Re: [U-Boot] [PATCH 2/3 v3] S5PC100: Function to configure the SROMC registers.

2010-02-23 Thread Minkyu Kang
Dear Naveen Krishna CH,

On 19 February 2010 19:23,   wrote:
> From: Naveen Krishna CH 
>
> Nand Flash, Ethernet, other features might need to configure the
> SROMC registers accordingly.
> The config_sromc() functions helps with this.
>
> Signed-off-by: Naveen Krishna Ch 
> ---
> Changes since V1:
>
> 1. Funtion config_sromc() is renamed to s5pc1xx_config_sromc().
> Comments from Minkyu Kang are fixed
>
> Changes since V2:
>
> 1.cpu_is_s5pc100() function is used instead of Macros.
>
>  cpu/arm_cortexa8/s5pc1xx/Makefile  |    1 +
>  cpu/arm_cortexa8/s5pc1xx/sromc.c   |   53 
> 
>  include/asm-arm/arch-s5pc1xx/smc.h |    3 ++
>  3 files changed, 57 insertions(+), 0 deletions(-)
>  create mode 100644 cpu/arm_cortexa8/s5pc1xx/sromc.c
>
> diff --git a/cpu/arm_cortexa8/s5pc1xx/Makefile 
> b/cpu/arm_cortexa8/s5pc1xx/Makefile
> index 4f922e6..0a6a9b4 100644
> --- a/cpu/arm_cortexa8/s5pc1xx/Makefile
> +++ b/cpu/arm_cortexa8/s5pc1xx/Makefile
> @@ -34,6 +34,7 @@ SOBJS += reset.o
>  COBJS  += clock.o
>  COBJS  += cpu_info.o
>  COBJS  += timer.o
> +COBJS  += sromc.o

Please sort this lists alphabetically.

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3 v3] S5PC100: Function to configure the SROMC registers.

2010-02-23 Thread Naveen Krishna Ch
Hi Kang,

Thanks for your comments.

Let me know in case of other comments.
I will incorporate them in v4 patch set and send this evening.

On 23 February 2010 14:02, Minkyu Kang  wrote:

> Dear Naveen Krishna CH,
>
> On 19 February 2010 19:23,   wrote:
> > From: Naveen Krishna CH 
> >
> > Nand Flash, Ethernet, other features might need to configure the
> > SROMC registers accordingly.
> > The config_sromc() functions helps with this.
> >
> > Signed-off-by: Naveen Krishna Ch 
> > ---
> > Changes since V1:
> >
> > 1. Funtion config_sromc() is renamed to s5pc1xx_config_sromc().
> > Comments from Minkyu Kang are fixed
> >
> > Changes since V2:
> >
> > 1.cpu_is_s5pc100() function is used instead of Macros.
> >
> >  cpu/arm_cortexa8/s5pc1xx/Makefile  |1 +
> >  cpu/arm_cortexa8/s5pc1xx/sromc.c   |   53
> 
> >  include/asm-arm/arch-s5pc1xx/smc.h |3 ++
> >  3 files changed, 57 insertions(+), 0 deletions(-)
> >  create mode 100644 cpu/arm_cortexa8/s5pc1xx/sromc.c
> >
> > diff --git a/cpu/arm_cortexa8/s5pc1xx/Makefile
> b/cpu/arm_cortexa8/s5pc1xx/Makefile
> > index 4f922e6..0a6a9b4 100644
> > --- a/cpu/arm_cortexa8/s5pc1xx/Makefile
> > +++ b/cpu/arm_cortexa8/s5pc1xx/Makefile
> > @@ -34,6 +34,7 @@ SOBJS += reset.o
> >  COBJS  += clock.o
> >  COBJS  += cpu_info.o
> >  COBJS  += timer.o
> > +COBJS  += sromc.o
>
> Please sort this lists alphabetically.
>
> Thanks
> Minkyu Kang
> --
> from. prom.
> www.promsoft.net
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>



-- 
Shine bright,
(: Naveen Krishna Ch :)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v3] SAMSUNG: SMDKC100: Adds ethernet support.

2010-02-23 Thread Minkyu Kang
Dear Naveen Krishna CH,

On 19 February 2010 19:26,   wrote:
> From: Naveen Krishna CH 
>
> Add setup for ethernet on SMDKC100, allowing kernel/ramdisk to be
> loaded over tftp.
>
> The preinit function will configure GPIO (GPK0CON) & SROMC to look
> for environment in SROM Bank 3.
>
> Signed-off-by: Naveen Krishna Ch 
> ---
> Changes since V1:
>
> 1. The CONFIG_BOOTP* and Net config Macros are removed from config header.
> Comments from Ben Warren are fixed
> 2. The GPIO configuration is modified & Macro and Function are renamed.
> Comments from Minkyu Kang are fixedChanges since V2
>
> Changes since V2:
> 1. GPIO configurations function has been implemented.
>
>  board/samsung/smdkc100/smdkc100.c |   39 
> +
>  include/configs/smdkc100.h        |   13 +++-
>  2 files changed, 51 insertions(+), 1 deletions(-)
>
> diff --git a/board/samsung/smdkc100/smdkc100.c 
> b/board/samsung/smdkc100/smdkc100.c
> index 15a1a27..946f7af 100644
> --- a/board/samsung/smdkc100/smdkc100.c
> +++ b/board/samsung/smdkc100/smdkc100.c
> @@ -23,10 +23,40 @@
>  */
>
>  #include 
> +#include 
> +#include 
> +#include 
> +
>  DECLARE_GLOBAL_DATA_PTR;
>
> +/*
> + * Miscellaneous platform dependent initialisations
> + */
> +static void smc9115_pre_init(void)
> +{
> +       u32 tmp;
> +       u32 smc_bw_conf, smc_bc_conf;
> +
> +       struct s5pc100_gpio *const gpio =
> +               (struct s5pc100_gpio *)S5PC100_GPIO_BASE;
> +
> +       /* gpio configuration GPK0CON */
> +       gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));
> +
> +       /* Ethernet needs bus width of 16 bits */
> +       smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
> +       smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe) \

\ is no need.

> +                       | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
> +                       | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);
> +
> +       /* Select and configure the SROMC bank */
> +       s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
> +}
> +
>  int board_init(void)
>  {
> +       smc9115_pre_init();
> +
>        gd->bd->bi_arch_number = MACH_TYPE_SMDKC100;
>        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
>
> @@ -49,3 +79,12 @@ int checkboard(void)
>        return 0;
>  }
>  #endif
> +
> +int board_eth_init(bd_t *bis)
> +{
> +       int rc = 0;
> +#ifdef CONFIG_SMC911X
> +       rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
> +#endif
> +       return rc;
> +}
> diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
> index f12fea3..22e8e95 100644
> --- a/include/configs/smdkc100.h
> +++ b/include/configs/smdkc100.h
> @@ -83,7 +83,7 @@
>  #undef CONFIG_CMD_FLASH
>  #undef CONFIG_CMD_IMLS
>  #undef CONFIG_CMD_NAND
> -#undef CONFIG_CMD_NET
> +#define CONFIG_CMD_NET         /* bootp, tftpboot, rarpboot */

CMD_NET is already defined config_cmd_default.h.
Just remove the undef line.

>
>  #define CONFIG_CMD_CACHE
>  #define CONFIG_CMD_REGINFO
> @@ -235,4 +235,15 @@
>
>  #define CONFIG_DOS_PARTITION           1
>
> +/*
> + * Ethernet Contoller driver
> + */
> +#ifdef CONFIG_CMD_NET
> +#define CONFIG_NET_MULTI
> +#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
> +#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
> +#define CONFIG_SMC911X_BASE    0x98800300      /* SMC911X Drive Base   */
> +#define CONFIG_ENV_SROM_BANK   3       /* Select SROM Bank-3 for Ethernet*/
> +#endif /* CONFIG_CMD_NET */
> +
>  #endif /* __CONFIG_H */
> --
> 1.6.6
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3 v4] S5PC100: Memory SubSystem Header file, register description(SROMC).

2010-02-23 Thread ch . naveen
From: Naveen Krishna CH 

Memory subsystem of S5PC100 handles SROM, SRAM, OneDRAM, OneNand,
NAND Flash, DDRs.
mem.h is a common place for the register description of Memory subsystem
of S5PC100.
Note: Only SROM related registers are descibed now.

Signed-off-by: Naveen Krishna Ch 
---
Changes since V1:

1. The header file is renamed to smc.h from mem.h

2. The Macros are renamed according to TRM.
Comments from Minkyu kang are fixed.

Changes since V2:

1. Macros have been modified to be generic.
Comments from Minkyu kang are fixed

Changes since V3:
1. No Changes.

 include/asm-arm/arch-s5pc1xx/smc.h |   50 
 1 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-arm/arch-s5pc1xx/smc.h

diff --git a/include/asm-arm/arch-s5pc1xx/smc.h 
b/include/asm-arm/arch-s5pc1xx/smc.h
new file mode 100644
index 000..e1a5399
--- /dev/null
+++ b/include/asm-arm/arch-s5pc1xx/smc.h
@@ -0,0 +1,50 @@
+/*
+ * (C) Copyright 2010 Samsung Electronics
+ * Naveen Krishna Ch 
+ *
+ * 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
+ *
+ * Note: This file contains the register description for Memory subsystem
+ *  (SROM, NAND Flash, OneNand, DDR, OneDRAM) on S5PC1XX.
+ *
+ *  Only SROMC is defined as of now
+ */
+
+#ifndef __ASM_ARCH_SMC_H_
+#define __ASM_ARCH_SMC_H_
+
+#define SMC_DATA16_WIDTH(x)(1<<((x*4)+0))
+#define SMC_BYTE_ADDR_MODE(x)  (1<<((x*4)+1))  /* 0-> Half-word base address*/
+   /* 1-> Byte base address*/
+#define SMC_WAIT_ENABLE(x) (1<<((x*4)+2))
+#define SMC_BYTE_ENABLE(x) (1<<((x*4)+3))
+
+#define SMC_BC_TACS(x) (x << 28) /* 0clk address set-up */
+#define SMC_BC_TCOS(x) (x << 24) /* 4clk chip selection set-up */
+#define SMC_BC_TACC(x) (x << 16) /* 14clkaccess cycle */
+#define SMC_BC_TCOH(x) (x << 12) /* 1clk chip selection hold */
+#define SMC_BC_TAH(x)  (x << 8)  /* 4clk address holding time */
+#define SMC_BC_TACP(x) (x << 4)  /* 6clk page mode access cycle */
+#define SMC_BC_PMC(x)  (x << 0)  /* normal(1data)page mode configuration */
+
+#ifndef __ASSEMBLY__
+struct s5pc1xx_smc {
+   unsigned intbw;
+   unsigned intbc[6];
+};
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_ARCH_SMC_H_ */
-- 
1.6.6

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


[U-Boot] [PATCH 2/3 v4] S5PC100: Function to configure the SROMC registers.

2010-02-23 Thread ch . naveen
From: Naveen Krishna CH 

Nand Flash, Ethernet, other features might need to configure the
SROMC registers accordingly.
The config_sromc() functions helps with this.

Signed-off-by: Naveen Krishna Ch 
---
Changes since V1:

1. Funtion config_sromc() is renamed to s5pc1xx_config_sromc().
Comments from Minkyu Kang are fixed

Changes since V2:

1.cpu_is_s5pc100() function is used instead of Macros.

Changes since V3:
1. Comments from Minkyu Kang are fixed.

 cpu/arm_cortexa8/s5pc1xx/Makefile  |1 +
 cpu/arm_cortexa8/s5pc1xx/sromc.c   |   53 
 include/asm-arm/arch-s5pc1xx/smc.h |3 ++
 3 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm_cortexa8/s5pc1xx/sromc.c

diff --git a/cpu/arm_cortexa8/s5pc1xx/Makefile 
b/cpu/arm_cortexa8/s5pc1xx/Makefile
index 7290c2f..01c93fe 100644
--- a/cpu/arm_cortexa8/s5pc1xx/Makefile
+++ b/cpu/arm_cortexa8/s5pc1xx/Makefile
@@ -34,6 +34,7 @@ SOBJS += reset.o
 COBJS  += clock.o
 COBJS  += cpu_info.o
 COBJS  += gpio.o
+COBJS  += sromc.o
 COBJS  += timer.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/cpu/arm_cortexa8/s5pc1xx/sromc.c b/cpu/arm_cortexa8/s5pc1xx/sromc.c
new file mode 100644
index 000..380be81
--- /dev/null
+++ b/cpu/arm_cortexa8/s5pc1xx/sromc.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics
+ * Naveen Krishna Ch 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+
+/*
+ * s5pc1xx_config_sromc() - select the proper SROMC Bank and configure the
+ * band width control and bank control registers
+ * srom_bank   - SROM Bank 0 to 5
+ * smc_bw_conf  - SMC Band witdh reg configuration value
+ * smc_bc_conf  - SMC Bank Control reg configuration value
+ */
+void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf)
+{
+   u32 tmp;
+   struct s5pc1xx_smc *srom;
+
+   if (cpu_is_s5pc100())
+   srom = (struct s5pc1xx_smc *)S5PC100_SROMC_BASE;
+   else
+   srom = (struct s5pc1xx_smc *)S5PC110_SROMC_BASE;
+
+   /* Configure SMC_BW register to handle proper SROMC bank */
+   tmp = srom->bw;
+   tmp &= ~(0xF << (srom_bank * 4));
+   tmp |= smc_bw_conf;
+   srom->bw = tmp;
+
+   /* Configure SMC_BC register */
+   srom->bc[srom_bank] = smc_bc_conf;
+}
diff --git a/include/asm-arm/arch-s5pc1xx/smc.h 
b/include/asm-arm/arch-s5pc1xx/smc.h
index e1a5399..88f4ffe 100644
--- a/include/asm-arm/arch-s5pc1xx/smc.h
+++ b/include/asm-arm/arch-s5pc1xx/smc.h
@@ -47,4 +47,7 @@ struct s5pc1xx_smc {
 };
 #endif /* __ASSEMBLY__ */
 
+/* Configure the Band Width and Bank Control Regs for required SROMC Bank */
+void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf);
+
 #endif /* __ASM_ARCH_SMC_H_ */
-- 
1.6.6

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


[U-Boot] [PATCH 3/3 v4] SAMSUNG: SMDKC100: Adds ethernet support.

2010-02-23 Thread ch . naveen
From: Naveen Krishna CH 

Add setup for ethernet on SMDKC100, allowing kernel/ramdisk to be
loaded over tftp.

