From patchwork Sun Feb 17 11:42:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14934 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 7D3FE23E1A for ; Sun, 17 Feb 2013 11:44:35 +0000 (UTC) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by fiordland.canonical.com (Postfix) with ESMTP id 3966EA18D32 for ; Sun, 17 Feb 2013 11:44:35 +0000 (UTC) Received: by mail-ve0-f170.google.com with SMTP id 14so4151812vea.1 for ; Sun, 17 Feb 2013 03:44:34 -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=ZisGietpr88qGn/lwH+JBwQeJ77OTHwXIk7wfjFBIMU=; b=oxv/+eiqqzcAw1Fm/YhxDcKmQBcBcGO+z8ty88L5Xgd6UxvYL8BlJCRzr03RKZ5Zqo q5XhhLPAiZcJsW11zeTg4g0t/1LyNsz8fp18np+89gnNBlW0M9vUnXr2COJkWno6Sh+D n7WkfML+2WeGXnapBuzldfBLXwN1CBw6k9Nt8Cqgl/B5WWv4n3TeJLmYcimaPvKy2XXE fTVAGTxmKpXmo8XEs0mHoNW252kZRn7nW8lgdJ3UhFYCFmMVU4DVTOTayWa6iKq1aYm8 2BUqIPzoWH6aUbMzA5cnYJZ1zy8vye8dDo9KmIlkndTZzdA4BwwSeLQgYzV91DAC0jeB CypA== X-Received: by 10.52.177.163 with SMTP id cr3mr9649189vdc.94.1361101474698; Sun, 17 Feb 2013 03:44:34 -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 st5csp43089veb; Sun, 17 Feb 2013 03:44:34 -0800 (PST) X-Received: by 10.68.216.7 with SMTP id om7mr20697162pbc.149.1361101473707; Sun, 17 Feb 2013 03:44:33 -0800 (PST) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by mx.google.com with ESMTPS id b7si17193366paz.245.2013.02.17.03.44.33 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 03:44:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.52 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.160.52; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.52 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-pb0-f52.google.com with SMTP id ma3so1231814pbc.39 for ; Sun, 17 Feb 2013 03:44:33 -0800 (PST) X-Received: by 10.68.135.3 with SMTP id po3mr21173544pbb.33.1361101473310; Sun, 17 Feb 2013 03:44:33 -0800 (PST) Received: from localhost.localdomain ([67.198.145.34]) by mx.google.com with ESMTPS id hp7sm10927800pbc.8.2013.02.17.03.44.28 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 03:44:32 -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 v9 05/10] gpio: pl061: bind pinctrl by gpio request Date: Sun, 17 Feb 2013 19:42:51 +0800 Message-Id: <1361101376-3783-6-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361101376-3783-1-git-send-email-haojian.zhuang@linaro.org> References: <1361101376-3783-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQnD5AG3Mwpbcy6HlU4PX3TLSyItH48aTFq9si8S7URvcvJQcDwyx+I4/ZnP8KrhEe//6J5W 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 d1d6035..06ed257 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,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); @@ -274,6 +286,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;