[U-Boot] Warning NetReceive(): Make sure packet buffers start on an even address

2010-08-06 Thread Reinhard Meyer (-VC)
Hi,

The network layer currently handles packets with
c-structures overlayd on the packets.

NetReceive() will fail to correctly parse packets that
are not word aligned (at least on ARM cpus).

Just figured that out debugging the enc28j60 driver.
Which had no fault except for having the receive
packet buffer on an odd address :)

Instead of:
  static unsigned char buffer[ENC_MAX_FRM_LEN];
The following works fine:
  static unsigned long lbuffer[ENC_MAX_FRM_LEN/4];
  #define buffer ((unsigned char *)lbuffer)

Is there a more elegant way of forcing a char array to start
on an even address?

Reinhard

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


Re: [U-Boot] Warning NetReceive(): Make sure packet buffers start on an even address

2010-08-06 Thread Reinhard Meyer (-VC)
Wolfgang Denk schrieb:
   static unsigned char buffer[ENC_MAX_FRM_LEN] __attribute__ 
 ((aligned(4)));
Thanks, sometimes the very obvious is hidden behind a large wooden board :)

 
 Or, probably even better, use malloc() to allocate the buffer.
For each received packet? Could do that, but its not worth it.
Received packets are queued in the 6K RAM of the enc28j60.
I'll see if the enc can be made to ignore broadcast packets,
otherwise it might get tough either way on a busy Windows
network .

Or are you aware of any need to hand over broadcast packets into
NetReceive() ?

Reinhard

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


[U-Boot] [PATCH] NET: move legacy enc28j60.c to sidetrack as enc28j60_lpc2292.c

2010-08-06 Thread Reinhard Meyer (-VC)
This patch is required before the upcoming new enc28j60 driver
using SPI framework patch can be applied:
- Move legacy enc28j60.c to enc28j60_lpc2292.c.
- Change Makefile and the two affected boards' definition files.

Tested with ./MAKEALL ARM7 that both boards still compile.

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de
---
 drivers/net/Makefile|2 +-
 drivers/net/enc28j60.c  |  982 --
 drivers/net/enc28j60_lpc2292.c  |  983 +++
 include/configs/SMN42.h |2 +-
 include/configs/lpc2292sodimm.h |2 +-
 5 files changed, 986 insertions(+), 985 deletions(-)
 delete mode 100644 drivers/net/enc28j60.c
 create mode 100644 drivers/net/enc28j60_lpc2292.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 218eeff..479954d 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -39,7 +39,7 @@ COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
-COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_ENC28J60_LPC2292) += enc28j60_lpc2292.o
 COBJS-$(CONFIG_EP93XX) += ep93xx_eth.o
 COBJS-$(CONFIG_ETHOC) += ethoc.o
 COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
deleted file mode 100644
index 3238a50..000
--- a/drivers/net/enc28j60.c
+++ /dev/null
@@ -1,982 +0,0 @@
-/*
- * 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 config.h
-#include common.h
-#include net.h
-#include asm/arch/hardware.h
-#include asm/arch/spi.h
-
-/*
- * Control Registers in Bank 0
- */
-
-#define CTL_REG_ERDPTL  0x00
-#define CTL_REG_ERDPTH  0x01
-#define CTL_REG_EWRPTL  0x02
-#define CTL_REG_EWRPTH  0x03
-#define CTL_REG_ETXSTL  0x04
-#define CTL_REG_ETXSTH  0x05
-#define CTL_REG_ETXNDL  0x06
-#define CTL_REG_ETXNDH  0x07
-#define CTL_REG_ERXSTL  0x08
-#define CTL_REG_ERXSTH  0x09
-#define CTL_REG_ERXNDL  0x0A
-#define CTL_REG_ERXNDH  0x0B
-#define CTL_REG_ERXRDPTL 0x0C
-#define CTL_REG_ERXRDPTH 0x0D
-#define CTL_REG_ERXWRPTL 0x0E
-#define CTL_REG_ERXWRPTH 0x0F
-#define CTL_REG_EDMASTL  0x10
-#define CTL_REG_EDMASTH  0x11
-#define CTL_REG_EDMANDL  0x12
-#define CTL_REG_EDMANDH  0x13
-#define CTL_REG_EDMADSTL 0x14
-#define CTL_REG_EDMADSTH 0x15
-#define CTL_REG_EDMACSL  0x16
-#define CTL_REG_EDMACSH  0x17
-/* these are common in all banks */
-#define CTL_REG_EIE 0x1B
-#define CTL_REG_EIR 0x1C
-#define CTL_REG_ESTAT   0x1D
-#define CTL_REG_ECON2   0x1E
-#define CTL_REG_ECON1   0x1F
-
-/*
- * Control Registers in Bank 1
- */
-
-#define CTL_REG_EHT0   0x00
-#define CTL_REG_EHT1   0x01
-#define CTL_REG_EHT2   0x02
-#define CTL_REG_EHT3   0x03
-#define CTL_REG_EHT4   0x04
-#define CTL_REG_EHT5   0x05
-#define CTL_REG_EHT6   0x06
-#define CTL_REG_EHT7   0x07
-#define CTL_REG_EPMM0  0x08
-#define CTL_REG_EPMM1  0x09
-#define CTL_REG_EPMM2  0x0A
-#define CTL_REG_EPMM3  0x0B
-#define CTL_REG_EPMM4  0x0C
-#define CTL_REG_EPMM5  0x0D
-#define CTL_REG_EPMM6  0x0E
-#define CTL_REG_EPMM7  0x0F
-#define CTL_REG_EPMCSL 0x10
-#define CTL_REG_EPMCSH 0x11
-#define CTL_REG_EPMOL  0x14
-#define CTL_REG_EPMOH  0x15
-#define CTL_REG_EWOLIE 0x16
-#define CTL_REG_EWOLIR 0x17
-#define CTL_REG_ERXFCON 0x18
-#define CTL_REG_EPKTCNT 0x19
-
-/*
- * Control Registers in Bank 2
- */
-
-#define CTL_REG_MACON1  0x00
-#define CTL_REG_MACON2  0x01
-#define CTL_REG_MACON3  0x02
-#define CTL_REG_MACON4  0x03
-#define CTL_REG_MABBIPG  0x04
-#define CTL_REG_MAIPGL  0x06
-#define CTL_REG_MAIPGH  0x07
-#define CTL_REG_MACLCON1 0x08
-#define CTL_REG_MACLCON2 0x09
-#define CTL_REG_MAMXFLL  0x0A
-#define CTL_REG_MAMXFLH  0x0B
-#define CTL_REG_MAPHSUP  0x0D
-#define CTL_REG_MICON   0x11
-#define CTL_REG_MICMD   0x12
-#define CTL_REG_MIREGADR 0x14
-#define CTL_REG_MIWRL   0x16
-#define CTL_REG_MIWRH   0x17
-#define CTL_REG_MIRDL   0x18
-#define CTL_REG_MIRDH   0x19
-
-/*
- * Control Registers in Bank 3
- */
-
-#define CTL_REG_MAADR1 0x00
-#define CTL_REG_MAADR0 0x01
-#define CTL_REG_MAADR3 0x02
-#define CTL_REG_MAADR2 0x03
-#define CTL_REG_MAADR5 0x04
-#define CTL_REG_MAADR4 0x05
-#define CTL_REG_EBSTSD 0x06
-#define CTL_REG_EBSTCON 0x07
-#define CTL_REG_EBSTCSL 0x08
-#define CTL_REG_EBSTCSH 0x09
-#define CTL_REG_MISTAT 

Re: [U-Boot] Warning NetReceive(): Make sure packet buffers start on an even address

2010-08-06 Thread Reinhard Meyer (-VC)
Chris Isbell schrieb:
 Or are you aware of any need to hand over broadcast packets into
 NetReceive() ?
 
 I am stepping into the middle of this, so the following may be totally
 misguided...
 
 BOOTP/DHCP servers can send broadcast packets. I have just tried this
 with a Windows DHCP server the the DHCP response was broadcast.

Thanks for the info!

That sounds like typical Windows (%@#*)

Duly noted, broadcast reception is configurable by #define now.

Best Regards
Reinhard

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


[U-Boot] [PATCH v2] NET: move legacy enc28j60.c to sidetrack as enc28j60_lpc2292.c

2010-08-06 Thread Reinhard Meyer (-VC)
This patch is required before the upcoming new enc28j60 driver
using SPI framework patch can be applied:
- Move legacy enc28j60.c to enc28j60_lpc2292.c.
- Change Makefile and the two affected boards' definition files.

Tested with ./MAKEALL ARM7 that both boards still compile.

Signed-off-by: Reinhard Meyeri...@emk-elektronik.de
---
 now with -C option on format-patch. Cheers!

 drivers/net/Makefile   |2 +-
 drivers/net/{enc28j60.c = enc28j60_lpc2292.c} |1 +
 include/configs/SMN42.h|2 +-
 include/configs/lpc2292sodimm.h|2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
 rename drivers/net/{enc28j60.c = enc28j60_lpc2292.c} (99%)

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 218eeff..479954d 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -39,7 +39,7 @@ COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
-COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_ENC28J60_LPC2292) += enc28j60_lpc2292.o
 COBJS-$(CONFIG_EP93XX) += ep93xx_eth.o
 COBJS-$(CONFIG_ETHOC) += ethoc.o
 COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60_lpc2292.c
similarity index 99%
rename from drivers/net/enc28j60.c
rename to drivers/net/enc28j60_lpc2292.c
index 3238a50..bf95052 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60_lpc2292.c
@@ -15,6 +15,7 @@
  * MA 02111-1307 USA
  */
 
+#warning This driver is depreciated. Please update to new SPI framework 
enc28j60 driver
 #include config.h
 #include common.h
 #include net.h
diff --git a/include/configs/SMN42.h b/include/configs/SMN42.h
index adb6ac5..ba3ada1 100644
--- a/include/configs/SMN42.h
+++ b/include/configs/SMN42.h
@@ -198,6 +198,6 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_MMC 1
 /* we use this ethernet chip */
-#define CONFIG_ENC28J60
+#define CONFIG_ENC28J60_LPC2292
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/lpc2292sodimm.h b/include/configs/lpc2292sodimm.h
index 7ce8d6d..65276a2 100644
--- a/include/configs/lpc2292sodimm.h
+++ b/include/configs/lpc2292sodimm.h
@@ -156,6 +156,6 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_MMC 1
 /* we use this ethernet chip */
-#define CONFIG_ENC28J60
+#define CONFIG_ENC28J60_LPC2292
 
 #endif /* __CONFIG_H */

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


