All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Baptiste Reynal <b.reynal@virtualopensystems.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Alexander Graf <agraf@suse.de>,
	Magnus Damm <magnus.damm@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	kvm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	qemu-devel@nongnu.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH/RFC 5/6] gpio: rcar: Add virtualization workarounds
Date: Fri,  9 Feb 2018 16:16:52 +0100	[thread overview]
Message-ID: <1518189413-2761-6-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1518189413-2761-1-git-send-email-geert+renesas@glider.be>

Allow to enable the driver if virtualization is enabled.

Handle the absence of clocks and interrupts, to support guests that
don't provide these yet.

Not-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be dropped once clocks and interrupts are supported on the guest.
---
 drivers/gpio/Kconfig     |  2 +-
 drivers/gpio/gpio-rcar.c | 28 ++++++++++++----------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d6a8e851ad13b8e6..50eeaa3bb0749b84 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -386,7 +386,7 @@ config GPIO_PXA
 
 config GPIO_RCAR
 	tristate "Renesas R-Car GPIO"
-	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on ARCH_RENESAS || VIRTIO_MMIO || COMPILE_TEST
 	select GPIOLIB_IRQCHIP
 	help
 	  Say yes here to support GPIO on Renesas R-Car SoCs.
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index e76de57dd617d7e2..bc205b7fbb30e892 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -442,22 +442,16 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 
 	p->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(p->clk)) {
-		if (p->needs_clk) {
-			dev_err(dev, "unable to get clock\n");
-			ret = PTR_ERR(p->clk);
-			goto err0;
-		}
+		if (p->needs_clk)
+			dev_warn(dev, "missing clock, ignoring\n");
 		p->clk = NULL;
 	}
 
 	pm_runtime_enable(dev);
 
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!irq) {
-		dev_err(dev, "missing IRQ\n");
-		ret = -EINVAL;
-		goto err0;
-	}
+	if (!irq)
+		dev_warn(dev, "missing IRQ, ignoring\n");
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	p->base = devm_ioremap_resource(dev, io);
@@ -502,12 +496,14 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 		goto err1;
 	}
 
-	p->irq_parent = irq->start;
-	if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
-			     IRQF_SHARED, name, p)) {
-		dev_err(dev, "failed to request IRQ\n");
-		ret = -ENOENT;
-		goto err1;
+	if (irq) {
+		p->irq_parent = irq->start;
+		if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
+				     IRQF_SHARED, name, p)) {
+			dev_err(dev, "failed to request IRQ\n");
+			ret = -ENOENT;
+			goto err1;
+		}
 	}
 
 	dev_info(dev, "driving %d GPIOs\n", npins);
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Baptiste Reynal <b.reynal@virtualopensystems.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Alexander Graf <agraf@suse.de>,
	Magnus Damm <magnus.damm@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	kvm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	qemu-devel@nongnu.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [Qemu-devel] [PATCH/RFC 5/6] gpio: rcar: Add virtualization workarounds
Date: Fri,  9 Feb 2018 16:16:52 +0100	[thread overview]
Message-ID: <1518189413-2761-6-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1518189413-2761-1-git-send-email-geert+renesas@glider.be>

Allow to enable the driver if virtualization is enabled.

Handle the absence of clocks and interrupts, to support guests that
don't provide these yet.

Not-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be dropped once clocks and interrupts are supported on the guest.
---
 drivers/gpio/Kconfig     |  2 +-
 drivers/gpio/gpio-rcar.c | 28 ++++++++++++----------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d6a8e851ad13b8e6..50eeaa3bb0749b84 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -386,7 +386,7 @@ config GPIO_PXA
 
 config GPIO_RCAR
 	tristate "Renesas R-Car GPIO"
-	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on ARCH_RENESAS || VIRTIO_MMIO || COMPILE_TEST
 	select GPIOLIB_IRQCHIP
 	help
 	  Say yes here to support GPIO on Renesas R-Car SoCs.
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index e76de57dd617d7e2..bc205b7fbb30e892 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -442,22 +442,16 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 
 	p->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(p->clk)) {
-		if (p->needs_clk) {
-			dev_err(dev, "unable to get clock\n");
-			ret = PTR_ERR(p->clk);
-			goto err0;
-		}
+		if (p->needs_clk)
+			dev_warn(dev, "missing clock, ignoring\n");
 		p->clk = NULL;
 	}
 
 	pm_runtime_enable(dev);
 
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!irq) {
-		dev_err(dev, "missing IRQ\n");
-		ret = -EINVAL;
-		goto err0;
-	}
+	if (!irq)
+		dev_warn(dev, "missing IRQ, ignoring\n");
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	p->base = devm_ioremap_resource(dev, io);
@@ -502,12 +496,14 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 		goto err1;
 	}
 
-	p->irq_parent = irq->start;
-	if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
-			     IRQF_SHARED, name, p)) {
-		dev_err(dev, "failed to request IRQ\n");
-		ret = -ENOENT;
-		goto err1;
+	if (irq) {
+		p->irq_parent = irq->start;
+		if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
+				     IRQF_SHARED, name, p)) {
+			dev_err(dev, "failed to request IRQ\n");
+			ret = -ENOENT;
+			goto err1;
+		}
 	}
 
 	dev_info(dev, "driving %d GPIOs\n", npins);
-- 
2.7.4

  parent reply	other threads:[~2018-02-09 15:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 15:16 [PATCH/RFC 0/6] R-Car Gen3 GPIO Pass-Through Prototype (Linux) Geert Uytterhoeven
2018-02-09 15:16 ` [Qemu-devel] " Geert Uytterhoeven
2018-02-09 15:16 ` [PATCH/RFC 1/6] vfio: platform: Allow runtime override of reset_required Geert Uytterhoeven
2018-02-09 15:16   ` [Qemu-devel] " Geert Uytterhoeven
2018-02-09 15:16 ` [PATCH/RFC 2/6] vfio: Ignore real IOMMUs if CONFIG_VFIO_NOIOMMU=y Geert Uytterhoeven
2018-02-09 15:16   ` [Qemu-devel] " Geert Uytterhoeven
2018-02-09 15:16 ` [PATCH/RFC 3/6] clk: renesas: r8a7795: Mark the GPIO6 clock critical Geert Uytterhoeven
2018-02-09 15:16   ` [Qemu-devel] " Geert Uytterhoeven
2018-02-09 15:16 ` [PATCH/RFC 4/6] arm64: renesas_defconfig: Enable VFIO_PLATFORM and VFIO_NOIOMMU Geert Uytterhoeven
2018-02-09 15:16   ` [Qemu-devel] " Geert Uytterhoeven
2018-02-09 15:16 ` Geert Uytterhoeven [this message]
2018-02-09 15:16   ` [Qemu-devel] [PATCH/RFC 5/6] gpio: rcar: Add virtualization workarounds Geert Uytterhoeven
2018-02-09 15:16 ` [PATCH/RFC 6/6] arm64: Add virt_defconfig Geert Uytterhoeven
2018-02-09 15:16   ` [Qemu-devel] " Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518189413-2761-6-git-send-email-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=arnd@arndb.de \
    --cc=b.reynal@virtualopensystems.com \
    --cc=kvm@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.