From patchwork Fri Apr 26 13:56:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 16436 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C6972397A for ; Fri, 26 Apr 2013 13:58:17 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r11sf6411712ghr.1 for ; Fri, 26 Apr 2013 06:57:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:mime-version :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=vo0uKSiBr4Phzw/q61AsgxuFpOO1hBhJ6Mf0R1hsmQI=; b=CFIrRgX34QT6mqlJab244SQy/mWERQMsUp6nLx1x7V1y+9rr1B3+EW9u3Q7SVoiNiL tB0a0a1lduEKOKkATlm/Zo3U2Nqx/F0wWxJFPBWAVthcmU+vhQHRZWHu/YM23sH4yr65 NTnUpMmAUdnP9XbdHHBQVs3KKy2IImhazETWSI3lsg9cvTuX3NhSoFnHsi+24vF3Ear7 7eSybA0zx7njfPHa/JuyhckNc7nd+h4vQ7r7Vj+YqG5mxFMA8wpAc98XW2C+bVDwMp+e lVCZuBKqpAqJD63wA4u0Y76+KhfzGH+82AwWYGG9Vy64ybic+WYuotXoj3sR9WF8tkyp Z4Gg== X-Received: by 10.236.115.170 with SMTP id e30mr22736839yhh.7.1366984641477; Fri, 26 Apr 2013 06:57:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.42.106 with SMTP id n10ls335003qel.90.gmail; Fri, 26 Apr 2013 06:57:21 -0700 (PDT) X-Received: by 10.58.132.232 with SMTP id ox8mr29087088veb.45.1366984641167; Fri, 26 Apr 2013 06:57:21 -0700 (PDT) Received: from mail-vb0-x232.google.com (mail-vb0-x232.google.com [2607:f8b0:400c:c02::232]) by mx.google.com with ESMTPS id sa4si5371077vdc.127.2013.04.26.06.57.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 06:57:20 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::232; Received: by mail-vb0-f50.google.com with SMTP id w16so3625150vbb.9 for ; Fri, 26 Apr 2013 06:57:20 -0700 (PDT) X-Received: by 10.58.181.201 with SMTP id dy9mr29227790vec.34.1366984640669; Fri, 26 Apr 2013 06:57:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp70362veb; Fri, 26 Apr 2013 06:57:19 -0700 (PDT) X-Received: by 10.14.87.199 with SMTP id y47mr88361849eee.17.1366984638867; Fri, 26 Apr 2013 06:57:18 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id b4si17232804eef.12.2013.04.26.06.57.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Apr 2013 06:57:18 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.143; Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKUXqHr3fts+0ks0BRbiXxlOli5BFNW/SL@postini.com; Fri, 26 Apr 2013 13:57:18 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4E2A7182; Fri, 26 Apr 2013 13:56:48 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 21E744E4F; Fri, 26 Apr 2013 13:56:42 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id EBE58A8093; Fri, 26 Apr 2013 15:56:41 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 26 Apr 2013 15:56:47 +0200 From: Linus Walleij To: , Arnd Bergmann Cc: , Linus Walleij Subject: [PATCH 05/23 v2] pinctrl: coh901: add device tree support Date: Fri, 26 Apr 2013 15:56:45 +0200 Message-ID: <1366984605-23951-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkT3qmMVHMG5OBggJ9rQtzV5Q+zrk6zLOjFV6mExTd1xVxhdIkI5ISfSPgLmCpivSelJ8cr X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij This makes it possible to probe the COH901 pinctrl driver from the device tree, and assigned the device tree node in the gpio_chip so we can look up cross-references from the device tree. Start grabbing the per-port (bank) IRQs by index instead of by name so we don't have to look up the IRQs by name going forward. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Alter the driver to look up IRQ by index. - Alter the bindings accordingly. --- .../devicetree/bindings/gpio/gpio-stericsson-coh901.txt | 7 +++++++ drivers/pinctrl/pinctrl-coh901.c | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt diff --git a/Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt b/Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt new file mode 100644 index 0000000..fd665b4 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-stericsson-coh901.txt @@ -0,0 +1,7 @@ +ST-Ericsson COH 901 571/3 GPIO controller + +Required properties: +- compatible: Compatible property value should be "stericsson,gpio-coh901" +- reg: Physical base address of the controller and length of memory mapped + region. +- interrupts: the 0...n interrupts assigned to the different GPIO ports/banks. diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index 8b7e7bc..4152ca2 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -770,8 +770,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev) port->number = portno; port->gpio = gpio; - port->irq = platform_get_irq_byname(pdev, - port->name); + port->irq = platform_get_irq(pdev, portno); dev_dbg(gpio->dev, "register IRQ %d for port %s\n", port->irq, port->name); @@ -808,6 +807,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev) } dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno); +#ifdef CONFIG_OF_GPIO + gpio->chip.of_node = pdev->dev.of_node; +#endif err = gpiochip_add(&gpio->chip); if (err) { dev_err(gpio->dev, "unable to add gpiochip: %d\n", err); @@ -861,9 +863,15 @@ static int __exit u300_gpio_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id u300_gpio_match[] = { + { .compatible = "stericsson,gpio-coh901" }, + {}, +}; + static struct platform_driver u300_gpio_driver = { .driver = { .name = "u300-gpio", + .of_match_table = u300_gpio_match, }, .remove = __exit_p(u300_gpio_remove), };