[U-Boot] [PATCH v4 08/19] SPEAr : Network support configured for spear SoCs

From: Vipin KUMAR vipin.kumar@st.com
Signed-off-by: Vipin Kumar vipin.kumar@st.com --- arch/arm/include/asm/arch-spear/hardware.h | 1 + board/spear/spear300/spear300.c | 11 +++++++++++ board/spear/spear310/spear310.c | 11 +++++++++++ board/spear/spear320/spear320.c | 11 +++++++++++ board/spear/spear600/spear600.c | 11 +++++++++++ include/configs/spear-common.h | 14 ++++++++++++-- include/configs/spear3xx.h | 3 +++ 7 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index 818f36c..39d64b6 100644 --- a/arch/arm/include/asm/arch-spear/hardware.h +++ b/arch/arm/include/asm/arch-spear/hardware.h @@ -31,6 +31,7 @@ #define CONFIG_SPEAR_SYSCNTLBASE (0xFCA00000) #define CONFIG_SPEAR_TIMERBASE (0xFC800000) #define CONFIG_SPEAR_MISCBASE (0xFCA80000) +#define CONFIG_SPEAR_ETHBASE (0xE0800000)
#define CONFIG_SYS_NAND_CLE (1 << 16) #define CONFIG_SYS_NAND_ALE (1 << 17) diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c index 60ee544..744a17b 100644 --- a/board/spear/spear300/spear300.c +++ b/board/spear/spear300/spear300.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -56,3 +57,13 @@ int board_nand_init(struct nand_chip *nand)
return -1; } + +int board_eth_init(bd_t *bis) +{ + int ret = 0; +#if defined(CONFIG_DESIGNWARE_ETH) + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) + ret++; +#endif + return ret; +} diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 03dfe16..666ed48 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -57,3 +58,13 @@ int board_nand_init(struct nand_chip *nand)
return -1; } + +int board_eth_init(bd_t *bis) +{ + int ret = 0; +#if defined(CONFIG_DESIGNWARE_ETH) + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) + ret++; +#endif + return ret; +} diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 2ba2dbb..89b074a 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -57,3 +58,13 @@ int board_nand_init(struct nand_chip *nand)
return -1; } + +int board_eth_init(bd_t *bis) +{ + int ret = 0; +#if defined(CONFIG_DESIGNWARE_ETH) + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) + ret++; +#endif + return ret; +} diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index eef9a37..759b4fa 100644 --- a/board/spear/spear600/spear600.c +++ b/board/spear/spear600/spear600.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -51,3 +52,13 @@ int board_nand_init(struct nand_chip *nand)
return -1; } + +int board_eth_init(bd_t *bis) +{ + int ret = 0; +#if defined(CONFIG_DESIGNWARE_ETH) + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) + ret++; +#endif + return ret; +} diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 10beef7..1398837 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -27,6 +27,14 @@ * Common configurations used for both spear3xx as well as spear6xx */
+/* Ethernet driver configuration */ +#define CONFIG_MII +#define CONFIG_DESIGNWARE_ETH +#define CONFIG_DW_SEARCH_PHY +#define CONFIG_DW0_PHY 1 +#define CONFIG_NET_MULTI +#define CONFIG_PHY_RESET_DELAY (10000) /* in usec */ + /* USBD driver configuration */ #define CONFIG_SPEARUDC #define CONFIG_USB_DEVICE @@ -99,11 +107,13 @@ #define CONFIG_CMD_MEMORY #define CONFIG_CMD_RUN #define CONFIG_CMD_SAVES +#define CONFIG_CMD_NET +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP
/* This must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <config_cmd_default.h> -#undef CONFIG_CMD_NET -#undef CONFIG_CMD_NFS
/* * Default Environment Varible definitions diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 0248aba..502c50f 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx.h @@ -41,6 +41,9 @@
#include <configs/spear-common.h>
+/* Ethernet driver configuration */ +#define CONFIG_DW_ALTDESCRIPTOR 1 + /* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000

From: Vipin KUMAR vipin.kumar@st.com
SPEAr310 and SPEAr320 SoCs have an extra ethernet controller. The driver for this device is already supported by u-boot, so configuring board configuration file and defining base addresses etc to make use of the common driver
Signed-off-by: Vipin Kumar vipin.kumar@st.com --- arch/arm/include/asm/arch-spear/clk.h | 27 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/hardware.h | 7 +++++++ board/spear/spear310/spear310.c | 17 +++++++++++++++++ board/spear/spear320/spear320.c | 5 +++++ include/configs/spear3xx.h | 13 +++++++++++++ 5 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-spear/clk.h
diff --git a/arch/arm/include/asm/arch-spear/clk.h b/arch/arm/include/asm/arch-spear/clk.h new file mode 100644 index 0000000..a45ec18 --- /dev/null +++ b/arch/arm/include/asm/arch-spear/clk.h @@ -0,0 +1,27 @@ +/* + * (C) Copyright 2010 + * Vipin Kumar, STMicroelectronics, vipin.kumar@st.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +static inline unsigned long get_macb_pclk_rate(unsigned int dev_id) +{ + return 83000000; +} diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index 39d64b6..9f1e154 100644 --- a/arch/arm/include/asm/arch-spear/hardware.h +++ b/arch/arm/include/asm/arch-spear/hardware.h @@ -56,6 +56,11 @@ #define CONFIG_SPEAR_EMIBASE (0x4F000000) #define CONFIG_SPEAR_RASBASE (0xB4000000)
+#define CONFIG_SYS_MACB0_BASE (0xB0000000) +#define CONFIG_SYS_MACB1_BASE (0xB0800000) +#define CONFIG_SYS_MACB2_BASE (0xB1000000) +#define CONFIG_SYS_MACB3_BASE (0xB1800000) + #elif defined(CONFIG_SPEAR320) #define CONFIG_SYS_I2C_BASE (0xD0180000) #define CONFIG_SPEAR_FSMCBASE (0x4C000000) @@ -63,5 +68,7 @@ #define CONFIG_SPEAR_EMIBASE (0x40000000) #define CONFIG_SPEAR_RASBASE (0xB3000000)
+#define CONFIG_SYS_MACB0_BASE (0xAA000000) + #endif #endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 666ed48..193fa0c 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -66,5 +66,22 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) ret++; #endif +#if defined(CONFIG_MACB) + if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, + CONFIG_MACB0_PHY) >= 0) + ret++; + + if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE, + CONFIG_MACB1_PHY) >= 0) + ret++; + + if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE, + CONFIG_MACB2_PHY) >= 0) + ret++; + + if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE, + CONFIG_MACB3_PHY) >= 0) + ret++; +#endif return ret; } diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 89b074a..0d9eed4 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -66,5 +66,10 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0) ret++; #endif +#if defined(CONFIG_MACB) + if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, + CONFIG_MACB0_PHY) >= 0) + ret++; +#endif return ret; } diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 502c50f..689d914 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx.h @@ -44,6 +44,19 @@ /* Ethernet driver configuration */ #define CONFIG_DW_ALTDESCRIPTOR 1
+#if defined(CONFIG_SPEAR310) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01 +#define CONFIG_MACB1_PHY 0x03 +#define CONFIG_MACB2_PHY 0x05 +#define CONFIG_MACB3_PHY 0x07 + +#elif defined(CONFIG_SPEAR320) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01 + +#endif + /* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000

These patches incorporate the feedbacks provided by Ben. The patch-set contians only 2 patches. All other subpatches remain unchanged from PATCH v3
http://lists.denx.de/pipermail/u-boot/2010-May/071357.html
Vipin KUMAR (18): change_bit routine defined SPEAr : SMI erase and write timeouts increased SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET SPEAr : Reducing the max RAM size to 128MB SPEAr : Basic arch related support added for SPEAr SoCs SPEAr : Network driver support added SPEAr : Network support configured for spear SoCs SPEAr : macb driver support added for spear310 and spear320 SPEAr : FSMC driver support added SPEAr : Configuring FSMC driver for NAND interface SPEAr : i2c driver moved completely into drivers/i2c SPEAr : smi driver moved completely into drivers/mtd SPEAr : USB Device Controller driver support added SPEAr : Supporting various configurations for spear3xx and spear6xx boards SPEAr : Basic spear1300 architecture support added SPEAr : spear1300 SoC support added SPEAr : Removing extraneous code SPEAr : USB device controller bugfixes
Wolfgang Denk (1): Makefile: fix out-of-tree building of "u-boot.img" target
MAINTAINERS | 1 + MAKEALL | 1 + Makefile | 30 +- arch/arm/cpu/arm926ejs/spear/Makefile | 3 +- arch/arm/cpu/arm926ejs/spear/cpu.c | 78 +++ arch/arm/cpu/arm_cortexa8/spear13xx/Makefile | 52 ++ arch/arm/cpu/arm_cortexa8/spear13xx/cache.S | 114 +++++ arch/arm/cpu/arm_cortexa8/spear13xx/cpu.c | 96 ++++ .../arm_cortexa8/spear13xx/reset.c} | 52 +-- arch/arm/cpu/arm_cortexa8/spear13xx/timer.c | 138 +++++ .../arm/include/asm/arch-spear/clk.h | 26 +- arch/arm/include/asm/arch-spear/hardware.h | 16 +- arch/arm/include/asm/arch-spear/spr_misc.h | 5 + .../arm/include/asm/arch-spear13xx/hardware.h | 33 +- arch/arm/include/asm/arch-spear13xx/spr_gpt.h | 85 ++++ arch/arm/include/asm/arch-spear13xx/spr_misc.h | 317 ++++++++++++ .../arm/include/asm/arch-spear13xx/sys_proto.h | 29 +- arch/arm/include/asm/bitops.h | 11 +- board/spear/common/Makefile | 10 +- board/spear/common/spr_misc.c | 28 +- board/spear/spear1300/Makefile | 51 ++ board/spear/spear1300/config.mk | 28 + board/spear/spear1300/spear1300.c | 88 ++++ .../spear/spear1300/spr_lowlevel_init.S | 35 +- board/spear/spear300/config.mk | 11 - board/spear/spear300/spear300.c | 18 +- board/spear/spear310/config.mk | 11 - board/spear/spear310/spear310.c | 35 ++- board/spear/spear320/config.mk | 11 - board/spear/spear320/spear320.c | 23 +- board/spear/spear600/config.mk | 11 - board/spear/spear600/spear600.c | 18 +- doc/README.designware_eth | 25 + doc/README.spear | 46 ++- drivers/i2c/Makefile | 2 +- drivers/i2c/{spr_i2c.c => designware_i2c.c} | 4 +- .../spr_i2c.h => drivers/i2c/designware_i2c.h | 6 +- drivers/mtd/Makefile | 2 +- drivers/mtd/nand/Makefile | 2 +- drivers/mtd/nand/fsmc_nand.c | 366 ++++++++++++++ drivers/mtd/nand/spr_nand.c | 124 ----- drivers/mtd/{spr_smi.c => st_smi.c} | 59 ++- .../arch-spear/spr_smi.h => drivers/mtd/st_smi.h | 8 +- drivers/net/Makefile | 1 + drivers/net/designware.c | 531 ++++++++++++++++++++ drivers/net/designware.h | 264 ++++++++++ drivers/serial/usbtty.h | 4 +- drivers/usb/gadget/Makefile | 2 +- drivers/usb/gadget/{spr_udc.c => designware_udc.c} | 116 +++-- include/configs/spear-common.h | 33 +- include/configs/spear13xx_evb.h | 202 ++++++++ include/configs/{spear3xx.h => spear3xx_evb.h} | 30 ++ include/configs/{spear6xx.h => spear6xx_evb.h} | 13 + include/linux/mtd/fsmc_nand.h | 104 ++++ include/netdev.h | 1 + include/usb/{spr_udc.h => designware_udc.h} | 6 +- 56 files changed, 2996 insertions(+), 420 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/spear/cpu.c create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/Makefile create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/cache.S create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/cpu.c rename arch/arm/{include/asm/arch-spear/spr_nand.h => cpu/arm_cortexa8/spear13xx/reset.c} (50%) mode change 100644 => 100755 create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/timer.c copy include/configs/spear6xx.h => arch/arm/include/asm/arch-spear/clk.h (64%) copy include/configs/spear6xx.h => arch/arm/include/asm/arch-spear13xx/hardware.h (58%) create mode 100644 arch/arm/include/asm/arch-spear13xx/spr_gpt.h create mode 100644 arch/arm/include/asm/arch-spear13xx/spr_misc.h copy include/configs/spear6xx.h => arch/arm/include/asm/arch-spear13xx/sys_proto.h (64%) create mode 100644 board/spear/spear1300/Makefile create mode 100644 board/spear/spear1300/config.mk create mode 100644 board/spear/spear1300/spear1300.c copy include/configs/spear6xx.h => board/spear/spear1300/spr_lowlevel_init.S (56%) create mode 100644 doc/README.designware_eth rename drivers/i2c/{spr_i2c.c => designware_i2c.c} (98%) rename arch/arm/include/asm/arch-spear/spr_i2c.h => drivers/i2c/designware_i2c.h (98%) create mode 100644 drivers/mtd/nand/fsmc_nand.c delete mode 100644 drivers/mtd/nand/spr_nand.c rename drivers/mtd/{spr_smi.c => st_smi.c} (94%) rename arch/arm/include/asm/arch-spear/spr_smi.h => drivers/mtd/st_smi.h (96%) create mode 100644 drivers/net/designware.c create mode 100644 drivers/net/designware.h rename drivers/usb/gadget/{spr_udc.c => designware_udc.c} (91%) create mode 100644 include/configs/spear13xx_evb.h rename include/configs/{spear3xx.h => spear3xx_evb.h} (85%) rename include/configs/{spear6xx.h => spear6xx_evb.h} (82%) create mode 100644 include/linux/mtd/fsmc_nand.h rename include/usb/{spr_udc.h => designware_udc.h} (98%)

