Re: [U-Boot] [PATCH 2/3] LaCie/common: add support for the GPIO extension bus

2013-06-17 Thread Prafulla Wadaskar


> -Original Message-
> From: Simon Guinot [mailto:simon.gui...@sequanux.org]
> Sent: 18 June 2013 02:28
> To: Prafulla Wadaskar
> Cc: Albert ARIBAUD; u-boot@lists.denx.de
> Subject: [PATCH 2/3] LaCie/common: add support for the
> GPIO extension bus
> 
> This patch adds support for the GPIO extension bus
> found on some LaCie
> boards (as the 2Big/5Big Network v2 and the 2Big NAS).
> This bus allows
> to configure the devices (mostly the LEDs) connected to
> a CPLD via two
> GPIO-based registers (address and data).

Hi Simon
The name given here for the patch as well as files "gpio-ext" is confusing for 
me.

As you stated here those are the IOs generated by CPLD on your board which can 
be programmed using bit-banging on two GPIOs.

So to me it those are "cpld_ios".

May you please rename these files accordingly and resend the patch series for 
better understanding?

To me "gpio-ext" is generic term application for "General purpose IOs"

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


Re: [U-Boot] [PATCH 1/3] net2big_v2: initialize I2C fan at startup

2013-06-17 Thread Prafulla Wadaskar


> -Original Message-
> From: Simon Guinot [mailto:simon.gui...@sequanux.org]
> Sent: 18 June 2013 02:28
> To: Prafulla Wadaskar
> Cc: Albert ARIBAUD; u-boot@lists.denx.de
> Subject: [PATCH 1/3] net2big_v2: initialize I2C fan at
> startup
> 
> This patch ensures minimal cooling for the net2big_v2
> by automatically
> starting the I2C fan (GMT G762) at low speed (2800 RPM).
> 
> Signed-off-by: Simon Guinot 
> ---
>  board/LaCie/net2big_v2/net2big_v2.c |   54
> ++-
>  board/LaCie/net2big_v2/net2big_v2.h |5 
>  include/configs/lacie_kw.h  |9 +-
>  3 files changed, 66 insertions(+), 2 deletions(-)
> 
> diff --git a/board/LaCie/net2big_v2/net2big_v2.c
> b/board/LaCie/net2big_v2/net2big_v2.c
> index e524f35..6cca4fb 100644
> --- a/board/LaCie/net2big_v2/net2big_v2.c
> +++ b/board/LaCie/net2big_v2/net2big_v2.c
> @@ -22,6 +22,7 @@
> 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -92,8 +93,59 @@ int board_init(void)
>  }
> 
>  #if defined(CONFIG_MISC_INIT_R)
> +
> +#if defined(CONFIG_CMD_I2C) &&
> defined(CONFIG_SYS_I2C_G762_ADDR)
> +/*
> + * Start I2C fan (GMT G762 controller)
> + */
> +static void init_fan(void)
> +{
> + u8 data;
> +
> + i2c_set_bus_num(0);
> +
> + /* Enable open-loop and PWM modes */
> + data = 0x20;
> + if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
> +   G762_REG_FAN_CMD1, 1, &data, 1) != 0)
> + goto err;
> + data = 0;
> + if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
> +   G762_REG_SET_CNT, 1, &data, 1) != 0)
> + goto err;
> + /*
> +  * RPM to PWM (set_out register) fan speed
> conversion array:
> +  * 00x00
> +  * 1500 0x04
> +  * 2800 0x08
> +  * 3400 0x0C
> +  * 3700 0x10
> +  * 4400 0x20
> +  * 4700 0x30
> +  * 4800 0x50
> +  * 5200 0x80
> +  * 5400 0xC0
> +  * 5500 0xFF
> +  *
> +  * Start fan at low speed (2800 RPM):
> +  */
> + data = 0x08;
> + if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
> +   G762_REG_SET_OUT, 1, &data, 1) != 0)
> + goto err;
> +
> + return;
> +err:
> + printf("Error: failed to start I2C fan @%02x\n",
> +CONFIG_SYS_I2C_G762_ADDR);
> +}
> +#else
> +static void init_fan(void) {}
> +#endif /* CONFIG_CMD_I2C && CONFIG_SYS_I2C_G762_ADDR
> */
> +
>  int misc_init_r(void)
>  {
> + init_fan();
>  #if defined(CONFIG_CMD_I2C) &&
> defined(CONFIG_SYS_I2C_EEPROM_ADDR)
>   if (!getenv("ethaddr")) {
>   uchar mac[6];
> @@ -103,7 +155,7 @@ int misc_init_r(void)
>  #endif
>   return 0;
>  }
> -#endif
> +#endif /* CONFIG_MISC_INIT_R */
> 
>  #if defined(CONFIG_CMD_NET) &&
> defined(CONFIG_RESET_PHY_R)
>  /* Configure and initialize PHY */
> diff --git a/board/LaCie/net2big_v2/net2big_v2.h
> b/board/LaCie/net2big_v2/net2big_v2.h
> index f9778f4..83537d6 100644
> --- a/board/LaCie/net2big_v2/net2big_v2.h
> +++ b/board/LaCie/net2big_v2/net2big_v2.h
> @@ -32,4 +32,9 @@
>  /* Buttons */
>  #define NET2BIG_V2_GPIO_PUSH_BUTTON  34
> 
> +/* GMT G762 registers (I2C fan controller) */
> +#define G762_REG_SET_CNT 0x00
> +#define G762_REG_SET_OUT 0x03
> +#define G762_REG_FAN_CMD10x04
> +
>  #endif /* NET2BIG_V2_H */
> diff --git a/include/configs/lacie_kw.h
> b/include/configs/lacie_kw.h
> index 09b5798..e2b3b21 100644
> --- a/include/configs/lacie_kw.h
> +++ b/include/configs/lacie_kw.h
> @@ -120,10 +120,14 @@
>  #endif
> 
>  /*
> + * Enable platform initialisation via misc_init_r()
> function
> + */
> +#define CONFIG_MISC_INIT_R
> +
> +/*
>   * Ethernet Driver configuration
>   */
>  #ifdef CONFIG_CMD_NET
> -#define CONFIG_MISC_INIT_R /* Call misc_init_r() to
> initialize MAC address */
>  #define CONFIG_MVGBE_PORTS   {1, 0} /* enable port
> 0 only */
>  #define CONFIG_NETCONSOLE
>  #endif
> @@ -153,6 +157,9 @@
>  #define CONFIG_SYS_I2C_EEPROM_ADDR   0x50
>  #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS4 /* 16-
> byte page size */
>  #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN   1 /* 8-bit
> device address */
> +#if defined(CONFIG_NET2BIG_V2)
> +#define CONFIG_SYS_I2C_G762_ADDR 0x3e
> +#endif
>  #endif /* CONFIG_CMD_I2C */
> 

Acked-by: Prafulla Wadaskar 


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


Re: [U-Boot] [PATCH 3/3] omap: cm_t35: Fix cm_t35 for weak splash_screen_prepare

2013-06-17 Thread Igor Grinberg

On 06/17/13 21:31, Robert Winkler wrote:
> Signed-off-by: Robert Winkler 

Usually, we add something to the commit message, otherwise
Acked-by: Igor Grinberg 

> ---
>  board/compulab/cm_t35/cm_t35.c | 2 +-
>  include/configs/cm_t35.h   | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
> index b0b80e5..95098af 100644
> --- a/board/compulab/cm_t35/cm_t35.c
> +++ b/board/compulab/cm_t35/cm_t35.c
> @@ -120,7 +120,7 @@ static inline int splash_load_from_nand(void)
>  }
>  #endif /* CONFIG_CMD_NAND */
>  
> -int board_splash_screen_prepare(void)
> +int splash_screen_prepare(void)
>  {
>   char *env_splashimage_value;
>   u32 bmp_load_addr;
> diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
> index c6e357a..b258da9 100644
> --- a/include/configs/cm_t35.h
> +++ b/include/configs/cm_t35.h
> @@ -339,6 +339,5 @@
>  #define CONFIG_SPLASH_SCREEN
>  #define CONFIG_CMD_BMP
>  #define CONFIG_BMP_16BPP
> -#define CONFIG_SPLASH_SCREEN_PREPARE
>  
>  #endif /* __CONFIG_H */
> 

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


Re: [U-Boot] [PATCH 2/3] video: lcd: Make splash_screen_prepare weak, remove config macro

2013-06-17 Thread Igor Grinberg


On 06/17/13 21:31, Robert Winkler wrote:
> Remove CONFIG_SPLASH_SCREEN_PREPARE from README
> Add doc/README.splashprepare to document functionality
> 
> Signed-off-by: Robert Winkler 

Acked-by: Igor Grinberg 

> ---
>  README   |  8 
>  common/splash.c  | 13 -
>  doc/README.splashprepare |  8 
>  3 files changed, 12 insertions(+), 17 deletions(-)
>  create mode 100644 doc/README.splashprepare
> 
> diff --git a/README b/README
> index b72ab2f..0686073 100644
> --- a/README
> +++ b/README
> @@ -1605,14 +1605,6 @@ CBFS (Coreboot Filesystem) support
>   => vertically centered image
>  at x = dspWidth - bmpWidth - 9
>  
> - CONFIG_SPLASH_SCREEN_PREPARE
> -
> - If this option is set then the board_splash_screen_prepare()
> - function, which must be defined in your code, is called as part
> - of the splash screen display sequence. It gives the board an
> - opportunity to prepare the splash image data before it is
> - processed and sent to the frame buffer by U-Boot.
> -
>  - Gzip compressed BMP image support: CONFIG_VIDEO_BMP_GZIP
>  
>   If this option is set, additionally to standard BMP
> diff --git a/common/splash.c b/common/splash.c
> index 98de2be..1882e5f 100644
> --- a/common/splash.c
> +++ b/common/splash.c
> @@ -21,16 +21,11 @@
>   */
>  
>  #include 
> -#include 
>  
> -#ifdef CONFIG_SPLASH_SCREEN_PREPARE
> -int splash_screen_prepare(void)
> -{
> - return board_splash_screen_prepare();
> -}
> -#else
> -int splash_screen_prepare(void)
> +int __splash_screen_prepare(void)
>  {
>   return 0;
>  }
> -#endif
> +
> +int splash_screen_prepare(void)
> + __attribute__ ((weak, alias("__splash_screen_prepare")));
> diff --git a/doc/README.splashprepare b/doc/README.splashprepare
> new file mode 100644
> index 000..61b4ec5
> --- /dev/null
> +++ b/doc/README.splashprepare
> @@ -0,0 +1,8 @@
> +-
> +Splash Screen
> +-
> +The splash_screen_prepare() function is a weak function defined in
> +common/splash.c. It is called as part of the splash screen display
> +sequence. It gives the board an opportunity to prepare the splash
> +image data before it is processed and sent to the frame buffer by
> +U-Boot.  Define your own version to use this feature.
> 

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


Re: [U-Boot] [PATCH 1/3 v2] video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO

2013-06-17 Thread Igor Grinberg
Hi Robert,

On 06/17/13 21:31, Robert Winkler wrote:
> Create splash.c/h to put the function and any future common splash
> screen code in.
> 
> Signed-off-by: Robert Winkler 

Acked-by: Igor Grinberg 

> ---
> v2 changes:
> remove superfluous comments
> remove debug printf that slipped in
> remove address from GPL comments
> 
>  common/Makefile |  1 +
>  common/lcd.c| 16 +++-
>  common/splash.c | 36 
>  drivers/video/cfb_console.c |  5 +++--
>  include/lcd.h   |  1 -
>  include/splash.h| 29 +
>  6 files changed, 72 insertions(+), 16 deletions(-)
>  create mode 100644 common/splash.c
>  create mode 100644 include/splash.h
> 
> diff --git a/common/Makefile b/common/Makefile
> index 1cfb132..b48f227 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -204,6 +204,7 @@ COBJS-y += flash.o
>  COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
>  COBJS-$(CONFIG_I2C_EDID) += edid.o
>  COBJS-$(CONFIG_KALLSYMS) += kallsyms.o
> +COBJS-y += splash.o
>  COBJS-$(CONFIG_LCD) += lcd.o
>  COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
>  COBJS-$(CONFIG_MENU) += menu.o
> diff --git a/common/lcd.c b/common/lcd.c
> index edae835..72ffcfb 100644
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -43,6 +43,8 @@
>  #include 
>  #include 
>  
> +#include 
> +
>  #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
>   defined(CONFIG_CPU_MONAHANS)
>  #define CONFIG_CPU_PXA
> @@ -1068,18 +1070,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  }
>  #endif
>  
> -#ifdef CONFIG_SPLASH_SCREEN_PREPARE
> -static inline int splash_screen_prepare(void)
> -{
> - return board_splash_screen_prepare();
> -}
> -#else
> -static inline int splash_screen_prepare(void)
> -{
> - return 0;
> -}
> -#endif
> -
>  static void *lcd_logo(void)
>  {
>  #ifdef CONFIG_SPLASH_SCREEN
> @@ -1092,7 +1082,7 @@ static void *lcd_logo(void)
>   do_splash = 0;
>  
>   if (splash_screen_prepare())
> - return (void *)gd->fb_base;
> + return (void *)lcd_base;
>  
>   addr = simple_strtoul (s, NULL, 16);
>  #ifdef CONFIG_SPLASH_SCREEN_ALIGN
> diff --git a/common/splash.c b/common/splash.c
> new file mode 100644
> index 000..98de2be
> --- /dev/null
> +++ b/common/splash.c
> @@ -0,0 +1,36 @@
> +/*
> + * Copyright (C) 2013, Boundary Devices 
> + *
> + * 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., http://www.fsf.org/about/contact/
> + *
> + */
> +
> +#include 
> +#include 
> +
> +#ifdef CONFIG_SPLASH_SCREEN_PREPARE
> +int splash_screen_prepare(void)
> +{
> + return board_splash_screen_prepare();
> +}
> +#else
> +int splash_screen_prepare(void)
> +{
> + return 0;
> +}
> +#endif
> diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
> index 0793f07..4e299c6 100644
> --- a/drivers/video/cfb_console.c
> +++ b/drivers/video/cfb_console.c
> @@ -181,6 +181,8 @@
>   */
>  #include 
>  
> +#include 
> +
>  /*
>   * some Macros
>   */
> @@ -1995,10 +1997,9 @@ static void *video_logo(void)
>  #ifdef CONFIG_SPLASH_SCREEN
>   s = getenv("splashimage");
>   if (s != NULL) {
> -
> + splash_screen_prepare();
>   addr = simple_strtoul(s, NULL, 16);
>  
> -
>   if (video_display_bitmap(addr,
>   video_logo_xpos,
>   video_logo_ypos) == 0) {
> diff --git a/include/lcd.h b/include/lcd.h
> index c6e7fc5..e58ffd0 100644
> --- a/include/lcd.h
> +++ b/include/lcd.h
> @@ -37,7 +37,6 @@ extern struct vidinfo panel_info;
>  
>  void lcd_ctrl_init(void *lcdbase);
>  void lcd_enable(void);
> -int board_splash_screen_prepare(void);
>  
>  /* setcolreg used in 8bpp/16bpp; initcolregs used in monochrome */
>  void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
> diff --git a/include/splash.h b/include/splash.h
> new file mode 100644
> index 000..63b45e0
> --- /dev/null
> +++ b/include/splash.h
> @@ -0,0 +1,29 @@
> +/*
> + * Copyright (C) 2013, Boundary Devices 
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is f

Re: [U-Boot] [PATCH 1/2] video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO

2013-06-17 Thread Igor Grinberg


On 06/17/13 20:08, Robert Winkler wrote:
> Hi Igor,
> 
> On Sun, Jun 16, 2013 at 10:34 PM, Igor Grinberg  
> wrote:
>> Hi Robert,
>>
>> On 06/14/13 20:00, Robert Winkler wrote:
>>> Create splash.c/h to put the function and any future common
>>> splash screen code in.
>>>
>>> Signed-off-by: Robert Winkler 
>>
>> Thanks for the effort!
>> Several comments below...
>>
>>> ---
>>>  common/Makefile |  1 +
>>>  common/lcd.c| 19 ++-
>>>  common/splash.c | 37 +
>>>  drivers/video/cfb_console.c |  8 ++--
>>>  include/lcd.h   |  1 -
>>>  include/splash.h| 30 ++
>>>  6 files changed, 80 insertions(+), 16 deletions(-)
>>>  create mode 100644 common/splash.c
>>>  create mode 100644 include/splash.h
>>>
>>> diff --git a/common/Makefile b/common/Makefile
>>> index 0e0fff1..1d70584 100644
>>> --- a/common/Makefile
>>> +++ b/common/Makefile
>>> @@ -203,6 +203,7 @@ COBJS-y += flash.o
>>>  COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
>>>  COBJS-$(CONFIG_I2C_EDID) += edid.o
>>>  COBJS-$(CONFIG_KALLSYMS) += kallsyms.o
>>> +COBJS-y += splash.o
>>
>> I think this should depend on CONFIG_SPLASH_SCREEN.
> No it shouldn't.  The function is always called so it always needs to
> be defined.  It's the
> same behavior we had before, it was always compiled into lcd.h.
> Whether or not the CONFIG
> was defined just changed whether it actually called
> board_splash_screen_prepare or just returned 0.
> 
> This is of course true for when it's a weak function as well.

Well, what I meant is, once you make it a separate file (named splash.c),
it is rather strange that it should be always compiled.
It is fine for me now, but once more splash screen specific code moves
to this file, it surely should depend on CONFIG_SPLASH_SCREEN.

In general, I think the construct of
1) having the .c file compiled conditionally
   (meaning depend on CONFIG_... option)
2) having the .h file to define the interface to the .c file
   and provide a default implementation
   (when the above CONFIG_... is not set),

like in many cases Linux does, brings the benefit of clear yet robust
(in regard to the CONFIG_... defined or not) code has proven itself.

> 
>>
>>>  COBJS-$(CONFIG_LCD) += lcd.o
>>>  COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
>>>  COBJS-$(CONFIG_MENU) += menu.o
>>> diff --git a/common/lcd.c b/common/lcd.c
>>> index 3a60484..4a85ebb 100644
>>> --- a/common/lcd.c
>>> +++ b/common/lcd.c
>>> @@ -43,6 +43,11 @@
>>>  #include 
>>>  #include 
>>>
>>> +/*
>>> + * Include splash.h for splash_screen_prepare() etc.
>>> + */
>>
>> I think this comment is meaningless, the below include is self explanatory.
> Agreed.  I was just trying to match the other superfluous comments.
>>
>>> +#include 
>>> +
>>>  #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
>>>   defined(CONFIG_CPU_MONAHANS)
>>>  #define CONFIG_CPU_PXA
>>> @@ -1072,18 +1077,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>>>  }
>>>  #endif
>>>
>>> -#ifdef CONFIG_SPLASH_SCREEN_PREPARE
>>> -static inline int splash_screen_prepare(void)
>>> -{
>>> - return board_splash_screen_prepare();
>>> -}
>>> -#else
>>> -static inline int splash_screen_prepare(void)
>>> -{
>>> - return 0;
>>> -}
>>> -#endif
>>> -
>>>  static void *lcd_logo(void)
>>>  {
>>>  #ifdef CONFIG_SPLASH_SCREEN
>>> @@ -1096,7 +1089,7 @@ static void *lcd_logo(void)
>>>   do_splash = 0;
>>>
>>>   if (splash_screen_prepare())
>>> - return (void *)gd->fb_base;
>>> + return (void *)lcd_base;
>>>
>>>   addr = simple_strtoul (s, NULL, 16);
>>>  #ifdef CONFIG_SPLASH_SCREEN_ALIGN
>>> diff --git a/common/splash.c b/common/splash.c
>>> new file mode 100644
>>> index 000..fe13c69
>>> --- /dev/null
>>> +++ b/common/splash.c
>>> @@ -0,0 +1,37 @@
>>> +/*
>>> + * Copyright (C) 2013, Boundary Devices 
>>> + *
>>> + * 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
>>
>> I would drop the postal address, as it changed in the past and
>> probably will change in the future and then we will have

Re: [U-Boot] [PATCH v2 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Nikita Kiryanov

This version works when booting with X-Loader.

Tested-by: Nikita Kiryanov 

On 06/17/2013 05:03 PM, Stefan Roese wrote:

Add SPL U-Boot support to replace x-loader on the Compulab cm_t35
board. Currently only the 256MiB SDRAM board versions are supported.

Tested by booting via MMC and NAND.

Signed-off-by: Stefan Roese 
Cc: Tom Rini 
Cc: Igor Grinberg 
---
v2:
- Change CONFIG_SYS_TEXT_BASE back to 0x80008000 for x-loader
   compatibility
- Change CONFIG_SPL_BSS_START_ADDR to 0x8010 to not overlap
   with TEXT_BASE now

  board/compulab/cm_t35/cm_t35.c | 18 +++-
  include/configs/cm_t35.h   | 64 --
  2 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index b0b80e5..cd7882e 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -120,6 +120,22 @@ static inline int splash_load_from_nand(void)
  }
  #endif /* CONFIG_CMD_NAND */

+#ifdef CONFIG_SPL_BUILD
+/*
+ * Routine: get_board_mem_timings
+ * Description: If we use SPL then there is no x-loader nor config header
+ * so we have to setup the DDR timings ourself on both banks.
+ */
+void get_board_mem_timings(struct board_sdrc_timings *timings)
+{
+   timings->mr = MICRON_V_MR_165;
+   timings->mcfg = MICRON_V_MCFG_165(256 << 20);
+   timings->ctrla = MICRON_V_ACTIMA_165;
+   timings->ctrlb = MICRON_V_ACTIMB_165;
+   timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+}
+#endif
+
  int board_splash_screen_prepare(void)
  {
char *env_splashimage_value;
@@ -443,7 +459,7 @@ void set_muxconf_regs(void)
cm_t3730_set_muxconf();
  }

-#ifdef CONFIG_GENERIC_MMC
+#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
  int board_mmc_getcd(struct mmc *mmc)
  {
u8 val;
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index c6e357a..1dc2d5b 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -40,8 +40,6 @@
  #define CONFIG_OMAP_GPIO
  #define CONFIG_CM_T3X /* working with CM-T35 and CM-T3730 */

-#define CONFIG_SYS_TEXT_BASE   0x80008000
-
  #define CONFIG_SDRC   /* The chip has SDRC controller */

  #include/* get chip and board defs */
@@ -341,4 +339,66 @@
  #define CONFIG_BMP_16BPP
  #define CONFIG_SPLASH_SCREEN_PREPARE

+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_NAND_SIMPLE
+
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR0x300 /* address 
0x6 */
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */
+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME   "u-boot.img"
+
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_BASE
+#define CONFIG_SPL_NAND_DRIVERS
+#define CONFIG_SPL_NAND_ECC
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
+#define CONFIG_SPL_OMAP3_ID_NAND
+#define CONFIG_SPL_LDSCRIPT"$(CPUDIR)/omap-common/u-boot-spl.lds"
+
+/* NAND boot config */
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_COUNT 64
+#define CONFIG_SYS_NAND_PAGE_SIZE  2048
+#define CONFIG_SYS_NAND_OOBSIZE64
+#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
+/*
+ * Use the ECC/OOB layout from omap_gpmc.h that matches your chip:
+ * SP vs LP, 8bit vs 16bit: GPMC_NAND_HW_ECC_LAYOUT
+ */
+#define CONFIG_SYS_NAND_ECCPOS { 1, 2, 3, 4, 5, 6, 7, 8, 9, \
+10, 11, 12 }
+#define CONFIG_SYS_NAND_ECCSIZE512
+#define CONFIG_SYS_NAND_ECCBYTES   3
+
+#define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_OFFS0x8
+
+#define CONFIG_SPL_TEXT_BASE   0x40200800
+#define CONFIG_SPL_MAX_SIZE(54 * 1024) /* 8 KB for stack */
+#define CONFIG_SPL_STACK   LOW_LEVEL_SRAM_STACK
+
+/*
+ * Use 0x80008000 as TEXT_BASE here for compatibility reasons with the
+ * older x-loader implementations. And move the BSS area so that it
+ * doesn't overlap with TEXT_BASE.
+ */
+#define CONFIG_SYS_TEXT_BASE   0x80008000
+#define CONFIG_SPL_BSS_START_ADDR  0x8010
+#define CONFIG_SPL_BSS_MAX_SIZE0x8 /* 512 KB */
+
+#define CONFIG_SYS_SPL_MALLOC_START0x80208000
+#define CONFIG_SYS_SPL_MALLOC_SIZE 0x10
+
  #endif /* __CONFIG_H */




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


Re: [U-Boot] Merge Window close date

2013-06-17 Thread Masahiro Yamada
Hi, Wolfgang.


> > You fixed "Feb 09" to "May 11".
> > "May 11" is true?
> 
> Yes, I think so.

If I see http://www.denx.de/wiki/rdiff/U-Boot/ReleaseCycle,
you changed the merge window status from open to closed
at Jun 14 (r1.95).

You mean, the merge windows closed at May 11,
and Release Cycle page continued to provide the false
information from May 11 to Jun 14. Right?

If Release Cycle page is unreliable,
where can I know the current merge window status?

Best Regards,
Masahiro  Yamada

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


Re: [U-Boot] Merge Window close date

2013-06-17 Thread Wolfgang Denk
Dear Masahiro Yamada,

In message <20130618112016.e74e.aa925...@jp.panasonic.com> you wrote:
> 
> You fixed "Feb 09" to "May 11".
> "May 11" is true?

Yes, I think so.

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 I have seen further it is by standing on the shoulders of  giants.
  - Isaac Newton, Letter to Robert Hooke, 5 February 1676
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Merge Window close date

2013-06-17 Thread Masahiro Yamada
Hi, Wolfgang

> Thanks, fixed.

Thanks.

You fixed "Feb 09" to "May 11".
"May 11" is true?

Before posting my patches, I always see this page and check if the merge
window is open or not.
When I saw last week, it was saying the merge window was open.


> Actually you could have fixed it yourslef - the web site is a wiki,
> and editing the page takes not much more effort than posting a message
> on the mailing list.

Oh, I did not know that.
I will give it a try next time.
Thanks.


Best Regards,
Masahiro Yamada

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


Re: [U-Boot] [PATCH v5 05/14] nand: add Faraday FTNANDC021 NAND controller support

2013-06-17 Thread Scott Wood

On 06/17/2013 07:51:44 PM, Kuo-Jung Su wrote:

2013/6/18 Scott Wood :
> On 06/17/2013 07:06:55 AM, Kuo-Jung Su wrote:
>> +   off = 0;
>> +   while (off < len && priv->col < mtd->writesize) {
>> +   ftnandc021_pio_wait(priv);
>> +   *(uint32_t *)(buf + off) = readl(®s->dr);
>
>
> This looks like illegal type-punning.  Use memcpy.
>
> Likewise elsewhere.

How about put_unaligned() / get_unaligned() ?
It looks more simpler and safer to me.


That's fine too.

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


Re: [U-Boot] [PATCH v5 05/14] nand: add Faraday FTNANDC021 NAND controller support

2013-06-17 Thread Kuo-Jung Su
2013/6/18 Scott Wood :
> On 06/17/2013 07:06:55 AM, Kuo-Jung Su wrote:
>>
>> diff --git a/README b/README
>> index ac1ec44..3dbb7cc 100644
>> --- a/README
>> +++ b/README
>> @@ -3930,6 +3930,12 @@ Low Level (hardware related) configuration options:
>> - drivers/mtd/nand/ndfc.c
>> - drivers/mtd/nand/mxc_nand.c
>>
>> +- CONFIG_SYS_FTNANDC021_TIMING
>> +   This option specifies an array of customized timing
>> parameters
>> +   for Faraday FTNANDC021 NAND flash controller.
>> +   e.g.
>> +   #define CONFIG_SYS_FTNANDC021_TIMING { 0x02240264,
>> 0x42054209 }
>
>
> But what does 0x02240264 mean?  What does 0x42054209 mean?  I wasn't looking
> for an example, but rather the name of the register you're going to use each
> array element to initialize.
>

Got it, thanks

>> +   off = 0;
>> +   while (off < len && priv->col < mtd->writesize) {
>> +   ftnandc021_pio_wait(priv);
>> +   *(uint32_t *)(buf + off) = readl(®s->dr);
>
>
> This looks like illegal type-punning.  Use memcpy.
>
> Likewise elsewhere.

How about put_unaligned() / get_unaligned() ?
It looks more simpler and safer to me.

--
Best wishes,
Kuo-Jung Su
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] dfu, nand: before write a buffer to nand, erase the nand sectors

2013-06-17 Thread Scott Wood

On 06/17/2013 12:01:01 AM, Heiko Schocher wrote:

before writing the received buffer to nand, erase the nand
sectors. If not doing this, nand write fails. See for
more info here:

http://lists.denx.de/pipermail/u-boot/2013-June/156361.html

Signed-off-by: Heiko Schocher 
Cc: Scott Wood 
Cc: Pantelis Antoniou 
Cc: Lukasz Majewski 
Cc: Kyungmin Park 
Cc: Marek Vasut 
Cc: Tom Rini 

---
- changes for v2:
  - use opts.spread as Scott Wood suggested

 drivers/dfu/dfu_nand.c | 17 +++--
 1 Datei geändert, 15 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 7dc89b2..93db9bd 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -63,12 +63,25 @@ static int nand_block_op(enum dfu_nand_op op,  
struct dfu_entity *dfu,


nand = &nand_info[nand_curr_device];

-   if (op == DFU_OP_READ)
+   if (op == DFU_OP_READ) {
ret = nand_read_skip_bad(nand, start, &count, &actual,
lim, buf);
-   else
+   } else {
+   nand_erase_options_t opts;
+
+   memset(&opts, 0, sizeof(opts));
+   opts.offset = start;
+   opts.length = count;
+   opts.spread = 1;
+   opts.quiet = 1;
+   /* first erase */
+   ret = nand_erase_opts(nand, &opts);
+   if (ret)
+   return ret;
+   /* then write */
ret = nand_write_skip_bad(nand, start, &count, &actual,
lim, buf, 0);


BTW, I notice you are currently using the limit functionality of  
nand_read/write_skip_bad...  opts.spread currently does not have this  
support (as I noted before), which means that if there's an error you'd  
erase too much and then refuse to write.


Maybe we need an opts.limit?

adjust_size_for_badblocks, OTOH, is probably the opposite of what you  
wanted -- it subtracts from the size in order to get the number of good  
blocks within an interval, rather than adding the number of bad blocks  
to turn a data size into an interval.  It's meant to produce an input  
to be used with skipping/spreading operations.


Which makes me think we have a bug in cmd_nand.c -- we should be  
setting .spread in erase cases where we call adjust_size_for_badblocks.


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


Re: [U-Boot] [PATCH v5 13/14] mmc: ftsdc010_mci: clk_get_rate() -> clock_get_rate()

2013-06-17 Thread Kuo-Jung Su
2013/6/18 Andy Fleming :
>
>
>
> On Mon, Jun 17, 2013 at 7:07 AM, Kuo-Jung Su  wrote:
>>
>> From: Kuo-Jung Su 
>>
>> This updates ftsdc010_mci.c for latest Faraday clock APIs.
>>
>> Signed-off-by: Kuo-Jung Su 
>> CC: Albert Aribaud 
>> CC: Andy Fleming 
>
>
>
> Acked-by: Andy Fleming 
>
> Since this is part of a series, it should go in with the rest of them,
> rather than through the mmc tree.
>

Got it, thanks



--
Best wishes,
Kuo-Jung Su
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] powerpc/p1022ds: nand: introduce the TPL based on the SPL

2013-06-17 Thread Scott Wood

On 06/17/2013 02:56:45 AM, Zhang Ying-B40530 wrote:



-Original Message-
From: Wood Scott-B07421
Sent: Saturday, June 15, 2013 12:37 AM
To: Zhang Ying-B40530
Cc: Wood Scott-B07421; u-boot@lists.denx.de; aflem...@gmail.com; Xie  
Xiaobo-R63061
Subject: Re: [PATCH] powerpc/p1022ds: nand: introduce the TPL based  
on the SPL


On 06/14/2013 05:08:49 AM, Zhang Ying-B40530 wrote:
>
>
> -Original Message-
> From: Wood Scott-B07421
> Sent: Friday, June 14, 2013 5:50 AM
> To: Zhang Ying-B40530
> Cc: Wood Scott-B07421; u-boot@lists.denx.de; aflem...@gmail.com; Xie
> Xiaobo-R63061
> Subject: Re: [PATCH] powerpc/p1022ds: nand: introduce the TPL based
> on the SPL
>
> Treat the autoconf.mk patch as a dependency.  Don't try to hack  
around

> its absence.
> [Zhang Ying]
> According to what you said, the same set of symbols will be declared
> under different ifdefs.
> That's the trouble, "The same set of symbols declared under  
different
> ifdefs" will not be effective in the "Makefile", in the current  
case.


It *will* be effective in the makefile if there is a separate
autoconf.mk for each phase.  My point is that a separate autoconf.mk
for each phase is a requirement for TPL to be done in a sane way.
[Zhang Ying]
So, could you tell me where I do wrong? Please let me know the  
specific.

Thanks.


Do not create a whole bunch of CONFIG_TPL_... definitions.  Base your  
patches on top of the patch that creates a separate autoconf.mk.


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


Re: [U-Boot] [PATCH v5 05/14] nand: add Faraday FTNANDC021 NAND controller support

2013-06-17 Thread Scott Wood

On 06/17/2013 07:06:55 AM, Kuo-Jung Su wrote:

diff --git a/README b/README
index ac1ec44..3dbb7cc 100644
--- a/README
+++ b/README
@@ -3930,6 +3930,12 @@ Low Level (hardware related) configuration  
options:

- drivers/mtd/nand/ndfc.c
- drivers/mtd/nand/mxc_nand.c

+- CONFIG_SYS_FTNANDC021_TIMING
+		This option specifies an array of customized timing  
parameters

+   for Faraday FTNANDC021 NAND flash controller.
+   e.g.
+		#define CONFIG_SYS_FTNANDC021_TIMING { 0x02240264,  
0x42054209 }


But what does 0x02240264 mean?  What does 0x42054209 mean?  I wasn't  
looking for an example, but rather the name of the register you're  
going to use each array element to initialize.



+   off = 0;
+   while (off < len && priv->col < mtd->writesize) {
+   ftnandc021_pio_wait(priv);
+   *(uint32_t *)(buf + off) = readl(®s->dr);


This looks like illegal type-punning.  Use memcpy.

Likewise elsewhere.

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


Re: [U-Boot] [PATCH] mtd: nand/docg4: fix driver after Linux resync

2013-06-17 Thread Scott Wood

On 06/17/2013 12:44:55 PM, Mike Dunn wrote:

Commit dfe64e2c89731a3f9950d7acd8681b68df2bae03:

mtd: resync with Linux-3.7.1

broke the docg4 driver.  Specifically:
 - some of the prototypes of the ecc methods changed
 - the NAND_NO_AUTOINCR flag was removed
 - the ecc.strength element was added.

This patch fixes these.  Tested on the docg4 on my palmtre680 board.


Applied to u-boot-nand-flash.

Is board support for palmtre680 coming, so the driver will get routine  
build-testing?


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


Re: [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined

2013-06-17 Thread Otavio Salvador
On Thu, Jun 6, 2013 at 2:57 PM, Otavio Salvador  wrote:
> Signed-off-by: Otavio Salvador 

Ping?

--
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] ARM: Tegra: FDT: Add USB EHCI function for T30/T114

2013-06-17 Thread Stephen Warren
On 06/17/2013 02:39 PM, Marek Vasut wrote:
> Dear Thierry Reding,
> 
>> On Sun, Jun 16, 2013 at 10:48:45PM +0200, Marek Vasut wrote:
>>> Dear Thierry Reding,
>>>
 On Sat, Jun 15, 2013 at 11:28:25PM +0200, Marek Vasut wrote:
> Dear Thierry Reding,
>
>> On Fri, Jun 14, 2013 at 06:41:40PM +0800, Jim Lin wrote:
>> [...]
>>
>>> diff --git a/board/nvidia/dts/tegra30-beaver.dts
>>> b/board/nvidia/dts/tegra30-beaver.dts
>>
>> [...]
>>
>>> @@ -68,4 +69,9 @@
>>>
>>> status = "okay";
>>> bus-width = <8>;
>>> 
>>> };
>>>
>>> +
>>> +   usb@7d008000 {
>>> +   nvidia,vbus-gpio = <&gpio 61 3>; /* PH5,
>>>
>>> USB13_VBUS_PULLUP */
>>>
>> This doesn't work for me on Beaver. I need to turn the above line
>> into
>>
>> this:
>>  nvidia,vbus-gpio = <&gpio 236 0>; /* PDD4 */
>>
>> PDD4 is the correct GPIO according to the schematics and the pin is
>> high-active. Also as far as I can tell, 3 is not a meaningful value
>> for the U-Boot GPIO bindings. Only the value 1 (low-active) is
>> used.
>>
>> With that change applied on top of your patches I can see that a
>> USB flash drive connected to USB3 is indeed powered. However I
>> noticed
>>
>> something strange. When I try to use USB, I get this:
>>  Tegra30 (Beaver) # usb start
>>  (Re)start USB...
>>  USB0:   set_host_mode: GPIO 236 high
>>  USB EHCI 1.00
>>  scanning bus 0 for devices... 1 USB Device(s) found
>>  
>> scanning usb for storage devices... 0 Storage Device(s)
>> found scanning usb for ethernet devices... 0 Ethernet
>> Device(s) found
>>
>> So no storage device is detected, even though a USB flash drive is
>> connected and powered properly. If I repeat the same command,
>> however,
>>
>> the storage device is detected:
>>  Tegra30 (Beaver) # usb reset
>>  (Re)start USB...
>>  USB0:   set_host_mode: GPIO 236 high
>>  USB EHCI 1.00
>>  scanning bus 0 for devices... 2 USB Device(s) found
>>  
>> scanning usb for storage devices... 1 Storage Device(s)
>> found scanning usb for ethernet devices... 0 Ethernet
>> Device(s) found
>>
>> Any idea what might be going on here?
>
> Try waiting a little after setting the GPIO maybe? The drive might
> need some time to settle.

 I can make it work on the first invocation of "usb start" by adding a
 rather long mdelay() at the very end of ehci_hcd_init() in the Tegra
 EHCI driver. The magic value seems to be 853 ms. 852 ms wasn't enough
 in any of the test runs. 853 ms always worked.

 However 850+ ms seems like a very long time for the device to settle,
 and keeping it in the driver probably isn't a good idea. Furthermore I
 cannot reproduce the same issue with a newer flash drive, which works
 fine with no additional delays.
>>>
>>> Try reverting 020bbcb "usb: hub: Power-cycle on root-hub ports" ...
>>> there's a thread in the ML that it caused issues.
>>
>> I reverted the following two patches:
>>
>>  0bf796f usb: hub: Parallelize power-cycling of root-hub ports
>>  020bbcb usb: hub: Power-cycle on root-hub ports
>>
>> because it wasn't trivial to revert only 020bbcb alone. However it
>> didn't change anything regarding the problem I was seeing.
>>
>> Thierry
> 
> Ok, this looks ugly and calls for a bisect. Can you check it ? I'll try to 
> test 
> if USB works for me on some EHCI-enabled device.

The problem is definitely caused by 020bbcb "usb: hub: Power-cycle on
root-hub ports"; I reverted just that locally and it fixed my problems.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] ARM: tegra: enable LCD panel on Harmony

2013-06-17 Thread Stephen Warren
On 06/17/2013 03:06 PM, Stephen Warren wrote:

> diff --git a/include/configs/harmony.h b/include/configs/harmony.h

> +#define CONFIG_LCD_DT_SIMPLEFB

If you could delete that one line from this and patch 2.2 when you
apply, that'd be great. Let me know if you want me to resend because of
this.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] ARM: tegra: enable LCD panel on Harmony

2013-06-17 Thread Stephen Warren
From: Stephen Warren 

Signed-off-by: Stephen Warren 
---
 board/nvidia/dts/tegra20-harmony.dts | 32 
 board/nvidia/harmony/harmony.c   |  7 +++
 include/configs/harmony.h| 10 ++
 3 files changed, 49 insertions(+)

diff --git a/board/nvidia/dts/tegra20-harmony.dts 
b/board/nvidia/dts/tegra20-harmony.dts
index 7934e4a..b115f87 100644
--- a/board/nvidia/dts/tegra20-harmony.dts
+++ b/board/nvidia/dts/tegra20-harmony.dts
@@ -17,6 +17,17 @@
reg = <0x 0x4000>;
};
 
+   host1x {
+   status = "okay";
+   dc@5420 {
+   status = "okay";
+   rgb {
+   status = "okay";
+   nvidia,panel = <&lcd_panel>;
+   };
+   };
+   };
+
serial@70006300 {
clock-frequency = < 21600 >;
};
@@ -70,4 +81,25 @@
power-gpios = <&gpio 70 0>; /* gpio PI6 */
bus-width = <8>;
};
+
+   lcd_panel: panel {
+   clock = <4243>;
+   xres = <1024>;
+   yres = <600>;
+   left-margin = <138>;
+   right-margin = <34>;
+   hsync-len = <136>;
+   lower-margin = <4>;
+   upper-margin = <21>;
+   vsync-len = <4>;
+   hsync-active-high;
+   vsyncx-active-high;
+   nvidia,bits-per-pixel = <16>;
+   nvidia,pwm = <&pwm 0 0>;
+   nvidia,backlight-enable-gpios = <&gpio 13 0>;   /* PB5 */
+   nvidia,lvds-shutdown-gpios = <&gpio 10 0>;  /* PB2 */
+   nvidia,backlight-vdd-gpios = <&gpio 176 0>; /* PW0 */
+   nvidia,panel-vdd-gpios = <&gpio 22 0>;  /* PC6 */
+   nvidia,panel-timings = <0 0 200 0 0>;
+   };
 };
diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c
index 3122441..dd8f99a 100644
--- a/board/nvidia/harmony/harmony.c
+++ b/board/nvidia/harmony/harmony.c
@@ -22,6 +22,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -59,3 +60,9 @@ void pin_mux_usb(void)
/* USB2 PHY reset GPIO */
pinmux_tristate_disable(PINGRP_UAC);
 }
+
+void pin_mux_display(void)
+{
+   pinmux_set_func(PINGRP_SDC, PMUX_FUNC_PWM);
+   pinmux_tristate_disable(PINGRP_SDC);
+}
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index 0c73f86..f3ef246 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -49,6 +49,7 @@
 #define CONFIG_MACH_TYPE   MACH_TYPE_HARMONY
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT /* Make sure LCD init is complete */
 
 /* SD/MMC */
 #define CONFIG_MMC
@@ -83,6 +84,15 @@
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_DHCP
 
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_PWM_TEGRA
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPPLCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES10
+#define CONFIG_LCD_DT_SIMPLEFB
+
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
-- 
1.8.1.5

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


[U-Boot] [PATCH 2/2] ARM: tegra: enable LCD panel on Ventana

2013-06-17 Thread Stephen Warren
From: Stephen Warren 

Signed-off-by: Stephen Warren 
---
 board/nvidia/dts/tegra20-ventana.dts | 32 
 include/configs/ventana.h| 10 ++
 2 files changed, 42 insertions(+)

diff --git a/board/nvidia/dts/tegra20-ventana.dts 
b/board/nvidia/dts/tegra20-ventana.dts
index e1a3d1e..1a526ba 100644
--- a/board/nvidia/dts/tegra20-ventana.dts
+++ b/board/nvidia/dts/tegra20-ventana.dts
@@ -16,6 +16,17 @@
reg = <0x 0x4000>;
};
 
+   host1x {
+   status = "okay";
+   dc@5420 {
+   status = "okay";
+   rgb {
+   status = "okay";
+   nvidia,panel = <&lcd_panel>;
+   };
+   };
+   };
+
serial@70006300 {
clock-frequency = < 21600 >;
};
@@ -56,4 +67,25 @@
status = "okay";
bus-width = <8>;
};
+
+   lcd_panel: panel {
+   clock = <72072000>;
+   xres = <1366>;
+   yres = <768>;
+   left-margin = <58>;
+   right-margin = <58>;
+   hsync-len = <58>;
+   lower-margin = <4>;
+   upper-margin = <4>;
+   vsync-len = <4>;
+   hsync-active-high;
+   vsync-active-high;
+   nvidia,bits-per-pixel = <16>;
+   nvidia,pwm = <&pwm 2 0>;
+   nvidia,backlight-enable-gpios = <&gpio 28 0>;   /* PD4 */
+   nvidia,lvds-shutdown-gpios = <&gpio 10 0>;  /* PB2 */
+   nvidia,backlight-vdd-gpios = <&gpio 176 0>; /* PW0 */
+   nvidia,panel-vdd-gpios = <&gpio 22 0>;  /* PC6 */
+   nvidia,panel-timings = <0 0 200 0 0>;
+   };
 };
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 41a7176..39ad77d 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -43,6 +43,7 @@
 #define CONFIG_MACH_TYPE   MACH_TYPE_VENTANA
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT /* Make sure LCD init is complete */
 
 /* SD/MMC */
 #define CONFIG_MMC
@@ -73,6 +74,15 @@
 /* USB keyboard */
 #define CONFIG_USB_KEYBOARD
 
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_PWM_TEGRA
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPPLCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES10
+#define CONFIG_LCD_DT_SIMPLEFB
+
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
-- 
1.8.1.5

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


[U-Boot] [PATCH 1/3] net2big_v2: initialize I2C fan at startup

2013-06-17 Thread Simon Guinot
This patch ensures minimal cooling for the net2big_v2 by automatically
starting the I2C fan (GMT G762) at low speed (2800 RPM).

Signed-off-by: Simon Guinot 
---
 board/LaCie/net2big_v2/net2big_v2.c |   54 ++-
 board/LaCie/net2big_v2/net2big_v2.h |5 
 include/configs/lacie_kw.h  |9 +-
 3 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/board/LaCie/net2big_v2/net2big_v2.c 
b/board/LaCie/net2big_v2/net2big_v2.c
index e524f35..6cca4fb 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,8 +93,59 @@ int board_init(void)
 }
 
 #if defined(CONFIG_MISC_INIT_R)
+
+#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_G762_ADDR)
+/*
+ * Start I2C fan (GMT G762 controller)
+ */
+static void init_fan(void)
+{
+   u8 data;
+
+   i2c_set_bus_num(0);
+
+   /* Enable open-loop and PWM modes */
+   data = 0x20;
+   if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
+ G762_REG_FAN_CMD1, 1, &data, 1) != 0)
+   goto err;
+   data = 0;
+   if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
+ G762_REG_SET_CNT, 1, &data, 1) != 0)
+   goto err;
+   /*
+* RPM to PWM (set_out register) fan speed conversion array:
+* 00x00
+* 1500 0x04
+* 2800 0x08
+* 3400 0x0C
+* 3700 0x10
+* 4400 0x20
+* 4700 0x30
+* 4800 0x50
+* 5200 0x80
+* 5400 0xC0
+* 5500 0xFF
+*
+* Start fan at low speed (2800 RPM):
+*/
+   data = 0x08;
+   if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
+ G762_REG_SET_OUT, 1, &data, 1) != 0)
+   goto err;
+
+   return;
+err:
+   printf("Error: failed to start I2C fan @%02x\n",
+  CONFIG_SYS_I2C_G762_ADDR);
+}
+#else
+static void init_fan(void) {}
+#endif /* CONFIG_CMD_I2C && CONFIG_SYS_I2C_G762_ADDR */
+
 int misc_init_r(void)
 {
+   init_fan();
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
if (!getenv("ethaddr")) {
uchar mac[6];
@@ -103,7 +155,7 @@ int misc_init_r(void)
 #endif
return 0;
 }
-#endif
+#endif /* CONFIG_MISC_INIT_R */
 
 #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
 /* Configure and initialize PHY */
diff --git a/board/LaCie/net2big_v2/net2big_v2.h 
b/board/LaCie/net2big_v2/net2big_v2.h
index f9778f4..83537d6 100644
--- a/board/LaCie/net2big_v2/net2big_v2.h
+++ b/board/LaCie/net2big_v2/net2big_v2.h
@@ -32,4 +32,9 @@
 /* Buttons */
 #define NET2BIG_V2_GPIO_PUSH_BUTTON34
 
+/* GMT G762 registers (I2C fan controller) */
+#define G762_REG_SET_CNT   0x00
+#define G762_REG_SET_OUT   0x03
+#define G762_REG_FAN_CMD1  0x04
+
 #endif /* NET2BIG_V2_H */
diff --git a/include/configs/lacie_kw.h b/include/configs/lacie_kw.h
index 09b5798..e2b3b21 100644
--- a/include/configs/lacie_kw.h
+++ b/include/configs/lacie_kw.h
@@ -120,10 +120,14 @@
 #endif
 
 /*
+ * Enable platform initialisation via misc_init_r() function
+ */
+#define CONFIG_MISC_INIT_R
+
+/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_MISC_INIT_R /* Call misc_init_r() to initialize MAC address */
 #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */
 #define CONFIG_NETCONSOLE
 #endif
@@ -153,6 +157,9 @@
 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS  4 /* 16-byte page size */
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* 8-bit device address */
+#if defined(CONFIG_NET2BIG_V2)
+#define CONFIG_SYS_I2C_G762_ADDR   0x3e
+#endif
 #endif /* CONFIG_CMD_I2C */
 
 /*
-- 
1.7.10.4

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


[U-Boot] [PATCH 3/3] net2big_v2: initialize LEDs at startup

2013-06-17 Thread Simon Guinot
This patch allows to configure the net2big_v2 LEDs at startup (through
the GPIO extension bus). The front blue LED is enabled and the SATA rear
LEDs are configured to blink in relation with the SATA activity.

Signed-off-by: Simon Guinot 
---
 board/LaCie/net2big_v2/Makefile |3 ++
 board/LaCie/net2big_v2/net2big_v2.c |   86 +++
 2 files changed, 89 insertions(+)

diff --git a/board/LaCie/net2big_v2/Makefile b/board/LaCie/net2big_v2/Makefile
index fbae48e..eca25e7 100644
--- a/board/LaCie/net2big_v2/Makefile
+++ b/board/LaCie/net2big_v2/Makefile
@@ -28,6 +28,9 @@ endif
 LIB= $(obj)lib$(BOARD).o
 
 COBJS  := $(BOARD).o ../common/common.o
+ifneq ($(and $(CONFIG_KIRKWOOD_GPIO),$(CONFIG_NET2BIG_V2)),)
+COBJS  += ../common/gpio-ext.o
+endif
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/LaCie/net2big_v2/net2big_v2.c 
b/board/LaCie/net2big_v2/net2big_v2.c
index 6cca4fb..caa9f64 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -30,6 +30,7 @@
 
 #include "net2big_v2.h"
 #include "../common/common.h"
+#include "../common/gpio-ext.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -143,6 +144,89 @@ err:
 static void init_fan(void) {}
 #endif /* CONFIG_CMD_I2C && CONFIG_SYS_I2C_G762_ADDR */
 
+#if defined(CONFIG_NET2BIG_V2) && defined(CONFIG_KIRKWOOD_GPIO)
+/*
+ * GPIO extension bus:
+ *
+ * - address register : bit [0-2] -> GPIO [47-49]
+ * - data register: bit [0-2] -> GPIO [44-46]
+ * - enable register  : GPIO 29
+ */
+static unsigned gpio_ext_addr[] = { 47, 48, 49 };
+static unsigned gpio_ext_data[] = { 44, 45, 46 };
+
+static struct gpio_ext gpio_ext = {
+   .addr   = gpio_ext_addr,
+   .num_addr   = ARRAY_SIZE(gpio_ext_addr),
+   .data   = gpio_ext_data,
+   .num_data   = ARRAY_SIZE(gpio_ext_data),
+   .enable = 29,
+};
+
+/*
+ * LEDs configuration:
+ *
+ * The LEDs are controlled by a CPLD and can be configured through
+ * the GPIO extension bus.
+ *
+ * Address register selection:
+ *
+ * addr | register
+ * 
+ *   0  | front LED
+ *   1  | front LED brightness
+ *   2  | SATA LED brightness
+ *   3  | SATA0 LED
+ *   4  | SATA1 LED
+ *   5  | SATA2 LED
+ *   6  | SATA3 LED
+ *   7  | SATA4 LED
+ *
+ * Data register configuration:
+ *
+ * data | LED brightness
+ * -
+ *   0  | min (off)
+ *   -  | -
+ *   7  | max
+ *
+ * data | front LED mode
+ * -
+ *   0  | fix off
+ *   1  | fix blue on
+ *   2  | fix red on
+ *   3  | blink blue on=1 sec and blue off=1 sec
+ *   4  | blink red on=1 sec and red off=1 sec
+ *   5  | blink blue on=2.5 sec and red on=0.5 sec
+ *   6  | blink blue on=1 sec and red on=1 sec
+ *   7  | blink blue on=0.5 sec and blue off=2.5 sec
+ *
+ * data | SATA LED mode
+ * -
+ *   0  | fix off
+ *   1  | SATA activity blink
+ *   2  | fix red on
+ *   3  | blink blue on=1 sec and blue off=1 sec
+ *   4  | blink red on=1 sec and red off=1 sec
+ *   5  | blink blue on=2.5 sec and red on=0.5 sec
+ *   6  | blink blue on=1 sec and red on=1 sec
+ *   7  | fix blue on
+ */
+static void init_leds(void)
+{
+   /* Enable the front blue LED */
+   gpio_ext_set_value(&gpio_ext, 0, 1);
+   gpio_ext_set_value(&gpio_ext, 1, 3);
+
+   /* Configure SATA LEDs to blink in relation with the SATA activity */
+   gpio_ext_set_value(&gpio_ext, 3, 1);
+   gpio_ext_set_value(&gpio_ext, 4, 1);
+   gpio_ext_set_value(&gpio_ext, 2, 3);
+}
+#else
+static void init_leds(void) {}
+#endif /* CONFIG_NET2BIG_V2 && CONFIG_KIRKWOOD_GPIO */
+
 int misc_init_r(void)
 {
init_fan();
@@ -153,6 +237,8 @@ int misc_init_r(void)
eth_setenv_enetaddr("ethaddr", mac);
}
 #endif
+   init_leds();
+
return 0;
 }
 #endif /* CONFIG_MISC_INIT_R */
-- 
1.7.10.4

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


[U-Boot] [PATCH 2/3] LaCie/common: add support for the GPIO extension bus

2013-06-17 Thread Simon Guinot
This patch adds support for the GPIO extension bus found on some LaCie
boards (as the 2Big/5Big Network v2 and the 2Big NAS). This bus allows
to configure the devices (mostly the LEDs) connected to a CPLD via two
GPIO-based registers (address and data).

Signed-off-by: Simon Guinot 
---
 board/LaCie/common/gpio-ext.c |   47 +
 board/LaCie/common/gpio-ext.h |   24 +
 2 files changed, 71 insertions(+)
 create mode 100644 board/LaCie/common/gpio-ext.c
 create mode 100644 board/LaCie/common/gpio-ext.h

diff --git a/board/LaCie/common/gpio-ext.c b/board/LaCie/common/gpio-ext.c
new file mode 100644
index 000..1e1b7ff
--- /dev/null
+++ b/board/LaCie/common/gpio-ext.c
@@ -0,0 +1,47 @@
+/*
+ * gpio-ext.c: provides support for the GPIO extension bus found on some
+ * LaCie boards (as the 2Big/5Big Network v2 and the 2Big NAS). This bus
+ * allows to configure the devices (mostly the LEDs) connected to a CPLD
+ * via two GPIO-based registers (address and data).
+ *
+ * Copyright (C) 2013 Simon Guinot 
+ *
+ * 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.
+ */
+
+#include 
+#include "gpio-ext.h"
+
+static void gpio_ext_set_addr(struct gpio_ext *gpio_ext, unsigned addr)
+{
+   int pin;
+
+   for (pin = 0; pin < gpio_ext->num_addr; pin++)
+   kw_gpio_set_value(gpio_ext->addr[pin], (addr >> pin) & 1);
+}
+
+static void gpio_ext_set_data(struct gpio_ext *gpio_ext, unsigned data)
+{
+   int pin;
+
+   for (pin = 0; pin < gpio_ext->num_data; pin++)
+   kw_gpio_set_value(gpio_ext->data[pin], (data >> pin) & 1);
+}
+
+static void gpio_ext_enable_select(struct gpio_ext *gpio_ext)
+{
+   /* The transfer is enabled on the raising edge. */
+   kw_gpio_set_value(gpio_ext->enable, 0);
+   kw_gpio_set_value(gpio_ext->enable, 1);
+}
+
+void gpio_ext_set_value(struct gpio_ext *gpio_ext,
+   unsigned addr, unsigned value)
+{
+   gpio_ext_set_addr(gpio_ext, addr);
+   gpio_ext_set_data(gpio_ext, value);
+   gpio_ext_enable_select(gpio_ext);
+}
diff --git a/board/LaCie/common/gpio-ext.h b/board/LaCie/common/gpio-ext.h
new file mode 100644
index 000..09fa271
--- /dev/null
+++ b/board/LaCie/common/gpio-ext.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2013 Simon Guinot 
+ *
+ * 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.
+ */
+
+#ifndef _LACIE_GPIO_EXT_H
+#define _LACIE_GPIO_EXT_H
+
+struct gpio_ext {
+   unsigned *addr;
+   unsigned num_addr;
+   unsigned *data;
+   unsigned num_data;
+   unsigned enable;
+};
+
+void gpio_ext_set_value(struct gpio_ext *gpio_ext,
+   unsigned addr, unsigned value);
+
+#endif /* _LACIE_GPIO_EXT_H */
-- 
1.7.10.4

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


[U-Boot] [PATCH 0/3] net2big_v2: initialize fan and LEDs at startup

2013-06-17 Thread Simon Guinot
Hi Prafulla,

This patch series allows to initialize the fan and the LEDs found on the
net2big_v2.

Regards,

Simon

Simon Guinot (3):
  net2big_v2: initialize I2C fan at startup
  LaCie/common: add support for the GPIO extension bus
  net2big_v2: initialize LEDs at startup

 board/LaCie/common/gpio-ext.c   |   47 
 board/LaCie/common/gpio-ext.h   |   24 ++
 board/LaCie/net2big_v2/Makefile |3 +
 board/LaCie/net2big_v2/net2big_v2.c |  140 ++-
 board/LaCie/net2big_v2/net2big_v2.h |5 ++
 include/configs/lacie_kw.h  |9 ++-
 6 files changed, 226 insertions(+), 2 deletions(-)
 create mode 100644 board/LaCie/common/gpio-ext.c
 create mode 100644 board/LaCie/common/gpio-ext.h

-- 
1.7.10.4

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


Re: [U-Boot] [PATCH v3 3/3] Tegra: Config: Enable Tegra30/Tegra114 USB function

2013-06-17 Thread Marek Vasut
Dear Stephen Warren,

> On 06/17/2013 03:09 AM, Jim Lin wrote:
> > Add USB EHCI, storage and network support.
> > 
> > Tested on Tegra30 Cardhu, and Tegra114 Dalmore
> > platforms. All works well.
> > 
> > diff --git a/include/configs/beaver.h b/include/configs/beaver.h
> > 
> > +/* USB Host support */
> 
> I notice that some Tegra20 boards include the following line here:
> 
> #define CONFIG_USB_MAX_CONTROLLER_COUNT 3
> 
> Is this necessary here too?
> 
> If it doesn't serve any purpose, can you send an extra patch to remove
> this from seaboard.h, harmony.h, trimslice.h, and colibtri_t20_iris.h.
> Thanks.

The default value is 1, if you have multiple EHCI controllers on the 
board/chip, 
you want to configure this accordingly.

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


Re: [U-Boot] [PATCH v3 1/3] ARM: Tegra: FDT: Add USB EHCI function for T30/T114

2013-06-17 Thread Marek Vasut
Dear Stephen Warren,

> On 06/17/2013 03:09 AM, Jim Lin wrote:
> > Add DT node for USB EHCI function.
> > Add support for T30-Cardhu, T30-Beaver, T114-Dalmore boards.
> 
> This patch shouldn't touch both DT files and code at the same time. The
> code changes should be part of the patch to the USB driver.
> 
> > diff --git a/board/nvidia/dts/tegra30-cardhu.dts
> > b/board/nvidia/dts/tegra30-cardhu.dts
> > 
> > +   usb@7d008000 {
> > +   nvidia,vbus-gpio = <&gpio 233 3>;   /* PDD1, EN_3V3_PU */
> > +   status = "okay";
> > +   };
> 
> PDD1 is the wrong signal. That enables a 100L pullup to a bunch of
> different signals, including the VBUS GPIO. Instead, I think you should
> be using PEX_L1_PRSNT / EN_USB3_VBUS_OC / PDD4, which co-incidentally
> matches the value in the Beaver .dts file in this patch, most likely
> because Beaver is closely based on Cardhu.

Thanks for reviewing those, will wait for V4.

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


Re: [U-Boot] [PATCH v2 1/3] ARM: Tegra: FDT: Add USB EHCI function for T30/T114

2013-06-17 Thread Marek Vasut
Dear Thierry Reding,

> On Sun, Jun 16, 2013 at 10:48:45PM +0200, Marek Vasut wrote:
> > Dear Thierry Reding,
> > 
> > > On Sat, Jun 15, 2013 at 11:28:25PM +0200, Marek Vasut wrote:
> > > > Dear Thierry Reding,
> > > > 
> > > > > On Fri, Jun 14, 2013 at 06:41:40PM +0800, Jim Lin wrote:
> > > > > [...]
> > > > > 
> > > > > > diff --git a/board/nvidia/dts/tegra30-beaver.dts
> > > > > > b/board/nvidia/dts/tegra30-beaver.dts
> > > > > 
> > > > > [...]
> > > > > 
> > > > > > @@ -68,4 +69,9 @@
> > > > > > 
> > > > > > status = "okay";
> > > > > > bus-width = <8>;
> > > > > > 
> > > > > > };
> > > > > > 
> > > > > > +
> > > > > > +   usb@7d008000 {
> > > > > > +   nvidia,vbus-gpio = <&gpio 61 3>; /* PH5,
> > 
> > USB13_VBUS_PULLUP */
> > 
> > > > > This doesn't work for me on Beaver. I need to turn the above line
> > > > > into
> > > > > 
> > > > > this:
> > > > >   nvidia,vbus-gpio = <&gpio 236 0>; /* PDD4 */
> > > > > 
> > > > > PDD4 is the correct GPIO according to the schematics and the pin is
> > > > > high-active. Also as far as I can tell, 3 is not a meaningful value
> > > > > for the U-Boot GPIO bindings. Only the value 1 (low-active) is
> > > > > used.
> > > > > 
> > > > > With that change applied on top of your patches I can see that a
> > > > > USB flash drive connected to USB3 is indeed powered. However I
> > > > > noticed
> > > > > 
> > > > > something strange. When I try to use USB, I get this:
> > > > >   Tegra30 (Beaver) # usb start
> > > > >   (Re)start USB...
> > > > >   USB0:   set_host_mode: GPIO 236 high
> > > > >   USB EHCI 1.00
> > > > >   scanning bus 0 for devices... 1 USB Device(s) found
> > > > >   
> > > > >  scanning usb for storage devices... 0 Storage Device(s)
> > > > >  found scanning usb for ethernet devices... 0 Ethernet
> > > > >  Device(s) found
> > > > > 
> > > > > So no storage device is detected, even though a USB flash drive is
> > > > > connected and powered properly. If I repeat the same command,
> > > > > however,
> > > > > 
> > > > > the storage device is detected:
> > > > >   Tegra30 (Beaver) # usb reset
> > > > >   (Re)start USB...
> > > > >   USB0:   set_host_mode: GPIO 236 high
> > > > >   USB EHCI 1.00
> > > > >   scanning bus 0 for devices... 2 USB Device(s) found
> > > > >   
> > > > >  scanning usb for storage devices... 1 Storage Device(s)
> > > > >  found scanning usb for ethernet devices... 0 Ethernet
> > > > >  Device(s) found
> > > > > 
> > > > > Any idea what might be going on here?
> > > > 
> > > > Try waiting a little after setting the GPIO maybe? The drive might
> > > > need some time to settle.
> > > 
> > > I can make it work on the first invocation of "usb start" by adding a
> > > rather long mdelay() at the very end of ehci_hcd_init() in the Tegra
> > > EHCI driver. The magic value seems to be 853 ms. 852 ms wasn't enough
> > > in any of the test runs. 853 ms always worked.
> > > 
> > > However 850+ ms seems like a very long time for the device to settle,
> > > and keeping it in the driver probably isn't a good idea. Furthermore I
> > > cannot reproduce the same issue with a newer flash drive, which works
> > > fine with no additional delays.
> > 
> > Try reverting 020bbcb "usb: hub: Power-cycle on root-hub ports" ...
> > there's a thread in the ML that it caused issues.
> 
> I reverted the following two patches:
> 
>   0bf796f usb: hub: Parallelize power-cycling of root-hub ports
>   020bbcb usb: hub: Power-cycle on root-hub ports
> 
> because it wasn't trivial to revert only 020bbcb alone. However it
> didn't change anything regarding the problem I was seeing.
> 
> Thierry

Ok, this looks ugly and calls for a bisect. Can you check it ? I'll try to test 
if USB works for me on some EHCI-enabled device.

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


Re: [U-Boot] [PATCH] Fix block device accesses beyond 2TiB

2013-06-17 Thread Marek Vasut
Hello Sascha,

> With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
> which is required to represent block numbers for storage devices that
> exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.
> 
> For some obscure reason, the current U-Boot code uses lbaint_t for the
> number of blocks to read (a rather optimistic estimation of how RAM
> sizes will evolve), but not for the starting address. Trying to access
> blocks beyond the 2TiB boundary will simply wrap around and read a
> block within the 0..2TiB range.
> 
> We now use lbaint_t for block start addresses, too. This required
> changes to all block drivers as the signature of block_read(),
> block_write() and block_erase() in block_dev_desc_t changed.
> 
> Signed-off-by: Sascha Silbe 
> ---
> Functionality tested on CuBox Pro with a Western Digital WD30EFRX hard
> disk (3TB). Build tested for all arm boards and sandbox.
> 
> Testing on other boards and architectures would be appreciated.
> 
> Fixes for typos, style errors etc. are explicitly out of scope for
> this patch, even those checkpatch complains about because they appear
> on or near lines touched by the patch. They are unrelated to the issue
> at hand and can be fixed up later. Mixing in unrelated changes would
> just make harder to revert any problematic change.

Quick review looks OK.

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


Re: [U-Boot] [PATCH] am33xx: fix the ddr_cmdtctrl structure

2013-06-17 Thread Peter Korsgaard
> "Ilya" == Ilya Ledvich  writes:

 Ilya> Fix the wrong mapping between the DDR I/O control registers on
 Ilya> AM33XX SoCs and the software representation in the SPL code.  The
 Ilya> most recent public TRM defines the following DDR I/O control
 Ilya> registers offsets:

 Ilya>  * ddr_cmd0_ioctrl : offset 0x44E11404
 Ilya>  * ddr_cmd1_ioctrl : offset 0x44E11408
 Ilya>  * ddr_cmd2_ioctrl : offset 0x44E1140C
 Ilya>  * ddr_data0_ioctrl: offset 0x44E11440
 Ilya>  * ddr_data1_ioctrl: offset 0x44E11444

 Ilya> While the struct ddr_cmdtctrl has also some reserved bits in the
 Ilya> beginning.  The struct is mapped to the address 0x44E11404. As a
 Ilya> result "cm0ioctl" points to the ddr_cmd1_ioctrl register,
 Ilya> "cm1ioctl" to the ddr_cmd2_ioctrl and etc.  Registers
 Ilya> ddr_cmd0_ioctrl and ddr_data0_ioctrl are never configured because
 Ilya> of this mapping mismatch.

 Ilya> Signed-off-by: Ilya Ledvich 

Reviewed-by: Peter Korsgaard 

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


[U-Boot] [PATCH] mpc83xx: add support for mpc8306

2013-06-17 Thread Filip Brozovic
This processor is most similar to the MPC8309, but lacks PCI.

Signed-off-by: Filip Brozovic 
---
 arch/powerpc/cpu/mpc83xx/cpu.c |  1 +
 arch/powerpc/cpu/mpc83xx/cpu_init.c|  4 +++
 arch/powerpc/cpu/mpc83xx/speed.c   | 24 ++--
 arch/powerpc/include/asm/global_data.h |  2 +-
 arch/powerpc/include/asm/immap_83xx.h  | 52 --
 arch/powerpc/include/asm/immap_qe.h|  2 +-
 drivers/qe/qe.c|  4 +--
 include/mpc83xx.h  |  9 +++---
 8 files changed, 80 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index cc20234..13fd502 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -55,6 +55,7 @@ int checkcpu(void)
char name[15];
u32 partid;
} cpu_type_list [] = {
+   CPU_TYPE_ENTRY(8306),
CPU_TYPE_ENTRY(8308),
CPU_TYPE_ENTRY(8309),
CPU_TYPE_ENTRY(8311),
diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c 
b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index 5153351..8beefc1 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -334,7 +334,11 @@ void cpu_init_f (volatile immap_t * im)
struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR;
 
/* Configure interface. */
+#ifdef CONFIG_MPC8306
+   setbits_be32(&ehci->control, REFSEL_16MHZ | PHY_CLK_SEL_ULPI);
+#else
setbits_be32(&ehci->control, REFSEL_16MHZ | UTMI_PHY_EN);
+#endif
 
/* Wait for clock to stabilize */
do {
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 6be0e3a..7c2a3bd 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -105,7 +105,7 @@ int get_clocks(void)
u32 tsec1_clk;
u32 tsec2_clk;
u32 usbdr_clk;
-#elif defined(CONFIG_MPC8309)
+#elif defined(CONFIG_MPC8306) || defined(CONFIG_MPC8309)
u32 usbdr_clk;
 #endif
 #ifdef CONFIG_MPC834x
@@ -122,7 +122,7 @@ int get_clocks(void)
 #if defined(CONFIG_FSL_ESDHC)
u32 sdhc_clk;
 #endif
-#if !defined(CONFIG_MPC8309)
+#if !defined(CONFIG_MPC8306) && !defined(CONFIG_MPC8309)
u32 enc_clk;
 #endif
u32 lbiu_clk;
@@ -166,7 +166,11 @@ int get_clocks(void)
}
 
spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
+#if defined(CONFIG_MPC8306)
+   csb_clk = CONFIG_83XX_CLKIN * spmf;
+#else
csb_clk = pci_sync_in * (1 + clkin_div) * spmf;
+#endif
 
sccr = im->clk.sccr;
 
@@ -267,7 +271,7 @@ int get_clocks(void)
return -6;
}
 #endif
