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

2013-06-18 Thread Nikita Kiryanov

This version works when booting with X-Loader.

Tested-by: Nikita Kiryanov nik...@compulab.co.il

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 s...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Igor Grinberg grinb...@compulab.co.il
---
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 asm/arch/cpu.h   /* 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

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

2013-06-18 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 grinb...@compulab.co.il 
 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 robert.wink...@boundarydevices.com

 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 lcd.h
  #include watchdog.h

 +/*
 + * 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 splash.h
 +
  #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 i...@boundarydevices.com
 + *
 + * 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 splash.h
 +#include config.h
 +
 +#ifdef CONFIG_SPLASH_SCREEN_PREPARE
 +int splash_screen_prepare(void)
 +{
 + return 

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

2013-06-18 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 robert.wink...@boundarydevices.com

Acked-by: Igor Grinberg grinb...@compulab.co.il

 ---
 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 lcd.h
  #include watchdog.h
  
 +#include splash.h
 +
  #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 i...@boundarydevices.com
 + *
 + * 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 splash.h
 +#include config.h
 +
 +#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 video_fb.h
  
 +#include splash.h
 +
  /*
   * 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 i...@boundarydevices.com
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free 

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

2013-06-18 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 robert.wink...@boundarydevices.com

Acked-by: Igor Grinberg grinb...@compulab.co.il

 ---
  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 splash.h
 -#include config.h
  
 -#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 3/3] omap: cm_t35: Fix cm_t35 for weak splash_screen_prepare

2013-06-18 Thread Igor Grinberg

On 06/17/13 21:31, Robert Winkler wrote:
 Signed-off-by: Robert Winkler robert.wink...@boundarydevices.com

Usually, we add something to the commit message, otherwise
Acked-by: Igor Grinberg grinb...@compulab.co.il

 ---
  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 1/3] net2big_v2: initialize I2C fan at startup

2013-06-18 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 simon.gui...@sequanux.org
 ---
  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 common.h
  #include command.h
 +#include i2c.h
  #include asm/arch/cpu.h
  #include asm/arch/kirkwood.h
  #include asm/arch/mpp.h
 @@ -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 prafu...@marvell.com


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


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

2013-06-18 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 V3 0/3] Introduce Samsung's new board Trats2

2013-06-18 Thread Jaehoon Chung
Hi Piotr,

I tested your patches on trats2 board.
I found the below log message..If i missed some patch, let me know.

Board PMIC init
Can't find PMIC:MAX77686_PMIC

What's this log?

Best Regards,
Jaehoon Chung

On 05/24/2013 05:23 PM, Piotr Wilczek wrote:
 This patchset add support for a new Samsung board Trats2.
 Multi I2C file is update to support more buses.
 Battery support is added for Trats2.
 
 This patchset depends on:
 http://patchwork.ozlabs.org/patch/246101/
 http://patchwork.ozlabs.org/patch/246100/
 http://patchwork.ozlabs.org/patch/245311/
 http://patchwork.ozlabs.org/patch/245307/
 http://patchwork.ozlabs.org/patch/245306/
 
 Changes in v3:
 - add Maintainer entry
 - changed T-flash detect pin to GPX3[3]
 - removed MMC_ASYNC
 - use only software i2c
 
 Changes in v2:
 - removed lcd callback in panel_info
 - changed i2c from hardware to software
 - use max77693 multifunction pmic
 
 Piotr Wilczek (3):
   power:battery: add battery support for Trats2 board
   i2c:multi_i2c: add new macros I2C_7 and I2C_8
   samsung: trats2: add support for new board Trats2
 
  MAINTAINERS|4 +
  board/samsung/common/multi_i2c.c   |   33 +++
  board/samsung/trats2/Makefile  |   50 
  board/samsung/trats2/trats2.c  |  529 
 
  boards.cfg |1 +
  drivers/power/battery/Makefile |1 +
  drivers/power/battery/bat_trats2.c |   81 ++
  include/configs/trats2.h   |  326 ++
  8 files changed, 1025 insertions(+)
  create mode 100644 board/samsung/trats2/Makefile
  create mode 100644 board/samsung/trats2/trats2.c
  create mode 100644 drivers/power/battery/bat_trats2.c
  create mode 100644 include/configs/trats2.h
 

___
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-18 Thread Alexandre Dilly
Dear Wolfgang, Mats and Stefano,

Thanks for your answers,
 In message ed3e0bcacd909541ba94a34c4a164d4c4fc91...@post.tritech.se
 you wrote:
  
  I haven't seen the scripts of Alexandre but it sounds something like
  what
  we have already implemented.
 
 I haven't 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...
 
Yes, this kind of system has been implemented many times before but, we 
can't found any examples in u-boot source, so the idea was to give a 
generic example to gain time in updater development...

 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
 something else like fall back to the previous version.
 
U-boots boot counter is not persistent which implies we can't handle
some error cases like power fail. That's why I suggested to use 
environment to store boot counter with redundant option to be power safe.

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.
 
In fact, what Mats explain was my idea: the system updates boot counter
only when it detects a partition marked as updated. When Linux has 
booted, it does some specific verifications and then mark the partition
as good or as bad. So, boot counter is not updated any more until a 
new update is installed on system. So, like said Mats, count update only 
occurs when an update fails and then it doesn't cause excessive memory 
wear, because we have a limit like 3 for boot attempts.

 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.
 
About partition, since the script uses an environment variable to store boot 
command for each partition, it can be a disk partition or a UBI partition or 
a raw memory area containing kernel or rootfs which will be loaded with boot 
command.

To illustrate all ideas, I join to this mail the both scripts. These scripts 
are definitively not final versions!

U-boot script:
diff --git a/uboot_script b/uboot_script
new file mode 100644
index 000..b189643
--- /dev/null
+++ b/uboot_script
@@ -0,0 +1,64 @@
+setenv tmp_update
+if test z$force_rescue != z; then
+   echo Boot on rescue partition...
+   run part_r_cmd
+   echo System cannot boot!
+   exit 1
+fi
+if test z$max_attempts = z; then
+   echo Set maximum boot attempts to default (=3)
+   setenv max_attempts 3
+fi
+for i in $boot_seq;
+do
+   setenv tmp setenv tmp \$part_${i}_flag
+   run tmp
+   if test z$tmp != z; then
+   if test $tmp = OK -o $tmp = UPDATE; then
+   if test $tmp = UPDATE; then
+   setenv tmp_update 1
+   echo Partition $i is an update
+   fi
+   if test z$tmp_update != z; then
+

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

2013-06-18 Thread Simon Guinot
On Mon, Jun 17, 2013 at 11:53:53PM -0700, Prafulla Wadaskar wrote:
 
 
  -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

Hi Prafulla,

Thanks for your quick answer.

 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.

Not really bit-banging. Here we have 3 GPIOs used as a kind of address
register and 3 other GPIOs used as a kind of data register. An another
GPIO is used to notify the CPLD than the registers have been updated.
I will update the patch description to make clear that a register may
include several GPIOs.

At LaCie, this kind of bus is called a GPIO extension bus. It is like
a cheap GPIO expander.

 
 So to me it those are cpld_ios.

I am not sure that behind this kind of bus we always have a CPLD. I will
check this. If it is the case, what do you think about cpld-gpio-bus ?

Moreover as this bus is really a lacie specific stuff, should I
prepend a lacie- prefix ?

Regards,

Simon

 
 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 . . .


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] [PATCH v2 1/3] ARM: Tegra: FDT: Add USB EHCI function for T30/T114

2013-06-18 Thread Thierry Reding
On Mon, Jun 17, 2013 at 10:39:12PM +0200, 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.

I should repeat that things work fine for a more recent flash drive, so
it doesn't look all that bad. Bisecting will be difficult because the
patches for Tegra30 haven't been merged upstream yet. Also I can't tell
for sure if this particular flash driver ever worked as expected since
I've never tried it before.

Given that I have limited time over the next few weeks, I'll see if I
can come up with a successful bisection. If I do I'll let you know.

Thierry


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


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

2013-06-18 Thread Prafulla Wadaskar


 -Original Message-
 From: Simon Guinot [mailto:simon.gui...@sequanux.org]
 Sent: 18 June 2013 15:59
 To: Prafulla Wadaskar
 Cc: Albert ARIBAUD; u-boot@lists.denx.de
 Subject: Re: [PATCH 2/3] LaCie/common: add support for
 the GPIO extension bus
 
 On Mon, Jun 17, 2013 at 11:53:53PM -0700, Prafulla
 Wadaskar wrote:
 
 
   -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
...snip...

 At LaCie, this kind of bus is called a GPIO extension
 bus. It is like
 a cheap GPIO expander.
 
 
  So to me it those are cpld_ios.
 
 I am not sure that behind this kind of bus we always
 have a CPLD. I will
 check this. If it is the case, what do you think about
 cpld-gpio-bus ?

Even this sounds good to me, better than my suggestion earlier :).

 
 Moreover as this bus is really a lacie specific stuff,
 should I
 prepend a lacie- prefix ?

This is not necessary I think.

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


[U-Boot] [PATCH 05/10 v2] powerpc: deleted unused symbol CONFIG_SPL_NAND_MINIMAL and enabled some functionality for common SPL

2013-06-18 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

1. The symbol CONFIG_SPL_NAND_MINIMAL is unused, so deleted it.
2. Some functions were unused in the minimal SPL, but it is useful
in the common SPL. So, enabled some functionality for common SPL.

Signed-off-by: Ying Zhang b40...@freescale.com

---
Compared with the previous version, use
!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL)
to replace to new symbols.

 arch/powerpc/cpu/mpc85xx/tlb.c |3 ++-
 arch/powerpc/cpu/mpc8xxx/law.c |6 --
 include/configs/MPC8313ERDB.h  |1 -
 include/configs/P1022DS.h  |1 -
 include/configs/p1_p2_rdb_pc.h |1 -
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c
index 0dff37f..b903d02 100644
--- a/arch/powerpc/cpu/mpc85xx/tlb.c
+++ b/arch/powerpc/cpu/mpc85xx/tlb.c
@@ -55,7 +55,8 @@ void init_tlbs(void)
return ;
 }
 
-#if !defined(CONFIG_NAND_SPL)  !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL)  \
+   (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 void read_tlbcam_entry(int idx, u32 *valid, u32 *tsize, unsigned long *epn,
   phys_addr_t *rpn)
 {
diff --git a/arch/powerpc/cpu/mpc8xxx/law.c b/arch/powerpc/cpu/mpc8xxx/law.c
index 6f9d568..6c0a307 100644
--- a/arch/powerpc/cpu/mpc8xxx/law.c
+++ b/arch/powerpc/cpu/mpc8xxx/law.c
@@ -92,7 +92,8 @@ void disable_law(u8 idx)
return;
 }
 
-#if !defined(CONFIG_NAND_SPL)  !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL)  \
+   (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 static int get_law_entry(u8 i, struct law_entry *e)
 {
u32 lawar;
@@ -122,7 +123,8 @@ int set_next_law(phys_addr_t addr, enum law_size sz, enum 
law_trgt_if id)
return idx;
 }
 
-#if !defined(CONFIG_NAND_SPL)  !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL)  \
+   (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
u32 idx;
diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h
index 1d753e7..0c15195 100644
--- a/include/configs/MPC8313ERDB.h
+++ b/include/configs/MPC8313ERDB.h
@@ -40,7 +40,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET  u-boot-with-spl.bin
 #define CONFIG_SPL_MPC83XX_WAIT_FOR_NAND
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index 9c27182..bcbda30 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -41,7 +41,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET  u-boot-with-spl.bin
 
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 2fa5372..b35b966 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -159,7 +159,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET  u-boot-with-spl.bin
 
-- 
1.7.0.4


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


[U-Boot] [PATCH 09/10 v2] nand: tpl : introduce the TPL based on the SPL

2013-06-18 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that runs in the
L2 SRAM, after being loaded by the code from the SPL. It initializes the
DDR with the SPD or other operations.

The TPL's size is sizeable, the maximum size must not exceed the size of L2
SRAM. It initializes the DDR through SPD code, and copys final uboot image
to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image,

This patch is on top of the patch:
powerpc/p1022ds: boot from spi flash with SPL

Signed-off-by: Ying Zhang b40...@freescale.com
---
Compared with the previous version, split into two separate patches.
this pactch only introduce the TPL.

 Makefile   |   21 +++-
 README |   52 ++-
 arch/powerpc/config.mk |2 +
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c|4 +-
 arch/powerpc/lib/Makefile  |2 +
 common/Makefile|9 +
 common/cmd_nvedit.c|8 +-
 config.mk  |   32 
 doc/README.TPL |   69 +
 drivers/mtd/nand/Makefile  |8 +
 drivers/mtd/nand/fsl_elbc_spl.c|4 +
 drivers/serial/serial.c|2 +-
 include/bootstage.h|3 +-
 tpl/Makefile   |  161 
 14 files changed, 366 insertions(+), 11 deletions(-)
 create mode 100644 doc/README.TPL
 create mode 100644 tpl/Makefile

diff --git a/Makefile b/Makefile
index 693b3f2..7954e96 100644
--- a/Makefile
+++ b/Makefile
@@ -118,10 +118,11 @@ endif # ifneq ($(BUILD_DIR),)
 
 OBJTREE:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
 SPLTREE:= $(OBJTREE)/spl
+TPLTREE:= $(OBJTREE)/tpl
 SRCTREE:= $(CURDIR)
 TOPDIR := $(SRCTREE)
 LNDIR  := $(OBJTREE)
-export TOPDIR SRCTREE OBJTREE SPLTREE
+export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
 
 MKCONFIG   := $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -412,6 +413,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ,,$(CONFIG_SPL_TARGET))
@@ -498,6 +500,18 @@ $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin 
$(obj)u-boot.bin
cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin  $@
rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot-with-tpl.bin: $(obj)spl/u-boot-spl.bin $(obj)tpl/u-boot-tpl.bin \
+   $(obj)u-boot.bin
+   $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+   -I binary -O binary \
+   $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl-pad.bin
+   $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_PAD_TO) \
+   -I binary -O binary \
+   $(obj)tpl/u-boot-tpl.bin $(obj)tpl/u-boot-tpl-pad.bin
+   cat $(obj)spl/u-boot-spl-pad.bin $(obj)tpl/u-boot-tpl-pad.bin \
+   $(obj)u-boot.bin  $@
+   rm $(obj)spl/u-boot-spl-pad.bin $(obj)tpl/u-boot-tpl-pad.bin
+
 $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
$(OBJTREE)/u-boot-with-spl.imx
@@ -622,6 +636,9 @@ $(obj)u-boot-nand.bin:  nand_spl $(obj)u-boot.bin
 $(obj)spl/u-boot-spl.bin:  $(SUBDIR_TOOLS) depend
$(MAKE) -C spl all
 
+$(obj)tpl/u-boot-tpl.bin:  $(SUBDIR_TOOLS) depend
+   $(MAKE) -C tpl all
+
 updater:
$(MAKE) -C tools/updater all
 
@@ -870,6 +887,8 @@ clobber:tidy
@rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
@rm -f $(obj)spl/u-boot-spl.lds
+   @rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
+   @rm -f $(obj)tpl/u-boot-tpl.lds
@rm -f $(obj)MLO MLO.byteswap
@rm -f $(obj)SPL
@rm -f $(obj)tools/xway-swap-bytes
diff --git a/README b/README
index 5985903..2d47816 100644
--- a/README
+++ b/README
@@ -2983,9 +2983,10 @@ FIT uImage format:
Set for the SPL on PPC mpc8xxx targets, support for
arch/powerpc/cpu/mpc8xxx/ddr/libddr.o in SPL binary.
 
-   

[U-Boot] [PATCH 10/10] powerpc: p1022ds: support TPL on the P1022DS

2013-06-18 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

Support TPL on the P1022DS.
The TPL's size is sizeable, the maximum size must not exceed the size of L2
SRAM. It initializes the DDR through SPD code, and copys final uboot image
to DDR. So there are three stage uboot images:
* spl_boot, 4KB size, pad to 128K byte.
* tpl_boot, 88K size, pad to 128K size. The env variables are
copied to L2 SRAM, so that ddr SPD code can get the interleaving
mode setting in env. It loads final uboot image from offset 256KB.
* final uboot image, size is variable depends on the functions
enabled.

This patch is on top of the patch:
nand: tpl : introduce the TPL based on the SPL

Signed-off-by: Ying Zhang b40...@freescale.com
---
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds |4 +
 board/freescale/p1022ds/Makefile|3 +
 board/freescale/p1022ds/spl_minimal.c   |   57 ++---
 board/freescale/p1022ds/tlb.c   |4 +-
 board/freescale/p1022ds/tpl.c   |  102 +++
 drivers/mtd/nand/fsl_elbc_spl.c |   18 +-
 include/configs/P1022DS.h   |   79 ++--
 7 files changed, 196 insertions(+), 71 deletions(-)
 create mode 100644 board/freescale/p1022ds/tpl.c

diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds 
b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
index 4e786a4..1af1da8 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
@@ -32,7 +32,11 @@ PHDRS
 #endif
 SECTIONS
 {
+#ifdef CONFIG_SPL_BUILD
. = CONFIG_SPL_TEXT_BASE;
+#else
+   . = CONFIG_TPL_TEXT_BASE;
+#endif
.text : {
*(.text*)
}
diff --git a/board/freescale/p1022ds/Makefile b/board/freescale/p1022ds/Makefile
index 9746063..58f224e 100644
--- a/board/freescale/p1022ds/Makefile
+++ b/board/freescale/p1022ds/Makefile
@@ -27,6 +27,9 @@ else
 ifdef CONFIG_SPL_BUILD
 COBJS-y += spl.o
 endif
+ifdef CONFIG_TPL_BUILD
+COBJS-y += tpl.o
+endif
 COBJS-y+= $(BOARD).o
 COBJS-y+= ddr.o
 COBJS-y+= law.o
diff --git a/board/freescale/p1022ds/spl_minimal.c 
b/board/freescale/p1022ds/spl_minimal.c
index 8d12fa6..8ab5ec2 100644
--- a/board/freescale/p1022ds/spl_minimal.c
+++ b/board/freescale/p1022ds/spl_minimal.c
@@ -27,51 +27,6 @@
 #include asm/fsl_ddr_sdram.h
 
 
-/*
- * Fixed sdram init -- doesn't use serial presence detect.
- */
-void sdram_init(void)
-{
-   volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
-
-   __raw_writel(CONFIG_SYS_DDR_CS0_BNDS, ddr-cs0_bnds);
-   __raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, ddr-cs0_config);
-#if CONFIG_CHIP_SELECTS_PER_CTRL  1
-   __raw_writel(CONFIG_SYS_DDR_CS1_BNDS, ddr-cs1_bnds);
-   __raw_writel(CONFIG_SYS_DDR_CS1_CONFIG, ddr-cs1_config);
-#endif
-   __raw_writel(CONFIG_SYS_DDR_TIMING_3, ddr-timing_cfg_3);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_0, ddr-timing_cfg_0);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_1, ddr-timing_cfg_1);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_2, ddr-timing_cfg_2);
-
-   __raw_writel(CONFIG_SYS_DDR_CONTROL_2, ddr-sdram_cfg_2);
-   __raw_writel(CONFIG_SYS_DDR_MODE_1, ddr-sdram_mode);
-   __raw_writel(CONFIG_SYS_DDR_MODE_2, ddr-sdram_mode_2);
-
-   __raw_writel(CONFIG_SYS_DDR_INTERVAL, ddr-sdram_interval);
-   __raw_writel(CONFIG_SYS_DDR_DATA_INIT, ddr-sdram_data_init);
-   __raw_writel(CONFIG_SYS_DDR_CLK_CTRL, ddr-sdram_clk_cntl);
-
-   __raw_writel(CONFIG_SYS_DDR_TIMING_4, ddr-timing_cfg_4);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_5, ddr-timing_cfg_5);
-   __raw_writel(CONFIG_SYS_DDR_ZQ_CONTROL, ddr-ddr_zq_cntl);
-   __raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL, ddr-ddr_wrlvl_cntl);
-
-   /* Set, but do not enable the memory */
-   __raw_writel(CONFIG_SYS_DDR_CONTROL  ~SDRAM_CFG_MEM_EN,
-   ddr-sdram_cfg);
-
-   in_be32(ddr-sdram_cfg);
-   udelay(500);
-
-   /* Let the controller go */
-   out_be32(ddr-sdram_cfg, in_be32(ddr-sdram_cfg) | SDRAM_CFG_MEM_EN);
-   in_be32(ddr-sdram_cfg);
-
-   set_next_law(0, CONFIG_SYS_SDRAM_SIZE_LAW, LAW_TRGT_IF_DDR_1);
-}
-
 const static u32 sysclk_tbl[] = {
6000, 7499900, 83332500, 800,
9000, 1000, 12499800, 1200
@@ -83,6 +38,10 @@ void board_init_f(ulong bootflag)
u32 plat_ratio, sys_clk, bus_clk;
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
+#if defined(CONFIG_SYS_NAND_BR_PRELIM)  defined(CONFIG_SYS_NAND_OR_PRELIM)
+   set_lbc_br(0, CONFIG_SYS_NAND_BR_PRELIM);
+   set_lbc_or(0, CONFIG_SYS_NAND_OR_PRELIM);
+#endif
/* for FPGA */
set_lbc_br(2, CONFIG_SYS_BR2_PRELIM);
set_lbc_or(2, CONFIG_SYS_OR2_PRELIM);
@@ -98,19 +57,17 @@ void board_init_f(ulong bootflag)
 
puts(\nNAND boot... );
 
-   /* Initialize the DDR3 */
-   sdram_init();
-
/* copy code to RAM and jump to it - this should not return */

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

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

 On Mon, Jun 17, 2013 at 10:39:12PM +0200, 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.
 
 I should repeat that things work fine for a more recent flash drive, so
 it doesn't look all that bad. Bisecting will be difficult because the
 patches for Tegra30 haven't been merged upstream yet. Also I can't tell
 for sure if this particular flash driver ever worked as expected since
 I've never tried it before.
 
 Given that I have limited time over the next few weeks, I'll see if I
 can come up with a successful bisection. If I do I'll let you know.

You can try checking 2013.01, I recall merging some usb-storage related changes 
after that release.

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-18 Thread Marek Vasut
Dear 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.

Even this one ? Did we already get any reply from the patch author?

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 7/7] am335x_evm: Add support to boot from NOR.

