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: 2163641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4C3553FDF1 for ; Tue, 19 Feb 2013 16:28:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7q1B-0005zZ-U4; Tue, 19 Feb 2013 16:26:09 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7pyj-0004IN-N3 for linux-arm-kernel@lists.infradead.org; Tue, 19 Feb 2013 16:23:39 +0000 Received: by mail-pa0-f41.google.com with SMTP id fb11so3501943pad.0 for ; Tue, 19 Feb 2013 08:23:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=o5IRok8TDBEXLwXCI3DdEAk/jEiuBqMw+Usu2Dg23Kw=; b=OuitMDP/WqwxErz9BsgbvreAllQ4RmmKShpANfKPeuZ2q/bjPlnmAJjDsIaSXO40e5 q/wPN/tDH7pMdb2JA2ceSqOJz6U8zrKmSBXBHieOh5UXov6jk4VnVH+lXVrm6yiNWLec V5VxlD4fT03Cvk+ST7Vu4tuSqTsqG/jOR19YqM1wqh7T/i/aTK50Rn3QtHzWm6bahfAU mK7I7MzKfwajVtiCy8pXxRQ1dvdZmjJlzPJE2LtU3cnUNw9RUdvJXrQcOzf/ThUVM1Wb UYnKqhJEjZzsULnX0JEMbPZi7bGDLKROXOcVVO4E030+xkvlHZ74hVCYR7djxNhSuUbn TFwA== 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 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: ALoCoQm5QW8jXW3643M9+2TBXEVVJl/8ahnG1A2hqxen5Vwbv4NvvyK0IUUjfGRwXJNbh9HqPo+f X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130219_112337_961434_5000AC9A X-CRM114-Status: GOOD ( 11.95 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.41 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Haojian Zhuang , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;