-#if !defined(CONFIG_MPC8309)
+#if !defined(CONFIG_MPC8306) && !defined(CONFIG_MPC8309)
switch ((sccr & SCCR_ENCCM) >> SCCR_ENCCM_SHIFT) {
case 0:
enc_clk = 0;
@@ -338,7 +342,7 @@ int get_clocks(void)
i2c1_clk = sdhc_clk;
 #elif defined(CONFIG_MPC837x)
i2c1_clk = enc_clk;
-#elif defined(CONFIG_MPC8309)
+#elif defined(CONFIG_MPC8306) || defined(CONFIG_MPC8309)
i2c1_clk = csb_clk;
 #endif
 #if !defined(CONFIG_MPC832x)
@@ -458,7 +462,11 @@ int get_clocks(void)
 #if defined(CONFIG_QE)
qepmf = (im->clk.spmr & SPMR_CEPMF) >> SPMR_CEPMF_SHIFT;
qepdf = (im->clk.spmr & SPMR_CEPDF) >> SPMR_CEPDF_SHIFT;
+#if defined(CONFIG_MPC8306)
+   qe_clk = (CONFIG_83XX_QE_CLKIN * qepmf) / (1 + qepdf);
+#else
qe_clk = (pci_sync_in * qepmf) / (1 + qepdf);
+#endif
brg_clk = qe_clk / 2;
 #endif
 
@@ -468,7 +476,7 @@ int get_clocks(void)
gd->arch.tsec1_clk = tsec1_clk;
gd->arch.tsec2_clk = tsec2_clk;
gd->arch.usbdr_clk = usbdr_clk;
-#elif defined(CONFIG_MPC8309)
+#elif defined(CONFIG_MPC8306) || defined(CONFIG_MPC8309)
gd->arch.usbdr_clk = usbdr_clk;
 #endif
 #if defined(CONFIG_MPC834x)
@@ -485,7 +493,7 @@ int get_clocks(void)
 #if !defined(CONFIG_MPC832x)
gd->arch.i2c2_clk = i2c2_clk;
 #endif
-#if !defined(CONFIG_MPC8309)
+#if !defined(CONFIG_MPC8306) && !defined(CONFIG_MPC8309)
gd->arch.enc_clk = enc_clk;
 #endif
gd->arch.lbiu_clk = lbiu_clk;
@@ -555,7 +563,7 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
printf("  DDR Secondary:   %-4s MHz\n",
   strmhz(buf, gd->arch.mem_sec_clk));
 #endif
-#if !defined(CONFIG_MPC8309)
+#if !defined(CONFIG_MPC8306) && !defined(CONFIG_MPC8309)
printf("  SEC: %-4s MHz\n",
   strmhz(buf, gd->arch.enc_clk));
 #endif
@@ -581,7 +589,7 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
   strmhz(buf, gd->arch.tsec2_clk));
printf("  USB DR:  %-4s MHz\n",
   strmhz(buf, gd->arch.usbdr_clk));
-#elif defined(CONFIG_MPC8309)
+#elif defined(CONFIG_MPC8306) || defined(CONFIG_MPC8309)
printf("  USB DR:  %-4s MHz\n

Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 17/06/13 18:04, Kipisz, Steven wrote:



>> I'll look at that thanks.
>>
>> But I've taken a slightly different approach, and added the following to the
>> start of s_init() ...
>>
>>
>>
>> void s_init(void)
>> {
>>  unsigned short *p = (unsigned short*)0x0800;
>>  while (1)
>>  {
>>  int i;
>>  for (i = 0; i < (1 * 1024); i++)
>>  {
>>  unsigned short d = p[i];
>>  d++;
>>  *p = d;
>>  }
>>  }
>>  ...
>>
>> AFAICT, that should just spin on reading/writing the NOR device, but I still 
>> get
>> only an initial 350us burst on the CS0 line, and then nothing.
>>
>> So I can only assume that the boot code isn't getting as far as
>> s_init() at all !!
>>
>> In start.S and low_levelinit.c, there are various uses of:-
>>
>> #ifdef CONFIG_SPL_BUILD
>>
>> Do any of these also need referencing with a CONFIG_NOR_BOOT ?
>>
>> Mark J.
> 
> Do  you have a u-boot.lds in board/ti/am335x? That should put s_init() 
> earlier in the boot. Also, include/configs/am335x_evm.h should have 
> /* Custom script for NOR */
> #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds"

Yes ... I have both u-boot.lds in my board directory, and the reference
to it in the config.

#define CONFIG_SYS_LDSCRIPT "board/newflow/nanobone/u-boot.lds"

> Before using JTAG, take a look in System.map where s_init is located. For a 
> multiplex NOR it should be in the first 64K of address space.

That all seems in order ...

0800 T __image_copy_start
0800 T _start
0820 t _undefined_instruction
0824 t _software_interrupt
0828 t _prefetch_abort
082c t _data_abort
0830 t _not_used
0834 t _irq
0838 t _fiq
083c t _pad
0840 T _TEXT_BASE
0840 T _end_vect
0844 T _bss_start_ofs
0848 T _bss_end_ofs
084c T _end_ofs
0850 T IRQ_STACK_START_IN
0854 t reset
0894 T c_runtime_cpu_setup
08b0 T cpu_init_cp15
08e8 T cpu_init_crit
08000100 t undefined_instruction
08000160 t software_interrupt
080001c0 t prefetch_abort
08000220 t data_abort
08000280 t not_used
080002e0 t irq
08000340 t fiq
080003a0 T enable_board_pin_mux
08000444 t cpsw_control
08000448 T s_init  <
08000464 t gpmc_mux
08000568 T board_init
080005d8 T board_late_init
0800060c T board_eth_init
0800076c T enable_gpmc_cs_config
080007e0 T gpmc_init
...

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


[U-Boot] [PATCH 3/3] omap: cm_t35: Fix cm_t35 for weak splash_screen_prepare

2013-06-17 Thread Robert Winkler
Signed-off-by: Robert Winkler 
---
 board/compulab/cm_t35/cm_t35.c | 2 +-
 include/configs/cm_t35.h   | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index b0b80e5..95098af 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -120,7 +120,7 @@ static inline int splash_load_from_nand(void)
 }
 #endif /* CONFIG_CMD_NAND */
 
-int board_splash_screen_prepare(void)
+int splash_screen_prepare(void)
 {
char *env_splashimage_value;
u32 bmp_load_addr;
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index c6e357a..b258da9 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -339,6 +339,5 @@
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_CMD_BMP
 #define CONFIG_BMP_16BPP
-#define CONFIG_SPLASH_SCREEN_PREPARE
 
 #endif /* __CONFIG_H */
-- 
1.8.3

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


Re: [U-Boot] [PATCH v5 13/14] mmc: ftsdc010_mci: clk_get_rate() -> clock_get_rate()

2013-06-17 Thread Andy Fleming
On Mon, Jun 17, 2013 at 7:07 AM, Kuo-Jung Su  wrote:

> From: Kuo-Jung Su 
>
> This updates ftsdc010_mci.c for latest Faraday clock APIs.
>
> Signed-off-by: Kuo-Jung Su 
> CC: Albert Aribaud 
> CC: Andy Fleming 
>


Acked-by: Andy Fleming 

Since this is part of a series, it should go in with the rest of them,
rather than through the mmc tree.

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


[U-Boot] [PATCH 1/3 v2] video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO

2013-06-17 Thread Robert Winkler
Create splash.c/h to put the function and any future common splash
screen code in.

Signed-off-by: Robert Winkler 
---
v2 changes:
remove superfluous comments
remove debug printf that slipped in
remove address from GPL comments

 common/Makefile |  1 +
 common/lcd.c| 16 +++-
 common/splash.c | 36 
 drivers/video/cfb_console.c |  5 +++--
 include/lcd.h   |  1 -
 include/splash.h| 29 +
 6 files changed, 72 insertions(+), 16 deletions(-)
 create mode 100644 common/splash.c
 create mode 100644 include/splash.h

diff --git a/common/Makefile b/common/Makefile
index 1cfb132..b48f227 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -204,6 +204,7 @@ COBJS-y += flash.o
 COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
 COBJS-$(CONFIG_I2C_EDID) += edid.o
 COBJS-$(CONFIG_KALLSYMS) += kallsyms.o
+COBJS-y += splash.o
 COBJS-$(CONFIG_LCD) += lcd.o
 COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
 COBJS-$(CONFIG_MENU) += menu.o
diff --git a/common/lcd.c b/common/lcd.c
index edae835..72ffcfb 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -43,6 +43,8 @@
 #include 
 #include 
 
+#include 
+
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
defined(CONFIG_CPU_MONAHANS)
 #define CONFIG_CPU_PXA
@@ -1068,18 +1070,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 }
 #endif
 
-#ifdef CONFIG_SPLASH_SCREEN_PREPARE
-static inline int splash_screen_prepare(void)
-{
-   return board_splash_screen_prepare();
-}
-#else
-static inline int splash_screen_prepare(void)
-{
-   return 0;
-}
-#endif
-
 static void *lcd_logo(void)
 {
 #ifdef CONFIG_SPLASH_SCREEN
@@ -1092,7 +1082,7 @@ static void *lcd_logo(void)
do_splash = 0;
 
if (splash_screen_prepare())
-   return (void *)gd->fb_base;
+   return (void *)lcd_base;
 
addr = simple_strtoul (s, NULL, 16);
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
diff --git a/common/splash.c b/common/splash.c
new file mode 100644
index 000..98de2be
--- /dev/null
+++ b/common/splash.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013, Boundary Devices 
+ *
+ * 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., http://www.fsf.org/about/contact/
+ *
+ */
+
+#include 
+#include 
+
+#ifdef CONFIG_SPLASH_SCREEN_PREPARE
+int splash_screen_prepare(void)
+{
+   return board_splash_screen_prepare();
+}
+#else
+int splash_screen_prepare(void)
+{
+   return 0;
+}
+#endif
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 0793f07..4e299c6 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -181,6 +181,8 @@
  */
 #include 
 
+#include 
+
 /*
  * some Macros
  */
@@ -1995,10 +1997,9 @@ static void *video_logo(void)
 #ifdef CONFIG_SPLASH_SCREEN
s = getenv("splashimage");
if (s != NULL) {
-
+   splash_screen_prepare();
addr = simple_strtoul(s, NULL, 16);
 
-
if (video_display_bitmap(addr,
video_logo_xpos,
video_logo_ypos) == 0) {
diff --git a/include/lcd.h b/include/lcd.h
index c6e7fc5..e58ffd0 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -37,7 +37,6 @@ extern struct vidinfo panel_info;
 
 void lcd_ctrl_init(void *lcdbase);
 void lcd_enable(void);
-int board_splash_screen_prepare(void);
 
 /* setcolreg used in 8bpp/16bpp; initcolregs used in monochrome */
 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
diff --git a/include/splash.h b/include/splash.h
new file mode 100644
index 000..63b45e0
--- /dev/null
+++ b/include/splash.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013, Boundary Devices 
+ *
+ * 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

[U-Boot] [PATCH 0/3 v2] video: lcd: splash screen prepare changes

2013-06-17 Thread Robert Winkler
The first 2 patches are the result of discussion in these threads:
http://lists.denx.de/pipermail/u-boot/2013-May/155463.html
http://lists.denx.de/pipermail/u-boot/2013-June/155630.html
http://lists.denx.de/pipermail/u-boot/2013-June/155632.html

The upshot is, move splash_screen_prepare to a common location
so it can be used in cfb_console.c and (possibly) make it weak.

The first patch can be accepted without the last two.  The third
patch is a fix for cm_t35 that's only necessary if we make it weak. 

Robert Winkler (3):
  video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO
  video: lcd: Make splash_screen_prepare weak, remove config macro
  omap: cm_t35: Fix cm_t35 for weak splash_screen_prepare

 README |  8 
 board/compulab/cm_t35/cm_t35.c |  2 +-
 common/Makefile|  1 +
 common/lcd.c   | 16 +++-
 common/splash.c| 31 +++
 doc/README.splashprepare   |  8 
 drivers/video/cfb_console.c|  5 +++--
 include/configs/cm_t35.h   |  1 -
 include/lcd.h  |  1 -
 include/splash.h   | 29 +
 10 files changed, 76 insertions(+), 26 deletions(-)
 create mode 100644 common/splash.c
 create mode 100644 doc/README.splashprepare
 create mode 100644 include/splash.h

-- 
1.8.3

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


[U-Boot] [PATCH 2/3] video: lcd: Make splash_screen_prepare weak, remove config macro

2013-06-17 Thread Robert Winkler
Remove CONFIG_SPLASH_SCREEN_PREPARE from README
Add doc/README.splashprepare to document functionality

Signed-off-by: Robert Winkler 
---
 README   |  8 
 common/splash.c  | 13 -
 doc/README.splashprepare |  8 
 3 files changed, 12 insertions(+), 17 deletions(-)
 create mode 100644 doc/README.splashprepare

diff --git a/README b/README
index b72ab2f..0686073 100644
--- a/README
+++ b/README
@@ -1605,14 +1605,6 @@ CBFS (Coreboot Filesystem) support
=> vertically centered image
   at x = dspWidth - bmpWidth - 9
 
-   CONFIG_SPLASH_SCREEN_PREPARE
-
-   If this option is set then the board_splash_screen_prepare()
-   function, which must be defined in your code, is called as part
-   of the splash screen display sequence. It gives the board an
-   opportunity to prepare the splash image data before it is
-   processed and sent to the frame buffer by U-Boot.
-
 - Gzip compressed BMP image support: CONFIG_VIDEO_BMP_GZIP
 
If this option is set, additionally to standard BMP
diff --git a/common/splash.c b/common/splash.c
index 98de2be..1882e5f 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -21,16 +21,11 @@
  */
 
 #include 
-#include 
 
-#ifdef CONFIG_SPLASH_SCREEN_PREPARE
-int splash_screen_prepare(void)
-{
-   return board_splash_screen_prepare();
-}
-#else
-int splash_screen_prepare(void)
+int __splash_screen_prepare(void)
 {
return 0;
 }
-#endif
+
+int splash_screen_prepare(void)
+   __attribute__ ((weak, alias("__splash_screen_prepare")));
diff --git a/doc/README.splashprepare b/doc/README.splashprepare
new file mode 100644
index 000..61b4ec5
--- /dev/null
+++ b/doc/README.splashprepare
@@ -0,0 +1,8 @@
+-
+Splash Screen
+-
+The splash_screen_prepare() function is a weak function defined in
+common/splash.c. It is called as part of the splash screen display
+sequence. It gives the board an opportunity to prepare the splash
+image data before it is processed and sent to the frame buffer by
+U-Boot.  Define your own version to use this feature.
-- 
1.8.3

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


[U-Boot] [PATCH] arm: fix memory coherency problem after relocation

2013-06-17 Thread Mike Dunn
On the xscale, the icache must be invalidated and the write buffers drained
after writing code over the data bus, even if the caches are disabled.  After
rebasing with the main git repository, u-boot began crashing in odd places on my
pxa270 board (palmtreo680) after the code relocation routine ran.  This patch
fixes it.  Cache coherency problems are often hit-and-miss (ha ha), and this
latent problem didn't rear its ugly head until now.  Tested on the pxa270.

Signed-off-by: Mike Dunn 
---

I realize that __ARM_ARCH_5TE__ does not necessarily mean xscale.  But how else
to test for pxa2xx/ixp in an assembly file?  I wouldn't expect any ill effects
on a non-xscale v5te because these CP15 operations are defined the same way in
the ARM Architecture Reference Manual for v5 cores, but unfortunately I only
have a pxa270 xscale to test on.

I experienced this same problem a couple years ago when I was getting OpenOCD
working on the xscale.  Often software breakpoints (replacing an instruction
with the 'bkpt' instruction) would fail unless this operation was performed
after replacing the instruction, even with caches off.  The following two
paragraphs are cut from section 4.2.7 of the xscale core developer's manual...

If the instruction cache is not enabled, or code is being written to a
non-cacheable region, software must still invalidate the instruction cache
before using the newly-written code. This precaution ensures that state
associated with the new code is not buffered elsewhere in the processor, such as
the fetch buffers or the BTB.

Naturally, when writing code as data, care must be taken to force it completely
out of the processor into external memory before attempting to execute it. If
writing into a non-cacheable region, flushing the write buffers is sufficient
precaution (see Section 7.2.8 for a description of this

 arch/arm/lib/relocate.S |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
index 4446da9..e2febed 100644
--- a/arch/arm/lib/relocate.S
+++ b/arch/arm/lib/relocate.S
@@ -92,6 +92,16 @@ fixnext:
 
 relocate_done:
 
+#ifdef __ARM_ARCH_5TE__
+   /*
+* On xscale, icache must be invalidated and write buffers drained,
+* even with cache disabled - 4.2.7 of xscale core developer's manual
+*/
+   mov r0, #0  /* arm reference manual: "data SBZ" */
+   mcr p15, 0, r0, c7, c7, 0   /* invalidate icache */
+   mcr p15, 0, r0, c7, c10, 4  /* drain write buffer */
+#endif
+
/* ARMv4- don't know bx lr but the assembler fails to see that */
 
 #ifdef __ARM_ARCH_4__
-- 
1.7.8.6

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


[U-Boot] [PATCH] pxa: turn icache off in cpu_init_crit()

2013-06-17 Thread Mike Dunn
The comment in the low-level initialization function cpu_init_crit() says that
the caches are being disabled, but (oddly) the icache is actually turned on.
This is probably not a good idea prior to relocating code, so this patch turns
it off.  Tested on the pxa270.

Signed-off-by: Mike Dunn 
---

Because the current code seems quite deliberate in setting the icache bit, I
looked for evidence of an errata on the pxa25x whereby the logic of this bit is
inverted, but couldn't find any.

 arch/arm/cpu/pxa/start.S |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index 2e3f65e..b1deb72 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -208,10 +208,9 @@ cpu_init_crit:
 * disable MMU stuff and caches
 */
mrc p15, 0, r0, c1, c0, 0
-   bic r0, r0, #0x2300 @ clear bits 13, 9:8 (--V- --RS)
+   bic r0, r0, #0x3300 @ clear bits 13:12, 9:8 (--VI --RS)
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
-   orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
mcr p15, 0, r0, c1, c0, 0
 
mov pc, lr  /* back to my caller */
-- 
1.7.8.6

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


[U-Boot] [PATCH] mtd: nand/docg4: fix driver after Linux resync

2013-06-17 Thread Mike Dunn
Commit dfe64e2c89731a3f9950d7acd8681b68df2bae03:

mtd: resync with Linux-3.7.1

broke the docg4 driver.  Specifically:
 - some of the prototypes of the ecc methods changed
 - the NAND_NO_AUTOINCR flag was removed
 - the ecc.strength element was added.

This patch fixes these.  Tested on the docg4 on my palmtre680 board.

Signed-off-by: Mike Dunn 
---
 drivers/mtd/nand/docg4.c |   26 ++
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index 7dd9953..09f01c8 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -487,7 +487,7 @@ static void docg4_read_buf(struct mtd_info *mtd, uint8_t 
*buf, int len)
 }
 
 static int docg4_read_oob(struct mtd_info *mtd, struct nand_chip *nand,
- int page, int sndcmd)
+ int page)
 {
struct docg4_priv *doc = nand->priv;
void __iomem *docptr = CONFIG_SYS_NAND_BASE;
@@ -577,7 +577,7 @@ static void docg4_write_buf16(struct mtd_info *mtd, const 
uint8_t *buf, int len)
writew(p[i], nand->IO_ADDR_W);
 }
 
-static void write_page(struct mtd_info *mtd, struct nand_chip *nand,
+static int write_page(struct mtd_info *mtd, struct nand_chip *nand,
   const uint8_t *buf, int use_ecc)
 {
void __iomem *docptr = CONFIG_SYS_NAND_BASE;
@@ -626,16 +626,18 @@ static void write_page(struct mtd_info *mtd, struct 
nand_chip *nand,
write_nop(docptr);
writew(0, docptr + DOC_DATAEND);
write_nop(docptr);
+
+   return 0;
 }
 
-static void docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand,
-const uint8_t *buf)
+static int docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand,
+const uint8_t *buf, int oob_required)
 {
return write_page(mtd, nand, buf, 0);
 }
 
-static void docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand,
-const uint8_t *buf)
+static int docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand,
+const uint8_t *buf, int oob_required)
 {
return write_page(mtd, nand, buf, 1);
 }
@@ -706,13 +708,13 @@ static int read_page(struct mtd_info *mtd, struct 
nand_chip *nand,
 
 
 static int docg4_read_page_raw(struct mtd_info *mtd, struct nand_chip *nand,
-  uint8_t *buf, int page)
+  uint8_t *buf, int oob_required, int page)
 {
return read_page(mtd, nand, buf, page, 0);
 }
 
 static int docg4_read_page(struct mtd_info *mtd, struct nand_chip *nand,
-  uint8_t *buf, int page)
+  uint8_t *buf, int oob_required, int page)
 {
return read_page(mtd, nand, buf, page, 1);
 }
@@ -779,7 +781,7 @@ static int read_factory_bbt(struct mtd_info *mtd)
return -ENOMEM;
 
read_page_prologue(CONFIG_SYS_NAND_BASE, g4_addr);
-   status = docg4_read_page(mtd, nand, buf, DOCG4_FACTORY_BBT_PAGE);
+   status = docg4_read_page(mtd, nand, buf, 0, DOCG4_FACTORY_BBT_PAGE);
if (status)
goto exit;
 
@@ -858,7 +860,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t 
ofs)
 
/* write first page of block */
write_page_prologue(CONFIG_SYS_NAND_BASE, g4_addr);
-   docg4_write_page(mtd, nand, buf);
+   docg4_write_page(mtd, nand, buf, 1);
ret = pageprog(mtd);
if (!ret)
mtd->ecc_stats.badblocks++;
@@ -959,8 +961,8 @@ int docg4_nand_init(struct mtd_info *mtd, struct nand_chip 
*nand, int devnum)
nand->ecc.size = DOCG4_PAGE_SIZE;
nand->ecc.prepad = 8;
nand->ecc.bytes = 8;
-   nand->options =
-   NAND_BUSWIDTH_16 | NAND_NO_SUBPAGE_WRITE | NAND_NO_AUTOINCR;
+   nand->ecc.strength = DOCG4_T;
+   nand->options = NAND_BUSWIDTH_16 | NAND_NO_SUBPAGE_WRITE;
nand->controller = &nand->hwcontrol;
 
/* methods */
-- 
1.7.8.6

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


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Kipisz, Steven


