Re: [U-Boot] [PATCH 2/2] LPC2468 example board

2009-04-28 Thread Remco Poelstra
Added example board for LPC2468 processor

Signed-off-by: Remco Poelstra 
Date: Tue, 28 Apr 2009 15:04:33 +0200
Subject: [PATCH] Added example board for LPC2468 processor

---
  board/LPC2468/LPC2468.c  |   65 +
  board/LPC2468/Makefile   |   55 +
  board/LPC2468/config.mk  |   29 +++
  board/LPC2468/flash.c|  255 +++
  board/LPC2468/lowlevel_init.c|  445 ++
  board/LPC2468/nand.c |   63 +
  board/LPC2468/u-boot.lds |   55 +
  include/asm-arm/arch-lpc24xx/immap.h |  142 ++-
  include/configs/LPC2468.h|  220 +
  9 files changed, 1319 insertions(+), 10 deletions(-)
  create mode 100644 board/LPC2468/LPC2468.c
  create mode 100755 board/LPC2468/Makefile
  create mode 100755 board/LPC2468/config.mk
  create mode 100644 board/LPC2468/flash.c
  create mode 100644 board/LPC2468/lowlevel_init.c
  create mode 100755 board/LPC2468/nand.c
  create mode 100755 board/LPC2468/u-boot.lds
  create mode 100644 include/configs/LPC2468.h

diff --git a/board/LPC2468/LPC2468.c b/board/LPC2468/LPC2468.c
new file mode 100644
index 000..498885f
--- /dev/null
+++ b/board/LPC2468/LPC2468.c
@@ -0,0 +1,65 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH 
+ * Marius Groeger 
+ *
+ * (C) Copyright 2005 Rowel Atienza 
+ * Armadillo board HT1070
+ *
+ * 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 
+#include 
+
+/* - */
+
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+int board_init (void)
+{
+   DECLARE_GLOBAL_DATA_PTR;
+
+   /* arch number MACH_TYPE_ARMADILLO - not official */
+   gd->bd->bi_arch_number = 1339;
+
+   /* location of boot parameters */
+   gd->bd->bi_boot_params = 0xA100;
+
+   return 0;
+}
+
+int print_cpuinfo (void)
+{
+   printf ("CPU:   LPC2468 (ARM7tdmi-s from NXP)\n"
+   "   running at 57.6 MHz (12 MHz crystal)\n");
+   return 0;
+}
+
+int dram_init (void)
+{
+   DECLARE_GLOBAL_DATA_PTR;
+
+   gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+   gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+   return (0);
+}
diff --git a/board/LPC2468/Makefile b/board/LPC2468/Makefile
new file mode 100755
index 000..19a2cd7
--- /dev/null
+++ b/board/LPC2468/Makefile
@@ -0,0 +1,55 @@
+
+###
+#
+# Copyright (C) 2000, 2001, 2002, 2003
+# The LEOX team , http://www.leox.org
+#
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# LEOX.org is about the development of free hardware and software resources
+#   for system on chip.
+#
+# Description: U-Boot port on the LEOX's ELPT860 CPU board
+# ~~~
+#
+###
+#
+# 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 nand.o flash.o 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)
+
+#
+
+

[U-Boot] LPC2468 again

2010-05-11 Thread Remco Poelstra
Hi all,

It's been a while since I was last on this list. Due to a lot of 
uncertainties in the codebase and a time shortage on my side, I decided 
that it was better to wait a while to try to get LPC2468 support in 
u-boot. I do at least have a lot more time now.
I would like to have the code added (and accepted in git) in smaller blocks:
1. general startup code
2. a minimal board example
3. external flash support
4. I2C support
5. Ethernet support

I hope you agree with this split up in manageable chunks.

Currently I've ported the code to the latest git version. It compiles 
more or less, except for the following error:
/usr/local/ELDK/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/soft-float/libgcc.a(_divdi3.o):(.ARM.exidx+0x0):
 
undefined reference to `__aeabi_unwind_cpp_pr0'
/usr/local/ELDK/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/soft-float/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0):
 
undefined reference to `__aeabi_unwind_cpp_pr0'

How can I fix that? It seems it's the last small problem before I can 
send a patch set for the startup code.

Kind regards,

Remco Poelsta

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


Re: [U-Boot] LPC2468 again

2010-05-11 Thread Remco Poelstra
On 11-05-10 14:25, Anatolij Gustschin wrote:
> On Tue, 11 May 2010 14:07:14 +0200
> Remco Poelstra  wrote:
>
> ...
>
>> Currently I've ported the code to the latest git version. It compiles
>> more or less, except for the following error:
>> /usr/local/ELDK/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/soft-float/libgcc.a(_divdi3.o):(.ARM.exidx+0x0):
>> undefined reference to `__aeabi_unwind_cpp_pr0'
>> /usr/local/ELDK/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/soft-float/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0):
>> undefined reference to `__aeabi_unwind_cpp_pr0'
>>
>> How can I fix that? It seems it's the last small problem before I can
>> send a patch set for the startup code.
>>  
> Try to apply this patch
>
> http://lists.denx.de/pipermail/u-boot/2010-May/071363.html
>
> Best regards,
> Anatolij
>
>
Thanks, this works. Why isn't this included in u-boot by default?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] LPC2468 again

