diff mbox

[1/3] arm: kirkwood: affect pins to their devices on OpenBlocks A6

Message ID 1362587021-32762-2-git-send-email-thomas.petazzoni@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Petazzoni March 6, 2013, 4:23 p.m. UTC
The pinctrl configuration done for the Kirkwood-based OpenBlocks A6
board was somewhat strange: all pins for all devices were selected
through "hogs", i.e as pins of the pinctrl device. Even though it
works, it isn't the proper way of doing things: pins should preferably
be associated to whatever device they belong to.

Therefore, this patch moves the selection of pin muxing of the
relevant pins to the UART nodes, the I2C node, the NAND node and the
gpio-leds node.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Andrew Lunn March 6, 2013, 6:21 p.m. UTC | #1
On Wed, Mar 06, 2013 at 05:23:39PM +0100, Thomas Petazzoni wrote:
> The pinctrl configuration done for the Kirkwood-based OpenBlocks A6
> board was somewhat strange: all pins for all devices were selected
> through "hogs", i.e as pins of the pinctrl device. Even though it
> works, it isn't the proper way of doing things: pins should preferably
> be associated to whatever device they belong to.

Hi Thomas

Being able to add pinctrl nodes to the device is new. I think it was
added in 3.8. Before then each device driver had to explicitly request
its pins and most didn't, so hogs was the way to do it. Now the core
driver code gets the pins. So i would not say it is odd, just
outdated. It would be nice to change the comment to reflect this.

> Therefore, this patch moves the selection of pin muxing of the
> relevant pins to the UART nodes, the I2C node, the NAND node and the
> gpio-leds node.

For gpio-leds, see the comment i just made for the next patch.

Otherwise this look O.K.

	  Andrew

> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  arch/arm/boot/dts/kirkwood-openblocks_a6.dts |   19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
> index ede7fe0d..087681d 100644
> --- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
> +++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
> @@ -19,17 +19,23 @@
>  	ocp@f1000000 {
>  		serial@12000 {
>  			clock-frequency = <200000000>;
> +			pinctrl-0 = <&pmx_uart0>;
> +			pinctrl-names = "default";
>  			status = "ok";
>  		};
>  
>  		serial@12100 {
>  			clock-frequency = <200000000>;
> +			pinctrl-0 = <&pmx_uart1>;
> +			pinctrl-names = "default";
>  			status = "ok";
>  		};
>  
>  		nand@3000000 {
>  			chip-delay = <25>;
>  			status = "okay";
> +			pinctrl-0 = <&pmx_nand>;
> +			pinctrl-names = "default";
>  
>  			partition@0 {
>  				label = "uboot";
> @@ -69,6 +75,8 @@
>  
>  		i2c@11100 {
>  			status = "okay";
> +			pinctrl-0 = <&pmx_twsi1>;
> +			pinctrl-names = "default";
>  
>  			s35390a: s35390a@30 {
>  				compatible = "s35390a";
> @@ -77,16 +85,12 @@
>  		};
>  
>  		pinctrl: pinctrl@10000 {
> -			pinctrl-0 = < &pmx_nand &pmx_uart0
> -				&pmx_uart1 &pmx_twsi1
> -				&pmx_dip_sw0 &pmx_dip_sw1
> +			pinctrl-0 = <&pmx_dip_sw0 &pmx_dip_sw1
>  				&pmx_dip_sw2 &pmx_dip_sw3
>  				&pmx_gpio_0 &pmx_gpio_1
>  				&pmx_gpio_2 &pmx_gpio_3
>  				&pmx_gpio_4 &pmx_gpio_5
> -				&pmx_gpio_6 &pmx_gpio_7
> -				&pmx_led_red &pmx_led_green
> -				&pmx_led_yellow >;
> +				&pmx_gpio_6 &pmx_gpio_7>;
>  			pinctrl-names = "default";
>  
>  			pmx_uart0: pmx-uart0 {
> @@ -195,6 +199,9 @@
>  
>  	gpio-leds {
>  		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_led_red &pmx_led_green
> +				&pmx_led_yellow>;
> +		pinctrl-names = "default";
>  
>  		led-red {
>  			label = "obsa6:red:stat";
> -- 
> 1.7.9.5
>
Thomas Petazzoni March 6, 2013, 7:07 p.m. UTC | #2
Dear Andrew Lunn,

On Wed, 6 Mar 2013 19:21:31 +0100, Andrew Lunn wrote:

> Being able to add pinctrl nodes to the device is new. I think it was
> added in 3.8. Before then each device driver had to explicitly request
> its pins and most didn't, so hogs was the way to do it.

A number of drivers were already capable of doing this, like gpio-leds
for example. But as you say, in 3.9 a patch making this globally
available to all drivers without having to modify them has been merged,
and that's what I rely on.

> Now the core
> driver code gets the pins. So i would not say it is odd, just
> outdated. It would be nice to change the comment to reflect this.

Ok, I'll fix that up.

> > Therefore, this patch moves the selection of pin muxing of the
> > relevant pins to the UART nodes, the I2C node, the NAND node and the
> > gpio-leds node.
> 
> For gpio-leds, see the comment i just made for the next patch.
> 
> Otherwise this look O.K.

Thanks.

Thomas
diff mbox

Patch

diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index ede7fe0d..087681d 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -19,17 +19,23 @@ 
 	ocp@f1000000 {
 		serial@12000 {
 			clock-frequency = <200000000>;
+			pinctrl-0 = <&pmx_uart0>;
+			pinctrl-names = "default";
 			status = "ok";
 		};
 
 		serial@12100 {
 			clock-frequency = <200000000>;
+			pinctrl-0 = <&pmx_uart1>;
+			pinctrl-names = "default";
 			status = "ok";
 		};
 
 		nand@3000000 {
 			chip-delay = <25>;
 			status = "okay";
+			pinctrl-0 = <&pmx_nand>;
+			pinctrl-names = "default";
 
 			partition@0 {
 				label = "uboot";
@@ -69,6 +75,8 @@ 
 
 		i2c@11100 {
 			status = "okay";
+			pinctrl-0 = <&pmx_twsi1>;
+			pinctrl-names = "default";
 
 			s35390a: s35390a@30 {
 				compatible = "s35390a";
@@ -77,16 +85,12 @@ 
 		};
 
 		pinctrl: pinctrl@10000 {
-			pinctrl-0 = < &pmx_nand &pmx_uart0
-				&pmx_uart1 &pmx_twsi1
-				&pmx_dip_sw0 &pmx_dip_sw1
+			pinctrl-0 = <&pmx_dip_sw0 &pmx_dip_sw1
 				&pmx_dip_sw2 &pmx_dip_sw3
 				&pmx_gpio_0 &pmx_gpio_1
 				&pmx_gpio_2 &pmx_gpio_3
 				&pmx_gpio_4 &pmx_gpio_5
-				&pmx_gpio_6 &pmx_gpio_7
-				&pmx_led_red &pmx_led_green
-				&pmx_led_yellow >;
+				&pmx_gpio_6 &pmx_gpio_7>;
 			pinctrl-names = "default";
 
 			pmx_uart0: pmx-uart0 {
@@ -195,6 +199,9 @@ 
 
 	gpio-leds {
 		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_led_red &pmx_led_green
+				&pmx_led_yellow>;
+		pinctrl-names = "default";
 
 		led-red {
 			label = "obsa6:red:stat";