> -Original Message-
> From: Mark Jackson [mailto:mpfj-l...@newflow.co.uk]
> Sent: Monday, June 17, 2013 11:10 AM
> To: Stefan Roese
> Cc: Rini, Tom; Kipisz, Steven; u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot
> from NOR.
> 
> On 17/06/13 17:01, Stefan Roese wrote:
> > Hi Mark,
> >
> > On 17.06.2013 17:23, Mark Jackson wrote:
> 
> 
> 
> >> One question ... the SPL code has:-
> >>
> >>...
> >>gd = &gdata;
> >>...
> >>
> >> But there seems to be no similar assignment when in NOR boot mode.
> >> I'm no expert in the internal workings of u-boot, so I thought I'd
> >> check, just in case !?!
> >
> > I just noticed you mentioning "gd" here and wanted to point you to a
> > patch that fixed a gd-related boot issue for me on OMAP3:
> >
> > [U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3
> >
> > (sorry, I can't find a link to this patch right now and I'm in a
> > hurry)
> >
> > Not sure if this has something to do with your problem (I don't have
> > the time to dig into this mail thread today as I'm leaving right now).
> 
> I'll look at that thanks.
> 
> But I've taken a slightly different approach, and added the following to the
> start of s_init() ...
> 
> 
> 
> void s_init(void)
> {
>   unsigned short *p = (unsigned short*)0x0800;
>   while (1)
>   {
>   int i;
>   for (i = 0; i < (1 * 1024); i++)
>   {
>   unsigned short d = p[i];
>   d++;
>   *p = d;
>   }
>   }
>   ...
> 
> AFAICT, that should just spin on reading/writing the NOR device, but I still 
> get
> only an initial 350us burst on the CS0 line, and then nothing.
> 
> So I can only assume that the boot code isn't getting as far as
> s_init() at all !!
> 
> In start.S and low_levelinit.c, there are various uses of:-
> 
> #ifdef CONFIG_SPL_BUILD
> 
> Do any of these also need referencing with a CONFIG_NOR_BOOT ?
> 
> Mark J.

Do  you have a u-boot.lds in board/ti/am335x? That should put s_init() earlier 
in the boot. Also, include/configs/am335x_evm.h should have 
/* Custom script for NOR */
#define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds"

Before using JTAG, take a look in System.map where s_init is located. For a 
multiplex NOR it should be in the first 64K of address space.

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


Re: [U-Boot] [SPI-TEST]: Request for test u-boot-spi/master-work

2013-06-17 Thread Willis, Max
Hi Gary - Please check Jagan's latest patches on your HW. --Max


-Original Message-
From: Jagan Teki [mailto:jagannadh.t...@gmail.com] 
Sent: Saturday, June 15, 2013 11:49 AM
To: U-Boot Mailing List
Cc: Tom Rini; Michal Simek; Simon Glass; Rajeshwari Shinde; Syed Hussain; 
Willis, Max; Todd Legler (tlegler); Hoyler, Gernot; Daassi, Bacem
Subject: [SPI-TEST]: Request for test u-boot-spi/master-work

Hi All,

In-fact this is a first time for sending test tagged mail.

The reason for sending this is: We added many changes on spi_flash 
framework to support all sizes of flashes.

I'd appreciate if anyone can test this master-work branch on 
u-boot-spi.git repo with your respective hw's

$ git clone git://git.denx.de/u-boot-spi.git
$ cd u-boot-spi
$ git checkout -b master-work origin/master-work

Please let me know for any issues/concerns.

Apologies, if anyone hurt this kind of mail.

--
Thanks,
Jagan.

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


Re: [U-Boot] [PATCH 1/2] video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO

2013-06-17 Thread Robert Winkler
Hi Igor,

On Sun, Jun 16, 2013 at 10:34 PM, Igor Grinberg  wrote:
> Hi Robert,
>
> On 06/14/13 20:00, Robert Winkler wrote:
>> Create splash.c/h to put the function and any future common
>> splash screen code in.
>>
>> Signed-off-by: Robert Winkler 
>
> Thanks for the effort!
> Several comments below...
>
>> ---
>>  common/Makefile |  1 +
>>  common/lcd.c| 19 ++-
>>  common/splash.c | 37 +
>>  drivers/video/cfb_console.c |  8 ++--
>>  include/lcd.h   |  1 -
>>  include/splash.h| 30 ++
>>  6 files changed, 80 insertions(+), 16 deletions(-)
>>  create mode 100644 common/splash.c
>>  create mode 100644 include/splash.h
>>
>> diff --git a/common/Makefile b/common/Makefile
>> index 0e0fff1..1d70584 100644
>> --- a/common/Makefile
>> +++ b/common/Makefile
>> @@ -203,6 +203,7 @@ COBJS-y += flash.o
>>  COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
>>  COBJS-$(CONFIG_I2C_EDID) += edid.o
>>  COBJS-$(CONFIG_KALLSYMS) += kallsyms.o
>> +COBJS-y += splash.o
>
> I think this should depend on CONFIG_SPLASH_SCREEN.
No it shouldn't.  The function is always called so it always needs to
be defined.  It's the
same behavior we had before, it was always compiled into lcd.h.
Whether or not the CONFIG
was defined just changed whether it actually called
board_splash_screen_prepare or just returned 0.

This is of course true for when it's a weak function as well.

>
>>  COBJS-$(CONFIG_LCD) += lcd.o
>>  COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
>>  COBJS-$(CONFIG_MENU) += menu.o
>> diff --git a/common/lcd.c b/common/lcd.c
>> index 3a60484..4a85ebb 100644
>> --- a/common/lcd.c
>> +++ b/common/lcd.c
>> @@ -43,6 +43,11 @@
>>  #include 
>>  #include 
>>
>> +/*
>> + * Include splash.h for splash_screen_prepare() etc.
>> + */
>
> I think this comment is meaningless, the below include is self explanatory.
Agreed.  I was just trying to match the other superfluous comments.
>
>> +#include 
>> +
>>  #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
>>   defined(CONFIG_CPU_MONAHANS)
>>  #define CONFIG_CPU_PXA
>> @@ -1072,18 +1077,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>>  }
>>  #endif
>>
>> -#ifdef CONFIG_SPLASH_SCREEN_PREPARE
>> -static inline int splash_screen_prepare(void)
>> -{
>> - return board_splash_screen_prepare();
>> -}
>> -#else
>> -static inline int splash_screen_prepare(void)
>> -{
>> - return 0;
>> -}
>> -#endif
>> -
>>  static void *lcd_logo(void)
>>  {
>>  #ifdef CONFIG_SPLASH_SCREEN
>> @@ -1096,7 +1089,7 @@ static void *lcd_logo(void)
>>   do_splash = 0;
>>
>>   if (splash_screen_prepare())
>> - return (void *)gd->fb_base;
>> + return (void *)lcd_base;
>>
>>   addr = simple_strtoul (s, NULL, 16);
>>  #ifdef CONFIG_SPLASH_SCREEN_ALIGN
>> diff --git a/common/splash.c b/common/splash.c
>> new file mode 100644
>> index 000..fe13c69
>> --- /dev/null
>> +++ b/common/splash.c
>> @@ -0,0 +1,37 @@
>> +/*
>> + * Copyright (C) 2013, Boundary Devices 
>> + *
>> + * 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
>
> I would drop the postal address, as it changed in the past and
> probably will change in the future and then we will have a bunch of
> files with wrong address...
Good point, will do.
>
>> + */
>> +
>> +#include 
>> +#include 
>> +
>> +#ifdef CONFIG_SPLASH_SCREEN_PREPARE
>> +int splash_screen_prepare(void)
>> +{
>> + return board_splash_screen_prepare();
>> +}
>> +#else
>> +int splash_screen_prepare(void)
>> +{
>> + printf("SPLASH_SCREEN_PREPARE not defined\n");
>> + return 0;
>> +}
>> +#endif
>> diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
>> index b769222..4543730 100644
>> --- a/drivers/video/cfb_console.c
>> +++ b/drivers/video/cfb_console.c
>> @@ -178,6 +178,11 @@
>>  #include 
>>
>>  /*
>> + * Include splash.h for splash_screen_prepare() etc.
>> + */
>
> Same here, the below include does not need any comment.
>
>> +#include 
>> +
>> +/*
>>   * some Macros
>>   */
>>  #define VIDEO_VISIBLE_COLS   (pGD->winSizeX)
>> @@ -1991

Re: [U-Boot] [PATCH v3 3/3] Tegra: Config: Enable Tegra30/Tegra114 USB function

2013-06-17 Thread Stephen Warren
On 06/17/2013 03:09 AM, Jim Lin wrote:
> Add USB EHCI, storage and network support.
> 
> Tested on Tegra30 Cardhu, and Tegra114 Dalmore
> platforms. All works well.

> diff --git a/include/configs/beaver.h b/include/configs/beaver.h

> +/* USB Host support */

I notice that some Tegra20 boards include the following line here:

#define CONFIG_USB_MAX_CONTROLLER_COUNT 3

Is this necessary here too?

If it doesn't serve any purpose, can you send an extra patch to remove
this from seaboard.h, harmony.h, trimslice.h, and colibtri_t20_iris.h.
Thanks.

> +#define CONFIG_USB_EHCI
> +#define CONFIG_USB_EHCI_TEGRA
> +#define CONFIG_USB_STORAGE
> +#define CONFIG_CMD_USB

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


Re: [U-Boot] [PATCH v3 2/3] ARM: Tegra: USB: EHCI: Add support for Tegra30/Tegra114

2013-06-17 Thread Stephen Warren
On 06/17/2013 03:09 AM, Jim Lin wrote:
> Tegra30 and Tegra114 are compatible except PLL parameters.
> 
> Tested on Tegra30 Cardhu, and Tegra114 Dalmore
> platforms. All works well.

> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c

> +static u32 port_clear_csc; /* Port that needs to clear CSC after Port Reset 
> */

What "units" is that variable in? The variable name should be more like
"status_reg_addr_needing_clear_csc".

> +static unsigned is_T30_compatible;
> +static unsigned is_T114_compatible;

Given that there is code in this patch that does:

+   if (is_T30_compatible) {
+   if (is_T114_compatible)

I think those should be is_T30_or_later and is_T114_or_later.

But, testing against SoC version is the wrong way to go. Instead, the
code should set a bunch of feature flags based on the SoC it's running
on during initialization, and then test those feature flags throughout
the code. That way, if Tegra30 and (hypothetical future chips) Tegra200
and Tegra300 need a fix, but Tegra114 doesn't, you don't have to write
tortuous if statements throughout the code, but simply have a lookup
table that maps from SoC ID to the set of feature/fix flags that it needs.

See for example Linux kernel driver drivers/gpio/gpio-tegra.c's
tegra20_gpio_config, tegra30_gpio_config, and tegra_gpio_of_match[], or
drivers/dma/tegra20-apb-dma.c's tegra_dma_of_match[].

> +static const unsigned *get_pll_timing(void)
> +{
> + const unsigned *timing;
> +
> + if (is_T30_compatible) {
> + if (is_T114_compatible)
> + timing = T114_usb_pll[clock_get_osc_freq()];
> + else
> + timing = T30_usb_pll[clock_get_osc_freq()];
> + } else {
> + timing = T20_usb_pll[clock_get_osc_freq()];
> + }
> +
> + return timing;
> +}

Following on from the feature flag discussion above, it'd be better to
simply include a pointer in the per-SoC configuration table that pointed
at the PLL table. That way, this function could be removed, and replaced
with a simple read through a pointer.

> +int board_usb_init(const void *blob)
> +{
> + int node_list[USB_PORTS_MAX];
> + int count, err = 0;
> +
> + is_T30_compatible = 0;
> + is_T114_compatible = 0;
> +
> + /* count may return <0 on error */
> + count = fdtdec_find_aliases_for_id(blob, "usb",
> + COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX);
> + if (count) {
> + err = process_usb_nodes(blob, node_list, count);
> + if (err)
> + printf("%s: Error processing T20 USB node!\n",
> +__func__);
> + return err;
> + }
> + count = fdtdec_find_aliases_for_id(blob, "usb",
> + COMPAT_NVIDIA_TEGRA114_USB, node_list, USB_PORTS_MAX);
> + if (count)
> + is_T114_compatible = 1;
> + else
> + count = fdtdec_find_aliases_for_id(blob, "usb",
> + COMPAT_NVIDIA_TEGRA30_USB, node_list, USB_PORTS_MAX);
> + if (count) {
> + /* T114 is also mostly compatible to T30 */
> + is_T30_compatible = 1;
> + err = process_usb_nodes(blob, node_list, count);
> + if (err) {
> + if (is_T114_compatible)
> + printf("%s: Error processing T114 USB node!\n",
> +__func__);
> + else
> + printf("%s: Error processing T30 USB node!\n",
> +__func__);

(Following on from the comment below: Why not just say "USB node" rather
than "T30 USB node" or "T114 USB node" here. That way, you completely
avoid having to write an if statement.

> + }
> + }
> +
> + return err;
> +}

This function is pretty convoluted. It'd be far better to enhance
fdtdec_find_aliases_for_id() to accept a list of compatible values, and
simply return all matching instances in one go.
fdtdec_find_aliases_for_id() should also return the "type" of each
match, so you know if each one is a Tegra20/30/114 port.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] ARM: Tegra: FDT: Add USB EHCI function for T30/T114

2013-06-17 Thread Stephen Warren
On 06/17/2013 03:09 AM, Jim Lin wrote:
> Add DT node for USB EHCI function.
> Add support for T30-Cardhu, T30-Beaver, T114-Dalmore boards.

This patch shouldn't touch both DT files and code at the same time. The
code changes should be part of the patch to the USB driver.

> diff --git a/board/nvidia/dts/tegra30-cardhu.dts 
> b/board/nvidia/dts/tegra30-cardhu.dts

> + usb@7d008000 {
> + nvidia,vbus-gpio = <&gpio 233 3>;   /* PDD1, EN_3V3_PU */
> + status = "okay";
> + };

PDD1 is the wrong signal. That enables a 100L pullup to a bunch of
different signals, including the VBUS GPIO. Instead, I think you should
be using PEX_L1_PRSNT / EN_USB3_VBUS_OC / PDD4, which co-incidentally
matches the value in the Beaver .dts file in this patch, most likely
because Beaver is closely based on Cardhu.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 17/06/13 17:01, Stefan Roese wrote:
> Hi Mark,
> 
> On 17.06.2013 17:23, Mark Jackson wrote:



>> One question ... the SPL code has:-
>>
>>  ...
>>  gd = &gdata;
>>  ...
>>
>> But there seems to be no similar assignment when in NOR boot mode.
>> I'm no expert in the internal workings of u-boot, so I thought I'd
>> check, just in case !?!
> 
> I just noticed you mentioning "gd" here and wanted to point you to a
> patch that fixed a gd-related boot issue for me on OMAP3:
> 
> [U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3
> 
> (sorry, I can't find a link to this patch right now and I'm in a hurry)
> 
> Not sure if this has something to do with your problem (I don't have the
> time to dig into this mail thread today as I'm leaving right now).

I'll look at that thanks.

But I've taken a slightly different approach, and added the following
to the start of s_init() ...



void s_init(void)
{
unsigned short *p = (unsigned short*)0x0800;
while (1)
{
int i;
for (i = 0; i < (1 * 1024); i++)
{
unsigned short d = p[i];
d++;
*p = d;
}
}
...

AFAICT, that should just spin on reading/writing the NOR device,
but I still get only an initial 350us burst on the CS0 line, and
then nothing.

So I can only assume that the boot code isn't getting as far as
s_init() at all !!

In start.S and low_levelinit.c, there are various uses of:-

#ifdef CONFIG_SPL_BUILD

Do any of these also need referencing with a CONFIG_NOR_BOOT ?

Mark J.

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


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Stefan Roese
Hi Mark,

On 17.06.2013 17:23, Mark Jackson wrote:
> On 17/06/13 15:59, Mark Jackson wrote:
>> On 17/06/13 15:49, Tom Rini wrote:
>>
>> 
>>
>>> Did you copy the parts that setup the pinmuxing in s_init for NOR?
>>
>> This bit ?
>>
>> #ifdef CONFIG_NOR_BOOT
>>  asm("stmfd  sp!, {r2 - r4}");
>>  asm("movw   r4, #0x8A4");
>>  asm("movw   r3, #0x44E1");
>>  asm("orrr4, r4, r3, lsl #16");
>>  asm("movr2, #9");
>>  asm("movr3, #8");
>>  asm("gpmc_mux:  str r2, [r4], #4");
>>  asm("subs   r3, r3, #1");
>>  asm("bnegpmc_mux");
>>  asm("ldmfd  sp!, {r2 - r4}");
>> #endif
>>
>> Yes ... :-)
>>
> 
> Below is my entire s_init() routine.
> 
> One question ... the SPL code has:-
> 
>   ...
>   gd = &gdata;
>   ...
> 
> But there seems to be no similar assignment when in NOR boot mode.
> I'm no expert in the internal workings of u-boot, so I thought I'd
> check, just in case !?!

I just noticed you mentioning "gd" here and wanted to point you to a
patch that fixed a gd-related boot issue for me on OMAP3:

[U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3

(sorry, I can't find a link to this patch right now and I'm in a hurry)

Not sure if this has something to do with your problem (I don't have the
time to dig into this mail thread today as I'm leaving right now).

Cheers,
Stefan

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


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/17/2013 11:23 AM, Mark Jackson wrote:
> On 17/06/13 15:59, Mark Jackson wrote:
>> On 17/06/13 15:49, Tom Rini wrote:
>> 
>> 
>> 
>>> Did you copy the parts that setup the pinmuxing in s_init for
>>> NOR?
>> 
>> This bit ?
>> 
>> #ifdef CONFIG_NOR_BOOT asm("stmfd  sp!, {r2 - r4}"); 
>> asm("movw   r4, #0x8A4"); asm("movw   r3, #0x44E1"); 
>> asm("orrr4, r4, r3, lsl #16"); asm("movr2, #9"); 
>> asm("movr3, #8"); asm("gpmc_mux:  str r2, [r4],
>> #4"); asm("subs   r3, r3, #1"); asm("bnegpmc_mux"); 
>> asm("ldmfd  sp!, {r2 - r4}"); #endif
>> 
>> Yes ... :-)
>> 
> 
> Below is my entire s_init() routine.
> 
> One question ... the SPL code has:-
> 
> ... gd = &gdata; ...
> 
> But there seems to be no similar assignment when in NOR boot mode. 
> I'm no expert in the internal workings of u-boot, so I thought I'd 
> check, just in case !?!

Maybe some of the recent changes broke things?  I recall having to
take a bit to track down where gd is assigned in the non-SPL case before..

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRvytfAAoJENk4IS6UOR1WisEQAJo4jQDfFMdVE9G/KiCphySx
0Y0YwQ7uR5eEktUIQ6P9a+Hcy5ipom4i1cQszUTBjfQgcL6NCD9ta98hdf9aXti/
Rtmn65Yt4+YSRmcRbLDvzqyRw4Z0tUPvwEZrur9dzGkwdTcGe/aW1edKPUUdkSiA
4CfkZo8bQOPPJJB/GF/rIvdLrKNpGBL4gy0LtwKsyduXNiqhXXI4Y/2hMHbafFgV
ZTpZylHTfm/3esNmyv2Es9Ftsxq52tVGIr488RMibrzPj/ERIl3Whpn0HmPd3ew0
irn+MVPzO6aRCE4HyM+43KI4/7cM6HuX97jxML5BmLNAD3b06DM+J2R8HLr+MVwb
9sv8PPxLcPfvDqujAQtzj8LQSyEbHajXG5y42ZB3V0afBIjVjPJ8FRtD88LjDvXJ
PmiaX2wBGnYCg+9q+xeF/4J3FqO1BvCSqxzNHJo2U1YrQFxMzIgl9Rvoh9pXUoVh
U8fIdQnSw6r9w+FKIVlpAKLNw8Ed8xWjPsZgSzRKdmZnJfvTR+XfVVNK3z1b5dc+
ogeky/Jtn1qffOyOOrOG1vGtXE+HHWRqYDK4FFb3wv6puxZbJpakV4Rj+x1qkU9F
AULG/z9cjDrSo2xZtjyCF9/I2fHq9X7NX0AxdVUqezNR0V0E8JQ28cTK8ywQuJkr
itP0oHGBqU0o/Ty+q92O
=sPuh
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 17/06/13 15:59, Mark Jackson wrote:
> On 17/06/13 15:49, Tom Rini wrote:
> 
> 
> 
>> Did you copy the parts that setup the pinmuxing in s_init for NOR?
> 
> This bit ?
> 
> #ifdef CONFIG_NOR_BOOT
>   asm("stmfd  sp!, {r2 - r4}");
>   asm("movw   r4, #0x8A4");
>   asm("movw   r3, #0x44E1");
>   asm("orrr4, r4, r3, lsl #16");
>   asm("movr2, #9");
>   asm("movr3, #8");
>   asm("gpmc_mux:  str r2, [r4], #4");
>   asm("subs   r3, r3, #1");
>   asm("bnegpmc_mux");
>   asm("ldmfd  sp!, {r2 - r4}");
> #endif
> 
> Yes ... :-)
> 

Below is my entire s_init() routine.

One question ... the SPL code has:-

...
gd = &gdata;
...

But there seems to be no similar assignment when in NOR boot mode.
I'm no expert in the internal workings of u-boot, so I thought I'd
check, just in case !?!

Cheers
Mark J.
---
void s_init(void)
{
/*
 * The ROM will only have set up sufficient pinmux to allow for the
 * first 4KiB NOR to be read, we must finish doing what we know of
 * the NOR mux in this space in order to continue.
 */
#ifdef CONFIG_NOR_BOOT
asm("stmfd  sp!, {r2 - r4}");
asm("movw   r4, #0x8A4");
asm("movw   r3, #0x44E1");
asm("orrr4, r4, r3, lsl #16");
asm("movr2, #9");
asm("movr3, #8");
asm("gpmc_mux:  str r2, [r4], #4");
asm("subs   r3, r3, #1");
asm("bnegpmc_mux");
asm("ldmfd  sp!, {r2 - r4}");
#endif

/*
 * Save the boot parameters passed from romcode.
 * We cannot delay the saving further than this,
 * to prevent overwrites.
 */
#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
save_omap_boot_params();
#endif

/* WDT1 is already running when the bootloader gets control
 * Disable it to avoid "random" resets
 */
writel(0x, &wdtimer->wdtwspr);
while (readl(&wdtimer->wdtwwps) != 0x0)
;
writel(0x, &wdtimer->wdtwspr);
while (readl(&wdtimer->wdtwwps) != 0x0)
;

#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
/* Setup the PLLs and the clocks for the peripherals */
pll_init();

/* Enable RTC32K clock */
rtc32k_enable();

enable_board_pin_mux();

/* UART softreset */
u32 regVal;
regVal = readl(&uart_base->uartsyscfg);
regVal |= UART_RESET;
writel(regVal, &uart_base->uartsyscfg);
while ((readl(&uart_base->uartsyssts) &
UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
;

/* Disable smart idle */
regVal = readl(&uart_base->uartsyscfg);
regVal |= UART_SMART_IDLE_EN;
writel(regVal, &uart_base->uartsyscfg);

#if defined(CONFIG_NOR_BOOT)
/* We want our console now. */
gd->baudrate = CONFIG_BAUDRATE;
serial_init();
gd->have_console = 1;
puts("\nU-Boot NOR Boot\n");
#else
gd = &gdata;

preloader_console_init();
#endif

config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data,
   &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);

i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif /* CONFIG_SPL_BUILD */
}

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


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 17/06/13 16:01, Tom Rini wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 06/17/2013 10:59 AM, Mark Jackson wrote:
>> On 17/06/13 15:49, Tom Rini wrote:
>>
>> 
>>
>>> Did you copy the parts that setup the pinmuxing in s_init for
>>> NOR?
>>
>> This bit ?
>>
>> #ifdef CONFIG_NOR_BOOT asm("stmfd  sp!, {r2 - r4}"); asm("movw
>> r4, #0x8A4"); asm("movw   r3, #0x44E1"); asm("orrr4,
>> r4, r3, lsl #16"); asm("movr2, #9"); asm("movr3,
>> #8"); asm("gpmc_mux:  str r2, [r4], #4"); asm("subs   r3,
>> r3, #1"); asm("bnegpmc_mux"); asm("ldmfd  sp!, {r2 -
>> r4}"); #endif
>>
>> Yes ... :-)
> 
> Right.  Well, baring hints from Steve, time to hook up the JTAG and
> see where it's stuck.

Urm ... unfortunately, we have no JTAG on this board ... :-(

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


[U-Boot] [PATCH] am33xx: fix the ddr_cmdtctrl structure

2013-06-17 Thread Ilya Ledvich
Fix the wrong mapping between the DDR I/O control registers on AM33XX
SoCs and the software representation in the SPL code.
The most recent public TRM defines the following DDR I/O control registers
offsets:
 * ddr_cmd0_ioctrl : offset 0x44E11404
 * ddr_cmd1_ioctrl : offset 0x44E11408
 * ddr_cmd2_ioctrl : offset 0x44E1140C
 * ddr_data0_ioctrl: offset 0x44E11440
 * ddr_data1_ioctrl: offset 0x44E11444

While the struct ddr_cmdtctrl has also some reserved bits in the beginning.
The struct is mapped to the address 0x44E11404. As a result "cm0ioctl" points
to the ddr_cmd1_ioctrl register, "cm1ioctl" to the ddr_cmd2_ioctrl and etc.
Registers ddr_cmd0_ioctrl and ddr_data0_ioctrl are never configured because
of this mapping mismatch.

Signed-off-by: Ilya Ledvich 
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index fb4e78e..a529460 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -267,7 +267,6 @@ void config_ddr_data(const struct ddr_data *data, int nr);
  * This structure represents the DDR io control on AM33XX devices.
  */
 struct ddr_cmdtctrl {
-   unsigned int resv1[1];
unsigned int cm0ioctl;
unsigned int cm1ioctl;
unsigned int cm2ioctl;
-- 
1.7.9.5

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


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/17/2013 10:59 AM, Mark Jackson wrote:
> On 17/06/13 15:49, Tom Rini wrote:
> 
> 
> 
>> Did you copy the parts that setup the pinmuxing in s_init for
>> NOR?
> 
> This bit ?
> 
> #ifdef CONFIG_NOR_BOOT asm("stmfd  sp!, {r2 - r4}"); asm("movw
> r4, #0x8A4"); asm("movw   r3, #0x44E1"); asm("orrr4,
> r4, r3, lsl #16"); asm("movr2, #9"); asm("movr3,
> #8"); asm("gpmc_mux:  str r2, [r4], #4"); asm("subs   r3,
> r3, #1"); asm("bnegpmc_mux"); asm("ldmfd  sp!, {r2 -
> r4}"); #endif
> 
> Yes ... :-)

Right.  Well, baring hints from Steve, time to hook up the JTAG and
see where it's stuck.

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRvyThAAoJENk4IS6UOR1WiuAP/0EYvMxbkfhncVCqIG6cPmi2
8+LM+VXNqJFice+WtD0peDZ6fh8HQHz9Dtehzd83J9dXea7W99mP6TvoYz/2x/q5
xyjtNwqiFdxCXLZB8qxRlaXLBMgT4KTBWV6SIk61PIhcIA46dX8pn8DT895Cx556
wHXFfvQEm8mK2unR5pNS4YBxtM/ka31bFQWpFUapDHhfkPnFHUhj98gl2C9JCpq3
Qa4UxcxsouXDGwzoa3nkhiss+HDdj2jEiDviNXPtq5wdzpjNGXz2GGlL7yL1aLOy
m+ewBadFiRxIhZAozDKyS4w7W5OndtTBVQrLKZWiHct2r1Ui1hrQCrazMWbs7Wzn
8usWKjElFr0uowcooRQ6IuHNsBxzT+ZSc+wVOKQOgemhSmLrLwXS+x3FgA8VW1eC
q2ijx/TzadorX4ZyiRyWSiYxgc6W84yZjhEAJ6TRYeVuN06iww5AFkNlpfMkrtqy
Pxem7TIhrP9eoUjGkLnTVIcAUmctrymekSh7B+fq3CKOrYDyCy2bqSsQzvALs3o7
o635vX97jdwNGUUQGwCholDqijFq9d5kR5yXFpcYP+0f0SCqDG6VmueW80EYaMnL
J7GeL1LIl09yKtTyTkZlL7JSuArKPerKTj5UwYGsvml99I+9E2f4bpvI7213MlnM
fh1BoB9u3nteGEG25HUH
=DrWl
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 17/06/13 15:49, Tom Rini wrote:



> Did you copy the parts that setup the pinmuxing in s_init for NOR?

This bit ?

#ifdef CONFIG_NOR_BOOT
asm("stmfd  sp!, {r2 - r4}");
asm("movw   r4, #0x8A4");
asm("movw   r3, #0x44E1");
asm("orrr4, r4, r3, lsl #16");
asm("movr2, #9");
asm("movr3, #8");
asm("gpmc_mux:  str r2, [r4], #4");
asm("subs   r3, r3, #1");
asm("bnegpmc_mux");
asm("ldmfd  sp!, {r2 - r4}");
#endif

Yes ... :-)

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


[U-Boot] [PATCH v4 4/8] main: Use autoconf to remove #ifdefs around process_boot_delay()

2013-06-17 Thread Simon Glass
Use autoconf to make process_boot_delay() be compiled always, and adjust
the caller and related functions as needed.

Signed-off-by: Simon Glass 
---
Changes in v4:
- Split out new patch to remove #ifdefs around process_boot_delay()

Changes in v3: None
Changes in v2: None

 common/main.c | 71 ++-
 1 file changed, 31 insertions(+), 40 deletions(-)

diff --git a/common/main.c b/common/main.c
index 3a4754d..dba6cee 100644
--- a/common/main.c
+++ b/common/main.c
@@ -79,8 +79,6 @@ extern void mdm_init(void); /* defined in board.c */
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
  * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
  */
-#if defined(CONFIG_BOOTDELAY)
-# if defined(CONFIG_AUTOBOOT_KEYED)
 static int abortboot_keyed(int bootdelay)
 {
int abort = 0;
@@ -173,8 +171,6 @@ static int abortboot_keyed(int bootdelay)
return abort;
 }
 
-# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
-
 static int menukey;
 
 static int abortboot_normal(int bootdelay)
@@ -228,17 +224,14 @@ static int abortboot_normal(int bootdelay)
 
return abort;
 }
-# endif/* CONFIG_AUTOBOOT_KEYED */
 
 static int abortboot(int bootdelay)
 {
-#ifdef CONFIG_AUTOBOOT_KEYED
-   return abortboot_keyed(bootdelay);
-#else
-   return abortboot_normal(bootdelay);
-#endif
+   if (autoconf_autoboot_keyed())
+   return abortboot_keyed(bootdelay);
+   else
+   return abortboot_normal(bootdelay);
 }
-#endif /* CONFIG_BOOTDELAY */
 
 /*
  * Runs the given boot command securely.  Specifically:
@@ -254,7 +247,6 @@ static int abortboot(int bootdelay)
  * printing the error message to console.
  */
 
-#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL)
 static void secure_boot_cmd(char *cmd)
 {
cmd_tbl_t *cmdtp;
@@ -295,22 +287,21 @@ static void process_fdt_options(const void *blob)
 
/* Add an env variable to point to a kernel payload, if available */
addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
-   if (addr)
-   setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+   if (addr) {
+   setenv_addr("kernaddr",
+   (void *)(autoconf_sys_text_base() + addr));
+   }
 
/* Add an env variable to point to a root disk, if available */
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
-   if (addr)
-   setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+   if (addr) {
+   setenv_addr("rootaddr",
+   (void *)(autoconf_sys_text_base() + addr));
+   }
 }
-#endif /* CONFIG_OF_CONTROL */
 
-#ifdef CONFIG_BOOTDELAY
 static void process_boot_delay(void)
 {
-#ifdef CONFIG_OF_CONTROL
-   char *env;
-#endif
char *s;
int bootdelay;
 #ifdef CONFIG_BOOTCOUNT_LIMIT
@@ -327,7 +318,7 @@ static void process_boot_delay(void)
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
s = getenv ("bootdelay");
-   bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+   bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay();
 
 #ifdef CONFIG_OF_CONTROL
bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
@@ -357,23 +348,24 @@ static void process_boot_delay(void)
else
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
s = getenv ("bootcmd");
-#ifdef CONFIG_OF_CONTROL
-   /* Allow the fdt to override the boot command */
-   env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
-   if (env)
-   s = env;
+   if (autoconf_of_control()) {
+   char *env;
 
-   process_fdt_options(gd->fdt_blob);
+   /* Allow the fdt to override the boot command */
+   env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
+   if (env)
+   s = env;
 
-   /*
-* If the bootsecure option was chosen, use secure_boot_cmd().
-* Always use 'env' in this case, since bootsecure requres that the
-* bootcmd was specified in the FDT too.
-*/
-   if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0))
-   secure_boot_cmd(env);
+   process_fdt_options(gd->fdt_blob);
 
-#endif /* CONFIG_OF_CONTROL */
+   /*
+   * If the bootsecure option was chosen, use secure_boot_cmd().
+   * Always use 'env' in this case, since bootsecure requres that
+   * the bootcmd was specified in the FDT too.
+   */
+   if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0))
+   secure_boot_cmd(env);
+   }
 
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "");
 
@@ -397,7 +389,6 @@ static void process_boot_delay(void)
}
 #endif /* CONFIG_MENUKEY */
 }
-#endif /* CONFIG_BOOTDELAY */
 
 void main_loop(v

Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/17/2013 10:43 AM, Mark Jackson wrote:
> On 13/05/13 19:28, Tom Rini wrote:
>> From: Steve Kipisz 
>> 
>> NOR requires that s_init be within the first 4KiB of the image so
>> that we can perform the rest of the required pinmuxing to talk
>> with the rest of NOR that we are found on.  When NOR_BOOT is set
>> we save our environment in NOR at 512KiB and a redundant copy at
>> 768KiB.  We avoid using SPL for this case and u-boot.bin is
>> written directly to the start of NOR.
> 
> I'm trying to get this up and running our NanoBone platform, but
> I'm having no success.
> 
> Using a non "NOR_BOOT" version, I can boot u-boot and read / write
> to the NOR device (located at 0x0800).
> 
> So I've compiled my "NOR_BOOT" version and stored it at the start
> of the flash device.
> 
> But when I switch to booting from NOR (rather than SD) I get no
> output on the serial console.
> 
> Using an oscilloscope, I can see the NOR chip select is active for
> a while (approx 350us), so *something* is trying to boot.
> 
> How can I debug such an early part of the boot process ?

Did you copy the parts that setup the pinmuxing in s_init for NOR?

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRvyIDAAoJENk4IS6UOR1W0v4P/0Nudkj1/7PhxndIRr3z1pXa
pbEDg3leDIiWHgoM5Z1Ruxti6s6l2LH+vzZ15Sl2XF4xrU8BQ6pxdBuMpbluiv2W
ePr3P2iQ/C67pT5WqXwXO2uIXzTxtUWNc6VOcd1ejDUWfHOAPZjWa7ObpPnklc/o
pGkN01xYuv+9Na/aLPVO2fB9KPE0t1xiVrAwReWaEGC8JaOMCN7XFslYjKSBOkRh
yai3NycmR6N12JcZVvzpRkA5WbcI4GdGC0TK/RywmF3bP6DdgNmc1GMCfKyQRs0c
h26S87AzUO4NyoEfecExLEhS8eP3LU0I5um2tp0kbLBOX/Wdy6hQ/Vn/LNGGFrDs
+urLVetNZweznxlyDn+dtxvo7dEQyiiIHN0xzOVwONUhz9mTnhDk8HBQAPRAqwOK
PVom+jNaG9UYxks4S0qjJvSiJR4VqvYdlOqMxwfPphIb0Nt1a/cVnhm7PCwWvvw2
q3bOAxq11+5aRDeBCOG+8rdFqotgXZ7ig4vwFb5qg4AFJE7wbJLoyAgxhO2o4KNe
Opa8DZsA4Joier1tC2fVuqPcl00tsg9JOqMDug4pgKyCz0EGWtREgy4/KKLT0/9J
JBXrv6h3D+tfUbNjNR7b5seMhK3WxYAMQQwgDGSLgs5Vwnydz5iI0Vp3xH21HSar
2SxW1hU4pMkAjBm2V4OA
=BJ51
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 1/8] Implement autoconf header file

2013-06-17 Thread Simon Glass
Add support for generating an autoconf.h header file that can be used in
the source instead of #ifdef.

For example, instead of:

 #ifdef CONFIG_VERSION_VARIABLE
setenv("ver", version_string);  /* set version variable */
 #endif

you can do:

if (autoconf_version_variable())
setenv("ver", version_string);  /* set version variable */

The compiler will ensure that the dead code is eliminated, so the result
is the same.

Where the value of the CONFIG define is 0, you can use the autoconf_has...()
form. For example CONFIG_BOOTDELAY can be -ve, 0 or +ve, but if it is
defined at all, it affects behaviour:

 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
s = getenv ("bootdelay");
 #endif

So we use:

if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0)
s = getenv ("bootdelay");

This later form should only be used for such 'difficult' defines where a
zero value still means that the CONFIG should be considered to be defined.

Signed-off-by: Simon Glass 
---
Changes in v4: None
Changes in v3:
- Add comment as to why we use [A-Za-z0-9_][A-Za-z0-9_]*
- Rename sed scripts to more useful names
- Update config_xxx() to autoconf_xxx() in comments/README/sed
- Update config_xxx_enabled() to autoconf_has_xxx() in comments/README/sed

Changes in v2:
- Add a grep to the sed/sort pipe to speed up processing
- Fix up a few errors and comments in the original RFC
- Split out changes to main.c into separate patches
- Use autoconf_...() instead of config_...()
- Use autoconf_has_...() instead of config_..._enabled()

 Makefile   | 43 -
 README | 87 --
 include/common.h   |  3 ++
 include/config_drop.h  | 17 +
 tools/scripts/define2value.sed | 37 ++
 tools/scripts/define2zero.sed  | 32 
 6 files changed, 215 insertions(+), 4 deletions(-)
 create mode 100644 include/config_drop.h
 create mode 100644 tools/scripts/define2value.sed
 create mode 100644 tools/scripts/define2zero.sed

diff --git a/Makefile b/Makefile
index 693b3f2..3c2ffd4 100644
--- a/Makefile
+++ b/Makefile
@@ -629,6 +629,7 @@ updater:
 # parallel sub-makes creating .depend files simultaneously.
 depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \
$(obj)include/autoconf.mk \
+   $(obj)include/generated/autoconf.h \
$(obj)include/generated/generic-asm-offsets.h \
$(obj)include/generated/asm-offsets.h
for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \
@@ -703,6 +704,45 @@ $(obj)include/autoconf.mk: $(obj)include/config.h
sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
mv $@.tmp $@
 
