From patchwork Mon Feb 11 17:10:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14746 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 8EE2623DEA for ; Mon, 11 Feb 2013 17:11:44 +0000 (UTC) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by fiordland.canonical.com (Postfix) with ESMTP id 49D6AA196E1 for ; Mon, 11 Feb 2013 17:11:44 +0000 (UTC) Received: by mail-vb0-f50.google.com with SMTP id ft2so3862228vbb.37 for ; Mon, 11 Feb 2013 09:11:43 -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=Z5qXWYUxX6xfaopMTvS7HEoMpYvW/WazCypf5jjjCUQ=; b=ipPSCxTIzNItnDX1pCHZ2MH+Xi0V9AT0aFCVz68sSUkgSeY45HMS/O4SubBJJITkiq r+7nTWpNPae2viqXh+kPID3u+zU39QVaO91RKGA8Hy67Nc2M6HOLyiC5RUwKUiT6gHWa GHhwuAO3XkOACmZM7cj8XzC/t5sSjDIa4661vkBoVNDscZzkQbNUM+hKMOiQnDwgX9+Z VIPAl6eTqk4AMe5etNX5DFy8c/PpdoNx61YOy4pJPqwKGfpoW8WqNtwGOVd+vmpkSu4k ICTjj5PYlYplYv65Q9/g8xM5gnG7ReFINJUAb9uYvmyj9ZgoqfUQvPOYLTDX3wu0lG6y iPnw== X-Received: by 10.58.213.37 with SMTP id np5mr2174786vec.54.1360602702306; Mon, 11 Feb 2013 09:11:42 -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 zo8csp108004vec; Mon, 11 Feb 2013 09:11:41 -0800 (PST) X-Received: by 10.50.196.227 with SMTP id ip3mr12599086igc.97.1360602701234; Mon, 11 Feb 2013 09:11:41 -0800 (PST) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by mx.google.com with ESMTPS id or2si21236457igc.3.2013.02.11.09.11.40 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Feb 2013 09:11:41 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.48 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.220.48; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.48 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-pa0-f48.google.com with SMTP id hz10so3091394pad.35 for ; Mon, 11 Feb 2013 09:11:40 -0800 (PST) X-Received: by 10.66.88.164 with SMTP id bh4mr42650553pab.41.1360602700343; Mon, 11 Feb 2013 09:11:40 -0800 (PST) Received: from localhost.localdomain ([27.115.121.35]) by mx.google.com with ESMTPS id m3sm67935973pav.4.2013.02.11.09.11.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Feb 2013 09:11:39 -0800 (PST) From: Haojian Zhuang To: shiraz.hashim@st.com, shiraz.linux.kernel@gmail.com, linux@arm.linux.org.uk, tony@atomide.com, linux-arm-kernel@lists.infradead.org, swarren@nvidia.com, grant.likely@secretlab.ca, linus.walleij@linaro.org Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH v8 05/12] gpio: pl061: bind pinctrl by gpio request Date: Tue, 12 Feb 2013 01:10:52 +0800 Message-Id: <1360602659-4774-6-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360602659-4774-1-git-send-email-haojian.zhuang@linaro.org> References: <1360602659-4774-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQnAM48HZldCVgsZe8cW7gq/OhmU2k06Vy6hrmvuaDo1xEq5ZM5n7CPFAr+JlzQiXbqcWGAd Add the pl061_gpio_request() to request pinctrl. Create the logic between pl061 gpio driver and pinctrl (pinctrl-single) driver. While a gpio pin is requested, it will request pinctrl driver to set that pin with gpio function mode. So pinctrl driver should append .gpio_request_enable() in pinmux_ops. Signed-off-by: Haojian Zhuang --- drivers/gpio/gpio-pl061.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 1a6d05c..bc9b4b2 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -61,6 +62,17 @@ struct pl061_gpio { #endif }; +static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset) +{ + /* + * Map back to global GPIO space and request muxing, the direction + * parameter does not matter for this controller. + */ + int gpio = chip->base + offset; + + return pinctrl_request_gpio(gpio); +} + static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) { struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); @@ -252,6 +264,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&chip->lock); + chip->gc.request = pl061_gpio_request; chip->gc.direction_input = pl061_direction_input; chip->gc.direction_output = pl061_direction_output; chip->gc.get = pl061_get_value;