LPC2468 support
Subsystems (3)
PATCH 1/1 LPC2468 support
This patch includes the LPC2468 processor from NXP. Included is a working board example.
---
http://www.beryllium.net/~remco/u-boot.diff (144kb)
PATCH 1/1 LPC2468 support
Dear Remco Poelstra,
Quoted 6 lines · In message <[email protected]> you wrote:
This patch includes the LPC2468 processor from NXP. Included is a working board example.
Signed-off-by Remco Poelstra <[email protected]>---
http://www.beryllium.net/~remco/u-boot.diff (144kb)
Please split this into a series of independent parts (each smaller than the size limit of the list)
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Gravitation cannot be held responsible for people falling in love." - Albert Einstein
PATCH 1/2 LPC2468 support
This patch includes support for the LPC2468 processor from NXP.
---
cpu/arm720t/cpu.c +18 -1
@@ -78,6 +78,23 @@ int cleanup_before_linux (void)/* Nothing more needed */ #elif defined(CONFIG_INTEGRATOR ) && defined(CONFIG_ARCH_INTEGRATOR )/* No cleanup before linux for IntegratorAP/CM720T as yet */ +#elif defined(CONFIG_LPC2468 ) +disable_interrupts (); + { +volatile unsigned char dummy,i; + +U0IER =0 ; +U1IER =0 ; +for (i=0 ; i<16 ; i++) + { + dummy=U0RBR ; + dummy=U0LSR ; + dummy=U0IIR ; + dummy=U1RBR ; + dummy=U1LSR ; + dummy=U1IIR ; + } + }#else #error No cleanup_before_linux() defined for this CPU type#endif
@@ -252,7 +269,7 @@ int dcache_status (void)void icache_enable (void ) { } -#elif defined(CONFIG_LPC2292 )/* just to satisfy the compiler */ +#elif defined(CONFIG_LPC2292 ) || defined(CONFIG_LPC2468 )/* just to satisfy the compiler */ #else #error No icache/dcache enable/disable functions defined for this CPU type#endif
cpu/arm720t/interrupts.c +14 -3
@@ -40,6 +40,11 @@#ifdef CONFIG_LPC2292 #undef READ_TIMER#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#undef TIMER_LOAD_VAL +#define TIMER_LOAD_VAL 0 +#undef READ_TIMER +#define READ_TIMER (0xFFFFFFFF - T0TC)#endif #else
@@ -73,7 +78,7 @@ void do_irq (struct pt_regs *pt_regs) }#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)/* No do_irq() for IntegratorAP/CM720T as yet */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)void (*pfnct)(void );
@@ -185,7 +190,13 @@ int interrupt_init (void)PUT32 (T0MCR ,0 );PUT32 (T0TC ,0 );PUT32 (T0TCR ,1 );/* enable timer0 */ - +#elif defined(CONFIG_LPC2468 ) +T0IR =0 ;/*disable all timer0 interupts*/ +T0TCR =0 ;/*disable timer0*/ +T0PR =CFG_SYS_CLK_FREQ /CONFIG_SYS_HZ -1 ; +T0MCR =0 ; +T0TC =0 ; +T0TCR =1 ;#else #error No interrupt_init() defined for this CPU type#endif
@@ -201,7 +212,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(CONFIG_LPC2292) ||
defined(CONFIG_LPC2468)
void reset_timer (void)
{
@@ -229,7 +240,7 @@ void udelay (unsigned long usec)
tmo += get_timer (0);
while (get_timer_masked () < tmo)
-#ifdef CONFIG_LPC2292
+#if defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)
/* GJ - not sure whether this is really needed or a misunderstanding */ __asm__ __volatile__(" nop");
#else
cpu/arm720t/lpc24xx/flash.c +249 -0
249 lines not on this page · raw message
cpu/arm720t/lpc24xx/iap_entry.S +7 -0
@@ -0,0 +1,7 @@ +IAP_ADDRESS: .word 0x7FFFFFF1 + +.globl iap_entry +iap_entry: + ldr r2, IAP_ADDRESS + bx r2 + mov pc, lr
cpu/arm720t/lpc24xx/Makefile +50 -0
50 lines not on this page · raw message
cpu/arm720t/serial.c +87 -0
91 lines not on this page · raw message
cpu/arm720t/start.S +8 -3
@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) bl lowlevel_init #endif
@@ -368,6 +368,10 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000 #else #error No cpu_init_crit() defined for current CPU type #endif
@@ -383,7 +387,8 @@ lock_loop: str r1, [r0] #endif -#ifndef CONFIG_LPC2292 +//#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2292) && !defined(CONFIG_LPC2468) mov ip, lr /* * before relocating, we have to setup RAM timing
@@ -601,7 +606,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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) .align 5 .globl reset_cpu reset_cpu:
include/asm-arm/arch-lpc24xx/hardware.h +33 -0
@@ -0,0 +1,33 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ + +#if defined(CONFIG_LPC2468 ) +#include <asm-arm/arch-lpc24xx/lpc24xx_registers.h> +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h +1123 -0
1,123 lines not on this page · raw message
include/flash.h +2 -2
@@ -338,8 +338,8 @@ extern flash_info_t *flash_get_info(ulon#define TOSH_ID_FVT160 0xC2/* TC58FVT160 ID (16 M, top ) */ #define TOSH_ID_FVB160 0x43/* TC58FVT160 ID (16 M, bottom ) */ -#define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ - +#define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ +#define PHILIPS_LPC2468 0x0603FF35/* LPC2468 internal FLASH */ /*----------------------------------------------------------------------- * Internal FLASH identification codes *
PATCH 1/2 LPC2468 support
Dear Remco Poelstra,
Quoted 3 lines · In message <[email protected]> you wrote:
This patch includes support for the LPC2468 processor from NXP.
Signed-off-by Remco Poelstra <[email protected]>
General comment: There are lots of coding style issues: trailing white space, incorrect brace style, lines too long, C++ comments, incorrect indentation, indentation not by TAB, etc.
Please clean up.
cpu/arm720t/cpu.c int cleanup_before_linux (void) · line 84
Quoted 11 lines
diff -upNr
u-boot-orig/cpu/arm720t/cpu.cu-boot/cpu/arm720t/cpu.ccpu/arm720t/cpu.c +4
-0@@ -78,6 +78,23 @@ int cleanup_before_linux (void)/* Nothing more needed */ #elif defined(CONFIG_INTEGRATOR ) && defined(CONFIG_ARCH_INTEGRATOR )/* No cleanup before linux for IntegratorAP/CM720T as yet */ +#elif defined(CONFIG_LPC2468 ) +disable_interrupts (); + { +volatile unsigned char dummy,i;
Please do not use arbitrary blocks to declare variables right in the middle of the function.
cpu/arm720t/cpu.c int cleanup_before_linux (void) · line 89
Quoted 4 lines
cpu/arm720t/cpu.c +4
-0+U0IER =0 ; +U1IER =0 ; +for (i=0 ; i<16 ; i++) + {
Incorrect brace style, here and in many other places. Indetation not by TAB, here and in many other places.
cpu/arm720t/cpu.c int cleanup_before_linux (void) · line 96
Quoted 7 lines
cpu/arm720t/cpu.c +7
-0+ dummy=U0RBR ; + dummy=U0LSR ; + dummy=U0IIR ; + dummy=U1RBR ; + dummy=U1LSR ; + dummy=U1IIR ; + }
What sort of magic is this "code" supposed to perform?
Quoted 9 lines
diff -upNr
u-boot-orig/cpu/arm720t/serial.cu-boot/cpu/arm720t/serial.ccpu/arm720t/serial.c +2
-0@@ -199,4 +199,91 @@ int serial_tstc (void) return (GET8(U0LSR) & 1); } +#elif defined(CONFIG_LPC2468) +#include <asm/arch/hardware.h>
cpu/arm720t/serial.c int serial_tstc (void) · line 213
Quoted 10 lines
cpu/arm720t/serial.c +10
-0+ +int serial_init (void ) +{ +unsigned long pinsel0; + +//enable uart #0 pins in GPIO (P0.2 = TxD0, P0.3 = RxD0) + pinsel0 =PINSEL0 ; + pinsel0 &= ~(0x000000f0 ); + pinsel0 |=0x00000050 ; +PINSEL0 = pinsel0;
Please use proper accessor functions to access device registers, here and everywhere else.
Quoted 17 lines
cpu/arm720t/serial.c +17
-0+void serial_setbrg (void ) +{ +DECLARE_GLOBAL_DATA_PTR ; + +unsigned short divisor =0 ; +unsigned long fractional =0 ; + +switch (gd->baudrate) { +case 1200 : divisor =3000 ; fractional =0xF0 ;break ; +case 9600 : divisor =375 ; fractional =0xF0 ;break ; +// case 19200: divisor = 188; fractional = 0; break; +case 19200 : divisor =175 ; fractional =0xAF ;break ; +case 38400 : divisor =94 ; fractional =0 ;break ; +// case 38400: divisor = 75; fractional = 0xC3; break; +// case 57600: divisor = 63; fractional = 0; break; +case 57600 : divisor =50 ; fractional =0xC3 ;break ; +// case 115200: divisor = 31; fractional = 0; break;
...
Quoted 1 line
+//#if 0
...
No such dead code, please!
Quoted 6 lines
diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/lpc24xx_registers.hu-boot/include/asm-arm/arch-lpc24xx/lpc24xx_registers.hinclude/asm-arm/arch-lpc24xx/lpc24xx_registers.h +2
-0@@ -0,0 +1,1123 @@ +#ifndef __LPC24XX_REGISTERS_H +#define __LPC24XX_REGISTERS_H
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h line 12
Quoted 10 lines
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h +10
-0+ +#include <config.h> + +/* Macros for reading/writing registers */ +//#define PUT8(reg, value) (*(volatile unsigned char*)(reg) = (value)) +//#define PUT16(reg, value) (*(volatile unsigned short*)(reg) = (value)) +//#define PUT32(reg, value) (*(volatile unsigned int*)(reg) = (value)) +//#define GET8(reg) (*(volatile unsigned char*)(reg)) +//#define GET16(reg) (*(volatile unsigned short*)(reg)) +//#define GET32(reg) (*(volatile unsigned int*)(reg))
No dead code, here and elsewhere, please.
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h line 26
Quoted 13 lines
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h +13
-0+ +/* Vectored Interrupt Controller (VIC) */ +#define VIC_BASE_ADDR 0xFFFFF000 +#define VICIRQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x000)) +#define VICFIQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x004)) +#define VICRawIntr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x008)) +#define VICIntSelect (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x00C)) +#define VICIntEnable (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x010)) +#define VICIntEnClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x014)) +#define VICSoftInt (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x018)) +#define VICSoftIntClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x01C)) +#define VICProtection (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x020)) +#define VICSWPrioMask (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x024))
Please do not use offset lists, but define a proper C data structure instead. And never ever access device regiters through simple volatile pointers. Use proper accessor functions. Here and elsewhere.
The whole code needs a *major* cleanup before resubmitting.
[Note: I do not spend time on the second part this time.]
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de To understand a program you must become both the machine and the program.
PATCH 1/2 LPC2468 support
Wolfgang Denk schreef:
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-0+/* Vectored Interrupt Controller (VIC) */ +#define VIC_BASE_ADDR 0xFFFFF000 +#define VICIRQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x000)) +#define VICFIQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x004)) +#define VICRawIntr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x008)) +#define VICIntSelect (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x00C)) +#define VICIntEnable (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x010)) +#define VICIntEnClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x014))
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+#define VICSoftInt (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x018)) +#define VICSoftIntClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x01C)) +#define VICProtection (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x020)) +#define VICSWPrioMask (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x024))Please do not use offset lists, but define a proper C data structure instead. And never ever access device regiters through simple volatile pointers. Use proper accessor functions. Here and elsewhere.
Hi,
All examples I checked use the same syntax for defining registers, so I left it in the code. If that is a problem, can you indicate an example which does The Right Thing (tm)?
Quoted 3 lines
The whole code needs a *major* cleanup before resubmitting.
I think the patch now matches the other criteria. The patch is a bit bigger, since
other code did not follow the Coding Styles either. I used indent to fix my code and it fixed the other code as well.
The second patch will follow when this patch is OK.
Regards,
Remco Poelstra
----
cpu/arm720t/cpu.c +37 -40
@@ -41,7 +41,9 @@ int cpu_init (void)* setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ -IRQ_STACK_START = _armboot_start -CONFIG_SYS_MALLOC_LEN -CONFIG_SYS_GBL_DATA_SIZE -4 ; +IRQ_STACK_START = + _armboot_start -CONFIG_SYS_MALLOC_LEN -CONFIG_SYS_GBL_DATA_SIZE - +4 ;FIQ_STACK_START =IRQ_STACK_START -CONFIG_STACKSIZE_IRQ ;#endif return 0 ;
@@ -63,17 +65,17 @@ int cleanup_before_linux (void)disable_interrupts ();/* turn off I-cache */ - asm ("mrc p15, 0, %0, c1, c0, 0" :"=r" (i)); + asm ("mrc p15, 0, %0, c1, c0, 0" :"=r" (i)); i &= ~0x1000 ; - asm ("mcr p15, 0, %0, c1, c0, 0" : :"r" (i)); + asm ("mcr p15, 0, %0, c1, c0, 0" : :"r" (i));/* flush I-cache */ - asm ("mcr p15, 0, %0, c7, c5, 0" : :"r" (i)); + asm ("mcr p15, 0, %0, c7, c5, 0" : :"r" (i));#ifdef CONFIG_ARM7_REVD /* 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_LPC2292 )|| defined(CONFIG_LPC2468 )disable_interrupts ();/* Nothing more needed */ #elif defined(CONFIG_INTEGRATOR ) && defined(CONFIG_ARCH_INTEGRATOR )
@@ -84,12 +86,11 @@ int cleanup_before_linux (void)return 0 ; } -int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) +int do_reset (cmd_tbl_t * cmdtp,int flag,int argc,char *argv[]) {disable_interrupts ();reset_cpu (0 ); -/*NOTREACHED*/ -return (0 ); +/*NOTREACHED*/ return (0 ); }/*
@@ -99,30 +100,26 @@ int do_reset (cmd_tbl_t *cmdtp, int flag#if defined(CONFIG_IMPA7 ) || defined(CONFIG_EP7312 ) || defined(CONFIG_NETARM ) || defined(CONFIG_ARMADILLO )/* read co-processor 15, register #1 (control register) */ -static unsigned long read_p15_c1 (void ) +static unsigned long read_p15_c1 (void ) {unsigned long value; - __asm__ __volatile__( -"mrc p15, 0, %0, c1, c0, 0 @ read control reg\n" - :"=r" (value) - : - :"memory" ); + __asm__ __volatile__ ("mrc p15, 0, %0, c1, c0, 0 @ read control reg\n" :"=r" (value) + ::"memory" );/* printf("p15/c1 is = %08lx\n", value); */ return value; }/* write to co-processor 15, register #1 (control register) */ -static void write_p15_c1 (unsigned long value) +static void write_p15_c1 (unsigned long value) {/* printf("write %08lx to p15/c1\n", value); */ - __asm__ __volatile__( -"mcr p15, 0, %0, c1, c0, 0 @ write it back\n" - : - :"r" (value) - :"memory" ); + __asm__ + __volatile__ + ("mcr p15, 0, %0, c1, c0, 0 @ write it back\n" ::"r" (value) + :"memory" ); -read_p15_c1 (); +read_p15_c1 (); }static void cp_delay (void )
@@ -130,7 +127,7 @@ static void cp_delay (void)volatile int i;/* copro seems to need some delay between reading and writing */ -for (i =0 ; i <100 ; i++); +for (i =0 ; i <100 ; i++) ; }/* See also ARM Ref. Man. */
@@ -196,63 +193,63 @@ void icache_enable (void)s32 i;/* disable all cache bits */ -CLR_REG (REG_SYSCFG ,0x3F ); +CLR_REG (REG_SYSCFG ,0x3F );/* 8KB cache, write enable */ -SET_REG (REG_SYSCFG ,CACHE_WRITE_BUFF |CACHE_MODE_01 ); +SET_REG (REG_SYSCFG ,CACHE_WRITE_BUFF |CACHE_MODE_01 );/* clear TAG RAM bits */ -for ( i =0 ; i <256 ; i++) -PUT_REG (CACHE_TAG_RAM +4 *i,0x00000000 ); +for (i =0 ; i <256 ; i++) +PUT_REG (CACHE_TAG_RAM +4 * i,0x00000000 );/* clear SET0 RAM */ -for (i=0 ; i <1024 ; i++) -PUT_REG (CACHE_SET0_RAM +4 *i,0x00000000 ); +for (i =0 ; i <1024 ; i++) +PUT_REG (CACHE_SET0_RAM +4 * i,0x00000000 );/* clear SET1 RAM */ -for (i=0 ; i <1024 ; i++) -PUT_REG (CACHE_SET1_RAM +4 *i,0x00000000 ); +for (i =0 ; i <1024 ; i++) +PUT_REG (CACHE_SET1_RAM +4 * i,0x00000000 );/* enable cache */ - SET_REG( REG_SYSCFG, CACHE_ENABLE); + SET_REG (REG_SYSCFG, CACHE_ENABLE); }void icache_disable (void ) {/* disable all cache bits */ -CLR_REG (REG_SYSCFG ,0x3F ); +CLR_REG (REG_SYSCFG ,0x3F ); }int icache_status (void ) { -return GET_REG (REG_SYSCFG ) &CACHE_ENABLE ; +return GET_REG (REG_SYSCFG ) &CACHE_ENABLE ; }void dcache_enable (void ) {/* we don't have seperate instruction/data caches */ -icache_enable (); +icache_enable (); }void dcache_disable (void ) {/* we don't have seperate instruction/data caches */ -icache_disable (); +icache_disable (); }int dcache_status (void ) {/* we don't have seperate instruction/data caches */ -return icache_status (); +return icache_status (); }#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)/* No specific cache setup for IntegratorAP/CM720T as yet */ -void icache_enable (void ) - { - } -#elif defined(CONFIG_LPC2292)/* just to satisfy the compiler */ +void icache_enable (void ) +{ +} +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)/* just to satisfy the compiler */ #else #error No icache/dcache enable/disable functions defined for this CPU type#endif
cpu/arm720t/interrupts.c +50 -37
186 lines not on this page · raw message
cpu/arm720t/lpc24xx/flash.c +232 -0
232 lines not on this page · raw message
cpu/arm720t/lpc24xx/iap_entry.S +7 -0
@@ -0,0 +1,7 @@ +IAP_ADDRESS: .word 0x7FFFFFF1 + +.globl iap_entry +iap_entry: + ldr r2, IAP_ADDRESS + bx r2 + mov pc, lr
cpu/arm720t/lpc24xx/Makefile +50 -0
50 lines not on this page · raw message
cpu/arm720t/serial.c +124 -52
242 lines not on this page · raw message
cpu/arm720t/start.S +7 -3
@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) bl lowlevel_init #endif
@@ -368,6 +368,10 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000 #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) 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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) .align 5 .globl reset_cpu reset_cpu:
include/asm-arm/arch-lpc24xx/hardware.h +33 -0
@@ -0,0 +1,33 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ + +#if defined(CONFIG_LPC2468 ) +#include <asm-arm/arch-lpc24xx/lpc24xx_registers.h> +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
include/asm-arm/arch-lpc24xx/lpc24xx_registers.h +1101 -0
1,101 lines not on this page · raw message
include/flash.h +124 -126
300 lines not on this page · raw message
PATCH 1/2 LPC2468 support
Dear Remco Poelstra,
Quoted 19 lines · In message <[email protected]> you wrote:
Wolfgang Denk schreef:
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-0+/* Vectored Interrupt Controller (VIC) */ +#define VIC_BASE_ADDR 0xFFFFF000 +#define VICIRQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x000)) +#define VICFIQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x004)) +#define VICRawIntr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x008)) +#define VICIntSelect (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x00C)) +#define VICIntEnable (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x010)) +#define VICIntEnClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x014))Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+#define VICSoftInt (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x018)) +#define VICSoftIntClr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x01C)) +#define VICProtection (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x020)) +#define VICSWPrioMask (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x024))Please do not use offset lists, but define a proper C data structure instead. And never ever access device regiters through simple volatile pointers. Use proper accessor functions. Here and elsewhere.
Quoted 2 lines
All examples I checked use the same syntax for defining registers, so I left it in the code. If that is a problem, can you indicate an example which does The Right Thing (tm)?
See for example the structure declarations in include/asm-ppc/*immap*
Quoted 2 lines
I think the patch now matches the other criteria. The patch is a bit bigger, since
other code did not follow the Coding Styles either. I used indent to fix my code and it fixed the other code as well.
I hope you didn't dop this in a single step. Codin style cleanup and adding new stuff must be done separately.
Quoted 21 lines
The second patch will follow when this patch is OK.
Regards,
Remco Poelstra
----
cpu/arm720t/cpu.c +3
-1@@ -41,7 +41,9 @@ int cpu_init (void)* setup up stacks if necessary */ #ifdef CONFIG_USE_IRQ -IRQ_STACK_START = _armboot_start -CONFIG_SYS_MALLOC_LEN -CONFIG_SYS_GBL_DATA_SIZE -4 ; +IRQ_STACK_START = + _armboot_start -CONFIG_SYS_MALLOC_LEN -CONFIG_SYS_GBL_DATA_SIZE - +4 ;FIQ_STACK_START =IRQ_STACK_START -CONFIG_STACKSIZE_IRQ ;#endif return 0 ;
cpu/arm720t/cpu.c int cleanup_before_linux (void) · line 70
Quoted 8 lines
cpu/arm720t/cpu.c +2
-2@@ -63,17 +65,17 @@ int cleanup_before_linux (void)disable_interrupts ();/* turn off I-cache */ - asm ("mrc p15, 0, %0, c1, c0, 0" :"=r" (i)); + asm ("mrc p15, 0, %0, c1, c0, 0" :"=r" (i)); i &= ~0x1000 ; - asm ("mcr p15, 0, %0, c1, c0, 0" : :"r" (i)); + asm ("mcr p15, 0, %0, c1, c0, 0" : :"r" (i));
What sort of patch is this? There is no commit message, no explanation what it is, no SoB, ... ?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Deliver yesterday, code today, think tomorrow."
PATCH 1/2 LPC2468 support
This patch includes support for the LPC2468 processor from NXP.
The example board will follow when this patch is OK.
---
cpu/arm720t/interrupts.c +27 -0
@@ -29,7 +29,11 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif #ifndef CONFIG_NETARM /* we always count down the max. */
@@ -40,6 +44,11 @@#ifdef CONFIG_LPC2292 #undef READ_TIMER#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#undef TIMER_LOAD_VAL +#define TIMER_LOAD_VAL 0 +#undef READ_TIMER +#define READ_TIMER (0xFFFFFFFF - 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
cpu/arm720t/lpc24xx/flash.c +233 -0
233 lines not on this page · raw message
cpu/arm720t/lpc24xx/iap_entry.S +7 -0
@@ -0,0 +1,7 @@ +IAP_ADDRESS: .word 0x7FFFFFF1 + +.globl iap_entry +iap_entry: + ldr r2, IAP_ADDRESS + bx r2 + mov pc, lr
cpu/arm720t/lpc24xx/Makefile +50 -0
50 lines not on this page · raw message
cpu/arm720t/serial.c +90 -0
94 lines not on this page · raw message
cpu/arm720t/start.S +7 -3
@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) bl lowlevel_init #endif
@@ -368,6 +368,10 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000 #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) 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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468) .align 5 .globl reset_cpu reset_cpu:
include/asm-arm/arch-lpc24xx/hardware.h +32 -0
@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ + +#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
include/asm-arm/arch-lpc24xx/immap.h +362 -0
362 lines not on this page · raw message
include/flash.h +1 -1
@@ -339,7 +339,7 @@ extern flash_info_t *flash_get_info(ulon#define TOSH_ID_FVT160 0xC2/* TC58FVT160 ID (16 M, top ) */ #define TOSH_ID_FVB160 0x43/* TC58FVT160 ID (16 M, bottom ) */ #define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ - +#define PHILIPS_LPC2468 0x0603FF35/* LPC2468 internal FLASH */ /*----------------------------------------------------------------------- * Internal FLASH identification codes *
PATCH 1/2 LPC2468 support
Dear Remco Poelstra,
Quoted 3 lines · In message <[email protected]> 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.
Quoted 6 lines
Signed-off-by Remco Poelstra <[email protected]>---
diff -upNru-boot-orig/cpu/arm720t/interrupts.cu-boot-cleanup/cpu/arm720t/interrupts.c
cpu/arm720t/interrupts.c line 36
Quoted 8 lines
cpu/arm720t/interrupts.c +4
-0@@ -29,7 +29,11 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif
Is there no way we can do without such a #ifdef here?
cpu/arm720t/interrupts.c line 51
Quoted 11 lines
cpu/arm720t/interrupts.c +5
-0#ifndef CONFIG_NETARM /* we always count down the max. */ @@ -40,6 +44,11 @@#ifdef CONFIG_LPC2292 #undef READ_TIMER#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#undef TIMER_LOAD_VAL +#define TIMER_LOAD_VAL 0 +#undef READ_TIMER +#define READ_TIMER (0xFFFFFFFF - 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.
Quoted 4 lines
cpu/arm720t/interrupts.c +0
-0#endif #else
cpu/arm720t/interrupts.c void do_irq (struct pt_regs *pt_regs) · line 98
Quoted 10 lines
cpu/arm720t/interrupts.c +7
-0@@ -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...
Quoted 14 lines
cpu/arm720t/interrupts.c +3
-0#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 */
cpu/arm720t/interrupts.c int interrupt_init (void) · line 214
Quoted 10 lines
cpu/arm720t/interrupts.c +7
-0@@ -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 );
Again: Is there no way to combine this code with the one for the LPC2292? It doesn't look that different to me...
...
Quoted 2 lines
cpu/arm720t/lpc24xx/Makefile +0
-0
...
cpu/arm720t/lpc24xx/Makefile line 41
Quoted 2 lines
+$(SOBJS):
cpu/arm720t/lpc24xx/Makefile +1
-0+ $(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?
...
cpu/arm720t/lpc24xx/Makefile
Quoted 10 lines
cpu/arm720t/lpc24xx/Makefile +9
-0+int serial_tstc (void) +{ + uart_2468_t *uart0=&(((immap_t *)CONFIG_SYS_IMMAP)->apb.uart0); + + return (GET8 (&(uart0->lsr)) & 1); +} + + + #endif
Get rid of all these empty lines, please.
cpu/arm720t/start.S reset: · line 130
Quoted 9 lines
diff -upNr
u-boot-orig/cpu/arm720t/start.Su-boot-cleanup/cpu/arm720t/start.Scpu/arm720t/start.S +1
-1@@ -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?
cpu/arm720t/start.S lock_loop: · line 372
Quoted 9 lines
cpu/arm720t/start.S +2
-0bl lowlevel_init #endif@@ -368,6 +368,10 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, 0x4000FFFF is end of SRAM*/
Line too long.
cpu/arm720t/start.S lock_loop: · line 374
Quoted 2 lines
cpu/arm720t/start.S +2
-0+ mov sp,r0 + sub sl,sp,#0x2000
Indentation by TAB, please.
cpu/arm720t/start.S lock_loop: · line 390
Quoted 9 lines
cpu/arm720t/start.S +1
-1#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?
cpu/arm720t/start.S reset_cpu: · line 608
Quoted 9 lines
cpu/arm720t/start.S +1
-1mov 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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)
Is there no way to combine this code with the one for the LPC2292?
Quoted 29 lines
cpu/arm720t/start.S +0
-0.align 5 .globl reset_cpu reset_cpu:diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/hardware.hu-boot-cleanup/include/asm-arm/arch-lpc24xx/hardware.hinclude/asm-arm/arch-lpc24xx/hardware.h +22
-0@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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
include/asm-arm/arch-lpc24xx/hardware.h line 32
Quoted 10 lines
include/asm-arm/arch-lpc24xx/hardware.h +10
-0+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
Ummm... What exactly is this file needed for?
Quoted 29 lines
diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/immap.hu-boot-cleanup/include/asm-arm/arch-lpc24xx/immap.hinclude/asm-arm/arch-lpc24xx/immap.h +25
-0@@ -0,0 +1,362 @@ +/* +* (C) Copyright 2009 Duran Audio B.V. +* +* LPC2468 Internal Memory Map +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#ifndef __LPC24XX_IMMAP_H +#define __LPC24XX_IMMAP_H +
include/asm-arm/arch-lpc24xx/immap.h line 35
Quoted 10 lines
include/asm-arm/arch-lpc24xx/immap.h +10
-0+#include <asm/types.h> +#include <config.h> + +/* Macros for reading/writing registers */ +#define PUT8 (reg, value) (*(volatile unsigned char*)(reg) = (value)) +#define PUT16 (reg, value) (*(volatile unsigned short*)(reg) = (value)) +#define PUT32 (reg, value) (*(volatile unsigned int*)(reg) = (value)) +#define GET8 (reg) (*(volatile unsigned char*)(reg)) +#define GET16 (reg) (*(volatile unsigned short*)(reg)) +#define GET32 (reg) (*(volatile unsigned int*)(reg))
Do you clain these are proper accessor functions for your processor?
include/asm-arm/arch-lpc24xx/immap.h line 42
Quoted 6 lines
include/asm-arm/arch-lpc24xx/immap.h +6
-0+#define BFS32 (reg,value) (*(volatile unsigned int*)(reg) |= (value)) +#define BFC32 (reg, value) (*(volatile unsigned int*)(reg) &= (~value)) + +typedef struct watchdog_2468 { +u8 fixme[0x4000 ]; +}watchdog2468_t ;
Indentation by TAB, please - here and everywhere else.
include/flash.h extern flash_info_t *flash_get_info(ulon · line 345
Quoted 12 lines
diff -upNr
u-boot-orig/include/flash.hu-boot-cleanup/include/flash.hinclude/flash.h +1
-1@@ -339,7 +339,7 @@ extern flash_info_t *flash_get_info(ulon#define TOSH_ID_FVT160 0xC2/* TC58FVT160 ID (16 M, top ) */ #define TOSH_ID_FVB160 0x43/* TC58FVT160 ID (16 M, bottom ) */ #define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ - +#define PHILIPS_LPC2468 0x0603FF35/* LPC2468 internal FLASH */ /*----------------------------------------------------------------------- * Internal FLASH identification codes *
Please keep the empty line here.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de panic: can't find /
PATCH 1/2 LPC2468 support
Wolfgang Denk schreef:
Quoted 9 lines
Dear Remco Poelstra,
Quoted 3 lines · In message <[email protected]> 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 "---"
Quoted 8 lines
Quoted 8 lines
Signed-off-by Remco Poelstra <[email protected]>---
diff -upNru-boot-orig/cpu/arm720t/interrupts.cu-boot-cleanup/cpu/arm720t/interrupts.ccpu/arm720t/interrupts.c +0
-0@@ -29,7 +29,11 @@#include <common.h> #include <clps7111.h>
Quoted 8 lines
cpu/arm720t/interrupts.c line 36
Quoted 6 lines
cpu/arm720t/interrupts.c +4
-0#include <asm/proc-armv/ptrace.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#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
Quoted 16 lines
cpu/arm720t/interrupts.c line 51
Quoted 12 lines
cpu/arm720t/interrupts.c +5
-0#ifndef CONFIG_NETARM /* we always count down the max. */ @@ -40,6 +44,11 @@#ifdef CONFIG_LPC2292 #undef READ_TIMER#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#undef TIMER_LOAD_VAL +#define TIMER_LOAD_VAL 0 +#undef READ_TIMER +#define READ_TIMER (0xFFFFFFFF - 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.
Quoted 7 lines
Quoted 7 lines
cpu/arm720t/interrupts.c +0
-0#endif #else @@ -80,6 +89,14 @@ void do_irq (struct pt_regs *pt_regs) pfnct = (void (*)(void ))VICVectAddr;
Quoted 11 lines
cpu/arm720t/interrupts.c void do_irq (struct pt_regs *pt_regs) · line 98
Quoted 8 lines
cpu/arm720t/interrupts.c +7
-0(*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.
Quoted 8 lines
Quoted 2 lines
cpu/arm720t/lpc24xx/Makefile +0
-0...
cpu/arm720t/lpc24xx/Makefile line 41
Quoted 2 lines
+$(SOBJS):
cpu/arm720t/lpc24xx/Makefile +1
-0+ $(CC) $(AFLAGS) -march=armv4t -c -o $(SOBJS) iap_entry.SSuch 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.
Quoted 11 lines
cpu/arm720t/start.S reset: · line 130
Quoted 9 lines
diff -upNr
u-boot-orig/cpu/arm720t/start.Su-boot-cleanup/cpu/arm720t/start.Scpu/arm720t/start.S +1
-1@@ -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?
Quoted 11 lines
cpu/arm720t/start.S lock_loop: · line 390
Quoted 9 lines
cpu/arm720t/start.S +1
-1#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.
Quoted 12 lines
cpu/arm720t/start.S reset_cpu: · line 608
Quoted 10 lines
cpu/arm720t/start.S +1
-1mov 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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)Is there no way to combine this code with the one for the LPC2292?
Same here.
Quoted 34 lines
Quoted 34 lines
cpu/arm720t/start.S +0
-0.align 5 .globl reset_cpu reset_cpu:diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/hardware.hu-boot-cleanup/include/asm-arm/arch-lpc24xx/hardware.hinclude/asm-arm/arch-lpc24xx/hardware.h +26
-0@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ +
Quoted 8 lines
include/asm-arm/arch-lpc24xx/hardware.h line 32
Quoted 6 lines
include/asm-arm/arch-lpc24xx/hardware.h +6
-0+#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */ 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.
Quoted 9 lines
include/asm-arm/arch-lpc24xx/hardware.h
Quoted 7 lines
include/asm-arm/arch-lpc24xx/hardware.h +7
-0+/* Macros for reading/writing registers */ +#define PUT8 (reg, value) (*(volatile unsigned char*)(reg) = (value)) +#define PUT16 (reg, value) (*(volatile unsigned short*)(reg) = (value)) +#define PUT32 (reg, value) (*(volatile unsigned int*)(reg) = (value)) +#define GET8 (reg) (*(volatile unsigned char*)(reg)) +#define GET16 (reg) (*(volatile unsigned short*)(reg)) +#define GET32 (reg) (*(volatile unsigned int*)(reg))Do you clain these are proper accessor functions for your processor?
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.
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.
Please tell me what you really want to see changed/whether you expect me to convert the LPC2292 code.
Depending on the amount of work left I'll reconsider submitting a patch.
Kind regards,
Remco Poelstra
PATCH 1/2 LPC2468 support
Dear Remco Poelstra,
Quoted 15 lines · In message <[email protected]> you wrote:
Quoted 14 lines
cpu/arm720t/interrupts.c line 36
Quoted 12 lines
cpu/arm720t/interrupts.c +4
-0@@ -29,7 +29,11 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif Is there no way we can do without such a #ifdef here?
Quoted 2 lines
The problem is that
start.Sneedshardware.h, but the code inimmap.hshould not be included instart.S, so I can not mergehardware.handimmap.h
Why not? I'm not aware of such a restriction?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
diff -upNr
u-boot-orig/cpu/arm720t/start.Su-boot-cleanup/cpu/arm720t/start.Scpu/arm720t/start.S +0
-0@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif
Quoted 6 lines
Quoted 4 lines
cpu/arm720t/start.S reset: · line 130
Quoted 2 lines
cpu/arm720t/start.S +1
-1-#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?
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?
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/hardware.hu-boot-cleanup/include/asm-arm/arch-lpc24xx/hardware.hinclude/asm-arm/arch-lpc24xx/hardware.h +4
-0@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/*
...
Quoted 11 lines
Quoted 10 lines
include/asm-arm/arch-lpc24xx/hardware.h line 32
Quoted 8 lines
+ */
include/asm-arm/arch-lpc24xx/hardware.h +7
-0+ +#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */ Ummm... What exactly is this file needed for?
Quoted 3 lines
I don't need it, but
start.Swants 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.
Quoted 10 lines
Quoted 9 lines
include/asm-arm/arch-lpc24xx/hardware.h
Quoted 7 lines
include/asm-arm/arch-lpc24xx/hardware.h +7
-0+/* Macros for reading/writing registers */ +#define PUT8 (reg, value) (*(volatile unsigned char*)(reg) = (value)) +#define PUT16 (reg, value) (*(volatile unsigned short*)(reg) = (value)) +#define PUT32 (reg, value) (*(volatile unsigned int*)(reg) = (value)) +#define GET8 (reg) (*(volatile unsigned char*)(reg)) +#define GET16 (reg) (*(volatile unsigned short*)(reg)) +#define GET32 (reg) (*(volatile unsigned int*)(reg))Do you clain these are proper accessor functions for your processor?
Quoted 7 lines
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.
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?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Given a choice between two theories, take the one which is funnier.
PATCH 1/2 LPC2468 support
Wolfgang Denk schreef:
Quoted 7 lines
Dear Remco Poelstra,
Quoted 3 lines
Quoted 1 line
Is there no way we can do without such a #ifdef here?
The problem is that
start.Sneedshardware.h, but the code inimmap.hshould not be included instart.S, so I can not mergehardware.handimmap.hWhy 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?
Quoted 5 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Ummm... What exactly is this file needed for?
I don't need it, but
start.Swants 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?
Quoted 2 lines
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
PATCH 1/2 LPC2468 support
Quoted 7 lines · Remco Poelstra
Wolfgang Denk schreef:
Quoted 6 lines
Dear Remco Poelstra,
Quoted 3 lines
Quoted 1 line
Is there no way we can do without such a #ifdef here?
The problem is that
start.Sneedshardware.h, but the code inimmap.hshould not be included instart.S, so I can not mergehardware.handimmap.h
Quoted 7 lines
Quoted 1 line
Why not? I'm not aware of such a restriction?
I'm not an expert in assembly, but at first I had
immap.hincluded instart.Sand it complained about invalid instructions, so if I combinehardware.handimmap.h, then there must be some way of making sure that the assembler ignores the C code inimmap.h. Do you know of any such thing?
immap.h?
Quoted 11 lines
Quoted 5 lines
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
#ifdefined(CONFIG_LPC2922)||defined(CONFIG_LPC2468)#define (CONFIG_LPC2000)
#endif
Quoted 7 lines
in a general place and then use
CONFIG_LPC2000at 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?
Maybe in include/asm-arm/config.h
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Ummm... What exactly is this file needed for?
I don't need it, but
start.Swants to include it. See my comment about the #ifdef's. Other architectures left it empty too, so it seemed the best option to me.
Quoted 7 lines
Quoted 2 lines
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.Sto 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
Best Regards;
J.
PATCH 1/2 LPC2468 support
Jean-Christophe PLAGNIOL-VILLARD schreef:
Quoted 6 lines
Quoted 5 lines
I'm not an expert in assembly, but at first I had
immap.hincluded instart.Sand it complained about invalid instructions, so if I combinehardware.handimmap.h, then there must be some way of making sure that the assembler ignores the C code inimmap.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.
Quoted 5 lines
Quoted 4 lines
I can remove the file, but than I need to put an #ifdef construct in
start.Sto 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
PATCH 1/2 LPC2468 support
This patch includes support for the LPC2468 processor from NXP.
---
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 <[email protected]>
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
Makefile +3 -0
@@ -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
cpu/arm720t/cpu.c +1 -1
@@ -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)
cpu/arm720t/interrupts.c +32 -5
@@ -29,17 +29,26 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#include <asm/io.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif #ifndef CONFIG_NETARM + +#if defined(CONFIG_LPC2292 ) +#define TIMER_LOAD_VAL 0xffff +#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#define TIMER_LOAD_VAL 0 +#define READ_TIMER (0xFFFFFFFF - 0xE0004008) +#else /* we always count down the max. */ #define TIMER_LOAD_VAL 0xffff/* macro to read the 16 bit timer */ #define READ_TIMER (IO_TC1D & 0xffff) - -#ifdef CONFIG_LPC2292 -#undef READ_TIMER -#define READ_TIMER (0xFFFFFFFF - 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(CONFIG_LPC2000 )void reset_timer (void ) {
cpu/arm720t/lpc24xx/Makefile new file +50 -0
50 lines not on this page · raw message
cpu/arm720t/lpc24xx/flash.c new file +233 -0
233 lines not on this page · raw message
cpu/arm720t/lpc24xx/iap_entry.S new file +7 -0
@@ -0,0 +1,7 @@ +IAP_ADDRESS: .word 0x7FFFFFF1 + +.globl iap_entry +iap_entry: + ldr r2, IAP_ADDRESS + bx r2 + mov pc, lr
cpu/arm720t/start.S +8 -3
@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2000) bl lowlevel_init #endif
@@ -368,6 +368,11 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, + 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000 #else #error No cpu_init_crit() defined for current CPU type #endif
@@ -383,7 +388,7 @@ lock_loop: str r1, [r0] #endif -#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2000) mov ip, lr /* * before relocating, we have to setup RAM timing
@@ -601,7 +606,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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2000) .align 5 .globl reset_cpu reset_cpu:
drivers/serial/Makefile +1 -0
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o +COBJS-$(CONFIG_LPC2468_SERIAL) += serial_lpc2468.o COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o COBJS-$(CONFIG_MX31_UART) += serial_mx31.o COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o
drivers/serial/serial_lpc2468.c new file +119 -0
119 lines not on this page · raw message
include/asm-arm/arch-lpc24xx/hardware.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ + +#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
include/asm-arm/arch-lpc24xx/immap.h new file +351 -0
351 lines not on this page · raw message
include/asm-arm/config.h +4 -0
@@ -21,4 +21,8 @@#ifndef _ASM_CONFIG_H_#define _ASM_CONFIG_H_ +#if defined(CONFIG_LPC2292 ) || defined(CONFIG_LPC2468 ) +#define CONFIG_LPC2000 +#endif +#endif
include/flash.h +1 -0
@@ -337,6 +337,7 @@ extern flash_info_t *flash_get_info(ulong base);#define TOSH_ID_FVT160 0xC2/* TC58FVT160 ID (16 M, top ) */ #define TOSH_ID_FVB160 0x43/* TC58FVT160 ID (16 M, bottom ) */ #define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ +#define PHILIPS_LPC2468 0x0603FF35/* LPC2468 internal FLASH */ /*----------------------------------------------------------------------- * Internal FLASH identification codes
Signature · 1 line
1.6.2.4
PATCH 1/2 LPC2468 support
Dear Remco Poelstra,
Quoted 1 line · In message <[email protected]> you wrote:
This patch includes support for the LPC2468 processor from NXP.
Thanks.
Here a few comments:
cpu/arm720t/cpu.c int cleanup_before_linux (void) · line 78
Quoted 8 lines
cpu/arm720t/cpu.c +1
-1@@ -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)
Line too long.
Quoted 5 lines
cpu/arm720t/interrupts.c +0
-0
cpu/arm720t/interrupts.c line 37
Quoted 9 lines
cpu/arm720t/interrupts.c +5
-0@@ -29,17 +29,26 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#include <asm/io.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif
Would it be possible to keep a generic ``#include <asm/hardware.h>'' here and add the processor specific stuff there?
cpu/arm720t/interrupts.c line 47
Quoted 9 lines
cpu/arm720t/interrupts.c +8
-0#ifndef CONFIG_NETARM + +#if defined(CONFIG_LPC2292 ) +#define TIMER_LOAD_VAL 0xffff +#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#define TIMER_LOAD_VAL 0 +#define READ_TIMER (0xFFFFFFFF - 0xE0004008) +#else
Can we please move this out of a common source file?
cpu/arm720t/interrupts.c int interrupt_init (void) · line 231
Quoted 2 lines
cpu/arm720t/interrupts.c +1
-1-#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(CONFIG_LPC2000 )
Line too long.
Quoted 2 lines
cpu/arm720t/start.S +0
-0
...
cpu/arm720t/start.S lock_loop: · line 375
Quoted 9 lines
cpu/arm720t/start.S +5
-0@@ -368,6 +368,11 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, + 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000
Indentation not by TAB
drivers/serial/serial_lpc2468.c
Quoted 6 lines
drivers/serial/serial_lpc2468.c new file +0
-0@@ -0,0 +1,119 @@
Do we really need a new file here?
Quoted 48 lines
include/asm-arm/arch-lpc24xx/immap.h new file +42
-0@@ -0,0 +1,351 @@ +/* +* (C) Copyright 2009 Duran Audio B.V. +* +* LPC2468 Internal Memory Map +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#ifndef __LPC24XX_IMMAP_H +#define __LPC24XX_IMMAP_H + +#include <asm/types.h> +#include <config.h> + +typedef struct watchdog_2468 { + u8 fixme[0x4000]; +} watchdog2468_t; + +typedef struct timer_2468 { + u32 ir; + u32 tcr; + u32 tc; + u32 pr; + u32 pc; + u32 mcr; + u32 mr0; + u32 mr1; + u32 mr2;
include/asm-arm/arch-lpc24xx/immap.h line 52
Quoted 10 lines
include/asm-arm/arch-lpc24xx/immap.h new file +10
-0+u32 mr3; +u32 ccr; +u32 cr0; +u32 cr1; +u32 cr2; +u32 cr3; +u32 emr; +u32 ctcr; +u8 notused[0x3fbc ]; +} timer_2468_t;
Indentation not by TAB (whole file!).
How about adding some comments to explain what all these fields mean? (whole file!)
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Of course there's no reason for it, it's just our policy.
PATCH 1/2 LPC2468 support
This patch includes support for the LPC2468 processor from NXP.
---
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 <[email protected]>
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
Makefile +3 -0
@@ -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
cpu/arm720t/cpu.c +3 -1
@@ -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)
cpu/arm720t/interrupts.c +33 -5
@@ -29,17 +29,26 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#include <asm/io.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif #ifndef CONFIG_NETARM + +#if defined(CONFIG_LPC2292 ) +#define TIMER_LOAD_VAL 0xffff +#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#define TIMER_LOAD_VAL 0 +#define READ_TIMER (0xFFFFFFFF - 0xE0004008) +#else /* we always count down the max. */ #define TIMER_LOAD_VAL 0xffff/* macro to read the 16 bit timer */ #define READ_TIMER (IO_TC1D & 0xffff) - -#ifdef CONFIG_LPC2292 -#undef READ_TIMER -#define READ_TIMER (0xFFFFFFFF - 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,8 @@ 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(CONFIG_LPC2000 )void reset_timer (void ) {
cpu/arm720t/lpc24xx/Makefile new file +50 -0
50 lines not on this page · raw message
cpu/arm720t/lpc24xx/flash.c new file +236 -0
236 lines not on this page · raw message
cpu/arm720t/lpc24xx/iap_entry.S new file +7 -0
@@ -0,0 +1,7 @@ +IAP_ADDRESS: .word 0x7FFFFFF1 + +.globl iap_entry +iap_entry: + ldr r2, IAP_ADDRESS + bx r2 + mov pc, lr
cpu/arm720t/start.S +9 -3
@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2000) bl lowlevel_init #endif
@@ -368,6 +368,12 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /* 0x40000000 is internal SRAM, + * 0x4000FFFF is end of SRAM + */ + mov sp,r0 + sub sl,sp,#0x2000 #else #error No cpu_init_crit() defined for current CPU type #endif
@@ -383,7 +389,7 @@ lock_loop: str r1, [r0] #endif -#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2000) mov ip, lr /* * before relocating, we have to setup RAM timing
@@ -601,7 +607,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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2000) .align 5 .globl reset_cpu reset_cpu:
drivers/net/Makefile +1 -0
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_GRETH) += greth.o COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o COBJS-$(CONFIG_DRIVER_LAN91C96) += lan91c96.o +COBJS-$(CONFIG_LPC2468_ETH) += lpc2468_eth.o COBJS-$(CONFIG_MACB) += macb.o COBJS-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o COBJS-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o
drivers/net/lpc2468_eth.c new file +494 -0
494 lines not on this page · raw message
drivers/net/lpc2468_eth.h new file +159 -0
159 lines not on this page · raw message
drivers/serial/Makefile +1 -0
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o +COBJS-$(CONFIG_LPC2468_SERIAL) += serial_lpc2468.o COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o COBJS-$(CONFIG_MX31_UART) += serial_mx31.o COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o
drivers/serial/serial_lpc2468.c new file +119 -0
119 lines not on this page · raw message
include/asm-arm/arch-lpc24xx/hardware.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ + +#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */
include/asm-arm/arch-lpc24xx/immap.h new file +406 -0
406 lines not on this page · raw message
include/asm-arm/config.h +4 -0
@@ -21,4 +21,8 @@#ifndef _ASM_CONFIG_H_#define _ASM_CONFIG_H_ +#if defined(CONFIG_LPC2292 ) || defined(CONFIG_LPC2468 ) +#define CONFIG_LPC2000 +#endif +#endif
include/flash.h +1 -0
@@ -337,6 +337,7 @@ extern flash_info_t *flash_get_info(ulong base);#define TOSH_ID_FVT160 0xC2/* TC58FVT160 ID (16 M, top ) */ #define TOSH_ID_FVB160 0x43/* TC58FVT160 ID (16 M, bottom ) */ #define PHILIPS_LPC2292 0x0401FF13/* LPC2292 internal FLASH */ +#define PHILIPS_LPC2468 0x0603FF35/* LPC2468 internal FLASH */ /*----------------------------------------------------------------------- * Internal FLASH identification codes
Signature · 1 line
1.6.2.4
PATCH 1/2 LPC2468 support
Hi Remco,
Quoted 15 lines · Remco Poelstra
This patch includes support for the LPC2468 processor from NXP.
Signed-off-by Remco Poelstra <[email protected]>---
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.
Please break this up into orthogonal patches by functionality. I'll comment on the net driver here, but will likely have more comments once the major issues are taken care of :) :
<snip>
Quoted 35 lines
drivers/net/lpc2468_eth.c new file +28
-0@@ -0,0 +1,494 @@ +/* +* (C) Copyright 2009 Duran Audio B.V. <www.duran-audio.com> +* +* 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 <[email protected]> +* Based on sample code from NXP +*/ + +#include <config.h> +#include <common.h> +#include <net.h> +#include <asm/io.h> +#include <asm/arch/immap.h>
drivers/net/lpc2468_eth.c line 38
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+#include "lpc2468_eth.h" + +/****************************************************************************** +* Local variables +*****************************************************************************/ + +static unsigned char macAddr[6 ]; +static volatile int phyAddr =0x1000 ; +static int eth_initialized =0 ; +mac_2468_t *mac=&(((immap_t *)CONFIG_SYS_IMMAP )->ahb.mac);
Please encapsulate these in a 'priv' data structure. More on that later...
Quoted 5 lines
drivers/net/lpc2468_eth.c new file +4
-0+ +/****************************************************************************** +* Local functions +*****************************************************************************/
drivers/net/lpc2468_eth.c line 52
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+ +static void writePhy (u32 phyReg,u32 phyData) +{ + +/* write command */ +writel (0x0 , &(mac->mcmd)); + +/* [12:8] == PHY addr, [4:0]=0x00(BMCR) register addr */ +writel ((phyAddr | phyReg), &(mac->madr)); +writel (phyData, &(mac->mwtd));
I don't know if 'writel' and 'readl' are the correct accessors for ARM. Hopefully somebody'll chime in on that.
Quoted 25 lines
drivers/net/lpc2468_eth.c new file +24
-0+while (readl (&(mac->mind)) !=0 ) ; +} + +static u32 readPhy (u32 phyReg) +{ + +/* read command */ +writel (0x1 , &(mac->mcmd)); + +/* [12:8] == PHY addr, [4:0]=0x00(BMCR) register addr */ +writel ((phyAddr | phyReg), &(mac->madr)); + +while (readl (&(mac->mind)) !=0 ); + +writel (0x0 , &(mac->mcmd)); + +return readl (&(mac->mrdd)); +} + +static int emac_start_xmit (volatile void *buf,int length) +{ + +u32 txProduceIndex =0 ; +u32 txConsumeIndex =0 ;
drivers/net/lpc2468_eth.c line 86
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+u8 *pData =0 ; +u32 len = length; +u32 sendLen =0 ; +u32 *tx_desc_addr =NULL ; + + txProduceIndex =readl (&(mac->txproduceindex)); + txConsumeIndex =readl (&(mac->txconsumeindex)); + +if (txConsumeIndex != txProduceIndex) { +/* TODO why return here? This just means that the transmit array isn't empty */
Good question... Please resolve before submitting.
Quoted 82 lines
drivers/net/lpc2468_eth.c new file +81
-0+printf ("emac: emac_tx transmit array isn't empty\n" ); +return -1 ; + } + +if (txProduceIndex ==EMAC_TX_DESCRIPTOR_COUNT ) { +/* should never happen */ +printf ("emac: emac_tx produce index == count\n" ); + } + +if (len >0 ) { + pData = (u8 *)EMAC_TX_BUFFER_ADDR ; +memcpy (pData, (void *)buf, length); + +do { + tx_desc_addr = + (u32 *) (TX_DESCRIPTOR_ADDR + txProduceIndex *8 ); + + sendLen = len; +if (sendLen >EMAC_BLOCK_SIZE ) { + sendLen =EMAC_BLOCK_SIZE ; + }else { +/* last fragment */ + sendLen |=EMAC_TX_DESC_LAST ; + } + +writel ((unsigned long ) pData, tx_desc_addr); + tx_desc_addr++; +writel ((u32) (EMAC_TX_DESC_INT | (sendLen -1 )), + tx_desc_addr); + + txProduceIndex++; +if (txProduceIndex ==EMAC_TX_DESCRIPTOR_COUNT ) { + txProduceIndex =0 ; + } + +writel (txProduceIndex, &(mac->txproduceindex)); + + len -= (sendLen & ~EMAC_TX_DESC_LAST ); + pData += (sendLen & ~EMAC_TX_DESC_LAST ); + }while (len >0 ); + } + +return 0 ; +} + +static void emac_rx (void ) +{ +u32 rxProduceIndex =0 ; +u32 rxConsumeIndex =0 ; +u32 *rxStatusAddr =0 ; +u32 recvSize =0 ; +u32 *recvAddr =0 ; + +/* the input parameter, EMCBuf, needs to be word aligned */ + + rxProduceIndex =readl (&(mac->rxproduceindex)); + rxConsumeIndex =readl (&(mac->rxconsumeindex)); + +/* consume the received packets */ +while (rxConsumeIndex != rxProduceIndex) { + + rxStatusAddr = (u32 *) (RX_STATUS_ADDR + rxConsumeIndex *8 ); + + recvSize =readl (rxStatusAddr); + +if ((recvSize &RX_DESC_STATUS_LAST ) ==0 ) { +/* TODO: could this occur when EMAC_BLOCK_SIZE == 0x0600? */ +printf ("emac_rx: NOT LAST fragment\n" ); + } + + recvSize = (recvSize &DESC_SIZE_MASK ) +1 ; + + recvAddr = (u32 *) (RX_DESCRIPTOR_ADDR + rxConsumeIndex *8 ); + +/* TODO: allocate buffer? */ +NetReceive ((uchar *) (readl (recvAddr)/*inBuf */ ), + recvSize); + + rxConsumeIndex++; +if (rxConsumeIndex ==EMAC_RX_DESCRIPTOR_COUNT ) { + rxConsumeIndex =0 ;
drivers/net/lpc2468_eth.c line 177
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+ } + +writel (rxConsumeIndex, &(mac->rxconsumeindex)); + + } + +} + +static void emac_interrupt (void ) +{
Do you really intend to use interrupts? If this is dead code, please remove it.
Quoted 193 lines
drivers/net/lpc2468_eth.c new file +192
-0+volatile u32 regValue =0 ; + + regValue =readl (&(mac->intstatus)); + +do { +if (regValue ==0 ) { +break ; + } + +if (regValue &EMAC_INT_RXOVERRUN ) { +writel (EMAC_INT_RXOVERRUN , &(mac->intclear)); +printf ("rxOverrun\n" ); +break ; + } + +if (regValue &EMAC_INT_RXERROR ) { +writel (EMAC_INT_RXERROR , &(mac->intclear)); + } + +if (regValue &EMAC_INT_RXFINISHED ) { +writel (EMAC_INT_RXFINISHED , &(mac->intclear)); + } + +if (regValue &EMAC_INT_RXDONE ) { +writel (EMAC_INT_RXDONE , &(mac->intclear)); +emac_rx (); + } + +if (regValue &EMAC_INT_TXUNDERRUN ) { +printf ("TX underrun\n" ); +writel (EMAC_INT_TXUNDERRUN , &(mac->intclear)); +break ; + } + +if (regValue &EMAC_INT_TXERROR ) { +printf ("TX err\n" ); +writel (EMAC_INT_TXERROR , &(mac->intclear)); +break ; + } + +if (regValue &EMAC_INT_TXFINISHED ) { +writel (EMAC_INT_TXFINISHED , &(mac->intclear)); + } + +if (regValue &EMAC_INT_TXDONE ) { +writel (EMAC_INT_TXDONE , &(mac->intclear)); + } + + }while (0 ); +} + +static int emac_open (void ) +{ +/* enable Rx & Tx */ +BFS32 (&(mac->command),CMD_RX_ENABLE ); +BFS32 (&(mac->command),CMD_TX_ENABLE ); +BFS32 (&(mac->command),CMD_PASS_RX_FILTER ); +BFS32 (&(mac->mac1),0x01 ); + +return 0 ; +} + +static void emac_close (void ) +{ +/* disable Rx6 Tx */ +BFC32 (&(mac->command),CMD_RX_ENABLE ); +BFC32 (&(mac->command),CMD_TX_ENABLE ); +BFC32 (&(mac->mac1),0x01 ); +} + +static int phyInit (void ) +{ +int i =0 ; +u32 regValue =0 ; +u32 timeout =0 ; + +writel (0x801C , &(mac->mcfg));/* host clock divided by 28, +no suppress preamble, +no scan increment */ + +for (i =0 ; i <0x40 ; i++) + asmvolatile (" nop" ); + +/* MII Mgmt. Divided by 28. */ +writel (0x001C , &(mac->mcfg)); +writel (0x0 , &(mac->mcmd)); + +for (i =0 ; i <0x100 ; i++) + asmvolatile (" nop" ); + +/*Reset the PHY */ +writePhy (PHY_BMCR ,BMCR_RESET ); +udelay (100 ); + + timeout =MII_BMSR_TIMEOUT *4 ; +while (timeout !=0 ) { + regValue =readPhy (PHY_BMCR ); +if ((regValue &BMCR_RESET ) ==0x0000 ) { +/* reset bit has been cleared */ +break ; + } + timeout--; + } + +if (timeout ==0 ) { +printf (" Error: phyInit failed to reset PHY\n" ); +return -1 ; + } + +return 0 ; +} + +static void emacTxDescriptorInit (void ) +{ +int i =0 ; +u32 *txDescAddr =NULL ; +u32 *txStatusAddr =NULL ; + +/* base address of tx descriptor array */ +writel (TX_DESCRIPTOR_ADDR , &(mac->txdescriptor)); + +/* base address of tx status */ +writel (TX_STATUS_ADDR , &(mac->txstatus)); + +/* number of tx descriptors */ +writel (EMAC_TX_DESCRIPTOR_COUNT -1 , &(mac->txdescriptornumber)); + +for (i =0 ; i <EMAC_TX_DESCRIPTOR_COUNT ; i++) { + txDescAddr = (u32 *) (TX_DESCRIPTOR_ADDR + i *8 ); +writel ((EMAC_TX_BUFFER_ADDR + i *EMAC_BLOCK_SIZE ), + (unsigned long )txDescAddr); + +/* control field in descriptor */ + txDescAddr++; +writel ((EMAC_TX_DESC_INT | (EMAC_BLOCK_SIZE -1 )), + (unsigned long )txDescAddr); + } + +for (i =0 ; i <EMAC_TX_DESCRIPTOR_COUNT ; i++) { + + txStatusAddr = (u32 *) (TX_STATUS_ADDR + i *4 ); + +/* set status info to 0 */ +writel (0x0 , (unsigned long )txStatusAddr); + } + +writel (0x0 , &(mac->txproduceindex)); +} + +static void emacRxDescriptorInit (void ) +{ +int i; +u32 *rxDescAddr =NULL ; +u32 *rxStatusAddr =NULL ; + +/* base address of rx descriptor array */ +writel (RX_DESCRIPTOR_ADDR , &(mac->rxdescriptor)); + +/* base address of rx status */ +writel (RX_STATUS_ADDR , &(mac->rxstatus)); + +/* number of rx descriptors */ +writel (EMAC_RX_DESCRIPTOR_COUNT -1 , &(mac->rxdescriptornumber)); + +for (i =0 ; i <EMAC_RX_DESCRIPTOR_COUNT ; i++) { + rxDescAddr = (u32 *) (RX_DESCRIPTOR_ADDR + i *8 ); + +writel ((EMAC_RX_BUFFER_ADDR + i *EMAC_BLOCK_SIZE ), + (unsigned long )rxDescAddr); + + rxDescAddr++; + +writel ((EMAC_RX_DESC_INT | + ((EMAC_BLOCK_SIZE -1 ) &DESC_SIZE_MASK )), + (unsigned long )rxDescAddr); + } + +for (i =0 ; i <EMAC_RX_DESCRIPTOR_COUNT ; i++) { +/* RX status, two words, status info. and status hash CRC. */ + rxStatusAddr = (u32 *) (RX_STATUS_ADDR + i *8 ); +writel (0x0 , (unsigned long )rxStatusAddr); + rxStatusAddr++; +writel (0x0 , (unsigned long )rxStatusAddr); + } + +writel (0x0 , &(mac->rxconsumeindex)); +} + +static int emacInit (void ) +{ +int i =0 ; +pin_connect_2468_t *pin_connect=&(((immap_t *)CONFIG_SYS_IMMAP )->apb.pin_connect);
drivers/net/lpc2468_eth.c line 379
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+ +/* turn on the ethernet MAC clock in PCONP, bit 30 */ +BFS32 (&(((immap_t *)CONFIG_SYS_IMMAP )->apb.sys_con.pconp),PCONP_EMAC_CLOCK ); +/*----------------------------------------------------------------------- +* write to PINSEL2/3 to select the PHY functions on P1[17:0] +*-----------------------------------------------------------------------*/ + +/* documentation needs to be updated */ +writel (0x55555555 , &(pin_connect->pinsel2));/* selects P1[0,1,4,8,9,10,14,15] */ +writel (0x00000005 , &(pin_connect->pinsel3));/* selects P1[17:16] */
This looks to me like board code. If it is, it doesn't belong in this driver.
Quoted 62 lines
drivers/net/lpc2468_eth.c new file +61
-0+ +/*reset MAC modules, tx, mcs_tx, rx, mcs_rx, simulation and soft reset*/ +writel (0xCF00 , &(mac->mac1)); + +/* reset datapaths and host registers */ +writel (0x0038 , &(mac->command)); + +/* short delay after reset */ +for (i =0 ; i <0x40 ; i++) + asmvolatile (" nop" ); + +/*Remove reset conditions*/ +writel (0x0 , &(mac->mac1)); + +/*disable Tx*/ +BFC32 (&(mac->command),CMD_TX_ENABLE ); + +/*disable Rx*/ +BFC32 (&(mac->command),CMD_RX_ENABLE ); + +/*initialize MAC2 to default value +TODO don't thinkt this is necessary?? m_nic_write(EMAC_MAC2, 0x0);*/ +writel (0x030 , &(mac->mac2)); + +/*non back-to-back Inter-Packet-Gap register +The manual recommends the value 0x12 */ +writel (0x12 , &(mac->ipgr)); + +/*collision window/retry register. Using recommended value from manual*/ +writel (0x370F , &(mac->clrt)); + +/* intialize PHY. */ +if (phyInit () <0 ) +return -1 ; + +/* write the mac address */ +writel ((macAddr[5 ] <<8 | macAddr[4 ]), &(mac->sa0)); +writel ((macAddr[3 ] <<8 | macAddr[2 ]), &(mac->sa1)); +writel ((macAddr[1 ] <<8 | macAddr[0 ]), &(mac->sa2)); + +printf ("emac: MAC address = %2x:%2x:%2x:%2x:%2x:%2x\n" , + macAddr[0 ], + macAddr[1 ], macAddr[2 ], macAddr[3 ], macAddr[4 ], macAddr[5 ]); + +emacTxDescriptorInit (); +emacRxDescriptorInit (); + +/* pass all receive frames */ +BFS32 (&(mac->mac1),0x002 ); + +/* set up the Rx filter +[0]-AllUnicast, [1]-AllBroadCast, [2]-AllMulticast, [3]-UnicastHash +[4]-MulticastHash, [5]-Perfect, [12]-MagicPacketEnWoL, +[13]-RxFilterEnWoL +PUT32(MAC_RXFILTERCTRL, 0x0022); */ +writel (0x003F , &(mac->rxfilterctrl));/*Pass everything */ + +/* clear all interrupts */ +writel (0xFFFF , &(mac->intclear)); + +/* enable interrupts (not SoftInt and WoL) */
drivers/net/lpc2468_eth.c line 450
Quoted 10 lines
drivers/net/lpc2468_eth.c new file +10
-0+writel (0x00FF , &(mac->intenable)); + +return 0 ; +} + +/* ############################## +* u-boot interface +* ############################## +*/ +
Please don't use this old API. Instead, use the CONFIG_NET_MULTI API where a 'struct eth_device' is allocated, initialized and filled. This struct contains a 'priv' field that you can use to store the static variables that were defined at the top of the driver. The API you've used is on its way out. You'll find plenty of examples in drivers/net.
Quoted 168 lines
drivers/net/lpc2468_eth.c new file +44
-0+/* +* Returns 0 when failes otherwise 1 +*/ +int eth_init (bd_t * bis) +{ +int ret; +if (!eth_initialized) { +if (!eth_getenv_enetaddr ("ethaddr" , macAddr)) { +printf ("Failed to get MAC address from environment\n" ); +return 1 ; + } + + ret =emacInit (); +if (ret !=0 ) { +return ret; + } + + eth_initialized =1 ; + } + +emac_open (); +return 0 ; +} + +int eth_send (volatile void *packet,int length) +{ +emac_start_xmit (packet, length); +return 0 ; +} + +/*----------------------------------------------------------------------------- +* Check for received packets. Call NetReceive for each packet. The return +* value is ignored by the caller. +*/ +int eth_rx (void ) +{ +emac_interrupt (); +return 0 ; +} + +void eth_halt (void ) +{ +emac_close (); +}drivers/net/lpc2468_eth.h new file +117
-0@@ -0,0 +1,159 @@ +#ifndef LPC2468_ETH_H +#define LPC2468_ETH_H + +/****************************************************************************** +* 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_CLOCK 0x40000000 + +#define SPEED_100 1 +#define SPEED_10 0 +#define FULL_DUPLEX 1 +#define HALF_DUPLEX 0 + +#define EMAC_RAM_ADDR 0x7FE00000 +#define EMAC_RAM_SIZE 0x00004000 + +#define EMAC_TX_DESCRIPTOR_COUNT 5 +#define EMAC_RX_DESCRIPTOR_COUNT 4 + +/* +* (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_NUM 10 + +#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_INT 0x80000000 +#define EMAC_TX_DESC_LAST 0x40000000 +#define EMAC_TX_DESC_CRC 0x20000000 +#define EMAC_TX_DESC_PAD 0x10000000 +#define EMAC_TX_DESC_HUGE 0x08000000 +#define EMAC_TX_DESC_OVERRIDE 0x04000000 + +#define EMAC_RX_DESC_INT 0x80000000 + +/* EMAC Descriptor status related definition */ +#define TX_DESC_STATUS_ERR 0x80000000 +#define TX_DESC_STATUS_NODESC 0x40000000 +#define TX_DESC_STATUS_UNDERRUN 0x20000000 +#define TX_DESC_STATUS_LCOL 0x10000000 +#define TX_DESC_STATUS_ECOL 0x08000000 +#define TX_DESC_STATUS_EDEFER 0x04000000 +#define TX_DESC_STATUS_DEFER 0x02000000 +#define TX_DESC_STATUS_COLCNT 0x01E00000/* four bits, it's a mask, not exact count */ + +#define RX_DESC_STATUS_ERR 0x80000000 +#define RX_DESC_STATUS_LAST 0x40000000 +#define RX_DESC_STATUS_NODESC 0x20000000 +#define RX_DESC_STATUS_OVERRUN 0x10000000 +#define RX_DESC_STATUS_ALGNERR 0x08000000 +#define RX_DESC_STATUS_RNGERR 0x04000000 +#define RX_DESC_STATUS_LENERR 0x02000000 +#define RX_DESC_STATUS_SYMERR 0x01000000 +#define RX_DESC_STATUS_CRCERR 0x00800000 +#define RX_DESC_STATUS_BCAST 0x00400000 +#define RX_DESC_STATUS_MCAST 0x00200000 +#define RX_DESC_STATUS_FAILFLT 0x00100000 +#define RX_DESC_STATUS_VLAN 0x00080000 +#define RX_DESC_STATUS_CTLFRAM 0x00040000 + +#define DESC_SIZE_MASK 0x000007FF/* 11 bits for both TX and RX */ + +/* EMAC interrupt controller related definition */ +#define EMAC_INT_RXOVERRUN 0x01 << 0 +#define EMAC_INT_RXERROR 0x01 << 1 +#define EMAC_INT_RXFINISHED 0x01 << 2 +#define EMAC_INT_RXDONE 0x01 << 3 +#define EMAC_INT_TXUNDERRUN 0x01 << 4 +#define EMAC_INT_TXERROR 0x01 << 5 +#define EMAC_INT_TXFINISHED 0x01 << 6 +#define EMAC_INT_TXDONE 0x01 << 7 +#define EMAC_INT_SOFTINT 0x01 << 12 +#define EMAC_INT_WOL 0x01 << 13 +
drivers/net/lpc2468_eth.h line 127
Quoted 10 lines
drivers/net/lpc2468_eth.h new file +10
-0+#define PHY_BMCR 0x0000 +#define PHY_BMSR 0x0001 +#define PHY_PHYIDR1 0x0002 +#define PHY_PHYIDR2 0x0003 +#define PHY_ANAR 0x0004 +#define PHY_ANLPAR 0x0005 +#define PHY_ANLPARNP 0x0005 +#define PHY_ANER 0x0006 +#define PHY_ANNPTR 0x0007 +
Please use the definitions in include/miiphy.h for all these standard IEEE802.3 registers.
Quoted 21 lines
drivers/net/lpc2468_eth.h new file +20
-0+/* BMCR setting */ +#define BMCR_RESET 0x8000 +#define BMCR_LOOPBACK 0x4000 +#define BMCR_SPEED_100 0x2000 +#define BMCR_AN 0x1000 +#define BMCR_POWERDOWN 0x0800 +#define BMCR_ISOLATE 0x0400 +#define BMCR_RE_AN 0x0200 +#define BMCR_DUPLEX 0x0100 + +/* BMSR setting */ +#define BMSR_100BE_T4 0x8000 +#define BMSR_100TX_FULL 0x4000 +#define BMSR_100TX_HALF 0x2000 +#define BMSR_10BE_FULL 0x1000 +#define BMSR_10BE_HALF 0x0800 +#define BMSR_AUTO_DONE 0x0020 +#define BMSR_REMOTE_FAULT 0x0010 +#define BMSR_NO_AUTO 0x0008 +#define BMSR_LINK_ESTABLISHED 0x0004
drivers/net/lpc2468_eth.h line 157
Quoted 10 lines
drivers/net/lpc2468_eth.h new file +10
-0+ +#define MII_BMSR_TIMEOUT 0x1000000 + +#define CMD_RX_ENABLE 0x01 +#define CMD_TX_ENABLE 0x02 +#define CMD_PASS_RX_FILTER 0x80 + +/* Helper macros */ +#define BFS32 (reg,value) writel( (readl(reg)|=(value)) ,reg) +#define BFC32 (reg,value) writel( (readl(reg)&=(~value)) ,reg)
Could you make these macro names a bit more descriptive please?
Thanks a lot! This is a very good start.
regards,
Ben
PATCH 1/2 LPC2468 support
In reply to Remco PoelstraQuoted 7 lines · Remco Poelstra
This patch includes support for the LPC2468 processor from NXP.
Signed-off-by Remco Poelstra <[email protected]>---
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.
two general news
I'm preparing some patch to cleanup the arm720t include LPC irq support
I'll send it asap
please take a look and test it
Quoted 173 lines
From
75361079ed78fb40c2840b3bd74687153e486620Mon Sep 17 00:00:00 2001
From: Remco Poelstra <[email protected]>
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.ccreate mode 100644cpu/arm720t/lpc24xx/iap_entry.Screate mode 100644drivers/serial/serial_lpc2468.ccreate mode 100644include/asm-arm/arch-lpc24xx/hardware.hcreate mode 100644include/asm-arm/arch-lpc24xx/immap.hMakefile +3
-0@@ -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 armadillocpu/arm720t/cpu.c +1
-1@@ -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)cpu/arm720t/interrupts.c +32
-5@@ -29,17 +29,26 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> +#include <asm/io.h> +#if defined(CONFIG_LPC2468 ) +#include <asm/arch/immap.h> +#else #include <asm/hardware.h> +#endif #ifndef CONFIG_NETARM + +#if defined(CONFIG_LPC2292 ) +#define TIMER_LOAD_VAL 0xffff +#define READ_TIMER (0xFFFFFFFF - GET32(T0TC)) +#elif defined(CONFIG_LPC2468 ) +#define TIMER_LOAD_VAL 0 +#define READ_TIMER (0xFFFFFFFF - 0xE0004008) +#else /* we always count down the max. */ #define TIMER_LOAD_VAL 0xffff/* macro to read the 16 bit timer */ #define READ_TIMER (IO_TC1D & 0xffff) - -#ifdef CONFIG_LPC2292 -#undef READ_TIMER -#define READ_TIMER (0xFFFFFFFF - 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(CONFIG_LPC2000 )void reset_timer (void ) {cpu/arm720t/lpc24xx/Makefile new file +29
-0@@ -0,0 +1,50 @@ +# +# (C) Copyright 2000-2007 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).a + +COBJS = flash.o +SOBJS = $(obj)iap_entry.o
cpu/arm720t/lpc24xx/Makefile line 39
Quoted 10 lines
cpu/arm720t/lpc24xx/Makefile new file +10
-0+ +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) + +# this MUST be compiled as thumb code!
why?
no thumb will be accpeted without a clear explination
Quoted 31 lines
cpu/arm720t/lpc24xx/Makefile new file +11
-0+$(SOBJS): + $(CC) $(AFLAGS) -march=armv4t -c -o $(SOBJS) iap_entry.S + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################cpu/arm720t/lpc24xx/flash.c new file +14
-0@@ -0,0 +1,233 @@ +/* +* (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com> +* +* 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
cpu/arm720t/lpc24xx/flash.c line 24
Quoted 10 lines
cpu/arm720t/lpc24xx/flash.c new file +10
-0+* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/immap.h> +/* IAP commands use 32 bytes at the top of CPU internal sram, we +use 512 bytes below that */
please use this style of comment
/*
*
*/
cpu/arm720t/lpc24xx/flash.c line 25
Quoted 1 line
cpu/arm720t/lpc24xx/flash.c new file +1
-0+#define COPY_BUFFER_LOCATION 0x4000fde0
evenif it's soc specific flash support I think they need to be store with the other flash and need to have the ack of Stefan
Quoted 16 lines
cpu/arm720t/lpc24xx/flash.c new file +10
-0+ +#define IAP_LOCATION 0x7ffffff1 +#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 +cpu/arm720t/start.S +0
-0
cpu/arm720t/start.S reset: · line 132
Quoted 7 lines
cpu/arm720t/start.S +1
-1@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endif -#ifdef CONFIG_LPC2292 +#if defined(CONFIG_LPC2000) bl lowlevel_init #endif
I'm not really happy with this we need to extract the soc specific from the arch init
Quoted 41 lines
cpu/arm720t/start.S +7
-2@@ -368,6 +368,11 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_LPC2468) + ldr r0, =0x40008000 /*0x40000000 is internal SRAM, + 0x4000FFFF is end of SRAM*/ + mov sp,r0 + sub sl,sp,#0x2000 #else #error No cpu_init_crit() defined for current CPU type #endif@@ -383,7 +388,7 @@ lock_loop: str r1, [r0] #endif -#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2000) mov ip, lr /* * before relocating, we have to setup RAM timing@@ -601,7 +606,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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2000) .align 5 .globl reset_cpu reset_cpu:drivers/serial/Makefile +1
-0@@ -39,6 +39,7 @@ COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o +COBJS-$(CONFIG_LPC2468_SERIAL) += serial_lpc2468.o COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o COBJS-$(CONFIG_MX31_UART) += serial_mx31.o
Quoted 1 line
COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o
Best Regards,
J.
PATCH 1/2 LPC2468 support
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 1 line · In message <[email protected]> you wrote:
...
Quoted 3 lines
Quoted 1 line
+#define
COPY_BUFFER_LOCATION0x4000fde0evenif it's soc specific flash support I think they need to be store with the other flash and need to have the ack of Stefan
No, not really. Stefan cares only about the CFI driver, and this is clearly not a CFI conformant flash type.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The typical page layout program is nothing more than an electronic light table for cutting and pasting documents.
PATCH 1/2 LPC2468 support
Quoted 11 lines · Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 1 line · In message <[email protected]> you wrote:
...
Quoted 3 lines
Quoted 1 line
+#define
COPY_BUFFER_LOCATION0x4000fde0evenif it's soc specific flash support I think they need to be store with the other flash and need to have the ack of Stefan
No, not really. Stefan cares only about the CFI driver, and this is clearly not a CFI conformant flash type.
ok but I steel wish to have Stefan opinion
Best Regards,
J.
PATCH 1/2 LPC2468 support
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines
In message <[email protected]> you wrote:
...
Quoted 2 lines
Quoted 1 line
+#define
COPY_BUFFER_LOCATION0x4000fde0
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
evenif it's soc specific flash support I think they need to be store with the other flash and need to have the ack of Stefan
No, not really. Stefan cares only about the CFI driver, and this is clearly not a CFI conformant flash type.
ok but I steel wish to have Stefan opinion
I took a quick look at the flash "driver". The main functions lpc24xx_flash_erase() and lpc24xx_write_buff() are not even referenced somewhere in this patch. They seem to be used in the 2nd patch (2/2) though. It's hard to really understand what's going on here. So this flash driver part really needs some sort of documentation how it's supposed to work.
And I also think this driver (as all FLASH related drivers) should be moved into drivers/mtd instead.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/2 LPC2468 support
Dear Stefan Roese,
Quoted 9 lines · In message <[email protected]> you wrote:
I took a quick look at the flash "driver". The main functions
lpc24xx_flash_erase()andlpc24xx_write_buff()are not even referenced somewhere in this patch. They seem to be used in the 2nd patch (2/2) though. It's hard to really understand what's going on here. So this flash driver part really needs some sort of documentation how it's supposed to work.And I also think this driver (as all FLASH related drivers) should be moved into
drivers/mtdinstead.
Into drivers/mtd? Even if it's not a MTD driver? This doesn't make mnuch sense to me.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Politics: A strife of interests masquerading as a contest of principles. The conduct of public affairs for private advantage. - Ambrose Bierce
PATCH 1/2 LPC2468 support
Hi Wolfgang,
Quoted 7 lines · Wolfgang Denk
Quoted 7 lines
I took a quick look at the flash "driver". The main functions
lpc24xx_flash_erase()andlpc24xx_write_buff()are not even referenced somewhere in this patch. They seem to be used in the 2nd patch (2/2) though. It's hard to really understand what's going on here. So this flash driver part really needs some sort of documentation how it's supposed to work.
Quoted 5 lines
Quoted 2 lines
And I also think this driver (as all FLASH related drivers) should be moved into
drivers/mtdinstead.Into
drivers/mtd? Even if it's not a MTD driver? This doesn't make mnuch sense to me.
In the end this driver will be used by the common FLASH user interface (cmd_flash.c, cmd_mem.c). So I prefer to have the "driver" for this interface in a common place for a better overview. And the only common place I can think of is drivers/mtd right now. We should probably add a subdirectory for NOR flash drivers: drivers/mtd/nor (or drivers/mtd/maps as done in Linux).
BTW: This common place will prevent those multiple platform/board specific flash drivers we have right now as well.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/2 LPC2468 support
Dear Stefan Roese,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Into
drivers/mtd? Even if it's not a MTD driver? This doesn't make mnuch sense to me.In the end this driver will be used by the common FLASH user interface (
cmd_flash.c,cmd_mem.c). So I prefer to have the "driver" for this interface
Yes. But MTD is a description of a specific interface. Even now we have two versions of the CFI driver: drivers/mtd/cfi_flash.c and drivers/mtd/cfi_mtd.c, and if we look closer at it only cfi_mtd.c makes sense in this directory. cfi_flash.c is *not* MTD conformant and should be somewhere else.
Quoted 2 lines
in a common place for a better overview. And the only common place I can think of is
drivers/mtdright now. We should probably add a subdirectory for
Maybe we should create drivers/flash for those non-MTD flash drivers? Then we should also move cfi_flash.c there.
Quoted 1 line
NOR flash drivers:
drivers/mtd/nor(ordrivers/mtd/mapsas done in Linux).
Um... this is something different - in Linux all flash drivers (at least all in mainline) are handled through the MTD layer.
Quoted 2 lines
BTW: This common place will prevent those multiple platform/board specific flash drivers we have right now as well.
We agree on that.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Overflow on /dev/null, please empty the bit bucket.
PATCH 1/2 LPC2468 support
Hi Wolfgang,
Quoted 10 lines · Wolfgang Denk
Quoted 6 lines
Quoted 2 lines
Into
drivers/mtd? Even if it's not a MTD driver? This doesn't make mnuch sense to me.In the end this driver will be used by the common FLASH user interface (
cmd_flash.c,cmd_mem.c). So I prefer to have the "driver" for this interfaceYes. But MTD is a description of a specific interface. Even now we have two versions of the CFI driver:
drivers/mtd/cfi_flash.canddrivers/mtd/cfi_mtd.c,
No, we don't have "two versions of the CFI driver". cfi_mtd.c is not really a driver but "only" a wrapper implementing the MTD infrastructure on top of the U-Boot NOR driver (cfi_flash or others).
Quoted 10 lines
and if we look closer at it only
cfi_mtd.c
makes sense in this directory.cfi_flash.cis *not* MTD conformant and should be somewhere else.Quoted 3 lines
in a common place for a better overview. And the only common place I can think of is
drivers/mtdright now. We should probably add a subdirectory forMaybe we should create
drivers/flashfor those non-MTD flash drivers? Then we should also movecfi_flash.cthere.
Yes, this could be done.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/2 LPC2468 support
In reply to Remco PoelstraQuoted 11 lines
Quoted 8 lines
Quoted 2 lines
cpu/arm720t/lpc24xx/Makefile +0
-0...
cpu/arm720t/lpc24xx/Makefile line 41
Quoted 2 lines
+$(SOBJS):
cpu/arm720t/lpc24xx/Makefile +1
-0+ $(CC) $(AFLAGS) -march=armv4t -c -o $(SOBJS) iap_entry.SSuch 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.
what is the Difference?
until a real big gap please do not use thumb
Quoted 101 lines
Quoted 8 lines
Quoted 8 lines
diff -upNr
u-boot-orig/cpu/arm720t/start.Su-boot-cleanup/cpu/arm720t/start.Scpu/arm720t/start.S +0
-0@@ -127,7 +127,7 @@ reset: bl cpu_init_crit #endifQuoted 4 lines
cpu/arm720t/start.S reset: · line 130
Quoted 2 lines
cpu/arm720t/start.S +1
-1-#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?
Quoted 11 lines
cpu/arm720t/start.S lock_loop: · line 390
Quoted 9 lines
cpu/arm720t/start.S +1
-1#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.
Quoted 12 lines
cpu/arm720t/start.S reset_cpu: · line 608
Quoted 10 lines
cpu/arm720t/start.S +1
-1mov 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 */ -#elif defined(CONFIG_LPC2292) +#elif defined(CONFIG_LPC2292) || defined(CONFIG_LPC2468)Is there no way to combine this code with the one for the LPC2292?
Same here.
Quoted 34 lines
Quoted 34 lines
cpu/arm720t/start.S +0
-0.align 5 .globl reset_cpu reset_cpu:diff -upNr
u-boot-orig/include/asm-arm/arch-lpc24xx/hardware.hu-boot-cleanup/include/asm-arm/arch-lpc24xx/hardware.hinclude/asm-arm/arch-lpc24xx/hardware.h +26
-0@@ -0,0 +1,32 @@ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* +* Copyright (c) 2004 Cucy Systems (http://www.cucy.com) +* Curt Brune <[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 +*/ +Quoted 8 lines
include/asm-arm/arch-lpc24xx/hardware.h line 32
Quoted 6 lines
include/asm-arm/arch-lpc24xx/hardware.h +6
-0+#if defined(CONFIG_LPC2468 ) +#else +#error No hardware file defined for this configuration +#endif + +#endif /* __ASM_ARCH_HARDWARE_H */ Ummm... What exactly is this file needed for?
I don't need it, but
start.Swants to include it. See my comment about the #ifdef's. Other architectures left it empty too, so it seemed the best option to me.Quoted 9 lines
include/asm-arm/arch-lpc24xx/hardware.h
Quoted 7 lines
include/asm-arm/arch-lpc24xx/hardware.h +7
-0+/* Macros for reading/writing registers */ +#define PUT8 (reg, value) (*(volatile unsigned char*)(reg) = (value)) +#define PUT16 (reg, value) (*(volatile unsigned short*)(reg) = (value)) +#define PUT32 (reg, value) (*(volatile unsigned int*)(reg) = (value)) +#define GET8 (reg) (*(volatile unsigned char*)(reg)) +#define GET16 (reg) (*(volatile unsigned short*)(reg)) +#define GET32 (reg) (*(volatile unsigned int*)(reg))Do you clain these are proper accessor functions for your processor?
Quoted 7 lines
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
Quoted 5 lines
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
Best Regards,
J.
PATCH 1/2 LPC2468 support
Jean-Christophe PLAGNIOL-VILLARD schreef:
Quoted 5 lines
Quoted 2 lines
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.
Quoted 8 lines
Quoted 7 lines
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.
Quoted 5 lines
Quoted 3 lines
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
PATCH 1/2 LPC2468 support
Remco Poelstra schreef:
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
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
PATCH 2/2 LPC2468 example board
In reply to Wolfgang DenkExample board for LPC2468 support
---
board/LPC2468/config.mk +29 -0
@@ -0,0 +1,29 @@ +# +# (C) Copyright 2000 +# Sysgo Real-Time Solutions, GmbH <www.elinos.com> +# Marius Groeger <[email protected]> +# +# (C) Copyright 2000 +# Wolfgang Denk, DENX Software Engineering, wd at 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 = 0xA1f80000
board/LPC2468/eth.c +694 -0
694 lines not on this page · raw message
board/LPC2468/flash.c +253 -0
253 lines not on this page · raw message
board/LPC2468/lowlevel_init.c +436 -0
436 lines not on this page · raw message
board/LPC2468/LPC2468.c +66 -0
66 lines not on this page · raw message
board/LPC2468/Makefile +55 -0
55 lines not on this page · raw message
board/LPC2468/nand.c +62 -0
62 lines not on this page · raw message
board/LPC2468/u-boot.lds +55 -0
55 lines not on this page · raw message
include/configs/LPC2468.h +213 -0
213 lines not on this page · raw message
MAKEALL +1 -0
@@ -481,6 +481,7 @@ LIST_ARM7=" \ impa7 \ integratorap \ lpc2292sodimm \ + LPC2468 \ modnet50 \ SMN42 \ "
Makefile +3 -0
@@ -2899,6 +2899,9 @@ B2_config : unconfig ## ARM720T Systems ######################################################################### +LPC2468_config: unconfig + @$(MKCONFIG) $(@:_config=) arm arm720t LPC2468 NULL lpc24xx + armadillo_config: unconfig @$(MKCONFIG) $(@:_config=) arm arm720t armadillo
PATCH 2/2 LPC2468 example board
Quoted 27 lines · Remco Poelstra
Example board for LPC2468 support
Signed-off-by Remco Poelstra <[email protected]>---
diff -upNru-boot-orig/board/LPC2468/config.mku-boot/board/LPC2468/config.mkboard/LPC2468/config.mk +19
-0@@ -0,0 +1,29 @@ +# +# (C) Copyright 2000 +# Sysgo Real-Time Solutions, GmbH <www.elinos.com> +# Marius Groeger <[email protected]> +# +# (C) Copyright 2000 +# Wolfgang Denk, DENX Software Engineering, wd at 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
board/LPC2468/config.mk line 29
Quoted 10 lines
board/LPC2468/config.mk +10
-0+# 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 = 0xA1f80000
please move the eth to drivers/net
Quoted 20 lines
diff -upNr
u-boot-orig/board/LPC2468/eth.cu-boot/board/LPC2468/eth.cboard/LPC2468/eth.c +16
-0@@ -0,0 +1,694 @@ +/* +* (C) Copyright 2009 Duran Audio B.V. <www.duran-audio.com> +* +* 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,
board/LPC2468/eth.c line 26
Quoted 10 lines
board/LPC2468/eth.c +10
-0+* MA 02111-1307 USA +* +* 18-03-2009 Updated for U-boot 2009.3 by Remco Poelstra <[email protected]> +* Based on sample code from NXP +*/ + +#include <config.h> +#include <common.h> +#include <net.h> +#include <asm/arch/hardware.h>
please move define to a header
please fix the whitespace
please remove dead code
please use proper access
why do you need your own flash driver?
please use the generic cfi drivers
please check the coding style
Quoted 90 lines
board/LPC2468/eth.c +23
-0+ +/****************************************************************************** +* 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_CLOCK 0x40000000 + +#define SPEED_100 1 +#define SPEED_10 0 +#define FULL_DUPLEX 1 +#define HALF_DUPLEX 0 + +#define EMAC_RAM_ADDR 0x7FE00000 +#define EMAC_RAM_SIZE 0x00004000 + +//#define EMAC_TX_DESCRIPTOR_COUNT 0x0010 +//#define EMAC_RX_DESCRIPTOR_COUNT 0x0010 +diff -upNr
u-boot-orig/board/LPC2468/lowlevel_init.cu-boot/board/LPC2468/lowlevel_init.cboard/LPC2468/lowlevel_init.c +63
-0@@ -0,0 +1,436 @@ +/* +* (C) Copyright 2006-2007 Embedded Artists AB <www.embeddedartists.com> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <config.h> +#include <version.h> +#include <exports.h> +#include <asm/arch/hardware.h> +#include <asm/hardware.h> + +/****************************************************************************** +* Defines, macros, and typedefs +*****************************************************************************/ + +#define USE_USB 1 + +#define PLL_MValue (CONFIG_PLL_MVALUE-1) +#define PLL_NValue (CONFIG_PLL_NVALUE-1) +#define CCLKDivValue (CONFIG_PLL_CLKDIV-1) +#define USBCLKDivValue (CONFIG_PLL_USBCLKDIV-1) + +#define Fcco ((2*CONFIG_PLL_MVALUE*CONFIG_FOSC) / CONFIG_PLL_NVALUE) +#define Fcclk (Fcco / CONFIG_PLL_CLKDIV) +#define Fpclk (Fcclk / CONFIG_FPCLK_DIV) +#define MAM_SETTING 1/* 0=disabled, +1=partly enabled (enabled for code prefetch, but not for data), +2=fully enabled */ +#define MEM_MAP 2/* When executing from RAM, MAM_MAP should always be 2 */ +#define SDRAM_BASE_ADDR 0xA0000000 +#define m_reg_write (reg,data) ((*(volatile unsigned long *)(reg)) = (volatile unsigned long)(data)) +/***************************************************************************** +* +* Description: +* Delay execution by a specified number of milliseconds by using +* timer #1. A polled implementation. +* +* Params: +* [in] delayInMs - the number of milliseconds to delay. +* +****************************************************************************/ +void delayMs (unsigned short delayInMs) +{ +/* +* setup timer #1 for delay +*/ +T1TCR =0x02 ;//stop and reset timer +T1PR =0x00 ;//set prescaler to zero +T1MR0 = delayInMs * (Fpclk /1000 );
board/LPC2468/lowlevel_init.c line 73
Quoted 10 lines
board/LPC2468/lowlevel_init.c +10
-0+ +T1IR =0xff ;//reset all interrrupt flags +T1MCR =0x04 ;//stop timer on match +T1TCR =0x01 ;//start timer + +//wait until delay time has elapsed +while (T1TCR &0x01 ) + ; + +}
please implemet and use timer
Quoted 30 lines
board/LPC2468/lowlevel_init.c +30
-0+ +/****************************************************************************** +** Function name: GPIOinit +** +** Descriptions: Sets all GPIO ports to a known state +** parameters: None +** Returned value: None +** +******************************************************************************/ +static void GPIOinit (void ) +{ +PINSEL0 =0 ; +PINSEL1 =0 ; +PINSEL2 =0 ; +PINSEL3 =0 ; +PINSEL4 =0 ; +PINSEL5 =0 ; +PINSEL6 =0 ; +PINSEL7 =0 ; +PINSEL8 =0 ; +PINSEL9 =0 ; +PINSEL10 =0 ; + +IODIR0 =0 ; +IODIR1 =0 ; +IOSET0 =0xffffffff ; +IOSET1 =0xffffffff ; + +FIO0DIR =0 ; +FIO1DIR =0 ;
board/LPC2468/lowlevel_init.c line 113
Quoted 10 lines
board/LPC2468/lowlevel_init.c +10
-0+FIO2DIR =0 ; +FIO3DIR =0 ; +FIO4DIR =0 ; + +FIO0SET =0xffffffff ; +FIO1SET =0xffffffff ; +FIO2SET =0xffffffff ; +FIO3SET =0x0 ; +FIO4SET =0xffffffff ; +}
???
please explain what do you do?
please try use access as at91 or other mach
Quoted 74 lines
board/LPC2468/lowlevel_init.c +74
-0+ +/****************************************************************************** +** Function name: VICinit +** +** Descriptions: Initialize the VIC to a known state +** parameters: None +** Returned value: None +** +******************************************************************************/ +static void VICinit (void ) +{ +//initialize VIC + VICIntEnClr =0xFFFFFFFF ;/* Disable ALL interrupts */ + + VICProtection =0 ;/* Setup interrupt controller */ + VICVectAddr =0 ; + VICIntSelect =0 ; + + VICVectAddr0 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr1 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr2 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr3 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr4 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr5 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr6 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr7 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr8 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr9 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr10 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr11 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr12 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr13 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr14 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr15 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr16 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr17 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr18 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr19 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr20 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr21 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr22 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr23 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr24 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr25 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr26 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr27 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr28 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr29 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr30 = (unsigned int )0 ;/* Set the vector address */ + VICVectAddr31 = (unsigned int )0 ;/* Set the vector address */ + + VICVectCntl0 = (unsigned int )0xf ; + VICVectCntl1 = (unsigned int )0xf ; + VICVectCntl2 = (unsigned int )0xf ; + VICVectCntl3 = (unsigned int )0xf ; + VICVectCntl4 = (unsigned int )0xf ; + VICVectCntl5 = (unsigned int )0xf ; + VICVectCntl6 = (unsigned int )0xf ; + VICVectCntl7 = (unsigned int )0xf ; + VICVectCntl8 = (unsigned int )0xf ; + VICVectCntl9 = (unsigned int )0xf ; + VICVectCntl10 = (unsigned int )0xf ; + VICVectCntl11 = (unsigned int )0xf ; + VICVectCntl12 = (unsigned int )0xf ; + VICVectCntl13 = (unsigned int )0xf ; + VICVectCntl14 = (unsigned int )0xf ; + VICVectCntl15 = (unsigned int )0xf ; + VICVectCntl16 = (unsigned int )0xf ; + VICVectCntl17 = (unsigned int )0xf ; + VICVectCntl18 = (unsigned int )0xf ; + VICVectCntl19 = (unsigned int )0xf ; + VICVectCntl20 = (unsigned int )0xf ; + VICVectCntl21 = (unsigned int )0xf ; + VICVectCntl22 = (unsigned int )0xf ;
board/LPC2468/lowlevel_init.c line 197
Quoted 10 lines
board/LPC2468/lowlevel_init.c +10
-0+ VICVectCntl23 = (unsigned int )0xf ; + VICVectCntl24 = (unsigned int )0xf ; + VICVectCntl25 = (unsigned int )0xf ; + VICVectCntl26 = (unsigned int )0xf ; + VICVectCntl27 = (unsigned int )0xf ; + VICVectCntl28 = (unsigned int )0xf ; + VICVectCntl29 = (unsigned int )0xf ; + VICVectCntl30 = (unsigned int )0xf ; + VICVectCntl31 = (unsigned int )0xf ; +}
please try to use loop
Quoted 276 lines
board/LPC2468/lowlevel_init.c +239
-0+ +/****************************************************************************** +** Function name: ConfigurePLL +** +** Descriptions: Configure the PLL +** parameters: None +** Returned value: None +** +******************************************************************************/ +void ConfigurePLL (void ) +{ + +volatile unsigned long MValue; +volatile unsigned long NValue; + +if (PLLSTAT & (1 <<25 )) + { + +PLLCON =1 ;/* Enable PLL, disconnected */ + +PLLFEED =0xaa ; + +PLLFEED =0x55 ; + + } + +PLLCON =0 ;/* Disable PLL, disconnected */ +PLLFEED =0xaa ; +PLLFEED =0x55 ; +SCS |=0x20 ;/* Enable main OSC */ + +while (!(SCS &0x40 )) ;/* Wait until main OSC is usable */ + +CLKSRCSEL =0x1 ;/* select main OSC, 12MHz, as the PLL clock source */ +PLLCFG = PLL_MValue | (PLL_NValue <<16 ); +PLLFEED =0xaa ; +PLLFEED =0x55 ; +PLLCON =1 ;/* Enable PLL, disconnected */ +PLLFEED =0xaa ; +PLLFEED =0x55 ; +CCLKCFG = CCLKDivValue;/* Set clock divider */ + +#if USE_USB +USBCLKCFG = USBCLKDivValue;/* usbclk = 288 MHz/6 = 48 MHz */ + +#endif /* +*/ + +while (((PLLSTAT & (1 <<26 )) ==0 )) ;/* Check lock bit status */ + + MValue =PLLSTAT &0x00007FFF ; + NValue = (PLLSTAT &0x00FF0000 ) >>16 ; + +while ((MValue != PLL_MValue) && (NValue != PLL_NValue)) ; + +PLLCON =3 ;/* enable and connect */ +PLLFEED =0xaa ; +PLLFEED =0x55 ; + +while (((PLLSTAT & (1 <<25 )) ==0 )) ;/* Check connect bit status */ + +} + +/****************************************************************************** +** Function name: ConfigureEMC +** +** Descriptions: Configure EMC for external SDRAM, NAND and NOR FLASH +** parameters: None +** Returned value: None +** +******************************************************************************/ +void ConfigureEMC (void ) +{ + +volatile unsigned int i, dummy = dummy; + +EMC_CTRL =0x00000001 ; +PCONP |=0x00000800 ;/* Turn on EMC PCLK */ + +// CS2 & CS3 not used PINSEL4 = 0x50000000; +PINSEL5 =0x05050555 ; +PINSEL6 =0x55555555 ; +PINSEL8 =0x55555555 ; +PINSEL9 =0x50555555 ; + +//all registers... +EMC_DYN_RP =2 ;//>20ns = 2 clk +EMC_DYN_RAS =3 ;//>45ns = 3 clk +EMC_DYN_SREX =7 ;//>80-100ns = 6 clk +EMC_DYN_APR =2 ;// +EMC_DYN_DAL =5 ;//2 clk +EMC_DYN_WR =1 ;//2 clk +EMC_DYN_RC =5 ;//>65ns = 4 clk +EMC_DYN_RFC =5 ;//>80-100ns = 6 clk +EMC_DYN_XSR =7 ;//>80-100ns = 6 clk +EMC_DYN_RRD =1 ;//>15ns = 1-2 clk +EMC_DYN_MRD =2 ;//2 clk +EMC_DYN_RD_CFG =1 ;//or 1,2,3 + +// +EMC_DYN_RASCAS0 =0x00000303 ; + +// +EMC_DYN_CFG0 =0x00000680 ; + +//wait 100mS +delayMs (100 ); + +//Send command: NOP +EMC_DYN_CTRL =0x00000183 ; + +//wait 200mS +delayMs (200 ); + +//Send command: PRECHARGE-ALL, shortest possible refresh period +EMC_DYN_CTRL =0x00000103 ; + +EMC_DYN_RFSH =0x00000002 ; + +//wait 128 ABH clock cycles +for (i =0 ; i <0x40 ; i++) + asmvolatile (" nop" ); + +//Set correct refresh period +EMC_DYN_RFSH =28 ; + +//Send command: MODE +EMC_DYN_CTRL =0x00000083 ; + +//Set mode register in SDRAM + dummy = *((volatile unsigned int *)(SDRAM_BASE_ADDR | (0x33 <<12 ))); + +//Send command: NORMAL +EMC_DYN_CTRL =0x00000000 ; + +//Enable buffer +EMC_DYN_CFG0 |=0x00080000 ; + +//initial system delay +delayMs (1 ); + +EMC_STA_WAITWEN0 =0x2 ; +EMC_STA_WAITOEN0 =0x2 ; +EMC_STA_WAITRD0 =0x1f ; +EMC_STA_WAITPAGE0 =0x1f ; +EMC_STA_WAITWR0 =0x1f ; +EMC_STA_WAITTURN0 =0xf ; +EMC_STA_CFG0 =0x00000081 ; +EMC_STA_WAITWEN1 =0x2 ; +EMC_STA_WAITOEN1 =0x2 ; +EMC_STA_WAITRD1 =0x8 ; +EMC_STA_WAITPAGE1 =0x1f ; +EMC_STA_WAITWR1 =0x8 ; +EMC_STA_WAITTURN1 =0xf ; +EMC_STA_CFG1 =0x00000080 ; +} + +/***************************************************************************** +* +* Description: +* Initialize system functions and GPIO +* +****************************************************************************/ +void lowlevel_init (void ) +{ + +/******************************************************************************************** +* Remap vectors for RAM execution +********************************************************************************************/ +MEMMAP =1 ; + +#ifndef CONFIG_SKIP_LOWLEVEL_INIT +/* move vectors to beginning of SRAM */ + asmvolatile (" mov r2, #0x40000000 \n" +" mov r0, #0x00000000 \n" +" ldmneia r0!, {r3-r10} \n" +" stmneia r2!, {r3-r10} \n" +" ldmneia r0, {r3-r9} \n" +" stmneia r2, {r3-r9} \n" ::: +"r0" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" , +"r8" ,"r9" ,"r10" ); +#else +/* move vectors to beginning of SRAM */ + asmvolatile (" mov r2, #0x40000000 \n" +" mov r0, #0xa1000000 \n" +" ldmneia r0!, {r3-r10} \n" +" stmneia r2!, {r3-r10} \n" +" ldmneia r0, {r3-r9} \n" +" stmneia r2, {r3-r9} \n" ::: +"r0" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" ,"r8" ,"r9" , +"r10" ); +#endif + +//initialize the exception vector mapping +MEMMAP =MEM_MAP ; + +#if USE_USB +PCONP |=0x80000000 ;/* Turn On USB PCLK */ + +#endif +ConfigurePLL (); + +/* Set system timers for each component */ +#if (Fpclk / (Fcclk /4 )) ==1 +PCLKSEL0 =0x00000000 ;/* PCLK is 1/4 CCLK */ +PCLKSEL1 =0x00000000 ; +#endif +#if (Fpclk / (Fcclk /4 )) ==2 +PCLKSEL0 =0xAAAAAAAA ;/* PCLK is 1/2 CCLK */ +PCLKSEL1 =0xAAAAAAAA ; + +#endif +#if (Fpclk / (Fcclk /4 )) ==4 +PCLKSEL0 =0x55555555 ;/* PCLK is the same as CCLK */ +PCLKSEL1 =0x55555555 ; +#endif +/* Set memory accelerater module */ +MAMCR =0 ; + +MAMTIM =4 ; + +// MAMCR = 2; +//Init GPIO +GPIOinit (); + +//initialize VIC +VICinit (); + +//short delay +delayMs (10 ); + +/******************************************************************************************** +* Initialize external memory interface (EMC) +********************************************************************************************/ +#ifndef CONFIG_SKIP_LOWLEVEL_INIT +ConfigureEMC (); +#endif /* +*/ +}diff -upNr
u-boot-orig/board/LPC2468/LPC2468.cu-boot/board/LPC2468/LPC2468.cboard/LPC2468/LPC2468.c +33
-0@@ -0,0 +1,66 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* +* (C) Copyright 2005 Rowel Atienza <[email protected]> +* 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 <common.h> +#include <clps7111.h> + +/* ------------------------------------------------------------------------- */ + +
board/LPC2468/LPC2468.c line 43
Quoted 10 lines
board/LPC2468/LPC2468.c +10
-0+/* +* 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 ;
please a valid ARCH NUMBER macro (mandatory)
Quoted 13 lines
board/LPC2468/LPC2468.c +13
-0+ +/* location of boot parameters */ + gd->bd->bi_boot_params =0xA0000100 ; + +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 ; +}
board/LPC2468/LPC2468.c line 66
Quoted 10 lines
board/LPC2468/LPC2468.c +10
-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 ); +}
please clean up first before a full review
Best Regards,
J.
PATCH 2/2 LPC2468 example board
Jean-Christophe PLAGNIOL-VILLARD schreef:
Quoted 2 lines
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
PATCH 2/2 LPC2468 example board
Added example board for LPC2468 processor
---
From ab9ef1e9c2bd8f04612429461baa5c24dbc52266 Mon Sep 17 00:00:00 2001
From: Remco Poelstra <[email protected]>
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
board/LPC2468/LPC2468.c new file +65 -0
@@ -0,0 +1,65 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* +* (C) Copyright 2005 Rowel Atienza <[email protected]> +* 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 <common.h> +#include <clps7111.h> + +/* ------------------------------------------------------------------------- */ + +/* +* 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 =0xA0000100 ; + +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 ); +}
board/LPC2468/Makefile new file +55 -0
55 lines not on this page · raw message
board/LPC2468/config.mk new file +29 -0
@@ -0,0 +1,29 @@ +# +# (C) Copyright 2000 +# Sysgo Real-Time Solutions, GmbH <www.elinos.com> +# Marius Groeger <[email protected]> +# +# (C) Copyright 2000 +# Wolfgang Denk, DENX Software Engineering, wd at 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 = 0xA1f80000
board/LPC2468/flash.c new file +255 -0
255 lines not on this page · raw message
board/LPC2468/lowlevel_init.c new file +445 -0
445 lines not on this page · raw message
board/LPC2468/nand.c new file +63 -0
63 lines not on this page · raw message
board/LPC2468/u-boot.lds new file +55 -0
55 lines not on this page · raw message
include/asm-arm/arch-lpc24xx/immap.h +132 -10
180 lines not on this page · raw message
include/configs/LPC2468.h new file +220 -0
220 lines not on this page · raw message
Signature · 1 line
1.6.2.4
PATCH 2/2 LPC2468 example board
Dear Jean-Christophe,
Quoted 20 lines · In message <[email protected]> Remco Poelstra wrote:
Added example board for LPC2468 processor
Signed-off-by Remco Poelstra <[email protected]---
Fromab9ef1e9c2bd8f04612429461baa5c24dbc52266Mon Sep 17 00:00:00 2001
From: Remco Poelstra <[email protected]>
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(-)
Quoted 8 lines
create mode 100644
board/LPC2468/LPC2468.ccreate mode 100755 board/LPC2468/Makefile create mode 100755board/LPC2468/config.mkcreate mode 100644board/LPC2468/flash.ccreate mode 100644board/LPC2468/lowlevel_init.ccreate mode 100755board/LPC2468/nand.ccreate mode 100755board/LPC2468/u-boot.ldscreate mode 100644include/configs/LPC2468.h
AFAICT this has neither been applied nor rejected yet. Please check.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A fanatic is a person who can't change his mind and won't change the subject. - Winston Churchill
PATCH 2/2 LPC2468 example board
In reply to Remco PoelstraQuoted 3 lines · Remco Poelstra
Added example board for LPC2468 processor
Signed-off-by Remco Poelstra <[email protected]
please split your patch
Quoted 6 lines
---
Fromab9ef1e9c2bd8f04612429461baa5c24dbc52266Mon Sep 17 00:00:00 2001
From: Remco Poelstra <[email protected]>
Date: Tue, 28 Apr 2009 15:04:33 +0200
Subject: [PATCH] Added example board for LPC2468 processor
Quoted 7 lines
--- 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 +++++
please add it in an other patch and please store it in drivers/mtd/nand/
Quoted 51 lines
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.ccreate mode 100755 board/LPC2468/Makefile create mode 100755board/LPC2468/config.mkcreate mode 100644board/LPC2468/flash.ccreate mode 100644board/LPC2468/lowlevel_init.ccreate mode 100755board/LPC2468/nand.ccreate mode 100755board/LPC2468/u-boot.ldscreate mode 100644include/configs/LPC2468.hboard/LPC2468/LPC2468.c new file +32
-0@@ -0,0 +1,65 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* +* (C) Copyright 2005 Rowel Atienza <[email protected]> +* 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 <common.h> +#include <clps7111.h> + +/* ------------------------------------------------------------------------- */ +
board/LPC2468/LPC2468.c line 42
Quoted 10 lines
board/LPC2468/LPC2468.c new file +10
-0+/* +* 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 ;
please use proper CONFIG
board/LPC2468/LPC2468.c line 45
Quoted 3 lines
board/LPC2468/LPC2468.c new file +3
-0+ +/* location of boot parameters */ + gd->bd->bi_boot_params =0xA0000100 ;
please use this styleCONFIG_RAM_BASE + 0x100
board/LPC2468/LPC2468.c line 53
Quoted 8 lines
board/LPC2468/LPC2468.c new file +8
-0+ +return 0 ; +} + +int print_cpuinfo (void ) +{ +printf ("CPU: LPC2468 (ARM7tdmi-s from NXP)\n" +" running at 57.6 MHz (12 MHz crystal)\n" );
is it possible to detect it?
Quoted 16 lines
board/LPC2468/LPC2468.c new file +12
-0+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 ); +}board/LPC2468/Makefile new file +0
-1--- /dev/null
<snip>
board/LPC2468/flash.c
Quoted 6 lines
board/LPC2468/Makefile new file +1
-0+TEXT_BASE = 0xA1f80000board/LPC2468/flash.c new file +0
-0
Is your flash cfi compatible? Stefan what do you think?
Quoted 46 lines
board/LPC2468/flash.c new file +24
-0@@ -0,0 +1,255 @@ +/* +* (C) Copyright 2006 Embedded Artists AB <www.embeddedartists.com> +* +* (C) Copyright 2009 Duran Audio B.V. <www.duran-audio.com> +* +* 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 <[email protected]> +*/ +board/LPC2468/lowlevel_init.c new file +14
-0@@ -0,0 +1,445 @@ +/* +* (C) Copyright 2006-2007 Embedded Artists AB <www.embeddedartists.com> +* +* 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
board/LPC2468/lowlevel_init.c line 24
Quoted 10 lines
board/LPC2468/lowlevel_init.c new file +10
-0+* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <config.h> +#include <version.h> +#include <exports.h> +#include <asm/arch/immap.h> +#include <asm/io.h>
I think a lot's of the inits done here are soc specific and not board specific
Quoted 12 lines
board/LPC2468/lowlevel_init.c new file +12
-0+ +/****************************************************************************** +* Defines, macros, and typedefs +*****************************************************************************/ + +#define USE_USB 1 + +#define PLL_MValue (CONFIG_PLL_MVALUE-1) +#define PLL_NValue (CONFIG_PLL_NVALUE-1) +#define CCLKDivValue (CONFIG_PLL_CLKDIV-1) +#define USBCLKDivValue (CONFIG_PLL_USBCLKDIV-1) +
board/LPC2468/lowlevel_init.c line 46
Quoted 10 lines
board/LPC2468/lowlevel_init.c new file +10
-0+#define Fcco ((2*CONFIG_PLL_MVALUE*CONFIG_FOSC) / CONFIG_PLL_NVALUE) +#define Fcclk (Fcco / CONFIG_PLL_CLKDIV) +#define Fpclk (Fcclk / CONFIG_FPCLK_DIV) +#define MAM_SETTING 1/* 0=disabled, +1=partly enabled (enabled for code prefetch, +but not for data), +2=fully enabled */ +#define MEM_MAP 2/*When executing from RAM, MAM_MAP should always be 2*/ +#define SDRAM_BASE_ADDR 0xA0000000 +#define FASTIO_BASE_ADDR 0x3FFF8000
please move thise configs to beter place
Quoted 23 lines
board/LPC2468/lowlevel_init.c new file +23
-0+ +/* Helper macros */ +#define BFS32 (reg,value) writel( (readl(reg)|=(value)) ,reg) +#define BFC32 (reg,value) writel( (readl(reg)&=(~value)) ,reg) + +/***************************************************************************** +* +* Description: +* Delay execution by a specified number of milliseconds by using +* timer #1. A polled implementation. +* +* Params: +* [in] delayInMs - the number of milliseconds to delay. +* +****************************************************************************/ +void delayMs (unsigned short delayInMs) +{ +timer_2468_t *timer=&(((immap_t *)CONFIG_SYS_IMMAP )->apb.timer1); +/* +* setup timer #1 for delay +*/ +writel (0x02 , &(timer->tcr));/*stop and reset timer */ +writel (0x00 , &(timer->pr));/*set prescaler to zero */
board/LPC2468/lowlevel_init.c line 79
Quoted 10 lines
board/LPC2468/lowlevel_init.c new file +10
-0+writel (delayInMs * (Fpclk /1000 ), &(timer->mr0)); + +writel (0xff , &(timer->ir));/*reset all interrrupt flags */ +writel (0x04 , &(timer->mcr));/*stop timer on match */ +writel (0x01 , &(timer->tcr));/*start timer */ + +/*wait until delay time has elapsed */ +while (readl (&(timer->tcr)) &0x01 ) ; + +}
why do you need this and do not use the general timer implementation?
board/LPC2468/lowlevel_init.c line 86
Quoted 7 lines
board/LPC2468/lowlevel_init.c new file +7
-0+ +/****************************************************************************** +** Function name: GPIOinit +** +** Descriptions: Sets all GPIO ports to a known state +** parameters: None +** Returned value: None
could you describe what you do here?
maybe use gpio api to be more generic and understandable
Quoted 36 lines
board/LPC2468/lowlevel_init.c new file +36
-0+** +******************************************************************************/ +static void GPIOinit (void ) +{ +pin_connect_2468_t *pin_connect= + &(((immap_t *)CONFIG_SYS_IMMAP )->apb.pin_connect); +gpio_2468_t *gpio= + &(((immap_t *)CONFIG_SYS_IMMAP )->apb.gpio); +fastio_2468_t *fio=(fastio_2468_t *)FASTIO_BASE_ADDR ; + +writel (0 , &(pin_connect->pinsel0)); +writel (0 , &(pin_connect->pinsel1)); +writel (0 , &(pin_connect->pinsel2)); +writel (0 , &(pin_connect->pinsel3)); +writel (0 , &(pin_connect->pinsel4)); +writel (0 , &(pin_connect->pinsel5)); +writel (0 , &(pin_connect->pinsel6)); +writel (0 , &(pin_connect->pinsel7)); +writel (0 , &(pin_connect->pinsel8)); +writel (0 , &(pin_connect->pinsel9)); +writel (0 , &(pin_connect->pinsel10)); + +writel (0 , &(gpio->iodir0)); +writel (0 , &(gpio->iodir1)); +writel (0xffffffff , &(gpio->ioset0)); +writel (0xffffffff , &(gpio->ioset1)); + +writel (0 , &(fio->fio0dir)); +writel (0 , &(fio->fio1dir)); +writel (0 , &(fio->fio2dir)); +writel (0 , &(fio->fio3dir)); +writel (0 , &(fio->fio4dir)); + +writel (0xffffffff , &(fio->fio0set)); +writel (0xffffffff , &(fio->fio1set)); +writel (0xffffffff , &(fio->fio2set));
board/LPC2468/lowlevel_init.c line 132
Quoted 10 lines
board/LPC2468/lowlevel_init.c new file +10
-0+writel (0 , &(fio->fio3set)); +writel (0xffffffff , &(fio->fio4set)); +} + +/****************************************************************************** +** Function name: VICinit +** +** Descriptions: Initialize the VIC to a known state +** parameters: None +** Returned value: None
why do you need this?
do you use the interrupt in update?
board/LPC2468/lowlevel_init.c line 135
Quoted 3 lines
board/LPC2468/lowlevel_init.c new file +3
-0+** +******************************************************************************/ +static void VICinit (void )
please uppercase for macro
and lowercase for the rest
board/LPC2468/lowlevel_init.c line 143
Quoted 8 lines
board/LPC2468/lowlevel_init.c new file +8
-0+{ +vic_2468_t *vic=&(((immap_t *)CONFIG_SYS_IMMAP )->ahb.vic); +/*initialize VIC */ +writel (0xffffffff , &(vic->vicinenclr));/* Disable ALL interrupts */ +writel (0 , &(vic->vicprotect));/* Setup interrupt controller */ +writel (0 , &(vic->vicaddr)); +writel (0 , &(vic->vicintselect)); +writel (0 , &(vic->vicvectaddr0));/* Set the vector address */
try to use array to simplify it
Quoted 4 lines
board/LPC2468/lowlevel_init.c new file +4
-0+writel (0 , &(vic->vicvectaddr1)); +writel (0 , &(vic->vicvectaddr2)); +writel (0 , &(vic->vicvectaddr3)); +writel (0 , &(vic->vicvectaddr4));
<snip>
board/LPC2468/lowlevel_init.c line 222
Quoted 6 lines
board/LPC2468/lowlevel_init.c new file +6
-0+void ConfigurePLL (void ) +{ +sys_con_2468_t *sys_con=&(((immap_t *)CONFIG_SYS_IMMAP )->apb.sys_con); + +volatile unsigned long MValue; +volatile unsigned long NValue;
please add an empty line
Quoted 16 lines
board/LPC2468/lowlevel_init.c new file +16
-0+if (readl (&(sys_con->pllstat)) & (1 <<25 )) { + +writel (1 , &(sys_con->pllcon));/* Enable PLL, disconnected */ +writel (0xaa , &(sys_con->pllfeed)); +writel (0x55 , &(sys_con->pllfeed)); + } + +writel (0 , &(sys_con->pllcon));/* Disable PLL, disconnected */ +writel (0xaa , &(sys_con->pllfeed)); +writel (0x55 , &(sys_con->pllfeed)); +BFS32 (&(sys_con->scs),0x20 );/* Enable main OSC */ + +/* Wait until main OSC is usable */ +while (!(readl (&(sys_con->scs)) &0x40 )); + +/* select main OSC, 12MHz, as the PLL clock source */
board/LPC2468/lowlevel_init.c line 248
Quoted 10 lines
board/LPC2468/lowlevel_init.c new file +10
-0+writel (0x1 , &(sys_con->clksrcsel)); +writel (PLL_MValue | (PLL_NValue <<16 ), &(sys_con->pllcfg)); +writel (0xaa , &(sys_con->pllfeed)); +writel (0x55 , &(sys_con->pllfeed)); +writel (1 , &(sys_con->pllcon));/* Enable PLL, disconnected */ +writel (0xaa , &(sys_con->pllfeed)); +writel (0x55 , &(sys_con->pllfeed)); +writel (CCLKDivValue, &(sys_con->cclkcfg));/*Set clock divider*/ + +#if USE_USB
please use a CONFIG_CMD_USB or other related CONFIG
board/LPC2468/u-boot.lds
Quoted 121 lines
board/LPC2468/lowlevel_init.c new file +118
-0+/* usbclk = 288 MHz/6 = 48 MHz */ +writel (USBCLKDivValue, &(sys_con->usbclkcfg)); +#endif + +/* Check lock bit status */ +while (((readl (&(sys_con->pllstat)) & (1 <<26 )) ==0 )); + + MValue =readl (&(sys_con->pllstat)) &0x00007FFF ; + NValue = (readl (&(sys_con->pllstat)) &0x00FF0000 ) >>16 ; + +while ((MValue != PLL_MValue) && (NValue != PLL_NValue)) ; + +writel (3 , &(sys_con->pllcon));/* enable and connect */ +writel (0xaa , &(sys_con->pllfeed)); +writel (0x55 , &(sys_con->pllfeed)); +/* Check connect bit status */ +while (((readl (&(sys_con->pllstat)) & (1 <<25 )) ==0 )); +} + +/**************************************************************************** +** Function name: ConfigureEMC +** +** Descriptions: Configure EMC for external SDRAM, NAND and NOR FLASH +** parameters: None +** Returned value: None +** +****************************************************************************/ +void ConfigureEMC (void ) +{ +ext_mem_2468_t *emc=&(((immap_t *)CONFIG_SYS_IMMAP )->ahb.ext_mem); +pin_connect_2468_t *pin_connect= + &(((immap_t *)CONFIG_SYS_IMMAP )->apb.pin_connect); +sys_con_2468_t *sys_con=&(((immap_t *)CONFIG_SYS_IMMAP )->apb.sys_con); + +volatile unsigned int i, dummy = dummy; + +writel (0x00000001 , &(emc->control)); +BFS32 (&(sys_con->pconp),0x00000800 );/* Turn on EMC PCLK */ + +/* CS2 & CS3 not used PINSEL4 = 0x50000000; */ +writel (0x05050555 , &(pin_connect->pinsel5)); +writel (0x55555555 , &(pin_connect->pinsel6)); +writel (0x55555555 , &(pin_connect->pinsel8)); +writel (0x50555555 , &(pin_connect->pinsel9)); + +/*all registers... */ +writel (2 , &(emc->dynrp));/*>20ns = 2 clk */ +writel (3 , &(emc->dynras));/*>45ns = 3 clk */ +writel (7 , &(emc->dynsrex));/*>80-100ns = 6 clk */ +writel (2 , &(emc->dynapr)); +writel (5 , &(emc->dyndal));/*2 clk */ +writel (1 , &(emc->dynwr));/*2 clk */ +writel (5 , &(emc->dynrc));/*>65ns = 4 clk */ +writel (5 , &(emc->dynrfc));/*>80-100ns = 6 clk */ +writel (7 , &(emc->dynxsr));/*>80-100ns = 6 clk */ +writel (1 , &(emc->dynrrd));/*>15ns = 1-2 clk */ +writel (2 , &(emc->dynmrd));/*2 clk */ +writel (1 , &(emc->dynreadconfig));/*or 1,2,3 */ +writel (0x00000303 , &(emc->dynrascas0)); +writel (0x00000680 , &(emc->dynconfig0)); + +/*wait 100mS */ +delayMs (100 ); + +/*Send command: NOP */ +writel (0x00000183 , &(emc->dyncontrol)); + +/*wait 200mS */ +delayMs (200 ); + +/*Send command: PRECHARGE-ALL, shortest possible refresh period */ +writel (0x00000103 , &(emc->dyncontrol)); +writel (0x00000002 , &(emc->dynrefresh)); + +/*wait 128 ABH clock cycles */ +for (i =0 ; i <0x40 ; i++) + asmvolatile (" nop" ); + +/*Set correct refresh period */ +writel (28 , &(emc->dynrefresh)); + +/*Send command: MODE */ +writel (0x00000083 , &(emc->dyncontrol)); + +/*Set mode register in SDRAM */ + dummy = *((volatile unsigned int *)(SDRAM_BASE_ADDR | (0x33 <<12 ))); + +/*Send command: NORMAL */ +writel (0x00000000 , &(emc->dyncontrol)); + +/*Enable buffer */ +BFS32 (&(emc->dynconfig0),0x00080000 ); + +/*initial system delay */ +delayMs (1 ); + +writel (0x2 , &(emc->statwaitwen0)); +writel (0x2 , &(emc->statwaitoen0)); +writel (0x1f , &(emc->statwaitrd0)); +writel (0x1f , &(emc->statwaitpage0)); +writel (0x1f , &(emc->statwaitwr0)); +writel (0xf , &(emc->statwaitturn0)); +writel (0x00000081 , &(emc->statconfig0)); +writel (0x2 , &(emc->statwaitwen1)); +writel (0x2 , &(emc->statwaitoen1)); +writel (0x8 , &(emc->statwaitrd1)); +writel (0x1f , &(emc->statwaitpage1)); +writel (0x8 , &(emc->statwaitwr1)); +writel (0xf , &(emc->statwaitturn1)); +writel (0x00000080 , &(emc->statconfig1)); +} + +/***************************************************************************** +* +* Description: +* Initialize system functions and GPIO +* +****************************************************************************/ board/LPC2468/u-boot.lds new file +0
-0
no need please remove
Quoted 24 lines
board/LPC2468/u-boot.lds new file +23
-0@@ -0,0 +1,55 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd at 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 + */ +
<snip>
board/LPC2468/u-boot.lds
Quoted 13 lines
board/LPC2468/u-boot.lds new file +13
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_LPC2468 + +/* + * If we are developing, we might want to start armboot from ram + * so we MUST NOT initialize critical regs like mem-timing ... + */ +#if 0 +#define CONFIG_INIT_CRITICAL /* undef for developing */ +#endif
please remove
Quoted 81 lines
board/LPC2468/u-boot.lds new file +81
-0+ +#undef CONFIG_SKIP_LOWLEVEL_INIT + +/* + * High Level Configuration Options + * (easy to change) + */ +#define CONFIG_ARM7 1 /* This is a ARM7 CPU */ +#define CONFIG_ARM_THUMB 1 /* this is an ARM720TDMI */ +#undef CONFIG_ARM7_REVD /* disable ARM720 REV.D Workarounds */ + +/* Clock settings */ + +/* Crystal frequency */ +#define CONFIG_FOSC 12000000 + +/* + * Fcco = 2*M*Fosc / N + * + * Fcco = 288000000 -> M = 12, N = 1 + * + * PLLCFG (MSEL) = (M-1) + * PLLCFG (NSEL) = (N-1) + */ +#define CONFIG_PLL_MVALUE 12 +#define CONFIG_PLL_NVALUE 1 + +/* + * Fcclk = Fcco / CLKDIV + * CLKDIV must be an even number + * + * CCLKCFG = CLKDIV-1 (odd number must be written to register) + * CLKDIV = 4 -> Fcclk = 72 MHz (if Fcco = 288 MHz) + * CLKDIV = 6 -> Fcclk = 48 MHz (if Fcco = 288 MHz) + */ +#define CONFIG_PLL_CLKDIV 4 + +/* + * The USB clock must be 48 MHz + * Fusb = Fcco / USBCLKDIV + * USBCLKCFG = (USBCLKDIV-1) + */ +#define CONFIG_PLL_USBCLKDIV 6 + +/* + * Periperhal clock divider, i.e. Fpclk = Fcclk / divider + * Valid values are 1, 2, or 4 + */ +#define CONFIG_FPCLK_DIV 1 + +#define CONFIG_USE_IRQ /* use irq for mci interface */ + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_SYS_GBL_DATA_SIZE 128 + +/* + * Hardware drivers + */ + +/* + * select serial console configuration + */ +#define CONFIG_LPC2468_SERIAL +#define CONFIG_SERIAL 1 /* we use Serial line 1 */ + +#define CONFIG_LPC2468_ETH + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE + +#define CONFIG_BAUDRATE 115200 + +#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT|CONFIG_BOOTP_BOOTFILESIZE) + +#include <config_cmd_default.h> +#undef CONFIG_CMD_NFS +#undef CONFIG_CMD_FPGA
board/LPC2468/u-boot.lds
Quoted 10 lines
board/LPC2468/u-boot.lds new file +10
-0+#undef CONFIG_CMD_BOOTD +#define CONFIG_CMD_NAND + +#define CONFIG_BOOTARGS\ + "root=/dev/ram initrd=0xa1800000,4000k console=ttyS0,115200N8" + +/* + * Miscellaneous configurable options + */ +#define CFG_LONGHELP /*undef to save memory*/
it's not anymore CFG_ but CONFIG_SYS_ please rebase your patch against the Mainline
Best Regards,
J.