+# Create a C header file where every '#define CONFIG_XXX value' becomes
+# '#define autoconf_xxx() value', or '#define autoconf_xxx() 0' where the
+# CONFIG is not used by this board configuration. This allows C code to do
+# things like 'if (autoconf_xxx())' and have the compiler remove the dead code,
+# instead of using '#ifdef CONFIG_XXX...#endif'. Note that in most cases
+# if the autoconf_...() returns 0 then the option is not enabled. In some rare
+# cases such as CONFIG_BOOTDELAY, the config can be enabled but still have a
+# a value of 0. So in addition we a #define autoconf_has_xxx(), setting the
+# value to 0 if the option is disabled, 1 if enabled. This last feature will
+# hopefully be deprecated soon.
+# The file is regenerated when any U-Boot header file changes.
+$(obj)include/generated/autoconf.h: $(obj)include/config.h
+   @$(XECHO) Generating $@ ; \
+   set -e ; \
+   : Extract the config macros to a C header file ; \
+   $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
+   sed -n -f tools/scripts/define2value.sed > $@.tmp; \
+   : Regenerate our list of all config macros if neeed ; \
+   if [ ! -f $@-all.tmp ] || \
+   find $(src) -name '*.h' -type f -newer $@-all.tmp | \
+   egrep -qv 'include/(autoconf.h|generated|config.h)'; \
+   then \
+   : Extract all config macros from all C header files ; \
+   : We can grep for CONFIG since the value will be dropped ; \
+   ( \
+   find ${src} -name "*.h" -type f | xargs \
+   cat | grep CONFIG | \
+   sed -n -f tools/scripts/define2zero.sed \
+   ) | sort | uniq > $@-all.tmp; \
+   fi; \
+   : Extract the enabled config macros to a C header file ; \
+   $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
+   sed -n -f tools/scripts/define2zero.sed | \
+   sort > $@-enabled.tmp; \
+   set -e ; \
+   : Find CONFIGs that are not enabled ; \
+   comm -13 $@-enabled.tmp $@-all.tmp >>$@.tmp && \
+   mv $@.tmp $@
+
 

Re: [U-Boot] [PATCH] checkpatch.pl: Do not hardcode perl path

2013-06-17 Thread Joel A Fernandes
On Mon, Jun 17, 2013 at 1:38 AM, Andreas Bießmann
 wrote:
> Dear Joel A Fernandes,
>
> On 16.06.13 17:44, Joel A Fernandes wrote:
>> On Sunday, June 16, 2013, Jagannadha Sutradharudu Teki wrote:
>>
>>> From: Jagannadha Sutradharudu Teki 

>>>
>>> checkpatch.pl requires perl v5.10.0 to run but it
>>> doesn't require to place in /usr/bin/perl
>>> Use env to ensure that the interpreter used is the
>>> first one on environment's $PATH on system with
>>> several versions of perl installed.
>>>
>>> Signed-off-by: Jagannadha Sutradharudu Teki 
>>> 

>>> ---
>>>  tools/checkpatch.pl | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/checkpatch.pl b/tools/checkpatch.pl
>>> index 896e2bc..8dc5b9c 100755
>>> --- a/tools/checkpatch.pl
>>> +++ b/tools/checkpatch.pl
>>> @@ -1,10 +1,11 @@
>>> -#!/usr/bin/perl -w
>>> +#!/usr/bin/env perl
>>
>>
>> Would it not work to pass in the -w here?
>
> this is not portable! BSD variants of env will only take a single parameter.
>

Sure yes I noticed that, this is an acceptable approach though I've
seen some cases people solve the problem using exec.

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


[U-Boot] [PATCH v4 8/8] main: Use autoconf in main_loop()

2013-06-17 Thread Simon Glass
Convert main_loop() over to use autoconf, and add a required prototype
to common.h.

The do_mdm_init variable is now always defined, but this seems like an
acceptable compromise.

In fdt_support.h the #ifdef used is CONFIG_OF_LIBFDT. However, even if
this is not defined we want to make the functions available for our
conditional-compilation scheme. The only place where we really don't
have access to these support functions is when USE_HOSTCC is defined.
So change the #ifdef to that.

Signed-off-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---
Changes in v4:
- Rebase on current master

Changes in v3:
- Remove the extra config_of_libfdt() condition in main_loop()

Changes in v2: None

 common/main.c | 72 +++
 include/common.h  |  1 +
 include/fdt_support.h |  4 +--
 3 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/common/main.c b/common/main.c
index a854c3b..a5ef5fb 100644
--- a/common/main.c
+++ b/common/main.c
@@ -70,10 +70,7 @@ static int  retry_time = -1; /* -1 so can call readline 
before main_loop */
 
 #defineendtick(seconds) (get_ticks() + (uint64_t)(seconds) * 
get_tbclk())
 
-#ifdef CONFIG_MODEM_SUPPORT
 int do_mdm_init = 0;
-extern void mdm_init(void); /* defined in board.c */
-#endif
 
 /***
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
@@ -386,51 +383,47 @@ void main_loop(void)
int len;
int rc = 1;
int flag;
-#ifdef CONFIG_PREBOOT
-   char *p;
-#endif
 
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
-#ifdef CONFIG_MODEM_SUPPORT
-   debug("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
-   if (do_mdm_init) {
-   char *str = strdup(getenv("mdm_cmd"));
-   setenv("preboot", str);  /* set or delete definition */
-   if (str != NULL)
-   free(str);
-   mdm_init(); /* wait for modem connection */
+   if (autoconf_modem_support()) {
+   debug("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
+   if (do_mdm_init) {
+   char *str = strdup(getenv("mdm_cmd"));
+
+   setenv("preboot", str);  /* set or delete definition */
+   if (str != NULL)
+   free(str);
+   mdm_init(); /* wait for modem connection */
+   }
}
-#endif  /* CONFIG_MODEM_SUPPORT */
 
-#ifdef CONFIG_VERSION_VARIABLE
-   {
+   if (autoconf_version_variable())
setenv("ver", version_string);  /* set version variable */
-   }
-#endif /* CONFIG_VERSION_VARIABLE */
 
-#ifdef CONFIG_SYS_HUSH_PARSER
-   u_boot_hush_start();
-#endif
+   if (autoconf_sys_hush_parser())
+   u_boot_hush_start();
 
-#if defined(CONFIG_HUSH_INIT_VAR)
-   hush_init_var();
-#endif
+   if (autoconf_hush_init_var())
+   hush_init_var();
+
+   if (autoconf_preboot()) {
+   char *p = getenv("preboot");
+
+   if (p) {
+   int prev;
 
-#ifdef CONFIG_PREBOOT
-   p = getenv("preboot");
-   if (p != NULL) {
-# ifdef CONFIG_AUTOBOOT_KEYED
-   int prev = disable_ctrlc(1);/* disable Control C checking */
-# endif
+   /* disable Control C checking */
+   if (autoconf_autoboot_keyed())
+   prev = disable_ctrlc(1);
 
-   run_command_list(p, -1, 0);
+   run_command_list(p, -1, 0);
 
-# ifdef CONFIG_AUTOBOOT_KEYED
-   disable_ctrlc(prev);/* restore Control C checking */
-# endif
+   /* restore Control C checking */
+   if (autoconf_autoboot_keyed())
+   disable_ctrlc(prev);
+   }
}
-#endif /* CONFIG_PREBOOT */
 
 #if defined(CONFIG_UPDATE_TFTP)
update_tftp(0UL);
@@ -472,14 +465,13 @@ void main_loop(void)
}
 
if (len == -1)
-   puts ("\n");
+   puts("\n");
else
rc = run_command(lastcommand, flag);
 
-   if (rc <= 0) {
-   /* invalid command or not repeatable, forget it */
+   /* If an invalid command or not repeatable, forget it */
+   if (rc <= 0)
lastcommand[0] = 0;
-   }
}
 }
 
diff --git a/include/common.h b/include/common.h
index f38cdad..0118ebf 100644
--- a/include/common.h
+++ b/include/common.h
@@ -328,6 +328,7 @@ extern u8 _binary_dt_dtb_start[];   /* embedded device tree 
blob */
 int set_cpu_clk_info(void);
 int print_cpuinfo(void);
 int update_flash_size(int flash_size);
+extern int mdm_init(void); /* defined in board.c */
 
 /**
  * Show the DRAM size in

[U-Boot] [PATCH v4 2/8] main: Use autoconf for boot retry feature

2013-06-17 Thread Simon Glass
Change this feature to use autoconf instead of #ifdef.

Signed-off-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---
Changes in v4:
- Rebase on current master
- Tidy up code style nits with new checkpatch

Changes in v3:
- Fix missing && in if() statement
- Remove unneeded retry_min variable

Changes in v2: None

 common/main.c | 73 ++-
 1 file changed, 32 insertions(+), 41 deletions(-)

diff --git a/common/main.c b/common/main.c
index 56da214..3a143ae 100644
--- a/common/main.c
+++ b/common/main.c
@@ -65,17 +65,11 @@ static char * delete_char (char *buffer, char *p, int 
*colp, int *np, int plen);
 static const char erase_seq[] = "\b \b";   /* erase sequence   
*/
 static const char   tab_seq[] = "";/* used to expand TABs  
*/
 
-#ifdef CONFIG_BOOT_RETRY_TIME
 static uint64_t endtime = 0;  /* must be set, default is instant timeout */
 static int  retry_time = -1; /* -1 so can call readline before main_loop */
-#endif
 
 #defineendtick(seconds) (get_ticks() + (uint64_t)(seconds) * 
get_tbclk())
 
-#ifndef CONFIG_BOOT_RETRY_MIN
-#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
-#endif
-
 #ifdef CONFIG_MODEM_SUPPORT
 int do_mdm_init = 0;
 extern void mdm_init(void); /* defined in board.c */
@@ -174,11 +168,10 @@ static int abortboot_keyed(int bootdelay)
   delaykey[i].retry ? "delay" :
   "stop");
 
-#  ifdef CONFIG_BOOT_RETRY_TIME
-   /* don't retry auto boot */
-   if (! delaykey[i].retry)
+   /* don't retry auto boot? */
+   if (autoconf_boot_retry_time() &&
+   !delaykey[i].retry)
retry_time = -1;
-#  endif
abort = 1;
}
}
@@ -368,9 +361,8 @@ static void process_boot_delay(void)
 #if defined(CONFIG_MENU_SHOW)
bootdelay = menu_show(bootdelay);
 #endif
-# ifdef CONFIG_BOOT_RETRY_TIME
-   init_cmd_timeout ();
-# endif/* CONFIG_BOOT_RETRY_TIME */
+   if (autoconf_boot_retry_time())
+   init_cmd_timeout();
 
 #ifdef CONFIG_POST
