Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Tom,

On 08/23/2012 11:39 PM, Tom Rini wrote:
 On 08/23/2012 01:12 AM, Stefan Roese wrote:
 
 This patch enables the SPL framework to be used on powerpc platforms
 and not only ARM.
 [snip]
 +#ifdef CONFIG_ARM
  gd = gdata;
 +#endif
 
 So, here's what I don't understand.  On ARM, in general, we can't rely
 on the global data pointer register (r8) to be set to a useful value, so
 we do the above to ensure it points to something useful.  Are you always
 able to rely on r2 it looks like pointing to something useful?  Or do
 you take care of this much earlier on in powerpc?  Thanks!

You are correct, I missed something here. r2 was still configured to the
value written to it from the real U-Boot (pointing to internal SRAM).

I can't use the code in preloader_console_init() though to setup the gd
pointer. As I need to write some values in gd *before* calling
preloader_console_init() (mainly clocks for serial driver). And since
this gd stuff is quite platform specific, we should probably move this
into an platform/arch spl file instead. As you also mentioned in another
reply to create an arch/${ARCH}/lib/spl.c file.

What do you think? Can you move this gd init stuff into such a common
ARM spl file in the next patchset version?

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Tom,

On 08/23/2012 11:52 PM, Tom Rini wrote:
 On 08/23/2012 01:12 AM, Stefan Roese wrote:
 
 This patch enables the SPL framework to be used on powerpc platforms
 and not only ARM.
 [snip]
 +#ifdef CONFIG_PPC
 +static void __noreturn jump_to_image_linux(void *arg)
 +{
 +debug(Entering kernel arg pointer: 0x%p\n, arg);
 +typedef void (*image_entry_arg_t)(void *, ulong r4, ulong r5, ulong r6,
 +  ulong r7, ulong r8, ulong r9)
 +__attribute__ ((noreturn));
 +image_entry_arg_t image_entry =
 +(image_entry_arg_t)spl_image.entry_point;
 +
 +image_entry(arg, 0, 0, EPAPR_MAGIC, CONFIG_SYS_BOOTMAPSZ, 0, 0);
 +}
 +#endif /* CONFIG_PPC */
 +#endif /* CONFIG_SPL_OS_BOOT */
 
 This, along with board_init_f make me wonder if we shouldn't have an
 arch/${ARCH}/lib/spl.c that contains them and make them non-static.
 Perhaps sharing with the non-SPL code portion as well?

Yes. Makes definitely sense. Please see my comments in the other mail.

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


Re: [U-Boot] [PATCH 4/6 v2] arm:exynos4:trats: Use pinmux for mmc configuration