The preinit function will configure GPIO (GPK0CON) & SROMC to look
for environment in SROM Bank 3.

Signed-off-by: Naveen Krishna Ch 
---
Changes since V1:

1. The CONFIG_BOOTP* and Net config Macros are removed from config header.
Comments from Ben Warren are fixed
2. The GPIO configuration is modified & Macro and Function are renamed.
Comments from Minkyu Kang are fixedChanges since V2

Changes since V2:
1. GPIO configurations function has been implemented.

Changes since V3:
1. Comments from Minkyu Kang are fixed.

 board/samsung/smdkc100/smdkc100.c |   39 +
 include/configs/smdkc100.h|   12 ++-
 2 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/board/samsung/smdkc100/smdkc100.c 
b/board/samsung/smdkc100/smdkc100.c
index 15a1a27..4fc802e 100644
--- a/board/samsung/smdkc100/smdkc100.c
+++ b/board/samsung/smdkc100/smdkc100.c
@@ -23,10 +23,40 @@
  */
 
 #include 
+#include 
+#include 
+#include 
+
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+static void smc9115_pre_init(void)
+{
+   u32 tmp;
+   u32 smc_bw_conf, smc_bc_conf;
+
+   struct s5pc100_gpio *const gpio =
+   (struct s5pc100_gpio *)S5PC100_GPIO_BASE;
+
+   /* gpio configuration GPK0CON */
+   gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));
+
+   /* Ethernet needs bus width of 16 bits */
+   smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
+   smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe)
+   | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
+   | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);
+
+   /* Select and configure the SROMC bank */
+   s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
+}
+
 int board_init(void)
 {
+   smc9115_pre_init();
+
gd->bd->bi_arch_number = MACH_TYPE_SMDKC100;
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
@@ -49,3 +79,12 @@ int checkboard(void)
return 0;
 }
 #endif
+
+int board_eth_init(bd_t *bis)
+{
+   int rc = 0;
+#ifdef CONFIG_SMC911X
+   rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+#endif
+   return rc;
+}
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index f12fea3..c8abad6 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -83,7 +83,6 @@
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
 #undef CONFIG_CMD_NAND
-#undef CONFIG_CMD_NET
 
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
@@ -235,4 +234,15 @@
 
 #define CONFIG_DOS_PARTITION   1
 
+/*
+ * Ethernet Contoller driver
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_NET_MULTI
+#define CONFIG_SMC911X 1   /* we have a SMC9115 on-board   */
+#define CONFIG_SMC911X_16_BIT  1   /* SMC911X_16_BIT Mode  */
+#define CONFIG_SMC911X_BASE0x98800300  /* SMC911X Drive Base   */
+#define CONFIG_ENV_SROM_BANK   3   /* Select SROM Bank-3 for Ethernet*/
+#endif /* CONFIG_CMD_NET */
+
 #endif /* __CONFIG_H */
-- 
1.6.6

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


[U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Anatolij Gustschin
The length of configured MTDPARTS_DEFAULT string
could be greather than console printbuffer size.
Check the lenght of the string before printing
to prevent U-Boot crashes.

Signed-off-by: Anatolij Gustschin 
---
 common/cmd_mtdparts.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 230e96e..d4cb194 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1254,6 +1254,14 @@ static void list_partitions(void)
printf("\ndefaults:\n");
printf("mtdids  : %s\n",
mtdids_default ? mtdids_default : "none");
+
+   /* Check to prevent printbuffer overflows */
+   if (mtdparts_default && strlen(mtdparts_default) > CONFIG_SYS_PBSIZE) {
+   puts("Warning: mtdparts too long,"
+" please increase CONFIG_SYS_PBSIZE\n");
+   return;
+   }
+
printf("mtdparts: %s\n",
mtdparts_default ? mtdparts_default : "none");
 }
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH 2/2] cmd_itest.c: fix pointer dereferencing

2010-02-23 Thread Detlev Zundel
Hi Frans,

> fix pointer dereferencing
> if the size is .b and .w an 8 or 16 bit access is done.
>
> Signed-off-by: Frans Meulenbroeks 

You could have included my previously given Acked-by.  But anyway:

Acked-by: Detlev Zundel 

> ---
>  common/cmd_itest.c |9 +++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/common/cmd_itest.c b/common/cmd_itest.c
> index 5b301bf..58c5e7b 100644
> --- a/common/cmd_itest.c
> +++ b/common/cmd_itest.c
> @@ -66,12 +66,17 @@ op_tbl_t op_table [] = {
>  
>  static long evalexp(char *s, int w)
>  {
> - long l, *p;
> + long l = 0;
> + long *p;
>  
>   /* if the parameter starts with a * then assume is a pointer to the 
> value we want */
>   if (s[0] == '*') {
>   p = (long *)simple_strtoul(&s[1], NULL, 16);
> - l = *p;
> + switch (w) {
> + case 1: return((long)(*(unsigned char *)p));
> + case 2: return((long)(*(unsigned short *)p));
> + case 4: return(*p);
> + }
>   } else {
>   l = simple_strtoul(s, NULL, 16);
>   }

-- 
It's like manually inflatable airbags -- people will never
think to use it in time to actually get any help from it.
 -- Miles Bader in <20030607122005.ga1...@gnu.org>
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Detlev Zundel
Hi Anatolij,

> The length of configured MTDPARTS_DEFAULT string
> could be greather than console printbuffer size.
> Check the lenght of the string before printing
> to prevent U-Boot crashes.
>
> Signed-off-by: Anatolij Gustschin 
> ---
>  common/cmd_mtdparts.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
> index 230e96e..d4cb194 100644
> --- a/common/cmd_mtdparts.c
> +++ b/common/cmd_mtdparts.c
> @@ -1254,6 +1254,14 @@ static void list_partitions(void)
>   printf("\ndefaults:\n");
>   printf("mtdids  : %s\n",
>   mtdids_default ? mtdids_default : "none");
> +
> + /* Check to prevent printbuffer overflows */
> + if (mtdparts_default && strlen(mtdparts_default) > CONFIG_SYS_PBSIZE) {
> + puts("Warning: mtdparts too long,"
> +  " please increase CONFIG_SYS_PBSIZE\n");
> + return;
> + }
> +
>   printf("mtdparts: %s\n",
>   mtdparts_default ? mtdparts_default : "none");
>  }

If I understand this correctly, then the real problem is the console
code crashing without a warning, correct?  If so, then please put such a
warning in the correct place instead of fixing the caller sites.

Thanks
  Detlev

-- 
Man sei weder unzufrieden mit sich selbst - denn das waere Kleinmut - noch
selbstzufrieden - denn das waere Dummheit.
--- Baltasar Gracian
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Wolfgang Denk
Dear Anatolij Gustschin,

In message <1266924140-14457-1-git-send-email-ag...@denx.de> you wrote:
> The length of configured MTDPARTS_DEFAULT string
> could be greather than console printbuffer size.
> Check the lenght of the string before printing
> to prevent U-Boot crashes.
> 
> Signed-off-by: Anatolij Gustschin 
> ---
>  common/cmd_mtdparts.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
> index 230e96e..d4cb194 100644
> --- a/common/cmd_mtdparts.c
> +++ b/common/cmd_mtdparts.c
> @@ -1254,6 +1254,14 @@ static void list_partitions(void)
>   printf("\ndefaults:\n");
>   printf("mtdids  : %s\n",
>   mtdids_default ? mtdids_default : "none");
> +
> + /* Check to prevent printbuffer overflows */
> + if (mtdparts_default && strlen(mtdparts_default) > CONFIG_SYS_PBSIZE) {
> + puts("Warning: mtdparts too long,"
> +  " please increase CONFIG_SYS_PBSIZE\n");
> + return;
> + }
> +

Instead of adding essentially dead code that does not really help the
end user, it would be better to avoid the potential problems. As log
as the console code has not been improved, it may make sense to avoid
printf() when you don't really need it.

I recommend to change this

>   printf("mtdparts: %s\n",
>   mtdparts_default ? mtdparts_default : "none");

into something like

puts("mtdparts: ");
puts(mtdparts_default ? mtdparts_default : "none");

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
"Unix is simple, but it takes a genius to understand the simplicity."
 - Dennis Ritchie
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Wolfgang Denk
Dear Detlev Zundel,

In message  you wrote:
> 
> > printf("mtdparts: %s\n",
> > mtdparts_default ? mtdparts_default : "none");
> >  }
> 
> If I understand this correctly, then the real problem is the console
> code crashing without a warning, correct?  If so, then please put such a

True.

> warning in the correct place instead of fixing the caller sites.

That's not exactly trivial, if you have a look at the code in
"common/console.c" - the printf code has no way to know the size of
the provided buffer.

OTOH it might make sense to use the (small, preconfigured) buffer only
before relocation, and then, when devices become available, switch to
a reasonably sized malloc()ed buffer - say 4 kB?   But then - this
just shifts the limits...

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Do you know about being with somebody? Wanting to be? If  I  had  the
whole  universe,  I'd  give it to you, Janice. When I see you, I feel
like I'm hungry all over. Do you know how that feels?
-- Charlie Evans, "Charlie X", stardate 1535.8
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Anatolij Gustschin
Hello Wolfgang,

Wolfgang Denk  wrote:

> > +   /* Check to prevent printbuffer overflows */
> > +   if (mtdparts_default && strlen(mtdparts_default) > CONFIG_SYS_PBSIZE) {
> > +   puts("Warning: mtdparts too long,"
> > +" please increase CONFIG_SYS_PBSIZE\n");
> > +   return;
> > +   }
> > +
> 
> Instead of adding essentially dead code that does not really help the
> end user, it would be better to avoid the potential problems. As log
> as the console code has not been improved, it may make sense to avoid
> printf() when you don't really need it.

This is indeed much better, thanks!

> I recommend to change this
> 
> > printf("mtdparts: %s\n",
> > mtdparts_default ? mtdparts_default : "none");
> 
> into something like
> 
>   puts("mtdparts: ");
>   puts(mtdparts_default ? mtdparts_default : "none");

I'll fix it as suggested, thanks!

Best regards,
Anatolij
--
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: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] EMAC failure and SPI support for TI DaVinci DM365

2010-02-23 Thread Ian Jeffray
Hi guys,

This question may be mostly directed to Sandeep Paulraj, the TI
tree maintainer, but is also observed in the mainline...

I've had great success with U-Boot on many ADI BF5xx devices, but I'm
having considerably less fun with the TI DM365.

I've a DM365EVM board - the stock U-Boot binary from the PSP 3.10
distribution from TI works ok, but has no SPI ('sf') support, so I
need to build that in for starters (ultimately we're designing a
custom board with only SPI flash - no NAND).

My problem is that even building the 2009.11 release, the current
mainline revision (ie 2010.02 prerelease), or the u-boot-ti mainline,
the EMAC fails and instantly reboots the board... with no mods made
to U-Boot... just a build out of the box fails this way:

git clone git://git.denx.de/u-boot-ti.git
cd u-boot-ti
make davinci_dm365evm_config
make

...then flash on to my board using the sfh_DM36x.exe utility with the
UBL from the PSP 3.10 distribution... and boot up...

  > DM36x initialization passed!
  > TI UBL Version: 1.50
  > Booting Catalog Boot Loader
  > BootMode = NAND
  > Starting NAND Copy...
  > Valid magicnum, 0xA1ACED66, found in block 0x001A.
  >DONE
  > Jumping to entry point at 0x8108.
  >
  > U-Boot 2009.11-00988-g2a6e256 (Feb 23 2010 - 13:50:13)
  >
  > I2C:   ready
  > DRAM:  128 MB
  > NAND:  2048 MiB
  > (snipped out lots of nand BBT details here from this email)
  > *** Warning - bad CRC or NAND, using default environment
  >
  > Net:
  > Hit any key to stop autoboot:  0
  > DM365 EVM # dhcp
  > DM36x initialization passed!
  > TI UBL Version: 1.50
  > Booting Catalog Boot Loader

As you can see, as soon as I "dhcp", the board is rebooting.  The same
happens if I set "ipaddr" and "netmask" then attempt a tftp or ping.

My expectation was that this stuff would work fine out of the box and
clearly isn't for me -- I hope this is just something I'm doing wrong
here and that someone is able to confirm that the code's kosher and
maybe pointers as to what I could have done wrong?

