[U-Boot] [PATCH 00/25] SPEAr: Update platform support for SPEAr3xx/6xx

This patchset updates the SPEAr support in the u-boot. It contains various bugfixes and enhancements.
The patches have certain dependencies on the drivers, so should be applied once the driver patches are frozen. The various drivers on which these patches depend are: 1. USB device controller: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/125220/focus=126598 2. USB OTG: Patch (USB:gadget:designware USB OTG implementation) 3. ST_SMI: http://lists.denx.de/pipermail/u-boot/2012-February/118672.html 4. FSMC_NAND: http://patchwork.ozlabs.org/patch/143167/ 5. Designware ethernet controller: http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/126029
In a subsequent patchset, more features shall be added along with cleanup of the directory structure.
Amit Virdi (6): SPEAr: Fix ARM relocation support SPEAr: Eliminate dependency on Xloader table SPEAr: Initialize SNOR in early_board_init_f SPEAr: Use separate config flags for 3xx and 6xx board files cleanup/SPEAr: Remove unnecessary parenthesis cleanup/SPEAr: Define configuration flags more elegantly
Shiraz Hashim (4): SPEAr: Enable autoneg for ethernet SPEAr: Enable dcache for fast file transfer SPEAr: explicitly select clk src for UART SPEAr: Correct SoC ID offset in misc configuration space
Vipin KUMAR (10): SPEAr: Place ethaddr write and read within CONFIG_CMD_NET SPEAr: Configure network support for spear SoCs SPEAr: Add macb driver support for spear310 and spear320 SPEAr: Add basic arch related support for SPEAr SoCs SPEAr: Add configuration options for spear3xx and spear6xx boards SPEAr: Remove unused flag (CONFIG_SYS_HZ_CLOCK) SPEAr: Change the default environment variables SPEAr: Enable usb device high speed support SPEAr: spear usbtty configuration does not use ethernet device SPEAr: Enable udc and usb-console support only for usbtty configuration
Vipin Kumar (5): SPEAr: Add interface information in initialization SPEAr: Enable CONFIG_SYS_FLASH_PROTECTION SPEAr: Correct the definition of CONFIG_SYS_MONITOR_BASE SPEAr: Enable CONFIG_SYS_FLASH_EMPTY_INFO macro SPEAr: Enable ONFI nand flash detection for spear3xx and 6xx and evb
arch/arm/cpu/arm926ejs/spear/Makefile | 3 +- arch/arm/cpu/arm926ejs/spear/cpu.c | 89 +++++++++++++++++ .../arm/include/asm/arch-spear/clk.h | 29 +----- arch/arm/include/asm/arch-spear/hardware.h | 8 ++ arch/arm/include/asm/arch-spear/spr_defs.h | 7 -- arch/arm/include/asm/arch-spear/spr_misc.h | 11 ++- .../arm/include/asm/arch-spear/spr_xloader_table.h | 67 ------------- board/spear/common/Makefile | 9 ++- board/spear/common/spr_misc.c | 102 +++++++------------- board/spear/spear300/config.mk | 13 +--- board/spear/spear300/spear300.c | 15 +++ board/spear/spear310/config.mk | 11 -- board/spear/spear310/spear310.c | 32 ++++++ board/spear/spear320/config.mk | 11 -- board/spear/spear320/spear320.c | 30 ++++++ board/spear/spear600/config.mk | 13 +--- board/spear/spear600/spear600.c | 18 ++++ boards.cfg | 20 +++- doc/README.spear | 39 ++++++-- drivers/net/designware.c | 10 ++- drivers/net/designware.h | 1 + include/configs/spear-common.h | 94 +++++++++++++----- include/configs/{spear3xx.h => spear3xx_evb.h} | 49 ++++++++-- include/configs/{spear6xx.h => spear6xx_evb.h} | 15 +++- include/netdev.h | 2 +- 25 files changed, 429 insertions(+), 269 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/spear/cpu.c copy include/configs/spear6xx.h => arch/arm/include/asm/arch-spear/clk.h (60%) delete mode 100644 arch/arm/include/asm/arch-spear/spr_xloader_table.h rename include/configs/{spear3xx.h => spear3xx_evb.h} (79%) rename include/configs/{spear6xx.h => spear6xx_evb.h} (84%)

While the u-boot code is running from the flash, it is essential that no access is made to the bss segment. This is due to the fact that .rel.dyn and .bss areas overlap and former contains information used in relocation. In SPEAr, this was not taken into consideration. As a result, while the relocation wasn't complete, dram_init populated an uninitialized global variable resulting in corruption of .rel.dyn area, which resulted in u-boot crash.
This commit fixes this problem by removing code that accesses bss segment
Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/common/spr_misc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index 0812c20..3ab278f 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -40,27 +40,9 @@ static struct chip_data chip_data;
int dram_init(void) { - struct xloader_table *xloader_tb = - (struct xloader_table *)XLOADER_TABLE_ADDRESS; - struct xloader_table_1_1 *table_1_1; - struct xloader_table_1_2 *table_1_2; - struct chip_data *chip = &chip_data; - + /* Store complete RAM size and return */ gd->ram_size = get_ram_size(PHYS_SDRAM_1, PHYS_SDRAM_1_MAXSIZE);
- if (XLOADER_TABLE_VERSION_1_1 == xloader_tb->table_version) { - table_1_1 = &xloader_tb->table.table_1_1; - chip->dramfreq = table_1_1->ddrfreq; - chip->dramtype = table_1_1->ddrtype; - - } else if (XLOADER_TABLE_VERSION_1_2 == xloader_tb->table_version) { - table_1_2 = &xloader_tb->table.table_1_2; - chip->dramfreq = table_1_2->ddrfreq; - chip->dramtype = table_1_2->ddrtype; - } else { - chip->dramfreq = -1; - } - return 0; }

On Wednesday 07 March 2012 13:03:50 Amit Virdi wrote:
While the u-boot code is running from the flash, it is essential that no access is made to the bss segment. This is due to the fact that .rel.dyn and .bss areas overlap and former contains information used in relocation. In SPEAr, this was not taken into consideration. As a result, while the relocation wasn't complete, dram_init populated an uninitialized global variable resulting in corruption of .rel.dyn area, which resulted in u-boot crash.
This commit fixes this problem by removing code that accesses bss segment
Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Xloader table was used primarily to inform u-boot about the DDR size. However, now the ddr size is calculated at runtime which eliminates any need for the Xloader table. So removing this unnecessary code.
Signed-off-by: Amit Virdi amit.virdi@st.com --- arch/arm/include/asm/arch-spear/spr_defs.h | 7 -- .../arm/include/asm/arch-spear/spr_xloader_table.h | 67 -------------------- board/spear/common/spr_misc.c | 41 ------------ 3 files changed, 0 insertions(+), 115 deletions(-) delete mode 100644 arch/arm/include/asm/arch-spear/spr_xloader_table.h
diff --git a/arch/arm/include/asm/arch-spear/spr_defs.h b/arch/arm/include/asm/arch-spear/spr_defs.h index fa8412c..0ddce62 100644 --- a/arch/arm/include/asm/arch-spear/spr_defs.h +++ b/arch/arm/include/asm/arch-spear/spr_defs.h @@ -28,13 +28,6 @@ extern int spear_board_init(ulong); extern void setfreq(unsigned int, unsigned int); extern unsigned int setfreq_sz;
-struct chip_data { - int cpufreq; - int dramfreq; - int dramtype; - uchar version[32]; -}; - /* HW mac id in i2c memory definitions */ #define MAGIC_OFF 0x0 #define MAGIC_LEN 0x2 diff --git a/arch/arm/include/asm/arch-spear/spr_xloader_table.h b/arch/arm/include/asm/arch-spear/spr_xloader_table.h deleted file mode 100644 index 7e3da18..0000000 --- a/arch/arm/include/asm/arch-spear/spr_xloader_table.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (C) Copyright 2009 - * Vipin Kumar, ST Micoelectronics, 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 - */ - -#ifndef _SPR_XLOADER_TABLE_H -#define _SPR_XLOADER_TABLE_H - -#define XLOADER_TABLE_VERSION_1_1 2 -#define XLOADER_TABLE_VERSION_1_2 3 - -#define XLOADER_TABLE_ADDRESS 0xD2801FF0 - -#define DDRMOBILE 1 -#define DDR2 2 - -#define REV_BA 1 -#define REV_AA 2 -#define REV_AB 3 - -struct xloader_table_1_1 { - unsigned short ddrfreq; - unsigned char ddrsize; - unsigned char ddrtype; - - unsigned char soc_rev; -} __attribute__ ((packed)); - -struct xloader_table_1_2 { - unsigned const char *version; - - unsigned short ddrfreq; - unsigned char ddrsize; - unsigned char ddrtype; - - unsigned char soc_rev; -} __attribute__ ((packed)); - -union table_contents { - struct xloader_table_1_1 table_1_1; - struct xloader_table_1_2 table_1_2; -}; - -struct xloader_table { - unsigned char table_version; - union table_contents table; -} __attribute__ ((packed)); - -#endif diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index 3ab278f..be96c15 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -28,7 +28,6 @@ #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_emi.h> -#include <asm/arch/spr_xloader_table.h> #include <asm/arch/spr_defs.h>
#define CPU 0 @@ -36,7 +35,6 @@ #define SRAM_REL 0xD2801000
DECLARE_GLOBAL_DATA_PTR; -static struct chip_data chip_data;
int dram_init(void) { @@ -127,25 +125,11 @@ void spear_emi_init(void)
int spear_board_init(ulong mach_type) { - struct xloader_table *xloader_tb = - (struct xloader_table *)XLOADER_TABLE_ADDRESS; - struct xloader_table_1_2 *table_1_2; - struct chip_data *chip = &chip_data; - gd->bd->bi_arch_number = mach_type;
/* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_BOOT_PARAMS_ADDR;
- /* CPU is initialized to work at 333MHz in Xloader */ - chip->cpufreq = 333; - - if (XLOADER_TABLE_VERSION_1_2 == xloader_tb->table_version) { - table_1_2 = &xloader_tb->table.table_1_2; - memcpy(chip->version, table_1_2->version, - sizeof(chip->version)); - } - #ifdef CONFIG_SPEAR_EMI spear_emi_init(); #endif @@ -195,7 +179,6 @@ static int write_mac(uchar *mac) int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { void (*sram_setfreq) (unsigned int, unsigned int); - struct chip_data *chip = &chip_data; unsigned char mac[6]; unsigned int reg, frequency; char *s, *e; @@ -218,13 +201,9 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!strcmp(argv[1], "cpufreq")) { sram_setfreq(CPU, frequency); printf("CPU frequency changed to %u\n", frequency); - - chip->cpufreq = frequency; } else { sram_setfreq(DDR, frequency); printf("DDR frequency changed to %u\n", frequency); - - chip->dramfreq = frequency; }
return 0; @@ -240,24 +219,6 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0; } else if (!strcmp(argv[1], "print")) { - - if (chip->cpufreq == -1) - printf("CPU Freq = Not Known\n"); - else - printf("CPU Freq = %d MHz\n", chip->cpufreq); - - if (chip->dramfreq == -1) - printf("DDR Freq = Not Known\n"); - else - printf("DDR Freq = %d MHz\n", chip->dramfreq); - - if (chip->dramtype == DDRMOBILE) - printf("DDR Type = MOBILE\n"); - else if (chip->dramtype == DDR2) - printf("DDR Type = DDR2\n"); - else - printf("DDR Type = Not Known\n"); - if (!i2c_read_mac(mac)) { sprintf(i2c_mac, "%pM", mac); printf("Ethaddr (from i2c mem) = %s\n", i2c_mac); @@ -265,8 +226,6 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("Ethaddr (from i2c mem) = Not set\n"); }
- printf("Xloader Rev = %s\n", chip->version); - return 0; }

On Wednesday 07 March 2012 13:03:51 Amit Virdi wrote:
Xloader table was used primarily to inform u-boot about the DDR size. However, now the ddr size is calculated at runtime which eliminates any need for the Xloader table. So removing this unnecessary code.
Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

From: Vipin KUMAR vipin.kumar@st.com
ethaddr can be optionally read from i2c memory. So, chip_config command supports reading/writing hw mac id into i2c memory. Placing this code within CONFIG_CMD_NET as this would only be needed when network interface is configured
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/common/spr_misc.c | 29 +++++++++++++++++++++-------- doc/README.spear | 8 ++++++++ 2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index be96c15..e2918ff 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -36,6 +36,10 @@
DECLARE_GLOBAL_DATA_PTR;
+#if defined(CONFIG_CMD_NET) +static int i2c_read_mac(uchar *buffer); +#endif + int dram_init(void) { /* Store complete RAM size and return */ @@ -136,6 +140,7 @@ int spear_board_init(ulong mach_type) return 0; }
+#if defined(CONFIG_CMD_NET) static int i2c_read_mac(uchar *buffer) { u8 buf[2]; @@ -172,17 +177,18 @@ static int write_mac(uchar *mac) return 0; }
- puts("I2C EEPROM writing failed \n"); + puts("I2C EEPROM writing failed\n"); return -1; } +#endif
int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { void (*sram_setfreq) (unsigned int, unsigned int); + unsigned int frequency; +#if defined(CONFIG_CMD_NET) unsigned char mac[6]; - unsigned int reg, frequency; - char *s, *e; - char i2c_mac[20]; +#endif
if ((argc > 3) || (argc < 2)) return cmd_usage(cmdtp); @@ -207,9 +213,12 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) }
return 0; + +#if defined(CONFIG_CMD_NET) } else if (!strcmp(argv[1], "ethaddr")) {
- s = argv[2]; + u32 reg; + char *e, *s = argv[2]; for (reg = 0; reg < 6; ++reg) { mac[reg] = s ? simple_strtoul(s, &e, 16) : 0; if (s) @@ -218,14 +227,15 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) write_mac(mac);
return 0; +#endif } else if (!strcmp(argv[1], "print")) { +#if defined(CONFIG_CMD_NET) if (!i2c_read_mac(mac)) { - sprintf(i2c_mac, "%pM", mac); - printf("Ethaddr (from i2c mem) = %s\n", i2c_mac); + printf("Ethaddr (from i2c mem) = %pM\n", mac); } else { printf("Ethaddr (from i2c mem) = Not set\n"); } - +#endif return 0; }
@@ -235,4 +245,7 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD(chip_config, 3, 1, do_chip_config, "configure chip", "chip_config cpufreq/ddrfreq frequency\n" +#if defined(CONFIG_CMD_NET) + "chip_config ethaddr XX:XX:XX:XX:XX:XX\n" +#endif "chip_config print"); diff --git a/doc/README.spear b/doc/README.spear index a8b1052..a6ff7fd 100644 --- a/doc/README.spear +++ b/doc/README.spear @@ -46,3 +46,11 @@ Further options make FLASH=PNOR (supported by SPEAr310 and SPEAr320) - This option generates a uboot image that supports emi controller for CFI compliant parallel NOR flash + +Mac id storage and retrieval in spear platforms + +Please read doc/README.enetaddr for the implementation guidelines for mac id +usage. Basically, environment has precedence over board specific storage. The +ethaddr beeing used for the network interface is always taken only from +environment variables. Although, we can check the mac id programmed in i2c +memory by using chip_config command

On Wednesday 07 March 2012 13:03:52 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
ethaddr can be optionally read from i2c memory. So, chip_config command supports reading/writing hw mac id into i2c memory. Placing this code within CONFIG_CMD_NET as this would only be needed when network interface is configured
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
I'm not really sure, why you have this special ethaddr handling in I2C prom here at all. Isn't it enough to have the MAC address (ethaddr) stored in the U-Boot environment (NOR, NAND, etc)? Why do you need this additional I2C stuff? Could you please explain this?
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

On Wednesday 07 March 2012 08:21:08 Stefan Roese wrote:
On Wednesday 07 March 2012 13:03:52 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
ethaddr can be optionally read from i2c memory. So, chip_config command supports reading/writing hw mac id into i2c memory. Placing this code within CONFIG_CMD_NET as this would only be needed when network interface is configured
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
I'm not really sure, why you have this special ethaddr handling in I2C prom here at all. Isn't it enough to have the MAC address (ethaddr) stored in the U-Boot environment (NOR, NAND, etc)? Why do you need this additional I2C stuff? Could you please explain this?
if the board is coming from the factory manufactured like this, then it makes sense to me to support it. after all, development boards aren't sold as "only runs u-boot". if i got a dev board and installed u-boot on it myself, i'd really prefer it to automatically look up the mac if it's stored locally.
that said, this looks like a debug command, so not sure if i would even bother making it depend on CONFIG_CMD_NET if there's no real runtime overhead ... -mike

Hi Stefan,
Sorry for this delayed response, I'm back to office after almost 2 weeks.
On 3/7/2012 6:51 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:03:52 Amit Virdi wrote:
From: Vipin KUMARvipin.kumar@st.com
ethaddr can be optionally read from i2c memory. So, chip_config command supports reading/writing hw mac id into i2c memory. Placing this code within CONFIG_CMD_NET as this would only be needed when network interface is configured
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
I'm not really sure, why you have this special ethaddr handling in I2C prom here at all. Isn't it enough to have the MAC address (ethaddr) stored in the U-Boot environment (NOR, NAND, etc)? Why do you need this additional I2C stuff? Could you please explain this?
Generally MAC addresses are stored in EEPROMs due to two reasons: 1. Special set of command sequences are required to erase data from an EEPROM 2. EEPROMs are cheaper
As a result, board manufacturers provide an EEPROM memory that contains MAC address and other vital board parameters. In such case, NAND/NOR memories may not have ethaddr stored. On SPEAr, I2C is used to access EEPROM. So this patch is required. Please let me know if I understood your question correctly and, hence, gave the right answer.
Thanks n Regards Amit Virdi

Dear Amit Virdi,
In message 4F7051AF.9080905@st.com you wrote:
Generally MAC addresses are stored in EEPROMs due to two reasons:
- Special set of command sequences are required to erase data from an
EEPROM 2. EEPROMs are cheaper
Hm... With U-Boot, an EEPROM is just an additional wart, which costs _extra_ money.
Best regards,
Wolfgang Denk

From: Vipin KUMAR vipin.kumar@st.com
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- arch/arm/include/asm/arch-spear/hardware.h | 1 + board/spear/spear300/spear300.c | 10 ++++++++++ board/spear/spear310/spear310.c | 10 ++++++++++ board/spear/spear320/spear320.c | 10 ++++++++++ board/spear/spear600/spear600.c | 10 ++++++++++ include/configs/spear-common.h | 14 ++++++++++++-- include/configs/spear3xx.h | 3 +++ 7 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index a6517b2..2b9cb0e 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 32bcb77..3f7ccb8 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 <linux/mtd/fsmc_nand.h> @@ -57,3 +58,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; } + +int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH) + return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); +#else + return -1; +#endif +} diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 8b58218..8c5b5ba 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 <linux/mtd/fsmc_nand.h> @@ -58,3 +59,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; } + +int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH) + return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); +#else + return -1; +#endif +} diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 172ad35..b60acc2 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 <linux/mtd/fsmc_nand.h> @@ -58,3 +59,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; } + +int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH) + return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); +#else + return -1; +#endif +} diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index 7cf63d6..5a32b7f 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 <linux/mtd/fsmc_nand.h> @@ -52,3 +53,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; } + +int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH) + return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); +#else + return -1; +#endif +} diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 8f4973a..3f52442 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_DW_UDC #define CONFIG_USB_DEVICE @@ -103,11 +111,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 2a86c21..035b321 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