2012-08-24 Thread Piotr Wilczek
Dear Jaehoon Chung,

 -Original Message-
 From: Jaehoon Chung [mailto:jh80.ch...@samsung.com]
 Sent: Friday, August 24, 2012 3:18 AM
 To: Piotr Wilczek
 Cc: u-boot@lists.denx.de; Kyungmin Park
 Subject: Re: [U-Boot] [PATCH 4/6 v2] arm:exynos4:trats: Use pinmux for
 mmc configuration
 
 On 08/23/2012 09:01 PM, Piotr Wilczek wrote:
  This patch use the pinmux for mmc configuration for Trats
 
  Signed-off-by: Piotr Wilczek p.wilc...@samsung.com
  Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
  CC: Minkyu Kang mk7.k...@samsung.com
  ---
  Chaneges for v2:
  - mmc iniatialisation using pinmux
 
   board/samsung/trats/trats.c |   62 +++--
 -
   1 files changed, 11 insertions(+), 51 deletions(-)
 
  diff --git a/board/samsung/trats/trats.c
 b/board/samsung/trats/trats.c
  index f5df56c..0fab2e0 100644
  --- a/board/samsung/trats/trats.c
  +++ b/board/samsung/trats/trats.c
  @@ -29,6 +29,7 @@
   #include asm/arch/cpu.h
   #include asm/arch/gpio.h
   #include asm/arch/mmc.h
  +#include asm/arch/pinmux.h
   #include asm/arch/clock.h
   #include asm/arch/clk.h
   #include asm/arch/mipi_dsim.h
  @@ -140,46 +141,16 @@ int board_mmc_init(bd_t *bis)  {
  struct exynos4_gpio_part2 *gpio =
  (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
  -   int i, err;
  +   int err;
 
  /* eMMC_EN: SD_0_CDn: GPK0[2] Output High */
  s5p_gpio_direction_output(gpio-k0, 2, 1);
  s5p_gpio_set_pull(gpio-k0, 2, GPIO_PULL_NONE);
 
  -   /*
  -* eMMC GPIO:
  -* SDR 8-bit@48MHz at MMC0
  -* GPK0[0]  SD_0_CLK(2)
  -* GPK0[1]  SD_0_CMD(2)
  -* GPK0[2]  SD_0_CDn- Not used
  -* GPK0[3:6]SD_0_DATA[0:3](2)
  -* GPK1[3:6]SD_0_DATA[0:3](3)
  -*
  -* DDR 4-bit@26MHz at MMC4
  -* GPK0[0]  SD_4_CLK(3)
  -* GPK0[1]  SD_4_CMD(3)
  -* GPK0[2]  SD_4_CDn- Not used
  -* GPK0[3:6]SD_4_DATA[0:3](3)
  -* GPK1[3:6]SD_4_DATA[4:7](4)
  -*/
  -   for (i = 0; i  7; i++) {
  -   if (i == 2)
  -   continue;
  -   /* GPK0[0:6] special function 2 */
  -   s5p_gpio_cfg_pin(gpio-k0, i, 0x2);
  -   /* GPK0[0:6] pull disable */
  -   s5p_gpio_set_pull(gpio-k0, i, GPIO_PULL_NONE);
  -   /* GPK0[0:6] drv 4x */
  -   s5p_gpio_set_drv(gpio-k0, i, GPIO_DRV_4X);
  -   }
  -
  -   for (i = 3; i  7; i++) {
  -   /* GPK1[3:6] special function 3 */
  -   s5p_gpio_cfg_pin(gpio-k1, i, 0x3);
  -   /* GPK1[3:6] pull disable */
  -   s5p_gpio_set_pull(gpio-k1, i, GPIO_PULL_NONE);
  -   /* GPK1[3:6] drv 4x */
  -   s5p_gpio_set_drv(gpio-k1, i, GPIO_DRV_4X);
  +   err = exynos_pinmux_config(PERIPH_ID_SDMMC0,
 PINMUX_FLAG_8BIT_MODE);
  +   if (err) {
  +   debug(SDMMC0 not configured\n);
  +   return err;
  }
 if err, return? then how can sd-card init?
 SD/eMMC card didn't have the dependency.
exynos_pinmux_config() returns err only if given peripheral and/or mode (or
cpu) are not supported. Then gpio pins are not configured and MMC cannot be
initiated. Err is returned to indicate this situation and it is essential to
init MMC0 correctly.
The dependency didn't exist in trats nor universal but exists when pinmux is
used ex: smdk5250 board.

Best regards
Piotr Wilczek

 
 Best Regards,
 Jaehoon Chung
 
  /*
  @@ -198,23 +169,12 @@ int board_mmc_init(bd_t *bis)
   * GPX3[4] T-flash detect pin
   */
  if (!s5p_gpio_get_value(gpio-x3, 4)) {
  -   /*
  -* SD card GPIO:
  -* GPK2[0]  SD_2_CLK(2)
  -* GPK2[1]  SD_2_CMD(2)
  -* GPK2[2]  SD_2_CDn- Not used
  -* GPK2[3:6]SD_2_DATA[0:3](2)
  -*/
  -   for (i = 0; i  7; i++) {
  -   if (i == 2)
  -   continue;
  -   /* GPK2[0:6] special function 2 */
  -   s5p_gpio_cfg_pin(gpio-k2, i, 0x2);
  -   /* GPK2[0:6] pull disable */
  -   s5p_gpio_set_pull(gpio-k2, i, GPIO_PULL_NONE);
  -   /* GPK2[0:6] drv 4x */
  -   s5p_gpio_set_drv(gpio-k2, i, GPIO_DRV_4X);
  +   err = exynos_pinmux_config(PERIPH_ID_SDMMC2,
 PINMUX_FLAG_NONE);
  +   if (err) {
  +   debug(SDMMC2 not configured\n);
  +   return err;
  }
  +
  err = s5p_mmc_init(2, 4);
  }
 
 


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


[U-Boot] which file would contain SRAM address and FLASH address range

2012-08-24 Thread facing_it_all

Hello all,
I am new to u-boot. I want to know in which file I can find the adress range
of SRAM and FLASH chip. Both of them are memory mapped. I am using a u-boot
source code customised to a client's board. i need to change the address of
FLASH.
Any sugesstion would be helpful

Thanks in advance,
Facing_it_all
-- 
View this message in context: 
http://old.nabble.com/which-file-would-contain-SRAM-address-and-FLASH-address-range-tp34338311p34338311.html
Sent from the Uboot - Users mailing list archive at Nabble.com.

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


Re: [U-Boot] [PATCH 3/3] mxs: Rename 'mx28_dram_init' to 'mxs_dram_init'

2012-08-24 Thread Stefano Babic
On 24/08/2012 01:06, Otavio Salvador wrote:
 Ping?
 

Hi Otavio,

Marek has already acked it, we get the ACK from Veli-Pekkola this
morning. I have put the series in my ready to be merged queue. It will
be merged soon.

Regards,
Stefano

 On Sun, Aug 19, 2012 at 12:07 PM, Marek Vasut marek.va...@gmail.com wrote:
 Dear Otavio Salvador,

 The DRAM initialization, after SPL has complete, is exactly the same
 for all mxs SoCs so we should name it accordinly.

 Acked-by: Marek Vasut ma...@denx.de

 The following boards has been changed:

  * apx4devkit
  * m28evk
  * mx28evk
  * sc_sps_1

 Signed-off-by: Otavio Salvador ota...@ossystems.com.br
 ---
  arch/arm/cpu/arm926ejs/mxs/mxs.c  |4 ++--
  arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
  board/bluegiga/apx4devkit/apx4devkit.c|2 +-
  board/denx/m28evk/m28evk.c|2 +-
  board/freescale/mx28evk/mx28evk.c |2 +-
  board/schulercontrol/sc_sps_1/sc_sps_1.c  |2 +-
  6 files changed, 7 insertions(+), 7 deletions(-)

 diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c
 b/arch/arm/cpu/arm926ejs/mxs/mxs.c index a1769fd..c8cda6a 100644
 --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
 +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
 @@ -320,13 +320,13 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char
 *mac) }
  #endif

 -int mx28_dram_init(void)
 +int mxs_dram_init(void)
  {
   struct mxs_spl_data *data = (struct mxs_spl_data *)
   ((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data))  ~0xf);

   if (data-mem_dram_size == 0) {
 - printf(MX28:\n
 + printf(MXS:\n
   Error, the RAM size passed up from SPL is 0!\n);
   hang();
   }
 diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h
 b/arch/arm/include/asm/arch-mxs/sys_proto.h index 9e4a4c9..fc84808 100644
 --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
 +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
 @@ -69,6 +69,6 @@ struct mxs_spl_data {
   uint32_tmem_dram_size;
  };

 -int mx28_dram_init(void);
 +int mxs_dram_init(void);

  #endif   /* __SYS_PROTO_H__ */
 diff --git a/board/bluegiga/apx4devkit/apx4devkit.c
 b/board/bluegiga/apx4devkit/apx4devkit.c index 5a1042e..ae48ab5 100644
 --- a/board/bluegiga/apx4devkit/apx4devkit.c
 +++ b/board/bluegiga/apx4devkit/apx4devkit.c
 @@ -55,7 +55,7 @@ int board_early_init_f(void)

  int dram_init(void)
  {
 - return mx28_dram_init();
 + return mxs_dram_init();
  }

  int board_init(void)
 diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
 index 74da3ea..9473d10 100644
 --- a/board/denx/m28evk/m28evk.c
 +++ b/board/denx/m28evk/m28evk.c
 @@ -72,7 +72,7 @@ int board_init(void)

  int dram_init(void)
  {
 - return mx28_dram_init();
 + return mxs_dram_init();
  }

  #ifdef   CONFIG_CMD_MMC
 diff --git a/board/freescale/mx28evk/mx28evk.c
 b/board/freescale/mx28evk/mx28evk.c index 1320277..867d3c8 100644
 --- a/board/freescale/mx28evk/mx28evk.c
 +++ b/board/freescale/mx28evk/mx28evk.c
 @@ -64,7 +64,7 @@ int board_early_init_f(void)

  int dram_init(void)
  {
 - return mx28_dram_init();
 + return mxs_dram_init();
  }

  int board_init(void)
 diff --git a/board/schulercontrol/sc_sps_1/sc_sps_1.c
 b/board/schulercontrol/sc_sps_1/sc_sps_1.c index 5f58e0b..fda191a 100644
 --- a/board/schulercontrol/sc_sps_1/sc_sps_1.c
 +++ b/board/schulercontrol/sc_sps_1/sc_sps_1.c
 @@ -72,7 +72,7 @@ int board_init(void)

  int dram_init(void)
  {
 - return mx28_dram_init();
 + return mxs_dram_init();
  }

  #ifdef   CONFIG_CMD_MMC
 
 
 


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


[U-Boot] [PATCH 0/6] gpt: GUID Partition Table (GPT) restoration

2012-08-24 Thread Lukasz Majewski
This patch series provides a new command - gpt for eMMC partition table
(in the GPT format) restoration and display.

As a pre-work, some cleanup at the part_efi.c file was performed to 
remove custom macros and make GPT related structures more readable. 

The GPT detailed description has been written to README.gpt file.

Tested at:
- Exynos4210 rev.1 - TRATS Samsung development board

Lukasz Majewski (6):
  gpt:doc: GPT (GUID Partition Table) documentation
  gpt: Replace the leXX_to_int() calls with ones defined at
compiler.h
  gpt: Replacement of GPT structures members with ones indicating
endianness and size
  gpt: Support for GPT (GUID Partition Table) restoration
  gpt: Support for new gpt command
  gpt: Enable support for GPT partition table restoration at Samsung's
Trats

 common/Makefile |1 +
 common/cmd_gpt.c|  182 ++
 disk/part_efi.c |  334 +--
 disk/part_efi.h |   85 ++--
 doc/README.gpt  |  199 
 include/configs/trats.h |   23 +++-
 include/part.h  |2 +
 7 files changed, 715 insertions(+), 111 deletions(-)
 create mode 100644 common/cmd_gpt.c
 create mode 100644 doc/README.gpt

-- 
1.7.2.3

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


[U-Boot] [PATCH 2/6] gpt: Replace the leXX_to_int() calls with ones defined at compiler.h

2012-08-24 Thread Lukasz Majewski
Custom definitions of le_XX_to_int functions have been replaced with
standard ones, defined at compiler.h

Signed-off-by: Chang Hyun Park chchch.p...@samsung.com
Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 disk/part_efi.c |  109 ---
 1 files changed, 40 insertions(+), 69 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 02927a0..86e7f33 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -44,34 +44,6 @@
 defined(CONFIG_MMC) || \
 defined(CONFIG_SYSTEMACE)
 
-/* Convert char[2] in little endian format to the host format integer
- */
-static inline unsigned short le16_to_int(unsigned char *le16)
-{
-   return ((le16[1]  8) + le16[0]);
-}
-
-/* Convert char[4] in little endian format to the host format integer
- */
-static inline unsigned long le32_to_int(unsigned char *le32)
-{
-   return ((le32[3]  24) + (le32[2]  16) + (le32[1]  8) + le32[0]);
-}
-
-/* Convert char[8] in little endian format to the host format integer
- */
-static inline unsigned long long le64_to_int(unsigned char *le64)
-{
-   return (((unsigned long long)le64[7]  56) +
-   ((unsigned long long)le64[6]  48) +
-   ((unsigned long long)le64[5]  40) +
-   ((unsigned long long)le64[4]  32) +
-   ((unsigned long long)le64[3]  24) +
-   ((unsigned long long)le64[2]  16) +
-   ((unsigned long long)le64[1]  8) +
-   (unsigned long long)le64[0]);
-}
-
 /**
  * efi_crc32() - EFI version of crc32 function
  * @buf: buffer to calculate crc32 of
@@ -79,7 +51,7 @@ static inline unsigned long long le64_to_int(unsigned char 
*le64)
  *
  * Description: Returns EFI-style CRC32 value for @buf
  */
-static inline unsigned long efi_crc32(const void *buf, unsigned long len)
+static inline u32 efi_crc32(const void *buf, u32 len)
 {
return crc32(0, buf, len);
 }
@@ -137,13 +109,13 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug(%s: gpt-entry at %p\n, __func__, gpt_pte);
 
printf(Part\tName\t\t\tStart LBA\tEnd LBA\n);
-   for (i = 0; i  le32_to_int(gpt_head-num_partition_entries); i++) {
+   for (i = 0; i  le32_to_cpu(gpt_head-num_partition_entries); i++) {
 
if (is_pte_valid(gpt_pte[i])) {
printf(%3d\t%-18s\t0x%08llX\t0x%08llX\n, (i + 1),
print_efiname(gpt_pte[i]),
-   le64_to_int(gpt_pte[i].starting_lba),
-   le64_to_int(gpt_pte[i].ending_lba));
+  (u64) le64_to_cpu(gpt_pte[i].starting_lba),
+  (u64) le64_to_cpu(gpt_pte[i].ending_lba));
} else {
break;  /* Stop at the first non valid PTE */
}
@@ -174,9 +146,9 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int 
part,
}
 
/* The ulong casting limits the maximum disk size to 2 TB */
-   info-start = (ulong) le64_to_int(gpt_pte[part - 1].starting_lba);
+   info-start = (u64) le64_to_cpu(gpt_pte[part - 1].starting_lba);
/* The ending LBA is inclusive, to calculate size, add 1 to it */
-   info-size = ((ulong)le64_to_int(gpt_pte[part - 1].ending_lba) + 1)
+   info-size = ((u64)le64_to_cpu(gpt_pte[part - 1].ending_lba) + 1)
 - info-start;
info-blksz = GPT_BLOCK_SIZE;
 
@@ -215,7 +187,7 @@ int test_part_efi(block_dev_desc_t * dev_desc)
 static int pmbr_part_valid(struct partition *part)
 {
if (part-sys_ind == EFI_PMBR_OSTYPE_EFI_GPT 
-   le32_to_int(part-start_sect) == 1UL) {
+   le32_to_cpu(part-start_sect) == 1UL) {
return 1;
}
 
@@ -234,9 +206,8 @@ static int is_pmbr_valid(legacy_mbr * mbr)
 {
int i = 0;
 
-   if (!mbr || le16_to_int(mbr-signature) != MSDOS_MBR_SIGNATURE) {
+   if (!mbr || le16_to_cpu(mbr-signature) != MSDOS_MBR_SIGNATURE)
return 0;
-   }
 
for (i = 0; i  4; i++) {
if (pmbr_part_valid(mbr-partition_record[i])) {
@@ -259,8 +230,8 @@ static int is_pmbr_valid(legacy_mbr * mbr)
 static int is_gpt_valid(block_dev_desc_t * dev_desc, unsigned long long lba,
gpt_header * pgpt_head, gpt_entry ** pgpt_pte)
 {
-   unsigned char crc32_backup[4] = { 0 };
-   unsigned long calc_crc32;
+   u32 crc32_backup = 0;
+   u32 calc_crc32;
unsigned long long lastlba;
 
if (!dev_desc || !pgpt_head) {
@@ -275,54 +246,54 @@ static int is_gpt_valid(block_dev_desc_t * dev_desc, 
unsigned long long lba,
}
 
/* Check the GPT header signature */
-   if (le64_to_int(pgpt_head-signature) != GPT_HEADER_SIGNATURE) {
+   if (le64_to_cpu(pgpt_head-signature) != GPT_HEADER_SIGNATURE) {
printf(GUID Partition Table Header signature 

[U-Boot] [PATCH 3/6] gpt: Replacement of GPT structures members with ones indicating endianness and size

2012-08-24 Thread Lukasz Majewski
Replacement of several GPT related structures members with ones
indicating its endianness and proper size.

Signed-off-by: Chang Hyun Park chchch.p...@samsung.com
Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 disk/part_efi.h |   85 --
 1 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/disk/part_efi.h b/disk/part_efi.h
index 5903e7c..85692fb 100644
--- a/disk/part_efi.h
+++ b/disk/part_efi.h
@@ -29,6 +29,8 @@
  * http://developer.intel.com/technology/efi/efi.htm
 */
 
+#include linux/compiler.h
+
 #ifndef _DISK_PART_EFI_H
 #define _DISK_PART_EFI_H
 
@@ -41,6 +43,8 @@
 #define GPT_HEADER_REVISION_V1 0x0001
 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
 #define GPT_ENTRY_NAME gpt
+#define GPT_ENTRY_NUMBERS  128
+#define GPT_ENTRY_SIZE 128
 
 #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
((efi_guid_t) \
@@ -72,68 +76,67 @@
0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
 
 /* linux/include/efi.h */
-typedef unsigned short efi_char16_t;
+typedef u16 efi_char16_t;
 
 typedef struct {
-   unsigned char b[16];
+   u8 b[16];
 } efi_guid_t;
 
 /* based on linux/include/genhd.h */
 struct partition {
-   unsigned char boot_ind; /* 0x80 - active */
-   unsigned char head; /* starting head */
-   unsigned char sector;   /* starting sector */
-   unsigned char cyl;  /* starting cylinder */
-   unsigned char sys_ind;  /* What partition type */
-   unsigned char end_head; /* end head */
-   unsigned char end_sector;   /* end sector */
-   unsigned char end_cyl;  /* end cylinder */
-   unsigned char start_sect[4];/* starting sector counting from 0 */
-   unsigned char nr_sects[4];  /* nr of sectors in partition */
-} __attribute__ ((packed));
+   u8 boot_ind;/* 0x80 - active */
+   u8 head;/* starting head */
+   u8 sector;  /* starting sector */
+   u8 cyl; /* starting cylinder */
+   u8 sys_ind; /* What partition type */
+   u8 end_head;/* end head */
+   u8 end_sector;  /* end sector */
+   u8 end_cyl; /* end cylinder */
+   __le32 start_sect;  /* starting sector counting from 0 */
+   __le32 nr_sects;/* nr of sectors in partition */
+} __packed;
 
 /* based on linux/fs/partitions/efi.h */
 typedef struct _gpt_header {
-   unsigned char signature[8];
-   unsigned char revision[4];
-   unsigned char header_size[4];
-   unsigned char header_crc32[4];
-   unsigned char reserved1[4];
-   unsigned char my_lba[8];
-   unsigned char alternate_lba[8];
-   unsigned char first_usable_lba[8];
-   unsigned char last_usable_lba[8];
+   __le64 signature;
+   __le32 revision;
+   __le32 header_size;
+   __le32 header_crc32;
+   __le32 reserved1;
+   __le64 my_lba;
+   __le64 alternate_lba;
+   __le64 first_usable_lba;
+   __le64 last_usable_lba;
efi_guid_t disk_guid;
-   unsigned char partition_entry_lba[8];
-   unsigned char num_partition_entries[4];
-   unsigned char sizeof_partition_entry[4];
-   unsigned char partition_entry_array_crc32[4];
-   unsigned char reserved2[GPT_BLOCK_SIZE - 92];
-} __attribute__ ((packed)) gpt_header;
+   __le64 partition_entry_lba;
+   __le32 num_partition_entries;
+   __le32 sizeof_partition_entry;
+   __le32 partition_entry_array_crc32;
+   u8 reserved2[GPT_BLOCK_SIZE - 92];
+} __packed gpt_header;
 
 typedef struct _gpt_entry_attributes {
-   unsigned long long required_to_function:1;
-   unsigned long long reserved:47;
-   unsigned long long type_guid_specific:16;
-} __attribute__ ((packed)) gpt_entry_attributes;
+   u64 required_to_function:1;
+   u64 reserved:47;
+   u64 type_guid_specific:16;
+} __packed gpt_entry_attributes;
 
 #define PARTNAME_SZ(72 / sizeof(efi_char16_t))
 typedef struct _gpt_entry {
efi_guid_t partition_type_guid;
efi_guid_t unique_partition_guid;
-   unsigned char starting_lba[8];
-   unsigned char ending_lba[8];
+   __le64 starting_lba;
+   __le64 ending_lba;
gpt_entry_attributes attributes;
efi_char16_t partition_name[PARTNAME_SZ];
-}
-__attribute__ ((packed)) gpt_entry;
+} __packed gpt_entry;
 
 typedef struct _legacy_mbr {
-   unsigned char boot_code[440];
-   unsigned char unique_mbr_signature[4];
-   unsigned char unknown[2];
+   u8 boot_code[440];
+   __le32 unique_mbr_signature;
+   __le16 unknown;
struct partition partition_record[4];
-   unsigned char signature[2];
-} __attribute__ ((packed)) legacy_mbr;
+   __le16 signature;
+} __packed legacy_mbr;
 
 #endif /* _DISK_PART_EFI_H */
-- 

[U-Boot] [PATCH 1/6] gpt:doc: GPT (GUID Partition Table) documentation

2012-08-24 Thread Lukasz Majewski
Documentation of the GPT table format.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 doc/README.gpt |  199 
 1 files changed, 199 insertions(+), 0 deletions(-)
 create mode 100644 doc/README.gpt

diff --git a/doc/README.gpt b/doc/README.gpt
new file mode 100644
index 000..0bdacf3
--- /dev/null
+++ b/doc/README.gpt
@@ -0,0 +1,199 @@
+#
+#  Copyright (C) 2012 Samsung Electronics
+#
+#  Lukasz Majewski l.majew...@samsung.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
+
+
+Glossary:
+
+- UUID -(Universally Unique Identifier)
+- GUID - (Globally Unique ID)
+- EFI - (Extensible Firmware Interface)
+- UEFI - (Unified EFI) - EFI evolution
+- GPT (GUID Page Table) - it is the EFI standard part
+- partitions - lists of availavle partitions (defined at u-boot):
+  ./include/configs/{target}.h
+
+Introduction:
+=
+This document describes the GPT partition table format when used with u-boot.
+
+
+UUID introduction[5]:
+
+
+GPT for marking disks/partitions is using the UUID. It is supposed to be a
+globally unique value. A UUID is a 16-byte (128-bit) number. The number of
+theoretically possible UUIDs is therefore about 3 × 10^38.
+More often UUID is stored as 32 hexadecimal digits, displayed in 5 groups
+separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters
+(32 digits and 4 hyphens)
+
+For instance, GUID of Linux data partition: 
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
+For u-boot GPT hyphens are omitted.
+
+Historically there are 5 methods to generate this number. The oldest one is
+combining machine's MAC address and timer (epoch) value.
+
+Successive versions are using MD5 hash, random numbers and SHA-1 hash. All 
major
+OSes and programming languages are providing libraries to compute UUID.
+
+However it costs in terms of the computational power and memory footprint.
+Therefore u-boot uses the crc32 with reading random block (512B) from MMC
+storage device to generate UUID/GUID.
+
+
+GUID brief explanation:
+==
+
+   Layout:
+   ---
+
+   --
+   LBA 0  |Protective MBR   |
+   --
+   LBA 1  |Primary GPT Header   | Primary
+   -- GPT
+   LBA 2  |Entry 1|Entry 2| Entry 3| Entry 4|
+   --
+   LBA 3  |Entries 5 - 128  |
+  | |
+  | |
+   ---
+   LBA 34  |Partition 1  |
+  | |
+  ---
+  |Partition 2  |
+  | |
+  ---
+  |Partition n  |
+  | |
+   ---
+   LBA -34 |Entry 1|Entry 2| Entry 3| Entry 4| Secondary
+   --- (bkp)
+   LBA 34  |Partition 1  |
+  | |
+  ---
+  |Partition 2  |
+  | |
+  ---
+  |Partition n  |
+  | |
+   ---
+   LBA -34 |Entry 1|Entry 2| Entry 3| Entry 4| Secondary
+   --- (bkp)
+   LBA -33 |Entries 

[U-Boot] [PATCH 6/6] gpt: Enable support for GPT partition table restoration at Samsung's Trats

2012-08-24 Thread Lukasz Majewski
Enable support for GPT partition table restoration at Samsung's Trats
development board.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 include/configs/trats.h |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 08aa65b..c6fb2e0 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -98,6 +98,7 @@
 #undef CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* FAT */
 #define CONFIG_CMD_FAT
@@ -122,6 +123,24 @@
 #define CONFIG_BOOTBLOCK   10
 #define CONFIG_ENV_COMMON_BOOT ${console} ${meminfo}
 
+/* Tizen - partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_KERNEL   kernel
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define PARTS_DEFAULT  8M(PARTS_CSA)\
+   ,60M(PARTS_BOOTLOADER)\
+   ,60M(PARTS_KERNEL)\
+   ,1G(PARTS_ROOT)\
+   ,3G(PARTS_DATA)\
+   ,150M(PARTS_CSC)\
+   ,-(PARTS_UMS)\0
+#define GPT_PARTS_NUM 7
+
 #define CONFIG_DFU_ALT \
dfu_alt_info= \
u-boot mmc 80 400; \
@@ -171,7 +190,8 @@
mmcbootpart=2\0 \
mmcrootpart=3\0 \
opts=always_resume=1\0 \
-   CONFIG_DFU_ALT
+   partitions= PARTS_DEFAULT \
+   CONFIG_DFU_ALT \
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
@@ -210,6 +230,7 @@
 #define CONFIG_ENV_OFFSET  ((32 - 4)  10) /* 32KiB - 4KiB */
 
 #define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
 
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 
GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_CACHELINE_SIZE   32
-- 
1.7.2.3

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


[U-Boot] [PATCH 5/6] gpt: Support for new gpt command

2012-08-24 Thread Lukasz Majewski
New command - gpt is now supported. It shows and restores the GPT partition
table.
It looks into the partitions environment variable for partitions definition.
It can be enabled at target configuration file with CONFIG_CMD_GPT.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 common/Makefile  |1 +
 common/cmd_gpt.c |  182 ++
 2 files changed, 183 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_gpt.c

diff --git a/common/Makefile b/common/Makefile
index 49df751..438d36c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -185,6 +185,7 @@ COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
 COBJS-$(CONFIG_UPDATE_TFTP) += update.o
 COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
 COBJS-$(CONFIG_CMD_DFU) += cmd_dfu.o
+COBJS-$(CONFIG_CMD_GPT) += cmd_gpt.o
 endif
 
 ifdef CONFIG_SPL_BUILD
diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
new file mode 100644
index 000..06d7c5f
--- /dev/null
+++ b/common/cmd_gpt.c
@@ -0,0 +1,182 @@
+/*
+ * cmd_gpt.c -- GPT (GUID Partition Table) handling command
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * author: Lukasz Majewski l.majew...@samsung.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 malloc.h
+#include command.h
+#include mmc.h
+
+static unsigned int gpt_parts;
+static int gpt_dev;
+
+static unsigned long memsize_to_blocks(const char *const ptr,
+  const char **retptr)
+{
+   unsigned long ret = simple_strtoul(ptr, (char **)retptr, 0);
+   int shift = 0;
+
+   switch (**retptr) {
+   case 'G':
+   case 'g':
+   shift += 10;
+   case 'M':
+   case 'm':
+   shift += 10;
+   case 'K':
+   case 'k':
+   shift += 10;
+   (*retptr)++;
+   default:
+   shift -= 9;
+   break;
+   }
+
+   if (shift  0)
+   ret = shift;
+   else
+   ret = shift;
+
+   return ret;
+}
+
+int set_gpt_info(block_dev_desc_t *dev_desc)
+{
+   char *ps[GPT_PARTS_NUM], *name[GPT_PARTS_NUM];
+   unsigned int size[GPT_PARTS_NUM];
+   char *tok, *t, *p, *s, *ss;
+   int i, ret;
+
+   s = getenv(partitions);
+   if (s == NULL) {
+   printf(%s: \partitions\ env variable not defined!\n,
+  __func__);
+   return -1;
+   }
+
+   ss = calloc(strlen(s) + 1, 1);
+   if (ss == NULL) {
+   printf(%s: calloc failed!\n, __func__);
+   return -1;
+   }
+   memcpy(ss, s, strlen(s) + 1);
+
+   for (i = 0, p = ss; ; i++) {
+   tok = strsep(p, ,);
+   if (tok == NULL)
+   break;
+
+   t = strsep(tok, ();
+   ps[i] = calloc(strlen(t) + 1, 1);
+   if (ps[i] == NULL) {
+   printf(%s: calloc failed!\n, __func__);
+   ret = -1;
+   goto err;
+   }
+   strcpy(ps[i], t);
+
+   t = strsep(tok, ));
+   name[i] = calloc(strlen(t) + 1, 1);
+   if (name[i] == NULL) {
+   printf(%s: calloc failed!\n, __func__);
+   ret = -1;
+   goto err;
+   }
+   strcpy(name[i], t);
+   }
+
+   gpt_parts = i;
+   printf(found %d partitions\n, gpt_parts);
+
+   for (i = 0; i  gpt_parts; i++) {
+   p = ps[i];
+   size[i] = memsize_to_blocks(p, (const char **)p);
+   }
+
+   puts(save the GPT Table...\n);
+   ret = set_gpt_table(dev_desc, gpt_parts, size, name);
+
+   i = gpt_parts;
+ err:
+   for (i--; i = 0; i--) {
+   free(name[i]);
+   free(ps[i]);
+   }
+
+   free(ss);
+   return ret;
+}
+
+static void set_gpt_dev(int dev)
+{
+   gpt_dev = dev;
+}
+
+static void gpt_show(void)
+{
+   struct mmc *mmc = find_mmc_device(gpt_dev);
+
+   print_part_efi(mmc-block_dev);
+}
+
+static int gpt_default(void)
+{
+   struct mmc *mmc = find_mmc_device(gpt_dev);
+
+   if (mmc == NULL) {
+   printf(%s: mmc dev %d NOT available\n, 

[U-Boot] [PATCH 4/6] gpt: Support for GPT (GUID Partition Table) restoration

2012-08-24 Thread Lukasz Majewski
The restoration of GPT table (both primary and secondary) is now possible.
Simple GUID generation is supported.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 disk/part_efi.c |  225 +++
 include/part.h  |2 +
 2 files changed, 227 insertions(+), 0 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 86e7f33..c1e8d54 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -403,4 +403,229 @@ static int is_pte_valid(gpt_entry * pte)
return 1;
}
 }
+
+/**
+ * guid_gen(): Generate UUID
+ *
+ * @param dev_desc - block device descriptor
+ *
+ * @return - generated UUID table
+ *
+ * NOTE: The entrophy of this function is small
+ */
+static u8 *guid_gen(block_dev_desc_t * dev_desc)
+{
+   int k = 0;
+   static int i = 1;
+   static u8 __aligned(CONFIG_SYS_CACHELINE_SIZE) guid[16];
+   static u8 __aligned(CONFIG_SYS_CACHELINE_SIZE) ent_pool[512];
+   u32 *ptr = (u32 *) guid;
+
+   /* Entrophy initialization - read random content of one SD sector */
+   if (i == 1) {
+   debug(Init entropy:%x\n, (u32)(dev_desc-lba  14));
+
+   if (dev_desc-block_read(dev_desc-dev, (dev_desc-lba  14),
+1, (u32 *) ent_pool) != 1) {
+   printf(** Can't read from device %d **\n,
+  dev_desc-dev);
+   }
+   }
+
+   for (k = 0; k  4; k++) {
+   *(ptr + k) = efi_crc32((const void *) ent_pool,
+  sizeof(ent_pool));
+   ent_pool[511 - k] = *(ptr + k);
+   }
+
+   ent_pool[0] = ((u8) i)  0xff;
+
+   debug(GUID: );
+   for (k = 0; k  sizeof(guid); k++)
+   debug( %x , guid[k]);
+
+   debug( i:%d,\n, i);
+
+   i++;
+   return guid;
+}
+
+/**
+ * set_protective_mbr(): Set the EFI protective MBR
+ * @param dev_desc - block device descriptor
+ *
+ * @return - zero on success, otherwise error
+ */
+static int set_protective_mbr(block_dev_desc_t *dev_desc)
+{
+   legacy_mbr p_mbr;
+
+   /* Setup the Protective MBR */
+   memset((u32 *) p_mbr, 0x00, sizeof(p_mbr));
+   /* Append signature */
+   p_mbr.signature = MSDOS_MBR_SIGNATURE;
+   p_mbr.partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT;
+   p_mbr.partition_record[0].start_sect = 1;
+   p_mbr.partition_record[0].nr_sects = (u32) dev_desc-lba;
+
+   /* Write MBR sector to the MMC device */
+   if (dev_desc-block_write(dev_desc-dev, 0, 1, p_mbr) != 1) {
+   printf(** Can't write to device %d **\n,
+   dev_desc-dev);
+   return -1;
+   }
+
+   return 0;
+}
+
+/**
+ * fill_pte(): Fill the GPT partition table entry
+ *
+ * @param dev_desc - block device descriptor
+ * @param gpt_h - GPT header representation
+ * @param gpt_e - GPT partition table entries
+ * @param parts - number of partitions
+ * @param size - size of each partition
+ * @param name - name of each partition
+ */
+static void fill_pte(block_dev_desc_t *dev_desc, gpt_header *gpt_h,
+gpt_entry *gpt_e, int parts, unsigned int *size,
+char *name[])
+{
+   u32 offset = (u32) gpt_h-first_usable_lba;
+   char p[PARTNAME_SZ];
+   int i, k, j;
+   char *s;
+
+   for (i = 0; i  parts; i++) {
+   memcpy(gpt_e[i].partition_type_guid.b,
+  PARTITION_BASIC_DATA_GUID, 16);
+   memcpy(gpt_e[i].unique_partition_guid.b,
+  guid_gen(dev_desc),
+  sizeof(gpt_e[i].unique_partition_guid.b));
+
+   s = name[i];
+
+   memset(p, 0x00, sizeof(p));
+   for (k = 0, j = 0; k  strlen(s); k++, j += 2) {
+   p[j] = *(s + k);
+   p[j + 1] = '.';
+   }
+
+   memcpy(gpt_e[i].partition_name,
+  p, strlen(p));
+
+   gpt_e[i].starting_lba = cpu_to_le32(offset);
+
+   /* allocate remaining memory in last partition */
+   if (i != parts - 1) {
+   gpt_e[i].ending_lba =
+   cpu_to_le64(offset + size[i] - 1);
+   } else {
+   gpt_e[i].ending_lba = gpt_h-last_usable_lba;
+   }
+
+   memset(gpt_e[i].attributes, 0,
+  sizeof(gpt_entry_attributes));
+
+   offset += size[i];
+   debug(%s: name: %s offset[%d]: 0x%x size[%d]: 0x%x\n,
+ __func__, name[i], i, offset, i, size[i]);
+   }
+}
+
+/**
+ * set_gpt_table() - Restore the GUID Partition Table
+ *
+ * @param dev_desc - block device descriptor
+ * @param parts - number of partitions
+ * @param size - pointer to array with each partition size
+ * @param 

Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Tom,

On 08/23/2012 09:31 PM, Tom Rini wrote:
 @@ -89,7 +106,11 @@ void spl_parse_image_header(const struct image_header 
 *header)
spl_image.size = __be32_to_cpu(header-ih_size) + header_size;
spl_image.entry_point = __be32_to_cpu(header-ih_load);
/* Load including the header */
 +#ifdef CONFIG_ARM
spl_image.load_addr = spl_image.entry_point - header_size;
 +#else
 +  spl_image.load_addr = __be32_to_cpu(header-ih_load);
 +#endif

 This isn't an ARM-ism but is instead because spl_nor.c isn't offsetting
 where the header is like mmc/nand/ymodem do, yes?  Would it be possible
 to make spl_nor.c behave like the others?  One of the reasons I ask is
 I'm looking at a NOR chip on my desk...

 I was wondering about this line as well. Please explain: Why can't ARM
 just use header-ih_load as load_addr?
 
 Off the top of my head, I believe what goes on is that we read things
 into SDRAM such that the header is taken into account and we don't need
 to relocate the payload (U-Boot or Linux).

Hmmm. So for example, when ih_load is set to 0x10, then you load the
image to (0x10 - 0x40) = 0xfffc0? Is this correct?

This can't work for powerpc. As here for Linux both load-address and
entry-point are set to 0. So when loading the image (e.g. from NOR flash)
can't copy the image header in front of the image.

Another thing I'm wondering about: Why is only ih_load from the mkimage
header used and not ih_ep (entry-point)?

I suggest that we switch to copying the real image (payload) to the load
address, skipping the header. Then ih_load and ih_ep can be used
without modification.

BTW: There also seems to be a bug in some of the SPL loaders:

For example in drivers/mtd/nand/nand_spl_load.c:

...
if (header-ih_os == IH_OS_LINUX) {
/* happy - was a linux */
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
spl_image.size, (void *)spl_image.load_addr);

The problem here is that the last 64 bytes of the image are not
copied to SDRAM. Since the header is copied which is not included
in the spl_image.size variable. With my idea of only copying
the payload (skipping the header) this would be:

nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS +
sizeof(struct image_header),
spl_image.size, (void *)spl_image.load_addr);

What do you think? Should we switch to this way of loading images?
Seems more logical to me. And we don't run into problems where the
load address is 0.

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 4/6 v2] arm:exynos4:trats: Use pinmux for mmc configuration

2012-08-24 Thread Jaehoon Chung
Hi Piotr,

 -   for (i = 0; i  7; i++) {
 -   if (i == 2)
 -   continue;
 -   /* GPK0[0:6] special function 2 */
 -   s5p_gpio_cfg_pin(gpio-k0, i, 0x2);
 -   /* GPK0[0:6] pull disable */
 -   s5p_gpio_set_pull(gpio-k0, i, GPIO_PULL_NONE);
 -   /* GPK0[0:6] drv 4x */
 -   s5p_gpio_set_drv(gpio-k0, i, GPIO_DRV_4X);
 -   }
 -
 -   for (i = 3; i  7; i++) {
 -   /* GPK1[3:6] special function 3 */
 -   s5p_gpio_cfg_pin(gpio-k1, i, 0x3);
 -   /* GPK1[3:6] pull disable */
 -   s5p_gpio_set_pull(gpio-k1, i, GPIO_PULL_NONE);
 -   /* GPK1[3:6] drv 4x */
 -   s5p_gpio_set_drv(gpio-k1, i, GPIO_DRV_4X);
 +   err = exynos_pinmux_config(PERIPH_ID_SDMMC0,
 PINMUX_FLAG_8BIT_MODE);
 +   if (err) {
 +   debug(SDMMC0 not configured\n);
 +   return err;
 }
 if err, return? then how can sd-card init?
 SD/eMMC card didn't have the dependency.
 exynos_pinmux_config() returns err only if given peripheral and/or mode (or
 cpu) are not supported. Then gpio pins are not configured and MMC cannot be
 initiated. Err is returned to indicate this situation and it is essential to
 init MMC0 correctly.
 The dependency didn't exist in trats nor universal but exists when pinmux is
 used ex: smdk5250 board.
You're Right. it returned error, as you mentioned.
But if eMMC init is failed, could you ensure that sd init is also failed?
I didn't think so.
Although eMMC card init is failed, i think that sd-card init should be succeed.
1) eMMC init failed - return error. : this is your code.
2) eMMC init failed - if SD card detect, then try to init SD-card.
: this is my opinion.

If my thinking is wrong, plz let me know.

Best Regards,
Jaehoon Chung
 
 Best regards
 Piotr Wilczek
 

 Best Regards,
 Jaehoon Chung

 /*
 @@ -198,23 +169,12 @@ int board_mmc_init(bd_t *bis)
  * GPX3[4] T-flash detect pin
  */
 if (!s5p_gpio_get_value(gpio-x3, 4)) {
 -   /*
 -* SD card GPIO:
 -* GPK2[0]  SD_2_CLK(2)
 -* GPK2[1]  SD_2_CMD(2)
 -* GPK2[2]  SD_2_CDn- Not used
 -* GPK2[3:6]SD_2_DATA[0:3](2)
 -*/
 -   for (i = 0; i  7; i++) {
 -   if (i == 2)
 -   continue;
 -   /* GPK2[0:6] special function 2 */
 -   s5p_gpio_cfg_pin(gpio-k2, i, 0x2);
 -   /* GPK2[0:6] pull disable */
 -   s5p_gpio_set_pull(gpio-k2, i, GPIO_PULL_NONE);
 -   /* GPK2[0:6] drv 4x */
 -   s5p_gpio_set_drv(gpio-k2, i, GPIO_DRV_4X);
 +   err = exynos_pinmux_config(PERIPH_ID_SDMMC2,
 PINMUX_FLAG_NONE);
 +   if (err) {
 +   debug(SDMMC2 not configured\n);
 +   return err;
 }
 +
 err = s5p_mmc_init(2, 4);
 }


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

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


[U-Boot] gpt: GUID/UUID - GPT restoration - open questions

2012-08-24 Thread Lukasz Majewski
Hi Stephen,

I'm writing to you, since I've posted a patch series regarding GPT
support for Samsung Trats board (you were on the CC).

e.g. http://patchwork.ozlabs.org/patch/179785/

I think, that we can cooperate to provide better EFI/GPT support.

In mine implementation the gpt command (with several sub commands) has
been proposed
- we can discuss if this is a correct way to go.

Moreover, at this patch series a weak GUID generator is implemented.
For now it is good enough, since I consider the restoration as an
emergency situation.
However,I wonder how can we provide better GUID (and in general random
numbers pool) generator for u-boot.


Maybe md5sum command can be used with some running clock (WDT, or
system clock from u-boot start up) data to provide better entropy?

Any ideas?

Regards,
Lukasz

 This patch series provides a new command - gpt for eMMC partition
 table (in the GPT format) restoration and display.
 
 As a pre-work, some cleanup at the part_efi.c file was performed to 
 remove custom macros and make GPT related structures more readable. 
 
 The GPT detailed description has been written to README.gpt file.
 
 Tested at:
   - Exynos4210 rev.1 - TRATS Samsung development board
 
 Lukasz Majewski (6):
   gpt:doc: GPT (GUID Partition Table) documentation
   gpt: Replace the leXX_to_int() calls with ones defined at
 compiler.h
   gpt: Replacement of GPT structures members with ones indicating
 endianness and size
   gpt: Support for GPT (GUID Partition Table) restoration
   gpt: Support for new gpt command
   gpt: Enable support for GPT partition table restoration at Samsung's
 Trats
 
  common/Makefile |1 +
  common/cmd_gpt.c|  182 ++
  disk/part_efi.c |  334
 +--
 disk/part_efi.h |   85 ++-- doc/README.gpt
 |  199  include/configs/trats.h |   23
 +++- include/part.h  |2 +
  7 files changed, 715 insertions(+), 111 deletions(-)
  create mode 100644 common/cmd_gpt.c
  create mode 100644 doc/README.gpt
 

-- 
Best regards,

Lukasz Majewski

Samsung Poland RD Center | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6 v2] arm:exynos4:trats: Use pinmux for mmc configuration

2012-08-24 Thread Piotr Wilczek
Hi Jaehoon,

 -Original Message-
 From: Jaehoon Chung [mailto:jh80.ch...@samsung.com]
 Sent: Friday, August 24, 2012 10:20 AM
 To: Piotr Wilczek
 Cc: 'Jaehoon Chung'; u-boot@lists.denx.de; 'Kyungmin Park'
 Subject: Re: [U-Boot] [PATCH 4/6 v2] arm:exynos4:trats: Use pinmux for
 mmc configuration
 
 Hi Piotr,
 
  - for (i = 0; i  7; i++) {
  - if (i == 2)
  - continue;
  - /* GPK0[0:6] special function 2 */
  - s5p_gpio_cfg_pin(gpio-k0, i, 0x2);
  - /* GPK0[0:6] pull disable */
  - s5p_gpio_set_pull(gpio-k0, i, GPIO_PULL_NONE);
  - /* GPK0[0:6] drv 4x */
  - s5p_gpio_set_drv(gpio-k0, i, GPIO_DRV_4X);
  - }
  -
  - for (i = 3; i  7; i++) {
  - /* GPK1[3:6] special function 3 */
  - s5p_gpio_cfg_pin(gpio-k1, i, 0x3);
  - /* GPK1[3:6] pull disable */
  - s5p_gpio_set_pull(gpio-k1, i, GPIO_PULL_NONE);
  - /* GPK1[3:6] drv 4x */
  - s5p_gpio_set_drv(gpio-k1, i, GPIO_DRV_4X);
  + err = exynos_pinmux_config(PERIPH_ID_SDMMC0,
  PINMUX_FLAG_8BIT_MODE);
  + if (err) {
  + debug(SDMMC0 not configured\n);
  + return err;
}
  if err, return? then how can sd-card init?
  SD/eMMC card didn't have the dependency.
  exynos_pinmux_config() returns err only if given peripheral and/or
  mode (or
  cpu) are not supported. Then gpio pins are not configured and MMC
  cannot be initiated. Err is returned to indicate this situation and
 it
  is essential to init MMC0 correctly.
  The dependency didn't exist in trats nor universal but exists when
  pinmux is used ex: smdk5250 board.
 You're Right. it returned error, as you mentioned.
 But if eMMC init is failed, could you ensure that sd init is also
 failed?
 I didn't think so.
 Although eMMC card init is failed, i think that sd-card init should be
 succeed.
 1) eMMC init failed - return error. : this is your code.
 2) eMMC init failed - if SD card detect, then try to init SD-card.
 : this is my opinion.
 
 If my thinking is wrong, plz let me know.
I agree and will fix patches so SD card can be initiated even if eMMC init
failed.
Best regards,
Piotr Wilczek
 
 Best Regards,
 Jaehoon Chung
 
  Best regards
  Piotr Wilczek
 
 
  Best Regards,
  Jaehoon Chung
 
/*
  @@ -198,23 +169,12 @@ int board_mmc_init(bd_t *bis)
 * GPX3[4] T-flash detect pin
 */
if (!s5p_gpio_get_value(gpio-x3, 4)) {
  - /*
  -  * SD card GPIO:
  -  * GPK2[0]  SD_2_CLK(2)
  -  * GPK2[1]  SD_2_CMD(2)
  -  * GPK2[2]  SD_2_CDn- Not used
  -  * GPK2[3:6]SD_2_DATA[0:3](2)
  -  */
  - for (i = 0; i  7; i++) {
  - if (i == 2)
  - continue;
  - /* GPK2[0:6] special function 2 */
  - s5p_gpio_cfg_pin(gpio-k2, i, 0x2);
  - /* GPK2[0:6] pull disable */
  - s5p_gpio_set_pull(gpio-k2, i, GPIO_PULL_NONE);
  - /* GPK2[0:6] drv 4x */
  - s5p_gpio_set_drv(gpio-k2, i, GPIO_DRV_4X);
  + err = exynos_pinmux_config(PERIPH_ID_SDMMC2,
  PINMUX_FLAG_NONE);
  + if (err) {
  + debug(SDMMC2 not configured\n);
  + return err;
}
  +
err = s5p_mmc_init(2, 4);
}
 
 
 
 
  ___
  U-Boot mailing list
  U-Boot@lists.denx.de
  http://lists.denx.de/mailman/listinfo/u-boot
 


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


[U-Boot] [PATCH 2/2] dfu:usb:fix: Read the filesize environment variable only when file read

2012-08-24 Thread Lukasz Majewski
The filesize environment variable shall be read only when relevant
file is read.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/dfu/dfu_mmc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 2270a61..5d504df 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -89,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity 
*dfu,
return ret;
}
 
-   if (dfu-layout != DFU_RAW_ADDR) {
+   if (dfu-layout != DFU_RAW_ADDR  op == DFU_OP_READ) {
str_env = getenv(filesize);
if (str_env == NULL) {
puts(dfu: Wrong file size!\n);
-- 
1.7.2.3

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


[U-Boot] [PATCH 1/2] dfu:usb: Support for ext4

2012-08-24 Thread Lukasz Majewski
Support for ext4 file system handling at DFU.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/dfu/dfu_mmc.c |   32 ++--
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 060145b..2270a61 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -63,10 +63,23 @@ static int mmc_file_op(enum dfu_mmc_op op, struct 
dfu_entity *dfu,
char *str_env;
int ret;
 
-   sprintf(cmd_buf, fat%s mmc %d:%d 0x%x %s %lx,
-   op == DFU_OP_READ ? load : write,
-   dfu-data.mmc.dev, dfu-data.mmc.part,
-   (unsigned int) buf, dfu-name, *len);
+   switch (dfu-layout) {
+   case DFU_FS_FAT:
+   sprintf(cmd_buf, fat%s mmc %d:%d 0x%x %s %lx,
+   op == DFU_OP_READ ? load : write,
+   dfu-data.mmc.dev, dfu-data.mmc.part,
+   (unsigned int) buf, dfu-name, *len);
+   break;
+   case DFU_FS_EXT4:
+   sprintf(cmd_buf, ext4%s mmc %d:%d /%s 0x%x %ld,
+   op == DFU_OP_READ ? load : write,
+   dfu-data.mmc.dev, dfu-data.mmc.part,
+   dfu-name, (unsigned int) buf, *len);
+   break;
+   default:
+   printf(%s: Layout (%s) not (yet) supported!\n, __func__,
+  dfu_get_layout(dfu-layout));
+   }
 
debug(%s: %s 0x%p\n, __func__, cmd_buf, cmd_buf);
 
@@ -107,6 +120,7 @@ int dfu_write_medium_mmc(struct dfu_entity *dfu, void *buf, 
long *len)
ret = mmc_block_write(dfu, buf, len);
break;
case DFU_FS_FAT:
+   case DFU_FS_EXT4:
ret = mmc_file_write(dfu, buf, len);
break;
default:
@@ -126,6 +140,7 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void *buf, 
long *len)
ret = mmc_block_read(dfu, buf, len);
break;
case DFU_FS_FAT:
+   case DFU_FS_EXT4:
ret = mmc_file_read(dfu, buf, len);
break;
default:
@@ -149,12 +164,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
} else if (!strcmp(st, fat)) {
dfu-layout = DFU_FS_FAT;
-   dfu-data.mmc.dev = simple_strtoul(s, s, 10);
-   dfu-data.mmc.part = simple_strtoul(++s, s, 10);
+   } else if (!strcmp(st, ext4)) {
+   dfu-layout = DFU_FS_EXT4;
} else {
printf(%s: Memory layout (%s) not supported!\n, __func__, st);
}
 
+   if (dfu-layout == DFU_FS_EXT4 || dfu-layout == DFU_FS_FAT) {
+   dfu-data.mmc.dev = simple_strtoul(s, s, 10);
+   dfu-data.mmc.part = simple_strtoul(++s, s, 10);
+   }
+
dfu-read_medium = dfu_read_medium_mmc;
dfu-write_medium = dfu_write_medium_mmc;
 
-- 
1.7.2.3

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


Re: [U-Boot] [PATCH 2/4] spi: atmel: add WDRBT bit to avoid receive overrun

2012-08-24 Thread Bo Shen

Hi Andreas,

On 8/22/2012 2:56, Mike Frysinger wrote:

On Tuesday 21 August 2012 07:11:18 Andreas Bießmann wrote:

On 20.08.2012 08:32, Bo Shen wrote:

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Signed-off-by: Bo Shen voice.s...@atmel.com


Acked-by: Andreas Bießmann andreas.de...@googlemail.com

Mike, will you take this patch?


for SoC drivers, sometimes i'll help review, but i'd expect it to be merged
through the respective architecture tree.  i've only been sheriffing the spi
core changes.


If no problem, please take this patch?


-mike



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


Re: [U-Boot] [PATCH 1/4] spiflash: at25: using common spi flash operation

2012-08-24 Thread Bo Shen

Hi Mike,

On 8/22/2012 2:55, Mike Frysinger wrote:

On Tuesday 21 August 2012 07:26:27 Andreas Bießmann wrote:

On 20.08.2012 08:32, Bo Shen wrote:

Using common spi flash operation function to replace private operation
funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger


Mike, do you think this is a fix? Should it go into 2012.10? Will you
take it?


i'll take care of merging the changes to drivers/mtd/spi/*, but always happy
to see people help to review the changes :).

especially with the atmel driver as their dataflashes have the unique command
set :(.


For atmel at25 and at26 series spi flash, they can support standard spi 
flash operation. So, this patch intent to use common spi flash operation.


Will this patch be took?


-mike



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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Heiko Schocher

Hello Stefan

On 24.08.2012 10:17, Stefan Roese wrote:

Hi Tom,

On 08/23/2012 09:31 PM, Tom Rini wrote:

@@ -89,7 +106,11 @@ void spl_parse_image_header(const struct image_header 
*header)
spl_image.size = __be32_to_cpu(header-ih_size) + header_size;
spl_image.entry_point = __be32_to_cpu(header-ih_load);
/* Load including the header */
+#ifdef CONFIG_ARM
spl_image.load_addr = spl_image.entry_point - header_size;
+#else
+   spl_image.load_addr = __be32_to_cpu(header-ih_load);
+#endif


This isn't an ARM-ism but is instead because spl_nor.c isn't offsetting
where the header is like mmc/nand/ymodem do, yes?  Would it be possible
to make spl_nor.c behave like the others?  One of the reasons I ask is
I'm looking at a NOR chip on my desk...


I was wondering about this line as well. Please explain: Why can't ARM
just use header-ih_load as load_addr?


Off the top of my head, I believe what goes on is that we read things
into SDRAM such that the header is taken into account and we don't need
to relocate the payload (U-Boot or Linux).


Hmmm. So for example, when ih_load is set to 0x10, then you load the
image to (0x10 - 0x40) = 0xfffc0? Is this correct?

This can't work for powerpc. As here for Linux both load-address and
entry-point are set to 0. So when loading the image (e.g. from NOR flash)
can't copy the image header in front of the image.

Another thing I'm wondering about: Why is only ih_load from the mkimage
header used and not ih_ep (entry-point)?

I suggest that we switch to copying the real image (payload) to the load
address, skipping the header. Then ih_load and ih_ep can be used
without modification.


Yep, this seems a good idea to me.


BTW: There also seems to be a bug in some of the SPL loaders:

For example in drivers/mtd/nand/nand_spl_load.c:

...
if (header-ih_os == IH_OS_LINUX) {
/* happy - was a linux */
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
spl_image.size, (void *)spl_image.load_addr);

The problem here is that the last 64 bytes of the image are not
copied to SDRAM. Since the header is copied which is not included
in the spl_image.size variable. With my idea of only copying
the payload (skipping the header) this would be:

nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS +
sizeof(struct image_header),
spl_image.size, (void *)spl_image.load_addr);

What do you think? Should we switch to this way of loading images?
Seems more logical to me. And we don't run into problems where the
load address is 0.


Yes, that should be the way to go ... @Simon: Do you see here some
reason for not switching to copy the real payload?

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] env: handle special variables and selective env default

2012-08-24 Thread Gerlando Falauto

On 08/13/2012 12:11 PM, Wolfgang Denk wrote:

Dear Holger Brunck,

In message5028ab80.5030...@keymile.com  you wrote:



time to do updates here I propose the following. I could prepare a branch as you
suggested based on current denx master with this changeset. But where and how
should I push it to git.denx.de? Or will you prepare this branch?


I already did.


is this branch public available? I don't find this branch on git.denx.de.


Oops.  Please try again now.


Actually, the branch does not currently compile due to some changes to 
the trunk introduced in the meantime. So I am sending a new v4 patch 
series based on the current master. Please note that the first patch of 
the new series is cosmetic only and independent from all others.


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


[U-Boot] [PATCH v4 0/7] env: handle special variables and selective env default

2012-08-24 Thread Gerlando Falauto
This patchset modifies the handling of all the operations on the environment
(set/import/default) so to unify handling of special variables.
On top of that we implement a selective env default.

A selective env import would imply a user API change and should therefore
be discussed separately.

NOTE:
The entire patchset generates an increase in code size of about 1200 bytes
on a PowerPC target. 
As much as I would like to get rid of the set_default_vars() function in 
env_common.c, I have not found a nice way to do so.

Changes in the syntax (user API):
- env default -f: override write-once variables, -a means all
- display a warning when trying to set to default variables not
  present in the default env.

Changes from v3:
- rebased to current trunk (was not compilable)
- removed compiler warnings
- added an independent cosmetic patch on top of the series (from which only
  a later patch would actually benefit)

Changes from v2:
- removed typedef for callback, moved to the hashtable (struct hsearch_data)
- refactored patchset into smaller patches
  (only patch 5 and 6 should have any visible effect)
- added handling of selected variables not present in the imported env
- removed CONFIG_CMD_DEFAULTENV_VARS
- cosmetic formatting

Changes from v1:
- removed cosmetic patches (now mainstream)
- rebased to latest trunk
- removed subtle error in env_check_apply
  (comparing {loadaddr, bootfile} to values instead
  of variable names)
- changed env_check_apply so not to display warnings
  in case of H_FORCE flag being set

Changes from v0
- checkpatch cleanup
- removed himport_ex()
- removed warning for serial_assign()
- env import NOT implemented here

Gerlando Falauto (7):
  env: cosmetic: drop assignment i = iomux_doenv()
  env: unify logic to check and apply changes
  env: make himport_r() selective on variables
  env: add check/apply logic to himport_r()
  env: check and apply changes on delete/destroy
  env: make env default selective, check and apply
  env: delete selected vars not present in imported env

 common/cmd_nvedit.c   |  190 ++---
 common/env_common.c   |   36 +-
 include/environment.h |   12 
 include/search.h  |   26 +--
 lib/hashtable.c   |   95 +++--
 5 files changed, 286 insertions(+), 73 deletions(-)

-- 
1.7.10.4

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


[U-Boot] [PATCH v4 1/7] env: cosmetic: drop assignment i = iomux_doenv()

2012-08-24 Thread Gerlando Falauto
iomux_doenv() can only return 0 or 1.
So there is no need to save its return value in variable i, as checking
its truth value within an if statement is enough.

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index fd05e72..b8c7676 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -239,9 +239,8 @@ int _do_env_set(int flag, int argc, char * const argv[])
}
 
 #ifdef CONFIG_CONSOLE_MUX
-   i = iomux_doenv(console, argv[2]);
-   if (i)
-   return i;
+   if (iomux_doenv(console, argv[2]))
+   return 1;
 #else
/* Try assigning specified device */
if (console_assign(console, argv[2])  0)
-- 
1.7.10.4

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


[U-Boot] [PATCH v4 3/7] env: make himport_r() selective on variables

2012-08-24 Thread Gerlando Falauto
Add 2 new arguments to himport_r():

 o nvars, vars: number and list of variables to take into account
   (0 means ALL)

NOTE: This patch does not change the current behaviour.

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c |3 ++-
 common/env_common.c |6 --
 include/search.h|6 +-
 lib/hashtable.c |   27 ++-
 4 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 2f5dcbc..493aecc 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -914,7 +914,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
addr = (char *)ep-data;
}
 
-   if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
+   if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR,
+   0, NULL) == 0) {
error(Environment import failed: errno = %d\n, errno);
return 1;
}
diff --git a/common/env_common.c b/common/env_common.c
index d9e990d..8f142ed 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -193,7 +193,8 @@ void set_default_env(const char *s)
}
 