2013-06-18 Thread Mark Jackson
On 17/06/13 15:43, Mark Jackson wrote:
 On 13/05/13 19:28, Tom Rini wrote:
 From: Steve Kipisz s-kipi...@ti.com

 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.

Just an update ... I now have it working ... yay !!

The main (and possibly the *only*) culprit was that SYSBOOT[8] (which selects
8/16bit mode) was being incorrectly influenced by a hardware fault.

I have pulled quite a few patches from various places, some of which might
not be required.  Now I have a working base, I'll work out what is needed
on top of Tom's original patch set.

Thanks for everyone's support.

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


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

2013-06-18 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 simon.gui...@sequanux.org
---
 board/LaCie/net2big_v2/Makefile |3 ++
 board/LaCie/net2big_v2/net2big_v2.c |  100 ---
 2 files changed, 96 insertions(+), 7 deletions(-)

Changes in v2:
- Rename gpio-ext into cpld-gpio-bus and adjust code and comments
  accordingly.

diff --git a/board/LaCie/net2big_v2/Makefile b/board/LaCie/net2big_v2/Makefile
index fbae48e..9a6dfb6 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/cpld-gpio-bus.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..b133f7c 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/cpld-gpio-bus.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -61,18 +62,18 @@ int board_early_init_f(void)
MPP24_GPIO, /* USB mode select */
MPP26_GPIO, /* USB device vbus */
MPP28_GPIO, /* USB enable host vbus */
-   MPP29_GPIO, /* GPIO extension ALE */
+   MPP29_GPIO, /* CPLD GPIO bus ALE */
MPP34_GPIO, /* Rear Push button 0=on 1=off */
MPP35_GPIO, /* Inhibit switch power-off */
MPP36_GPIO, /* SATA HDD1 presence */
MPP37_GPIO, /* SATA HDD2 presence */
MPP40_GPIO, /* eSATA presence */
-   MPP44_GPIO, /* GPIO extension (data 0) */
-   MPP45_GPIO, /* GPIO extension (data 1) */
-   MPP46_GPIO, /* GPIO extension (data 2) */
-   MPP47_GPIO, /* GPIO extension (addr 0) */
-   MPP48_GPIO, /* GPIO extension (addr 1) */
-   MPP49_GPIO, /* GPIO extension (addr 2) */
+   MPP44_GPIO, /* CPLD GPIO bus (data 0) */
+   MPP45_GPIO, /* CPLD GPIO bus (data 1) */
+   MPP46_GPIO, /* CPLD GPIO bus (data 2) */
+   MPP47_GPIO, /* CPLD GPIO bus (addr 0) */
+   MPP48_GPIO, /* CPLD GPIO bus (addr 1) */
+   MPP49_GPIO, /* CPLD GPIO bus (addr 2) */
0
};
 
@@ -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)
+/*
+ * CPLD GPIO bus:
+ *
+ * - address register : bit [0-2] - GPIO [47-49]
+ * - data register: bit [0-2] - GPIO [44-46]
+ * - enable register  : GPIO 29
+ */
+static unsigned cpld_gpio_bus_addr[] = { 47, 48, 49 };
+static unsigned cpld_gpio_bus_data[] = { 44, 45, 46 };
+
+static struct cpld_gpio_bus cpld_gpio_bus = {
+   .addr   = cpld_gpio_bus_addr,
+   .num_addr   = ARRAY_SIZE(cpld_gpio_bus_addr),
+   .data   = cpld_gpio_bus_data,
+   .num_data   = ARRAY_SIZE(cpld_gpio_bus_data),
+   .enable = 29,
+};
+
+/*
+ * LEDs configuration:
+ *
+ * The LEDs are controlled by a CPLD and can be configured through
+ * the CPLD GPIO 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 

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

2013-06-18 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 simon.gui...@sequanux.org
Acked-by: Prafulla Wadaskar prafu...@marvell.com
---
 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(-)

Changes in v2:
- Add Prafulla's Acked-by

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 common.h
 #include command.h
+#include i2c.h
 #include asm/arch/cpu.h
 #include asm/arch/kirkwood.h
 #include asm/arch/mpp.h
@@ -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 v2 2/3] LaCie/common: add support for the CPLD GPIO bus

2013-06-18 Thread Simon Guinot
This patch adds support for the CPLD GPIO bus found on some LaCie boards
(as the 2Big/5Big Network v2 and the 2Big NAS). This parallel GPIO bus
exposes two registers (address and data). Each of this register is made
up of several dedicated GPIOs. An extra GPIO is used to notify the CPLD
that the registers have been updated.

Mostly this bus is used to configure the LEDs on LaCie boards.

Signed-off-by: Simon Guinot simon.gui...@sequanux.org
---
 board/LaCie/common/cpld-gpio-bus.c |   50 
 board/LaCie/common/cpld-gpio-bus.h |   24 +
 2 files changed, 74 insertions(+)
 create mode 100644 board/LaCie/common/cpld-gpio-bus.c
 create mode 100644 board/LaCie/common/cpld-gpio-bus.h

Changes in v2:
- Rename gpio-ext into cpld-gpio-bus and adjust code and comments
  accordingly.

diff --git a/board/LaCie/common/cpld-gpio-bus.c 
b/board/LaCie/common/cpld-gpio-bus.c
new file mode 100644
index 000..fb9bf8d
--- /dev/null
+++ b/board/LaCie/common/cpld-gpio-bus.c
@@ -0,0 +1,50 @@
+/*
+ * cpld-gpio-bus.c: provides support for the CPLD GPIO bus found on some LaCie
+ * boards (as the 2Big/5Big Network v2 and the 2Big NAS). This parallel GPIO
+ * bus exposes two registers (address and data). Each of this register is made
+ * up of several dedicated GPIOs. An extra GPIO is used to notify the CPLD that
+ * the registers have been updated.
+ *
+ * Mostly this bus is used to configure the LEDs on LaCie boards.
+ *
+ * Copyright (C) 2013 Simon Guinot simon.gui...@sequanux.org
+ *
+ * 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 asm/arch/gpio.h
+#include cpld-gpio-bus.h
+
+static void cpld_gpio_bus_set_addr(struct cpld_gpio_bus *bus, unsigned addr)
+{
+   int pin;
+
+   for (pin = 0; pin  bus-num_addr; pin++)
+   kw_gpio_set_value(bus-addr[pin], (addr  pin)  1);
+}
+
+static void cpld_gpio_bus_set_data(struct cpld_gpio_bus *bus, unsigned data)
+{
+   int pin;
+
+   for (pin = 0; pin  bus-num_data; pin++)
+   kw_gpio_set_value(bus-data[pin], (data  pin)  1);
+}
+
+static void cpld_gpio_bus_enable_select(struct cpld_gpio_bus *bus)
+{
+   /* The transfer is enabled on the raising edge. */
+   kw_gpio_set_value(bus-enable, 0);
+   kw_gpio_set_value(bus-enable, 1);
+}
+
+void cpld_gpio_bus_write(struct cpld_gpio_bus *bus,
+unsigned addr, unsigned value)
+{
+   cpld_gpio_bus_set_addr(bus, addr);
+   cpld_gpio_bus_set_data(bus, value);
+   cpld_gpio_bus_enable_select(bus);
+}
diff --git a/board/LaCie/common/cpld-gpio-bus.h 
b/board/LaCie/common/cpld-gpio-bus.h
new file mode 100644
index 000..e9e9b96
--- /dev/null
+++ b/board/LaCie/common/cpld-gpio-bus.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2013 Simon Guinot simon.gui...@sequanux.org
+ *
+ * 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_CPLD_GPI0_BUS_H
+#define _LACIE_CPLD_GPI0_BUS_H
+
+struct cpld_gpio_bus {
+   unsigned *addr;
+   unsigned num_addr;
+   unsigned *data;
+   unsigned num_data;
+   unsigned enable;
+};
+
+void cpld_gpio_bus_write(struct cpld_gpio_bus *cpld_gpio_bus,
+unsigned addr, unsigned value);
+
+#endif /* _LACIE_CPLD_GPI0_BUS_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 v2 0/3] net2big_v2: initialize fan and LEDs at startup

2013-06-18 Thread Simon Guinot
This patch series allows to initialize the fan and the LEDs found on the
net2big_v2.

Changes in v2:
- Add Prafulla's Acked-by to patch
  net2big_v2: initialize I2C fan at startup
- Rename gpio-ext into cpld-gpio-bus and adjust code and comments
  accordingly.

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

 board/LaCie/common/cpld-gpio-bus.c  |   50 
 board/LaCie/common/cpld-gpio-bus.h  |   24 ++
 board/LaCie/net2big_v2/Makefile |3 +
 board/LaCie/net2big_v2/net2big_v2.c |  154 +--
 board/LaCie/net2big_v2/net2big_v2.h |5 ++
 include/configs/lacie_kw.h  |9 +-
 6 files changed, 236 insertions(+), 9 deletions(-)
 create mode 100644 board/LaCie/common/cpld-gpio-bus.c
 create mode 100644 board/LaCie/common/cpld-gpio-bus.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 0/6] Optimize ARM relocation

2013-06-18 Thread Albert ARIBAUD
Hi Jeroen,

On Sun, 16 Jun 2013 15:33:32 +0200, Jeroen Hofstee
jer...@myspectrum.nl wrote:

 Hello Albert,
 
 On 06/13/2013 08:54 PM, Jeroen Hofstee wrote:
 
  binaries only use one type of relocation record,
  R_ARM_RELATIVE., then optimizing relocation code
  accordingly.
 
 
 
 fyi, I had a look at the clang build and it doesn't boot
 after these patches...
 
 When constant pointers are used without fpie, e.g. the
 arguments to printf, gcc will load the address with ldr /
 R_ARM_ABS32, clang sets the address with a movw /
 movt pair.

Hmm... Why do you remove -fpie from the gcc build?

 ld -r will make the former relative, but the movw / movt
 cannot be fixed. So I set fpie for clang, which generates
 a couple of R_ARM_ABS32:
 
 Most notably a reference to do_bootd. Since it is no
 longer valid after this patch and used in command.c this
 crashes the board (unless there happens to be a valid
 address in it). gcc seems to always recalculate it using pc.
 
 Another symbol is _start, but that looks easily fixable.
 
 The last one looks similar like the do_bootd and I haven't
 bothered to check the details.

Can you give more precise info on the issue? Such as the U-Boot
codebase (even if not in shape for submitting) and clang compiler
version you are using, so that I can try the build on my side and have
a look at how/why r_arm_abs32 relocation recodes are generated and how
to avoid it?

 Regards,
 Jeroen

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


Re: [U-Boot] please pull u-boot-samsung master

2013-06-18 Thread Albert ARIBAUD
Hi Minkyu,

On Mon, 17 Jun 2013 13:16:20 +0530, Jagan Teki
jagannadh.t...@gmail.com wrote:

 On Mon, Jun 17, 2013 at 7:40 AM, Minkyu Kang mk7.k...@samsung.com wrote:
  Dear Albert,
 
  The following changes since commit d0a51373131c4ba565a2391d5ed78b87c406ce98:
 
at91sam9260ek: move board id setup to config header (2013-05-12 16:49:14 
  +0200)
 
  are available in the git repository at:
 
git://git.denx.de/u-boot-samsung master
 
  for you to fetch changes up to ed7bdc03eb516fb698ccc12ec5b4b9f132d05c5f:
 
