Re: [U-Boot] [PATCH] avr32/bootm: remove unused variable 'ret'

2008-11-13 Thread Haavard Skinnemoen
Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED] wrote:
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED]

Acked-by: Haavard Skinnemoen [EMAIL PROTECTED]

I'm a bit out of sync at the moment. Wolfgang, can you apply it
directly?

 diff --git a/lib_avr32/bootm.c b/lib_avr32/bootm.c
 index 556e3ea..03ab8d1 100644
 --- a/lib_avr32/bootm.c
 +++ b/lib_avr32/bootm.c
 @@ -176,7 +176,6 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
 bootm_headers_t *images)
   void(*theKernel)(int magic, void *tagtable);
   struct  tag *params, *params_start;
   char*commandline = getenv(bootargs);
 - int ret;
  
   if ((flag != 0)  (flag != BOOTM_STATE_OS_GO))
   return 1;
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_bdinfo: move implementation to arch instead of common

2008-11-13 Thread Haavard Skinnemoen
Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED] wrote:
 This patch trades off the removal of most of the #ifdef ugly for  
  a lot of duplication.  Which is the lesser of two evils?  
 Only 4 archs share actually the same code avr32, i386, mips and sh
 which actually I've plan to modify for sh soon

And the avr32 code is mostly wrong. So it looks like the current
situation is #ifdef mess _and_ duplication. This patch definitely
improves things.

The reason why the avr32 part is wrong is that I simply didn't notice
that I had to do anything in there until quite recently. So IMO making
this thing arch-specific will make it easier to get it right for new
architectures (since you'll get a nice and friendly link error
reminding you that you missed it.)

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


[U-Boot] [PATCH] bios_emulator: only build when CONFIG_BIOSEMU

2008-11-13 Thread Mike Frysinger
Convert the bios_emulator subdir over to COBJS-y style to avoid pointless
compilation for the majority of boards.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
---
 drivers/bios_emulator/Makefile  |6 +++---
 drivers/bios_emulator/atibios.c |4 
 drivers/bios_emulator/besys.c   |3 ---
 drivers/bios_emulator/bios.c|3 ---
 drivers/bios_emulator/biosemu.c |3 ---
 drivers/bios_emulator/x86emu/debug.c|4 
 drivers/bios_emulator/x86emu/decode.c   |4 
 drivers/bios_emulator/x86emu/ops.c  |4 
 drivers/bios_emulator/x86emu/ops2.c |4 
 drivers/bios_emulator/x86emu/prim_ops.c |4 
 drivers/bios_emulator/x86emu/sys.c  |4 
 11 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/drivers/bios_emulator/Makefile b/drivers/bios_emulator/Makefile
index 90c64da..dca9940 100644
--- a/drivers/bios_emulator/Makefile
+++ b/drivers/bios_emulator/Makefile
@@ -6,7 +6,7 @@ X86DIR  = x86emu
 
 $(shell mkdir -p $(obj)$(X86DIR))
 
-COBJS  = atibios.o biosemu.o besys.o bios.o \
+COBJS-$(CONFIG_BIOSEMU)= atibios.o biosemu.o besys.o bios.o \
$(X86DIR)/decode.o \
$(X86DIR)/ops2.o \
$(X86DIR)/ops.o \
@@ -14,8 +14,8 @@ COBJS = atibios.o biosemu.o besys.o bios.o \
$(X86DIR)/sys.o \
$(X86DIR)/debug.o
 
-SRCS   := $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
+SRCS   := $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
 
 EXTRA_CFLAGS += -I. -I./include -I$(TOPDIR)/include \
-D__PPC__  -D__BIG_ENDIAN__
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index 5779f99..b946d30 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -47,8 +47,6 @@
 /
 #include common.h
 
-#ifdef CONFIG_BIOSEMU
-
 #include biosemui.h
 #include malloc.h
 
@@ -336,5 +334,3 @@ int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo ** 
pVGAInfo, int cleanUp)
*pVGAInfo = VGAInfo;
return true;
 }
-
-#endif
diff --git a/drivers/bios_emulator/besys.c b/drivers/bios_emulator/besys.c
index cb1b0c1..bc03373 100644
--- a/drivers/bios_emulator/besys.c
+++ b/drivers/bios_emulator/besys.c
@@ -49,8 +49,6 @@
 
 #include common.h
 
-#if defined(CONFIG_BIOSEMU)
-
 #include biosemui.h
 
 /*- Global Variables --*/
@@ -721,4 +719,3 @@ void X86API BE_outl(X86EMU_pioAddr port, u32 val)
 #endif
LOG_outpd(port, val);
 }
-#endif
diff --git a/drivers/bios_emulator/bios.c b/drivers/bios_emulator/bios.c
index d41511c..a435cd9 100644
--- a/drivers/bios_emulator/bios.c
+++ b/drivers/bios_emulator/bios.c
@@ -43,8 +43,6 @@
 
 #include common.h
 
-#if defined(CONFIG_BIOSEMU)
-
 #include biosemui.h
 
 /*- Implementation */
@@ -323,4 +321,3 @@ void _BE_bios_init(u32 * intrTab)
bios_intr_tab[0x6D] = int10;
X86EMU_setupIntrFuncs(bios_intr_tab);
 }
-#endif
diff --git a/drivers/bios_emulator/biosemu.c b/drivers/bios_emulator/biosemu.c
index decdb79..2a0f25d 100644
--- a/drivers/bios_emulator/biosemu.c
+++ b/drivers/bios_emulator/biosemu.c
@@ -48,8 +48,6 @@
 #include malloc.h
 #include common.h
 
-#if defined(CONFIG_BIOSEMU)
-
 #include biosemui.h
 
 BE_sysEnv _BE_env = {{0}};
@@ -372,4 +370,3 @@ int X86API BE_int86x(int intno, RMREGS * in, RMREGS * out, 
RMSREGS * sregs)
sregs-gs = M.x86.R_GS;
return out-x.ax;
 }
-#endif
diff --git a/drivers/bios_emulator/x86emu/debug.c 
b/drivers/bios_emulator/x86emu/debug.c
index 29fe3f1..991ef85 100644
--- a/drivers/bios_emulator/x86emu/debug.c
+++ b/drivers/bios_emulator/x86emu/debug.c
@@ -40,8 +40,6 @@
 #include stdarg.h
 #include common.h
 
-#if defined(CONFIG_BIOSEMU)
-
 #include x86emu/x86emui.h
 
 /*- Implementation */
@@ -463,5 +461,3 @@ void x86emu_dump_xregs(void)
printk(NC );
printk(\n);
 }
-
-#endif
diff --git a/drivers/bios_emulator/x86emu/decode.c 
b/drivers/bios_emulator/x86emu/decode.c
index 7a9a1dd..969f22f 100644
--- a/drivers/bios_emulator/x86emu/decode.c
+++ b/drivers/bios_emulator/x86emu/decode.c
@@ -38,8 +38,6 @@
 /
 #include common.h
 
-#if defined(CONFIG_BIOSEMU)
-
 #include x86emu/x86emui.h
 
 /*- Implementation */
@@ -1145,5 +1143,3 @@ unsigned decode_rmXX_address(int mod, int rm)
 return decode_rm01_address(rm);
   return decode_rm10_address(rm);
 }
-
-#endif
diff --git a/drivers/bios_emulator/x86emu/ops.c 
b/drivers/bios_emulator/x86emu/ops.c
index 10f2757..deb950b 100644
--- a/drivers/bios_emulator/x86emu/ops.c
+++ b/drivers/bios_emulator/x86emu/ops.c
@@ -77,8 +77,6 @@
 
 #include common.h
 
-#if 

[U-Boot] [PATCH] bug fix for the delay function of ARM s3c44b0

2008-11-13 Thread Chaofu Chen
The original implementation of delay function of ARM s3c44b0 doesnt' cooperate 
with U-Boot kernel well, which will cause fake-time-out. What is important is 
to keep timestamp in unit of millisecond. 

diff -purN old/cpu/s3c44b0/interrupts.c new/cpu/s3c44b0/interrupts.c
--- old/cpu/s3c44b0/interrupts.c2005-12-17 00:39:27.0 +0800
+++ new/cpu/s3c44b0/interrupts.c2008-11-13 20:36:46.0 +0800
@@ -147,7 +147,7 @@ static ulong lastdec;
 int interrupt_init (void)
 {
TCFG0 = 0x00E9;
-   TCFG1 = 0x0004;
+   TCFG1 = 0x0040;
TCON = 0x0900;
TCNTB1 = TIMER_LOAD_VAL;
TCMPB1 = 0;
@@ -185,7 +185,7 @@ void udelay (unsigned long usec)
 
tmo = usec / 1000;
tmo *= CFG_HZ;
-   tmo /= 8;
+   tmo /= 1000;
 
tmo += get_timer (0);
 
@@ -213,7 +213,7 @@ ulong get_timer_masked (void)
}
lastdec = now;
 
-   return timestamp;
+   return (timestamp  3);
 }
 
 void udelay_masked (unsigned long usec)
@@ -225,10 +225,9 @@ void udelay_masked (unsigned long usec)
if (usec = 1000) {
tmo = usec / 1000;
tmo *= CFG_HZ;
-   tmo /= 8;
+   tmo /= 1000;
} else {
-   tmo = usec * CFG_HZ;
-   tmo /= (1000*8);
+   tmo = 1;
}
 
endtime = get_timer(0) + tmo;



  

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


[U-Boot] [PATCH] 85xx: Fix relocation of CCSRBAR

2008-11-13 Thread Kumar Gala
If the virtual address for CCSRBAR is the same after relocation but
the physical address is changing we'd end up having two TLB entries with
the same VA.  Instead we new us the new CCSRBAR virt address + 4k as a
temp virt address to access the old CCSRBAR to relocate it.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
---
 cpu/mpc85xx/cpu_init.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c