if (himport_r(env_htab, (char *)default_environment,
-   sizeof(default_environment), '\0', 0) == 0)
+   sizeof(default_environment), '\0', 0,
+   0, NULL) == 0)
error(Environment import failed: errno = %d\n, errno);
 
gd-flags |= GD_FLG_ENV_READY;
@@ -218,7 +219,8 @@ int env_import(const char *buf, int check)
}
}
 
-   if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0)) {
+   if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0,
+   0, NULL)) {
gd-flags |= GD_FLG_ENV_READY;
return 1;
}
diff --git a/include/search.h b/include/search.h
index a4a5ef4..94d75fc 100644
--- a/include/search.h
+++ b/include/search.h
@@ -94,9 +94,13 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,
 const char __sep, char **__resp, size_t __size,
 int argc, char * const argv[]);
 
+/*
+ * nvars: length of vars array
+ * vars: array of strings (variable names) to import (nvars == 0 means all)
+ */
 extern int himport_r(struct hsearch_data *__htab,
 const char *__env, size_t __size, const char __sep,
-int __flag);
+int __flag, int nvars, char * const vars[]);
 
 /* Flags for himport_r() */
 #defineH_NOCLEAR   (1  0) /* do not clear hash table before 
importing */
diff --git a/lib/hashtable.c b/lib/hashtable.c
index abd61c8..0610e86 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -603,6 +603,24 @@ ssize_t hexport_r(struct hsearch_data *htab, const char 
sep,
  * himport()
  */
 
+/* Check whether variable name is amongst vars[] */
+static int is_var_in_set(const char *name, int nvars, char * const vars[])
+{
+   int i = 0;
+
+   /* No variables specified means process all of them */
+   if (nvars == 0)
+   return 1;
+
+   for (i = 0; i  nvars; i++) {
+   if (!strcmp(name, vars[i]))
+   return 1;
+   }
+   debug(Skipping non-listed variable %s\n, name);
+
+   return 0;
+}
+
 /*
  * Import linearized data into hash table.
  *
@@ -639,7 +657,8 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,
  */
 
 int himport_r(struct hsearch_data *htab,
- const char *env, size_t size, const char sep, int flag)
+   const char *env, size_t size, const char sep, int flag,
+   int nvars, char * const vars[])
 {
char *data, *sp, *dp, *name, *value;
 
@@ -726,6 +745,8 @@ int himport_r(struct hsearch_data *htab,
*dp++ = '\0';   /* terminate name */
 
debug(DELETE CANDIDATE: \%s\\n, name);
+   if (!is_var_in_set(name, nvars, vars))
+   continue;
 
if (hdelete_r(name, htab) == 0)
debug(DELETE ERROR 
##\n);
@@ -743,6 +764,10 @@ int himport_r(struct hsearch_data *htab,
*sp++ = '\0';   /* terminate value */
++dp;
 
+   /* Skip variables which are not supposed to be processed */
+   if (!is_var_in_set(name, nvars, vars))
+   continue;
+
/* enter into hash table */
e.key = name;
e.data = value;
-- 
1.7.10.4

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


[U-Boot] [PATCH v4 5/7] env: check and apply changes on delete/destroy

2012-08-24 Thread Gerlando Falauto
Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c |2 +-
 include/search.h|5 +++--
 lib/hashtable.c |   16 ++--
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 983e747..b0860f3 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -359,7 +359,7 @@ int _do_env_set(int flag, int argc, char * const argv[])
 
/* Delete only ? */
if (argc  3 || argv[2] == NULL) {
-   int rc = hdelete_r(name, env_htab);
+   int rc = hdelete_r(name, env_htab, 0);
return !rc;
}
 
diff --git a/include/search.h b/include/search.h
index 721c8ac..93e1cbc 100644
--- a/include/search.h
+++ b/include/search.h
@@ -73,7 +73,7 @@ struct hsearch_data {
 extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);
 
 /* Destroy current internal hashing table.  */
-extern void hdestroy_r(struct hsearch_data *__htab);
+extern void hdestroy_r(struct hsearch_data *__htab, int do_apply);
 
 /*
  * Search for entry matching ITEM.key in internal hash table.  If
@@ -98,7 +98,8 @@ extern int hstrstr_r(const char *__match, int __last_idx, 
ENTRY ** __retval,
struct hsearch_data *__htab);
 
 /* Search and delete entry matching ITEM.key in internal hash table. */
-extern int hdelete_r(const char *__key, struct hsearch_data *__htab);
+extern int hdelete_r(const char *__key, struct hsearch_data *__htab,
+   int do_apply);
 
 extern ssize_t hexport_r(struct hsearch_data *__htab,
 const char __sep, char **__resp, size_t __size,
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 6cfba56..f3f47de 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -142,7 +142,7 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
  * be freed and the local static variable can be marked as not used.
  */
 
-void hdestroy_r(struct hsearch_data *htab)
+void hdestroy_r(struct hsearch_data *htab, int do_apply)
 {
int i;
 
@@ -156,7 +156,10 @@ void hdestroy_r(struct hsearch_data *htab)
for (i = 1; i = htab-size; ++i) {
if (htab-table[i].used  0) {
ENTRY *ep = htab-table[i].entry;
-
+   if (do_apply  htab-apply != NULL) {
+   /* deletion is always forced */
+   htab-apply(ep-key, ep-data, NULL, H_FORCE);
+   }
free((void *)ep-key);
free(ep-data);
}
@@ -401,7 +404,7 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
  * do that.
  */
 
-int hdelete_r(const char *key, struct hsearch_data *htab)
+int hdelete_r(const char *key, struct hsearch_data *htab, int do_apply)
 {
ENTRY e, *ep;
int idx;
@@ -417,7 +420,8 @@ int hdelete_r(const char *key, struct hsearch_data *htab)
 
/* free used ENTRY */
debug(hdelete: DELETING key \%s\\n, key);
-
+   if (do_apply  htab-apply != NULL)
+   htab-apply(ep-key, ep-data, NULL, H_FORCE);
free((void *)ep-key);
free(ep-data);
htab-table[idx].used = -1;
@@ -682,7 +686,7 @@ int himport_r(struct hsearch_data *htab,
debug(Destroy Hash Table: %p table = %p\n, htab,
   htab-table);
if (htab-table)
-   hdestroy_r(htab);
+   hdestroy_r(htab, do_apply);
}
 
/*
@@ -748,7 +752,7 @@ int himport_r(struct hsearch_data *htab,
if (!is_var_in_set(name, nvars, vars))
continue;
 
-   if (hdelete_r(name, htab) == 0)
+   if (hdelete_r(name, htab, do_apply) == 0)
debug(DELETE ERROR 
##\n);
 
continue;
-- 
1.7.10.4

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


[U-Boot] [PATCH v4 6/7] env: make env default selective, check and apply

2012-08-24 Thread Gerlando Falauto
Change the syntax (user API) for env default:
  -f: override write-once variables
  var... : accept individual variable(s)
  -a: all (resetting the whole env is NOT the default behavior)

Enable variable checking and make changes effective by
enabling do_apply argument to himport_r().

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c   |   40 ++--
 common/env_common.c   |   28 +++-
 include/environment.h |3 +++
 3 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index b0860f3..ac2b985 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -656,14 +656,41 @@ int envmatch(uchar *s1, int i2)
return -1;
 }
 
-static int do_env_default(cmd_tbl_t *cmdtp, int flag,
+static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
  int argc, char * const argv[])
 {
-   if (argc != 2 || strcmp(argv[1], -f) != 0)
-   return CMD_RET_USAGE;
+   int all = 0, flag = 0;
 
-   set_default_env(## Resetting to default environment\n);
-   return 0;
+   debug(Initial value for argc=%d\n, argc);
+   while (--argc  0  **++argv == '-') {
+   char *arg = *argv;
+
+   while (*++arg) {
+   switch (*arg) {
+   case 'a':   /* default all */
+   all = 1;
+   break;
+   case 'f':   /* force */
+   flag |= H_FORCE;
+   break;
+   default:
+   return cmd_usage(cmdtp);
+   }
+   }
+   }
+   debug(Final value for argc=%d\n, argc);
+   if (all  (argc == 0)) {
+   /* Reset the whole environment */
+   set_default_env(## Resetting to default environment\n);
+   return 0;
+   }
+   if (!all  (argc  0)) {
+   /* Reset individual variables */
+   set_default_vars(argc, argv);
+   return 0;
+   }
+
+   return cmd_usage(cmdtp);
 }
 
 static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
@@ -994,7 +1021,8 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_ASKENV)
ask name [message] [size] - ask for environment variable\nenv 
 #endif
-   default -f - reset default environment\n
+   default [-f] -a - [forcibly] reset default environment\n
+   env default [-f] var [...] - [forcibly] reset variable(s) to their 
default values\n
 #if defined(CONFIG_CMD_EDITENV)
env edit name - edit environment variable\n
 #endif
diff --git a/common/env_common.c b/common/env_common.c
index c6e7c4c..482d715 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -177,6 +177,11 @@ const uchar *env_get_addr(int index)
 
 void set_default_env(const char *s)
 {
+   /*
+* By default, do not apply changes as they will eventually
+* be applied by someone else
+*/
+   int do_apply = 0;
if (sizeof(default_environment)  ENV_SIZE) {
puts(*** Error - default environment is too large\n\n);
return;
@@ -188,6 +193,14 @@ void set_default_env(const char *s)
using default environment\n\n,
s + 1);
} else {
+   /*
+* This set_to_default was explicitly asked for
+* by the user, as opposed to being a recovery
+* mechanism.  Therefore we check every single
+* variable and apply changes to the system
+* right away (e.g. baudrate, console).
+*/
+   do_apply = 1;
puts(s);
}
} else {
@@ -196,12 +209,25 @@ void set_default_env(const char *s)
 
if (himport_r(env_htab, (char *)default_environment,
sizeof(default_environment), '\0', 0,
-   0, NULL, 0 /* do_apply */) == 0)
+   0, NULL, do_apply) == 0)
error(Environment import failed: errno = %d\n, errno);
 
gd-flags |= GD_FLG_ENV_READY;
 }
 
+
+/* [re]set individual variables to their value in the default environment */
+int set_default_vars(int nvars, char * const vars[])
+{
+   /*
+* Special use-case: import from default environment
+* (and use \0 as a separator)
+*/
+   return himport_r(env_htab, (const char *)default_environment,
+   sizeof(default_environment), '\0', H_NOCLEAR,
+   nvars, vars, 1 /* do_apply */);
+}
+
 /*
  * Check if CRC is valid and (if yes) import the environment.
  * Note that buf may or may not be aligned.
diff --git 

[U-Boot] [PATCH v4 2/7] env: unify logic to check and apply changes

2012-08-24 Thread Gerlando Falauto
The logic of checking special parameters (e.g. baudrate, stdin, stdout,
for a valid value and/or whether can be overwritten) and applying the
new value to the running system is now all within a single function
env_check_apply() which can be called whenever changes are made
to the environment, no matter if by set, default or import.

With this patch env_check_apply() is only called by env set,
retaining previous behavior.

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c |  141 +--
 include/search.h|3 +-
 2 files changed, 94 insertions(+), 50 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index b8c7676..2f5dcbc 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -198,31 +198,19 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
 #endif
 
 /*
- * Set a new environment variable,
- * or replace or delete an existing one.
+ * Perform consistency checking before setting, replacing, or deleting an
+ * environment variable, then (if successful) apply the changes to internals so
+ * to make them effective.  Code for this function was taken out of
+ * _do_env_set(), which now calls it instead.
+ * Returns 0 in case of success, 1 in case of failure.
+ * When (flag  H_FORCE) is set, do not print out any error message and force
+ * overwriting of write-once variables.
  */
-int _do_env_set(int flag, int argc, char * const argv[])
+
+int env_check_apply(const char *name, const char *oldval,
+   const char *newval, int flag)
 {
-   int   i, len;
int   console = -1;
-   char  *name, *value, *s;
-   ENTRY e, *ep;
-
-   name = argv[1];
-
-   if (strchr(name, '=')) {
-   printf(## Error: illegal character '=' in variable name
-  \%s\\n, name);
-   return 1;
-   }
-
-   env_id++;
-   /*
-* search if variable with this name already exists
-*/
-   e.key = name;
-   e.data = NULL;
-   hsearch_r(e, FIND, ep, env_htab);
 
/* Check for console redirection */
if (strcmp(name, stdin) == 0)
@@ -233,59 +221,75 @@ int _do_env_set(int flag, int argc, char * const argv[])
console = stderr;
 
if (console != -1) {
-   if (argc  3) { /* Cannot delete it! */
-   printf(Can't delete \%s\\n, name);
+   if ((newval == NULL) || (*newval == '\0')) {
+   /* We cannot delete stdin/stdout/stderr */
+   if ((flag  H_FORCE) == 0)
+   printf(Can't delete \%s\\n, name);
return 1;
}
 
 #ifdef CONFIG_CONSOLE_MUX
-   if (iomux_doenv(console, argv[2]))
+   if (iomux_doenv(console, newval))
return 1;
 #else
/* Try assigning specified device */
-   if (console_assign(console, argv[2])  0)
+   if (console_assign(console, newval)  0)
return 1;
 
 #ifdef CONFIG_SERIAL_MULTI
-   if (serial_assign(argv[2])  0)
+   if (serial_assign(newval)  0)
return 1;
 #endif
 #endif /* CONFIG_CONSOLE_MUX */
}
 
/*
-* Some variables like ethaddr and serial# can be set only
-* once and cannot be deleted; also, ver is readonly.
+* Some variables like ethaddr and serial# can be set only once and
+* cannot be deleted, unless CONFIG_ENV_OVERWRITE is defined.
 */
-   if (ep) {   /* variable exists */
 #ifndef CONFIG_ENV_OVERWRITE
+   if (oldval != NULL/* variable exists */
+   (flag  H_FORCE) == 0) {/* and we are not forced */
if (strcmp(name, serial#) == 0 ||
(strcmp(name, ethaddr) == 0
 #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE)  defined(CONFIG_ETHADDR)
- strcmp(ep-data, MK_STR(CONFIG_ETHADDR)) != 0
+ strcmp(oldval, MK_STR(CONFIG_ETHADDR)) != 0
 #endif /* CONFIG_OVERWRITE_ETHADDR_ONCE  CONFIG_ETHADDR */
)) {
printf(Can't overwrite \%s\\n, name);
return 1;
}
+   }
 #endif
+   /*
+* When we change baudrate, or we are doing an env default -a
+* (which will erase all variables prior to calling this),
+* we want the baudrate to actually change - for real.
+*/
+   if (oldval != NULL ||   /* variable exists */
+   (flag  H_NOCLEAR) == 0) {  /* or env is clear */
/*
 * Switch to new baudrate if new baudrate is supported
 */
if (strcmp(name, baudrate) == 0) {
-   int baudrate = simple_strtoul(argv[2], NULL, 10);
+   int baudrate = 

[U-Boot] [PATCH v4 4/7] env: add check/apply logic to himport_r()

2012-08-24 Thread Gerlando Falauto
Change hashtable so that a callback function will decide whether a
variable can be overwritten, and possibly apply the changes.

So add a new field to struct hsearch_data:

 o apply callback function to check whether a variable can be
overwritten, and possibly immediately apply the changes;
when NULL, no check is performed.

And a new argument to himport_r():
 o do_apply: whether to call the apply callback function

NOTE: This patch does not change the current behavior.

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 common/cmd_nvedit.c   |3 ++-
 common/env_common.c   |8 +---
 include/environment.h |9 +
 include/search.h  |   14 +-
 lib/hashtable.c   |   20 +++-
 5 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 493aecc..983e747 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -202,6 +202,7 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
  * environment variable, then (if successful) apply the changes to internals so
  * to make them effective.  Code for this function was taken out of
  * _do_env_set(), which now calls it instead.
+ * Also called as a callback function by himport_r().
  * Returns 0 in case of success, 1 in case of failure.
  * When (flag  H_FORCE) is set, do not print out any error message and force
  * overwriting of write-once variables.
@@ -915,7 +916,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
}
 
if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR,
-   0, NULL) == 0) {
+   0, NULL, 0 /* do_apply */) == 0) {
error(Environment import failed: errno = %d\n, errno);
return 1;
}
diff --git a/common/env_common.c b/common/env_common.c
index 8f142ed..c6e7c4c 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -133,7 +133,9 @@ const uchar default_environment[] = {
\0
 };
 
-struct hsearch_data env_htab;
+struct hsearch_data env_htab = {
+   .apply = env_check_apply,
+};
 
 static uchar __env_get_char_spec(int index)
 {
@@ -194,7 +196,7 @@ void set_default_env(const char *s)
 
if (himport_r(env_htab, (char *)default_environment,
sizeof(default_environment), '\0', 0,
-   0, NULL) == 0)
+   0, NULL, 0 /* do_apply */) == 0)
error(Environment import failed: errno = %d\n, errno);
 
gd-flags |= GD_FLG_ENV_READY;
@@ -220,7 +222,7 @@ int env_import(const char *buf, int check)
}
 
if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0,
-   0, NULL)) {
+   0, NULL, 0 /* do_apply */)) {
gd-flags |= GD_FLG_ENV_READY;
return 1;
}
diff --git a/include/environment.h b/include/environment.h
index ae3f7b6..90fb130 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -184,6 +184,15 @@ void set_default_env(const char *s);
 /* Import from binary representation into hash table */
 int env_import(const char *buf, int check);
 
+/*
+ * Check if variable name can be changed from oldval to newval,
+ * and if so, apply the changes (e.g. baudrate).
+ * When (flag  H_FORCE) is set, it does not print out any error
+ * message and forces overwriting of write-once variables.
+ */
+int env_check_apply(const char *name, const char *oldval,
+   const char *newval, int flag);
+
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */
diff --git a/include/search.h b/include/search.h
index 94d75fc..721c8ac 100644
--- a/include/search.h
+++ b/include/search.h
@@ -57,6 +57,16 @@ struct hsearch_data {
struct _ENTRY *table;
unsigned int size;
unsigned int filled;
+/*
+ * Callback function which will check whether the given change for variable
+ * name from oldval to newval may be applied or not, and possibly apply
+ * such change.
+ * When (flag  H_FORCE) is set, it shall not print out any error message and
+ * shall force overwriting of write-once variables.
+.* Must return 0 for approval, 1 for denial.
+ */
+   int (*apply)(const char *name, const char *oldval,
+   const char *newval, int flag);
 };
 
 /* Create a new hashing table which will at most contain NEL elements.  */
@@ -97,10 +107,12 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,
 /*
  * nvars: length of vars array
  * vars: array of strings (variable names) to import (nvars == 0 means all)
+ * do_apply: whether to call callback function to check the new argument,
+ * and possibly apply changes (false means accept everything)
  */
 extern int himport_r(struct hsearch_data *__htab,
 const char *__env, size_t __size, const char __sep,
-int __flag, int nvars, char * const vars[]);
+int __flag, int nvars, char * const vars[], int 

[U-Boot] [PATCH v4 7/7] env: delete selected vars not present in imported env

2012-08-24 Thread Gerlando Falauto
When variables explicitly specified on the command line are not present
in the imported env, delete them from the running env.
If the variable is also missing from the running env, issue a warning.

Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
---
 lib/hashtable.c |   48 +---
 1 file changed, 41 insertions(+), 7 deletions(-)

diff --git a/lib/hashtable.c b/lib/hashtable.c
index f3f47de..b3d0b64 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -607,22 +607,32 @@ ssize_t hexport_r(struct hsearch_data *htab, const char 
sep,
  * himport()
  */
 
-/* Check whether variable name is amongst vars[] */
-static int is_var_in_set(const char *name, int nvars, char * const vars[])
+/*
+ * Check whether variable 'name' is amongst vars[],
+ * and remove all instances by setting the pointer to NULL
+ */
+static int is_var_in_set(const char *name, int nvars, char * vars[])
 {
int i = 0;
+   int res = 0;
 
/* No variables specified means process all of them */
if (nvars == 0)
return 1;
 
for (i = 0; i  nvars; i++) {
-   if (!strcmp(name, vars[i]))
-   return 1;
+   if (vars[i] == NULL)
+   continue;
+   /* If we found it, delete all of them */
+   if (!strcmp(name, vars[i])) {
+   vars[i] = NULL;
+   res = 1;
+   }
}
-   debug(Skipping non-listed variable %s\n, name);
+   if (!res)
+   debug(Skipping non-listed variable %s\n, name);
 
-   return 0;
+   return res;
 }
 
 /*
@@ -662,9 +672,11 @@ static int is_var_in_set(const char *name, int nvars, char 
* const vars[])
 
 int himport_r(struct hsearch_data *htab,
const char *env, size_t size, const char sep, int flag,
-   int nvars, char * const vars[], int do_apply)
+   int nvars, char * const __vars[], int do_apply)
 {
char *data, *sp, *dp, *name, *value;
+   char *vars[nvars];
+   int i;
 
/* Test for correct arguments.  */
if (htab == NULL) {
@@ -681,6 +693,10 @@ int himport_r(struct hsearch_data *htab,
memcpy(data, env, size);
dp = data;
 
+   /* make a local copy of the list of variables */
+   if (nvars)
+   memcpy(vars, __vars, sizeof(__vars[0]) * nvars);
+
if ((flag  H_NOCLEAR) == 0) {
/* Destroy old hash table if one exists */
debug(Destroy Hash Table: %p table = %p\n, htab,
@@ -809,6 +825,24 @@ int himport_r(struct hsearch_data *htab,
debug(INSERT: free(data = %p)\n, data);
free(data);
 
+   /* process variables which were not considered */
+   for (i = 0; i  nvars; i++) {
+   if (vars[i] == NULL)
+   continue;
+   /*
+* All variables which were not deleted from the variable list
+* were not present in the imported env
+* This could mean two things:
+* a) if the variable was present in current env, we delete it
+* b) if the variable was not present in current env, we notify
+*it might be a typo
+*/
+   if (hdelete_r(vars[i], htab, do_apply) == 0)
+   printf(WARNING: '%s' neither in running nor in 
imported env!\n, vars[i]);
+   else
+   printf(WARNING: '%s' not in imported env, deleting 
it!\n, vars[i]);
+   }
+
debug(INSERT: done\n);
return 1;   /* everything OK */
 }
-- 
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 1/2 V2] PMIC: MAX77686: Add support for MAX77686

2012-08-24 Thread Rajeshwari Birje
Hi Joonyoung Shim,

Thank you for comments.
Sorry for late reply.

On Fri, Jun 15, 2012 at 1:20 PM, Joonyoung Shim dofm...@gmail.com wrote:
 Hi,

 2012/5/23 Rajeshwari Birje rajeshwari.bi...@gmail.com:
 ccing Lukasz Majewski.

 On Wed, May 23, 2012 at 2:27 PM, Rajeshwari Shinde
 rajeshwar...@samsung.com wrote:
 This patch adds driver and register definitions for PMIC chip
 MAX77686.

 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
 changes for V2:
- using the generic PMIC framework instead of writing separate 
 driver.
  drivers/misc/Makefile|1 +
  drivers/misc/pmic_max77686.c |   42 +++
  include/max77686_pmic.h  |  158 
 ++
  3 files changed, 201 insertions(+), 0 deletions(-)
  create mode 100644 drivers/misc/pmic_max77686.c
  create mode 100644 include/max77686_pmic.h

 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
 index 271463c..9fac190 100644
 --- a/drivers/misc/Makefile
 +++ b/drivers/misc/Makefile
 @@ -39,6 +39,7 @@ COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
  COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
  COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
  COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
 +COBJS-$(CONFIG_PMIC_MAX77686) += pmic_max77686.o
  COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
  COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o

 diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c
 new file mode 100644
 index 000..36f7f4d
 --- /dev/null
 +++ b/drivers/misc/pmic_max77686.c
 @@ -0,0 +1,42 @@
 +/*
 + *  Copyright (C) 2012 Samsung Electronics
 + *  Rajeshwari Shinde rajeshwar...@samsung.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
 + */
 +
 +#include common.h
 +#include pmic.h
 +#include max77686_pmic.h
 +
 +int pmic_init(void)
 +{
 +   struct pmic *p = get_pmic();
 +   static const char name[] = MAX77686_PMIC;
 +
 +   puts(Board PMIC init\n);
 +   p-name = name;
 +   p-interface = PMIC_I2C;
 +   p-number_of_regs = PMIC_NUM_OF_REGS;
 +   p-hw.i2c.addr = MAX77686_I2C_ADDR;
 +   p-hw.i2c.tx_num = 1;
 +   p-bus = I2C_PMIC;

 If board supports I2C_MULTI_BUS, bus number of pmic can be other value,
 so let's add function parameter for bus number.
This already has parameter for bus number which is p-bus and it does
the following during pmic probe
if (I2C_MULTI_BUS)
i2c_set_bus_num(bus);

 Thanks.

 --
 - Joonyoung Shim

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


[U-Boot] [PATCH 0/2 V3] EXYNOS5: Add MAX77686 support

2012-08-24 Thread Rajeshwari Shinde
This patch set adds support for MAX77686 support.

Changes in V3:
- Rebased on latest u-boot-samsung tree

Rajeshwari Shinde (2):
  PMIC: MAX77686: Add support for MAX77686
  SMDK5250: Config:  Enable MAX77686 pmic chip

 board/samsung/smdk5250/smdk5250.c |4 +
 drivers/misc/Makefile |1 +
 drivers/misc/pmic_max77686.c  |   42 ++
 include/configs/smdk5250.h|5 +
 include/max77686_pmic.h   |  158 +
 5 files changed, 210 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/pmic_max77686.c
 create mode 100644 include/max77686_pmic.h

-- 
1.7.4.4

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


[U-Boot] [PATCH 1/2 V3] PMIC: MAX77686: Add support for MAX77686

2012-08-24 Thread Rajeshwari Shinde
This patch adds driver and register definitions for PMIC chip
MAX77686.

Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Acked-by: Simon Glass s...@chromium.org
---
Changes in V3:
- None.
 drivers/misc/Makefile|1 +
 drivers/misc/pmic_max77686.c |   42 +++
 include/max77686_pmic.h  |  158 ++
 3 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/pmic_max77686.c
 create mode 100644 include/max77686_pmic.h

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 271463c..9fac190 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
 COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
 COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
 COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
+COBJS-$(CONFIG_PMIC_MAX77686) += pmic_max77686.o
 COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
 COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
 
diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c
new file mode 100644
index 000..36f7f4d
--- /dev/null
+++ b/drivers/misc/pmic_max77686.c
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Rajeshwari Shinde rajeshwar...@samsung.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
+ */
+
+#include common.h
+#include pmic.h
+#include max77686_pmic.h
+
+int pmic_init(void)
+{
+   struct pmic *p = get_pmic();
+   static const char name[] = MAX77686_PMIC;
+
+   puts(Board PMIC init\n);
+   p-name = name;
+   p-interface = PMIC_I2C;
+   p-number_of_regs = PMIC_NUM_OF_REGS;
+   p-hw.i2c.addr = MAX77686_I2C_ADDR;
+   p-hw.i2c.tx_num = 1;
+   p-bus = I2C_PMIC;
+
+   return 0;
+}
diff --git a/include/max77686_pmic.h b/include/max77686_pmic.h
new file mode 100644
index 000..d949ace
--- /dev/null
+++ b/include/max77686_pmic.h
@@ -0,0 +1,158 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Rajeshwari Shinde rajeshwar...@samsung.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
+ */
+
+#ifndef __MAX77686_H_
+#define __MAX77686_H_
+
+enum {
+   MAX77686_REG_PMIC_ID= 0x0,
+   MAX77686_REG_PMIC_INTSRC,
+   MAX77686_REG_PMIC_INT1,
+   MAX77686_REG_PMIC_INT2,
+   MAX77686_REG_PMIC_INT1MSK,
+   MAX77686_REG_PMIC_INT2MSK,
+
+   MAX77686_REG_PMIC_STATUS1,
+   MAX77686_REG_PMIC_STATUS2,
+
+   MAX77686_REG_PMIC_PWRON,
+   MAX77686_REG_PMIC_ONOFFDELAY,
+   MAX77686_REG_PMIC_MRSTB,
+
+   MAX77686_REG_PMIC_BUCK1CRTL = 0x10,
+   MAX77686_REG_PMIC_BUCK1OUT,
+   MAX77686_REG_PMIC_BUCK2CTRL1,
+   MAX77686_REG_PMIC_BUCK234FREQ,
+   MAX77686_REG_PMIC_BUCK2DVS1,
+   MAX77686_REG_PMIC_BUCK2DVS2,
+   MAX77686_REG_PMIC_BUCK2DVS3,
+   MAX77686_REG_PMIC_BUCK2DVS4,
+   MAX77686_REG_PMIC_BUCK2DVS5,
+   MAX77686_REG_PMIC_BUCK2DVS6,
+   MAX77686_REG_PMIC_BUCK2DVS7,
+   MAX77686_REG_PMIC_BUCK2DVS8,
+   MAX77686_REG_PMIC_BUCK3CTRL,
+   MAX77686_REG_PMIC_BUCK3DVS1,
+   MAX77686_REG_PMIC_BUCK3DVS2,
+   MAX77686_REG_PMIC_BUCK3DVS3,
+   MAX77686_REG_PMIC_BUCK3DVS4,
+   MAX77686_REG_PMIC_BUCK3DVS5,
+   MAX77686_REG_PMIC_BUCK3DVS6,
+   MAX77686_REG_PMIC_BUCK3DVS7,
+   MAX77686_REG_PMIC_BUCK3DVS8,
+   MAX77686_REG_PMIC_BUCK4CTRL1,
+   MAX77686_REG_PMIC_BUCK4DVS1 = 0x28,
+   

[U-Boot] [PATCH 2/2 V3] SMDK5250: Config: Enable MAX77686 pmic chip

2012-08-24 Thread Rajeshwari Shinde
This patch enables MAX77686 pmic chip for SMDK5250.

Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
---
Changes in V3:
- Rebased on latest u-boot-samsung tree
 board/samsung/smdk5250/smdk5250.c |4 
 include/configs/smdk5250.h|5 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/board/samsung/smdk5250/smdk5250.c 
b/board/samsung/smdk5250/smdk5250.c
index a5816e4..18dd5d2 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -29,6 +29,7 @@
 #include asm/arch/mmc.h
 #include asm/arch/pinmux.h
 #include asm/arch/sromc.h
+#include pmic.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,6 +64,9 @@ static int smc9115_pre_init(void)
 int board_init(void)
 {
gd-bd-bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+#if defined(CONFIG_PMIC)
+   pmic_init();
+#endif
return 0;
 }
 
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 27dab76..72cd048 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -208,6 +208,11 @@
 #define CONFIG_MAX_I2C_NUM 8
 #define CONFIG_SYS_I2C_SLAVE0x0
 
+/* PMIC */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_MAX77686
+
 /* Ethernet Controllor Driver */
 #ifdef CONFIG_CMD_NET
 #define CONFIG_SMC911X
-- 
1.7.4.4

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Heiko,

On 08/24/2012 12:17 PM, Heiko Schocher wrote:
 BTW: There also seems to be a bug in some of the SPL loaders:

 For example in drivers/mtd/nand/nand_spl_load.c:

  ...
  if (header-ih_os == IH_OS_LINUX) {
  /* happy - was a linux */
  nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
  spl_image.size, (void *)spl_image.load_addr);

 The problem here is that the last 64 bytes of the image are not
 copied to SDRAM. Since the header is copied which is not included
 in the spl_image.size variable.

Okay. I just noticed that it's not a bug. spl_image.size is set to
header-ih_size + header_size. So 64 is added and the complete payload
is copied.

I still would like to move to my suggestion to not copy the header and
use the mkimage header values ih_load and ih_ep directly. Right now I
don't see any showstopper for doing it this way. I'll send a patch to
change this shortly (if everything works out).

Stay tuned...

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
On 08/24/2012 12:56 PM, Stefan Roese wrote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).

Hmmm. As it seems some SPL loading drivers (block like mmc, streaming
like ymodem) are not that easily converted to skipping the header. So
I'm not so sure if we should go this way after all...

Comments?

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Daniel Schwierzeck
Hi Stefan,

2012/8/24 Stefan Roese s...@denx.de:
 On 08/24/2012 12:56 PM, Stefan Roese wrote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).

 Hmmm. As it seems some SPL loading drivers (block like mmc, streaming
 like ymodem) are not that easily converted to skipping the header. So
 I'm not so sure if we should go this way after all...

 Comments?


I did similar work for my upcoming Lantiq MIPS SoC port. In my
approach I also support compressed u-boot
images as payload (LZO, LZMA). The u-boot image is merged with SPL
image without any padding or
fixed flash offsets to achieve a maximum reduction of flash footprint.

I ended up with doing something like this:

static int spl_parse_image(const image_header_t *hdr, struct spl_image *spl)
{
   u32 magic;

   magic = image_get_magic(hdr);
   if (magic != IH_MAGIC)
   return -1;

   spl-data_addr += image_get_header_size();
   spl-entry_addr = image_get_load(hdr);
   spl-size = image_get_data_size(hdr);
   spl-comp = image_get_comp(hdr);

   if (spl-comp == IH_COMP_NONE)
   spl-load_addr = spl-entry_addr;
   else
   spl-load_addr = CONFIG_LOADADDR;

   return 0;
}

spl-data_addr points to the image header of the payload and is
initialized by the caller
dependent on the used load mechanism. If the payload is uncompressed
it can be directly copied to
its final RAM location. A compressed payload needs an intermediate
copy step if it is stored in SPI or NAND flash.
I chose CONFIG_LOADADDR. After this the decompression function
extracts the image to its final RAM location.

I think we should keep an architecture-neutral SPL image context
inside the generic SPL framework.
The content of this context should be filled by architecture/SoC/board
specific code.

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


Re: [U-Boot] [PATCH] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Stefano Babic
On 24/08/2012 15:16, Matt Sealey wrote:
 
 Oops. I picked the wrong commit id out of my local tree and there's a
 subtle mistake here.. It won't break anything but its not the one I
 wanted to submit. I'll respond this one..
 


Do not worry - I mark this pacth as read to be merged in my queue, but
it is not yet merged. I discharge it, send to the ML the right one.

Best regards,
Stefano Babic

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


[U-Boot] Blackfin BF54x Silicon revision 0.4 and uClinux

2012-08-24 Thread Dimitar Penev

Hello Gents,

My question is not directly applicable with u-boot but I think here I may 
find the answer

which I still don't get from the Analog Device forum.

Does anyone got working hardware based on Blackfin BF54x rev 0.4 (the 
current silicon revision) and uClinux 
http://blackfin.uclinux.org/gf/project/uclinux-dist ?

I know about BF548 EZKIT Lite but it uses BF548 Rev 0.2.

Thank you
Dimitar 


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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Daniel,

On 08/24/2012 01:49 PM, Daniel Schwierzeck wrote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).

 Hmmm. As it seems some SPL loading drivers (block like mmc, streaming
 like ymodem) are not that easily converted to skipping the header. So
 I'm not so sure if we should go this way after all...

 Comments?
 
 I did similar work for my upcoming Lantiq MIPS SoC port. In my
 approach I also support compressed u-boot
 images as payload (LZO, LZMA).

Yes, I thought about adding this as well. Nice.

 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.

Interesting. I'm still padding to the fixed offset. Let me look into
squeezing those two images together as well...

 I ended up with doing something like this:
 
 static int spl_parse_image(const image_header_t *hdr, struct spl_image *spl)
 {
u32 magic;
 
magic = image_get_magic(hdr);
if (magic != IH_MAGIC)
return -1;
 
spl-data_addr += image_get_header_size();
spl-entry_addr = image_get_load(hdr);
spl-size = image_get_data_size(hdr);
spl-comp = image_get_comp(hdr);
 
if (spl-comp == IH_COMP_NONE)
spl-load_addr = spl-entry_addr;
else
spl-load_addr = CONFIG_LOADADDR;
 
return 0;
 }

So you introduced a new struct spl_image and did not use struct
spl_image_info from the SPL framework? Why is that? We should
definitely consolidate to one structure here.

 spl-data_addr points to the image header of the payload and is
 initialized by the caller
 dependent on the used load mechanism.

Good idea. Looks like your spl_parse_image might be a potential
replacement for spl_parse_image_header() from this common SPL framework.

 If the payload is uncompressed
 it can be directly copied to
 its final RAM location. A compressed payload needs an intermediate
 copy step if it is stored in SPI or NAND flash.
 I chose CONFIG_LOADADDR. After this the decompression function
 extracts the image to its final RAM location.

Sounds good. Do you have some patches that you could send for review?
Did you try to keep as much platform/arch independent as possible?

 I think we should keep an architecture-neutral SPL image context
 inside the generic SPL framework.
 The content of this context should be filled by architecture/SoC/board
 specific code.

Ack. It would be great to review your code here. Please keep us informed.

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the filesize environment variable only when file read

2012-08-24 Thread Marek Vasut
Dear Lukasz Majewski,

 The filesize environment variable shall be read only when relevant
 file is read.
 
 Signed-off-by: Lukasz Majewski l.majew...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

Reviewed-by: Marek Vasut ma...@denx.de

 ---
  drivers/dfu/dfu_mmc.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
 index 2270a61..5d504df 100644
 --- a/drivers/dfu/dfu_mmc.c
 +++ b/drivers/dfu/dfu_mmc.c
 @@ -89,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct
 dfu_entity *dfu, return ret;
   }
 
 - if (dfu-layout != DFU_RAW_ADDR) {
 + if (dfu-layout != DFU_RAW_ADDR  op == DFU_OP_READ) {
   str_env = getenv(filesize);
   if (str_env == NULL) {
   puts(dfu: Wrong file size!\n);

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 v4 1/7] env: cosmetic: drop assignment i = iomux_doenv()

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 iomux_doenv() can only return 0 or 1.
 So there is no need to save its return value in variable i, as checking
 its truth value within an if statement is enough.
 
 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com

Reviewed-by: Marek Vasut ma...@denx.de

 ---
  common/cmd_nvedit.c |5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
 
 diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
 index fd05e72..b8c7676 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -239,9 +239,8 @@ int _do_env_set(int flag, int argc, char * const
 argv[]) }
 
  #ifdef CONFIG_CONSOLE_MUX
 - i = iomux_doenv(console, argv[2]);
 - if (i)
 - return i;
 + if (iomux_doenv(console, argv[2]))
 + return 1;
  #else
   /* Try assigning specified device */
   if (console_assign(console, argv[2])  0)

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 1/2] dfu:usb: Support for ext4

2012-08-24 Thread Marek Vasut
Dear Lukasz Majewski,

 Support for ext4 file system handling at DFU.
 
 Signed-off-by: Lukasz Majewski l.majew...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

Reviewed-by: Marek Vasut ma...@denx.de

[...]

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 v4 2/7] env: unify logic to check and apply changes

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 The logic of checking special parameters (e.g. baudrate, stdin, stdout,
 for a valid value and/or whether can be overwritten) and applying the
 new value to the running system is now all within a single function
 env_check_apply() which can be called whenever changes are made
 to the environment, no matter if by set, default or import.
 
 With this patch env_check_apply() is only called by env set,
 retaining previous behavior.
 
 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
[...]

Reviewed-by: Marek Vasut ma...@denx.de

but whew, you're giving me a tough time here with such change :-) At least now 
I 
see how env works ;-)

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 v4 3/7] env: make himport_r() selective on variables

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 Add 2 new arguments to himport_r():
 
  o nvars, vars: number and list of variables to take into account
