From patchwork Mon Feb 18 05:12:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14959 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 6CA5E23E0D for ; Mon, 18 Feb 2013 05:14:12 +0000 (UTC) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by fiordland.canonical.com (Postfix) with ESMTP id 29D22A1852D for ; Mon, 18 Feb 2013 05:14:12 +0000 (UTC) Received: by mail-vc0-f175.google.com with SMTP id fw7so3347440vcb.6 for ; Sun, 17 Feb 2013 21:14:11 -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=/OU/pJTHXVnWW2WNnYqnuN8jGM3h1QZtUtrkl9IIwy8=; b=n4xA19Fyqhu6+g7BHi38XYcsv83GMJWi6LYQMqvm1Idk0D99fCpmP+pzRzoT7RQ8bQ O9KzqV8R0dmDrOxk8NzKRj6c3JIFShO9Xs3iCCaoMn24LhU8cHaxBYogaQEdCyFKdUrN JxXPdyfZfMGnkjwZsSkgpxI1UWE2jx0GrGjlK/7wTcBAiOyXLR07kRTrK+g7oFCtMGSd hmCbEaDu+bfSgnA63gX1hbC3x/DZthLJExpxayUBF3qBAGkj62J2LPWc0TAg59lTdTOC ighp6y1TnCHpd4y+pCwMcyNDBbd2Wsz/e6wLS2XHoV/6Yb8leJl6ZwQH9Y+Y7S7TdL+j KRiQ== X-Received: by 10.58.247.132 with SMTP id ye4mr14508098vec.9.1361164451691; Sun, 17 Feb 2013 21:14:11 -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 st5csp72449veb; Sun, 17 Feb 2013 21:14:11 -0800 (PST) X-Received: by 10.68.24.33 with SMTP id r1mr26132411pbf.139.1361164450818; Sun, 17 Feb 2013 21:14:10 -0800 (PST) Received: from mail-da0-f47.google.com (mail-da0-f47.google.com [209.85.210.47]) by mx.google.com with ESMTPS id n2si4189293paz.143.2013.02.17.21.14.10 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 21:14:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.47 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.47; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.47 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-f47.google.com with SMTP id s35so2333022dak.34 for ; Sun, 17 Feb 2013 21:14:10 -0800 (PST) X-Received: by 10.68.213.7 with SMTP id no7mr26578201pbc.48.1361164450429; Sun, 17 Feb 2013 21:14:10 -0800 (PST) Received: from localhost.localdomain ([140.206.155.71]) by mx.google.com with ESMTPS id ni3sm13194880pbc.31.2013.02.17.21.14.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 21:14:09 -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 v3 09/12] gpio: pxa: bind to pinctrl by request Date: Mon, 18 Feb 2013 13:12:35 +0800 Message-Id: <1361164358-5845-10-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361164358-5845-1-git-send-email-haojian.zhuang@linaro.org> References: <1361164358-5845-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQlLZEZGhGVa1QaixBsqmXae3wIogNod26r3wFW1Jj2w6KFP12IJ7Xn9EX2jEXycuoehSQJR While gpio pins is requested, request the pin of pinctrl driver first. Signed-off-by: Haojian Zhuang Acked-by: Linus Walleij --- 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 5c39db3..c9cc636 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -159,6 +160,23 @@ int pxa_irq_to_gpio(struct irq_data *d) return gpio; } +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) { struct pxa_gpio_chip *chip = NULL; @@ -471,6 +489,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;