[U-Boot] [PATCH] AT91: remove superfluous test in spi driver

2010-07-30 Thread Reinhard Meyer (-VC)
Let spi_cs_is_valid() alone make the decision

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de
---
 drivers/spi/atmel_spi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 317c0b4..1a650ee 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -43,7 +43,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned 
int cs,
u32 csrx;
void*regs;
 
-   if (cs  3 || !spi_cs_is_valid(bus, cs))
+   if (!spi_cs_is_valid(bus, cs))
return NULL;
 
switch (bus) {
-- 
1.5.6.5


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


Re: [U-Boot] drivers/net/enc28j60.c - generalisation, how?

2010-07-27 Thread Reinhard Meyer (-VC)
Martin Krause schrieb:
 Hi all,
 Some time ago I modified the current encc28j60 driver to use the
 generic SPI api and to work with CONFIG_NET_MULTI. It was for a
 project not part of mainline U-Boot (and a bit of a hack), so I
 didn't post the patches on the mailing list.
 
 Reinhard, if you are interested, I could send you my patch, or
 post it on the mailing list.

Yes, of course, at your discretion to the list, but if it is
not yet in acceptable patch format it will suffice to send it
to me. I will try to make it work on our AT91 based board
(as a 2nd LAN interface, so CONFIG_NET_MULTI will be really
required) and later submit a patch if all goes well.

Best Regards, Reinhard

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


[U-Boot] [PATCH] AT91SAM9XE add embedded flash support

2010-07-16 Thread Reinhard Meyer (-VC)
Add support for the embedded flash in the AT91SAM9XE128/256/512 SoCs:
- Environment can be put into that flash
- U-Boot can be in that flash
- Commands cp and protect are supported

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 arch/arm/cpu/arm926ejs/at91/Makefile   |1 +
 arch/arm/cpu/arm926ejs/at91/eflash.c   |  277

 arch/arm/include/asm/arch-at91/at91_dbu.h  |   41 
 arch/arm/include/asm/arch-at91/at91_eefc.h |   51 +
 4 files changed, 370 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/at91/eflash.c
 create mode 100644 arch/arm/include/asm/arch-at91/at91_dbu.h
 create mode 100644 arch/arm/include/asm/arch-at91/at91_eefc.h

diff --git a/arch/arm/cpu/arm926ejs/at91/Makefile
b/arch/arm/cpu/arm926ejs/at91/Makefile
index 4f467be..def3980 100644
--- a/arch/arm/cpu/arm926ejs/at91/Makefile
+++ b/arch/arm/cpu/arm926ejs/at91/Makefile
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_AT91SAM9263)+= at91sam9263_devices.o
 COBJS-$(CONFIG_AT91SAM9RL)+= at91sam9rl_devices.o
 COBJS-$(CONFIG_AT91SAM9M10G45)+= at91sam9m10g45_devices.o
 COBJS-$(CONFIG_AT91SAM9G45)+= at91sam9m10g45_devices.o
+COBJS-$(CONFIG_AT91_EFLASH)+= eflash.o
 COBJS-$(CONFIG_AT91_LED)+= led.o
 COBJS-y += clock.o
 COBJS-y += cpu.o
diff --git a/arch/arm/cpu/arm926ejs/at91/eflash.c
b/arch/arm/cpu/arm926ejs/at91/eflash.c
new file mode 100644
index 000..83dce7d
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/at91/eflash.c
@@ -0,0 +1,277 @@
+/*
+ * (C) Copyright 2010
+ * Reinhard Meyer, EMK Elektronik, reinhard.me...@emk-elektronik.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
+ */
+/*
+ * this driver supports the enhanced embedded flash in the Atmel
+ * AT91SAM9XE devices with the following geometry:
+ *
+ * AT91SAM9XE128: 1 plane of  8 regions of 32 pages (total  256 pages)
+ * AT91SAM9XE256: 1 plane of 16 regions of 32 pages (total  512 pages)
+ * AT91SAM9XE512: 1 plane of 32 regions of 32 pages (total 1024 pages)
+ * (the exact geometry is read from the flash at runtime, so any
+ *  future devices should already be covered)
+ *
+ * Regions can be write/erase protected.
+ * Whole (!) pages can be individually written with erase on the fly.
+ * Writing partial pages will corrupt the rest of the page.
+ *
+ * The flash is presented to u-boot with each region being a sector,
+ * having the following effects:
+ * Each sector can be hardware protected (protect on/off).
+ * Each page in a sector can be rewritten anytime.
+ * Since pages are erased when written, the erase does nothing.
+ * The first CONFIG_EFLASH_PROTSECTORS cannot be unprotected
+ * by u-Boot commands.
+ *
+ * Note: Redundant environment will not work in this flash since
+ * it does use partial page writes. Make sure the environent spans
+ * whole pages!
+ */
+
+#include common.h
+#include asm/arch/hardware.h
+#include asm/arch/io.h
+#include asm/arch/at91_common.h
+#include asm/arch/at91_eefc.h
+#include asm/arch/at91_dbu.h
+
+/* checks to detect configuration errors */
+#if CONFIG_SYS_MAX_FLASH_BANKS!=1
+#error eflash: this driver can only handle 1 bank
+#endif
+
+/*#define DEBUG_FLASH*/
+
+#ifdef DEBUG_FLASH
+#define DEBUGF(fmt,args...) printf(eflash: fmt ,##args)
+#else
+#define DEBUGF(fmt,args...)
+#endif
+
+/* global structure */
+flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
+static u32 pagesize;
+
+unsigned long flash_init (void)
+{
+at91_eefc_t *eefc = (at91_eefc_t *) 0xfa00;
+at91_dbu_t *dbu = (at91_dbu_t *) 0xf200;
+u32 id, size, nplanes, planesize, nlocks;
+u32 addr, i, tmp=0;
+
+#ifdef DEBUG_FLASH
+puts(eflash: init\n);
+#endif
+
+flash_info[0].flash_id = FLASH_UNKNOWN;
+
+/* check if its an AT91ARM9XE SoC */
+if ((readl(dbu-cidr)  AT91_DBU_CID_ARCH_MASK) !=
AT91_DBU_CID_ARCH_9XExx) {
+#ifdef DEBUG_FLASH
+puts(eflash: not an AT91SAM9XE\n);
+#endif
+return 0;
+}
+
+/* now query the eflash for its structure */
+writel(AT91_EEFC_FCR_KEY | AT91_EEFC_FCR_FCMD_GETD, eefc-fcr);
+while ((readl(eefc-fsr)  AT91_EEFC_FSR_FRDY) == 0)
+;
+id = readl(eefc-frr);/* word 0 */
+size = readl(eefc-frr);/* word 1 */
+pagesize = 

[U-Boot] [PATCH v2] AT91SAM9XE add embedded flash support

2010-07-16 Thread Reinhard Meyer (-VC)
Add support for the embedded flash in the AT91SAM9XE128/256/512 SoCs:
- Environment can be put into that flash
- U-Boot can be in that flash
- Commands cp and protect are supported

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 arch/arm/cpu/arm926ejs/at91/Makefile   |1 +
 arch/arm/cpu/arm926ejs/at91/eflash.c   |  277 
 arch/arm/include/asm/arch-at91/at91_dbu.h  |   41 
 arch/arm/include/asm/arch-at91/at91_eefc.h |   51 +
 4 files changed, 370 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/at91/eflash.c
 create mode 100644 arch/arm/include/asm/arch-at91/at91_dbu.h
 create mode 100644 arch/arm/include/asm/arch-at91/at91_eefc.h

diff --git a/arch/arm/cpu/arm926ejs/at91/Makefile 
b/arch/arm/cpu/arm926ejs/at91/Makefile
index 4f467be..def3980 100644
--- a/arch/arm/cpu/arm926ejs/at91/Makefile
+++ b/arch/arm/cpu/arm926ejs/at91/Makefile
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_AT91SAM9263)   += at91sam9263_devices.o
 COBJS-$(CONFIG_AT91SAM9RL) += at91sam9rl_devices.o
 COBJS-$(CONFIG_AT91SAM9M10G45) += at91sam9m10g45_devices.o
 COBJS-$(CONFIG_AT91SAM9G45)+= at91sam9m10g45_devices.o
+COBJS-$(CONFIG_AT91_EFLASH)+= eflash.o
 COBJS-$(CONFIG_AT91_LED)   += led.o
 COBJS-y += clock.o
 COBJS-y += cpu.o