(0 means ALL)
 
 NOTE: This patch does not change the current behaviour.

Reviewed-by: Marek Vasut ma...@denx.de

 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
 ---
  common/cmd_nvedit.c |3 ++-
  common/env_common.c |6 --
  include/search.h|6 +-
  lib/hashtable.c |   27 ++-
  4 files changed, 37 insertions(+), 5 deletions(-)
 
 diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
 index 2f5dcbc..493aecc 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -914,7 +914,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
   addr = (char *)ep-data;
   }
 
 - if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
 + if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR,
 + 0, NULL) == 0) {
   error(Environment import failed: errno = %d\n, errno);
   return 1;
   }
 diff --git a/common/env_common.c b/common/env_common.c
 index d9e990d..8f142ed 100644
 --- a/common/env_common.c
 +++ b/common/env_common.c
 @@ -193,7 +193,8 @@ void set_default_env(const char *s)
   }
 
   if (himport_r(env_htab, (char *)default_environment,
 - sizeof(default_environment), '\0', 0) == 0)
 + sizeof(default_environment), '\0', 0,
 + 0, NULL) == 0)
   error(Environment import failed: errno = %d\n, errno);
 
   gd-flags |= GD_FLG_ENV_READY;
 @@ -218,7 +219,8 @@ int env_import(const char *buf, int check)
   }
   }
 
 - if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0)) {
 + if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0,
 + 0, NULL)) {
   gd-flags |= GD_FLG_ENV_READY;
   return 1;
   }
 diff --git a/include/search.h b/include/search.h
 index a4a5ef4..94d75fc 100644
 --- a/include/search.h
 +++ b/include/search.h
 @@ -94,9 +94,13 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,
const char __sep, char **__resp, size_t __size,
int argc, char * const argv[]);
 
 +/*
 + * nvars: length of vars array
 + * vars: array of strings (variable names) to import (nvars == 0 means
 all) + */
  extern int himport_r(struct hsearch_data *__htab,
const char *__env, size_t __size, const char __sep,
 -  int __flag);
 +  int __flag, int nvars, char * const vars[]);
 
  /* Flags for himport_r() */
  #define  H_NOCLEAR   (1  0) /* do not clear hash table before 
