[U-Boot] [PATCH] nand booting support (SPL) for phyCORE-i.MX31

2008-11-29 Thread user
nand booting support (SPL) for phyCORE-i.MX31

This patch allows Phytec phyCORE-i.MX31 based system to boot from embed
NAND-flash memory.It not add support for NAND cmd and/or driver for U-BOOT,
it is only SPL for U-BOOT. For NAND support in U-BOOT I give refer to
Magnus Lilja's aug/2008 patch series for PDK/Litekit boards.
([U-Boot] [PATCH v3 4/6] i.MX31: Add i.MX31 NAND Flash Controller driver.;
MID [EMAIL PROTECTED])

Some note: by default, Phytec phyCORE-i.MX31 board (pcm-037 on pcm-970) is
not suitable for nand-bootloading, because of SW5 switchers block haven't
appropriate modes(8-bit, 2k page or 16-bit, 512B page) for BOOTPINS[4:0]
and nand-flash(8-bit mode, 512B page) contemporary. There is require to make
RESOLDER for really nand-booting either BOOTPIN state or JN1/2 and RN41/42.
This nand-spl work with 8-bit, 512B page size nand-flash.

Patch is applicable on v2008.10 release tag master branch.

Maxim Artamonov, scn1874 a t yandex d o t ru. Nov, 29, 2008
---
 MAKEALL |1 +
 Makefile|9 ++-
 board/imx31_phycore/config.mk   |   10 ++
 board/imx31_phycore/lowlevel_init.S |   29 ++-
 board/imx31_phycore/u-boot-nand.lds |   62 
 cpu/arm1136/start.S |   36 +--
 include/asm-arm/arch-mx31/mx31-regs.h   |   98 +++-
 include/configs/imx31_phycore.h |   58 +--
 nand_spl/board/imx31_phycore/Makefile   |   95 ++
 nand_spl/board/imx31_phycore/config.mk  |   33 +++
 nand_spl/board/imx31_phycore/u-boot.lds |   65 +
 nand_spl/nand_boot_mx31.c   |  160 +++
 12 files changed, 633 insertions(+), 23 deletions(-)
 create mode 100644 board/imx31_phycore/u-boot-nand.lds
 create mode 100644 nand_spl/board/imx31_phycore/Makefile
 create mode 100644 nand_spl/board/imx31_phycore/config.mk
 create mode 100644 nand_spl/board/imx31_phycore/u-boot.lds
 create mode 100644 nand_spl/nand_boot_mx31.c

diff --git a/MAKEALL b/MAKEALL
index 9ccb9ac..1f639a8 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -522,6 +522,7 @@ LIST_ARM11=\
apollon \
imx31_litekit   \
imx31_phycore   \
+   imx31_phycore_nand  \
mx31ads \
smdk6400\
 
