diff mbox

ARM: Kirkwood: convert ns2 boards to pinctrl

Message ID 1357655778-32066-1-git-send-email-simon.guinot@sequanux.org (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Guinot Jan. 8, 2013, 2:36 p.m. UTC
Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
on the pinctrl driver, then a pinctrl definition must be given to allow
the GPIO configuration.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
---
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
 arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
 2 files changed, 16 insertions(+), 38 deletions(-)

Comments

Andrew Lunn Jan. 8, 2013, 2:49 p.m. UTC | #1
On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> on the pinctrl driver, then a pinctrl definition must be given to allow
> the GPIO configuration.
> 
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> ---
>  arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
>  arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
>  2 files changed, 16 insertions(+), 38 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> index 9bc6785..77d21ab 100644
> --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> @@ -1,4 +1,5 @@
>  /include/ "kirkwood.dtsi"
> +/include/ "kirkwood-6281.dtsi"
>  
>  / {
>  	chosen {
> @@ -6,6 +7,21 @@
>  	};
>  
>  	ocp@f1000000 {
> +		pinctrl: pinctrl@10000 {
> +			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
> +					&pmx_ns2_sata0 &pmx_ns2_sata1>;
> +			pinctrl-names = "default";
> +
> +			pmx_ns2_sata0: pmx-ns2-sata0 {
> +				marvell,pins = "mpp21";
> +				marvell,function = "sata0";
> +			};
> +			pmx_ns2_sata1: pmx-ns2-sata1 {
> +				marvell,pins = "mpp20";
> +				marvell,function = "sata1";
> +			};
> +		};

Hi Simon

Its normal to also list all the gpio pins here as well. 

    Andrew
Simon Guinot Jan. 8, 2013, 3:09 p.m. UTC | #2
On Tue, Jan 08, 2013 at 03:49:54PM +0100, Andrew Lunn wrote:
> On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> > Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> > Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> > gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> > on the pinctrl driver, then a pinctrl definition must be given to allow
> > the GPIO configuration.
> > 
> > Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> > ---
> >  arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
> >  arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
> >  2 files changed, 16 insertions(+), 38 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > index 9bc6785..77d21ab 100644
> > --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > @@ -1,4 +1,5 @@
> >  /include/ "kirkwood.dtsi"
> > +/include/ "kirkwood-6281.dtsi"
> >  
> >  / {
> >  	chosen {
> > @@ -6,6 +7,21 @@
> >  	};
> >  
> >  	ocp@f1000000 {
> > +		pinctrl: pinctrl@10000 {
> > +			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
> > +					&pmx_ns2_sata0 &pmx_ns2_sata1>;
> > +			pinctrl-names = "default";
> > +
> > +			pmx_ns2_sata0: pmx-ns2-sata0 {
> > +				marvell,pins = "mpp21";
> > +				marvell,function = "sata0";
> > +			};
> > +			pmx_ns2_sata1: pmx-ns2-sata1 {
> > +				marvell,pins = "mpp20";
> > +				marvell,function = "sata1";
> > +			};
> > +		};
> 
> Hi Simon
> 
> Its normal to also list all the gpio pins here as well. 

I was not sure about that. As gpio_request triggers the mpp
configuration at run time, IMHO there is no point for an initial and
statical configuration, except for a documentation purpose. As GPIOs
are also referenced in their dedicated driver nodes, I think that the
informations about the pin are quite exhaustive. All the non-GPIO MPPs
are listed in the pinctrl node. The other MPPs are GPIOs if requested
by a driver. It is simple :)

Do you think that the full MPP/GPIO list is really needed ?

Simon
Andrew Lunn Jan. 8, 2013, 4:13 p.m. UTC | #3
On Tue, Jan 08, 2013 at 04:09:07PM +0100, Simon Guinot wrote:
> On Tue, Jan 08, 2013 at 03:49:54PM +0100, Andrew Lunn wrote:
> > On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> > > Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> > > Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> > > gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> > > on the pinctrl driver, then a pinctrl definition must be given to allow
> > > the GPIO configuration.
> > > 
> > > Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> > > ---
> > >  arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
> > >  arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
> > >  2 files changed, 16 insertions(+), 38 deletions(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > > index 9bc6785..77d21ab 100644
> > > --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > > +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > > @@ -1,4 +1,5 @@
> > >  /include/ "kirkwood.dtsi"
> > > +/include/ "kirkwood-6281.dtsi"
> > >  
> > >  / {
> > >  	chosen {
> > > @@ -6,6 +7,21 @@
> > >  	};
> > >  
> > >  	ocp@f1000000 {
> > > +		pinctrl: pinctrl@10000 {
> > > +			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
> > > +					&pmx_ns2_sata0 &pmx_ns2_sata1>;
> > > +			pinctrl-names = "default";
> > > +
> > > +			pmx_ns2_sata0: pmx-ns2-sata0 {
> > > +				marvell,pins = "mpp21";
> > > +				marvell,function = "sata0";
> > > +			};
> > > +			pmx_ns2_sata1: pmx-ns2-sata1 {
> > > +				marvell,pins = "mpp20";
> > > +				marvell,function = "sata1";
> > > +			};
> > > +		};
> > 
> > Hi Simon
> > 
> > Its normal to also list all the gpio pins here as well. 
> 
> I was not sure about that. As gpio_request triggers the mpp
> configuration at run time, IMHO there is no point for an initial and
> statical configuration, except for a documentation purpose.

[Goes away and reads Docunmentation/gpio.txt]

Yes, you appear to be correct. Its not necessary. Don't know that.

     Andrew
Andrew Lunn Jan. 8, 2013, 4:15 p.m. UTC | #4
On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> on the pinctrl driver, then a pinctrl definition must be given to allow
> the GPIO configuration.
> 
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> ---
>  arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
>  arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
>  2 files changed, 16 insertions(+), 38 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> index 9bc6785..77d21ab 100644
> --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> @@ -1,4 +1,5 @@
>  /include/ "kirkwood.dtsi"
> +/include/ "kirkwood-6281.dtsi"
>  
>  / {
>  	chosen {
> @@ -6,6 +7,21 @@
>  	};
>  
>  	ocp@f1000000 {
> +		pinctrl: pinctrl@10000 {
> +			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
> +					&pmx_ns2_sata0 &pmx_ns2_sata1>;
> +			pinctrl-names = "default";
> +
> +			pmx_ns2_sata0: pmx-ns2-sata0 {
> +				marvell,pins = "mpp21";
> +				marvell,function = "sata0";
> +			};
> +			pmx_ns2_sata1: pmx-ns2-sata1 {
> +				marvell,pins = "mpp20";
> +				marvell,function = "sata1";
> +			};
> +		};
> +
>  		serial@12000 {
>  			clock-frequency = <166666667>;
>  			status = "okay";
> diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
> index 8821720..f4632a8 100644
> --- a/arch/arm/mach-kirkwood/board-ns2.c
> +++ b/arch/arm/mach-kirkwood/board-ns2.c
> @@ -18,47 +18,11 @@
>  #include <linux/gpio.h>
>  #include <linux/of.h>
>  #include "common.h"
> -#include "mpp.h"
>  
>  static struct mv643xx_eth_platform_data ns2_ge00_data = {
>  	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
>  };
>  
> -static unsigned int ns2_mpp_config[] __initdata = {
> -	MPP0_SPI_SCn,
> -	MPP1_SPI_MOSI,
> -	MPP2_SPI_SCK,
> -	MPP3_SPI_MISO,
> -	MPP4_NF_IO6,
> -	MPP5_NF_IO7,
> -	MPP6_SYSRST_OUTn,
> -	MPP7_GPO,		/* Fan speed (bit 1) */
> -	MPP8_TW0_SDA,
> -	MPP9_TW0_SCK,
> -	MPP10_UART0_TXD,
> -	MPP11_UART0_RXD,
> -	MPP12_GPO,		/* Red led */
> -	MPP14_GPIO,		/* USB fuse */
> -	MPP16_GPIO,		/* SATA 0 power */
> -	MPP17_GPIO,		/* SATA 1 power */
> -	MPP18_NF_IO0,
> -	MPP19_NF_IO1,
> -	MPP20_SATA1_ACTn,
> -	MPP21_SATA0_ACTn,
> -	MPP22_GPIO,		/* Fan speed (bit 0) */
> -	MPP23_GPIO,		/* Fan power */
> -	MPP24_GPIO,		/* USB mode select */
> -	MPP25_GPIO,		/* Fan rotation fail */
> -	MPP26_GPIO,		/* USB device vbus */
> -	MPP28_GPIO,		/* USB enable host vbus */
> -	MPP29_GPIO,		/* Blue led (slow register) */
> -	MPP30_GPIO,		/* Blue led (command register) */
> -	MPP31_GPIO,		/* Board power off */
> -	MPP32_GPIO,		/* Power button (0 = Released, 1 = Pushed) */
> -	MPP33_GPO,		/* Fan speed (bit 2) */
> -	0
> -};
> -
>  #define NS2_GPIO_POWER_OFF	31
>  
>  static void ns2_power_off(void)
> @@ -71,8 +35,6 @@ void __init ns2_init(void)
>  	/*
>  	 * Basic setup. Needs to be called early.
>  	 */
> -	kirkwood_mpp_conf(ns2_mpp_config);
> -
>  	if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
>  	    of_machine_is_compatible("lacie,netspace_mini_v2"))
>  		ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
> -- 
> 1.7.10
> 

Acked-by: Andrew Lunn <andrew@lunn.ch>

	  Andrew
Simon Guinot Jan. 8, 2013, 4:18 p.m. UTC | #5
On Tue, Jan 08, 2013 at 05:15:53PM +0100, Andrew Lunn wrote:
> On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> > Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> > Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> > gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> > on the pinctrl driver, then a pinctrl definition must be given to allow
> > the GPIO configuration.
> > 
> > Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> > ---
> >  arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   16 ++++++++++++
> >  arch/arm/mach-kirkwood/board-ns2.c         |   38 ----------------------------
> >  2 files changed, 16 insertions(+), 38 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > index 9bc6785..77d21ab 100644
> > --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
> > @@ -1,4 +1,5 @@
> >  /include/ "kirkwood.dtsi"
> > +/include/ "kirkwood-6281.dtsi"
> >  
> >  / {
> >  	chosen {
> > @@ -6,6 +7,21 @@
> >  	};
> >  
> >  	ocp@f1000000 {
> > +		pinctrl: pinctrl@10000 {
> > +			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
> > +					&pmx_ns2_sata0 &pmx_ns2_sata1>;
> > +			pinctrl-names = "default";
> > +
> > +			pmx_ns2_sata0: pmx-ns2-sata0 {
> > +				marvell,pins = "mpp21";
> > +				marvell,function = "sata0";
> > +			};
> > +			pmx_ns2_sata1: pmx-ns2-sata1 {
> > +				marvell,pins = "mpp20";
> > +				marvell,function = "sata1";
> > +			};
> > +		};
> > +
> >  		serial@12000 {
> >  			clock-frequency = <166666667>;
> >  			status = "okay";
> > diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
> > index 8821720..f4632a8 100644
> > --- a/arch/arm/mach-kirkwood/board-ns2.c
> > +++ b/arch/arm/mach-kirkwood/board-ns2.c
> > @@ -18,47 +18,11 @@
> >  #include <linux/gpio.h>
> >  #include <linux/of.h>
> >  #include "common.h"
> > -#include "mpp.h"
> >  
> >  static struct mv643xx_eth_platform_data ns2_ge00_data = {
> >  	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
> >  };
> >  
> > -static unsigned int ns2_mpp_config[] __initdata = {
> > -	MPP0_SPI_SCn,
> > -	MPP1_SPI_MOSI,
> > -	MPP2_SPI_SCK,
> > -	MPP3_SPI_MISO,
> > -	MPP4_NF_IO6,
> > -	MPP5_NF_IO7,
> > -	MPP6_SYSRST_OUTn,
> > -	MPP7_GPO,		/* Fan speed (bit 1) */
> > -	MPP8_TW0_SDA,
> > -	MPP9_TW0_SCK,
> > -	MPP10_UART0_TXD,
> > -	MPP11_UART0_RXD,
> > -	MPP12_GPO,		/* Red led */
> > -	MPP14_GPIO,		/* USB fuse */
> > -	MPP16_GPIO,		/* SATA 0 power */
> > -	MPP17_GPIO,		/* SATA 1 power */
> > -	MPP18_NF_IO0,
> > -	MPP19_NF_IO1,
> > -	MPP20_SATA1_ACTn,
> > -	MPP21_SATA0_ACTn,
> > -	MPP22_GPIO,		/* Fan speed (bit 0) */
> > -	MPP23_GPIO,		/* Fan power */
> > -	MPP24_GPIO,		/* USB mode select */
> > -	MPP25_GPIO,		/* Fan rotation fail */
> > -	MPP26_GPIO,		/* USB device vbus */
> > -	MPP28_GPIO,		/* USB enable host vbus */
> > -	MPP29_GPIO,		/* Blue led (slow register) */
> > -	MPP30_GPIO,		/* Blue led (command register) */
> > -	MPP31_GPIO,		/* Board power off */
> > -	MPP32_GPIO,		/* Power button (0 = Released, 1 = Pushed) */
> > -	MPP33_GPO,		/* Fan speed (bit 2) */
> > -	0
> > -};
> > -
> >  #define NS2_GPIO_POWER_OFF	31
> >  
> >  static void ns2_power_off(void)
> > @@ -71,8 +35,6 @@ void __init ns2_init(void)
> >  	/*
> >  	 * Basic setup. Needs to be called early.
> >  	 */
> > -	kirkwood_mpp_conf(ns2_mpp_config);
> > -
> >  	if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
> >  	    of_machine_is_compatible("lacie,netspace_mini_v2"))
> >  		ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
> > -- 
> > 1.7.10
> > 
> 
> Acked-by: Andrew Lunn <andrew@lunn.ch>
> 

Do you think it is still possible to merge this patch as a bug fix for
the current release ?

Simon
Thomas Petazzoni Jan. 8, 2013, 4:21 p.m. UTC | #6
Dear Andrew Lunn,

On Tue, 8 Jan 2013 17:13:10 +0100, Andrew Lunn wrote:
> > I was not sure about that. As gpio_request triggers the mpp
> > configuration at run time, IMHO there is no point for an initial and
> > statical configuration, except for a documentation purpose.
> 
> [Goes away and reads Docunmentation/gpio.txt]
> 
> Yes, you appear to be correct. Its not necessary. Don't know that.

Yes, Simon is correct.

 gpio_request()
  -> gpio/gpio-mvebu.c:mvebu_gpio_request()
    -> pinctrl/core.c:pinctrl_request_gpio()
      -> pinctrl/pinmux.c:pinmux_request_gpio()
        -> pinctrl/pinmux.c:pin_request()
          -> pinctrl/mvebu/pinctrl-mvebu.c:mvebu_pinmux_gpio_request_enable()
            -> which muxes the pin as GPIO

Pffiou :-)

Thomas
Andrew Lunn Jan. 8, 2013, 4:30 p.m. UTC | #7
> Do you think it is still possible to merge this patch as a bug fix for
> the current release ?

Hi Simon

The commit log will need some explanation why this is a fix. It
currently looks like it just a conversion. Document what actually goes
wrong and how this fixes it.

    Andrew
Jason Cooper Jan. 8, 2013, 4:39 p.m. UTC | #8
On Tue, Jan 08, 2013 at 05:30:15PM +0100, Andrew Lunn wrote:
> > Do you think it is still possible to merge this patch as a bug fix for
> > the current release ?
> 
> Hi Simon
> 
> The commit log will need some explanation why this is a fix. It
> currently looks like it just a conversion. Document what actually goes
> wrong and how this fixes it.

hmm, I could change the patch subject to:

-ARM: Kirkwood: convert ns2 boards to pinctrl
+ARM: Kirkwood: fix gpio by converting ns2 boards to pinctrl

That's basically what the body says.  Sound good?

thx,

Jason.
Simon Guinot Jan. 8, 2013, 4:55 p.m. UTC | #9
On Tue, Jan 08, 2013 at 11:39:09AM -0500, Jason Cooper wrote:
> On Tue, Jan 08, 2013 at 05:30:15PM +0100, Andrew Lunn wrote:
> > > Do you think it is still possible to merge this patch as a bug fix for
> > > the current release ?
> > 
> > Hi Simon
> > 
> > The commit log will need some explanation why this is a fix. It
> > currently looks like it just a conversion. Document what actually goes
> > wrong and how this fixes it.
> 
> hmm, I could change the patch subject to:
> 
> -ARM: Kirkwood: convert ns2 boards to pinctrl
> +ARM: Kirkwood: fix gpio by converting ns2 boards to pinctrl
> 
> That's basically what the body says.  Sound good?

It would be perfect for me.

Thanks.

Simon
Jason Cooper Jan. 8, 2013, 5:07 p.m. UTC | #10
On Tue, Jan 08, 2013 at 05:55:54PM +0100, Simon Guinot wrote:
> On Tue, Jan 08, 2013 at 11:39:09AM -0500, Jason Cooper wrote:
> > On Tue, Jan 08, 2013 at 05:30:15PM +0100, Andrew Lunn wrote:
> > > > Do you think it is still possible to merge this patch as a bug fix for
> > > > the current release ?
> > > 
> > > Hi Simon
> > > 
> > > The commit log will need some explanation why this is a fix. It
> > > currently looks like it just a conversion. Document what actually goes
> > > wrong and how this fixes it.
> > 
> > hmm, I could change the patch subject to:
> > 
> > -ARM: Kirkwood: convert ns2 boards to pinctrl
> > +ARM: Kirkwood: fix gpio by converting ns2 boards to pinctrl
> > 
> > That's basically what the body says.  Sound good?
> 
> It would be perfect for me.
> 

On second thought, I'll do "fix ns2 gpios by converting to pinctrl"

thx,

Jason.
Simon Guinot Jan. 8, 2013, 5:51 p.m. UTC | #11
On Tue, Jan 08, 2013 at 12:07:36PM -0500, Jason Cooper wrote:
> On Tue, Jan 08, 2013 at 05:55:54PM +0100, Simon Guinot wrote:
> > On Tue, Jan 08, 2013 at 11:39:09AM -0500, Jason Cooper wrote:
> > > On Tue, Jan 08, 2013 at 05:30:15PM +0100, Andrew Lunn wrote:
> > > > > Do you think it is still possible to merge this patch as a bug fix for
> > > > > the current release ?
> > > > 
> > > > Hi Simon
> > > > 
> > > > The commit log will need some explanation why this is a fix. It
> > > > currently looks like it just a conversion. Document what actually goes
> > > > wrong and how this fixes it.
> > > 
> > > hmm, I could change the patch subject to:
> > > 
> > > -ARM: Kirkwood: convert ns2 boards to pinctrl
> > > +ARM: Kirkwood: fix gpio by converting ns2 boards to pinctrl
> > > 
> > > That's basically what the body says.  Sound good?
> > 
> > It would be perfect for me.
> > 
> 
> On second thought, I'll do "fix ns2 gpios by converting to pinctrl"

OK, thanks.

Simon
Jason Cooper Jan. 10, 2013, 1:32 a.m. UTC | #12
On Tue, Jan 08, 2013 at 03:36:18PM +0100, Simon Guinot wrote:
> Note that the pinctrl conversion also fixes GPIO support for ns2 boards.
> Since commit f9e75922: "ARM: Kirkwood: Make use of mvebu pincltl and
> gpio", the mvbu_gpio driver is used for DT boards. As mvbu_gpio relies
> on the pinctrl driver, then a pinctrl definition must be given to allow
> the GPIO configuration.
> 
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>

Applied to mvebu/fixes with the following subject:

    ARM: Kirkwood: fix ns2 gpios by converting to pinctrl

thx,

Jason.
diff mbox

Patch

diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index 9bc6785..77d21ab 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -1,4 +1,5 @@ 
 /include/ "kirkwood.dtsi"
+/include/ "kirkwood-6281.dtsi"
 
 / {
 	chosen {
@@ -6,6 +7,21 @@ 
 	};
 
 	ocp@f1000000 {
+		pinctrl: pinctrl@10000 {
+			pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
+					&pmx_ns2_sata0 &pmx_ns2_sata1>;
+			pinctrl-names = "default";
+
+			pmx_ns2_sata0: pmx-ns2-sata0 {
+				marvell,pins = "mpp21";
+				marvell,function = "sata0";
+			};
+			pmx_ns2_sata1: pmx-ns2-sata1 {
+				marvell,pins = "mpp20";
+				marvell,function = "sata1";
+			};
+		};
+
 		serial@12000 {
 			clock-frequency = <166666667>;
 			status = "okay";
diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
index 8821720..f4632a8 100644
--- a/arch/arm/mach-kirkwood/board-ns2.c
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -18,47 +18,11 @@ 
 #include <linux/gpio.h>
 #include <linux/of.h>
 #include "common.h"
-#include "mpp.h"
 
 static struct mv643xx_eth_platform_data ns2_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
 };
 
-static unsigned int ns2_mpp_config[] __initdata = {
-	MPP0_SPI_SCn,
-	MPP1_SPI_MOSI,
-	MPP2_SPI_SCK,
-	MPP3_SPI_MISO,
-	MPP4_NF_IO6,
-	MPP5_NF_IO7,
-	MPP6_SYSRST_OUTn,
-	MPP7_GPO,		/* Fan speed (bit 1) */
-	MPP8_TW0_SDA,
-	MPP9_TW0_SCK,
-	MPP10_UART0_TXD,
-	MPP11_UART0_RXD,
-	MPP12_GPO,		/* Red led */
-	MPP14_GPIO,		/* USB fuse */
-	MPP16_GPIO,		/* SATA 0 power */
-	MPP17_GPIO,		/* SATA 1 power */
-	MPP18_NF_IO0,
-	MPP19_NF_IO1,
-	MPP20_SATA1_ACTn,
-	MPP21_SATA0_ACTn,
-	MPP22_GPIO,		/* Fan speed (bit 0) */
-	MPP23_GPIO,		/* Fan power */
-	MPP24_GPIO,		/* USB mode select */
-	MPP25_GPIO,		/* Fan rotation fail */
-	MPP26_GPIO,		/* USB device vbus */
-	MPP28_GPIO,		/* USB enable host vbus */
-	MPP29_GPIO,		/* Blue led (slow register) */
-	MPP30_GPIO,		/* Blue led (command register) */
-	MPP31_GPIO,		/* Board power off */
-	MPP32_GPIO,		/* Power button (0 = Released, 1 = Pushed) */
-	MPP33_GPO,		/* Fan speed (bit 2) */
-	0
-};
-
 #define NS2_GPIO_POWER_OFF	31
 
 static void ns2_power_off(void)
@@ -71,8 +35,6 @@  void __init ns2_init(void)
 	/*
 	 * Basic setup. Needs to be called early.
 	 */
-	kirkwood_mpp_conf(ns2_mpp_config);
-
 	if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
 	    of_machine_is_compatible("lacie,netspace_mini_v2"))
 		ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);