diff --git a/arch/arm/cpu/arm926ejs/at91/eflash.c 
b/arch/arm/cpu/arm926ejs/at91/eflash.c
new file mode 100644
index 000..83dce7d
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/at91/eflash.c
@@ -0,0 +1,277 @@
+/*
+ * (C) Copyright 2010
+ * Reinhard Meyer, EMK Elektronik, reinhard.me...@emk-elektronik.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
+ */
+/*
+ * this driver supports the enhanced embedded flash in the Atmel
+ * AT91SAM9XE devices with the following geometry:
+ *
+ * AT91SAM9XE128: 1 plane of  8 regions of 32 pages (total  256 pages)
+ * AT91SAM9XE256: 1 plane of 16 regions of 32 pages (total  512 pages)
+ * AT91SAM9XE512: 1 plane of 32 regions of 32 pages (total 1024 pages)
+ * (the exact geometry is read from the flash at runtime, so any
+ *  future devices should already be covered)
+ *
+ * Regions can be write/erase protected.
+ * Whole (!) pages can be individually written with erase on the fly.
+ * Writing partial pages will corrupt the rest of the page.
+ *
+ * The flash is presented to u-boot with each region being a sector,
+ * having the following effects:
+ * Each sector can be hardware protected (protect on/off).
+ * Each page in a sector can be rewritten anytime.
+ * Since pages are erased when written, the erase does nothing.
+ * The first CONFIG_EFLASH_PROTSECTORS cannot be unprotected
+ * by u-Boot commands.
+ *
+ * Note: Redundant environment will not work in this flash since
+ * it does use partial page writes. Make sure the environent spans
+ * whole pages!
+ */
+
+#include common.h
+#include asm/arch/hardware.h
+#include asm/arch/io.h
+#include asm/arch/at91_common.h
+#include asm/arch/at91_eefc.h
+#include asm/arch/at91_dbu.h
+
+/* checks to detect configuration errors */
+#if CONFIG_SYS_MAX_FLASH_BANKS!=1
+#error eflash: this driver can only handle 1 bank
+#endif
+
+/*#define DEBUG_FLASH*/
+
+#ifdef DEBUG_FLASH
+#define DEBUGF(fmt,args...) printf(eflash: fmt ,##args)
+#else
+#define DEBUGF(fmt,args...)
+#endif
+
+/* global structure */
+flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
+static u32 pagesize;
+
+unsigned long flash_init (void)
+{
+   at91_eefc_t *eefc = (at91_eefc_t *) 0xfa00;
+   at91_dbu_t *dbu = (at91_dbu_t *) 0xf200;
+   u32 id, size, nplanes, planesize, nlocks;
+   u32 addr, i, tmp=0;
+
+#ifdef DEBUG_FLASH
+   puts(eflash: init\n);
+#endif
+
+   flash_info[0].flash_id = FLASH_UNKNOWN;
+
+   /* check if its an AT91ARM9XE SoC */
+   if ((readl(dbu-cidr)  AT91_DBU_CID_ARCH_MASK) != 
AT91_DBU_CID_ARCH_9XExx) {
+#ifdef DEBUG_FLASH
+   puts(eflash: not an AT91SAM9XE\n);
+#endif
+   return 0;
+   }
+
+   /* now query the eflash for its structure */
+   writel(AT91_EEFC_FCR_KEY | AT91_EEFC_FCR_FCMD_GETD, eefc-fcr);
+   while ((readl(eefc-fsr)  AT91_EEFC_FSR_FRDY) == 0)
+   ;
+   id = readl(eefc-frr); /* word 0 */
+ 

Re: [U-Boot] [PATCH] AT91SAM9XE add embedded flash support

2010-07-16 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:
  arch/arm/cpu/arm926ejs/at91/eflash.c   |  277
 
Sorry, Thunderbird had me there again.
When the compose window is too narrow for the
insterted Text, it will wrap text during insertion,
even if wrapping is switched off generally!
Disregard this patch. A new one is sent already.

Reinhard

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


Re: [U-Boot] [PATCH] common: add a grepenv command

2010-07-16 Thread Reinhard Meyer (-VC)
Wolfgang Denk schrieb:
 Dear Kim Phillips,
 
 In message 20100715221522.1dd4eecb.kim.phill...@freescale.com you wrote:
 u-boot environments, esp. when boards are shared across multiple users,
 can get pretty large and time consuming to visually parse.
 The grepenv command this patch adds can be used in lieu of printenv
 to facilitate searching.  grepenv works like printenv but limits its output
 only to environment strings (variable name and value pairs) that match the
 user specified substring.

My five cents to this: this addition command should be optional (#ifdef) 
anyway...

 
 Thanks, but I will not apply thjis.
 
 I'm in the process of resturcturing the whole environment handling.
 The new implementation will use a hash table for internal storage, so
 this code would no longer apply then.
 
 Please wait a bit for me to publish the new code, and then try to
 reimplement it in the new environment.

Will be there a means to mark variables as non-saveable, example if one
does a bootp/dhcp and a saveenv afterwards, ip-address, filesize etc.
are saved as well, which makes absolutely no sense. Neither does
saving the ethaddr when it is created from VPD data :)

Reinhard

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


[U-Boot] cmd_date.c error or itention?

2010-07-05 Thread Reinhard Meyer (-VC)
Hi,

cmd_data.c codes the following:

case 2: /* set date  time */
if (strcmp(argv[1],reset) == 0) {
puts (Reset RTC...\n);
rtc_reset ();
} else {
/* initialize tm with current time */
rcode = rtc_get (tm);

if(!rcode) {
/* insert new date  time */
if (mk_date (argv[1], tm) != 0) {
puts (## Bad date format\n);
break;
}
/* and write to RTC */
rcode = rtc_set (tm);
if(rcode)
puts(## Set date failed\n);
} else {
puts(## Get date failed\n);
}
}
/* FALL TROUGH */

Now I have implemented rtc_get() such that it returns an error code
when the time is corrupt/has never been set.

However the if(!rcode) then prevents the time to be set!

Is that intentional and rtc_get() should never return an error ??
Or is it an oversight, and a patch would be welcome ?

Reinhard

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


[U-Boot] [PATCH 0/3] AT91: add header files, update cpu.c, add RTC support

2010-07-05 Thread Reinhard Meyer (-VC)
This is a series of 3 patches:

[PATCH 1/3] AT91: add two new header files for RTT and GPBR
- adds at91_rtt.h and at91_gpbr.h
- condenses GPBR usage assignment into one file (at91_gpbr.h)
- required to compile the following two patches

[PATCH 2/3] AT91: update cpu.c to use GPBR definitions from at91_gpbr.h
- no functional change, just make use of at91_gpbr.h

[PATCH 3/3] AT91: add RTT and GPBR based RTC support
- adds kernel compatible RTC handling to u-boot using
  the RTT and one GPBRegister

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


[U-Boot] [PATCH 1/3] AT91: add two new header files for RTT and GPBR

2010-07-05 Thread Reinhard Meyer (-VC)
adds at91_rtt.h and at91_gpbr.h
condenses GPBR usage assignment into one file (at91_gpbr.h)

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 arch/arm/include/asm/arch-at91/at91_gpbr.h |   45 
 arch/arm/include/asm/arch-at91/at91_rtt.h  |   36 ++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-at91/at91_gpbr.h
 create mode 100644 arch/arm/include/asm/arch-at91/at91_rtt.h

diff --git a/arch/arm/include/asm/arch-at91/at91_gpbr.h 
b/arch/arm/include/asm/arch-at91/at91_gpbr.h
new file mode 100644
index 000..cf1d790
--- /dev/null
+++ b/arch/arm/include/asm/arch-at91/at91_gpbr.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010
+ * Reinhard Meyer, reinhard.me...@emk-elektronik.de
+ *
+ * General Purpose Backup Registers
+ * Based on AT91SAM9XE datasheet
+ *
+ * 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.
+ */
+
+#ifndef AT91_GPBR_H
+#define AT91_GPBR_H
+
+/*
+ * The Atmel AT91SAM9 series has a small resource of 4 nonvolatile
+ * 32 Bit registers (buffered by the Vbu power).
+ *
+ * Please consider carefully before using this resource for tasks
+ * that do not really need nonvolatile registers. Maybe you can
+ * store information in EEPROM or FLASH instead.
+ *
+ * However, if you use a GPBR please document its use here and
+ * reference the define in your code!
+ *
+ * known typical uses of the GPBRs:
+ * GPBR[0]: offset for RTT timekeeping (u-boot, kernel)
+ * GPBR[1]: unused
+ * GPBR[2]: unused
+ * GPBR[3]: bootcount (u-boot)
+ */
+#define AT91_GPBR_INDEX_TIMEOFF 0
+#define AT91_GPBR_INDEX_BOOTCOUNT 3
+
+#ifndef __ASSEMBLY__
+
+typedef struct at91_gpbr {
+   u32 reg[4];
+} at91_gpbr_t;
+
+#endif /* __ASSEMBLY__ */
+
+#endif
diff --git a/arch/arm/include/asm/arch-at91/at91_rtt.h 
b/arch/arm/include/asm/arch-at91/at91_rtt.h
new file mode 100644
index 000..e0253ef
--- /dev/null
+++ b/arch/arm/include/asm/arch-at91/at91_rtt.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010
+ * Reinhard Meyer, reinhard.me...@emk-elektronik.de
+ *
+ * Real-time Timer
+ * Based on AT91SAM9XE datasheet
+ *
+ * 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.
+ */
+
+#ifndef AT91_RTT_H
+#define AT91_RTT_H
+
+#ifndef __ASSEMBLY__
+
+typedef struct at91_rtt {
+   u32 mr; /* Mode Register   RW 0x8000 */
+   u32 ar; /* Alarm Register  RW 0x */
+   u32 vr; /* Value Register  RO 0x */
+   u32 sr; /* Status Register RO 0x */
+} at91_rtt_t;
+
+#endif /* __ASSEMBLY__ */
+
+#define AT91_RTT_MR_RTPRES 0x
+#define AT91_RTT_MR_ALMIEN 0x0001
+#define AT91_RTT_RTTINCIEN 0x0002
+#define AT91_RTT_RTTRST0x0004
+
+#define AT91_RTT_SR_ALMS   0x0001
+#define AT91_RTT_SR_RTTINC 0x0002
+
+#endif
-- 
1.5.6.5


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


[U-Boot] [PATCH 2/3] AT91: update cpu.c to use GPBR definitions from at91_gpbr.h

2010-07-05 Thread Reinhard Meyer (-VC)
no functional change, just make use of at91_gpbr.h

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 arch/arm/cpu/arm926ejs/at91/cpu.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c 
b/arch/arm/cpu/arm926ejs/at91/cpu.c
index 141a7d1..1a7e99f 100644
--- a/arch/arm/cpu/arm926ejs/at91/cpu.c
+++ b/arch/arm/cpu/arm926ejs/at91/cpu.c
@@ -28,6 +28,7 @@
 
 #include asm/arch/hardware.h
 #include asm/arch/at91_pmc.h
+#include asm/arch/at91_gpbr.h
 #include asm/arch/clk.h
 #include asm/arch/io.h
 
@@ -36,11 +37,10 @@
 #endif
 
 /*
- * The at91sam9260 has 4 GPBR (0-3), we'll use the last one, nr 3,
- * to keep track of the bootcount.
+ * The at91sam9260 has 4 GPBR (0-3).
+ * For their typical use see at91_gpbr.h !
  */
-#define AT91_GPBR_BOOTCOUNT_REGISTER 3
-#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_BOOTCOUNT_REGISTER)
+#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_INDEX_BOOTCOUNT)
 
 int arch_cpu_init(void)
 {
-- 
1.5.6.5


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


[U-Boot] [PATCH 3/3] AT91: add RTT and GPBR based RTC support

2010-07-05 Thread Reinhard Meyer (-VC)
adds kernel compatible RTC handling to u-boot using
the RTT and one GPBRegister

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 drivers/rtc/Makefile   |1 +
 drivers/rtc/at91sam9.c |  100 
 2 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/at91sam9.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 772a49a..53db3d0 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -29,6 +29,7 @@ LIB   = $(obj)librtc.a
 
 COBJS-$(CONFIG_RTC_BFIN) += bfin_rtc.o
 COBJS-y += date.o
+COBJS-$(CONFIG_RTC_AT91SAM9) += at91sam9.o
 COBJS-$(CONFIG_RTC_DS12887) += ds12887.o
 COBJS-$(CONFIG_RTC_DS1302) += ds1302.o
 COBJS-$(CONFIG_RTC_DS1306) += ds1306.o
diff --git a/drivers/rtc/at91sam9.c b/drivers/rtc/at91sam9.c
new file mode 100644
index 000..6ec8e8e
--- /dev/null
+++ b/drivers/rtc/at91sam9.c
@@ -0,0 +1,100 @@
+/*
+ * (C) Copyright 2010
+ * Reinhard Meyer, reinhard.me...@emk-elektronik.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
+ */
+
+/*
+ * Date  Time support for the internal Real-time Timer
+ * of AT91SAM9260 and compatibles.
+ * Compatible with the LinuX rtc driver workaround:
+ * The RTT cannot be written to, but only reset.
+ * The actual time is the sum of RTT and one of
+ * the four GPBR registers.
+ *
+ * The at91sam9260 has 4 GPBR (0-3).
+ * For their typical use see at91_gpbr.h !
+ *
+ * make sure u-boot and kernel use the same GPBR !
+ */
+
+#include common.h
+#include command.h
+#include rtc.h
+#include asm/errno.h
+#include asm/arch/hardware.h
+#include asm/arch/io.h
+#include asm/arch/at91_rtt.h
+#include asm/arch/at91_gpbr.h
+
+#if defined(CONFIG_CMD_DATE)
+
+int rtc_get (struct rtc_time *tmp)
+{
+   at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE;
+   at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE;
+   ulong tim;
+   ulong tim2;
+   ulong off;
+
+   do {
+   tim = readl(rtt-vr);
+   tim2 = readl(rtt-vr);
+   } while (tim!=tim2);
+   off = readl(gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]);
+   /* off==0 means time is invalid, but we ignore that */
+   to_tm (tim+off, tmp);
+   return 0;
+}
+
+int rtc_set (struct rtc_time *tmp)
+{
+   at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE;
+   at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE;
+   ulong tim;
+
+   tim = mktime (tmp-tm_year, tmp-tm_mon, tmp-tm_mday,
+ tmp-tm_hour, tmp-tm_min, tmp-tm_sec);
+
+   /* clear alarm, set prescaler to 32768, clear counter */
+   writel(32768+AT91_RTT_RTTRST, rtt-mr);
+   writel(~0, rtt-ar);
+   writel(tim, gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]);
+   /* wait for counter clear to happen, takes less than a 1/32768th second 
*/
+   while (readl(rtt-vr) != 0)
+   ;
+   return 0;
+}
+
+void rtc_reset (void)
+{
+   at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE;
+   at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE;
+   
+   /* clear alarm, set prescaler to 32768, clear counter */
+   writel(32768+AT91_RTT_RTTRST, rtt-mr);
+   writel(~0, rtt-ar);
+   writel(0, gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]);
+   /* wait for counter clear to happen, takes less than a 1/32768th second 
*/
+   while (readl(rtt-vr) != 0)
+   ;
+}
+
+#endif
-- 
1.5.6.5


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


[U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI)

2010-07-04 Thread Reinhard Meyer (-VC)
This patch adds support for the Atmel MultiMedia Card Interface (MCI)
in AT91SAM9260 and AT91SAM9XE SoCs and preserves the original support
for the AVR32AP700x SoCs.
It patches the original atmel_mci.c driver to remove byte order and
toolchain dependencies and makes it a common MCI driver for
Atmels AVR32AP7000 and AT91SAM9260 based SoCs.
The driver itself is not specific to those SoCs and should work with
other Atmel devices having an identical MultiMedia Card Interface (MCI),
provided the functions get_mci_clk_rate() and SoC_mci_hw_init() are
defined.

Tested on AT91SAM9XE-EK (AT91SAM9XE512)
Tested on ATNGW100 (AVR32AP7000)

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de
---
 arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c |   20 
 arch/arm/include/asm/arch-at91/clk.h  |5 +
 arch/arm/include/asm/arch-at91/hardware.h |1 +
 doc/README.atmel_mci  |   68 +
 drivers/mmc/atmel_mci.c   |  112 ++---
 drivers/mmc/atmel_mci.h   |6 +-
 include/mmc.h |   93 ++---
 7 files changed, 207 insertions(+), 98 deletions(-)
 create mode 100644 doc/README.atmel_mci

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c 
b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
index 77d49ab..9cef832 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -194,3 +194,23 @@ void at91_macb_hw_init(void)
 #endif
 }
 #endif
+
+#ifdef CONFIG_ATMEL_MCI
+void at91_mci_hw_init(void)
+{
+   at91_set_a_periph(AT91_PIO_PORTA, 8, 0);/* MCCK */
+#if defined(CONFIG_ATMEL_MCI_PORTB)
+   at91_set_b_periph(AT91_PIO_PORTA, 1, 0);/* MCCDB */
+   at91_set_b_periph(AT91_PIO_PORTA, 0, 0);/* MCDB0 */
+   at91_set_b_periph(AT91_PIO_PORTA, 5, 0);/* MCDB1 */
+   at91_set_b_periph(AT91_PIO_PORTA, 4, 0);/* MCDB2 */
+   at91_set_b_periph(AT91_PIO_PORTA, 3, 0);/* MCDB3 */
+#else
+   at91_set_a_periph(AT91_PIO_PORTA, 7, 0);/* MCCDA */
+   at91_set_a_periph(AT91_PIO_PORTA, 6, 0);/* MCDA0 */
+   at91_set_a_periph(AT91_PIO_PORTA, 9, 0);/* MCDA1 */
+   at91_set_a_periph(AT91_PIO_PORTA, 10, 0);   /* MCDA2 */
+   at91_set_a_periph(AT91_PIO_PORTA, 11, 0);   /* MCDA3 */
+#endif
+}
+#endif
diff --git a/arch/arm/include/asm/arch-at91/clk.h 
b/arch/arm/include/asm/arch-at91/clk.h
index f642dd9..457e6c9 100644
--- a/arch/arm/include/asm/arch-at91/clk.h
+++ b/arch/arm/include/asm/arch-at91/clk.h
@@ -59,5 +59,10 @@ static inline unsigned long get_twi_clk_rate(unsigned int 
dev_id)
return get_mck_clk_rate();
 }
 