2010-05-11 Thread Remco Poelstra
On 11-05-10 14:45, Anatolij Gustschin wrote:
> On Tue, 11 May 2010 14:40:30 +0200
> Remco Poelstra  wrote:
> ...
>
>>>> /usr/local/ELDK/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/soft-float/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0):
>>>> undefined reference to `__aeabi_unwind_cpp_pr0'
>>>>
>>>> How can I fix that? It seems it's the last small problem before I can
>>>> send a patch set for the startup code.
>>>>
>>>>  
>>> Try to apply this patch
>>>
>>> http://lists.denx.de/pipermail/u-boot/2010-May/071363.html
>>>
>>> Best regards,
>>> Anatolij
>>>
>>>
>>>
>> Thanks, this works. Why isn't this included in u-boot by default?
>>  
> This patch is quite new and I suppose it will be included soon.
>

I see, I thought it would be in git already.

Regards,

Remco Poelstra

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


[U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-05-12 Thread Remco Poelstra
Add support for LPC2468 from NXP

Basic startup code
Internal flash is supported (for environment storage)

Signed-off-by: Remco Poelstra 
---
  MAKEALL  |1 +
  Makefile |3 +
  arch/arm/cpu/arm720t/cpu.c   |4 +-
  arch/arm/cpu/arm720t/interrupts.c|   39 ++-
  arch/arm/cpu/arm720t/lpc24xx/Makefile|   50 +++
  arch/arm/cpu/arm720t/lpc24xx/flash.c |  236 
  arch/arm/cpu/arm720t/lpc24xx/iap_entry.S |7 +
  arch/arm/cpu/arm720t/start.S |   12 +-
  arch/arm/include/asm/arch-lpc24xx/hardware.h |   32 ++
  arch/arm/include/asm/arch-lpc24xx/immap.h|  528 
++
  arch/arm/include/asm/config.h|4 +
  arch/arm/lib/eabi_compat.c   |5 +
  drivers/serial/Makefile  |1 +
  drivers/serial/serial_lpc2468.c  |  119 ++
  include/flash.h  |1 +
  15 files changed, 1033 insertions(+), 9 deletions(-)
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/Makefile
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/flash.c
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
  create mode 100644 arch/arm/include/asm/arch-lpc24xx/hardware.h
  create mode 100644 arch/arm/include/asm/arch-lpc24xx/immap.h
  create mode 100644 drivers/serial/serial_lpc2468.c

diff --git a/MAKEALL b/MAKEALL
index bb09627..2f747c6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -540,6 +540,7 @@ LIST_ARM7=" \
impa7   \
integratorap\
lpc2292sodimm   \
+   LPC2468 \
modnet50\
SMN42   \
  "
diff --git a/Makefile b/Makefile
index 82cbbf4..a4212c8 100644
--- a/Makefile
+++ b/Makefile
@@ -3148,6 +3148,9 @@ evb4510_config :  unconfig
  lpc2292sodimm_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292

+LPC2468_config:unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468  NULL lpc24xx
+
  SMN42_config  :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292

diff --git a/arch/arm/cpu/arm720t/cpu.c b/arch/arm/cpu/arm720t/cpu.c
index 88c71bf..578358c 100644
--- a/arch/arm/cpu/arm720t/cpu.c
+++ b/arch/arm/cpu/arm720t/cpu.c
@@ -63,7 +63,9 @@ int cleanup_before_linux (void)
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
  #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elif  defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) ||\
+   defined(CONFIG_LPC2000)
+
disable_interrupts ();
/* Nothing more needed */
  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index eb8d425..06c4550 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -29,17 +29,26 @@
  #include 
  #include 
  #include 
+#if defined(CONFIG_LPC2468)
+#include 
+#include 
+#else
  #include 
+#endif

  #ifndef CONFIG_NETARM
+
+#if defined(CONFIG_LPC2292)
+#define TIMER_LOAD_VAL 0x
+#define READ_TIMER (0x - GET32(T0TC))
+#elif defined(CONFIG_LPC2468)
+#define TIMER_LOAD_VAL 0
+#define READ_TIMER (0x - 0xE0004008)
+#else
  /* we always count down the max. */
  #define TIMER_LOAD_VAL 0x
  /* macro to read the 16 bit timer */
  #define READ_TIMER (IO_TC1D & 0x)
-
-#ifdef CONFIG_LPC2292
-#undef READ_TIMER
-#define READ_TIMER (0x - GET32(T0TC))
  #endif

  #else
@@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs)
  pfnct = (void (*)(void))VICVectAddr;

  (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
  #else
  #error do_irq() not defined for this CPU type
  #endif
@@ -138,6 +155,10 @@ int arch_interrupt_init (void)

  int timer_init (void)
  {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif
+
  #if defined(CONFIG_NETARM)
/* disable all interrupts */
IRQEN = 0;
@@ -191,6 +212,13 @@ int timer_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   writel (0, &(timer0->ir));  /*disable all timer0 interupts 
*/
+   writel (0, &(timer0->tcr)); /*disable timer0 */
+   writel (CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1, &(timer0->pr));
+   writel (0, &(timer0->mcr));
+   writel (0, &(timer0->tc));
+   writel (1, &(timer0->tcr));

  #else
  #error No timer_init() defined for this CPU typ

Re: [U-Boot] [PATCH v2] Add support for LPC2468 from NXP

2010-05-12 Thread Remco Poelstra
Add support for LPC2468 from NXP

Basic startup code
Internal flash is supported (for environment storage)

Signed-off-by: Remco Poelstra

---
  MAINTAINERS  |4 +
  MAKEALL  |1 +
  Makefile |3 +
  arch/arm/cpu/arm720t/cpu.c   |4 +-
  arch/arm/cpu/arm720t/interrupts.c|   43 ++-
  arch/arm/cpu/arm720t/lpc24xx/Makefile|   50 +++
  arch/arm/cpu/arm720t/lpc24xx/flash.c |  236 
  arch/arm/cpu/arm720t/lpc24xx/iap_entry.S |7 +
  arch/arm/cpu/arm720t/start.S |   12 +-
  arch/arm/include/asm/arch-lpc24xx/hardware.h |   32 ++
  arch/arm/include/asm/arch-lpc24xx/immap.h|  532 
++
  arch/arm/include/asm/config.h|4 +
  arch/arm/lib/eabi_compat.c   |5 +
  drivers/serial/Makefile  |1 +
  drivers/serial/serial_lpc2468.c  |  119 ++
  include/flash.h  |1 +
  16 files changed, 1049 insertions(+), 5 deletions(-)
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/Makefile
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/flash.c
  create mode 100644 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
  create mode 100644 arch/arm/include/asm/arch-lpc24xx/hardware.h
  create mode 100644 arch/arm/include/asm/arch-lpc24xx/immap.h
  create mode 100644 drivers/serial/serial_lpc2468.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5cbc845..3cdf22d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -708,6 +708,10 @@ Manikandan Pillai 

  omap3_evmARM CORTEX-A8 (OMAP3xx SoC)

+Remco Poelstra 
+
+LPC2468LPC2468
+
  Stelian Pop 

  at91cap9adkARM926EJS (AT91CAP9 SoC)
diff --git a/MAKEALL b/MAKEALL
index bb09627..2f747c6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -540,6 +540,7 @@ LIST_ARM7="\
  impa7\
  integratorap\
  lpc2292sodimm\
+LPC2468\
  modnet50\
  SMN42\
  "
diff --git a/Makefile b/Makefile
index 82cbbf4..a4212c8 100644
--- a/Makefile
+++ b/Makefile
@@ -3148,6 +3148,9 @@ evb4510_config :unconfig
  lpc2292sodimm_config:unconfig
  @$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292

+LPC2468_config:unconfig
+@$(MKCONFIG) $(@:_config=) arm arm720t LPC2468  NULL lpc24xx
+
  SMN42_config:unconfig
  @$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292

diff --git a/arch/arm/cpu/arm720t/cpu.c b/arch/arm/cpu/arm720t/cpu.c
index 88c71bf..578358c 100644
--- a/arch/arm/cpu/arm720t/cpu.c
+++ b/arch/arm/cpu/arm720t/cpu.c
@@ -63,7 +63,9 @@ int cleanup_before_linux (void)
  /* go to high speed */
  IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
  #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elifdefined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) ||\
+defined(CONFIG_LPC2000)
+
  disable_interrupts ();
  /* Nothing more needed */
  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index eb8d425..2ef7101 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -30,6 +30,8 @@
  #include 
  #include 
  #include 
+#include 
+#include 

  #ifndef CONFIG_NETARM
  /* we always count down the max. */
@@ -80,6 +82,14 @@ void do_irq (struct pt_regs *pt_regs)
  pfnct = (void (*)(void))VICVectAddr;

  (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+void (*pfnct) (void);
+vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+pfnct = (void (*)(void))(&(vic->vicaddr));
+
+(*pfnct) ();
+
  #else
  #error do_irq() not defined for this CPU type
  #endif
@@ -138,6 +148,10 @@ int arch_interrupt_init (void)

  int timer_init (void)
  {
+#if defined(CONFIG_LPC2468)
+timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif
+
  #if defined(CONFIG_NETARM)
  /* disable all interrupts */
  IRQEN = 0;
@@ -191,6 +205,13 @@ int timer_init (void)
  PUT32(T0MCR, 0);
  PUT32(T0TC, 0);
  PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+writel (0, &(timer0->ir));/*disable all timer0 interupts */
+writel (0, &(timer0->tcr));/*disable timer0 */
+writel (CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1, &(timer0->pr));
+writel (0, &(timer0->mcr));
+writel (0, &(timer0->tc));
+writel (1, &(timer0->tcr));

  #else
  #error No timer_init() defined for this CPU type
@@ -207,7 +228,8 @@ int timer_init (void)
   */


-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || 
defined(CONFIG_NETARM) || defined(CONFIG_ARMADILLO) || 
defined(CONFIG_LPC2292)
+#ifdefined(CONFIG_IMPA7) || defined(CONFIG_EP7312) ||

Re: [U-Boot] [PATCH v2] Add support for LPC2468 from NXP

2010-05-12 Thread Remco Poelstra

On 12-05-10 15:01, Remco Poelstra wrote:
> Add support for LPC2468 from NXP
>
> Basic startup code
> Internal flash is supported (for environment storage)
>
> Signed-off-by: Remco Poelstra
>
> ---
>MAINTAINERS  |4 +
>MAKEALL  |1 +
>Makefile |3 +
>arch/arm/cpu/arm720t/cpu.c   |4 +-
>arch/arm/cpu/arm720t/interrupts.c|   43 ++-
>arch/arm/cpu/arm720t/lpc24xx/Makefile|   50 +++
>arch/arm/cpu/arm720t/lpc24xx/flash.c |  236 
>arch/arm/cpu/arm720t/lpc24xx/iap_entry.S |7 +
>arch/arm/cpu/arm720t/start.S |   12 +-
>arch/arm/include/asm/arch-lpc24xx/hardware.h |   32 ++
>arch/arm/include/asm/arch-lpc24xx/immap.h|  532
> ++
>

I just see that my mail client wrapped the lines again on send. I'll see 
how I can fix this. I don't think it's a problem right now, I doubt the 
patch will be completely fine this time.

Regards,

Remco Poelstra

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


[U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-05-17 Thread Remco Poelstra
Add Support for LPC2468 from NXP

Basic startup code
Internal flash is uspported (for environment storage)

---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |3 +
 arch/arm/cpu/arm720t/cpu.c   |4 +-
 arch/arm/cpu/arm720t/interrupts.c|   43 ++-
 arch/arm/cpu/arm720t/lpc24xx/Makefile|   50 +++
 arch/arm/cpu/arm720t/lpc24xx/flash.c |  236 
 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S |7 +
 arch/arm/cpu/arm720t/start.S |   12 +-
 arch/arm/include/asm/arch-lpc24xx/hardware.h |   32 ++
 arch/arm/include/asm/arch-lpc24xx/immap.h|  532 ++
 arch/arm/include/asm/config.h|4 +
 arch/arm/lib/eabi_compat.c   |5 +
 drivers/serial/Makefile  |1 +
 drivers/serial/serial_lpc2468.c  |  119 ++
 include/flash.h  |1 +
 16 files changed, 1049 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/Makefile
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/flash.c
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
 create mode 100644 arch/arm/include/asm/arch-lpc24xx/hardware.h
 create mode 100644 arch/arm/include/asm/arch-lpc24xx/immap.h
 create mode 100644 drivers/serial/serial_lpc2468.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5cbc845..3cdf22d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -708,6 +708,10 @@ Manikandan Pillai 
 
omap3_evm   ARM CORTEX-A8 (OMAP3xx SoC)
 
+Remco Poelstra 
+
+   LPC2468 LPC2468
+
 Stelian Pop 
 
at91cap9adk ARM926EJS (AT91CAP9 SoC)
diff --git a/MAKEALL b/MAKEALL
index bb09627..2f747c6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -540,6 +540,7 @@ LIST_ARM7=" \
impa7   \
integratorap\
lpc2292sodimm   \
+   LPC2468 \
modnet50\
SMN42   \
 "
diff --git a/Makefile b/Makefile
index 82cbbf4..a4212c8 100644
--- a/Makefile
+++ b/Makefile
@@ -3148,6 +3148,9 @@ evb4510_config :  unconfig
 lpc2292sodimm_config:  unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292
 
+LPC2468_config:unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468  NULL lpc24xx
+
 SMN42_config   :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292
 
diff --git a/arch/arm/cpu/arm720t/cpu.c b/arch/arm/cpu/arm720t/cpu.c
index 88c71bf..578358c 100644
--- a/arch/arm/cpu/arm720t/cpu.c
+++ b/arch/arm/cpu/arm720t/cpu.c
@@ -63,7 +63,9 @@ int cleanup_before_linux (void)
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
 #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elif  defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) ||\
+   defined(CONFIG_LPC2000)
+
disable_interrupts ();
/* Nothing more needed */
 #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index eb8d425..2ef7101 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -30,6 +30,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #ifndef CONFIG_NETARM
 /* we always count down the max. */
@@ -80,6 +82,14 @@ void do_irq (struct pt_regs *pt_regs)
 pfnct = (void (*)(void))VICVectAddr;
 
 (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
 #else
 #error do_irq() not defined for this CPU type
 #endif
@@ -138,6 +148,10 @@ int arch_interrupt_init (void)
 
 int timer_init (void)
 {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif
+
 #if defined(CONFIG_NETARM)
/* disable all interrupts */
IRQEN = 0;
@@ -191,6 +205,13 @@ int timer_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   writel (0, &(timer0->ir));  /*disable all timer0 interupts 
*/
+   writel (0, &(timer0->tcr)); /*disable timer0 */
+   writel (CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1, &(timer0->pr));
+   writel (0, &(timer0->mcr));
+   writel (0, &(timer0->tc));
+   writel (1, &(timer0->tcr));
 
 #else
 #error No timer_init() defined for this CPU type
@@ -207,7 +228,8 @@ int timer_init (void)
  */
 
 
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) 
|| defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC22

[U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-05-17 Thread Remco Poelstra
Add Support for LPC2468 from NXP

Basic startup code
Internal flash is uspported (for environment storage)

---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |3 +
 arch/arm/cpu/arm720t/cpu.c   |4 +-
 arch/arm/cpu/arm720t/interrupts.c|   43 ++-
 arch/arm/cpu/arm720t/lpc24xx/Makefile|   50 +++
 arch/arm/cpu/arm720t/lpc24xx/flash.c |  236 
 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S |7 +
 arch/arm/cpu/arm720t/start.S |   12 +-
 arch/arm/include/asm/arch-lpc24xx/hardware.h |   32 ++
 arch/arm/include/asm/arch-lpc24xx/immap.h|  532 ++
 arch/arm/include/asm/config.h|4 +
 arch/arm/lib/eabi_compat.c   |5 +
 drivers/serial/Makefile  |1 +
 drivers/serial/serial_lpc2468.c  |  119 ++
 include/flash.h  |1 +
 16 files changed, 1049 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/Makefile
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/flash.c
 create mode 100644 arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
 create mode 100644 arch/arm/include/asm/arch-lpc24xx/hardware.h
 create mode 100644 arch/arm/include/asm/arch-lpc24xx/immap.h
 create mode 100644 drivers/serial/serial_lpc2468.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5cbc845..3cdf22d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -708,6 +708,10 @@ Manikandan Pillai 
 
omap3_evm   ARM CORTEX-A8 (OMAP3xx SoC)
 
+Remco Poelstra 
+
+   LPC2468 LPC2468
+
 Stelian Pop 
 
at91cap9adk ARM926EJS (AT91CAP9 SoC)
diff --git a/MAKEALL b/MAKEALL
index bb09627..2f747c6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -540,6 +540,7 @@ LIST_ARM7=" \
impa7   \
integratorap\
lpc2292sodimm   \
+   LPC2468 \
modnet50\
SMN42   \
 "
diff --git a/Makefile b/Makefile
index 82cbbf4..a4212c8 100644
--- a/Makefile
+++ b/Makefile
@@ -3148,6 +3148,9 @@ evb4510_config :  unconfig
 lpc2292sodimm_config:  unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292
 
+LPC2468_config:unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468  NULL lpc24xx
+
 SMN42_config   :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292
 
diff --git a/arch/arm/cpu/arm720t/cpu.c b/arch/arm/cpu/arm720t/cpu.c
index 88c71bf..578358c 100644
--- a/arch/arm/cpu/arm720t/cpu.c
+++ b/arch/arm/cpu/arm720t/cpu.c
@@ -63,7 +63,9 @@ int cleanup_before_linux (void)
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
 #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elif  defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) ||\
+   defined(CONFIG_LPC2000)
+
disable_interrupts ();
/* Nothing more needed */
 #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index eb8d425..2ef7101 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -30,6 +30,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #ifndef CONFIG_NETARM
 /* we always count down the max. */
@@ -80,6 +82,14 @@ void do_irq (struct pt_regs *pt_regs)
 pfnct = (void (*)(void))VICVectAddr;
 
 (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
 #else
 #error do_irq() not defined for this CPU type
 #endif
@@ -138,6 +148,10 @@ int arch_interrupt_init (void)
 
 int timer_init (void)
 {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif
+
 #if defined(CONFIG_NETARM)
/* disable all interrupts */
IRQEN = 0;
@@ -191,6 +205,13 @@ int timer_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   writel (0, &(timer0->ir));  /*disable all timer0 interupts 
*/
+   writel (0, &(timer0->tcr)); /*disable timer0 */
+   writel (CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1, &(timer0->pr));
+   writel (0, &(timer0->mcr));
+   writel (0, &(timer0->tc));
+   writel (1, &(timer0->tcr));
 
 #else
 #error No timer_init() defined for this CPU type
@@ -207,7 +228,8 @@ int timer_init (void)
  */
 
 
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) 
|| defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC22

Re: [U-Boot] [PATCH v2] Add support for LPC2468 from NXP

2010-05-18 Thread Remco Poelstra
On 12-05-10 18:09, Wolfgang Denk wrote:
> I just see that my mail client wrapped the lines again on send. I'll see
>> how I can fix this. I don't think it's a problem right now, I doubt the
>> patch will be completely fine this time.
>>  
> Yes, it is a problem, because I cannot apply it for testing, nur run
> any automatic checking tools over it.
>
>

Hi,

Yesterday I tried resending my patch using 'git send-email'. I received
an aknowledgement from Mailman, but the message didn't show up on the list.
Did I do something wrong? Can someone check the Mailman logs?

Kind regards,

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


Re: [U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-05-20 Thread Remco Poelstra
On 17-05-10 14:21, Remco Poelstra wrote:
> Add Support for LPC2468 from NXP
>
> Basic startup code
> Internal flash is uspported (for environment storage)
>
Hi,

Can someone review my patch please?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-06-02 Thread Remco Poelstra
Op 17-5-2010 14:21, Remco Poelstra schreef:
> Add Support for LPC2468 from NXP
>
> Basic startup code
> Internal flash is uspported (for environment storage)
>
> ---

Hi,

Can someone please review this code?
Or is there something terribly wrong with this patch?

Regards,

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


Re: [U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-06-02 Thread Remco Poelstra
Hi,

On 02-06-10 12:03, Wolfgang Denk wrote:
>
>> @@ -80,6 +82,14 @@ void do_irq (struct pt_regs *pt_regs)
>>   pfnct = (void (*)(void))VICVectAddr;
>>
>>   (*pfnct)();
>> +#elif defined(CONFIG_LPC2468)
>> +void (*pfnct) (void);
>> +vic_2468_t *vic =&(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
>> +
>> +pfnct = (void (*)(void))(&(vic->vicaddr));
>> +
>> +(*pfnct) ();
>>  
> Please unify with code for the LPC2292 and get rid of the #ifdef.
>

This is not possible. I do understand that there is a lot of similarity,
but I was asked to use C structures to access registers, but the lpc22xx
code uses direct access. I cannot convert the lpc22xx code, since I don't
have access to a board and it's a very error-prone process. I think it would
be better if the current lpc22xx maintainer converts the lpc22xx code to 
use
C structures as well. Unfortunatly, the same holds for most of the code 
merge/factor out
comments below.
>>   {
>> +#if defined(CONFIG_LPC2468)
>> +timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
>> +ulong now = readl(&(timer0->tc));
>> +
>> +if (lastdec<= now) {
>> +/* normal mode */
>> +timestamp += now - lastdec;
>> +} else {
>> +/* we have an overflow ... */
>> +timestamp += now + TIMER_LOAD_VAL - lastdec;
>> +}
>> +#else
>>  ulong now = READ_TIMER;
>>
>>  if (lastdec>= now) {
>> @@ -261,6 +300,8 @@ ulong get_timer_masked (void)
>>  /* we have an overflow ... */
>>  timestamp += lastdec + TIMER_LOAD_VAL - now;
>>  }
>> +#endif
>>  
> Ditto here.
>

This one is different. The lpc2468 uses an upward counting timer,
while the other ARM's seem to use a downward counting timer (as
far as I could judge from the code).
I cannot set the timer to count downward, so this code must be different.
This may actually mean that the delay functions do not work on the lpc22xx.
The code my patches are based on was not functional either.
>> diff --git a/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S 
>> b/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
>> new file mode 100644
>> index 000..c31d519
>> --- /dev/null
>> +++ b/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
>> @@ -0,0 +1,7 @@
>> +IAP_ADDRESS:.word   0x7FF1
>> +
>> +.globl iap_entry
>> +iap_entry:
>> +ldr r2, IAP_ADDRESS
>> +bx  r2
>> +mov pc, lr
>>  
> Verbatim copy of arch/arm/cpu/arm720t/lpc2292/iap_entry.S - please
> unify.
>
Can you give a hint on how I should accomplish that? Copy the
iap_netry.S to the parent directiry?

> ...
>
>> --- /dev/null
>> +++ b/arch/arm/include/asm/arch-lpc24xx/hardware.h
>> @@ -0,0 +1,32 @@
>> +#ifndef __ASM_ARCH_HARDWARE_H
>> +#define __ASM_ARCH_HARDWARE_H
>> +
>> +/*
>>  
> ...
>
>> + */
>> +
>> +#if defined(CONFIG_LPC2468)
>> +#else
>> +#error No hardware file defined for this configuration
>> +#endif
>> +
>> +#endif /* __ASM_ARCH_HARDWARE_H */
>>  
> Do we really need such an empty file?
>

Yes, start.S needs this file, but since my code uses C structures, it's 
empty.

> ...
>
>> +typedef struct ssp1_2468 {
>> +u8 fixme[0x4000];
>> +} ssp1_2468_t;
>> +
>> +typedef struct adc_2468 {
>> +u8 fixme[0x4000];
>> +} adc_2468_t;
>> +
>> +typedef struct can_accept_ram_2468 {
>> +u8 fixme[0x4000];
>> +} can_accept_ram_2468_t;
>> +
>> +typedef struct can_accept_filter_2468 {
>> +u8 fixme[0x4000];
>> +} can_accept_filter_2468_t;
>> +
>> +typedef struct can_common_2468 {
>> +u8 fixme[0x4000];
>> +} can_common_2468_t;
>> +
>> +typedef struct can1_2468 {
>> +u8 fixme[0x4000];
>> +} can1_2468_t;
>> +
>> +typedef struct can2_2468 {
>> +u8 fixme[0x4000];
>> +} can2_2468_t;
>> +
>> +typedef struct i2c1_2468 {
>> +u8 fixme[0x4000];
>> +} i2c1_2468_t;
>>  
> ...
>
>
> Do we _really_ need all this?
>

Yes and no. Not all H/W is used. That may well change in
the future as more peripherals are supported. I do also believe
that it is more readable if the mapping of the memory is
reflected in the file, rather than undefined chunks, just because
momentarily a peripheral isn't needed. I think this provides
a better base for future development.

Kind regards,

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


Re: [U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-06-03 Thread Remco Poelstra
Hi,

On 02-06-10 12:03, Wolfgang Denk wrote:
>
>> diff --git a/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S 
>> b/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
>> new file mode 100644
>> index 000..c31d519
>> --- /dev/null
>> +++ b/arch/arm/cpu/arm720t/lpc24xx/iap_entry.S
>> @@ -0,0 +1,7 @@
>> +IAP_ADDRESS:.word   0x7FF1
>> +
>> +.globl iap_entry
>> +iap_entry:
>> +ldr r2, IAP_ADDRESS
>> +bx  r2
>> +mov pc, lr
>>  
> Verbatim copy of arch/arm/cpu/arm720t/lpc2292/iap_entry.S - please
> unify.
>
>

Looking at other architectures for inspiration to solve the above 
problem, I find that it's common practice to not-share common code 
between SOC's. Is there a reason for that?
Furthermore I see the same problems with some code using direct register 
access and other almost identical code using C-structure based access. 
Maybe these SOC's are in the same process of getting converted to 
C-structures?
Main point: What do you want me to do? I fixed the other minor comments, 
so I can send a new patch if you want.


Regards,

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


Re: [U-Boot] [PATCH] Add support for LPC2468 from NXP

2010-06-08 Thread Remco Poelstra
Hi,

Op 2-6-2010 12:03, Wolfgang Denk schreef:
> Dear Remco Poelstra,
>
> In message<1274098916-1805-1-git-send-email-remco.poels...@duran-audio.com>  
> you wrote:
>> Add Support for LPC2468 from NXP
>>
>> Basic startup code
>> Internal flash is uspported (for environment storage)

How are we going to solve all the mentioned problems?

Kind regards,

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


[U-Boot] Strange data behaviour

2009-02-17 Thread Remco Poelstra
Hi,

I'm trying to get my LPC2468 based board to work. I've some problems 
with the external memory databus.
I would like to know the settings of internal registers to see whether 
I've initialized them correctly, so I tried making a function that 
prints the content over the serial link. I'm still in the lowlevel_init 
function, so I do not have the U-boot puts functions available.
I wrote the following function to convert a long to a HEX string:
---
void print_long(unsigned long data) {
   char i;
   char 
hex_data[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

   for(i=0; i<8; i++) {
 while((U0LSR & (1<<5)) == 0); /* Wait for empty U0THR */
//U0THR = hex_data[(0xDEADBEEF>>i*4)&0xF];
 U0THR = hex_data[(0xDEADBEEF>>4)&0xF];
   }
}
---
When I run it likes this I get 8 E's. Which is what I expect. When I run 
it with the commented-out line, I get back 8 0x0's. So it seems that the 
output is only correct when it is constant.
Does anyone have a clue on why that is?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] Strange data behaviour

2009-02-18 Thread Remco Poelstra
Wolfgang Denk schreef:
>>  U0THR = hex_data[(0xDEADBEEF>>4)&0xF];
>>}
>> }
>> ---
>> When I run it likes this I get 8 E's. Which is what I expect. When I run 
>> it with the commented-out line, I get back 8 0x0's. So it seems that the 
>> output is only correct when it is constant.
>> Does anyone have a clue on why that is?
> 
> What exactly is U0THR ? 

Hi,

Thanks for your reply.

For my processor, U0THR is defnied as:
#define U0THR  (*(volatile unsigned char *)(UART0_BASE_ADDR + 
0x00))

UART0_BASE_ADDR is equal to 0xE000C000

The register itself represents the top of the UART0 transmit FIFO.

> 
> The only definition I can find in the U-Boot sources is here:
> 
> include/asm-arm/arch-lpc2292/lpc2292_registers.h:#define U0THR 0xE000C000
> 
> but that is obviously not what you are using.
> 
> You probably forget the effects of compiler optimization and/or
> caching here.
> 
> 
> I bet you are using a plain  pointer  access  without  a  "volatile",
> which is essential here. Maybe even some form of "sync" is needed. In
> any  case,  you  should  use appropriate accessor functions to access
> device registers.

I do not know any accessor functions.
What do you mean with a "sync"?

Kind regards,

Remco Poelstra

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


[U-Boot] Ethernet interface

2009-03-04 Thread Remco Poelstra
Hi all,

I want to add ethernet support to my LPC2468 processor (using its 
integrated MAC), but I can't find  documentation about what interface to 
implement. How does U-Boot handle ethernet? What functions do I need to 
add to get ethernet working?

Thanks in advance,

Remco Poelstra

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


[U-Boot] Problem booting Linux

2009-03-12 Thread Remco Poelstra
Hi all,

I'm trying to get Linux booting on an ARM7 (NXP LPC2468). I copy the 
uImage to 0xa150 and the romfs.bin to 0xa180. I set bootargs to: 
root=/dev/ram initrd=0xa180,4000k console=/dev/ttyS0,115200N8
When I do 'bootm a150', it finds the image and tries to uncompress 
it, but it goes silent after printing"Uncompressing Kernel Image ..."
When I try to create the uImage with
'mkimage -A arm -O linux -T kernel -a 0 -e 0 -n "Linux Kernel Image" -d 
linux.bin uImage', I get the following output (mind the absent -C flag):
---
Image Name:   Linux Kernel Image
Created:  Thu Mar 12 15:37:01 2009
Image Type:   ARM Linux Kernel Image (gzip compressed)
Data Size:1986268 Bytes = 1939.71 kB = 1.89 MB
Load Address: 0x
Entry Point:  0x
-
bootm also still thinks that the image is compressed and bootm prints: 
Uncompressing Kernel Image ... Error: Bad gzipped data
GUNZIP: uncompress or overwrite error - must RESET board to recover

How can I make sure that the Linux image can boot?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] Problem booting Linux

2009-03-12 Thread Remco Poelstra
Remco Poelstra schreef:
> Hi all,
> 
> I'm trying to get Linux booting on an ARM7 (NXP LPC2468). I copy the 
> uImage to 0xa150 and the romfs.bin to 0xa180. I set bootargs to: 
> root=/dev/ram initrd=0xa180,4000k console=/dev/ttyS0,115200N8
> When I do 'bootm a150', it finds the image and tries to uncompress 
> it, but it goes silent after printing"Uncompressing Kernel Image ..."
> When I try to create the uImage with
> 'mkimage -A arm -O linux -T kernel -a 0 -e 0 -n "Linux Kernel Image" -d 
> linux.bin uImage', I get the following output (mind the absent -C flag):
> ---
> Image Name:   Linux Kernel Image
> Created:  Thu Mar 12 15:37:01 2009
> Image Type:   ARM Linux Kernel Image (gzip compressed)
> Data Size:1986268 Bytes = 1939.71 kB = 1.89 MB
> Load Address: 0x
> Entry Point:  0x
> -
> bootm also still thinks that the image is compressed and bootm prints: 
> Uncompressing Kernel Image ... Error: Bad gzipped data
> GUNZIP: uncompress or overwrite error - must RESET board to recover
> 
> How can I make sure that the Linux image can boot?

I just noticed that when I set the load and entry address to 0xa000 
(the start address of my external RAM), then bootm prints "starting 
kernel" and then U-boot resets itself twice
I think I have no idea what's going on here. Is this a problem in my 
U-boot or is it already in the kernel?

Kind regards,

Remco Poelstra

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


[U-Boot] Cleaning up new port

2009-03-17 Thread Remco Poelstra
Hi all,

I've finished my port of U-boot 2008.10 to the LPC2468. I've based my 
port on code by Embedded Artists, which was based on U-boot 1.1.6.
The LPC2468 is an ARM processor with build in peripherals, so I need to 
divide my code into LPC2468 generic part and a part for my board only 
(which is not to be published). I have however no clue on how to do 
that. What code should belong where?
Is there any documentation on the exact code structure of U-boot? Is 
anyone here interested in LPC2468 support and willing to offer some help?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] Cleaning up new port

2009-03-17 Thread Remco Poelstra
Wolfgang Denk schreef:
> In message <49bf91d5.2030...@duran-audio.com> you wrote:
>> I've finished my port of U-boot 2008.10 to the LPC2468. I've based my 
>> port on code by Embedded Artists, which was based on U-boot 1.1.6.
>> The LPC2468 is an ARM processor with build in peripherals, so I need to 
>> divide my code into LPC2468 generic part and a part for my board only 
>> (which is not to be published). I have however no clue on how to do 
> 
> Not pubslishing your code would be a stupid thing to do. Are you aware
> how quickly out-of-mainline code rots? You are already two releases
> behind against current mainline, and a lot of changes have already
> been queued up in the "next" branch for the next release. 

I fully understand. The problem is that there is a special Ethernet PHY 
on the board which is under a NDA, so I cannot publish code surrounding 
it. I can publish the general part of the ethernet driver.

> Try to forward port your stuff to the "next" branch (you will have to
> do that to submit any patches), and then think again if it makes sense
> for you to maintain an out-of-tree port.  It doesn't.
> 
>> that. What code should belong where?
>> Is there any documentation on the exact code structure of U-boot? Is 
>> anyone here interested in LPC2468 support and willing to offer some help?
> 
> Apply common sense. Then submit your patches. We  will  tell  you  if
> they  fit.  Note  that  so  far there is no LPC2468 support in U-Boot
> mainline, so you must provide some complete working  board  port,  or
> there would be code which cannot even be compiled, and we don't allow
> that.

I see, I will provide a working example.

Regards,

Remco Poelstra

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


[U-Boot] Generic MII interface

2009-03-17 Thread Remco Poelstra
Hi,

While working on cleaning up my LPC2468 port, I was wondering whether 
I'm correct in thinking that U-boot has some generic MII interface? My 
processor has a MAC which uses (R)MII to communicate with the PHY. Can I 
adapt my MAC driver for such interface, so the MAC and PHY code can be 
separated?

Kind regards,

Remco Poelstra

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


[U-Boot] [PATCH 1/1] LPC2468 support

2009-03-18 Thread Remco Poelstra
This patch includes the LPC2468 processor from NXP. Included is a 
working board example.

Signed-off-by: Remco Poelstra 
---
http://www.beryllium.net/~remco/u-boot.diff (144kb)

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


Re: [U-Boot] [PATCH 2/2] LPC2468 example board

2009-03-18 Thread Remco Poelstra
Example board for LPC2468 support

Signed-off-by: Remco Poelstra 
---
diff -upNr u-boot-orig/board/LPC2468/config.mk u-boot/board/LPC2468/config.mk
--- u-boot-orig/board/LPC2468/config.mk 1970-01-01 01:00:00.0 +0100
+++ u-boot/board/LPC2468/config.mk  2009-03-18 09:30:20.0 +0100
@@ -0,0 +1,29 @@
+#
+# (C) Copyright 2000
+# Sysgo Real-Time Solutions, GmbH 
+# Marius Groeger 
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#address where u-boot will be relocated
+TEXT_BASE =  0xA1f8
diff -upNr u-boot-orig/board/LPC2468/eth.c u-boot/board/LPC2468/eth.c
--- u-boot-orig/board/LPC2468/eth.c 1970-01-01 01:00:00.0 +0100
+++ u-boot/board/LPC2468/eth.c  2009-03-18 15:33:31.0 +0100
@@ -0,0 +1,694 @@
+/*
+ * (C) Copyright 2009 Duran Audio B.V. 
+ *
+ * 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
+ *
+ * 18-03-2009 Updated for U-boot 2009.3 by Remco Poelstra 

+ * Based on sample code from NXP
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * Typedefs and defines
+ */
+#define MAX_PHY_INIT_RETRY 10
+
+/* EMAC MODULE ID   */
+#define OLD_EMAC_MODULE_ID  ((0x3902 << 16) | 0x2000)
+
+/* MAC registers and parameters */
+#define PCONP_EMAC_CLOCK0x4000
+
+#define SPEED_100   1
+#define SPEED_100
+#define FULL_DUPLEX 1
+#define HALF_DUPLEX 0
+
+#define EMAC_RAM_ADDR   0x7FE0
+#define EMAC_RAM_SIZE   0x4000
+
+//#define EMAC_TX_DESCRIPTOR_COUNT0x0010
+//#define EMAC_RX_DESCRIPTOR_COUNT0x0010
+
+#define EMAC_TX_DESCRIPTOR_COUNT5
+#define EMAC_RX_DESCRIPTOR_COUNT4
+
+/*
+ * (Rx|Tx)Descriptor ::
+ *   [4] packet  - base address of the buffer containing the data
+ *   [4] control - control information
+ */
+#define TX_DESCRIPTOR_SIZE  (EMAC_TX_DESCRIPTOR_COUNT * 8)
+#define RX_DESCRIPTOR_SIZE  (EMAC_RX_DESCRIPTOR_COUNT * 8)
+
+/*
+ * TxStatus ::
+ *   [4] status
+ */
+#define TX_STATUS_SIZE  (EMAC_TX_DESCRIPTOR_COUNT * 4)
+
+/*
+ * RxStatus ::
+ *   [4] status- receive status flags
+ *   [4] statusHashCRC - concat of dest addr hash CRC and src addr CRC
+ */
+#define RX_STATUS_SIZE  (EMAC_RX_DESCRIPTOR_COUNT * 8)
+
+#define TOTAL_DESCRIPTOR_SIZE   (TX_DESCRIPTOR_SIZE + RX_DESCRIPTOR_SIZE + 
TX_STATUS_SIZE + RX_STATUS_SIZE)
+
+/* descriptors are placed at the end of the emac address space */
+#define EMAC_DESCRIPTOR_ADDR(EMAC_RAM_ADDR + EMAC_RAM_SIZE - 
TOTAL_DESCRIPTOR_SIZE)
+
+#define TX_DESCRIPTOR_ADDR  EMAC_DESCRIPTOR_ADDR
+#define TX_STATUS_ADDR  (EMAC_DESCRIPTOR_ADDR + TX_DESCRIPTOR_SIZE)
+#define RX_DESCRIPTOR_ADDR  (TX_STATUS_ADDR + TX_STATUS_SIZE)
+#define RX_STATUS_ADDR  (RX_DESCRIPTOR_ADDR + RX_DESCRIPTOR_SIZE)
+
+#define EMAC_DMA_ADDR   EMAC_RAM_ADDR
+#define EMAC_DMA_SIZE   EMAC_RAM_ADDR + EMAC_RAM_END - 
TOTAL_DESCRIPTOR_SIZE
+
+#define EMAC_BLOCK_SIZE 0x600
+#define EMAC_TX_BLOCK_NUM   5
+#define EMAC_RX_BLOCK_NUM   5
+#define TOTAL_EMAC_BLOCK_NUM10
+
+#define EMAC_BUFFER_SIZE(EMAC_BLOCK_SIZE * (EMAC_TX_BLOCK_NUM + 
EMAC_RX_BLOCK_NUM ))
+#define EMAC_TX_BUFFER_ADDR EMAC_RAM_ADDR
+#define EMAC_RX_BUFFER_ADDR (EMAC_RAM_ADDR + EMAC_BLOCK_SIZE * 
EMAC_TX_BLOCK_NUM)
+
+/* EMAC Descriptor TX and RX Control fields */
+#define EMAC_TX_DESC_INT0x8000
+#define EMAC_TX_DES

Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-24 Thread Remco Poelstra
This patch includes support for the LPC2468 processor from NXP.

The example board will follow when this patch is OK.

Signed-off-by: Remco Poelstra 
---
diff -upNr u-boot-orig/cpu/arm720t/interrupts.c 
u-boot-cleanup/cpu/arm720t/interrupts.c
--- u-boot-orig/cpu/arm720t/interrupts.c2009-03-18 00:42:12.0 
+0100
+++ u-boot-cleanup/cpu/arm720t/interrupts.c 2009-03-24 11:48:50.0 
+0100
@@ -29,7 +29,11 @@
  #include 
  #include 
  #include 
+#if defined(CONFIG_LPC2468)
+#include 
+#else
  #include 
+#endif

  #ifndef CONFIG_NETARM
  /* we always count down the max. */
@@ -40,6 +44,11 @@
  #ifdef CONFIG_LPC2292
  #undef READ_TIMER
  #define READ_TIMER (0x - GET32(T0TC))
+#elif defined(CONFIG_LPC2468)
+#undef TIMER_LOAD_VAL
+#define TIMER_LOAD_VAL 0
+#undef READ_TIMER
+#define READ_TIMER (0x - 0xE0004008)
  #endif

  #else
@@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs)
  pfnct = (void (*)(void))VICVectAddr;

  (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
  #else
  #error do_irq() not defined for this CPU type
  #endif
@@ -112,6 +129,9 @@ static ulong lastdec;

  int interrupt_init (void)
  {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif

  #if defined(CONFIG_NETARM)
/* disable all interrupts */
@@ -185,6 +205,13 @@ int interrupt_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   PUT32 (&(timer0->ir), 0);   /*disable all timer0 interupts 
*/
+   PUT32 (&(timer0->tcr), 0);  /*disable timer0 */
+   PUT32 (&(timer0->pr), CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1);
+   PUT32 (&(timer0->mcr), 0);
+   PUT32 (&(timer0->tc), 0);
+   PUT32 (&(timer0->tcr), 1);

  #else
  #error No interrupt_init() defined for this CPU type
diff -upNr u-boot-orig/cpu/arm720t/lpc24xx/flash.c 
u-boot-cleanup/cpu/arm720t/lpc24xx/flash.c
--- u-boot-orig/cpu/arm720t/lpc24xx/flash.c 1970-01-01 01:00:00.0 
+0100
+++ u-boot-cleanup/cpu/arm720t/lpc24xx/flash.c  2009-03-24 11:38:37.0 
+0100
@@ -0,0 +1,233 @@
+/*
+ * (C) Copyright 2006 Embedded Artists AB 
+ *
+ * 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 
+/*#include */
+#include 
+/* IAP commands use 32 bytes at the top of CPU internal sram, we
+   use 512 bytes below that */
+#define COPY_BUFFER_LOCATION 0x4000fde0
+
+#define IAP_LOCATION 0x7ff1
+#define IAP_CMD_PREPARE 50
+#define IAP_CMD_COPY 51
+#define IAP_CMD_ERASE 52
+#define IAP_CMD_CHECK 53
+#define IAP_CMD_ID 54
+#define IAP_CMD_VERSION 55
+#define IAP_CMD_COMPARE 56
+
+#define IAP_RET_CMD_SUCCESS 0
+
+static unsigned long command[5];
+static unsigned long result[2];
+
+extern void iap_entry (unsigned long *command, unsigned long *result);
+
+/*---
+ *
+ */
+int get_flash_sector (flash_info_t * info, ulong flash_addr)
+{
+   int i;
+
+   for (i = 1; i < (info->sector_count); i++) {
+   if (flash_addr < (info->start[i]))
+   break;
+   }
+
+   return (i - 1);
+}
+
+/*---
+ * This function assumes that flash_addr is aligned on 512 bytes boundary
+ * in flash. This function also assumes that prepare have been called
+ * for the sector in question.
+ */
+int lpc24xx_copy_buffer_to_flash (flash_info_t * info, ulong flash_addr)
+{
+   int first_sector;
+   int last_sector;
+
+   first_sector = get_flash_sector (info, flash_addr);
+   last_sector = get_flash_sector (info, flash_addr + 512 - 1);
+
+   /* prepare sectors for write */
+   command[0] = IAP_CMD_PREPARE;
+   command[1] = first_sector;
+   command[2] = last_sector;
+   iap_entry (command, result);
+   if (result[0] != IAP_RET_CMD_SUCCESS) {
+   printf ("IAP prepare failed\n");
+   return ERR_PROG_

Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-25 Thread Remco Poelstra
Wolfgang Denk schreef:
> Dear Remco Poelstra,
> 
> In message <49c8be7a.10...@duran-audio.com> you wrote:
>> This patch includes support for the LPC2468 processor from NXP.
>>
>> The example board will follow when this patch is OK.
> 
> Such a comment does not belong into the commit message. Please mode it
> below the "---" line.

I see, I thought nothing else was allowed below the "---"

>> Signed-off-by: Remco Poelstra 
>> ---
>> diff -upNr u-boot-orig/cpu/arm720t/interrupts.c 
>> u-boot-cleanup/cpu/arm720t/interrupts.c
>> --- u-boot-orig/cpu/arm720t/interrupts.c 2009-03-18 00:42:12.0 
>> +0100
>> +++ u-boot-cleanup/cpu/arm720t/interrupts.c  2009-03-24 11:48:50.0 
>> +0100
>> @@ -29,7 +29,11 @@
>>   #include 
>>   #include 
>>   #include 
>> +#if defined(CONFIG_LPC2468)
>> +#include 
>> +#else
>>   #include 
>> +#endif
> 
> Is there no way we can do without such a #ifdef here?

The problem is that start.S needs hardware.h, but the code in immap.h 
should not be included in start.S, so I can not merge hardware.h and immap.h

> 
>>   #ifndef CONFIG_NETARM
>>   /* we always count down the max. */
>> @@ -40,6 +44,11 @@
>>   #ifdef CONFIG_LPC2292
>>   #undef READ_TIMER
>>   #define READ_TIMER (0x - GET32(T0TC))
>> +#elif defined(CONFIG_LPC2468)
>> +#undef TIMER_LOAD_VAL
>> +#define TIMER_LOAD_VAL 0
>> +#undef READ_TIMER
>> +#define READ_TIMER (0x - 0xE0004008)
> 
> NAK. When you have to #unifdef existing variable definitions, then
> ther eis something fundamentally wrong. Please fix this problem at the
> cause, i. e. where the wroing values are defined.

I'll look into this.

> 
>>   #endif
>>
>>   #else
>> @@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs)
>>   pfnct = (void (*)(void))VICVectAddr;
>>
>>   (*pfnct)();
>> +#elif defined(CONFIG_LPC2468)
>> +void (*pfnct) (void);
>> +vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
>> +
>> +pfnct = (void (*)(void))(&(vic->vicaddr));
>> +
>> +(*pfnct) ();
> 
> Is there no way to combine this code with the one for the LPC2292? It
> doesn't look that different to me...

Interesting point. I was wondering the same. The problem lies in the 
fact that you want this patch to use C data structures, while the 
LPC2292 code uses offset lists. I can not convert the LPC2292 code to C 
structures, since a) I can not test the code b) I get paid to design 
hardware, not getting my ports published. I'm doing this to give 
something back to the community, since I really appreciate the work done 
by other OSS developers. But I can not spend time on converting complete 
other architectures. I leave that to other (the original LPC2292?) 
developers.

>> --- u-boot-orig/cpu/arm720t/lpc24xx/Makefile 1970-01-01 01:00:00.0 
>> +0100
>> +++ u-boot-cleanup/cpu/arm720t/lpc24xx/Makefile  2009-03-19 
>> 10:56:53.0 +0100
> ...
>> +$(SOBJS):
>> +$(CC) $(AFLAGS) -march=armv4t -c -o $(SOBJS) iap_entry.S
> 
> Such compile options hsould probably be set globally, not just for
> this single source file?

No, thumb code is less efficient in terms of performance, but this 
single file needs thumb code. See LPC2292.

>> diff -upNr u-boot-orig/cpu/arm720t/start.S u-boot-cleanup/cpu/arm720t/start.S
>> --- u-boot-orig/cpu/arm720t/start.S  2009-03-18 00:42:12.0 +0100
>> +++ u-boot-cleanup/cpu/arm720t/start.S   2009-03-24 11:52:35.0 
>> +0100
>> @@ -127,7 +127,7 @@ reset:
>>  bl  cpu_init_crit
>>   #endif
>>
>> -#ifdef CONFIG_LPC2292
>> +#if defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)
> 
> Is there no way to combine this code with the one for the LPC2292?

I'm sorry, it is combined in this case, no?

>>   #else
>>   #error No cpu_init_crit() defined for current CPU type
>>   #endif
>> @@ -383,7 +387,7 @@ lock_loop:
>>  str r1, [r0]
>>   #endif
>>
>> -#ifndef CONFIG_LPC2292
>> +#if !defined(CONFIG_LPC2292) && !defined(CONFIG_LPC2468)
> 
> Is there no way to combine this code with the one for the LPC2292?

Same here.

> 
>>  mov ip, lr
>>  /*
>>   * before relocating, we have to setup RAM timing
>> @@ -601,7 +605,7 @@ reset_cpu:
>>* on external peripherals such as watchdog timers, etc. */
>>   #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
>>  /* No specific reset actions for IntegratorAP/CM720T as yet */
>> 

Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-25 Thread Remco Poelstra
Wolfgang Denk schreef:
> Dear Remco Poelstra,
> 
>>> Is there no way we can do without such a #ifdef here?
>> The problem is that start.S needs hardware.h, but the code in immap.h 
>> should not be included in start.S, so I can not merge hardware.h and immap.h
> 
> Why not? I'm not aware of such a restriction?

I'm not an expert in assembly, but at first I had immap.h included in 
start.S and it complained about invalid instructions, so if I combine 
hardware.h and immap.h, then there must be some way of making sure that 
the assembler ignores the C code in immap.h. Do you know of any such thing?

  > I would like to avoid the ever growing list of
> 
>   #if defined(this) || defined(that) || defined(...) || ...
> 
> Maybe we can have a common #define that covers the common case?

I could add something like
#if defined(CONFIG_LPC2922) || defined(CONFIG_LPC2468)
#define (CONFIG_LPC2000)
#endif

in a general place and then use CONFIG_LPC2000 at the common places.

The problem I then have is: What would be the best place to put such 
define? Preferably it is automatically included also for the LPC2292 
code. If that's not possible, it can be defined in the board config, but 
I think that leads to confusion.
What's your opinion?

>>> Ummm... What exactly is this file needed for?
>> I don't need it, but start.S wants to include it. See my comment about 
>> the #ifdef's. Other architectures left it empty too, so it seemed the 
>> best option to me.
> 
> Hm... that doesn't really make sense to me. Also, the error checking
> in this file makes little sense to me.

I can remove the file, but than I need to put an #ifdef construct in 
start.S to only exclude it in the lpc2468 case. The file is used by the 
other ARM ports. I can also simply empty it, but in this way it is more 
similar to the other ports. What would you like?

> I'm not an expert for this processor, but I wonder it there might be
> some form of sync instruction (or memory barrier or similar) needed?

No, none at all. There is only a single linear memory region for the 
processor and a write to a location has immediate effect, whether it be 
a register or just RAM.

I suppose leaving parts of the 2468 and 2292 code separated is OK for 
the time being (considering offset lists and data structures), in the 
hope someone will upgrade the 2292 code?

I'm willing to look into the PUT32() vs. writel() problem in about half 
a year or so. That will at least cleanup part of the code.

Kind regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-26 Thread Remco Poelstra
Jean-Christophe PLAGNIOL-VILLARD schreef:
>> No, thumb code is less efficient in terms of performance, but this 
>> single file needs thumb code. See LPC2292.
> what is the Difference?
> 
> until a real big gap please do not use thumb

IAP entries need thumb code. This is not a problem, they are only used 
for programming the internal flash of the processor, so there is no 
performance penalty for normal operation.


>> Yes I do. They are straight from the LPC2292 code, so once they were 
>> considered OK. I checked out the the write{s,l,b} functions in asm/io.h, 
>> but although they look similar, for some reason they simply don't work. 
>> Given the similarities between the write{s,l,b} and the PUT* functions, 
>> what is the problem with those? Furthermore, the ARM architecture 
>> doesn't use any kind of special instructions for accessing registers, 
>> everything is memory mapped.
> please use readx/writex

Thanks for the pointer, I'll look into those.

>> I do understand that you want the best code for U-boot, but I do not 
>> entirely agree on all points. Certainly when I look at the code already 
>> in place in U-boot.
> I'm preparing a patch series to clean the arm720t to seprate it as arch
> and avoid this borring #ifdef

Can you explain what you mean here?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH 2/2] LPC2468 example board

2009-03-26 Thread Remco Poelstra
Jean-Christophe PLAGNIOL-VILLARD schreef:
> 
> please clean up first before a full review

Hi,

This patch is outdated. After the part 1 patch is OK, I'll work on this 
part. I'll include your comments then.

Kind regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-26 Thread Remco Poelstra
Jean-Christophe PLAGNIOL-VILLARD schreef:
>> I'm not an expert in assembly, but at first I had immap.h included in 
>> start.S and it complained about invalid instructions, so if I combine 
>> hardware.h and immap.h, then there must be some way of making sure that 
>> the assembler ignores the C code in immap.h. Do you know of any such thing?
>>
> immap.h?

immap.h is like hardware.h for the LPC2292, but it contains C structures 
to define the registers instead of #defines. I based it on the ppc code.
See the patch for an explanation.

>> I can remove the file, but than I need to put an #ifdef construct in 
>> start.S to only exclude it in the lpc2468 case. The file is used by the 
>> other ARM ports. I can also simply empty it, but in this way it is more 
>> similar to the other ports. What would you like?
> no please do not I'll prefer to separate arch file

I do not understand what you mean with the last part of your comment.

Kind regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-03-26 Thread Remco Poelstra
Remco Poelstra schreef:
>>> Yes I do. They are straight from the LPC2292 code, so once they were 
>>> considered OK. I checked out the the write{s,l,b} functions in asm/io.h, 
>>> but although they look similar, for some reason they simply don't work. 
>>> Given the similarities between the write{s,l,b} and the PUT* functions, 
>>> what is the problem with those? Furthermore, the ARM architecture 
>>> doesn't use any kind of special instructions for accessing registers, 
>>> everything is memory mapped.
>> please use readx/writex
> 
> Thanks for the pointer, I'll look into those.

I can't find these functions/macros, but I think you mean the 
write{b,s,l} macros. As I already indicated in a previous e-mail, they 
do not work in my code. If I replace, e.g. the PUT32 with writel than 
the code doesn't run. I will look into that problem after I've finished 
another project at work.

Kind regards,

Remco Poelstra

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


[U-Boot] Problem cloning Git

2009-04-15 Thread Remco Poelstra
Hi,

While doing > git clone git://git.denx.de/u-boot.git, I get the following 
errors:
> remote: Compressing objects: 100% (16533/16533), done.
> remote: Total 90263 (delta 74103), reused 89209 (delta 73184)
> Receiving objects: 100% (90263/90263), 29.61 MiB | 175 KiB/s, done.
> Resolving deltas: 100% (74103/74103), done.
> error: Trying to write ref REMOTE_HEAD with nonexistant object 
> f75a729b5c1434d5a5bbf453b1b699bf1c3ffbce
> fatal: Cannot update the ref 'REMOTE_HEAD'.
> error: Trying to write ref refs/remotes/origin/i.MX31 with nonexistant object 
> a6e0e74f933745c45d2b5ee83a0898d973acaf71
> fatal: Cannot update the ref 'refs/remotes/origin/i.MX31'.
> error: Trying to write ref refs/remotes/origin/lwmon5 with nonexistant object 
> 0008e2abc8456d51e0e1bfae71e6f14f74790cc5
> fatal: Cannot update the ref 'refs/tags/LABEL_2003_03_06_0050'.

> error: Trying to write ref refs/tags/LABEL_2003_03_06_0200 with nonexistant 
> object db2f721ffcf9693086a7e5c6c7015f2019e7f52e
> fatal: Cannot update the ref 'refs/tags/LABEL_2003_03_06_0200'.
> error: Trying to write ref refs/tags/LABEL_2003_03_06_1440 with nonexistant 
> object 500545cc6b83958209128bffa825b3c842a21a4e
> fatal: Cannot update the ref 'refs/tags/LABEL_2003_03_06_1440'.
> error: Trying to write ref refs/tags/LABEL_2003_03_06_2255 with nonexistant 
> object 1cb8e980c41e86760fa93de63f4e4cf643bef9d9
> fatal: Cannot update the ref 'refs/tags/LABEL_2003_03_06_2255'. 
> Warning: Remote HEAD refers to nonexistent ref, unable to checkout.

Am I doing something wrong?

Kind regards,

Remco Poelstra

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


Re: [U-Boot] Problem cloning Git

2009-04-20 Thread Remco Poelstra
Detlev Zundel schreef:
> Just checked here and I don't see any problems.  Maybe try again, or try
> upgrading git on your end.  For the test I used 1.5.6.5 and 1.6.2.2,
> both without a problem.

Thanks for your reply.
Upgrading to a newer version indeed fixed the problem.

Regards,

Remco Poelstra

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


Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-04-24 Thread Remco Poelstra
This patch includes support for the LPC2468 processor from NXP.

Signed-off-by: Remco Poelstra 
---
A working board example will be submitted when this patch is found to be OK.
This patch is against latest git.
The previous problem with PUTx vs. writex is solved.

 From 75361079ed78fb40c2840b3bd74687153e486620 Mon Sep 17 00:00:00 2001
From: Remco Poelstra 
Date: Fri, 24 Apr 2009 12:18:21 +0200
Subject: [PATCH] Support for LPC2468 processor from NXP

---
  Makefile|3 +
  cpu/arm720t/cpu.c   |2 +-
  cpu/arm720t/interrupts.c|   37 +++-
  cpu/arm720t/lpc24xx/Makefile|   50 +
  cpu/arm720t/lpc24xx/flash.c |  233 
  cpu/arm720t/lpc24xx/iap_entry.S |7 +
  cpu/arm720t/start.S |   11 +-
  drivers/serial/Makefile |1 +
  drivers/serial/serial_lpc2468.c |  119 +++
  include/asm-arm/arch-lpc24xx/hardware.h |   32 +++
  include/asm-arm/arch-lpc24xx/immap.h|  351 +++
  include/asm-arm/config.h|4 +
  include/flash.h |1 +
  13 files changed, 842 insertions(+), 9 deletions(-)
  create mode 100644 cpu/arm720t/lpc24xx/Makefile
  create mode 100644 cpu/arm720t/lpc24xx/flash.c
  create mode 100644 cpu/arm720t/lpc24xx/iap_entry.S
  create mode 100644 drivers/serial/serial_lpc2468.c
  create mode 100644 include/asm-arm/arch-lpc24xx/hardware.h
  create mode 100644 include/asm-arm/arch-lpc24xx/immap.h

diff --git a/Makefile b/Makefile
index e91c051..fb23ee6 100644
--- a/Makefile
+++ b/Makefile
@@ -2940,6 +2940,9 @@ B2_config :   unconfig
  ## ARM720T Systems
  #

+LPC2468_config:unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468 NULL lpc24xx
+
  armadillo_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t armadillo

diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c
index 6c40903..b3a2853 100644
--- a/cpu/arm720t/cpu.c
+++ b/cpu/arm720t/cpu.c
@@ -75,7 +75,7 @@ int cleanup_before_linux (void)
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
  #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2000)
disable_interrupts ();
/* Nothing more needed */
  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c
index 39ed345..d7aec27 100644
--- a/cpu/arm720t/interrupts.c
+++ b/cpu/arm720t/interrupts.c
@@ -29,17 +29,26 @@
  #include 
  #include 
  #include 
+#include 
+#if defined(CONFIG_LPC2468)
+#include 
+#else
  #include 
+#endif

  #ifndef CONFIG_NETARM
+
+#if defined(CONFIG_LPC2292)
+#define TIMER_LOAD_VAL 0x
+#define READ_TIMER (0x - GET32(T0TC))
+#elif defined(CONFIG_LPC2468)
+#define TIMER_LOAD_VAL 0
+#define READ_TIMER (0x - 0xE0004008)
+#else
  /* we always count down the max. */
  #define TIMER_LOAD_VAL 0x
  /* macro to read the 16 bit timer */
  #define READ_TIMER (IO_TC1D & 0x)
-
-#ifdef CONFIG_LPC2292
-#undef READ_TIMER
-#define READ_TIMER (0x - GET32(T0TC))
  #endif

  #else
@@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs)
  pfnct = (void (*)(void))VICVectAddr;

  (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
  #else
  #error do_irq() not defined for this CPU type
  #endif
@@ -112,6 +129,9 @@ static ulong lastdec;

  int interrupt_init (void)
  {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif

  #if defined(CONFIG_NETARM)
/* disable all interrupts */
@@ -185,6 +205,13 @@ int interrupt_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   writel (0, &(timer0->ir));  /*disable all timer0 interupts 
*/
+   writel (0, &(timer0->tcr)); /*disable timer0 */
+   writel (CFG_SYS_CLK_FREQ / CONFIG_SYS_HZ - 1, &(timer0->pr));
+   writel (0, &(timer0->mcr));
+   writel (0, &(timer0->tc));
+   writel (1, &(timer0->tcr));

  #else
  #error No interrupt_init() defined for this CPU type
@@ -201,7 +228,7 @@ int interrupt_init (void)
   */


-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) 
|| defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC2292)
+#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) 
|| defined(CONFIG_ARMADILLO) || defined(

Re: [U-Boot] [PATCH 1/2] LPC2468 support

2009-04-28 Thread Remco Poelstra
This patch includes support for the LPC2468 processor from NXP.

Signed-off-by: Remco Poelstra 
---
It now also includes support for the ethernet interface.
It does not include any changes to flash related code, until it's known
where to put it. Stefan was right that the unreferenced function are needed
by the board code.
Neither does it contain any significant changes to the interrupt code,
waiting for the patch to clean it up.
I would be gratefull if the patch can be applied before then, I can then help
clean up the code, instead of staying behind.
Concerning thumb code: As explained earlier, it is needed to call the internal
IAP functions. These are seldom used, so there is no performance penalty.

 From 10ae52e03e99a2567f4b74434ba346b45c24ac02 Mon Sep 17 00:00:00 2001
From: Remco Poelstra 
Date: Fri, 24 Apr 2009 12:18:21 +0200
Subject: [PATCH] Support for LPC2468 processor from NXP

---
  Makefile|3 +
  cpu/arm720t/cpu.c   |4 +-
  cpu/arm720t/interrupts.c|   38 ++-
  cpu/arm720t/lpc24xx/Makefile|   50 +++
  cpu/arm720t/lpc24xx/flash.c |  236 +++
  cpu/arm720t/lpc24xx/iap_entry.S |7 +
  cpu/arm720t/start.S |   12 +-
  drivers/net/Makefile|1 +
  drivers/net/lpc2468_eth.c   |  494 +++
  drivers/net/lpc2468_eth.h   |  159 ++
  drivers/serial/Makefile |1 +
  drivers/serial/serial_lpc2468.c |  119 
  include/asm-arm/arch-lpc24xx/hardware.h |   32 ++
  include/asm-arm/arch-lpc24xx/immap.h|  406 +
  include/asm-arm/config.h|4 +
  include/flash.h |1 +
  16 files changed, 1558 insertions(+), 9 deletions(-)
  create mode 100644 cpu/arm720t/lpc24xx/Makefile
  create mode 100644 cpu/arm720t/lpc24xx/flash.c
  create mode 100644 cpu/arm720t/lpc24xx/iap_entry.S
  create mode 100644 drivers/net/lpc2468_eth.c
  create mode 100644 drivers/net/lpc2468_eth.h
  create mode 100644 drivers/serial/serial_lpc2468.c
  create mode 100644 include/asm-arm/arch-lpc24xx/hardware.h
  create mode 100644 include/asm-arm/arch-lpc24xx/immap.h

diff --git a/Makefile b/Makefile
index e91c051..fb23ee6 100644
--- a/Makefile
+++ b/Makefile
@@ -2940,6 +2940,9 @@ B2_config :   unconfig
  ## ARM720T Systems
  #

+LPC2468_config:unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468 NULL lpc24xx
+
  armadillo_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm720t armadillo

diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c
index 6c40903..29e13d0 100644
--- a/cpu/arm720t/cpu.c
+++ b/cpu/arm720t/cpu.c
@@ -75,7 +75,9 @@ int cleanup_before_linux (void)
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
  #endif
-#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || 
defined(CONFIG_LPC2292)
+#elif  defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) ||\
+   defined(CONFIG_LPC2000)
+
disable_interrupts ();
/* Nothing more needed */
  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c
index 39ed345..8671b63 100644
--- a/cpu/arm720t/interrupts.c
+++ b/cpu/arm720t/interrupts.c
@@ -29,17 +29,26 @@
  #include 
  #include 
  #include 
+#include 
+#if defined(CONFIG_LPC2468)
+#include 
+#else
  #include 
+#endif

  #ifndef CONFIG_NETARM
+
+#if defined(CONFIG_LPC2292)
+#define TIMER_LOAD_VAL 0x
+#define READ_TIMER (0x - GET32(T0TC))
+#elif defined(CONFIG_LPC2468)
+#define TIMER_LOAD_VAL 0
+#define READ_TIMER (0x - 0xE0004008)
+#else
  /* we always count down the max. */
  #define TIMER_LOAD_VAL 0x
  /* macro to read the 16 bit timer */
  #define READ_TIMER (IO_TC1D & 0x)
-
-#ifdef CONFIG_LPC2292
-#undef READ_TIMER
-#define READ_TIMER (0x - GET32(T0TC))
  #endif

  #else
@@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs)
  pfnct = (void (*)(void))VICVectAddr;

  (*pfnct)();
+#elif defined(CONFIG_LPC2468)
+   void (*pfnct) (void);
+   vic_2468_t *vic = &(((immap_t *)CONFIG_SYS_IMMAP)->ahb.vic);
+
+   pfnct = (void (*)(void))(&(vic->vicaddr));
+
+   (*pfnct) ();
+
  #else
  #error do_irq() not defined for this CPU type
  #endif
@@ -112,6 +129,9 @@ static ulong lastdec;

  int interrupt_init (void)
  {
+#if defined(CONFIG_LPC2468)
+   timer_2468_t *timer0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.timer0);
+#endif

  #if defined(CONFIG_NETARM)
/* disable all interrupts */
@@ -185,6 +205,13 @@ int interrupt_init (void)
PUT32(T0MCR, 0);
PUT32(T0TC, 0);
PUT32(T0TCR, 1);/* enable timer0 */
+#elif defined(CONFIG_LPC2468)
+   writel