On Wednesday 07 March 2012 13:03:53 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
Please find some comments below.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
arch/arm/include/asm/arch-spear/hardware.h | 1 + board/spear/spear300/spear300.c | 10 ++++++++++ board/spear/spear310/spear310.c | 10 ++++++++++ board/spear/spear320/spear320.c | 10 ++++++++++ board/spear/spear600/spear600.c | 10 ++++++++++ include/configs/spear-common.h | 14 ++++++++++++-- include/configs/spear3xx.h | 3 +++ 7 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index a6517b2..2b9cb0e 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)
I would prefer if you removed these unneeded parentheses here:
#define CONFIG_SPEAR_ETHBASE 0xE0800000
Perhaps best done by doing a cosmetic cleanup patch before the newly added defines. I know that checkpatch doesn't complain about this, but these parentheses really distract me. Not sure how other feel about it.
#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 32bcb77..3f7ccb8 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 <linux/mtd/fsmc_nand.h> @@ -57,3 +58,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; }
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
This routine is added multiple times in this patch. Perhaps this can be moved to a "common/" file instead?
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index 8b58218..8c5b5ba 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 <linux/mtd/fsmc_nand.h> @@ -58,3 +59,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; }
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
Here again.
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index 172ad35..b60acc2 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 <linux/mtd/fsmc_nand.h> @@ -58,3 +59,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; }
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
And again.
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index 7cf63d6..5a32b7f 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 <linux/mtd/fsmc_nand.h> @@ -52,3 +53,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; }
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
and again.
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 8f4973a..3f52442 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 */
Again, please remove these parentheses.
/* USBD driver configuration */ #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE @@ -103,11 +111,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 2a86c21..035b321 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
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
On 3/7/2012 6:59 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:03:53 Amit Virdi wrote:
From: Vipin KUMARvipin.kumar@st.com
Please find some comments below.
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h index a6517b2..2b9cb0e 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)
I would prefer if you removed these unneeded parentheses here:
#define CONFIG_SPEAR_ETHBASE 0xE0800000
Perhaps best done by doing a cosmetic cleanup patch before the newly added defines. I know that checkpatch doesn't complain about this, but these parentheses really distract me. Not sure how other feel about it.
ok
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
This routine is added multiple times in this patch. Perhaps this can be moved to a "common/" file instead?
[...]
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
Here again.
[...]
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
And again.
[...]
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index 7cf63d6..5a32b7f 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<linux/mtd/fsmc_nand.h> @@ -52,3 +53,12 @@ int board_nand_init(struct nand_chip *nand) #endif return -1; }
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
and again.
Yes Stefan, it is planned. There's a lot of cleanup that is needed in the SPEAr platform code. I shall be sending another patchset after this patchset that adds new functionality and does the cleanup.
Can you accept this patch for the time being?
+/* 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 */
Again, please remove these parentheses.
Sure!
Thanks Amit Virdi

Hi Amit,
On Monday 26 March 2012 13:41:09 Amit Virdi wrote:
+int board_eth_init(bd_t *bis) +{ +#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
+#else
- return -1;
+#endif +}
and again.
Yes Stefan, it is planned. There's a lot of cleanup that is needed in the SPEAr platform code. I shall be sending another patchset after this patchset that adds new functionality and does the cleanup.
Can you accept this patch for the time being?
I can, yes. Only speaking for myself though.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

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 Signed-off-by: Amit Virdi amit.virdi@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 | 25 ++++++++++++++++++++++--- board/spear/spear320/spear320.c | 12 +++++++++--- include/configs/spear3xx.h | 13 +++++++++++++ 5 files changed, 78 insertions(+), 6 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 2b9cb0e..421f33f 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_SYS_FSMC_BASE (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 8c5b5ba..f74bbac 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -62,9 +62,28 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis) { + int ret = 0; + #if defined(CONFIG_DESIGNWARE_ETH) - return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); -#else - return -1; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0) + ret += -1; +#endif +#if defined(CONFIG_MACB) + if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, + CONFIG_MACB0_PHY) < 0) + ret += -1; + + if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE, + CONFIG_MACB1_PHY) < 0) + ret += -1; + + if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE, + CONFIG_MACB2_PHY) < 0) + ret += -1; + + if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE, + CONFIG_MACB3_PHY) < 0) + ret += -1; #endif + return ret; } diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index b60acc2..adddfd1 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -62,9 +62,15 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis) { + int ret = 0; #if defined(CONFIG_DESIGNWARE_ETH) - return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); -#else - return -1; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0) + ret += -1; +#endif +#if defined(CONFIG_MACB) + if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, + CONFIG_MACB0_PHY) < 0) + ret += -1; #endif + return ret; } diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h index 035b321..f3e3354 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

From: Vipin Kumar vipin.kumar@st.com
Few Designware peripheral registers need to be modified based on the ethernet interface selected by the board. This patch supports interface information in ethernet driver
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/spear300/spear300.c | 11 ++++++++--- board/spear/spear310/spear310.c | 23 +++++++++++++---------- board/spear/spear320/spear320.c | 22 ++++++++++++++++++---- board/spear/spear600/spear600.c | 14 +++++++++++--- drivers/net/designware.c | 10 +++++++++- drivers/net/designware.h | 1 + include/netdev.h | 2 +- 7 files changed, 61 insertions(+), 22 deletions(-)
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c index 3f7ccb8..bf3bbc5 100644 --- a/board/spear/spear300/spear300.c +++ b/board/spear/spear300/spear300.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <miiphy.h> #include <netdev.h> #include <nand.h> #include <asm/io.h> @@ -61,9 +62,13 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis) { + int ret = 0; + #if defined(CONFIG_DESIGNWARE_ETH) - return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); -#else - return -1; + u32 interface = PHY_INTERFACE_MODE_MII; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY, + interface) >= 0) + ret++; #endif + return ret; } diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c index f74bbac..107b34b 100644 --- a/board/spear/spear310/spear310.c +++ b/board/spear/spear310/spear310.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <miiphy.h> #include <netdev.h> #include <nand.h> #include <asm/io.h> @@ -65,25 +66,27 @@ 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 += -1; + u32 interface = PHY_INTERFACE_MODE_MII; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY, + interface) >= 0) + ret++; #endif #if defined(CONFIG_MACB) if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, - CONFIG_MACB0_PHY) < 0) - ret += -1; + CONFIG_MACB0_PHY) >= 0) + ret++;
if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE, - CONFIG_MACB1_PHY) < 0) - ret += -1; + CONFIG_MACB1_PHY) >= 0) + ret++;
if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE, - CONFIG_MACB2_PHY) < 0) - ret += -1; + CONFIG_MACB2_PHY) >= 0) + ret++;
if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE, - CONFIG_MACB3_PHY) < 0) - ret += -1; + CONFIG_MACB3_PHY) >= 0) + ret++; #endif return ret; } diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c index adddfd1..ffe11ad 100644 --- a/board/spear/spear320/spear320.c +++ b/board/spear/spear320/spear320.c @@ -23,6 +23,7 @@ */
#include <common.h> +#include <miiphy.h> #include <netdev.h> #include <nand.h> #include <asm/io.h> @@ -31,8 +32,18 @@ #include <asm/arch/spr_defs.h> #include <asm/arch/spr_misc.h>
+#define PLGPIO_SEL_36 0xb3000028 +#define PLGPIO_IO_36 0xb3000038 + +static void spear_phy_reset(void) +{ + writel(0x10, PLGPIO_IO_36); + writel(0x10, PLGPIO_SEL_36); +} + int board_init(void) { + spear_phy_reset(); return spear_board_init(MACH_TYPE_SPEAR320); }
@@ -63,14 +74,17 @@ int board_nand_init(struct nand_chip *nand) 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 += -1; + u32 interface = PHY_INTERFACE_MODE_MII; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY, + interface) >= 0) + ret++; #endif #if defined(CONFIG_MACB) if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, - CONFIG_MACB0_PHY) < 0) - ret += -1; + CONFIG_MACB0_PHY) >= 0) + ret++; #endif return ret; } diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c index 5a32b7f..f592233 100644 --- a/board/spear/spear600/spear600.c +++ b/board/spear/spear600/spear600.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <miiphy.h> #include <netdev.h> #include <nand.h> #include <asm/io.h> @@ -56,9 +57,16 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis) { + int ret = 0; + #if defined(CONFIG_DESIGNWARE_ETH) - return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY); -#else - return -1; + u32 interface = PHY_INTERFACE_MODE_MII; +#if defined(CONFIG_DW_AUTONEG) + interface = PHY_INTERFACE_MODE_GMII; +#endif + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY, + interface) >= 0) + ret++; #endif + return ret; } diff --git a/drivers/net/designware.c b/drivers/net/designware.c index e8e669b..e263022 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -171,6 +171,13 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis) if (priv->speed != SPEED_1000M) conf |= MII_PORTSELECT;
+ if ((priv->interface != PHY_INTERFACE_MODE_MII) && + (priv->interface != PHY_INTERFACE_MODE_GMII)) { + + if (priv->speed == SPEED_100M) + conf |= FES_100; + } + if (priv->duplex == FULL_DUPLEX) conf |= FULLDPLXMODE;
@@ -532,7 +539,7 @@ static int dw_mii_write(const char *devname, u8 addr, u8 reg, u16 val) } #endif
-int designware_initialize(u32 id, ulong base_addr, u32 phy_addr) +int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface) { struct eth_device *dev; struct dw_eth_dev *priv; @@ -566,6 +573,7 @@ int designware_initialize(u32 id, ulong base_addr, u32 phy_addr) DW_DMA_BASE_OFFSET); priv->address = phy_addr; priv->phy_configured = 0; + priv->interface = interface;
if (mac_reset(dev) < 0) return -1; diff --git a/drivers/net/designware.h b/drivers/net/designware.h index abf729d..40020bf 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -234,6 +234,7 @@ struct dmamacdescr {
struct dw_eth_dev { u32 address; + u32 interface; u32 speed; u32 duplex; u32 tx_currdescnum; diff --git a/include/netdev.h b/include/netdev.h index b0c21d5..bad1eaf 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -52,7 +52,7 @@ int calxedaxgmac_initialize(u32 id, ulong base_addr); int cs8900_initialize(u8 dev_num, int base_addr); int davinci_emac_initialize(void); int dc21x4x_initialize(bd_t *bis); -int designware_initialize(u32 id, ulong base_addr, u32 phy_addr); +int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface); int dm9000_initialize(bd_t *bis); int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr); int e1000_initialize(bd_t *bis);

