From patchwork Sun Feb 3 10:15:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14442 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 3C7D323F94 for ; Sun, 3 Feb 2013 10:18:25 +0000 (UTC) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by fiordland.canonical.com (Postfix) with ESMTP id E6E80A19678 for ; Sun, 3 Feb 2013 10:18:24 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id l6so3310177vcl.31 for ; Sun, 03 Feb 2013 02:18:24 -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=DlM2/gOa++xXeK03mOV3FL0KvWGCO9fSraR8Ycp5WUS1bIxTtgJUo9kg9ZwIenECIj YyclIktN22RhCQwTCz7TPtZfPgWHfH/W1N9dtOquh4RV8LgkeKl2/5txYLNVRdB3dGQl RNiyKs3ZZ+U/6KMmsHSRWuH7ulRPoqcSwV2SDyde0f1O6rqrdYqb91G9DRCAThtT7Qcy BMVr5nxcimVWo92uN5lwGcKfaD/a3cXKK0103TMgulze9Cd2RyYx0LgWjin6RPM5DfEv 7yyn9aP+dwErriRiDIRG7gGqXa8dwuqglB1EcIvZNTLX7d1llaTWExPIPtXzSICKAZoq brzA== X-Received: by 10.220.153.143 with SMTP id k15mr17285541vcw.33.1359886704409; Sun, 03 Feb 2013 02:18:24 -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.252.8 with SMTP id zo8csp40421vec; Sun, 3 Feb 2013 02:18:24 -0800 (PST) X-Received: by 10.66.80.70 with SMTP id p6mr43366202pax.23.1359886703511; Sun, 03 Feb 2013 02:18:23 -0800 (PST) Received: from mail-da0-f51.google.com (mail-da0-f51.google.com [209.85.210.51]) by mx.google.com with ESMTPS id d3si13124835paw.302.2013.02.03.02.18.23 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 02:18:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.51 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.51 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-f51.google.com with SMTP id i30so2254699dad.38 for ; Sun, 03 Feb 2013 02:18:23 -0800 (PST) X-Received: by 10.68.134.130 with SMTP id pk2mr46523259pbb.125.1359886703107; Sun, 03 Feb 2013 02:18:23 -0800 (PST) Received: from haojian-E6230.domain ([67.198.145.34]) by mx.google.com with ESMTPS id ov4sm14344348pbb.45.2013.02.03.02.18.13 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 02:18:22 -0800 (PST) From: Haojian Zhuang To: linux@arm.linux.org.uk, marek.vasut@gmail.com, robert.jarzmik@free.fr, daniel@caiaq.de, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, grant.likely@secretlab.ca, cxie4@marvell.com, grinberg@compulab.co.il Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH v2 09/10] gpio: pxa: bind to pinctrl by request Date: Sun, 3 Feb 2013 18:15:50 +0800 Message-Id: <1359886551-20950-10-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359886551-20950-1-git-send-email-haojian.zhuang@linaro.org> References: <1359886551-20950-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQn4vq5a3j90aX4za1xSOMVcETq0IjLWi8Xyb1+hKYJQxAvbf9S0L9735HUE17ERhydij7Pz 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 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;