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

Albert ARIBAUD albert.u.boot at aribaud.net
Thu Aug 16 20:08:34 CEST 2012


Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
---

This patch adds the Wireless Space to the lacie_kw sub-targets.
It *should* not change a thing to the already existing sub-targets
(except that each one gets its own prompt).

Owners of NETSPACE_[MAX]_V2, INETSPACE_V2, NET2BIG_V2 please test.

 board/LaCie/netspace_v2/netspace_v2.c |   42 ++----------
 board/LaCie/netspace_v2/netspace_v2.h |  121 +++++++++++++++++++++++++++++++++
 boards.cfg                            |    1 +
 drivers/net/mvgbe.c                   |   10 ++-
 include/configs/lacie_kw.h            |   38 ++++++++++-
 5 files changed, 175 insertions(+), 37 deletions(-)

diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index 68e8a77..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,7 +74,12 @@ int misc_init_r(void)
 /* Configure and initialize PHY */
 void reset_phy(void)
 {
-	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..fc1d571 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)
+
 #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=100ms, 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 edd750c..f001b29 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -157,6 +157,7 @@ inetspace_v2                 arm         arm926ejs   netspace_v2         LaCie
 net2big_v2                   arm         arm926ejs   net2big_v2          LaCie          kirkwood	lacie_kw:NET2BIG_V2
 netspace_max_v2              arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_MAX_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/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 47bf27c..670edb0 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -653,6 +653,14 @@ int mvgbe_initialize(bd_t *bis)
 	struct eth_device *dev;
 	int devnum;
 	u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
+#if defined(CONFIG_MVGBE_PHY_ADRS)
+#define MVGBE_PHY_ADRS CONFIG_MVGBE_PHY_ADRS
+#elif defined(CONFIG_PHY_BASE_ADR)
+#define MVGBE_PHY_ADRS {CONFIG_PHY_BASE_ADR,CONFIG_PHY_BASE_ADR+1}
+#else
+#define MVGBE_PHY_ADRS {8,9}
+#endif
+ 	u8 used_phy_adrs[MAX_MVGBE_DEVS] = MVGBE_PHY_ADRS;
 
 	for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
 		/*skip if port is configured not to use */
@@ -733,7 +741,7 @@ error1:
 		miiphy_register(dev->name, smi_reg_read, smi_reg_write);
 		/* Set phy address of the port */
 		miiphy_write(dev->name, MV_PHY_ADR_REQUEST,
-				MV_PHY_ADR_REQUEST, PHY_BASE_ADR + devnum);
+				MV_PHY_ADR_REQUEST, used_phy_adrs[devnum]);
 #endif
 	}
 	return 0;
diff --git a/include/configs/lacie_kw.h b/include/configs/lacie_kw.h
index c35c2db..a979ab4 100644
--- a/include/configs/lacie_kw.h
+++ b/include/configs/lacie_kw.h
@@ -33,6 +33,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
@@ -73,6 +77,12 @@
 #define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-is2.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
@@ -90,8 +100,14 @@
 #define CONFIG_SYS_IDE_MAXDEVICE        1
 #if 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> "
 #endif
 
 /*
@@ -99,7 +115,16 @@
  */
 #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 only */
+#define CONFIG_EGIGA1_PHY		0x6		/* egiga1 has a PHY, egiga0 has NOT */
+#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_EGIGA0_PHY		0x8
+#endif
 #define CONFIG_NETCONSOLE
 #endif
 
@@ -154,11 +179,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
 
 /*
  * Default environment variables
@@ -185,4 +219,6 @@
 	"usbload=usb start && "					\
 		"fatload usb 0:1 $loadaddr /boot/$bootfile\0"
 
+//#define DEBUG
+
 #endif /* _CONFIG_LACIE_KW_H */
-- 
1.7.9.5



More information about the U-Boot mailing list