I do notice that the "Net: " line above has no further detail, wheras
the TI PSP binary version says "Ethernet PHY: GENERIC @ 0x00"
(I've not managed to get a 2009.03 build of my own to run on DM365
to compare yet... that's the version TI supplied as binary somehow)


My second question is about the DaVinci SPI flash support in U-Boot.
I've replaced the 64K SPI flash on the DM365EVM with a larger part,
which works just fine from my self-build Linux kernel, so I know the
device itself is fine.   All attempts to utilise this from U-Boot
are failing.   I realise the SPI DaVinci SPI flash driver is rather
new - wondering what the expectations of this driver are in terms of
stability and testing?


Many thanks for all the great work by everyone on the U-Boot project;
It's certainly been an invaluable asset for us on Blackfin and I hope
we'll be able to get it playing nicely on DaVinci too!

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


[U-Boot] [PATCH v2] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Anatolij Gustschin
The length of configured MTDPARTS_DEFAULT string
could be greater than console printbuffer size.
Replace printf() by puts() to avoid potential buffer
overflows.

Signed-off-by: Anatolij Gustschin 
---
Changes since v1:
 - use puts() instead of printf() as suggested by Wolfgang.

 common/cmd_mtdparts.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index b375fea..0fd5ce2 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1254,8 +1254,9 @@ static void list_partitions(void)
printf("\ndefaults:\n");
printf("mtdids  : %s\n",
mtdids_default ? mtdids_default : "none");
-   printf("mtdparts: %s\n",
-   mtdparts_default ? mtdparts_default : "none");
+   puts("mtdparts: ");
+   puts(mtdparts_default ? mtdparts_default : "none");
+   puts("\n");
 }
 
 /**
-- 
1.6.3.3

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


[U-Boot] [PATCH] ARM change name of defines for AT91 arm926ejs

2010-02-23 Thread Achim Ehrlich
  AT91_CPU_NAME to CONFIG_SYS_AT91_CPU_NAME
  AT91_MAIN_CLOCK to CONFIG_SYS_AT91_MAIN_CLOCK

Signed-off-by: Achim Ehrlich 
---
 board/atmel/at91cap9adk/at91cap9adk.c   |2 +-
 board/atmel/at91sam9261ek/at91sam9261ek.c   |2 +-
 board/atmel/at91sam9263ek/at91sam9263ek.c   |2 +-
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |2 +-
 board/atmel/at91sam9rlek/at91sam9rlek.c |2 +-
 board/esd/otc570/otc570.c   |2 +-
 board/ronetix/pm9261/pm9261.c   |2 +-
 board/ronetix/pm9263/pm9263.c   |2 +-
 cpu/arm926ejs/at91/clock.c  |2 +-
 cpu/arm926ejs/at91/cpu.c|8 
 include/asm-arm/arch-at91/at91cap9.h|2 +-
 include/asm-arm/arch-at91/at91rm9200.h  |2 +-
 include/asm-arm/arch-at91/at91sam9260.h |4 ++--
 include/asm-arm/arch-at91/at91sam9261.h |2 +-
 include/asm-arm/arch-at91/at91sam9263.h |2 +-
 include/asm-arm/arch-at91/at91sam9g45.h |2 +-
 include/asm-arm/arch-at91/at91sam9rl.h  |2 +-
 include/configs/afeb9260.h  |2 +-
 include/configs/at91cap9adk.h   |2 +-
 include/configs/at91sam9260ek.h |2 +-
 include/configs/at91sam9261ek.h |2 +-
 include/configs/at91sam9263ek.h |2 +-
 include/configs/at91sam9m10g45ek.h  |2 +-
 include/configs/at91sam9rlek.h  |2 +-
 include/configs/cpu9260.h   |2 +-
 include/configs/pm9261.h|4 ++--
 include/configs/pm9263.h|2 +-
 include/configs/sbc35_a9g20.h   |2 +-
 include/configs/tny_a9260.h |2 +-
 29 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/board/atmel/at91cap9adk/at91cap9adk.c 
b/board/atmel/at91cap9adk/at91cap9adk.c
index 9f73df6..258d1ea 100644
--- a/board/atmel/at91cap9adk/at91cap9adk.c
+++ b/board/atmel/at91cap9adk/at91cap9adk.c
@@ -282,7 +282,7 @@ void lcd_show_board_info(void)
lcd_printf ("(C) 2008 ATMEL Corp\n");
lcd_printf ("at91supp...@atmel.com\n");
lcd_printf ("%s CPU at %s MHz\n",
-   AT91_CPU_NAME,
+   CONFIG_SYS_AT91_CPU_NAME,
strmhz(temp, get_cpu_clk_rate()));
 
dram_size = 0;
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c 
b/board/atmel/at91sam9261ek/at91sam9261ek.c
index 7ead2b8..de5cfae 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -217,7 +217,7 @@ void lcd_show_board_info(void)
lcd_printf ("(C) 2008 ATMEL Corp\n");
lcd_printf ("at91supp...@atmel.com\n");
lcd_printf ("%s CPU at %s MHz\n",
-   AT91_CPU_NAME,
+   CONFIG_SYS_AT91_CPU_NAME,
strmhz(temp, get_cpu_clk_rate()));
 
dram_size = 0;
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c 
b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 8ab45af..5cd7aa7 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -218,7 +218,7 @@ void lcd_show_board_info(void)
lcd_printf ("(C) 2008 ATMEL Corp\n");
lcd_printf ("at91supp...@atmel.com\n");
lcd_printf ("%s CPU at %s MHz\n",
-   AT91_CPU_NAME,
+   CONFIG_SYS_AT91_CPU_NAME,
strmhz(temp, get_cpu_clk_rate()));
 
dram_size = 0;
diff --git a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c 
b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
index 45a14a9..edfb627 100644
--- a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
+++ b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
@@ -217,7 +217,7 @@ void lcd_show_board_info(void)
lcd_printf ("(C) 2008 ATMEL Corp\n");
lcd_printf ("at91supp...@atmel.com\n");
lcd_printf ("%s CPU at %s MHz\n",
-   AT91_CPU_NAME,
+   CONFIG_SYS_AT91_CPU_NAME,
strmhz(temp, get_cpu_clk_rate()));
 
dram_size = 0;
diff --git a/board/atmel/at91sam9rlek/at91sam9rlek.c 
b/board/atmel/at91sam9rlek/at91sam9rlek.c
index 7013ba2..e374917 100644
--- a/board/atmel/at91sam9rlek/at91sam9rlek.c
+++ b/board/atmel/at91sam9rlek/at91sam9rlek.c
@@ -157,7 +157,7 @@ void lcd_show_board_info(void)
lcd_printf ("(C) 2008 ATMEL Corp\n");
lcd_printf ("at91supp...@atmel.com\n");
lcd_printf ("%s CPU at %s MHz\n",
-   AT91_CPU_NAME,
+   CONFIG_SYS_AT91_CPU_NAME,
strmhz(temp, get_cpu_clk_rate()));
 
dram_size = 0;
diff --git a/board/esd/otc570/otc570.c b/board/esd/otc570/otc570.c
index 056df37..3fe28cb 100644
--- a/board/esd/otc570/otc570.c
+++ b/board/esd/otc570/otc570.c
@@ -219,7 +219,7 @@ void lcd_show_board_info(void)
nand_size += nand_info[i].size;
 
lcd_printf("\n%s\

[U-Boot] subcmd handling

2010-02-23 Thread Frans Meulenbroeks
It was hinted (iirc by Detlev) that I'd have a stab at subcmd handling
(at least for i2c).
As example bootm was suggested.
I've peeked at the bootm code and the code in command.c.
It seems bootm has some internal state engine, that is somewhat less
applicable for other commands.

My proposal for i2c:

have an array
static cmd_tbl_t cmd_i2c_sub[] = { };
whiich is populated/initialized  by U_BOOT_CMD_MKENT macro invocations
for the various subcommands.

The function do_i2c which now handles the subcmd parsing changes into:

int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
 cmd_tbl_t *c;

/* Strip off leading 'i2c' command argument */
argc--;
argv++;

c = find_cmd_tbl(argv[0], &cmd_i2c_sub[0], ARRAY_SIZE(cmd_i2c_sub));

if (c) {
   return  c->cmd(cmdtp, flag, argc, argv);
}
else
   {
   cmd_usage(cmdtp);
   return 0;

}
}

(and sorry for the messy layout)

A few questions before I actually implement and test this:

any comments on this proposal ?

What should be the return value in case the usage is printed? do_i2c
returns 0 in that case
however do_bootm_subcommand returns 1 in that case.

We might also consider putting the help texts in  U_BOOT_CMD_MKENT.
Then U_BOOT_CMD should probably be aware of the child commands and
should use the help of the child commands to print its help.

