From patchwork Mon Feb 25 03:49:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 15056 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 CE0C723E27 for ; Mon, 25 Feb 2013 03:51:52 +0000 (UTC) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by fiordland.canonical.com (Postfix) with ESMTP id 92CC3A18145 for ; Mon, 25 Feb 2013 03:51:52 +0000 (UTC) Received: by mail-vb0-f51.google.com with SMTP id fq11so1492077vbb.10 for ; Sun, 24 Feb 2013 19:51:52 -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=jh0ZCpHrU072rSkVV2ct7UswjtSWGjITG3G2dXh+U2Q=; b=hg7AOqwCLY48BEuZxfQuPHpECVZodAEJqOe1qpgQSMcRPnmDzfJ8ZYPkz9l4EHwuel e6G1QIgXB4sjw8OCvC9Od2cTB1r8/P0m3cKCvdSo348lOHwnDAfZNvLakE6ZIUp04hRY QDqIDMB9X4VvEAI6iqLMMDCrc67mVhI2DEFFMqnKHBbRsC6925KhFSjK8T5/jGis2GGA Yu4TF5SV/Q5ZkgDIJQIKp9G5vUCohPizBRtOqJeTcuD5o7iLTQ1G/DXo1yLDKzILOb0R S6z2LjYSL01rRDf4LIqkBxBNYkughCH6UHJU1rjGJDYkgSd/ZyCxBNI/LXxfj3cHx7Mf qgYw== X-Received: by 10.58.48.166 with SMTP id m6mr242790ven.59.1361764312079; Sun, 24 Feb 2013 19:51:52 -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 st5csp39578veb; Sun, 24 Feb 2013 19:51:51 -0800 (PST) X-Received: by 10.68.170.97 with SMTP id al1mr3703087pbc.210.1361764310987; Sun, 24 Feb 2013 19:51:50 -0800 (PST) Received: from mail-da0-f44.google.com (mail-da0-f44.google.com [209.85.210.44]) by mx.google.com with ESMTPS id tm7si10380354pbc.330.2013.02.24.19.51.50 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Feb 2013 19:51:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.44 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.44 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-f44.google.com with SMTP id z20so1264880dae.17 for ; Sun, 24 Feb 2013 19:51:50 -0800 (PST) X-Received: by 10.68.197.168 with SMTP id iv8mr15616175pbc.114.1361764310618; Sun, 24 Feb 2013 19:51:50 -0800 (PST) Received: from localhost.localdomain ([67.198.145.34]) by mx.google.com with ESMTPS id b9sm11188695pba.6.2013.02.24.19.51.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Feb 2013 19:51:49 -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 v5 11/12] gpio: pxa: bind to pinctrl by request Date: Mon, 25 Feb 2013 11:49:40 +0800 Message-Id: <1361764181-26647-12-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361764181-26647-1-git-send-email-haojian.zhuang@linaro.org> References: <1361764181-26647-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQk5l0TFzc72qOzT1enuWPzKWPTGMa1wDc9auFe9rKyloAyqAG5tnG/5cTmxAuvv43NnMf11 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 91f4881..f2f7737 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;