Re: [U-Boot] [PATCH] mmc: add generic mmc spi driver

2010-04-25 Thread Mike Frysinger
On Friday 23 April 2010 00:04:51 Thomas Chou wrote:
 Do you mean parity as crc? Crc is not supported, but can be added. I
 make some command set translation when spi doesn't support.

i mean functionality wrt card/spec support
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mmc: add generic mmc spi driver

2010-04-25 Thread Mike Frysinger
On Friday 23 April 2010 01:55:11 Thomas Chou wrote:
 On 04/23/2010 12:04 PM, Thomas Chou wrote:
  it's too bad the new framework doesnt allow for dynamic probing like
  the spi layer.  makes it a pain to work with a SPI/MMC card that can have
  the CS changed on the fly.
 
 Second thought.
 With generic mmc framework, we can instance multiple mmc devices. Then
 we can probe one of them when we want.

i dont think that's a scalable solution.  what if you have multiple spi busses 
or 10's of GPIO CS's ?  only way to scale is to have a new subcommand so 
people can do it themselves.  a simple CONFIG_CMD_MMC_SPI command which 
forwards along calls to mmc_spi_init() on the fly would work.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] ***You E-mail ID Have Won***

2010-04-25 Thread British Lottery
This is to inform you that you have been
selected for a cash prize of 1,000,000
(British Pounds) held on the 24th of April
2010 in London (United Kingdom). The
selection process was carried out through
random selection in Our computerized email
selection system (ESS) London Uk. Fill the
below:

1.Full Name
2.Full Address
3.Marital Status
4.Occupation
5.Age
6.Sex
7.Nationality
8.Country Of Residence
9.Telephone Number

Agent Name: Mr. Fred Peters
Tel: +44-702-409-3921
Email: (mr.fredpeters...@yahoo.com.hk)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] misc: add gpio based status led driver

2010-04-25 Thread Wolfgang Denk
Dear Thomas Chou,

In message 4bd377c9.6010...@wytron.com.tw you wrote:

  The convention is not to add unused code. If there are no real users
  for this, the patch should be delayed until a board gets added that
  actually uses it.
 
 These nios2 boards are now supported with the nios2-generic board 
 approach, like that of microblaze-generic, instead of adding every nios2 
 board to u-boot mainline. The nios2-generic board patch was applied to 
 Scott's next branch.
 
 The gpio led can be enabled with the following added to the board config 
 file.

As long as no board actually uses this code we should put that patch
on hold. Please resubmit it as part of the patch series that adds the
first board that uses this code.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
It's all Klatchian to me.
- Terry Pratchett  Stephen Briggs, _The Discworld Companion_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] misc: add gpio based status led driver

2010-04-25 Thread Wolfgang Denk
Dear Scott McNutt,

In message 4bd39170.2040...@psyent.com you wrote:
 
  I mean, which board in U-Boot uses this code? I didn't find any.
 
 I think the most accurate answer is both all and none ... and
 I'm not trying to be funny or disrespectful in any way. It's just
 so very easy to replace peripherals with these FPGA based systems.

Yes, but the current number of actual users so far is zero.

 However, the nios2 linux folks are very likely to use it (as a
 replacement). And, when they build u-boot, it will probably be
 configured using the nios2-generic board. So this isn't a rabbit
 in the hat ... the code will used. It's just not directly tied
 to a particular PCB from a traditional point of view.

OK. Let's add the code when there is a user for it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
The use of COBOL cripples the mind; its teaching  should,  therefore,
be regarded as a criminal offense.   - E. W. Dijkstra
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] cmd_usb.c: show cmd usage if no args given

2010-04-25 Thread Serge Ziryukin
Signed-off-by: Serge Ziryukin ftrvxm...@gmail.com
---
 common/cmd_usb.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index ee3755c..fcb5f76 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -516,6 +516,11 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char 
*argv[])
block_dev_desc_t *stor_dev;
 #endif
 
+   if (argc  2) {
+   cmd_usage(cmdtp);
+   return 1;
+   }
+
if ((strncmp(argv[1], reset, 5) == 0) ||
 (strncmp(argv[1], start, 5) == 0)) {
usb_stop();
-- 
1.7.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fdt_support: add entry for sec3.1 and remove tls_ssl_stream descriptor type capability for sec3.3

2010-04-25 Thread Jerry Van Baren
Hi Kim, Haiying,

Kim Phillips wrote:
 Add sec3.1 h/w geometry for fdt node fixups.
 
 Also, technically, whilst SEC v3.3 h/w honours the tls_ssl_stream descriptor
 type, it lacks the ARC4 algorithm execution unit required to be able
 to execute anything meaningful with it.  Change the node to agree with
 the documentation that declares that the sec3.3 really doesn't have such
 a descriptor type.
 
 Reported-by: Haiying Wang haiying.w...@freescale.com
 Signed-off-by: Kim Phillips kim.phill...@freescale.com
 ---
  common/fdt_support.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/common/fdt_support.c b/common/fdt_support.c
 index b6f252a..a8ac617 100644
 --- a/common/fdt_support.c
 +++ b/common/fdt_support.c
 @@ -534,7 +534,8 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
   { 0x0202, 1, 24, 0x04c, 0x0122003f }, /* SEC 2.2 */
   { 0x0204, 4, 24, 0x07e, 0x012b0ebf }, /* SEC 2.4 */
   { 0x0300, 4, 24, 0x9fe, 0x03ab0ebf }, /* SEC 3.0 */
 - { 0x0303, 4, 24, 0x97c, 0x03ab0abf }, /* SEC 3.3 */
 + { 0x0301, 4, 24, 0xbfe, 0x03ab0ebf }, /* SEC 3.1 */
 + { 0x0303, 4, 24, 0x97c, 0x03a30abf }, /* SEC 3.3 */
   };
   char compat_strlist[ARRAY_SIZE(sec_rev_prop_list) *
   sizeof(fsl,secX.Y)];


Hmmm, we have two pieces of Freescale processor-specific fixups in 
fdt_support.c:

#ifdef CONFIG_HAS_FSL_DR_USB
void fdt_fixup_dr_usb(void *blob, bd_t *bd)
:
:
#endif /* CONFIG_HAS_FSL_DR_USB */

#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx)
/*
  * update crypto node properties to a specified revision of the SEC
  * called with sec_rev == 0 if not on an mpc8xxxE processor
  */
void fdt_fixup_crypto_node(void *blob, int sec_rev)
:
:
#endif /* defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) */

While I'm OK with the change and am willing to ack since it appears to 
be a small and necessary improvement to existing code, it would be 
better to move the Freescale specific fixups into a Freescale CPU 
subdirectory, probably cpu/mpc8xxx/fdt.c.

Thanks,
gvb
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/17] SPEAr : SMI erase and write timeouts increased

2010-04-25 Thread Vipin KUMAR
SMI driver fails because of low timeout values. Increasing the erase and write
timeouts to 3 seconds

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 arch/arm/include/asm/arch-spear/spr_smi.h |6 +++---
 drivers/mtd/spr_smi.c |8 
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/arch-spear/spr_smi.h 
b/arch/arm/include/asm/arch-spear/spr_smi.h
index 06df745..e2e5e8f 100644
--- a/arch/arm/include/asm/arch-spear/spr_smi.h
+++ b/arch/arm/include/asm/arch-spear/spr_smi.h
@@ -108,8 +108,8 @@ struct flash_dev {
ushort sector_count;
 };
 
-#define SFLASH_PAGE_SIZE   0x100   /* flash page size */
-#define XFER_FINISH_TOUT   2   /* xfer finish timeout */
-#define WMODE_TOUT 2   /* write enable timeout */
+#define SFLASH_PAGE_SIZE   0x100   /* flash page size */
+#define XFER_FINISH_TOUT   (3 * CONFIG_SYS_HZ)
+#define WMODE_TOUT (3 * CONFIG_SYS_HZ)
 
 #endif
diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/spr_smi.c
index 9a70a19..189ee6d 100644
--- a/drivers/mtd/spr_smi.c
+++ b/drivers/mtd/spr_smi.c
@@ -60,11 +60,11 @@ static struct flash_dev flash_ids[] = {
  */
 static void smi_wait_xfer_finish(int timeout)
 {
-   while (timeout--) {
+   do {
if (readl(smicntl-smi_sr)  TFF)
break;
udelay(1000);
-   }
+   } while (timeout--);
 }
 
 /*
@@ -215,11 +215,11 @@ static int smi_write_enable(int bank)
/* Restore the CTRL REG1 state */
writel(ctrlreg1, smicntl-smi_cr1);
 
-   while (timeout--) {
+   do {
if (smi_read_sr(bank)  (1  (bank + WM_SHIFT)))
break;
udelay(1000);
-   }
+   } while (timeout--);
 
if (timeout)
return 0;
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 05/17] SPEAr : Reducing the max RAM size to 128MB

2010-04-25 Thread Vipin KUMAR
Signed-off-by: Vipin Kumar vipin.ku...@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 cc52e39..b526558 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -208,6 +208,6 @@
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS   1
 #define PHYS_SDRAM_1   0x
-#define PHYS_SDRAM_1_MAXSIZE   0x4000
+#define PHYS_SDRAM_1_MAXSIZE   0x0800
 
 #endif
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 06/17] SPEAr : Basic arch related support added for SPEAr SoCs

2010-04-25 Thread Vipin KUMAR
Adding CONFIG_DISPLAY_CPUINFO and CONFIG_ARCH_CPU_INIT support for SPEAr3xx and
SPEAr6xx SoCs

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 arch/arm/cpu/arm926ejs/spear/Makefile  |3 +-
 arch/arm/cpu/arm926ejs/spear/cpu.c |   76 
 arch/arm/include/asm/arch-spear/spr_misc.h |5 ++
 include/configs/spear-common.h |3 +-
 4 files changed, 85 insertions(+), 2 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 bf8dfa8..2814526 100644
--- a/arch/arm/cpu/arm926ejs/spear/Makefile
+++ b/arch/arm/cpu/arm926ejs/spear/Makefile
@@ -26,7 +26,8 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(SOC).a
 
 COBJS  := reset.o \
