ARM: dts: bcm283x: add and use pinctrl groups
Subsystems (5)
v4 cover ARM: dts: bcm283x: add and use pinctrl groups
Hi,
New in v4: Patch #6 has been splitted into two: Patch 6 just moves pinctrl from &gpio to &sdhci. Removing the empty now alt3 group -- including all references as pointed out by Stefan Wahren in review -- is done by the new patch 7. Patches 1-5 are unchanged.
cheers,
Gerd
Eric Anholt (1):
ARM: dts: bcm283x: Define standard pinctrl groups in the gpio node.
Gerd Hoffmann (6):
pinctrl: bcm2835: add pull defines to dt bindings
ARM: dts: bcm283x: add pinctrl group to &pwm, drop pins from &gpio
ARM: dts: bcm283x: add pinctrl group to &i2c0, drop pins from &gpio
ARM: dts: bcm283x: add pinctrl group to &i2c1, drop pins from &gpio
ARM: dts: bcm283x: add pinctrl group to &sdhci, drop pins from &gpio
ARM: dts: bcm283x: drop alt3 from &gpio
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-a.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-zero.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi.dtsi | 15 ++- arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 2 +- arch/arm/boot/dts/bcm283x.dtsi | 203 +++++++++++++++++++++++++++++++ drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 - include/dt-bindings/pinctrl/bcm2835.h | 5 + 11 files changed, 224 insertions(+), 19 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/7 pinctrl: bcm2835: add pull defines to dt bindings
Also delete (unused) private enum from driver.
The pull defines can be used instead if needed.
--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 ------ include/dt-bindings/pinctrl/bcm2835.h | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm2835.c +0 -6
@@ -76,12 +76,6 @@ enum bcm2835_pinconf_param { BCM2835_PINCONF_PARAM_PULL, }; -enum bcm2835_pinconf_pull { -BCM2835_PINCONFIG_PULL_NONE , -BCM2835_PINCONFIG_PULL_DOWN , -BCM2835_PINCONFIG_PULL_UP , -}; -#define BCM2835_PINCONF_PACK (_param_, _arg_) ((_param_) << 16 | (_arg_))#define BCM2835_PINCONF_UNPACK_PARAM (_conf_) ((_conf_) >> 16)#define BCM2835_PINCONF_UNPACK_ARG (_conf_) ((_conf_) & 0xffff)
include/dt-bindings/pinctrl/bcm2835.h +5 -0
@@ -24,4 +24,9 @@#define BCM2835_FSEL_ALT2 6#define BCM2835_FSEL_ALT3 7 +/* brcm,pull property */ +#define BCM2835_PUD_OFF 0 +#define BCM2835_PUD_DOWN 1 +#define BCM2835_PUD_UP 2 +#endif /* __DT_BINDINGS_PINCTRL_BCM2835_H__ */
Signature · 1 line
1.8.3.1
Re: [PATCH v4 1/7] pinctrl: bcm2835: add pull defines to dt bindings
Quoted 4 lines · Gerd Hoffmann
Also delete (unused) private enum from driver.
The pull defines can be used instead if needed.Signed-off-by Gerd Hoffmann <[email protected]>
gpio maintainers, could I pull this through my dt tree? Or does this need to be split in two?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160919/82c39ac2/attachment.sig>
Linus Walleij
Acked-byRe: [PATCH v4 1/7] pinctrl: bcm2835: add pull defines to dt bindings
Quoted 11 lines · Eric Anholt
Quoted 4 lines · Gerd Hoffmann
Also delete (unused) private enum from driver.
The pull defines can be used instead if needed.Signed-off-by Gerd Hoffmann <[email protected]>Acked-by Eric Anholt <[email protected]>gpio maintainers, could I pull this through my dt tree? Or does this need to be split in two?
You can take it. The bcm2835 driver is not seeing any conflicting changes in this merge window.
Yours,
Linus Walleij
PATCH v4 2/7 ARM: dts: bcm283x: Define standard pinctrl groups in the gpio node.
In reply to Gerd HoffmannFrom: Eric Anholt <[email protected]>
The BCM2835-ARM-Peripherals.pdf documentation specifies what the function selects do for the pins, and there are a bunch of obvious groupings to be made. With these created, we'll be able to replace bcm2835-rpi.dtsi's main "set all of these pins to alt0" with references to specific groups we want enabled.
Also add pinctrl groups for emmc and sdhost.
Based on patches by Eric Anholt <[email protected]>
--- arch/arm/boot/dts/bcm283x.dtsi | 203 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +203 -0
@@ -131,6 +131,209 @@ interrupt-controller; #interrupt-cells = <2>; + + /* Defines pin muxing groups according to + * BCM2835-ARM-Peripherals.pdf page 102. + * + * While each pin can have its mux selected + * for various functions individually, some + * groups only make sense to switch to a + * particular function together. + */ + dpi_gpio0: dpi_gpio0 { + brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 + 12 13 14 15 16 17 18 19 + 20 21 22 23 24 25 26 27>; + brcm,function = <BCM2835_FSEL_ALT2>; + }; + emmc_gpio22: emmc_gpio22 { + brcm,pins = <22 23 24 25 26 27>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + emmc_gpio34: emmc_gpio34 { + brcm,pins = <34 35 36 37 38 39>; + brcm,function = <BCM2835_FSEL_ALT3>; + brcm,pull = <BCM2835_PUD_OFF + BCM2835_PUD_UP + BCM2835_PUD_UP + BCM2835_PUD_UP + BCM2835_PUD_UP + BCM2835_PUD_UP>; + }; + emmc_gpio48: emmc_gpio48 { + brcm,pins = <48 49 50 51 52 53>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + + gpclk0_gpio4: gpclk0_gpio4 { + brcm,pins = <4>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + gpclk1_gpio5: gpclk1_gpio5 { + brcm,pins = <5>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + gpclk1_gpio42: gpclk1_gpio42 { + brcm,pins = <42>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + gpclk1_gpio44: gpclk1_gpio44 { + brcm,pins = <44>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + gpclk2_gpio6: gpclk2_gpio6 { + brcm,pins = <6>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + gpclk2_gpio43: gpclk2_gpio43 { + brcm,pins = <43>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + + i2c0_gpio0: i2c0_gpio0 { + brcm,pins = <0 1>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + i2c0_gpio32: i2c0_gpio32 { + brcm,pins = <32 34>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + i2c0_gpio44: i2c0_gpio44 { + brcm,pins = <44 45>; + brcm,function = <BCM2835_FSEL_ALT1>; + }; + i2c1_gpio2: i2c1_gpio2 { + brcm,pins = <2 3>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + i2c1_gpio44: i2c1_gpio44 { + brcm,pins = <44 45>; + brcm,function = <BCM2835_FSEL_ALT2>; + }; + i2c_slave_gpio18: i2c_slave_gpio18 { + brcm,pins = <18 19 20 21>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + + jtag_gpio4: jtag_gpio4 { + brcm,pins = <4 5 6 12 13>; + brcm,function = <BCM2835_FSEL_ALT4>; + }; + jtag_gpio22: jtag_gpio22 { + brcm,pins = <22 23 24 25 26 27>; + brcm,function = <BCM2835_FSEL_ALT4>; + }; + + pcm_gpio18: pcm_gpio18 { + brcm,pins = <18 19 20 21>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + pcm_gpio28: pcm_gpio28 { + brcm,pins = <28 29 30 31>; + brcm,function = <BCM2835_FSEL_ALT2>; + }; + + pwm0_gpio12: pwm0_gpio12 { + brcm,pins = <12>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + pwm0_gpio18: pwm0_gpio18 { + brcm,pins = <18>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + pwm0_gpio40: pwm0_gpio40 { + brcm,pins = <40>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + pwm1_gpio13: pwm1_gpio13 { + brcm,pins = <13>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + pwm1_gpio19: pwm1_gpio19 { + brcm,pins = <19>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + pwm1_gpio41: pwm1_gpio41 { + brcm,pins = <41>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + pwm1_gpio45: pwm1_gpio45 { + brcm,pins = <45>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + + sdhost_gpio48: sdhost_gpio48 { + brcm,pins = <48 49 50 51 52 53>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + + spi0_gpio7: spi0_gpio7 { + brcm,pins = <7 8 9 10 11>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + spi0_gpio35: spi0_gpio35 { + brcm,pins = <35 36 37 38 39>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + spi1_gpio16: spi1_gpio16 { + brcm,pins = <16 17 18 19 20 21>; + brcm,function = <BCM2835_FSEL_ALT4>; + }; + spi2_gpio40: spi2_gpio40 { + brcm,pins = <40 41 42 43 44 45>; + brcm,function = <BCM2835_FSEL_ALT4>; + }; + + uart0_gpio14: uart0_gpio14 { + brcm,pins = <14 15>; + brcm,function = <BCM2835_FSEL_ALT0>; + }; + /* Separate from the uart0_gpio14 group + * because it conflicts with spi1_gpio16, and + * people often run uart0 on the two pins + * without flow contrl. + */ + uart0_ctsrts_gpio16: uart0_ctsrts_gpio16 { + brcm,pins = <16 17>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + uart0_gpio30: uart0_gpio30 { + brcm,pins = <30 31>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + uart0_ctsrts_gpio32: uart0_ctsrts_gpio32 { + brcm,pins = <32 33>; + brcm,function = <BCM2835_FSEL_ALT3>; + }; + + uart1_gpio14: uart1_gpio14 { + brcm,pins = <14 15>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + uart1_ctsrts_gpio16: uart1_ctsrts_gpio16 { + brcm,pins = <16 17>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + uart1_gpio32: uart1_gpio32 { + brcm,pins = <32 33>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + uart1_ctsrts_gpio30: uart1_ctsrts_gpio30 { + brcm,pins = <30 31>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + uart1_gpio36: uart1_gpio36 { + brcm,pins = <36 37 38 39>; + brcm,function = <BCM2835_FSEL_ALT2>; + }; + uart1_gpio40: uart1_gpio40 { + brcm,pins = <40 41>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; + uart1_ctsrts_gpio42: uart1_ctsrts_gpio42 { + brcm,pins = <42 43>; + brcm,function = <BCM2835_FSEL_ALT5>; + }; }; uart0: serial at 7e201000 {
Signature · 1 line
1.8.3.1
Re: [PATCH v4 2/7] ARM: dts: bcm283x: Define standard pinctrl groups in the gpio node.
Quoted 11 lines · Gerd Hoffmann
From: Eric Anholt <[email protected]>
The BCM2835-ARM-Peripherals.pdf documentation specifies what the function selects do for the pins, and there are a bunch of obvious groupings to be made. With these created, we'll be able to replace bcm2835-rpi.dtsi's main "set all of these pins to alt0" with references to specific groups we want enabled.
Also add pinctrl groups for emmc and sdhost.
Based on patches by Eric Anholt <[email protected]>
I amended this line to "Based on patches by Eric Anholt, with fixups by Gerd Hoffmann." to explain why it had me as author but you in signoff.
I had to resolve some conflicts on the way in because apparently you had built this against a tree with 14 and 15 already dropped from alt0. I think those resolutions were sufficiently mechanical that it didn't merit a respin.
Merged the series to bcm2835-dt-next. Thanks for getting this done!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161017/8fe3d040/attachment.sig>
PATCH v4 3/7 ARM: dts: bcm283x: add pinctrl group to &pwm, drop pins from &gpio
In reply to Gerd Hoffmann--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +3 -1
@@ -38,7 +38,7 @@ }; alt0: alt0 { - brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 40 45>; + brcm,pins = <0 1 2 3 4 5 7 8 9 10 11>; brcm,function = <BCM2835_FSEL_ALT0>; };
@@ -68,6 +68,8 @@ }; &pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>; status = "okay"; };
Signature · 1 line
1.8.3.1
PATCH v4 4/7 ARM: dts: bcm283x: add pinctrl group to &i2c0, drop pins from &gpio
In reply to Gerd Hoffmann--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +3 -1
@@ -38,7 +38,7 @@ }; alt0: alt0 { - brcm,pins = <0 1 2 3 4 5 7 8 9 10 11>; + brcm,pins = <2 3 4 5 7 8 9 10 11>; brcm,function = <BCM2835_FSEL_ALT0>; };
@@ -49,6 +49,8 @@ }; &i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio0>; status = "okay"; clock-frequency = <100000>; };
Signature · 1 line
1.8.3.1
PATCH v4 5/7 ARM: dts: bcm283x: add pinctrl group to &i2c1, drop pins from &gpio
In reply to Gerd Hoffmann--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +3 -1
@@ -38,7 +38,7 @@ }; alt0: alt0 { - brcm,pins = <2 3 4 5 7 8 9 10 11>; + brcm,pins = <4 5 7 8 9 10 11>; brcm,function = <BCM2835_FSEL_ALT0>; };
@@ -56,6 +56,8 @@ }; &i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_gpio2>; status = "okay"; clock-frequency = <100000>; };
Signature · 1 line
1.8.3.1
PATCH v4 6/7 ARM: dts: bcm283x: add pinctrl group to &sdhci, drop pins from &gpio
In reply to Gerd Hoffmann--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +3 -1
@@ -43,7 +43,7 @@ }; alt3: alt3 { - brcm,pins = <48 49 50 51 52 53>; + brcm,pins = <>; brcm,function = <BCM2835_FSEL_ALT3>; }; };
@@ -67,6 +67,8 @@ }; &sdhci { + pinctrl-names = "default"; + pinctrl-0 = <&emmc_gpio48>; status = "okay"; bus-width = <4>; };
Signature · 1 line
1.8.3.1
PATCH v4 7/7 ARM: dts: bcm283x: drop alt3 from &gpio
In reply to Gerd HoffmannAs the alt3 group has no pins left drop it from &gpio.
--- arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-a.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-b.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi-zero.dts | 2 +- arch/arm/boot/dts/bcm2835-rpi.dtsi | 5 ----- arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 2 +- 8 files changed, 7 insertions(+), 12 deletions(-)
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +1 -1
@@ -22,7 +22,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; /* I2S interface */ i2s_alt0: i2s_alt0 {
arch/arm/boot/dts/bcm2835-rpi-a.dts +1 -1
@@ -15,7 +15,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt2>; /* I2S interface */ i2s_alt2: i2s_alt2 {
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +1 -1
@@ -23,7 +23,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; /* I2S interface */ i2s_alt0: i2s_alt0 {
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +1 -1
@@ -16,7 +16,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt2>; /* I2S interface */ i2s_alt2: i2s_alt2 {
arch/arm/boot/dts/bcm2835-rpi-b.dts +1 -1
@@ -16,7 +16,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &alt3>; + pinctrl-0 = <&gpioout &alt0>; }; &hdmi {
arch/arm/boot/dts/bcm2835-rpi-zero.dts +1 -1
@@ -26,7 +26,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; /* I2S interface */ i2s_alt0: i2s_alt0 {
arch/arm/boot/dts/bcm2835-rpi.dtsi +0 -5
@@ -41,11 +41,6 @@ brcm,pins = <4 5 7 8 9 10 11>; brcm,function = <BCM2835_FSEL_ALT0>; }; - - alt3: alt3 { - brcm,pins = <>; - brcm,function = <BCM2835_FSEL_ALT3>; - }; }; &i2c0 {
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +1 -1
@@ -27,7 +27,7 @@ }; &gpio { - pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; + pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; /* I2S interface */ i2s_alt0: i2s_alt0 {
Signature · 1 line
1.8.3.1
Re: [PATCH v4 7/7] ARM: dts: bcm283x: drop alt3 from &gpio
Quoted 3 lines · Gerd Hoffmann
As the alt3 group has no pins left drop it from &gpio.
Signed-off-by Gerd Hoffmann <[email protected]>
If you end up spinning another version for some reason, I'd squash this patch with the previous one. But regardless, 3-7 are:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160919/749771d8/attachment.sig>
v4 cover ARM: dts: bcm283x: add and use pinctrl groups
In reply to Gerd HoffmannAm 19.09.2016 um 10:43 schrieb Gerd Hoffmann:
Quoted 6 lines
Hi,
New in v4: Patch #6 has been splitted into two: Patch 6 just moves pinctrl from &gpio to &sdhci. Removing the empty now alt3 group -- including all references as pointed out by Stefan Wahren in review -- is done by the new patch 7. Patches 1-5 are unchanged.
for the whole series.
Thanks
Stefan