From patchwork Fri Jan 4 16:13:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1933691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4853B3FDDA for ; Fri, 4 Jan 2013 16:16:45 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tr9u8-0007gW-2a; Fri, 04 Jan 2013 16:13:56 +0000 Received: from eu1sys200aog102.obsmtp.com ([207.126.144.113]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tr9tz-0007dA-FK for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2013 16:13:48 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUOb/tFOtcIroQv5C7FJ9n3N6yeY/YyQJ@postini.com; Fri, 04 Jan 2013 16:13:47 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 8C46815D; Fri, 4 Jan 2013 16:13:34 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 12C394D7D; Fri, 4 Jan 2013 16:13:34 +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 8C790A807B; Fri, 4 Jan 2013 17:13:27 +0100 (CET) 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.83.0; Fri, 4 Jan 2013 17:13:33 +0100 From: Linus Walleij To: , Subject: [PATCH] pinctrl/nomadik: Add "ste,config" property Date: Fri, 4 Jan 2013 17:13:30 +0100 Message-ID: <1357316010-677-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130104_111347_899537_A804CE0F X-CRM114-Status: GOOD ( 19.46 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.113 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Anmar Oueja , Gabriel Fernandez , Linus Walleij , Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Gabriel Fernandez The "ste,config" property will contain the pin config node. It will be easier to define a pin configuration and use it by reference without duplicating lines tedious. Signed-off-by: Gabriel Fernandez Signed-off-by: Linus Walleij --- This is made as an add-on patch to the first device-tree patch instead of respinning it for ease-of-review. We may squash it in the end if this approach is OK. --- .../devicetree/bindings/pinctrl/ste,nomadik.txt | 56 +++++++++++++++------- drivers/pinctrl/pinctrl-nomadik.c | 24 ++++++---- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt b/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt index 8639234..8ee860c 100644 --- a/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt +++ b/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt @@ -26,11 +26,12 @@ Optional subnode-properties: - ste,function: A string containing the name of the function to mux to the pin or group. -- ste,input : <0/1/2/3> +- ste,config: Handle of pin configuration node (ste,config = <&in_pu>) + +- ste,input : <0/1/2> 0: input with no pull 1: input with pull up, 2: input with pull down, - 3: input and keep last input configuration (no pull, pull up or pull down). - ste,output: <0/1/2> 0: output low, @@ -41,10 +42,11 @@ Optional subnode-properties: 0: sleep mode disable, 1: sleep mode enable. -- ste,sleep-input: <0/1/2> +- ste,sleep-input: <0/1/2/3> 0: sleep input with no pull, 1: sleep input with pull up, 2: sleep input with pull down. + 3: sleep input and keep last input configuration (no pull, pull up or pull down). - ste,sleep-output: <0/1/2> 0: sleep output low, @@ -65,12 +67,39 @@ Optional subnode-properties: Example board file extract: + in_pu: input_pull_up { + ste,input = <1>; + }; + + out_hi: output_high { + ste,output = <1>; + }; + + slpm_in_wkup_pdis: slpm_in_wkup_pdis { + ste,sleep = <1>; + ste,sleep-input = <3>; + ste,sleep-wakeup = <1>; + ste,sleep-pull-disable = <0>; + }; + + slpm_out_hi_wkup_pdis: slpm_out_hi_wkup_pdis { + ste,sleep = <1>; + ste,sleep-output = <1>; + ste,sleep-wakeup = <1>; + ste,sleep-pull-disable = <0>; + }; + slpm_out_wkup_pdis: slpm_out_wkup_pdis { + ste,sleep = <1>; + ste,sleep-output = <2>; + ste,sleep-wakeup = <1>; + ste,sleep-pull-disable = <0>; + }; + pinctrl@80157000 { compatible = "stericsson,nmk-pinctrl"; reg = <0x80157000 0x2000>; pinctrl-names = "default"; - pinctrl-0 = <&uart0_default_mode>; uart0 { uart0_default_mux: uart0_mux { @@ -82,35 +111,26 @@ Example board file extract: uart0_default_mode: uart0_default { uart0_default_cfg1 { ste,pins = "GPIO0", "GPIO2"; - ste,input = <1>; + ste,config = <&in_pu>; }; uart0_default_cfg2 { ste,pins = "GPIO1", "GPIO3"; - ste,output = <1>; + ste,config = <&out_hi>; }; }; uart0_sleep_mode: uart0_sleep { uart0_sleep_cfg1 { ste,pins = "GPIO0", "GPIO2"; - ste,sleep = <0>; - ste,sleep-input = <0>; - ste,sleep-wakeup = <1>; - ste,sleep-pull-disable = <0>; + ste,config = <&slpm_in_wkup_pdis>; }; uart0_sleep_cfg2 { ste,pins = "GPIO1"; - ste,sleep = <0>; - ste,sleep-output = <1>; - ste,sleep-wakeup = <1>; - ste,sleep-pull-disable = <0>; + ste,config = <&slpm_out_hi_wkup_pdis>; }; uart0_sleep_cfg3 { ste,pins = "GPIO3"; - ste,sleep = <0>; - ste,sleep-output = <2>; - ste,sleep-wakeup = <1>; - ste,sleep-pull-disable = <0>; + ste,config = <&slpm_out_wkup_pdis>; }; }; }; diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index b508bd7..0355786 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -1691,23 +1691,29 @@ int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, unsigned reserve = 0; struct property *prop; const char *group, *gpio_name; + struct device_node *np_config; ret = of_property_read_string(np, "ste,function", &function); if (ret >= 0) reserve = 1; - for (i = 0; i < ARRAY_SIZE(nmk_cfg_params); i++) { - unsigned long cfg = 0; - int val; - - ret = of_property_read_u32(np, nmk_cfg_params[i].property, &val); - if (ret != -EINVAL) { - if (nmk_dt_pin_config(i, val, &cfg) == 0) { - configs |= cfg; - has_config = 1; + np_config = of_parse_phandle(np, "ste,config", 0); + if (np_config) { + for (i = 0; i < ARRAY_SIZE(nmk_cfg_params); i++) { + unsigned long cfg = 0; + int val; + + ret = of_property_read_u32(np_config, + nmk_cfg_params[i].property, &val); + if (ret != -EINVAL) { + if (nmk_dt_pin_config(i, val, &cfg) == 0) { + configs |= cfg; + has_config = 1; + } } } } + ret = of_property_count_strings(np, "ste,pins"); if (ret < 0) goto exit;