-  timer.o
+  timer.o \
+  cpu.o
 SOBJS  :=
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c 
b/arch/arm/cpu/arm926ejs/spear/cpu.c
new file mode 100644
index 000..e935fec
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/spear/cpu.c
@@ -0,0 +1,76 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, ST Micoelectronics, vipin.ku...@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_PL011_SERIAL)
+   periph1_clken |= MISC_UART0ENB;
+#endif
+#if defined(CONFIG_DW_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);
+#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..045d2bb 100644
--- a/arch/arm/include/asm/arch-spear/spr_misc.h
+++ b/arch/arm/include/asm/arch-spear/spr_misc.h
@@ -126,5 +126,10 @@ struct misc_regs {
 
 /* PERIPH1_CLKEN, PERIPH1_RST value */
 #define MISC_USBDENB   0x0100
+#define MISC_ETHENB0x0080
+#define MISC_SMIENB0x0020
+#define MISC_FSMCENB   0x0200
+#define MISC_I2CENB0x0080
+#define MISC_UART0ENB  0x0008
 
 #endif
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index b526558..68ba293 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -47,7 +47,6 @@
 
 /* Timer, HZ specific defines */
 #define CONFIG_SYS_HZ  (1000)
-#define CONFIG_SYS_HZ_CLOCK(830)
 
 /* Flash configuration */
 #if defined(CONFIG_FLASH_PNOR)
@@ -168,6 +167,8 @@
 #define CONFIG_ENV_SIZE0x02000
 
 /* Miscellaneous configurable options */
+#define CONFIG_ARCH_CPU_INIT   1
+#define CONFIG_DISPLAY_CPUINFO 1
 #define CONFIG_BOOT_PARAMS_ADDR0x0100
 #define CONFIG_CMDLINE_TAG 1
 #define CONFIG_SETUP_MEMORY_TAGS   1
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2010-04-25 Thread Vipin KUMAR
Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 arch/arm/include/asm/arch-spear/hardware.h |1 +
 board/spear/spear300/spear300.c|6 ++
 board/spear/spear310/spear310.c|6 ++
 board/spear/spear320/spear320.c|6 ++
 board/spear/spear600/spear600.c|6 ++
 include/configs/spear-common.h |   10 --
 include/configs/spear3xx.h |3 +++
 7 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-spear/hardware.h 
b/arch/arm/include/asm/arch-spear/hardware.h
index 818f36c..39d64b6 100644
--- a/arch/arm/include/asm/arch-spear/hardware.h
+++ b/arch/arm/include/asm/arch-spear/hardware.h
@@ -31,6 +31,7 @@
 #define CONFIG_SPEAR_SYSCNTLBASE   (0xFCA0)
 #define CONFIG_SPEAR_TIMERBASE (0xFC80)
 #define CONFIG_SPEAR_MISCBASE  (0xFCA8)
+#define CONFIG_SPEAR_ETHBASE   (0xE080)
 
 #define CONFIG_SYS_NAND_CLE(1  16)
 #define CONFIG_SYS_NAND_ALE(1  17)
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index 60ee544..cd24247 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -22,6 +22,7 @@
  */
 
 #include common.h
+#include netdev.h
 #include nand.h
 #include asm/io.h
 #include asm/arch/hardware.h
@@ -56,3 +57,8 @@ int board_nand_init(struct nand_chip *nand)
 
return -1;
 }
+
+int board_eth_init(bd_t *bis)
+{
+   return designware_initialize(0, CONFIG_SPEAR_ETHBASE);
+}
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index 03dfe16..e8a6552 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -23,6 +23,7 @@
  */
 
 #include common.h
+#include netdev.h
 #include nand.h
 #include asm/io.h
 #include asm/arch/hardware.h
@@ -57,3 +58,8 @@ int board_nand_init(struct nand_chip *nand)
 
return -1;
 }
+
+int board_eth_init(bd_t *bis)
+{
+   return dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+}
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index 2ba2dbb..72bc9a5 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -23,6 +23,7 @@
  */
 
 #include common.h
+#include netdev.h
 #include nand.h
 #include asm/io.h
 #include asm/arch/hardware.h
@@ -57,3 +58,8 @@ int board_nand_init(struct nand_chip *nand)
 
return -1;
 }
+
+int board_eth_init(bd_t *bis)
+{
+   return dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+}
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c
index eef9a37..6d921bd 100644
--- a/board/spear/spear600/spear600.c
+++ b/board/spear/spear600/spear600.c
@@ -22,6 +22,7 @@
  */
 
 #include common.h
+#include netdev.h
 #include nand.h
 #include asm/io.h
 #include asm/arch/hardware.h
@@ -51,3 +52,8 @@ int board_nand_init(struct nand_chip *nand)
 
return -1;
 }
+
+int board_eth_init(bd_t *bis)
+{
+   return designware_initialize(0, CONFIG_SPEAR_ETHBASE);
+}
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index 68ba293..ecb1fd1 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -27,6 +27,11 @@
  * Common configurations used for both spear3xx as well as spear6xx
  */
 
+/* Ethernet driver configuration */
+#define CONFIG_DESIGNWARE_ETH
+#define CONFIG_NET_MULTI
+#define CONFIG_PHY_RESET_DELAY (1) /* in usec */
+
 /* USBD driver configuration */
 #define CONFIG_SPEARUDC
 #define CONFIG_USB_DEVICE
@@ -98,11 +103,12 @@
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_RUN
 #define CONFIG_CMD_SAVES
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
 
 /* This must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include config_cmd_default.h
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
 
 /*
  * Default Environment Varible definitions
diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
index 0248aba..502c50f 100644
--- a/include/configs/spear3xx.h
+++ b/include/configs/spear3xx.h
@@ -41,6 +41,9 @@
 
 #include configs/spear-common.h
 
+/* Ethernet driver configuration */
+#define CONFIG_DW_ALTDESCRIPTOR1
+
 /* Serial Configuration (PL011) */
 #define CONFIG_SYS_SERIAL0 0xD000
 
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 04/17] SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET

2010-04-25 Thread Vipin KUMAR
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.ku...@st.com
---
 board/spear/common/spr_misc.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c
index e356912..4af9436 100644
--- a/board/spear/common/spr_misc.c
+++ b/board/spear/common/spr_misc.c
@@ -38,6 +38,10 @@
 DECLARE_GLOBAL_DATA_PTR;
 static struct chip_data chip_data;
 
+#if defined(CONFIG_CMD_NET)
+static int i2c_read_mac(uchar *buffer);
+#endif
+
 int dram_init(void)
 {
struct xloader_table *xloader_tb =
@@ -166,6 +170,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];
@@ -205,15 +210,20 @@ static int write_mac(uchar *mac)
puts(I2C EEPROM writing failed \n);
return -1;
 }
+#endif
 
 int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
void (*sram_setfreq) (unsigned int, unsigned int);
struct chip_data *chip = chip_data;
-   unsigned char mac[6];
-   unsigned int reg, frequency;
+   unsigned int frequency;
+
+#if defined(CONFIG_CMD_NET)
+   unsigned int reg;
char *s, *e;
char i2c_mac[20];
+   unsigned char mac[6];
+#endif
 
if ((argc  3) || (argc  2)) {
cmd_usage(cmdtp);
@@ -244,6 +254,8 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, 
char *argv[])
}
 
return 0;
+
+#if defined(CONFIG_CMD_NET)
} else if (!strcmp(argv[1], ethaddr)) {
 
s = argv[2];
@@ -255,6 +267,7 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, 
char *argv[])
write_mac(mac);
 
return 0;
+#endif
} else if (!strcmp(argv[1], print)) {
 
if (chip-cpufreq == -1)
@@ -274,13 +287,14 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, 
char *argv[])
else
printf(DDR Type= Not Known\n);
 
+#if defined(CONFIG_CMD_NET)
if (!i2c_read_mac(mac)) {
sprintf(i2c_mac, %pM, mac);
printf(Ethaddr (from i2c mem) = %s\n, i2c_mac);
} else {
printf(Ethaddr (from i2c mem) = Not set\n);
}
-
+#endif
printf(Xloader Rev = %s\n, chip-version);
 
return 0;
@@ -293,4 +307,7 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, 
char *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);
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 12/17] SPEAr : i2c driver moved completely into drivers/i2c

2010-04-25 Thread Vipin KUMAR
The i2c IP used by spear platform is a synopsys i2c controller
The earlier driver adds the driver of this controller as if it is specific to
spear platform.
The driver files are now moved into drivers/i2c folder for reusability by other
platforms

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 drivers/i2c/Makefile   |2 +-
 drivers/i2c/{spr_i2c.c = designware_i2c.c}|4 ++--
 .../spr_i2c.h = drivers/i2c/designware_i2c.h  |6 +++---
 include/configs/spear-common.h |2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
 rename drivers/i2c/{spr_i2c.c = designware_i2c.c} (98%)
 rename arch/arm/include/asm/arch-spear/spr_i2c.h = 
drivers/i2c/designware_i2c.h (98%)

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index d2c2515..099a6cd 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)libi2c.a
 
 COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
 COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+COBJS-$(CONFIG_DW_I2C) += designware_i2c.o
 COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
 COBJS-$(CONFIG_I2C_KIRKWOOD) += kirkwood_i2c.o
 COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
@@ -38,7 +39,6 @@ COBJS-$(CONFIG_PPC4XX_I2C) += ppc4xx_i2c.o
 COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o
 COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o
 COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o
-COBJS-$(CONFIG_SPEAR_I2C) += spr_i2c.o
 COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o
 
 COBJS  := $(COBJS-y)
diff --git a/drivers/i2c/spr_i2c.c b/drivers/i2c/designware_i2c.c
similarity index 98%
rename from drivers/i2c/spr_i2c.c
rename to drivers/i2c/designware_i2c.c
index eabfe84..d352146 100644
--- a/drivers/i2c/spr_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -24,7 +24,7 @@
 #include common.h
 #include asm/io.h
 #include asm/arch/hardware.h
