Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2
@ 2020-07-01  1:33 Drew Fustini
  2020-07-01  1:33 ` [PATCH v4 1/2] pinctrl: single: parse " Drew Fustini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Drew Fustini @ 2020-07-01  1:33 UTC (permalink / raw)
  To: Tony Lindgren, Rob Herring, linux-omap, linux-kernel, linux-gpio,
	linux-arm-kernel, Linus Walleij, Haojian Zhuang, devicetree,
	bcousson, Jason Kridner, Robert Nelson
  Cc: Drew Fustini

Currently, pinctrl-single only allows #pinctrl-cells = 1.

This series will allow pinctrl-single to also support #pinctrl-cells = 2

If "pinctrl-single,pins" has 3 arguments (offset, conf, mux) then
pcs_parse_one_pinctrl_entry() does an OR operation on conf and mux to
get the value to store in the register.
    
To take advantage of #pinctrl-cells = 2, the AM33XX_PADCONF macro in
omap.h is modified to keep pin conf and pin mux values separate.

change log:
- v4: squash patches 2 and 3 together so that git biesct will not result
  in a boot failure

- v3: change order of patches to make sure the pinctrl-single.c patch
  does not break anything without the dts patches

- v2: remove outer parentheses from AM33XX_PADCONF macro as it causes a
  compile error in dtc.  I had added it per suggestion from checkpatch
  about having parentheses around complex values.

Drew Fustini (2):
  pinctrl: single: parse #pinctrl-cells = 2
  ARM: dts: am33xx-l4: change #pinctrl-cells from 1 to 2

 arch/arm/boot/dts/am33xx-l4.dtsi   |  2 +-
 drivers/pinctrl/pinctrl-single.c   | 11 +++++++++--
 include/dt-bindings/pinctrl/omap.h |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 1/2] pinctrl: single: parse #pinctrl-cells = 2
  2020-07-01  1:33 [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Drew Fustini
@ 2020-07-01  1:33 ` Drew Fustini
  2020-07-01  1:33 ` [PATCH v4 2/2] ARM: dts: am33xx-l4: change #pinctrl-cells from 1 to 2 Drew Fustini
  2020-07-02 17:36 ` [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Drew Fustini @ 2020-07-01  1:33 UTC (permalink / raw)
  To: Tony Lindgren, Rob Herring, linux-omap, linux-kernel, linux-gpio,
	linux-arm-kernel, Linus Walleij, Haojian Zhuang, devicetree,
	bcousson, Jason Kridner, Robert Nelson
  Cc: Drew Fustini

If "pinctrl-single,pins" has 3 arguments (offset, conf, mux), then
pcs_parse_one_pinctrl_entry() does an OR operation on conf and mux to
get the value to store in the register.

Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
 drivers/pinctrl/pinctrl-single.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index f3a8a465d27e..a436ed7762cc 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1017,10 +1017,17 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
 			break;
 		}
 
-		/* Index plus one value cell */
 		offset = pinctrl_spec.args[0];
 		vals[found].reg = pcs->base + offset;
-		vals[found].val = pinctrl_spec.args[1];
+
+		switch (pinctrl_spec.args_count) {
+		case 2:
+			vals[found].val = pinctrl_spec.args[1];
+			break;
+		case 3:
+			vals[found].val = (pinctrl_spec.args[1] | pinctrl_spec.args[2]);
+			break;
+		}
 
 		dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x\n",
 			pinctrl_spec.np, offset, pinctrl_spec.args[1]);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 2/2] ARM: dts: am33xx-l4: change #pinctrl-cells from 1 to 2
  2020-07-01  1:33 [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Drew Fustini
  2020-07-01  1:33 ` [PATCH v4 1/2] pinctrl: single: parse " Drew Fustini
@ 2020-07-01  1:33 ` Drew Fustini
  2020-07-02 17:36 ` [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Drew Fustini @ 2020-07-01  1:33 UTC (permalink / raw)
  To: Tony Lindgren, Rob Herring, linux-omap, linux-kernel, linux-gpio,
	linux-arm-kernel, Linus Walleij, Haojian Zhuang, devicetree,
	bcousson, Jason Kridner, Robert Nelson
  Cc: Drew Fustini

Increase #pinctrl-cells to 2 so that mux and conf be kept separate. This
requires the AM33XX_PADCONF macro in omap.h to also be modified to keep pin
conf and pin mux values separate.

Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
 arch/arm/boot/dts/am33xx-l4.dtsi   | 2 +-
 include/dt-bindings/pinctrl/omap.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4.dtsi
index a9cbefc80c0c..3141590e5889 100644
--- a/arch/arm/boot/dts/am33xx-l4.dtsi
+++ b/arch/arm/boot/dts/am33xx-l4.dtsi
@@ -278,7 +278,7 @@ scm: scm@0 {
 				am33xx_pinmux: pinmux@800 {
 					compatible = "pinctrl-single";
 					reg = <0x800 0x238>;
-					#pinctrl-cells = <1>;
+					#pinctrl-cells = <2>;
 					pinctrl-single,register-width = <32>;
 					pinctrl-single,function-mask = <0x7f>;
 				};
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
index 625718042413..2d2a8c737822 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -65,7 +65,7 @@
 #define DM814X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
 #define DM816X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
 #define AM33XX_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
-#define AM33XX_PADCONF(pa, dir, mux)	OMAP_IOPAD_OFFSET((pa), 0x0800) ((dir) | (mux))
+#define AM33XX_PADCONF(pa, conf, mux)	OMAP_IOPAD_OFFSET((pa), 0x0800) (conf) (mux)
 
 /*
  * Macros to allow using the offset from the padconf physical address
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2
  2020-07-01  1:33 [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Drew Fustini
  2020-07-01  1:33 ` [PATCH v4 1/2] pinctrl: single: parse " Drew Fustini
  2020-07-01  1:33 ` [PATCH v4 2/2] ARM: dts: am33xx-l4: change #pinctrl-cells from 1 to 2 Drew Fustini
@ 2020-07-02 17:36 ` Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2020-07-02 17:36 UTC (permalink / raw)
  To: Drew Fustini
  Cc: Rob Herring, linux-omap, linux-kernel, linux-gpio,
	linux-arm-kernel, Linus Walleij, Haojian Zhuang, devicetree,
	bcousson, Jason Kridner, Robert Nelson

* Drew Fustini <drew@beagleboard.org> [200701 01:34]:
> Currently, pinctrl-single only allows #pinctrl-cells = 1.
> 
> This series will allow pinctrl-single to also support #pinctrl-cells = 2
> 
> If "pinctrl-single,pins" has 3 arguments (offset, conf, mux) then
> pcs_parse_one_pinctrl_entry() does an OR operation on conf and mux to
> get the value to store in the register.
>     
> To take advantage of #pinctrl-cells = 2, the AM33XX_PADCONF macro in
> omap.h is modified to keep pin conf and pin mux values separate.
> 
> change log:
> - v4: squash patches 2 and 3 together so that git biesct will not result
>   in a boot failure

Thanks for updating it. Best that Linus queues both patches via
the pinctrl tree when no more comments:

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  1:33 [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Drew Fustini
2020-07-01  1:33 ` [PATCH v4 1/2] pinctrl: single: parse " Drew Fustini
2020-07-01  1:33 ` [PATCH v4 2/2] ARM: dts: am33xx-l4: change #pinctrl-cells from 1 to 2 Drew Fustini
2020-07-02 17:36 ` [PATCH v4 0/2] pinctrl: single: support #pinctrl-cells = 2 Tony Lindgren

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org
	public-inbox-index linux-gpio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git