+static inline unsigned long get_mci_clk_rate(void)
+{
+   return get_mck_clk_rate();
+}
+
 int at91_clock_init(unsigned long main_clock);
 #endif /* __ASM_ARM_ARCH_CLK_H__ */
diff --git a/arch/arm/include/asm/arch-at91/hardware.h 
b/arch/arm/include/asm/arch-at91/hardware.h
index 4ddb315..224b285 100644
--- a/arch/arm/include/asm/arch-at91/hardware.h
+++ b/arch/arm/include/asm/arch-at91/hardware.h
@@ -23,6 +23,7 @@
 #define AT91_BASE_SPI  AT91SAM9260_BASE_SPI0
 #define AT91_ID_UHPAT91SAM9260_ID_UHP
 #define AT91_PMC_UHP   AT91SAM926x_PMC_UHP
+#define MMCI_BASE  AT91SAM9260_BASE_MCI
 #elif defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10)
 #include asm/arch/at91sam9261.h
 #define AT91_BASE_SPI  AT91SAM9261_BASE_SPI0
diff --git a/doc/README.atmel_mci b/doc/README.atmel_mci
new file mode 100644
index 000..15b3cc0
--- /dev/null
+++ b/doc/README.atmel_mci
@@ -0,0 +1,68 @@
+How to use SD/MMC cards with Atmel SoCs having MCI hardware
+---
+2010-07-04 Reinhard Meyer reinhard.me...@emk-elektronik.de
+
+The drivers/mmc/atmel_mci.c file which originally worked only
+with the AVR32 architecture SoCs like AVR32AP700x has been
+updated to also work with the AT91SAM9260 compatible architectures:
+
+- AT91SAM9XE512 (tested, will definitely work with XE128 and XE256)
+- AT91SAM9260 (not tested, but MCI is to AT91SAM9XE)
+- AT91SAM9G20 (not tested, should work)
+
+It should work with all other AT91SAM9xxx devices that have MCI
+provided that a correct version of the following function is added
+to their specific XXX_devices file:
+
+(this example is from at91sam9260_devices.c)
+
+#ifdef CONFIG_ATMEL_MCI
+void at91_mci_hw_init(void)
+{
+   at91_set_a_periph(AT91_PIO_PORTA, 8, 0);/* MCCK */
+#if defined(CONFIG_ATMEL_MCI_PORTB)
+   at91_set_b_periph(AT91_PIO_PORTA, 1, 0);/* MCCDB */
+   at91_set_b_periph(AT91_PIO_PORTA, 0, 0);/* MCDB0 */
+   at91_set_b_periph(AT91_PIO_PORTA, 5, 0);/* MCDB1 */
+   at91_set_b_periph(AT91_PIO_PORTA, 4, 0);/* MCDB2 */
+   at91_set_b_periph(AT91_PIO_PORTA, 3, 0);/* MCDB3 */
+#else
+   

[U-Boot] AT91SAM9xxx SDCard/MMC support?

2010-07-01 Thread Reinhard Meyer (-VC)
Hello,

apparently none of the mainstream u-boot designs use
SDCard/MMC.

It appears that this task should not be a huge problem,
the MCI for both AVR32 and AT91SAM9 seems to be identical
(and MCI on AVR32 works).

But before I perhaps reinvent anything already done, I
prefer to ask here. Also any input what obstacles have
been found would be appreciated.

I need the support for 9260/9G20/9XE.

Best Regards
Reinhard

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


Re: [U-Boot] AT91SAM9xxx SDCard/MMC support?

2010-07-01 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:
 Hello,
 
 apparently none of the mainstream u-boot designs use
 SDCard/MMC.
 
 It appears that this task should not be a huge problem,
 the MCI for both AVR32 and AT91SAM9 seems to be identical
 (and MCI on AVR32 works).
 
 But before I perhaps reinvent anything already done, I
 prefer to ask here. Also any input what obstacles have
 been found would be appreciated.
 
 I need the support for 9260/9G20/9XE.


After some hacking I get the following results:

TOP9000  mmc init
mmc: bus_hz is 99328000, setting clock 15 Hz, block size 512
mmc: requested clock 15 is too low; setting CLKDIV to 255; resulting clock 
is 194000
mmc: CMD0 0x0 (flags 0x0)
mmc: status 0xc0e5

mmc: CMD0 0x0 (flags 0x100)
mmc: status 0xc0e5

mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0xc0e5
mmc: response: 0120
mmc: CMD41 0x10 (flags 0x41)
mmc: status 0x0004c0e5
mmc: response: 00ff8000
mmc: CMD55 0x0 (flags 0x1040)
mmc: status 0xc0e5
mmc: response: 0120
mmc: CMD41 0x10 (flags 0x41)
mmc: status 0x0004c0e5
mmc: response: 80ff8000
mmc: CMD2 0x0 (flags 0x80)
mmc: status 0xc0e5
mmc: response: 19445953 4d495344 1073 f30054bb
Manufacturer ID:   19
OEM/Application ID:4459
Product name:  SMISD
Product Revision:  1.0
Product Serial Number: 29683
Manufacturing Date:05/04
mmc: CMD3 0x0 (flags 0x1040)
mmc: status 0xc0e5
mmc: response: b3680500
SD Card detected (RCA 45928)
mmc: CMD9 0xb368 (flags 0x1080)
mmc: status 0xc0e5
mmc: response: 005e0032 1f5983d0 6db7bf9f 9645
CSD data: 005e0032 1f5983d0 6db7bf9f 9645
CSD structure version:   1.2
MMC System Spec version: 12
Card command classes:3d0
Read block length:   256
Supports partial reads
Write block length:  1
Does not support partial writes
Does not support group WP
Card capacity:  131072000 bytes
File format:1/2
Write protection: permanent
mmc: Using 983040 cycles data timeout (DTOR=0x6f)
Card does not support 512 byte reads, aborting.
No MMC card found
   
It IS a 1 GB Card, and sure has 512 Byte sectors
(it worked well on the ATNGW100)
with the same driver source.

What I notice is that the current driver (atmel_mci.c)
nowhere sets the MMCI_SDCR register, therefore using
the bus in 1 bit mode. But that is the case in the AVR32
case as well, and there MCI did work...

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


Re: [U-Boot] AT91SAM9xxx SDCard/MMC support?

2010-07-01 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:
 TOP9000  mmc init
 Manufacturer ID:   19
 OEM/Application ID:4459
 Product name:  SMISD
 Product Revision:  1.0
 Product Serial Number: 29683
 Manufacturing Date:05/04
 SD Card detected (RCA 45928)
 CSD data: 005e0032 1f5983d0 6db7bf9f 9645
 CSD structure version:   1.2
 MMC System Spec version: 12
 Card command classes:3d0
 Read block length:   256
 Supports partial reads
 Write block length:  1
 Does not support partial writes
 Does not support group WP
 Card capacity:  131072000 bytes
 File format:1/2
 Write protection: permanent
 Card does not support 512 byte reads, aborting.
 No MMC card found
on AVR32 the ouput is:
top7000 mmc init
Manufacturer ID:   19
OEM/Application ID:4459
Product name:  SMISD
Product Revision:  1.0
Product Serial Number: 29683
Manufacturing Date:05/04
SD Card detected (RCA 45928)
CSD data: 005e0032 1f5983d0 6db7bf9f 9645
CSD structure version:   1.0
MMC System Spec version: 0
Card command classes:1f5
Read block length:   512
Supports partial reads
Write block length:  512
Does not support partial writes
Supports group WP:  32
Card capacity:  1023934464 bytes
File format:0/0
Write protection:
mmc: Using 262144 cycles data timeout (DTOR=0x64)

*** the CSD Data is the same, the interpretation of
non-byte values is different. Looks like an alignment
or byteswap issue...

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


[U-Boot] [PATCH] Fix (null) problem for AVR32 boards

2010-06-14 Thread Reinhard Meyer (-VC)
Currently the U-Boot address ranges for AVR32 boards are
printed like this:
U-Boot code: (null) - 0001183c  data: 000188e8 - 0004e9b0
This patch fixes this to print:
U-Boot code:  - 0001183c  data: 000188f8 - 0004e9c0

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de
---
 arch/avr32/lib/board.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 6be5ab0..c6b1f7b 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -115,8 +115,9 @@ static int init_baudrate(void)
 static int display_banner (void)
 {
printf (\n\n%s\n\n, version_string);
-   printf (U-Boot code: %p - %p  data: %p - %p\n,
-   _text, _etext, _data, _end);
+   printf (U-Boot code: %08lx - %08lx  data: %08lx - %08lx\n,
+   (unsigned long)_text, (unsigned long)_etext,
+   (unsigned long)_data, (unsigned long)_end);
return 0;
 }
 
-- 
1.5.6.5


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


Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU Module (3rd try)

2010-06-08 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:
 Add support for EMK TOP7000 CPU Module
 
 Specifics:
 
 1) create subdir board/emk/top7000 and files in it
 2) create include/configs/top7000.h
 3) update board/emk/common/vpd.c
 4) add call to misc_init_r() to arch/avr32/lib/board.c
 5) create arch/avr32/include/asm/unaligned.h to