-#include asm/arch/spr_i2c.h
+#include designware_i2c.h
 
 static struct i2c_regs *const i2c_regs_p =
 (struct i2c_regs *)CONFIG_SYS_I2C_BASE;
@@ -113,7 +113,7 @@ int i2c_get_bus_speed(void)
 /*
  * i2c_init - Init function
  * @speed: required i2c speed
- * @slaveadd:  slave address for the spear device
+ * @slaveadd:  slave address for the device
  *
  * Initialization function.
  */
diff --git a/arch/arm/include/asm/arch-spear/spr_i2c.h 
b/drivers/i2c/designware_i2c.h
similarity index 98%
rename from arch/arm/include/asm/arch-spear/spr_i2c.h
rename to drivers/i2c/designware_i2c.h
index 7521ebc..03b520e 100644
--- a/arch/arm/include/asm/arch-spear/spr_i2c.h
+++ b/drivers/i2c/designware_i2c.h
@@ -21,8 +21,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef __SPR_I2C_H_
-#define __SPR_I2C_H_
+#ifndef __DW_I2C_H_
+#define __DW_I2C_H_
 
 struct i2c_regs {
u32 ic_con;
@@ -143,4 +143,4 @@ struct i2c_regs {
 #define I2C_FAST_SPEED 40
 #define I2C_STANDARD_SPEED 10
 
-#endif /* __SPR_I2C_H_ */
+#endif /* __DW_I2C_H_ */
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index 3eaa086..e49f267 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -44,7 +44,7 @@
 
 /* I2C driver configuration */
 #define CONFIG_HARD_I2C
-#define CONFIG_SPEAR_I2C
+#define CONFIG_DW_I2C
 #define CONFIG_SYS_I2C_SPEED   40
 #define CONFIG_SYS_I2C_SLAVE   0x02
 
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 00/17] Network support for spear platform and spear1300 support

2010-04-25 Thread Vipin KUMAR
Hi,
The following subpatches incorporate review comments given on patch-set v1.
Please consider it for inclusion in mainline

Thanks and Regards
Vipin

Vipin Kumar (17):
  u-boot.img file not created when srctree and objtree are different
  change_bit routine defined
  SPEAr : SMI erase and write timeouts increased
  SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET
  SPEAr : Reducing the max RAM size to 128MB
  SPEAr : Basic arch related support added for SPEAr SoCs
  SPEAr : Network driver support added
  SPEAr : Network support configured for spear SoCs
  SPEAr : macb driver support added for spear310 and spear320
  SPEAr : FSMC driver support added
  SPEAr : Configuring FSMC driver for NAND interface
  SPEAr : i2c driver moved completely into drivers/i2c
  SPEAr : smi driver moved completely into drivers/mtd
  SPEAr : USBD driver support added
  SPEAr : Basic spear1300 architecture support added
  SPEAr : spear1300 SoC support added
  SPEAr : Supporting various configurations for spear3xx and spear6xx
boards

 Makefile   |   24 +-
 arch/arm/cpu/arm926ejs/spear/Makefile  |3 +-
 arch/arm/cpu/arm926ejs/spear/cpu.c |   76 +++
 arch/arm/cpu/arm_cortexa8/spear13xx/Makefile   |   52 ++
 arch/arm/cpu/arm_cortexa8/spear13xx/cache.S|  112 
 arch/arm/cpu/arm_cortexa8/spear13xx/cpu.c  |   99 
 .../arm_cortexa8/spear13xx/reset.c}|   50 +--
 arch/arm/cpu/arm_cortexa8/spear13xx/timer.c|  136 +
 arch/arm/include/asm/arch-spear/clk.h  |   27 +
 arch/arm/include/asm/arch-spear/hardware.h |   16 +-
 arch/arm/include/asm/arch-spear/spr_misc.h |5 +
 arch/arm/include/asm/arch-spear13xx/hardware.h |   40 ++
 arch/arm/include/asm/arch-spear13xx/spr_gpt.h  |   85 +++
 arch/arm/include/asm/arch-spear13xx/spr_misc.h |  317 
 arch/arm/include/asm/arch-spear13xx/sys_proto.h|   32 ++
 arch/arm/include/asm/bitops.h  |   11 +-
 board/spear/common/Makefile|   10 +-
 board/spear/common/spr_misc.c  |   23 +-
 board/spear/spear1300/Makefile |   51 ++
 board/spear/spear1300/config.mk|   28 +
 board/spear/spear1300/spear1300.c  |   86 
 .../spear/spear1300/spr_lowlevel_init.S|   49 +--
 board/spear/spear300/config.mk |   11 -
 board/spear/spear300/spear300.c|   10 +-
 board/spear/spear310/config.mk |   11 -
 board/spear/spear310/spear310.c|   17 +-
 board/spear/spear320/config.mk |   11 -
 board/spear/spear320/spear320.c|   14 +-
 board/spear/spear600/config.mk |   11 -
 board/spear/spear600/spear600.c|   10 +-
 drivers/i2c/Makefile   |2 +-
 drivers/i2c/{spr_i2c.c = designware_i2c.c}|4 +-
 .../spr_i2c.h = drivers/i2c/designware_i2c.h  |6 +-
 drivers/mtd/Makefile   |2 +-
 drivers/mtd/nand/Makefile  |2 +-
 drivers/mtd/nand/fsmc_nand.c   |  365 +
 drivers/mtd/nand/spr_nand.c|  124 -
 drivers/mtd/{spr_smi.c = st_smi.c}|   10 +-
 .../arch-spear/spr_smi.h = drivers/mtd/st_smi.h   |   10 +-
 drivers/net/Makefile   |1 +
 drivers/net/designware.c   |  537 
 drivers/net/designware.h   |  264 ++
 drivers/serial/usbtty.h|4 +-
 drivers/usb/gadget/Makefile|2 +-
 drivers/usb/gadget/{spr_udc.c = designware_udc.c} |  116 +++--
 include/configs/spear-common.h |   27 +-
 include/configs/spear13xx.h|  199 
 include/configs/spear3xx.h |   30 ++
 include/configs/spear6xx.h |   13 +
 include/linux/mtd/fsmc_nand.h  |  104 
 include/netdev.h   |1 +
 include/usb/{spr_udc.h = designware_udc.h}|8 +-
 52 files changed, 2918 insertions(+), 340 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/spear/cpu.c
 create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/Makefile
 create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/cache.S
 create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/cpu.c
 copy arch/arm/{include/asm/arch-spear/spr_nand.h = 
cpu/arm_cortexa8/spear13xx/reset.c} (51%)
 mode change 100644 = 100755
 create mode 100644 arch/arm/cpu/arm_cortexa8/spear13xx/timer.c
 create mode 100644 arch/arm/include/asm/arch-spear/clk.h
 create mode 100644 arch/arm/include/asm/arch-spear13xx/hardware.h
 create mode 100644 

[U-Boot] [PATCH v2 16/17] SPEAr : spear1300 SoC support added

2010-04-25 Thread Vipin KUMAR
SPEAr1300 SoC support contains basic spear1300 support along with the
usage of following drivers
- serial driver(UART)
- i2c driver
- smi driver
- nand driver(FSMC)
- usbd driver

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 Makefile   |6 +
 arch/arm/include/asm/arch-spear13xx/hardware.h |8 +-
 board/spear/common/Makefile|   10 +-
 board/spear/spear1300/Makefile |   51 ++
 board/spear/spear1300/config.mk|   28 
 board/spear/spear1300/spear1300.c  |   86 ++
 board/spear/spear1300/spr_lowlevel_init.S  |   38 +
 include/configs/spear13xx.h|  199 
 8 files changed, 420 insertions(+), 6 deletions(-)
 create mode 100644 board/spear/spear1300/Makefile
 create mode 100644 board/spear/spear1300/config.mk
 create mode 100644 board/spear/spear1300/spear1300.c
 create mode 100644 board/spear/spear1300/spr_lowlevel_init.S
 create mode 100644 include/configs/spear13xx.h

diff --git a/Makefile b/Makefile
index 7bfdfd3..0b6a151 100644
--- a/Makefile
+++ b/Makefile
@@ -3041,6 +3041,12 @@ spear320_config :unconfig
 spear600_config :  unconfig
@$(MKCONFIG) -n $@ -t $(@:_config=) spear6xx arm arm926ejs 
$(@:_config=) spear spear
 
+spear1300_config \
+spear1300_nand_config \
+spear1300_usbtty_config \
+spear1300_usbtty_nand_config : unconfig
+   @$(MKCONFIG) -n $@ -t $(@:_config=) spear13xx arm arm_cortexa8 
spear1300 spear spear13xx
+
 suen3_config:  unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs km_arm keymile kirkwood
 
diff --git a/arch/arm/include/asm/arch-spear13xx/hardware.h 
b/arch/arm/include/asm/arch-spear13xx/hardware.h
index 384260a..7a1cedb 100644
--- a/arch/arm/include/asm/arch-spear13xx/hardware.h
+++ b/arch/arm/include/asm/arch-spear13xx/hardware.h
@@ -24,10 +24,10 @@
 #ifndef _ASM_ARCH_HARDWARE_H
 #define _ASM_ARCH_HARDWARE_H
 
-#define CONFIG_SYS_USBD_BASE   (0xE110)
-#define CONFIG_SYS_PLUG_BASE   (0xE120)
-#define CONFIG_SYS_FIFO_BASE   (0xE1000800)
-#define CONFIG_SYS_SMI_BASE(0xFC00)
+#define CONFIG_SYS_USBD_BASE   (0xE380)
+#define CONFIG_SYS_PLUG_BASE   (0xE280)
+#define CONFIG_SYS_FIFO_BASE   (0xE3000800)
+#define CONFIG_SYS_SMI_BASE(0xEA00)
 #define CONFIG_SPEAR_TIMERBASE (0xE038)
 #define CONFIG_SPEAR_MISCBASE  (0xE070)
 #define CONFIG_SYS_I2C_BASE(0xE028)
diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile
index 4f8959f..1ae4fd4 100644
--- a/board/spear/common/Makefile
+++ b/board/spear/common/Makefile
@@ -29,8 +29,14 @@ endif
 
 LIB= $(obj)lib$(VENDOR).a
 
-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  := $(COBJS-y)
+SOBJS  := $(SOBJS-y)
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/spear/spear1300/Makefile b/board/spear/spear1300/Makefile
new file mode 100644
index 000..fb66895
--- /dev/null
+++ b/board/spear/spear1300/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := spear1300.o
+SOBJS  := spr_lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+

[U-Boot] [PATCH v2 10/17] SPEAr : FSMC driver support added

2010-04-25 Thread Vipin KUMAR
Flexible static memory controller is an IP which controls the access
to NAND chips along with many other memory device chips eg NOR, SRAM.
This is an ST peripheral. This patch adds the driver support for FSMC
controller interfacing with NAND memory.

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 drivers/mtd/nand/Makefile |1 +
 drivers/mtd/nand/fsmc_nand.c  |  365 +
 include/linux/mtd/fsmc_nand.h |  104 
 3 files changed, 470 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/fsmc_nand.c
 create mode 100644 include/linux/mtd/fsmc_nand.h

diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 28f27da..4c6b54f 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -38,6 +38,7 @@ COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
+COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o
 COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 COBJS-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
new file mode 100644
index 000..bad5606
--- /dev/null
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -0,0 +1,365 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, ST Micoelectronics, vipin.ku...@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 nand.h
+#include asm/io.h
+#include linux/bitops.h
+#include linux/err.h
+#include linux/mtd/nand_ecc.h
+#include linux/mtd/fsmc_nand.h
+#include asm/arch/hardware.h
+
+static u32 fsmc_version;
+static struct fsmc_regs *const fsmc_regs_p =
+(struct fsmc_regs *)CONFIG_SYS_FSMC_BASE;
+
+/*
+ * ECC4 and ECC1 have 13 bytes and 3 bytes of ecc respectively for 512 bytes of
+ * data. ECC4 can correct upto 8 bits in 512 bytes of data while ECC1 can
+ * correct 1 bit in 512 bytes
+ */
+
+#if defined(CONFIG_SYS_FSMC_NAND_LP)
+static struct nand_ecclayout fsmc_ecc4_layout = {
+   .eccbytes = 104,
+   .eccpos = {  2,   3,   4,   5,   6,   7,   8,
+   9,  10,  11,  12,  13,  14,
+   18,  19,  20,  21,  22,  23,  24,
+   25,  26,  27,  28,  29,  30,
+   34,  35,  36,  37,  38,  39,  40,
+   41,  42,  43,  44,  45,  46,
+   50,  51,  52,  53,  54,  55,  56,
+   57,  58,  59,  60,  61,  62,
+   66,  67,  68,  69,  70,  71,  72,
+   73,  74,  75,  76,  77,  78,
+   82,  83,  84,  85,  86,  87,  88,
+   89,  90,  91,  92,  93,  94,
+   98,  99, 100, 101, 102, 103, 104,
+   105, 106, 107, 108, 109, 110,
+   114, 115, 116, 117, 118, 119, 120,
+   121, 122, 123, 124, 125, 126
+   },
+   .oobfree = {
+   {.offset = 15, .length = 3},
+   {.offset = 31, .length = 3},
+   {.offset = 47, .length = 3},
+   {.offset = 63, .length = 3},
+   {.offset = 79, .length = 3},
+   {.offset = 95, .length = 3},
+   {.offset = 111, .length = 3},
+   {.offset = 127, .length = 1}
+   }
+};
+
+/*
+ * ECC placement definitions in oobfree type format
+ * There are 13 bytes of ecc for every 512 byte block and it has to be read
+ * consicutively and immidiately after the 512 byte data block for hardware to
+ * generate the error bit offsets in 512 byte data
+ * Managing the ecc bytes in the following way makes it easier for software to
+ * read ecc bytes consicutive to data bytes. This way is similar to
+ * oobfree structure maintained already in u-boot nand driver
+ */
+static struct fsmc_eccplace fsmc_eccpl = {
+   .eccplace = {
+   {.offset = 2, .length = 13},
+   {.offset = 18, .length = 13},
+   {.offset = 34, .length = 13},
+   {.offset = 50, .length = 13},
+   {.offset = 66, .length = 13},
+   {.offset = 82, .length = 13},
+   {.offset = 98, .length = 13},
+   {.offset = 114, .length = 13}
+   }

[U-Boot] [PATCH v2 13/17] SPEAr : smi driver moved completely into drivers/mtd

2010-04-25 Thread Vipin KUMAR
The smi IP used by spear platform is a ST serial memory interface controller
The earlier driver adds the driver of this controller as if it is specific to
spear platform.
The driver files are now moved into drivers/mtd folder for reusability by other
platforms

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 drivers/mtd/Makefile   |2 +-
 drivers/mtd/{spr_smi.c = st_smi.c}|2 +-
 .../arch-spear/spr_smi.h = drivers/mtd/st_smi.h   |4 ++--
 include/configs/spear-common.h |6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)
 rename drivers/mtd/{spr_smi.c = st_smi.c} (99%)
 rename arch/arm/include/asm/arch-spear/spr_smi.h = drivers/mtd/st_smi.h (99%)

diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index cbf6f15..d868d27 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -34,7 +34,7 @@ COBJS-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
 COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
-COBJS-$(CONFIG_SPEARSMI) += spr_smi.o
+COBJS-$(CONFIG_ST_SMI) += st_smi.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/st_smi.c
similarity index 99%
rename from drivers/mtd/spr_smi.c
rename to drivers/mtd/st_smi.c
index 189ee6d..80d9fee 100644
--- a/drivers/mtd/spr_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -27,7 +27,7 @@
 
 #include asm/io.h
 #include asm/arch/hardware.h
-#include asm/arch/spr_smi.h
+#include st_smi.h
 
 #if !defined(CONFIG_SYS_NO_FLASH)
 
diff --git a/arch/arm/include/asm/arch-spear/spr_smi.h b/drivers/mtd/st_smi.h
similarity index 99%
rename from arch/arm/include/asm/arch-spear/spr_smi.h
rename to drivers/mtd/st_smi.h
index e2e5e8f..37ed503 100644
--- a/arch/arm/include/asm/arch-spear/spr_smi.h
+++ b/drivers/mtd/st_smi.h
@@ -21,8 +21,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef SPR_SMI_H
-#define SPR_SMI_H
+#ifndef ST_SMI_H
+#define ST_SMI_H
 
 /* 0xF800. . 0xFBFF.   64MBSMI (Serial Flash Mem) */
 /* 0xFC00. . 0xFC1F.   2MB SMI (Serial Flash Reg.) */
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index e49f267..99923de 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -57,10 +57,10 @@
 #if defined(CONFIG_FLASH_PNOR)
 #define CONFIG_SPEAR_EMI   1
 #else
-#define CONFIG_SPEARSMI1
+#define CONFIG_ST_SMI  1
 #endif
 
-#if defined(CONFIG_SPEARSMI)
+#if defined(CONFIG_ST_SMI)
 
 #define CONFIG_SYS_MAX_FLASH_BANKS 2
 #define CONFIG_SYS_FLASH_BASE  (0xF800)
@@ -125,7 +125,7 @@
  * U-Boot Environment placing definitions.
  */
 #if defined(CONFIG_ENV_IS_IN_FLASH)
-#ifdef CONFIG_SPEARSMI
+#ifdef CONFIG_ST_SMI
 /*
  * Environment is in serial NOR flash
  */
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 11/17] SPEAr : Configuring FSMC driver for NAND interface

2010-04-25 Thread Vipin KUMAR
Since FSMC is a standard IP and it supports different memory interfaces the FSMC
is supported independent of spear platform and spear is configured to use that
driver for interfacing with the NAND device

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 arch/arm/include/asm/arch-spear/hardware.h |8 +-
 arch/arm/include/asm/arch-spear/spr_nand.h |   57 -
 board/spear/spear300/spear300.c|4 +-
 board/spear/spear310/spear310.c|4 +-
 board/spear/spear320/spear320.c|4 +-
 board/spear/spear600/spear600.c|4 +-
 drivers/mtd/nand/Makefile  |1 -
 drivers/mtd/nand/spr_nand.c|  124 
 include/configs/spear-common.h |2 +-
 include/configs/spear3xx.h |4 +
 include/configs/spear6xx.h |3 +
 11 files changed, 20 insertions(+), 195 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-spear/spr_nand.h
 delete mode 100644 drivers/mtd/nand/spr_nand.c

diff --git a/arch/arm/include/asm/arch-spear/hardware.h 
b/arch/arm/include/asm/arch-spear/hardware.h
index 9f1e154..52037b6 100644
--- a/arch/arm/include/asm/arch-spear/hardware.h
+++ b/arch/arm/include/asm/arch-spear/hardware.h
@@ -38,15 +38,15 @@
 
 #if defined(CONFIG_SPEAR600)
 #define CONFIG_SYS_I2C_BASE(0xD020)
-#define CONFIG_SPEAR_FSMCBASE  (0xD180)
+#define CONFIG_SYS_FSMC_BASE   (0xD180)
 
 #elif defined(CONFIG_SPEAR300)
 #define CONFIG_SYS_I2C_BASE(0xD018)
-#define CONFIG_SPEAR_FSMCBASE  (0x9400)
+#define CONFIG_SYS_FSMC_BASE   (0x9400)
 
 #elif defined(CONFIG_SPEAR310)
 #define CONFIG_SYS_I2C_BASE(0xD018)
-#define CONFIG_SPEAR_FSMCBASE  (0x4400)
+#define CONFIG_SYS_FSMC_BASE   (0x4400)
 
 #undef CONFIG_SYS_NAND_CLE
 #undef CONFIG_SYS_NAND_ALE
@@ -63,7 +63,7 @@
 
 #elif defined(CONFIG_SPEAR320)
 #define CONFIG_SYS_I2C_BASE(0xD018)