The first entry in  U_BOOT_CMD_MKENT is the name. This is stringified
by using a # in the macro.
Personally I would like to change it and have string quotes in the
macro invocation so that it is immediately visible when reading the
code that it is a string, not e.g. a variable.
E.g. we would get
 U_BOOT_CMD_MKENT("start", ...
instead of
 U_BOOT_CMD_MKENT(start, ...
what we have now where for the casual reader not up to date on the
definition of the macro it  might look as if a var is passed.
(btw passing a string could also allow for passing an empty string,
which could be used to add non-command assoicated help texts).

As I have no plans to implement this more than once,  I would
appreciate feedback before starting to actually code it.

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


Re: [U-Boot] [PATCH v2] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Stefan Roese
Hi Anatolij,

On Tuesday 23 February 2010 16:18:30 Anatolij Gustschin wrote:
> The length of configured MTDPARTS_DEFAULT string
> could be greater than console printbuffer size.
> Replace printf() by puts() to avoid potential buffer
> overflows.
> 
> Signed-off-by: Anatolij Gustschin 
> ---
> Changes since v1:
>  - use puts() instead of printf() as suggested by Wolfgang.
> 
>  common/cmd_mtdparts.c |5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
> index b375fea..0fd5ce2 100644
> --- a/common/cmd_mtdparts.c
> +++ b/common/cmd_mtdparts.c
> @@ -1254,8 +1254,9 @@ static void list_partitions(void)
>   printf("\ndefaults:\n");
>   printf("mtdids  : %s\n",
>   mtdids_default ? mtdids_default : "none");
> - printf("mtdparts: %s\n",
> - mtdparts_default ? mtdparts_default : "none");
> + puts("mtdparts: ");
> + puts(mtdparts_default ? mtdparts_default : "none");
> + puts("\n");

It might make sense to add a comment here, describing why you use these puts() 
calls instead of one printf(). Otherwise somebody else might trip into this 
problem again in a later time.

Cheers,
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: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-ti/master

2010-02-23 Thread Tom
Paulraj, Sandeep wrote:
> Tom,
> 
>> The following changes since commit
>> 77e7273c40315abd2f3c17ad8d46a78950e3e65f:
>>   Jens Scharsig (1):
>> new board (eb_cpux9k2)
>>
>> are available in the git repository at:
>>
>>   git://git.denx.de/u-boot-ti.git master
>>
>> Ladislav Michl (8):
>>   NetStar: eeprom - undefined reference to `memset'
>>   NetStar: eeprom - be less verbose
>>   NetStar: eeprom - fix linker error
>>   NetStar: fix default environment
>>   NetStar: make mtdparts default ready for recent kernels
> You have already pulled in the 5 patches above. I thought I'd let you know.

Yes. I have these.

> 
>>   netstar.h: do not exceed 80 columns
>>   VoiceBlue: limit line lenght to 80 characters
>>   VoiceBlue: fix linker errors

I did not see a public ack for this one.

>>
>> Nick Thompson (1):
>>   da830evm: Add support for TI EMAC

Should this go through NET ?

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


Re: [U-Boot] Please pull u-boot-ti/master

2010-02-23 Thread Paulraj, Sandeep


> -Original Message-
> From: Tom [mailto:tom@windriver.com]
> Sent: Tuesday, February 23, 2010 10:55 AM
> To: Paulraj, Sandeep
> Cc: u-boot@lists.denx.de; Ben Warren
> Subject: Re: [U-Boot] Please pull u-boot-ti/master
> 
> Paulraj, Sandeep wrote:
> > Tom,
> >
> >> The following changes since commit
> >> 77e7273c40315abd2f3c17ad8d46a78950e3e65f:
> >>   Jens Scharsig (1):
> >> new board (eb_cpux9k2)
> >>
> >> are available in the git repository at:
> >>
> >>   git://git.denx.de/u-boot-ti.git master
> >>
> >> Ladislav Michl (8):
> >>   NetStar: eeprom - undefined reference to `memset'
> >>   NetStar: eeprom - be less verbose
> >>   NetStar: eeprom - fix linker error
> >>   NetStar: fix default environment
> >>   NetStar: make mtdparts default ready for recent kernels
> > You have already pulled in the 5 patches above. I thought I'd let you
> know.
> 
> Yes. I have these.
> 
> >
> >>   netstar.h: do not exceed 80 columns
> >>   VoiceBlue: limit line lenght to 80 characters
> >>   VoiceBlue: fix linker errors
> 
> I did not see a public ack for this one.

 http://lists.denx.de/pipermail/u-boot/2010-February/067840.html

I did so for the other as well I believe.
> >>
> >> Nick Thompson (1):
> >>   da830evm: Add support for TI EMAC
> 
> Should this go through NET ?

This does not add the driver. That patch was ACK'ed by Ben long ago.
This patch just does the PINMUX init and invokes the driver.

> 
> Tom

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


Re: [U-Boot] [PATCH v2] OMAP3: workaround for ARM Cortex-A8 erratum 725233

2010-02-23 Thread Tom
Siarhei Siamashka wrote:
> 725233: PLD instructions executed with PLD data forwarding
> enabled can result in a processor deadlock
> 
> This deadlock can happen when NEON load instructions are used together
> with cache preload instructions (PLD). The problematic conditions
> can be triggered in-the-wild by NEON optimized functions from pixman
> library (http://cgit.freedesktop.org/pixman), which perform dynamic
> adjustment of prefetch distance.
> 
> The workaround disables PLD data forwarding by setting PLD_FWD bit
> in L2 Cache Auxiliary Control Register as recommended in ARM Cortex-A8
> errata list.
> 
> The deadlock can only happen on r1pX revisions of Cortex-A8 (used in
> OMAP34xx/OMAP35xx). Performance impact of the workaround is practically
> non-existant.
> 
> Signed-off-by: Siarhei Siamashka 

Thank you for the improvements on the comment.
Ack-ed.

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


Re: [U-Boot] Please pull u-boot-ti/master

2010-02-23 Thread Tom
Paulraj, Sandeep wrote:
> 
>> -Original Message-
>> From: Tom [mailto:tom@windriver.com]
>> Sent: Tuesday, February 23, 2010 10:55 AM
>> To: Paulraj, Sandeep
>> Cc: u-boot@lists.denx.de; Ben Warren
>> Subject: Re: [U-Boot] Please pull u-boot-ti/master
>>
>> Paulraj, Sandeep wrote:
>>> Tom,
>>>
 The following changes since commit
 77e7273c40315abd2f3c17ad8d46a78950e3e65f:
   Jens Scharsig (1):
 new board (eb_cpux9k2)

 are available in the git repository at:

   git://git.denx.de/u-boot-ti.git master

 Ladislav Michl (8):
   NetStar: eeprom - undefined reference to `memset'
   NetStar: eeprom - be less verbose
   NetStar: eeprom - fix linker error
   NetStar: fix default environment
   NetStar: make mtdparts default ready for recent kernels
>>> You have already pulled in the 5 patches above. I thought I'd let you
>> know.
>>
>> Yes. I have these.
>>
   netstar.h: do not exceed 80 columns
   VoiceBlue: limit line lenght to 80 characters
   VoiceBlue: fix linker errors
>> I did not see a public ack for this one.
> 
>  http://lists.denx.de/pipermail/u-boot/2010-February/067840.html
> 
> I did so for the other as well I believe.

I believe i did not see the linker one.
Just checking..
Ok
 Nick Thompson (1):
   da830evm: Add support for TI EMAC
>> Should this go through NET ?
> 
> This does not add the driver. That patch was ACK'ed by Ben long ago.
> This patch just does the PINMUX init and invokes the driver.
> 

Ok

>> Tom
> 
> Sandeep

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


Re: [U-Boot] EMAC failure and SPI support for TI DaVinci DM365

2010-02-23 Thread Paulraj, Sandeep


> Subject: [U-Boot] EMAC failure and SPI support for TI DaVinci DM365
> 
> Hi guys,
> 
> This question may be mostly directed to Sandeep Paulraj, the TI
> tree maintainer, but is also observed in the mainline...
> 
> I've had great success with U-Boot on many ADI BF5xx devices, but I'm
> having considerably less fun with the TI DM365.
> 
> I've a DM365EVM board - the stock U-Boot binary from the PSP 3.10
> distribution from TI works ok, but has no SPI ('sf') support, so I
> need to build that in for starters (ultimately we're designing a
> custom board with only SPI flash - no NAND).
> 
> My problem is that even building the 2009.11 release, the current
> mainline revision (ie 2010.02 prerelease), or the u-boot-ti mainline,
> the EMAC fails and instantly reboots the board... with no mods made
> to U-Boot... just a build out of the box fails this way:
> 
> git clone git://git.denx.de/u-boot-ti.git
> cd u-boot-ti
> make davinci_dm365evm_config
> make
> 
> ...then flash on to my board using the sfh_DM36x.exe utility with the
> UBL from the PSP 3.10 distribution... and boot up...
> 
>   > DM36x initialization passed!
>   > TI UBL Version: 1.50
>   > Booting Catalog Boot Loader
>   > BootMode = NAND
>   > Starting NAND Copy...
>   > Valid magicnum, 0xA1ACED66, found in block 0x001A.
>   >DONE
>   > Jumping to entry point at 0x8108.
>   >
>   > U-Boot 2009.11-00988-g2a6e256 (Feb 23 2010 - 13:50:13)
>   >
>   > I2C:   ready
>   > DRAM:  128 MB
>   > NAND:  2048 MiB
>   > (snipped out lots of nand BBT details here from this email)
>   > *** Warning - bad CRC or NAND, using default environment
>   >
>   > Net:
>   > Hit any key to stop autoboot:  0
>   > DM365 EVM # dhcp
>   > DM36x initialization passed!
>   > TI UBL Version: 1.50
>   > Booting Catalog Boot Loader
> 
> As you can see, as soon as I "dhcp", the board is rebooting.  The same
> happens if I set "ipaddr" and "netmask" then attempt a tftp or ping.


I checked this feature some days back after I rebased with Wolfgang. 

And this is the dump
DM36x initialization passed!
TI UBL Version: 1.50
Booting Catalog Boot Loader
BootMode = NAND
Starting NAND Copy...
Valid magicnum, 0xA1ACED66, found in block 0x0019.
   DONE
Jumping to entry point at 0x8108.


U-Boot 2009.11-00406-ga85c80c-dirty (Feb 17 2010 - 20:42:42)

I2C:   ready
DRAM:  128 MB
NAND:  2048 MiB
Bad block table found at page 524224, version 0x01
Bad block table found at page 1048512, version 0x01
Bad block table found at page 524160, version 0x01
Bad block table found at page 1048448, version 0x01
nand_read_bbt: Bad block at 0x0010
nand_read_bbt: Bad block at 0x0036

many more of these I just removed them.. . BTW there is nothing wrong with 
these messages.

Net:   Ethernet PHY: GENERIC @ 0x01

Hit any key to stop autoboot:  0
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
*** Unhandled DHCP Option in OFFER/ACK: 150
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
*** Unhandled DHCP Option in OFFER/ACK: 150
DHCP client bound to address 158.218.100.176
Using  device
TFTP from server 158.218.100.23; our IP address is 158.218.100.176
Filename 'uImage-git-dm365'.
Load address: 0x8070
Loading: #
 ###
done
Bytes transferred = 1523356 (173e9c hex)
## Booting kernel from Legacy Image at 8070 ...
   Image Name:   Linux-2.6.33-rc4-06989-g887f8d1-
   Created:  2010-01-27  21:11:35 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:1523292 Bytes =  1.5 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.33-rc4-06989-g887f8d1-dirty (a0866...@gt5d9d821.telogy.design.
ti.com) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #7 PREEMPT Wed Jan 2
7 16:11:26 EST 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: DaVinci DM365 EVM
Memory policy: ECC disabled, Data cache writeback
DaVinci dm365_rev1.2 variant 0x8

And then I get to the kernel prompt

> 
> My expectation was that this stuff would work fine out of the box and
> clearly isn't for me -- I hope this is just something I'm doing wrong
> here and that someone is able to confirm that the code's kosher and
> maybe pointers as to what I could have done wrong?
This is your custom board correct. I am using the Spectrum Digital DM365 EVM
> 
> I do notice that the "Net: " line above has no further detail, wheras
> the TI PSP binary version says "Ethernet PHY: GENERIC @ 0x00"
> (I've not managed to get a 2009.03 build of my own to run on DM365
> to compare yet... that's the version TI supplied as binary somehow)
The other issue might be the updates tot eh EMAC driver. The 

[U-Boot] [STATUS] Release on hold, wait for i.MX custodian

2010-02-23 Thread Wolfgang Denk
Hi,

this is to let you know that Freescale has informed me that they will
appoint a custodian for the Freescale ARM processors Really Soon Now.
I would like to give him a chance to introduce himself here and get
some overview of the open i.MX patches that are supposed to go into
this release, which I hope will be acchieved before the end of this
week.

Until then, I will continue to work on fixes and process pull
requests, but otherwise hold the release so the i.MX stuff can go in
before we have -rc1 out.

Thanks for your patience.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
"An open mind has but one disadvantage: it collects dirt."
- a saying at RPI
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM change name of defines for AT91 arm926ejs

2010-02-23 Thread Tom
Achim Ehrlich wrote:
>   AT91_CPU_NAME to CONFIG_SYS_AT91_CPU_NAME
>   AT91_MAIN_CLOCK to CONFIG_SYS_AT91_MAIN_CLOCK
> 

Please expand the comment to explain why this change is necessary.
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Problem executing hello world as specified on wiki

2010-02-23 Thread Wolfgang Denk
Dear Vipul Jain,

please do not top post / full quote. Please read
http://www.netmeister.org/news/learn2quote.html

Please always post plain text only, no HTML ever.

And please keep the mailing list on Cc:

In message  you 
wrote:
>
> when I captured the make output for u-boot which as part of buildiing
> u=boot.bin also builds standalone examples, this is what I noticed.
> 
> arm-linux-ld -g -Ttext 0xc10 \
> -o hello_world -e hello_world hello_world.o libstubs.a \

OK, so you know your text address is 0xc10.

> In lib_arm/config.mk I could see code that says
...
> ifeq ($(BOARD),omap2420h4)
> STANDALONE_LOAD_ADDR = 0x8030
> else
> ifeq ($(SOC),omap3)
> STANDALONE_LOAD_ADDR = 0x8030
> else
> STANDALONE_LOAD_ADDR = 0xc10
> endif
> endif

Here you can see where the number above is actually coming from.

> Do I need to add one more case here specifically for EDB9203 board. if yes,
> can you please suggest

Why would you want to do that? What makes you think 0xc10 would
not be a suitable address for your system?

In previous postings you showed that you were able to TFTP your image
to this address just fine.

In those examples you downloaded the ELF image, but we explained you
that this does not work with the "go" ommand, and that you have to use
the binary image (.bin) instead - as documented.

You also tried to start it right at the download address, but I also
pointed you to the entry in the FAQ which explains that the actual
entry point address might be elsewhere, and how you can find it.

Did you read this documentation? Did you attempt to try following the
many hints you received?

If you got stuck on that way then please feel free to ask again (on
the list), but please show that you at least attempted to do what you
have been told.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Q:  Do you know what the death rate around here is?
A:  One per person.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-ti/master

2010-02-23 Thread Tom
Paulraj, Sandeep wrote:
> Tom,
> 
>> The following changes since commit
>> 77e7273c40315abd2f3c17ad8d46a78950e3e65f:
>>   Jens Scharsig (1):
>> new board (eb_cpux9k2)
>>
>> are available in the git repository at:
>>
>>   git://git.denx.de/u-boot-ti.git master
>>
>> Ladislav Michl (8):
>>   NetStar: eeprom - undefined reference to `memset'
>>   NetStar: eeprom - be less verbose
>>   NetStar: eeprom - fix linker error
>>   NetStar: fix default environment
>>   NetStar: make mtdparts default ready for recent kernels
> You have already pulled in the 5 patches above. I thought I'd let you know.
> 
>>   netstar.h: do not exceed 80 columns
>>   VoiceBlue: limit line lenght to 80 characters
>>   VoiceBlue: fix linker errors
>>
>> Nick Thompson (1):
>>   da830evm: Add support for TI EMAC
>>
>> Sandeep Paulraj (1):
>>   DaVinci: Adding entry to MAKEALL for DM365 EVM
>>
>>  MAKEALL  |1 +
>>  board/davinci/da830evm/da830evm.c|   65 +++-
>>  board/netstar/Makefile   |   54 +-
>>  board/netstar/eeprom.c   |   95 +
>>  board/netstar/eeprom.lds |   51 -
>>  board/netstar/eeprom_start.S |   13 ---
>>  board/voiceblue/Makefile |   33 +++---
>>  board/voiceblue/eeprom.c |   97 +
>>  board/voiceblue/eeprom.lds   |   51 -
>>  board/voiceblue/eeprom_start.S   |   11 --
>>  include/asm-arm/arch-davinci/emac_defs.h |1 +
>>  include/configs/da830evm.h   |1 +
>>  include/configs/netstar.h|  114 ++---
>>  include/configs/voiceblue.h  |  168 +++--
>> -
>>  14 files changed, 343 insertions(+), 412 deletions(-)
>>  delete mode 100644 board/netstar/eeprom.lds
>>  delete mode 100644 board/netstar/eeprom_start.S
>>  delete mode 100644 board/voiceblue/eeprom.lds
>>  delete mode 100644 board/voiceblue/eeprom_start.S
> 
> Regards,
> Sandeep
> 
Applied,
Thanks
Tom

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


Re: [U-Boot] EMAC failure and SPI support for TI DaVinci DM365

2010-02-23 Thread Ian Jeffray
Hi Sandeep,

You wrote:
> I checked this feature some days back after I rebased with Wolfgang.
[snip]
> Net:   Ethernet PHY: GENERIC @ 0x01

Well it's good to know that it must be something wrong with my
tools or my board :-)

>> My expectation was that this stuff would work fine out of the box and
>> clearly isn't for me -- I hope this is just something I'm doing wrong
>> here and that someone is able to confirm that the code's kosher and
>> maybe pointers as to what I could have done wrong?
> This is your custom board correct. I am using the Spectrum Digital DM365 EVM

No; I don't have a custom board (yet) - I'm also using the DM365EVM...
which was why I was hoping things would "just work" out of the box.

I guess I'll have to try and debug around the network code directly...
to find out why the "Ethernet PHY:" part isn't being displayed.

Thanks for the dump - it's always really useful to compare output
against a working system!


>> I do notice that the "Net: " line above has no further detail, wheras
>> the TI PSP binary version says "Ethernet PHY: GENERIC @ 0x00"
>> (I've not managed to get a 2009.03 build of my own to run on DM365
>> to compare yet... that's the version TI supplied as binary somehow)
> The other issue might be the updates tot eh EMAC driver. The version that 
> finally was accepted by Ben was submitted by Nick Thompson. It worked fine 
> for me but I'm not sure if something small was missed.
>
> Maybe you can compare the driver that TI release as part of PSP 3.01 and what 
> is there in u-boot at the moment.
> I'll do so myself as soon as I get some free cycles.

That's what I want to do but I guess I must be myopic... I can't
see or find the U-Boot sources in the PSP.   I'll look again.


(Re SPI flash)
> I have not tried SPI FLASH from U-boot myself. I have tried SPI with flash in 
> the kernel.
>
> Did you do all the necessary PINMUX?

Aha! No. I didn't realise I would need to do that myself.  My fault
there then.  I'll investigate this.  Thanks for the pointer!

 > The TI engineer who did the SPI driver for U-boot must have only
 > tested on OMAP L chips. The SPI IP is similar but not same.

A little worrysome ;)   Maybe Davinci SPI support in U-Boot isn't
very well fledged and tested just now - something for me to work on.


Regards,

Ian.



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


[U-Boot] [PATCH] ppc4xx: Corrected EBC register bit definitions

2010-02-23 Thread Eugene O'Brien

Corrected the bit field positions of the external master priority low
and the external master priority high values in the EBC configuration
register.

Signed-off-by: Eugene O'Brien 
---
 include/asm-ppc/ppc4xx-ebc.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/asm-ppc/ppc4xx-ebc.h b/include/asm-ppc/ppc4xx-ebc.h
index 9680f70..697a916 100644
--- a/include/asm-ppc/ppc4xx-ebc.h
+++ b/include/asm-ppc/ppc4xx-ebc.h
@@ -143,10 +143,10 @@
 #define EBC_CFG_EBTC_MASK  PPC_REG_VAL(0, 0x1)
 #define EBC_CFG_EBTC_HIPPC_REG_VAL(0, 0x0)
 #define EBC_CFG_EBTC_DRIVENPPC_REG_VAL(0, 0x1)
-#define EBC_CFG_EMPH_MASK  PPC_REG_VAL(6, 0x3)
-#define EBC_CFG_EMPH_ENCODE(n) PPC_REG_VAL(6, (static_cast(u32, n)) &
0x3)
-#define EBC_CFG_EMPL_MASK  PPC_REG_VAL(8, 0x3)
-#define EBC_CFG_EMPL_ENCODE(n) PPC_REG_VAL(8, (static_cast(u32, n)) &
0x3)
+#define EBC_CFG_EMPL_MASK  PPC_REG_VAL(6, 0x3)
+#define EBC_CFG_EMPL_ENCODE(n) PPC_REG_VAL(6, (static_cast(u32, n)) &
0x3)
+#define EBC_CFG_EMPH_MASK  PPC_REG_VAL(8, 0x3)
+#define EBC_CFG_EMPH_ENCODE(n) PPC_REG_VAL(8, (static_cast(u32, n)) &
0x3)
 #define EBC_CFG_CSTC_MASK  PPC_REG_VAL(9, 0x1)
 #define EBC_CFG_CSTC_HIPPC_REG_VAL(9, 0x0)
 #define EBC_CFG_CSTC_DRIVENPPC_REG_VAL(9, 0x1)
-- 
1.7.0.rc1.10.gb8bb

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


[U-Boot] [PATCH 1/2] ep93xx: Fix calculation of sys ticks in clk_to_systicks()

2010-02-23 Thread Matthias Kaehlcke
ep93xx: Use unsigned long long for calculation of sys ticks in clk_to_systicks()
for proper handling of large intermediate values

Signed-off-by: Matthias Kaehlcke 
---
 cpu/arm920t/ep93xx/timer.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c
index 6d969d9..98c759c 100644
--- a/cpu/arm920t/ep93xx/timer.c
+++ b/cpu/arm920t/ep93xx/timer.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define TIMER_CLKSEL   (1 << 3)
 #define TIMER_MODE (1 << 6)