From: Vipin KUMAR vipin.kumar@st.com
Earlier, architecture specific init code was mixed with board initialization code in board/spear/... This patch updates architecture support for SPEAr in latest u-boot.
It defines the following two flags for SPEAr3xx and SPEAr6xx SoCs - CONFIG_DISPLAY_CPUINFO: Used to print the SoC information - CONFIG_ARCH_CPU_INIT: compiles the architecture specific initialization code with arch/arm/spear/cpu.c
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- arch/arm/cpu/arm926ejs/spear/Makefile | 3 +- arch/arm/cpu/arm926ejs/spear/cpu.c | 84 ++++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/spr_misc.h | 7 ++ include/configs/spear-common.h | 2 + 4 files changed, 95 insertions(+), 1 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/spear/cpu.c
diff --git a/arch/arm/cpu/arm926ejs/spear/Makefile b/arch/arm/cpu/arm926ejs/spear/Makefile index f32ec4c..46923a4 100644 --- a/arch/arm/cpu/arm926ejs/spear/Makefile +++ b/arch/arm/cpu/arm926ejs/spear/Makefile @@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).o
-COBJS := reset.o \ +COBJS := cpu.o \ + reset.o \ timer.o SOBJS :=
diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c new file mode 100644 index 0000000..4dc7d69 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/spear/cpu.c @@ -0,0 +1,84 @@ +/* + * (C) Copyright 2010 + * Vipin Kumar, ST Micoelectronics, 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 + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/hardware.h> +#include <asm/arch/spr_misc.h> + +#ifdef CONFIG_ARCH_CPU_INIT +int arch_cpu_init(void) +{ + struct misc_regs *const misc_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + u32 periph1_clken; + + periph1_clken = readl(&misc_p->periph1_clken); + +#if defined(CONFIG_SPEAR3XX) + periph1_clken |= MISC_GPT2ENB; +#elif defined(CONFIG_SPEAR600) + periph1_clken |= MISC_GPT3ENB; +#endif + +#if defined(CONFIG_PL011_SERIAL) + periph1_clken |= MISC_UART0ENB; +#endif +#if defined(CONFIG_DESIGNWARE_ETH) + periph1_clken |= MISC_ETHENB; +#endif +#if defined(CONFIG_DW_UDC) + periph1_clken |= MISC_USBDENB; +#endif +#if defined(CONFIG_DW_I2C) + periph1_clken |= MISC_I2CENB; +#endif +#if defined(CONFIG_ST_SMI) + periph1_clken |= MISC_SMIENB; +#endif +#if defined(CONFIG_NAND_FSMC) + periph1_clken |= MISC_FSMCENB; +#endif + + writel(periph1_clken, &misc_p->periph1_clken); + return 0; +} +#endif + +#ifdef CONFIG_DISPLAY_CPUINFO +int print_cpuinfo(void) +{ +#ifdef CONFIG_SPEAR300 + printf("CPU: SPEAr300\n"); +#elif defined(CONFIG_SPEAR310) + printf("CPU: SPEAr310\n"); +#elif defined(CONFIG_SPEAR320) + printf("CPU: SPEAr320\n"); +#elif defined(CONFIG_SPEAR600) + printf("CPU: SPEAr600\n"); +#else +#error CPU not supported in spear platform +#endif + return 0; +} +#endif diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h b/arch/arm/include/asm/arch-spear/spr_misc.h index 8b96d9b..b10c726 100644 --- a/arch/arm/include/asm/arch-spear/spr_misc.h +++ b/arch/arm/include/asm/arch-spear/spr_misc.h @@ -126,5 +126,12 @@ struct misc_regs {
/* PERIPH1_CLKEN, PERIPH1_RST value */ #define MISC_USBDENB 0x01000000 +#define MISC_ETHENB 0x00800000 +#define MISC_SMIENB 0x00200000 +#define MISC_GPT3ENB 0x00010000 +#define MISC_GPT2ENB 0x00000800 +#define MISC_FSMCENB 0x00000200 +#define MISC_I2CENB 0x00000080 +#define MISC_UART0ENB 0x00000008
#endif diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 3f52442..5540630 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -182,6 +182,8 @@ #define CONFIG_ENV_SIZE 0x02000
/* Miscellaneous configurable options */ +#define CONFIG_ARCH_CPU_INIT +#define CONFIG_DISPLAY_CPUINFO #define CONFIG_BOOT_PARAMS_ADDR 0x00000100 #define CONFIG_CMDLINE_TAG 1 #define CONFIG_SETUP_MEMORY_TAGS 1

On Wednesday 07 March 2012 13:03:56 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
Earlier, architecture specific init code was mixed with board initialization code in board/spear/... This patch updates architecture support for SPEAr in latest u-boot.
It defines the following two flags for SPEAr3xx and SPEAr6xx SoCs
- CONFIG_DISPLAY_CPUINFO: Used to print the SoC information
- CONFIG_ARCH_CPU_INIT: compiles the architecture specific initialization
code with arch/arm/spear/cpu.c
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
arch/arm/cpu/arm926ejs/spear/Makefile | 3 +- arch/arm/cpu/arm926ejs/spear/cpu.c | 84 ++++++++++++++++++++++++++++ arch/arm/include/asm/arch-spear/spr_misc.h | 7 ++ include/configs/spear-common.h | 2 + 4 files changed, 95 insertions(+), 1 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/spear/cpu.c
diff --git a/arch/arm/cpu/arm926ejs/spear/Makefile b/arch/arm/cpu/arm926ejs/spear/Makefile index f32ec4c..46923a4 100644 --- a/arch/arm/cpu/arm926ejs/spear/Makefile +++ b/arch/arm/cpu/arm926ejs/spear/Makefile @@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).o
-COBJS := reset.o \ +COBJS := cpu.o \
reset.o \ timer.o
SOBJS :=
diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c new file mode 100644 index 0000000..4dc7d69 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/spear/cpu.c @@ -0,0 +1,84 @@ +/*
- (C) Copyright 2010
- Vipin Kumar, ST Micoelectronics, 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
- */
+#include <common.h> +#include <asm/io.h> +#include <asm/arch/hardware.h> +#include <asm/arch/spr_misc.h>
+#ifdef CONFIG_ARCH_CPU_INIT
Why not remove this #ifdef here and make compile it in unconditionally? It is needed for each SPEAr board, right?
+int arch_cpu_init(void) +{
- struct misc_regs *const misc_p =
(struct misc_regs *)CONFIG_SPEAR_MISCBASE;
- u32 periph1_clken;
- periph1_clken = readl(&misc_p->periph1_clken);
+#if defined(CONFIG_SPEAR3XX)
- periph1_clken |= MISC_GPT2ENB;
+#elif defined(CONFIG_SPEAR600)
- periph1_clken |= MISC_GPT3ENB;
+#endif
+#if defined(CONFIG_PL011_SERIAL)
- periph1_clken |= MISC_UART0ENB;
+#endif +#if defined(CONFIG_DESIGNWARE_ETH)
- periph1_clken |= MISC_ETHENB;
+#endif +#if defined(CONFIG_DW_UDC)
- periph1_clken |= MISC_USBDENB;
+#endif +#if defined(CONFIG_DW_I2C)
- periph1_clken |= MISC_I2CENB;
+#endif +#if defined(CONFIG_ST_SMI)
- periph1_clken |= MISC_SMIENB;
+#endif +#if defined(CONFIG_NAND_FSMC)
- periph1_clken |= MISC_FSMCENB;
+#endif
- writel(periph1_clken, &misc_p->periph1_clken);
- return 0;
+} +#endif
+#ifdef CONFIG_DISPLAY_CPUINFO
Again, I would remove this #ifdef here. Make it unconditionally for all SPEAr boards. We have enough #ifdef's already. :)
+int print_cpuinfo(void) +{ +#ifdef CONFIG_SPEAR300
- printf("CPU: SPEAr300\n");
+#elif defined(CONFIG_SPEAR310)
- printf("CPU: SPEAr310\n");
+#elif defined(CONFIG_SPEAR320)
- printf("CPU: SPEAr320\n");
+#elif defined(CONFIG_SPEAR600)
- printf("CPU: SPEAr600\n");
+#else +#error CPU not supported in spear platform +#endif
- return 0;
+} +#endif diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h b/arch/arm/include/asm/arch-spear/spr_misc.h index 8b96d9b..b10c726 100644 --- a/arch/arm/include/asm/arch-spear/spr_misc.h +++ b/arch/arm/include/asm/arch-spear/spr_misc.h @@ -126,5 +126,12 @@ struct misc_regs {
/* PERIPH1_CLKEN, PERIPH1_RST value */ #define MISC_USBDENB 0x01000000 +#define MISC_ETHENB 0x00800000 +#define MISC_SMIENB 0x00200000 +#define MISC_GPT3ENB 0x00010000 +#define MISC_GPT2ENB 0x00000800 +#define MISC_FSMCENB 0x00000200 +#define MISC_I2CENB 0x00000080 +#define MISC_UART0ENB 0x00000008
#endif diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 3f52442..5540630 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -182,6 +182,8 @@ #define CONFIG_ENV_SIZE 0x02000
/* Miscellaneous configurable options */ +#define CONFIG_ARCH_CPU_INIT +#define CONFIG_DISPLAY_CPUINFO
Other than my comment above:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
- */
+#include<common.h> +#include<asm/io.h> +#include<asm/arch/hardware.h> +#include<asm/arch/spr_misc.h>
+#ifdef CONFIG_ARCH_CPU_INIT
Why not remove this #ifdef here and make compile it in unconditionally? It is needed for each SPEAr board, right?
Yes, we don't need this flag.
+int arch_cpu_init(void) +{
- struct misc_regs *const misc_p =
(struct misc_regs *)CONFIG_SPEAR_MISCBASE;
- u32 periph1_clken;
- periph1_clken = readl(&misc_p->periph1_clken);
+#if defined(CONFIG_SPEAR3XX)
- periph1_clken |= MISC_GPT2ENB;
+#elif defined(CONFIG_SPEAR600)
- periph1_clken |= MISC_GPT3ENB;
+#endif
+#if defined(CONFIG_PL011_SERIAL)
- periph1_clken |= MISC_UART0ENB;
+#endif +#if defined(CONFIG_DESIGNWARE_ETH)
- periph1_clken |= MISC_ETHENB;
+#endif +#if defined(CONFIG_DW_UDC)
- periph1_clken |= MISC_USBDENB;
+#endif +#if defined(CONFIG_DW_I2C)
- periph1_clken |= MISC_I2CENB;
+#endif +#if defined(CONFIG_ST_SMI)
- periph1_clken |= MISC_SMIENB;
+#endif +#if defined(CONFIG_NAND_FSMC)
- periph1_clken |= MISC_FSMCENB;
+#endif
- writel(periph1_clken,&misc_p->periph1_clken);
- return 0;
+} +#endif
+#ifdef CONFIG_DISPLAY_CPUINFO
Again, I would remove this #ifdef here. Make it unconditionally for all SPEAr boards. We have enough #ifdef's already. :)
Yeah. In V2, I would not use these flags.
+int print_cpuinfo(void) +{ +#ifdef CONFIG_SPEAR300
- printf("CPU: SPEAr300\n");
+#elif defined(CONFIG_SPEAR310)
- printf("CPU: SPEAr310\n");
+#elif defined(CONFIG_SPEAR320)
- printf("CPU: SPEAr320\n");
+#elif defined(CONFIG_SPEAR600)
- printf("CPU: SPEAr600\n");
+#else +#error CPU not supported in spear platform +#endif
- return 0;
+} +#endif diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h b/arch/arm/include/asm/arch-spear/spr_misc.h index 8b96d9b..b10c726 100644 --- a/arch/arm/include/asm/arch-spear/spr_misc.h +++ b/arch/arm/include/asm/arch-spear/spr_misc.h @@ -126,5 +126,12 @@ struct misc_regs {
/* PERIPH1_CLKEN, PERIPH1_RST value */ #define MISC_USBDENB 0x01000000 +#define MISC_ETHENB 0x00800000 +#define MISC_SMIENB 0x00200000 +#define MISC_GPT3ENB 0x00010000 +#define MISC_GPT2ENB 0x00000800 +#define MISC_FSMCENB 0x00000200 +#define MISC_I2CENB 0x00000080 +#define MISC_UART0ENB 0x00000008
#endif diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 3f52442..5540630 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -182,6 +182,8 @@ #define CONFIG_ENV_SIZE 0x02000
/* Miscellaneous configurable options */ +#define CONFIG_ARCH_CPU_INIT +#define CONFIG_DISPLAY_CPUINFO
Other than my comment above:
Acked-by: Stefan Roesesr@denx.de
Ok, I would change the code and add yours Acked-by.
Regards Amit Virdi