-#define CONFIG_SPEAR_FSMCBASE  (0x4C00)
+#define CONFIG_SYS_FSMC_BASE   (0x4C00)
 
 #define CONFIG_SPEAR_EMIBASE   (0x4000)
 #define CONFIG_SPEAR_RASBASE   (0xB300)
diff --git a/arch/arm/include/asm/arch-spear/spr_nand.h 
b/arch/arm/include/asm/arch-spear/spr_nand.h
deleted file mode 100644
index 2b63dc7..000
--- a/arch/arm/include/asm/arch-spear/spr_nand.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Micoelectronics, vipin.ku...@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_NAND_H__
-#define __SPR_NAND_H__
-
-struct fsmc_regs {
-   u32 reserved_1[0x10];
-   u32 genmemctrl_pc;
-   u32 reserved_2;
-   u32 genmemctrl_comm;
-   u32 genmemctrl_attrib;
-   u32 reserved_3;
-   u32 genmemctrl_ecc;
-};
-
-/* genmemctrl_pc register definitions */
-#define FSMC_RESET (1  0)
-#define FSMC_WAITON(1  1)
-#define FSMC_ENABLE(1  2)
-#define FSMC_DEVTYPE_NAND  (1  3)
-#define FSMC_DEVWID_8  (0  4)
-#define FSMC_DEVWID_16 (1  4)
-#define FSMC_ECCEN (1  6)
-#define FSMC_ECCPLEN_512   (0  7)
-#define FSMC_ECCPLEN_256   (1  7)
-#define FSMC_TCLR_1(1  9)
-#define FSMC_TAR_1 (1  13)
-
-/* genmemctrl_comm register definitions */
-#define FSMC_TSET_0(0  0)
-#define FSMC_TWAIT_6   (6  8)
-#define FSMC_THOLD_4   (4  16)
-#define FSMC_THIZ_1(1  24)
-
-extern int spear_nand_init(struct nand_chip *nand);
-#endif
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index cd24247..bb98161 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -25,10 +25,10 @@
 #include netdev.h
 #include nand.h
 #include asm/io.h
+#include linux/mtd/fsmc_nand.h
 #include asm/arch/hardware.h
 #include asm/arch/spr_defs.h
 #include asm/arch/spr_misc.h
-#include asm/arch/spr_nand.h
 
 int board_init(void)
 {
@@ -52,7 +52,7 @@ int board_nand_init(struct 

[U-Boot] [PATCH v2 02/17] change_bit routine defined

2010-04-25 Thread Vipin KUMAR
change_bit routine is left implementation dependent until now.
This routine is now defined for arm platforms in asm-arm/bitops.h

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 arch/arm/include/asm/bitops.h |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 270f163..435857b 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -29,8 +29,6 @@ extern void set_bit(int nr, volatile void * addr);
 
 extern void clear_bit(int nr, volatile void * addr);
 
-extern void change_bit(int nr, volatile void * addr);
-
 static inline void __change_bit(int nr, volatile void *addr)
 {
unsigned long mask = BIT_MASK(nr);
@@ -39,6 +37,15 @@ static inline void __change_bit(int nr, volatile void *addr)
*p ^= mask;
 }
 
+static inline void change_bit(int nr, volatile void *addr)
+{
+   unsigned long flags;
+
+   local_irq_save(flags);
+   __change_bit(nr, addr);
+   local_irq_restore(flags);
+}
+
 static inline int __test_and_set_bit(int nr, volatile void *addr)
 {
unsigned long mask = BIT_MASK(nr);
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 01/17] u-boot.img file not created when srctree and objtree are different

2010-04-25 Thread Vipin KUMAR
Adding ($obj) before tools/mkimage for u-boot.img file creation

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 34f10ce..7bfdfd3 100644
--- a/Makefile
+++ b/Makefile
@@ -313,7 +313,7 @@ $(obj)u-boot.ldr.srec:  $(obj)u-boot.ldr
$(OBJCOPY) ${OBJCFLAGS} -O srec $ $@ -I binary
 
 $(obj)u-boot.img:  $(obj)u-boot.bin
-   ./tools/mkimage -A $(ARCH) -T firmware -C none \
+   $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
-a $(TEXT_BASE) -e 0 \
-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
sed -e 's/[ ]*$$/ for $(BOARD) board/') \
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 14/17] SPEAr : USBD driver support added

2010-04-25 Thread Vipin KUMAR
USBD is a Synopsys IP. The earlier driver implements itself as specific to spear
SoCs. This patch implements this driver as a reusable driver for other platforms
as well.

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 drivers/serial/usbtty.h|4 +-
 drivers/usb/gadget/Makefile|2 +-
 drivers/usb/gadget/{spr_udc.c = designware_udc.c} |  116 +++-
 include/configs/spear-common.h |2 +-
 include/usb/{spr_udc.h = designware_udc.h}|8 +-
 5 files changed, 74 insertions(+), 58 deletions(-)
 rename drivers/usb/gadget/{spr_udc.c = designware_udc.c} (91%)
 rename include/usb/{spr_udc.h = designware_udc.h} (98%)

diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
index a23169a..38b407f 100644
--- a/drivers/serial/usbtty.h
+++ b/drivers/serial/usbtty.h
@@ -33,8 +33,8 @@
 #include usb/musb_udc.h
 #elif defined(CONFIG_PXA27X)
 #include usb/pxa27x_udc.h
-#elif defined(CONFIG_SPEAR3XX) || defined(CONFIG_SPEAR600)
-#include usb/spr_udc.h
+#elif defined(CONFIG_DW_UDC)
+#include usb/designware_udc.h
 #endif
 
 #include version_autogenerated.h
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 1d7362d..3820f36 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -28,11 +28,11 @@ LIB := $(obj)libusb_gadget.a
 ifdef CONFIG_USB_DEVICE
 COBJS-y += core.o
 COBJS-y += ep0.o
+COBJS-$(CONFIG_DW_UDC) += designware_udc.o
 COBJS-$(CONFIG_OMAP1510) += omap1510_udc.o
 COBJS-$(CONFIG_OMAP1610) += omap1510_udc.o
 COBJS-$(CONFIG_MPC885_FAMILY) += mpc8xx_udc.o
 COBJS-$(CONFIG_PXA27X) += pxa27x_udc.o
-COBJS-$(CONFIG_SPEARUDC) += spr_udc.o
 endif
 
 COBJS  := $(COBJS-y)
diff --git a/drivers/usb/gadget/spr_udc.c b/drivers/usb/gadget/designware_udc.c
similarity index 91%
rename from drivers/usb/gadget/spr_udc.c
rename to drivers/usb/gadget/designware_udc.c
index f2b06d6..e550426 100644
--- a/drivers/usb/gadget/spr_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -29,14 +29,13 @@
 
 #include usbdevice.h
 #include ep0.h
-#include usb/spr_udc.h
+#include usb/designware_udc.h
 #include asm/arch/hardware.h
-#include asm/arch/spr_misc.h
 
 #define UDC_INIT_MDELAY80  /* Device settle delay */
 
 /* Some kind of debugging output... */
-#ifndef DEBUG_SPRUSBTTY
+#ifndef DEBUG_DWUSBTTY
 #define UDCDBG(str)
 #define UDCDBGA(fmt, args...)
 #else
@@ -251,7 +250,7 @@ static void usbputpcktofifo(int epNum, u8 *bufp, u32 len)
 }
 
 /*
- * spear_write_noniso_tx_fifo - Write the next packet to TxFIFO.
+ * dw_write_noniso_tx_fifo - Write the next packet to TxFIFO.
  * @endpoint:  Endpoint pointer.
  *
  * If the endpoint has an active tx_urb, then the next packet of data from the
@@ -263,7 +262,7 @@ static void usbputpcktofifo(int epNum, u8 *bufp, u32 len)
  * transmitted in this packet.
  *
  */