diff --git a/Makefile b/Makefile
index 58b8331..7519dfe 100644
--- a/Makefile
+++ b/Makefile
@@ -353,7 +353,7 @@ $(NAND_SPL):$(VERSION_FILE) 
$(obj)include/autoconf.mk
$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
 $(U_BOOT_NAND):$(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
-   cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin  
$(obj)u-boot-nand.bin
+   cat $(obj)nand_spl/u-boot-spl-aligned.bin $(obj)u-boot.bin  
$(obj)u-boot-nand.bin
 
 $(ONENAND_IPL):$(VERSION_FILE) $(obj)include/autoconf.mk
$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
@@ -2805,6 +2805,13 @@ imx31_litekit_config : unconfig
 imx31_phycore_config   : unconfig
@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
 
+imx31_phycore_nand_config  : unconfig
+   @mkdir -p $(obj)include $(obj)board/imx31_phycore
+   @mkdir -p $(obj)nand_spl/board/imx31_phycore
+   @echo #define CONFIG_NAND_U_BOOT  $(obj)include/config.h
+   @$(MKCONFIG) -n $@ -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
+   @echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
+
 mx31ads_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
 
diff --git a/board/imx31_phycore/config.mk b/board/imx31_phycore/config.mk
index d34dc02..412defc 100644
--- a/board/imx31_phycore/config.mk
+++ b/board/imx31_phycore/config.mk
@@ -1 +1,11 @@
+#
+# (C) Copyright 2008
+# was changed by Maxim Artamonov, scn1874 at yandex.ru
+#
+
+ifndef CONFIG_NAND_SPL
 TEXT_BASE = 0x87f0
+else
+TEXT_BASE = 0x87ec
+endif
+
diff --git a/board/imx31_phycore/lowlevel_init.S 
b/board/imx31_phycore/lowlevel_init.S
index c5d6eb0..bd838c7 100644
--- a/board/imx31_phycore/lowlevel_init.S
+++ b/board/imx31_phycore/lowlevel_init.S
@@ -1,5 +1,7 @@
 /*
- *
+ * (C) Copyright 2008
+ * Maxim Artamonov, scn1874 at yandex.ru
+ * 
  * (c) 2007 Pengutronix, Sascha Hauer [EMAIL PROTECTED]
  *
  * See file CREDITS for list of people who contributed to this
@@ -43,6 +45,20 @@
bcs 1b
 .endm
 
+#ifdef CONFIG_NAND_SPL
+/* somewhat macro to reduce bin size for CONFIG_NAND_SPL*/
+.macro FILLREGS begreg, val, count, step
+   ldr r2, =\begreg
+   ldr r3, =\val
+   ldr r4, =\count
+2:
+   str r3, [r2]
+   add r2, r2, #\step
+   subsr4, r4, #1
+   bcs 2b
+.endm
+#endif
+
 .globl lowlevel_init
 lowlevel_init:
 
@@ -60,10 +76,20 @@ lowlevel_init:
 
REG CCM_SPCTL, PLL_PD(1) | PLL_MFD(0x43) | PLL_MFI(12) | PLL_MFN(1)
 
+   REG CCM_UPCTL, 0x40c2403 /* USB Clock 60 MHZ 

Re: [U-Boot] [PATCH] ne2000: take MAC address from config if available

2008-11-29 Thread Daniel Mack
Hi Ben,

On Fri, Nov 28, 2008 at 09:27:37PM -0800, Ben Warren wrote:
  the board I'm currently working on has an ASIX AX88796 NE2000 clone but
  no EEPROM attached to it. Hence, the get_prom() routine returns zeros
  only so the system won't work.
 
  This patch takes the MAC address given by CONFIG_ETHADDR and translates
  it to numeric values. This could probably go to some other, more generic
  place, but I didn't find any.
 
 
 CONFIG_ETHADDR is bad and shouldn't be used unless you only ever plan on
 building one board.  No new board ports will be accepted that define it.

I agree it's a hack, but in order to boot the board from ethernet, there
is need for something, even if it's not perfect.

 What would be better here, although it's still not very good, would be to
 have something like CONFIG_NE2000_NOPROM, and if defined, make a
 'getenv(ethaddr)' call and program the hardware with the return value
 (with proper error checking, of course).

I agree. See the patch below.

Thanks,
Daniel

This patch adds CONFIG_NE2000_NOPROM as configuration variable and reads
the 'ethaddr' setting from environment to set up the adapter.

Signed-off-by: Daniel Mack [EMAIL PROTECTED]

diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index f93f932..86c1380 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -669,7 +669,6 @@ void uboot_push_tx_done(int key, int val) {
 int eth_init(bd_t *bd) {
int r;
u8 dev_addr[6];
-   char ethaddr[20];
 
PRINTK(### eth_init\n);
 
@@ -693,16 +692,35 @@ int eth_init(bd_t *bd) {
 
nic.base = (u8 *) CONFIG_DRIVER_NE2000_BASE;
 
-   r = get_prom(dev_addr, nic.base);
-   if (!r)
-   return -1;
+#ifndef CONFIG_NE2000_NOPROM
+   {
+   char ethaddr[20];
+   r = get_prom(dev_addr, nic.base);
+   if (!r)
+   return -1;
+
+   sprintf (ethaddr, %02X:%02X:%02X:%02X:%02X:%02X,
+dev_addr[0], dev_addr[1],
+dev_addr[2], dev_addr[3],
+dev_addr[4], dev_addr[5]) ;
+   PRINTK(Set environment from HW MAC addr = \%s\\n, ethaddr);
+   setenv (ethaddr, ethaddr);
+   }
+#else /* CONFIG_NE2000_NOPROM */
+   {
+   char *s = getenv(ethaddr);
 
-   sprintf (ethaddr, %02X:%02X:%02X:%02X:%02X:%02X,
-dev_addr[0], dev_addr[1],
-dev_addr[2], dev_addr[3],
-dev_addr[4], dev_addr[5]) ;
-   PRINTK(Set environment from HW MAC addr = \%s\\n, ethaddr);
-   setenv (ethaddr, ethaddr);
+   if (!s) {
+   printf (CONFIG_NE2000_NOPROM set but no 
+   ethaddr given in environment.\n);
+   return -1;
+   }
+
+   /* convert the string notation */
+   for (r = 0; r  6; r++)
+   dev_addr[r] = simple_strtol(s + (r * 3), NULL, 16);
+   }
+#endif
 
nic.data = nic.base + DP_DATA;
nic.tx_buf1 = START_PG;
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Error compiling UBOOT 1.3.4 for AT91RM9200

2008-11-29 Thread Linux RegaTech
Hello UBOOT mailinglist

I have encountered a problem when i try to compile any newer version of UBOOT 
than V1.2.0 for AT91RM9200,
below is given the output from console when i try to compile the UBOOT V1.3.4 
for AT91RM9200,
could anybody please give me a hint what a solution to this problem might could 
be:

In file included from fdt_host.h:25,
 from mkimage.h:36,
 from mkimage.c:25:
../include/libfdt.h: In function `fdt_set_magic':
../include/libfdt.h:162: warning: implicit declaration of function 
`__cpu_to_be32'
In file included from mkimage.c:26:
/home/Rene/uboot134/include/image.h: At top level:
/home/Rene/uboot134/include/image.h:202: error: parse error before ulong
/home/Rene/uboot134/include/image.h:224: error: parse error before '}' token
/home/Rene/uboot134/include/image.h:334: error: parse error before 
image_get_data
/home/Rene/uboot134/include/image.h: In function `image_get_data':
/home/Rene/uboot134/include/image.h:336: error: `ulong' undeclared (first use 
in this function)
/home/Rene/uboot134/include/image.h:336: error: (Each undeclared identifier is 
reported only once
/home/Rene/uboot134/include/image.h:336: error: for each function it appears 
in.)
/home/Rene/uboot134/include/image.h:336: error: parse error before hdr
/home/Rene/uboot134/include/image.h: At top level:
/home/Rene/uboot134/include/image.h:343: error: parse error before 
image_get_image_end
/home/Rene/uboot134/include/image.h: In function `image_get_image_end':
/home/Rene/uboot134/include/image.h:345: error: `ulong' undeclared (first use 
in this function)
/home/Rene/uboot134/include/image.h:345: error: parse error before hdr
/home/Rene/uboot134/include/image.h: At top level:
/home/Rene/uboot134/include/image.h:402: error: parse error before 
image_multi_count
/home/Rene/uboot134/include/image.h:403: error: parse error before ulong
/home/Rene/uboot134/include/image.h:477: error: parse error before ulong
/home/Rene/uboot134/include/image.h:479: error: parse error before ulong
/home/Rene/uboot134/include/image.h:493: error: parse error before 
fit_get_size
/home/Rene/uboot134/include/image.h:505: error: parse error before fit_get_end
/home/Rene/uboot134/include/image.h: In function `fit_get_end':
/home/Rene/uboot134/include/image.h:507: error: `ulong' undeclared (first use 
in this function)
/home/Rene/uboot134/include/image.h:507: error: parse error before fit
/home/Rene/uboot134/include/image.h: At top level:
/home/Rene/uboot134/include/image.h:532: error: parse error before ulong
/home/Rene/uboot134/include/image.h:533: error: parse error before ulong
make[1]: *** [mkimage.o] Error 1
make: *** [tools] Error 2 