From: Vipin KUMAR vipin.kumar@st.com
spear3xx and 6xx boards can be compiled in following configurations 1. Environment placed in NAND 2. console on usb device 3. console on usb device with environment placed in NAND
Also, renaming the include/configs/spearxxx.h files to spear3xx_evb.h, spear6xx_evb.h etc to depict evaluation board configuration.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/spear300/config.mk | 13 +--------- board/spear/spear310/config.mk | 11 -------- board/spear/spear320/config.mk | 11 -------- board/spear/spear600/config.mk | 13 +--------- boards.cfg | 20 ++++++++++++--- doc/README.spear | 31 +++++++++++++++++------- include/configs/{spear3xx.h => spear3xx_evb.h} | 10 +++++++ include/configs/{spear6xx.h => spear6xx_evb.h} | 10 +++++++ 8 files changed, 60 insertions(+), 59 deletions(-) rename include/configs/{spear3xx.h => spear3xx_evb.h} (96%) rename include/configs/{spear6xx.h => spear6xx_evb.h} (89%)
diff --git a/board/spear/spear300/config.mk b/board/spear/spear300/config.mk index 5848ef8..0706430 100644 --- a/board/spear/spear300/config.mk +++ b/board/spear/spear300/config.mk @@ -25,15 +25,4 @@
CONFIG_SYS_TEXT_BASE = 0x00700000
-ALL-y += $(obj)u-boot.img - -# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif - -ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif +ALL += $(obj)u-boot.img diff --git a/board/spear/spear310/config.mk b/board/spear/spear310/config.mk index f8a6bdb..d644238 100644 --- a/board/spear/spear310/config.mk +++ b/board/spear/spear310/config.mk @@ -27,18 +27,7 @@ CONFIG_SYS_TEXT_BASE = 0x00700000
ALL-y += $(obj)u-boot.img
-# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif - # Support parallel flash ifeq ($(FLASH),PNOR) PLATFORM_RELFLAGS += -DCONFIG_FLASH_PNOR endif - -ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif diff --git a/board/spear/spear320/config.mk b/board/spear/spear320/config.mk index f8a6bdb..d644238 100644 --- a/board/spear/spear320/config.mk +++ b/board/spear/spear320/config.mk @@ -27,18 +27,7 @@ CONFIG_SYS_TEXT_BASE = 0x00700000
ALL-y += $(obj)u-boot.img
-# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif - # Support parallel flash ifeq ($(FLASH),PNOR) PLATFORM_RELFLAGS += -DCONFIG_FLASH_PNOR endif - -ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif diff --git a/board/spear/spear600/config.mk b/board/spear/spear600/config.mk index 5848ef8..0706430 100644 --- a/board/spear/spear600/config.mk +++ b/board/spear/spear600/config.mk @@ -25,15 +25,4 @@
CONFIG_SYS_TEXT_BASE = 0x00700000
-ALL-y += $(obj)u-boot.img - -# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif - -ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif +ALL += $(obj)u-boot.img diff --git a/boards.cfg b/boards.cfg index 28cc345..9eae88d3 100644 --- a/boards.cfg +++ b/boards.cfg @@ -178,10 +178,22 @@ omap730p2_cs0boot arm arm926ejs omap730p2 ti omap omap730p2_cs3boot arm arm926ejs omap730p2 ti omap omap730p2:CS3_BOOT edminiv2 arm arm926ejs - LaCie orion5x dkb arm arm926ejs - Marvell pantheon -spear300 arm arm926ejs spear300 spear spear spear3xx:spear300 -spear310 arm arm926ejs spear310 spear spear spear3xx:spear310 -spear320 arm arm926ejs spear320 spear spear spear3xx:spear320 -spear600 arm arm926ejs spear600 spear spear spear6xx:spear600 +spear300 arm arm926ejs spear300 spear spear spear3xx_evb:spear300 +spear300_nand arm arm926ejs spear300 spear spear spear3xx_evb:spear300,nand +spear300_usbtty arm arm926ejs spear300 spear spear spear3xx_evb:spear300,usbtty +spear300_usbtty_nand arm arm926ejs spear300 spear spear spear3xx_evb:spear300,usbtty,nand +spear310 arm arm926ejs spear310 spear spear spear3xx_evb:spear310 +spear310_nand arm arm926ejs spear310 spear spear spear3xx_evb:spear310,nand +spear310_usbtty arm arm926ejs spear310 spear spear spear3xx_evb:spear310,usbtty +spear310_usbtty_nand arm arm926ejs spear310 spear spear spear3xx_evb:spear310,usbtty,nand +spear320 arm arm926ejs spear320 spear spear spear3xx_evb:spear320 +spear320_nand arm arm926ejs spear320 spear spear spear3xx_evb:spear320,nand +spear320_usbtty arm arm926ejs spear320 spear spear spear3xx_evb:spear320,usbtty +spear320_usbtty_nand arm arm926ejs spear320 spear spear spear3xx_evb:spear320,usbtty,nand +spear600 arm arm926ejs spear600 spear spear spear6xx_evb:spear600 +spear600_nand arm arm926ejs spear600 spear spear spear6xx_evb:spear600,nand +spear600_usbtty arm arm926ejs spear600 spear spear spear6xx_evb:spear600,usbtty +spear600_usbtty_nand arm arm926ejs spear600 spear spear spear6xx_evb:spear600,usbtty,nand versatileab arm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_AB versatilepb arm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_PB versatileqemu arm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_QEMU,ARCH_VERSATILE_PB diff --git a/doc/README.spear b/doc/README.spear index a6ff7fd..3161e64 100644 --- a/doc/README.spear +++ b/doc/README.spear @@ -6,9 +6,9 @@ SPEAr600 is also known as SPEArPlus and SPEAr300 is also known as SPEArBasic The SPEAr SoC family embeds a customizable logic that can be programmed one-time by a customer at silicon mask level (i.e. not at runtime!).
-We are now adding the support in u-boot for two SoC: SPEAr600 and SPEAr3xx. +U-Boot supports four SoCs: SPEAr600, SPEAr3xx
-All 4 SoCs share common peripherals. +All 4 SoCs (SPEAr3xx and SPEAr600) share common peripherals.
1. ARM926ejs core based (sp600 has two cores, the 2nd handled only in Linux) 2. FastEthernet (sp600 has Gbit version, but same controller - GMAC) @@ -22,7 +22,7 @@ All 4 SoCs share common peripherals. 10. others ..
Everything is supported in Linux. -u-boot is not currently supporting all peripeharls (just a few as listed below). +u-boot is currently not supporting all peripeharls (just a few as listed below). 1. USB Device 2. NAND controller (FSMC) 3. Serial Memory Interface @@ -32,17 +32,30 @@ u-boot is not currently supporting all peripeharls (just a few as listed below).
Build options make spear600_config + spear600 build with environment variables placed at default + location i.e. Serial NOR device + make spear600_nand_config + spear600 build with environment variables placed in NAND device + make spear600_usbtty_config + spear600 build with usbtty terminal as default and environment + placed at default location + make spear600_usbtty_nand_config + Build with usbtty terminal as default and environment placed in + NAND device make spear300_config + make spear300_nand_config + make spear300_usbtty_config + make spear300_usbtty_nand_config make spear310_config + make spear310_nand_config + make spear310_usbtty_config + make spear310_usbtty_nand_config make spear320_config + make spear320_nand_config + make spear320_usbtty_config + make spear320_usbtty_nand_config
Further options - make ENV=NAND (supported by all 4 SoCs) - - This option generates a uboot image that saves environment inn NAND - - make CONSOLE=USB (supported by all 4 SoCs) - - This option generates a uboot image for using usbdevice as a tty i/f - make FLASH=PNOR (supported by SPEAr310 and SPEAr320) - This option generates a uboot image that supports emi controller for CFI compliant parallel NOR flash diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx_evb.h similarity index 96% rename from include/configs/spear3xx.h rename to include/configs/spear3xx_evb.h index f3e3354..263c058 100644 --- a/include/configs/spear3xx.h +++ b/include/configs/spear3xx_evb.h @@ -39,6 +39,16 @@ #define CONFIG_SPEAR320 1 #endif
+#if defined(CONFIG_usbtty) +#define CONFIG_SPEAR_USBTTY 1 +#endif + +#if defined(CONFIG_nand) +#define CONFIG_ENV_IS_IN_NAND 1 +#else +#define CONFIG_ENV_IS_IN_FLASH 1 +#endif + #include <configs/spear-common.h>
/* Ethernet driver configuration */ diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx_evb.h similarity index 89% rename from include/configs/spear6xx.h rename to include/configs/spear6xx_evb.h index c5bcc30..a61d9be 100644 --- a/include/configs/spear6xx.h +++ b/include/configs/spear6xx_evb.h @@ -30,6 +30,16 @@ */ #define CONFIG_SPEAR600 1
+#if defined(CONFIG_usbtty) +#define CONFIG_SPEAR_USBTTY 1 +#endif + +#if defined(CONFIG_nand) +#define CONFIG_ENV_IS_IN_NAND 1 +#else +#define CONFIG_ENV_IS_IN_FLASH 1 +#endif + #include <configs/spear-common.h>
/* Serial Configuration (PL011) */

On Wednesday 07 March 2012 13:03:57 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
spear3xx and 6xx boards can be compiled in following configurations
- Environment placed in NAND
- console on usb device
- console on usb device with environment placed in NAND
Also, renaming the include/configs/spearxxx.h files to spear3xx_evb.h, spear6xx_evb.h etc to depict evaluation board configuration.
Some comments below.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
board/spear/spear300/config.mk | 13 +--------- board/spear/spear310/config.mk | 11 -------- board/spear/spear320/config.mk | 11 -------- board/spear/spear600/config.mk | 13 +--------- boards.cfg | 20 ++++++++++++--- doc/README.spear | 31 +++++++++++++++++------- include/configs/{spear3xx.h => spear3xx_evb.h} | 10 +++++++ include/configs/{spear6xx.h => spear6xx_evb.h} | 10 +++++++ 8 files changed, 60 insertions(+), 59 deletions(-) rename include/configs/{spear3xx.h => spear3xx_evb.h} (96%) rename include/configs/{spear6xx.h => spear6xx_evb.h} (89%)
diff --git a/board/spear/spear300/config.mk b/board/spear/spear300/config.mk index 5848ef8..0706430 100644 --- a/board/spear/spear300/config.mk +++ b/board/spear/spear300/config.mk @@ -25,15 +25,4 @@
CONFIG_SYS_TEXT_BASE = 0x00700000
-ALL-y += $(obj)u-boot.img
-# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif
-ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif +ALL += $(obj)u-boot.img
Can't you just remove this config.mk file completely? CONFIG_SYS_TEXT_BASE can be moved to the config header instead. What else is this file needed for?
The same comment for all other config.mk files.
<snip>
+++ b/include/configs/spear3xx_evb.h @@ -39,6 +39,16 @@ #define CONFIG_SPEAR320 1 #endif
+#if defined(CONFIG_usbtty) +#define CONFIG_SPEAR_USBTTY 1 +#endif
+#if defined(CONFIG_nand) +#define CONFIG_ENV_IS_IN_NAND 1 +#else +#define CONFIG_ENV_IS_IN_FLASH 1 +#endif
Please don't add the "1" here. Plain "#define CONFIG_xxx" should be enough.
#include <configs/spear-common.h>
/* Ethernet driver configuration */ diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx_evb.h similarity index 89% rename from include/configs/spear6xx.h rename to include/configs/spear6xx_evb.h index c5bcc30..a61d9be 100644 --- a/include/configs/spear6xx.h +++ b/include/configs/spear6xx_evb.h @@ -30,6 +30,16 @@ */ #define CONFIG_SPEAR600 1
+#if defined(CONFIG_usbtty) +#define CONFIG_SPEAR_USBTTY 1 +#endif
+#if defined(CONFIG_nand) +#define CONFIG_ENV_IS_IN_NAND 1 +#else +#define CONFIG_ENV_IS_IN_FLASH 1 +#endif
Again.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Dear Stefan,
diff --git a/board/spear/spear300/config.mk b/board/spear/spear300/config.mk index 5848ef8..0706430 100644 --- a/board/spear/spear300/config.mk +++ b/board/spear/spear300/config.mk @@ -25,15 +25,4 @@
CONFIG_SYS_TEXT_BASE = 0x00700000
-ALL-y += $(obj)u-boot.img
-# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif
-ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif +ALL += $(obj)u-boot.img
Can't you just remove this config.mk file completely? CONFIG_SYS_TEXT_BASE can be moved to the config header instead. What else is this file needed for?
Could you please explain which config header you are referring to here? Do you mean include/configs/spear..... ?
For SPEAr310 and SPEAr320, config.mk is needed to make image (by specifying FLASH=PNOR during compile time) that can access CFI compliant PNOR flash.
The same comment for all other config.mk files.
Thanks Amit Virdi

Hi Amit,
On Monday 26 March 2012 14:10:04 Amit Virdi wrote:
+++ b/board/spear/spear300/config.mk @@ -25,15 +25,4 @@
CONFIG_SYS_TEXT_BASE = 0x00700000
-ALL-y += $(obj)u-boot.img
-# Environment variables in NAND -ifeq ($(ENV),NAND) -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_NAND -else -PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH -endif
-ifeq ($(CONSOLE),USB) -PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY -endif +ALL += $(obj)u-boot.img
Can't you just remove this config.mk file completely? CONFIG_SYS_TEXT_BASE can be moved to the config header instead. What else is this file needed for?
Could you please explain which config header you are referring to here? Do you mean include/configs/spear..... ?
Yes.
For SPEAr310 and SPEAr320, config.mk is needed to make image (by specifying FLASH=PNOR during compile time) that can access CFI compliant PNOR flash.
In the example above (spear300), only CONFIG_SYS_TEXT_BASE is left in config.mk. This can be moved to the config header (include/configs/spear-xxx- h).
You should be able to move the other remaining options (PNOR...) to boards.cfg. Or is this not possible?
Thanks, Stefan

