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: 10209443 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1715F602D8 for ; Fri, 9 Feb 2018 15:17:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0733429604 for ; Fri, 9 Feb 2018 15:17:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F057F2976B; Fri, 9 Feb 2018 15:17:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A618D29604 for ; Fri, 9 Feb 2018 15:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751179AbeBIPRc (ORCPT ); Fri, 9 Feb 2018 10:17:32 -0500 Received: from albert.telenet-ops.be ([195.130.137.90]:52460 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089AbeBIPRM (ORCPT ); Fri, 9 Feb 2018 10:17:12 -0500 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 Cc: Arnd Bergmann , Alexander Graf , Magnus Damm , Laurent Pinchart , Wolfram Sang , kvm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, qemu-devel@nongnu.org, Geert Uytterhoeven Subject: [PATCH/RFC 5/6] gpio: rcar: Add virtualization workarounds 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> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);