@@ -44,9 +45,10 @@ static ulong lastdec;
 
 static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
 {
-   unsigned long sys_ticks = (clk_ticks * CONFIG_SYS_HZ) / TIMER_FREQ;
+   unsigned long long sys_ticks = (clk_ticks * CONFIG_SYS_HZ);
+   do_div(sys_ticks, TIMER_FREQ);
 
-   return sys_ticks;
+   return (unsigned long)sys_ticks;
 }
 
 static inline unsigned long usecs_to_ticks(unsigned long usecs)
-- 
1.6.5

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


[U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code

2010-02-23 Thread Matthias Kaehlcke
ep93xx: Refactoring of the timer code, including the following changes

 * use a free running timer instead of a periodical one
 * use unsigned long long for total number of ticks
 * hold the timer state in a structure instead of separate variables
 * increment the timer counter instead of decrementing it
 * remove unused function udelay_masked()
 * remove unused function set_timer()

Signed-off-by: Matthias Kaehlcke 
---
 cpu/arm920t/ep93xx/timer.c |   71 ---
 1 files changed, 27 insertions(+), 44 deletions(-)

diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c
index 98c759c..84bdb12 100644
--- a/cpu/arm920t/ep93xx/timer.c
+++ b/cpu/arm920t/ep93xx/timer.c
@@ -34,16 +34,19 @@
 #include 
 
 #define TIMER_CLKSEL   (1 << 3)
-#define TIMER_MODE (1 << 6)
 #define TIMER_ENABLE   (1 << 7)
 
-#define TIMER_FREQ 508469
-#define TIMER_LOAD_VAL (TIMER_FREQ / CONFIG_SYS_HZ)
+#define TIMER_FREQ 508469
+#define CLK_TICKS_PER_SYS_TICK (TIMER_FREQ / CONFIG_SYS_HZ)
+#define TIMER_MAX_VAL  0x
 
-static ulong timestamp;
-static ulong lastdec;
+static struct ep93xx_timer
+{
+   unsigned long long ticks;
+   unsigned long last_update;
+} timer;
 
-static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
+static inline unsigned long clk_to_systicks(unsigned long long clk_ticks)
 {
unsigned long long sys_ticks = (clk_ticks * CONFIG_SYS_HZ);
do_div(sys_ticks, TIMER_FREQ);
@@ -57,10 +60,10 @@ static inline unsigned long usecs_to_ticks(unsigned long 
usecs)
 
if (usecs >= 1000) {
ticks = usecs / 1000;
-   ticks *= (TIMER_LOAD_VAL * CONFIG_SYS_HZ);
+   ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
ticks /= 1000;
} else {
-   ticks = usecs * TIMER_LOAD_VAL * CONFIG_SYS_HZ;
+   ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;
ticks /= (1000 * 1000);
}
 
@@ -71,7 +74,7 @@ static inline unsigned long read_timer(void)
 {
struct timer_regs *timer = (struct timer_regs *)TIMER_BASE;
 
-   return readl(&timer->timer3.value);
+   return TIMER_MAX_VAL - readl(&timer->timer3.value);
 }
 
 /*
@@ -81,17 +84,15 @@ unsigned long long get_ticks(void)
 {
const unsigned long now = read_timer();
 
-   if (lastdec >= now) {
-   /* normal mode */
-   timestamp += lastdec - now;
-   } else {
-   /* we have an overflow ... */
-   timestamp += lastdec + TIMER_LOAD_VAL - now;
-   }
+   if (now >= timer.last_update)
+   timer.ticks += now - timer.last_update;
+   else
+   /* an overflow occurred */
+   timer.ticks += TIMER_MAX_VAL - timer.last_update + now;
 
-   lastdec = now;
+   timer.last_update = now;
 
-   return timestamp;
+   return timer.ticks;
 }
 
 unsigned long get_timer_masked(void)
@@ -106,8 +107,8 @@ unsigned long get_timer(unsigned long base)
 
 void reset_timer_masked(void)
 {
-   lastdec = read_timer();
-   timestamp = 0;
+   timer.last_update = read_timer();
+   timer.ticks = 0;
 }
 
 void reset_timer(void)
@@ -115,28 +116,11 @@ void reset_timer(void)
reset_timer_masked();
 }
 
-void set_timer(unsigned long t)
-{
-   timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
-   const unsigned long ticks = usecs_to_ticks(usec);
-   const unsigned long target = clk_to_systicks(ticks) + get_timer(0);
-
-   while (get_timer_masked() < target)
-   /* noop */;
-}
-
-void udelay_masked(unsigned long usec)
-{
-   const unsigned long ticks = usecs_to_ticks(usec);
-   const unsigned long target = clk_to_systicks(ticks) + get_timer(0);
-
-   reset_timer_masked();
+   const unsigned long target = get_ticks() + usecs_to_ticks(usec);
 
-   while (get_timer_masked() < target)
+   while (get_ticks() < target)
/* noop */;
 }
 
@@ -147,12 +131,11 @@ int timer_init(void)
/* use timer 3 with 508KHz and free running */
writel(TIMER_CLKSEL, &timer->timer3.control);
 
-   /* auto load, manual update of Timer 3 */
-   lastdec = TIMER_LOAD_VAL;
-   writel(TIMER_LOAD_VAL, &timer->timer3.load);
+   /* set initial timer value 3 */
+   writel(TIMER_MAX_VAL, &timer->timer3.load);
 
-   /* Enable the timer and periodic mode */
-   writel(TIMER_ENABLE | TIMER_MODE | TIMER_CLKSEL,
+   /* Enable the timer */
+   writel(TIMER_ENABLE | TIMER_CLKSEL,
&timer->timer3.control);
 
reset_timer_masked();
-- 
1.6.5

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


Re: [U-Boot] [PATCH] ppc4xx: Corrected EBC register bit definitions

2010-02-23 Thread Wolfgang Denk
Dear "Eugene O'Brien",

In message <8b3930fea8618c44b48eb06b5d33a06e01cce...@satmail.advantech.ca> you 
wrote:
> 
> Corrected the bit field positions of the external master priority low
> and the external master priority high values in the EBC configuration
> register.
> 
> Signed-off-by: Eugene O'Brien 
> ---
>  include/asm-ppc/ppc4xx-ebc.h |8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/asm-ppc/ppc4xx-ebc.h b/include/asm-ppc/ppc4xx-ebc.h
> index 9680f70..697a916 100644
> --- a/include/asm-ppc/ppc4xx-ebc.h
> +++ b/include/asm-ppc/ppc4xx-ebc.h
> @@ -143,10 +143,10 @@
>  #define EBC_CFG_EBTC_MASKPPC_REG_VAL(0, 0x1)
>  #define EBC_CFG_EBTC_HI  PPC_REG_VAL(0, 0x0)
>  #define EBC_CFG_EBTC_DRIVEN  PPC_REG_VAL(0, 0x1)
> -#define EBC_CFG_EMPH_MASKPPC_REG_VAL(6, 0x3)
> -#define EBC_CFG_EMPH_ENCODE(n)   PPC_REG_VAL(6, (static_cast(u32, n)) &
> 0x3)

Your patch is line-wrapped.

Please use git-send-email to send patches, or fix your mailer
configuration.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
All I ask is a chance to prove that money can't make me happy.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] edb93xx: Fix SDRAM initialization

2010-02-23 Thread Matthias Kaehlcke
edb93xx: Fix SDRAM initialization by issuing a precharge all command before
forcing the precharge and select mode register update mode before programming
the mode registers. Write to the SDRAM banks in order to force a precharge,
reading causes the edb93xx boards to hang

Signed-off-by: Matthias Kaehlcke 
---
 board/edb93xx/sdram_cfg.c |   40 
 1 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/board/edb93xx/sdram_cfg.c b/board/edb93xx/sdram_cfg.c
index 6155f0e..5070744 100644
--- a/board/edb93xx/sdram_cfg.c
+++ b/board/edb93xx/sdram_cfg.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2009 Matthias Kaehlcke 
+ * Copyright (C) 2010, 2009
+ * Matthias Kaehlcke 
  *
  * Copyright (C) 2006 Dominic Rath 
  *
@@ -30,9 +31,9 @@
(SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank | SDRAM_MODE_REG_VAL))
 
 #define PRECHARGE_BANK(bank)   (*(volatile uint32_t *) \
-   (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank))
+   (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank)) = 0
 
-static void force_precharge(void);
+static void precharge_all_banks(void);
 static void setup_refresh_timer(void);
 static void program_mode_registers(void);
 
@@ -47,7 +48,7 @@ void sdram_cfg(void)
 
early_udelay(200);
 
-   force_precharge();
+   precharge_all_banks();
 
setup_refresh_timer();
 
@@ -57,19 +58,37 @@ void sdram_cfg(void)
writel(GLCONFIG_CKE, &sdram->glconfig);
 }
 
-static void force_precharge(void)
+static void precharge_all_banks(void)
 {
+   struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+   /* Issue PRECHARGE ALL commands */
+   writel(GLCONFIG_INIT | GLCONFIG_CKE, &sdram->glconfig);
+
/*
-* Errata most EP93xx revisions say that PRECHARGE ALL isn't always
-* issued.
+* Errata of most EP93xx revisions say that PRECHARGE ALL isn't always
+* issued
 *
-* Do a read from each bank to make sure they're precharged
+* Cirrus proposes a workaround which consists in performing a read from
+* each bank to force the precharge. This causes some boards to hang.
+* Writing to the SDRAM banks instead of reading has the same
+* side-effect (the SDRAM controller issues the necessary precharges),
+* but is known to work on all supported boards
 */
 
PRECHARGE_BANK(0);
+
+#if (CONFIG_NR_DRAM_BANKS >= 2)
PRECHARGE_BANK(1);
+#endif
+
+#if (CONFIG_NR_DRAM_BANKS >= 3)
PRECHARGE_BANK(2);
+#endif
+
+#if (CONFIG_NR_DRAM_BANKS == 4)
PRECHARGE_BANK(3);
+#endif
 }
 
 static void setup_refresh_timer(void)