On Thu, Jun 3, 2010 at 4:50 AM, Vipin KUMAR vipin.kumar@st.com wrote:
From: Vipin KUMAR vipin.kumar@st.com
SPEAr310 and SPEAr320 SoCs have an extra ethernet controller. The driver for this device is already supported by u-boot, so configuring board configuration file and defining base addresses etc to make use of the common driver
Signed-off-by: Vipin Kumar vipin.kumar@st.com
Acked-by: Ben Warren biggerbadderben@gmail.com
arch/arm/include/asm/arch-spear/clk.h | 27 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/hardware.h | 7 +++++++ board/spear/spear310/spear310.c | 17 +++++++++++++++++ board/spear/spear320/spear320.c | 5 +++++ include/configs/spear3xx.h | 13 +++++++++++++ 5 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-spear/clk.h
diff --git a/arch/arm/include/asm/arch-spear/clk.h b/arch/arm/include/asm/arch-spear/clk.h new file mode 100644 index 0000000..a45ec18 --- /dev/null +++ b/arch/arm/include/asm/arch-spear/clk.h @@ -0,0 +1,27 @@ +/*
- (C) Copyright 2010
- Vipin Kumar, STMicroelectronics, vipin.kumar@st.com
- See file CREDITS for list of people who contributed to this
- project.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
- */
+static inline unsigned long get_macb_pclk_rate(unsigned int dev_id) +{
return 83000000;
+} diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index 39d64b6..9f1e154 100644 --- a/arch/arm/include/asm/arch-spear/hardware.h +++ b/arch/arm/include/asm/arch-spear/hardware.h @@ -56,6 +56,11 @@ #define CONFIG_SPEAR_EMIBASE (0x4F000000) #define CONFIG_SPEAR_RASBASE (0xB4000000)
+#define CONFIG_SYS_MACB0_BASE (0xB0000000) +#define CONFIG_SYS_MACB1_BASE (0xB0800000) +#define CONFIG_SYS_MACB2_BASE (0xB1000000) +#define CONFIG_SYS_MACB3_BASE (0xB1800000)
#elif defined(CONFIG_SPEAR320) #define CONFIG_SYS_I2C_BASE (0xD0180000) #define CONFIG_SPEAR_FSMCBASE (0x4C000000) @@ -63,5 +68,7 @@ #define CONFIG_SPEAR_EMIBASE (0x40000000) #define CONFIG_SPEAR_RASBASE (0xB3000000)
+#define CONFIG_SYS_MACB0_BASE (0xAA000000)
#endif #endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 666ed48..193fa0c 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -66,5 +66,22 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
#endif +#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
CONFIG_MACB0_PHY) >= 0)
ret++;
if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE,
CONFIG_MACB1_PHY) >= 0)
ret++;
if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE,
CONFIG_MACB2_PHY) >= 0)
ret++;
if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE,
CONFIG_MACB3_PHY) >= 0)
ret++;
+#endif return ret; } diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 89b074a..0d9eed4 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -66,5 +66,10 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
#endif +#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
CONFIG_MACB0_PHY) >= 0)
ret++;
+#endif return ret; } diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 502c50f..689d914 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx.h @@ -44,6 +44,19 @@ /* Ethernet driver configuration */ #define CONFIG_DW_ALTDESCRIPTOR 1
+#if defined(CONFIG_SPEAR310) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01 +#define CONFIG_MACB1_PHY 0x03 +#define CONFIG_MACB2_PHY 0x05 +#define CONFIG_MACB3_PHY 0x07
+#elif defined(CONFIG_SPEAR320) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01
+#endif
/* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000
-- 1.6.0.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Sat, Jun 5, 2010 at 8:13 PM, Ben Warren biggerbadderben@gmail.com wrote:
On Thu, Jun 3, 2010 at 4:50 AM, Vipin KUMAR vipin.kumar@st.com wrote:
From: Vipin KUMAR vipin.kumar@st.com
SPEAr310 and SPEAr320 SoCs have an extra ethernet controller. The driver for this device is already supported by u-boot, so configuring board configuration file and defining base addresses etc to make use of the common driver
Signed-off-by: Vipin Kumar vipin.kumar@st.com
Acked-by: Ben Warren biggerbadderben@gmail.com
Thanks Ben
arch/arm/include/asm/arch-spear/clk.h | 27 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/hardware.h | 7 +++++++ board/spear/spear310/spear310.c | 17 +++++++++++++++++ board/spear/spear320/spear320.c | 5 +++++ include/configs/spear3xx.h | 13 +++++++++++++ 5 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-spear/clk.h
diff --git a/arch/arm/include/asm/arch-spear/clk.h b/arch/arm/include/asm/arch-spear/clk.h new file mode 100644 index 0000000..a45ec18 --- /dev/null +++ b/arch/arm/include/asm/arch-spear/clk.h @@ -0,0 +1,27 @@ +/*
- (C) Copyright 2010
- Vipin Kumar, STMicroelectronics, vipin.kumar@st.com
- See file CREDITS for list of people who contributed to this
- project.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
- */
+static inline unsigned long get_macb_pclk_rate(unsigned int dev_id) +{
- return 83000000;
+} diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index 39d64b6..9f1e154 100644 --- a/arch/arm/include/asm/arch-spear/hardware.h +++ b/arch/arm/include/asm/arch-spear/hardware.h @@ -56,6 +56,11 @@ #define CONFIG_SPEAR_EMIBASE (0x4F000000) #define CONFIG_SPEAR_RASBASE (0xB4000000)
+#define CONFIG_SYS_MACB0_BASE (0xB0000000) +#define CONFIG_SYS_MACB1_BASE (0xB0800000) +#define CONFIG_SYS_MACB2_BASE (0xB1000000) +#define CONFIG_SYS_MACB3_BASE (0xB1800000)
#elif defined(CONFIG_SPEAR320) #define CONFIG_SYS_I2C_BASE (0xD0180000) #define CONFIG_SPEAR_FSMCBASE (0x4C000000) @@ -63,5 +68,7 @@ #define CONFIG_SPEAR_EMIBASE (0x40000000) #define CONFIG_SPEAR_RASBASE (0xB3000000)
+#define CONFIG_SYS_MACB0_BASE (0xAA000000)
#endif #endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 666ed48..193fa0c 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -66,5 +66,22 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++; #endif +#if defined(CONFIG_MACB)
- if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) >= 0)
- ret++;
- if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE,
- CONFIG_MACB1_PHY) >= 0)
- ret++;
- if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE,
- CONFIG_MACB2_PHY) >= 0)
- ret++;
- if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE,
- CONFIG_MACB3_PHY) >= 0)
- ret++;
+#endif return ret; } diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 89b074a..0d9eed4 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -66,5 +66,10 @@ int board_eth_init(bd_t *bis) if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++; #endif +#if defined(CONFIG_MACB)
- if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) >= 0)
- ret++;
+#endif return ret; } diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 502c50f..689d914 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx.h @@ -44,6 +44,19 @@ /* Ethernet driver configuration */ #define CONFIG_DW_ALTDESCRIPTOR 1
+#if defined(CONFIG_SPEAR310) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01 +#define CONFIG_MACB1_PHY 0x03 +#define CONFIG_MACB2_PHY 0x05 +#define CONFIG_MACB3_PHY 0x07
+#elif defined(CONFIG_SPEAR320) +#define CONFIG_MACB 1 +#define CONFIG_MACB0_PHY 0x01
+#endif
/* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000
-- 1.6.0.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Thu, Jun 3, 2010 at 4:50 AM, Vipin KUMAR vipin.kumar@st.com wrote:
From: Vipin KUMAR vipin.kumar@st.com
Signed-off-by: Vipin Kumar vipin.kumar@st.com
Acked-by: Ben Warren biggerbadderben@gmail.com
arch/arm/include/asm/arch-spear/hardware.h | 1 + board/spear/spear300/spear300.c | 11 +++++++++++ board/spear/spear310/spear310.c | 11 +++++++++++ board/spear/spear320/spear320.c | 11 +++++++++++ board/spear/spear600/spear600.c | 11 +++++++++++ include/configs/spear-common.h | 14 ++++++++++++-- include/configs/spear3xx.h | 3 +++ 7 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index 818f36c..39d64b6 100644 --- a/arch/arm/include/asm/arch-spear/hardware.h +++ b/arch/arm/include/asm/arch-spear/hardware.h @@ -31,6 +31,7 @@ #define CONFIG_SPEAR_SYSCNTLBASE (0xFCA00000) #define CONFIG_SPEAR_TIMERBASE (0xFC800000) #define CONFIG_SPEAR_MISCBASE (0xFCA80000) +#define CONFIG_SPEAR_ETHBASE (0xE0800000)
#define CONFIG_SYS_NAND_CLE (1 << 16) #define CONFIG_SYS_NAND_ALE (1 << 17) diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c index 60ee544..744a17b 100644 --- a/board/spear/spear300/spear300.c +++ b/board/spear/spear300/spear300.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -56,3 +57,13 @@ int board_nand_init(struct nand_chip *nand)
return -1;
}
+int board_eth_init(bd_t *bis) +{
int ret = 0;
+#if defined(CONFIG_DESIGNWARE_ETH)
if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
+#endif
return ret;
+} diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 03dfe16..666ed48 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -57,3 +58,13 @@ int board_nand_init(struct nand_chip *nand)
return -1;
}
+int board_eth_init(bd_t *bis) +{
int ret = 0;
+#if defined(CONFIG_DESIGNWARE_ETH)
if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
+#endif
return ret;
+} diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 2ba2dbb..89b074a 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -57,3 +58,13 @@ int board_nand_init(struct nand_chip *nand)
return -1;
}
+int board_eth_init(bd_t *bis) +{
int ret = 0;
+#if defined(CONFIG_DESIGNWARE_ETH)
if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
+#endif
return ret;
+} diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index eef9a37..759b4fa 100644 --- a/board/spear/spear600/spear600.c +++ b/board/spear/spear600/spear600.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <netdev.h> #include <nand.h> #include <asm/io.h> #include <asm/arch/hardware.h> @@ -51,3 +52,13 @@ int board_nand_init(struct nand_chip *nand)
return -1;
}
+int board_eth_init(bd_t *bis) +{
int ret = 0;
+#if defined(CONFIG_DESIGNWARE_ETH)
if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY)
= 0)
ret++;
+#endif
return ret;
+} diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 10beef7..1398837 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -27,6 +27,14 @@
- Common configurations used for both spear3xx as well as spear6xx
*/
+/* Ethernet driver configuration */ +#define CONFIG_MII +#define CONFIG_DESIGNWARE_ETH +#define CONFIG_DW_SEARCH_PHY +#define CONFIG_DW0_PHY 1 +#define CONFIG_NET_MULTI +#define CONFIG_PHY_RESET_DELAY (10000) /* in usec */
/* USBD driver configuration */ #define CONFIG_SPEARUDC #define CONFIG_USB_DEVICE @@ -99,11 +107,13 @@ #define CONFIG_CMD_MEMORY #define CONFIG_CMD_RUN #define CONFIG_CMD_SAVES +#define CONFIG_CMD_NET +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP
/* This must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <config_cmd_default.h> -#undef CONFIG_CMD_NET -#undef CONFIG_CMD_NFS
/*
- Default Environment Varible definitions
diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 0248aba..502c50f 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx.h @@ -41,6 +41,9 @@
#include <configs/spear-common.h>
+/* Ethernet driver configuration */ +#define CONFIG_DW_ALTDESCRIPTOR 1
/* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000
-- 1.6.0.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (3)
-
Ben Warren
-
Vipin Kumar
-
Vipin KUMAR