From patchwork Fri Feb 9 15:16:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 871513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zdN6n6LM1z9s7M for ; Sat, 10 Feb 2018 04:56:49 +1100 (AEDT) Received: from localhost ([::1]:50190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekCum-0000Ky-0O for incoming@patchwork.ozlabs.org; Fri, 09 Feb 2018 12:56:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekBDa-0007M5-7J for qemu-devel@nongnu.org; Fri, 09 Feb 2018 11:08:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekBDW-0001Ee-Vf for qemu-devel@nongnu.org; Fri, 09 Feb 2018 11:08:06 -0500 Received: from leibniz.telenet-ops.be ([2a02:1800:110:4::f00:d]:33980) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ekBDW-0001DH-K3 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 11:08:02 -0500 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by leibniz.telenet-ops.be (Postfix) with ESMTPS id 3zdJvz3csyzMqc1P for ; Fri, 9 Feb 2018 16:32:15 +0100 (CET) Received: from ayla.of.borg ([84.194.111.163]) by albert.telenet-ops.be with bizsmtp id 8fH71x01w3XaVaC06fH7lk; Fri, 09 Feb 2018 16:17:10 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1ekAQF-0003RQ-Ff; Fri, 09 Feb 2018 16:17:07 +0100 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1ekAQF-0000jo-Ag; Fri, 09 Feb 2018 16:17:07 +0100 From: Geert Uytterhoeven To: Baptiste Reynal , Alex Williamson Date: Fri, 9 Feb 2018 16:16:52 +0100 Message-Id: <1518189413-2761-6-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518189413-2761-1-git-send-email-geert+renesas@glider.be> References: <1518189413-2761-1-git-send-email-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:1800:110:4::f00:d X-Mailman-Approved-At: Fri, 09 Feb 2018 12:38:16 -0500 Subject: [Qemu-devel] [PATCH/RFC 5/6] gpio: rcar: Add virtualization workarounds X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , kvm@vger.kernel.org, Magnus Damm , Alexander Graf , qemu-devel@nongnu.org, linux-renesas-soc@vger.kernel.org, Wolfram Sang , Laurent Pinchart , Geert Uytterhoeven Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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);