fix zlib.c compilation problem
 6) update Makefile, MAINTAINERS, MAKEALL
 
 Signed-off-by: Reinhard Meyer i...@emk-elektronik.de

Hi,

was this my patch overseen now? Its from 6.6.2010...

Reinhard

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


Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU module

2010-06-06 Thread Reinhard Meyer (-VC)
Hello,

is this patch going to be accepted, or is someone insisting that only
my port shall return the number of controllers initialized?

Reinhard Meyer schrieb:
 Ben Warren schrieb:
 Hello Reinhard,

 On Sat, Jun 5, 2010 at 3:41 AM, Reinhard Meyer (-VC) 
 reinhard.me...@emk-elektronik.de wrote:

 Add support for EMK TOP7000 CPU module

 Specifics:

 1) create subdir board/emk/top7000 and files in it
 2) create include/configs/top7000.h
 3) update board/emk/common/vpd.c
 4) add call to misc_init_r() to arch/avr32/lib/board.c
 5) create arch/avr32/include/asm/unaligned.h to
   fix zlib.c compilation problem
 6) update Makefile, MAINTAINERS, MAKEALL

 Signed-off-by: Reinhard Meyer i...@emk-elektronik.de

 ---
  MAINTAINERS|6 +-
  MAKEALL|3 +-
  Makefile   |3 +
  arch/avr32/include/asm/unaligned.h |1 +
  arch/avr32/lib/board.c |5 +
  board/emk/common/vpd.c |   56 +-
  board/emk/top7000/Makefile |   41 +++
  board/emk/top7000/config.mk|3 +
  board/emk/top7000/top7000.c|  169 
  board/emk/top7000/u-boot.lds   |   72 
  include/configs/top7000.h  |  216
 
  11 files changed, 570 insertions(+), 5 deletions(-)
  create mode 100644 arch/avr32/include/asm/unaligned.h
  create mode 100644 board/emk/top7000/Makefile
  create mode 100644 board/emk/top7000/config.mk
  create mode 100644 board/emk/top7000/top7000.c
  create mode 100644 board/emk/top7000/u-boot.lds
  create mode 100644 include/configs/top7000.h

 diff --git a/MAINTAINERS b/MAINTAINERS
 index 7a13d28..a361be1 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -311,7 +311,7 @@ Andrea llandre Marson andrea.mar...@dave-tech.it

PPChameleonEVB  PPC405EP

 -Reinhard Meyer r.me...@emk-elektronik.de
 +Reinhard Meyer reinhard.me...@emk-elektronik.de

TOP860  MPC860T
TOP5200 MPC5200
 @@ -919,6 +919,10 @@ Julien May julien@miromico.ch

HAMMERHEAD  AT32AP7000

 +Reinhard Meyer reinhard.me...@emk-elektronik.de
 +
 +   TOP7000 AT32AP7000
 +
  Haavard Skinnemoen haavard.skinnem...@atmel.com

ATSTK1000   AT32AP7xxx
 diff --git a/MAKEALL b/MAKEALL
 index 2527352..3a80041 100755
 --- a/MAKEALL
 +++ b/MAKEALL
 @@ -873,7 +873,8 @@ LIST_avr32=\
atngw100\
favr-32-ezkit   \
hammerhead  \
 -   mimc200 \
 +   mimc200 \
 +   top7000 \
  

  #
 diff --git a/Makefile b/Makefile
 index c26e491..e57a4ca 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -3549,6 +3549,9 @@ hammerhead_config :   unconfig
  mimc200_config :   unconfig
@$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x

 +top7000_config :   unconfig
 +   @$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
 +
  #
  # SH3 (SuperH)
  #
 diff --git a/arch/avr32/include/asm/unaligned.h
 b/arch/avr32/include/asm/unaligned.h
 new file mode 100644
 index 000..6cecbbb
 --- /dev/null
 +++ b/arch/avr32/include/asm/unaligned.h
 @@ -0,0 +1 @@
 +#include asm-generic/unaligned.h
 diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
 index 917ed6c..6be5ab0
 --- a/arch/avr32/lib/board.c
 +++ b/arch/avr32/lib/board.c
 @@ -337,6 +337,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
jumptable_init();
console_init_r();

 +#if defined(CONFIG_MISC_INIT_R)
 +   /* miscellaneous platform dependent initialisations */
 +   misc_init_r();
 +#endif
 +
s = getenv(loadaddr);
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
 index c2af219..a6c456b
 --- a/board/emk/common/vpd.c
 +++ b/board/emk/common/vpd.c
 @@ -1,6 +1,6 @@
  /*
 - * (C) Copyright 2003
 - * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
 + * (C) Copyright 2003-2010
 + * EMK Elektronik GmbH  Co. KG, reinhard.me...@emk-elektronik.de
  *
  * See file CREDITS for list of people who contributed to this
  * project.
 @@ -22,7 +22,8 @@
  */

  #include common.h
 -
 +#include command.h
 +

  
 /*
  * read factory part of EEPROM and set some environment variables

  
 */
 @@ -70,6 +71,10 @@ void read_factory_r (void)
/* search for our specific entry */
if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
setenv (ethaddr, (char *)(buf + 19));
 +#if defined

Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU module

2010-06-06 Thread Reinhard Meyer (-VC)
Wolfgang Denk schrieb:
 Dear Reinhard Meyer (-VC),
 
 In message 4c0b85d8.4070...@emk-elektronik.de you wrote:
 is this patch going to be accepted, or is someone insisting that only
 my port shall return the number of controllers initialized?
 
 I don't understand what you mean by only my port. Ben's comment that
 board_eth_init() is supposed to retrurn the number of  successfully
 initialized controllers has been standard policy for a pretty long
 time, and many boards do so.
 
 Eventually the boards you compared against are older ones, and have
 not been maintained well, so they misbehave in this regard?
 
 Best regards,
 
 Wolfgang Denk
 


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


Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU module