@@ -101,6 +120,11 @@ static void setup_refresh_timer(void)
 
 static void program_mode_registers(void)
 {
+   struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+   /* Select mode register update mode */
+   writel(GLCONFIG_MRS | GLCONFIG_CKE, &sdram->glconfig);
+
/*
 * The mode registers are programmed by performing a read from each
 * SDRAM bank. The value of the address that is read defines the value
-- 
1.6.5

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


Re: [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code

2010-02-23 Thread Wolfgang Denk
Dear Matthias Kaehlcke,

In message <20100223220421.gk20...@darwin> you wrote:
> ep93xx: Refactoring of the timer code, including the following changes
...
> +#define TIMER_FREQ   508469
> +#define CLK_TICKS_PER_SYS_TICK   (TIMER_FREQ / CONFIG_SYS_HZ)
...
> + ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
...
> + ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;

Why don't you use

ticks *= TIMER_FREQ;
resp.
ticks = usecs * TIMER_FREQ;

The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad
NO-OP (with rounding errors).

Hm... re-reading the optimized code makes me wonder if the variable
really should be called "ticks" - looks more as a frequency to me?


Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
If it went on at this rate, in several billion  years  he'd  be  rich
beyond his wildest dreams!- Terry Pratchett, _Soul Music_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/6] mpc512x: make MEM IO Control configuration a board config option

2010-02-23 Thread Anatolij Gustschin
Signed-off-by: Anatolij Gustschin 
---
 cpu/mpc512x/fixed_sdram.c|2 +-
 include/asm-ppc/immap_512x.h |4 
 include/configs/aria.h   |2 ++
 include/configs/mecp5123.h   |2 ++
 include/configs/mpc5121ads.h |2 ++
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/cpu/mpc512x/fixed_sdram.c b/cpu/mpc512x/fixed_sdram.c
index 442b5fc..72d524c 100644
--- a/cpu/mpc512x/fixed_sdram.c
+++ b/cpu/mpc512x/fixed_sdram.c
@@ -91,7 +91,7 @@ long int fixed_sdram(ddr512x_config_t *mddrc_config,
}
 
/* Initialize IO Control */
-   out_be32(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+   out_be32(&im->io_ctrl.io_control_mem, CONFIG_SYS_IOCTRL_MUX_DDR);
 
/* Initialize DDR Local Window */
out_be32(&im->sysconf.ddrlaw.bar, CONFIG_SYS_DDR_BASE & 0xF000);
diff --git a/include/asm-ppc/immap_512x.h b/include/asm-ppc/immap_512x.h
index 95350fd..1dc47e5 100644
--- a/include/asm-ppc/immap_512x.h
+++ b/include/asm-ppc/immap_512x.h
@@ -848,10 +848,6 @@ typedef struct ioctrl512x {
u8  reserved[0x0cfc];   /* fill to 4096 bytes size */
 } ioctrl512x_t;
 
-/* Indexes in regs array */
-/* Set for DDR */
-#define IOCTRL_MUX_DDR 0x0036
-
 /* IO pin fields */
 #define IO_PIN_FMUX(v) ((v) << 7)  /* pin function */
 #define IO_PIN_HOLD(v) ((v) << 5)  /* hold time, pci only */
diff --git a/include/configs/aria.h b/include/configs/aria.h
index f89fc57..a73c0c7 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -79,6 +79,8 @@
 #define CONFIG_SYS_DDR_BASE0x
 #define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_BASE
 
+#define CONFIG_SYS_IOCTRL_MUX_DDR  0x0036
+
 /* DDR Controller Configuration
  *
  * SYS_CFG:
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index 31d..cafd6a7 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -67,6 +67,8 @@
 #define CONFIG_SYS_DDR_BASE0x  /* DDR is sys memory*/
 #define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_BASE
 
+#define CONFIG_SYS_IOCTRL_MUX_DDR  0x0036
+
 /* DDR Controller Configuration
  *
  * SYS_CFG:
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index fb49388..8ecc9e1 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -86,6 +86,8 @@
 #define CONFIG_SYS_DDR_BASE0x  /* DDR is system 
memory*/
 #define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_BASE
 
+#define CONFIG_SYS_IOCTRL_MUX_DDR  0x0036
+
 /* DDR Controller Configuration
  *
  * SYS_CFG:
-- 
1.6.3.3

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


[U-Boot] [PATCH 0/6] Add support for PDM360NG board

2010-02-23 Thread Anatolij Gustschin
This patch series intend to support MPC5121e based
PDM360NG board. Patches preceding the actual board
support patch 6 prepare needed infrastructure for
the PDM360NG board.

Anatolij Gustschin (6):
  mpc512x: make MEM IO Control configuration a board config option
  mpc512x: add multi serial PSC support
  mpc5121: add PSC serial communication routines
  fsl_diu_fb.c: add support for RLE8 bitmaps
  fdt_support: add partitions fixup in mtd node
  mpc5121: add support for PDM360NG board

 MAKEALL |1 +
 Makefile|3 +
 board/freescale/common/fsl_diu_fb.c |  107 ++-
 board/pdm360ng/Makefile |   51 +++
 board/pdm360ng/config.mk|   24 ++
 board/pdm360ng/pdm360ng.c   |  618 +++
 common/cmd_mtdparts.c   |2 +-
 common/fdt_support.c|  214 
 common/serial.c |   23 ++
 cpu/mpc512x/diu.c   |   14 +-
 cpu/mpc512x/fixed_sdram.c   |2 +-
 cpu/mpc512x/serial.c|  353 ++--
 include/asm-ppc/immap_512x.h|  112 +++
 include/configs/aria.h  |2 +
 include/configs/mecp5123.h  |2 +
 include/configs/mpc5121ads.h|2 +
 include/configs/pdm360ng.h  |  525 +
 include/fdt_support.h   |2 +
 include/jffs2/load_kernel.h |1 +
 include/mtd_node.h  |   11 +
 include/post.h  |1 +
 include/serial.h|   15 +
 post/tests.c|4 +
 23 files changed, 1996 insertions(+), 93 deletions(-)
 create mode 100644 board/pdm360ng/Makefile
 create mode 100644 board/pdm360ng/config.mk
 create mode 100644 board/pdm360ng/pdm360ng.c
 create mode 100644 include/configs/pdm360ng.h
 create mode 100644 include/mtd_node.h

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


[U-Boot] [PATCH 4/6] fsl_diu_fb.c: add support for RLE8 bitmaps

2010-02-23 Thread Anatolij Gustschin
Allow displaying run length encoded bitmaps.

Signed-off-by: Anatolij Gustschin 
---
 board/freescale/common/fsl_diu_fb.c |   78 +++
 1 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/board/freescale/common/fsl_diu_fb.c 
b/board/freescale/common/fsl_diu_fb.c
index 2fc878b..d7c55b5 100644
--- a/board/freescale/common/fsl_diu_fb.c
+++ b/board/freescale/common/fsl_diu_fb.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fsl_diu_fb.h"
 
@@ -464,6 +465,78 @@ static int allocate_buf(struct diu_addr *buf, u32 size, 
u32 bytes_align)
return 0;
 }
 
+int display_rle8_bitmap(unsigned char *bmp, unsigned int *palette,
+   int yoff, int xoff)
+{
+   struct fb_info *info = &fsl_fb_info;
+   bmp_header_t *im = (bmp_header_t *)bmp;
+   unsigned char *bm;
+   unsigned int *fbp;
+   unsigned int cnt;
+   int decode = 1;
+   int x, y, bpp, i;
+
+   x = 0;
+   y = __le32_to_cpu(im->height) - 1;
+   bpp = info->var.bits_per_pixel / 8;
+   fbp = (unsigned int *) ((unsigned int)info->screen_base +
+   (((y + yoff) * info->var.xres) + xoff) * bpp);
+   bm = bmp + __le32_to_cpu(im->data_offset);
+
+   while (decode) {
+   switch (bm[0]) {
+   case 0:
+   switch (bm[1]) {
+   case 0:
+   /* scan line end marker */
+   bm += 2;
+   x = 0;
+   y--;
+   fbp = (unsigned int *)
+   ((unsigned int)info->screen_base +
+(((y + yoff) * info->var.xres) +
+ xoff) * bpp);
+   continue;
+   case 1:
+   /* end of bitmap data marker */
+   decode = 0;
+   break;
+   case 2:
+   /* run offset marker */
+   x += bm[2];
+   y -= bm[3];
+   fbp = (unsigned int *)
+   ((unsigned int)info->screen_base +
+(((y + yoff) * info->var.xres) +
+ x + xoff) * bpp);
+   bm += 4;
+   break;
+   default:
+   /* unencoded run */
+   cnt = bm[1];
+   bm += 2;
+   for (i = 0; i < cnt; i++) {
+   *fbp++ = palette[bm[0]];
+   bm++;
+   x++;
+   }
+   if (cnt & 1)
+   bm++;
+   }
+   break;
+   default:
+   /* encoded run */
+   for (i = 0; i < bm[0]; i++) {
+   *fbp++ = palette[bm[1]];
+   x++;
+   }
+   bm += 2;
+   break;
+   }
+   }
+   return __le32_to_cpu(im->height);
+}
+
 int fsl_diu_display_bmp(unsigned char *bmp,
int xoffset,
int yoffset,
@@ -544,6 +617,11 @@ int fsl_diu_display_bmp(unsigned char *bmp,
}
break;
case 8:
+   if (bmp[30] == BMP_BI_RLE8) {
+   return display_rle8_bitmap(bmp, palette, yoffset,
+  xoffset);
+   }
+
for (y = height - 1; y >= 0; y--) {
fb_t = (unsigned int *) ((unsigned 
int)info->screen_base + (((y+yoffset) * info->var.xres) + xoffset)*cpp);
for (x = 0; x < width; x++) {
-- 
1.6.3.3

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


[U-Boot] [PATCH 2/6] mpc512x: add multi serial PSC support

2010-02-23 Thread Anatolij Gustschin
Extend mpc512x serial driver to support multiple PSCs ports.

Supsequent patches for PDM360NG board support make use of this
functionality by defining CONFIG_SERIAL_MULTI in the board config
file. Additionally the used PSC devices are specified by defining
e.g. CONFIG_SYS_PSC1, CONFIG_SYS_PSC4 and CONFIG_SYS_PSC6.

Support for PSC devices other than 1, 3, 4 and 6 is not added
by this patch because these aren't used currently. In the future
it can be easily added using DECLARE_PSC_SERIAL_FUNCTIONS(N) and
INIT_PSC_SERIAL_STRUCTURE(N) macros in cpu/mpc512x/serial.c.
Additionally you have to add code for registering added
devices in serial_initialise() in common/serial.c.

Signed-off-by: Anatolij Gustschin 
---
 common/serial.c  |   23 
 cpu/mpc512x/serial.c |  266 +-
 include/asm-ppc/immap_512x.h |  108 +-
 include/serial.h |8 ++
 4 files changed, 324 insertions(+), 81 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 5f9ffd7..754e329 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -59,6 +59,14 @@ struct serial_device *__default_serial_console (void)
 #else
return &serial0_device;
 #endif
+#elif defined(CONFIG_MPC512X)
+#if (CONFIG_PSC_CONSOLE == 3)
+   return &serial3_device;
+#elif (CONFIG_PSC_CONSOLE == 6)
+   return &serial6_device;
+#else
+#error "Bad CONFIG_PSC_CONSOLE."
+#endif
 #elif defined(CONFIG_S3C2410)
 #if defined(CONFIG_SERIAL1)
return &s3c24xx_serial0_device;
@@ -159,6 +167,20 @@ void serial_initialize (void)
serial_register(&s5pc1xx_serial2_device);
serial_register(&s5pc1xx_serial3_device);
 #endif
+#if defined(CONFIG_MPC512X)
+#if defined(CONFIG_SYS_PSC1)
+   serial_register(&serial1_device);
+#endif
+#if defined(CONFIG_SYS_PSC3)
+   serial_register(&serial3_device);
+#endif
+#if defined(CONFIG_SYS_PSC4)
+   serial_register(&serial4_device);
+#endif
+#if defined(CONFIG_SYS_PSC6)
+   serial_register(&serial6_device);
+#endif
+#endif
serial_assign (default_serial_console ()->name);
 }
 
@@ -174,6 +196,7 @@ void serial_stdio_init (void)
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
 
dev.start = s->init;
+   dev.stop = s->uninit;
dev.putc = s->putc;
dev.puts = s->puts;
dev.getc = s->getc;
diff --git a/cpu/mpc512x/serial.c b/cpu/mpc512x/serial.c
index ec2f41b..f421968 100644
--- a/cpu/mpc512x/serial.c
+++ b/cpu/mpc512x/serial.c
@@ -32,14 +32,16 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_PSC_CONSOLE)
+#if defined(CONFIG_PSC_CONSOLE) || defined(CONFIG_SERIAL_MULTI)
 
 static void fifo_init (volatile psc512x_t *psc)
 {
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
+   u32 tfsize, rfsize;
 
/* reset Rx & Tx fifo slice */
out_be32(&psc->rfcmd, PSC_FIFO_RESET_SLICE);
@@ -49,8 +51,65 @@ static void fifo_init (volatile psc512x_t *psc)
out_be32(&psc->rfintmask, 0);
out_be32(&psc->tfintmask, 0);
 
-   out_be32(&psc->tfsize, CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR << 
16));
-   out_be32(&psc->rfsize, CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR << 
16));
+#if defined(CONFIG_SERIAL_MULTI)
+   switch (((u32)psc & 0xf00) >> 8) {
+   case 0:
+   tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
+   rfsize = FIFOC_PSC0_RX_SIZE | (FIFOC_PSC0_RX_ADDR << 16);
+   break;
+   case 1:
+   tfsize = FIFOC_PSC1_TX_SIZE | (FIFOC_PSC1_TX_ADDR << 16);
+   rfsize = FIFOC_PSC1_RX_SIZE | (FIFOC_PSC1_RX_ADDR << 16);
+   break;
+   case 2:
+   tfsize = FIFOC_PSC2_TX_SIZE | (FIFOC_PSC2_TX_ADDR << 16);
+   rfsize = FIFOC_PSC2_RX_SIZE | (FIFOC_PSC2_RX_ADDR << 16);
+   break;
+   case 3:
+   tfsize = FIFOC_PSC3_TX_SIZE | (FIFOC_PSC3_TX_ADDR << 16);
+   rfsize = FIFOC_PSC3_RX_SIZE | (FIFOC_PSC3_RX_ADDR << 16);
+   break;
+   case 4:
+   tfsize = FIFOC_PSC4_TX_SIZE | (FIFOC_PSC4_TX_ADDR << 16);
+   rfsize = FIFOC_PSC4_RX_SIZE | (FIFOC_PSC4_RX_ADDR << 16);
+   break;
+   case 5:
+   tfsize = FIFOC_PSC5_TX_SIZE | (FIFOC_PSC5_TX_ADDR << 16);
+   rfsize = FIFOC_PSC5_RX_SIZE | (FIFOC_PSC5_RX_ADDR << 16);
+   break;
+   case 6:
+   tfsize = FIFOC_PSC6_TX_SIZE | (FIFOC_PSC6_TX_ADDR << 16);
+   rfsize = FIFOC_PSC6_RX_SIZE | (FIFOC_PSC6_RX_ADDR << 16);
+   break;
+   case 7:
+   tfsize = FIFOC_PSC7_TX_SIZE | (FIFOC_PSC7_TX_ADDR << 16);
+   rfsize = FIFOC_PSC7_RX_SIZE | (FIFOC_PSC7_RX_ADDR << 16);
+   break;
+   case 8:
+   tfsize = FIFOC_PSC8_TX_SIZE | (FIFOC_PSC8_TX_ADDR << 16);
+  

[U-Boot] [PATCH 5/6] fdt_support: add partitions fixup in mtd node

2010-02-23 Thread Anatolij Gustschin
Allow overriding defined partitions in the device tree blob
using partition info defined in the 'mtdparts' environment
variable.

Signed-off-by: Anatolij Gustschin 
Cc: Gerald Van Baren 
---
 common/cmd_mtdparts.c   |2 +-
 common/fdt_support.c|  214 +++
 include/fdt_support.h   |2 +
 include/jffs2/load_kernel.h |1 +
 include/mtd_node.h  |   11 ++
 5 files changed, 229 insertions(+), 1 deletions(-)
 create mode 100644 include/mtd_node.h

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index b375fea..80c548b 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -776,7 +776,7 @@ static int device_del(struct mtd_device *dev)
  * @param num device number
  * @return NULL if requested device does not exist
  */
-static struct mtd_device* device_find(u8 type, u8 num)
+struct mtd_device *device_find(u8 type, u8 num)
 {
struct list_head *entry;
struct mtd_device *dev_tmp;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index f89a3ee..b6abf38 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -757,3 +757,217 @@ int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size)
return -1;
 }
 #endif