if (gd->flags & GD_FLG_POSTFAIL) {
@@ -499,14 +491,12 @@ void main_loop(void)
for (;;);
 #else
for (;;) {
-#ifdef CONFIG_BOOT_RETRY_TIME
-   if (rc >= 0) {
+   if (autoconf_boot_retry_time() && rc >= 0) {
/* Saw enough of a valid command to
 * restart the timeout.
 */
reset_cmd_timeout();
}
-#endif
len = readline (CONFIG_SYS_PROMPT);
 
flag = 0;   /* assume no special flags for now */
@@ -514,19 +504,16 @@ void main_loop(void)
strcpy (lastcommand, console_buffer);
else if (len == 0)
flag |= CMD_FLAG_REPEAT;
-#ifdef CONFIG_BOOT_RETRY_TIME
-   else if (len == -2) {
+   else if (autoconf_boot_retry_time() && len == -2) {
/* -2 means timed out, retry autoboot
 */
-   puts ("\nTimed out waiting for command\n");
-# ifdef CONFIG_RESET_TO_RETRY
+   puts("\nTimed out waiting for command\n");
/* Reinit board to run initialization code again */
-   do_reset (NULL, 0, 0, NULL);
-# else
-   return; /* retry autoboot */
-# endif
+   if (autoconf_reset_to_retry())
+   do_reset(NULL, 0, 0, NULL);
+   else
+   return; /* retry autoboot */
}
-#endif
 
if (len == -1)
puts ("\n");
@@ -541,6 +528,10 @@ void main_loop(void)
 #endif /*CONFIG_SYS_HUSH_PARSER*/
 }
 
+/*
+ * Use ifdef here for the benefit of those archs not using
+ * -ffunction-sections, since these functions are exported.
+ */
 #ifdef CONFIG_BOOT_RETRY_TIME
 /***
  * initialize command line timeout
@@ -552,10 +543,10 @@ void init_cmd_timeout(void)
if (s != NULL)
retry_time = (int)simple_strtol(s, NULL, 10);
else
-   retry_time =  CONFIG_BOOT_RETRY_TIME;
+   retry_time = autoconf_boot_retry_time();
 
-   if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
-   retry_time = CONFIG_BOOT_RETRY_MIN;
+   if (retry_time >= 0 && retry_time < autoconf_boot_retry_min())
+   retry_time = autoconf_boot_retry_min();
 }
 
 /***
@@ -777,13 +768,13 @@ st

[U-Boot] [PATCH v4 6/8] main: Use autoconf for parser selection

2013-06-17 Thread Simon Glass
Allow parser selection to make use of autoconf instead of #ifdefs.

Signed-off-by: Simon Glass 
---
Changes in v4:
- Rebase on current master

Changes in v3: None
Changes in v2: None

 common/main.c  | 87 +++---
 include/hush.h |  2 --
 2 files changed, 41 insertions(+), 48 deletions(-)

diff --git a/common/main.c b/common/main.c
index fc55e06..b09bfb4 100644
--- a/common/main.c
+++ b/common/main.c
@@ -382,12 +382,10 @@ static void process_boot_delay(void)
 
 void main_loop(void)
 {
-#ifndef CONFIG_SYS_HUSH_PARSER
static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
int len;
int rc = 1;
int flag;
-#endif
 #ifdef CONFIG_PREBOOT
char *p;
 #endif
@@ -444,12 +442,11 @@ void main_loop(void)
/*
 * Main Loop for Monitor Command Processing
 */
-#ifdef CONFIG_SYS_HUSH_PARSER
-   parse_file_outer();
-   /* This point is never reached */
-   for (;;);
-#else
-   for (;;) {
+   if (autoconf_sys_hush_parser()) {
+   parse_file_outer();
+   /* This point is never reached */
+   for (;;);
+   } else {
if (autoconf_boot_retry_time() && rc >= 0) {
/* Saw enough of a valid command to
 * restart the timeout.
@@ -484,7 +481,6 @@ void main_loop(void)
lastcommand[0] = 0;
}
}
-#endif /*CONFIG_SYS_HUSH_PARSER*/
 }
 
 /*
@@ -1174,7 +1170,6 @@ int parse_line (char *line, char *argv[])
 
 //
 
-#ifndef CONFIG_SYS_HUSH_PARSER
 static void process_macros (const char *input, char *output)
 {
char c, prev;
@@ -1382,7 +1377,6 @@ static int builtin_run_command(const char *cmd, int flag)
 
return rc ? rc : repeatable;
 }
-#endif
 
 /*
  * Run a command using the selected parser.
@@ -1393,22 +1387,21 @@ static int builtin_run_command(const char *cmd, int 
flag)
  */
 int run_command(const char *cmd, int flag)
 {
-#ifndef CONFIG_SYS_HUSH_PARSER
-   /*
-* builtin_run_command can return 0 or 1 for success, so clean up
-* its result.
-*/
-   if (builtin_run_command(cmd, flag) == -1)
-   return 1;
-
-   return 0;
-#else
-   return parse_string_outer(cmd,
+   if (autoconf_sys_hush_parser()) {
+   return parse_string_outer(cmd,
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
-#endif
+   } else {
+   /*
+   * builtin_run_command can return 0 or 1 for success, so
+   * clean up its result.
+   */
+   if (builtin_run_command(cmd, flag) == -1)
+   return 1;
+
+   return 0;
+   }
 }
 
-#ifndef CONFIG_SYS_HUSH_PARSER
 /**
  * Execute a list of command separated by ; or \n using the built-in parser.
  *
@@ -1449,7 +1442,6 @@ static int builtin_run_command_list(char *cmd, int flag)
 
return rcode;
 }
-#endif
 
 int run_command_list(const char *cmd, int len, int flag)
 {
@@ -1459,13 +1451,16 @@ int run_command_list(const char *cmd, int len, int flag)
 
if (len == -1) {
len = strlen(cmd);
-#ifdef CONFIG_SYS_HUSH_PARSER
-   /* hush will never change our string */
-   need_buff = 0;
-#else
-   /* the built-in parser will change our string if it sees \n */
-   need_buff = strchr(cmd, '\n') != NULL;
-#endif
+   if (autoconf_sys_hush_parser()) {
+   /* hush will never change our string */
+   need_buff = 0;
+   } else {
+   /*
+* the built-in parser will change our string if it
+* sees \n
+*/
+   need_buff = strchr(cmd, '\n') != NULL;
+   }
}
if (need_buff) {
buff = malloc(len + 1);
@@ -1474,20 +1469,20 @@ int run_command_list(const char *cmd, int len, int flag)
memcpy(buff, cmd, len);
buff[len] = '\0';
}
-#ifdef CONFIG_SYS_HUSH_PARSER
-   rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON);
-#else
-   /*
-* This function will overwrite any \n it sees with a \0, which
-* is why it can't work with a const char *. Here we are making
-* using of internal knowledge of this function, to avoid always
-* doing a malloc() which is actually required only in a case that
-* is pretty rare.
-*/
-   rcode = builtin_run_command_list(buff, flag);
-   if (need_buff)
-   free(buff);
-#endif
+   if (autoconf_sys_hush_parser()) {
+   rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON);
+   } else {
+   /*
+   * This function will overwrite any \n it sees with a \0, 

[U-Boot] [PATCH v4 3/8] main: Remove CONFIG #ifdefs from the abortboot() code

2013-06-17 Thread Simon Glass
Move this code over to using autoconf. We can add the autoconf values to
the delaykey[] array, and move the code that checks for autoconf values into
the loop.

Also change to using ARRAY_SIZE on delaykey[].

Signed-off-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---
Changes in v4:
- Rebase on current master

Changes in v3: None
Changes in v2: None

 common/main.c | 90 ++-
 1 file changed, 34 insertions(+), 56 deletions(-)

diff --git a/common/main.c b/common/main.c
index 3a143ae..3a4754d 100644
--- a/common/main.c
+++ b/common/main.c
@@ -86,15 +86,20 @@ static int abortboot_keyed(int bootdelay)
int abort = 0;
uint64_t etime = endtick(bootdelay);
struct {
-   char* str;
+   const char *str;
u_int len;
int retry;
+   const char *conf;   /* Configuration value */
}
delaykey [] = {
-   { str: getenv ("bootdelaykey"),  retry: 1 },
-   { str: getenv ("bootdelaykey2"), retry: 1 },
-   { str: getenv ("bootstopkey"),   retry: 0 },
-   { str: getenv ("bootstopkey2"),  retry: 0 },
+   { str: getenv("bootdelaykey"),  retry: 1,
+   conf: autoconf_autoboot_delay_str() },
+   { str: getenv("bootdelaykey2"), retry: 1,
+   conf: autoconf_autoboot_delay_str2() },
+   { str: getenv("bootstopkey"),   retry: 0,
+   conf: autoconf_autoboot_stop_str() },
+   { str: getenv("bootstopkey2"),  retry: 0,
+   conf: autoconf_autoboot_stop_str2() },
};
 
char presskey [MAX_DELAY_STOP_STR];
@@ -102,33 +107,15 @@ static int abortboot_keyed(int bootdelay)
u_int presskey_max = 0;
u_int i;
 
-#ifndef CONFIG_ZERO_BOOTDELAY_CHECK
-   if (bootdelay == 0)
+   if (!autoconf_zero_bootdelay_check() && bootdelay == 0)
return 0;
-#endif
 
-#  ifdef CONFIG_AUTOBOOT_PROMPT
-   printf(CONFIG_AUTOBOOT_PROMPT);
-#  endif
-
-#  ifdef CONFIG_AUTOBOOT_DELAY_STR
-   if (delaykey[0].str == NULL)
-   delaykey[0].str = CONFIG_AUTOBOOT_DELAY_STR;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_DELAY_STR2
-   if (delaykey[1].str == NULL)
-   delaykey[1].str = CONFIG_AUTOBOOT_DELAY_STR2;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_STOP_STR
-   if (delaykey[2].str == NULL)
-   delaykey[2].str = CONFIG_AUTOBOOT_STOP_STR;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_STOP_STR2
-   if (delaykey[3].str == NULL)
-   delaykey[3].str = CONFIG_AUTOBOOT_STOP_STR2;
-#  endif
-
-   for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
+   if (autoconf_has_autoboot_prompt())
+   printf(autoconf_autoboot_prompt());
+
+   for (i = 0; i < ARRAY_SIZE(delaykey); i++) {
+   if (delaykey[i].conf && !delaykey[i].str)
+   delaykey[i].str = delaykey[i].conf;
delaykey[i].len = delaykey[i].str == NULL ?
0 : strlen (delaykey[i].str);
delaykey[i].len = delaykey[i].len > MAX_DELAY_STOP_STR ?
@@ -158,7 +145,7 @@ static int abortboot_keyed(int bootdelay)
}
}
 
-   for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
+   for (i = 0; i < ARRAY_SIZE(delaykey); i++) {
if (delaykey[i].len > 0 &&
presskey_len >= delaykey[i].len &&
memcmp (presskey + presskey_len - delaykey[i].len,
@@ -180,45 +167,39 @@ static int abortboot_keyed(int bootdelay)
if (!abort)
debug_bootkeys("key timeout\n");
 
-#ifdef CONFIG_SILENT_CONSOLE
-   if (abort)
+   if (autoconf_silent_console() && abort)
gd->flags &= ~GD_FLG_SILENT;
-#endif
 
return abort;
 }
 
 # else /* !defined(CONFIG_AUTOBOOT_KEYED) */
 
-#ifdef CONFIG_MENUKEY
-static int menukey = 0;
-#endif
+static int menukey;
 
 static int abortboot_normal(int bootdelay)
 {
int abort = 0;
unsigned long ts;
 
-#ifdef CONFIG_MENUPROMPT
-   printf(CONFIG_MENUPROMPT);
-#else
-   if (bootdelay >= 0)
+   if (autoconf_menuprompt())
+   printf(autoconf_menuprompt());
+   else if (bootdelay >= 0)
printf("Hit any key to stop autoboot: %2d ", bootdelay);
-#endif
 
-#if defined CONFIG_ZERO_BOOTDELAY_CHECK
/*
-* Check if key already pressed
-* Don't check if bootdelay < 0
+* If we need to do a bootdelay check even if bootdelay is 0, do
+* it here, since the loop below will be skipped in this case.
+* We don't do this check if bootdelay < 0.
 */
-   if (bootdelay >= 0) {
-   if (tstc()) {   /* we got a key press   */
+   if (autoconf_zero_bootdelay_check() && bootdelay >= 0) {
+

[U-Boot] [PATCH v4 5/8] main: Use autoconf for boot_delay code

2013-06-17 Thread Simon Glass
Convert this function and its children to use autoconf instead of #ifdef.

Signed-off-by: Simon Glass 
---
Changes in v4:
- Rebase on current master

Changes in v3:
- Simplify code for finding out bootdelay from config or environment

Changes in v2: None

 common/main.c  | 74 +-
 include/menu.h |  2 --
 2 files changed, 32 insertions(+), 44 deletions(-)

diff --git a/common/main.c b/common/main.c
index dba6cee..fc55e06 100644
--- a/common/main.c
+++ b/common/main.c
@@ -302,52 +302,42 @@ static void process_fdt_options(const void *blob)
 
 static void process_boot_delay(void)
 {
-   char *s;
-   int bootdelay;
-#ifdef CONFIG_BOOTCOUNT_LIMIT
unsigned long bootcount = 0;
unsigned long bootlimit = 0;
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-   bootcount = bootcount_load();
-   bootcount++;
-   bootcount_store (bootcount);
-   setenv_ulong("bootcount", bootcount);
-   bootlimit = getenv_ulong("bootlimit", 10, 0);
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-
-   s = getenv ("bootdelay");
-   bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay();
-
-#ifdef CONFIG_OF_CONTROL
-   bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
-   bootdelay);
-#endif
+   const char *s;
+   int bootdelay;
+
+   if (autoconf_bootcount_limit()) {
+   bootcount = bootcount_load();
+   bootcount++;
+   bootcount_store(bootcount);
+   setenv_ulong("bootcount", bootcount);
+   bootlimit = getenv_ulong("bootlimit", 10, 0);
+   }
 
+   bootdelay = getenv_ulong("bootdelay", 10, autoconf_bootdelay());
+
+   if (autoconf_of_control()) {
+   bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
+ bootdelay);
+   }
debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
-#if defined(CONFIG_MENU_SHOW)
-   bootdelay = menu_show(bootdelay);
-#endif
+   if (autoconf_menu_show())
+   bootdelay = menu_show(bootdelay);
if (autoconf_boot_retry_time())
init_cmd_timeout();
 
-#ifdef CONFIG_POST
-   if (gd->flags & GD_FLG_POSTFAIL) {
+   if (autoconf_post() && (gd->flags & GD_FLG_POSTFAIL)) {
s = getenv("failbootcmd");
-   }
-   else
-#endif /* CONFIG_POST */
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-   if (bootlimit && (bootcount > bootlimit)) {
+   } else if (autoconf_bootcount_limit() && bootlimit &&
+   (bootcount > bootlimit)) {
printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
(unsigned)bootlimit);
s = getenv ("altbootcmd");
-   }
-   else
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
+   } else {
s = getenv ("bootcmd");
+   }
if (autoconf_of_control()) {
char *env;
 
@@ -370,24 +360,24 @@ static void process_boot_delay(void)
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "");
 
if (bootdelay != -1 && s && !abortboot(bootdelay)) {
-#ifdef CONFIG_AUTOBOOT_KEYED
-   int prev = disable_ctrlc(1);/* disable Control C checking */
-#endif
+   int prev;
+
+   /* disable Control C checking */
+   if (autoconf_autoboot_keyed())
+   prev = disable_ctrlc(1);
 
run_command_list(s, -1, 0);
 
-#ifdef CONFIG_AUTOBOOT_KEYED
-   disable_ctrlc(prev);/* restore Control C checking */
-#endif
+   /* restore Control C checking */
+   if (autoconf_autoboot_keyed())
+   disable_ctrlc(prev);
}
 
-#ifdef CONFIG_MENUKEY
-   if (menukey == CONFIG_MENUKEY) {
+   if (autoconf_menukey() && menukey == autoconf_menukey()) {
s = getenv("menucmd");
if (s)
run_command_list(s, -1, 0);
}
-#endif /* CONFIG_MENUKEY */
 }
 
 void main_loop(void)
diff --git a/include/menu.h b/include/menu.h
index d8200ee..bcc3ec4 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -31,7 +31,5 @@ int menu_destroy(struct menu *m);
 void menu_display_statusline(struct menu *m);
 int menu_default_choice(struct menu *m, void **choice);
 
-#if defined(CONFIG_MENU_SHOW)
 int menu_show(int bootdelay);
-#endif
 #endif /* __MENU_H__ */
-- 
1.8.3

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


[U-Boot] [PATCH v4 7/8] main: Use autoconf in command line reading

2013-06-17 Thread Simon Glass
Remove #ifdefs in favour of autoconf for this code. This involves removing
a few unnecessary #ifdefs in headers also.

We have two versions of the code - one that handles command line editing and
one that is just a simple implementation. Create a new function called
readline_into_buffer() which calls either cread_line() or the new
simple_readline(), created to hold the 'simple' code.

The cread_print_hist_list() function is not actually used anywhere, so punt
it.

Signed-off-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---
Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/main.c | 164 --
 include/command.h |   2 -
 include/common.h  |   2 -
 3 files changed, 73 insertions(+), 95 deletions(-)

diff --git a/common/main.c b/common/main.c
index b09bfb4..a854c3b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -513,8 +513,6 @@ void reset_cmd_timeout(void)
 }
 #endif
 
-#ifdef CONFIG_CMDLINE_EDITING
-
 /*
  * cmdline-editing related codes from vivi.
  * Author: Janghoon Lyu 
@@ -617,27 +615,6 @@ static char* hist_next(void)
return (ret);
 }
 
-#ifndef CONFIG_CMDLINE_EDITING
-static void cread_print_hist_list(void)
-{
-   int i;
-   unsigned long n;
-
-   n = hist_num - hist_max;
-
-   i = hist_add_idx + 1;
-   while (1) {
-   if (i > hist_max)
-   i = 0;
-   if (i == hist_add_idx)
-   break;
-   printf("%s\n", hist_list[i]);
-   n++;
-   i++;
-   }
-}
-#endif /* CONFIG_CMDLINE_EDITING */
-
 #define BEGINNING_OF_LINE() {  \
while (num) {   \
getcmd_putch(CTL_BACKSPACE);\
@@ -899,27 +876,27 @@ static int cread_line(const char *const prompt, char 
*buf, unsigned int *len,
REFRESH_TO_EOL();
continue;
}
-#ifdef CONFIG_AUTO_COMPLETE
-   case '\t': {
-   int num2, col;
+   case '\t':
+   if (autoconf_auto_complete()) {
+   int num2, col;
 
-   /* do not autocomplete when in the middle */
-   if (num < eol_num) {
-   getcmd_cbeep();
-   break;
-   }
+   /* do not autocomplete when in the middle */
+   if (num < eol_num) {
+   getcmd_cbeep();
+   break;
+   }
 
-   buf[num] = '\0';
-   col = strlen(prompt) + eol_num;
-   num2 = num;
-   if (cmd_auto_complete(prompt, buf, &num2, &col)) {
-   col = num2 - num;
-   num += col;
-   eol_num += col;
+   buf[num] = '\0';
+   col = strlen(prompt) + eol_num;
+   num2 = num;
+   if (cmd_auto_complete(prompt, buf, &num2,
+ &col)) {
+   col = num2 - num;
+   num += col;
+   eol_num += col;
+   }
+   break;
}
-   break;
-   }
-#endif
default:
cread_add_char(ichar, insert, &num, &eol_num, buf, 
*len);
break;
@@ -935,8 +912,6 @@ static int cread_line(const char *const prompt, char *buf, 
unsigned int *len,
return 0;
 }
 
-#endif /* CONFIG_CMDLINE_EDITING */
-
 //
 
 /*
@@ -958,46 +933,14 @@ int readline (const char *const prompt)
return readline_into_buffer(prompt, console_buffer, 0);
 }
 
-
-int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
+static int simple_readline(const char *const prompt, int plen, char *p,
+  int timeout)
 {
-   char *p = buffer;
-#ifdef CONFIG_CMDLINE_EDITING
-   unsigned int len = CONFIG_SYS_CBSIZE;
-   int rc;
-   static int initted = 0;
-
-   /*
-* History uses a global array which is not
-* writable until after relocation to RAM.
-* Revert to non-history version if still
-* running from flash.
-*/
-   if (gd->flags & GD_FLG_RELOC) {
-   if (!initted) {
-   hist_init();
-   initted = 1;
-   }
-
-   if (prompt)
-   puts (prompt);
-
-   rc = cread_line(promp

[U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere

2013-06-17 Thread Simon Glass
Many parts of the U-Boot code base are sprinkled with #ifdefs. This makes
different boards compile different versions of the source code, meaning
that we must build all boards to check for failures. It is easy to misspell
an #ifdef and there is not as much checking of this by the compiler. Multiple
dependent #ifdefs are harder to do than with if..then..else. Variable
declarations must be #idefed as well as the code that uses them, often much
later in the file/function. #ifdef indents don't match code indents and
have their own separate indent feature. Overall, excessive use of #idef
hurts readability and makes the code harder to modify and refactor. For
people coming newly into the code base, #ifdefs can be a big barrier.

The use of #ifdef in U-Boot has possibly got a little out of hand. In an
attempt to turn the tide, this series includes a patch which provides a way
to make CONFIG macros available to C code without using the preprocessor.
This makes it possible to use standard C conditional features such as
if/then instead of #ifdef. A README update exhorts compliance.

As an example of how to use this, this series replaces all but two #ifdefs
from the main code body of common/main.c, which is one of the largest users
of #ifdef, even after a recent cleanup:

for f in $(find . -name *.c); do echo $(grep -c "ifdef" $f) $f; do
ne |sort -nr |head
81 ./common/board_r.c
57 ./arch/powerpc/cpu/mpc83xx/cpu_init.c
55 ./common/board_f.c
49 ./common/main.c
48 ./arch/powerpc/lib/board.c
47 ./drivers/video/cfb_console.c
40 ./drivers/mtd/cfi_flash.c
38 ./net/tftp.c
37 ./drivers/usb/host/ohci-hcd.c
36 ./drivers/fpga/ivm_core.c

Code size for this series seems to be roughly neutral (below numbers are
average change in byte size for each region:

  blackfin: (for 24/35 boards)  all -11.0  text -11.0
   x86: (for 1/1 boards)  bss +20.0  data +4.0  text -24.0
 avr32: (for 10/10 boards)  all -8.4  text -8.4
   sandbox: (for 1/1 boards)  all +16.0  bss +16.0
  m68k: (for 41/50 boards)  all -31.9  text -31.9
   powerpc: (for 639/641 boards)  all -20.5  bss +0.0  rodata -0.5  text -20.0
 sparc: (for 5/5 boards)  all -28.8  text -28.8
sh: (for 16/21 boards)  all -78.2  bss +3.2  rodata -15.5  text -66.0
 nios2: (for 3/3 boards)  all +24.0  bss +1.3  data -1.3  text +24.0
   arm: (for 307/327 boards)  all -41.0  bss +3.5  data +0.1  rodata -3.6
spl/u-boot-spl:all -0.1  spl/u-boot-spl:bss -0.1  text -41.0

Note that a config_drop.h file is added - this defines all the CONFIGs
which are not used in any board config file. Without this, autoconf cannot
define the macros for this CONFIGs.

Compile time for main.c does not seem to be any different in my tests. The
time to perform the 'dep' step (which now creates autoconf.h) increases,
from about 2.8s to about 4.6s. This additional time is used to grep, sed
and sort the contents of all the header file in U-Boot. The time for an
incremental build is not affected.

It would be much more efficient to maintain a list of all available CONFIG
defines, but no such list exists at present.

Buildman output shows no additional failures from mainline:
01: Merge branch 'master' of git://www.denx.de/git/u-boot-mmc
  blackfin: +   bf561-acvilon cm-bf561 blackstamp br4 bct-brettl2 cm-bf527 
dnp5370 bf506f-ezkit ip04 bf527-sdp bf609-ezkit bf537-stamp bf527-ezkit-v2 
cm-bf537e tcm-bf518 cm-bf537u bf527-ezkit bf537-pnav cm-bf533 pr1 bf533-ezkit 
ibf-dsp561 bf537-srv1 cm-bf548 bf537-minotaur bf538f-ezkit bf548-ezkit 
bf525-ucr2 blackvme tcm-bf537 bf533-stamp bf518f-ezbrd bf527-ad7160-eval 
bf526-ezbrd bf561-ezkit
  m68k: +   M54455EVB_a66 M5329AFEE M5249EVB idmr M5208EVBE M5475FFE 
M54451EVB astro_mcf5373l M54418TWR_serial_rmii M54455EVB_intel M5282EVB 
M54455EVB_i66 M5475GFE M5253DEMO M54455EVB_stm33 M5485BFE M5485DFE M5329BFEE 
M52277EVB M5475EFE M5475CFE M5485AFE M53017EVB M5475AFE M5485HFE M5235EVB 
M5253EVBE M54418TWR_nand_mii M54418TWR_nand_rmii_lowfreq TASREG cobra5272 
M5475BFE M5475DFE M5275EVB M52277EVB_stmicro eb_cpu5282 eb_cpu5282_internal 
M54451EVB_stmicro M5271EVB M5485GFE M5485EFE M5485FFE M54418TWR 
M5235EVB_Flash32 M5373EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5485CFE 
M54455EVB M5272C3
   powerpc: +   MVBLM7 MVSMR lcd4_lwmon5
sh: +   rsk7269 rsk7264 sh7757lcr sh7752evb rsk7203
microblaze: +   microblaze-generic
  openrisc: +   openrisc-generic
   arm: +   palmtc zipitz2 VCMA9 lubbock zynq_dcc vpac270_nor_128 
colibri_pxa270 kzm9g zynq xaeniax polaris pxa255_idp lp8x4x vpac270_ond_256 
vpac270_nor_256 smdk2410 h2200 balloon3 palmld trizepsiv
 nds32: +   adp-ag101p adp-ag102 adp-ag101
02: Implement autoconf header file
03: main: Use autoconf for boot retry feature
04: main: Remove CONFIG #ifdefs from the abortboot() code
05: main: Use autoconf to remove #ifdefs around process_boot_delay()
06: main: Use autoconf for boot_delay code
07: main: Use autoconf for parser selection
08: main: Use autoconf in command line re

Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

2013-06-17 Thread Mark Jackson
On 13/05/13 19:28, Tom Rini wrote:
> From: Steve Kipisz 
> 
> NOR requires that s_init be within the first 4KiB of the image so that
> we can perform the rest of the required pinmuxing to talk with the rest
> of NOR that we are found on.  When NOR_BOOT is set we save our
> environment in NOR at 512KiB and a redundant copy at 768KiB.  We avoid
> using SPL for this case and u-boot.bin is written directly to the start
> of NOR.

I'm trying to get this up and running our NanoBone platform, but I'm having
no success.

Using a non "NOR_BOOT" version, I can boot u-boot and read / write to the
NOR device (located at 0x0800).

So I've compiled my "NOR_BOOT" version and stored it at the start of the
flash device.

But when I switch to booting from NOR (rather than SD) I get no output on
the serial console.

Using an oscilloscope, I can see the NOR chip select is active for a while
(approx 350us), so *something* is trying to boot.

How can I debug such an early part of the boot process ?

Thanks for any help you can give me.

Regards
Mark J.


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


Re: [U-Boot] [RFC] Safe Linux Updater

2013-06-17 Thread Wolfgang Denk
Dear Mats,

In message  you wrote:
> 
> I havn't seen the scripts of Alexandre but it sounds something like what
> we have already implemented.

I haven'ty seen the scripts either, but this is something that has
been implemented many times before, with many variations depending on
specific project needs.  But as I mentioned before, most users do not
push such scripts into mainline...

> >   Please note that this is a feature standardized for example in the
> >   Open Source Development Labs Carrier Grade Linux Requirements
> >   Definition, which says something like: "CGL shall provide support
> >   for detecting a repeating reboot cycle due to recurring failures
> >   and will go to an offline state if this occurs."
> 
> As I read Alexandre, the aim is to revert to a previous functional image,

Yes, of course.  And the boot counter is the mechanism that will
decide when to do that.

> not to go to an offline state.

Indeed.  U-Boots boot counter will select an alternative boot command
in this case - you can use this to hard hang or power off the board
and so implement strictly CGL conformant behaviour, or you can do
somthing else like fall back to the previous version.

> >  Normally you want to avoid all erase / write operations to
> >   the boot loader and it's private data structures in the process of
> >   a normal reboot / reset.
> 
> But a failing boot is not a normal boot. This should only occur when an
> update fails. After a maximum number of failing boots, the old functional

Alexandre wrote about a boot counter; he did not mention that he would
update this only on failed boot attempts.

Also, in my experience one should be especially careful when something
fails, and in such a situation I would all the more restrain from
messing with the environment if it can be avoided (and here it's
trivial to avoid).

> image is used and there is no need to update the counter any more.

Did you have a look at the current implementation of the boot counter
for the systems where it is supported?  Yes, we even do have a system
where the boot counter is stored in an environment variable (due to
hardware restrictions and the expectation that the system will
normally not need to be rebooted at all), but normally is can be
easily avoided to meddle with the environment for this functionality.

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 person who is more than casually interested in computers should  be
well  schooled in machine language, since it is a fundamental part of
a computer.   -- Donald Knuth
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] image: Use ENOENT instead of ENOMEDIUM for better compatibility

2013-06-17 Thread Tom Rini
On Sun, Jun 16, 2013 at 07:46:49AM -0700, Simon Glass wrote:

> This error may not be defined on some platforms such as MacOS so host
> compilation will fail. Use one of the more common errors instead.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH v2 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Stefan Roese
Add SPL U-Boot support to replace x-loader on the Compulab cm_t35
board. Currently only the 256MiB SDRAM board versions are supported.

Tested by booting via MMC and NAND.

Signed-off-by: Stefan Roese 
Cc: Tom Rini 
Cc: Igor Grinberg 
---
v2:
- Change CONFIG_SYS_TEXT_BASE back to 0x80008000 for x-loader
  compatibility
- Change CONFIG_SPL_BSS_START_ADDR to 0x8010 to not overlap
  with TEXT_BASE now

 board/compulab/cm_t35/cm_t35.c | 18 +++-
 include/configs/cm_t35.h   | 64 --
 2 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index b0b80e5..cd7882e 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -120,6 +120,22 @@ static inline int splash_load_from_nand(void)
 }
 #endif /* CONFIG_CMD_NAND */
 
+#ifdef CONFIG_SPL_BUILD
+/*
+ * Routine: get_board_mem_timings
+ * Description: If we use SPL then there is no x-loader nor config header
+ * so we have to setup the DDR timings ourself on both banks.
+ */
+void get_board_mem_timings(struct board_sdrc_timings *timings)
+{
+   timings->mr = MICRON_V_MR_165;
+   timings->mcfg = MICRON_V_MCFG_165(256 << 20);
+   timings->ctrla = MICRON_V_ACTIMA_165;
+   timings->ctrlb = MICRON_V_ACTIMB_165;
+   timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+}
+#endif
+
 int board_splash_screen_prepare(void)
 {
char *env_splashimage_value;
@@ -443,7 +459,7 @@ void set_muxconf_regs(void)
cm_t3730_set_muxconf();
 }
 
-#ifdef CONFIG_GENERIC_MMC
+#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_getcd(struct mmc *mmc)
 {
u8 val;
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index c6e357a..1dc2d5b 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -40,8 +40,6 @@
 #define CONFIG_OMAP_GPIO
 #define CONFIG_CM_T3X  /* working with CM-T35 and CM-T3730 */
 
-#define CONFIG_SYS_TEXT_BASE   0x80008000
-
 #define CONFIG_SDRC/* The chip has SDRC controller */
 
 #include   /* get chip and board defs */
@@ -341,4 +339,66 @@
 #define CONFIG_BMP_16BPP
 #define CONFIG_SPLASH_SCREEN_PREPARE
 
+/* Defines for SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_NAND_SIMPLE
+
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR0x300 /* address 
0x6 */
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x200 /* 256 KB */
+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME   "u-boot.img"
+
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_BASE
+#define CONFIG_SPL_NAND_DRIVERS
+#define CONFIG_SPL_NAND_ECC
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
+#define CONFIG_SPL_OMAP3_ID_NAND
+#define CONFIG_SPL_LDSCRIPT"$(CPUDIR)/omap-common/u-boot-spl.lds"
+
+/* NAND boot config */
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_COUNT 64
+#define CONFIG_SYS_NAND_PAGE_SIZE  2048
+#define CONFIG_SYS_NAND_OOBSIZE64
+#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
+/*
+ * Use the ECC/OOB layout from omap_gpmc.h that matches your chip:
+ * SP vs LP, 8bit vs 16bit: GPMC_NAND_HW_ECC_LAYOUT
+ */
+#define CONFIG_SYS_NAND_ECCPOS { 1, 2, 3, 4, 5, 6, 7, 8, 9, \
+10, 11, 12 }
+#define CONFIG_SYS_NAND_ECCSIZE512
+#define CONFIG_SYS_NAND_ECCBYTES   3
+
+#define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_OFFS0x8
+
+#define CONFIG_SPL_TEXT_BASE   0x40200800
+#define CONFIG_SPL_MAX_SIZE(54 * 1024) /* 8 KB for stack */
+#define CONFIG_SPL_STACK   LOW_LEVEL_SRAM_STACK
+
+/*
+ * Use 0x80008000 as TEXT_BASE here for compatibility reasons with the
+ * older x-loader implementations. And move the BSS area so that it
+ * doesn't overlap with TEXT_BASE.
+ */
+#define CONFIG_SYS_TEXT_BASE   0x80008000
+#define CONFIG_SPL_BSS_START_ADDR  0x8010
+#define CONFIG_SPL_BSS_MAX_SIZE0x8 /* 512 KB */
+
+#define CONFIG_SYS_SPL_MALLOC_START0x80208000
+#define CONFIG_SYS_SPL_MALLOC_SIZE 0x10
+
 #endif /* __CONFIG_H */
-- 
1.8.2.3

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


Re: [U-Boot] [RFC] Safe Linux Updater

2013-06-17 Thread Stefano Babic
Hi Mats,

On 17/06/2013 15:25, Mats Kärrman wrote:
> Dear Wolfgang,
> 
> I havn't seen the scripts of Alexandre but it sounds something like what
> we have already implemented.
> 
> Wolfgang Denk wrote:
>>   Please note that this is a feature standardized for example in the
>>   Open Source Development Labs Carrier Grade Linux Requirements
>>   Definition, which says something like: "CGL shall provide support
>>   for detecting a repeating reboot cycle due to recurring failures
>>   and will go to an offline state if this occurs."
> 
> As I read Alexandre, the aim is to revert to a previous functional image,
> not to go to an offline state.

This is already done in u-boot checking the value of the boot counter
(in not persistency storage) and calling a script that switch back to
the previous copy, if any.

I find that the proposal does not scale well. Having partitions on a
disk / SDCARd is a case, but we have several different way to boot.
Think about kernel / rootfs into UBI or UBIFS, or saved as raw data in
other kind of storages (NOR, SPI,..). Because we are talking about the
feature "updating", this should be abstracted from the specific case to
be generalized in U-Boot.

> 
>>  Normally you want to avoid all erase / write operations to
>>   the boot loader and it's private data structures in the process of
>>   a normal reboot / reset.
> 
> But a failing boot is not a normal boot. This should only occur when an
> update fails.

There are runtime conditions that can cause the boot to fail, due for
example to power-supply. Or a degrading of the resources (flash gets
wrong), and so on.

Even if a failure due to a wrong update is a common case to have a
failing boot, this is not the only use case.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Stefan Roese
On 17.06.2013 15:38, Igor Grinberg wrote:
 +/*
 + * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
 + * 64 bytes before this address should be set aside for u-boot.img's
 + * header. That is 0x800FFFC0--0x8010 should not be used for any
 + * other needs.
 + */
 +#define CONFIG_SYS_TEXT_BASE  0x8010
>>>
>>> Now this is a problem.
>>> This breaks the backward compatibility with our X-Loader and we
>>> cannot just switch to 8010...
>>
>> And thinking back to when I was doing more OMAP3 conversions, there's no
>> requirement to break compatibility with x-loader either.  You just need
>> to take care where you place things, see doc/SPL/README.omap3 for the
>> SPL and X-Loader compatible setup.
> 
> Actually, I was thinking about adding a target in boards.cfg, but
> if we can make both (X-Loader and SPL) live in piece, then IMO,
> we should go for it.

I just did a quick check with moving CONFIG_SYS_TEXT_BASE back to
0x80008000 and CONFIG_SPL_BSS_START_ADDR up to 0x8010. Seems to work
just fine.

I'll submit a new version in a short while.

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


Re: [U-Boot] [PATCH 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Igor Grinberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/17/13 15:38, Tom Rini wrote:
> On Mon, Jun 17, 2013 at 02:53:27PM +0300, Igor Grinberg wrote:
>> Hi Stefan,
>>
>> On 06/14/13 11:55, Stefan Roese wrote:
>>> Add SPL U-Boot support to replace x-loader on the Compulab cm_t35
>>> board. Currently only the 256MiB SDRAM board versions are supported.
>>>
>>> Tested by booting via MMC and NAND.
>>>
>>> Signed-off-by: Stefan Roese 
>>> Cc: Tom Rini 
>>> Cc: Igor Grinberg 
> [snip]
>>> +/*
>>> + * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
>>> + * 64 bytes before this address should be set aside for u-boot.img's
>>> + * header. That is 0x800FFFC0--0x8010 should not be used for any
>>> + * other needs.
>>> + */
>>> +#define CONFIG_SYS_TEXT_BASE   0x8010
>>
>> Now this is a problem.
>> This breaks the backward compatibility with our X-Loader and we
>> cannot just switch to 8010...
> 
> And thinking back to when I was doing more OMAP3 conversions, there's no
> requirement to break compatibility with x-loader either.  You just need
> to take care where you place things, see doc/SPL/README.omap3 for the
> SPL and X-Loader compatible setup.

Actually, I was thinking about adding a target in boards.cfg, but
if we can make both (X-Loader and SPL) live in piece, then IMO,
we should go for it.

Thanks for the pointer!


- -- 
Regards,
Igor.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (GNU/Linux)

iQIcBAEBAgAGBQJRvxFwAAoJEBDE8YO64Efa0DsP/R0053VMz10juUsP38dFb7lb
xcKQFmvJe0W1skIJZmFAa+1gUNYf1EMcHGx7JqIwtsVDBsHxK5fzAbj1mU4RbQUx
zY5nmGtKlfiV1xPMQSrwo6rDxX3pPRId5rfC9sxpCwdliCFzvypfP6mPTcGm10db
2MygHvm+cXU1hNi7JPF3eRCVuqDhO/mrnES0MD2tkxfF88sJOYvvCBSLndJy+cF2
8FrnAC1w+4xnUqT33VTAf/P1+/2qzFcnrVXRNBn/fRfvahT91EuGwWrzqRrvvwNd
lMTwSreO4RvvG6pa0RGgu6I6/6Ao5CYbjkznDzeyMl+001a2hxIlwuXb+yJaNneN
lISSWSAnTT6AcoIRDGVOmFkWOzfmgZoqsikeBKA22jyzZymoXWwhJ5RM5/l0/OKu
V7/X2vWuzTeAzbOlRMof25DtLk/vXdYA4vt6b9iyIffVPSq9WWGGJhPhgSfQ5rW1
S8k1JXbIn99TY6igyaK+7rf42FxOMZLyPdKH53qCM2G80XGy+Df7y2ZHyv8ssQRY
f5w2CYSDo4ph01tGo3hI5bvz671yAoBUs6+/7ERofJ9gx2R0XOKUhfY6znIXeDMl
o8AqyYpXTboDG9FRH0cE6Lud4CUt2sY2NQ/CkfdXyYIfeOGVqWUbLefc9cZNBGDe
4AoUHehr5tgIFNiT5yP+
=X70e
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] Safe Linux Updater

2013-06-17 Thread Mats Kärrman
Dear Wolfgang,

I havn't seen the scripts of Alexandre but it sounds something like what
we have already implemented.

Wolfgang Denk wrote:
>   Please note that this is a feature standardized for example in the
>   Open Source Development Labs Carrier Grade Linux Requirements
>   Definition, which says something like: "CGL shall provide support
>   for detecting a repeating reboot cycle due to recurring failures
>   and will go to an offline state if this occurs."

As I read Alexandre, the aim is to revert to a previous functional image,
not to go to an offline state.

>  Normally you want to avoid all erase / write operations to
>   the boot loader and it's private data structures in the process of
>   a normal reboot / reset.

But a failing boot is not a normal boot. This should only occur when an
update fails. After a maximum number of failing boots, the old functional
image is used and there is no need to update the counter any more.

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


Re: [U-Boot] [PATCH] ARM: mxs: Make the console buffer smaller

2013-06-17 Thread Otavio Salvador
On Mon, Jun 17, 2013 at 10:07 AM, Stefano Babic  wrote:
> Hallo Marek,
>
> On 17/06/2013 14:51, Marek Vasut wrote:
>
>>> I am missing something: which is the real advantage to reduce the
>>> console buffer ? I do not think that the saved memory is worth, and on
>>> the other side more elaborated scripts (usings nested if-then-else) are
>>> quite long nowadays.
>>
>> True, but so far they didn't overflow this limit I believe. Some of them are
>> hanging on the verge of blowing it though, good point.
>
> I think that a point to consider is if all scripts are already provided
> or we let the user/owner of the board to add his own scripts, as I
> presume. It is pity if he cannot do what u-boot really supports only to
> save some bytes.

I think this is more than enough to justify a bigger buffer.


--
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: mxs: Make the console buffer smaller

2013-06-17 Thread Stefano Babic
Hallo Marek,

On 17/06/2013 14:51, Marek Vasut wrote:

>> I am missing something: which is the real advantage to reduce the
>> console buffer ? I do not think that the saved memory is worth, and on
>> the other side more elaborated scripts (usings nested if-then-else) are
>> quite long nowadays.
> 
> True, but so far they didn't overflow this limit I believe. Some of them are 
> hanging on the verge of blowing it though, good point.

I think that a point to consider is if all scripts are already provided
or we let the user/owner of the board to add his own scripts, as I
presume. It is pity if he cannot do what u-boot really supports only to
save some bytes.

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: mxs: Make the console buffer smaller

2013-06-17 Thread Marek Vasut
Hello Stefano,

I'm CCing Wolfgang,

> Hi Marek,
> 
> On 15/06/2013 23:41, Marek Vasut wrote:
> > Using 1024 bytes for console buffer is unnecessarily too much,
> > lower the amount for all MXS boards to 256.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Fabio Estevam 
> > Cc: Lauri Hintsala 
> > Cc: Otavio Salvador 
> > Cc: Stefano Babic 
> > ---
> > 
> >  include/configs/mxs.h |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Note: This depends on http://patchwork.ozlabs.org/patch/251631/
> > 
> > diff --git a/include/configs/mxs.h b/include/configs/mxs.h
> > index a684166..161d89d 100644
> > --- a/include/configs/mxs.h
> > +++ b/include/configs/mxs.h
> > @@ -92,7 +92,7 @@
> > 
> >  #ifndef CONFIG_SYS_PROMPT
> >  #define CONFIG_SYS_PROMPT  "=> "
> >  #endif
> > 
> > -#define CONFIG_SYS_CBSIZE  1024/* Console I/O buffer size */
> > +#define CONFIG_SYS_CBSIZE  256 /* Console I/O buffer size */
> > 
> >  #define CONFIG_SYS_PBSIZE  \
> >  
> > (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
> > 
> > /* Print buffer size */
> 
> I am missing something: which is the real advantage to reduce the
> console buffer ? I do not think that the saved memory is worth, and on
> the other side more elaborated scripts (usings nested if-then-else) are
> quite long nowadays.

True, but so far they didn't overflow this limit I believe. Some of them are 
hanging on the verge of blowing it though, good point.

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


Re: [U-Boot] [PATCH 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Tom Rini
On Mon, Jun 17, 2013 at 02:53:27PM +0300, Igor Grinberg wrote:
> Hi Stefan,
> 
> On 06/14/13 11:55, Stefan Roese wrote:
> > Add SPL U-Boot support to replace x-loader on the Compulab cm_t35
> > board. Currently only the 256MiB SDRAM board versions are supported.
> > 
> > Tested by booting via MMC and NAND.
> > 
> > Signed-off-by: Stefan Roese 
> > Cc: Tom Rini 
> > Cc: Igor Grinberg 
[snip]
> > +/*
> > + * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
> > + * 64 bytes before this address should be set aside for u-boot.img's
> > + * header. That is 0x800FFFC0--0x8010 should not be used for any
> > + * other needs.
> > + */
> > +#define CONFIG_SYS_TEXT_BASE   0x8010
> 
> Now this is a problem.
> This breaks the backward compatibility with our X-Loader and we
> cannot just switch to 8010...

And thinking back to when I was doing more OMAP3 conversions, there's no
requirement to break compatibility with x-loader either.  You just need
to take care where you place things, see doc/SPL/README.omap3 for the
SPL and X-Loader compatible setup.

-- 
Tom


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


Re: [U-Boot] [RFC] Safe Linux Updater

2013-06-17 Thread Wolfgang Denk
Dear Alexandre

In message <130325823.452426.1371459938406.javamail.r...@openwide.fr> you wrote:
> 
> One month ago, I sent a first request for comments about an open source 
> automatic updater for embedded systems using U-boot: the goal of this project 
> was to split a flash memory or hard disk drive in multiple partition (2 or 
> more) and install a new kern
> el and/or root filesystem  on an empty or outdated partition.

Could you please restrict yourline length to some 70 characters or so?
Thanks!!

> The u-boot environment would contain some variables to handle name, state and 
> boot attempt count of each partition of the system. I would use 
> CONFIG_ENV_OFFSET_REDUND to make writing on environment powerfail-safe.
> The environment contains 3 variables by partitions:
> - part_X_flag: handles state of partition X. It can be NONE for empty 
> partition, OK for working system, LOCK for locking a partition to install a 
> new system on it, UPDATED for new system version (we count boot attempts for 
> this partition) and BAD for ba
> d system which doesn't work.
> - part_X_count: handles boot attempts on partition X.
> - part_X_cmd: U-boot command used to boot on the partition X (e.g. partition 
> address in flash).
> Environment contains also another variable: "boot_seq" which handles a list 
> of bootable partition sorted by version.

This sounds like a bad idea, for two reasons:

1) U-Boot already supports the boot count feature (but of course this
   hardware-specific as you need to find persistent storage for the
   counter).  However, this does not consider which exact boot command
   has been executed (in your case: what the used boot partition was),
   it just counts the number of resets after the last power-on.
   Actually this is all you should need.

   Please note that this is a feature standardized for example in the
   Open Source Development Labs Carrier Grade Linux Requirements
   Definition, which says something like: "CGL shall provide support
   for detecting a repeating reboot cycle due to recurring failures
   and will go to an offline state if this occurs."

2) Defining the boot counter as part of the envrionment requires
   automatic writes to the environment for each reset / reboot of the
   board.  This is considered a bad idea, as it causes excessive flash
   wear.  Normally you want to avoid all erase / write operations to
   the boot loader and it's private data structures in the process of
   a normal reboot / reset.

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
Microsoft Multitasking:
 several applications can crash at the same time.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 11/14] arm: add Faraday FTPWMTMR010 timer support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Drop IRQ dependant implementation
   - Use gd->arch.timer_rate_hz for timer clock source
   - Use gd->arch.tbl for timestamp

Changes for v4:
   - Coding Style cleanup.
   - Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
   - Coding Style cleanup.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Add '__iomem' to all the declaration of HW register pointers.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().

 arch/arm/cpu/faraday/Makefile  |1 +
 arch/arm/cpu/faraday/ftpwmtmr010.c |  128 
 include/faraday/ftpwmtmr010.h  |   41 
 3 files changed, 170 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftpwmtmr010.c
 create mode 100644 include/faraday/ftpwmtmr010.h

diff --git a/arch/arm/cpu/faraday/Makefile b/arch/arm/cpu/faraday/Makefile
index 658d9ed..6b96e32 100644
--- a/arch/arm/cpu/faraday/Makefile
+++ b/arch/arm/cpu/faraday/Makefile
@@ -28,6 +28,7 @@ LIB   = $(obj)lib$(CPU).o
 src-y  := cpu.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
 src-$(CONFIG_FTTMR010)+= fttmr010.o
+src-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o

 START  = start.o
 COBJS  = $(src-y)
diff --git a/arch/arm/cpu/faraday/ftpwmtmr010.c 
b/arch/arm/cpu/faraday/ftpwmtmr010.c
new file mode 100644
index 000..8f8185e
--- /dev/null
+++ b/arch/arm/cpu/faraday/ftpwmtmr010.c
@@ -0,0 +1,128 @@
+/*
+ * arch/arm/cpu/faraday/ftpwmtmr010.c
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+
+#ifdef CONFIG_A369_FA606TE_PLATFORM
+#define TIMER_ID4
+#else
+#define TIMER_ID0
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct ftpwmtmr010_regs *regs = (void __iomem *)CONFIG_FTPWMTMR010_BASE;
+
+void udelay_masked(unsigned long usec)
+{
+   int id = TIMER_ID + 1;
+   ulong freq = gd->arch.timer_rate_hz;
+
+   /* timer re-start */
+   writel(0, ®s->t[id].ctrl);
+   writel(BIT_MASK(id), ®s->isr);
+   writel(0, ®s->t[id].cmpb);
+   writel((freq / 100) * usec, ®s->t[id].cntb);
+   writel(CTRL_INTEN | CTRL_START | CTRL_UPDATE, ®s->t[id].ctrl);
+
+   /* wait for timer interrupt */
+   while (!(readl(®s->isr) & BIT_MASK(id)))
+   ;
+
+   /* timer disabled */
+   writel(0, ®s->t[id].ctrl);
+   writel(BIT_MASK(id), ®s->isr);
+}
+
+void reset_timer_masked(void)
+{
+   int id = TIMER_ID;
+   ulong freq = gd->arch.timer_rate_hz;
+
+   writel(0, ®s->t[id].ctrl);
+   writel(BIT_MASK(id), ®s->isr);
+
+   /* setup a longest periodic timer */
+   writel((0x / freq) * freq, ®s->t[id].cntb);
+
+   writel(0, ®s->t[id].cmpb);
+   writel(CTRL_AUTORELOAD | CTRL_INTEN | CTRL_START | CTRL_UPDATE,
+   ®s->t[id].ctrl);
+}
+
+ulong get_timer_masked(void)
+{
+   int id = TIMER_ID;
+   ulong freq = gd->arch.timer_rate_hz;
+   ulong secs = 0x / freq;
+   ulong ms = freq / CONFIG_SYS_HZ;
+
+   if (readl(®s->isr) & BIT_MASK(id)) {
+   writel(BIT_MASK(id), ®s->isr);
+   gd->arch.tbl += secs * CONFIG_SYS_HZ;
+   }
+
+   return gd->arch.tbl
+   + ((secs * freq - readl(®s->t[id].cnto)) / ms);
+}
+
+int timer_init(void)
+{
+   gd->arch.tbl = 0;
+   reset_timer_masked();
+   return 0;
+}
+
+void reset_timer(void)
+{
+   reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+   return get_timer_masked() - base;
+}
+
+void __udelay(unsigned long usec)
+{
+   udelay_masked(usec);
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+   return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+   return CONFIG

[U-Boot] [PATCH v5 12/14] arm: add Faraday specific boot command

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

At the time of writting, none of Faraday NAND & SPI controllers
supports XIP (eXecute In Place). So the Faraday A360/A369 SoC has
to implement a 1st level bootstrap code stored in the embedded ROM
inside the SoC.

After power-on, the ROM code (1st level bootstrap code) would load
the 2nd bootstrap code into SRAM without any SDRAM initialization.

The 2nd bootstrap code would then initialize SDRAM and load the
generic firmware (u-boot/linux) into SDRAM, and finally make
a long-jump to the firmware.

Which means the SPL design of U-boot would never fit to A360/A369,
since it's usually not possible to alter a embedded ROM code.
And because both the 1st & 2nd level bootstrap code use the private
Faraday Firmware Image Format, it would be better to drop U-boot
image support to simplify the design.

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Rename from 'arm: add Faraday firmware image utility'
 into 'arm: add Faraday specific boot command'
   - Add missing CRC check to the command 'bootfa'.
   - Add rationale to the command 'bootfa'.

Changes for v4:
   - Coding Style cleanup.
   - Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
   - Coding Style cleanup.
   - Always insert a blank line between declarations and code.

Changes for v2:
   - Coding Style cleanup.

 arch/arm/cpu/faraday/Makefile |2 +-
 arch/arm/cpu/faraday/cmd_bootfa.c |  276 +
 arch/arm/cpu/faraday/fwimage.h|   47 +++
 arch/arm/cpu/faraday/fwimage2.h   |   67 +
 arch/arm/cpu/u-boot.lds   |   11 ++
 5 files changed, 402 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/faraday/cmd_bootfa.c
 create mode 100644 arch/arm/cpu/faraday/fwimage.h
 create mode 100644 arch/arm/cpu/faraday/fwimage2.h

diff --git a/arch/arm/cpu/faraday/Makefile b/arch/arm/cpu/faraday/Makefile
index 6b96e32..ef6a72e 100644
--- a/arch/arm/cpu/faraday/Makefile
+++ b/arch/arm/cpu/faraday/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk

 LIB= $(obj)lib$(CPU).o

-src-y  := cpu.o
+src-y  := cpu.o cmd_bootfa.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
 src-$(CONFIG_FTTMR010)+= fttmr010.o
 src-$(CONFIG_FTPWMTMR010) += ftpwmtmr010.o
diff --git a/arch/arm/cpu/faraday/cmd_bootfa.c 
b/arch/arm/cpu/faraday/cmd_bootfa.c
new file mode 100644
index 000..cdc47a3
--- /dev/null
+++ b/arch/arm/cpu/faraday/cmd_bootfa.c
@@ -0,0 +1,276 @@
+/*
+ * arch/arm/cpu/faraday/cmd_bootfa.c
+ *
+ * This command is used to boot faraday firmware from MMC/USB/SPI/NAND/NOR
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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
+ */
+
+/*
+ * At the time of writting, none of Faraday NAND & SPI controllers
+ * supports XIP (eXecute In Place). So the Faraday A360/A369 SoC has
+ * to implement a 1st level bootstrap code stored in the embedded ROM
+ * inside the SoC.
+ *
+ * After power-on, the ROM code (1st level bootstrap code) would load
+ * the 2nd bootstrap code into SRAM without any SDRAM initialization.
+ *
+ * The 2nd bootstrap code would then initialize SDRAM and load the
+ * generic firmware (u-boot/linux) into SDRAM, and finally make
+ * a long-jump to the firmware.
+ *
+ * Which means the SPL design of U-boot would never fit to A360/A369,
+ * since it's usually not possible to alter a embedded ROM code.
+ * And because both the 1st & 2nd level bootstrap code use the private
+ * Faraday Firmware Image Format, it would be better to drop U-boot
+ * image support to simplify the design.
+ *
+ * The Faraday Firmware Image Format uses a 1 KB (1024 Bytes) header:
+ *
+ * ++ 0x
+ * | MAGIC  | Magic number
+ * ++ 0x0004
+ * | HDR LENGTH | The size of this header
+ * ++ 0x0008
+ * ||
+ * | SYS PARAMETERS | A set of (addr, data) for 32-bit register write,
+ * || which is for SDRAM initialization and timing control.
+ * ++ 0x0108
+ * ||
+ * | PART TABLE | A partition table with max. 10 entries.
+ * ||
+ * ++ 0x03D8
+ * | HDR CHECKSUM   | Header Checksum (CRC32)
+ * ++ 0x03DC
+ * | HDR REVISION   | Header Revision ID
+ * ++ 0x03E

[U-Boot] [PATCH v5 13/14] mmc: ftsdc010_mci: clk_get_rate() -> clock_get_rate()

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

This updates ftsdc010_mci.c for latest Faraday clock APIs.

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
CC: Andy Fleming 
---
Changes for v5:
   - Initial commit

 drivers/mmc/ftsdc010_mci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
index 562b14a..0a0a19b 100644
--- a/drivers/mmc/ftsdc010_mci.c
+++ b/drivers/mmc/ftsdc010_mci.c
@@ -363,7 +363,7 @@ int ftsdc010_mmc_init(int devid)
 #ifdef CONFIG_SYS_CLK_FREQ
chip->sclk = CONFIG_SYS_CLK_FREQ;
 #else
-   chip->sclk = clk_get_rate("SDC");
+   chip->sclk = clock_get_rate(MMC_CLK);
 #endif

mmc->voltages  = MMC_VDD_32_33 | MMC_VDD_33_34;
--
1.7.9.5

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


[U-Boot] [PATCH v5 10/14] arm: add Faraday FTTMR010 timer support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Drop IRQ dependant implementation
   - Use gd->arch.timer_rate_hz for timer clock source
   - Use gd->arch.tbl for timestamp

Changes for v4:
   - Coding Style cleanup.
   - Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
   - Coding Style cleanup.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Add '__iomem' to all the declaration of HW register pointers.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().

 arch/arm/cpu/faraday/Makefile   |1 +
 arch/arm/cpu/faraday/fttmr010.c |  136 +++
 include/faraday/fttmr010.h  |   17 +
 3 files changed, 154 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/fttmr010.c

diff --git a/arch/arm/cpu/faraday/Makefile b/arch/arm/cpu/faraday/Makefile
index 35926c2..658d9ed 100644
--- a/arch/arm/cpu/faraday/Makefile
+++ b/arch/arm/cpu/faraday/Makefile
@@ -27,6 +27,7 @@ LIB   = $(obj)lib$(CPU).o

 src-y  := cpu.o
 src-$(CONFIG_FTINTC020)   += ftintc020.o
+src-$(CONFIG_FTTMR010)+= fttmr010.o

 START  = start.o
 COBJS  = $(src-y)
diff --git a/arch/arm/cpu/faraday/fttmr010.c b/arch/arm/cpu/faraday/fttmr010.c
new file mode 100644
index 000..9d6f7ac
--- /dev/null
+++ b/arch/arm/cpu/faraday/fttmr010.c
@@ -0,0 +1,136 @@
+/*
+ * arch/arm/cpu/faraday/fttmr010.c
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct fttmr010 *regs = (void __iomem *)CONFIG_FTTMR010_BASE;
+
+void udelay_masked(unsigned long usec)
+{
+   ulong freq = gd->arch.timer_rate_hz;
+
+   /* Disable Timer2 */
+   clrbits_le32(®s->cr, FTTMR010_TM2_CRMASK);
+   /* Disable Timer2 interrupts */
+   writel(FTTMR010_TM2_ISRMASK, ®s->interrupt_mask);
+   /* Clear Timer2 interrupts */
+   writel(FTTMR010_TM2_ISRMASK, ®s->interrupt_state);
+
+   /* Configure Timer2 */
+   writel((freq / 100) * usec, ®s->timer2_counter);
+   writel(0, ®s->timer2_load);
+   writel(0, ®s->timer2_match1);
+   writel(0, ®s->timer2_match2);
+
+   /* Enable Timer2 */
+   setbits_le32(®s->cr,
+   FTTMR010_TM2_OFENABLE | FTTMR010_TM2_ENABLE);
+
+   /* Wait until timeout */
+   while (!(readl(®s->interrupt_state) & FTTMR010_TM2_ISRMASK))
+   ;
+}
+
+void reset_timer_masked(void)
+{
+   ulong freq = gd->arch.timer_rate_hz;
+
+   /* Disable Timer1 */
+   clrbits_le32(®s->cr, FTTMR010_TM1_CRMASK);
+
+   /* Disable & Clear Timer1 interrupts */
+   writel(FTTMR010_TM1_ISRMASK, ®s->interrupt_mask);
+   writel(FTTMR010_TM1_ISRMASK, ®s->interrupt_state);
+
+   /* Setup a longest periodic timer */
+   writel((0x / freq) * freq, ®s->timer1_counter);
+   writel((0x / freq) * freq, ®s->timer1_load);
+
+   writel(0, ®s->timer1_match1);
+   writel(0, ®s->timer1_match2);
+
+   /* Disable match interrupts */
+   writel(FTTMR010_TM1_MATCH1 | FTTMR010_TM1_MATCH2,
+   ®s->interrupt_mask);
+
+   /* Enable Timer1 with overflow interrupt */
+   setbits_le32(®s->cr,
+   FTTMR010_TM1_OFENABLE | FTTMR010_TM1_ENABLE);
+}
+
+ulong get_timer_masked(void)
+{
+   ulong freq = gd->arch.timer_rate_hz;
+   ulong secs = 0x / freq;
+   ulong ms = freq / CONFIG_SYS_HZ;
+
+   if (readl(®s->interrupt_state) & FTTMR010_TM1_ISRMASK) {
+   writel(FTTMR010_TM1_ISRMASK, ®s->interrupt_state);
+   gd->arch.tbl += secs * CONFIG_SYS_HZ;
+   }
+
+   return gd->arch.tbl
+   + ((secs * freq) - readl(®s->timer1_counter)) / ms;
+}
+
+int timer_init(void)
+{
+   gd->arch.tbl = 0;
+   reset_timer_masked();
+   return 0;
+}
+
+void reset_timer(void)
+{
+   reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+   return get_timer_masked() - base;
+}
+
+void __udelay(unsigned long usec)
+{
+   

[U-Boot] [PATCH v5 04/14] video: add Faraday FTLCDC200 LCD controller support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Faraday FTLCDC200 Color LCD controller performs translation of
pixel-coded data into the required formats and timings to
drive a variety of single/dual mono and color LCDs.

Depending on the LCD type and mode, the unpacked data can represent:
   1. an actual true display gray or color value
   2. an address to a 256 x 16 bit wide palette RAM gray or color value.

The FTLCDC200 generates 4 individual interrupts for:
   1. DMA FIFO underflow
   2. base address update
   3. vertical status
   4. bus error.

There is also a single combined interrupt that is raised when any of
the individual interrupts become active.

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
CC: Anatolij Gustschin 
---
Changes for v5:
   - Coding Style cleanup:
 struct chip_regs __iomem *regs -> struct chip_regs *regs
   - Chain it back to Faraday A360/A369 patch series, because
 Faraday A369 depends on the header file of this patch
 for I2C work-around.(Enable I2C clock to prevent I2C bus hangs)

Changes for v4:
   - Nothing updates

Changes for v3:
   - Nothing updates

Changes for v2:
   - Make it a separate patch, rather then a part of
 Faraday A36x patch series

 drivers/video/Makefile  |1 +
 drivers/video/ftlcdc200.c   |  148 ++
 drivers/video/ftlcdc200_panel.c |  221 +++
 include/faraday/ftlcdc200.h |  179 +++
 include/lcd.h   |   33 ++
 5 files changed, 582 insertions(+)
 create mode 100644 drivers/video/ftlcdc200.c
 create mode 100644 drivers/video/ftlcdc200_panel.c
 create mode 100644 include/faraday/ftlcdc200.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 68ff34b..92ab9d1 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o 
exynos_mipi_dsi_common.o \
exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+COBJS-$(CONFIG_FTLCDC200) += ftlcdc200.o ftlcdc200_panel.o
 COBJS-$(CONFIG_MPC8XX_LCD) += mpc8xx_lcd.o
 COBJS-$(CONFIG_PXA_LCD) += pxa_lcd.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
diff --git a/drivers/video/ftlcdc200.c b/drivers/video/ftlcdc200.c
new file mode 100644
index 000..331a35f
--- /dev/null
+++ b/drivers/video/ftlcdc200.c
@@ -0,0 +1,148 @@
+/*
+ * Faraday LCD Controller
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+#include 
+
+#ifndef CONFIG_FTLCDC200_FREQ
+#define CONFIG_FTLCDC200_FREQ  clock_get_rate(AHB_CLK)
+#endif
+
+static struct ftlcdc200_regs *regs = (void __iomem *)CONFIG_FTLCDC200_BASE;
+
+static void ftlcdc2xx_fixup(struct vidinfo *panel)
+{
+   u_long ht, vt;
+   u_long div, clk;
+   long fps = 60;
+   long upper = 32767;
+   long lower = -32767;
+
+   if (panel->vl_fps)
+   return;
+
+   /* If it's serial mode */
+   if (panel->vl_serial & SPPR_SERIAL)
+   clk = CONFIG_FTLCDC200_FREQ / 3;
+   else
+   clk = CONFIG_FTLCDC200_FREQ;
+
+   /* Derive clock divisor */
+   ht = panel->vl_col + panel->vl_hbp + panel->vl_hfp + panel->vl_hsw;
+   vt = panel->vl_row + panel->vl_vbp + panel->vl_vfp + panel->vl_vsw;
+   for (div = 1; div <= 0x7f; ++div) {
+   long tmp = (clk / div / ht / vt);
+   if (fps > tmp) {
+   lower = tmp;
+   break;
+   }
+   upper = tmp;
+   }
+   if ((upper - fps) > (fps - lower))
+   div += 1;
+   div = (div > 1) ? (div - 1) : div;
+
+   /* Update hardware register cache */
+   panel->vl_polarity = (panel->vl_polarity & (~0x7f00))
+   | ((div - 1) << 8);
+
+   /* Derive real frame rate */
+   panel->vl_fps = (u_long)(clk / div / ht / vt);
+
+   debug("ftlcdc200: %s\n", panel->vl_name);
+   debug("ftlcdc200: fps=%u (%u < FPS < %u)\n",
+  (unsigned int)panel->vl_fps,
+  (unsigned int)lower,
+  (unsigned int)upper);
+   debug("ftlcdc200: div=%u (ahb=%u MHz)\n",

[U-Boot] [PATCH v5 06/14] cfi_flash: use buffer length in unmap_physmem()

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

While the flash_detect_legacy() of drivers/mtd/cfi_flash.c
feed unmap_physmem() with MAP_NOCACHE as 2nd parameter,
the do_spi_flash_read_write() of common/cmd_sf.c
feed unmap_physmem() with the length of the mapped buffer
as 2nd parameter.

It's apparently a bug, and I personally think the 2nd parameter
should be the length of the mapped buffer.

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
CC: Stefan Roese 
---
Changes for v5:
   - Initial commit, which is separated from
 "arm: add MMU/D-Cache support for Faraday cores"

 drivers/mtd/cfi_flash.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 25f8752..0d7a5ac 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1820,7 +1820,7 @@ static int flash_detect_legacy(phys_addr_t base, int 
banknum)
break;
else
unmap_physmem((void *)info->start[0],
- MAP_NOCACHE);
+ info->portwidth);
}
}

--
1.7.9.5

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


[U-Boot] [PATCH v5 08/14] arm: add Faraday processor core support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

This adds i/d-cache control, mmu setup & bootstrap code
for Faraday cores.

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Initial commit which is separated from
 "arm: add Faraday common utilities"

 arch/arm/cpu/faraday/Makefile  |   55 +
 arch/arm/cpu/faraday/config.mk |   33 +++
 arch/arm/cpu/faraday/cpu.c |  346 
 arch/arm/cpu/faraday/start.S   |  431 
 4 files changed, 865 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/Makefile
 create mode 100644 arch/arm/cpu/faraday/config.mk
 create mode 100644 arch/arm/cpu/faraday/cpu.c
 create mode 100644 arch/arm/cpu/faraday/start.S

diff --git a/arch/arm/cpu/faraday/Makefile b/arch/arm/cpu/faraday/Makefile
new file mode 100644
index 000..ecb240a
--- /dev/null
+++ b/arch/arm/cpu/faraday/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# 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$(CPU).o
+
+src-y  := cpu.o
+
+START  = start.o
+COBJS  = $(src-y)
+
+ifdef  CONFIG_SPL_BUILD
+ifdef  CONFIG_SPL_NO_CPU_SUPPORT_CODE
+START  :=
+endif
+endif
+
+SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
+START  := $(addprefix $(obj),$(START))
+
+all:   $(obj).depend $(START) $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/faraday/config.mk b/arch/arm/cpu/faraday/config.mk
new file mode 100644
index 000..f03030a
--- /dev/null
+++ b/arch/arm/cpu/faraday/config.mk
@@ -0,0 +1,33 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, 
+#
+# 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
+#
+
+PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =
+#
+# Supply options according to compiler version
+#
+# =
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call 
cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
diff --git a/arch/arm/cpu/faraday/cpu.c b/arch/arm/cpu/faraday/cpu.c
new file mode 100644
index 000..570b8b2
--- /dev/null
+++ b/arch/arm/cpu/faraday/cpu.c
@@ -0,0 +1,346 @@
+/*
+ * arch/arm/cpu/faraday/cpu.c
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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  

[U-Boot] [PATCH v5 09/14] arm: add Faraday FTINTC020 interrupt controller support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Coding Style cleanup.
   - Now the irq is always enabled inside irq_install_handler().

Changes for v4:
   - Coding Style cleanup.
   - Break up from [arm: add Faraday A36x SoC platform support]

Changes for v3:
   - Coding Style cleanup.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Add '__iomem' to all the declaration of HW register pointers.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().

 arch/arm/cpu/faraday/Makefile|1 +
 arch/arm/cpu/faraday/ftintc020.c |  156 ++
 include/common.h |3 +
 include/faraday/ftintc020.h  |   37 +
 4 files changed, 197 insertions(+)
 create mode 100644 arch/arm/cpu/faraday/ftintc020.c
 create mode 100644 include/faraday/ftintc020.h

diff --git a/arch/arm/cpu/faraday/Makefile b/arch/arm/cpu/faraday/Makefile
index ecb240a..35926c2 100644
--- a/arch/arm/cpu/faraday/Makefile
+++ b/arch/arm/cpu/faraday/Makefile
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(CPU).o

 src-y  := cpu.o
+src-$(CONFIG_FTINTC020)   += ftintc020.o

 START  = start.o
 COBJS  = $(src-y)
diff --git a/arch/arm/cpu/faraday/ftintc020.c b/arch/arm/cpu/faraday/ftintc020.c
new file mode 100644
index 000..542f616
--- /dev/null
+++ b/arch/arm/cpu/faraday/ftintc020.c
@@ -0,0 +1,156 @@
+/*
+ * arch/arm/cpu/faraday/ftintc020.c
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+
+static struct ftintc020_regs *regs = (void __iomem *)CONFIG_FTINTC020_BASE;
+
+static struct {
+   void  *data;
+   void (*func)(void *data);
+} irq_hndl[64];
+
+static inline void irq_acknowledge(int irq)
+{
+   uint32_t mask = BIT_MASK(irq);
+
+   if (irq < 32)
+   writel(mask, ®s->irq32.scr);
+   else
+   writel(mask, ®s->irq64.scr);
+}
+
+void irq_enable(int irq)
+{
+   uint32_t mask = BIT_MASK(irq);
+
+   if (irq < 32)
+   setbits_le32(®s->irq32.ena, mask);
+   else
+   setbits_le32(®s->irq64.ena, mask);
+}
+
+void irq_disable(int irq)
+{
+   uint32_t mask = BIT_MASK(irq);
+
+   if (irq < 32)
+   clrbits_le32(®s->irq32.ena, mask);
+   else
+   clrbits_le32(®s->irq64.ena, mask);
+}
+
+void irq_set_trigger(int irq, int edge, int low)
+{
+   uint32_t mask = BIT_MASK(irq);
+
+   if (edge) {
+   if (irq < 32)
+   setbits_le32(®s->irq32.tmr, mask);
+   else
+   setbits_le32(®s->irq64.tmr, mask);
+   } else {
+   if (irq < 32)
+   clrbits_le32(®s->irq32.tmr, mask);
+   else
+   clrbits_le32(®s->irq64.tmr, mask);
+   }
+
+   if (low) {
+   if (irq < 32)
+   setbits_le32(®s->irq32.tlr, mask);
+   else
+   setbits_le32(®s->irq64.tlr, mask);
+   } else {
+   if (irq < 32)
+   clrbits_le32(®s->irq32.tlr, mask);
+   else
+   clrbits_le32(®s->irq64.tlr, mask);
+   }
+}
+
+void do_irq(struct pt_regs *pt_regs)
+{
+   int irq;
+   uint32_t stat;
+
+   irq  = 32;
+   stat = readl(®s->irq64.sr); /* IRQ 32 ~ 63 */
+   if (!stat) {
+   irq  = 0;
+   stat = readl(®s->irq32.sr); /* IRQ  0 ~ 31 */
+   }
+   irq += ffs(stat) - 1;
+
+   if (irq < 0) {
+   printf("interrupts: no irq!?\n");
+   return;
+   }
+
+   if (irq_hndl[irq].func)
+   irq_hndl[irq].func(irq_hndl[irq].data);
+   else
+   printf("Unhandled IRQ = %d\n", irq);
+
+   irq_acknowledge(irq);
+}
+
+void irq_install_handler(int irq, interrupt_handler_t *hndl, void *data)
+{
+   if (irq >= 0 && irq < 64) {
+   irq_hndl[irq].func = hndl;
+   irq_hndl

[U-Boot] [PATCH v5 05/14] nand: add Faraday FTNANDC021 NAND controller support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Faraday FTNANDC021 is a integrated NAND flash controller.
It use a build-in command table to abstract the underlying
NAND flash control logic.

For example:

Issuing a command 0x10 to FTNANDC021 would result in
a page write + a read status operation.

Signed-off-by: Kuo-Jung Su 
CC: Albert ARIBAUD 
CC: Scott Wood 
---
Changes for v5 (Part of A360/A369 patch series):
   - Coding Style cleanup:
 struct chip_regs __iomem *regs -> struct chip_regs *regs
   - For there is a strong dependancy between this and A360/A369 patch
 series, it had been chained back to A360/A369 patch series.
   - The latest nand_base requires the ecc.strength to be set properlly,
 so this patch adds ecc.strength setting accroding to ECC algorithm.

Changes for v5 (Standalone):
   - Update README for the description of CONFIG_SYS_FTNANDC021_TIMING.
   - Drop redundant white space. (i.e. if (mtd->writesize >= ' '4096))

Changes for v4:
   - Make it a separate patch, rather then a part of
 Faraday A36x patch series
   - Drop the faraday/nand.h to remove dependency to
 Faraday A36x patch series.
   - CONFIG_SYS_NAND_TIMING -> CONFIG_SYS_FTNANDC021_TIMING
   - Remove non-ECC code.
   - Implement private hwecc read/write_page functions
 to get rid of .eccpos & .eccbytes.
   - Use macro constants for timeout control

Changes for v3:
   - Coding Style cleanup.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Replace all the infinite wait loop with a timeout.
   - Add '__iomem' to all the declaration of HW register pointers.
   - Re-write this driver with ECC enabled and correct column address
 handling for OOB read/write,
   - Fix issuses addressed by Scott.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().

 README|6 +
 drivers/mtd/nand/Makefile |1 +
 drivers/mtd/nand/ftnandc021.c |  622 +
 include/faraday/ftnandc021.h  |  153 ++
 4 files changed, 782 insertions(+)
 create mode 100644 drivers/mtd/nand/ftnandc021.c
 create mode 100644 include/faraday/ftnandc021.h

diff --git a/README b/README
index ac1ec44..3dbb7cc 100644
--- a/README
+++ b/README
@@ -3930,6 +3930,12 @@ Low Level (hardware related) configuration options:
- drivers/mtd/nand/ndfc.c
- drivers/mtd/nand/mxc_nand.c

+- CONFIG_SYS_FTNANDC021_TIMING
+   This option specifies an array of customized timing parameters
+   for Faraday FTNANDC021 NAND flash controller.
+   e.g.
+   #define CONFIG_SYS_FTNANDC021_TIMING { 0x02240264, 0x42054209 }
+
 - CONFIG_SYS_NDFC_EBC0_CFG
Sets the EBC0_CFG register for the NDFC. If not defined
a default value will be used.
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 8821704..f2c8b1a 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -64,6 +64,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o
+COBJS-$(CONFIG_NAND_FTNANDC021) += ftnandc021.o
 COBJS-$(CONFIG_NAND_JZ4740) += jz4740_nand.o
 COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
diff --git a/drivers/mtd/nand/ftnandc021.c b/drivers/mtd/nand/ftnandc021.c
new file mode 100644
index 000..b189909
--- /dev/null
+++ b/drivers/mtd/nand/ftnandc021.c
@@ -0,0 +1,622 @@
+/*
+ * Faraday NAND Flash Controller
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+#include 
+#include 
+#include 
+
+#include 
+
+#define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 2) /* 250 ms */
+#define CFG_RST_TIMEOUT CONFIG_SYS_HZ /* 1 sec reset timeout */
+#define CFG_PIO_TIMEOUT (CONFIG_SYS_HZ >> 3) /* 125 ms */
+
+struct ftnandc021_chip {
+   void __iomem *regs;
+   int alen;
+   int pgsz;
+   int bksz;
+
+   int col;/* current

[U-Boot] [PATCH v5 07/14] arm: add MMU/D-Cache support for Faraday cores

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

This updates the map_physmem()/unmap_physmem(), and use
them to implement dma_alloc_coherent() & dma_free_coherent().

It uses 1MB section for each mapping, and thus wastes lots of
address space, however this should still be good enough for
tiny systems (i.e. u-boot).

Signed-off-by: Kuo-Jung Su 
CC: Albert Aribaud 
---
Changes for v5:
   - Add void dram_bank_mmu_setup() into 'arch/arm/cpu/faraday/cpu.c'
 to override the weak function in "cache-cp15.c".
   - Use small page (4KB) to map relocated exception table to 0x

Changes for v4:
   - Coding Style cleanup.

Changes for v3:
   - Coding Style cleanup.
   - Always insert a blank line between declarations and code.
   - dma-mapping.h: Have the global data ptr declared outside functions.
   - dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
   - Drop static non-cached region, now we use map_physmem()/unmap_physmem()
 for dynamic mappings.

Changes for v2:
   - Coding Style cleanup.
   - cache-cp15: Enable write buffer in write-through mode.

 arch/arm/include/asm/dma-mapping.h |   59 -
 arch/arm/include/asm/global_data.h |4 +
 arch/arm/include/asm/io.h  |  160 ++--
 arch/arm/include/asm/system.h  |7 +-
 arch/arm/lib/cache-cp15.c  |   12 +++
 5 files changed, 230 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h 
b/arch/arm/include/asm/dma-mapping.h
index a11178f..5a13af5 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -3,6 +3,9 @@
  * Stelian Pop 
  * Lead Tech Design 
  *
+ * (C) Copyright 2010
+ * Dante Su 
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -24,22 +27,76 @@
 #ifndef __ASM_ARM_DMA_MAPPING_H
 #define __ASM_ARM_DMA_MAPPING_H

+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+
 enum dma_data_direction {
DMA_BIDIRECTIONAL   = 0,
DMA_TO_DEVICE   = 1,
DMA_FROM_DEVICE = 2,
 };

-static void *dma_alloc_coherent(size_t len, unsigned long *handle)
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+   void *map, *va = memalign(ARCH_DMA_MINALIGN, len);
+
+   if (va && gd->arch.cpu_mmu) {
+   invalidate_dcache_range((ulong)va, (ulong)va + len);
+   map = map_physmem((phys_addr_t)va, len, MAP_NOCACHE);
+   if (!map)
+   free(va);
+   va = map;
+   }
+
+   if (handle)
+   *handle = virt_to_phys(va);
+
+   return va;
+#else  /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
return (void *)*handle;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
+}
+
+static inline void dma_free_coherent(void *vaddr, ulong len)
+{
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+   void *tmp = (void *)virt_to_phys(vaddr);
+   unmap_physmem(vaddr, len);
+   vaddr = tmp;
+#endif
+   free(vaddr);
 }

 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
   enum dma_data_direction dir)
 {
+#if defined(CONFIG_FARADAY) && !defined(CONFIG_SYS_DCACHE_OFF)
+   if (gd->arch.cpu_mmu) {
+   switch (dir) {
+   case DMA_BIDIRECTIONAL:
+   case DMA_TO_DEVICE:
+   flush_dcache_range((ulong)vaddr,
+   (ulong)vaddr + len);
+   break;
+
+   case DMA_FROM_DEVICE:
+   invalidate_dcache_range((ulong)vaddr,
+   (ulong)vaddr + len);
+   break;
+   }
+   }
+   return virt_to_phys((void *)vaddr);
+#else  /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
return (unsigned long)vaddr;
+#endif /* CONFIG_FARADAY && !CONFIG_SYS_DCACHE_OFF */
 }

 static inline void dma_unmap_single(volatile void *vaddr, size_t len,
diff --git a/arch/arm/include/asm/global_data.h 
b/arch/arm/include/asm/global_data.h
index 7611d0a..fc78c6a 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -42,6 +42,10 @@ struct arch_global_data {
unsigned long   pllb_rate_hz;
unsigned long   at91_pllb_usb_init;
 #endif
+#ifdef CONFIG_FARADAY
+   unsigned long   cpu_id;
+   unsigned long   cpu_mmu;/* has mmu */
+#endif
/* "static data" needed by most of timer.c on ARM platforms */
unsigned long timer_rate_hz;
unsigned long tbu;
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 1fbc531..37c737e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/a

[U-Boot] [PATCH v5 01/14] arm: dma_alloc_coherent: malloc() -> memalign()

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Even though the MMU/D-cache is off, some DMA engines still
expect strict address alignment.

For example, the incoming Faraday FTMAC110 & FTGMAC100 ethernet
controllers expect the tx/rx descriptors should always be aligned
to 16-bytes boundary.

Signed-off-by: Kuo-Jung Su 
CC: Albert ARIBAUD 
---
Changes for v5:
   - Initial commit, which is separated from
 "arm: add MMU/D-Cache support for Faraday cores"

 arch/arm/include/asm/dma-mapping.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/dma-mapping.h 
b/arch/arm/include/asm/dma-mapping.h
index 5bbb0a0..a11178f 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -32,7 +32,7 @@ enum dma_data_direction {

 static void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
-   *handle = (unsigned long)malloc(len);
+   *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
return (void *)*handle;
 }

--
1.7.9.5

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


[U-Boot] [PATCH v5 02/14] net: ftgmac100: add MMU/D-cache support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

1. Dynamically allocate the tx/rx descriptors
   through dma_alloc_coherent(), instead of
   allocating at compile/link time.

2. Do not block on ftgmac100_send(), the packet
   has been copied to a safe buffer. Although it's
   a little bit slower, but the tx performance is
   never critical.

3. No matter if MMU/D-cache is on or off, this patch
   always depends on previous patch:

   arm: dma_alloc_coherent: malloc() -> memalign().

   Because the FTGMAC100 expects the tx/rx descriptors
   are always be aligned to 16-bytes boundary.

Signed-off-by: Kuo-Jung Su 
CC: Albert ARIBAUD 
CC: Joe Hershberger 
CC: Tom Rini 
---
Changes for v5:
   - Chain it back to Faraday A360/A369 patch series, because this
 strongly depends on patch to dma_alloc_coherent() at the
 Faraday A360/A369 patch series.

Changes for v4:
   - Make it a separate patch, rather then a part of
 Faraday A36x patch series

Changes for v3:
   - Coding Style cleanup

Changes for v2:
   - Coding Style cleanup
   - Cleanup (Drop cosmetic patch)

 drivers/net/ftgmac100.c |   70 +--
 1 file changed, 49 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 69ba57d..2dbb328 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -27,11 +27,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include "ftgmac100.h"

 #define ETH_ZLEN   60
+#define CFG_XBUF_SIZE  1536

 /* RBSR - hw default init value is also 0x640 */
 #define RBSR_DEFAULT_VALUE 0x640
@@ -40,8 +42,10 @@
 #define PKTBUFSTX  4   /* must be power of 2 */

 struct ftgmac100_data {
-   struct ftgmac100_txdes txdes[PKTBUFSTX];
-   struct ftgmac100_rxdes rxdes[PKTBUFSRX];
+   ulong txdes_dma;
+   struct ftgmac100_txdes *txdes;
+   ulong rxdes_dma;
+   struct ftgmac100_rxdes *rxdes;
int tx_index;
int rx_index;
int phy_addr;
@@ -375,13 +379,34 @@ static int ftgmac100_init(struct eth_device *dev, bd_t 
*bd)
 {
struct ftgmac100 *ftgmac100 = (struct ftgmac100 *)dev->iobase;
struct ftgmac100_data *priv = dev->priv;
-   struct ftgmac100_txdes *txdes = priv->txdes;
-   struct ftgmac100_rxdes *rxdes = priv->rxdes;
+   struct ftgmac100_txdes *txdes;
+   struct ftgmac100_rxdes *rxdes;
unsigned int maccr;
+   void *buf;
int i;

debug("%s()\n", __func__);

+   if (!priv->txdes) {
+   txdes = dma_alloc_coherent(
+   sizeof(*txdes) * PKTBUFSTX, &priv->txdes_dma);
+   if (!txdes)
+   panic("ftgmac100: out of memory\n");
+   memset(txdes, 0, sizeof(*txdes) * PKTBUFSTX);
+   priv->txdes = txdes;
+   }
+   txdes = priv->txdes;
+
+   if (!priv->rxdes) {
+   rxdes = dma_alloc_coherent(
+   sizeof(*rxdes) * PKTBUFSRX, &priv->rxdes_dma);
+   if (!rxdes)
+   panic("ftgmac100: out of memory\n");
+   memset(rxdes, 0, sizeof(*rxdes) * PKTBUFSRX);
+   priv->rxdes = rxdes;
+   }
+   rxdes = priv->rxdes;
+
/* set the ethernet address */
ftgmac100_set_mac_from_env(dev);

@@ -397,21 +422,31 @@ static int ftgmac100_init(struct eth_device *dev, bd_t 
*bd)

for (i = 0; i < PKTBUFSTX; i++) {
/* TXBUF_BADR */
-   txdes[i].txdes3 = 0;
+   if (!txdes[i].txdes2) {
+   buf = memalign(ARCH_DMA_MINALIGN, CFG_XBUF_SIZE);
+   if (!buf)
+   panic("ftgmac100: out of memory\n");
+   txdes[i].txdes3 = virt_to_phys(buf);
+   txdes[i].txdes2 = (uint)buf;
+   }
txdes[i].txdes1 = 0;
}

for (i = 0; i < PKTBUFSRX; i++) {
/* RXBUF_BADR */
-   rxdes[i].rxdes3 = (unsigned int)NetRxPackets[i];
+   if (!rxdes[i].rxdes2) {
+   buf = NetRxPackets[i];
+   rxdes[i].rxdes3 = virt_to_phys(buf);
+   rxdes[i].rxdes2 = (uint)buf;
+   }
rxdes[i].rxdes0 &= ~FTGMAC100_RXDES0_RXPKT_RDY;
}

/* transmit ring */
-   writel((unsigned int)txdes, &ftgmac100->txr_badr);
+   writel(priv->txdes_dma, &ftgmac100->txr_badr);

/* receive ring */
-   writel((unsigned int)rxdes, &ftgmac100->rxr_badr);
+   writel(priv->rxdes_dma, &ftgmac100->rxr_badr);

/* poll receive descriptor automatically */
writel(FTGMAC100_APTC_RXPOLL_CNT(1), &ftgmac100->aptc);
@@ -466,8 +501,11 @@ static int ftgmac100_recv(struct eth_device *dev)
debug("%s(): RX buffer %d, %x received\n",
   __func__, priv->rx_index, rxlen);

+   /* invalidate d-cache */
+   dma_map_single((void *)curr_des->rxdes2, rxlen, DMA_FROM_DEVICE)

[U-Boot] [PATCH v5 03/14] net: add Faraday FTMAC110 10/100Mbps ethernet support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

Faraday FTMAC110 10/100Mbps supports half-word data transfer for Linux.
However it has a weird DMA alignment issue:

(1) Tx DMA Buffer Address:
1 bytes aligned: Invalid
2 bytes aligned: O.K
4 bytes aligned: O.K

(2) Rx DMA Buffer Address:
1 bytes aligned: Invalid
2 bytes aligned: O.K
4 bytes aligned: Invalid!!!

NOTE:
No matter if MMU/D-cache is on or off, this patch
always depends on previous patch:

arm: dma_alloc_coherent: malloc() -> memalign().

Because the FTMAC110 expects the tx/rx descriptors
are always be aligned to 16-bytes boundary.

Signed-off-by: Kuo-Jung Su 
CC: Albert ARIBAUD 
CC: Joe Hershberger 
CC: Tom Rini 
---
Changes for v5:
   - Coding Style cleanup:
 struct chip_regs __iomem *regs -> struct chip_regs *regs
   - Chain it back to Faraday A360/A369 patch series, because this
 strongly depends on patch to dma_alloc_coherent() at the
 Faraday A360/A369 patch series.

Changes for v4:
   - Make it a separate patch, rather then a part of
 Faraday A36x patch series
   - Use macro constants for timeout control
   - Use only named constants for bit mask/shift and values
   - Drop the magic number from mdio read/write.

Changes for v3:
   - Coding Style cleanup.
   - Drop bit fields from c struct.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Replace all the infinite wait loop with a timeout.
   - Add '__iomem' to all the declaration of HW register pointers.
   - Make a correction to multi-line comment style
   - Use random MAC address while having trouble
 to get one from environment variables.
   - Add comments to timing control registers.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().
   - ftmac110: Remove debug codes.

 drivers/net/Makefile   |1 +
 drivers/net/ftmac110.c |  484 
 drivers/net/ftmac110.h |  188 +++
 include/netdev.h   |1 +
 4 files changed, 674 insertions(+)
 create mode 100644 drivers/net/ftmac110.c
 create mode 100644 drivers/net/ftmac110.h

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 786a656..0e23817 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -46,6 +46,7 @@ COBJS-$(CONFIG_ETHOC) += ethoc.o
 COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_FTGMAC100) += ftgmac100.o
+COBJS-$(CONFIG_FTMAC110) += ftmac110.o
 COBJS-$(CONFIG_FTMAC100) += ftmac100.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
new file mode 100644
index 000..1afd95a
--- /dev/null
+++ b/drivers/net/ftmac110.c
@@ -0,0 +1,484 @@
+/*
+ * Faraday 10/100Mbps Ethernet Controller
+ *
+ * (C) Copyright 2013 Faraday Technology
+ * Dante Su 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+#include 
+#endif
+
+#include "ftmac110.h"
+
+#define CFG_RXDES_NUM   8
+#define CFG_TXDES_NUM   2
+#define CFG_XBUF_SIZE   1536
+
+#define CFG_MDIORD_TIMEOUT  (CONFIG_SYS_HZ >> 1) /* 500 ms */
+#define CFG_MDIOWR_TIMEOUT  (CONFIG_SYS_HZ >> 1) /* 500 ms */
+#define CFG_LINKUP_TIMEOUT  (CONFIG_SYS_HZ << 2) /* 4 sec */
+
+/*
+ * FTMAC110 DMA design issue
+ *
+ * Its DMA engine has a weird restriction that its Rx DMA engine
+ * accepts only 16-bits aligned address, 32-bits aligned is not
+ * acceptable. However this restriction does not apply to Tx DMA.
+ *
+ * Conclusion:
+ * (1) Tx DMA Buffer Address:
+ * 1 bytes aligned: Invalid
+ * 2 bytes aligned: O.K
+ * 4 bytes aligned: O.K (-> u-boot ZeroCopy is possible)
+ * (2) Rx DMA Buffer Address:
+ * 1 bytes aligned: Invalid
+ * 2 bytes aligned: O.K
+ * 4 bytes aligned: Invalid
+ */
+
+struct ftmac110_chip {
+   void __iomem *regs;
+   uint32_t imr;
+   uint32_t maccr;
+   uint32_t lnkup;
+   uint32_t phy_addr;
+
+   struct ftmac110_rxd *rxd;
+   ulon

[U-Boot] [PATCH v5 00/14] arm: add Faraday A36x SoC platform support

2013-06-17 Thread Kuo-Jung Su
From: Kuo-Jung Su 

These patches introduce Faraday A36x SoC platform support.

Here are some public documents for your reference.

   http://www.faraday-tech.com/html/documentation/index.html

There is also a A369 QEMU emulator available at my github account:

   https://github.com/dantesu1218/qemu.git

Here is quick start for QEMU + U-Boot:

1. Download the QEMU source tree

   $ git clone -b qemu-1.4.0 https://github.com/dantesu1218/qemu.git

2. Build & Install the QEMU:

   $ ./configure --target-list=arm-softmmu
   $ make
   $ make install

3. Launch u-boot with QEMU:

   $ qemu-system-arm -M a369 -m 512M -nographic -kernel ~/u-boot-2013.04/u-boot

Changes for v5:
   - Coding Style cleanup:
 1. struct chip_regs __iomem *regs -> struct chip_regs *regs
 2. Move Faraday specific APIs into asm/arch-faraday/*.h
   - Fix Copyright notices (dates) throughout the patch
   - Make 'arm: dma_alloc_coherent: malloc() -> memalign()' as a separate patch
   - Make 'cfi_flash: use buffer length in unmap_physmem()' as a separate patch
   - Define Faraday machine type in board's config header file
   - Add the rationale to the command 'bootfa'
   - Add myself as the maintainer for Faraday A360/A369 in MAINTAINERS.
   - Chain the video:FTLCDC200 back to this patch series.
   - Chain the nand:FTNANDC021 back to this patch series.
   - Chain the net:FTGMAC100 & FTMAC110 back to this patch series.
   - Update Faraday Firmware Image Format:
 1. Drop u-boot image support to simplify the design.
Since it's not possible for the hard-wired ROM code of A360/A369
to support U-boot images. And the real bootloader for A360/A369
is actually Faraday bootcode2, rather than U-Boot.
 2. Add image creation timestamp
   - Update 'arch/arm/cpu/faraday/start.S' with the new design, which move
 relocation into 'arch/arm/lib/relocate.S'
   - Drop i2c:FTI2C010 & spi:FTSSP010_SPI support. The corresponding patch
 would restart after this patch series have been accepted.
   - Revise IRQ & MMU design: Now the exception table would be mapped to
 0x as a small page(4KB), rather than runtime adjust after
 relocation finished.
   - Revise irq:FTINTC020 design, now the irq is always enabled inside
 irq_install_handler().
   - Revise clock management system
   - Revise FTPWMTMR010 & FTTMR010 timer design:
 1. Drop IRQ dependant implementation
 2. Use gd->arch.timer_rate_hz for timer clock source
 3. Use gd->arch.tbl for timestamp

Changes for v4:
   - Coding Style cleanup.
   - Break down the patch series:
   - Patches without hard dependency to this series are now
 seperate patches.
   - Split up the patch into more logical changesets
 (i.e. interrupt & timers are now split up)
   - Drop the faraday/nand.h to remove dependency to ftnandc021
   - Drop the faraday/mmc.h to remove dependency to ftsdc010
   - Add change logs to each part of the patch series to make
 patchwork be able to grab comments.

Changes for v3:
   - Coding Style cleanup.
 There is still one warnning reported by checkpatch.pl,
 however it's too deep for me to fix it.
 Here is the shapshot for it:
 -
 WARNING: do not add new typedefs
 #9735: FILE: include/lcd.h:258:
 +typedef struct vidinfo {
 -
   - Drop bit fields from c struct.
   - Drop macros for wirtel()/readl(), call them directly.
   - Always insert a blank line between declarations and code.
   - Replace all the infinite wait loop with a timeout.
   - Add '__iomem' to all the declaration of HW register pointers.
   - cmd_boot.c: Make it a separate stand-alone patch.
   - ftspi020: Make it a separate stand-alone patch.
   - dma-mapping.h: Have the global data ptr declared outside functions.
   - dma-mapping.h: Add #if...#else...#endif to dma_free_coherent().
   - MMU/D-Cache: Drop static non-cached region, now we use
 map_physmem()/unmap_physmem() for dynamic mappings.
   - ftmac110: Make a correction to multi-line comment style
   - ftmac110: Use random MAC address while having trouble
 to get one from environment variables.
   - ftmac110: Add comments to timing control registers.
   - ftnandc021: Re-write this driver with ECC enabled and
 correct column address handling for OOB read/write,
 and fixing issused addressed by Scott.
   - a36x_config: No more static global network configurations.
   - a36x_config: Add a common file for the redundant configurations.

Changes for v2:
   - Coding Style cleanup.
   - Use readl(), writel(), clrsetbits_le32() to replace REG() macros.
   - Use structure based hardware registers to replace the macro constants.
   - Replace BIT() with BIT_MASK().
   - echi-faraday: Remove debug codes.
   - ftmac110: Remove debug codes.
   - cache-cp15: Enable write buffer in write-through mode.

Kuo-Jung Su (14):
  arm: dma_alloc_coherent: malloc() 

[U-Boot] [PATCH] board/bsc913x: Add config flag for bootdelay

2013-06-17 Thread Harninder Rai
Keep the value of CONFIG_BOOTDELAY as -1 to disable autoboot

Signed-off-by: Harninder Rai 
---
 include/configs/BSC9131RDB.h |1 +
 include/configs/BSC9132QDS.h |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h
index fd076e0..c56b119 100644
--- a/include/configs/BSC9131RDB.h
+++ b/include/configs/BSC9131RDB.h
@@ -393,6 +393,7 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_UBOOTPATH   "u-boot.bin" /* U-Boot image on TFTP server */
 
 #define CONFIG_BAUDRATE115200
+#define CONFIG_BOOTDELAY   -1 /* Disable autoboot */
 
 #defineCONFIG_EXTRA_ENV_SETTINGS   \
"netdev=eth0\0" \
diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h
index 9d15d0e..d54900a 100644
--- a/include/configs/BSC9132QDS.h
+++ b/include/configs/BSC9132QDS.h
@@ -607,6 +607,7 @@ combinations. this should be removed later
 #define CONFIG_UBOOTPATH   "u-boot.bin"
 
 #define CONFIG_BAUDRATE115200
+#define CONFIG_BOOTDELAY   -1 /* Disable autoboot */
 
 #ifdef CONFIG_SDCARD
 #define CONFIG_DEF_HWCONFIG"hwconfig=usb1:dr_mode=host,phy_type=ulpi\0"
-- 
1.5.5.6


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


Re: [U-Boot] [PATCH 3/3] arm: omap3: Add SPL support to cm_t35

2013-06-17 Thread Igor Grinberg
Hi Stefan,

On 06/14/13 11:55, Stefan Roese wrote:
> Add SPL U-Boot support to replace x-loader on the Compulab cm_t35
> board. Currently only the 256MiB SDRAM board versions are supported.
> 
> Tested by booting via MMC and NAND.
> 
> Signed-off-by: Stefan Roese 
> Cc: Tom Rini 
> Cc: Igor Grinberg 
> ---
>  board/compulab/cm_t35/cm_t35.c | 18 +++-
>  include/configs/cm_t35.h   | 64 
> --
>  2 files changed, 79 insertions(+), 3 deletions(-)
> 
> diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
> index b0b80e5..cd7882e 100644
> --- a/board/compulab/cm_t35/cm_t35.c
> +++ b/board/compulab/cm_t35/cm_t35.c
> @@ -120,6 +120,22 @@ static inline int splash_load_from_nand(void)
>  }
>  #endif /* CONFIG_CMD_NAND */
>  
> +#ifdef CONFIG_SPL_BUILD
> +/*
> + * Routine: get_board_mem_timings
> + * Description: If we use SPL then there is no x-loader nor config header
> + * so we have to setup the DDR timings ourself on both banks.
> + */
> +void get_board_mem_timings(struct board_sdrc_timings *timings)
> +{
> + timings->mr = MICRON_V_MR_165;
> + timings->mcfg = MICRON_V_MCFG_165(256 << 20);
> + timings->ctrla = MICRON_V_ACTIMA_165;
> + timings->ctrlb = MICRON_V_ACTIMB_165;
> + timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
> +}
> +#endif

I still haven't checked the timings...
Hopefully, I will sometime during this week.

> +
>  int board_splash_screen_prepare(void)
>  {
>   char *env_splashimage_value;
> @@ -443,7 +459,7 @@ void set_muxconf_regs(void)
>   cm_t3730_set_muxconf();
>  }
>  
> -#ifdef CONFIG_GENERIC_MMC
> +#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
>  int board_mmc_getcd(struct mmc *mmc)
>  {
>   u8 val;
> diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
> index c6e357a..b76810d 100644
> --- a/include/configs/cm_t35.h
> +++ b/include/configs/cm_t35.h
> @@ -40,8 +40,6 @@
>  #define CONFIG_OMAP_GPIO
>  #define CONFIG_CM_T3X/* working with CM-T35 and CM-T3730 */
>  
> -#define CONFIG_SYS_TEXT_BASE 0x80008000
> -
>  #define CONFIG_SDRC  /* The chip has SDRC controller */
>  
>  #include /* get chip and board defs */
> @@ -341,4 +339,66 @@
>  #define CONFIG_BMP_16BPP
>  #define CONFIG_SPLASH_SCREEN_PREPARE
>  
> +/* Defines for SPL */
> +#define CONFIG_SPL
> +#define CONFIG_SPL_FRAMEWORK
> +#define CONFIG_SPL_NAND_SIMPLE
> +#define CONFIG_SPL_TEXT_BASE 0x40200800
> +#define CONFIG_SPL_MAX_SIZE  (54 * 1024) /* 8 KB for stack */
> +#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
> +
> +#define CONFIG_SPL_BSS_START_ADDR0x8000
> +#define CONFIG_SPL_BSS_MAX_SIZE  0x8 /* 512 KB */
> +
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR  0x300 /* address 
> 0x6 */
> +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS   0x200 /* 256 KB */
> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1
> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME "u-boot.img"
> +
> +#define CONFIG_SPL_BOARD_INIT
> +#define CONFIG_SPL_LIBCOMMON_SUPPORT
> +#define CONFIG_SPL_LIBDISK_SUPPORT
> +#define CONFIG_SPL_I2C_SUPPORT
> +#define CONFIG_SPL_LIBGENERIC_SUPPORT
> +#define CONFIG_SPL_MMC_SUPPORT
> +#define CONFIG_SPL_FAT_SUPPORT
> +#define CONFIG_SPL_SERIAL_SUPPORT
> +#define CONFIG_SPL_NAND_SUPPORT
> +#define CONFIG_SPL_NAND_BASE
> +#define CONFIG_SPL_NAND_DRIVERS
> +#define CONFIG_SPL_NAND_ECC
> +#define CONFIG_SPL_GPIO_SUPPORT
> +#define CONFIG_SPL_POWER_SUPPORT
> +#define CONFIG_SPL_OMAP3_ID_NAND
> +#define CONFIG_SPL_LDSCRIPT  "$(CPUDIR)/omap-common/u-boot-spl.lds"
> +
> +/* NAND boot config */
> +#define CONFIG_SYS_NAND_5_ADDR_CYCLE
> +#define CONFIG_SYS_NAND_PAGE_COUNT   64
> +#define CONFIG_SYS_NAND_PAGE_SIZE2048
> +#define CONFIG_SYS_NAND_OOBSIZE  64
> +#define CONFIG_SYS_NAND_BLOCK_SIZE   (128 * 1024)
> +#define CONFIG_SYS_NAND_BAD_BLOCK_POSNAND_LARGE_BADBLOCK_POS
> +/*
> + * Use the ECC/OOB layout from omap_gpmc.h that matches your chip:
> + * SP vs LP, 8bit vs 16bit: GPMC_NAND_HW_ECC_LAYOUT
> + */
> +#define CONFIG_SYS_NAND_ECCPOS   { 1, 2, 3, 4, 5, 6, 7, 8, 9, \
> +  10, 11, 12 }
> +#define CONFIG_SYS_NAND_ECCSIZE  512
> +#define CONFIG_SYS_NAND_ECCBYTES 3
> +
> +#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
> +#define CONFIG_SYS_NAND_U_BOOT_OFFS  0x8
> +
> +/*
> + * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
> + * 64 bytes before this address should be set aside for u-boot.img's
> + * header. That is 0x800FFFC0--0x8010 should not be used for any
> + * other needs.
> + */
> +#define CONFIG_SYS_TEXT_BASE 0x8010

Now this is a problem.
This breaks the backward compatibility with our X-Loader and we
cannot just switch to 8010...

> +#define CONFIG_SYS_SPL_MALLOC_START  0x80208000
> +#define CONFIG_SYS_SPL_MALLOC_SIZE   0x10
> +
>  #endif /* __

[U-Boot] [PATCH v2 4/5] mtd: atmel_nand: alloc memory instead of use static array for pmecc data

2013-06-17 Thread Josh Wu
In this way, the pmecc corraction capbility can change in run time.

Signed-off-by: Josh Wu 
---
v1 --> v2:
  replace printk with dev_err.
  fix coding style.
  free memory before return ENOMEM.

 drivers/mtd/nand/atmel_nand.c |   63 -
 1 file changed, 56 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 139a479..3cd403f 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -66,13 +67,13 @@ struct atmel_nand_host {
void __iomem*pmecc_index_of;
 
/* data for pmecc computation */
-   int16_t pmecc_smu[(CONFIG_PMECC_CAP + 2) * (2 * CONFIG_PMECC_CAP + 1)];
-   int16_t pmecc_partial_syn[2 * CONFIG_PMECC_CAP + 1];
-   int16_t pmecc_si[2 * CONFIG_PMECC_CAP + 1];
-   int16_t pmecc_lmu[CONFIG_PMECC_CAP + 1]; /* polynomal order */
-   int pmecc_mu[CONFIG_PMECC_CAP + 1];
-   int pmecc_dmu[CONFIG_PMECC_CAP + 1];
-   int pmecc_delta[CONFIG_PMECC_CAP + 1];
+   int16_t *pmecc_smu;
+   int16_t *pmecc_partial_syn;
+   int16_t *pmecc_si;
+   int16_t *pmecc_lmu; /* polynomal order */
+   int *pmecc_mu;
+   int *pmecc_dmu;
+   int *pmecc_delta;
 };
 
 static struct atmel_nand_host pmecc_host;
@@ -125,6 +126,48 @@ static void __iomem *pmecc_get_alpha_to(struct 
atmel_nand_host *host)
table_size * sizeof(int16_t);
 }
 
+static void pmecc_data_free(struct atmel_nand_host *host)
+{
+   free(host->pmecc_partial_syn);
+   free(host->pmecc_si);
+   free(host->pmecc_lmu);
+   free(host->pmecc_smu);
+   free(host->pmecc_mu);
+   free(host->pmecc_dmu);
+   free(host->pmecc_delta);
+}
+
+static int pmecc_data_alloc(struct atmel_nand_host *host)
+{
+   const int cap = host->pmecc_corr_cap;
+   int size;
+
+   size = (2 * cap + 1) * sizeof(int16_t);
+   host->pmecc_partial_syn = malloc(size);
+   host->pmecc_si = malloc(size);
+   host->pmecc_lmu = malloc((cap + 1) * sizeof(int16_t));
+   host->pmecc_smu = malloc((cap + 2) * size);
+
+   size = (cap + 1) * sizeof(int);
+   host->pmecc_mu = malloc(size);
+   host->pmecc_dmu = malloc(size);
+   host->pmecc_delta = malloc(size);
+
+   if (host->pmecc_partial_syn &&
+   host->pmecc_si &&
+   host->pmecc_lmu &&
+   host->pmecc_smu &&
+   host->pmecc_mu &&
+   host->pmecc_dmu &&
+   host->pmecc_delta)
+   return 0;
+
+   /* error happened */
+   pmecc_data_free(host);
+   return -ENOMEM;
+
+}
+
 static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector)
 {
struct nand_chip *nand_chip = mtd->priv;
@@ -710,6 +753,12 @@ static int atmel_pmecc_nand_init_params(struct nand_chip 
*nand,
return 0;
}
 
+   /* Allocate data for PMECC computation */
+   if (pmecc_data_alloc(host)) {
+   dev_err(NULL, "Cannot allocate memory for PMECC 
computation!\n");
+   return -ENOMEM;
+   }
+
nand->ecc.read_page = atmel_nand_pmecc_read_page;
nand->ecc.write_page = atmel_nand_pmecc_write_page;
nand->ecc.strength = cap;
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 5/5] ARM: at91: atmel_nand: add code to check the ONFI parameter ECC requirement

2013-06-17 Thread Josh Wu
1. if CONFIG_SYS_NAND_ONFI_DETECTION is defined, driver will check NAND flash's
   ecc minimum requirement in ONFI parameter.

  a) if CONFIG_PMECC_CAP, CONFIG_PMECC_SECTOR_SIZE are defined. then use it.
 Driver will display a WARNING if the values are different from ONFI
 parameters.

  b) if CONFIG_PMECC_CAP, CONFIG_PMECC_SECTOR_SIZE are not defined, then use
  the value from ONFI parameters.
  * If ONFI ECC parameters are in ONFI extended parameter page, since we
are not support it, so assume the minimum ecc requirement is 2 bits
in 512 bytes.
  * For non-ONFI support nand flash, also assume the minimum ecc
requirement is 2 bits in 512 bytes.

2. if CONFIG_SYS_NAND_ONFI_DETECTION is not defined, just use CONFIG_PMECC_CAP
   and CONFIG_PMECC_SECTOR_SIZE.

Signed-off-by: Josh Wu 
---
v1 --> v2:
  use dev_err/info to replace printk.
  fix typo mistake, that should use <= instead of use <.

 drivers/mtd/nand/atmel_nand.c |  129 -
 1 file changed, 127 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 3cd403f..ceba562 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -681,6 +681,98 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd)
pmecc_writel(host->pmecc, ctrl, PMECC_CTRL_ENABLE);
 }
 
+#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
+/*
+ * get_onfi_ecc_param - Get ECC requirement from ONFI parameters
+ * @ecc_bits: store the ONFI ECC correct bits capbility
+ * @sector_size: in how many bytes that ONFI require to correct @ecc_bits
+ *
+ * Returns -1 if ONFI parameters is not supported. In this case @ecc_bits,
+ * @sector_size are initialize to 0.
+ * Return 0 if success to get the ECC requirement.
+ */
+static int get_onfi_ecc_param(struct nand_chip *chip,
+   int *ecc_bits, int *sector_size)
+{
+   *ecc_bits = *sector_size = 0;
+
+   if (chip->onfi_params.ecc_bits == 0xff)
+   /* TODO: the sector_size and ecc_bits need to be find in
+* extended ecc parameter, currently we don't support it.
+*/
+   return -1;
+
+   *ecc_bits = chip->onfi_params.ecc_bits;
+
+   /* The default sector size (ecc codeword size) is 512 */
+   *sector_size = 512;
+
+   return 0;
+}
+
+/*
+ * pmecc_choose_ecc - Get ecc requirement from ONFI parameters. If
+ *pmecc_corr_cap or pmecc_sector_size is 0, then set it as
+ *ONFI ECC parameters.
+ * @host: point to an atmel_nand_host structure.
+ *if host->pmecc_corr_cap is 0 then set it as the ONFI ecc_bits.
+ *if host->pmecc_sector_size is 0 then set it as the ONFI sector_size.
+ * @chip: point to an nand_chip structure.
+ * @cap: store the ONFI ECC correct bits capbility
+ * @sector_size: in how many bytes that ONFI require to correct @ecc_bits
+ *
+ * Return 0 if success. otherwise return the error code.
+ */
+static int pmecc_choose_ecc(struct atmel_nand_host *host,
+   struct nand_chip *chip,
+   int *cap, int *sector_size)
+{
+   /* Get ECC requirement from ONFI parameters */
+   *cap = *sector_size = 0;
+   if (chip->onfi_version) {
+   if (!get_onfi_ecc_param(chip, cap, sector_size))
+   pr_debug("ONFI params, minimum required ECC: %d bits in 
%d bytes\n",
+   *cap, *sector_size);
+   else
+   dev_info(NULL, "NAND chip ECC reqirement is in Extended 
ONFI parameter, we don't support yet.\n");
+   } else {
+   dev_info(NULL, "NAND chip is not ONFI compliant, assume 
ecc_bits is 2 in 512 bytes");
+   }
+   if (*cap == 0 && *sector_size == 0) {
+   /* Non-ONFI compliant or use extended ONFI parameters */
+   *cap = 2;
+   *sector_size = 512;
+   }
+
+   /* If head file doesn't specify then use the one in ONFI parameters */
+   if (host->pmecc_corr_cap == 0) {
+   /* use the most fitable ecc bits (the near bigger one ) */
+   if (*cap <= 2)
+   host->pmecc_corr_cap = 2;
+   else if (*cap <= 4)
+   host->pmecc_corr_cap = 4;
+   else if (*cap <= 8)
+   host->pmecc_corr_cap = 8;
+   else if (*cap <= 12)
+   host->pmecc_corr_cap = 12;
+   else if (*cap <= 24)
+   host->pmecc_corr_cap = 24;
+   else
+   return -EINVAL;
+   }
+   if (host->pmecc_sector_size == 0) {
+   /* use the most fitable sector size (the near smaller one ) */
+   if (*sector_size >= 1024)
+   host->pmecc_sector_size = 1024;
+   else if (*sector_size >= 512)
+   host->pmecc_sector_size = 512;
+   else
+ 

[U-Boot] [PATCH v2 3/5] linux/compat.h: move dev_err, dev_info and dev_dbg from usb driver to compat.h

2013-06-17 Thread Josh Wu
Since kernel code current use many dev_xxx() instead of using printk. To
compatible, move those dev_xxx from usb driver to linux/compat.h. Then all
driver code can use dev_err, dev_info and dev_vdbg.

This patch also removed duplicated macro definitions in usb driver.

Signed-off-by: Josh Wu 
---
 drivers/usb/musb-new/linux-compat.h |   16 
 include/linux/compat.h  |8 
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/musb-new/linux-compat.h 
b/drivers/usb/musb-new/linux-compat.h
index 72c8c2b..d7a5663 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -39,15 +39,6 @@ typedef unsigned long dmaaddr_t;
 #define cpu_relax() do {} while (0)
 
 #define pr_debug(fmt, args...) debug(fmt, ##args)
-#define dev_dbg(dev, fmt, args...) \
-   debug(fmt, ##args)
-#define dev_vdbg(dev, fmt, args...)\
-   debug(fmt, ##args)
-#define dev_info(dev, fmt, args...)\
-   printf(fmt, ##args)
-#define dev_err(dev, fmt, args...) \
-   printf(fmt, ##args)
-#define printk printf
 
 #define WARN(condition, fmt, args...) ({   \
int ret_warn = !!condition; \
@@ -55,13 +46,6 @@ typedef unsigned long dmaaddr_t;
printf(fmt, ##args);\
ret_warn; })
 
-#define KERN_DEBUG
-#define KERN_NOTICE
-#define KERN_WARNING
-#define KERN_ERR
-
-#define kfree(ptr) free(ptr)
-
 #define pm_runtime_get_sync(dev) do {} while (0)
 #define pm_runtime_put(dev) do {} while (0)
 #define pm_runtime_put_sync(dev) do {} while (0)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e1338bf..3fdfb39 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -3,6 +3,14 @@
 
 #define ndelay(x)  udelay(1)
 
+#define dev_dbg(dev, fmt, args...) \
+   debug(fmt, ##args)
+#define dev_vdbg(dev, fmt, args...)\
+   debug(fmt, ##args)
+#define dev_info(dev, fmt, args...)\
+   printf(fmt, ##args)
+#define dev_err(dev, fmt, args...) \
+   printf(fmt, ##args)
 #define printk printf
 
 #define KERN_EMERG
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 1/5] ARM: at91: atmel_nand: pmecc driver will select the galois table by sector size

2013-06-17 Thread Josh Wu
Define the galois index table offset in chip head file. So user do not need
to set by himself. Driver will set it correctly according to sector_size.

Signed-off-by: Josh Wu 
---
 arch/arm/include/asm/arch-at91/at91sam9x5.h |6 ++
 doc/README.atmel_pmecc  |   14 --
 drivers/mtd/nand/atmel_nand.c   |5 -
 include/configs/at91sam9x5ek.h  |1 -
 include/configs/sama5d3xek.h|1 -
 5 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h 
b/arch/arm/include/asm/arch-at91/at91sam9x5.h
index 85e42f5..de9fa50 100644
--- a/arch/arm/include/asm/arch-at91/at91sam9x5.h
+++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h
@@ -165,6 +165,12 @@
 #define ATMEL_ID_UHP   ATMEL_ID_UHPHS
 
 /*
+ * PMECC table in ROM
+ */
+#define ATMEL_PMECC_INDEX_OFFSET_512   0x8000
+#define ATMEL_PMECC_INDEX_OFFSET_1024  0x1
+
+/*
  * at91sam9x5 specific prototypes
  */
 #ifndef __ASSEMBLY__
diff --git a/doc/README.atmel_pmecc b/doc/README.atmel_pmecc
index b483744..41f3bd7 100644
--- a/doc/README.atmel_pmecc
+++ b/doc/README.atmel_pmecc
@@ -19,17 +19,6 @@ To use PMECC in this driver, the user needs to set:
   It can be 2, 4, 8, 12 or 24.
2. The PMECC sector size: CONFIG_PMECC_SECTOR_SIZE.
   It only can be 512 or 1024.
-   3. The PMECC index lookup table's offsets in ROM code: 
CONFIG_PMECC_INDEX_TABLE_OFFSET.
-  In the chip datasheet section "Boot Stragegies", you can find
-  two Galois Field Table in the ROM code. One table is for 512-bytes
-  sector. Another is for 1024-byte sector. Each Galois Field includes
-  two sub-table: indext table & alpha table.
-  In the beginning of each Galois Field Table is the index table,
-  Alpha table is in the following.
-  So the index table's offset is same as the Galois Field Table.
-
-  Please set CONFIG_PMECC_INDEX_TABLE_OFFSET correctly according the
-  Galois Field Table's offset base on the sector size you used.
 
 Take AT91SAM9X5EK as an example, the board definition file likes:
 
@@ -38,7 +27,4 @@ Take AT91SAM9X5EK as an example, the board definition file 
likes:
 #define CONFIG_ATMEL_NAND_HW_PMECC 1
 #define CONFIG_PMECC_CAP   2
 #define CONFIG_PMECC_SECTOR_SIZE   512
-#define CONFIG_PMECC_INDEX_TABLE_OFFSET0x8000
 
-NOTE: If you use 1024 as the sector size, then need set 0x1 as the
- CONFIG_PMECC_INDEX_TABLE_OFFSET
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 3bfbaf8..139a479 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -653,7 +653,10 @@ static int atmel_pmecc_nand_init_params(struct nand_chip 
*nand,
 
cap = host->pmecc_corr_cap = CONFIG_PMECC_CAP;
sector_size = host->pmecc_sector_size = CONFIG_PMECC_SECTOR_SIZE;
-   host->pmecc_index_table_offset = CONFIG_PMECC_INDEX_TABLE_OFFSET;
+   if (host->pmecc_sector_size == 512)
+   host->pmecc_index_table_offset = ATMEL_PMECC_INDEX_OFFSET_512;
+   else
+   host->pmecc_index_table_offset = ATMEL_PMECC_INDEX_OFFSET_1024;
 
MTDDEBUG(MTD_DEBUG_LEVEL1,
"Initialize PMECC params, cap: %d, sector: %d\n",
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index ee6e3fc..4364026 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -137,7 +137,6 @@
 #define CONFIG_ATMEL_NAND_HW_PMECC 1
 #define CONFIG_PMECC_CAP   2
 #define CONFIG_PMECC_SECTOR_SIZE   512
-#define CONFIG_PMECC_INDEX_TABLE_OFFSET0x8000
 
 #define CONFIG_MTD_DEVICE
 #define CONFIG_CMD_MTDPARTS
diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h
index c13e983..67f8180 100644
--- a/include/configs/sama5d3xek.h
+++ b/include/configs/sama5d3xek.h
@@ -142,7 +142,6 @@
 #define CONFIG_ATMEL_NAND_HW_PMECC
 #define CONFIG_PMECC_CAP   4
 #define CONFIG_PMECC_SECTOR_SIZE   512
-#define CONFIG_PMECC_INDEX_TABLE_OFFSETATMEL_PMECC_INDEX_OFFSET_512
 #define CONFIG_CMD_NAND_TRIMFFS
 #endif
 
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 0/5] ARM: at91: atmel_nand: check ONFI ecc minimum requirement

2013-06-17 Thread Josh Wu
In this patch series, first we make the nand driver can dynamic change sector
size and ecc correct bits.
Then we enable ONFI ecc parameters check.

v1 --> v2: Fixes according to Scoot Wood's suggestion
  - add a new patch which make all driver can use dev_err, dev_info, dev_dbg.
  - replace all printk to dev_err or dev_info.
  - fix pmecc data allocate error handler.
  - fix the pmecc ecc requirement selection, should use <= instead of use <.

Josh Wu (5):
  ARM: at91: atmel_nand: pmecc driver will select the galois table by
sector size
  ARM: at91: sama5d3: remove unused definition about PMECC alpha table
offset
  linux/compat.h: move dev_err, dev_info and dev_dbg from usb driver to
compat.h
  mtd: atmel_nand: alloc memory instead of use static array for pmecc
data
  ARM: at91: atmel_nand: add code to check the ONFI parameter ECC
requirement

 arch/arm/include/asm/arch-at91/at91sam9x5.h |6 +
 arch/arm/include/asm/arch-at91/sama5d3.h|2 -
 doc/README.atmel_pmecc  |   14 --
 drivers/mtd/nand/atmel_nand.c   |  197 +--
 drivers/usb/musb-new/linux-compat.h |   16 ---
 include/configs/at91sam9x5ek.h  |1 -
 include/configs/sama5d3xek.h|1 -
 include/linux/compat.h  |8 ++
 8 files changed, 201 insertions(+), 44 deletions(-)

-- 
1.7.9.5

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


  1   2   >