Stefan,
Can't you just remove this config.mk file completely? CONFIG_SYS_TEXT_BASE can be moved to the config header instead. What else is this file needed for?
Could you please explain which config header you are referring to here? Do you mean include/configs/spear..... ?
Yes.
For SPEAr310 and SPEAr320, config.mk is needed to make image (by specifying FLASH=PNOR during compile time) that can access CFI compliant PNOR flash.
In the example above (spear300), only CONFIG_SYS_TEXT_BASE is left in config.mk. This can be moved to the config header (include/configs/spear-xxx- h).
You should be able to move the other remaining options (PNOR...) to boards.cfg. Or is this not possible?
It is possible and it adds to the clarity, thanks for this nice suggestion. I'll remove all the config.mk files from the board/spear/spearxx/ directories and add targets in boards.cfg for making u-boot build with environment variables placed in PNOR flash.
Best Regards Amit Virdi

From: Vipin KUMAR vipin.kumar@st.com
SPEAr doesn't need CONFIG_SYS_HZ_CLOCK. This commit removes it.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 5540630..9c195eb 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -57,7 +57,6 @@
/* Timer, HZ specific defines */ #define CONFIG_SYS_HZ (1000) -#define CONFIG_SYS_HZ_CLOCK (8300000)
/* Flash configuration */ #if defined(CONFIG_FLASH_PNOR)

On Wednesday 07 March 2012 13:03:58 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
SPEAr doesn't need CONFIG_SYS_HZ_CLOCK. This commit removes it.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

From: Vipin KUMAR vipin.kumar@st.com
This patch modifies the default environment variables as: 1. Default bootargs: - console=ttyAMA0,115200 - For environment present in NOR flash root=/dev/mtdblock3 - For environment present in NAND flash root=/dev/mtdblock7 - Removes "mem=" option 2. Introduces CONFIG_EXTRA_ENV_USBTTY as default usbtty env var even when usbtty is not selected 3. Add default definitions for nfsboot and ramboot 4. Add a new default environment variable(CONFIG_EXTRA_ENV_UNLOCK)
Signifacance of CONFIG_EXTRA_ENV_USBTTY: This environment variable is important for flashing utility to work. So if somebody accidently erases the env sector then also this variable must be preserved so that flashing utility functions properly.
Signifacance of CONFIG_EXTRA_ENV_UNLOCK: This env variable is read by the cfi driver to unlock all flash sectors. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, has all its sectors in locked state at reset and these have to be unlocked explicitly before being erased or written.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 30 ++++++++++++++++++++++-------- 1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 9c195eb..bdfda9d 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -43,9 +43,7 @@ #define CONFIG_USBD_PRODUCT_NAME "SPEAr SoC" #define CONFIG_USBD_MANUFACTURER "ST Microelectronics"
-#if defined(CONFIG_USB_TTY) #define CONFIG_EXTRA_ENV_USBTTY "usbtty=cdc_acm\0" -#endif
/* I2C driver configuration */ #define CONFIG_HARD_I2C @@ -139,7 +137,7 @@ */ #define CONFIG_SYS_MONITOR_LEN 0x00040000 #define CONFIG_ENV_SECT_SIZE 0x00010000 -#define CONFIG_FSMTDBLK "/dev/mtdblock8 " +#define CONFIG_FSMTDBLK "/dev/mtdblock3 "
#define CONFIG_BOOTCOMMAND "bootm 0xf8050000"
@@ -165,19 +163,33 @@
#define CONFIG_ENV_OFFSET 0x60000 #define CONFIG_ENV_RANGE 0x10000 -#define CONFIG_FSMTDBLK "/dev/mtdblock12 " +#define CONFIG_FSMTDBLK "/dev/mtdblock7 "
#define CONFIG_BOOTCOMMAND "nand read.jffs2 0x1600000 " \ "0x80000 0x4C0000; " \ "bootm 0x1600000" #endif
-#define CONFIG_BOOTARGS_NFS "root=/dev/nfs ip=dhcp " \ - "console=ttyS0 init=/bin/sh" -#define CONFIG_BOOTARGS "console=ttyS0 mem=128M " \ +#define CONFIG_BOOTARGS "console=ttyAMA0,115200 " \ + "mem=128M " \ "root="CONFIG_FSMTDBLK \ "rootfstype=jffs2"
+#define CONFIG_NFSBOOTCOMMAND \ + "bootp; " \ + "setenv bootargs root=/dev/nfs rw " \ + "nfsroot=$(serverip):$(rootpath) " \ + "ip=$(ipaddr):$(serverip):$(gatewayip):" \ + "$(netmask):$(hostname):$(netdev):off " \ + "console=ttyAMA0,115200 $(othbootargs);" \ + "bootm; " + +#define CONFIG_RAMBOOTCOMMAND \ + "setenv bootargs root=/dev/ram rw " \ + "console=ttyAMA0,115200 $(othbootargs);" \ + CONFIG_BOOTCOMMAND + + #define CONFIG_ENV_SIZE 0x02000
/* Miscellaneous configurable options */ @@ -209,7 +221,9 @@ #define CONFIG_SYS_CONSOLE_INFO_QUIET 1 #define CONFIG_SYS_64BIT_VSPRINTF 1
-#define CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_USBTTY +#define CONFIG_EXTRA_ENV_UNLOCK "unlock=yes\0" +#define CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_USBTTY \ + CONFIG_EXTRA_ENV_UNLOCK
/* Stack sizes */ #define CONFIG_STACKSIZE (128*1024)

On Wednesday 07 March 2012 13:03:59 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
This patch modifies the default environment variables as:
- Default bootargs:
- console=ttyAMA0,115200
- For environment present in NOR flash root=/dev/mtdblock3
- For environment present in NAND flash root=/dev/mtdblock7
- Removes "mem=" option
- Introduces CONFIG_EXTRA_ENV_USBTTY as default usbtty env var even when
usbtty is not selected 3. Add default definitions for nfsboot and ramboot 4. Add a new default environment variable(CONFIG_EXTRA_ENV_UNLOCK)
Signifacance of CONFIG_EXTRA_ENV_USBTTY: This environment variable is important for flashing utility to work. So if somebody accidently erases the env sector then also this variable must be preserved so that flashing utility functions properly.
Signifacance of CONFIG_EXTRA_ENV_UNLOCK: This env variable is read by the cfi driver to unlock all flash sectors. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, has all its sectors in locked state at reset and these have to be unlocked explicitly before being erased or written.
But this is not needed for boards not using the common CFI flash driver. As the SPEAr600 based ones. So please only define it for board using the CFI driver.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
Other than my comment above:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
Signifacance of CONFIG_EXTRA_ENV_UNLOCK: This env variable is read by the cfi driver to unlock all flash sectors. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, has all its sectors in locked state at reset and these have to be unlocked explicitly before being erased or written.
But this is not needed for boards not using the common CFI flash driver. As the SPEAr600 based ones. So please only define it for board using the CFI driver.
Ok. I would undefine it from the spear-common file and define it for SPEAr310 board file only.
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Shiraz Hashimshiraz.hashim@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
Other than my comment above:
Acked-by: Stefan Roesesr@denx.de
Thanks.
Regards Amit Virdi