-static void spear_write_noniso_tx_fifo(struct usb_endpoint_instance
+static void dw_write_noniso_tx_fifo(struct usb_endpoint_instance
   *endpoint)
 {
struct urb *urb = endpoint-tx_urb;
@@ -307,7 +306,7 @@ static void spear_write_noniso_tx_fifo(struct 
usb_endpoint_instance
  * Handle SETUP USB interrupt.
  * This function implements TRM Figure 14-14.
  */
-static void spear_udc_setup(struct usb_endpoint_instance *endpoint)
+static void dw_udc_setup(struct usb_endpoint_instance *endpoint)
 {
u8 *datap = (u8 *)ep0_urb-device_request;
int ep_addr = endpoint-endpoint_address;
@@ -344,11 +343,11 @@ static void spear_udc_setup(struct usb_endpoint_instance 
*endpoint)
endpoint-tx_urb = ep0_urb;
endpoint-sent = 0;
/*
-* Write packet data to the FIFO.  spear_write_noniso_tx_fifo
+* Write packet data to the FIFO.  dw_write_noniso_tx_fifo
 * will update endpoint-last with the number of bytes written
 * to the FIFO.
 */
-   spear_write_noniso_tx_fifo(endpoint);
+   dw_write_noniso_tx_fifo(endpoint);
 
writel(0x0, inep_regs_p[ep_addr].write_done);
}
@@ -361,7 +360,7 @@ static void spear_udc_setup(struct usb_endpoint_instance 
*endpoint)
 /*
  * Handle endpoint 0 RX interrupt
  */
-static void spear_udc_ep0_rx(struct usb_endpoint_instance *endpoint)
+static void dw_udc_ep0_rx(struct usb_endpoint_instance *endpoint)
 {
u8 dummy[64];
 
@@ -395,7 +394,7 @@ static void spear_udc_ep0_rx(struct usb_endpoint_instance 
*endpoint)
 /*
  * Handle endpoint 0 TX interrupt
  */
-static void spear_udc_ep0_tx(struct usb_endpoint_instance *endpoint)
+static void dw_udc_ep0_tx(struct usb_endpoint_instance *endpoint)
 {
struct usb_device_request *request = ep0_urb-device_request;
int ep_addr;
@@ -444,7 +443,7 @@ static void spear_udc_ep0_tx(struct usb_endpoint_instance 
*endpoint)
 * need a zero-length terminating packet.
 

[U-Boot] [PATCH v2 17/17] SPEAr : Supporting various configurations for spear3xx and spear6xx boards

2010-04-25 Thread Vipin KUMAR
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

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 Makefile   |   16 ++--
 board/spear/spear300/config.mk |   11 ---
 board/spear/spear310/config.mk |   11 ---
 board/spear/spear320/config.mk |   11 ---
 board/spear/spear600/config.mk |   11 ---
 include/configs/spear3xx.h |   10 ++
 include/configs/spear6xx.h |   10 ++
 7 files changed, 34 insertions(+), 46 deletions(-)

diff --git a/Makefile b/Makefile
index 0b6a151..4cc9913 100644
--- a/Makefile
+++ b/Makefile
@@ -3034,11 +3034,23 @@ smdk2410_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0
 
 spear300_config \
+spear300_nand_config \
+spear300_usbtty_config \
+spear300_usbtty_nand_config \
 spear310_config \
-spear320_config :  unconfig
+spear310_nand_config \
+spear310_usbtty_config \
+spear310_usbtty_nand_config \
+spear320_config \
+spear320_nand_config \
+spear320_usbtty_config \
+spear320_usbtty_nand_config :  unconfig
@$(MKCONFIG) -n $@ -t $(@:_config=) spear3xx arm arm926ejs 
$(@:_config=) spear spear
 
-spear600_config :  unconfig
+spear600_config \
+spear600_nand_config \
+spear600_usbtty_config \
+spear600_usbtty_nand_config :  unconfig
@$(MKCONFIG) -n $@ -t $(@:_config=) spear6xx arm arm926ejs 
$(@:_config=) spear spear
 
 spear1300_config \
diff --git a/board/spear/spear300/config.mk b/board/spear/spear300/config.mk
index 35646f2..0bbb40f 100644
--- a/board/spear/spear300/config.mk
+++ b/board/spear/spear300/config.mk
@@ -26,14 +26,3 @@
 TEXT_BASE = 0x0070
 
 ALL += $(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
diff --git a/board/spear/spear310/config.mk b/board/spear/spear310/config.mk
index cba8436..c8264c3 100644
--- a/board/spear/spear310/config.mk
+++ b/board/spear/spear310/config.mk
@@ -27,18 +27,7 @@ TEXT_BASE = 0x0070
 
 ALL += $(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 cba8436..c8264c3 100644
--- a/board/spear/spear320/config.mk
+++ b/board/spear/spear320/config.mk
@@ -27,18 +27,7 @@ TEXT_BASE = 0x0070
 
 ALL += $(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 35646f2..0bbb40f 100644
--- a/board/spear/spear600/config.mk
+++ b/board/spear/spear600/config.mk
@@ -26,14 +26,3 @@
 TEXT_BASE = 0x0070
 
 ALL += $(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
diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
index fde505c..f0c915e 100644
--- a/include/configs/spear3xx.h
+++ b/include/configs/spear3xx.h
@@ -39,6 +39,16 @@
 #define CONFIG_SPEAR3201
 #endif
 
+#if defined(CONFIG_MK_usbtty)
+#define CONFIG_SPEAR_USBTTY1
+#endif
+
+#if defined(CONFIG_MK_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.h
index 2532344..82d24df 100644
--- a/include/configs/spear6xx.h
+++ b/include/configs/spear6xx.h
@@ -30,6 +30,16 @@
  */
 #define CONFIG_SPEAR6001
 
+#if defined(CONFIG_MK_usbtty)
+#define CONFIG_SPEAR_USBTTY1
+#endif
+
+#if defined(CONFIG_MK_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) */
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/17] SPEAr : macb driver support added for spear310 and spear320

2010-04-25 Thread Vipin KUMAR
Signed-off-by: Vipin Kumar vipin.ku...@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|9 -
 board/spear/spear320/spear320.c|6 +-
 include/configs/spear3xx.h |   13 +
 5 files changed, 60 insertions(+), 2 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 000..343c6ce
--- /dev/null
+++ b/arch/arm/include/asm/arch-spear/clk.h
@@ -0,0 +1,27 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, STMicroelectronics, vipin.ku...@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 8300;
+}
diff --git a/arch/arm/include/asm/arch-spear/hardware.h 
b/arch/arm/include/asm/arch-spear/hardware.h
index 39d64b6..9f1e154 100644
--- a/arch/arm/include/asm/arch-spear/hardware.h
+++ b/arch/arm/include/asm/arch-spear/hardware.h
@@ -56,6 +56,11 @@
 #define CONFIG_SPEAR_EMIBASE   (0x4F00)
 #define CONFIG_SPEAR_RASBASE   (0xB400)
 
+#define CONFIG_SYS_MACB0_BASE  (0xB000)
+#define CONFIG_SYS_MACB1_BASE  (0xB080)
+#define CONFIG_SYS_MACB2_BASE  (0xB100)
+#define CONFIG_SYS_MACB3_BASE  (0xB180)
+
 #elif defined(CONFIG_SPEAR320)
 #define CONFIG_SYS_I2C_BASE(0xD018)
 #define CONFIG_SPEAR_FSMCBASE  (0x4C00)
@@ -63,5 +68,7 @@
 #define CONFIG_SPEAR_EMIBASE   (0x4000)
 #define CONFIG_SPEAR_RASBASE   (0xB300)
 
+#define CONFIG_SYS_MACB0_BASE  (0xAA00)
+
 #endif
 #endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index e8a6552..1207709 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -61,5 +61,12 @@ int board_nand_init(struct nand_chip *nand)
 
 int board_eth_init(bd_t *bis)
 {
-   return dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+   dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+
+   macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, CONFIG_MACB0_PHY);
+   macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE, CONFIG_MACB1_PHY);
+   macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE, CONFIG_MACB2_PHY);
+   macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE, CONFIG_MACB3_PHY);
+
+   return 0;
 }
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index 72bc9a5..efc9a99 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -61,5 +61,9 @@ int board_nand_init(struct nand_chip *nand)
 
 int board_eth_init(bd_t *bis)
 {
-   return dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+   dw_mii_initialize(0, CONFIG_SPEAR_ETHBASE);
+
+   macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, CONFIG_MACB0_PHY);
+
+   return 0;
 }
diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
index 502c50f..689d914 100644
--- a/include/configs/spear3xx.h
+++ b/include/configs/spear3xx.h
@@ -44,6 +44,19 @@
 /* Ethernet driver configuration */
 #define CONFIG_DW_ALTDESCRIPTOR1
 
+#if defined(CONFIG_SPEAR310)
+#define CONFIG_MACB1
+#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_MACB1
+#define CONFIG_MACB0_PHY   0x01
+
+#endif
+
 /* Serial Configuration (PL011) */
 #define CONFIG_SYS_SERIAL0 0xD000
 
-- 
1.6.0.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/17] SPEAr : Network driver support added

2010-04-25 Thread Vipin KUMAR
Designware network driver support added.
This is a Synopsys ethernet controller

Signed-off-by: Vipin Kumar vipin.ku...@st.com
---
 drivers/net/Makefile |1 +
 drivers/net/designware.c |  537 ++
 drivers/net/designware.h |  264 +++
 include/netdev.h |1 +
 4 files changed, 803 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/designware.c
 create mode 100644 drivers/net/designware.h

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 1ec0ba1..82df908 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 
5701rls.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
 COBJS-$(CONFIG_CS8900) += cs8900.o
 COBJS-$(CONFIG_TULIP) += dc2114x.o
+COBJS-$(CONFIG_DESIGNWARE_ETH) += designware.o
 COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
new file mode 100644
index 000..9361f77
--- /dev/null
+++ b/drivers/net/designware.c
@@ -0,0 +1,537 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, ST Micoelectronics, vipin.ku...@st.com.
+ *
+ * (C) Copyright 2008
+ * Deepak Sikri, ST Micoelectronics, deepak.si...@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
+ */
+
+/*
+ * Designware ethernet IP driver for u-boot
+ */
+
+#include common.h
+#include miiphy.h
+#include malloc.h
+#include linux/err.h
+#include asm/io.h
+#include designware.h
+
+static void tx_descs_init(struct eth_device *dev)
+{
+   struct dw_eth_dev *priv = dev-priv;
+   struct eth_dma_regs *dma_p = priv-dma_regs_p;
+   struct dmamacdescr *desc_table_p = priv-tx_mac_descrtable[0];
+   char *txbuffs = priv-txbuffs[0];
+   struct dmamacdescr *desc_p;
+   u32 idx;
+
+   for (idx = 0; idx  CONFIG_TX_DESCR_NUM; idx++) {
+   desc_p = desc_table_p[idx];
+   desc_p-dmamac_addr = txbuffs[idx * CONFIG_ETH_BUFSIZE];
+   desc_p-dmamac_next = desc_table_p[idx + 1];
+
+#if defined(CONFIG_DW_ALTDESCRIPTOR)
+   desc_p-txrx_status = ~(DESC_TXSTS_TXINT | DESC_TXSTS_TXLAST |
+   DESC_TXSTS_TXFIRST | DESC_TXSTS_TXCRCDIS | \
+   DESC_TXSTS_TXCHECKINSCTRL | \
+   DESC_TXSTS_TXRINGEND | DESC_TXSTS_TXPADDIS);
+
+   desc_p-txrx_status |= DESC_TXSTS_TXCHAIN;
+   desc_p-dmamac_cntl = 0;
+   desc_p-txrx_status = ~(DESC_TXSTS_MSK | DESC_TXSTS_OWNBYDMA);
+#else
+   desc_p-dmamac_cntl = DESC_TXCTRL_TXCHAIN;
+   desc_p-txrx_status = 0;
+#endif
+   }
+
+   /* Correcting the last pointer of the chain */
+   desc_p-dmamac_next = desc_table_p[0];
+
+   writel((ulong)desc_table_p[0], dma_p-txdesclistaddr);
+}
+
+static void rx_descs_init(struct eth_device *dev)
+{
+   struct dw_eth_dev *priv = dev-priv;
+   struct eth_dma_regs *dma_p = priv-dma_regs_p;
+   struct dmamacdescr *desc_table_p = priv-rx_mac_descrtable[0];
+   char *rxbuffs = priv-rxbuffs[0];
+   struct dmamacdescr *desc_p;
+   u32 idx;
+
+   for (idx = 0; idx  CONFIG_RX_DESCR_NUM; idx++) {
+   desc_p = desc_table_p[idx];
+   desc_p-dmamac_addr = rxbuffs[idx * CONFIG_ETH_BUFSIZE];
+   desc_p-dmamac_next = desc_table_p[idx + 1];
+
+   desc_p-dmamac_cntl =
+   (MAC_MAX_FRAME_SZ  DESC_RXCTRL_SIZE1MASK) | \
+ DESC_RXCTRL_RXCHAIN;
+
+   desc_p-txrx_status = DESC_RXSTS_OWNBYDMA;
+   }
+
+   /* Correcting the last pointer of the chain */
+   desc_p-dmamac_next = desc_table_p[0];
+
+   writel((ulong)desc_table_p[0], dma_p-rxdesclistaddr);
+}
+
+static void descs_init(struct eth_device *dev)
+{
+   tx_descs_init(dev);
+   rx_descs_init(dev);
+}
+
+static int mac_reset(struct eth_device *dev)
+{
+   struct dw_eth_dev *priv = dev-priv;
+   struct eth_mac_regs *mac_p = priv-mac_regs_p;
+   struct eth_dma_regs *dma_p = priv-dma_regs_p;
+
+   int timeout = CONFIG_MACRESET_TIMEOUT;

Re: [U-Boot] [PATCH] net: Kirkwood_egiga.c bugfixes for rx path

2010-04-25 Thread Ben Warren
Prafulla,
On 4/6/2010 9:03 AM, Prafulla Wadaskar wrote:
 Cosmetic changes: Few comments updated
 Functionality: Rx packet frame size is programming should
 be done when port is in disabled state. this is corrected

 Signed-off-by: Prafulla Wadaskarprafu...@marvell.com
 ---

Applied to net repo.

thanks,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] net: dm9000x: use standard I/O accessors

2010-04-25 Thread Ben Warren
Mike,

ApplOn 4/14/2010 1:29 PM, Mike Frysinger wrote:
 The current dm9000x driver accesses its memory mapped registers directly
 instead of using the standard I/O accessors.  This can cause problems on
 Blackfin systems as the accesses can get out of order.  So convert the
 direct volatile dereferences to use the normal in/out macros.

 Signed-off-by: Mike Frysingervap...@gentoo.org
 ---
   drivers/net/dm9000x.c |   12 ++--
   1 files changed, 6 insertions(+), 6 deletions(-)

 diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
 index a7fef56..f121286 100644
 --- a/drivers/net/dm9000x.c
 +++ b/drivers/net/dm9000x.c
 @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value);

   /* DM9000 network board routine  */

 -#define DM9000_outb(d,r) ( *(volatile u8 *)r = d )
 -#define DM9000_outw(d,r) ( *(volatile u16 *)r = d )
 -#define DM9000_outl(d,r) ( *(volatile u32 *)r = d )
 -#define DM9000_inb(r) (*(volatile u8 *)r)
 -#define DM9000_inw(r) (*(volatile u16 *)r)
 -#define DM9000_inl(r) (*(volatile u32 *)r)
 +#define DM9000_outb(d,r) outb(d, r)
 +#define DM9000_outw(d,r) outw(d, r)
 +#define DM9000_outl(d,r) outl(d, r)
 +#define DM9000_inb(r) inb(r)
 +#define DM9000_inw(r) inw(r)
 +#define DM9000_inl(r) inl(r)

   #ifdef CONFIG_DM9000_DEBUG
   static void