2010-06-06 Thread Reinhard Meyer (-VC)
Wolfgang Denk schrieb:
 Dear Reinhard Meyer (-VC),
 
 In message 4c0b85d8.4070...@emk-elektronik.de you wrote:
 is this patch going to be accepted, or is someone insisting that only
 my port shall return the number of controllers initialized?
 
 I don't understand what you mean by only my port. Ben's comment that
 board_eth_init() is supposed to retrurn the number of  successfully
 initialized controllers has been standard policy for a pretty long
 time, and many boards do so.
 
 Eventually the boards you compared against are older ones, and have
 not been maintained well, so they misbehave in this regard?
 
 Best regards,
 
 Wolfgang Denk
 

Hello Wolfgang,

Is that documented somewhere? I see that the calling function in net.c
does NOT care about any positive interger result. Will it care sometime
in the future? :)

The second problem is that I cannot seem to undo my previous commit in my
tree, so any changes I do to my source would come out as a second patch.
Would that be accepted?

Or do you know what must be done that GIT will issue a new patch with the
current and the new changes in one patch?

I generate the patches by
after editing:
git commit -m message
git format-patch origin

what to do to return to after editing, do new edits and generate a new,
single patch?

Best Regards, Reinhard

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


Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU module

2010-06-06 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:
 Wolfgang Denk schrieb:
 Dear Reinhard Meyer (-VC),
 The second problem is that I cannot seem to undo my previous commit in my
 tree, so any changes I do to my source would come out as a second patch.
 Would that be accepted?
 
 Or do you know what must be done that GIT will issue a new patch with the
 current and the new changes in one patch?
 
 I generate the patches by
 after editing:
 git commit -m message
 git format-patch origin
 
 what to do to return to after editing, do new edits and generate a new,
 single patch?
 
A git reset --soft HEAD^ followed by git add of all newly
changed files does the trick...
 Best Regards, Reinhard
 

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


[U-Boot] [PATCH] add support for EMK TOP7000 CPU Module (2nd try)

2010-06-06 Thread Reinhard Meyer (-VC)
Add support for EMK TOP7000 CPU Module

Specifics:

1) create subdir board/emk/top7000 and files in it
2) create include/configs/top7000.h
3) update board/emk/common/vpd.c
4) add call to misc_init_r() to arch/avr32/lib/board.c
5) create arch/avr32/include/asm/unaligned.h to
   fix zlib.c compilation problem
6) update Makefile, MAINTAINERS, MAKEALL

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de

---
 MAINTAINERS|6 +-
 MAKEALL|3 +-
 Makefile   |3 +
 arch/avr32/include/asm/unaligned.h |1 +
 arch/avr32/lib/board.c |5 +
 board/emk/common/vpd.c |   71 +++-
 board/emk/top7000/Makefile |   41 +++
 board/emk/top7000/config.mk|3 +
 board/emk/top7000/top7000.c|  174 +
 board/emk/top7000/u-boot.lds   |   72 
 include/configs/top7000.h  |  217 
 11 files changed, 588 insertions(+), 8 deletions(-)
 create mode 100644 arch/avr32/include/asm/unaligned.h
 create mode 100644 board/emk/top7000/Makefile
 create mode 100644 board/emk/top7000/config.mk
 create mode 100644 board/emk/top7000/top7000.c
 create mode 100644 board/emk/top7000/u-boot.lds
 create mode 100644 include/configs/top7000.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a13d28..a361be1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ Andrea llandre Marson andrea.mar...@dave-tech.it
 
PPChameleonEVB  PPC405EP
 
-Reinhard Meyer r.me...@emk-elektronik.de
+Reinhard Meyer reinhard.me...@emk-elektronik.de
 
TOP860  MPC860T
TOP5200 MPC5200
@@ -919,6 +919,10 @@ Julien May julien@miromico.ch
 
HAMMERHEAD  AT32AP7000
 
+Reinhard Meyer reinhard.me...@emk-elektronik.de
+
+   TOP7000 AT32AP7000
+
 Haavard Skinnemoen haavard.skinnem...@atmel.com
 
ATSTK1000   AT32AP7xxx
diff --git a/MAKEALL b/MAKEALL
index 2527352..3a80041 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -873,7 +873,8 @@ LIST_avr32=\
atngw100\
favr-32-ezkit   \
hammerhead  \
-   mimc200 \
+   mimc200 \
+   top7000 \
 
 
 #
diff --git a/Makefile b/Makefile
index c26e491..e57a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -3549,6 +3549,9 @@ hammerhead_config :   unconfig
 mimc200_config :   unconfig
@$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
+top7000_config :   unconfig
+   @$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
+
 #
 # SH3 (SuperH)
 #
diff --git a/arch/avr32/include/asm/unaligned.h 
b/arch/avr32/include/asm/unaligned.h
new file mode 100644
index 000..6cecbbb
--- /dev/null
+++ b/arch/avr32/include/asm/unaligned.h
@@ -0,0 +1 @@
+#include asm-generic/unaligned.h
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 917ed6c..6be5ab0 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -337,6 +337,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
jumptable_init();
console_init_r();
 
+#if defined(CONFIG_MISC_INIT_R)
+   /* miscellaneous platform dependent initialisations */
+   misc_init_r();
+#endif
+
s = getenv(loadaddr);
if (s)
load_addr = simple_strtoul(s, NULL, 16);
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index c2af219..d2c8af2 100644
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2003
- * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
+ * (C) Copyright 2003-2010
+ * EMK Elektronik GmbH  Co. KG, reinhard.me...@emk-elektronik.de
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,10 +22,9 @@
  */
 
 #include common.h
-
-/*
- * read factory part of EEPROM and set some environment variables
- */
+#include command.h
+
+/* read factory part of EEPROM and set some environment variables */
 void read_factory_r (void)
 {
/* read 'factory' part of EEPROM */
@@ -70,6 +69,10 @@ void read_factory_r (void)
/* search for our specific entry */
if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
setenv (ethaddr, (char *)(buf + 19));
+#if defined(CONFIG_TOP7000)
+   } else if (!strncmp ((char *) buf, [RLA/lan2/Ethernet] , 20)) 
{
+   setenv (eth1addr, (char *)(buf + 20));
+#endif
} else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15)) {

Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU Module (2nd try)

2010-06-06 Thread Reinhard Meyer (-VC)
Reinhard Meyer (-VC) schrieb:

if anything can go wrong, it will go wrong...

a 0x0d (CR) sneaked into the following line:

   hammerhead  \
 - mimc200 \
 + mimc200 \
 + top7000 \

Please do not try to apply the patch. I will send a new one!

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


[U-Boot] [PATCH] add support for EMK TOP7000 CPU Module (3rd try)

2010-06-06 Thread Reinhard Meyer (-VC)
Add support for EMK TOP7000 CPU Module

Specifics:

1) create subdir board/emk/top7000 and files in it
2) create include/configs/top7000.h
3) update board/emk/common/vpd.c
4) add call to misc_init_r() to arch/avr32/lib/board.c
5) create arch/avr32/include/asm/unaligned.h to
   fix zlib.c compilation problem
6) update Makefile, MAINTAINERS, MAKEALL

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de

---
 MAINTAINERS|6 +-
 MAKEALL|1 +
 Makefile   |3 +
 arch/avr32/include/asm/unaligned.h |1 +
 arch/avr32/lib/board.c |5 +
 board/emk/common/vpd.c |   71 +++-
 board/emk/top7000/Makefile |   41 +++
 board/emk/top7000/config.mk|3 +
 board/emk/top7000/top7000.c|  174 +
 board/emk/top7000/u-boot.lds   |   72 
 include/configs/top7000.h  |  217 
 11 files changed, 587 insertions(+), 7 deletions(-)
 create mode 100644 arch/avr32/include/asm/unaligned.h
 create mode 100644 board/emk/top7000/Makefile
 create mode 100644 board/emk/top7000/config.mk
 create mode 100644 board/emk/top7000/top7000.c
 create mode 100644 board/emk/top7000/u-boot.lds
 create mode 100644 include/configs/top7000.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a13d28..a361be1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ Andrea llandre Marson andrea.mar...@dave-tech.it
 
PPChameleonEVB  PPC405EP
 
-Reinhard Meyer r.me...@emk-elektronik.de
+Reinhard Meyer reinhard.me...@emk-elektronik.de
 
TOP860  MPC860T
TOP5200 MPC5200
@@ -919,6 +919,10 @@ Julien May julien@miromico.ch
 
HAMMERHEAD  AT32AP7000
 
+Reinhard Meyer reinhard.me...@emk-elektronik.de
+
+   TOP7000 AT32AP7000
+
 Haavard Skinnemoen haavard.skinnem...@atmel.com
 
ATSTK1000   AT32AP7xxx
diff --git a/MAKEALL b/MAKEALL
index 2527352..016f6ef 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -874,6 +874,7 @@ LIST_avr32=\
favr-32-ezkit   \
hammerhead  \
mimc200 \
+   top7000 \
 
 
 #
diff --git a/Makefile b/Makefile
index c26e491..e57a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -3549,6 +3549,9 @@ hammerhead_config :   unconfig
 mimc200_config :   unconfig
@$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
+top7000_config :   unconfig
+   @$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
+
 #
 # SH3 (SuperH)
 #
diff --git a/arch/avr32/include/asm/unaligned.h 
b/arch/avr32/include/asm/unaligned.h
new file mode 100644
index 000..6cecbbb
--- /dev/null
+++ b/arch/avr32/include/asm/unaligned.h
@@ -0,0 +1 @@
+#include asm-generic/unaligned.h
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 917ed6c..6be5ab0 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -337,6 +337,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
jumptable_init();
console_init_r();
 
+#if defined(CONFIG_MISC_INIT_R)
+   /* miscellaneous platform dependent initialisations */
+   misc_init_r();
+#endif
+
s = getenv(loadaddr);
if (s)
load_addr = simple_strtoul(s, NULL, 16);
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index c2af219..d2c8af2 100644
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2003
- * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
+ * (C) Copyright 2003-2010
+ * EMK Elektronik GmbH  Co. KG, reinhard.me...@emk-elektronik.de
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,10 +22,9 @@
  */
 
 #include common.h
