From patchwork Fri May 31 09:18:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-fa0-f72.google.com (mail-fa0-f72.google.com [209.85.161.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2CCDA25CAB for ; Fri, 31 May 2013 09:21:04 +0000 (UTC) Received: by mail-fa0-f72.google.com with SMTP id v1sf1295959fav.11 for ; Fri, 31 May 2013 02:21:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :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=/vAN++gXJmlym3UCz6tgV24ZC1lVhj/799BiT/ugvfY=; b=Ih+DHk/8Rm3sRhmpVbMnTTffj2/0QvS3g0o+7tmRIs2CYnmfB2HYiM6K7M4aJCQq3r cGhGlAfNZ7LQsdJGpnzNr0trPVkLBVc3ZVKjEAieB0ppONM3jxdbqOFcITTG10zA03hM uI1hSZG+kwmgjXEh2u8TI3l+yb+LV1rRYyOXvt2zdt70JjiAKmGuXq5sZ4dQ6uoxvbvp 26IU8Er3EoGRDIK/ki0JGM1m/AoEeCnW7ZdSA2LiRm64GWSvW+G4eHEjOC4KgFIp+Gst tMNb/j9iI/ZFTNz1lz/BeNVOBPzTXRaaFw4wKvZPVXaF2QkCuqmQ4br/88s6F3Hy1k24 7LcA== X-Received: by 10.180.206.107 with SMTP id ln11mr1129222wic.7.1369992063361; Fri, 31 May 2013 02:21:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.183.237 with SMTP id ep13ls175571wic.2.gmail; Fri, 31 May 2013 02:21:03 -0700 (PDT) X-Received: by 10.194.61.140 with SMTP id p12mr8454223wjr.51.1369992063283; Fri, 31 May 2013 02:21:03 -0700 (PDT) Received: from mail-ve0-x22d.google.com (mail-ve0-x22d.google.com [2607:f8b0:400c:c01::22d]) by mx.google.com with ESMTPS id gw5si1182236wib.56.2013.05.31.02.21.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 May 2013 02:21:03 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22d 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:c01::22d; Received: by mail-ve0-f173.google.com with SMTP id jw11so952276veb.18 for ; Fri, 31 May 2013 02:21:02 -0700 (PDT) X-Received: by 10.52.34.114 with SMTP id y18mr7929565vdi.56.1369992062207; Fri, 31 May 2013 02:21:02 -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.220.229.199 with SMTP id jj7csp42418vcb; Fri, 31 May 2013 02:21:01 -0700 (PDT) X-Received: by 10.14.111.129 with SMTP id w1mr13005221eeg.13.1369992061043; Fri, 31 May 2013 02:21:01 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id v46si30084166een.47.2013.05.31.02.19.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 May 2013 02:21:01 -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-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKUahrMsaHu3EFzSI+Ex5bGoXejjZPgWx8@postini.com; Fri, 31 May 2013 09:21:00 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 3C162E6; Fri, 31 May 2013 09:19:42 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 440C916AF; Fri, 31 May 2013 09:19:42 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 4788E24C07C; Fri, 31 May 2013 11:19:36 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 31 May 2013 11:19:41 +0200 From: Linus Walleij To: Cc: Arnd Bergmann , Linus Walleij Subject: [PATCH 04/39] pinctrl: coh901: add device tree support Date: Fri, 31 May 2013 11:18:39 +0200 Message-ID: <1369991954-17406-5-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1369991954-17406-1-git-send-email-linus.walleij@stericsson.com> References: <1369991954-17406-1-git-send-email-linus.walleij@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlLw8pwzqKzfONauZ4KfkdBGgsapXcGxTon7qOuvHrAHDBqE+827n4GuvES28CUYPWpnI3X X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22d 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 edde3ac..d4f8afd 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -773,8 +773,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); @@ -811,6 +810,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); @@ -864,9 +866,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), };