[U-Boot] [PATCH v2 2/2] ARM: lacie_kw: add support for WIRELESS_SPACE

Simon Guinot simon.guinot at sequanux.org
Sat Oct 20 02:17:23 CEST 2012


On Fri, Oct 19, 2012 at 11:38:09PM +0200, Albert ARIBAUD wrote:
> Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
> Changes in v2:
> - split the patch in two: mvgbe phy/port changes and WS support.
> - removed spurious DEBUG define
> - fixed various checkpatch errors/warnings/typos
> 
>  board/LaCie/netspace_v2/netspace_v2.c |   44 ++----------
>  board/LaCie/netspace_v2/netspace_v2.h |  121 +++++++++++++++++++++++++++++++++
>  boards.cfg                            |    1 +
>  include/configs/lacie_kw.h            |   42 +++++++++++-
>  4 files changed, 168 insertions(+), 40 deletions(-)

Hi Albert,

Thank you for your work on the Wireless Space. It is nice to have this
patch.

> 
> diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
> index 101a80a..084f0cf 100644
> --- a/board/LaCie/netspace_v2/netspace_v2.c
> +++ b/board/LaCie/netspace_v2/netspace_v2.c
> @@ -39,40 +39,7 @@ int board_early_init_f(void)
>  			NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
>  
>  	/* Multi-Purpose Pins Functionality configuration */
> -	u32 kwmpp_config[] = {
> -		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_TW_SDA,
> -		MPP9_TW_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 vbus-in detection */
> -		MPP28_GPIO,		/* USB enable vbus-out */
> -		MPP29_GPIO,		/* Blue led (slow register) */
> -		MPP30_GPIO,		/* Blue led (command register) */
> -		MPP31_GPIO,		/* Board power off */
> -		MPP32_GPIO,		/* Button (0 = Released, 1 = Pushed) */
> -		MPP33_GPIO,		/* Fan speed (bit 2) */
> -		0
> -	};
> +	u32 kwmpp_config[] = NETSPACE_V2_MPP_CONFIG;
>  	kirkwood_mpp_conf(kwmpp_config, NULL);
>  
>  	return 0;
> @@ -107,10 +74,11 @@ int misc_init_r(void)
>  /* Configure and initialize PHY */
>  void reset_phy(void)
>  {
> -#if defined(CONFIG_NETSPACE_LITE_V2) || defined(CONFIG_NETSPACE_MINI_V2)
> -	mv_phy_88e1318_init("egiga0", 0);
> -#else
> -	mv_phy_88e1116_init("egiga0", 8);
> +#ifdef CONFIG_EGIGA0_PHY
> +	mv_phy_88e1116_init("egiga0", CONFIG_EGIGA0_PHY);
> +#endif
> +#ifdef CONFIG_EGIGA1_PHY
> +	mv_phy_88e1116_init("egiga1", CONFIG_EGIGA1_PHY);
>  #endif
>  }
>  #endif
> diff --git a/board/LaCie/netspace_v2/netspace_v2.h b/board/LaCie/netspace_v2/netspace_v2.h
> index 34e492c..1f0eefd 100644
> --- a/board/LaCie/netspace_v2/netspace_v2.h
> +++ b/board/LaCie/netspace_v2/netspace_v2.h
> @@ -24,11 +24,132 @@
>  #define NETSPACE_V2_H
>  
>  /* GPIO configuration */
> +
> +/* Net Space V2, Net Space Max V2, Internet Space V2: */
> +#if defined(CONFIG_NETSPACE_MAX_V2) \
> +	|| defined(CONFIG_NETSPACE_V2) \
> +	|| defined(CONFIG_NET2BIG_V2) \
> +	|| defined(CONFIG_INETSPACE_V2)

I think you missed here a couple of 'defined()' for the boards ns2lite
and ns2mini.

Moreover, don't you think that the Wireless Space could have his own
board files ? I mean, there is almost no common hardware between ws and
ns2 boards. I think it is confusing to have NETSPACE_V2_ macros to
designate MPP and GPIO configuration for both ns2 and ws.