-
-/*
- * read factory part of EEPROM and set some environment variables
- */
+#include command.h
+
+/* read factory part of EEPROM and set some environment variables */
 void read_factory_r (void)
 {
/* read 'factory' part of EEPROM */
@@ -70,6 +69,10 @@ void read_factory_r (void)
/* search for our specific entry */
if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
setenv (ethaddr, (char *)(buf + 19));
+#if defined(CONFIG_TOP7000)
+   } else if (!strncmp ((char *) buf, [RLA/lan2/Ethernet] , 20)) 
{
+   setenv (eth1addr, (char *)(buf + 20));
+#endif
} else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15)) {
setenv (serial#, (char 

[U-Boot] Warnings when compiling for AVR32 boards

2010-06-06 Thread Reinhard Meyer (-VC)
During ./MAKEALL avr32 at least my toolchain gives the following warnings for 
every board:

Configuring for atstk1002 board...
atmel_usart.c:21:2: warning: #warning Please update to use C structur SoC 
access !
cmd_bdinfo.c: In function 'do_bdinfo':
cmd_bdinfo.c:295: warning: format '%d' expects type 'int', but argument 2 has 
type 'long unsigned int'
   textdata bss dec hex filename
  915877136  211712  310435   4bca3 ./u-boot
same for all boards

atmel_usart.c:

that is more or less a TODO warning, it should probably be removed or the
structure approach be implemented. And is it wise to directly pointer access 
hardware,
even if the AVR32 hardware allows that without cache problems?


cmd_bdinfo.c:

this is because
printf (baudrate= %d bps\n, bd-bi_baudrate);
but
AVR32 bd_t has unsigned long bi_baudrate
and there is no explicit case for avr32 architecture, so the code under
/* ! PPC, which leaves MIPS */
is compiled and used!

The current architecture specific #if chain in cmd_bdinfo.c is as follows:

#ifndef CONFIG_ARM  /* PowerPC and other */
 #ifdef CONFIG_PPC
 #elif defined(CONFIG_NIOS2) /* Nios-II */
 #elif defined(CONFIG_MICROBLAZE) /* ! PPC, which leaves Microblaze */
 #elif defined(CONFIG_SPARC)/* SPARC */
 #elif defined(CONFIG_M68K) /* M68K */
 #elif defined(CONFIG_BLACKFIN)
 #else /* ! PPC, which leaves MIPS */
AVR32 falls into here 
 #endif  /* MIPS */
#else   /* ARM */
#endif /* CONFIG_ARM XXX */

Would it not be better to include ARM in the #elif chain as well, and of course
add AVR32 in a similiar way:
#if defined(CONFIG_PPC)
#elif defined(CONFIG_NIOS2)
#elif defined(CONFIG_MICROBLAZE)
#elif defined(CONFIG_SPARC)
#elif defined(CONFIG_M68K)
#elif defined(CONFIG_BLACKFIN)
#elif defined(CONFIG_MIPS)
#elif defined(CONFIG_AVR32)
#elif defined(CONFIG_ARM)
#else
  #error a case for this architecture does not exist
#endif

I can rework that and submit a patch, but I cannot MAKEALL all the 
architectures.
However the changes should be straightforward and involve little risk breaking
something.

Reinhard

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


[U-Boot] [PATCH] add support for EMK TOP7000 CPU module

2010-06-05 Thread Reinhard Meyer (-VC)
Add support for EMK TOP7000 CPU module

Specifics:

1) create subdir board/emk/top7000 and files in it
2) create include/configs/top7000.h
3) update board/emk/common/vpd.c
4) add call to misc_init_r() to arch/avr32/lib/board.c
5) create arch/avr32/include/asm/unaligned.h to
   fix zlib.c compilation problem
6) update Makefile, MAINTAINERS, MAKEALL

Signed-off-by: Reinhard Meyer i...@emk-elektronik.de

---
 MAINTAINERS|6 +-
 MAKEALL|3 +-
 Makefile   |3 +
 arch/avr32/include/asm/unaligned.h |1 +
 arch/avr32/lib/board.c |5 +
 board/emk/common/vpd.c |   56 +-
 board/emk/top7000/Makefile |   41 +++
 board/emk/top7000/config.mk|3 +
 board/emk/top7000/top7000.c|  169 
 board/emk/top7000/u-boot.lds   |   72 
 include/configs/top7000.h  |  216 
 11 files changed, 570 insertions(+), 5 deletions(-)
 create mode 100644 arch/avr32/include/asm/unaligned.h
 create mode 100644 board/emk/top7000/Makefile
 create mode 100644 board/emk/top7000/config.mk
 create mode 100644 board/emk/top7000/top7000.c
 create mode 100644 board/emk/top7000/u-boot.lds
 create mode 100644 include/configs/top7000.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a13d28..a361be1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ Andrea llandre Marson andrea.mar...@dave-tech.it
 
PPChameleonEVB  PPC405EP
 
-Reinhard Meyer r.me...@emk-elektronik.de
+Reinhard Meyer reinhard.me...@emk-elektronik.de
 
TOP860  MPC860T
TOP5200 MPC5200
@@ -919,6 +919,10 @@ Julien May julien@miromico.ch
 
HAMMERHEAD  AT32AP7000
 
+Reinhard Meyer reinhard.me...@emk-elektronik.de
+
+   TOP7000 AT32AP7000
+
 Haavard Skinnemoen haavard.skinnem...@atmel.com
 
ATSTK1000   AT32AP7xxx
diff --git a/MAKEALL b/MAKEALL
index 2527352..3a80041 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -873,7 +873,8 @@ LIST_avr32=\
atngw100\
favr-32-ezkit   \
hammerhead  \
-   mimc200 \
+   mimc200 \
+   top7000 \
 
 
 #
diff --git a/Makefile b/Makefile
index c26e491..e57a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -3549,6 +3549,9 @@ hammerhead_config :   unconfig
 mimc200_config :   unconfig
@$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
+top7000_config :   unconfig
+   @$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
+
 #
 # SH3 (SuperH)
 #
diff --git a/arch/avr32/include/asm/unaligned.h 
b/arch/avr32/include/asm/unaligned.h
new file mode 100644
index 000..6cecbbb
--- /dev/null
+++ b/arch/avr32/include/asm/unaligned.h
@@ -0,0 +1 @@
+#include asm-generic/unaligned.h
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 917ed6c..6be5ab0
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -337,6 +337,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
jumptable_init();
console_init_r();
 
+#if defined(CONFIG_MISC_INIT_R)
+   /* miscellaneous platform dependent initialisations */
+   misc_init_r();
+#endif
+
s = getenv(loadaddr);
if (s)
load_addr = simple_strtoul(s, NULL, 16);
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index c2af219..a6c456b
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2003
- * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
+ * (C) Copyright 2003-2010
+ * EMK Elektronik GmbH  Co. KG, reinhard.me...@emk-elektronik.de
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,7 +22,8 @@
  */
 
 #include common.h
-
+#include command.h
+
 /*
  * read factory part of EEPROM and set some environment variables
  */
@@ -70,6 +71,10 @@ void read_factory_r (void)
/* search for our specific entry */
if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
setenv (ethaddr, (char *)(buf + 19));
+#if defined(CONFIG_TOP7000)
+   } else if (!strncmp ((char *) buf, [RLA/lan2/Ethernet] , 20)) 
{
+   setenv (eth1addr, (char *)(buf + 20));
+#endif
} else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15)) {
setenv (serial#, (char *)(buf + 15));
} else if (!strncmp ((char *) buf, [BOARD/TYPE] , 13)) {
@@ -77,3 +82,48 @@ void 

[U-Boot] [PATCH] add support for EMK TOP7000 CPU module (new files)

2010-06-04 Thread Reinhard Meyer (-VC)
This Patch adds support for the EMK TOP7000 CPU Module
Part 1: new files

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de


---
 board/emk/top7000/Makefile   |   41 
 board/emk/top7000/config.mk  |3 +
 board/emk/top7000/top7000.c  |  165 
 board/emk/top7000/u-boot.lds |   72 ++
 include/configs/top7000.h|  214 
++
 5 files changed, 495 insertions(+), 0 deletions(-)
 create mode 100644 board/emk/top7000/Makefile
 create mode 100644 board/emk/top7000/config.mk
 create mode 100644 board/emk/top7000/top7000.c
 create mode 100644 board/emk/top7000/u-boot.lds
 create mode 100644 include/configs/top7000.h

diff --git a/board/emk/top7000/Makefile b/board/emk/top7000/Makefile
new file mode 100644
index 000..a36cc86
--- /dev/null
+++ b/board/emk/top7000/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2005-2006 Atmel Corporation
+# Copyright (C) 2010 EMK Elektronik
+#
+# 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:= $(BOARD).o ../common/vpd.o
+
+SRCS:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+$(LIB): $(obj).depend $(OBJS)
+$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/emk/top7000/config.mk b/board/emk/top7000/config.mk
new file mode 100644
index 000..9a794e5
--- /dev/null
+++ b/board/emk/top7000/config.mk
@@ -0,0 +1,3 @@
+TEXT_BASE= 0x
+PLATFORM_RELFLAGS+= -ffunction-sections -fdata-sections
+PLATFORM_LDFLAGS+= --gc-sections
diff --git a/board/emk/top7000/top7000.c b/board/emk/top7000/top7000.c
new file mode 100644
index 000..a8edb91
--- /dev/null
+++ b/board/emk/top7000/top7000.c
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2006 Atmel Corporation
+ * COpyright (C) 2010 EMK Elektronik
+ *
+ * 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/sdram.h
+#include asm/arch/clk.h
+#include asm/arch/gpio.h
+#include asm/arch/hmatrix.h
+#include asm/arch/portmux.h
+#include netdev.h
+#include i2c.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct sdram_config sdram_config = {
+.data_bits= SDRAM_DATA_16BIT,
+.row_bits= 13,
+.col_bits= 9,
+.bank_bits= 2,
+.cas= 3,
+.twr= 2,
+.trc= 7,
+.trp= 2,
+.trcd= 2,
+.tras= 5,
+.txsr= 5,
+/* 7.81 us */
+.refresh_period= (781 * (SDRAMC_BUS_HZ / 1000)) / 10,
+};
+
+int board_early_init_f(void)
+{
+/* Enable SDRAM in the EBI mux */
+hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
+
+/* 16 data, 26 address lines */
+portmux_enable_ebi(16, 26, 0, PORTMUX_DRIVE_HIGH);
+portmux_enable_usart1(PORTMUX_DRIVE_MIN);
+
+#if defined(CONFIG_MACB)
+portmux_enable_macb0(PORTMUX_MACB_MII, PORTMUX_DRIVE_HIGH);
+portmux_enable_macb1(PORTMUX_MACB_MII, PORTMUX_DRIVE_HIGH);
+#endif
+#if defined(CONFIG_MMC)
+portmux_enable_mmci(0, PORTMUX_MMCI_4BIT, PORTMUX_DRIVE_LOW);
+#endif
+#if defined(CONFIG_ATMEL_SPI)
+portmux_enable_spi0(1  0, PORTMUX_DRIVE_LOW);
+#endif
+#ifdef CONFIG_CMD_I2C
+// first 

[U-Boot] [PATCH] add support for EMK TOP7000 CPU module (modified files)

2010-06-04 Thread Reinhard Meyer (-VC)
This Patch adds support for the EMK TOP7000 CPU Module
Part 2: modified files

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de


---
 MAINTAINERS   |6 -
 Makefile  |3 ++
 board/emk/common/vpd.c|   57 

 3 files changed, 59 insertions(+), 7 deletions(-)
 mode change 100755 = 100644 include/configs/top7000.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a13d28..9d5540a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ Andrea llandre Marson andrea.mar...@dave-tech.it
 
 PPChameleonEVBPPC405EP
 
-Reinhard Meyer r.me...@emk-elektronik.de
+Reinhard Meyer reinhard.me...@emk-elektronik.de
 
 TOP860MPC860T
 TOP5200MPC5200
@@ -928,6 +928,10 @@ Haavard Skinnemoen haavard.skinnem...@atmel.com
 ATSTK1006AT32AP7000
 ATNGW100AT32AP7000
 
+Reinhard Meyer reinhard.me...@emk-elektronik.de
+
+TOP7000AT32AP7000
+
 #
 # SuperH Systems:#
 ##
diff --git a/Makefile b/Makefile
index c26e491..e57a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -3549,6 +3549,9 @@ hammerhead_config:unconfig
 mimc200_config:unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
+top7000_config:unconfig
+@$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
+
 #
 # SH3 (SuperH)
 #
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index c2af219..50776bd 100644
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2003
- * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
+ * (C) Copyright 2003-2010
+ * Reinhard Meyer, EMK Elektronik
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,6 +22,7 @@
  */
 
 #include common.h
+#include command.h
 
 /*
  * read factory part of EEPROM and set some environment variables
@@ -68,12 +69,56 @@ void read_factory_r (void)
 addr += p - buf;
 /*printf (%s\n, buf); */
 /* search for our specific entry */
-if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
+if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19))
 setenv (ethaddr, (char *)(buf + 19));