Applied to net repo.

thanks,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] tsec: Wait for both RX and TX to stop

2010-04-25 Thread Ben Warren
Andy,

On 4/19/2010 12:54 PM, Andy Fleming wrote:
 When gracefully stopping the controller, the driver was continuing if
 *either* RX or TX had stopped.  We need to wait for both, or the
 controller could get into an invalid state.

 Signed-off-by: Andy Flemingaflem...@freescale.com
 ---
   drivers/net/tsec.c |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
 index fd49eff..3e4c3bd 100644
 --- a/drivers/net/tsec.c
 +++ b/drivers/net/tsec.c
 @@ -1082,7 +1082,8 @@ static void tsec_halt(struct eth_device *dev)
   regs-dmactrl= ~(DMACTRL_GRS | DMACTRL_GTS);
   regs-dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);

 - while (!(regs-ievent  (IEVENT_GRSC | IEVENT_GTSC))) ;
 + while ((regs-ievent  (IEVENT_GRSC | IEVENT_GTSC))
 + != (IEVENT_GRSC | IEVENT_GTSC)) ;

   regs-maccfg1= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);


Applied to net repo.

thanks,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] smc911x driver frame alignment patch

2010-04-25 Thread Ben Warren
  Valentin,
On 4/22/2010 10:40 PM, Valentin Yakovenkov wrote:
 SMSC911x chips have alignment function to allow frame payload data
 (which comes after 14-bytes ethernet header) to be aligned at some
 boundary when reading it from fifo (usually - 4 bytes boundary).
 This is done by inserting fake zeros bytes BEFORE actual frame data when
 reading from SMSC's fifo.
 This function controlled by RX_CFG register. There are bits that
 represents amount of fake bytes to be inserted.

 Linux uses alignment of 4 bytes. Ethernet frame header is 14 bytes long,
 so we need to add 2 fake bytes to get payload data aligned at 4-bytes
 boundary.
 Linux driver does this by adding IP_ALIGNMENT constant (defined at
 skb.h) when calculating fifo data length. All network subsystem of Linux
 uses this constant too when calculating different offsets.

 But u-boot does not use any packet data alignment, so we don't need to
 add anything when calculating fifo data length.
 Moreover, driver zeros the RX_CFG register just one line up, so chip
 does not insert any fake data at the beginig. So calculated data length
 is always bigger by 1 word.

 It seems that at almost every packet read we get an underflow condition
 at fifo and possible corruption of data. Especially at continuous
 transfers, such as tftp.

 Just after removing this magic addition, I've got tftp transfer speed as
 it aught to be at 100Mbps. It was really slow before.

 It seems that fifo underflow occurs only when using byte packing on
 32-bit blackfin bus (may be because of very small delay between reads).



 Signed-off-by: Valentin Yakovenkovyakoven...@niistt.ru
 diff -r 7dc8ff189175 a/drivers/net/smc911x.c
 --- a/drivers/net/smc911x.c   Mon Mar 29 11:08:55 2010 +0400
 +++ b/drivers/net/smc911x.c   Mon Apr 19 10:46:02 2010 +0400
 @@ -220,7 +220,7 @@

   smc911x_reg_write(dev, RX_CFG, 0);

 - tmplen = (pktlen + 2+ 3) / 4;
 + tmplen = (pktlen + 3) / 4;
   while (tmplen--)
   *data++ = pkt_data_pull(dev, RX_DATA_FIFO);

 --
WBR, Valentin
CJSC NII STT, Russia, Smolensk
http://www.niistt.ru


Applied to net repo.

thanks,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/17] SPEAr : Network driver support added

2010-04-25 Thread Ben Warren
Hi Armando,

On 4/23/2010 3:32 AM, Armando VISCONTI wrote:
 Ben,

 I have a specific question on the way we handle phy address
 in SPEAr.
 +
 +static u8 find_phy(struct eth_device *dev)
 +{
 +u8 phy_addr = 0;
 +u16 ctrl, oldctrl;
 +
 +do {
 +eth_mdio_read(dev, phy_addr, PHY_BMCR,ctrl);
 +oldctrl = ctrl  PHY_BMCR_AUTON;
 +
 +ctrl ^= PHY_BMCR_AUTON;
 +eth_mdio_write(dev, phy_addr, PHY_BMCR, ctrl);
 +eth_mdio_read(dev, phy_addr, PHY_BMCR,ctrl);
 +ctrl= PHY_BMCR_AUTON;
 +
 +if (ctrl == oldctrl) {
 +phy_addr++;
 +} else {
 +ctrl ^= PHY_BMCR_AUTON;
 +eth_mdio_write(dev, phy_addr, PHY_BMCR, ctrl);
 +break;
 +}
 +} while (phy_addr  32);
 +
 +return phy_addr;
 +}
 +
 As you can see we use an auto-probing mechanism implemented as find_phy()
 routine. This auto-probing is also used in other cases, like the
 drivers/net/mcfmii.c (mii_discover_phy()).

 Actually I'm not sure this auto-probing mechanism is correct, as it 
 works only
 in case (very used) in which the MAC-PHY are in 1:1 relationship.

 Instead, the MDIO bus nature implies that there might be N MACs and M 
 PHYs connected
 to the bus, so the auto-probing would not work.

 See here some comments on the same:
 http://lists.ozlabs.org/pipermail/devicetree-discuss/2010-February/001670.html
  



 In our PCB we have the 1:1 relationship, but since the dw_eth.c driver 
 is generic, it
 might be used on differently designed pcb.

 What is your general opinion in that?
 Should we implement it differently?

I agree that MDIO bus probing doesn't make much sense.  I don't know 
anything about your SOC, but the ones that I work with typically have 
multiple MACs (data link) but only one MDIO bus (control link).  The end 
result is multiple PHYs on a multi-drop bus, and there's no way of 
knowing which one has its data link connected to which MAC.

I'd prefer to see it hard-coded, either through a CONFIG option or an 
environment variable.
 Regards,
 Arm
regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Ethernet over USB using PXA320