index 3a8aef2..1cb9ed9 100644
--- a/cpu/mpc85xx/cpu_init.c
+++ b/cpu/mpc85xx/cpu_init.c
@@ -140,14 +140,15 @@ void cpu_init_early_f(void)
 #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS)
{
u32 temp;
+   volatile u32 *ccsr_virt =
+   (volatile u32 *)(CONFIG_SYS_CCSRBAR + 0x1000);
 
-   set_tlb(0, CONFIG_SYS_CCSRBAR_DEFAULT, 
CONFIG_SYS_CCSRBAR_DEFAULT,
+   set_tlb(0, (u32)ccsr_virt, CONFIG_SYS_CCSRBAR_DEFAULT,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
1, 1, BOOKE_PAGESZ_4K, 0);
 
-   temp = in_be32((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT);
-   out_be32((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT, 
CONFIG_SYS_CCSRBAR_PHYS  12);
-
+   temp = in_be32(ccsr_virt);
+   out_be32(ccsr_virt, CONFIG_SYS_CCSRBAR_PHYS  12);
temp = in_be32((volatile u32 *)CONFIG_SYS_CCSRBAR);
}
 #endif
-- 
1.5.6.5

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


Re: [U-Boot] [PATCH] bios_emulator: only build when CONFIG_BIOSEMU

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 04:03 Thu 13 Nov , Mike Frysinger wrote:
 Convert the bios_emulator subdir over to COBJS-y style to avoid pointless
 compilation for the majority of boards.
 
 Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
 ---
  drivers/bios_emulator/Makefile  |6 +++---
  drivers/bios_emulator/atibios.c |4 
  drivers/bios_emulator/besys.c   |3 ---
  drivers/bios_emulator/bios.c|3 ---
  drivers/bios_emulator/biosemu.c |3 ---
  drivers/bios_emulator/x86emu/debug.c|4 
  drivers/bios_emulator/x86emu/decode.c   |4 
  drivers/bios_emulator/x86emu/ops.c  |4 
  drivers/bios_emulator/x86emu/ops2.c |4 
  drivers/bios_emulator/x86emu/prim_ops.c |4 
  drivers/bios_emulator/x86emu/sys.c  |4 
  11 files changed, 3 insertions(+), 40 deletions(-)

I've send a patch for this before

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


[U-Boot] [PATCH 3/6] AVR32: Use SRAM as main memory on the atevk1100 board

2008-11-13 Thread Gunnar Rangoy
This patch makes u-boot use SRAM instead of SDRAM as main memory.
This is done due to a bug in the current revsions of the
at32uc3a0xxx series microcontrollers, which makes it unreliable to
run code from SDRAM.

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 board/atmel/atevk1100/atevk1100.c |   65 
 include/configs/atevk1100.h   |   12 ---
 2 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/board/atmel/atevk1100/atevk1100.c 
b/board/atmel/atevk1100/atevk1100.c
index 105e5c9..a85337e 100644
--- a/board/atmel/atevk1100/atevk1100.c
+++ b/board/atmel/atevk1100/atevk1100.c
@@ -22,30 +22,51 @@
 #include common.h
 
 #include asm/io.h
-#include asm/sdram.h
+#include asm/sram.h
 #include asm/arch/clk.h
 #include asm/arch/hmatrix.h
 #include asm/arch/portmux.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct sdram_config sdram_config = {
-   /* MT48LC16M16A2-7E (32 MB) */
-   .data_bits  = SDRAM_DATA_16BIT,
-   .row_bits   = 13,
-   .col_bits   = 9,
-   .bank_bits  = 2,
-   .cas= 2,
-   .twr= 2,
-   .trc= 7,
-   .trp= 2,
-   .trcd   = 2,
-   .tras   = 4,
-   .txsr   = 7,
-   /* 7.81 us */
-   .refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 10,
-};
+static const struct sram_config sram_config = {
+   /* 2x16MBit, CY7C1069AV33-10ZXC */
+   .data_bits  = 16,
+   .address_bits   = 21,
+   .ncs_rd_setup   = 0,
+   .ncs_wr_setup   = 0,
+   .nwe_setup  = 0,
+   .nrd_setup  = 0,
+   /*
+* These settings works when running at 33Mhz,
+* but fails at 54MHz
+*/
+
+   /*
+   .ncs_wr_pulse   = 1,
+   .ncs_rd_pulse   = 1,
+   .nwe_pulse  = 1,
+   .nrd_pulse  = 1,
+   .nwe_cycle  = 2,
+   .nrd_cycle  = 2,
+   */
+   .ncs_wr_pulse   = 2,
+   .ncs_rd_pulse   = 2,
+   .nwe_pulse  = 2,
+   .nrd_pulse  = 2,
+   .nwe_cycle  = 3,
+   .nrd_cycle  = 3,
+   .chip_select= 2,
+   .read_mode  = 1,
+   .write_mode = 1,
+   .exnw_mode  = 0,
+   .bat= 1,
+   .tdf_cycles = 0,
+   .tdf_mode   = 0,
+   .pmen   = 0,
+   .ps = 1,
 
+};
 int board_early_init_f(void)
 {
/* Enable SDRAM in the EBI mux according to AP7000 datasheet */
@@ -65,14 +86,14 @@ phys_size_t initdram(int board_type)
 {
unsigned long expected_size;
unsigned long actual_size;
-   void *sdram_base;
+   void *sram_base;
 
-   sdram_base = map_physmem(EBI_SDRAM_BASE, EBI_SDRAM_SIZE, MAP_NOCACHE);
+   sram_base = map_physmem(EBI_SRAM_CS2_BASE, EBI_SRAM_CS2_SIZE, 
MAP_NOCACHE);
 
-   expected_size = sdram_init(sdram_base, sdram_config);
-   actual_size = get_ram_size(sdram_base, expected_size);
+   expected_size = sram_init(sram_config);
+   actual_size = get_ram_size(sram_base, expected_size);
 
-   unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
+   unmap_physmem(sram_base, EBI_SRAM_CS2_SIZE);
 
if (expected_size != actual_size)
printf(Warning: Only %lu of %lu MiB SDRAM is working\n,
diff --git a/include/configs/atevk1100.h b/include/configs/atevk1100.h
index db5af37..166027a 100644
--- a/include/configs/atevk1100.h
+++ b/include/configs/atevk1100.h
@@ -148,7 +148,8 @@
 #define CONFIG_ATMEL_SPI   1
 #define CONFIG_PORTMUX_GPIO1
 #define CFG_NR_PIOS5
-#define CFG_SDRAMC 1
+#define CFG_SDRAMC 0
+#define CFG_SMC1
 
 #define CFG_DCACHE_LINESZ  32
 #define CFG_ICACHE_LINESZ  32
@@ -165,7 +166,8 @@
 
 #define CFG_INTRAM_BASEINTERNAL_SRAM_BASE
 #define CFG_INTRAM_SIZEINTERNAL_SRAM_SIZE
-#define CFG_SDRAM_BASE EBI_SDRAM_BASE
+/* Not really SDRAM, maybe change to SRAM? */
+#define CFG_SDRAM_BASE EBI_SRAM_CS2_BASE
 
 #define CONFIG_ENV_IS_IN_FLASH 1
 #define CONFIG_ENV_SIZE65536
@@ -176,8 +178,8 @@
 #define CFG_MALLOC_LEN (256*1024)
 #define CFG_DMA_ALLOC_LEN  (16384)
 
-/* Allow 4MB for the kernel run-time image */
-#define CFG_LOAD_ADDR  (EBI_SDRAM_BASE + 0x0040)
+/* Allow 3MB(TODO:update) for the kernel run-time image */
+#define CFG_LOAD_ADDR  (CFG_SDRAM_BASE + 0x0027)
 #define CFG_BOOTPARAMS_LEN (16 * 1024)
 
 /* Other configuration settings that shouldn't have to change all that often */
@@ -187,7 +189,7 @@
 #define CFG_PBSIZE (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
 #define CFG_LONGHELP   1
 

[U-Boot] [PATCH 6/6] AVR32: Set boot parameters for atevk1100

2008-11-13 Thread Gunnar Rangoy
This patch sets resonable boot parameters for the atevk1100.
(Load kernel via tftp/dhcp and use nfs rootfs.)

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 include/configs/atevk1100.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/atevk1100.h b/include/configs/atevk1100.h
index 776a3a1..2a9d91b 100644
--- a/include/configs/atevk1100.h
+++ b/include/configs/atevk1100.h
@@ -95,17 +95,17 @@
 
 #define CONFIG_BAUDRATE9600
 #define CONFIG_BOOTARGS
\
-   console=ttyS0 root=/dev/mmcblk0p1 fbmem=600k rootwait=1
+   console=ttyS0 ip=dhcp root=/dev/nfs rootwait=1
 
 #define CONFIG_BOOTCOMMAND \
-   fsload; bootm $(fileaddr)
+   dhcp; bootm $(fileaddr)
 
 /*
  * Only interrupt autoboot if space is pressed. Otherwise, garbage
  * data on the serial line may interrupt the boot sequence.
  */
-#define CONFIG_BOOTDELAY   -1
-#define CONFIG_AUTOBOOT0
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_AUTOBOOT1
 #define CONFIG_AUTOBOOT_KEYED  1
 #define CONFIG_AUTOBOOT_PROMPT \
Press SPACE to abort autoboot in %d seconds\n, bootdelay
-- 
1.5.6.3

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


[U-Boot] [PATCH 1/6] AVR32: Make GPIO implmentation cpu dependent

2008-11-13 Thread Gunnar Rangoy
There are some differences in the implementation of GPIO in the
at32uc chip compared to the ap700x series.

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 cpu/at32uc/portmux-gpio.c   |   30 
 include/asm-avr32/arch-at32ap700x/gpio-impl.h   |   86 +++
 include/asm-avr32/arch-at32uc3a0xxx/gpio-impl.h |   62 
 include/asm-avr32/arch-common/portmux-gpio.h|   83 +-
 4 files changed, 150 insertions(+), 111 deletions(-)
 create mode 100644 include/asm-avr32/arch-at32ap700x/gpio-impl.h
 create mode 100644 include/asm-avr32/arch-at32uc3a0xxx/gpio-impl.h

diff --git a/cpu/at32uc/portmux-gpio.c b/cpu/at32uc/portmux-gpio.c
index 8ed5659..0b8bae9 100644
--- a/cpu/at32uc/portmux-gpio.c
+++ b/cpu/at32uc/portmux-gpio.c
@@ -29,26 +29,11 @@
 void portmux_select_peripheral(void *port, unsigned long pin_mask,
enum portmux_function func, unsigned long flags)
 {
-   /* Both pull-up and pull-down set means buskeeper */
-   if (flags  PORTMUX_PULL_DOWN)
-   gpio_writel(port, PDERS, pin_mask);
-   else
-   gpio_writel(port, PDERC, pin_mask);
if (flags  PORTMUX_PULL_UP)
gpio_writel(port, PUERS, pin_mask);
else
gpio_writel(port, PUERC, pin_mask);
 
-   /* Select drive strength */
-   if (flags  PORTMUX_DRIVE_LOW)
-   gpio_writel(port, ODCR0S, pin_mask);
-   else
-   gpio_writel(port, ODCR0C, pin_mask);
-   if (flags  PORTMUX_DRIVE_HIGH)
-   gpio_writel(port, ODCR1S, pin_mask);
-   else
-   gpio_writel(port, ODCR1C, pin_mask);
-
/* Select function */
if (func  PORTMUX_FUNC_B)
gpio_writel(port, PMR0S, pin_mask);
@@ -66,11 +51,6 @@ void portmux_select_peripheral(void *port, unsigned long 
pin_mask,
 void portmux_select_gpio(void *port, unsigned long pin_mask,
unsigned long flags)
 {
-   /* Both pull-up and pull-down set means buskeeper */
-   if (flags  PORTMUX_PULL_DOWN)
-   gpio_writel(port, PDERS, pin_mask);
-   else
-   gpio_writel(port, PDERC, pin_mask);
if (flags  PORTMUX_PULL_UP)
gpio_writel(port, PUERS, pin_mask);
else
@@ -82,16 +62,6 @@ void portmux_select_gpio(void *port, unsigned long pin_mask,
else
gpio_writel(port, ODMERC, pin_mask);
 
-   /* Select drive strength */
-   if (flags  PORTMUX_DRIVE_LOW)
-   gpio_writel(port, ODCR0S, pin_mask);
-   else
-   gpio_writel(port, ODCR0C, pin_mask);
-   if (flags  PORTMUX_DRIVE_HIGH)
-   gpio_writel(port, ODCR1S, pin_mask);
-   else
-   gpio_writel(port, ODCR1C, pin_mask);
-
/* Select direction and initial pin state */
if (flags  PORTMUX_DIR_OUTPUT) {
if (flags  PORTMUX_INIT_HIGH)
diff --git a/include/asm-avr32/arch-at32ap700x/gpio-impl.h 
b/include/asm-avr32/arch-at32ap700x/gpio-impl.h
new file mode 100644
index 000..8801bd0
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap700x/gpio-impl.h
@@ -0,0 +1,86 @@
+#ifndef __ASM_AVR32_ARCH_GPIO_IMPL_H__
+#define __ASM_AVR32_ARCH_GPIO_IMPL_H__
+
+/* Register offsets */
+struct gpio_regs {
+   u32 GPER;
+   u32 GPERS;
+   u32 GPERC;
+   u32 GPERT;
+   u32 PMR0;
+   u32 PMR0S;
+   u32 PMR0C;
+   u32 PMR0T;
+   u32 PMR1;
+   u32 PMR1S;
+   u32 PMR1C;
+   u32 PMR1T;
+   u32 __reserved0[4];
+   u32 ODER;
+   u32 ODERS;
+   u32 ODERC;
+   u32 ODERT;
+   u32 OVR;
+   u32 OVRS;
+   u32 OVRC;
+   u32 OVRT;
+   u32 PVR;
+   u32 __reserved_PVRS;
+   u32 __reserved_PVRC;
+   u32 __reserved_PVRT;
+   u32 PUER;
+   u32 PUERS;
+   u32 PUERC;
+   u32 PUERT;
+   u32 PDER;
+   u32 PDERS;
+   u32 PDERC;
+   u32 PDERT;
+   u32 IER;
+   u32 IERS;
+   u32 IERC;
+   u32 IERT;
+   u32 IMR0;
+   u32 IMR0S;
+   u32 IMR0C;
+   u32 IMR0T;
+   u32 IMR1;
+   u32 IMR1S;
+   u32 IMR1C;
+   u32 IMR1T;
+   u32 GFER;
+   u32 GFERS;
+   u32 GFERC;
+   u32 GFERT;
+   u32 IFR;
+   u32 __reserved_IFRS;
+   u32 IFRC;
+   u32 __reserved_IFRT;
+   u32 ODMER;
+   u32 ODMERS;
+   u32 ODMERC;
+   u32 ODMERT;
+   u32 __reserved1[4];
+   u32 ODCR0;
+   u32 ODCR0S;
+   u32 ODCR0C;
+   u32 ODCR0T;
+   u32 ODCR1;
+   u32 ODCR1S;
+   u32 ODCR1C;
+   u32 ODCR1T;
+   u32 

[U-Boot] [PATCH 5/6] AVR32: Support for writing to internal flash on at32uc3

2008-11-13 Thread Gunnar Rangoy
This patch enables writing (the environment) to the internal flash in
the microcontroller.

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 cpu/at32uc/flashc.c |   69 +--
 cpu/at32uc/flashc.h |   17 ++
 include/configs/atevk1100.h |2 +-
 3 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/cpu/at32uc/flashc.c b/cpu/at32uc/flashc.c
index f33a4bb..e626e1f 100644
--- a/cpu/at32uc/flashc.c
+++ b/cpu/at32uc/flashc.c
@@ -45,6 +45,7 @@ unsigned long flash_init(void)
 {
unsigned long fsz;
unsigned long size;
+   unsigned int i;
 
fsz = FLASHC_BFEXT(FSZ, flashc_readl(FSR));
 
@@ -55,6 +56,10 @@ unsigned long flash_init(void)
/* Currently, all interflash have pages which are 128 words. */
flash_info[0].sector_count = size / (128*4);
 
+   for(i=0; iflash_info[0].sector_count; i++){
+   flash_info[0].start[i] = i*128*4 + CFG_FLASH_BASE;
+   }
+
return size;
 }
 
@@ -62,19 +67,77 @@ void flash_print_info(flash_info_t *info)
 {
printf(Flash: Vendor ID: 0x%02lx, Product ID: 0x%02lx\n,
   info-flash_id  16, info-flash_id  0x);
-   printf(Size: %ld MB in %d sectors\n,
+   printf(Size: %ld kB in %d sectors\n,
   info-size  10, info-sector_count);
 }
 
+static void flash_wait_ready(void)
+{
+   while(! flashc_readl(FSR)  FLASHC_BIT(FRDY) );
+}
+
 int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
-   /* TODO */
+   int page;
+
+   for(page=s_first;pages_last; page++){
+   flash_wait_ready();
+   flashc_writel(
+   FCMD,FLASHC_BF(CMD, FLASHC_EP)
+   |FLASHC_BF(PAGEN, page)
+   |FLASHC_BF(KEY, 0xa5));
+   }
return ERR_OK;
 }
 
+static void write_flash_page(unsigned int pagen, const u32 *data)
+{
+   unsigned int i;
+   u32 *dst;
+
+   dst = (u32 *) CFG_FLASH_BASE;
+
+   /* clear page buffer */
+   flash_wait_ready();
+   flashc_writel(FCMD,
+   FLASHC_BF(CMD, FLASHC_CPB) |
+   FLASHC_BF(KEY, 0xa5));
+
+   /* fill page buffer*/
+   flash_wait_ready();
+   for(i=0; i128; i++){
+   dst[i]=data[i];
+   }
+
+   /* issue write command */
+   flashc_writel(FCMD,
+   FLASHC_BF(CMD, FLASHC_WP)|
+   FLASHC_BF(PAGEN, pagen)|
+   FLASHC_BF(KEY, 0xa5));
+}
+
 int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong count)
 {
-   /* TODO */
+   unsigned int i;
+
+   if (addr % (4*128)) {
+   printf(flash: write_buff(): ERROR, addr(0x%08lx) not 
+   on page boundary, addr);
+   return ERR_ALIGN;
+   }
+   if (count % (4*128)) {
+   printf(flash: write_buff(): ERROR, count(0x%lu) not 
+   a multiple of pagesize, count);
+   return ERR_ALIGN;
+   }
+
+   for (i = 0; i  count; i += 128*4) {
+   unsigned int pagen;
+   pagen = (addr-CFG_FLASH_BASE+i) / (128*4);
+   write_flash_page(pagen, (u32*) (src+i));
+   }
+
+
return ERR_OK;
 }
 
diff --git a/cpu/at32uc/flashc.h b/cpu/at32uc/flashc.h
index 23618bc..3e97781 100644
--- a/cpu/at32uc/flashc.h
+++ b/cpu/at32uc/flashc.h
@@ -43,6 +43,23 @@
 #define FLASHC_LOCK_OFFSET 16
 #define FLASHC_LOCK_SIZE   16
 
+#define FLASHC_NOP 0 /*No operation*/
+#define FLASHC_WP  1 /*Write Page*/
+#define FLASHC_EP  2 /*Erase Page*/
+#define FLASHC_CPB 3 /*Clear Page Buffer*/
+#define FLASHC_LP  4 /*Lock region containing given Page*/
+#define FLASHC_UP  5 /*Unlock region containing given Page*/
+#define FLASHC_EA  6 /*Erase All*/
+#define FLASHC_WGPB7 /*Write General-Purpose Fuse Bit*/
+#define FLASHC_EGPB8 /*Erase General-Purpose Fuse Bit*/
+#define FLASHC_SSB 9 /*Set Security Bit*/
+#define FLASHC_PGPFB   10 /*Program GP Fuse Byte*/
+#define FLASHC_EAGPF   11 /*Erase All GPFuses*/
+#define FLASHC_QPR 12 /*Quick Page Read*/
+#define FLASHC_WUP 13 /*Write User Page*/
+#define FLASHC_EUP 14 /*Erase User Page*/
+#define FLASHC_QPRUP   15 /*Quick Page Read User Page*/
+
 
 /* Bit manipulation macros */
 #define FLASHC_BIT(name)   \
diff --git a/include/configs/atevk1100.h b/include/configs/atevk1100.h
index 166027a..776a3a1 100644
--- a/include/configs/atevk1100.h
+++ b/include/configs/atevk1100.h
@@ -160,7 +160,7 @@
 #define CFG_FLASH_BASE 0x8000
 #define CFG_FLASH_SIZE 0x8
 #define CFG_MAX_FLASH_BANKS1
-#define CFG_MAX_FLASH_SECT 135
+#define CFG_MAX_FLASH_SECT 1024
 
 #define CFG_MONITOR_BASE   

[U-Boot] [PATCH 2/6] AVR32: Support for external SRAM on at32uc3

2008-11-13 Thread Gunnar Rangoy
This patch adds support for external SRAM connected to the EBI bus
on the at32uc3a0xxx.

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 cpu/at32uc/Makefile  |1 +
 cpu/at32uc/smc.c |   61 ++
 cpu/at32uc/smc.h |  105 ++
 include/asm-avr32/sram.h |   34 +++
 4 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 cpu/at32uc/smc.c
 create mode 100644 cpu/at32uc/smc.h
 create mode 100644 include/asm-avr32/sram.h

diff --git a/cpu/at32uc/Makefile b/cpu/at32uc/Makefile
index cab9bdc..6714d14 100644
--- a/cpu/at32uc/Makefile
+++ b/cpu/at32uc/Makefile
@@ -36,6 +36,7 @@ COBJS-y   += cache.o
 COBJS-y+= interrupts.o
 COBJS-$(CONFIG_PORTMUX_GPIO) += portmux-gpio.o
 COBJS-y+= flashc.o
+COBJS-y+= smc.o
 
 SRCS   := $(START-y:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/cpu/at32uc/smc.c b/cpu/at32uc/smc.c
new file mode 100644
index 000..f4bb9fb
--- /dev/null
+++ b/cpu/at32uc/smc.c
@@ -0,0 +1,61 @@
+#include common.h
+#include asm/sram.h
+#include smc.h
+
+unsigned long sram_init(const struct sram_config *config)
+{
+   u32 cfgreg;
+   u32 dbw;
+   u32 sram_size;
+
+   cfgreg = SMC_BF(NWE_SETUP, config-nwe_setup)
+   |SMC_BF(NRD_SETUP, config-nrd_setup)
+   |SMC_BF(NCS_WR_SETUP, config-ncs_wr_setup)
+   |SMC_BF(NCS_RD_SETUP, config-ncs_rd_setup);
+   smc_writel(config-chip_select, SETUP, cfgreg);
+
+   cfgreg = SMC_BF(NWE_PULSE, config-nwe_pulse)
+   |SMC_BF(NRD_PULSE, config-nrd_pulse)
+   |SMC_BF(NCS_WR_PULSE, config-ncs_wr_pulse)
+   |SMC_BF(NCS_RD_PULSE, config-ncs_rd_pulse);
+   smc_writel(config-chip_select, PULSE, cfgreg);
+
+   cfgreg = SMC_BF(NWE_CYCLE, config-nwe_cycle)
+   |SMC_BF(NRD_CYCLE, config-nrd_cycle);
+   smc_writel(config-chip_select, CYCLE, cfgreg);
+
+   switch (config-data_bits) {
+   case 8:
+   dbw=0;
+   break;
+   case 16:
+   dbw=1;
+   break;
+   case 32:
+   dbw=2;
+   break;
+   default:
+   panic(Invalid number of databits for SRAM);
+
+   }
+   cfgreg = SMC_BF(READ_MODE, config-read_mode)
+   |SMC_BF(WRITE_MODE, config-write_mode)
+   |SMC_BF(EXNW_MODE, config-exnw_mode)
+   |SMC_BF(BAT, config-bat)
+   |SMC_BF(DBW, dbw)
+   |SMC_BF(TDF_CYCLES, config-tdf_cycles)
+   |SMC_BF(TDF_MODE, config-tdf_mode)
+   |SMC_BF(PMEN, config-pmen)
+   |SMC_BF(PS, config-ps);
+
+
+
+
+   smc_writel(config-chip_select, MODE, cfgreg);
+   sram_size= (1config-address_bits) * (config-data_bits/8);
+
+
+   return sram_size;
+}
+
+
diff --git a/cpu/at32uc/smc.h b/cpu/at32uc/smc.h
new file mode 100644
index 000..ea4d399
--- /dev/null
+++ b/cpu/at32uc/smc.h
@@ -0,0 +1,105 @@
+/*
+ * Register definitions for Static Memory Controller
+ */
+#ifndef __CPU_AT32UC3_SMC_H__
+#define __CPU_AT32UC3_SMC_H__
+
+#include asm/arch/memory-map.h
+#include asm/io.h
+
+/* SMC register offsets */
+#define SMC_SETUP(x)   0x+(x)*0x10
+#define SMC_PULSE(x)   0x0004+(x)*0x10
+#define SMC_CYCLE(x)   0x0008+(x)*0x10
+#define SMC_MODE(x)0x000c+(x)*0x10
+
+/* Bitfields in SETUP0..3 */
+#define SMC_NWE_SETUP_OFFSET   0
+#define SMC_NWE_SETUP_SIZE 6
+#define SMC_NCS_WR_SETUP_OFFSET8
+#define SMC_NCS_WR_SETUP_SIZE  6
+#define SMC_NRD_SETUP_OFFSET   16
+#define SMC_NRD_SETUP_SIZE 6
+#define SMC_NCS_RD_SETUP_OFFSET24
+#define SMC_NCS_RD_SETUP_SIZE  6
+
+/* Bitfields in PULSE0..3 */
+#define SMC_NWE_PULSE_OFFSET   0
+#define SMC_NWE_PULSE_SIZE 7
+#define SMC_NCS_WR_PULSE_OFFSET8
+#define SMC_NCS_WR_PULSE_SIZE  7
+#define SMC_NRD_PULSE_OFFSET   16
+#define SMC_NRD_PULSE_SIZE 7
+#define SMC_NCS_RD_PULSE_OFFSET24
+#define SMC_NCS_RD_PULSE_SIZE  7
+
+/* Bitfields in CYCLE0..3 */
+#define SMC_NWE_CYCLE_OFFSET   0
+#define SMC_NWE_CYCLE_SIZE 9
+#define SMC_NRD_CYCLE_OFFSET   16
+#define SMC_NRD_CYCLE_SIZE 9
+
+/* Bitfields in MODE0..3 */
+#define SMC_READ_MODE_OFFSET   0
+#define SMC_READ_MODE_SIZE 1
+#define SMC_WRITE_MODE_OFFSET 

[U-Boot] [PATCH 0/6] Updates for atevk1100 support

2008-11-13 Thread Gunnar Rangoy
These patches makes it possible to load code into external SRAM on
the atevk1100. 

Also included is a patch to use the internal flash. Before this can be
done, U-Boot must be relocated to SRAM.

The GPIO implementation is made cpu dependent due to differences between
at32uc and ap700x.


Gunnar Rangoy (6):
  AVR32: Make GPIO implmentation cpu dependent
  AVR32: Support for external SRAM on at32uc3
  AVR32: Use SRAM as main memory on the atevk1100 board
  AVR32: Enable relocation of code for at32uc3
  AVR32: Support for writing to internal flash on at32uc3
  AVR32: Set boot parameters for atevk1100

 board/atmel/atevk1100/atevk1100.c   |   65 +-
 board/atmel/atevk1100/u-boot.lds|2 -
 cpu/at32uc/Makefile |1 +
 cpu/at32uc/flashc.c |   69 ++-
 cpu/at32uc/flashc.h |   17 
 cpu/at32uc/portmux-gpio.c   |   30 ---
 cpu/at32uc/smc.c|   61 +
 cpu/at32uc/smc.h|  105 +++
 cpu/at32uc/start.S  |   15 +---
 include/asm-avr32/arch-at32ap700x/gpio-impl.h   |   86 ++
 include/asm-avr32/arch-at32uc3a0xxx/gpio-impl.h |   62 +
 include/asm-avr32/arch-common/portmux-gpio.h|   83 +-
 include/asm-avr32/sram.h|   34 +++
 include/configs/atevk1100.h |   22 +++--
 lib_avr32/board.c   |5 -
 15 files changed, 490 insertions(+), 167 deletions(-)
 create mode 100644 cpu/at32uc/smc.c
 create mode 100644 cpu/at32uc/smc.h
 create mode 100644 include/asm-avr32/arch-at32ap700x/gpio-impl.h
 create mode 100644 include/asm-avr32/arch-at32uc3a0xxx/gpio-impl.h
 create mode 100644 include/asm-avr32/sram.h

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


[U-Boot] [PATCH 4/6] AVR32: Enable relocation of code for at32uc3

2008-11-13 Thread Gunnar Rangoy
Since we now have working SRAM, we can relocate the code to SRAM.

Signed-off-by: Gunnar Rangoy [EMAIL PROTECTED]
Signed-off-by: Paul Driveklepp [EMAIL PROTECTED]
Signed-off-by: Olav Morken [EMAIL PROTECTED]
---
 board/atmel/atevk1100/u-boot.lds |2 --
 cpu/at32uc/start.S   |   15 +--
 lib_avr32/board.c|5 -
 3 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/board/atmel/atevk1100/u-boot.lds b/board/atmel/atevk1100/u-boot.lds
index 3c20979..1c09641 100644
--- a/board/atmel/atevk1100/u-boot.lds
+++ b/board/atmel/atevk1100/u-boot.lds
@@ -40,8 +40,6 @@ SECTIONS
*(.rodata.*)
}
 
-   _end_noreloc = .;
-
. = ALIGN(8);
_data = .;
.data : {
diff --git a/cpu/at32uc/start.S b/cpu/at32uc/start.S
index e1d44cb..a8798af 100644
--- a/cpu/at32uc/start.S
+++ b/cpu/at32uc/start.S
@@ -216,44 +216,31 @@ relocate_code:
brgt1b
 
/* jump to RAM */
-   /* we don't want to run from sdram.
sub r0, pc, . - in_ram
add pc, r0, lr
-   */
 
.align  2
 in_ram:
/* find the new GOT and relocate it */
lddpc   r6, got_init_reloc
 3: rsubr6, pc
-   add r6, lr
mov r8, r6
lda.w   r9, _egot
lda.w   r10, _got
sub r9, r10
 
-   lda.w   r1, _end_noreloc
-
 1: ld.wr0, r8[0]
-   /* Check if the symbol points to the text-section, and
-* skip relocation if they do.
-*/
-   cp.wr0, r1
-   brlt2f
-
add r0, lr
st.wr8, r0
-2:
+
sub r8, -4
sub r9, 4
brgt1b
 
/* Move the exception handlers */
-   /* We don't want to run from sdram.
mfsrr2, SYSREG_EVBA
add r2, lr
mtsrSYSREG_EVBA, r2
-   */
 
/* Do the rest of the initialization sequence */
callboard_init_r
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 6afa8bd..216ff74 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -294,13 +294,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 cmdtp !=  __u_boot_cmd_end; cmdtp++) {
unsigned long addr;
 
-   /* We don't relocate code in the at32uc3a0xxx cpu yet due to
-* SDRAM bug. See errata 41.4.6.1.
-*/
-#ifndef CONFIG_AT32UC
addr = (unsigned long)cmdtp-cmd + gd-reloc_off;
cmdtp-cmd = (typeof(cmdtp-cmd))addr;
-#endif
 
addr = (unsigned long)cmdtp-name + gd-reloc_off;
cmdtp-name = (typeof(cmdtp-name))addr;
-- 
1.5.6.3

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


Re: [U-Boot] [PATCH] 85xx: Fix relocation of CCSRBAR

2008-11-13 Thread Peter Tyser
On Thu, 2008-11-13 at 06:30 -0600, Kumar Gala wrote:
 If the virtual address for CCSRBAR is the same after relocation but
 the physical address is changing we'd end up having two TLB entries with
 the same VA.  Instead we new us the new CCSRBAR virt address + 4k as a
 temp virt address to access the old CCSRBAR to relocate it.

s/we new us the/we now use the/

 Signed-off-by: Kumar Gala [EMAIL PROTECTED]
 ---
  cpu/mpc85xx/cpu_init.c |9 +
  1 files changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c
 index 3a8aef2..1cb9ed9 100644
 --- a/cpu/mpc85xx/cpu_init.c
 +++ b/cpu/mpc85xx/cpu_init.c
 @@ -140,14 +140,15 @@ void cpu_init_early_f(void)
  #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS)
   {
   u32 temp;
 + volatile u32 *ccsr_virt =
 + (volatile u32 *)(CONFIG_SYS_CCSRBAR + 0x1000);

Is there any reason to use volatiles when you access the address using
the proper io functions?

Best,
Peter

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


Re: [U-Boot] [PATCH] bug fix for the delay function of ARM s3c44b0

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 05:11 Thu 13 Nov , Chaofu Chen wrote:
 The original implementation of delay function of ARM s3c44b0 doesnt' 
 cooperate with U-Boot kernel well, which will cause fake-time-out. What is 
 important is to keep timestamp in unit of millisecond. 
 
SOB please

 diff -purN old/cpu/s3c44b0/interrupts.c new/cpu/s3c44b0/interrupts.c
 --- old/cpu/s3c44b0/interrupts.c  2005-12-17 00:39:27.0 +0800
 +++ new/cpu/s3c44b0/interrupts.c  2008-11-13 20:36:46.0 +0800
 @@ -147,7 +147,7 @@ static ulong lastdec;
  int interrupt_init (void)
  {
   TCFG0 = 0x00E9;
 - TCFG1 = 0x0004;
 + TCFG1 = 0x0040;
   TCON = 0x0900;
   TCNTB1 = TIMER_LOAD_VAL;
   TCMPB1 = 0;
 @@ -185,7 +185,7 @@ void udelay (unsigned long usec)
  
   tmo = usec / 1000;
   tmo *= CFG_HZ;
now it's CFG_HZ

please rebase you code against the current tree

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


Re: [U-Boot] [PATCH] 85xx: Fix relocation of CCSRBAR

2008-11-13 Thread Kumar Gala

On Nov 13, 2008, at 9:30 AM, Peter Tyser wrote:

 On Thu, 2008-11-13 at 06:30 -0600, Kumar Gala wrote:
 If the virtual address for CCSRBAR is the same after relocation but
 the physical address is changing we'd end up having two TLB entries  
 with
 the same VA.  Instead we new us the new CCSRBAR virt address + 4k  
 as a
 temp virt address to access the old CCSRBAR to relocate it.

 s/we new us the/we now use the/

I'll let andy fix that when we applies the patch.

 Signed-off-by: Kumar Gala [EMAIL PROTECTED]
 ---
 cpu/mpc85xx/cpu_init.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

 diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c
 index 3a8aef2..1cb9ed9 100644
 --- a/cpu/mpc85xx/cpu_init.c
 +++ b/cpu/mpc85xx/cpu_init.c
 @@ -140,14 +140,15 @@ void cpu_init_early_f(void)
 #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS)
  {
  u32 temp;
 +volatile u32 *ccsr_virt =
 +(volatile u32 *)(CONFIG_SYS_CCSRBAR + 0x1000);

 Is there any reason to use volatiles when you access the address using
 the proper io functions?

That's how the functions are defined:

extern inline unsigned in_be32(const volatile unsigned __iomem *addr)

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


Re: [U-Boot] [patch V2] U-Boot Firetux board support

2008-11-13 Thread Jürgen Schöw
Hi Jean-Christophe PLAGNIOL-VILLARD,

sorry to answer late. I've been on the CELF Conference last week and
being busy this week delays so much.

Am Thu, 6 Nov 2008 21:53:29 +0100
schrieb Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED]:

 On 12:48 Wed 05 Nov , Juergen Schoew wrote:
  Hi U-Boot mailling list,

 First some general comments
 
 As you anwser it's a NXP board so please create a vendor directory

OK, I use DSPG.

 please use tab instead of space for code alignement and indentation
 please a blank line when you write block of code and comment to make
 it more readable
 please and whitespace before and after   co

OK, I try to find every position.
 
 in the code their is a lot of hard code value please use Macro or
 specify why you can not do it

Will try to find suitable places.

 please only one blank line consecutive

OK.

  diff --git a/board/firetux/Makefile b/board/firetux/Makefile
  new file mode 100644
  index 000..bf1afec
  --- /dev/null
  +++ b/board/firetux/Makefile
  +include $(TOPDIR)/config.mk
  +
  +LIB= $(obj)lib$(BOARD).a
  +
  +COBJS-y+= firetux.o ethernet.o
 as ask by Ben and I move this to drivers/net

OK, I read it more as you may and not you have to. Sorry for the
misinterpretation. I try to find some spare time to do this jobs.
Hopefully this can work on the next weekend.

  diff --git a/board/firetux/ethernet.c b/board/firetux/ethernet.c
  new file mode 100644
  index 000..a4c1bc2
  --- /dev/null
  +++ b/board/firetux/ethernet.c
  +
  +extern unsigned int boardrevision;
  +
  +int firetux_miiphy_initialize(bd_t *bis);
  +int mii_discover_phy(void);
  +int mii_negotiate_phy(void);
  +
  +#define ALIGN8 static __attribute__ ((aligned(8)))
  +#define ALIGN4 static __attribute__ ((aligned(4)))
 IMHO this make more sense
 #define align8 __attribute__ ((aligned(8))

OK, changed.

  +   }
  +   if (act) {
  +   etn_rxdescriptor = etn2_rxdescriptor;
  +   etn_rxstatus = etn2_rxstatus;
 ^
 please use tab instead of space on all

Yes.

  +   /* get mode from environment */
  +   mode = getenv(phymode);
  +   if (mode  != NULL) {
 please use if (mode)
  +   if (0 == strcmp(mode, auto)) {
 please invert the condition an so on
   if (strcmp(mode, auto)) == 0) {

No problem.

  +void firetux_gpio_init_A(void)
  +{
  +   /* select TXD2 for GPIOa11 and select RXD2 for GPIOa1 */
  +   writel(((readl((void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX0))
  +0xff33) |
  0x0044),
  +   (void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX0));
  +   /* select ETN for GPIOc0-16 */
  +   writel(readl((void *)(PNX8181_SCON_BASE + PNX8181_SYSMUX5))
  +   
  0xfffc,
  +   (void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX5));
  +   writel(readl((void *)(PNX8181_SCON_BASE + PNX8181_SYSMUX4))
  +   
  0x3000,
  +   (void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX4)); +
  +   /* use clk26m and fract-n for UART2 */
  +   writew(((1  7) | (1  1)),
  +   (void *)(PNX8181_UART2_BASE +
  PNX8181_UART_FDIV_CTRL));
  +   writew(0x5F37, (void *)(PNX8181_UART2_BASE +
  PNX8181_UART_FDIV_M));
  +   writew(0x32C8, (void *)(PNX8181_UART2_BASE +
  PNX8181_UART_FDIV_N)); +}
  +
  
 IMHO please use deferent function for each hardware revision
 it will allow to make it more readable and to reduce the u-boot when
 compiling it for specific revision

The different revisions are very similair. I can split the routines
into different functions, but I doubt that it make sense to split these
into different files. The overhead is IMHO too much.

  +void firetux_gpio_init_B(void)
  +{
  +   if (boardrevision  2)  /* EZ_MCP has no
  leds or keys */
  +   return;
  +
  +   /* set GPIOA10 and GPIOA2 for key input */
  +   writel(readl((void *)(PNX8181_SCON_BASE + PNX8181_SYSMUX0))
  +   
  0xffcfffcf,
  +   (void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX0));
  +   writel(readl((void *)PNX8181_GPIOA_PAD_LOW)  0xffcfffcf,
  +   (void
  *)PNX8181_GPIOA_PAD_LOW);
  +   writel(readl((void *)PNX8181_GPIOA_DIRECTION)  ~((1  2)
  | (1  10)),
  +   (void
  *)PNX8181_GPIOA_DIRECTION); +
  +   /* set GPIOA9 and GPIOA0 for LED output */
  +   if (boardrevision  2) {
  +   writel(readl((void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX0))
  +   
  0xfff3fffc,
  +   (void *)(PNX8181_SCON_BASE +
  PNX8181_SYSMUX0));
  +   writel(readl((void *)PNX8181_GPIOA_DIRECTION)
  +   | ((1 
  9) | (1  0)),
  +

Re: [U-Boot] [PATCH-OMAP3] OMAP3: Update ARM's if then else logic in examples Makefile

2008-11-13 Thread Dirk Behme
Dear Wolfgang,

Wolfgang Denk wrote:
 Dear [EMAIL PROTECTED],
 
 In message [EMAIL PROTECTED] you wrote:
 
Update ARM's if then else logic.

---
 examples/Makefile |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
 
 
 Hm... wouldn't it make  sense  to  explicitely  state  against  which
 repository this patch (and all other of your patches) was (were) made
 resp. where you want to have it added?

Hm, I think this info is already there? Have you noticed the 
[PATCH-OMAP3] OMAP3 in subject? Having this identifier in subject is 
the way Jean-Christophe likes to have patches for u-boot-arm/omap3 [1] 
[2] marked.

Regarding my pending patches, there is one exception and this is

http://lists.denx.de/pipermail/u-boot/2008-November/043220.html

This is for (u-boot-arm) mainline as expressed by ARM in subject. As 
mentioned in note of this patch, I did it against mainline cause 
u-boot-arm wasn't in sync with mainline while creating that patch. But 
as u-boot-arm is in sync with mainline again now, it should apply 
there, too.

Best regards

Dirk

[1] http://lists.denx.de/pipermail/u-boot/2008-November/042897.html

[2] 
http://git.denx.de/?p=u-boot/u-boot-arm.git;a=shortlog;h=refs/heads/omap3


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


Re: [U-Boot] mini-pci wireless driver

2008-11-13 Thread John W. Linville
On Thu, Nov 13, 2008 at 02:58:51AM +0100, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 On 09:56 Thu 13 Nov , Lance Zhang wrote:
  
   With the Ralink chip it's not too much complicate to add wifi support.
   You need to upload the firmware and manage the wifi configuration via
  the
   firmware. After it will work as ant other ethernet driver.
  
  Thank you, I will ask for the Ralink chip information from manufacturer,
  then I will try to do it as you say
 Ask also to Ralink.
 
 It will be the best solution.

YMMV...Ralink devices require lots of 802.11 MAC work at the host CPU.

John
-- 
John W. LinvilleLinux should be at the core
[EMAIL PROTECTED]   of your literate lifestyle.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/6] jffs2: fix searching for latest version in jffs2_1pass_list_inodes()

2008-11-13 Thread Ilya Yanok
We need to update i_version inside cycle to find really latest version
inside jffs2_1pass_list_inodes(). With that fixed we can use isize inside
dump_inode() instead of calling expensive jffs2_1pass_read_inode().

Signed-off-by: Alexey Neyman [EMAIL PROTECTED]
Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 fs/jffs2/jffs2_1pass.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 920d2fd..35743fc 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -940,9 +940,7 @@ static inline u32 dump_inode(struct b_lists * pL, struct 
jffs2_raw_dirent *d, st
st.st_mtime = i-mtime;
st.st_mode = i-mode;
st.st_ino = i-ino;
-
-   /* neither dsize nor isize help us.. do it the long way */
-   st.st_size = jffs2_1pass_read_inode(pL, i-ino, NULL);
+   st.st_size = i-isize;
 
dump_stat(st, fname);
 
@@ -976,6 +974,7 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
jNode = (struct jffs2_raw_inode *)
get_fl_mem(b2-offset, sizeof(ojNode), 
ojNode);
if (jNode-ino == jDir-ino  jNode-version 
= i_version) {
+   i_version = jNode-version;
if (i)
put_fl_mem(i);
 
-- 
1.5.6.1

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


[U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Ilya Yanok
This patch adds sector_size field to part_info structure (used
by new JFFS2 code).

Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 common/cmd_jffs2.c  |   20 +---
 include/jffs2/load_kernel.h |1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index 791a572..e2bf198 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -339,11 +339,15 @@ static int part_validate_nor(struct mtdids *id, struct 
part_info *part)
extern flash_info_t flash_info[];
flash_info_t *flash;
int offset_aligned;
-   u32 end_offset;
+   u32 end_offset, sector_size = 0;
int i;
 
flash = flash_info[id-num];
 
+   /* size of last sector */
+   part-sector_size = flash-size -
+   (flash-start[flash-sector_count-1] - flash-start[0]);
+
offset_aligned = 0;
for (i = 0; i  flash-sector_count; i++) {
if ((flash-start[i] - flash-start[0]) == part-offset) {
@@ -358,12 +362,18 @@ static int part_validate_nor(struct mtdids *id, struct 
part_info *part)
}
 
end_offset = part-offset + part-size;
+   offset_aligned = 0;
for (i = 0; i  flash-sector_count; i++) {
+   if (i) {
+   sector_size = flash-start[i] - flash-start[i-1];
+   if (part-sector_size  sector_size)
+   part-sector_size = sector_size;
+   }
if ((flash-start[i] - flash-start[0]) == end_offset)
-   return 0;
+   offset_aligned = 1;
}
 
-   if (flash-size == end_offset)
+   if (offset_aligned || flash-size == end_offset)
return 0;
 
printf(%s%d: partition (%s) size alignment incorrect\n,
@@ -389,6 +399,8 @@ static int part_validate_nand(struct mtdids *id, struct 
part_info *part)
 
nand = nand_info[id-num];
 
+   part-sector_size = nand-erasesize;
+
if ((unsigned long)(part-offset) % nand-erasesize) {
printf(%s%d: partition (%s) start offset alignment 
incorrect\n,
MTD_DEV_TYPE(id-type), id-num, part-name);
@@ -424,6 +436,8 @@ static int part_validate_onenand(struct mtdids *id, struct 
part_info *part)
 
mtd = onenand_mtd;
 
+   part-sector_size = mtd-erasesize;
+
if ((unsigned long)(part-offset) % mtd-erasesize) {
printf(%s%d: partition (%s) start offset
alignment incorrect\n,
diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h
index 551fd0c..c0442a2 100644
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -50,6 +50,7 @@ struct part_info {
u32 offset; /* offset within device */
void *jffs2_priv;   /* used internaly by jffs2 */
u32 mask_flags; /* kernel MTD mask flags */
+   u32 sector_size;/* size of sector */
struct mtd_device *dev; /* parent device */
 };
 
-- 
1.5.6.1

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


[U-Boot] [RFC PATCH 0/6] Some speed improvements to U-Boot JFFS2 code (updated)

2008-11-13 Thread Ilya Yanok
Hello everybody,

here is a set of changes we made to improve U-Boot JFFS2 code
performance. We still can't reach Linux's performance but improvements
are significant.

Patches are againt current u-boot git tree.

Any comments are welcome.

Regards, Ilya.


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


[U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based on Linux one

2008-11-13 Thread Ilya Yanok
Rewrites jffs2_1pass_build_lists() function in style of Linux's
jffs2_scan_medium() and jffs2_scan_eraseblock().
This includes:
 - Caching flash acceses
 - Smart dealing with free space

Signed-off-by: Alexey Neyman [EMAIL PROTECTED]
Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 fs/jffs2/jffs2_1pass.c |  227 
 1 files changed, 171 insertions(+), 56 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 35743fc..30a6dba 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -389,6 +389,12 @@ static inline void *get_fl_mem_nor(u32 off)
return (void*)addr;
 }
 
+static inline void *get_fl_mem_nor_copy(u32 off, u32 size, void *ext_buf)
+{
+   memcpy(ext_buf, get_fl_mem_nor(off), size);
+   return ext_buf;
+}
+
 static inline void *get_node_mem_nor(u32 off)
 {
return (void*)get_fl_mem_nor(off);
@@ -405,8 +411,11 @@ static inline void *get_fl_mem(u32 off, u32 size, void 
*ext_buf)
struct mtdids *id = current_part-dev-id;
 
 #if defined(CONFIG_CMD_FLASH)
-   if (id-type == MTD_DEV_TYPE_NOR)
+   if (id-type == MTD_DEV_TYPE_NOR) {
+   if (ext_buf)
+   return get_fl_mem_nor_copy(off, size, ext_buf);
return get_fl_mem_nor(off);
+   }
 #endif
 
 #if defined(CONFIG_JFFS2_NAND)  defined(CONFIG_CMD_NAND)
@@ -478,9 +487,6 @@ static char *compr_names[] = {
 #endif
 };
 
-/* Spinning wheel */
-static char spinner[] = { '|', '/', '-', '\\' };
-
 /* Memory management */
 struct mem_block {
u32 index;
@@ -651,23 +657,6 @@ static int compare_dirents(struct b_node *new, struct 
b_node *old)
 }
 #endif
 
-static u32
-jffs2_scan_empty(u32 start_offset, struct part_info *part)
-{
-   char *max = (char *)(part-offset + part-size - sizeof(struct 
jffs2_raw_inode));
-   char *offset = (char *)(part-offset + start_offset);
-   u32 off;
-
-   while (offset  max 
-  *(u32*)get_fl_mem((u32)offset, sizeof(u32), off) == 0x) 
{
-   offset += sizeof(u32);
-   /* return if spinning is due */
-   if (((u32)offset  ((1  SPIN_BLKSIZE)-1)) == 0) break;
-   }
-
-   return (u32)offset - part-offset;
-}
-
 void
 jffs2_free_cache(struct part_info *part)
 {
@@ -766,6 +755,10 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char 
*dest)
put_fl_mem(jNode);
continue;
}
+   if (!data_crc(jNode)) {
+   put_fl_mem(jNode);
+   continue;
+   }
 
lDest = (uchar *) (dest + jNode-offset);
 #if 0
@@ -1268,17 +1261,33 @@ dump_dirents(struct b_lists *pL)
 }
 #endif
 
+#define min_t(type, x, y) ({\
+   type __min1 = (x);  \
+   type __min2 = (y);  \
+   __min1  __min2 ? __min1: __min2; })
+
+#define DEFAULT_EMPTY_SCAN_SIZE4096
+
+static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size)
+{
+   if (sector_size  DEFAULT_EMPTY_SCAN_SIZE)
+   return sector_size;
+   else
+   return DEFAULT_EMPTY_SCAN_SIZE;
+}
+
 static u32
 jffs2_1pass_build_lists(struct part_info * part)
 {
struct b_lists *pL;
struct jffs2_unknown_node *node;
-   u32 offset, oldoffset = 0;
-   u32 max = part-size - sizeof(struct jffs2_raw_inode);
-   u32 counter = 0;
+   u32 nr_sectors = part-size/part-sector_size;
+   u32 i;
u32 counter4 = 0;
u32 counterF = 0;
u32 counterN = 0;
+   u32 buf_size = DEFAULT_EMPTY_SCAN_SIZE;
+   char *buf;
 
/* turn off the lcd.  Refreshing the lcd adds 50% overhead to the */
/* jffs2 list building enterprise nope.  in newer versions the overhead 
is */
@@ -1288,70 +1297,176 @@ jffs2_1pass_build_lists(struct part_info * part)
/* if we are building a list we need to refresh the cache. */
jffs_init_1pass_list(part);
pL = (struct b_lists *)part-jffs2_priv;
-   offset = 0;
+   buf = malloc(buf_size);
puts (Scanning JFFS2 FS:   );
 
/* start at the beginning of the partition */
-   while (offset  max) {
-   if ((oldoffset  SPIN_BLKSIZE) != (offset  SPIN_BLKSIZE)) {
-   printf(\b\b%c , spinner[counter++ % sizeof(spinner)]);
-   oldoffset = offset;
-   }
+   for (i = 0; i  nr_sectors; i++) {
+   uint32_t sector_ofs = i * part-sector_size;
+   uint32_t buf_ofs = sector_ofs;
+   uint32_t buf_len = EMPTY_SCAN_SIZE(part-sector_size);
+   uint32_t ofs, prevofs;
 
WATCHDOG_RESET();
+   get_fl_mem((u32)part-offset + buf_ofs, buf_len, buf);
 
- 

[U-Boot] [PATCH 4/6] jffs2: add buffer to cache flash accesses

2008-11-13 Thread Ilya Yanok
With this patch JFFS2 code allocates memory buffer of max_totlen size
(size of the largest node, calculated during scan time) and uses it to
store entire node. Speeds up loading. If malloc fails we use old ways
to do things.

Signed-off-by: Alexey Neyman [EMAIL PROTECTED]
Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 fs/jffs2/jffs2_1pass.c   |  116 -
 fs/jffs2/jffs2_private.h |2 +-
 2 files changed, 73 insertions(+), 45 deletions(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 30a6dba..73d3ddc 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -245,7 +245,7 @@ static void *get_fl_mem_nand(u32 off, u32 size, void 
*ext_buf)
return buf;
 }
 
-static void *get_node_mem_nand(u32 off)
+static void *get_node_mem_nand(u32 off, void *ext_buf)
 {
struct jffs2_unknown_node node;
void *ret = NULL;
@@ -255,7 +255,7 @@ static void *get_node_mem_nand(u32 off)
 
if (!(ret = get_fl_mem_nand(off, node.magic ==
   JFFS2_MAGIC_BITMASK ? node.totlen : sizeof(node),
-  NULL))) {
+  ext_buf))) {
printf(off = %#x magic %#x type %#x node.totlen = %d\n,
   off, node.magic, node.nodetype, node.totlen);
}
@@ -344,7 +344,7 @@ static void *get_fl_mem_onenand(u32 off, u32 size, void 
*ext_buf)
return buf;
 }
 
-static void *get_node_mem_onenand(u32 off)
+static void *get_node_mem_onenand(u32 off, void *ext_buf)
 {
struct jffs2_unknown_node node;
void *ret = NULL;
@@ -354,7 +354,7 @@ static void *get_node_mem_onenand(u32 off)
 
ret = get_fl_mem_onenand(off, node.magic ==
JFFS2_MAGIC_BITMASK ? node.totlen : sizeof(node),
-   NULL);
+   ext_buf);
if (!ret) {
printf(off = %#x magic %#x type %#x node.totlen = %d\n,
   off, node.magic, node.nodetype, node.totlen);
@@ -377,7 +377,7 @@ static void put_fl_mem_onenand(void *buf)
  * NOR flash memory is mapped in processor's address space,
  * just return address.
  */
-static inline void *get_fl_mem_nor(u32 off)
+static inline void *get_fl_mem_nor(u32 off, u32 size, void *ext_buf)
 {
u32 addr = off;
struct mtdids *id = current_part-dev-id;
@@ -386,18 +386,22 @@ static inline void *get_fl_mem_nor(u32 off)
flash_info_t *flash = flash_info[id-num];
 
addr += flash-start[0];
+   if (ext_buf) {
+   memcpy(ext_buf, (void *)addr, size);
+   return ext_buf;
+   }
return (void*)addr;
 }
 
-static inline void *get_fl_mem_nor_copy(u32 off, u32 size, void *ext_buf)
+static inline void *get_node_mem_nor(u32 off, void *ext_buf)
 {
-   memcpy(ext_buf, get_fl_mem_nor(off), size);
-   return ext_buf;
-}
+   struct jffs2_unknown_node *pNode;
 
-static inline void *get_node_mem_nor(u32 off)
-{
-   return (void*)get_fl_mem_nor(off);
+   /* pNode will point directly to flash - don't provide external buffer
+  and don't care about size */
+   pNode = get_fl_mem_nor(off, 0, NULL);
+   return (void *)get_fl_mem_nor(off, pNode-magic == JFFS2_MAGIC_BITMASK ?
+   pNode-totlen : sizeof(*pNode), ext_buf);
 }
 #endif
 
@@ -412,9 +416,7 @@ static inline void *get_fl_mem(u32 off, u32 size, void 
*ext_buf)
 
 #if defined(CONFIG_CMD_FLASH)
if (id-type == MTD_DEV_TYPE_NOR) {
-   if (ext_buf)
-   return get_fl_mem_nor_copy(off, size, ext_buf);
-   return get_fl_mem_nor(off);
+   return get_fl_mem_nor(off, size, ext_buf);
}
 #endif
 
@@ -432,34 +434,38 @@ static inline void *get_fl_mem(u32 off, u32 size, void 
*ext_buf)
return (void*)off;
 }
 
-static inline void *get_node_mem(u32 off)
+static inline void *get_node_mem(u32 off, void *ext_buf)
 {
struct mtdids *id = current_part-dev-id;
 
 #if defined(CONFIG_CMD_FLASH)
if (id-type == MTD_DEV_TYPE_NOR)
-   return get_node_mem_nor(off);
+   return get_node_mem_nor(off, ext_buf);
 #endif
 
 #if defined(CONFIG_JFFS2_NAND)  \
 defined(CONFIG_CMD_NAND)
if (id-type == MTD_DEV_TYPE_NAND)
-   return get_node_mem_nand(off);
+   return get_node_mem_nand(off, ext_buf);
 #endif
 
 #if defined(CONFIG_CMD_ONENAND)
if (id-type == MTD_DEV_TYPE_ONENAND)
-   return get_node_mem_onenand(off);
+   return get_node_mem_onenand(off, ext_buf);
 #endif
 
printf(get_node_mem: unknown device type, using raw offset!\n);
return (void*)off;
 }
 
-static inline void put_fl_mem(void *buf)
+static inline void put_fl_mem(void *buf, void *ext_buf)
 {
struct mtdids *id = current_part-dev-id;
 
+   /* If buf is the same as ext_buf, it was provided by the caller -
+  we shouldn't free it 

[U-Boot] [PATCH 5/6] jffs2: summary support

2008-11-13 Thread Ilya Yanok
This patch adds support for reading fs information from summary
node instead of scanning full eraseblock.

Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
---
 fs/jffs2/jffs2_1pass.c |  187 +++-
 fs/jffs2/summary.h |  163 +
 include/jffs2/jffs2.h  |   19 +
 3 files changed, 368 insertions(+), 1 deletions(-)
 create mode 100644 fs/jffs2/summary.h

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 73d3ddc..4e49a05 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -138,6 +138,8 @@
 # define DEBUGF(fmt,args...)
 #endif
 
+#include summary.h
+
 /* keeps pointer to currentlu processed partition */
 static struct part_info *current_part;
 
@@ -1214,6 +1216,132 @@ jffs2_1pass_rescan_needed(struct part_info *part)
return 0;
 }
 
+#define dbg_summary(...) do {} while (0);
+/* Process the stored summary information - helper function for
+ * jffs2_sum_scan_sumnode()
+ */
+
+static int jffs2_sum_process_sum_data(struct part_info *part, uint32_t offset,
+   struct jffs2_raw_summary *summary,
+   struct b_lists *pL)
+{
+   void *sp;
+   int i;
+
+   sp = summary-sum;
+
+   for (i = 0; i  summary-sum_num; i++) {
+   dbg_summary(processing summary index %d\n, i);
+
+   switch (((struct jffs2_sum_unknown_flash *)sp)-nodetype) {
+   case JFFS2_NODETYPE_INODE: {
+   struct jffs2_sum_inode_flash *spi;
+   spi = sp;
+
+   dbg_summary(Inode at 0x%08x-0x%08x\n,
+   offset + spi-offset,
+   offset + spi-offset + spi-totlen);
+
+   if (insert_node(pL-frag, (u32) part-offset +
+   offset + spi-offset) == NULL)
+   return -1;
+
+   sp += JFFS2_SUMMARY_INODE_SIZE;
+
+   break;
+   }
+
+   case JFFS2_NODETYPE_DIRENT: {
+   struct jffs2_sum_dirent_flash *spd;
+   spd = sp;
+
+   dbg_summary(Dirent at 0x%08x-0x%08x\n,
+   offset + spd-offset,
+   offset + spd-offset + spd-totlen);
+
+   if (insert_node(pL-dir, (u32) part-offset +
+   offset + spd-offset) == NULL)
+   return -1;
+
+   sp += JFFS2_SUMMARY_DIRENT_SIZE(spd-nsize);
+
+   break;
+   }
+   default : {
+   uint16_t nodetype =
+   ((struct jffs2_sum_unknown_flash *)
+sp)-nodetype;
+   printf(Unsupported node type %x found in 
+   summary!\n, nodetype);
+   break;
+   }
+   }
+   }
+   return 0;
+}
+
+/* Process the summary node - called from jffs2_scan_eraseblock() */
+int jffs2_sum_scan_sumnode(struct part_info *part, uint32_t offset,
+  struct jffs2_raw_summary *summary, uint32_t sumsize,
+  struct b_lists *pL)
+{
+   struct jffs2_unknown_node crcnode;
+   int ret, ofs;
+   uint32_t crc;
+
+   ofs = part-sector_size - sumsize;
+
+   dbg_summary(summary found for 0x%08x at 0x%08x (0x%x bytes)\n,
+   offset, offset + ofs, sumsize);
+
+   /* OK, now check for node validity and CRC */
+   crcnode.magic = JFFS2_MAGIC_BITMASK;
+   crcnode.nodetype = JFFS2_NODETYPE_SUMMARY;
+   crcnode.totlen = summary-totlen;
+   crc = crc32_no_comp(0, (uchar *)crcnode, sizeof(crcnode)-4);
+
+   if (summary-hdr_crc != crc) {
+   dbg_summary(Summary node header is corrupt (bad CRC or 
+   no summary at all)\n);
+   goto crc_err;
+   }
+
+   if (summary-totlen != sumsize) {
+   dbg_summary(Summary node is corrupt (wrong erasesize?)\n);
+   goto crc_err;
+   }
+
+   crc = crc32_no_comp(0, (uchar *)summary,
+   sizeof(struct jffs2_raw_summary)-8);
+
+   if (summary-node_crc != crc) {
+   dbg_summary(Summary node is corrupt (bad CRC)\n);
+   goto crc_err;
+   }
+
+   crc = crc32_no_comp(0, (uchar *)summary-sum,
+   sumsize - sizeof(struct jffs2_raw_summary));
+
+   if (summary-sum_crc != crc) {
+   

Re: [U-Boot] [patch V2] U-Boot Firetux board support

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
   diff --git a/include/configs/firetux.h b/include/configs/firetux.h
   new file mode 100644
   index 000..efa27af
   --- /dev/null
   +++ b/include/configs/firetux.h
   +/* we can have nand _or_ nor flash */
   +/* #define CONFIG_NANDFLASH  1 */
   +
   +/* #define CONFIG_SHOW_BOOT_PROGRESS 1 */
  please no dead code
 
 Sorry, I use this code for testing the release and trying to find
 problematic areas. This way I only need to change the config and do not
 need to write the code for every release cycle. So I prefer to let it
 there.

please do this via Makefile and different config

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


[U-Boot] [PATCH] 85xx: socrates: fix DDR SDRAM tlb entry configuration

2008-11-13 Thread Anatolij Gustschin
since commit be0bd8234b9777ecd63c4c686f72af070d886517
tlb entry for socrates DDR SDRAM will be reconfigured
by setup_ddr_tlbs() from initdram() causing an
inconsistency with previously configured DDR SDRAM tlb
entry from tlb_table:

socratesl2cam 7 9
IDX  PID  EPN  SIZE V TS   RPN U0-U3 WIMGE UUUSSS
  7 : 00  256MB V  0 - 0_   -I-G- ---RWX
  8 : 00  256MB V  0 - 0_   - ---RWX
  9 : 00 1000 256MB V  0 - 0_1000   - ---RWX

This patch makes the presence of the DDR SDRAM tlb entry in
the tlb_table dependent on CONFIG_SPD_EEPROM to avoid this
inconsistency.

Signed-off-by: Anatolij Gustschin [EMAIL PROTECTED]
---
 board/socrates/tlb.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/board/socrates/tlb.c b/board/socrates/tlb.c
index b91b1ea..4591e46 100644
--- a/board/socrates/tlb.c
+++ b/board/socrates/tlb.c
@@ -100,6 +100,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  0, 6, BOOKE_PAGESZ_64M, 1),
 
+#if !defined(CONFIG_SPD_EEPROM)
/*
 * TLB 7+8: 512MDDR, cache disabled (needed for memory test)
 * 0x  512M DDR System memory
@@ -114,6 +115,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x1000, 
CONFIG_SYS_DDR_SDRAM_BASE + 0x1000,
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  0, 8, BOOKE_PAGESZ_256M, 1),
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
-- 
1.5.6.1

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


Re: [U-Boot] [PATCH 4/5] powerpc: keymile: Add a check for the PIGGY debug board

2008-11-13 Thread Ben Warren
Heiko Schocher wrote:
 Hello Ben

 Ben Warren wrote:
   
 Heiko Schocher wrote:
   
 
 Check the presence of the PIGGY on the keymile boards mgcoge,
 mgsuvd and kmeter1. If the PIGGY is not present, dont register
 this Ethernet device.

 Signed-off-by: Heiko Schocher [EMAIL PROTECTED]
 ---
 
   
 This looks like useful stuff to have, but I'd prefer that you put the 
 check logic in board_eth_init() rather than adding to the individual 
 device drivers.  I know the 8260 SCC driver is the older style, which 
 precludes the use of board_eth_init, but I'll convert it if you're able 
 to test.
   
 

 Yes, I could test such a change for you, but hmm... I am not sure, if
 board_eth_init () is the right place for my purpose.
 I need for every Ethernet device a selection, if this device is present or
 not.
 Correct me if I am wrong, but it looks like board_eth_init ()
 is not made for this purpose. (Ok, I can do a specific device init
 in board_eth_init (), but then we must do something, that prevents
 that the device is again initialized in eth_initialize () ...

   
board_eth_init() was introduced for exactly this sort of thing.  Have a 
look at the net repo (I've sent a pull request to Wolfgang so the 
current changes will make it into the 12.2008 release).  There aren't 
any device initializations left in eth_initialize(), so there's no issue 
of a device being initialized twice.  The goal is for all devices to be 
started by cpu_eth_int() or board_eth_init().
 Hmm... while writing this it comes a idea in my mind:
 we could move all the *_initialize functions in eth_initialize () in a
 seperate function, say eth_hardware_init() and maybe making this
 function weak, so a board writer can write his own
 eth_hardware_init() ... in such a function, I could check which
 device is present, and only initialize the present devices ...
 what do you think?
   
That's what board_eth_init() and cpu_eth_init() are for.  In addition, I 
forgot to mention that a couple of days ago Gary Jennejohn submitted a 
patch for changing the 82xx SCC driver over to CONFIG_NET_MULTI style.

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


Re: [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 19:49 Thu 13 Nov , Ilya Yanok wrote:
 This patch adds sector_size field to part_info structure (used
 by new JFFS2 code).
 
 Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
 ---
  common/cmd_jffs2.c  |   20 +---
  include/jffs2/load_kernel.h |1 +
  2 files changed, 18 insertions(+), 3 deletions(-)
 
 diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
 index 791a572..e2bf198 100644
 --- a/common/cmd_jffs2.c
 +++ b/common/cmd_jffs2.c
 @@ -339,11 +339,15 @@ static int part_validate_nor(struct mtdids *id, struct 
 part_info *part)
   extern flash_info_t flash_info[];
   flash_info_t *flash;
   int offset_aligned;
 - u32 end_offset;
 + u32 end_offset, sector_size = 0;
please spit in two lines

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


Re: [U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based on Linux one

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
  
   /* start at the beginning of the partition */
 - while (offset  max) {
 - if ((oldoffset  SPIN_BLKSIZE) != (offset  SPIN_BLKSIZE)) {
 - printf(\b\b%c , spinner[counter++ % sizeof(spinner)]);
 - oldoffset = offset;
 - }
 + for (i = 0; i  nr_sectors; i++) {
 + uint32_t sector_ofs = i * part-sector_size;
 + uint32_t buf_ofs = sector_ofs;
 + uint32_t buf_len = EMPTY_SCAN_SIZE(part-sector_size);
 + uint32_t ofs, prevofs;
  
   WATCHDOG_RESET();
 + get_fl_mem((u32)part-offset + buf_ofs, buf_len, buf);
  
 - node = (struct jffs2_unknown_node *) 
 get_node_mem((u32)part-offset + offset);
 - if (node-magic == JFFS2_MAGIC_BITMASK  hdr_crc(node)) {
 + /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
 + ofs = 0;
 +
 + /* Scan only 4KiB of 0xFF before declaring it's empty */
 + while (ofs  EMPTY_SCAN_SIZE(part-sector_size) 
 + *(uint32_t *)(buf[ofs]) == 0x)
please use readx/writex
 + ofs += 4;
 +
 + if (ofs == EMPTY_SCAN_SIZE(part-sector_size))
 + continue;
 +
 + ofs += sector_ofs;
 + prevofs = ofs - 1;
 +
 + scan_more:
 + while (ofs  sector_ofs + part-sector_size) {
 + if (ofs == prevofs) {
 + printf(offset %08x already seen, skip\n, ofs);
 + ofs += 4;
 + counter4++;
 + continue;
 + }
 + prevofs = ofs;
 + if (sector_ofs + part-sector_size 
 + ofs + sizeof(*node))
 + break;
 + if (buf_ofs + buf_len  ofs + sizeof(*node)) {
 + buf_len = min_t(uint32_t, buf_size, sector_ofs
 + + part-sector_size - ofs);
 + get_fl_mem((u32)part-offset + ofs, buf_len,
 +buf);
 + buf_ofs = ofs;
 + }
 +
 + node = (struct jffs2_unknown_node *)buf[ofs-buf_ofs];
 +
 + if (*(uint32_t *)(buf[ofs-buf_ofs]) == 0x) {
please use readx/writex
 + uint32_t inbuf_ofs;
 + uint32_t empty_start, scan_end;
 +
 + empty_start = ofs;
 + ofs += 4;
 + scan_end = min_t(uint32_t, EMPTY_SCAN_SIZE(
 + part-sector_size)/8,
 + buf_len);
 + more_empty:
 + inbuf_ofs = ofs - buf_ofs;
 + while (inbuf_ofs  scan_end) {
 + if (*(uint32_t *)(buf[inbuf_ofs]) !=
 + 0x)
please use readx/writex and so on

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


Re: [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Ben Warren
Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 19:49 Thu 13 Nov , Ilya Yanok wrote:
   
 This patch adds sector_size field to part_info structure (used
 by new JFFS2 code).

 Signed-off-by: Ilya Yanok [EMAIL PROTECTED]
 ---
  common/cmd_jffs2.c  |   20 +---
  include/jffs2/load_kernel.h |1 +
  2 files changed, 18 insertions(+), 3 deletions(-)

 diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
 index 791a572..e2bf198 100644
 --- a/common/cmd_jffs2.c
 +++ b/common/cmd_jffs2.c
 @@ -339,11 +339,15 @@ static int part_validate_nor(struct mtdids *id, struct 
 part_info *part)
  extern flash_info_t flash_info[];
  flash_info_t *flash;
  int offset_aligned;
 -u32 end_offset;
 +u32 end_offset, sector_size = 0;
 
 please spit in two lines
   
Why do you waste peoples' time with this pedantic nit-picking?  There's 
absolutely nothing wrong with having them both on the same line, 
especially if it's the only thing you can object to in the patch.

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


Re: [U-Boot] Hangs up after transferring control to kernel

2008-11-13 Thread eliad lubovsky
On Wed, Nov 12, 2008 at 8:14 PM, Kumar Gala [EMAIL PROTECTED]wrote:


 On Nov 12, 2008, at 5:48 PM, eliad lubovsky wrote:

  I am trying to boot kernel 2.6.23 on an MPC8572DS board.
 It hangs on a bootm command after decompressing the kernel and the rootfs.
 I
 added some printings to u-boot where I can see that it transfers control
 to
 the kernel (can be seen in the attached file).

 What could be the problem?


 Where did you get a kernel for 8572 that is based on 2.6.23?


 The kernel is from the ltib environment installed from Freescale BSP.


 - k


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


Re: [U-Boot] [PATCH RFC] at91sam9/at91cap: move common initialisation to cpu

2008-11-13 Thread Stelian Pop
Le vendredi 07 novembre 2008 à 20:38 +0100, Jean-Christophe
PLAGNIOL-VILLARD a écrit :

 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED]
 ---
 The idea is to reduce common code initialisation which is actually in board.
 as done on afeb9260 and Ronetix eval board for 9260  9263

[...]

I agree with the general idea of moving the serial and spi from board
specific files to the cpu specific files.

Note however that serial and spi are not the only initialisations that
can be moved: the very same thing can be done with all the other device
initialisations. Some devices will need to specify which GPIOs are used
when it's board specific, and this can be passed as arguments to the cpu
specfic function. One can look at the Linux kernel files which nicely
separates the cpu specific GPIOs (in arch/arm/mach-at91/XXX_devices.c)
and the board specific GPIOs (in arch/arm/mach-at91/board-YYY.c). Or one
can also RTFM of course.

I also don't like this:

 --- a/board/atmel/at91cap9adk/at91cap9adk.c
 +++ b/board/atmel/at91cap9adk/at91cap9adk.c

  #ifdef CONFIG_USART0
 - at91_set_A_periph(AT91_PIN_PA22, 1);/* TXD0 */
 - at91_set_A_periph(AT91_PIN_PA23, 0);/* RXD0 */
 - at91_sys_write(AT91_PMC_PCER, 1  AT91CAP9_ID_US0);
 + at91_serial_hw_init(0);
  #endif

Why don't just do at91_serial_hw_init() once, and test the CONFIG_USART*
inside the cpu specific at91_serial_hw_init function() ?

This also eliminates that unneeded switch case in that function.

Stelian.
-- 
Stelian Pop [EMAIL PROTECTED]

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


Re: [U-Boot] [PATCH RFC] at91sam9/at91cap: move common initialisation to cpu

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 22:28 Thu 13 Nov , Stelian Pop wrote:
 Le vendredi 07 novembre 2008 à 20:38 +0100, Jean-Christophe
 PLAGNIOL-VILLARD a écrit :
 
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED]
  ---
  The idea is to reduce common code initialisation which is actually in board.
  as done on afeb9260 and Ronetix eval board for 9260  9263
 
 [...]
 
 I agree with the general idea of moving the serial and spi from board
 specific files to the cpu specific files.
 
 Note however that serial and spi are not the only initialisations that
 can be moved: the very same thing can be done with all the other device
 initialisations.
I've just put serial  spi for the RFC

 Some devices will need to specify which GPIOs are used
 when it's board specific, and this can be passed as arguments to the cpu
 specfic function. One can look at the Linux kernel files which nicely
 separates the cpu specific GPIOs (in arch/arm/mach-at91/XXX_devices.c)
 and the board specific GPIOs (in arch/arm/mach-at91/board-YYY.c).
This the idea

 
 I also don't like this:
 
  --- a/board/atmel/at91cap9adk/at91cap9adk.c
  +++ b/board/atmel/at91cap9adk/at91cap9adk.c
 
   #ifdef CONFIG_USART0
  -   at91_set_A_periph(AT91_PIN_PA22, 1);/* TXD0 */
  -   at91_set_A_periph(AT91_PIN_PA23, 0);/* RXD0 */
  -   at91_sys_write(AT91_PMC_PCER, 1  AT91CAP9_ID_US0);
  +   at91_serial_hw_init(0);
   #endif
 
 Why don't just do at91_serial_hw_init() once, and test the CONFIG_USART*
 inside the cpu specific at91_serial_hw_init function() ?
 
 This also eliminates that unneeded switch case in that function.
The idea is too allow multiple serial at the same time.

I've plan to add the multi serial support to the at91 serial drivers

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


Re: [U-Boot] Hangs up after transferring control to kernel

2008-11-13 Thread Kumar Gala

On Nov 13, 2008, at 1:36 PM, eliad lubovsky wrote:



 On Wed, Nov 12, 2008 at 8:14 PM, Kumar Gala  
 [EMAIL PROTECTED] wrote:

 On Nov 12, 2008, at 5:48 PM, eliad lubovsky wrote:

 I am trying to boot kernel 2.6.23 on an MPC8572DS board.
 It hangs on a bootm command after decompressing the kernel and the  
 rootfs. I
 added some printings to u-boot where I can see that it transfers  
 control to
 the kernel (can be seen in the attached file).

 What could be the problem?

 Where did you get a kernel for 8572 that is based on 2.6.23?

  The kernel is from the ltib environment installed from Freescale BSP.

you should than use the u-boot from ltib.  There ltib kernel is NOT  
expected to work w/the open source u-boot.

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