-} else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15)) {
+#if defined(CONFIG_TOP7000)
+/* boards that have 2 LAN interfaces */
+else if (!strncmp ((char *) buf, [RLA/lan2/Ethernet] , 20))
+setenv (eth1addr, (char *)(buf + 20));
+#endif
+else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15))
 setenv (serial#, (char *)(buf + 15));
-} else if (!strncmp ((char *) buf, [BOARD/TYPE] , 13)) {
+else if (!strncmp ((char *) buf, [BOARD/TYPE] , 13))
 setenv (board_id, (char *)(buf + 13));
-}
 }
 }
+
+#if defined(CONFIG_TOP7000)
+int do_vpd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+uchar buf[512];
+uchar *p;
+int i;
+u_int addr;
+
+if (argc != 3)
+return 1;
+
+p = buf+2;
+i = simple_strtoul(argv[1], NULL, 10);
+if (i1 || i32766)
+return 1;
+
+addr=(i-1)*2;
+
+p+=sprintf((char*)p, [RLA/lan/Ethernet] 00:80:d9:0d:%02x:%02x\n,
+addr/256, addr%256);
+addr++;
+p+=sprintf((char*)p, [RLA/lan2/Ethernet] 00:80:d9:0d:%02x:%02x\n,
+addr/256, addr%256);
+p+=sprintf((char*)p, [BOARD/SERIAL] %05d\n, i);
+p+=sprintf((char*)p, [BOARD/TYPE] %s\n, argv[2]);
+
+i = p-buf-2;
+buf[0]=i;
+buf[1]=i8;
+if (eeprom_write (CONFIG_SYS_I2C_FACT_ADDR, CONFIG_SYS_FACT_OFFSET, 
buf, i+2)) {
+printf (cannot write factory configuration\n);
+return 1;
+}
+
+return 0;
+}
+
+U_BOOT_CMD(vpd,3,0,do_vpd, enter vital product data, 
serialnumer type);
+#endif
diff --git a/include/configs/top7000.h b/include/configs/top7000.h
old mode 100755
new mode 100644
-- 
1.5.6.5


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


[U-Boot] [PATCH] add support for EMK TOP7000 CPU module (change to arch-avr32 file)

2010-06-04 Thread Reinhard Meyer (-VC)
This Patch adds support for the EMK TOP7000 CPU Module
Part 3: added code to arch/avr32/lib/board.c

Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de


---
 arch/avr32/lib/board.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 917ed6c..57e1a2f 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -337,6 +337,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 jumptable_init();
 console_init_r();
 
+#if defined(CONFIG_MISC_INIT_R)
+/* miscellaneous platform dependent initialisations */
+misc_init_r ();
+#endif
+
 s = getenv(loadaddr);
 if (s)
 load_addr = simple_strtoul(s, NULL, 16);
-- 
1.5.6.5



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


Re: [U-Boot] [PATCH] add support for EMK TOP7000 CPU module (modified files)

2010-06-04 Thread Reinhard Meyer (-VC)
Wolfgang Denk schrieb:
 Dear Reinhard Meyer (-VC),

 In message 4c08ed38.8030...@emk-elektronik.de you wrote:
   
 This Patch adds support for the EMK TOP7000 CPU Module
 Part 2: modified files

 Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de


 ---
  MAINTAINERS   |6 -
  Makefile  |3 ++
  board/emk/common/vpd.c|   57 
 
 

 Fix your mailer, it is wrapping lines!
   
I will investigate on that. Using Thunderbird, should have settings for 
that.
   
 @@ -928,6 +928,10 @@ Haavard Skinnemoen haavard.skinnem...@atmel.com
  ATSTK1006AT32AP7000
  ATNGW100AT32AP7000
  
 +Reinhard Meyer reinhard.me...@emk-elektronik.de
 

 Please keep lists sorted - M  S
   
Well, what about that situation (two names as maintainers for HAMMERHEAD),
where do I sort in?

Mark Jackson m...@mimc.co.uk

MIMC200AT32AP7000

Alex Raimondi alex.raimo...@miromico.ch
Julien May julien@miromico.ch

HAMMERHEADAT32AP7000

Reinhard Meyer reinhard.me...@emk-elektronik.de

TOP7000AT32AP7000

Haavard Skinnemoen haavard.skinnem...@atmel.com

   
 --- a/board/emk/common/vpd.c
 +++ b/board/emk/common/vpd.c
 @@ -1,6 +1,6 @@
  /*
 - * (C) Copyright 2003
 - * Reinhard Meyer, EMK Elektronik GmbH, r.me...@emk-elektronik.de
 + * (C) Copyright 2003-2010
 + * Reinhard Meyer, EMK Elektronik
 

 Please add mail address
   
I can do that. But is it really senseful to add an email address to each 
file?
E-Mail adresses can change. Also Rechtsform (GmbH - GmbH  Co. KG).
Shall that all be reflected in a simple copyright string?
   
 @@ -68,12 +69,56 @@ void read_factory_r (void)
  addr += p - buf;
  /*printf (%s\n, buf); */
  /* search for our specific entry */
 -if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19)) {
 +if (!strncmp ((char *) buf, [RLA/lan/Ethernet] , 19))
  setenv (ethaddr, (char *)(buf + 19));
 -} else if (!strncmp ((char *) buf, [BOARD/SERIAL] , 15)) {
 +#if defined(CONFIG_TOP7000)
 +/* boards that have 2 LAN interfaces */
 +else if (!strncmp ((char *) buf, [RLA/lan2/Ethernet] , 20))
 +setenv (eth1addr, (char *)(buf + 20));
 +#endif
 

 Curly braces are needed for multiline statements.
   
Not sure what is multiline here? its like
 if (cond1)
statement1;
else if (cond2)
statement2;
else if (cond3)
statement3;
 ...
   
 +if (eeprom_write (CONFIG_SYS_I2C_FACT_ADDR, CONFIG_SYS_FACT_OFFSET, 
 buf, i+2)) {
 +printf (cannot write factory configuration\n);
 

 All previous comments apply here, too (too long lines, wrapped lines,
 no spaces after function name, ...)

   
willco.

Best Regards
Reinhard


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


Re: [U-Boot] AVR32 AP700x - I2C somewhere?

2010-06-02 Thread Reinhard Meyer (-VC)
Andreas Bießmann schrieb:
 Am 01.06.2010 16:04, schrieb Reinhard Meyer (-VC):
   
 Hi,
 
 Dear Reinhard Meyer,

   
 has anyone started or completed work on an I2C driver for AP7000x?
 
 No ...
   
 If not, I am at least going to make SOFT I2C defines to read VPD from an 
 At24C64 EEPROM.
 
 But I've working soft-i2c here. There are still some other examples in
 u-boot how to interface a at24xx eeprom.
   
Thank you. That worked to verify my setup.
I was fooled by the AtTiny on the NGW100 which does try to slow I2C 
Transfers by pulling SCL low.
That feature however is NOT honored by the SOFT_I2C driver.
So accesses to my At24C64 had to fail. After removing the AtTiny it 
works fine :)
 custom board config file:
 ---8---
 /* i2c definitions */
 #define CONFIG_SOFT_I2C
 #if defined(CONFIG_SOFT_I2C)
 #define DEBUG_I2C
 #ifndef __ASSEMBLY__
 #include asm/arch/portmux.h
 #define MEDUCORE_SDA_PIN  6
 #define MEDUCORE_SCL_PIN  7

 #define I2C_ACTIVEportmux_select_gpio(PORTMUX_PORT_A,
 (1MEDUCORE_SDA_PIN), PORTMUX_DIR_OUTPUT|PORTMUX_INIT_LOW)
 #define I2C_TRISTATE  portmux_select_gpio(PORTMUX_PORT_A,
 (1MEDUCORE_SDA_PIN), PORTMUX_DIR_INPUT|PORTMUX_OPEN_DRAIN)
   
The functions ACTIVE and TRISTATE are not required when the Pins are 
initialized OUTPUT and OPENDRAIN as follows:

int board_early_init_f(void)
{
...
#ifdef CONFIG_CMD_I2C
// first select SCL and SDA gpio
portmux_select_gpio(PORTMUX_PORT_A,(1SDA_PIN), 
PORTMUX_DIR_OUTPUT|PORTMUX_INIT_LOW|PORTMUX_OPEN_DRAIN);
portmux_select_gpio(PORTMUX_PORT_A,(1SCL_PIN), 
PORTMUX_DIR_OUTPUT|PORTMUX_INIT_LOW|PORTMUX_OPEN_DRAIN);
// initialize i2c
i2c_init(1000, 0x27);
#endif
return 0;
}

The I2C Bus by definition is a wired-or bus, all devices must have open 
drain outputs for SDA and SCL!

Best Regards,
Reinhard

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