2010-04-25 Thread Thad Phetteplace
I'm working on a board based on the PXA320 Zylonite reference board and
attempting to get Ethernet via USB support working in u-boot.  From what I
can tell so far, this is not yet well supported in the u-boot mainline.
I've been looking at the u-boot-usb branch but its been slow going.  Can
anyone point me at a particular driver or board that would make a good
starting point?  What success has there been in using USB attached Ethernet
dongles with u-boot?

I apologize if this is well documented somewhere.  I've been searching the
archives and digging through source code, but I could use a nudge in the
right direction to speed things along.

Thanks,

Thad Phetteplace
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] Program net device MAC addresses after initializing

2010-04-25 Thread Ben Warren
Add a new function to the eth_device struct for programming a network
controller's hardware address.

After all network devices have been initialized and the proper MAC address for
each has been determined, make a device driver call to program the address
into the device.  Only device instances with valid unicast addresses will be
programmed.

Signed-off-by: Ben Warren biggerbadder...@gmail.com
Acked-by: Heiko Schocher h...@denx.de
Acked-by: Prafulla Wadaskar prafu...@marvell.com
Acked-by: Detlev Zundel d...@denx.de
---

v1-v2 Add documentation  environment variable for overriding new behavior
ACKs mentioned above are for v1

 README |5 +
 doc/README.drivers.eth |7 ++-
 doc/README.enetaddr|   10 ++
 include/net.h  |1 +
 net/eth.c  |   13 +
 5 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/README b/README
index cdd81d4..2f92bd2 100644
--- a/README
+++ b/README
@@ -3303,6 +3303,11 @@ o If both the SROM and the environment contain a MAC 
address, and the
 o If neither SROM nor the environment contain a MAC address, an error
   is raised.
 
+If Ethernet drivers implement the 'write_hwaddr' function, valid MAC addresses
+will be programmed into hardware as part of the initialization process.  This
+may be skipped by setting the appropriate 'ethmacskip' environment variable.
+The naming convention is as follows:
+eth0macskip (=eth0), eth1macskip (=eth1) etc.
 
 Image Formats:
 ==
diff --git a/doc/README.drivers.eth b/doc/README.drivers.eth
index d0c3571..eb83038 100644
--- a/doc/README.drivers.eth
+++ b/doc/README.drivers.eth
@@ -70,6 +70,7 @@ int ape_register(bd_t *bis, int iobase)
dev-halt = ape_halt;
dev-send = ape_send;
dev-recv = ape_recv;
+   dev-write_hwaddr = ape_write_hwaddr;
 
eth_register(dev);
 
@@ -102,11 +103,12 @@ not checking its state or doing random probing.
  ---
 
 Now that we've registered with the ethernet layer, we can start getting some
-real work done.  You will need four functions:
+real work done.  You will need five functions:
int ape_init(struct eth_device *dev, bd_t *bis);
int ape_send(struct eth_device *dev, volatile void *packet, int length);
int ape_recv(struct eth_device *dev);
int ape_halt(struct eth_device *dev);
+   int ape_write_hwaddr(struct eth_device *dev);
 
 The init function checks the hardware (probing/identifying) and gets it ready
 for send/recv operations.  You often do things here such as resetting the MAC
@@ -150,6 +152,9 @@ The halt function should turn off / disable the hardware 
and place it back in
 its reset state.  It can be called at any time (before any call to the related
 init function), so make sure it can handle this sort of thing.
 
+The write_hwaddr function should program the MAC address stored in 
dev-enetaddr
+into the Ethernet controller.
+
 So the call graph at this stage would look something like:
 some net operation (ping / tftp / whatever...)
eth_init()
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 94d800a..53a0c25 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -33,11 +33,13 @@ Correct flow of setting up the MAC address (summarized):
 1. Read from hardware in initialize() function
 2. Read from environment in net/eth.c after initialize()
 3. Give priority to the value in the environment if a conflict
-4. Program hardware in the device's init() function.
+4. Program the address into hardware if the following conditions are met:
+   a) The relevant driver has a 'write_addr' function
+   b) The user hasn't set an 'eth%dmacskip' environment varialbe
+   c) The address is valid (unicast, not all-zeros)
 
-If somebody wants to subvert the design philosophy, this can be done
-in the board-specific board_eth_init() function by calling eth_init()
-after all the NICs have been registered.
+Previous behavior had the MAC address always being programmed into hardware
+in the device's init() function.
 
 ---
  Usage
diff --git a/include/net.h b/include/net.h
index 3f6a5d1..a180881 100644
--- a/include/net.h
+++ b/include/net.h
@@ -105,6 +105,7 @@ struct eth_device {
 #ifdef CONFIG_MCAST_TFTP
int (*mcast) (struct eth_device*, u32 ip, u8 set);
 #endif
+   int  (*write_hwaddr) (struct eth_device*);
struct eth_device *next;
void *priv;
 };
diff --git a/net/eth.c b/net/eth.c
index aff6987..7364699 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -60,6 +60,14 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr)
return eth_getenv_enetaddr(enetvar, enetaddr);
 }
 
+static int eth_mac_skip(int index)
+{
+   char enetvar[15];
+   char *skip_state;
+   sprintf(enetvar, eth%dmacskip);
+   return ((skip_state = getenv(enetvar)) != NULL);
+}
+ 
 #ifdef CONFIG_NET_MULTI
 
 /*
@@ -242,6 +250,11 @@ int eth_initialize(bd_t *bis)
 

[U-Boot] [PATCH v3] Program net device MAC addresses after initializing

2010-04-25 Thread Ben Warren
Add a new function to the eth_device struct for programming a network
controller's hardware address.

After all network devices have been initialized and the proper MAC address for
each has been determined, make a device driver call to program the address
into the device.  Only device instances with valid unicast addresses will be
programmed.

Signed-off-by: Ben Warren biggerbadder...@gmail.com
Acked-by: Heiko Schocher h...@denx.de
Acked-by: Prafulla Wadaskar prafu...@marvell.com
Acked-by: Detlev Zundel d...@denx.de
---
v2-v3 Made the sprintf in new function actually work :(
v1-v2 Add documentation  environment variable for overriding new behavior
ACKs mentioned above are for v1

 README |5 +
 doc/README.drivers.eth |7 ++-
 doc/README.enetaddr|   10 ++
 include/net.h  |1 +
 net/eth.c  |   13 +
 5 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/README b/README
index cdd81d4..2f92bd2 100644
--- a/README
+++ b/README
@@ -3303,6 +3303,11 @@ o If both the SROM and the environment contain a MAC 
address, and the
 o If neither SROM nor the environment contain a MAC address, an error
   is raised.
 
+If Ethernet drivers implement the 'write_hwaddr' function, valid MAC addresses
+will be programmed into hardware as part of the initialization process.  This
+may be skipped by setting the appropriate 'ethmacskip' environment variable.
+The naming convention is as follows:
+eth0macskip (=eth0), eth1macskip (=eth1) etc.
 
 Image Formats:
 ==
diff --git a/doc/README.drivers.eth b/doc/README.drivers.eth
index d0c3571..eb83038 100644
--- a/doc/README.drivers.eth
+++ b/doc/README.drivers.eth
@@ -70,6 +70,7 @@ int ape_register(bd_t *bis, int iobase)
dev-halt = ape_halt;
dev-send = ape_send;
dev-recv = ape_recv;
+   dev-write_hwaddr = ape_write_hwaddr;
 
eth_register(dev);
 
@@ -102,11 +103,12 @@ not checking its state or doing random probing.
  ---
 
 Now that we've registered with the ethernet layer, we can start getting some
-real work done.  You will need four functions:
+real work done.  You will need five functions:
int ape_init(struct eth_device *dev, bd_t *bis);
int ape_send(struct eth_device *dev, volatile void *packet, int length);
int ape_recv(struct eth_device *dev);
int ape_halt(struct eth_device *dev);
+   int ape_write_hwaddr(struct eth_device *dev);
 
 The init function checks the hardware (probing/identifying) and gets it ready
 for send/recv operations.  You often do things here such as resetting the MAC
@@ -150,6 +152,9 @@ The halt function should turn off / disable the hardware 
and place it back in
 its reset state.  It can be called at any time (before any call to the related
 init function), so make sure it can handle this sort of thing.
 
+The write_hwaddr function should program the MAC address stored in 
dev-enetaddr
+into the Ethernet controller.
+
 So the call graph at this stage would look something like:
 some net operation (ping / tftp / whatever...)
eth_init()
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 94d800a..53a0c25 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -33,11 +33,13 @@ Correct flow of setting up the MAC address (summarized):
 1. Read from hardware in initialize() function
 2. Read from environment in net/eth.c after initialize()
 3. Give priority to the value in the environment if a conflict
-4. Program hardware in the device's init() function.
+4. Program the address into hardware if the following conditions are met:
+   a) The relevant driver has a 'write_addr' function
+   b) The user hasn't set an 'eth%dmacskip' environment varialbe
+   c) The address is valid (unicast, not all-zeros)
 
-If somebody wants to subvert the design philosophy, this can be done
-in the board-specific board_eth_init() function by calling eth_init()
-after all the NICs have been registered.
+Previous behavior had the MAC address always being programmed into hardware
+in the device's init() function.
 
 ---
  Usage
diff --git a/include/net.h b/include/net.h
index 3f6a5d1..a180881 100644
--- a/include/net.h
+++ b/include/net.h
@@ -105,6 +105,7 @@ struct eth_device {
 #ifdef CONFIG_MCAST_TFTP
int (*mcast) (struct eth_device*, u32 ip, u8 set);
 #endif
+   int  (*write_hwaddr) (struct eth_device*);
struct eth_device *next;
void *priv;
 };
diff --git a/net/eth.c b/net/eth.c
index aff6987..1653ea9 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -60,6 +60,14 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr)
return eth_getenv_enetaddr(enetvar, enetaddr);
 }
 
+static int eth_mac_skip(int index)
+{
+   char enetvar[15];
+   char *skip_state;
+   sprintf(enetvar, eth%dmacskip, index);
+   return ((skip_state = getenv(enetvar)) != NULL);
+}
+ 
 #ifdef CONFIG_NET_MULTI
 
 /*
@@ -242,6 +250,11 @@ int