+
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+#include 
+#include 
+
+struct reg_cell {
+   unsigned int r0;
+   unsigned int r1;
+};
+
+int fdt_del_subnodes(const void *blob, int parent_offset)
+{
+   int off, ndepth;
+   int ret;
+
+   for (ndepth = 0, off = fdt_next_node(blob, parent_offset, &ndepth);
+(off >= 0) && (ndepth > 0);
+off = fdt_next_node(blob, off, &ndepth)) {
+   if (ndepth == 1) {
+   debug("delete %s: offset: %x\n",
+   fdt_get_name(blob, off, 0), off);
+   ret = fdt_del_node((void *)blob, off);
+   if (ret < 0) {
+   printf("Can't delete node: %s\n",
+   fdt_strerror(ret));
+   return ret;
+   } else {
+   ndepth = 0;
+   off = parent_offset;
+   }
+   }
+   }
+   return 0;
+}
+
+int fdt_increase_size(void *fdt, int add_len)
+{
+   int newlen;
+
+   newlen = fdt_totalsize(fdt) + add_len;
+
+   /* Open in place with a new len */
+   return fdt_open_into(fdt, fdt, newlen);
+}
+
+int fdt_del_partitions(void *blob, int parent_offset)
+{
+   const void *prop;
+   int ndepth = 0;
+   int off;
+   int ret;
+
+   off = fdt_next_node(blob, parent_offset, &ndepth);
+   if (off > 0 && ndepth == 1) {
+   prop = fdt_getprop(blob, off, "label", NULL);
+   if (prop == NULL) {
+   /*
+* Could not find label property, nand {}; node?
+* Check subnode, delete partitions there if any.
+*/
+   return fdt_del_partitions(blob, off);
+   } else {
+   ret = fdt_del_subnodes(blob, parent_offset);
+   if (ret < 0) {
+   printf("Can't remove subnodes: %s\n",
+   fdt_strerror(ret));
+   return ret;
+   }
+   }
+   }
+   return 0;
+}
+
+int fdt_node_set_part_info(void *blob, int parent_offset,
+  struct mtd_device *dev)
+{
+   struct list_head *pentry;
+   struct part_info *part;
+   struct reg_cell cell;
+   int off, ndepth = 0;
+   int part_num, ret;
+   char buf[64];
+
+   ret = fdt_del_partitions(blob, parent_offset);
+   if (ret < 0)
+   return ret;
+
+   /*
+* Check if it is nand {}; subnode, adjust
+* the offset in this case
+*/
+   off = fdt_next_node(blob, parent_offset, &ndepth);
+   if (off > 0 && ndepth == 1)
+   parent_offset = off;
+
+   part_num = 0;
+   list_for_each_prev(pentry, &dev->parts) {
+   int newoff;
+
+   part = list_entry(pentry, struct part_info, link);
+
+   debug("%2d: %-20s0x%08x\t0x%08x\t%d\n",
+   part_num, part->name, part->size,
+   part->offset, part->mask_flags);
+
+   sprintf(buf, "partit...@%x", part->offset);
+add_sub:
+   ret = fdt_add_subnode(blob, parent_offset, buf);
+   if (ret == -FDT_ERR_NOSPACE) {
+   ret = fdt_increase_size(blob, 512);
+   if (!ret)
+   goto add_sub;
+   else
+   goto err_size;
+   } else if (ret < 0) {
+   printf("Can't add partition node: %s\n",
+   

[U-Boot] [PATCH 3/6] mpc5121: add PSC serial communication routines

2010-02-23 Thread Anatolij Gustschin
Signed-off-by: Anatolij Gustschin 
---
 cpu/mpc512x/serial.c |   87 ++
 include/serial.h |7 
 2 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc512x/serial.c b/cpu/mpc512x/serial.c
index f421968..cb5bbf0 100644
--- a/cpu/mpc512x/serial.c
+++ b/cpu/mpc512x/serial.c
@@ -401,3 +401,90 @@ int serial_getcts(void)
return serial_getcts_dev(CONFIG_PSC_CONSOLE);
 }
 #endif /* CONFIG_PSC_CONSOLE */
+
+#if defined(CONFIG_SERIAL_MULTI)
+#include 
+/*
+ * Routines for communication with serial devices over PSC
+ */
+/* Bitfield for initialized PSCs */
+static unsigned int initialized;
+
+struct stdio_dev *open_port(int num, int baudrate)
+{
+   struct stdio_dev *port;
+   char env_var[16];
+   char env_val[10];
+   char name[7];
+
+   if (num < 0 || num > 11)
+   return NULL;
+
+   sprintf(name, "psc%d", num);
+   port = stdio_get_by_name(name);
+   if (!port)
+   return NULL;
+
+   if (!test_bit(num, &initialized)) {
+   sprintf(env_var, "psc%d_baudrate", num);
+   sprintf(env_val, "%d", baudrate);
+   setenv(env_var, env_val);
+
+   if (port->start())
+   return NULL;
+
+   set_bit(num, &initialized);
+   }
+
+   return port;
+}
+
+int close_port(int num)
+{
+   struct stdio_dev *port;
+   int ret;
+   char name[7];
+
+   if (num < 0 || num > 11)
+   return -1;
+
+   sprintf(name, "psc%d", num);
+   port = stdio_get_by_name(name);
+   if (!port)
+   return -1;
+
+   ret = port->stop();
+   clear_bit(num, &initialized);
+
+   return ret;
+}
+
+int write_port(struct stdio_dev *port, char *buf)
+{
+   if (!port || !buf)
+   return -1;
+
+   port->puts(buf);
+
+   return 0;
+}
+
+int read_port(struct stdio_dev *port, char *buf, int size)
+{
+   int cnt = 0;
+
+   if (!port || !buf)
+   return -1;
+
+   if (!size)
+   return 0;
+
+   while (port->tstc()) {
+   buf[cnt++] = port->getc();
+   if (cnt > size)
+   break;
+   }
+
+   return cnt;
+}
+#endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 3f3edbc..6423fba 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -92,4 +92,11 @@ extern int usbtty_tstc(void);
 
 #endif /* CONFIG_USB_TTY */
 
+#if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
+extern struct stdio_dev *open_port(int num, int baudrate);
+extern int close_port(int num);
+extern int write_port(struct stdio_dev *port, char *buf);
+extern int read_port(struct stdio_dev *port, char *buf, int size);
+#endif
+
 #endif
-- 
1.6.3.3

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


[U-Boot] [PATCH 6/6] mpc5121: add support for PDM360NG board

2010-02-23 Thread Anatolij Gustschin
PDM360NG is a MPC5121E based board by ifm ecomatic gmbh.

Signed-off-by: Michael Weiss michael.we...@ifm.com
Signed-off-by: Anatolij Gustschin 
---
 MAKEALL |1 +
 Makefile|3 +
 board/freescale/common/fsl_diu_fb.c |   29 ++-
 board/pdm360ng/Makefile |   51 +++
 board/pdm360ng/config.mk|   24 ++
 board/pdm360ng/pdm360ng.c   |  618 +++
 cpu/mpc512x/diu.c   |   14 +-
 include/configs/pdm360ng.h  |  525 +
 include/post.h  |1 +
 post/tests.c|4 +
 10 files changed, 1264 insertions(+), 6 deletions(-)
 create mode 100644 board/pdm360ng/Makefile
 create mode 100644 board/pdm360ng/config.mk
 create mode 100644 board/pdm360ng/pdm360ng.c
 create mode 100644 include/configs/pdm360ng.h

diff --git a/MAKEALL b/MAKEALL
index 1e660b6..06ac650 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -93,6 +93,7 @@ LIST_512x="   \
aria\
mecp5123\
mpc5121ads  \
+   pdm360ng\
 "
 
 #
diff --git a/Makefile b/Makefile
index 524b9da..9003ef9 100644
--- a/Makefile
+++ b/Makefile
@@ -820,6 +820,9 @@ aria_config:unconfig
 mecp5123_config:   unconfig
@$(MKCONFIG) -a mecp5123 ppc mpc512x mecp5123 esd
 
+pdm360ng_config:   unconfig
+   @$(MKCONFIG) -a pdm360ng ppc mpc512x pdm360ng
+
 mpc5121ads_config \
 mpc5121ads_rev2_config \
: unconfig
diff --git a/board/freescale/common/fsl_diu_fb.c 
b/board/freescale/common/fsl_diu_fb.c
index d7c55b5..5512bb2 100644
--- a/board/freescale/common/fsl_diu_fb.c
+++ b/board/freescale/common/fsl_diu_fb.c
@@ -51,6 +51,22 @@ struct fb_videomode {
 #define FB_SYNC_COMP_HIGH_ACT  8   /* composite sync high active   */
 #define FB_VMODE_NONINTERLACED  0  /* non interlaced */
 
+/* This setting is used for the ifm pdm360ng with PRIMEVIEW PM070WL3 */
+static struct fb_videomode fsl_diu_mode_800 = {
+   .refresh= 60,
+   .xres   = 800,
+   .yres   = 480,
+   .pixclock   = 31250,
+   .left_margin= 86,
+   .right_margin   = 42,
+   .upper_margin   = 33,
+   .lower_margin   = 10,
+   .hsync_len  = 128,
+   .vsync_len  = 2,
+   .sync   = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+   .vmode  = FB_VMODE_NONINTERLACED
+};
+
 /*
  * These parameters give default parameters
  * for video output 1024x768,
@@ -211,9 +227,14 @@ int fsl_diu_init(int xres,
 
disable_lcdc();
 
-   if (xres == 1280) {
+   switch (xres) {
+   case 800:
+   fsl_diu_mode_db = &fsl_diu_mode_800;
+   break;
+   case 1280:
fsl_diu_mode_db = &fsl_diu_mode_1280;
-   } else {
+   break;
+   default:
fsl_diu_mode_db = &fsl_diu_mode_1024;
}
 
@@ -592,9 +613,9 @@ int fsl_diu_display_bmp(unsigned char *bmp,
b = *bitmap++;
for (k = 0; k < 8; k++) {
if (b & 0x80)
-   *fb_t = palette[1];
+   *fb_t++ = palette[1];
else
-   *fb_t = palette[0];
+   *fb_t++ = palette[0];
b = b << 1;
}
}
diff --git a/board/pdm360ng/Makefile b/board/pdm360ng/Makefile
new file mode 100644
index 000..8513242
--- /dev/null
+++ b/board/pdm360ng/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2007
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS-y:= $(BOARD).o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+

Re: [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code

2010-02-23 Thread Matthias Kaehlcke
Hi Wolfgang,

El Tue, Feb 23, 2010 at 11:23:42PM +0100 Wolfgang Denk ha dit:

> In message <20100223220421.gk20...@darwin> you wrote:
> > ep93xx: Refactoring of the timer code, including the following changes
> ...
> > +#define TIMER_FREQ 508469
> > +#define CLK_TICKS_PER_SYS_TICK (TIMER_FREQ / CONFIG_SYS_HZ)
> ...
> > +   ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
> ...
> > +   ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;
> 
> Why don't you use
> 
>   ticks *= TIMER_FREQ;
> resp.
>   ticks = usecs * TIMER_FREQ;
> 
> The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad
> NO-OP (with rounding errors).

you certainly have a point, i'm going to change this as you proposed

> Hm... re-reading the optimized code makes me wonder if the variable
> really should be called "ticks" - looks more as a frequency to me?

here i disagree, the function returns the number of ticks that pass in
a certain number of microseconds, so i think 'ticks' is an appropiate
name

thanks for your review!

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

I cannot say whether things will get better if we change,
  what I can say is they must change if they are to get better
   (Georg Christoph Lichtenberg)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] fsl_diu_fb.c: add support for RLE8 bitmaps

2010-02-23 Thread Wolfgang Denk
Dear Anatolij Gustschin,

In message <1266964630-7754-5-git-send-email-ag...@denx.de> you wrote:
> Allow displaying run length encoded bitmaps.
> 
> Signed-off-by: Anatolij Gustschin 
> ---
>  board/freescale/common/fsl_diu_fb.c |   78 
> +++
>  1 files changed, 78 insertions(+), 0 deletions(-)

Isn't there a way to implement this feature in common code, so all
boards with bitmap support can benefit from this?

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Die Scheu vor Verantwortung ist die Krankheit unserer Zeit.
 -- Otto von Bismarck
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Anatolij Gustschin
Hi Stefan,

Stefan Roese  wrote:

> > -   printf("mtdparts: %s\n",
> > -   mtdparts_default ? mtdparts_default : "none");
> > +   puts("mtdparts: ");
> > +   puts(mtdparts_default ? mtdparts_default : "none");
> > +   puts("\n");
> 
> It might make sense to add a comment here, describing why you use these 
> puts() 
> calls instead of one printf(). Otherwise somebody else might trip into this 
> problem again in a later time.

This makes sense. I'll add a comment in next patch version.

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


Re: [U-Boot] [PATCH] mpc8315erdb: fix out-of-tree building for NAND config

2010-02-23 Thread Wolfgang Denk
Dear Kim Phillips,

In message <20100222192612.8da0a6b6.kim.phill...@freescale.com> you wrote:
> On Sun, 21 Feb 2010 21:52:56 +0100
> Wolfgang Denk  wrote:
> 
> > Out-of-tree build for MPC8315ERDB_NAND configuration failed with
> > /bin/sh: line 0: cd: /tmp/foo/nand_spl/board/freescale/mpc8315erdb: No such 
> > file or directory
> > error message
> > 
> > Signed-off-by: Wolfgang Denk 
> > ---
> 
> applied.

Please undo. This is still broken.

Running an out of tree build for MPC8315ERDB_NAND causes the
symbolic link
nand_spl/board/freescale/mpc8315erdb -> mpc8313erdb
to be created in the local source tree. But the local source tree must
be left unchanged for out of tree builds (assume it is on a read-only
storage device).

As is, I see no straightforward way to acchieve this - the current
implementation assumes there is a board directory mpc8315erdb which
does not exist.

I think this must be changed on a deeper level.

Can you please look into this?  Thanks.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
You don't have to worry about me. I might have been born yesterday...
but I stayed up all night.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2] mkimage: SEGFAULT with imximage on 64 bit systems

2010-02-23 Thread Wolfgang Denk
Dear Stefano Babic,

In message <1265379362-8794-1-git-send-email-sba...@denx.de> you wrote:
> Running mkimage to generate an imximage produces a SEGFAULT
> on 64 bit machines due to pointer arithmetic limited to 32 bit.
> 
> Signed-off-by: Stefano Babic 
> ---
>  tools/imximage.c |   30 ++
>  tools/imximage.h |2 +-
>  2 files changed, 15 insertions(+), 17 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Nothing ever becomes real till it is experienced -- even a proverb is
no proverb to you till your life has illustrated it. - John Keats
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] tools: fix imximage warning: p assing argument 2 of ‘getline’ from inco mpatible pointer type

2010-02-23 Thread Wolfgang Denk
Dear Kim Phillips,

In message <20100222193756.ac6af560.kim.phill...@freescale.com> you wrote:
> Configuring for MPC837XEMDS board...
> imximage.c: In function `imximage_parse_cfg_file´:
> imximage.c:146: warning: passing argument 2 of `getline´ from incompatible 
> pointer type
> /usr/include/bits/stdio.h:116: note: expected `size_t *´ but argument is of 
> type `uint32_t *´
> 
> Signed-off-by: Kim Phillips 
> ---
>  tools/imximage.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
A consultant is a person who borrows your watch, tells you what  time
it is, pockets the watch, and sends you a bill for it.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] cmd_itest.c: fix pointer dereferencing

2010-02-23 Thread Wolfgang Denk
Dear Frans Meulenbroeks,

In message <1266875346-17025-1-git-send-email-fransmeulenbro...@gmail.com> you 
wrote:
> fix pointer dereferencing
> if the size is .b and .w an 8 or 16 bit access is done.
> 
> Signed-off-by: Frans Meulenbroeks 
> ---
>  common/cmd_itest.c |9 +++--
>  1 files changed, 7 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
"We learn from history that we learn nothing from history."
- George Bernard Shaw
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] ep93xx: Fix calculation of sys ticks in clk_to_systicks()

2010-02-23 Thread Matthias Kaehlcke
ep93xx: Use unsigned long long for calculation of sys ticks in clk_to_systicks()
for proper handling of large intermediate values

Signed-off-by: Matthias Kaehlcke 
---
 cpu/arm920t/ep93xx/timer.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c
index 6d969d9..98c759c 100644
--- a/cpu/arm920t/ep93xx/timer.c
+++ b/cpu/arm920t/ep93xx/timer.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define TIMER_CLKSEL   (1 << 3)
 #define TIMER_MODE (1 << 6)
@@ -44,9 +45,10 @@ static ulong lastdec;
 
 static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
 {
-   unsigned long sys_ticks = (clk_ticks * CONFIG_SYS_HZ) / TIMER_FREQ;
+   unsigned long long sys_ticks = (clk_ticks * CONFIG_SYS_HZ);
+   do_div(sys_ticks, TIMER_FREQ);
 
-   return sys_ticks;
+   return (unsigned long)sys_ticks;
 }
 
 static inline unsigned long usecs_to_ticks(unsigned long usecs)
-- 
1.6.5

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


[U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code

2010-02-23 Thread Matthias Kaehlcke
ep93xx: Refactoring of the timer code, including the following changes

 * use a free running timer instead of a periodical one
 * use unsigned long long for total number of ticks
 * hold the timer state in a structure instead of separate variables
 * increment the timer counter instead of decrementing it
 * remove unused function udelay_masked()
 * remove unused function set_timer()

Signed-off-by: Matthias Kaehlcke 
---
Changes with regard to rev1:

 * use TIMER_FREQ directly instead of recalculating it with rounding errors


 cpu/arm920t/ep93xx/timer.c |   70 ---
 1 files changed, 26 insertions(+), 44 deletions(-)

diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c
index 98c759c..b1a01a0 100644
--- a/cpu/arm920t/ep93xx/timer.c
+++ b/cpu/arm920t/ep93xx/timer.c
@@ -34,16 +34,18 @@
 #include 
 
 #define TIMER_CLKSEL   (1 << 3)
-#define TIMER_MODE (1 << 6)
 #define TIMER_ENABLE   (1 << 7)
 
-#define TIMER_FREQ 508469
-#define TIMER_LOAD_VAL (TIMER_FREQ / CONFIG_SYS_HZ)
+#define TIMER_FREQ 508469
+#define TIMER_MAX_VAL  0x
 
-static ulong timestamp;
-static ulong lastdec;
+static struct ep93xx_timer
+{
+   unsigned long long ticks;
+   unsigned long last_update;
+} timer;
 
-static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
+static inline unsigned long clk_to_systicks(unsigned long long clk_ticks)
 {
unsigned long long sys_ticks = (clk_ticks * CONFIG_SYS_HZ);
do_div(sys_ticks, TIMER_FREQ);
@@ -57,10 +59,10 @@ static inline unsigned long usecs_to_ticks(unsigned long 
usecs)
 
if (usecs >= 1000) {
ticks = usecs / 1000;
-   ticks *= (TIMER_LOAD_VAL * CONFIG_SYS_HZ);
+   ticks *= TIMER_FREQ;
ticks /= 1000;
} else {
-   ticks = usecs * TIMER_LOAD_VAL * CONFIG_SYS_HZ;
+   ticks = usecs * TIMER_FREQ;
ticks /= (1000 * 1000);
}
 
@@ -71,7 +73,7 @@ static inline unsigned long read_timer(void)
 {
struct timer_regs *timer = (struct timer_regs *)TIMER_BASE;
 
-   return readl(&timer->timer3.value);
+   return TIMER_MAX_VAL - readl(&timer->timer3.value);
 }
 
 /*
@@ -81,17 +83,15 @@ unsigned long long get_ticks(void)
 {
const unsigned long now = read_timer();
 
-   if (lastdec >= now) {
-   /* normal mode */
-   timestamp += lastdec - now;
-   } else {
-   /* we have an overflow ... */
-   timestamp += lastdec + TIMER_LOAD_VAL - now;
-   }
+   if (now >= timer.last_update)
+   timer.ticks += now - timer.last_update;
+   else
+   /* an overflow occurred */
+   timer.ticks += TIMER_MAX_VAL - timer.last_update + now;
 
-   lastdec = now;
+   timer.last_update = now;
 
-   return timestamp;
+   return timer.ticks;
 }
 
 unsigned long get_timer_masked(void)
@@ -106,8 +106,8 @@ unsigned long get_timer(unsigned long base)
 
 void reset_timer_masked(void)
 {
-   lastdec = read_timer();
-   timestamp = 0;
+   timer.last_update = read_timer();
+   timer.ticks = 0;
 }
 
 void reset_timer(void)
@@ -115,28 +115,11 @@ void reset_timer(void)
reset_timer_masked();
 }
 
-void set_timer(unsigned long t)
-{
-   timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
-   const unsigned long ticks = usecs_to_ticks(usec);
-   const unsigned long target = clk_to_systicks(ticks) + get_timer(0);
-
-   while (get_timer_masked() < target)
-   /* noop */;
-}
-
-void udelay_masked(unsigned long usec)
-{
-   const unsigned long ticks = usecs_to_ticks(usec);
-   const unsigned long target = clk_to_systicks(ticks) + get_timer(0);
-
-   reset_timer_masked();
+   const unsigned long target = get_ticks() + usecs_to_ticks(usec);
 
-   while (get_timer_masked() < target)
+   while (get_ticks() < target)
/* noop */;
 }
 
@@ -147,12 +130,11 @@ int timer_init(void)
/* use timer 3 with 508KHz and free running */
writel(TIMER_CLKSEL, &timer->timer3.control);
 
-   /* auto load, manual update of Timer 3 */
-   lastdec = TIMER_LOAD_VAL;
-   writel(TIMER_LOAD_VAL, &timer->timer3.load);
+   /* set initial timer value 3 */
+   writel(TIMER_MAX_VAL, &timer->timer3.load);
 
-   /* Enable the timer and periodic mode */
-   writel(TIMER_ENABLE | TIMER_MODE | TIMER_CLKSEL,
+   /* Enable the timer */
+   writel(TIMER_ENABLE | TIMER_CLKSEL,
&timer->timer3.control);
 
reset_timer_masked();
-- 
1.6.5

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


[U-Boot] [PATCH v3] cmd_mtdparts.c: prevent printbuffer overflows

2010-02-23 Thread Anatolij Gustschin
The length of configured MTDPARTS_DEFAULT string
could be greater than console printbuffer size.
Replace printf() by puts() to avoid potential buffer
overflows.

Signed-off-by: Anatolij Gustschin 
---
Changes since v2:
 - add comment explaining the reason for usage of puts().

Changes since v1:
 - use puts() instead of printf() as suggested by Wolfgang.

 common/cmd_mtdparts.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index b375fea..20fed2a 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1254,8 +1254,14 @@ static void list_partitions(void)
printf("\ndefaults:\n");
printf("mtdids  : %s\n",
mtdids_default ? mtdids_default : "none");
-   printf("mtdparts: %s\n",
-   mtdparts_default ? mtdparts_default : "none");
+   /*
+* Using printf() here results in printbuffer overflow
+* if default mtdparts string is greater than console
+* printbuffer. Use puts() to prevent system crashes.
+*/
+   puts("mtdparts: ");
+   puts(mtdparts_default ? mtdparts_default : "none");
+   puts("\n");
 }
 
 /**
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH] edb93xx: Fix SDRAM initialization

2010-02-23 Thread Tom
Matthias Kaehlcke wrote:
> edb93xx: Fix SDRAM initialization by issuing a precharge all command before
> forcing the precharge and select mode register update mode before programming
> the mode registers. Write to the SDRAM banks in order to force a precharge,
> reading causes the edb93xx boards to hang
> 
> Signed-off-by: Matthias Kaehlcke 
> ---
>  board/edb93xx/sdram_cfg.c |   40 
>  1 files changed, 32 insertions(+), 8 deletions(-)
> 
> diff --git a/board/edb93xx/sdram_cfg.c b/board/edb93xx/sdram_cfg.c
> index 6155f0e..5070744 100644
> --- a/board/edb93xx/sdram_cfg.c
> +++ b/board/edb93xx/sdram_cfg.c
> @@ -1,5 +1,6 @@
>  /*
> - * Copyright (C) 2009 Matthias Kaehlcke 
> + * Copyright (C) 2010, 2009

Minor point but I have copyrights on my mind.
Maybe this should be '2009 - 2010' or '2009, 2010'
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mpc8315erdb: fix out-of-tree building for NAND config

2010-02-23 Thread Kim Phillips
On Tue, 23 Feb 2010 23:58:42 +0100
Wolfgang Denk  wrote:

> Dear Kim Phillips,
> 
> In message <20100222192612.8da0a6b6.kim.phill...@freescale.com> you wrote:
> > On Sun, 21 Feb 2010 21:52:56 +0100
> > Wolfgang Denk  wrote:
> > 
> > > Out-of-tree build for MPC8315ERDB_NAND configuration failed with
> > > /bin/sh: line 0: cd: /tmp/foo/nand_spl/board/freescale/mpc8315erdb: No 
> > > such file or directory
> > > error message
> > > 
> > > Signed-off-by: Wolfgang Denk 
> > > ---
> > 
> > applied.
> 
> Please undo. This is still broken.
> 
> Running an out of tree build for MPC8315ERDB_NAND causes the
> symbolic link
> nand_spl/board/freescale/mpc8315erdb -> mpc8313erdb
> to be created in the local source tree. But the local source tree must
> be left unchanged for out of tree builds (assume it is on a read-only
> storage device).
> 
> As is, I see no straightforward way to acchieve this - the current
> implementation assumes there is a board directory mpc8315erdb which
> does not exist.
> 
> I think this must be changed on a deeper level.
> 
> Can you please look into this?  Thanks.

it seems a complete merge of mpc8313 and mpc8315 into mpc831x is in
order. I'll see what I can do.

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


Re: [U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code

2010-02-23 Thread Tom
Matthias Kaehlcke wrote:
> Hi Wolfgang,
> 
> El Tue, Feb 23, 2010 at 11:23:42PM +0100 Wolfgang Denk ha dit:
> 
>> In message <20100223220421.gk20...@darwin> you wrote:
>>> ep93xx: Refactoring of the timer code, including the following changes
>> ...
>>> +#define TIMER_FREQ 508469
>>> +#define CLK_TICKS_PER_SYS_TICK (TIMER_FREQ / CONFIG_SYS_HZ)
>> ...
>>> +   ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
>> ...
>>> +   ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;
>> Why don't you use
>>
>>  ticks *= TIMER_FREQ;
>> resp.
>>  ticks = usecs * TIMER_FREQ;
>>
>> The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad
>> NO-OP (with rounding errors).
> 
> you certainly have a point, i'm going to change this as you proposed
> 
>> Hm... re-reading the optimized code makes me wonder if the variable
>> really should be called "ticks" - looks more as a frequency to me?
> 
> here i disagree, the function returns the number of ticks that pass in
> a certain number of microseconds, so i think 'ticks' is an appropiate
> name
> 
Perhaps a comment on the units of TIMER_FREQ ?
This is minor point.
Otherwise looks fine.
Tom


> thanks for your review!
> 

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


Re: [U-Boot] [STATUS] Release on hold, wait for i.MX custodian

2010-02-23 Thread Liu Hui-R64343
Hi, all
I'm Jason Liu from freecale MAD SW team. I will act as uboot custodian 
for FSL I.MX platforms.
I just got known that there are many patches on the mail-list need take 
further action by the patches owner and me

I'm hope that the patches owner can feedback me the status of each 
patch with the following classfication
a. brand new pathes, no review comments.
b. patches reviewed by not provide new version according to the 
review comments,
c. updated patches, no further review comments.

I will put clsss (c) to I.MX custodian repo and request 
upstream to merge it.

Please feedback new ASAP, really thanks for your work.



BR,
Jason
 

> -Original Message-
> From: Wolfgang Denk [mailto:w...@denx.de]
> Sent: 2010年2月24日 4:44
> To: u-boot@lists.denx.de
> Cc: Tom; Liu Hui-R64343
> Subject: [STATUS] Release on hold, wait for i.MX custodian
> 
> Hi,
> 
> this is to let you know that Freescale has informed me that they will 
> appoint a custodian for the Freescale ARM processors Really Soon Now.
> I would like to give him a chance to introduce himself here and get 
> some overview of the open i.MX patches that are supposed to go into 
> this release, which I hope will be acchieved before the end of this 
> week.
> 
> Until then, I will continue to work on fixes and process pull 
> requests, but otherwise hold the release so the i.MX stuff can go in 
> before we have -rc1 out.
> 
> Thanks for your patience.
> 
> Best regards,
> 
> Wolfgang Denk
> 
> -- 
> 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: 
> w...@denx.de "An open mind has but one disadvantage: it collects dirt."
> - a saying at RPI
> 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] OMAP3: workaround for ARM Cortex-A8 erratum 725233

2010-02-23 Thread Paulraj, Sandeep

> 
> Siarhei Siamashka wrote:
> > 725233: PLD instructions executed with PLD data forwarding
> > enabled can result in a processor deadlock
> >
> > This deadlock can happen when NEON load instructions are used together
> > with cache preload instructions (PLD). The problematic conditions
> > can be triggered in-the-wild by NEON optimized functions from pixman
> > library (http://cgit.freedesktop.org/pixman), which perform dynamic
> > adjustment of prefetch distance.
> >
> > The workaround disables PLD data forwarding by setting PLD_FWD bit
> > in L2 Cache Auxiliary Control Register as recommended in ARM Cortex-A8
> > errata list.
> >
> > The deadlock can only happen on r1pX revisions of Cortex-A8 (used in
> > OMAP34xx/OMAP35xx). Performance impact of the workaround is practically
> > non-existant.
> >
> > Signed-off-by: Siarhei Siamashka 
> 
> Thank you for the improvements on the comment.
> Ack-ed.
Seems important to me.
I'm going to push it to u-boot-ti and send a pull request for the same

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


[U-Boot] Please pull u-boot-ti/master

2010-02-23 Thread s-paulraj
Tom,

Please accept this pull request for this rather important looking fix

Regards,
Sandeep

The following changes since commit 2a6e25632fd71eae9cb9d9e098d72e90dfec8af1:
  Ladislav Michl (1):
VoiceBlue: fix linker errors

are available in the git repository at:

  git://git.denx.de/u-boot-ti.git master

Siarhei Siamashka (1):
  OMAP3: workaround for ARM Cortex-A8 erratum 725233

 cpu/arm_cortexa8/omap3/board.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ppc4xx: Corrected EBC register bit definitions

2010-02-23 Thread Stefan Roese
Eugene,

On Tuesday 23 February 2010 22:19:04 Eugene O'Brien wrote:
> Corrected the bit field positions of the external master priority low
> and the external master priority high values in the EBC configuration
> register.

In addition to Wolfgangs comment (patch is line wrapped): I just checked the 
440EP and the 440EPx users manual, and it seems that the original bit masks 
are correct. Which PPC4xx variant are you using? Please double check again if 
you your patch is correct.
 
Thanks.

Cheers,
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: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] mcf5307

2010-02-23 Thread angelo

Hello all,

is ColdFire mcf5307 supported ? in 1.1.6 i found mcf52x2 cpu only.

Regards,
Angelo

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