From patchwork Sat Apr 13 04:21:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2440101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id F31C5DFB78 for ; Sat, 13 Apr 2013 09:03:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQwMr-0007Bo-6W; Sat, 13 Apr 2013 09:03:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQryY-00008Z-Q1; Sat, 13 Apr 2013 04:22:06 +0000 Received: from smtp53.i.mail.ru ([94.100.177.113]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQryV-000082-5b for linux-arm-kernel@lists.infradead.org; Sat, 13 Apr 2013 04:22:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Vnh1RmpWnupbWAKECNxQaTcYZagOk/lQ35TX+gTwrvI=; b=iA6eaVuxtZDxLFPsR3eU+hVbwXVsZhe0utJOvMrvL9vVFWN6Y1YqPR1bMtZZF7dSP7WH+o3QGfZrft39wrSJjvUzRvUV5Udiwjcd95oV/ovsxxF4nUMExSk/p6PbsYmtLGLs8mGytIpkoV+poMBmJ+H9EJaMD3mX6cojt7/0mbU=; Received: from [188.134.40.128] (port=40228 helo=shc.zet) by smtp53.i.mail.ru with esmtpa (envelope-from ) id 1UQryR-0003wq-FQ; Sat, 13 Apr 2013 08:21:59 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] GPIO: clps711x: Add DT support Date: Sat, 13 Apr 2013 08:21:40 +0400 Message-Id: <1365826900-30136-2-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1365826900-30136-1-git-send-email-shc_work@mail.ru> References: <1365826900-30136-1-git-send-email-shc_work@mail.ru> X-Spam: Not detected X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130413_002203_692837_BC306601 X-CRM114-Status: GOOD ( 14.18 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Alexander Shiyan , Arnd Bergmann , devicetree-discuss@lists.ozlabs.org, Rob Herring , Grant Likely , Olof Johansson , Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add DT support to the CLPS711X GPIO driver. Signed-off-by: Alexander Shiyan --- .../devicetree/bindings/gpio/clps711x-gpio.txt | 28 ++++++++++++++++++++++ drivers/gpio/gpio-clps711x.c | 14 ++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/clps711x-gpio.txt diff --git a/Documentation/devicetree/bindings/gpio/clps711x-gpio.txt b/Documentation/devicetree/bindings/gpio/clps711x-gpio.txt new file mode 100644 index 0000000..0fe2bb6 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/clps711x-gpio.txt @@ -0,0 +1,28 @@ +Cirrus Logic CLPS711X GPIO controller + +Required properties: +- compatible : Should be "cirrus,clps711x-gpio" +- reg : Physical base GPIO controller registers location and length. + There should be two registers, first is DATA register, the second + is DIRECTION. +- gpio-controller : Marks the device node as a gpio controller. +- #gpio-cells : Should be two. The first cell is the pin number and + the second cell is used to specify the gpio polarity: + 0 = active high + 1 = active low + +Note: Each GPIO port should have an alias correctly numbered in "aliases" +node. + +Example: + +aliases { + gpio0 = &porta; +}; + +porta: gpio@80000000 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000000 0x1>, <0x80000040 0x1>; + gpio-controller; + #gpio-cells = <2>; +}; diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-clps711x.c index 3c71815..e2e7ec9 100644 --- a/drivers/gpio/gpio-clps711x.c +++ b/drivers/gpio/gpio-clps711x.c @@ -16,10 +16,11 @@ static int clps711x_gpio_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; void __iomem *dat, *dir; struct bgpio_chip *bgc; struct resource *res; - int err, id = pdev->id; + int err, id = np ? of_alias_get_id(np, "gpio") : pdev->id; if ((id < 0) || (id > 4)) return -ENODEV; @@ -76,10 +77,17 @@ static int clps711x_gpio_remove(struct platform_device *pdev) return bgpio_remove(bgc); } +static const struct of_device_id clps711x_gpio_ids[] = { + { .compatible = "cirrus,clps711x-gpio" }, + { }, +}; +MODULE_DEVICE_TABLE(of, clps711x_gpio_ids); + static struct platform_driver clps711x_gpio_driver = { .driver = { - .name = "clps711x-gpio", - .owner = THIS_MODULE, + .name = "clps711x-gpio", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(clps711x_gpio_ids), }, .probe = clps711x_gpio_probe, .remove = clps711x_gpio_remove,