MMC: DWMMC: Fix FIFO_DEPTH calculation (2013-06-17 11:03:42 +0900)
 
  
  Akshay Saraswat (2):
Exynos5: clock: Update the equation to calculate PLL output frequency
Exynos: uart: s5p: enabling the uart tx/rx fifo
 
  Amar (9):
FDT: Add compatible string for DWMMC
EXYNOS5: FDT: Add DWMMC device node data
DWMMC: Initialise dwmci and resolve EMMC read write issues
EXYNOS5: DWMMC: Added FDT support for DWMMC
EXYNOS5: DWMMC: Initialise the local variable to avoid unwanted 
  results.
SMDK5250: Initialise and Enable DWMMC, support FDT and non-FDT
MMC: APIs to support resize of EMMC boot partition
SMDK5250: Enable EMMC booting
COMMON: MMC: Command to support EMMC booting and to resize EMMC boot 
  partition
 
  Arkadiusz Wlodarczyk (1):
arm:trats: change auto-booting to boot kernel with separate device 
  tree blob
 
  Inderpal Singh (3):
exynos: move tzpc_init to armv7/exynos
exynos: update tzpc to make it common for exynos4 and exynos5
exynos: Update origen and smdkv310 to use common tzpc_init
 
  Naveen Krishna Chatradhi (2):
power: exynos-tmu: fix warnings and clean up code
power: exynos-tmu: use the mux_addr bit fields in tmu_control register
 
  Rajeshwari Shinde (3):
SF: Add driver for Gigabyte device GD25LQ and GD25Q64B
SMDK5250: Enable SPI Gigabyte device.
 
 SPI gigabyte flash driver is not available in drivers/mtd/spi/
 Am i missing anything here, please help.

So, Minkyu, should I pick this PR or wait for an update?

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


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

2013-06-18 Thread Tom Rini
Hello,

The following changes since commit 847e6693ccb529bf8346db62876f38f0c4e04ade:

  arm: pxa: config option for PXA270 turbo mode (2013-06-12 22:24:12 +0200)

are available in the git repository at:

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

for you to fetch changes up to bf3b98a1886ef18d7e2e4f83fec17f6c8cc51eaf:

  arm: omap4: panda: Fix checkpatch on panda file (2013-06-18 10:43:30 -0400)


Dan Murphy (5):
  arm: omap: Add check for fdtfile in the findfdt macro
  arm: omap5_uevm: Correct the console sys prompt for 5432
  arm: dra7xx: Update the EXTRA_ENV_SETTINGS
  arm: omap4: panda: Add reading of the board revision
  arm: omap4: panda: Fix checkpatch on panda file

Heiko Schocher (3):
  arm, am33xx: move rtc32k_enable() to common place
  arm, am335x: make mpu pll config configurable
  arm, am33xx: move uart soft reset code to common place

 arch/arm/cpu/armv7/am33xx/board.c|   40 ++
 arch/arm/cpu/armv7/am33xx/clock_am33xx.c |9 ++-
 arch/arm/include/asm/arch-am33xx/sys_proto.h |4 +
 board/isee/igep0033/board.c  |   40 +-
 board/phytec/pcm051/board.c  |   39 +-
 board/ti/am335x/board.c  |   39 +-
 board/ti/panda/panda.c   |  104 +-
 board/ti/ti814x/evm.c|   35 +
 include/configs/am335x_evm.h |7 +-
 include/configs/dra7xx_evm.h |3 +
 include/configs/omap4_common.h   |7 +-
 include/configs/omap5_common.h   |9 ++-
 include/configs/omap5_uevm.h |4 +-
 13 files changed, 164 insertions(+), 176 deletions(-)

Thanks!

-- 
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] [Patch v2] PHY: micrel.c: add support for KSZ9031

2013-06-18 Thread Fabio Estevam
Hi Joe,

On Wed, Feb 6, 2013 at 7:18 PM, David Andrey david.and...@netmodule.com wrote:
 Add support for Micrel PHY KSZ9031 in phylib,
 including small rework for KSZ9021 to avoid
 code duplication

 Signed-off-by: David Andrey david.and...@netmodule.com
 Cc: Troy Kisky troy.ki...@boundarydevices.com
 Cc: Joe Herschberger joe.hershber...@gmail.com
 Cc: Andy Fleming aflem...@freescale.com

Can we get this one applied for the upcoming 2013.04?

Regards,

Fabio Estevam
___
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-18 Thread Stephen Warren
On 06/18/2013 05:29 AM, Marek Vasut wrote:
 Dear 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.
 
 Even this one ? Did we already get any reply from the patch author?

Oh, it's possible this is a different symptom, although I'd wager since
it's narrowed down to a patch that's known to cause another problem
already, it's the same patch that caused it, but yes that should be
verified explicitly.

No, I haven't heard anything at all from the patch author.

___
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-18 Thread Stephen Warren
On 06/18/2013 04:58 AM, Thierry Reding wrote:
 On Mon, Jun 17, 2013 at 10:39:12PM +0200, Marek Vasut wrote:
...
 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.
 
 I should repeat that things work fine for a more recent flash
 drive, so it doesn't look all that bad. Bisecting will be difficult
 because the patches for Tegra30 haven't been merged upstream yet.
 Also I can't tell for sure if this particular flash driver ever
 worked as expected since I've never tried it before.

You can easily cherry-pick changes on top of each commit while you're
doing a bisect to add the board support in if you need; just be
careful to say git bisect good|bad
the_commit_which_git_bisect_told_me_to_test where
the_commit_which_git_bisect_told_me_to_test is before the
cherry-picks you did.

Doesn't the problem happen on a Tegra20 board though; it might be easier
to test there since no cherry-picks would be needed.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 10/10] powerpc: p1022ds: support TPL on the P1022DS

2013-06-18 Thread Timur Tabi
On Tue, Jun 18, 2013 at 5:39 AM,  ying.zh...@freescale.com wrote:
 From: Ying Zhang b40...@freescale.com

 Support TPL on the P1022DS.

Please define TPL.  I have no idea what it is.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-06-18 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Signed-off-by: Stephen Warren swar...@nvidia.com
---
v2: Removed CONFIG_LCD_DT_SIMPLEFB
---
 board/nvidia/dts/tegra20-harmony.dts | 32 
 board/nvidia/harmony/harmony.c   |  7 +++
 include/configs/harmony.h|  9 +
 3 files changed, 48 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 common.h
+#include lcd.h
 #include asm/io.h
 #include asm/arch/clock.h
 #include asm/arch/funcmux.h
@@ -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..27aaf16 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,14 @@
 #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
+
 #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 V2 2/2] ARM: tegra: enable LCD panel on Ventana

