From patchwork Tue Feb 19 16:22:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14998 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9873023E24 for ; Tue, 19 Feb 2013 16:23:38 +0000 (UTC) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by fiordland.canonical.com (Postfix) with ESMTP id 4A84DA19070 for ; Tue, 19 Feb 2013 16:23:38 +0000 (UTC) Received: by mail-vc0-f171.google.com with SMTP id p1so4400437vcq.2 for ; Tue, 19 Feb 2013 08:23:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=o5IRok8TDBEXLwXCI3DdEAk/jEiuBqMw+Usu2Dg23Kw=; b=CQasFt4Tjp3HPbzeZS42aAYgxZmDqdGN2qkUqGtyHGGnZgpSRd8FpsCGV1ePgGyhzZ IigHKchIUE+5Wz5GZpsQrNaurCwBQSzZH2rEGDqUpZn98TUDPpGOzggCAXrJUu0JJxP+ Q2WW8uBqpExgAGGWJpr0u8lgFyBiG/CdsfMGZdE7ekqzkcRxEb6XQJuMHbytJ5yUFCBm Y+79xT1x9gv0c/Fr2XiF/XVyvvxpZYf3Pm3QH4v5iKzq9coZ1oQntcJ8ZnlGoOld2eJo Ep+BtEUw7XD09QD4PwnlVl9DyfSMZfX8F6Aoe9yVMiBbC4JrdnBseQ+H6dxoNECFzpEc /9ag== X-Received: by 10.58.188.48 with SMTP id fx16mr21994099vec.22.1361291017822; Tue, 19 Feb 2013 08:23:37 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp150720veb; Tue, 19 Feb 2013 08:23:37 -0800 (PST) X-Received: by 10.66.74.197 with SMTP id w5mr46870849pav.60.1361291016443; Tue, 19 Feb 2013 08:23:36 -0800 (PST) Received: from mail-da0-f43.google.com (mail-da0-f43.google.com [209.85.210.43]) by mx.google.com with ESMTPS id rz8si16963150pbc.357.2013.02.19.08.23.36 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Feb 2013 08:23:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) smtp.mail=haojian.zhuang@linaro.org Received: by mail-da0-f43.google.com with SMTP id u36so3009000dak.2 for ; Tue, 19 Feb 2013 08:23:36 -0800 (PST) X-Received: by 10.66.10.106 with SMTP id h10mr39714202pab.35.1361291016017; Tue, 19 Feb 2013 08:23:36 -0800 (PST) Received: from localhost.localdomain ([27.115.121.39]) by mx.google.com with ESMTPS id rn14sm18472714pbb.33.2013.02.19.08.23.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Feb 2013 08:23:35 -0800 (PST) From: Haojian Zhuang To: grinberg@compulab.co.il, linus.walleij@linaro.org, linux@arm.linux.org.uk, marek.vasut@gmail.com, robert.jarzmik@free.fr, daniel@caiaq.de, linux-arm-kernel@lists.infradead.org, grant.likely@secretlab.ca, cxie4@marvell.com Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH v4 10/11] gpio: pxa: bind to pinctrl by request Date: Wed, 20 Feb 2013 00:22:27 +0800 Message-Id: <1361290948-16669-11-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361290948-16669-1-git-send-email-haojian.zhuang@linaro.org> References: <1361290948-16669-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQnnNt9chqp0LOTyVWF9mrbn37Btl13ZnPR9AaLHw3m6Dxx5oWSAM+QLzDlOf/P8WAJ0q3EX While gpio pins is requested, request the pin of pinctrl driver first. Signed-off-by: Haojian Zhuang Tested-by: Igor Grinberg --- drivers/gpio/gpio-pxa.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 0f3a350..8cf7814 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -154,6 +155,23 @@ int pxa_irq_to_gpio(int irq) return irq - irq_base; } +static int pxa_gpio_request(struct gpio_chip *gc, unsigned offset) +{ + /* + * Map back to global GPIO space and request muxing, the direction + * parameter does not matter for this controller. + */ + int gpio = gc->base + offset; + + /* + * Platforms in ARCH_PXA doesn't move to device tree yet, + * and PINCTRL_SINGLE is depend on device tree. + */ + if (IS_ENABLED(CONFIG_PINCTRL_SINGLE)) + return pinctrl_request_gpio(gpio); + return 0; +} + static int pxa_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { void __iomem *base = gpio_chip_base(gc); @@ -258,6 +276,7 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end) gc->base = gpio; gc->label = chips[i].label; + gc->request = pxa_gpio_request; gc->direction_input = pxa_gpio_direction_input; gc->direction_output = pxa_gpio_direction_output; gc->get = pxa_gpio_get;