flash reading is required earlier than flash_init is called since the env_init is called before flash_init. This makes the smi_init necessary before env_init being called.
Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/common/spr_misc.c | 8 ++++++++ include/configs/spear-common.h | 1 + 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index e2918ff..043c72a 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -25,6 +25,7 @@ #include <command.h> #include <i2c.h> #include <net.h> +#include <linux/mtd/st_smi.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/spr_emi.h> @@ -54,6 +55,13 @@ void dram_init_banksize(void) gd->bd->bi_dram[0].size = gd->ram_size; }
+int board_early_init_f() +{ +#if defined(CONFIG_ST_SMI) + smi_init(); +#endif + return 0; +} int misc_init_r(void) { #if defined(CONFIG_CMD_NET) diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index bdfda9d..66cf19d 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -194,6 +194,7 @@
/* Miscellaneous configurable options */ #define CONFIG_ARCH_CPU_INIT +#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO #define CONFIG_BOOT_PARAMS_ADDR 0x00000100 #define CONFIG_CMDLINE_TAG 1

On Wednesday 07 March 2012 13:04:00 Amit Virdi wrote:
flash reading is required earlier than flash_init is called since the env_init is called before flash_init. This makes the smi_init necessary before env_init being called.
Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

From: Vipin KUMAR vipin.kumar@st.com
This patch enables the support for usb high speed device for spear platform SOCs
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 66cf19d..f4980b0 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -38,6 +38,7 @@ /* USBD driver configuration */ #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE +#define CONFIG_USBD_HS #define CONFIG_USB_TTY
#define CONFIG_USBD_PRODUCT_NAME "SPEAr SoC"

On Wednesday 07 March 2012 13:04:01 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
This patch enables the support for usb high speed device for spear platform SOCs
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 66cf19d..f4980b0 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -38,6 +38,7 @@ /* USBD driver configuration */ #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE +#define CONFIG_USBD_HS
This define doesn't seem to be mentioned in the toplevel README file. Please add a short description there.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
On 3/7/2012 7:37 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:01 Amit Virdi wrote:
From: Vipin KUMARvipin.kumar@st.com
This patch enables the support for usb high speed device for spear platform SOCs
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 66cf19d..f4980b0 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -38,6 +38,7 @@ /* USBD driver configuration */ #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE +#define CONFIG_USBD_HS
This define doesn't seem to be mentioned in the toplevel README file. Please add a short description there.
Sure.
Regards Amit Virdi

Hello Stefan,
On 3/12/2012 6:09 PM, Amit Virdi wrote:
Hello Stefan,
On 3/7/2012 7:37 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:01 Amit Virdi wrote:
From: Vipin KUMARvipin.kumar@st.com
This patch enables the support for usb high speed device for spear platform SOCs
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 66cf19d..f4980b0 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -38,6 +38,7 @@ /* USBD driver configuration */ #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE +#define CONFIG_USBD_HS
This define doesn't seem to be mentioned in the toplevel README file. Please add a short description there.
Sure.
The description of this flag is in the driver patch. Since that patch is not applied yet, so you couldn't see the description.
Thanks Amit Virdi

From: Vipin KUMAR vipin.kumar@st.com
Ethernet probing is removed from u-boot compiled as a firmware for spear flashing utility. This enables faster access to usbtty interface as unused ethernet i/f is not initialized.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 10 ++++++++++ include/configs/spear3xx_evb.h | 3 ++- include/configs/spear6xx_evb.h | 1 - 3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index f4980b0..14e3ec4 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -27,6 +27,7 @@ * Common configurations used for both spear3xx as well as spear6xx */
+#if !defined(CONFIG_SPEAR_USBTTY) /* Ethernet driver configuration */ #define CONFIG_MII #define CONFIG_DESIGNWARE_ETH @@ -34,6 +35,7 @@ #define CONFIG_DW0_PHY 1 #define CONFIG_NET_MULTI #define CONFIG_PHY_RESET_DELAY (10000) /* in usec */ +#endif
/* USBD driver configuration */ #define CONFIG_DW_UDC @@ -109,14 +111,22 @@ #define CONFIG_CMD_MEMORY #define CONFIG_CMD_RUN #define CONFIG_CMD_SAVES + +#if !defined(CONFIG_SPEAR_USBTTY) #define CONFIG_CMD_NET #define CONFIG_CMD_MII #define CONFIG_CMD_PING #define CONFIG_CMD_DHCP +#endif
/* This must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <config_cmd_default.h>
+#if defined(CONFIG_SPEAR_USBTTY) +#undef CONFIG_CMD_NET +#undef CONFIG_CMD_NFS +#endif + /* * Default Environment Varible definitions */ diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index 263c058..84fad0c 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -51,6 +51,7 @@
#include <configs/spear-common.h>
+#if !defined(CONFIG_SPEAR_USBTTY) /* Ethernet driver configuration */ #define CONFIG_DW_ALTDESCRIPTOR 1
@@ -66,6 +67,7 @@ #define CONFIG_MACB0_PHY 0x01
#endif +#endif
/* Serial Configuration (PL011) */ #define CONFIG_SYS_SERIAL0 0xD0000000 @@ -144,7 +146,6 @@ #endif
/* NAND flash configuration */ -#define CONFIG_SYS_FSMC_NAND_SP #define CONFIG_SYS_FSMC_NAND_8BIT
#if defined(CONFIG_SPEAR300) diff --git a/include/configs/spear6xx_evb.h b/include/configs/spear6xx_evb.h index a61d9be..d901ba8 100644 --- a/include/configs/spear6xx_evb.h +++ b/include/configs/spear6xx_evb.h @@ -49,7 +49,6 @@ (void *)CONFIG_SYS_SERIAL1 }
/* NAND flash configuration */ -#define CONFIG_SYS_FSMC_NAND_SP #define CONFIG_SYS_FSMC_NAND_8BIT #define CONFIG_SYS_NAND_BASE (0xD2000000)

On Wednesday 07 March 2012 13:04:02 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
Ethernet probing is removed from u-boot compiled as a firmware for spear flashing utility. This enables faster access to usbtty interface as unused ethernet i/f is not initialized.
Ethernet probing should only be done, when the device is really accessed (e.g. by using tftp commands). I know that the current implementation of the designware ethernet driver does this probing (PHY link negotiation etc) unconditionally at startup.
I have a patch in my queue that changes the designware driver to only start probing/auto-negotiating once its really used. I'll rebase my patch on top of your designware rework patches, once they are approved.
With this patch, this patch here should be unnecessary. At least when reading the patch description above.
So is this patch still needed, after my designware net driver rework?
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
On 3/7/2012 7:44 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:02 Amit Virdi wrote:
From: Vipin KUMARvipin.kumar@st.com
Ethernet probing is removed from u-boot compiled as a firmware for spear flashing utility. This enables faster access to usbtty interface as unused ethernet i/f is not initialized.
Ethernet probing should only be done, when the device is really accessed (e.g. by using tftp commands). I know that the current implementation of the designware ethernet driver does this probing (PHY link negotiation etc) unconditionally at startup.
I have a patch in my queue that changes the designware driver to only start probing/auto-negotiating once its really used. I'll rebase my patch on top of your designware rework patches, once they are approved.
With this patch, this patch here should be unnecessary. At least when reading the patch description above.
So is this patch still needed, after my designware net driver rework?
This patch is not required after your patch. I shall be dropping this in V2.
Regards Amit Virdi

From: Vipin KUMAR vipin.kumar@st.com
This patch enables the UDC and usb-console support only for usbtty configurations
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 14e3ec4..5b6ef72 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -38,6 +38,7 @@ #endif
/* USBD driver configuration */ +#if defined(CONFIG_SPEAR_USBTTY) #define CONFIG_DW_UDC #define CONFIG_USB_DEVICE #define CONFIG_USBD_HS @@ -46,6 +47,8 @@ #define CONFIG_USBD_PRODUCT_NAME "SPEAr SoC" #define CONFIG_USBD_MANUFACTURER "ST Microelectronics"
+#endif + #define CONFIG_EXTRA_ENV_USBTTY "usbtty=cdc_acm\0"
/* I2C driver configuration */

On Wednesday 07 March 2012 13:04:03 Amit Virdi wrote:
From: Vipin KUMAR vipin.kumar@st.com
This patch enables the UDC and usb-console support only for usbtty configurations
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

From: Shiraz Hashim shiraz.hashim@st.com
The linux-2.6.37 base port has few problems with nfs boot. The boot fails while getting timeout on attempting to mount root file system. This helps the ethernet to bring up faster in linux boot thus avoiding the time out. Besides, it was reported that few phys on SPEAr board are failing in certain network conditions which is avoided by enabling autonegotiation. See issue #115943 in global bug tracker.
Reported-by: Deepak Sikri deepak.sikri@st.com Reported-by: Armando Visconti armando.visconti@st.com Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 5b6ef72..26642f1 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -35,6 +35,7 @@ #define CONFIG_DW0_PHY 1 #define CONFIG_NET_MULTI #define CONFIG_PHY_RESET_DELAY (10000) /* in usec */ +#define CONFIG_DW_AUTONEG 1 #endif
/* USBD driver configuration */

On Wednesday 07 March 2012 13:04:04 Amit Virdi wrote:
From: Shiraz Hashim shiraz.hashim@st.com
The linux-2.6.37 base port has few problems with nfs boot. The boot fails while getting timeout on attempting to mount root file system. This helps the ethernet to bring up faster in linux boot thus avoiding the time out. Besides, it was reported that few phys on SPEAr board are failing in certain network conditions which is avoided by enabling autonegotiation. See issue #115943 in global bug tracker.
Hmmm. This sounds like a problem in the Linux network/PHY code then. Which needs to get fixed there instead of changing something here in U-Boot. Please think about situations where the ethernet driver is not called at all in U- Boot (booting from NOR/NAND). With my changes to defer the ethernet probing to the first usage.
One more comment below.
Reported-by: Deepak Sikri deepak.sikri@st.com Reported-by: Armando Visconti armando.visconti@st.com Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 5b6ef72..26642f1 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -35,6 +35,7 @@ #define CONFIG_DW0_PHY 1 #define CONFIG_NET_MULTI #define CONFIG_PHY_RESET_DELAY (10000) /*
in usec */
+#define CONFIG_DW_AUTONEG 1
Please don't add the "1" here.
#endif
/* USBD driver configuration */

Stefan,
On 3/7/2012 7:48 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:04 Amit Virdi wrote:
From: Shiraz Hashimshiraz.hashim@st.com
The linux-2.6.37 base port has few problems with nfs boot. The boot fails while getting timeout on attempting to mount root file system. This helps the ethernet to bring up faster in linux boot thus avoiding the time out. Besides, it was reported that few phys on SPEAr board are failing in certain network conditions which is avoided by enabling autonegotiation. See issue #115943 in global bug tracker.
Hmmm. This sounds like a problem in the Linux network/PHY code then. Which needs to get fixed there instead of changing something here in U-Boot. Please
Probably, this is the problem with phys used in some boards.
think about situations where the ethernet driver is not called at all in U- Boot (booting from NOR/NAND). With my changes to defer the ethernet probing to the first usage.
Keeping your changes, we can still move ahead with autoneg ON. I can think of two solutions for this -
Solution 1: - Use fix configuration for all SPEAr boards except the one on which the problem has been reported. In that case we can ON autoneg.
Solution 2: - Enable autoneg for all SPEAr and specify a larger delay parameter if rootfs has to be mounted from nfs. This would ensure that timeout won't happen.
I would prefer solution 2. What's your opinion?
One more comment below.
Reported-by: Deepak Sikrideepak.sikri@st.com Reported-by: Armando Viscontiarmando.visconti@st.com Signed-off-by: Shiraz Hashimshiraz.hashim@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
include/configs/spear-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 5b6ef72..26642f1 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -35,6 +35,7 @@ #define CONFIG_DW0_PHY 1 #define CONFIG_NET_MULTI #define CONFIG_PHY_RESET_DELAY (10000) /*
in usec */
+#define CONFIG_DW_AUTONEG 1
Please don't add the "1" here.
Ok.
Thanks Amit Virdi

Amit,
On Tuesday 27 March 2012 11:02:08 Amit Virdi wrote:
The linux-2.6.37 base port has few problems with nfs boot. The boot fails while getting timeout on attempting to mount root file system. This helps the ethernet to bring up faster in linux boot thus avoiding the time out. Besides, it was reported that few phys on SPEAr board are failing in certain network conditions which is avoided by enabling autonegotiation. See issue #115943 in global bug tracker.
Hmmm. This sounds like a problem in the Linux network/PHY code then. Which needs to get fixed there instead of changing something here in U-Boot. Please
Probably, this is the problem with phys used in some boards.
think about situations where the ethernet driver is not called at all in U- Boot (booting from NOR/NAND). With my changes to defer the ethernet probing to the first usage.
Keeping your changes, we can still move ahead with autoneg ON. I can think of two solutions for this -
Solution 1:
- Use fix configuration for all SPEAr boards except the one on which
the problem has been reported. In that case we can ON autoneg.
No, please don't.
Solution 2:
- Enable autoneg for all SPEAr and specify a larger delay parameter if
rootfs has to be mounted from nfs. This would ensure that timeout won't happen.
I would prefer solution 2. What's your opinion?
I have no problem with enabling autoneg on all boards. My only concern was the error description in the commit log. This seemed to indicate some error in the Linux ethernet driver. As it relies on the ethernet setup done by the bootloader.
But again, I have generally no objection to enable autoneg for the SPEAr boards.
Best regards, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hi Stefan,
Solution 2:
- Enable autoneg for all SPEAr and specify a larger delay parameter if
rootfs has to be mounted from nfs. This would ensure that timeout won't happen.
I would prefer solution 2. What's your opinion?
I have no problem with enabling autoneg on all boards. My only concern was the error description in the commit log. This seemed to indicate some error in the Linux ethernet driver. As it relies on the ethernet setup done by the bootloader.
The error description is misleading. I would reword the same.
But again, I have generally no objection to enable autoneg for the SPEAr boards.
Ok, thanks.
Best Regards Amit Virdi

From: Shiraz Hashim shiraz.hashim@st.com
Enable data cache with 1:1 mapping of DDR to enable fast file transfer over tty which was doing lot of copy.
This feature is enabled only for flashing operation i.e. when CONFIG_SPEAR_USBTTY is enabled.
This has been tested on SPEAr320, SPEAr600 and SPEAr900 evaluation boards.
Following figures show an estimate on the performance improvements. The test setup was a Linux host (not Windows) and involved measurement of only binary transfer time, through kermit. The flash erase and flash copy time would be unaffected by these patches.
Another thing is this that the timings remained more or less same across ARM9 and Cortex based devices, hence reporting only one of the cases.
Before Enhancements ===================
$ time ukermit.small -p /dev/ttyACM0 -f spear320_uImage.img Downloading file: 100.00% completed(2014080/2014080 bytes) real 0m41.228s user 0m0.002s sys 0m0.064s
After Enhancements ==================
$ time ukermit.large -p /dev/ttyACM0 -f spear320_uImage.img Downloading file: 100.00% completed(2014080/2014080 bytes) real 0m5.441s user 0m0.001s sys 0m0.001s
Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/common/spr_misc.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index 043c72a..99a6595 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -76,6 +76,10 @@ int misc_init_r(void) setenv("stdin", "usbtty"); setenv("stdout", "usbtty"); setenv("stderr", "usbtty"); + +#ifndef CONFIG_SYS_NO_DCACHE + dcache_enable(); +#endif #endif return 0; }

From: Vipin Kumar vipin.kumar@st.com
This patch enables flash protection(lock/unlock) for CFI devices. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, can be locked/unlocked on a sector basis. Moreover, all its sectors are in locked state at reset and these have to be unlocked explicitly before being erased or written.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear3xx_evb.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index 84fad0c..e827a33 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -113,6 +113,7 @@ #define CONFIG_FLASH_CFI_DRIVER
#if defined(CONFIG_SPEAR310) +#define CONFIG_SYS_FLASH_PROTECTION 1 #define CONFIG_SYS_FLASH_BASE 0x50000000 #define CONFIG_SYS_CS1_FLASH_BASE 0x60000000 #define CONFIG_SYS_CS2_FLASH_BASE 0x70000000 @@ -128,6 +129,7 @@ #define CONFIG_SYS_MAX_FLASH_BANKS 6
#elif defined(CONFIG_SPEAR320) +#define CONFIG_SYS_FLASH_PROTECTION 1 #define CONFIG_SYS_FLASH_BASE 0x44000000 #define CONFIG_SYS_CS1_FLASH_BASE 0x45000000 #define CONFIG_SYS_CS2_FLASH_BASE 0x46000000

On Wednesday 07 March 2012 13:04:06 Amit Virdi wrote:
From: Vipin Kumar vipin.kumar@st.com
This patch enables flash protection(lock/unlock) for CFI devices. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, can be locked/unlocked on a sector basis. Moreover, all its sectors are in locked state at reset and these have to be unlocked explicitly before being erased or written.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear3xx_evb.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index 84fad0c..e827a33 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -113,6 +113,7 @@ #define CONFIG_FLASH_CFI_DRIVER
#if defined(CONFIG_SPEAR310) +#define CONFIG_SYS_FLASH_PROTECTION 1 #define CONFIG_SYS_FLASH_BASE 0x50000000 #define CONFIG_SYS_CS1_FLASH_BASE 0x60000000 #define CONFIG_SYS_CS2_FLASH_BASE 0x70000000 @@ -128,6 +129,7 @@ #define CONFIG_SYS_MAX_FLASH_BANKS 6
#elif defined(CONFIG_SPEAR320) +#define CONFIG_SYS_FLASH_PROTECTION 1
Remove the "1"'s above.
Other that that:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Dear Stefan,
On 3/7/2012 7:55 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:06 Amit Virdi wrote:
From: Vipin Kumarvipin.kumar@st.com
This patch enables flash protection(lock/unlock) for CFI devices. This is necessary because the Parallel NOR flash connected on the spear boards, M28W64, can be locked/unlocked on a sector basis. Moreover, all its sectors are in locked state at reset and these have to be unlocked explicitly before being erased or written.
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
include/configs/spear3xx_evb.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index 84fad0c..e827a33 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -113,6 +113,7 @@ #define CONFIG_FLASH_CFI_DRIVER
#if defined(CONFIG_SPEAR310) +#define CONFIG_SYS_FLASH_PROTECTION 1 #define CONFIG_SYS_FLASH_BASE 0x50000000 #define CONFIG_SYS_CS1_FLASH_BASE 0x60000000 #define CONFIG_SYS_CS2_FLASH_BASE 0x70000000 @@ -128,6 +129,7 @@ #define CONFIG_SYS_MAX_FLASH_BANKS 6
#elif defined(CONFIG_SPEAR320) +#define CONFIG_SYS_FLASH_PROTECTION 1
Remove the "1"'s above.
Other that that:
Acked-by: Stefan Roesesr@denx.de
Ok.
Thanks Amit Virdi

From: Vipin Kumar vipin.kumar@st.com
The below text is copy pasted from README - CONFIG_SYS_MONITOR_BASE: Physical start address of boot monitor code (set by make config files to be same as the text base address (TEXT_BASE) used when linking) - same as CONFIG_SYS_FLASH_BASE when booting from flash.
This patch corrects the definition of CONFIG_SYS_MONITOR_BASE and sets it to TEXT_BASE
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 26642f1..0998157 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -168,8 +168,7 @@ "0x4C0000; bootm 0x1600000" #endif
-#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE -#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \ +#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + \ CONFIG_SYS_MONITOR_LEN) #elif defined(CONFIG_ENV_IS_IN_NAND) /* @@ -206,6 +205,8 @@
#define CONFIG_ENV_SIZE 0x02000 +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_MONITOR_IS_IN_RAM 1
/* Miscellaneous configurable options */ #define CONFIG_ARCH_CPU_INIT

On Wednesday 07 March 2012 13:04:07 Amit Virdi wrote:
From: Vipin Kumar vipin.kumar@st.com
The below text is copy pasted from README
- CONFIG_SYS_MONITOR_BASE: Physical start address of boot monitor code (set by make config files to be same as the text base address (TEXT_BASE) used when linking) - same as CONFIG_SYS_FLASH_BASE when booting from flash.
This patch corrects the definition of CONFIG_SYS_MONITOR_BASE and sets it to TEXT_BASE
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear-common.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 26642f1..0998157 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -168,8 +168,7 @@ "0x4C0000; bootm
0x1600000"
#endif
-#define CONFIG_SYS_MONITOR_BASE
CONFIG_SYS_FLASH_BASE
-#define CONFIG_ENV_ADDR
(CONFIG_SYS_MONITOR_BASE + \
+#define CONFIG_ENV_ADDR
(CONFIG_SYS_FLASH_BASE + \
CONFIG_SYS_MONITOR_LEN)
#elif defined(CONFIG_ENV_IS_IN_NAND) /* @@ -206,6 +205,8 @@
#define CONFIG_ENV_SIZE 0x02000 +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_MONITOR_IS_IN_RAM 1
Why is CONFIG_MONITOR_IS_IN_RAM defined? And if really needed, please without the 1.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Stefan,
#define CONFIG_ENV_SIZE 0x02000 +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_MONITOR_IS_IN_RAM 1
Why is CONFIG_MONITOR_IS_IN_RAM defined? And if really needed, please without the 1.
CONFIG_MONITOR_IS_IN_RAM is defined with the understanding that since, u-boot is loaded by the BootROM (embedded in eROM) to RAM, so the monitor is present in RAM. Please confirm if this understanding is correct.
Thanks Amit Virdi

Amit,
On Tuesday 27 March 2012 08:38:18 Amit Virdi wrote:
#define CONFIG_ENV_SIZE 0x02000
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_MONITOR_IS_IN_RAM 1
Why is CONFIG_MONITOR_IS_IN_RAM defined? And if really needed, please without the 1.
CONFIG_MONITOR_IS_IN_RAM is defined with the understanding that since, u-boot is loaded by the BootROM (embedded in eROM) to RAM, so the monitor is present in RAM. Please confirm if this understanding is correct.
Hmmm, seems to be used on some Coldfire and Blackfin platforms. Its not needed for your platform. Please remove it.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

On 3/27/2012 12:35 PM, Stefan Roese wrote:
Amit,
On Tuesday 27 March 2012 08:38:18 Amit Virdi wrote:
#define CONFIG_ENV_SIZE 0x02000
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_MONITOR_IS_IN_RAM 1
Why is CONFIG_MONITOR_IS_IN_RAM defined? And if really needed, please without the 1.
CONFIG_MONITOR_IS_IN_RAM is defined with the understanding that since, u-boot is loaded by the BootROM (embedded in eROM) to RAM, so the monitor is present in RAM. Please confirm if this understanding is correct.
Hmmm, seems to be used on some Coldfire and Blackfin platforms. Its not needed for your platform. Please remove it.
Ok. Thanks for the clarification!
Best Regards Amit Virdi

From: Vipin Kumar vipin.kumar@st.com
Enable CONFIG_SYS_FLASH_EMPTY_INFO macro to enable reporting of empty sector information through flinfo command.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 0998157..bde99d2 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -80,7 +80,6 @@ CONFIG_SYS_CS1_FLASH_BASE} #define CONFIG_SYS_MAX_FLASH_SECT 128
-#define CONFIG_SYS_FLASH_EMPTY_INFO 1 #define CONFIG_SYS_FLASH_ERASE_TOUT (3 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_WRITE_TOUT (3 * CONFIG_SYS_HZ)
@@ -238,6 +237,7 @@ #define CONFIG_SYS_CONSOLE_INFO_QUIET 1 #define CONFIG_SYS_64BIT_VSPRINTF 1
+#define CONFIG_SYS_FLASH_EMPTY_INFO 1 #define CONFIG_EXTRA_ENV_UNLOCK "unlock=yes\0" #define CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_USBTTY \ CONFIG_EXTRA_ENV_UNLOCK

On Wednesday 07 March 2012 13:04:08 Amit Virdi wrote:
From: Vipin Kumar vipin.kumar@st.com
Enable CONFIG_SYS_FLASH_EMPTY_INFO macro to enable reporting of empty sector information through flinfo command.
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear-common.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 0998157..bde99d2 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -80,7 +80,6 @@
CONFIG_SYS_CS1_FLASH_BASE}
#define CONFIG_SYS_MAX_FLASH_SECT 128
-#define CONFIG_SYS_FLASH_EMPTY_INFO 1 #define CONFIG_SYS_FLASH_ERASE_TOUT (3 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_WRITE_TOUT (3 * CONFIG_SYS_HZ)
@@ -238,6 +237,7 @@ #define CONFIG_SYS_CONSOLE_INFO_QUIET 1 #define CONFIG_SYS_64BIT_VSPRINTF 1
+#define CONFIG_SYS_FLASH_EMPTY_INFO 1
No 1 please.
Other than that:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hi Stefan,
CONFIG_SYS_CS1_FLASH_BASE}
#define CONFIG_SYS_MAX_FLASH_SECT 128
-#define CONFIG_SYS_FLASH_EMPTY_INFO 1 #define CONFIG_SYS_FLASH_ERASE_TOUT (3 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_WRITE_TOUT (3 * CONFIG_SYS_HZ)
@@ -238,6 +237,7 @@ #define CONFIG_SYS_CONSOLE_INFO_QUIET 1 #define CONFIG_SYS_64BIT_VSPRINTF 1
+#define CONFIG_SYS_FLASH_EMPTY_INFO 1
No 1 please.
Other than that:
Acked-by: Stefan Roesesr@denx.de
Ok.
Thanks Amit Virdi