2013-06-18 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Signed-off-by: Stephen Warren swar...@nvidia.com
---
v2: Removed CONFIG_LCD_DT_SIMPLEFB
---
 board/nvidia/dts/tegra20-ventana.dts | 32 
 include/configs/ventana.h|  9 +
 2 files changed, 41 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..05e682c 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,14 @@
 /* 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
+
 #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


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

2013-06-18 Thread Mike Dunn
On 06/17/2013 03:29 PM, Scott Wood wrote:
 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?


Yes.  I've already submitted patches for palmtreo680 board support, but was
remiss in shepherding it to mainline.  Will be resubmitting soon.

Thanks,
Mike
___
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-18 Thread Robert Winkler
I figured this one was so simple it didn't warrant anything more than
what's already in the subject line.

On Mon, Jun 17, 2013 at 11:26 PM, Igor Grinberg grinb...@compulab.co.il wrote:

 On 06/17/13 21:31, Robert Winkler wrote:
 Signed-off-by: Robert Winkler robert.wink...@boundarydevices.com

 Usually, we add something to the commit message, otherwise
 Acked-by: Igor Grinberg grinb...@compulab.co.il

 ---
  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 1/2] video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO

2013-06-18 Thread Robert Winkler
On Mon, Jun 17, 2013 at 11:20 PM, Igor Grinberg grinb...@compulab.co.il wrote:


 On 06/17/13 20:08, Robert Winkler wrote:
 Hi Igor,

 On Sun, Jun 16, 2013 at 10:34 PM, Igor Grinberg grinb...@compulab.co.il 
 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 robert.wink...@boundarydevices.com

 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.

Ah, I'm sorry, I misread that as SPLASH_SCREEN_PREPARE, but that makes
more sense.  However I haven't noticed
any function definitions in h files in U-Boot and as it stands it has
to be this way.  Since a lot of the common code in lcd.c
and cfb_console is unrelated to (or at least, not only used) for
splash screens, maybe splash.c/h should be called
something else and thus always included.  Not sure what to call it,
but something to do with logos/bmp probably.

The overlap between
lcd_init - lcd_clear - lcd_logo - bmp_display
and
video_init - video_logo - video_display_bitmap

is as much related to general bmp/logo display as splash screen
functionality and it would probably be more sensible
to pull it all out that than try to snip out only the splash screen
stuff for splash.c

Just an idea.



  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 lcd.h
  #include watchdog.h

 +/*
 + * 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 splash.h
 +
  #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 i...@boundarydevices.com
 + *
 + * 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
 + * 

Re: [U-Boot] [PATCH 10/10] powerpc: p1022ds: support TPL on the P1022DS

2013-06-18 Thread Scott Wood

On 06/18/2013 10:37:02 AM, Timur Tabi wrote:

On Tue, Jun 18, 2013 at 5:39 AM,  ying.zh...@freescale.com wrote:
 From: Ying Zhang b40...@freescale.com

 Support TPL on the P1022DS.

Please define TPL.  I have no idea what it is.


Third Program Loader.  An additional stage that comes after SPL, before  
the main image.  But yes, the commit message and README should explain  
this.


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


[U-Boot] [PATCH v6 1/2] pxa: add support for palmtreo680 board

2013-06-18 Thread Mike Dunn
This patch adds support for the Palm Treo 680 smartphone.  A quick overview of
u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip.  This device has a 2k region
that maps to the system bus at the reset vector in a NOR-like fashion so that it
can be used as the boot device.  The phone is shipped with this 2k region
configured as write-protected (can't be modified) and programmed with an initial
program loader (IPL).  At power-up, this IPL loads the contents of two flash
blocks to SDRAM and jumps to it.  The capacity of the two blocks is not large
enough to hold all of u-boot, so a u-boot SPL is used.  To conserve flash space,
these two blocks and the necessary number of subsequent blocks are programmed
with a concatenated spl + u-boot image.  That way, the IPL will also load a
portion of u-boot proper, and when the spl runs, it relocates the portion of
u-boot that the IPL has already loaded, and then resumes loading the remaining
part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think
that having a writable environment was worth the cost of a flash block, although
adding it would be straightforward.  I abuse the CONFIG_EXTRA_ENV_SETTINGS
option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Support for the LCD is included, but currently it is only useful for displaying
the u-boot splash screen.  But if u-boot is built without the usbtty console, it
does display the auto-boot progress nicely.

Signed-off-by: Mike Dunn miked...@newsguy.com
---
Changelog:
  v6: mv doc/README.palmtreo680 board/palmtreo680/README
  v5: do not use a custom linker script for spl build
  v4:
- use CONFIG_MACH_TYPE instead of MACH_TYPE_TREO680 to initialize
  bi_arch_number
- use offset from CONFIG_SYS_DRAM_BASE to initialize bi_boot_params,
  instead of hard-coding an absolute address
- use shift operator to set one bit when initializing gpio register
- remove memcpy() definition from spl build; use
  CONFIG_SPL_LIBGENERIC_SUPPORT to properly build and link with
  u-boot's memcpy()
- config file cleanup: remove erroneous comments, unneeded numerical
  definitions
- edited README.palmtreo680 a bit
  v3: flash_u-boot utility split into separate patch
  v2:
- tabs removed in #defines in palmtreo680.h
- utility for programming u-boot to flash moved to tools/palmtreo680

 CREDITS |4 +
 MAINTAINERS |3 +
 board/palmtreo680/Makefile  |   34 +++
 board/palmtreo680/README|  581 +++
 board/palmtreo680/palmtreo680.c |  148 ++
 boards.cfg  |1 +
 include/configs/palmtreo680.h   |  286 +++
 7 files changed, 1057 insertions(+), 0 deletions(-)
 create mode 100644 board/palmtreo680/Makefile
 create mode 100644 board/palmtreo680/README
 create mode 100644 board/palmtreo680/palmtreo680.c
 create mode 100644 include/configs/palmtreo680.h

diff --git a/CREDITS b/CREDITS
index 7c1458f..3b657e9 100644
--- a/CREDITS
+++ b/CREDITS
@@ -124,6 +124,10 @@ N: James F. Dougherty
 E: j...@gigabitnetworks.com
 D: Port to the MOUSSE board
 
+N: Mike Dunn
+E: miked...@newsguy.com
+D: Palmtreo680 board, docg4 nand flash driver
+
 N: Dave Ellis
 E: d...@sixnetio.com
 D: EEPROM Speedup, SXNI855T port
diff --git a/MAINTAINERS b/MAINTAINERS
index 7820375..9abff0a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -651,6 +651,9 @@ Wolfgang Denk w...@denx.de
imx27lite   i.MX27
qongi.MX31
 
+Mike Dunn miked...@newsguy.com
+   palmtreo680 pxa270
+
 Kristoffer Ericson kristoffer.eric...@gmail.com
 
jornada SA1110
diff --git a/board/palmtreo680/Makefile b/board/palmtreo680/Makefile
new file mode 100644
index 000..34ffb99
--- /dev/null
+++ b/board/palmtreo680/Makefile
@@ -0,0 +1,34 @@
+#
+# Palm Treo680 Support
+#
+# Copyright (C) 2013 Mike Dunn miked...@newsguy.com
+#
+# This file is released under the terms of GPL v2 and any later version.
+# See the file COPYING in the root directory of the source tree for details.
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := palmtreo680.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+clean:
+   rm -f $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/palmtreo680/README b/board/palmtreo680/README
new file mode 100644
index 000..159f1f6
--- /dev/null
+++ b/board/palmtreo680/README
@@ -0,0 +1,581 @@
+
+README for the Palm Treo 680.
+
+Copyright (C) 

[U-Boot] [PATCH v6 0/2] pxa: add support for palmtreo680 board

2013-06-18 Thread Mike Dunn
These two patches add support for the Palm Treo 680 phone.  The second patch
provides a userspace utility that is needed to program u-boot to the docg4 nand
flash in the manner required by the phone's IPL.

Marek, I thought that these patches were in your tree when you issued the PR a
few weeks ago, but I must have been mistaken.  Sorry.

I would have labeled these patches RESEND, but since I submitted v5 I learned
that README files now go into the board/ directory, so I made that change and
called it v6.  Each patch contains its full changelog.

Thanks!

Mike Dunn (2):
  pxa: add support for palmtreo680 board
  pxa: palmtreo680 flash programming utility

 CREDITS  |4 +
 MAINTAINERS  |3 +
 board/palmtreo680/Makefile   |   34 +++
 board/palmtreo680/README |  581 ++
 board/palmtreo680/palmtreo680.c  |  148 ++
 boards.cfg   |1 +
 include/configs/palmtreo680.h|  286 +++
 tools/palmtreo680/flash_u-boot.c |  177 
 8 files changed, 1234 insertions(+), 0 deletions(-)
 create mode 100644 board/palmtreo680/Makefile
 create mode 100644 board/palmtreo680/README
 create mode 100644 board/palmtreo680/palmtreo680.c
 create mode 100644 include/configs/palmtreo680.h
 create mode 100644 tools/palmtreo680/flash_u-boot.c

-- 
1.7.8.6

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


[U-Boot] [PATCH v6 2/2] pxa: palmtreo680 flash programming utility

2013-06-18 Thread Mike Dunn
This adds a userspace linux utility that writes the u-boot image to an mtd
partition on the docg4 nand flash.

A special utility is required to do this because u-boot is partially loaded by
an initial program loader (IPL) that is permanently programmed to the boot
region of the flash.  This IPL expects the image to be written in a unique
format. The characteristics of this format can be summarized as follows:
  - Flash blocks to be loaded must have a magic number in the oob bytes of the
first page of the block.
  - Each page must be written redundantly in the subsequent page.
  - The integrated flash controller's reliable mode is used, requiring that
alternate 2k regions (4 pages) are skipped when writing.
For these reasons, a u-boot image can not be written using nandwrite from
mtd-utils.

Signed-off-by: Mike Dunn miked...@newsguy.com
---
Changelog:
  v6: no change
  v5: on error, return a sensible errno.h code
  v4:
- use return instead of exit
- use calloc() instead of malloc()
- remove call to read() from within while loop test 
  v3: new patch; split off from patch 7 in v2 of patchset

 tools/palmtreo680/flash_u-boot.c |  177 ++
 1 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 tools/palmtreo680/flash_u-boot.c

diff --git a/tools/palmtreo680/flash_u-boot.c b/tools/palmtreo680/flash_u-boot.c
new file mode 100644
index 000..3d8296f
--- /dev/null
+++ b/tools/palmtreo680/flash_u-boot.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2013 Mike Dunn miked...@newsguy.com
+ *
+ * This file is released under the terms of GPL v2 and any later version.
+ * See the file COPYING in the root directory of the source tree for details.
+ *
+ *
+ * This is a userspace Linux utility that, when run on the Treo 680, will
+ * program u-boot to flash.  The docg4 driver *must* be loaded with the
+ * reliable_mode and ignore_badblocks parameters enabled:
+ *
+ *modprobe docg4 ignore_badblocks=1 reliable_mode=1
+ *
+ * This utility writes the concatenated spl + u-boot image to the start of the
+ * mtd device in the format expected by the IPL/SPL.  The image file and mtd
+ * device node are passed to the utility as arguments.  The blocks must have
+ * been erased beforehand.
+ *
+ * When you compile this, note that it links to libmtd from mtd-utils, so 
ensure
+ * that your include and lib paths include this.
+ */
+
+#include stdio.h
+#include stdlib.h
+#include sys/stat.h
+#include fcntl.h
+#include string.h
+#include sys/types.h
+#include unistd.h
+#include errno.h
+#include mtd/mtd-user.h
+#include libmtd.h
+
+#define RELIABLE_BLOCKSIZE  0x1 /* block capacity in reliable mode */
+#define STANDARD_BLOCKSIZE  0x4 /* block capacity in normal mode */
+#define PAGESIZE 512
+#define PAGES_PER_BLOCK 512
+#define OOBSIZE 7  /* available to user (16 total) */
+
+uint8_t ff_oob[OOBSIZE] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+/* this is the magic number the IPL looks for (ASCII BIPO) */
+uint8_t page0_oob[OOBSIZE] = {'B', 'I', 'P', 'O', 0xff, 0xff, 0xff};
+
+int main(int argc, char * const argv[])
+{
+   int devfd, datafd, num_blocks, block;
+   off_t file_size;
+   libmtd_t mtd_desc;
+   struct mtd_dev_info devinfo;
+   uint8_t *blockbuf;
+   char response[8];
+
+   if (argc != 3) {
+   printf(usage: %s image file mtd dev node\n, argv[0]);
+   return -EINVAL;
+   }
+
+   mtd_desc = libmtd_open();
+   if (mtd_desc == NULL) {
+   int errsv = errno;
+   fprintf(stderr, can't initialize libmtd\n);
+   return -errsv;
+   }
+
+   /* open the spl image file and mtd device */
+   datafd = open(argv[1], O_RDONLY);
+   if (datafd == -1) {
+   int errsv = errno;
+   perror(argv[1]);
+   return -errsv;
+   }
+   devfd = open(argv[2], O_WRONLY);
+   if (devfd == -1) {
+   int errsv = errno;
+   perror(argv[2]);
+   return -errsv;
+   }
+   if (mtd_get_dev_info(mtd_desc, argv[2], devinfo)  0) {
+   int errsv = errno;
+   perror(argv[2]);
+   return -errsv;
+   }
+
+   /* determine the number of blocks needed by the image */
+   file_size = lseek(datafd, 0, SEEK_END);
+   if (file_size == (off_t)-1) {
+   int errsv = errno;
+   perror(lseek);
+   return -errsv;
+   }
+   num_blocks = (file_size + RELIABLE_BLOCKSIZE - 1) / RELIABLE_BLOCKSIZE;
+   file_size = lseek(datafd, 0, SEEK_SET);
+   if (file_size == (off_t)-1) {
+   int errsv = errno;
+   perror(lseek);
+   return -errsv;
+   }
+   printf(The mtd partition contains %d blocks\n, devinfo.eb_cnt);
+   printf(U-boot will occupy %d blocks\n, num_blocks);
+   if (num_blocks  devinfo.eb_cnt) {
+   fprintf(stderr, 

Re: [U-Boot] Bug in fdt_fixup_fman_firmware

2013-06-18 Thread Andy Fleming
 --- a/arch/powerpc/cpu/mpc85xx/fdt.c
 +++ b/arch/powerpc/cpu/mpc85xx/fdt.c
 @@ -492,7 +492,7 @@
   if (!p)
   return;

 - fmanfw = (struct qe_firmware *) simple_strtoul(p, NULL, 0);
 + fmanfw = (struct qe_firmware *) simple_strtoul(p, NULL, 16);
   if (!fmanfw)
   return;



Could you submit this second one as a proper patch?

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


Re: [U-Boot] [PATCH 2/2] powerpc/c29xpcie: add support for C29XPCIE board

2013-06-18 Thread Andy Fleming
On Wed, Apr 24, 2013 at 2:14 AM, Po Liu po@freescale.com wrote:

 From: Mingkai Hu mingkai...@freescale.com

 C29XPCIE board is a series of Freescale PCIe add-in cards to perform
 as public key crypto accelerator or secure key management module. It
 includes C293PCIE board, C293PCIE board and C291PCIE board.

  - 512KB platform SRAM in addition to 512K L2 Cache/SRAM
  - 512MB soldered DDR3 32bit memory
  - CPLD System Logic
  - 64MB x16 NOR flash and 4GB x8 NAND flash
  - 16MB SPI flash

 Signed-off-by: Mingkai Hu mingkai...@freescale.com
 Singed-off-by: Po Liu po@freescale.com
 ---


[...]


 diff --git a/boards.cfg b/boards.cfg
 index 8b7933f..c35c9bf 100644
 --- a/boards.cfg
 +++ b/boards.cfg
 @@ -758,6 +758,12 @@ MPC8569MDS_NAND  powerpc mpc85xx
 mpc8569mds  freesca
  MPC8572DSpowerpc mpc85xx mpc8572ds
 freescale  -   MPC8572DS
  MPC8572DS_36BIT  powerpc mpc85xx mpc8572ds
 freescale  -   MPC8572DS:36BIT
  MPC8572DS_NAND   powerpc mpc85xx mpc8572ds
 freescale  -   MPC8572DS:NAND
 +C291PCIE powerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C291PCIE,36BIT
 +C291PCIE_SPIFLASHpowerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C291PCIE,36BIT,SPIFLASH
 +C292PCIE powerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C292PCIE,36BIT
 +C292PCIE_SPIFLASHpowerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C292PCIE,36BIT,SPIFLASH
 +C293PCIE powerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C293PCIE,36BIT
 +C293PCIE_SPIFLASHpowerpc mpc85xx c29xpcie
  freescale  -   C29XPCIE:C293PCIE,36BIT,SPIFLASH



There's no reason to create 6 different build targets for these boards.
Just use the two:

C29XPCIE
C29XPCIE_SPIFLASH



  P1010RDB_36BIT_NAND  powerpc mpc85xx p1010rdb
  freescale  -   P1010RDB:P1010RDB,36BIT,NAND
  P1010RDB_36BIT_NAND_SECBOOT  powerpc mpc85xx p1010rdb
  freescale  -   P1010RDB:P1010RDB,36BIT,NAND_SECBOOT,SECURE_BOOT
  P1010RDB_36BIT_NOR   powerpc mpc85xx p1010rdb
  freescale  -   P1010RDB:P1010RDB,36BIT
 diff --git a/include/configs/C29XPCIE.h b/include/configs/C29XPCIE.h
 new file mode 100644
 index 000..0061426
 --- /dev/null
 +++ b/include/configs/C29XPCIE.h
 @@ -0,0 +1,562 @@
 +/*
 + * Copyright 2013 Freescale Semiconductor, Inc.
 + *
 + * 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
 + */
 +
 +/*
 + * C29XPCIE board configuration file
 + */
 +
 +#ifndef __CONFIG_H
 +#define __CONFIG_H
 +
 +#ifdef CONFIG_36BIT
 +#define CONFIG_PHYS_64BIT
 +#endif
 +
 +#ifdef CONFIG_C291PCIE
 +#define CONFIG_C291
 +#endif
 +
 +#ifdef CONFIG_C292PCIE
 +#define CONFIG_C292
 +#endif
 +
 +#ifdef CONFIG_C293PCIE
 +#define CONFIG_C293
 +#endif
 +
 +#if defined(CONFIG_C291) || defined(CONFIG_C292) || defined(CONFIG_C293)
 +#define CONFIG_C29X
 +#endif



Here's just one reason why all those targets are excessive. Especially
since there's only *one* consumer of CONFIG_C291/2/3, and that consumer
just defines a constant that currently has no consumers.

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


Re: [U-Boot] [PATCH 1/2] powerpc/85xx: Add C29x SoC support

2013-06-18 Thread Andy Fleming
On Wed, Apr 24, 2013 at 2:14 AM, Po Liu po@freescale.com wrote:

 From: Mingkai Hu mingkai...@freescale.com

 The Freescale C29x family is a high performance crypto co-processor.
 It combines a single e500v2 core with necessary SEC engine. There're
 three SoC types(C291, C292, C293) with the following features:

  - 512K L2 Cache/SRAM and 512 KB platform SRAM
  - DDR3/DDR3L 32bit DDR controller
  - One PCI express (x1, x2, x4) Gen 2.0 Controller
  - Trust Architecture 2.0
  - SEC6.0 engine


[...]


 diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c
 b/arch/powerpc/cpu/mpc8xxx/cpu.c
 index 39525fb..478a852 100644
 --- a/arch/powerpc/cpu/mpc8xxx/cpu.c
 +++ b/arch/powerpc/cpu/mpc8xxx/cpu.c
 @@ -88,6 +88,9 @@ static struct cpu_type cpu_type_list[] = {
 CPU_TYPE_ENTRY(BSC9131, 9131, 1),
 CPU_TYPE_ENTRY(BSC9132, 9132, 2),
 CPU_TYPE_ENTRY(BSC9232, 9232, 2),
 +   CPU_TYPE_ENTRY(C291, C291, 1),
 +   CPU_TYPE_ENTRY(C292, C292, 1),
 +   CPU_TYPE_ENTRY(C293, C293, 1),
  #elif defined(CONFIG_MPC86xx)
 CPU_TYPE_ENTRY(8610, 8610, 1),
 CPU_TYPE_ENTRY(8641, 8641, 2),
 diff --git a/arch/powerpc/include/asm/config_mpc85xx.h
 b/arch/powerpc/include/asm/config_mpc85xx.h
 index d57c178..0ec0940 100644
 --- a/arch/powerpc/include/asm/config_mpc85xx.h
 +++ b/arch/powerpc/include/asm/config_mpc85xx.h
 @@ -587,6 +587,26 @@
  #define CONFIG_SYS_FSL_ERRATUM_A_004934
  #define CONFIG_SYS_CCSRBAR_DEFAULT 0xfe00

 +#elif defined(CONFIG_C29X)
 +#define CONFIG_MAX_CPUS1
 +#define CONFIG_FSL_SDHC_V2_3
 +#define CONFIG_SYS_FSL_NUM_LAWS12
 +#define CONFIG_SYS_PPC_E500_DEBUG_TLB  3
 +#define CONFIG_TSECV2_1
 +#define CONFIG_SYS_FSL_SEC_COMPAT  6
 +#define CONFIG_SYS_FSL_ERRATUM_ESDHC111
 +#define CONFIG_NUM_DDR_CONTROLLERS 1
 +#define CONFIG_SYS_FSL_IFC_BANK_COUNT  8
 +#define CONFIG_SYS_CCSRBAR_DEFAULT 0xff70
 +
 +#if defined(CONFIG_C293)
 +#define CONFIG_SYS_FSL_SEC_NUM 3
 +#elif defined(CONFIG_C292)
 +#define CONFIG_SYS_FSL_SEC_NUM 2
 +#elif defined(CONFIG_C291)
 +#define CONFIG_SYS_FSL_SEC_NUM 1
 +#endif


Could you find a different way to do this? It's a bit absurd that we have
to have 3 different build targets for devices which are the same (from the
point of view of u-boot) except for this one constant. Especially since the
variant can be determined at run-time via SVR. Also, CONFIG_SYS_FSL_SEC_NUM
doesn't appear to be used anywhere...

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


Re: [U-Boot] MIPI-CSI Support question

2013-06-18 Thread Andy Fleming
On Thu, Apr 25, 2013 at 4:07 AM, tiger...@viatech.com.cn wrote:

 Hi, experts:
 MIPI(Mobile Industry Processor Interface) has defined many mobile device
 interface.
 Such as:
 CSI --- for Camera
 DSI --- for Display

 It seems DSI has samples on Exynos board.(in drivers\video directory)
 I want to know the status about CSI support in u-boot.
 Is there any samples in u-boot source code?


Please do not create a new message by replying to an unrelated one. Your
message contains:

In-Reply-To: 1366876271-24213-1-git-send-email-x@freescale.com

This means this whole, unrelated conversation has been logged into
patchworks as part of a conversation about a patch. Also, naive mail
clients will have difficulty with threading when the two conversations
appear to be related.

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


Re: [U-Boot] mtd: nand: fix initialization of BBT options

2013-06-18 Thread Scott Wood
On Sat, Jun 08, 2013 at 11:00:15PM +0200, Daniel Schwierzeck wrote:
 commit dfe64e2c89731a3f9950d7acd8681b68df2bae03
 Author: Sergey Lapin sla...@ossfans.org
 Date:   Mon Jan 14 03:46:50 2013 +
 
 mtd: resync with Linux-3.7.1
 
 changed the initialization of BBT options. Fix drivers
 jz4740 and s3c2410 which have not been updated yet and
 cause compile errors.
 
 Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com

Thanks -- I missed jz4740 because I don't have a MIPS toolchain, and
s3c2410 because CONFIG_S3C2410_NAND_BBT is not defined in any config.

Applied to u-boot-nand-flash.

-Scott

___
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-18 Thread Wolfgang Denk
Dear Masahiro Yamada,

In message 20130618143710.7439.aa925...@jp.panasonic.com you wrote:
 
 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).

Correct.  I fixed the page by making theedit that was forgotten when
the MW was closed.

 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?

No.  We forgot to edit this part of the page, so the end of the MW was
that of the previous release.  This error is even older than May 11.

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

Come on, please be fair.  It's humans (in this case me) who can make
errors, in in this case I missed to edit a line of text.  This is bad
and should not happen, but it can happen.  You are the first to
notice...

If you go further back in the version history of the page you can see
the original release plan.  In this case, we even shifted the end of
the MW by a few days, as you can see here:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/159294

In general, the release schedule is based on very simple arithmetics:

- We release every 3 months.

- As release date we chose a Monday around mid-month.

- The merge window ends at Release Date + 19 days, i. e. on the
  Saturday in the 2nd week after the release.

Please don't hesitate toask if there are still any remaining doubts
about the U-Boot release schedule.

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
It is easier to change the specification to fit the program than vice
versa.
___
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-18 Thread Stephen Warren
On 06/16/2013 04:30 AM, Thierry Reding wrote:
 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.

Interesting. I see this exact same issue on Dalmore (Tegra114) with my
SD card reader too. I tried inserting a 1000ms delay at the end of
ehci_hcd_init() and that solves the problem for me too.

I already have 020bbcb usb: hub: Power-cycle on root-hub ports
reverted locally, although when I reverted it, IIRC there was a
conflict, so it's possible I just hacked around that and ended up
reverting all/part of 0bf796f usb: hub: Parallelize power-cycling of
root-hub ports too; see my branch at:

git://github.com:swarren/u-boot.git mainline_dev

... if you want to see the revert (about 8 commits down).

Another interesting aspect to this: An NVIDIA intern is trying to get
the Linux Tegra USB driver working on Tegra114. All the devices we've
tried except this SD card reader work fine with that driver, so
there's obviously something quirky with it. However, once I've run
usb start twice in U-Boot, or added the mdelay() to U-Boot and run
usb start once in U-Boot, then the kernel driver works with the
problematic SD card reader...
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] please pull u-boot-samsung master

2013-06-18 Thread Minkyu Kang
On 18/06/13 23:57, Albert ARIBAUD wrote:
 Hi Minkyu,
 
 On Mon, 17 Jun 2013 13:16:20 +0530, Jagan Teki
 jagannadh.t...@gmail.com wrote:
 
 On Mon, Jun 17, 2013 at 7:40 AM, Minkyu Kang mk7.k...@samsung.com wrote:
 Dear Albert,

 The following changes since commit d0a51373131c4ba565a2391d5ed78b87c406ce98:

   at91sam9260ek: move board id setup to config header (2013-05-12 16:49:14 
 +0200)

 are available in the git repository at:

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

 for you to fetch changes up to ed7bdc03eb516fb698ccc12ec5b4b9f132d05c5f:

   MMC: DWMMC: Fix FIFO_DEPTH calculation (2013-06-17 11:03:42 +0900)

 
 Akshay Saraswat (2):
   Exynos5: clock: Update the equation to calculate PLL output frequency
   Exynos: uart: s5p: enabling the uart tx/rx fifo

 Amar (9):
   FDT: Add compatible string for DWMMC
   EXYNOS5: FDT: Add DWMMC device node data
   DWMMC: Initialise dwmci and resolve EMMC read write issues
   EXYNOS5: DWMMC: Added FDT support for DWMMC
   EXYNOS5: DWMMC: Initialise the local variable to avoid unwanted 
 results.
   SMDK5250: Initialise and Enable DWMMC, support FDT and non-FDT
   MMC: APIs to support resize of EMMC boot partition
   SMDK5250: Enable EMMC booting
   COMMON: MMC: Command to support EMMC booting and to resize EMMC boot 
 partition

 Arkadiusz Wlodarczyk (1):
   arm:trats: change auto-booting to boot kernel with separate device 
 tree blob

 Inderpal Singh (3):
   exynos: move tzpc_init to armv7/exynos
   exynos: update tzpc to make it common for exynos4 and exynos5
   exynos: Update origen and smdkv310 to use common tzpc_init

 Naveen Krishna Chatradhi (2):
   power: exynos-tmu: fix warnings and clean up code
   power: exynos-tmu: use the mux_addr bit fields in tmu_control register

 Rajeshwari Shinde (3):
   SF: Add driver for Gigabyte device GD25LQ and GD25Q64B
   SMDK5250: Enable SPI Gigabyte device.

 SPI gigabyte flash driver is not available in drivers/mtd/spi/
 Am i missing anything here, please help.

gigabyte flash driver is available in drivers/mtd/spi/
please refer below link.
http://git.denx.de/?p=u-boot/u-boot-samsung.git;a=blob;f=drivers/mtd/spi/gigadevice.c;
 
 So, Minkyu, should I pick this PR or wait for an update?

Please pick this PR.

 
 Amicalement,
 

Thanks,
Minkyu Kang.
___
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-18 Thread Masahiro Yamada
Hi Wolfgang,


I could understood what happened up until now.

I couldn't say properly, I did not mean to critisize
but wanted to know things precisely.


 You are the first to notice...

Before starting to post my patches,
I read though the wiki and tried to observe the rules.

Especailly after reading this
http://thread.gmane.org/gmane.linux.network/104943/focus=104951
Maybe I became a little nervous about the MW.


Let me ask one more question.

How strict is the MW rule in U-Boot development?

I can't say for sure because I'm quite new here,
but the development looks (at least to me)
to keep going regardless of the MW status.


Best Regards
Masahiro Yamada

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


[U-Boot] [PATCH v3 0/16] Driver model implementation, tests, demo and GPIO

2013-06-18 Thread Simon Glass

Note: If you are reviewing this code, but don't have a lot of time, please
consider starting with the 'demo' driver (patch 'dm: Add a
demonstration/example driver') since it clearly shows how devices and
uclasses work. Much of this series consists of test code and plumbing, so
is of less interest to driver authors.

This patch adds a driver model implementation. It is taken from
the driver model code developed by:

   Marek Vasut ma...@denx.de
   Pavel Herrmann morpheus.i...@gmail.com
   Viktor Křivák viktor.kri...@gmail.com
   Tomas Hlavacek tmshl...@gmail.com

Please see doc/driver-model/README.txt for details of how to run this and
what to look for. So far the documentation in doc/driver-model has not
been updated.

You can find a test version of the code used here in branch dm2 at:

   http://git.denx.de/u-boot-x86.git

(Branch dm contains the original implementation)

Changes in v3:
- Add new patch to build a device tree file for sandbox
- Tidy up commenting of functions and structures
- Rename per_device_priv_size to per_device_auto_alloc_size, etc.
- Add a flag for tracking whether DM allocates/frees platform_data
- Add function/struct comments to tests
- Fix up demo command help
- Update demo driver to use device tree
- Update GPIO support to use new struct member names
- Tidy up comments/documentation in GPIO module
- Update sandbox GPIO header file comments
- Updated README.txt to cover changes since version 2
- Add new patch to move driver model documentation

Changes in v2:
- Removed pointer return values in favour of integer
- Use driver_bind() in dm_init() instead of writing new code
- Allow driver_bind() to support a NULL parent
- Add dm_warn() to warn about impending doom
- Standardise variable names (e.g. uclass instead of class)
- Remove relocation functions
- Add new header file for lists
- Add new util file to hold utility functions
- Allow a driver to bind to only one uclass
- Remove unneeded arguments to uclass_bind(), uclass_unbind()
- Rename struct device's 'bus' to 'parent'
- Rename data structures to hopefully be clearer
- Put platform_data definitions in their own header file
- Add U_BOOT_DEVICE to declare platform_data
- Add auto-probing feature for platform_data to avoid driver_bind() calls
- Add simple unit test functions
- Add test infrastructure for driver model
- Add integration tests for driver model
- Add device tree support in driver model
- Add automatic allocation of platform_data for FDT
- Add automatic allocation of priv data for devices
- Add automatic allocation of device-specific priv data for uclasses
- Add GPIO uclass and tests
- Add sandbox GPIO driver
- Update gpio command to use driver model
- Add tests for core code
- Add script to run tests
- Add a single include/dm.h to bring in driver model code

Pavel Herrmann (1):
  dm: Add README for driver model

Simon Glass (15):
  sandbox: Make map_to_sysmem() use a constant pointer
  sandbox: Correct data sizes and printf() strings in fdtdec.c
  sandbox: config: Don't use 64-bit physical memory
  sandbox: Build a device tree file for sandbox
  Add cmd_process_error() to report and process errors
  sandbox: config: Enable driver model
  dm: Add base driver model support
  dm: Set up driver model after relocation
  dm: Add basic tests
  dm: Add a 'dm' command for testing
  dm: Add a demonstration/example driver
  dm: Add GPIO support and tests
  sandbox: Convert GPIOs to use driver model
  dm: Enable gpio command to support driver model
  dm: Move old driver model documentation into an 'old-docs' directory

 Makefile |   5 +
 arch/sandbox/config.mk   |   2 +
 arch/sandbox/include/asm/gpio.h  |  14 +-
 arch/sandbox/include/asm/io.h|   2 +-
 arch/sandbox/include/asm/types.h |   4 +-
 board/sandbox/dts/sandbox.dts|  20 +
 board/sandbox/sandbox/sandbox.c  |   7 +-
 common/Makefile  |   1 +
 common/board_r.c |  33 ++
 common/cmd_demo.c| 115 +
 common/cmd_gpio.c| 127 +-
 common/command.c |  10 +
 common/dm/Makefile   |  43 ++
 common/dm/device.c   | 331 ++
 common/dm/lists.c| 168 +++
 common/dm/root.c | 115 +
 common/dm/uclass.c   | 298 
 common/dm/util.c |  50 ++
 doc/driver-model/README.txt  | 320 +
 doc/driver-model/old-docs/README |  29 ++
 doc/driver-model/{ = old-docs}/UDM-block.txt|   0
 doc/driver-model/{ = old-docs}/UDM-cores.txt|   0
 doc/driver-model/{ = old-docs}/UDM-design.txt   |   0
 doc/driver-model/{ = old-docs}/UDM-fpga.txt

[U-Boot] [PATCH v3 08/16] dm: Set up driver model after relocation

2013-06-18 Thread Simon Glass
Make driver model available after relocation, by setting up data structures
and scanning for devices using compiled-in platform_data and (when available)
the device tree.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 common/board_r.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/common/board_r.c b/common/board_r.c
index f5649c9..5fe86ef 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -34,6 +34,7 @@
 #ifdef CONFIG_HAS_DATAFLASH
 #include dataflash.h
 #endif
+#include dm.h
 #include environment.h
 #include fdtdec.h
 #if defined(CONFIG_CMD_IDE)
@@ -66,7 +67,9 @@
 #ifdef CONFIG_X86
 #include asm/init_helpers.h
 #endif
+#include dm/root.h
 #include linux/compiler.h
+#include linux/err.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -269,6 +272,33 @@ static int initr_malloc(void)
return 0;
 }
 
+#ifdef CONFIG_DM
+static int initr_dm(void)
+{
+   int ret;
+
+   ret = dm_init();
+   if (ret) {
+   debug(dm_init() failed: %d\n, ret);
+   return ret;
+   }
+   ret = dm_scan_platform_data();
+   if (ret) {
+   debug(dm_scan_platform_data() failed: %d\n, ret);
+   return ret;
+   }
+#ifdef CONFIG_OF_CONTROL
+   ret = dm_scan_fdt(gd-fdt_blob);
+   if (ret) {
+   debug(dm_scan_fdt() failed: %d\n, ret);
+   return ret;
+   }
+#endif
+
+   return 0;
+}
+#endif
+
 __weak int power_init_board(void)
 {
return 0;
@@ -766,6 +796,9 @@ init_fnc_t init_sequence_r[] = {
initr_barrier,
initr_malloc,
bootstage_relocate,
+#ifdef CONFIG_DM
+   initr_dm,
+#endif
 #ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r,
 #endif
-- 
1.8.3

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


[U-Boot] [PATCH v3 01/16] sandbox: Make map_to_sysmem() use a constant pointer

2013-06-18 Thread Simon Glass
Very often a constant pointer is passed to this function, so we should
declare this, since map_to_sysmem() does not change the pointer.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 arch/sandbox/include/asm/io.h | 2 +-
 include/common.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 0c022f1..321bc0d 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -54,6 +54,6 @@ static inline void unmap_sysmem(const void *vaddr)
 }
 
 /* Map from a pointer to our RAM buffer */
-phys_addr_t map_to_sysmem(void *ptr);
+phys_addr_t map_to_sysmem(const void *ptr);
 
 #endif
diff --git a/include/common.h b/include/common.h
index 126891d..ad3a64b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -926,7 +926,7 @@ static inline void unmap_sysmem(const void *vaddr)
 {
 }
 
-static inline phys_addr_t map_to_sysmem(void *ptr)
+static inline phys_addr_t map_to_sysmem(const void *ptr)
 {
return (phys_addr_t)(uintptr_t)ptr;
 }
-- 
1.8.3

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


[U-Boot] [PATCH v3 13/16] sandbox: Convert GPIOs to use driver model

2013-06-18 Thread Simon Glass
Convert sandbox over to use driver model GPIOs.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Update sandbox GPIO header file comments

Changes in v2: None

 arch/sandbox/include/asm/gpio.h |  14 +--
 board/sandbox/sandbox/sandbox.c |   7 +-
 drivers/gpio/sandbox.c  | 210 +---
 include/configs/sandbox.h   |   1 +
 4 files changed, 144 insertions(+), 88 deletions(-)

diff --git a/arch/sandbox/include/asm/gpio.h b/arch/sandbox/include/asm/gpio.h
index 0500c53..33a9929 100644
--- a/arch/sandbox/include/asm/gpio.h
+++ b/arch/sandbox/include/asm/gpio.h
@@ -45,7 +45,7 @@
  * @param gp   GPIO number
  * @return -1 on error, 0 if GPIO is low, 0 if high
  */
-int sandbox_gpio_get_value(unsigned gp);
+int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
 
 /**
  * Set the simulated value of a GPIO (used only in sandbox test code)
@@ -54,7 +54,7 @@ int sandbox_gpio_get_value(unsigned gp);
  * @param valuevalue to set (0 for low, non-zero for high)
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_value(unsigned gp, int value);
+int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
 
 /**
  * Return the simulated direction of a GPIO (used only in sandbox test code)
@@ -62,7 +62,7 @@ int sandbox_gpio_set_value(unsigned gp, int value);
  * @param gp   GPIO number
  * @return -1 on error, 0 if GPIO is input, 0 if output
  */
-int sandbox_gpio_get_direction(unsigned gp);
+int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
 
 /**
  * Set the simulated direction of a GPIO (used only in sandbox test code)
@@ -71,11 +71,7 @@ int sandbox_gpio_get_direction(unsigned gp);
  * @param output 0 to set as input, 1 to set as output
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_direction(unsigned gp, int output);
-
-/* Display information about each GPIO */
-void gpio_info(void);
-
-#define gpio_status()  gpio_info()
+int sandbox_gpio_set_direction(struct device *dev, unsigned int offset,
+  int output);
 
 #endif
diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
index 8bdba92..4143318 100644
--- a/board/sandbox/sandbox/sandbox.c
+++ b/board/sandbox/sandbox/sandbox.c
@@ -20,7 +20,7 @@
  */
 
 #include common.h
-
+#include dm.h
 #include os.h
 
 /*
@@ -30,6 +30,11 @@
  */
 gd_t *gd;
 
+/* Add a simple GPIO device */
+U_BOOT_DEVICE(gpio_sandbox) = {
+   .name = gpio_sandbox,
+};
+
 void flush_cache(unsigned long start, unsigned long size)
 {
 }
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 19d2db0..94a9fdd 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -20,8 +20,13 @@
  */
 
 #include common.h
+#include dm.h
+#include fdtdec.h
+#include malloc.h
 #include asm/gpio.h
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Flags for each GPIO */
 #define GPIOF_OUTPUT   (1  0)/* Currently set as an output */
 #define GPIOF_HIGH (1  1)/* Currently set high */
@@ -32,34 +37,30 @@ struct gpio_state {
u8 flags;   /* flags (GPIOF_...) */
 };
 
-/*
- * State of GPIOs
- * TODO: Put this into sandbox state
- */
-static struct gpio_state state[CONFIG_SANDBOX_GPIO_COUNT];
-
 /* Access routines for GPIO state */
-static u8 *get_gpio_flags(unsigned gp)
+static u8 *get_gpio_flags(struct device *dev, unsigned offset)
 {
-   /* assert()'s could be disabled, so make sure we handle that */
-   assert(gp  ARRAY_SIZE(state));
-   if (gp = ARRAY_SIZE(state)) {
+   struct gpio_dev_priv *uc_priv = dev-uclass_priv;
+   struct gpio_state *state = dev-priv;
+
+   if (offset = uc_priv-gpio_count) {
static u8 invalid_flags;
-   printf(sandbox_gpio: error: invalid gpio %u\n, gp);
+   printf(sandbox_gpio: error: invalid gpio %u\n, offset);
return invalid_flags;
}
 
-   return state[gp].flags;
+   return state[offset].flags;
 }
 
-static int get_gpio_flag(unsigned gp, int flag)
+static int get_gpio_flag(struct device *dev, unsigned offset, int flag)
 {
-   return (*get_gpio_flags(gp)  flag) != 0;
+   return (*get_gpio_flags(dev, offset)  flag) != 0;
 }
 
-static int set_gpio_flag(unsigned gp, int flag, int value)
+static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
+int value)
 {
-   u8 *gpio = get_gpio_flags(gp);
+   u8 *gpio = get_gpio_flags(dev, offset);
 
if (value)
*gpio |= flag;
@@ -69,11 +70,12 @@ static int set_gpio_flag(unsigned gp, int flag, int value)
return 0;
 }
 
-static int check_reserved(unsigned gpio, const char *func)
+static int check_reserved(struct device *dev, unsigned offset,
+ const char *func)
 {
-   if (!get_gpio_flag(gpio, GPIOF_RESERVED)) {
-   printf(sandbox_gpio: %s: error: gpio %u not reserved\n,
-   func, gpio);

[U-Boot] [PATCH v3 06/16] sandbox: config: Enable driver model

2013-06-18 Thread Simon Glass
Use driver model in sandbox to permit running of driver model unit test.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 include/configs/sandbox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 14f5f98..162c26c 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -22,6 +22,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_DM
+
 /* Number of bits in a C 'long' on this architecture */
 #define CONFIG_SANDBOX_BITS_PER_LONG   64
 
-- 
1.8.3

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


[U-Boot] [PATCH v3 09/16] dm: Add basic tests

2013-06-18 Thread Simon Glass
Add some tests of driver model functionality. Coverage includes:

- basic init
- binding of drivers to devices using platform_data
- automatic probing of devices when referenced
- availability of platform data to devices
- lifecycle from bind to probe to remove to unbind
- renumbering within a uclass when devices are probed/removed
- calling driver-defined operations
- deactivation of drivers when removed
- memory leak across creation and destruction of drivers/uclasses
- uclass init/destroy methods
- automatic probe/remove of children/parents when needed

This function is enabled for sandbox, using CONFIG_DM_TEST.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Add function/struct comments to tests

Changes in v2: None

 Makefile  |   1 +
 include/configs/sandbox.h |   1 +
 include/dm/test.h | 180 +++
 include/dm/ut.h   | 108 +
 test/dm/Makefile  |  52 +
 test/dm/core.c| 557 ++
 test/dm/test-driver.c | 159 +
 test/dm/test-fdt.c| 148 
 test/dm/test-main.c   | 120 ++
 test/dm/test-uclass.c | 117 ++
 test/dm/test.dts  |  59 +
 test/dm/ut.c  |  46 
 12 files changed, 1548 insertions(+)
 create mode 100644 include/dm/test.h
 create mode 100644 include/dm/ut.h
 create mode 100644 test/dm/Makefile
 create mode 100644 test/dm/core.c
 create mode 100644 test/dm/test-driver.c
 create mode 100644 test/dm/test-fdt.c
 create mode 100644 test/dm/test-main.c
 create mode 100644 test/dm/test-uclass.c
 create mode 100644 test/dm/test.dts
 create mode 100644 test/dm/ut.c

diff --git a/Makefile b/Makefile
index c1c13c8..0655c9c 100644
--- a/Makefile
+++ b/Makefile
@@ -336,6 +336,7 @@ LIBS-y += lib/libfdt/libfdt.o
 LIBS-y += api/libapi.o
 LIBS-y += post/libpost.o
 LIBS-y += test/libtest.o
+LIBS-y += test/dm/libtestdm.o
 
 LIBS-$(CONFIG_DM) += common/dm/libdm.o
 
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 162c26c..38e0384 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -23,6 +23,7 @@
 #define __CONFIG_H
 
 #define CONFIG_DM
+#define CONFIG_DM_TEST
 
 /* Number of bits in a C 'long' on this architecture */
 #define CONFIG_SANDBOX_BITS_PER_LONG   64
diff --git a/include/dm/test.h b/include/dm/test.h
new file mode 100644
index 000..fa514d8
--- /dev/null
+++ b/include/dm/test.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2013 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __DM_TEST_H
+#define __DM_TEST_H
+
+#include dm.h
+
+/**
+ * struct dm_test_cdata - configuration data for test instance
+ *
+ * @ping_add: Amonut to add each time we get a ping
+ * @base: Base address of this device
+ */
+struct dm_test_pdata {
+   int ping_add;
+   uint32_t base;
+};
+
+/**
+ * struct test_ops - Operations supported by the test device
+ *
+ * @ping: Ping operation
+ * @dev: Device to operate on
+ * @pingval: Value to ping the device with
+ * @pingret: Returns resulting value from driver
+ * @return 0 if OK, -ve on error
+ */
+struct test_ops {
+   int (*ping)(struct device *dev, int pingval, int *pingret);
+};
+
+/* Operations that our test driver supports */
+enum {
+   DM_TEST_OP_BIND = 0,
+   DM_TEST_OP_UNBIND,
+   DM_TEST_OP_PROBE,
+   DM_TEST_OP_REMOVE,
+
+   /* For uclass */
+   DM_TEST_OP_POST_BIND,
+   DM_TEST_OP_PRE_UNBIND,
+   DM_TEST_OP_POST_PROBE,
+   DM_TEST_OP_PRE_REMOVE,
+   DM_TEST_OP_INIT,
+   DM_TEST_OP_DESTROY,
+
+   DM_TEST_OP_COUNT,
+};
+
+/* Test driver types */
+enum {
+   DM_TEST_TYPE_FIRST = 0,
+   DM_TEST_TYPE_SECOND,
+};
+
+/* The number added to the ping total on each probe */
+#define DM_TEST_START_TOTAL5
+
+/**
+ * struct dm_test_priv - private data for the test devices
+ */
+struct dm_test_priv {
+   int ping_total;
+   int op_count[DM_TEST_OP_COUNT];
+};
+
+/**
+ * struct dm_test_perdev_class_priv - private per-device data for test uclass
+ */
+struct dm_test_uclass_perdev_priv {
+   int base_add;
+};
+
+/**
+ * struct dm_test_uclass_priv - private data for test uclass
+ */
+struct dm_test_uclass_priv {
+   int total_add;
+};
+
+/*

[U-Boot] [PATCH v3 05/16] Add cmd_process_error() to report and process errors

2013-06-18 Thread Simon Glass
U-Boot now uses errors defined in include/errno.h which are negative
integers. Commands which fail need to report the error and return 1
to indicate failure. Add this functionality in cmd_process_error().

For now this merely reports the error number. It would be possible
also to produce a helpful error message by storing the error strings
in U-Boot.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 common/command.c  | 10 ++
 include/command.h |  9 +
 2 files changed, 19 insertions(+)

diff --git a/common/command.c b/common/command.c
index 305a236..70faa60 100644
--- a/common/command.c
+++ b/common/command.c
@@ -554,3 +554,13 @@ enum command_ret_t cmd_process(int flag, int argc, char * 
const argv[],
rc = cmd_usage(cmdtp);
return rc;
 }
+
+int cmd_process_error(cmd_tbl_t *cmdtp, int err)
+{
+   if (err) {
+   printf(Command '%s' failed: Error %d\n, cmdtp-name, err);
+   return 1;
+   }
+
+   return 0;
+}
diff --git a/include/command.h b/include/command.h
index 65692fd..e82c555 100644
--- a/include/command.h
+++ b/include/command.h
@@ -80,6 +80,15 @@ extern int var_complete(int argc, char * const argv[], char 
last_char, int maxv,
 extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int 
*colp);
 #endif
 
+/**
+ * cmd_process_error() - report and process a possible error
+ *
+ * @cmdtp: Command which caused the error
+ * @err: Error code (0 if none, -ve for error, like -EIO)
+ * @return 0 if there is not error, 1 (CMD_RET_FAILURE) if an error is found
+ */
+int cmd_process_error(cmd_tbl_t *cmdtp, int err);
+
 /*
  * Monitor Command
  *
-- 
1.8.3

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


[U-Boot] [PATCH v3 12/16] dm: Add GPIO support and tests

2013-06-18 Thread Simon Glass
Add driver model support for GPIOs. Since existing GPIO drivers do not use
driver model, this feature must be enabled by CONFIG_DM_GPIO. After all
GPO drivers are converted over we can perhaps remove this config.

Tests are provided for the sandbox implementation, and are a sufficient
sanity check for basic operation.

The GPIO uclass understands the concept of named banks of GPIOs, with each
GPIO device providing a single bank. Within each bank the GPIOs are numbered
using an offset from 0 to n-1. For example a bank named 'b' with 20
offsets will provide GPIOs named b0 to b19.

Anonymous GPIO banks are also supported, and are just numbered without any
prefix.

Each time a GPIO driver is added to the uclass, the GPIOs are renumbered
accordinging, so there is always a global GPIO numbering order.

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Marek Vasut ma...@denx.de
Signed-off-by: Pavel Herrmann morpheus.i...@gmail.com
Signed-off-by: Viktor Křivák viktor.kri...@gmail.com
Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
---
Changes in v3:
- Update GPIO support to use new struct member names
- Tidy up comments/documentation in GPIO module

Changes in v2: None

 drivers/gpio/Makefile  |   2 +
 drivers/gpio/gpio-uclass.c | 279 +
 include/asm-generic/gpio.h | 104 +
 test/dm/gpio.c | 124 
 4 files changed, 509 insertions(+)
 create mode 100644 drivers/gpio/gpio-uclass.c
 create mode 100644 test/dm/gpio.c

diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index f77c1ec..87c8591 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -25,6 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB:= $(obj)libgpio.o
 
+COBJS-$(CONFIG_DM_GPIO)+= gpio-uclass.o
+
 COBJS-$(CONFIG_AT91_GPIO)  += at91_gpio.o
 COBJS-$(CONFIG_INTEL_ICH6_GPIO)+= intel_ich6_gpio.o
 COBJS-$(CONFIG_KIRKWOOD_GPIO)  += kw_gpio.o
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
new file mode 100644
index 000..de32e20
--- /dev/null
+++ b/drivers/gpio/gpio-uclass.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include dm.h
+#include errno.h
+#include asm/gpio.h
+
+/**
+ * gpio_to_device() - Convert global GPIO number to device, number
+ * gpio:   The numeric representation of the GPIO
+ *
+ * Convert the GPIO number to an entry in the list of GPIOs
+ * or GPIO blocks registered with the GPIO controller. Returns
+ * entry on success, NULL on error.
+ */
+static int gpio_to_device(unsigned int gpio, struct device **devp,
+ unsigned int *offset)
+{
+   struct gpio_dev_priv *uc_priv;
+   struct device *dev;
+   int ret;
+
+   for (ret = uclass_first_device(UCLASS_GPIO, dev);
+dev;
+ret = uclass_next_device(dev)) {
+   uc_priv = dev-uclass_priv;
+   if (gpio = uc_priv-gpio_base 
+   gpio  uc_priv-gpio_base + uc_priv-gpio_count) {
+   *devp = dev;
+   *offset = gpio - uc_priv-gpio_base;
+   return 0;
+   }
+   }
+
+   /* No such GPIO */
+   return ret ? ret : -EINVAL;
+}
+
+int gpio_lookup_name(const char *name, struct device **devp,
+unsigned int *offsetp, unsigned int *gpiop)
+{
+   struct gpio_dev_priv *uc_priv;
+   struct device *dev;
+   int ret;
+
+   if (devp)
+   *devp = NULL;
+   for (ret = uclass_first_device(UCLASS_GPIO, dev);
+dev;
+ret = uclass_next_device(dev)) {
+   ulong offset;
+   int len;
+
+   uc_priv = dev-uclass_priv;
+   len = uc_priv-bank_name ? strlen(uc_priv-bank_name) : 0;
+
+   if (!strncmp(name, uc_priv-bank_name, len)) {
+   if (strict_strtoul(name + len, 10, offset))
+   continue;
+   if (devp)
+   *devp = dev;
+   if (offsetp)
+   *offsetp = offset;
+   if (gpiop)
+   *gpiop = 

[U-Boot] [PATCH v3 15/16] dm: Add README for driver model

2013-06-18 Thread Simon Glass
From: Pavel Herrmann morpheus.i...@gmail.com

This adds a README to help with understanding of this series.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Updated README.txt to cover changes since version 2

Changes in v2:
- Removed pointer return values in favour of integer
- Use driver_bind() in dm_init() instead of writing new code
- Allow driver_bind() to support a NULL parent
- Add dm_warn() to warn about impending doom
- Standardise variable names (e.g. uclass instead of class)
- Remove relocation functions
- Add new header file for lists
- Add new util file to hold utility functions
- Allow a driver to bind to only one uclass
- Remove unneeded arguments to uclass_bind(), uclass_unbind()
- Rename struct device's 'bus' to 'parent'
- Rename data structures to hopefully be clearer
- Put platform_data definitions in their own header file
- Add U_BOOT_DEVICE to declare platform_data
- Add auto-probing feature for platform_data to avoid driver_bind() calls
- Add simple unit test functions
- Add test infrastructure for driver model
- Add integration tests for driver model
- Add device tree support in driver model
- Add automatic allocation of platform_data for FDT
- Add automatic allocation of priv data for devices
- Add automatic allocation of device-specific priv data for uclasses
- Add GPIO uclass and tests
- Add sandbox GPIO driver
- Update gpio command to use driver model
- Add tests for core code
- Add script to run tests
- Add a single include/dm.h to bring in driver model code

 doc/driver-model/README.txt | 320 
 1 file changed, 320 insertions(+)
 create mode 100644 doc/driver-model/README.txt

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
new file mode 100644
index 000..02106d6
--- /dev/null
+++ b/doc/driver-model/README.txt
@@ -0,0 +1,320 @@
+Driver Model
+
+
+This README contains high-level information about driver model, a unified
+way of declaring and accessing drivers in U-Boot. The original work was done
+by:
+
+   Marek Vasut ma...@denx.de
+   Pavel Herrmann morpheus.i...@gmail.com
+   Viktor Křivák viktor.kri...@gmail.com
+   Tomas Hlavacek tmshl...@gmail.com
+
+This has been both simplified and extended into the current implementation
+by:
+
+   Simon Glass s...@chromium.org
+
+
+Terminology
+---
+
+Uclass - a group of device which operate in the same way. A uclass provides
+   a way of accessing invidual devices within the group, but always
+   using the same interface. For example a GPIO uclass provides
+   operations for get/set value. An I2C uclass may have 10 I2C ports,
+   4 with one driver, and 6 with another.
+
+Driver - some code which talks to a peripheral and presents a higher-level
+   interface to it.
+
+Device - an instance of a driver, tied to a particular port or peripheral.
+
+
+How to try it
+-
+
+Build U-Boot sandbox and run it:
+
+   make sandbox_config
+   make
+   ./u-boot
+
+   (type 'reset' to exit U-Boot)
+
+
+There is a uclass called 'demo'. This uclass handles
+saying hello, and reporting its status. There are two drivers in this
+uclass:
+
+   - simple: Just prints a message for hello, doesn't implement status
+   - shape: Prints shapes and reports number of characters printed as status
+
+The demo class is pretty simple, but not trivial. The intention is that it
+can be used for testing, so it will implement all driver model features and
+provide 100% code coverage of them. It does have multiple drivers, it
+handles parameter data and platform_data (data which tells the driver how
+to operate on a particular platform) and it uses private driver data.
+
+To try it, see the example session below:
+
+=demo hello 1
+Hello '@' from 07981110: red 4
+=demo status 2
+Status: 0
+=demo hello 2
+g
+r@
+e@@
+e@@@
+n
+g@
+=demo status 2
+Status: 21
+=demo hello 4 ^
+  y^^^
+ e^
+l^^^
+l^^^
+ o^
+  w^^^
+=demo status 4
+Status: 36
+=
+
+
+Running the tests
+-
+
+The intent with driver model is that the core portion has 100% test coverage
+in sandbox, and every uclass has its own test. As a move towards this, tests
+are provided in test/dm. To run them, try:
+
+   ./test/dm/test-dm.sh
+
+
+What is going on?
+-
+
+Let's start at the top. The demo command is in common/cmd_demo.c. It does
+the usual command procesing and then:
+
+   struct device *demo_dev;
+
+   ret = uclass_get_device(UCLASS_DEMO, demo_dev);
+
+UCLASS_DEMO means the class of devices which implement 'demo'. Other
+classes might be MMC, or GPIO, hashing or serial. The idea is that the
+devices in the class all share a particular way of working. The class
+presents a unified view of all these devices to U-Boot.
+
+This function looks up the device for the demo uclass. Given a device
+number we can find the device because all devices have registered with
+the UCLASS_DEMO uclass.
+
+Having found the device, 

[U-Boot] [PATCH v3 04/16] sandbox: Build a device tree file for sandbox

2013-06-18 Thread Simon Glass
Add support for building a device tree for sandbox's CONFIG_OF_HOSTFILE
option to make it easier to use device tree with sandbox.

This adjusts the Makefile to build a u-boot.dtb file which can be passed
to sandbox U-Boot with:

   ./u-boot -d u-boot.dtb

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Add new patch to build a device tree file for sandbox

Changes in v2: None

 Makefile  |  1 +
 arch/sandbox/config.mk|  2 ++
 board/sandbox/dts/sandbox.dts | 20 
 include/configs/sandbox.h |  1 +
 4 files changed, 24 insertions(+)
 create mode 100644 board/sandbox/dts/sandbox.dts

diff --git a/Makefile b/Makefile
index 693b3f2..ed8068b 100644
--- a/Makefile
+++ b/Makefile
@@ -413,6 +413,7 @@ ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
+ALL-$(CONFIG_OF_HOSTFILE) += $(obj)u-boot.dtb
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ,,$(CONFIG_SPL_TARGET))
 endif
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 988b52c..52d164f 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -23,3 +23,5 @@ PLATFORM_LIBS += -lrt
 
 # Support generic board on sandbox
 __HAVE_ARCH_GENERIC_BOARD := y
+
+CONFIG_ARCH_DEVICE_TREE := sandbox
diff --git a/board/sandbox/dts/sandbox.dts b/board/sandbox/dts/sandbox.dts
new file mode 100644
index 000..96a4438
--- /dev/null
+++ b/board/sandbox/dts/sandbox.dts
@@ -0,0 +1,20 @@
+/dts-v1/;
+
+/ {
+   triangle {
+   compatible = demo-shape;
+   colour = cyan;
+   sides = 3;
+   character = 83;
+   };
+   square {
+   compatible = demo-shape;
+   colour = blue;
+   sides = 4;
+   };
+   hexagon {
+   compatible = demo-simple;
+   colour = white;
+   sides = 6;
+   };
+};
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 78eda90..14f5f98 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -31,6 +31,7 @@
 #define CONFIG_LMB
 #define CONFIG_FIT
 #define CONFIG_CMD_FDT
+#define CONFIG_DEFAULT_DEVICE_TREE sandbox
 
 #define CONFIG_FS_FAT
 #define CONFIG_FS_EXT4
-- 
1.8.3

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


[U-Boot] [PATCH v3 16/16] dm: Move old driver model documentation into an 'old-docs' directory

2013-06-18 Thread Simon Glass
This documentation is still useful but is not fully correct with the API
changes since the original driver model implementation. So move it into
a separate directory, and create a README to describe what is going on.

This documentation pertains to the planned implementation of driver model
in U-Boot for each subsystem. It is probably better to have this
documentation in the source code for each subsystem where possible, so
that docbook will pick it up. Where this does not make sense, new
documentation can be placed in some suitable file in doc/driver-model.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Add new patch to move driver model documentation

Changes in v2: None

 doc/driver-model/old-docs/README | 29 
 doc/driver-model/{ = old-docs}/UDM-block.txt|  0
 doc/driver-model/{ = old-docs}/UDM-cores.txt|  0
 doc/driver-model/{ = old-docs}/UDM-design.txt   |  0
 doc/driver-model/{ = old-docs}/UDM-fpga.txt |  0
 doc/driver-model/{ = old-docs}/UDM-gpio.txt |  0
 doc/driver-model/{ = old-docs}/UDM-hwmon.txt|  0
 doc/driver-model/{ = old-docs}/UDM-keyboard.txt |  0
 doc/driver-model/{ = old-docs}/UDM-mmc.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-net.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-pci.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-pcmcia.txt   |  0
 doc/driver-model/{ = old-docs}/UDM-power.txt|  0
 doc/driver-model/{ = old-docs}/UDM-rtc.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-serial.txt   |  0
 doc/driver-model/{ = old-docs}/UDM-spi.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-stdio.txt|  0
 doc/driver-model/{ = old-docs}/UDM-tpm.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-twserial.txt |  0
 doc/driver-model/{ = old-docs}/UDM-usb.txt  |  0
 doc/driver-model/{ = old-docs}/UDM-video.txt|  0
 doc/driver-model/{ = old-docs}/UDM-watchdog.txt |  0
 22 files changed, 29 insertions(+)
 create mode 100644 doc/driver-model/old-docs/README
 rename doc/driver-model/{ = old-docs}/UDM-block.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-cores.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-design.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-fpga.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-gpio.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-hwmon.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-keyboard.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-mmc.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-net.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-pci.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-pcmcia.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-power.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-rtc.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-serial.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-spi.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-stdio.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-tpm.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-twserial.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-usb.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-video.txt (100%)
 rename doc/driver-model/{ = old-docs}/UDM-watchdog.txt (100%)

diff --git a/doc/driver-model/old-docs/README b/doc/driver-model/old-docs/README
new file mode 100644
index 000..0de03bf
--- /dev/null
+++ b/doc/driver-model/old-docs/README
@@ -0,0 +1,29 @@
+The U-Boot Driver Model Project
+===
+
+This directory contains the original driver model documents. The documents
+are still useful and relevant, but some of the terminology has changed,
+and some of the APIs are a little different.
+
+The changes (which are not reflected in the docs in this directory) are:
+
+- Tried to agressively remove boilerplate, so that for most drivers there
+is little or no 'driver model' code to write.
+- Moved some data from code into data structure - e.g. store a pointer to
+the driver operations structure in the driver, rather than passing it
+to the driver bind function.
+- Rename some structures to make them more similar to Linux (struct device
+instead of struct instance, struct platform_data, etc.)
+- Change the name 'core' to 'uclass', meaning U-Boot class. It seems that
+this concept relates to a class of drivers (or a subsystem). We shouldn't
+use 'class' since it is a C++ reserved word, so U-Boot class (uclass) seems
+better than 'core'.
+- Remove 'struct driver_instance' and just use a single 'struct device'.
+This removes a level of indirection that doesn't seem necessary.
+- Built in device tree support, to avoid the need for platform_data
+- Removed the concept of driver relocation, and just make it possible for
+the new driver (created after relocation) to access the old driver data.
+I feel that relocation is a very special case and will only apply to a few
+drivers, many of which can/will just re-init anyway. So the overhead of
+dealing with 

[U-Boot] [PATCH v3 14/16] dm: Enable gpio command to support driver model

2013-06-18 Thread Simon Glass
Now that named GPIO banks are supported, along with a way of obtaining
the status of a GPIO (input or output), we can provide an enhanced
GPIO command for driver model. Where the driver provides its own operation
for obtaining the GPIO state, this is used, otherwise a generic version
is sufficient.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 common/cmd_gpio.c | 127 --
 1 file changed, 114 insertions(+), 13 deletions(-)

diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 47eee89..c6758c1 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -8,7 +8,7 @@
 
 #include common.h
 #include command.h
-
+#include dm.h
 #include asm/gpio.h
 
 #ifndef name_to_gpio
@@ -22,25 +22,115 @@ enum gpio_cmd {
GPIO_TOGGLE,
 };
 
+#if defined(CONFIG_DM_GPIO)  !defined(gpio_status)
+static const char * const gpio_function[] = {
+   input,
+   output,
+   unknown,
+};
+
+static void show_gpio(struct device *dev, const char *bank_name, int offset)
+{
+   struct dm_gpio_ops *ops = gpio_get_ops(dev);
+   char buf[80];
+   int ret;
+
+   *buf = '\0';
+   if (ops-get_state) {
+   ret = ops-get_state(dev, offset, buf, sizeof(buf));
+   if (ret) {
+   puts(unknown);
+   return;
+   }
+   } else {
+   int func =  GPIOF_UNKNOWN;
+   int ret;
+
+   if (ops-get_function) {
+   ret = ops-get_function(dev, offset);
+   if (ret = 0  ret  ARRAY_SIZE(gpio_function))
+   func = ret;
+   }
+   sprintf(buf, %s%u: %8s %d, bank_name, offset,
+   gpio_function[func], ops-get_value(dev, offset));
+   }
+
+   puts(buf);
+   puts(\n);
+}
+
+static int do_gpio_status(const char *gpio_name)
+{
+   struct device *dev;
+   int newline = 0;
+   int ret;
+
+   if (gpio_name  !*gpio_name)
+   gpio_name = NULL;
+   for (ret = uclass_first_device(UCLASS_GPIO, dev);
+dev;
+ret = uclass_next_device(dev)) {
+   const char *bank_name;
+   int num_bits;
+
+   bank_name = gpio_get_bank_info(dev, num_bits);
+
+   if (!gpio_name || !bank_name ||
+   !strncmp(gpio_name, bank_name, strlen(bank_name))) {
+   const char *p = NULL;
+   int offset;
+
+   if (bank_name) {
+   if (newline)
+   putc('\n');
+   printf(Bank %s:\n, bank_name);
+   }
+   newline = 1;
+   if (gpio_name  bank_name) {
+   p = gpio_name + strlen(bank_name);
+   offset = simple_strtoul(p, NULL, 10);
+   show_gpio(dev, bank_name, offset);
+   } else {
+   for (offset = 0; offset  num_bits; offset++)
+   show_gpio(dev, bank_name, offset);
+   }
+   }
+   }
+
+   return ret;
+}
+#endif
+
 static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   int gpio;
+   unsigned int gpio;
enum gpio_cmd sub_cmd;
ulong value;
-   const char *str_cmd, *str_gpio;
+   const char *str_cmd, *str_gpio = NULL;
+#ifdef CONFIG_DM_GPIO
+   int ret;
+#endif
 
+   if (argc  2)
+ show_usage:
+   return CMD_RET_USAGE;
+   str_cmd = argv[1];
+   if (argc  2)
+   str_gpio = argv[2];
+   if (!strcmp(str_cmd, status)) {
+   /* Support deprecated gpio_status() */
 #ifdef gpio_status
-   if (argc == 2  !strcmp(argv[1], status)) {
gpio_status();
return 0;
-   }
+#elif defined(CONFIG_DM_GPIO)
+   return cmd_process_error(cmdtp, do_gpio_status(str_gpio));
+#else
+   goto show_usage;
 #endif
+   }
 
-   if (argc != 3)
- show_usage:
-   return CMD_RET_USAGE;
-   str_cmd = argv[1];
-   str_gpio = argv[2];
+   if (!str_gpio)
+   goto show_usage;
 
/* parse the behavior */
switch (*str_cmd) {
@@ -51,11 +141,21 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
default:  goto show_usage;
}
 
+#if defined(CONFIG_DM_GPIO)
+   /*
+* TODO(s...@chromium.org): Convert this code over to use the GPIO
+* uclass interface instead of the numbered GPIO compatibility
+* layer.
+*/
+   ret = gpio_lookup_name(str_gpio, NULL, NULL, gpio);
+   if (ret)
+   return cmd_process_error(cmdtp, ret);
+#else

[U-Boot] [PATCH v3 02/16] sandbox: Correct data sizes and printf() strings in fdtdec.c

2013-06-18 Thread Simon Glass
There are a few warnings in this file when building for sandbox. Addresses
coming from the device tree need to be treated as ulong as elsewhere in
U-Boot and we must use map_sysmem() to convert to a pointer when needed.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 lib/fdtdec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 005ad3d..dc53a1a 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -93,10 +93,10 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
size = (fdt_size_t *)((char *)cell +
sizeof(fdt_addr_t));
*sizep = fdt_size_to_cpu(*size);
-   debug(addr=%p, size=%p\n, (void *)addr,
- (void *)*sizep);
+   debug(addr=%08lx, size=%08x\n,
+ (ulong)addr, *sizep);
} else {
-   debug(%p\n, (void *)addr);
+   debug(%08lx\n, (ulong)addr);
}
return addr;
}
@@ -618,7 +618,7 @@ int fdtdec_decode_region(const void *blob, int node,
if (!cell || (len != sizeof(fdt_addr_t) * 2))
return -1;
 
-   *ptrp = (void *)fdt_addr_to_cpu(*cell);
+   *ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size);
*size = fdt_size_to_cpu(cell[1]);
debug(%s: size=%zx\n, __func__, *size);
return 0;
-- 
1.8.3

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


[U-Boot] [PATCH v3 11/16] dm: Add a demonstration/example driver

2013-06-18 Thread Simon Glass
As an example of how to write a uclass and a driver, provide a demo version
of each, accessible through the 'demo' command.

To use these with driver model, define CONFIG_CMD_DEMO and CONFIG_DM_DEMO.

The two demo drivers are enabled with CONFIG_DM_DEMO_SIMPLE and
CONFIG_DM_DEMO_SHAPE.

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Marek Vasut ma...@denx.de
Signed-off-by: Pavel Herrmann morpheus.i...@gmail.com
Signed-off-by: Viktor Křivák viktor.kri...@gmail.com
Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
---
Changes in v3:
- Fix up demo command help
- Update demo driver to use device tree

Changes in v2: None

 Makefile   |   1 +
 common/Makefile|   1 +
 common/cmd_demo.c  | 115 
 drivers/demo/Makefile  |  44 ++
 drivers/demo/demo-pdata.c  |  60 +++
 drivers/demo/demo-shape.c  | 143 +
 drivers/demo/demo-simple.c |  61 +++
 drivers/demo/demo-uclass.c |  73 +++
 include/configs/sandbox.h  |   4 ++
 include/dm-demo.h  |  49 
 10 files changed, 551 insertions(+)
 create mode 100644 common/cmd_demo.c
 create mode 100644 drivers/demo/Makefile
 create mode 100644 drivers/demo/demo-pdata.c
 create mode 100644 drivers/demo/demo-shape.c
 create mode 100644 drivers/demo/demo-simple.c
 create mode 100644 drivers/demo/demo-uclass.c
 create mode 100644 include/dm-demo.h

diff --git a/Makefile b/Makefile
index 0655c9c..1654ec3 100644
--- a/Makefile
+++ b/Makefile
@@ -338,6 +338,7 @@ LIBS-y += post/libpost.o
 LIBS-y += test/libtest.o
 LIBS-y += test/dm/libtestdm.o
 
+LIBS-$(CONFIG_DM_DEMO) += drivers/demo/libdemo.o
 LIBS-$(CONFIG_DM) += common/dm/libdm.o
 
 ifneq 
($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TI814X),)
diff --git a/common/Makefile b/common/Makefile
index 3ba4316..99921ca 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -85,6 +85,7 @@ COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
 COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
 COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
 COBJS-$(CONFIG_CMD_DATE) += cmd_date.o
+COBJS-$(CONFIG_CMD_DEMO) += cmd_demo.o
 COBJS-$(CONFIG_CMD_SOUND) += cmd_sound.o
 ifdef CONFIG_4xx
 COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o
diff --git a/common/cmd_demo.c b/common/cmd_demo.c
new file mode 100644
index 000..6ec91f8
--- /dev/null
+++ b/common/cmd_demo.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * (C) Copyright 2012
+ * Pavel Herrmann morpheus.i...@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include dm-demo.h
+#include asm/io.h
+
+struct device *demo_dev;
+
+static int do_demo_hello(cmd_tbl_t *cmdtp, int flag, int argc,
+char * const argv[])
+{
+   int ch = 0;
+
+   if (argc)
+   ch = *argv[0];
+
+   return demo_hello(demo_dev, ch);
+}
+
+static int do_demo_status(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+   int status;
+   int ret;
+
+   ret = demo_status(demo_dev, status);
+   if (ret)
+   return ret;
+
+   printf(Status: %d\n, status);
+
+   return 0;
+}
+
+int do_demo_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   struct device *dev;
+   int i, ret;
+
+   puts(Demo uclass entries:\n);
+
+   for (i = 0, ret = uclass_first_device(UCLASS_DEMO, dev);
+dev;
+ret = uclass_next_device(dev)) {
+   printf(entry %d - instance %08x, ops %08x, platform_data 
%08x\n,
+  i++, map_to_sysmem(dev),
+  map_to_sysmem(dev-driver-ops),
+  map_to_sysmem(dev-platform_data));
+   }
+
+   return cmd_process_error(cmdtp, ret);
+}
+
+static cmd_tbl_t demo_commands[] = {
+   U_BOOT_CMD_MKENT(list, 0, 1, do_demo_list, , ),
+   U_BOOT_CMD_MKENT(hello, 2, 1, do_demo_hello, , ),
+   U_BOOT_CMD_MKENT(status, 1, 1, do_demo_status, , ),
+};
+
+static int do_demo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   cmd_tbl_t *demo_cmd;
+   int devnum = 0;
+   int ret;
+
+   if (argc  2)

[U-Boot] [PATCH v3 10/16] dm: Add a 'dm' command for testing

2013-06-18 Thread Simon Glass
This command is not required for driver model operation, but can be useful
for testing. It provides simple dumps of internal data structures.

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Marek Vasut ma...@denx.de
Signed-off-by: Pavel Herrmann morpheus.i...@gmail.com
Signed-off-by: Viktor Křivák viktor.kri...@gmail.com
Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
---
Changes in v3: None
Changes in v2: None

 include/configs/sandbox.h |   1 +
 test/dm/Makefile  |   1 +
 test/dm/cmd_dm.c  | 146 ++
 3 files changed, 148 insertions(+)
 create mode 100644 test/dm/cmd_dm.c

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 38e0384..8e9a661 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -23,6 +23,7 @@
 #define __CONFIG_H
 
 #define CONFIG_DM
+#define CONFIG_CMD_DM
 #define CONFIG_DM_TEST
 
 /* Number of bits in a C 'long' on this architecture */
diff --git a/test/dm/Makefile b/test/dm/Makefile
index 310aa05..8f67215 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -21,6 +21,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)libtestdm.o
 
+COBJS-$(CONFIG_CMD_DM) += cmd_dm.o
 COBJS-$(CONFIG_DM_TEST) += test-driver.o
 COBJS-$(CONFIG_DM_TEST) += test-fdt.o
 COBJS-$(CONFIG_DM_TEST) += test-main.o
diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
new file mode 100644
index 000..49d7887
--- /dev/null
+++ b/test/dm/cmd_dm.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * (C) Copyright 2012
+ * Marek Vasut ma...@denx.de
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include dm.h
+#include malloc.h
+#include errno.h
+#include asm/io.h
+#include dm/root.h
+#include dm/test.h
+#include dm/uclass-internal.h
+
+static int display_succ(struct device *in, char *buf)
+{
+   int len;
+   int ip = 0;
+   char local[16];
+   struct device *pos, *n, *prev = NULL;
+
+   printf(%s- %s @ %08x, buf, in-name, map_to_sysmem(in));
+   if (in-flags  DM_FLAG_ACTIVATED)
+   puts( - activated);
+   puts(\n);
+
+   if (list_empty(in-child_head))
+   return 0;
+
+   len = strlen(buf);
+   strncpy(local, buf, sizeof(local));
+   snprintf(local + len, 2, |);
+   if (len  local[len - 1] == '`')
+   local[len - 1] = ' ';
+
+   list_for_each_entry_safe(pos, n, in-child_head, sibling_node) {
+   if (ip++)
+   display_succ(prev, local);
+   prev = pos;
+   }
+
+   snprintf(local + len, 2, `);
+   display_succ(prev, local);
+
+   return 0;
+}
+
+static int dm_dump(struct device *dev)
+{
+   if (!dev)
+   return -EINVAL;
+   return display_succ(dev, );
+}
+
+static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+   struct device *root;
+
+   root = dm_root();
+   printf(ROOT %08x\n, map_to_sysmem(root));
+   return dm_dump(root);
+}
+
+static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
+char * const argv[])
+{
+   struct uclass *uc;
+   int ret;
+   int id;
+
+   for (id = 0; id  UCLASS_COUNT; id++) {
+   struct device *dev;
+
+   ret = uclass_get(id, uc);
+   if (ret)
+   continue;
+
+   printf(uclass %d: %s\n, id, uc-uc_drv-name);
+   for (ret = uclass_first_device(id, dev);
+dev;
+ret = uclass_next_device(dev)) {
+   printf(  %s @  %08x:\n, dev-name,
+  map_to_sysmem(dev));
+   }
+   puts(\n);
+   }
+
+   return 0;
+}
+
+static int do_dm_test(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+   return dm_test_main();
+}
+
+static cmd_tbl_t test_commands[] = {
+   U_BOOT_CMD_MKENT(dump, 0, 1, do_dm_dump_all, , ),
+   U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, , ),
+   U_BOOT_CMD_MKENT(test, 1, 1, do_dm_test, , ),
+};
+
+static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   cmd_tbl_t *test_cmd;
+   int ret;
+

[U-Boot] [PATCH v3 03/16] sandbox: config: Don't use 64-bit physical memory

2013-06-18 Thread Simon Glass
Sandbox uses an emulated memory map which is quite small. We don't need the
CONFIG_PHYS_64BIT option since we can address memory with a 32-bit offset
into our ram_buf.

Adjust the phys_addr_t and phys_size_t types accordingly.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3: None
Changes in v2: None

 arch/sandbox/include/asm/types.h | 4 ++--
 include/configs/sandbox.h| 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index 2316c2d..07c2986 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -64,8 +64,8 @@ typedef unsigned long long u64;
 #define BITS_PER_LONG  CONFIG_SANDBOX_BITS_PER_LONG
 
 typedef unsigned long dma_addr_t;
-typedef unsigned long phys_addr_t;
-typedef unsigned long phys_size_t;
+typedef u32 phys_addr_t;
+typedef u32 phys_size_t;
 
 #endif /* __KERNEL__ */
 
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 788207d..78eda90 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -73,7 +73,6 @@
 #define CONFIG_SYS_LOAD_ADDR   0x
 #define CONFIG_SYS_MEMTEST_START   0x0010
 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x1000)
-#define CONFIG_PHYS_64BIT
 #define CONFIG_SYS_FDT_LOAD_ADDR   0x100
 
 /* Size of our emulated memory */
-- 
1.8.3

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


Re: [U-Boot] [PATCH v4 02/14] sf: Discover the bank addr commands

2013-06-18 Thread Simon Glass
Hi Jagan,

On Thu, Jun 13, 2013 at 1:55 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 Bank/Extended addr commands are specific to particular
 flash vendor so discover them based on the idocode0.

 Assign the discovered bank commands to spi_flash members
 so-that the bank read/write will use their specific operations.

 Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
 ---
 Changes for v4:
 - none
 Changes for v3:
 - none
 Changes for v2:
 - none

  drivers/mtd/spi/spi_flash.c  | 21 +
  drivers/mtd/spi/spi_flash_internal.h | 14 ++
  include/spi_flash.h  |  2 ++
  3 files changed, 37 insertions(+)

 diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
 index 9ddd070..9c90f00 100644
 --- a/drivers/mtd/spi/spi_flash.c
 +++ b/drivers/mtd/spi/spi_flash.c
 @@ -304,6 +304,27 @@ int spi_flash_cmd_bankaddr_write(struct spi_flash
 *flash, u8 bank_sel)
 return 0;
  }

 +int spi_flash_bank_config(struct spi_flash *flash, u8 idcode0)
 +{
 +   /* discover bank cmds */
 +   switch (idcode0) {
 +   case SPI_FLASH_SPANSION_IDCODE0:
 +   flash-bank_cmd[0] = CMD_BANKADDR_BRRD;
 +   flash-bank_cmd[1] = CMD_BANKADDR_BRWR;


I suggest bank_read_cmd, bank_write_cmd


 +   break;
 +   case SPI_FLASH_STMICRO_IDCODE0:
 +   case SPI_FLASH_WINBOND_IDCODE0:
 +   flash-bank_cmd[0] = CMD_EXTNADDR_RDEAR;
 +   flash-bank_cmd[1] = CMD_EXTNADDR_WREAR;
 +   break;
 +   default:
 +   printf(SF: Unsupported bank commands %02x\n, idcode0);
 +   return -1;
 +   }
 +
 +   return 0;
 +}
 +
  #ifdef CONFIG_OF_CONTROL
  int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
  {
 diff --git a/drivers/mtd/spi/spi_flash_internal.h
 b/drivers/mtd/spi/spi_flash_internal.h
 index 772fef6..db6c444 100644
 --- a/drivers/mtd/spi/spi_flash_internal.h
 +++ b/drivers/mtd/spi/spi_flash_internal.h
 @@ -28,6 +28,17 @@
  #define CMD_ERASE_64K  0xd8
  #define CMD_ERASE_CHIP 0xc7

 +/* Manufacture ID's */
 +#define SPI_FLASH_SPANSION_IDCODE0 0x01
 +#define SPI_FLASH_STMICRO_IDCODE0  0x20
 +#define SPI_FLASH_WINBOND_IDCODE0  0xef
 +
 +/* Bank addr access commands */
 +#define CMD_BANKADDR_BRWR  0x17
 +#define CMD_BANKADDR_BRRD  0x16
 +#define CMD_EXTNADDR_WREAR 0xC5
 +#define CMD_EXTNADDR_RDEAR 0xC8
 +
  /* Common status */
  #define STATUS_WIP 0x01

 @@ -80,6 +91,9 @@ int spi_flash_cmd_write_status(struct spi_flash *flash,
 u8 sr);
  /* Program the bank address register */
  int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel);

 +/* Configure the BAR - discover the bank cmds */
 +int spi_flash_bank_config(struct spi_flash *flash, u8 idcode0);
 +
  /*
   * Same as spi_flash_cmd_read() except it also claims/releases the SPI
   * bus. Used as common part of the -read() operation.
 diff --git a/include/spi_flash.h b/include/spi_flash.h
 index 3b6a44e..50a03bf 100644
 --- a/include/spi_flash.h
 +++ b/include/spi_flash.h
 @@ -38,6 +38,8 @@ struct spi_flash {
 u32 page_size;
 /* Erase (sector) size */
 u32 sector_size;
 +   /* Bank cmds - cmd[0] - read, cmd[1] - write */
 +   u8  bank_cmd[2];

 void *memory_map;   /* Address of read-only SPI flash access */
 int (*read)(struct spi_flash *flash, u32 offset,
 --
 1.8.3



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


Re: [U-Boot] [PATCH v4 05/14] sf: Update sf read to support all sizes of flashes

2013-06-18 Thread Simon Glass
Hi Jagan,

On Thu, Jun 13, 2013 at 1:55 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 This patch updated the spi_flash read func to support all
 sizes of flashes using bank reg addr facility.

 The same support has been added in below patch for erase/write
 spi_flash functions:
 sf: Support all sizes of flashes using bank addr reg facility
 (sha1: c956f600cbb0943d0afe1004cdb503f4fcd8f415)

 With these new updates on sf framework, the flashes which has  16MB
 are not effected as per as performance is concern and but the
 u-boot.bin size incrased ~460 bytes.

 sf update(for first 16MBytes), Changes before:
 U-Boot sf update 0x100 0x0 0x100
 - N25Q256
   16777216 bytes written, 0 bytes skipped in 199.72s, speed 86480 B/s
 - W25Q128BV
   16777216 bytes written, 0 bytes skipped in 351.739s, speed 48913 B/s
 - S25FL256S_64K
   16777216 bytes written, 0 bytes skipped in 65.659s, speed 262144 B/s

 sf update(for first 16MBytes), Changes before:
 U-Boot sf update 0x100 0x0 0x100
 - N25Q256
   16777216 bytes written, 0 bytes skipped in 198.953s, speed 86480 B/s
 - W25Q128BV
   16777216 bytes written, 0 bytes skipped in 350.90s, speed 49200 B/s
 - S25FL256S_64K
   16777216 bytes written, 0 bytes skipped in 66.521s, speed 262144 B/s


FYI you can also use 'sf test' to get performance numbers.

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


Re: [U-Boot] [PATCH v4 14/14] sf: Add Flag status register polling support

2013-06-18 Thread Simon Glass
Hi Jagan,

On Thu, Jun 13, 2013 at 1:55 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 Flag status register polling is required for micron 512Mb flash
 devices onwards, for performing erase/program operations.

 Like polling for WIP(Write-In-Progress) bit in read status register,
 spi_flash_cmd_wait_ready will poll for PEC(Program-Erase-Control)
 bit in flag status register.

 Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
 Reviewed-by: Simon Glass s...@chromium.org
 ---
 Changes for v4:
 - Remove STMICRO config, discover poll_cmd at probe
 Changes for v3:
 - none
 Changes for v2:
 - none

  drivers/mtd/spi/spi_flash.c  | 21 +
  drivers/mtd/spi/spi_flash_internal.h |  2 ++
  include/spi_flash.h  |  3 +++
  3 files changed, 22 insertions(+), 4 deletions(-)

 diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
 index e5b401f..c439601 100644
 --- a/drivers/mtd/spi/spi_flash.c
 +++ b/drivers/mtd/spi/spi_flash.c
 @@ -200,12 +200,19 @@ int spi_flash_cmd_wait_ready(struct spi_flash
 *flash, unsigned long timeout)
 unsigned long timebase;
 int ret;
 u8 status;
 +   u8 check_status = 0x0;
 u8 poll_bit = STATUS_WIP;
 -   u8 cmd = CMD_READ_STATUS;
 +   u8 cmd = flash-poll_cmd;
 +
 +   if (cmd == CMD_FLAG_STATUS) {
 +   poll_bit = STATUS_PEC;
 +   check_status = poll_bit;
 +   }

 ret = spi_xfer(spi, 8, cmd, NULL, SPI_XFER_BEGIN);
 if (ret) {
 -   debug(SF: Failed to send command %02x: %d\n, cmd, ret);
 +   debug(SF: fail to read %s status register\n,
 +   cmd == CMD_READ_STATUS ? read : flag);
 return ret;
 }

 @@ -217,14 +224,14 @@ int spi_flash_cmd_wait_ready(struct spi_flash
 *flash, unsigned long timeout)
 if (ret)
 return -1;

 -   if ((status  poll_bit) == 0)
 +   if ((status  poll_bit) == check_status)
 break;

 } while (get_timer(timebase)  timeout);

 spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);

 -   if ((status  poll_bit) == 0)
 +   if ((status  poll_bit) == check_status)
 return 0;

 /* Timed out */
 @@ -542,6 +549,12 @@ struct spi_flash *spi_flash_probe(unsigned int bus,
 unsigned int cs,
 goto err_manufacturer_probe;
  #endif

 +   /* Discover the poll_cmd, as STMICRO is something different */
 +   flash-poll_cmd = CMD_READ_STATUS;


Move this line into spi_flash_do_alloc()

+   if ((*idp == SPI_FLASH_STMICRO_IDCODE0) 
 +   (flash-size = 0x400))
 +   flash-poll_cmd = CMD_FLAG_STATUS;


...and the above into the stmicro.c's probe handler


 +
  #ifdef CONFIG_OF_CONTROL
 if (spi_flash_decode_fdt(gd-fdt_blob, flash)) {
 debug(SF: FDT decode error\n);
 diff --git a/drivers/mtd/spi/spi_flash_internal.h
 b/drivers/mtd/spi/spi_flash_internal.h
 index e9b85bf..8147f27 100644
 --- a/drivers/mtd/spi/spi_flash_internal.h
 +++ b/drivers/mtd/spi/spi_flash_internal.h
 @@ -22,6 +22,7 @@
  #define CMD_PAGE_PROGRAM   0x02
  #define CMD_WRITE_DISABLE  0x04
  #define CMD_READ_STATUS0x05
 +#define CMD_FLAG_STATUS0x70
  #define CMD_WRITE_ENABLE   0x06
  #define CMD_ERASE_4K   0x20
  #define CMD_ERASE_32K  0x52
 @@ -45,6 +46,7 @@

  /* Common status */
  #define STATUS_WIP 0x01
 +#define STATUS_PEC 0x80

  /* Send a single-byte command to the device and read the response */
  int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t
 len);
 diff --git a/include/spi_flash.h b/include/spi_flash.h
 index 1de193a..e94e59c 100644
 --- a/include/spi_flash.h
 +++ b/include/spi_flash.h
 @@ -44,6 +44,9 @@ struct spi_flash {
 /* Current flash bank */
 u8  bank_curr;
  #endif
 +   /* Poll cmd - for flash erase/program */
 +   u8  poll_cmd;
 +
 void *memory_map;   /* Address of read-only SPI flash access */
 int (*read)(struct spi_flash *flash, u32 offset,
 size_t len, void *buf);
 --
 1.8.3


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


Re: [U-Boot] [PATCH 1/4] sf: Unify spi_flash write code

2013-06-18 Thread Simon Glass
Hi Jagan,

On Fri, Jun 14, 2013 at 1:18 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 Move common flash write code into spi_flash_write_common().

 Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
 ---
  drivers/mtd/spi/spi_flash.c  | 122
 ---
  drivers/mtd/spi/spi_flash_internal.h |   6 ++
  2 files changed, 60 insertions(+), 68 deletions(-)


This looks good except that  spi_flash_write_common() is not a great name -
only one of the operations is a 'write'. Perhaps spi_flash_oper_common() or
similar?

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


Re: [U-Boot] [PATCH 4/4] sf: Warn to use BAR for 16MiB flashes

2013-06-18 Thread Simon Glass
Hi Jagan,

On Fri, Jun 14, 2013 at 1:18 PM, Jagannadha Sutradharudu Teki 
jagannadha.sutradharudu-t...@xilinx.com wrote:

 Warning for  16MiB flashes to #define CONFIG_SPI_FLASH_BAR

 Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
 ---
  drivers/mtd/spi/spi_flash.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

 diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
 index f3245a4..911c5e8 100644
 --- a/drivers/mtd/spi/spi_flash.c
 +++ b/drivers/mtd/spi/spi_flash.c
 @@ -563,7 +563,12 @@ struct spi_flash *spi_flash_probe(unsigned int bus,
 unsigned int cs,
 if (flash-memory_map)
 printf(, mapped at %p, flash-memory_map);
 puts(\n);
 -
 +#ifndef CONFIG_SPI_FLASH_BAR
 +   if (flash-size  SPI_FLASH_16MB_BOUN) {
 +   puts(SF: Warning - Only lower 16MiB accessible,);
 +   puts( Full access #define CONFIG_SPI_FLASH_BAR\n);


Perhaps you can shorten this to fit on one line?

Warning: CONFIG_SPI_FLASH_BAR provides full access to 16MiB devices

Anyway you should not split strings across lines.

+   }
 +#endif
 spi_release_bus(spi);

 return flash;
 --
 1.8.3



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


[U-Boot] [PATCH] ARM: OMAP4+: Fix MA detection during SDRAM_AUTO_DETECTION

2013-06-18 Thread Lokesh Vutla
During SDRAM_AUTO_DETECTION MA is not configured.
For Soc's  OMAP4460 MA is present. So populating
MA for the same.

Tested on OMAP4430 PANDA, OMAP4460 PANDA.

Reported-by: Dan Murphy dmur...@ti.com
Signed-off-by: Lokesh Vutla lokeshvu...@ti.com
---
 arch/arm/cpu/armv7/omap-common/emif-common.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c 
b/arch/arm/cpu/armv7/omap-common/emif-common.c
index 11e830a..e6287cd 100644
--- a/arch/arm/cpu/armv7/omap-common/emif-common.c
+++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
@@ -1180,6 +1180,9 @@ void dmm_init(u32 base)
/* TRAP for invalid TILER mappings in section 0 */
lis_map_regs_calculated.dmm_lisa_map_0 = DMM_LISA_MAP_0_INVAL_ADDR_TRAP;
 
+   if (omap_revision() = OMAP4460_ES1_0)
+   lis_map_regs_calculated.is_ma_present = 1;
+
lisa_map_regs = lis_map_regs_calculated;
 #endif
struct dmm_lisa_map_regs *hw_lisa_map_regs =
-- 
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 3/3] omap: cm_t35: Fix cm_t35 for weak splash_screen_prepare

2013-06-18 Thread Igor Grinberg
On 06/18/13 19:28, Robert Winkler wrote:
 I figured this one was so simple it didn't warrant anything more than
 what's already in the subject line.

Yes, that's understood.
There are plenty of simple patches, but still it is a good practice
to have even a minimal commit message.

 
 On Mon, Jun 17, 2013 at 11:26 PM, Igor Grinberg grinb...@compulab.co.il 
 wrote:

 On 06/17/13 21:31, Robert Winkler wrote:
 Signed-off-by: Robert Winkler robert.wink...@boundarydevices.com

 Usually, we add something to the commit message, otherwise
 Acked-by: Igor Grinberg grinb...@compulab.co.il

 ---
  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.
 

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