Thanks in advance.
Best regards
René___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] iPAQ 21x support (+PXA3xx NAND flash and MMC)

2008-11-29 Thread Oliver Ford
Hi,

I've recently started trying to use U-boot on an iPAQ 214 which runs on 
a PXA310 cpu.
I've got the basic boot up, NAND flash and MMC systems working so far.

I originally tried to use the zylonite's nand.c that's already in u-boot 
but it was very flaky and didn't support several things I needed like 
large-page command set and the hardware ecc.

I've now copied the latest pxa3xx nand flash code from the kernel and 
just modified it to cope without DMA and without IRQs.

I'm not sure it exactly fits in with the u-boot nand code (eg. it does 
an internal read ID scan to find the right command set) but it works a 
lot better than the board/zylonite/nand.c. Would this be useful to 
anyone else?

Also, can I, and how do I go about submitting the stuff for the iPAQ 
21x. The only change outside it's own config header and board/ dir is 
the a slight change to get the MMC code working on the pxa3xx (below).

Thanks,

Oliver



diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c
index d735c8d..3b281d5 100644
--- a/cpu/pxa/mmc.c
+++ b/cpu/pxa/mmc.c
@@ -126,7 +126,7 @@ mmc_block_read(uchar * dst, ulong src, ulong len)
   MMC_I_MASK = ~MMC_I_MASK_RXFIFO_RD_REQ;
   while (len) {
   if (MMC_I_REG  MMC_I_REG_RXFIFO_RD_REQ) {
-#ifdef CONFIG_PXA27X
+#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS)
   int i;
   for (i = min(len, 32); i; i--) {
   *dst++ = *((volatile uchar *)MMC_RXFIFO);
@@ -558,7 +558,11 @@ mmc_init(int verbose)
   set_GPIO_mode(GPIO6_MMCCLK_MD);
   set_GPIO_mode(GPIO8_MMCCS0_MD);
#endif
+#ifdef CONFIG_CPU_MONAHANS
+   CKENA |= CKENA_12_MMC0;
+#else
   CKEN |= CKEN12_MMC; /* enable MMC unit clock */
+#endif

   MMC_CLKRT = MMC_CLKRT_0_3125MHZ;
   MMC_RESTO = MMC_RES_TO_MAX;



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


Re: [U-Boot] iPAQ 21x support (+PXA3xx NAND flash and MMC)

2008-11-29 Thread Daniel Mack
Hi Oliver,

On Sat, Nov 29, 2008 at 02:03:25PM +, Oliver Ford wrote:
 I've recently started trying to use U-boot on an iPAQ 214 which runs on 
 a PXA310 cpu.
 I've got the basic boot up, NAND flash and MMC systems working so far.
 
 I originally tried to use the zylonite's nand.c that's already in u-boot 
 but it was very flaky and didn't support several things I needed like 
 large-page command set and the hardware ecc.
 
 I've now copied the latest pxa3xx nand flash code from the kernel and 
 just modified it to cope without DMA and without IRQs.

Great.

 I'm not sure it exactly fits in with the u-boot nand code (eg. it does 
 an internal read ID scan to find the right command set) but it works a 
 lot better than the board/zylonite/nand.c. Would this be useful to 
 anyone else?

Yes, absolutely - to me. I'm sitting on this at this very moment :)

I was also thinking about implementing this as a PXA3xx generic layer
for small pages, large pages, 8bit and 16bit so the same code does not
need to be copied to all the board implementations over and over again.

But I'm not sure whether there are any plans to do this as I didn't
follow the development of this project for a long time.

Anyways, I'd appreciate if you could send over what you got.

Many thanks,
Daniel

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


[U-Boot] [PATCH] add support for Toradex Colibri PXA300 module

2008-11-29 Thread Daniel Mack
Hi,

this patch adds support for Toradex' Colibri PXA300 module. I had to
modify the AX88796 driver a bit to make it work, but that goes in a
different patch.

Also, the board code does not support NAND yet. I'll implement the code
from Oliver Ford soon.

Signed-off-by: Daniel Mack [EMAIL PROTECTED]


diff --git a/MAKEALL b/MAKEALL
index dbed268..868205f 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -554,6 +554,7 @@ LIST_at91= \
 
 LIST_pxa= \
cerf250 \
+   colibri_pxa300  \
cradle  \
csb226  \
delta   \
diff --git a/Makefile b/Makefile
index befb608..ee94d17 100644
--- a/Makefile
+++ b/Makefile
@@ -2804,6 +2804,9 @@ actux4_config :   unconfig
 cerf250_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm pxa cerf250
 
+colibri_pxa300_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm pxa colibri_pxa300
+
 cradle_config  :   unconfig
@$(MKCONFIG) $(@:_config=) arm pxa cradle
 
diff --git a/board/colibri_pxa300/Makefile b/board/colibri_pxa300/Makefile
new file mode 100644
index 000..2fa3fb9
--- /dev/null
+++ b/board/colibri_pxa300/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+#
+# 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  := colibri_pxa300.o
+SOBJS  := 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
+
+#
diff --git a/board/colibri_pxa300/colibri_pxa300.c 
b/board/colibri_pxa300/colibri_pxa300.c
new file mode 100644
index 000..2c2b0d7
--- /dev/null
+++ b/board/colibri_pxa300/colibri_pxa300.c
@@ -0,0 +1,61 @@
+/*
+ * (C) Copyright 2008
+ * Daniel Mack, caiaq GbR [EMAIL PROTECTED]
+ *
+ * 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
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+int board_init (void)
+{
+   /* arch number for linux kernel */
+   gd-bd-bi_arch_number = MACH_TYPE_COLIBRI300;
+
+   /* adress of boot parameters */
+   gd-bd-bi_boot_params = 0xa100;
+
+   return 0;
+}
+
+int board_late_init(void)
+{
+   setenv(stdout, serial);
+   setenv(stderr, serial);
+   return 0;
+}
+
+int dram_init (void)
+{
+   gd-bd-bi_dram[0].start = PHYS_SDRAM_1;
+   gd-bd-bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+   gd-bd-bi_dram[1].start = PHYS_SDRAM_2;
+   gd-bd-bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+   gd-bd-bi_dram[2].start = PHYS_SDRAM_3;
+   gd-bd-bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+   gd-bd-bi_dram[3].start = PHYS_SDRAM_4;
+   gd-bd-bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+   return 0;
+}
diff --git a/board/colibri_pxa300/config.mk b/board/colibri_pxa300/config.mk
new file mode 100644
index 000..350ff3d
--- /dev/null
+++ b/board/colibri_pxa300/config.mk
@@ -0,0 +1,2 @@
+TEXT_BASE = 0x8100
+
diff --git