From: Vipin Kumar vipin.kumar@st.com
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index bde99d2..4fb56ba 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -104,6 +104,8 @@ #define CONFIG_NAND_FSMC #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_MTD_NAND_VERIFY_WRITE 1 +#define CONFIG_SYS_NAND_ONFI_DETECTION 1 +#define CONFIG_SYS_NAND_QUIET_TEST 1
/* * Command support defines

On Wednesday 07 March 2012 13:04:09 Amit Virdi wrote:
From: Vipin Kumar vipin.kumar@st.com
Signed-off-by: Vipin Kumar vipin.kumar@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
include/configs/spear-common.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index bde99d2..4fb56ba 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -104,6 +104,8 @@ #define CONFIG_NAND_FSMC #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_MTD_NAND_VERIFY_WRITE 1 +#define CONFIG_SYS_NAND_ONFI_DETECTION 1 +#define CONFIG_SYS_NAND_QUIET_TEST 1
Remove the "1"'s please. And please also remove CONFIG_MTD_NAND_VERIFY_WRITE. Or is it really needed? I didn't need it on my SPEAr600 boards. And it slows NAND access unnecessarily down.
Other than this:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Stefan,
On 3/7/2012 8:04 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:09 Amit Virdi wrote:
From: Vipin Kumarvipin.kumar@st.com
Signed-off-by: Vipin Kumarvipin.kumar@st.com Signed-off-by: Amit Virdiamit.virdi@st.com
include/configs/spear-common.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index bde99d2..4fb56ba 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -104,6 +104,8 @@ #define CONFIG_NAND_FSMC #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_MTD_NAND_VERIFY_WRITE 1 +#define CONFIG_SYS_NAND_ONFI_DETECTION 1 +#define CONFIG_SYS_NAND_QUIET_TEST 1
Remove the "1"'s please. And please also remove CONFIG_MTD_NAND_VERIFY_WRITE. Or is it really needed? I didn't need it on my SPEAr600 boards. And it slows NAND access unnecessarily down.
Yes, CONFIG_MTD_NAND_VERIFY_WRITE slows down the NAND access. Since it is only for verification purposes, I'll remove it in V2.
Thanks Amit Virdi

From: Shiraz Hashim shiraz.hashim@st.com
UART in u-boot intends to run on 48MHz clock supplied by USB PLL. Explicitly select the intended clock source.
Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- arch/arm/cpu/arm926ejs/spear/cpu.c | 7 ++++++- arch/arm/include/asm/arch-spear/spr_misc.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c index 4dc7d69..8f34aed 100644 --- a/arch/arm/cpu/arm926ejs/spear/cpu.c +++ b/arch/arm/cpu/arm926ejs/spear/cpu.c @@ -31,7 +31,7 @@ int arch_cpu_init(void) { struct misc_regs *const misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE; - u32 periph1_clken; + u32 periph1_clken, periph_clk_cfg;
periph1_clken = readl(&misc_p->periph1_clken);
@@ -43,6 +43,11 @@ int arch_cpu_init(void)
#if defined(CONFIG_PL011_SERIAL) periph1_clken |= MISC_UART0ENB; + + periph_clk_cfg = readl(&misc_p->periph_clk_cfg); + periph_clk_cfg &= ~CONFIG_SPEAR_UARTCLKMSK; + periph_clk_cfg |= CONFIG_SPEAR_UART48M; + writel(periph_clk_cfg, &misc_p->periph_clk_cfg); #endif #if defined(CONFIG_DESIGNWARE_ETH) periph1_clken |= MISC_ETHENB; diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h b/arch/arm/include/asm/arch-spear/spr_misc.h index b10c726..384944d 100644 --- a/arch/arm/include/asm/arch-spear/spr_misc.h +++ b/arch/arm/include/asm/arch-spear/spr_misc.h @@ -110,6 +110,8 @@ struct misc_regs { /* PERIPH_CLK_CFG value */ #define MISC_GPT3SYNTH 0x00000400 #define MISC_GPT4SYNTH 0x00000800 +#define CONFIG_SPEAR_UART48M 0 +#define CONFIG_SPEAR_UARTCLKMSK (0x1 << 4)
/* PRSC_CLK_CFG value */ /*

On Wednesday 07 March 2012 13:04:10 Amit Virdi wrote:
From: Shiraz Hashim shiraz.hashim@st.com
UART in u-boot intends to run on 48MHz clock supplied by USB PLL. Explicitly select the intended clock source.
Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

From: Shiraz Hashim shiraz.hashim@st.com
SoC Core ID offset is 0x30 in miscellaneous configuration address space. It was wrongly mentioned as periph2 clk enable.
Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com --- arch/arm/include/asm/arch-spear/spr_misc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h b/arch/arm/include/asm/arch-spear/spr_misc.h index 384944d..b8fcf49 100644 --- a/arch/arm/include/asm/arch-spear/spr_misc.h +++ b/arch/arm/include/asm/arch-spear/spr_misc.h @@ -37,7 +37,7 @@ struct misc_regs { u32 amba_clk_cfg; /* 0x24 */ u32 periph_clk_cfg; /* 0x28 */ u32 periph1_clken; /* 0x2C */ - u32 periph2_clken; /* 0x30 */ + u32 soc_core_id; /* 0x30 */ u32 ras_clken; /* 0x34 */ u32 periph1_rst; /* 0x38 */ u32 periph2_rst; /* 0x3C */

On Wednesday 07 March 2012 13:04:11 Amit Virdi wrote:
From: Shiraz Hashim shiraz.hashim@st.com
SoC Core ID offset is 0x30 in miscellaneous configuration address space. It was wrongly mentioned as periph2 clk enable.
Signed-off-by: Shiraz Hashim shiraz.hashim@st.com Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Signed-off-by: Amit Virdi amit.virdi@st.com --- board/spear/common/Makefile | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile index 11f81e4..48dcfd3 100644 --- a/board/spear/common/Makefile +++ b/board/spear/common/Makefile @@ -29,9 +29,14 @@ endif
LIB = $(obj)lib$(VENDOR).o
-COBJS := spr_misc.o -SOBJS := spr_lowlevel_init.o +COBJS-$(CONFIG_SPEAR3XX) += spr_misc.o +COBJS-$(CONFIG_SPEAR600) += spr_misc.o
+SOBJS-$(CONFIG_SPEAR3XX) += spr_lowlevel_init.o +SOBJS-$(CONFIG_SPEAR600) += spr_lowlevel_init.o + +COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))

On Wednesday 07 March 2012 13:04:12 Amit Virdi wrote:
Signed-off-by: Amit Virdi amit.virdi@st.com
board/spear/common/Makefile | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile index 11f81e4..48dcfd3 100644 --- a/board/spear/common/Makefile +++ b/board/spear/common/Makefile @@ -29,9 +29,14 @@ endif
LIB = $(obj)lib$(VENDOR).o
-COBJS := spr_misc.o -SOBJS := spr_lowlevel_init.o +COBJS-$(CONFIG_SPEAR3XX) += spr_misc.o +COBJS-$(CONFIG_SPEAR600) += spr_misc.o
+SOBJS-$(CONFIG_SPEAR3XX) += spr_lowlevel_init.o +SOBJS-$(CONFIG_SPEAR600) += spr_lowlevel_init.o
+COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))
I don't really see the benefit of this patch. Could you please explain a bit more why this is needed/better?
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile index 11f81e4..48dcfd3 100644 --- a/board/spear/common/Makefile +++ b/board/spear/common/Makefile @@ -29,9 +29,14 @@ endif
LIB = $(obj)lib$(VENDOR).o
-COBJS := spr_misc.o -SOBJS := spr_lowlevel_init.o +COBJS-$(CONFIG_SPEAR3XX) += spr_misc.o +COBJS-$(CONFIG_SPEAR600) += spr_misc.o
+SOBJS-$(CONFIG_SPEAR3XX) += spr_lowlevel_init.o +SOBJS-$(CONFIG_SPEAR600) += spr_lowlevel_init.o
+COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y)) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))
I don't really see the benefit of this patch. Could you please explain a bit more why this is needed/better?
Although it is better this way but the original intention to introduce this patch was to add more features which I didn't added in this patchset since this patchset aims to provide bug fixes in the already existing SPEAr support in u-boot.
Maybe, I can drop this patch in V2.
Regards Amit Virdi

On Monday 12 March 2012 14:57:50 Amit Virdi wrote:
diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile index 11f81e4..48dcfd3 100644 --- a/board/spear/common/Makefile +++ b/board/spear/common/Makefile @@ -29,9 +29,14 @@ endif
LIB = $(obj)lib$(VENDOR).o
-COBJS := spr_misc.o -SOBJS := spr_lowlevel_init.o +COBJS-$(CONFIG_SPEAR3XX) += spr_misc.o +COBJS-$(CONFIG_SPEAR600) += spr_misc.o
+SOBJS-$(CONFIG_SPEAR3XX) += spr_lowlevel_init.o +SOBJS-$(CONFIG_SPEAR600) += spr_lowlevel_init.o
+COBJS := $(sort $(COBJS-y)) +SOBJS := $(sort $(SOBJS-y))
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))
I don't really see the benefit of this patch. Could you please explain a bit more why this is needed/better?
Although it is better this way but the original intention to introduce this patch was to add more features which I didn't added in this patchset since this patchset aims to provide bug fixes in the already existing SPEAr support in u-boot.
Maybe, I can drop this patch in V2.
Yes. Please drop it for now. You can always introduce it (if needed) in a new patch adding the "features" you mentioned above.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