importing */
 diff --git a/lib/hashtable.c b/lib/hashtable.c
 index abd61c8..0610e86 100644
 --- a/lib/hashtable.c
 +++ b/lib/hashtable.c
 @@ -603,6 +603,24 @@ ssize_t hexport_r(struct hsearch_data *htab, const
 char sep, * himport()
   */
 
 +/* Check whether variable name is amongst vars[] */
 +static int is_var_in_set(const char *name, int nvars, char * const vars[])
 +{
 + int i = 0;
 +
 + /* No variables specified means process all of them */
 + if (nvars == 0)
 + return 1;
 +
 + for (i = 0; i  nvars; i++) {
 + if (!strcmp(name, vars[i]))
 + return 1;
 + }
 + debug(Skipping non-listed variable %s\n, name);
 +
 + return 0;
 +}
 +
  /*
   * Import linearized data into hash table.
   *
 @@ -639,7 +657,8 @@ ssize_t hexport_r(struct hsearch_data *htab, const char
 sep, */
 
  int himport_r(struct hsearch_data *htab,
 -   const char *env, size_t size, const char sep, int flag)
 + const char *env, size_t size, const char sep, int flag,
 + int nvars, char * const vars[])
  {
   char *data, *sp, *dp, *name, *value;
 
 @@ -726,6 +745,8 @@ int himport_r(struct hsearch_data *htab,
   *dp++ = '\0';   /* terminate name */
 
   debug(DELETE CANDIDATE: \%s\\n, name);
 + if (!is_var_in_set(name, nvars, vars))
 + continue;
 
   if (hdelete_r(name, htab) == 0)
   debug(DELETE ERROR 
##\n);
 @@ -743,6 +764,10 @@ int himport_r(struct hsearch_data *htab,
   *sp++ = '\0';   /* terminate value */
   ++dp;
 
 + /* Skip variables which are not supposed to be processed */
 + if (!is_var_in_set(name, nvars, vars))
 + continue;
 +
   /* enter into hash table */
   e.key = name;
   e.data = value;

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 v4 4/7] env: add check/apply logic to himport_r()

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 Change hashtable so that a callback function will decide whether a
 variable can be overwritten, and possibly apply the changes.
 
 So add a new field to struct hsearch_data:
 
  o apply callback function to check whether a variable can be
 overwritten, and possibly immediately apply the changes;
 when NULL, no check is performed.
 
 And a new argument to himport_r():
  o do_apply: whether to call the apply callback function
 
 NOTE: This patch does not change the current behavior.

Reviewed-by: Marek Vasut ma...@denx.de

 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
 ---
  common/cmd_nvedit.c   |3 ++-
  common/env_common.c   |8 +---
  include/environment.h |9 +
  include/search.h  |   14 +-
  lib/hashtable.c   |   20 +++-
  5 files changed, 48 insertions(+), 6 deletions(-)
 
 diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
 index 493aecc..983e747 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -202,6 +202,7 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
   * environment variable, then (if successful) apply the changes to
 internals so * to make them effective.  Code for this function was taken
 out of * _do_env_set(), which now calls it instead.
 + * Also called as a callback function by himport_r().
   * Returns 0 in case of success, 1 in case of failure.
   * When (flag  H_FORCE) is set, do not print out any error message and
 force * overwriting of write-once variables.
 @@ -915,7 +916,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,
   }
 
   if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR,
 - 0, NULL) == 0) {
 + 0, NULL, 0 /* do_apply */) == 0) {
   error(Environment import failed: errno = %d\n, errno);
   return 1;
   }
 diff --git a/common/env_common.c b/common/env_common.c
 index 8f142ed..c6e7c4c 100644
 --- a/common/env_common.c
 +++ b/common/env_common.c
 @@ -133,7 +133,9 @@ const uchar default_environment[] = {
   \0
  };
 
 -struct hsearch_data env_htab;
 +struct hsearch_data env_htab = {
 + .apply = env_check_apply,
 +};
 
  static uchar __env_get_char_spec(int index)
  {
 @@ -194,7 +196,7 @@ void set_default_env(const char *s)
 
   if (himport_r(env_htab, (char *)default_environment,
   sizeof(default_environment), '\0', 0,
 - 0, NULL) == 0)
 + 0, NULL, 0 /* do_apply */) == 0)
   error(Environment import failed: errno = %d\n, errno);
 
   gd-flags |= GD_FLG_ENV_READY;
 @@ -220,7 +222,7 @@ int env_import(const char *buf, int check)
   }
 
   if (himport_r(env_htab, (char *)ep-data, ENV_SIZE, '\0', 0,
 - 0, NULL)) {
 + 0, NULL, 0 /* do_apply */)) {
   gd-flags |= GD_FLG_ENV_READY;
   return 1;
   }
 diff --git a/include/environment.h b/include/environment.h
 index ae3f7b6..90fb130 100644
 --- a/include/environment.h
 +++ b/include/environment.h
 @@ -184,6 +184,15 @@ void set_default_env(const char *s);
  /* Import from binary representation into hash table */
  int env_import(const char *buf, int check);
 
 +/*
 + * Check if variable name can be changed from oldval to newval,
 + * and if so, apply the changes (e.g. baudrate).
 + * When (flag  H_FORCE) is set, it does not print out any error
 + * message and forces overwriting of write-once variables.
 + */
 +int env_check_apply(const char *name, const char *oldval,
 + const char *newval, int flag);
 +
  #endif /* DO_DEPS_ONLY */
 
  #endif /* _ENVIRONMENT_H_ */
 diff --git a/include/search.h b/include/search.h
 index 94d75fc..721c8ac 100644
 --- a/include/search.h
 +++ b/include/search.h
 @@ -57,6 +57,16 @@ struct hsearch_data {
   struct _ENTRY *table;
   unsigned int size;
   unsigned int filled;
 +/*
 + * Callback function which will check whether the given change for
 variable + * name from oldval to newval may be applied or not, and
 possibly apply + * such change.
 + * When (flag  H_FORCE) is set, it shall not print out any error message
 and + * shall force overwriting of write-once variables.
 +.* Must return 0 for approval, 1 for denial.
 + */
 + int (*apply)(const char *name, const char *oldval,
 + const char *newval, int flag);
  };
 
  /* Create a new hashing table which will at most contain NEL elements.  */
 @@ -97,10 +107,12 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,
  /*
   * nvars: length of vars array
   * vars: array of strings (variable names) to import (nvars == 0 means
 all) + * do_apply: whether to call callback function to check the new
 argument, + * and possibly apply changes (false means accept everything)
   */
  extern int himport_r(struct hsearch_data *__htab,
const char *__env, size_t __size, const char __sep,
 -  

Re: [U-Boot] [PATCH v4 5/7] env: check and apply changes on delete/destroy

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
 ---
  common/cmd_nvedit.c |2 +-
  include/search.h|5 +++--
  lib/hashtable.c |   16 ++--
  3 files changed, 14 insertions(+), 9 deletions(-)
 
[...]

Reviewed-by: Marek Vasut ma...@denx.de

but I'm starting to get a bit lost around this time ;-)

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 v4 6/7] env: make env default selective, check and apply

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 Change the syntax (user API) for env default:
   -f: override write-once variables
   var... : accept individual variable(s)
   -a: all (resetting the whole env is NOT the default behavior)
 
 Enable variable checking and make changes effective by
 enabling do_apply argument to himport_r().
 
 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com
 ---
  common/cmd_nvedit.c   |   40 ++--
  common/env_common.c   |   28 +++-
  include/environment.h |3 +++
  3 files changed, 64 insertions(+), 7 deletions(-)
 
 diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
 index b0860f3..ac2b985 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -656,14 +656,41 @@ int envmatch(uchar *s1, int i2)
   return -1;
  }
 
 -static int do_env_default(cmd_tbl_t *cmdtp, int flag,
 +static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
 int argc, char * const argv[])
  {
 - if (argc != 2 || strcmp(argv[1], -f) != 0)
 - return CMD_RET_USAGE;
 + int all = 0, flag = 0;
 
 - set_default_env(## Resetting to default environment\n);
 - return 0;
 + debug(Initial value for argc=%d\n, argc);
 + while (--argc  0  **++argv == '-') {

m ... **++argv, yummy :) This might use some cleanup, to make more 
readable. 
Don't we have some getopt or something too ?

 + char *arg = *argv;
 +
 + while (*++arg) {
 + switch (*arg) {
 + case 'a':   /* default all */
 + all = 1;
 + break;
 + case 'f':   /* force */
 + flag |= H_FORCE;
 + break;
 + default:
 + return cmd_usage(cmdtp);
 + }
 + }
 + }
 + debug(Final value for argc=%d\n, argc);
 + if (all  (argc == 0)) {
 + /* Reset the whole environment */
 + set_default_env(## Resetting to default environment\n);
 + return 0;
 + }
 + if (!all  (argc  0)) {
 + /* Reset individual variables */
 + set_default_vars(argc, argv);
 + return 0;
 + }
 +
 + return cmd_usage(cmdtp);
  }
 
  static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
 @@ -994,7 +1021,8 @@ U_BOOT_CMD(
  #if defined(CONFIG_CMD_ASKENV)
   ask name [message] [size] - ask for environment variable\nenv 
  #endif
 - default -f - reset default environment\n
 + default [-f] -a - [forcibly] reset default environment\n
 + env default [-f] var [...] - [forcibly] reset variable(s) to their
 default values\n #if defined(CONFIG_CMD_EDITENV)
   env edit name - edit environment variable\n
  #endif
 diff --git a/common/env_common.c b/common/env_common.c
 index c6e7c4c..482d715 100644
 --- a/common/env_common.c
 +++ b/common/env_common.c
 @@ -177,6 +177,11 @@ const uchar *env_get_addr(int index)
 
  void set_default_env(const char *s)
  {
 + /*
 +  * By default, do not apply changes as they will eventually
 +  * be applied by someone else
 +  */
 + int do_apply = 0;
   if (sizeof(default_environment)  ENV_SIZE) {
   puts(*** Error - default environment is too large\n\n);
   return;
 @@ -188,6 +193,14 @@ void set_default_env(const char *s)
   using default environment\n\n,
   s + 1);
   } else {
 + /*
 +  * This set_to_default was explicitly asked for
 +  * by the user, as opposed to being a recovery
 +  * mechanism.  Therefore we check every single
 +  * variable and apply changes to the system
 +  * right away (e.g. baudrate, console).
 +  */
 + do_apply = 1;
   puts(s);
   }
   } else {
 @@ -196,12 +209,25 @@ void set_default_env(const char *s)
 
   if (himport_r(env_htab, (char *)default_environment,
   sizeof(default_environment), '\0', 0,
 - 0, NULL, 0 /* do_apply */) == 0)
 + 0, NULL, do_apply) == 0)
   error(Environment import failed: errno = %d\n, errno);
 
   gd-flags |= GD_FLG_ENV_READY;
  }
 
 +
 +/* [re]set individual variables to their value in the default environment
 */ +int set_default_vars(int nvars, char * const vars[])
 +{
 + /*
 +  * Special use-case: import from default environment
 +  * (and use \0 as a separator)
 +  */
 + return himport_r(env_htab, (const char *)default_environment,
 + sizeof(default_environment), '\0', H_NOCLEAR,
 + nvars, vars, 1 /* do_apply */);
 +}
 +
  /*
   * Check 

Re: [U-Boot] [PATCH v4 7/7] env: delete selected vars not present in imported env

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 When variables explicitly specified on the command line are not present
 in the imported env, delete them from the running env.
 If the variable is also missing from the running env, issue a warning.
 
 Signed-off-by: Gerlando Falauto gerlando.fala...@keymile.com

Whew! I made it through ... it wasn't that scary in the end ;-)

 ---
  lib/hashtable.c |   48 +---
  1 file changed, 41 insertions(+), 7 deletions(-)
 
 diff --git a/lib/hashtable.c b/lib/hashtable.c
 index f3f47de..b3d0b64 100644
 --- a/lib/hashtable.c
 +++ b/lib/hashtable.c
 @@ -607,22 +607,32 @@ ssize_t hexport_r(struct hsearch_data *htab, const
 char sep, * himport()
   */
 
 -/* Check whether variable name is amongst vars[] */
 -static int is_var_in_set(const char *name, int nvars, char * const vars[])
 +/*
 + * Check whether variable 'name' is amongst vars[],
 + * and remove all instances by setting the pointer to NULL
 + */
 +static int is_var_in_set(const char *name, int nvars, char * vars[])
  {
   int i = 0;
 + int res = 0;
 
   /* No variables specified means process all of them */
   if (nvars == 0)
   return 1;
 
   for (i = 0; i  nvars; i++) {
 - if (!strcmp(name, vars[i]))
 - return 1;
 + if (vars[i] == NULL)
 + continue;
 + /* If we found it, delete all of them */
 + if (!strcmp(name, vars[i])) {
 + vars[i] = NULL;
 + res = 1;

break here ?

 + }
   }
 - debug(Skipping non-listed variable %s\n, name);
 + if (!res)
 + debug(Skipping non-listed variable %s\n, name);
 
 - return 0;
 + return res;
  }
 
  /*
 @@ -662,9 +672,11 @@ static int is_var_in_set(const char *name, int nvars,
 char * const vars[])
 
  int himport_r(struct hsearch_data *htab,
   const char *env, size_t size, const char sep, int flag,
 - int nvars, char * const vars[], int do_apply)
 + int nvars, char * const __vars[], int do_apply)

Two underscores are reserved, use something else ;-)

  {
   char *data, *sp, *dp, *name, *value;
 + char *vars[nvars];
 + int i;
 
   /* Test for correct arguments.  */
   if (htab == NULL) {
 @@ -681,6 +693,10 @@ int himport_r(struct hsearch_data *htab,
   memcpy(data, env, size);
   dp = data;
 
 + /* make a local copy of the list of variables */
 + if (nvars)
 + memcpy(vars, __vars, sizeof(__vars[0]) * nvars);
 +
   if ((flag  H_NOCLEAR) == 0) {
   /* Destroy old hash table if one exists */
   debug(Destroy Hash Table: %p table = %p\n, htab,
 @@ -809,6 +825,24 @@ int himport_r(struct hsearch_data *htab,
   debug(INSERT: free(data = %p)\n, data);
   free(data);
 
 + /* process variables which were not considered */
 + for (i = 0; i  nvars; i++) {
 + if (vars[i] == NULL)
 + continue;
 + /*
 +  * All variables which were not deleted from the variable list
 +  * were not present in the imported env
 +  * This could mean two things:
 +  * a) if the variable was present in current env, we delete it
 +  * b) if the variable was not present in current env, we notify
 +  *it might be a typo
 +  */
 + if (hdelete_r(vars[i], htab, do_apply) == 0)
 + printf(WARNING: '%s' neither in running nor in 
 imported 
env!\n,
 vars[i]); +   else
 + printf(WARNING: '%s' not in imported env, deleting it!
\n, vars[i]);
 + }
 +
   debug(INSERT: done\n);
   return 1;   /* everything OK */
  }

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


Re: [U-Boot] [PATCH v4 6/7] env: make env default selective, check and apply

2012-08-24 Thread Gerlando Falauto

On 08/24/2012 04:56 PM, Marek Vasut wrote:

Dear Gerlando Falauto,


Change the syntax (user API) for env default:
   -f: override write-once variables
   var... : accept individual variable(s)
   -a: all (resetting the whole env is NOT the default behavior)

Enable variable checking and make changes effective by
enabling do_apply argument to himport_r().

Signed-off-by: Gerlando Falautogerlando.fala...@keymile.com
---
  common/cmd_nvedit.c   |   40 ++--
  common/env_common.c   |   28 +++-
  include/environment.h |3 +++
  3 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index b0860f3..ac2b985 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -656,14 +656,41 @@ int envmatch(uchar *s1, int i2)
return -1;
  }

-static int do_env_default(cmd_tbl_t *cmdtp, int flag,
+static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
  int argc, char * const argv[])
  {
-   if (argc != 2 || strcmp(argv[1], -f) != 0)
-   return CMD_RET_USAGE;
+   int all = 0, flag = 0;

-   set_default_env(## Resetting to default environment\n);
-   return 0;
+   debug(Initial value for argc=%d\n, argc);
+   while (--argc  0  **++argv == '-') {


m ... **++argv, yummy :) This might use some cleanup, to make more readable.


Uhm, this pattern is being used all over the place on that file (that's 
where I copied it from).



Don't we have some getopt or something too ?


Not that I (or git grep) know of.




+   char *arg = *argv;
+
+   while (*++arg) {
+   switch (*arg) {
+   case 'a':   /* default all */
+   all = 1;
+   break;
+   case 'f':   /* force */
+   flag |= H_FORCE;
+   break;
+   default:
+   return cmd_usage(cmdtp);
+   }
+   }
+   }
+   debug(Final value for argc=%d\n, argc);
+   if (all  (argc == 0)) {
+   /* Reset the whole environment */
+   set_default_env(## Resetting to default environment\n);
+   return 0;
+   }
+   if (!all  (argc  0)) {
+   /* Reset individual variables */
+   set_default_vars(argc, argv);
+   return 0;
+   }
+
+   return cmd_usage(cmdtp);
  }

  static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
@@ -994,7 +1021,8 @@ U_BOOT_CMD(
  #if defined(CONFIG_CMD_ASKENV)
ask name [message] [size] - ask for environment variable\nenv 
  #endif
-   default -f - reset default environment\n
+   default [-f] -a - [forcibly] reset default environment\n
+   env default [-f] var [...] - [forcibly] reset variable(s) to their
default values\n #if defined(CONFIG_CMD_EDITENV)
env edit name - edit environment variable\n
  #endif
diff --git a/common/env_common.c b/common/env_common.c
index c6e7c4c..482d715 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -177,6 +177,11 @@ const uchar *env_get_addr(int index)

  void set_default_env(const char *s)
  {
+   /*
+* By default, do not apply changes as they will eventually
+* be applied by someone else
+*/
+   int do_apply = 0;
if (sizeof(default_environment)  ENV_SIZE) {
puts(*** Error - default environment is too large\n\n);
return;
@@ -188,6 +193,14 @@ void set_default_env(const char *s)
using default environment\n\n,
s + 1);
} else {
+   /*
+* This set_to_default was explicitly asked for
+* by the user, as opposed to being a recovery
+* mechanism.  Therefore we check every single
+* variable and apply changes to the system
+* right away (e.g. baudrate, console).
+*/
+   do_apply = 1;
puts(s);
}
} else {
@@ -196,12 +209,25 @@ void set_default_env(const char *s)

if (himport_r(env_htab, (char *)default_environment,
sizeof(default_environment), '\0', 0,
-   0, NULL, 0 /* do_apply */) == 0)
+   0, NULL, do_apply) == 0)
error(Environment import failed: errno = %d\n, errno);

gd-flags |= GD_FLG_ENV_READY;
  }

+
+/* [re]set individual variables to their value in the default environment
*/ +int set_default_vars(int nvars, char * const vars[])
+{
+   /*
+* Special use-case: import from default environment
+* (and use \0 as a separator)
+*/
+   

Re: [U-Boot] [PATCH v3 0/6] env: handle special variables and selective env default

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 On 08/13/2012 12:11 PM, Wolfgang Denk wrote:
  Dear Holger Brunck,
  
  In message5028ab80.5030...@keymile.com  you wrote:
  time to do updates here I propose the following. I could prepare a
  branch as you suggested based on current denx master with this
  changeset. But where and how should I push it to git.denx.de? Or will
  you prepare this branch?
  
  I already did.
  
  is this branch public available? I don't find this branch on
  git.denx.de.
  
  Oops.  Please try again now.
 
 Actually, the branch does not currently compile due to some changes to
 the trunk introduced in the meantime. So I am sending a new v4 patch
 series based on the current master. Please note that the first patch of
 the new series is cosmetic only and independent from all others.

I did some review :)

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 v4 7/7] env: delete selected vars not present in imported env

2012-08-24 Thread Gerlando Falauto

On 08/24/2012 04:58 PM, Marek Vasut wrote:

Dear Gerlando Falauto,


When variables explicitly specified on the command line are not present
in the imported env, delete them from the running env.
If the variable is also missing from the running env, issue a warning.

Signed-off-by: Gerlando Falautogerlando.fala...@keymile.com


Whew! I made it through ... it wasn't that scary in the end ;-)


---
  lib/hashtable.c |   48 +---
  1 file changed, 41 insertions(+), 7 deletions(-)

diff --git a/lib/hashtable.c b/lib/hashtable.c
index f3f47de..b3d0b64 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -607,22 +607,32 @@ ssize_t hexport_r(struct hsearch_data *htab, const
char sep, * himport()
   */

-/* Check whether variable name is amongst vars[] */
-static int is_var_in_set(const char *name, int nvars, char * const vars[])
+/*
+ * Check whether variable 'name' is amongst vars[],
+ * and remove all instances by setting the pointer to NULL
+ */
+static int is_var_in_set(const char *name, int nvars, char * vars[])
  {
int i = 0;
+   int res = 0;

/* No variables specified means process all of them */
if (nvars == 0)
return 1;

for (i = 0; i  nvars; i++) {
-   if (!strcmp(name, vars[i]))
-   return 1;
+   if (vars[i] == NULL)
+   continue;
+   /* If we found it, delete all of them */
+   if (!strcmp(name, vars[i])) {
+   vars[i] = NULL;
+   res = 1;


break here ?


Nope, if we find it, we should delete all of them (see comment above).




+   }
}
-   debug(Skipping non-listed variable %s\n, name);
+   if (!res)
+   debug(Skipping non-listed variable %s\n, name);

-   return 0;
+   return res;
  }

  /*
@@ -662,9 +672,11 @@ static int is_var_in_set(const char *name, int nvars,
char * const vars[])

  int himport_r(struct hsearch_data *htab,
const char *env, size_t size, const char sep, int flag,
-   int nvars, char * const vars[], int do_apply)
+   int nvars, char * const __vars[], int do_apply)


Two underscores are reserved, use something else ;-)


Like... one? three? ;-)




  {
char *data, *sp, *dp, *name, *value;
+   char *vars[nvars];
+   int i;

/* Test for correct arguments.  */
if (htab == NULL) {
@@ -681,6 +693,10 @@ int himport_r(struct hsearch_data *htab,
memcpy(data, env, size);
dp = data;

+   /* make a local copy of the list of variables */
+   if (nvars)
+   memcpy(vars, __vars, sizeof(__vars[0]) * nvars);
+
if ((flag  H_NOCLEAR) == 0) {
/* Destroy old hash table if one exists */
debug(Destroy Hash Table: %p table = %p\n, htab,
@@ -809,6 +825,24 @@ int himport_r(struct hsearch_data *htab,
debug(INSERT: free(data = %p)\n, data);
free(data);

+   /* process variables which were not considered */
+   for (i = 0; i  nvars; i++) {
+   if (vars[i] == NULL)
+   continue;
+   /*
+* All variables which were not deleted from the variable list
+* were not present in the imported env
+* This could mean two things:
+* a) if the variable was present in current env, we delete it
+* b) if the variable was not present in current env, we notify
+*it might be a typo
+*/
+   if (hdelete_r(vars[i], htab, do_apply) == 0)
+   printf(WARNING: '%s' neither in running nor in imported

env!\n,

vars[i]); + else
+   printf(WARNING: '%s' not in imported env, deleting it!

\n, vars[i]);

+   }
+
debug(INSERT: done\n);
return 1;   /* everything OK */
  }


Best regards,
Marek Vasut


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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Daniel Schwierzeck
Hi Stefan,

2012/8/24 Stefan Roese s...@denx.de:
 Hi Daniel,

 On 08/24/2012 01:49 PM, Daniel Schwierzeck wrote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).

 Hmmm. As it seems some SPL loading drivers (block like mmc, streaming
 like ymodem) are not that easily converted to skipping the header. So
 I'm not so sure if we should go this way after all...

 Comments?

 I did similar work for my upcoming Lantiq MIPS SoC port. In my
 approach I also support compressed u-boot
 images as payload (LZO, LZMA).

 Yes, I thought about adding this as well. Nice.

 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.

 Interesting. I'm still padding to the fixed offset. Let me look into
 squeezing those two images together as well...

 I ended up with doing something like this:

 static int spl_parse_image(const image_header_t *hdr, struct spl_image *spl)
 {
u32 magic;

magic = image_get_magic(hdr);
if (magic != IH_MAGIC)
return -1;

spl-data_addr += image_get_header_size();
spl-entry_addr = image_get_load(hdr);
spl-size = image_get_data_size(hdr);
spl-comp = image_get_comp(hdr);

if (spl-comp == IH_COMP_NONE)
spl-load_addr = spl-entry_addr;
else
spl-load_addr = CONFIG_LOADADDR;

return 0;
 }

 So you introduced a new struct spl_image and did not use struct
 spl_image_info from the SPL framework? Why is that? We should
 definitely consolidate to one structure here.

I implemented this after the initial SPL infrastructure got merged
into mainline one year ago.
At this time a generic SPL framework did not exist ;)


 spl-data_addr points to the image header of the payload and is
 initialized by the caller
 dependent on the used load mechanism.

 Good idea. Looks like your spl_parse_image might be a potential
 replacement for spl_parse_image_header() from this common SPL framework.

 If the payload is uncompressed
 it can be directly copied to
 its final RAM location. A compressed payload needs an intermediate
 copy step if it is stored in SPI or NAND flash.
 I chose CONFIG_LOADADDR. After this the decompression function
 extracts the image to its final RAM location.

 Sounds good. Do you have some patches that you could send for review?
 Did you try to keep as much platform/arch independent as possible?

Not yet. I had not time yet to adopt my work to the new common SPL framework.

My current SPL solution is queued here:
http://dev.phrozen.org/gitweb/?p=uboot-upstream.git;a=commitdiff;h=39165fa145b2d959f1eaa6faa3ab3053823bb985


 I think we should keep an architecture-neutral SPL image context
 inside the generic SPL framework.
 The content of this context should be filled by architecture/SoC/board
 specific code.

 Ack. It would be great to review your code here. Please keep us informed.


Actually this was my response to your original question.
Quote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).

So I suggest to not remove the 'struct spl_image_info'.

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Tom Rini
On 08/24/2012 12:01 AM, Stefan Roese wrote:
 Hi Tom,
 
 On 08/23/2012 11:39 PM, Tom Rini wrote:
 On 08/23/2012 01:12 AM, Stefan Roese wrote:

 This patch enables the SPL framework to be used on powerpc platforms
 and not only ARM.
 [snip]
 +#ifdef CONFIG_ARM
 gd = gdata;
 +#endif

 So, here's what I don't understand.  On ARM, in general, we can't rely
 on the global data pointer register (r8) to be set to a useful value, so
 we do the above to ensure it points to something useful.  Are you always
 able to rely on r2 it looks like pointing to something useful?  Or do
 you take care of this much earlier on in powerpc?  Thanks!
 
 You are correct, I missed something here. r2 was still configured to the
 value written to it from the real U-Boot (pointing to internal SRAM).
 
 I can't use the code in preloader_console_init() though to setup the gd
 pointer. As I need to write some values in gd *before* calling
 preloader_console_init() (mainly clocks for serial driver). And since
 this gd stuff is quite platform specific, we should probably move this
 into an platform/arch spl file instead. As you also mentioned in another
 reply to create an arch/${ARCH}/lib/spl.c file.
 
 What do you think? Can you move this gd init stuff into such a common
 ARM spl file in the next patchset version?

Yes.  We should probably say it's the job of board_init_f.  I know full
U-Boot does it at the start of board_init_r but I think for SPL it makes
sense to document that board_init_f does any early init it needs to,
clears BSS, sets up gd and calls board_init_r.

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
Hi Daniel,

On 08/24/2012 04:11 PM, Stefan Roese wrote:
 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.
 
 Interesting. I'm still padding to the fixed offset. Let me look into
 squeezing those two images together as well...

Looks good. One question though: How do you make sure, that your SPL
image length is 4-byte aligned?

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
On 08/24/2012 05:55 PM, Tom Rini wrote:
 So, here's what I don't understand.  On ARM, in general, we can't rely
 on the global data pointer register (r8) to be set to a useful value, so
 we do the above to ensure it points to something useful.  Are you always
 able to rely on r2 it looks like pointing to something useful?  Or do
 you take care of this much earlier on in powerpc?  Thanks!

 You are correct, I missed something here. r2 was still configured to the
 value written to it from the real U-Boot (pointing to internal SRAM).

 I can't use the code in preloader_console_init() though to setup the gd
 pointer. As I need to write some values in gd *before* calling
 preloader_console_init() (mainly clocks for serial driver). And since
 this gd stuff is quite platform specific, we should probably move this
 into an platform/arch spl file instead. As you also mentioned in another
 reply to create an arch/${ARCH}/lib/spl.c file.

 What do you think? Can you move this gd init stuff into such a common
 ARM spl file in the next patchset version?
 
 Yes.  We should probably say it's the job of board_init_f.  I know full
 U-Boot does it at the start of board_init_r but I think for SPL it makes
 sense to document that board_init_f does any early init it needs to,
 clears BSS, sets up gd and calls board_init_r.

Full ack. In my next patchset version, I already extracted this gd setup
into board_init_f().

Thanks,
Stefan



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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Tom Rini
On 08/24/2012 09:07 AM, Stefan Roese wrote:
 On 08/24/2012 05:55 PM, Tom Rini wrote:
 So, here's what I don't understand.  On ARM, in general, we can't rely
 on the global data pointer register (r8) to be set to a useful value, so
 we do the above to ensure it points to something useful.  Are you always
 able to rely on r2 it looks like pointing to something useful?  Or do
 you take care of this much earlier on in powerpc?  Thanks!

 You are correct, I missed something here. r2 was still configured to the
 value written to it from the real U-Boot (pointing to internal SRAM).

 I can't use the code in preloader_console_init() though to setup the gd
 pointer. As I need to write some values in gd *before* calling
 preloader_console_init() (mainly clocks for serial driver). And since
 this gd stuff is quite platform specific, we should probably move this
 into an platform/arch spl file instead. As you also mentioned in another
 reply to create an arch/${ARCH}/lib/spl.c file.

 What do you think? Can you move this gd init stuff into such a common
 ARM spl file in the next patchset version?

 Yes.  We should probably say it's the job of board_init_f.  I know full
 U-Boot does it at the start of board_init_r but I think for SPL it makes
 sense to document that board_init_f does any early init it needs to,
 clears BSS, sets up gd and calls board_init_r.
 
 Full ack. In my next patchset version, I already extracted this gd setup
 into board_init_f().

OK good, I just booted and reset my arm9 platform with this
proof-of-concepted over.  I should post v4 today.

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Daniel Schwierzeck
Hi Stefan,

2012/8/24 Stefan Roese stefan.ro...@gmail.com:
 Hi Daniel,

 On 08/24/2012 04:11 PM, Stefan Roese wrote:
 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.

 Interesting. I'm still padding to the fixed offset. Let me look into
 squeezing those two images together as well...

 Looks good. One question though: How do you make sure, that your SPL
 image length is 4-byte aligned?

I have 4-byte alignments for each section and for each address symbol
in my linker script.
Actually all MIPS linker scripts do this.

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


Re: [U-Boot] [PATCH] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Matt Sealey

Oops. I picked the wrong commit id out of my local tree and there's a subtle 
mistake here.. It won't break anything but its not the one I wanted to submit. 
I'll respond this one..

-- 
Matt Sealey m...@genesi-usa.com
Product Development Analyst, Genesi USA, Inc.

On Aug 23, 2012, at 3:27 PM, Matt Sealey m...@genesi-usa.com wrote:

 We have no idea where the DCD was derived from for Smartbook support, but they
 differ from the Smarttop settings, MX51EVK settings and certainly don't
 correspond to any shipped or development version of U-Boot that Genesi has 
 ever
 had on any Smartbook.
 
 So, copy the calibrated, verified settings from the U-Boot as shipped with 
 every
 Smartbook since retail production. Remove those few settings that just set the
 POR defaults which have already been confirmed for the previous Smarttop DCD
 change.
 
 One of the lines is specific to i.MX51 TO3 designs and therefore TO2 
 Smartbooks
 will possibly not work so reliably with this new DCD; that said, TO2 
 Smartbooks
 basically don't exist at retail and the number of units in the world is less
 than 5 (3 of which are at the Genesi office or owned by Genesi employees).
 
 Many hours of memory testing confirms the new settings are stable.
 
 Signed-off-by: Matt Sealey m...@genesi-usa.com
 Cc: Stefano Babic sba...@denx.de
 Cc: Marek Vasut ma...@denx.de
 ---
 board/genesi/mx51_efikamx/imximage_sb.cfg |   46 +
 1 file changed, 20 insertions(+), 26 deletions(-)
 
 diff --git a/board/genesi/mx51_efikamx/imximage_sb.cfg 
 b/board/genesi/mx51_efikamx/imximage_sb.cfg
 index 878146f..57ccad0 100644
 --- a/board/genesi/mx51_efikamx/imximage_sb.cfg
 +++ b/board/genesi/mx51_efikamx/imximage_sb.cfg
 @@ -1,5 +1,7 @@
 #
 +# Copyright (C) 2009 Pegatron Corporation
 # Copyright (C) 2010 Marek Vasut marek.va...@gmail.com
 +# Copyright (C) 2009-2012 Genesi USA, Inc.
 #
 # BASED ON: imx51evk
 #
 @@ -43,30 +45,22 @@ BOOT_FROMspi
 #Address  absolute address of the register
 #value  value to be stored in the register
 
 -# Setting IOMUXC
 -DATA 4 0x73fa88a0 0x200
 -DATA 4 0x73fa850c 0x20c3
 -DATA 4 0x73fa8510 0x20c3
 -DATA 4 0x73fa883c 0x2
 -DATA 4 0x73fa8848 0x2
 -DATA 4 0x73fa84b8 0xe7
 -DATA 4 0x73fa84bc 0x45
 -DATA 4 0x73fa84c0 0x45
 -DATA 4 0x73fa84c4 0x45
 -DATA 4 0x73fa84c8 0x45
 -DATA 4 0x73fa8820 0x0
 -DATA 4 0x73fa84a4 0x5
 -DATA 4 0x73fa84a8 0x5
 -DATA 4 0x73fa84ac 0xe3
 -DATA 4 0x73fa84b0 0xe3
 -DATA 4 0x73fa84b4 0xe3
 -DATA 4 0x73fa84cc 0xe3
 -DATA 4 0x73fa84d0 0xe2
 -
 -DATA 4 0x73fa882c 0x4
 -DATA 4 0x73fa88a4 0x4
 -DATA 4 0x73fa88ac 0x4
 -DATA 4 0x73fa88b8 0x4
 +# DDR bus IOMUX PAD settings
 +DATA 4 0x73fa88a0 0x200# GRP_INMODE1
 +DATA 4 0x73fa850c 0x20c5# SDODT1
 +DATA 4 0x73fa8510 0x20c5# SDODT0
 +DATA 4 0x73fa8848 0x4# DDR_A1
 +DATA 4 0x73fa84b8 0xe7# DRAM_SDCLK
 +DATA 4 0x73fa84bc 0x45# DRAM_SDQS0
 +DATA 4 0x73fa84c0 0x45# DRAM_SDQS1
 +DATA 4 0x73fa84c4 0x45# DRAM_SDQS2
 +DATA 4 0x73fa84c8 0x45# DRAM_SDQS3
 +DATA 4 0x73fa8820 0x0# DDRPKS
 +DATA 4 0x73fa84ac 0xe5# SDWE
 +DATA 4 0x73fa84b0 0xe5# SDCKE0
 +DATA 4 0x73fa84b4 0xe5# SDCKE1
 +DATA 4 0x73fa84cc 0xe5# DRAM_CS0
 +DATA 4 0x73fa84d0 0xe4# DRAM_CS1
 
 # Setting DDR for micron
 # 13 Rows, 10 Cols, 32 bit, SREF=4 Micron Model
 @@ -108,7 +102,7 @@ DATA 4 0x83fd9014 0x8014
 DATA 4 0x83fd9014 0x8014
 DATA 4 0x83fd9014 0x0632801c
 DATA 4 0x83fd9014 0x0380801d
 -DATA 4 0x83fd9014 0x0040801d
 +DATA 4 0x83fd9014 0x0042801d
 DATA 4 0x83fd9014 0x8004
 
 # Write to CTL0
 @@ -116,7 +110,7 @@ DATA 4 0x83fd9000 0xb2a2
 # Write to CTL1
 DATA 4 0x83fd9008 0xb2a2
 # ESDMISC
 -DATA 4 0x83fd9010 0xcaaaf6d0
 +DATA 4 0x83fd9010 0x000ad6d0
 #ESDCTL_ESDCDLYGD
 DATA 4 0x83fd9034 0x9000
 DATA 4 0x83fd9014 0x
 -- 
 1.7.9.5
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Matt Sealey
We have no idea where the DCD was derived from for Smartbook support, but they
differ from the Smarttop settings, MX51EVK settings and certainly don't
correspond to any shipped or development version of U-Boot that Genesi has ever
had on any Smartbook.

So, copy the calibrated, verified settings from the U-Boot as shipped with every
Smartbook since retail production. Remove those few settings that just set the
POR defaults which have already been confirmed for the previous Smarttop DCD
change.

One of the lines is specific to i.MX51 TO3 designs and therefore TO2 Smartbooks
will possibly not work so reliably with this new DCD; that said, TO2 Smartbooks
basically don't exist at retail and the number of units in the world is less
than 5 (3 of which are at the Genesi office or owned by Genesi employees).

Many hours of memory testing confirms the new settings are stable.

Patch v2:
 * picked the correct commit from our development tree, correcting tuned DDR 
ODF setting
   (which was correct anyway)

Signed-off-by: Matt Sealey m...@genesi-usa.com
Cc: Stefano Babic sba...@denx.de
Cc: Marek Vasut ma...@denx.de
---
 board/genesi/mx51_efikamx/imximage_sb.cfg |   44 +
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/board/genesi/mx51_efikamx/imximage_sb.cfg 
b/board/genesi/mx51_efikamx/imximage_sb.cfg
index 878146f..26d259f 100644
--- a/board/genesi/mx51_efikamx/imximage_sb.cfg
+++ b/board/genesi/mx51_efikamx/imximage_sb.cfg
@@ -1,5 +1,7 @@
 #
+# Copyright (C) 2009 Pegatron Corporation
 # Copyright (C) 2010 Marek Vasut marek.va...@gmail.com
+# Copyright (C) 2009-2012 Genesi USA, Inc.
 #
 # BASED ON: imx51evk
 #
@@ -43,30 +45,22 @@ BOOT_FROM   spi
 #  Address   absolute address of the register
 #  value value to be stored in the register
 
-# Setting IOMUXC
-DATA 4 0x73fa88a0 0x200
-DATA 4 0x73fa850c 0x20c3
-DATA 4 0x73fa8510 0x20c3
-DATA 4 0x73fa883c 0x2
-DATA 4 0x73fa8848 0x2
-DATA 4 0x73fa84b8 0xe7
-DATA 4 0x73fa84bc 0x45
-DATA 4 0x73fa84c0 0x45
-DATA 4 0x73fa84c4 0x45
-DATA 4 0x73fa84c8 0x45
-DATA 4 0x73fa8820 0x0
-DATA 4 0x73fa84a4 0x5
-DATA 4 0x73fa84a8 0x5
-DATA 4 0x73fa84ac 0xe3
-DATA 4 0x73fa84b0 0xe3
-DATA 4 0x73fa84b4 0xe3
-DATA 4 0x73fa84cc 0xe3
-DATA 4 0x73fa84d0 0xe2
-
-DATA 4 0x73fa882c 0x4
-DATA 4 0x73fa88a4 0x4
-DATA 4 0x73fa88ac 0x4
-DATA 4 0x73fa88b8 0x4
+# DDR bus IOMUX PAD settings
+DATA 4 0x73fa88a0 0x200# GRP_INMODE1
+DATA 4 0x73fa850c 0x20c5   # SDODT1
+DATA 4 0x73fa8510 0x20c5   # SDODT0
+DATA 4 0x73fa8848 0x4  # DDR_A1
+DATA 4 0x73fa84b8 0xe7 # DRAM_SDCLK
+DATA 4 0x73fa84bc 0x45 # DRAM_SDQS0
+DATA 4 0x73fa84c0 0x45 # DRAM_SDQS1
+DATA 4 0x73fa84c4 0x45 # DRAM_SDQS2
+DATA 4 0x73fa84c8 0x45 # DRAM_SDQS3
+DATA 4 0x73fa8820 0x0  # DDRPKS
+DATA 4 0x73fa84ac 0xe5 # SDWE
+DATA 4 0x73fa84b0 0xe5 # SDCKE0
+DATA 4 0x73fa84b4 0xe5 # SDCKE1
+DATA 4 0x73fa84cc 0xe5 # DRAM_CS0
+DATA 4 0x73fa84d0 0xe4 # DRAM_CS1
 
 # Setting DDR for micron
 # 13 Rows, 10 Cols, 32 bit, SREF=4 Micron Model
@@ -108,7 +102,7 @@ DATA 4 0x83fd9014 0x8014
 DATA 4 0x83fd9014 0x8014
 DATA 4 0x83fd9014 0x0632801c
 DATA 4 0x83fd9014 0x0380801d
-DATA 4 0x83fd9014 0x0040801d
+DATA 4 0x83fd9014 0x0042801d
 DATA 4 0x83fd9014 0x8004
 
 # Write to CTL0
-- 
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] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Matt Sealey
Done. Sorry for the inconvenience.

-- 
Matt Sealey m...@genesi-usa.com
Product Development Analyst, Genesi USA, Inc.


On Fri, Aug 24, 2012 at 8:32 AM, Stefano Babic sba...@denx.de wrote:
 On 24/08/2012 15:16, Matt Sealey wrote:

 Oops. I picked the wrong commit id out of my local tree and there's a
 subtle mistake here.. It won't break anything but its not the one I
 wanted to submit. I'll respond this one..



 Do not worry - I mark this pacth as read to be merged in my queue, but
 it is not yet merged. I discharge it, send to the ML the right one.

 Best regards,
 Stefano Babic

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


Re: [U-Boot] [PATCH] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Marek Vasut
Dear Matt Sealey,

 Done. Sorry for the inconvenience.

Please stop posting.
Please submit the patch in reply to the original one.
Please read http://www.denx.de/wiki/U-Boot/Patches

  On 24/08/2012 15:16, Matt Sealey wrote:
  Oops. I picked the wrong commit id out of my local tree and there's a
  subtle mistake here.. It won't break anything but its not the one I
  wanted to submit. I'll respond this one..
  
  Do not worry - I mark this pacth as read to be merged in my queue, but
  it is not yet merged. I discharge it, send to the ML the right one.
  
  Best regards,
  Stefano Babic
  
  --
  =
  DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
  HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
  Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
  =

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
On 08/24/2012 06:19 PM, Tom Rini wrote:
 What do you think? Can you move this gd init stuff into such a common
 ARM spl file in the next patchset version?

 Yes.  We should probably say it's the job of board_init_f.  I know full
 U-Boot does it at the start of board_init_r but I think for SPL it makes
 sense to document that board_init_f does any early init it needs to,
 clears BSS, sets up gd and calls board_init_r.

 Full ack. In my next patchset version, I already extracted this gd setup
 into board_init_f().
 
 OK good, I just booted and reset my arm9 platform with this
 proof-of-concepted over.  I should post v4 today.

Great. I'll rebase my patches on top of that next week then.

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Stefan Roese
On 08/24/2012 06:42 PM, Daniel Schwierzeck wrote:
 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.

 Interesting. I'm still padding to the fixed offset. Let me look into
 squeezing those two images together as well...

 Looks good. One question though: How do you make sure, that your SPL
 image length is 4-byte aligned?
 
 I have 4-byte alignments for each section and for each address symbol
 in my linker script.
 Actually all MIPS linker scripts do this.

Yes. I have those section alignments in the linker script as well. The
problem is the end of the last (physical end in flash) section. If I
have here a string with length 7 for example, the SPL binary has a
non-4-byte aligned length.

Any ideas on this?

Thanks,
Stefan



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


Re: [U-Boot] [PATCH] efikamx: sync Smartbook DDR settings in DCD with those found in Genesi's production U-Boot

2012-08-24 Thread Matt Sealey
On Fri, Aug 24, 2012 at 12:08 PM, Marek Vasut marek.va...@gmail.com wrote:
 Dear Matt Sealey,

 Done. Sorry for the inconvenience.

 Please stop posting.
 Please submit the patch in reply to the original one.
 Please read http://www.denx.de/wiki/U-Boot/Patches

I read it, I am still getting used to this abominable system.

We can't all be the epitome of perfection as you obviously are.

-- 
Matt Sealey m...@genesi-usa.com
Product Development Analyst, Genesi USA, Inc.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/6] davinci: ea20: reorganisation LCD startup

2012-08-24 Thread Tom Rini
On Wed, Aug 15, 2012 at 09:55:40AM -0700, Tom Rini wrote:
 On Fri, Aug 10, 2012 at 09:26:41AM +0200, Bastian Ruppert wrote:
 
  Signed-off-by: Bastian Ruppert bastian.rupp...@sewerin.de
  CC: Tom Rini tr...@ti.com
  CC: Stefano Babic sba...@denx.de
 
 For the series, I'm fine with the davinci side of the changes but want
 Anatolij and Stefano to ack as well before I pull into u-boot-ti,
 thanks!

Still waiting for Anatolij (thanks Stefano!) before I take this, FYI.

-- 
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 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Tom Rini
On 08/24/2012 04:13 AM, Stefan Roese wrote:
 On 08/24/2012 12:56 PM, Stefan Roese wrote:
 I still would like to move to my suggestion to not copy the header and
 use the mkimage header values ih_load and ih_ep directly. Right now I
 don't see any showstopper for doing it this way. I'll send a patch to
 change this shortly (if everything works out).
 
 Hmmm. As it seems some SPL loading drivers (block like mmc, streaming
 like ymodem) are not that easily converted to skipping the header. So
 I'm not so sure if we should go this way after all...

Maybe I'm missing something, but maybe we just need to mimic the
behavior full U-Boot does and if we haven't been loaded where we need to
execute, shift bits around?

-- 
Tom

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


Re: [U-Boot] [PATCHv1] ARM: Add Altera SOCFPGA Cyclone5

2012-08-24 Thread Tom Rini
On 08/23/2012 03:43 AM, Pavel Machek wrote:

[snip]
 It's the omap-common/spl.c code with the bits for IH_OS_LINUX taken out
 :)  Can you please re-do your series on top of the SPL series I just
 posted that provides a common SPL framework?  Thanks!
 
 I'll take a look. OTOH, ammount of code duplication here is quite low,
 and redoing it on top of SPL series will mean delaying merge, right?