> +
>  #define NETSPACE_V2_OE_LOW		0x06004000
>  #define NETSPACE_V2_OE_HIGH		0x00000031
>  #define NETSPACE_V2_OE_VAL_LOW		0x10030000
>  #define NETSPACE_V2_OE_VAL_HIGH		0x00000000
>  
> +/* Wireless Space */
> +
> +#elif defined(CONFIG_WIRELESS_SPACE)
> +
> +#define NETSPACE_V2_OE_LOW		0xFF006808
> +#define NETSPACE_V2_OE_HIGH		0x0000F989
> +#define NETSPACE_V2_OE_VAL_LOW		0x00000000
> +#define NETSPACE_V2_OE_VAL_HIGH		0x00000000
> +
> +#else
> +
> +#error Undefined or unsupported LaCie KW board variant
> +
> +#endif
> +
>  #define NETSPACE_V2_GPIO_BUTTON         32
>  
> +/* MPP configuration */
> +
> +/* Net Space V2, Net Space Max V2, Internet Space V2: */
> +#if defined(CONFIG_NETSPACE_MAX_V2) \
> +	|| defined(CONFIG_NETSPACE_V2) \
> +	|| defined(CONFIG_NET2BIG_V2) \
> +	|| defined(CONFIG_INETSPACE_V2)
> +
> +#define NETSPACE_V2_MPP_CONFIG	{ \
> +	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_TW_SDA, \
> +	MPP9_TW_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 vbus-in detection */ \
> +	MPP28_GPIO,		/* USB enable vbus-out */ \
> +	MPP29_GPIO,		/* Blue led (slow register) */ \
> +	MPP30_GPIO,		/* Blue led (command register) */ \
> +	MPP31_GPIO,		/* Board power off */ \
> +	MPP32_GPIO,		/* Button (0 = Released, 1 = Pushed) */ \
> +	MPP33_GPIO,		/* Fan speed (bit 2) */ \
> +	0 \
> +	}
> +
> +#elif defined(CONFIG_WIRELESS_SPACE)
> +
> +#define NETSPACE_V2_MPP_CONFIG	{ \
> +	MPP0_NF_IO2, \
> +	MPP1_NF_IO3, \
> +	MPP2_NF_IO4, \
> +	MPP3_NF_IO5, \
> +	MPP4_NF_IO6, \
> +	MPP5_NF_IO7, \
> +	MPP6_SYSRST_OUTn, \
> +	MPP7_GPO,		/* Fan speed (bit 1) */ \
> +	MPP8_TW_SDA, \
> +	MPP9_TW_SCK, \
> +	MPP10_UART0_TXD, \
> +	MPP11_UART0_RXD, \
> +	MPP13_GPIO,		/* Red led */ \
> +	MPP14_GPIO,		/* USB fuse */ \
> +	MPP15_SATA0_ACTn, \
> +	MPP16_GPIO,		/* SATA 0 power */ \
> +	MPP17_GPIO,		/* SATA 1 power */ \
> +	MPP18_NF_IO0, \
> +	MPP19_NF_IO1, \
> +	MPP20_GE1_0,		/* Gigabit Ethernet 1 */ \
> +	MPP21_GE1_1, \
> +	MPP22_GE1_2, \
> +	MPP23_GE1_3, \
> +	MPP24_GE1_4, \
> +	MPP25_GE1_5, \
> +	MPP26_GE1_6, \
> +	MPP27_GE1_7, \
> +	MPP28_GE1_8, \
> +	MPP29_GE1_9, \
> +	MPP30_GE1_10, \
> +	MPP31_GE1_11, \
> +	MPP32_GE1_12, \
> +	MPP33_GE1_13, \
> +	MPP34_GE1_14, \
> +	MPP35_GE1_15, \
> +	MPP36_GPIO,		/* Fan speed (bit 2) */ \
> +	MPP37_GPIO,		/* Fan speed (bit 0) */ \
> +	MPP38_GPIO,		/* Fan power */ \
> +	MPP39_GPIO,		/* Fan rotation fail */ \
> +	MPP40_GPIO,		/* Ethernet switch link */ \
> +	MPP41_GPIO,		/* USB enable host vbus */ \
> +	MPP42_GPIO,		/* LED clock control */ \
> +	MPP43_GPIO,		/* WPS button (0=Pushed, 1=Released) */ \
> +	MPP44_GPIO,		/* Red LED on/off */ \
> +	MPP45_GPIO,		/* Red LED timer blink (on=off=100ms) */ \
> +	MPP46_GPIO,		/* Green LED on/off */ \
> +	MPP47_GPIO,		/* LED (blue, green) SATA activity blink */ \
> +	MPP48_GPIO,		/* Blue LED on/off */ \
> +	0 \
> +	}
> +
> +#endif
> +
>  #endif /* NETSPACE_V2_H */
> diff --git a/boards.cfg b/boards.cfg
> index d467f56..3f49b18 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -168,6 +168,7 @@ netspace_lite_v2             arm         arm926ejs   netspace_v2         LaCie
>  netspace_max_v2              arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_MAX_V2
>  netspace_mini_v2             arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_MINI_V2
>  netspace_v2                  arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_V2
> +wireless_space               arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:WIRELESS_SPACE
>  dreamplug                    arm         arm926ejs   -                   Marvell        kirkwood
>  guruplug                     arm         arm926ejs   -                   Marvell        kirkwood
>  mv88f6281gtw_ge              arm         arm926ejs   -                   Marvell        kirkwood
> diff --git a/include/configs/lacie_kw.h b/include/configs/lacie_kw.h
> index 09b5798..fdbc785 100644
> --- a/include/configs/lacie_kw.h
> +++ b/include/configs/lacie_kw.h
> @@ -44,6 +44,10 @@
>  #elif defined(CONFIG_NET2BIG_V2)
>  #define CONFIG_MACH_TYPE		MACH_TYPE_NET2BIG_V2
>  #define CONFIG_IDENT_STRING		" 2Big v2"
> +#elif defined(CONFIG_WIRELESS_SPACE)
> +#define MACH_TYPE_WIRELESS_SPACE	2500 /* is missing in mach-types.h */
> +#define CONFIG_MACH_TYPE		MACH_TYPE_WIRELESS_SPACE
> +#define CONFIG_IDENT_STRING		" Wireless Space"
>  #else
>  #error "Unknown board"
>  #endif
> @@ -96,6 +100,12 @@
>  #define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-ns2l.cfg
>  #endif
>  
> +#ifdef CONFIG_WIRELESS_SPACE
> +/* No SPI but NAND */
> +#undef CONFIG_CMD_SF
> +#define CONFIG_CMD_NAND
> +#endif
> +
>  /*
>   * mv-common.h should be defined after CMD configs since it used them
>   * to enable certain macros
> @@ -115,8 +125,14 @@
>  #define CONFIG_SYS_PROMPT		"d2v2> "
>  #elif defined(CONFIG_NET2BIG_V2)
>  #define CONFIG_SYS_PROMPT		"2big2> "
> -#else
> +#elif defined(CONFIG_NETSPACE_V2)
>  #define CONFIG_SYS_PROMPT		"ns2> "
> +#elif defined(CONFIG_INETSPACE_V2)
> +#define CONFIG_SYS_PROMPT		"is2> "
> +#elif defined(CONFIG_WIRELESS_SPACE)
> +#define CONFIG_SYS_PROMPT		"ws> "
> +#else
> +#define CONFIG_SYS_PROMPT		"lacie-kw> "

Maybe you may add here the prompts for the ns2mini and ns2lite boards.
Also, we could move all the prompts with the machine number definitions.
This would allow to remove a couple of ifdef statements.

>  #endif
>  
>  /*
> @@ -124,9 +140,22 @@
>   */
>  #ifdef CONFIG_CMD_NET
>  #define CONFIG_MISC_INIT_R /* Call misc_init_r() to initialize MAC address */
> +#if defined(CONFIG_WIRELESS_SPACE)
> +#define CONFIG_MVGBE_PORTS		{1, 1}	/* enable both ports */
> +#define CONFIG_EGIGA1_PHY		0x6	/* ONLY egiga1 has a PHY */
> +#define CONFIG_MVGBE_PHY_ADRS	{0xa, 0x6}
> +#define CONFIG_MII
> +#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
> +#else
>  #define CONFIG_MVGBE_PORTS		{1, 0} /* enable port 0 only */
> -#define CONFIG_NETCONSOLE
> +#if defined(CONFIG_NETSPACE_LITE_V2) || defined(CONFIG_NETSPACE_MINI_V2)
> +#define CONFIG_EGIGA0_PHY		0x0
> +#else
> +#define CONFIG_EGIGA0_PHY		0x8
>  #endif
> +#endif /* CONFIG_WIRELESS_SPACE */
> +#define CONFIG_NETCONSOLE
> +#endif /* CONFIG_CMD_NET */
>  
>  /*
>   * SATA Driver configuration
> @@ -186,11 +215,20 @@
>  /*
>   * Environment variables configurations
>   */
> +
> +#if defined(CONFIG_WIRELESS_SPACE)
> +#define CONFIG_ENV_IS_IN_NAND
> +#define CONFIG_ENV_SECT_SIZE		0x10000	/* 64KB */
> +#define CONFIG_ENV_SIZE			0x1000	/* 4KB */
> +#define CONFIG_ENV_ADDR			0x70000
> +#define CONFIG_ENV_OFFSET		0x70000	/* env starts here */
> +#else
>  #define CONFIG_ENV_IS_IN_SPI_FLASH
>  #define CONFIG_ENV_SECT_SIZE		0x10000	/* 64KB */
>  #define CONFIG_ENV_SIZE			0x1000	/* 4KB */
>  #define CONFIG_ENV_ADDR			0x70000
>  #define CONFIG_ENV_OFFSET		0x70000	/* env starts here */
> +#endif

There is some reason for the duplicate lines here ?

Regards,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121020/f60021ed/attachment.pgp>


More information about the U-Boot mailing list