In SPEAr configuration files, unnecessary paranthesis are used in some #defines. Remove them as they serve no purpose
Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 8 ++++---- include/configs/spear3xx_evb.h | 6 +++--- include/configs/spear6xx_evb.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index 4fb56ba..fe8d66d 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -61,7 +61,7 @@ #define CONFIG_I2C_CHIPADDRESS 0x50
/* Timer, HZ specific defines */ -#define CONFIG_SYS_HZ (1000) +#define CONFIG_SYS_HZ 1000
/* Flash configuration */ #if defined(CONFIG_FLASH_PNOR) @@ -73,9 +73,9 @@ #if defined(CONFIG_ST_SMI)
#define CONFIG_SYS_MAX_FLASH_BANKS 2 -#define CONFIG_SYS_FLASH_BASE (0xF8000000) -#define CONFIG_SYS_CS1_FLASH_BASE (0xF9000000) -#define CONFIG_SYS_FLASH_BANK_SIZE (0x01000000) +#define CONFIG_SYS_FLASH_BASE 0xF8000000 +#define CONFIG_SYS_CS1_FLASH_BASE 0xF9000000 +#define CONFIG_SYS_FLASH_BANK_SIZE 0x01000000 #define CONFIG_SYS_FLASH_ADDR_BASE {CONFIG_SYS_FLASH_BASE, \ CONFIG_SYS_CS1_FLASH_BASE} #define CONFIG_SYS_MAX_FLASH_SECT 128 diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index e827a33..5da8115 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -151,13 +151,13 @@ #define CONFIG_SYS_FSMC_NAND_8BIT
#if defined(CONFIG_SPEAR300) -#define CONFIG_SYS_NAND_BASE (0x80000000) +#define CONFIG_SYS_NAND_BASE 0x80000000
#elif defined(CONFIG_SPEAR310) -#define CONFIG_SYS_NAND_BASE (0x40000000) +#define CONFIG_SYS_NAND_BASE 0x40000000
#elif defined(CONFIG_SPEAR320) -#define CONFIG_SYS_NAND_BASE (0x50000000) +#define CONFIG_SYS_NAND_BASE 0x50000000
#endif
diff --git a/include/configs/spear6xx_evb.h b/include/configs/spear6xx_evb.h index d901ba8..502937a 100644 --- a/include/configs/spear6xx_evb.h +++ b/include/configs/spear6xx_evb.h @@ -50,6 +50,6 @@
/* NAND flash configuration */ #define CONFIG_SYS_FSMC_NAND_8BIT -#define CONFIG_SYS_NAND_BASE (0xD2000000) +#define CONFIG_SYS_NAND_BASE 0xD2000000
#endif /* __CONFIG_H */

On Wednesday 07 March 2012 13:04:13 Amit Virdi wrote:
In SPEAr configuration files, unnecessary paranthesis are used in some #defines. Remove them as they serve no purpose
Signed-off-by: Amit Virdi amit.virdi@st.com
Ahh, I see. I should have scanned all you patches before commenting on these cosmetic issues. I assume that you also remove the newly added parentheses here? Then I've no objections to apply the earlier patches as well and do the cleanup with this patch.
So:
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

On Wednesday 07 March 2012 15:41:26 Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:13 Amit Virdi wrote:
In SPEAr configuration files, unnecessary paranthesis are used in some #defines. Remove them as they serve no purpose
Signed-off-by: Amit Virdi amit.virdi@st.com
Ahh, I see. I should have scanned all you patches before commenting on these cosmetic issues. I assume that you also remove the newly added parentheses here? Then I've no objections to apply the earlier patches as well and do the cleanup with this patch.
This reminds me of the spear headers in arch/arm/include/asm/arch-spear. It would be great if you could remove the parentheses here as well.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

On 3/7/2012 8:16 PM, Stefan Roese wrote:
On Wednesday 07 March 2012 15:41:26 Stefan Roese wrote:
On Wednesday 07 March 2012 13:04:13 Amit Virdi wrote:
In SPEAr configuration files, unnecessary paranthesis are used in some #defines. Remove them as they serve no purpose
Signed-off-by: Amit Virdiamit.virdi@st.com
Ahh, I see. I should have scanned all you patches before commenting on these cosmetic issues. I assume that you also remove the newly added parentheses here? Then I've no objections to apply the earlier patches as well and do the cleanup with this patch.
This reminds me of the spear headers in arch/arm/include/asm/arch-spear. It would be great if you could remove the parentheses here as well.
Sure! Somehow, I missed this file.
It was my mistake to hold the cleanup patches till the last. Point noted for next time ;)
Regards Amit Virdi

In SPEAr, some of the configuration flags eg. CONFIG_SPEAR_EMI, were given value "1", which isn't required. Define the flags without assigning any value
Signed-off-by: Amit Virdi amit.virdi@st.com --- include/configs/spear-common.h | 26 +++++++++++++------------- include/configs/spear3xx_evb.h | 12 ++++++------ include/configs/spear6xx_evb.h | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h index fe8d66d..a022fc8 100644 --- a/include/configs/spear-common.h +++ b/include/configs/spear-common.h @@ -65,7 +65,7 @@
/* Flash configuration */ #if defined(CONFIG_FLASH_PNOR) -#define CONFIG_SPEAR_EMI 1 +#define CONFIG_SPEAR_EMI #else #define CONFIG_ST_SMI #endif @@ -103,9 +103,9 @@ #define CONFIG_MTD_PARTITIONS #define CONFIG_NAND_FSMC #define CONFIG_SYS_MAX_NAND_DEVICE 1 -#define CONFIG_MTD_NAND_VERIFY_WRITE 1 -#define CONFIG_SYS_NAND_ONFI_DETECTION 1 -#define CONFIG_SYS_NAND_QUIET_TEST 1 +#define CONFIG_MTD_NAND_VERIFY_WRITE +#define CONFIG_SYS_NAND_ONFI_DETECTION +#define CONFIG_SYS_NAND_QUIET_TEST
/* * Command support defines @@ -207,18 +207,18 @@
#define CONFIG_ENV_SIZE 0x02000 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -#define CONFIG_MONITOR_IS_IN_RAM 1 +#define CONFIG_MONITOR_IS_IN_RAM
/* Miscellaneous configurable options */ #define CONFIG_ARCH_CPU_INIT #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO #define CONFIG_BOOT_PARAMS_ADDR 0x00000100 -#define CONFIG_CMDLINE_TAG 1 -#define CONFIG_SETUP_MEMORY_TAGS 1 -#define CONFIG_MISC_INIT_R 1 -#define CONFIG_ZERO_BOOTDELAY_CHECK 1 -#define CONFIG_AUTOBOOT_KEYED 1 +#define CONFIG_CMDLINE_TAG +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_MISC_INIT_R +#define CONFIG_ZERO_BOOTDELAY_CHECK +#define CONFIG_AUTOBOOT_KEYED #define CONFIG_AUTOBOOT_STOP_STR " " #define CONFIG_AUTOBOOT_PROMPT \ "Hit SPACE in %d seconds to stop autoboot.\n", bootdelay @@ -236,10 +236,10 @@ #define CONFIG_SYS_MAXARGS 16 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE #define CONFIG_SYS_LOAD_ADDR 0x00800000 -#define CONFIG_SYS_CONSOLE_INFO_QUIET 1 -#define CONFIG_SYS_64BIT_VSPRINTF 1 +#define CONFIG_SYS_CONSOLE_INFO_QUIET +#define CONFIG_SYS_64BIT_VSPRINTF
-#define CONFIG_SYS_FLASH_EMPTY_INFO 1 +#define CONFIG_SYS_FLASH_EMPTY_INFO #define CONFIG_EXTRA_ENV_UNLOCK "unlock=yes\0" #define CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_USBTTY \ CONFIG_EXTRA_ENV_UNLOCK diff --git a/include/configs/spear3xx_evb.h b/include/configs/spear3xx_evb.h index 5da8115..84b6a9f 100644 --- a/include/configs/spear3xx_evb.h +++ b/include/configs/spear3xx_evb.h @@ -29,14 +29,14 @@ * (easy to change) */ #if defined(CONFIG_spear300) -#define CONFIG_SPEAR3XX 1 -#define CONFIG_SPEAR300 1 +#define CONFIG_SPEAR3XX +#define CONFIG_SPEAR300 #elif defined(CONFIG_spear310) -#define CONFIG_SPEAR3XX 1 -#define CONFIG_SPEAR310 1 +#define CONFIG_SPEAR3XX +#define CONFIG_SPEAR310 #elif defined(CONFIG_spear320) -#define CONFIG_SPEAR3XX 1 -#define CONFIG_SPEAR320 1 +#define CONFIG_SPEAR3XX +#define CONFIG_SPEAR320 #endif
#if defined(CONFIG_usbtty) diff --git a/include/configs/spear6xx_evb.h b/include/configs/spear6xx_evb.h index 502937a..92244d7 100644 --- a/include/configs/spear6xx_evb.h +++ b/include/configs/spear6xx_evb.h @@ -28,7 +28,7 @@ * High Level Configuration Options * (easy to change) */ -#define CONFIG_SPEAR600 1 +#define CONFIG_SPEAR600
#if defined(CONFIG_usbtty) #define CONFIG_SPEAR_USBTTY 1

On Wednesday 07 March 2012 13:04:14 Amit Virdi wrote:
In SPEAr, some of the configuration flags eg. CONFIG_SPEAR_EMI, were given value "1", which isn't required. Define the flags without assigning any value
Signed-off-by: Amit Virdi amit.virdi@st.com
Acked-by: Stefan Roese sr@denx.de
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hi Amit,
On Wednesday 07 March 2012 13:03:49 Amit Virdi wrote:
This patchset updates the SPEAr support in the u-boot. It contains various bugfixes and enhancements.
The patches have certain dependencies on the drivers, so should be applied once the driver patches are frozen. The various drivers on which these patches depend are:
- USB device controller:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/125220/focus=126598 2. USB OTG: Patch (USB:gadget:designware USB OTG implementation) 3. ST_SMI: http://lists.denx.de/pipermail/u-boot/2012-February/118672.html 4. FSMC_NAND: http://patchwork.ozlabs.org/patch/143167/ 5. Designware ethernet controller: http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/126029
In a subsequent patchset, more features shall be added along with cleanup of the directory structure.
Thanks for all this work.
We already talked about this off list. I think it makes much sense to install an SPEAr U-Boot custodian, to offload Albert a bit. As I understand there are more SPEAr patches to be seen soon. And I also have some waiting here (SPL support etc).
So who would be best suited to become SPEAr custodian? Amit, you yourself? Or Vipin Kumar, as he is currently listed as maintainer for the SPEAr eval boards?
Comments?
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Hello Stefan,
On Wed, Mar 7, 2012 at 6:45 PM, Stefan Roese sr@denx.de wrote:
Hi Amit,
On Wednesday 07 March 2012 13:03:49 Amit Virdi wrote:
This patchset updates the SPEAr support in the u-boot. It contains various bugfixes and enhancements.
The patches have certain dependencies on the drivers, so should be applied once the driver patches are frozen. The various drivers on which these patches depend are:
- USB device controller:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/125220/focus=126598 2. USB OTG: Patch (USB:gadget:designware USB OTG implementation) 3. ST_SMI: http://lists.denx.de/pipermail/u-boot/2012-February/118672.html 4. FSMC_NAND: http://patchwork.ozlabs.org/patch/143167/ 5. Designware ethernet controller: http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/126029
In a subsequent patchset, more features shall be added along with cleanup of the directory structure.
Thanks for all this work.
We already talked about this off list. I think it makes much sense to install an SPEAr U-Boot custodian, to offload Albert a bit. As I understand there are more SPEAr patches to be seen soon. And I also have some waiting here (SPL support etc).
So who would be best suited to become SPEAr custodian? Amit, you yourself? Or Vipin Kumar, as he is currently listed as maintainer for the SPEAr eval boards?
Comments?
Today, the best candidate for SPEAr custodian is Vipin. He has great experience on SPEAr and has been working for past so many years. However, we need his consent before appointing him the custodian ;-)
Vipin, please share your opinion.
Thanks Amit Virdi

Hello Stefan,
We already talked about this off list. I think it makes much sense to install an SPEAr U-Boot custodian, to offload Albert a bit. As I understand there are more SPEAr patches to be seen soon. And I also have some waiting here (SPL support etc).
So who would be best suited to become SPEAr custodian? Amit, you yourself? Or Vipin Kumar, as he is currently listed as maintainer for the SPEAr eval boards?
Yes, I can become a custodian on denx. Well, in that case all spear patches would be pushed through my denx.git repository. Is that right ? Also, can I create a repository myself ? and last but not the least, the workflow for custodians given at denx.de is how custodians really work or is there a deviation?
Comments?
Thanks, Stefan
Regards Vipin
-- DENX Software Engineering GmbH, MD: Wolfgang Denk& Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de .

Hi Vipin,
On Friday 09 March 2012 08:29:10 Vipin Kumar wrote:
So who would be best suited to become SPEAr custodian? Amit, you yourself? Or Vipin Kumar, as he is currently listed as maintainer for the SPEAr eval boards?
Yes, I can become a custodian on denx. Well, in that case all spear patches would be pushed through my denx.git repository. Is that right ?
Correct. But only the SPEAr platform patches. Not the peripheral patches like designware ethernet, USB, NAND etc. Those will still go through the responsible subsystem custodian. So its mainly those patches related to files in SPEAr board files and under arch/arm.
Also, can I create a repository myself ?
I think Wolfgang will create it initially for you. Wolfgang, please correct me if I'm wrong.
and last but not the least, the workflow for custodians given at denx.de is how custodians really work or is there a deviation?
Are you referring to this page?
http://www.denx.de/wiki/U-Boot/CustodianGitTrees
It should be quite up-to-date. Though I haven't read it for quite a while. I suggest that you give it a try and ask on the list once you have some questions.
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

On 3/9/2012 1:17 PM, Stefan Roese wrote:
Hi Vipin,
Hello Stefan,
On Friday 09 March 2012 08:29:10 Vipin Kumar wrote:
So who would be best suited to become SPEAr custodian? Amit, you yourself? Or Vipin Kumar, as he is currently listed as maintainer for the SPEAr eval boards?
Yes, I can become a custodian on denx. Well, in that case all spear patches would be pushed through my denx.git repository. Is that right ?
Correct. But only the SPEAr platform patches. Not the peripheral patches like designware ethernet, USB, NAND etc. Those will still go through the responsible subsystem custodian. So its mainly those patches related to files in SPEAr board files and under arch/arm.
Yes, understood
Also, can I create a repository myself ?
I think Wolfgang will create it initially for you. Wolfgang, please correct me if I'm wrong.
and last but not the least, the workflow for custodians given at denx.de is how custodians really work or is there a deviation?
Are you referring to this page?
Yes
It should be quite up-to-date. Though I haven't read it for quite a while. I suggest that you give it a try and ask on the list once you have some questions.
Sure. I will do that
Thanks, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk& Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de .
Regards Vipin
participants (6)
-
Amit Virdi
-
Amit Virdi
-
Mike Frysinger
-
Stefan Roese
-
Vipin Kumar
-
Wolfgang Denk