My hope is that since I got the SPL patches posted in time we can get
them in for v2012.10 so no, this will only help your chances :)

-- 
Tom

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


Re: [U-Boot] [PATCH v2] rmobile: Add README

2012-08-24 Thread Tom Rini
On 08/21/2012 06:40 PM, Nobuhiro Iwamatsu wrote:
 From: Nobuhiro Iwamatsu iwama...@nigauri.org
 
 This add README of Renesas RMOBILE.
 Based doc/README.omap3.
 
 Signed-off-by: Nobuhiro Iwamatsu iwama...@nigauri.org

Acked-by: Tom Rini tr...@ti.com

-- 
Tom

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


Re: [U-Boot] [PATCH 1/1] lib, panic: don't call do_reset in SPL (debug).

2012-08-24 Thread Tom Rini
On 08/14/2012 01:40 PM, Jeroen Hofstee wrote:

 Several omap boards won't build when DEBUG is defined, SPL build error:
 vsprintf.c:791: undefined reference to `do_reset', since SPL has no
 commands. Therefore don't call do_reset in SPL. SPL panic will end in an
 endless loop or call hang if CONFIG_PANIC_HANG is defined.
 
 cc: Tom Rini tr...@ti.com
 Signed-off-by: Jeroen Hofstee jhofs...@victronenergy.com
 ---
  lib/vsprintf.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/lib/vsprintf.c b/lib/vsprintf.c
 index e38a4b7..4fa392d 100644
 --- a/lib/vsprintf.c
 +++ b/lib/vsprintf.c
 @@ -18,7 +18,7 @@
  #include errno.h
 
  #include common.h
 -#if !defined (CONFIG_PANIC_HANG)
 +#if !defined(CONFIG_PANIC_HANG)  !defined(CONFIG_SPL_BUILD)
  #include command.h
  #endif
 
 @@ -786,7 +786,7 @@ void panic(const char *fmt, ...)
  va_end(args);
  #if defined (CONFIG_PANIC_HANG)
  hang();
 -#else
 +#elif !defined(CONFIG_SPL_BUILD)
  udelay (10);/* allow messages to go out */
  do_reset (NULL, 0, 0, NULL);
  #endif

Thinking about this more.  The point is that today, no one that does SPL
has reset ability.  I would like to see this changed, slightly.  Lets do:
#if defined(CONFIG_PANIC_HANG) || defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_SPL_BUILD)
puts(hanging\n);
#endif
hang();
#else
...

And no need to not include command.h I think.  This makes it clear that
a panic results in hang in SPL so that in the future, should someone
depend on other behavior it's at least saying why we aren't resetting
which is my concern.

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


Re: [U-Boot] [PATCH 16/17] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Scott Wood
On 08/15/2012 04:30 PM, Tom Rini wrote:
 Takes the load function from arch/arm/lib/spl_nand.c instead.  This will
 allow for easier integration of SPL-boots-Linux code on other arches.
 Kill off CONFIG_SPL_NAND_LOAD as a separate option.

I would have complained about the loss of a small CONFIG_SPL_NAND_LOAD,
if I hadn't found that moving it into the equivalent of
nand_spl_simple.c resulted in a smaller binary. :-P

-Scott


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


[U-Boot] [PATCH 0/2] Add gio api support to mx27

2012-08-24 Thread Philippe Reynes
Change in v3:
- rebase on u-boot-imx (instead of u-boot)
- fix conflit with mxc: Make gpio_get_value() use PSR

Philippe Reynes (2):
  gpio: add gpio api support to mx27 (v3)
  imx27lite: update with gpio api change (v3)

 arch/arm/cpu/arm926ejs/mx27/generic.c |   11 +++---
 arch/arm/include/asm/arch-mx27/gpio.h |   55 +
 arch/arm/include/asm/arch-mx27/imx-regs.h |   30 
 board/logicpd/imx27lite/imx27lite.c   |5 +--
 drivers/gpio/mxc_gpio.c   |   12 +--
 include/configs/imx27lite-common.h|5 +++
 6 files changed, 84 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-mx27/gpio.h

-- 
1.7.4.4

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


[U-Boot] [PATCH 1/2] gpio: add gpio api support to mx27 (v3)

2012-08-24 Thread Philippe Reynes
There is a little change on gpio_get_value because
on mx27 the register to read is ssr and not dr.

Signed-off-by: Philippe Reynes trem...@yahoo.fr
---
 arch/arm/cpu/arm926ejs/mx27/generic.c |   11 +++---
 arch/arm/include/asm/arch-mx27/gpio.h |   55 +
 arch/arm/include/asm/arch-mx27/imx-regs.h |   30 
 drivers/gpio/mxc_gpio.c   |   12 +--
 4 files changed, 77 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-mx27/gpio.h

diff --git a/arch/arm/cpu/arm926ejs/mx27/generic.c 
b/arch/arm/cpu/arm926ejs/mx27/generic.c
index 65c4813..41bb84b 100644
--- a/arch/arm/cpu/arm926ejs/mx27/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx27/generic.c
@@ -24,6 +24,7 @@
 #include asm/io.h
 #include asm/arch/imx-regs.h
 #include asm/arch/clock.h
+#include asm/arch/gpio.h
 #ifdef CONFIG_MXC_MMC
 #include asm/arch/mxcmmc.h
 #endif
@@ -209,7 +210,7 @@ int cpu_mmc_init(bd_t *bis)
 
 void imx_gpio_mode(int gpio_mode)
 {
-   struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+   struct gpio_port_regs *regs = (struct gpio_port_regs *)IMX_GPIO_BASE;
unsigned int pin = gpio_mode  GPIO_PIN_MASK;
unsigned int port = (gpio_mode  GPIO_PORT_MASK)  GPIO_PORT_SHIFT;
unsigned int ocr = (gpio_mode  GPIO_OCR_MASK)  GPIO_OCR_SHIFT;
@@ -228,11 +229,11 @@ void imx_gpio_mode(int gpio_mode)
 
/* Data direction */
if (gpio_mode  GPIO_OUT) {
-   writel(readl(regs-port[port].ddir) | 1  pin,
-   regs-port[port].ddir);
+   writel(readl(regs-port[port].gpio_dir) | 1  pin,
+   regs-port[port].gpio_dir);
} else {
-   writel(readl(regs-port[port].ddir)  ~(1  pin),
-   regs-port[port].ddir);
+   writel(readl(regs-port[port].gpio_dir)  ~(1  pin),
+   regs-port[port].gpio_dir);
}
 
/* Primary / alternate function */
diff --git a/arch/arm/include/asm/arch-mx27/gpio.h 
b/arch/arm/include/asm/arch-mx27/gpio.h
new file mode 100644
index 000..965b584
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx27/gpio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012
+ * Philippe Reynes trem...@yahoo.fr
+ *
+ * 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
+ */
+
+
+#ifndef __ASM_ARCH_MX27_GPIO_H
+#define __ASM_ARCH_MX27_GPIO_H
+
+/* GPIO registers */
+struct gpio_regs {
+   u32 gpio_dir; /* DDIR */
+   u32 ocr1;
+   u32 ocr2;
+   u32 iconfa1;
+   u32 iconfa2;
+   u32 iconfb1;
+   u32 iconfb2;
+   u32 gpio_dr; /* DR */
+   u32 gius;
+   u32 ssr;
+   u32 icr1;
+   u32 icr2;
+   u32 imr;
+   u32 isr;
+   u32 gpr;
+   u32 swr;
+   u32 puen;
+   u32 res[0x2f];
+};
+
+/* This structure is used by the function imx_gpio_mode */
+struct gpio_port_regs {
+   struct gpio_regs port[6];
+};
+
+#endif
diff --git a/arch/arm/include/asm/arch-mx27/imx-regs.h 
b/arch/arm/include/asm/arch-mx27/imx-regs.h
index f7cf85b..f78d5f2 100644
--- a/arch/arm/include/asm/arch-mx27/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx27/imx-regs.h
@@ -164,29 +164,6 @@ struct gpt_regs {
 #define PORTE 4
 #define PORTF 5
 
-struct gpio_regs {
-   struct {
-   u32 ddir;
-   u32 ocr1;
-   u32 ocr2;
-   u32 iconfa1;
-   u32 iconfa2;
-   u32 iconfb1;
-   u32 iconfb2;
-   u32 dr;
-   u32 gius;
-   u32 ssr;
-   u32 icr1;
-   u32 icr2;
-   u32 imr;
-   u32 isr;
-   u32 gpr;
-   u32 swr;
-   u32 puen;
-   u32 res[0x2f];
-   } port[6];
-};
-
 /* IIM Control Registers */
 struct iim_regs {
u32 iim_stat;
@@ -474,6 +451,13 @@ struct fuse_bank0_regs {
 #define TSTAT_CAPT (1  1)/* Capture event */
 #define TSTAT_COMP 1   /* Compare event */
 
+#define GPIO1_BASE_ADDR 0x10015000
+#define GPIO2_BASE_ADDR 0x10015100
+#define GPIO3_BASE_ADDR 0x10015200
+#define GPIO4_BASE_ADDR 0x10015300
+#define GPIO5_BASE_ADDR 0x10015400
+#define 

[U-Boot] [PATCH 2/2] imx27lite: update with gpio api change (v3)

2012-08-24 Thread Philippe Reynes
Signed-off-by: Philippe Reynes trem...@yahoo.fr
---
 board/logicpd/imx27lite/imx27lite.c |5 ++---
 include/configs/imx27lite-common.h  |5 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/board/logicpd/imx27lite/imx27lite.c 
b/board/logicpd/imx27lite/imx27lite.c
index 8a5015c..b38e5ab 100644
--- a/board/logicpd/imx27lite/imx27lite.c
+++ b/board/logicpd/imx27lite/imx27lite.c
@@ -23,12 +23,12 @@
 #include common.h
 #include asm/io.h
 #include asm/arch/imx-regs.h
+#include asm/gpio.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-   struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
 #if defined(CONFIG_SYS_NAND_LARGEPAGE)
struct system_control_regs *sc_regs =
(struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
@@ -43,8 +43,7 @@ int board_init(void)
 #ifdef CONFIG_FEC_MXC
mx27_fec_init_pins();
imx_gpio_mode((GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31));
-   writel(readl(regs-port[PORTC].dr) | (1  31),
-   regs-port[PORTC].dr);
+   gpio_set_value(GPIO_PORTC | 31, 1);
 #endif
 #ifdef CONFIG_MXC_MMC
 #if defined(CONFIG_MAGNESIUM)
diff --git a/include/configs/imx27lite-common.h 
b/include/configs/imx27lite-common.h
index 7d2876b..2e79a9e 100644
--- a/include/configs/imx27lite-common.h
+++ b/include/configs/imx27lite-common.h
@@ -162,6 +162,11 @@
 #define CONFIG_DOS_PARTITION
 
 /*
+ * GPIO
+ */
+#define CONFIG_MXC_GPIO
+
+/*
  * MTD partitions
  */
 #define CONFIG_CMD_MTDPARTS
-- 
1.7.4.4

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


Re: [U-Boot] [PATCH v2 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Scott Wood
On 08/20/2012 11:45 AM, Tom Rini wrote:
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index 29dc20e..5475c8c 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -27,12 +27,7 @@ LIB:= $(obj)libnand.o
  
  ifdef CONFIG_CMD_NAND
  ifdef CONFIG_SPL_BUILD
 -ifdef CONFIG_SPL_NAND_SIMPLE
 -COBJS-y += nand_spl_simple.o
 -endif
 -ifdef CONFIG_SPL_NAND_LOAD
 -COBJS-y  += nand_spl_load.o
 -endif
 +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o

OK, I was wrong, I will complain. :-)

The commit message didn't mention you were changing
CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
Is your new enhanced nand_spl_load small enough (with proper
configuration) to work with all the SPLs that currently use
nand_spl/nand_boot.c (e.g. PPC 44x)?

-Scott


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


Re: [U-Boot] [PATCH v4 6/7] env: make env default selective, check and apply

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 On 08/24/2012 04:56 PM, Marek Vasut wrote:
  Dear Gerlando Falauto,
  
  Change the syntax (user API) for env default:
 -f: override write-once variables
 var... : accept individual variable(s)
 -a: all (resetting the whole env is NOT the default behavior)
  
  Enable variable checking and make changes effective by
  enabling do_apply argument to himport_r().
  
  Signed-off-by: Gerlando Falautogerlando.fala...@keymile.com
  ---
  
common/cmd_nvedit.c   |   40 ++--
common/env_common.c   |   28 +++-
include/environment.h |3 +++
3 files changed, 64 insertions(+), 7 deletions(-)
  
  diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
  index b0860f3..ac2b985 100644
  --- a/common/cmd_nvedit.c
  +++ b/common/cmd_nvedit.c
  @@ -656,14 +656,41 @@ int envmatch(uchar *s1, int i2)
  
 return -1;

}
  
  -static int do_env_default(cmd_tbl_t *cmdtp, int flag,
  +static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
  
   int argc, char * const argv[])

{
  
  -  if (argc != 2 || strcmp(argv[1], -f) != 0)
  -  return CMD_RET_USAGE;
  +  int all = 0, flag = 0;
  
  -  set_default_env(## Resetting to default environment\n);
  -  return 0;
  +  debug(Initial value for argc=%d\n, argc);
  +  while (--argc  0  **++argv == '-') {
  
  m ... **++argv, yummy :) This might use some cleanup, to make more
  readable.
 
 Uhm, this pattern is being used all over the place on that file (that's
 where I copied it from).

That doesn't mean it's right, it just means the codebase is in a very sad state 
:-C

  Don't we have some getopt or something too ?
 
 Not that I (or git grep) know of.

Even more :-C

  +  char *arg = *argv;
  +
  +  while (*++arg) {
  +  switch (*arg) {
  +  case 'a':   /* default all */
  +  all = 1;
  +  break;
  +  case 'f':   /* force */
  +  flag |= H_FORCE;
  +  break;
  +  default:
  +  return cmd_usage(cmdtp);
  +  }
  +  }
  +  }
  +  debug(Final value for argc=%d\n, argc);
  +  if (all  (argc == 0)) {
  +  /* Reset the whole environment */
  +  set_default_env(## Resetting to default environment\n);
  +  return 0;
  +  }
  +  if (!all  (argc  0)) {
  +  /* Reset individual variables */
  +  set_default_vars(argc, argv);
  +  return 0;
  +  }
  +
  +  return cmd_usage(cmdtp);
  
}

static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
  
  @@ -994,7 +1021,8 @@ U_BOOT_CMD(
  
#if defined(CONFIG_CMD_ASKENV)

 ask name [message] [size] - ask for environment variable\nenv 

#endif
  
  -  default -f - reset default environment\n
  +  default [-f] -a - [forcibly] reset default environment\n
  +  env default [-f] var [...] - [forcibly] reset variable(s) to their
  default values\n #if defined(CONFIG_CMD_EDITENV)
  
 env edit name - edit environment variable\n

#endif
  
  diff --git a/common/env_common.c b/common/env_common.c
  index c6e7c4c..482d715 100644
  --- a/common/env_common.c
  +++ b/common/env_common.c
  @@ -177,6 +177,11 @@ const uchar *env_get_addr(int index)
  
void set_default_env(const char *s)
{
  
  +  /*
  +   * By default, do not apply changes as they will eventually
  +   * be applied by someone else
  +   */
  +  int do_apply = 0;
  
 if (sizeof(default_environment)  ENV_SIZE) {
 
 puts(*** Error - default environment is too large\n\n);
 return;
  
  @@ -188,6 +193,14 @@ void set_default_env(const char *s)
  
 using default environment\n\n,
 s + 1);
 
 } else {
  
  +  /*
  +   * This set_to_default was explicitly asked for
  +   * by the user, as opposed to being a recovery
  +   * mechanism.  Therefore we check every single
  +   * variable and apply changes to the system
  +   * right away (e.g. baudrate, console).
  +   */
  +  do_apply = 1;
  
 puts(s);
 
 }
 
 } else {
  
  @@ -196,12 +209,25 @@ void set_default_env(const char *s)
  
 if (himport_r(env_htab, (char *)default_environment,
 
 sizeof(default_environment), '\0', 0,
  
  -  0, NULL, 0 /* do_apply */) == 0)
  +  0, NULL, do_apply) == 0)
  
 error(Environment import failed: errno = %d\n, errno);
 
 gd-flags |= GD_FLG_ENV_READY;

}
  
  +
  +/* [re]set individual variables to their value in the default
  environment */ +int 

Re: [U-Boot] [PATCH v2 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Scott Wood
On 08/24/2012 04:09 PM, Scott Wood wrote:
 On 08/20/2012 11:45 AM, Tom Rini wrote:
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index 29dc20e..5475c8c 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -27,12 +27,7 @@ LIB   := $(obj)libnand.o
  
  ifdef CONFIG_CMD_NAND
  ifdef CONFIG_SPL_BUILD
 -ifdef CONFIG_SPL_NAND_SIMPLE
 -COBJS-y += nand_spl_simple.o
 -endif
 -ifdef CONFIG_SPL_NAND_LOAD
 -COBJS-y += nand_spl_load.o
 -endif
 +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o
 
 OK, I was wrong, I will complain. :-)
 
 The commit message didn't mention you were changing
 CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
 Is your new enhanced nand_spl_load small enough (with proper
 configuration) to work with all the SPLs that currently use
 nand_spl/nand_boot.c (e.g. PPC 44x)?

Oh, and please CC me on NAND patches so that I can see them sooner.

-Scott


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


Re: [U-Boot] [PATCH v4 7/7] env: delete selected vars not present in imported env

2012-08-24 Thread Marek Vasut
Dear Gerlando Falauto,

 On 08/24/2012 04:58 PM, Marek Vasut wrote:
  Dear Gerlando Falauto,
  
  When variables explicitly specified on the command line are not present
  in the imported env, delete them from the running env.
  If the variable is also missing from the running env, issue a warning.
  
  Signed-off-by: Gerlando Falautogerlando.fala...@keymile.com
  
  Whew! I made it through ... it wasn't that scary in the end ;-)
  
  ---
  
lib/hashtable.c |   48
+--- 1 file changed, 41
insertions(+), 7 deletions(-)
  
  diff --git a/lib/hashtable.c b/lib/hashtable.c
  index f3f47de..b3d0b64 100644
  --- a/lib/hashtable.c
  +++ b/lib/hashtable.c
  @@ -607,22 +607,32 @@ ssize_t hexport_r(struct hsearch_data *htab, const
  char sep, * himport()
  
 */
  
  -/* Check whether variable name is amongst vars[] */
  -static int is_var_in_set(const char *name, int nvars, char * const
  vars[]) +/*
  + * Check whether variable 'name' is amongst vars[],
  + * and remove all instances by setting the pointer to NULL
  + */
  +static int is_var_in_set(const char *name, int nvars, char * vars[])
  
{

 int i = 0;
  
  +  int res = 0;
  
 /* No variables specified means process all of them */
 if (nvars == 0)
 
 return 1;
 
 for (i = 0; i  nvars; i++) {
  
  -  if (!strcmp(name, vars[i]))
  -  return 1;
  +  if (vars[i] == NULL)
  +  continue;
  +  /* If we found it, delete all of them */
  +  if (!strcmp(name, vars[i])) {
  +  vars[i] = NULL;
  +  res = 1;
  
  break here ?
 
 Nope, if we find it, we should delete all of them (see comment above).

Stupid me, of course now I see the logic! Sorry!

  +  }
  
 }
  
  -  debug(Skipping non-listed variable %s\n, name);
  +  if (!res)
  +  debug(Skipping non-listed variable %s\n, name);
  
  -  return 0;
  +  return res;
  
}

/*
  
  @@ -662,9 +672,11 @@ static int is_var_in_set(const char *name, int
  nvars, char * const vars[])
  
int himport_r(struct hsearch_data *htab,

 const char *env, size_t size, const char sep, int flag,
  
  -  int nvars, char * const vars[], int do_apply)
  +  int nvars, char * const __vars[], int do_apply)
  
  Two underscores are reserved, use something else ;-)
 
 Like... one? three? ;-)

I think one is the way to go ... http://lwn.net/Articles/509149/ definitelly 
not 
like this ;-)

[...]


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 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Tom Rini
On Fri, Aug 24, 2012 at 04:10:44PM -0500, Scott Wood wrote:
 On 08/24/2012 04:09 PM, Scott Wood wrote:
  On 08/20/2012 11:45 AM, Tom Rini wrote:
  diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
  index 29dc20e..5475c8c 100644
  --- a/drivers/mtd/nand/Makefile
  +++ b/drivers/mtd/nand/Makefile
  @@ -27,12 +27,7 @@ LIB := $(obj)libnand.o
   
   ifdef CONFIG_CMD_NAND
   ifdef CONFIG_SPL_BUILD
  -ifdef CONFIG_SPL_NAND_SIMPLE
  -COBJS-y += nand_spl_simple.o
  -endif
  -ifdef CONFIG_SPL_NAND_LOAD
  -COBJS-y   += nand_spl_load.o
  -endif
  +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o
  
  OK, I was wrong, I will complain. :-)
  
  The commit message didn't mention you were changing
  CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
  Is your new enhanced nand_spl_load small enough (with proper
  configuration) to work with all the SPLs that currently use
  nand_spl/nand_boot.c (e.g. PPC 44x)?
 
 Oh, and please CC me on NAND patches so that I can see them sooner.

Should have put nand in there for patman, sorry.

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


Re: [U-Boot] [PATCH v2 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Tom Rini
On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote:
 On 08/20/2012 11:45 AM, Tom Rini wrote:
  diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
  index 29dc20e..5475c8c 100644
  --- a/drivers/mtd/nand/Makefile
  +++ b/drivers/mtd/nand/Makefile
  @@ -27,12 +27,7 @@ LIB  := $(obj)libnand.o
   
   ifdef CONFIG_CMD_NAND
   ifdef CONFIG_SPL_BUILD
  -ifdef CONFIG_SPL_NAND_SIMPLE
  -COBJS-y += nand_spl_simple.o
  -endif
  -ifdef CONFIG_SPL_NAND_LOAD
  -COBJS-y+= nand_spl_load.o
  -endif
  +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o
 
 OK, I was wrong, I will complain. :-)
 
 The commit message didn't mention you were changing
 CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
 Is your new enhanced nand_spl_load small enough (with proper
 configuration) to work with all the SPLs that currently use
 nand_spl/nand_boot.c (e.g. PPC 44x)?

OK, I suspect it would be close-to-fail.  There's a few bytes overhead
to parse the header and so forth, but it also allows for direct Linux
booting.  Is that something you want for these machines or no?  It
wouldn't be hard to put the enhanced version nand_spl_simple.c and leave
nand_spl_load.c alone.

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


Re: [U-Boot] [PATCH v2 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Scott Wood
On 08/24/2012 04:20 PM, Tom Rini wrote:
 On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote:
 On 08/20/2012 11:45 AM, Tom Rini wrote:
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index 29dc20e..5475c8c 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -27,12 +27,7 @@ LIB  := $(obj)libnand.o
  
  ifdef CONFIG_CMD_NAND
  ifdef CONFIG_SPL_BUILD
 -ifdef CONFIG_SPL_NAND_SIMPLE
 -COBJS-y += nand_spl_simple.o
 -endif
 -ifdef CONFIG_SPL_NAND_LOAD
 -COBJS-y+= nand_spl_load.o
 -endif
 +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o

 OK, I was wrong, I will complain. :-)

 The commit message didn't mention you were changing
 CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
 Is your new enhanced nand_spl_load small enough (with proper
 configuration) to work with all the SPLs that currently use
 nand_spl/nand_boot.c (e.g. PPC 44x)?
 
 OK, I suspect it would be close-to-fail.  There's a few bytes overhead
 to parse the header and so forth, but it also allows for direct Linux
 booting.  Is that something you want for these machines or no?

I don't think there's room for any new features at all.  The SPL must
fit in 4K.  Canyonlands is at 4020 bytes currently.

Why can't the new functionality be conditionally built?

 It wouldn't be hard to put the enhanced version nand_spl_simple.c and leave
 nand_spl_load.c alone.

nand_spl_simple.c is what I'm talking about needing to not expand.  Why
does the new stuff need to be bound to a specific NAND boot implementation?

-Scott


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


Re: [U-Boot] [PATCH 3/6] SPL: Port SPL framework to powerpc

2012-08-24 Thread Daniel Schwierzeck
2012/8/24 Stefan Roese stefan.ro...@gmail.com:
 On 08/24/2012 06:42 PM, Daniel Schwierzeck wrote:
 The u-boot image is merged with SPL
 image without any padding or
 fixed flash offsets to achieve a maximum reduction of flash footprint.

 Interesting. I'm still padding to the fixed offset. Let me look into
 squeezing those two images together as well...

 Looks good. One question though: How do you make sure, that your SPL
 image length is 4-byte aligned?

 I have 4-byte alignments for each section and for each address symbol
 in my linker script.
 Actually all MIPS linker scripts do this.

 Yes. I have those section alignments in the linker script as well. The
 problem is the end of the last (physical end in flash) section. If I
 have here a string with length 7 for example, the SPL binary has a
 non-4-byte aligned length.

 Any ideas on this?

MIPS linker scripts have a symbol in front of the BSS section that is
named uboot_end_data.
I think most ARM linker scripts have it too but it is named __image_copy_end.
This symbol is 4-byte-aligned. If I want to know the length of SPL
image i can simply do

ulong len = (ulong) __image_copy_end - CONFIG_SPL_TEXT_BASE

and len is 4-byte-aligned

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


Re: [U-Boot] [PATCH] powerpc: Fix declaration type for I/O functions

2012-08-24 Thread Scott Wood
On 08/23/2012 01:09 PM, Scott Wood wrote:
 On 08/23/2012 01:03 PM, Andy Fleming wrote:
 On Thu, Aug 23, 2012 at 12:57 PM, Scott Wood scottw...@freescale.com wrote:
 On 08/23/2012 12:24 PM, Andy Fleming wrote:
 This patch (commit 20959471b5d07fdeb8603b918d80385aa2954711),
 strangely, causes the error below to happen when I build
 P1010RDB_36BIT_NAND:

 Configuring for P1010RDB_36BIT_NAND - Board: P1010RDB, Options: 
 P1010RDB,36BIT,N
 AND
 make[1]: *** [/local/afleming/u-boot/nand_spl/u-boot-spl] Error 1
 make: *** [nand_spl] Error 2
 /opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/bin/powerpc
 -linux-gnu-size: './u-boot': No such file
 /opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/bin/powerpc
 -linux-gnu-ld: section .bootpg loaded at 
 [ff801000,ff80120f] ove
 rlaps section .data loaded at [ff800e90,ff80102b]
 make[1]: *** [/local/afleming/u-boot/nand_spl/u-boot-spl] Error 1
 make: *** [nand_spl] Error 2
 make: *** Waiting for unfinished jobs

 ${CROSS_COMPILE}gcc --version:
 powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1

 I'm guessing this change increased the amount of inlining. Sadly, the
 subsequent patches, which were intended to shrink the SPL build, were
 not enough to fix this problem.

 My inclination is to revert this patch until we figure out what went wrong.

 On Wed, Apr 11, 2012 at 3:49 AM, Prabhakar Kushwaha
 prabha...@freescale.com wrote:
 Prototype declaration of I/O operation functions are not correct. as both
 'extern' and function definition are at same place.

 Chage protoype declaration as static.

 Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com


 It builds OK for me using that same toolchain.  What SHA1 are you building?

 -Scott

 Very top of Wolfgang's master branch.

 
 Sigh, I missed the 36bit part.  Before reverting, let me see if I can
 fix it today.
 
 BTW, top of ... is not a SHA1.

The p1010rdb patches I posted yesterday fix it for me.

-Scott


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


Re: [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500

2012-08-24 Thread Scott Wood
On 08/17/2012 01:27 PM, York Sun wrote:
 Using E6500 L1 cache as initram requires L2 cache enabled.
 Add l2-cache cluster enabling.
 
 Signed-off-by: York Sun york...@freescale.com
 Signed-off-by: Kumar Gala ga...@kernel.crashing.org
 ---
  arch/powerpc/cpu/mpc85xx/cpu_init.c   |   39 ++-
  arch/powerpc/cpu/mpc85xx/start.S  |   57 
 +
  arch/powerpc/include/asm/immap_85xx.h |   43 +
  3 files changed, 138 insertions(+), 1 deletions(-)
 
 diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
 b/arch/powerpc/cpu/mpc85xx/cpu_init.c
 index 2c78905..1a2858a 100644
 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
 +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
 @@ -309,6 +309,34 @@ static void __fsl_serdes__init(void)
  }
  __attribute__((weak, alias(__fsl_serdes__init))) void 
 fsl_serdes_init(void);
  
 +#ifdef CONFIG_E6500
 +int enable_cluster_l2(void)

If enabling L2 is required for the stack, how are we enabling it in C
code?  Is this just for non-boot clusters?

 +{
 + int i = 0;
 + u32 cluster;
 + ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 + struct ccsr_cluster_l2 *l2cache;
 +
 + cluster = in_be32(gur-tp_cluster[i++].lower);
 + if (cluster  TP_CLUSTER_EOC)
 + return 0;
 +
 + do {
 + l2cache = (void *)(CONFIG_SYS_FSL_CLUSTER_1_L2 + i * 0x4);
 + cluster = in_be32(gur-tp_cluster[i++].lower);
 +
 + printf(enable l2 for cluster %d %p\n, i, l2cache);

This should be a debug message (or removed), not a normal printf.

 +
 + out_be32(l2cache-l2csr0, L2CSR0_L2FI|L2CSR0_L2LFC);
 + while ((in_be32(l2cache-l2csr0)  (L2CSR0_L2FI|L2CSR0_L2LFC)) 
 != 0)
 + ;

Timeout?

 @@ -322,6 +350,11 @@ int cpu_init_r(void)
  #ifdef CONFIG_SYS_LBC_LCRR
   volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
  #endif
 +#ifdef CONFIG_L2_CACHE
 + volatile ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
 +#elif defined(CONFIG_E6500)
 + struct ccsr_cluster_l2 * l2cache = (void *)CONFIG_SYS_FSL_CLUSTER_1_L2;
 +#endif

If CONFIG_L2_CACHE doesn't apply to e6500, then CONFIG_L2_CACHE is misnamed.

 diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
 b/arch/powerpc/cpu/mpc85xx/start.S
 index 2e1d265..739127f 100644
 --- a/arch/powerpc/cpu/mpc85xx/start.S
 +++ b/arch/powerpc/cpu/mpc85xx/start.S
 @@ -762,6 +762,63 @@ delete_temp_tlbs:
   tlbwe
  #endif /* #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS) */
  
 +#ifdef CONFIG_E6500
 +create_ccsr_l2_tlb:
 + /*
 +  * Create a TLB for the MMR location of CCSR
 +  * to access L2CSR0 register
 +  */
 + lis r0, FSL_BOOKE_MAS0(0, 0, 0)@h
 + ori r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
 +
 + lis r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
 + ori r1, r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@l
 + lis r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2, 
 (MAS2_I|MAS2_G))@h
 + ori r2, r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2, 
 (MAS2_I|MAS2_G))@l
 + lis r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC2, 0, 
 (MAS3_SW|MAS3_SR))@h
 + ori r3, r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC2, 
 0, (MAS3_SW|MAS3_SR))@l
 + lis r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@h
 + ori r7, r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@l
 + mtspr   MAS0, r0
 + mtspr   MAS1, r1
 + mtspr   MAS2, r2
 + mtspr   MAS3, r3
 + mtspr   MAS7, r7
 + isync
 + msync
 + tlbwe

Let's make a macro (asm, not cpp) out of this instead of copy and
pasting all over the place.  And stop misusing r1/r2.

-Scott


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


Re: [U-Boot] [PATCH 05/11] powerpc/mpc85xx: use boot page translation for spin table address

2012-08-24 Thread Scott Wood
On 08/17/2012 01:27 PM, York Sun wrote:
 E6500 doesn't allow cache inhibit TLB alias. Use the boot page translation
 instead. The boot page is always cache inhibit.

We're not supposed to create such aliases on any PPC core.

Please move to a cacheable spintable as described in ePAPR 1.1.  This
probably means not using the boot page window to access it.

-Scott


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


Re: [U-Boot] [PATCH v2 17/18] SPL: Enhance drivers/mtd/nand/nand_spl_load.c

2012-08-24 Thread Tom Rini
On Fri, Aug 24, 2012 at 04:30:45PM -0500, Scott Wood wrote:
 On 08/24/2012 04:20 PM, Tom Rini wrote:
  On Fri, Aug 24, 2012 at 04:09:13PM -0500, Scott Wood wrote:
  On 08/20/2012 11:45 AM, Tom Rini wrote:
  diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
  index 29dc20e..5475c8c 100644
  --- a/drivers/mtd/nand/Makefile
  +++ b/drivers/mtd/nand/Makefile
  @@ -27,12 +27,7 @@ LIB:= $(obj)libnand.o
   
   ifdef CONFIG_CMD_NAND
   ifdef CONFIG_SPL_BUILD
  -ifdef CONFIG_SPL_NAND_SIMPLE
  -COBJS-y += nand_spl_simple.o
  -endif
  -ifdef CONFIG_SPL_NAND_LOAD
  -COBJS-y  += nand_spl_load.o
  -endif
  +COBJS-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o nand_spl_load.o
 
  OK, I was wrong, I will complain. :-)
 
  The commit message didn't mention you were changing
  CONFIG_SPL_NAND_SIMPLE.  That needs to be able to support small SPLs.
  Is your new enhanced nand_spl_load small enough (with proper
  configuration) to work with all the SPLs that currently use
  nand_spl/nand_boot.c (e.g. PPC 44x)?
  
  OK, I suspect it would be close-to-fail.  There's a few bytes overhead
  to parse the header and so forth, but it also allows for direct Linux
  booting.  Is that something you want for these machines or no?
 
 I don't think there's room for any new features at all.  The SPL must
 fit in 4K.  Canyonlands is at 4020 bytes currently.
 
 Why can't the new functionality be conditionally built?

I'm not sure there would be a point.  The nand_boot() method is read
u-boot.bin from nand, read env from nand and read redundant env from
nand, boot u-boot.  The spl_nand_load_image method doesn't boot u-boot,
reads the image header, parses, reads the image.  In short, I don't
think a modified version would gain us anything more than a lot of
complex #ifdefs :(

  It wouldn't be hard to put the enhanced version nand_spl_simple.c and leave
  nand_spl_load.c alone.
 
 nand_spl_simple.c is what I'm talking about needing to not expand.  Why
 does the new stuff need to be bound to a specific NAND boot implementation?

Sorry, I got it backwards.  I mean (and did locally) leave the very tiny
and simple approach alone, add to the version where we have a little,
but not a lot, of space.

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


Re: [U-Boot] [PATCHv1] ARM: Add Altera SOCFPGA Cyclone5

2012-08-24 Thread Tom Rini
On Thu, Aug 23, 2012 at 12:50:28PM +0200, Pavel Machek wrote:

[snip]
 +void reset_cpu(ulong addr)
 +{
 + /* request a warm reset */
 + writel(RSTMGR_CTRL_SWWARMRSTREQ_LSB, reset_manager_base-ctrl);
 + /* infinite loop here as watchdog will trigger and reset
 +  * the processor */

/*
 * Is the form of a multi line comment.
 * Or people get upset, sorry.
 */

:)

Things look fine, just expecting a proper v2 posting once you're able to
re-base to the SPL common series.  Thanks!

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


Re: [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500

2012-08-24 Thread York Sun

On 08/24/2012 03:53 PM, Scott Wood wrote:

On 08/17/2012 01:27 PM, York Sun wrote:

Using E6500 L1 cache as initram requires L2 cache enabled.
Add l2-cache cluster enabling.

Signed-off-by: York Sun york...@freescale.com
Signed-off-by: Kumar Gala ga...@kernel.crashing.org
---
  arch/powerpc/cpu/mpc85xx/cpu_init.c   |   39 ++-
  arch/powerpc/cpu/mpc85xx/start.S  |   57 +
  arch/powerpc/include/asm/immap_85xx.h |   43 +
  3 files changed, 138 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 2c78905..1a2858a 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -309,6 +309,34 @@ static void __fsl_serdes__init(void)
  }
  __attribute__((weak, alias(__fsl_serdes__init))) void fsl_serdes_init(void);

+#ifdef CONFIG_E6500
+int enable_cluster_l2(void)


If enabling L2 is required for the stack, how are we enabling it in C
code?  Is this just for non-boot clusters?


Yes, this is for non-boot clusters. The boot cluster is enabled in start.S.




+{
+   int i = 0;
+   u32 cluster;
+   ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+   struct ccsr_cluster_l2 *l2cache;
+
+   cluster = in_be32(gur-tp_cluster[i++].lower);
+   if (cluster  TP_CLUSTER_EOC)
+   return 0;
+
+   do {
+   l2cache = (void *)(CONFIG_SYS_FSL_CLUSTER_1_L2 + i * 0x4);
+   cluster = in_be32(gur-tp_cluster[i++].lower);
+
+   printf(enable l2 for cluster %d %p\n, i, l2cache);


This should be a debug message (or removed), not a normal printf.


OK.




+
+   out_be32(l2cache-l2csr0, L2CSR0_L2FI|L2CSR0_L2LFC);
+   while ((in_be32(l2cache-l2csr0)  (L2CSR0_L2FI|L2CSR0_L2LFC)) 
!= 0)
+   ;


Timeout?


I don't have a spec telling me how long.





@@ -322,6 +350,11 @@ int cpu_init_r(void)
  #ifdef CONFIG_SYS_LBC_LCRR
volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
  #endif
+#ifdef CONFIG_L2_CACHE
+   volatile ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
+#elif defined(CONFIG_E6500)
+   struct ccsr_cluster_l2 * l2cache = (void *)CONFIG_SYS_FSL_CLUSTER_1_L2;
+#endif


If CONFIG_L2_CACHE doesn't apply to e6500, then CONFIG_L2_CACHE is misnamed.


Maybe it's time to introduce a new name?




diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 2e1d265..739127f 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -762,6 +762,63 @@ delete_temp_tlbs:
tlbwe
  #endif /* #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS) */

+#ifdef CONFIG_E6500
+create_ccsr_l2_tlb:
+   /*
+* Create a TLB for the MMR location of CCSR
+* to access L2CSR0 register
+*/
+   lis r0, FSL_BOOKE_MAS0(0, 0, 0)@h
+   ori r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
+
+   lis r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
+   ori r1, r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@l
+   lis r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2, 
(MAS2_I|MAS2_G))@h
+   ori r2, r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2, 
(MAS2_I|MAS2_G))@l
+   lis r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC2, 0, 
(MAS3_SW|MAS3_SR))@h
+   ori r3, r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC2, 
0, (MAS3_SW|MAS3_SR))@l
+   lis r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@h
+   ori r7, r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@l
+   mtspr   MAS0, r0
+   mtspr   MAS1, r1
+   mtspr   MAS2, r2
+   mtspr   MAS3, r3
+   mtspr   MAS7, r7
+   isync
+   msync
+   tlbwe


Let's make a macro (asm, not cpp) out of this instead of copy and
pasting all over the place.  And stop misusing r1/r2.



That's a good idea. I am also tired of this long copy-n-paste. Using a 
macro increase the chance of overwriting registers, doesn't it? Any good 
idea to avoid?


York





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


Re: [U-Boot] [PATCH 05/11] powerpc/mpc85xx: use boot page translation for spin table address

2012-08-24 Thread York Sun

On 08/24/2012 03:55 PM, Scott Wood wrote:

On 08/17/2012 01:27 PM, York Sun wrote:

E6500 doesn't allow cache inhibit TLB alias. Use the boot page translation
instead. The boot page is always cache inhibit.


We're not supposed to create such aliases on any PPC core.


We seem to have been using it for quite a while, until it is broken here.



Please move to a cacheable spintable as described in ePAPR 1.1.  This
probably means not using the boot page window to access it.


No objection here.

York


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


Re: [U-Boot] [PATCH 05/11] powerpc/mpc85xx: use boot page translation for spin table address

2012-08-24 Thread Scott Wood
On 08/24/2012 06:06 PM, York Sun wrote:
 On 08/24/2012 03:55 PM, Scott Wood wrote:
 On 08/17/2012 01:27 PM, York Sun wrote:
 E6500 doesn't allow cache inhibit TLB alias. Use the boot page
 translation
 instead. The boot page is always cache inhibit.

 We're not supposed to create such aliases on any PPC core.
 
 We seem to have been using it for quite a while, until it is broken here.

Just because there wasn't a cop behind the billboard doesn't mean we
weren't speeding. :-)

I've gotten machine checks on p4080 from such aliases under specific
circumstances (just not in the specific case of what U-Boot does).

 Please move to a cacheable spintable as described in ePAPR 1.1.  This
 probably means not using the boot page window to access it.

 No objection here.

While we're touching the spin table stuff, we really should fix the bug
that we don't load the upper half of r3 on 64-bit so at least on
non-e5500 we won't have old U-Boots floating around that don't do it.

-Scott


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


Re: [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500

2012-08-24 Thread Scott Wood
On 08/24/2012 06:02 PM, York Sun wrote:
 On 08/24/2012 03:53 PM, Scott Wood wrote:
 On 08/17/2012 01:27 PM, York Sun wrote:
 Using E6500 L1 cache as initram requires L2 cache enabled.
 Add l2-cache cluster enabling.

 Signed-off-by: York Sun york...@freescale.com
 Signed-off-by: Kumar Gala ga...@kernel.crashing.org
 ---
   arch/powerpc/cpu/mpc85xx/cpu_init.c   |   39 ++-
   arch/powerpc/cpu/mpc85xx/start.S  |   57
 +
   arch/powerpc/include/asm/immap_85xx.h |   43 +
   3 files changed, 138 insertions(+), 1 deletions(-)

 diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c
 b/arch/powerpc/cpu/mpc85xx/cpu_init.c
 index 2c78905..1a2858a 100644
 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
 +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
 @@ -309,6 +309,34 @@ static void __fsl_serdes__init(void)
   }
   __attribute__((weak, alias(__fsl_serdes__init))) void
 fsl_serdes_init(void);

 +#ifdef CONFIG_E6500
 +int enable_cluster_l2(void)

 If enabling L2 is required for the stack, how are we enabling it in C
 code?  Is this just for non-boot clusters?
 
 Yes, this is for non-boot clusters. The boot cluster is enabled in start.S.

OK, maybe put a comment on that first EOC check (which I missed).
Anything we can do to help people navigate what's going on during 85xx
boot would be welcome.

 +out_be32(l2cache-l2csr0, L2CSR0_L2FI|L2CSR0_L2LFC);
 +while ((in_be32(l2cache-l2csr0) 
 (L2CSR0_L2FI|L2CSR0_L2LFC)) != 0)
 +;

 Timeout?
 
 I don't have a spec telling me how long.

You can estimate an upper bound, so we print a message if we get stuck.
 It shouldn't take longer than a second, right?

 @@ -322,6 +350,11 @@ int cpu_init_r(void)
   #ifdef CONFIG_SYS_LBC_LCRR
   volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
   #endif
 +#ifdef CONFIG_L2_CACHE
 +volatile ccsr_l2cache_t *l2cache = (void
 *)CONFIG_SYS_MPC85xx_L2_ADDR;
 +#elif defined(CONFIG_E6500)
 +struct ccsr_cluster_l2 * l2cache = (void
 *)CONFIG_SYS_FSL_CLUSTER_1_L2;
 +#endif

 If CONFIG_L2_CACHE doesn't apply to e6500, then CONFIG_L2_CACHE is
 misnamed.
 
 Maybe it's time to introduce a new name?

Sure.  What is it supposed to refer to?

 diff --git a/arch/powerpc/cpu/mpc85xx/start.S
 b/arch/powerpc/cpu/mpc85xx/start.S
 index 2e1d265..739127f 100644
 --- a/arch/powerpc/cpu/mpc85xx/start.S
 +++ b/arch/powerpc/cpu/mpc85xx/start.S
 @@ -762,6 +762,63 @@ delete_temp_tlbs:
   tlbwe
   #endif /* #if (CONFIG_SYS_CCSRBAR_DEFAULT !=
 CONFIG_SYS_CCSRBAR_PHYS) */

 +#ifdef CONFIG_E6500
 +create_ccsr_l2_tlb:
 +/*
 + * Create a TLB for the MMR location of CCSR
 + * to access L2CSR0 register
 + */
 +lis r0, FSL_BOOKE_MAS0(0, 0, 0)@h
 +ori r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
 +
 +lis r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
 +ori r1, r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@l
 +lis r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2,
 (MAS2_I|MAS2_G))@h
 +ori r2, r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC2,
 (MAS2_I|MAS2_G))@l
 +lis r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW +
 0xC2, 0, (MAS3_SW|MAS3_SR))@h
 +ori r3, r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW +
 0xC2, 0, (MAS3_SW|MAS3_SR))@l
 +lisr7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@h
 +orir7, r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH@l
 +mtspr   MAS0, r0
 +mtspr   MAS1, r1
 +mtspr   MAS2, r2
 +mtspr   MAS3, r3
 +mtspr   MAS7, r7
 +isync
 +msync
 +tlbwe

 Let's make a macro (asm, not cpp) out of this instead of copy and
 pasting all over the place.  And stop misusing r1/r2.

 
 That's a good idea. I am also tired of this long copy-n-paste. Using a
 macro increase the chance of overwriting registers, doesn't it? Any good
 idea to avoid?

If you can get away with one or two temporary registers, you could pass
the temporaries in as parameters.  Otherwise, document what you clobber,
and stick to registers that are normally caller-saved.

-Scott


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


Re: [U-Boot] [PATCH] da8xx/hawkboard: Add support for ohci host controller

2012-08-24 Thread Tom Rini
On Fri, Aug 10, 2012 at 02:15:20AM +0530, Sughosh Ganu wrote:

 Also enable the ohci port on hawkboard. These additions result in an
 increased u-boot size -- adjust the same accordingly in the board's
 config.
 
 Move the usb header for da8xx platforms under arch-davinci.
 
 Signed-off-by: Sughosh Ganu urwithsugh...@gmail.com

Queued up to u-boot-ti/master, thanks!

-- 
Tom


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


Re: [U-Boot] am33xx evm: Update secure_emif_sdram_config during ddr init

2012-08-24 Thread Tom Rini
On Fri, Aug 10, 2012 at 09:59:57AM +0530, Satyanarayana, Sandhya wrote:

 This patch updates secure_emif_sdram_config with the
 same value written to sdram_config during ddr3 initialization.
 
 During suspend/resume, this value is copied into sdram_config.
 With this, a write to sdram_config at the end of resume sequence
 which triggers an init sequence can be avoided.
 
 Without this register write in place, the DDR_RESET line goes
 low for a few cycles during resume which is a violation of the
 JEDEC spec.
 
 Signed-off-by: Satyanarayana, Sandhya sandhya.satyanaray...@ti.com

Queued to u-boot-ti/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] davinci: enbw_cmc: change switch init behaviour

2012-08-24 Thread Tom Rini
On Tue, Aug 14, 2012 at 11:51:04AM +0200, Heiko Schocher wrote:

 change the behaviour of switch initialization:
 
 - rename pwl to lan in hwconfig parameter
   lan = port 1 with phy addr 2
   lmn = port 2 with phy addr 3
 
 - if we have a valid switch config file in flash, do not
   evaluate the settings in the hwconfig lan or lmn
   subcommand.
 
 - if we have no valid switch config file in flash, start
   the switch with default values, if we have a lan or
   a lmn hwconfig subcommand. If no lan or lmn is
   found in hwconfig, do nothing with the switch.
 
 Signed-off-by: Heiko Schocher h...@denx.de

Queued to u-boot-ti/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2] arm: omap: Fix switching back to nandecc sw.

2012-08-24 Thread Tom Rini
On Tue, Aug 14, 2012 at 10:36:19PM +0200, Jeroen Hofstee wrote:

 version 2:
 Updated the commit message to include the explanation from the
 original thread.
 
 For cosmetic reasons, move the added line 2 lines down, so it
 is similiar to the hw case.
 
 Add original author and maintainer on cc.
 
 Jeroen Hofstee (1):
   arm: omap2+: Fix switching back to nandecc sw.

Queued up for u-boot-ti/master, thanks!

-- 
Tom


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


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

2012-08-24 Thread Tom Rini
Hello,

The following changes since commit a1cd53c6b6e2e7fbf4ffa20d3548646e4c94efe5:

  sc_sps_1: Adjust board config to use 'mxs' SoC code (2012-08-14 00:36:30 
+0200)

are available in the git repository at:

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

for you to fetch changes up to 56540ed12d86a998ebd8f9ec8d55828c30ab1f14:

  davinci, c6x: Always use C version of reset code (2012-08-24 15:50:35 -0700)


Heiko Schocher (1):
  davinci: enbw_cmc: change switch init behaviour

Jeroen Hofstee (1):
  arm: omap: Fix switching back to nandecc sw.

Satyanarayana, Sandhya (1):
  am33xx evm: Update secure_emif_sdram_config during ddr init

Sughosh Ganu (1):
  da8xx/hawkboard: Add support for ohci host controller

Tom Rini (8):
  am335x evm: Initial support for AM335x GP EVM Profiles
  am33xx: Correct MMC1, remove MMC2 support
  am335x evm: Enable MMC1 pinmux
  am33xx: Add support, update omap3 McSPI driver
  am335x evm: Enable support for spi0
  omap4/5/am33xx: Make lowlevel_init available to all armv7 platforms
  armv7: Make lowlevel_init.S's lowlevel_init do ABI compatible stack
  davinci, c6x: Always use C version of reset code

 arch/arm/cpu/arm926ejs/davinci/Makefile|4 +-
 arch/arm/cpu/arm926ejs/davinci/psc.c   |5 +
 arch/arm/cpu/arm926ejs/davinci/reset.S |   81 
 arch/arm/cpu/arm926ejs/davinci/reset.c |   33 +++
 arch/arm/cpu/armv7/Makefile|6 +-
 arch/arm/cpu/armv7/am33xx/board.c  |8 +-
 arch/arm/cpu/armv7/am33xx/clock.c  |5 +
 arch/arm/cpu/armv7/am33xx/ddr.c|5 +-
 arch/arm/cpu/armv7/lowlevel_init.S |   51 ++
 arch/arm/cpu/armv7/omap-common/lowlevel_init.S |   18 
 arch/arm/include/asm/arch-am33xx/cpu.h |2 +
 arch/arm/include/asm/arch-am33xx/hardware.h|3 +-
 arch/arm/include/asm/arch-am33xx/mmc_host_def.h|3 +-
 arch/arm/include/asm/arch-am33xx/omap.h|1 -
 arch/arm/include/asm/arch-am33xx/sys_proto.h   |1 +
 .../arm/include/asm/arch-davinci/da8xx-usb.h   |7 +-
 arch/arm/include/asm/arch-davinci/hardware.h   |1 +
 arch/arm/include/asm/arch-omap4/omap.h |1 -
 arch/arm/include/asm/arch-omap5/omap.h |2 -
 arch/arm/include/asm/omap_common.h |2 +-
 board/davinci/da8xxevm/hawkboard.c |   41 
 board/enbw/enbw_cmc/enbw_cmc.c |  102 +---
 board/ti/am335x/mux.c  |   73 +-
 drivers/mtd/nand/omap_gpmc.c   |1 +
 drivers/spi/omap3_spi.c|   16 +++
 drivers/spi/omap3_spi.h|5 +
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/ohci-da8xx.c  |   48 +
 drivers/usb/musb/da8xx.c   |3 +-
 include/configs/am335x_evm.h   |   13 ++-
 include/configs/hawkboard.h|   14 ++-
 include/configs/omap4_common.h |7 +-
 include/configs/omap5_evm.h|7 +-
 33 files changed, 404 insertions(+), 166 deletions(-)
 delete mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.S
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.c
 create mode 100644 arch/arm/cpu/armv7/lowlevel_init.S
 rename drivers/usb/musb/da8xx.h = 
arch/arm/include/asm/arch-davinci/da8xx-usb.h (96%)
 create mode 100644 drivers/usb/host/ohci-da8xx.c

-- 
Tom


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


[U-Boot] [PATCH v4 0/20] ARM: SPL: Make more generic, merge DaVinci and OMAP

2012-08-24 Thread Tom Rini
Hey all,

The following patch series merges the davinci and omap-common SPL
frameworks into a single framework, CONFIG_SPL_FRAMEWORK along with a
few small cleanups to the code to make it a little smaller and more
flexible.  The end result is that davinci can now opt in on
SPL-boots-Linux by just setting the right defines and other platforms
would just need to adapt to this framework.  In my testing, davinci
gains between 300 and 700 bytes for this (not enabling the SPL OS
feature) and omap4/5/etc lose just a little bit (from the printf-puts
changes).  I've tested this on omap3_beagle (xM and classic) and
omap4_panda.  I don't have any davinci platforms that were previously
using SPL so I can't boot-test those changes but since everyone sets
CONFIG_SPL_MAX_SIZE, we're OK in that department.

To make this series easier to test I've placed it on
http://github.com/trini/u-boot WIP/spl-improvements

I've looked a little into re-reducing the size and the biggest problem I
see is that SPI a lot of informational prints that we don't need,
strictly speaking, but are nice in a normal U-Boot context.  I'm unsure
of the best way to quiet these as I don't like the idea of sprinkling
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303 and I'm sending
another email to discuss that.

--
Tom

Changes in v2:
- Add CONFIG_SYS_SPL_MALLOC_START / SIZE defines from Christian Riesch
- Add README.da850_am18xxevm
- Add arch/arm/cpu/arm926ejs/davinci/config.mk to build u-boot.ais
- Fix checkpatch warning (u32* boot_params_ptr - u32 *boot_params_ptr)
- Place files into common/spl (due to gcc bug #54303) and include/spl.h
- Reorder all of the patches that used to follow this to precede.

Changes in v3:
  CONFIG_SPL_FRAMEWORK
  perform early init.  Fixes the cannot reset problem.
- Fix checkpatch.pl warning
- Fix thinko, Nand - SPI (spotted by Prabhakar Lad)
- Make u-boot.ais use u-boot.img not u-boot.bin, now that it uses
- Make use of board_init_f being a weak function now so that we can
- Rename to README.da850, add more direct recovery method (Christian Riesch)

Changes in v4:
- Adapt davinci to new board_init_f requirements
- Add Stefano's patch for CONFIG_SYS_MONITOR_LEN
- Based on PowerPC, use memset to clear BSS rather than relocate_code
- Document what board_init_f must do
- Further re-word README.da850 based on feedback from Christian Riesch
- Leave nand_spl_load.c alone, move the new load into nand_spl_simple.c
- Make board_init_f setup the global data pointer, after clearing BSS.
- Move board_init_f / jump_to_image_linux to arch/arm/lib/spl.c

Stefano Babic (1):
  SPL: do not use fix value for u-boot size

Tom Rini (19):
  Makefile: Move SPL files to clobber, remove from clean
  spl_mmc: Make FAT checks / calls guarded with CONFIG_SPL_FAT_SUPPORT
  omap-common: SPL: Add CONFIG_SPL_DISPLAY_PRINT / spl_display_print()
  omap-common: Fix typo in save_boot_params() in lowlevel_init.S
  ARM: SPL: Rename omap_boot_device to spl_boot_device
  ARM: SPL: Rename omap_boot_mode to spl_boot_mode()
  ARM: SPL: Remove NAND_MODE_HW_ECC from spl_nand.c
  ARM: SPL: Only call mem_malloc_init if configured
  ARM: SPL: Add asm/spl.h and asm/arch/spl.h
  ARM: SPL: Make spl_mmc.c more generic
  ARM: SPL: Clean up spl.c / spl_nand.c slightly
  ARM: SPL: Start hooking in the current SPI SPL support
  ARM: SPL: Move gpmc_init() to spl_board_init()
  SPL: Move the omap SPL framework to common/spl
  SPL: Create arch/arm/lib/spl.c for board_init_f and
jump_to_image_linux
  ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK
  da850: Add README.da850
  SPL: NAND: Enhance drivers/mtd/nand/nand_spl_simple.c
  SPL: SPI: Enhance spi_spl_load to match the other load functions

 Makefile   |   16 +--
 README |9 ++
 arch/arm/cpu/arm926ejs/davinci/Makefile|2 +-
 arch/arm/cpu/arm926ejs/davinci/config.mk   |   16 +++
 arch/arm/cpu/arm926ejs/davinci/spl.c   |   60 +--
 arch/arm/cpu/arm926ejs/start.S |   20 +---
 arch/arm/cpu/armv7/am33xx/board.c  |2 +-
 arch/arm/cpu/armv7/omap-common/Makefile|   13 ---
 arch/arm/cpu/armv7/omap-common/boot-common.c   |   27 -
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |7 +-
 arch/arm/cpu/armv7/omap-common/lowlevel_init.S |6 +-
 arch/arm/cpu/armv7/omap-common/spl_nand.c  |  111 
 arch/arm/cpu/armv7/omap3/board.c   |   28 +++--
 arch/arm/cpu/armv7/start.S |   13 +--
 arch/arm/include/asm/arch-am33xx/spl.h |   31 ++
 arch/arm/include/asm/arch-davinci/spl.h|   28 +
 arch/arm/include/asm/arch-omap3/spl.h  |   34 ++
 arch/arm/include/asm/arch-omap4/spl.h  |   35 ++
 arch/arm/include/asm/arch-omap4/sys_proto.h|1 -
 arch/arm/include/asm/arch-omap5/spl.h  |   35 ++
 

[U-Boot] [PATCH v4 01/20] Makefile: Move SPL files to clobber, remove from clean

2012-08-24 Thread Tom Rini
The 'clean' target has been removing all of spl but not u-boot itself.
For consistency and ease of testing, only remove SPL binaries / maps in
the clobber target, just like for full U-Boot

Signed-off-by: Tom Rini tr...@ti.com
---

 Makefile |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 73c8e39..57bb0b9 100644
--- a/Makefile
+++ b/Makefile
@@ -763,12 +763,6 @@ clean:
@rm -f $(obj)lib/asm-offsets.s
@rm -f $(obj)include/generated/asm-offsets.h
@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
-   @rm -f 
$(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
-   @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
-   @rm -f $(ONENAND_BIN)
-   @rm -f $(obj)onenand_ipl/u-boot.lds
-   @rm -f 
$(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map}
-   @rm -f $(obj)MLO
@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
@find $(OBJTREE) -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
@@ -793,6 +787,12 @@ clobber:   tidy
@rm -f $(obj)u-boot.dtb
@rm -f $(obj)u-boot.sb
@rm -f $(obj)u-boot.spr
+   @rm -f 
$(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
+   @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
+   @rm -f $(ONENAND_BIN)
+   @rm -f $(obj)onenand_ipl/u-boot.lds
+   @rm -f 
$(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map}
+   @rm -f $(obj)MLO
@rm -f $(obj)tools/xway-swap-bytes
@rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
@rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 02/20] spl_mmc: Make FAT checks / calls guarded with CONFIG_SPL_FAT_SUPPORT

2012-08-24 Thread Tom Rini
Signed-off-by: Tom Rini tr...@ti.com
---

 arch/arm/cpu/armv7/omap-common/spl_mmc.c |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap-common/spl_mmc.c 
b/arch/arm/cpu/armv7/omap-common/spl_mmc.c
index 2f921bb..7552f6c 100644
--- a/arch/arm/cpu/armv7/omap-common/spl_mmc.c
+++ b/arch/arm/cpu/armv7/omap-common/spl_mmc.c
@@ -84,6 +84,7 @@ end:
}
 }
 
+#ifdef CONFIG_SPL_FAT_SUPPORT
 static void mmc_load_image_fat(struct mmc *mmc)
 {
s32 err;
@@ -116,6 +117,7 @@ end:
hang();
}
 }
+#endif
 
 void spl_mmc_load_image(void)
 {
@@ -140,9 +142,11 @@ void spl_mmc_load_image(void)
if (boot_mode == MMCSD_MODE_RAW) {
debug(boot mode - RAW\n);
mmc_load_image_raw(mmc);
+#ifdef CONFIG_SPL_FAT_SUPPORT
} else if (boot_mode == MMCSD_MODE_FAT) {
debug(boot mode - FAT\n);
mmc_load_image_fat(mmc);
+#endif
} else {
puts(spl: wrong MMC boot mode\n);
hang();
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 04/20] omap-common: Fix typo in save_boot_params() in lowlevel_init.S

2012-08-24 Thread Tom Rini
Signed-off-by: Tom Rini tr...@ti.com
---

 arch/arm/cpu/armv7/omap-common/lowlevel_init.S |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S 
b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index ccc6bb6..48a296c 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -63,7 +63,7 @@ ENTRY(save_boot_params)
blt 2f
cmp r2, #7
bgt 2f
-   /* Store the boot mode (raw/FAT) in omap_boot_mode */
+   /* Store the boot mode (raw/FAT) in omap_bootmode */
ldr r2, [r0, #DEV_DESC_PTR_OFFSET]  @ get the device descriptor ptr
ldr r2, [r2, #DEV_DATA_PTR_OFFSET]  @ get the pDeviceData ptr
ldr r2, [r2, #BOOT_MODE_OFFSET] @ get the boot mode
-- 
1.7.9.5

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


  1   2   >