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

2012-08-23 Thread Veli-Pekka Peltola

Hi Otavio,

On 08/19/2012 05:58 PM, Otavio Salvador wrote:

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

The following boards has been changed:

  * apx4devkit
  * m28evk
  * mx28evk
  * sc_sps_1

Signed-off-by: Otavio Salvador 


Acked-by: Veli-Pekka Peltola 


---
  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();
  }

  #ifdefCONFIG_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();
  }

  #ifdefCONFIG_CMD_MMC



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


Re: [U-Boot] [PATCH 3/9] disk/part: introduce get_device_and_partition

2012-08-23 Thread Stephen Warren
On 08/23/2012 07:57 PM, Rob Herring wrote:
> On 08/23/2012 05:36 PM, Stephen Warren wrote:
>> On 08/23/2012 03:31 PM, Rob Herring wrote:
>>> From: Rob Herring 
>>>
>>> All block device related commands (scsiboot, fatload, ext2ls, etc.) have
>>> simliar duplicated device and partition parsing and selection code. This
>>> adds a common function to replace various implementations.
>>>
>>> The new function has some enhancements over current versions. If no device
>>> or partition is specified on the command line, the bootdevice env variable
>>> will be used (scsiboot does this). If the partition is not specified and
>>> the device has partitions, then the first bootable partition will be used.
>>> If a bootable partition is not found, the first valid partition is used.
>>> The ret value is not needed since part will be zero when no partition is
>>> found.
>>
>> Two thoughts on this patch:
>>
>> First, if I write "mmc 0" right now, command will always attempt to
>> access precisely partion 1, whereas after this patch, they will search
>> for the first bootable, or valid, partition. This is a change in
>> behavior. It's a pretty reasonable change, but I wonder if it might
>> cause problems somewhere.
>>
>> Instead, perhaps this new feature should be explicitly requested,
>> supporting the following device/partition specifications:
>>
>> # existing:
>> dev 0:0# whole device
>> dev 0:n# n >= 1: explicit partition
>> dev 0  # partition 1
>> # new:
>> dev 0:valid# first valid partition
>> dev 0:bootable # first bootable partition
>> dev 0:default  # first bootable partition if there is one,
>># else first valid
> 
> I'm not sure we need to distinguish valid vs. bootable. Returning the
> first valid partition was really just to maintain somewhat backwards
> compatible behavior.
> 
> Perhaps just "0:-" would be sufficient.

I guess that syntax would be fine if we don't need to distinguish all
the cases. "-" isn't that descriptive though, and I've only seen it mean
"nothing" in U-Boot commands. So, bike-shedding a bit, it doesn't seem
exactly correct. Perhaps just "auto"?

>> That would allow scripts to be very explicit about whether they wanted
>> this new functionality.
>>
>> Second, if I run a slew of ext2load commands:
>>
>> ext2load mmc 0:bootable ${scriptaddr} boot.scr
>> source ${scriptaddr}
>> # script does:
>> ext2load mmc 0:bootable ${kernel_addr} zImage
>> ext2load mmc 0:bootable ${initrd_addr} initrd.bin
>> ext2load mmc 0:bootable ${fdt_addr} foo.dtb
>>
>> Then there are two disadvantages:
>>
>> 1) I believe the partition table is read and decoded and search for
>> every one of those ext2load commands. Slightly inefficient.
> 
> It was already multiple times per command with the command function
> calling get_partition_info and then the filesystem code calling it again
> internally as well. Now it is only 1 time at least. I would think the
> 1st partition being bootable is the common case.
> 
>> 2) There's no permanent record of the partition number, so this couldn't
>> be e.g. used to construct a kernel command-line etc.
> 
> You mean to setup rootfs? I don't think we want u-boot to do that. Or
> what would be the use?

I can imagine a boot.scr that does:

setenv bootargs root=/dev/mmcblk0p${bootpart}

But then, you may as well use the partition UUID feature instead of
that, so that boot.scr doesn't need to know the kernel's device name.

>> Instead, I wonder if get_device_and_partition() should just support the
>> existing 3 device specification options, and we introduce a new command
>> to determine which partition to boot from, e.g.:
>>
>> # writes result to "bootpart" variable
>> # or get-default or get-first-valid
>> part get-first-bootable mmc 0 bootpart
>>
>> ext2load mmc 0:${bootpart} ${scriptaddr} boot.scr
>> source ${scriptaddr}
>> # script does:
>> ext2load mmc 0:${bootpart} ${kernel_addr} zImage
>> ext2load mmc 0:${bootpart} ${initrd_addr} initrd.bin
>> ext2load mmc 0:${bootpart} ${fdt_addr} foo.dtb
>>
>> That solves those issues. Does anyone have any comment on the two
>> approaches?
> 
> I'm really open to either way.
> 
> Another option would be for the first command run to set bootpart and
> then re-use that value on subsequent commands.

That could work too, although commands using environment variables seems
a little implicit/hidden.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/9] disk/part: introduce get_device_and_partition

2012-08-23 Thread Rob Herring
On 08/23/2012 05:36 PM, Stephen Warren wrote:
> On 08/23/2012 03:31 PM, Rob Herring wrote:
>> From: Rob Herring 
>>
>> All block device related commands (scsiboot, fatload, ext2ls, etc.) have
>> simliar duplicated device and partition parsing and selection code. This
>> adds a common function to replace various implementations.
>>
>> The new function has some enhancements over current versions. If no device
>> or partition is specified on the command line, the bootdevice env variable
>> will be used (scsiboot does this). If the partition is not specified and
>> the device has partitions, then the first bootable partition will be used.
>> If a bootable partition is not found, the first valid partition is used.
>> The ret value is not needed since part will be zero when no partition is
>> found.
> 
> Two thoughts on this patch:
> 
> First, if I write "mmc 0" right now, command will always attempt to
> access precisely partion 1, whereas after this patch, they will search
> for the first bootable, or valid, partition. This is a change in
> behavior. It's a pretty reasonable change, but I wonder if it might
> cause problems somewhere.
> 
> Instead, perhaps this new feature should be explicitly requested,
> supporting the following device/partition specifications:
> 
> # existing:
> dev 0:0# whole device
> dev 0:n# n >= 1: explicit partition
> dev 0  # partition 1
> # new:
> dev 0:valid# first valid partition
> dev 0:bootable # first bootable partition
> dev 0:default  # first bootable partition if there is one,
># else first valid

I'm not sure we need to distinguish valid vs. bootable. Returning the
first valid partition was really just to maintain somewhat backwards
compatible behavior.

Perhaps just "0:-" would be sufficient.

> 
> That would allow scripts to be very explicit about whether they wanted
> this new functionality.
> 
> Second, if I run a slew of ext2load commands:
> 
> ext2load mmc 0:bootable ${scriptaddr} boot.scr
> source ${scriptaddr}
> # script does:
> ext2load mmc 0:bootable ${kernel_addr} zImage
> ext2load mmc 0:bootable ${initrd_addr} initrd.bin
> ext2load mmc 0:bootable ${fdt_addr} foo.dtb
> 
> Then there are two disadvantages:
> 
> 1) I believe the partition table is read and decoded and search for
> every one of those ext2load commands. Slightly inefficient.

It was already multiple times per command with the command function
calling get_partition_info and then the filesystem code calling it again
internally as well. Now it is only 1 time at least. I would think the
1st partition being bootable is the common case.

> 2) There's no permanent record of the partition number, so this couldn't
> be e.g. used to construct a kernel command-line etc.

You mean to setup rootfs? I don't think we want u-boot to do that. Or
what would be the use?

> Instead, I wonder if get_device_and_partition() should just support the
> existing 3 device specification options, and we introduce a new command
> to determine which partition to boot from, e.g.:
> 
> # writes result to "bootpart" variable
> # or get-default or get-first-valid
> part get-first-bootable mmc 0 bootpart
> 
> ext2load mmc 0:${bootpart} ${scriptaddr} boot.scr
> source ${scriptaddr}
> # script does:
> ext2load mmc 0:${bootpart} ${kernel_addr} zImage
> ext2load mmc 0:${bootpart} ${initrd_addr} initrd.bin
> ext2load mmc 0:${bootpart} ${fdt_addr} foo.dtb
> 
> That solves those issues. Does anyone have any comment on the two
> approaches?

I'm really open to either way.

Another option would be for the first command run to set bootpart and
then re-use that value on subsequent commands.

Rob

> 
> (although perhaps e.g. ext2load always re-reads the partition table
> anyway, so perhaps that advantage is moot?)
> 
> Aside from that, this series looks conceptually reasonable at a quick
> glance. I'd be happy to provide an equivalent to patch 2 for GPT/EFI
> partition tables.
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] atmel: sam9g10: correct the text base and move into config.mk

2012-08-23 Thread Bo Shen

Hi Andreas,

On 8/23/2012 18:36, Andreas Bießmann wrote:

Dear Bo Shen,

On 23.08.2012 11:34, Bo Shen wrote:

This patch correct the text base for at91sam9g10ek board
Move the text base define to config.mk

Signed-off-by: Bo Shen 
---
  board/atmel/at91sam9261ek/config.mk |1 +
  include/configs/at91sam9261ek.h |1 -
  2 files changed, 1 insertion(+), 1 deletion(-)
  create mode 100644 board/atmel/at91sam9261ek/config.mk

diff --git a/board/atmel/at91sam9261ek/config.mk 
b/board/atmel/at91sam9261ek/config.mk
new file mode 100644
index 000..e554a45
--- /dev/null
+++ b/board/atmel/at91sam9261ek/config.mk
@@ -0,0 +1 @@
+CONFIG_SYS_TEXT_BASE = 0x23f0


NAK, these configuration should go into the board config header or maybe
the boards.cfg.
For this board please read commit f7aea46d6ad9c257d2fbea7238cc8796aaa733f1



Thanks for your information.
I will keep it and fix the bootstrap.

BRs,
Bo Shen


Another point is, the 23f0 is (possibly) not far enough from
position the start.S code will relocate the u-boot (depends on size of
gd_t, bd_t, malloc arena, some special env, a.s.o). That was changed in
f7aea46 by intention. Please fix at91bootstrap instead (or start
integrating at91 for common SPL framework in u-boot; still on my plan
for this year but I couldn't manage to start until yet).


diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 014437b..718ac60 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -52,7 +52,6 @@
  #define CONFIG_DISPLAY_CPUINFO

  #define CONFIG_ATMEL_LEGACY
-#define CONFIG_SYS_TEXT_BASE   0x21f0

  /*
   * Hardware drivers





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


[U-Boot] [PATCH 2/2] nand_spl: p1010rdb: optimize ddr init for size

2012-08-23 Thread Scott Wood
Data is more compact than code for initializing a bunch of registers.

Some of the register intialization is reordered in order to reduce the
number of separate register lists to process, but since they were all raw
accesses we should not have been relying on the ordering anyway.  This saves
about 300 bytes.

Signed-off-by: Scott Wood 
---
 nand_spl/board/freescale/p1010rdb/nand_boot.c |  110 +++--
 1 file changed, 84 insertions(+), 26 deletions(-)

diff --git a/nand_spl/board/freescale/p1010rdb/nand_boot.c 
b/nand_spl/board/freescale/p1010rdb/nand_boot.c
index 444d2f2..f1e9df4 100644
--- a/nand_spl/board/freescale/p1010rdb/nand_boot.c
+++ b/nand_spl/board/freescale/p1010rdb/nand_boot.c
@@ -31,48 +31,106 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static const u32 ddr_regvals_common[] = {
+   CONFIG_SYS_DDR_CONTROL | SDRAM_CFG_32_BE,
+   CONFIG_SYS_DDR_CS0_BNDS,
+   CONFIG_SYS_DDR_CS0_CONFIG,
+   CONFIG_SYS_DDR_CONTROL_2,
+   CONFIG_SYS_DDR_DATA_INIT,
+   CONFIG_SYS_DDR_TIMING_4,
+   CONFIG_SYS_DDR_TIMING_5,
+   CONFIG_SYS_DDR_ZQ_CONTROL,
+};
+
+static const u16 ddr_regoffs_common[] = {
+   offsetof(ccsr_ddr_t, sdram_cfg),
+   offsetof(ccsr_ddr_t, cs0_bnds),
+   offsetof(ccsr_ddr_t, cs0_config),
+   offsetof(ccsr_ddr_t, sdram_cfg_2),
+   offsetof(ccsr_ddr_t, sdram_data_init),
+   offsetof(ccsr_ddr_t, timing_cfg_4),
+   offsetof(ccsr_ddr_t, timing_cfg_5),
+   offsetof(ccsr_ddr_t, ddr_zq_cntl),
+};
+
+static const u32 ddr_regvals_slow[] = {
+   CONFIG_SYS_DDR_TIMING_3_667,
+   CONFIG_SYS_DDR_TIMING_0_667,
+   CONFIG_SYS_DDR_TIMING_1_667,
+   CONFIG_SYS_DDR_TIMING_2_667,
+   CONFIG_SYS_DDR_MODE_1_667,
+   CONFIG_SYS_DDR_MODE_2_667,
+   CONFIG_SYS_DDR_INTERVAL_667,
+   CONFIG_SYS_DDR_CLK_CTRL_667,
+   CONFIG_SYS_DDR_WRLVL_CONTROL_667,
+};
+
+static const u32 ddr_regvals_fast[] = {
+   CONFIG_SYS_DDR_TIMING_3_800,
+   CONFIG_SYS_DDR_TIMING_0_800,
+   CONFIG_SYS_DDR_TIMING_1_800,
+   CONFIG_SYS_DDR_TIMING_2_800,
+   CONFIG_SYS_DDR_MODE_1_800,
+   CONFIG_SYS_DDR_MODE_2_800,
+   CONFIG_SYS_DDR_INTERVAL_800,
+   CONFIG_SYS_DDR_CLK_CTRL_800,
+   CONFIG_SYS_DDR_WRLVL_CONTROL_800,
+};
+
+static const u16 ddr_regoffs_freq[] = {
+   offsetof(ccsr_ddr_t, timing_cfg_3),
+   offsetof(ccsr_ddr_t, timing_cfg_0),
+   offsetof(ccsr_ddr_t, timing_cfg_1),
+   offsetof(ccsr_ddr_t, timing_cfg_2),
+   offsetof(ccsr_ddr_t, sdram_mode),
+   offsetof(ccsr_ddr_t, sdram_mode_2),
+   offsetof(ccsr_ddr_t, sdram_interval),
+   offsetof(ccsr_ddr_t, sdram_clk_cntl),
+   offsetof(ccsr_ddr_t, ddr_wrlvl_cntl),
+};
+
+void set_ddr_regs(const u32 *vals, const u16 *offs, int num)
+{
+   ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
+   int i;
+
+   for (i = 0; i < num; i++) {
+   u32 val = *vals++;
+   u32 *ptr = (u32 *)(((uintptr_t)ddr) + *offs++);
+   __raw_writel(val, ptr);
+   }
+}
+
 void sdram_init(u32 ddr_freq_mhz)
 {
+   const u32 *regvals;
ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
/* mask off E bit */
u32 svr = SVR_SOC_VER(mfspr(SPRN_SVR));
 
+   set_ddr_regs(ddr_regvals_common, ddr_regoffs_common,
+   ARRAY_SIZE(ddr_regoffs_common));
+
__raw_writel(CONFIG_SYS_DDR_CONTROL | SDRAM_CFG_32_BE, &ddr->sdram_cfg);
__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
__raw_writel(CONFIG_SYS_DDR_CONTROL_2, &ddr->sdram_cfg_2);
__raw_writel(CONFIG_SYS_DDR_DATA_INIT, &ddr->sdram_data_init);
 
-   if (ddr_freq_mhz < 700) {
-   __raw_writel(CONFIG_SYS_DDR_TIMING_3_667, &ddr->timing_cfg_3);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_0_667, &ddr->timing_cfg_0);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_1_667, &ddr->timing_cfg_1);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_2_667, &ddr->timing_cfg_2);
-   __raw_writel(CONFIG_SYS_DDR_MODE_1_667, &ddr->sdram_mode);
-   __raw_writel(CONFIG_SYS_DDR_MODE_2_667, &ddr->sdram_mode_2);
-   __raw_writel(CONFIG_SYS_DDR_INTERVAL_667, &ddr->sdram_interval);
-   __raw_writel(CONFIG_SYS_DDR_CLK_CTRL_667, &ddr->sdram_clk_cntl);
-   __raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL_667, 
&ddr->ddr_wrlvl_cntl);
-   } else {
-   __raw_writel(CONFIG_SYS_DDR_TIMING_3_800, &ddr->timing_cfg_3);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_0_800, &ddr->timing_cfg_0);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_1_800, &ddr->timing_cfg_1);
-   __raw_writel(CONFIG_SYS_DDR_TIMING_2_800, &ddr->timing_cfg_2);
-   __raw_writel(CONFIG_SYS_DDR_MODE_1_800, &ddr->sdram_mode);
-   __raw_writel(CONFIG_SYS_DDR_MODE_2_800, &ddr->sdram_mode_2);
-   __raw_writel(CONFIG_SYS_

[U-Boot] [PATCH 1/2] nand_spl: p1010rdb: don't write to global variable before reloc

2012-08-23 Thread Scott Wood
Pass it on the stack instead.  Besides being the right thing to do, it
also should save a few bytes.

Signed-off-by: Scott Wood 
---
 nand_spl/board/freescale/p1010rdb/nand_boot.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/nand_spl/board/freescale/p1010rdb/nand_boot.c 
b/nand_spl/board/freescale/p1010rdb/nand_boot.c
index 9c35690..444d2f2 100644
--- a/nand_spl/board/freescale/p1010rdb/nand_boot.c
+++ b/nand_spl/board/freescale/p1010rdb/nand_boot.c
@@ -31,9 +31,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-unsigned long ddr_freq_mhz;
-
-void sdram_init(void)
+void sdram_init(u32 ddr_freq_mhz)
 {
ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
/* mask off E bit */
@@ -91,7 +89,7 @@ void sdram_init(void)
 
 void board_init_f(ulong bootflag)
 {
-   u32 plat_ratio, ddr_ratio;
+   u32 plat_ratio, ddr_ratio,  ddr_freq_mhz;
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
/* initialize selected port with appropriate baud rate */
@@ -109,7 +107,7 @@ void board_init_f(ulong bootflag)
puts("\nNAND boot... ");
 
/* Initialize the DDR3 */
-   sdram_init();
+   sdram_init(ddr_freq_mhz);
 
/* copy code to RAM and jump to it - this should not return */
/* NOTE - code has to be copied out of NAND buffer before
-- 
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 4/6 v2] arm:exynos4:trats: Use pinmux for mmc configuration

2012-08-23 Thread Jaehoon Chung
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 
> Signed-off-by: Kyungmin Park 
> CC: Minkyu Kang 
> ---
> 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 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -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.

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


Re: [U-Boot] [Patch V3 4/4] [MIPS] Disable standalone while building MIPS64

2012-08-23 Thread Daniel Schwierzeck
2012/8/20 Zhizhou Zhang :
> I think copy mips.lds to mips64.lds with only one line changed is not
> good. So I disable it in top Makefile.
> Signed-off-by: Zhizhou Zhang 
> ---
>  Makefile |2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 5ce5cc3..626d888 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -155,8 +155,10 @@ sinclude $(obj)include/autoconf.mk.dep
>  sinclude $(obj)include/autoconf.mk
>
>  ifndef CONFIG_SANDBOX
> +ifndef CONFIG_MIPS64
>  SUBDIRS += $(SUBDIR_EXAMPLES)
>  endif
> +endif
>
>  # load ARCH, BOARD, and CPU configuration
>  include $(obj)include/config.mk
> --
> 1.7.9.5
>

NAK.

Please do what you have done in v1 of your patch series. This is possible now
if you use current master of git://git.denx.de/u-boot-mips.git.

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


Re: [U-Boot] [Patch V3 3/4] [MIPS] Add qemu-mips building configs

2012-08-23 Thread Daniel Schwierzeck
2012/8/20 Zhizhou Zhang :
> This patch add qemu-mips64 config. And here uses qemu-mips board rather
> then a new board qemu-mips64 for the sake of reduce code copying. Below
> are the changes:
>   config.mk: We must define CONFIG_SYS_TEXT_BASE in configs/*.h, not
> here, so remove this file.
>   u-boot.lds: add mips64 link statements.
>   boards.cfg: add mips64 cpu define.
>
> Signed-off-by: Zhizhou Zhang 
> ---
>  board/qemu-mips/config.mk |   10 ---
>  board/qemu-mips/u-boot.lds|8 ++
>  boards.cfg|1 +
>  include/configs/qemu-mips.h   |3 +
>  include/configs/qemu-mips64.h |  171 
> +
>  5 files changed, 183 insertions(+), 10 deletions(-)
>  delete mode 100644 board/qemu-mips/config.mk
>  create mode 100644 include/configs/qemu-mips64.h
>
> diff --git a/board/qemu-mips/config.mk b/board/qemu-mips/config.mk
> deleted file mode 100644
> index 27cd34a..000
> --- a/board/qemu-mips/config.mk
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#
> -# Qemu -M mips system emulator
> -# See http://fabrice.bellard.free.fr/qemu
> -#
> -
> -# ROM version
> -CONFIG_SYS_TEXT_BASE = 0xbfc0
> -
> -# RAM version
> -#CONFIG_SYS_TEXT_BASE = 0x80001000
> diff --git a/board/qemu-mips/u-boot.lds b/board/qemu-mips/u-boot.lds
> index 9460b20..06db68d 100644
> --- a/board/qemu-mips/u-boot.lds
> +++ b/board/qemu-mips/u-boot.lds
> @@ -24,7 +24,11 @@
>  /*
>  OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
>  */
> +#if defined(CONFIG_64BIT)
> +OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradlittlemips", 
> "elf64-tradlittlemips")

this is still wrong. We ideally want to support qemu_mips64 and qemu_mips64el.
Please use
OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", "elf64-tradlittlemips")

> +#else
>  OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 
> "elf32-tradlittlemips")
> +#endif
>  OUTPUT_ARCH(mips)
>  ENTRY(_start)
>  SECTIONS
> @@ -63,7 +67,11 @@ SECTIONS
> }
>
> uboot_end_data = .;
> +#if defined(CONFIG_64BIT)
> +   num_got_entries = (__got_end - __got_start) >> 3;
> +#else
> num_got_entries = (__got_end - __got_start) >> 2;
> +#endif
>
> . = ALIGN(4);
> .sbss  : { *(.sbss*) }
> diff --git a/boards.cfg b/boards.cfg
> index fdb84ad..a6806b8 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -379,6 +379,7 @@ M5485GFE m68kmcf547x_8x  m548xevb 
>freescale  -
>  M5485HFEm68kmcf547x_8x  m548xevb
> freescale  -   
> M5485EVB:SYS_BUSCLK=1,SYS_BOOTSZ=2,SYS_DRAMSZ=64,SYS_NOR1SZ=16,SYS_VIDEO
>  microblaze-generic   microblaze  microblaze  microblaze-generic  
> xilinx
>  qemu_mipsmipsmips32  qemu-mips   -   
>-   qemu-mips
> +qemu_mips64  mipsmips64  qemu-mips   -   
>-   qemu-mips64

please use following to support both endianess types

qemu_mips64  mipsmips64  qemu-mips
  -  -   qemu-mips64:SYS_BIG_ENDIAN
qemu_mips64elmipsmips64  qemu-mips
  -  -   qemu-mips64:SYS_LITTLE_ENDIAN

>  vct_platinum mipsmips32  vct 
> micronas   -   vct:VCT_PLATINUM
>  vct_platinumavc  mipsmips32  vct 
> micronas   -   vct:VCT_PLATINUMAVC
>  vct_platinumavc_onenand  mipsmips32  vct 
> micronas   -   vct:VCT_PLATINUMAVC,VCT_ONENAND
> diff --git a/include/configs/qemu-mips.h b/include/configs/qemu-mips.h
> index 306c173..bb85bbe 100644
> --- a/include/configs/qemu-mips.h
> +++ b/include/configs/qemu-mips.h
> @@ -135,6 +135,9 @@
>  #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE
>  #define CONFIG_SYS_MONITOR_LEN (192 << 10)
>
> +#define CONFIG_SYS_TEXT_BASE   0xbfc0 /* Rom version */
> +//#define CONFIG_SYS_TEXT_BASE 0x80001000 /* RAM Version */

no C++ style comments. Actually you could drop that line.

> +
>  #define CONFIG_SYS_INIT_SP_OFFSET  0x40
>
>  /* We boot from this flash, selected with dip switch */
> diff --git a/include/configs/qemu-mips64.h b/include/configs/qemu-mips64.h
> new file mode 100644
> index 000..2f39494
> --- /dev/null
> +++ b/include/configs/qemu-mips64.h
> @@ -0,0 +1,171 @@
> +/*
> + * (C) Copyright 2003
> + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will 

Re: [U-Boot] [Patch V3 2/4] [MIPS] add mips64 support in mips head files

2012-08-23 Thread Daniel Schwierzeck
2012/8/20 Zhizhou Zhang :
> The most important difference between mips32 and mips64 is the address
> space. changes in addrspace.h and io.h are for this sake. And this patch
> add cache discribe struct in cache.h, and make compatible to mips64 of
> some types in posix_types.h.
> Signed-off-by: Zhizhou Zhang 

add a blank line between commit message and SoB tag

> ---
>  arch/mips/include/asm/addrspace.h   |2 +-
>  arch/mips/include/asm/cache.h   |   21 +
>  arch/mips/include/asm/io.h  |   18 +-
>  arch/mips/include/asm/posix_types.h |   12 +---
>  4 files changed, 48 insertions(+), 5 deletions(-)
>
> diff --git a/arch/mips/include/asm/addrspace.h 
> b/arch/mips/include/asm/addrspace.h
> index 3a1e6d6..b768bb5 100644
> --- a/arch/mips/include/asm/addrspace.h
> +++ b/arch/mips/include/asm/addrspace.h
> @@ -136,7 +136,7 @@
> cannot access physical memory directly from core */
>  #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x2000)
>  #else  /* !CONFIG_SOC_AU1X00 */
> -#define UNCACHED_SDRAM(a) KSEG1ADDR(a)
> +#define UNCACHED_SDRAM(a) CKSEG1ADDR(a)
>  #endif /* CONFIG_SOC_AU1X00 */
>  #endif /* __ASSEMBLY__ */
>
> diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
> index 5406d5d..e41b9b4 100644
> --- a/arch/mips/include/asm/cache.h
> +++ b/arch/mips/include/asm/cache.h
> @@ -33,4 +33,25 @@
>  #define ARCH_DMA_MINALIGN  128
>  #endif
>
> +/*
> + * Descriptor for a cache
> + */
> +struct cache_desc {
> +   unsigned int size;  /* total size */
> +   unsigned int waysize;   /* Bytes per way */
> +   unsigned short sets;/* Number of lines per set */
> +   unsigned char ways; /* Number of ways */
> +   unsigned char linesz;   /* Size of line in bytes */
> +};
> +
> +#define cache_op(op,addr)  \
> +   __asm__ __volatile__(   \
> +   "   .setpush\n" \
> +   "   .setnoreorder   \n" \
> +   "   .setmips64\n\t  \n" \
> +   "   cache   %0, %1  \n" \
> +   "   .setpop \n" \
> +   :   \
> +   : "i" (op), "R" (*(unsigned char *)(addr)))
> +
>  #endif /* __MIPS_CACHE_H__ */
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index 025012a..1b82c61 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -120,12 +120,20 @@ static inline void set_io_port_base(unsigned long base)
>   */
>  extern inline phys_addr_t virt_to_phys(volatile void * address)
>  {
> +#ifndef CONFIG_64BIT
> return CPHYSADDR(address);
> +#else
> +   return XPHYSADDR(address);
> +#endif
>  }
>
>  extern inline void * phys_to_virt(unsigned long address)
>  {
> -   return (void *)KSEG0ADDR(address);
> +#ifndef CONFIG_64BIT
> +   return (void *)KSEG0ADDR(address);
> +#else
> +   return (void *)CKSEG0ADDR(address);
> +#endif
>  }
>
>  /*
> @@ -133,12 +141,20 @@ extern inline void * phys_to_virt(unsigned long address)
>   */
>  extern inline unsigned long virt_to_bus(volatile void * address)
>  {
> +#ifndef CONFIG_64BIT
> return CPHYSADDR(address);
> +#else
> +   return XPHYSADDR(address);
> +#endif
>  }
>
>  extern inline void * bus_to_virt(unsigned long address)
>  {
> +#ifndef CONFIG_64BIT
> return (void *)KSEG0ADDR(address);
> +#else
> +   return (void *)CKSEG0ADDR(address);
> +#endif
>  }
>
>  /*
> diff --git a/arch/mips/include/asm/posix_types.h 
> b/arch/mips/include/asm/posix_types.h
> index 879aae2..0da1dde 100644
> --- a/arch/mips/include/asm/posix_types.h
> +++ b/arch/mips/include/asm/posix_types.h
> @@ -24,9 +24,15 @@ typedef int  __kernel_pid_t;
>  typedef int__kernel_ipc_pid_t;
>  typedef int__kernel_uid_t;
>  typedef int__kernel_gid_t;
> -typedef unsigned int   __kernel_size_t;
> -typedef int__kernel_ssize_t;
> -typedef int__kernel_ptrdiff_t;
> +#ifndef CONFIG_MIPS64
> + typedef unsigned int  __kernel_size_t;
> + typedef int   __kernel_ssize_t;
> + typedef int   __kernel_ptrdiff_t;
> +#else
> +typedef unsigned long  __kernel_size_t;
> +typedef long   __kernel_ssize_t;
> +typedef long   __kernel_ptrdiff_t;
> +#endif
>  typedef long   __kernel_time_t;
>  typedef long   __kernel_suseconds_t;
>  typedef long   __kernel_clock_t;
> --
> 1.7.9.5
>



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


Re: [U-Boot] [Patch V3 1/4] [MIPS] Add support for MIPS64 cpus

2012-08-23 Thread Daniel Schwierzeck
2012/8/20 Zhizhou Zhang :
> These files are derived from arch/mips/cpu/mips32/*. Howerver some
> Changes are made:
>   *.S: changes ABI o32 to n64
>   config.mk: add mips64 building cflags
>   cpu.c: add cache size probe
>   interrupts.c: implement enable_interrupts and disable_interrupts
>
> Signed-off-by: Zhizhou Zhang 
> ---
>  arch/mips/cpu/mips64/Makefile |   47 +++
>  arch/mips/cpu/mips64/config.mk|   39 ++
>  arch/mips/cpu/mips64/cpu.c|  124 ++
>  arch/mips/cpu/mips64/interrupts.c |   39 ++
>  arch/mips/cpu/mips64/start.S  |  256 
> +
>  arch/mips/cpu/mips64/time.c   |   86 +
>  6 files changed, 591 insertions(+)
>  create mode 100644 arch/mips/cpu/mips64/Makefile
>  create mode 100644 arch/mips/cpu/mips64/config.mk
>  create mode 100644 arch/mips/cpu/mips64/cpu.c
>  create mode 100644 arch/mips/cpu/mips64/interrupts.c
>  create mode 100644 arch/mips/cpu/mips64/start.S
>  create mode 100644 arch/mips/cpu/mips64/time.c
>
> diff --git a/arch/mips/cpu/mips64/Makefile b/arch/mips/cpu/mips64/Makefile
> new file mode 100644
> index 000..335fe88
> --- /dev/null
> +++ b/arch/mips/cpu/mips64/Makefile
> @@ -0,0 +1,47 @@
> +#
> +# (C) Copyright 2003-2006
> +# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> +# MA 02111-1307 USA
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB= $(obj)lib$(CPU).o
> +
> +START  = start.o
> +COBJS-y= cpu.o interrupts.o time.o
> +
> +SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
> +OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
> +START  := $(addprefix $(obj),$(START))
> +
> +all:   $(obj).depend $(START) $(LIB)
> +
> +$(LIB):$(OBJS)
> +   $(call cmd_link_o_target, $(OBJS))
> +
> +#
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#
> diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
> new file mode 100644
> index 000..26f79e6
> --- /dev/null
> +++ b/arch/mips/cpu/mips64/config.mk
> @@ -0,0 +1,39 @@
> +#
> +# (C) Copyright 2003
> +# Wolfgang Denk, DENX Software Engineering, 
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> +# MA 02111-1307 USA
> +#
> +
> +#
> +# Default optimization level for MIPS64
> +#
> +# Note: Toolchains with binutils prior to v2.16
> +# are no longer supported by U-Boot MIPS tree!
> +#
> +MIPSFLAGS = -march=mips64
> +
> +ENDIANNESS = -EL
> +
> +MIPSFLAGS += $(ENDIANNESS)

with current master branch in git://git.denx.de/u-boot-mips.git you can drop the
endianess flags which are now handled in arch/mips/config.mk

> +
> +PLATFORM_CPPFLAGS += $(MIPSFLAGS)
> +PLATFORM_CPPFLAGS += -mabi=64 -DCONFIG_64BIT
> +PLATFORM_LDFLAGS  += -m elf64ltsmip
> +
> diff --git a/arch/mips/cpu/mips64/cpu.c b/arch/mips/cpu/mips64/cpu.c
> new file mode 100644
> index 000..348ccfe
> --- /dev/null
> +++ b/arch/mips/cpu/mips64/cpu.c
> @@ -0,0 +1,124 @@
> +/*
> + * (C) Copyright 2003
> + * Wolfgang Denk, DENX Software Engineering, 
> + * Zhi-zhou Zhang 
> + *
> + * 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 Pub

Re: [U-Boot] [Patch V3 0/4] add mips64 cpu support

2012-08-23 Thread Daniel Schwierzeck
2012/8/20 Zhizhou Zhang :
> This patch add mips64 cpu support.
> Changes in V3:
>   - merge related files into one patch, no longer one file one patch.
>   - add detailed commit message.
>   - remove standalone example. it's too complicate.
>
> Zhizhou Zhang (4):
>   [MIPS] Add support for MIPS64 cpus
>   [MIPS] add mips64 support in mips head files
>   [MIPS] Add qemu-mips building configs
>   [MIPS] Disable standalone while building MIPS64
>

looks better now, but there are still some issues:
- please replace [MIPS] by MIPS:
- always check each patch with checkpatch.pl in tools directory anf
fix the warnings

Please rework and base your patches on
git://git.denx.de/u-boot-mips.git. I have prepared
some patches which rework the handling of endianess flags and
CONFIG_STANDALONE_LOAD_ADDR.

-- 
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/3] mxs: Rename 'mx28_dram_init' to 'mxs_dram_init'

2012-08-23 Thread Otavio Salvador
Ping?

On Sun, Aug 19, 2012 at 12:07 PM, Marek Vasut  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 
>
>> The following boards has been changed:
>>
>>  * apx4devkit
>>  * m28evk
>>  * mx28evk
>>  * sc_sps_1
>>
>> Signed-off-by: Otavio Salvador 
>> ---
>>  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



-- 
Otavio Salvador O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854  http://projetos.ossystems.com.br
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] MIPS: add support for qemu for little endian MIPS32 CPUs

2012-08-23 Thread daniel . schwierzeck
From: Daniel Schwierzeck 

Tested with 'qemu-system-mipsel -machine mips -bios u-boot.bin -nographic'

Signed-off-by: Daniel Schwierzeck 
---
 boards.cfg  | 3 ++-
 include/configs/qemu-mips.h | 7 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/boards.cfg b/boards.cfg
index fdb84ad..6b54941 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -378,7 +378,8 @@ M5485FFE m68kmcf547x_8x  m548xevb   
 freescale  -
 M5485GFEm68kmcf547x_8x  m548xevb
freescale  -   
M5485EVB:SYS_BUSCLK=1,SYS_BOOTSZ=4,SYS_DRAMSZ=64
 M5485HFEm68kmcf547x_8x  m548xevb
freescale  -   
M5485EVB:SYS_BUSCLK=1,SYS_BOOTSZ=2,SYS_DRAMSZ=64,SYS_NOR1SZ=16,SYS_VIDEO
 microblaze-generic   microblaze  microblaze  microblaze-generic  xilinx
-qemu_mipsmipsmips32  qemu-mips   - 
 -   qemu-mips
+qemu_mipsmipsmips32  qemu-mips   - 
 -   qemu-mips:SYS_BIG_ENDIAN
+qemu_mipsel  mipsmips32  qemu-mips   - 
 -   qemu-mips:SYS_LITTLE_ENDIAN
 vct_platinum mipsmips32  vct 
micronas   -   vct:VCT_PLATINUM
 vct_platinumavc  mipsmips32  vct 
micronas   -   vct:VCT_PLATINUMAVC
 vct_platinumavc_onenand  mipsmips32  vct 
micronas   -   vct:VCT_PLATINUMAVC,VCT_ONENAND
diff --git a/include/configs/qemu-mips.h b/include/configs/qemu-mips.h
index 306c173..b8b9705 100644
--- a/include/configs/qemu-mips.h
+++ b/include/configs/qemu-mips.h
@@ -100,7 +100,12 @@
  */
 #define CONFIG_SYS_LONGHELP/* undef to save memory 
*/
 
-#define CONFIG_SYS_PROMPT  "qemu-mips # "  /* Monitor Command 
Prompt */
+/* Monitor Command Prompt */
+#if defined(CONFIG_SYS_LITTLE_ENDIAN)
+#define CONFIG_SYS_PROMPT  "qemu-mipsel # "
+#else
+#define CONFIG_SYS_PROMPT  "qemu-mips # "
+#endif
 
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_CMDLINE_EDITING
-- 
1.7.11.3

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


[U-Boot] [PATCH 2/3] MIPS: move CONFIG_STANDALONE_LOAD_ADDR to CPU config makefiles

2012-08-23 Thread daniel . schwierzeck
From: Daniel Schwierzeck 

Prepare for upcoming MIPS64 CPU support.

Signed-off-by: Daniel Schwierzeck 
---
 arch/mips/config.mk| 2 --
 arch/mips/cpu/mips32/config.mk | 2 ++
 arch/mips/cpu/xburst/config.mk | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index b680256..de9140b 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -39,8 +39,6 @@ endif
 # Default to EB if no endianess is configured
 ENDIANNESS ?= -EB
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x8020 -T mips.lds
-
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
 #
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a0e4de5..481e984 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -30,3 +30,5 @@
 MIPSFLAGS := -march=mips32r2
 
 PLATFORM_CPPFLAGS += $(MIPSFLAGS)
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x8020 -T mips.lds
diff --git a/arch/mips/cpu/xburst/config.mk b/arch/mips/cpu/xburst/config.mk
index 18d49ab..1536746 100644
--- a/arch/mips/cpu/xburst/config.mk
+++ b/arch/mips/cpu/xburst/config.mk
@@ -21,3 +21,5 @@
 #
 
 PLATFORM_CPPFLAGS += -march=mips32
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x8020 -T mips.lds
-- 
1.7.11.3

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


[U-Boot] [PATCH 1/3] MIPS: factor out endianess flag handling to arch config.mk

2012-08-23 Thread daniel . schwierzeck
From: Daniel Schwierzeck 

This is CPU independent and should be configured architecture-wide.

Signed-off-by: Daniel Schwierzeck 
---
 arch/mips/config.mk| 20 ++--
 arch/mips/cpu/mips32/config.mk | 19 +--
 arch/mips/cpu/xburst/config.mk |  3 +--
 include/configs/qi_lb60.h  |  1 +
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 6ab8acd..b680256 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -23,6 +23,22 @@
 
 CROSS_COMPILE ?= mips_4KC-
 
+# Handle special prefix in ELDK 4.0 toolchain
+ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
+ENDIANNESS := -EL
+endif
+
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+ENDIANNESS := -EL
+endif
+
+ifdef CONFIG_SYS_BIG_ENDIAN
+ENDIANNESS := -EB
+endif
+
+# Default to EB if no endianess is configured
+ENDIANNESS ?= -EB
+
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x8020 -T mips.lds
 
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
@@ -47,8 +63,8 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
 # to RAM. $28 is always used as gp.
 #
-PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic
+PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic $(ENDIANNESS)
 PLATFORM_CPPFLAGS  += -msoft-float
-PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib
+PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib $(ENDIANNESS)
 PLATFORM_RELFLAGS  += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL  += --gc-sections
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a1cd590..a0e4de5 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -29,21 +29,4 @@
 #
 MIPSFLAGS := -march=mips32r2
 
-# Handle special prefix in ELDK 4.0 toolchain
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS := -EL
-endif
-
-ifdef CONFIG_SYS_LITTLE_ENDIAN
-ENDIANNESS := -EL
-endif
-
-ifdef CONFIG_SYS_BIG_ENDIAN
-ENDIANNESS := -EB
-endif
-
-# Default to EB if no endianess is configured
-ENDIANNESS ?= -EB
-
-PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANNESS)
-PLATFORM_LDFLAGS += $(ENDIANNESS)
+PLATFORM_CPPFLAGS += $(MIPSFLAGS)
diff --git a/arch/mips/cpu/xburst/config.mk b/arch/mips/cpu/xburst/config.mk
index bce0c1b..18d49ab 100644
--- a/arch/mips/cpu/xburst/config.mk
+++ b/arch/mips/cpu/xburst/config.mk
@@ -20,5 +20,4 @@
 # MA 02111-1307 USA
 #
 
-PLATFORM_CPPFLAGS += -march=mips32 -EL
-PLATFORM_LDFLAGS += -EL
+PLATFORM_CPPFLAGS += -march=mips32
diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
index a3fc465..4bb5bbc 100644
--- a/include/configs/qi_lb60.h
+++ b/include/configs/qi_lb60.h
@@ -11,6 +11,7 @@
 #define __CONFIG_QI_LB60_H
 
 #define CONFIG_MIPS32  /* MIPS32 CPU core */
+#define CONFIG_SYS_LITTLE_ENDIAN
 #define CONFIG_JZSOC   /* Jz SoC */
 #define CONFIG_JZ4740  /* Jz4740 SoC */
 #define CONFIG_NAND_JZ4740
-- 
1.7.11.3

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


[U-Boot] [PATCH 0/3] MIPS: refactoring for extended Qemu support

2012-08-23 Thread daniel . schwierzeck
From: Daniel Schwierzeck 

Refactor handling of endianess flag and CONFIG_STANDALONE_LOAD_ADDR.
Introduce qemu_mipsel support.

Daniel Schwierzeck (3):
  MIPS: factor out endianess flag handling to arch config.mk
  MIPS: move CONFIG_STANDALONE_LOAD_ADDR to CPU config makefiles
  MIPS: add support for qemu for little endian MIPS32 CPUs

 arch/mips/config.mk| 20 +---
 arch/mips/cpu/mips32/config.mk | 19 ++-
 arch/mips/cpu/xburst/config.mk |  5 +++--
 boards.cfg |  3 ++-
 include/configs/qemu-mips.h|  7 ++-
 include/configs/qi_lb60.h  |  1 +
 6 files changed, 31 insertions(+), 24 deletions(-)

-- 
1.7.11.3

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


Re: [U-Boot] [PATCH 3/9] disk/part: introduce get_device_and_partition

2012-08-23 Thread Stephen Warren
On 08/23/2012 03:31 PM, Rob Herring wrote:
> From: Rob Herring 
> 
> All block device related commands (scsiboot, fatload, ext2ls, etc.) have
> simliar duplicated device and partition parsing and selection code. This
> adds a common function to replace various implementations.
> 
> The new function has some enhancements over current versions. If no device
> or partition is specified on the command line, the bootdevice env variable
> will be used (scsiboot does this). If the partition is not specified and
> the device has partitions, then the first bootable partition will be used.
> If a bootable partition is not found, the first valid partition is used.
> The ret value is not needed since part will be zero when no partition is
> found.

Two thoughts on this patch:

First, if I write "mmc 0" right now, command will always attempt to
access precisely partion 1, whereas after this patch, they will search
for the first bootable, or valid, partition. This is a change in
behavior. It's a pretty reasonable change, but I wonder if it might
cause problems somewhere.

Instead, perhaps this new feature should be explicitly requested,
supporting the following device/partition specifications:

# existing:
dev 0:0# whole device
dev 0:n# n >= 1: explicit partition
dev 0  # partition 1
# new:
dev 0:valid# first valid partition
dev 0:bootable # first bootable partition
dev 0:default  # first bootable partition if there is one,
   # else first valid

That would allow scripts to be very explicit about whether they wanted
this new functionality.

Second, if I run a slew of ext2load commands:

ext2load mmc 0:bootable ${scriptaddr} boot.scr
source ${scriptaddr}
# script does:
ext2load mmc 0:bootable ${kernel_addr} zImage
ext2load mmc 0:bootable ${initrd_addr} initrd.bin
ext2load mmc 0:bootable ${fdt_addr} foo.dtb

Then there are two disadvantages:

1) I believe the partition table is read and decoded and search for
every one of those ext2load commands. Slightly inefficient.

2) There's no permanent record of the partition number, so this couldn't
be e.g. used to construct a kernel command-line etc.

Instead, I wonder if get_device_and_partition() should just support the
existing 3 device specification options, and we introduce a new command
to determine which partition to boot from, e.g.:

# writes result to "bootpart" variable
# or get-default or get-first-valid
part get-first-bootable mmc 0 bootpart

ext2load mmc 0:${bootpart} ${scriptaddr} boot.scr
source ${scriptaddr}
# script does:
ext2load mmc 0:${bootpart} ${kernel_addr} zImage
ext2load mmc 0:${bootpart} ${initrd_addr} initrd.bin
ext2load mmc 0:${bootpart} ${fdt_addr} foo.dtb

That solves those issues. Does anyone have any comment on the two
approaches?

(although perhaps e.g. ext2load always re-reads the partition table
anyway, so perhaps that advantage is moot?)

Aside from that, this series looks conceptually reasonable at a quick
glance. I'd be happy to provide an equivalent to patch 2 for GPT/EFI
partition tables.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2] SPL: do not use fix value for u-boot size

2012-08-23 Thread Tom Rini
On 08/23/2012 03:46 AM, Stefano Babic wrote:
> If an u-boot image is not found, SPL thinks to load a bare
> u-boot.bin image with a maximum size of 200KB.
> Use CONFIG_SYS_MONITOR_LEN instead.
> 
> Signed-off-by: Stefano Babic 
> CC: Tom Rini 
> CC: Stefan Roese 

Looks good, I'll take this for my v4.

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


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

2012-08-23 Thread Tom Rini
On 08/23/2012 01:12 AM, Stefan Roese wrote:
> This patchset ports the SPL framework to powerpc. Its based on the
> SPL generalization lately done by Tom Rini. The patches can be applied
> on top of his 3rd version located here:
> 
> http://github.com/trini/u-boot WIP/spl-improvements
> 
> Additionally, a new MPC5200 board port is included, the a3m071 board
> port. This board port uses this SPL framework mainly to speed up
> booting into the OS (Linux of course). Detection of Linux vs. U-Boot
> booting is done here by checking the environment variable "boot_os".
> If "boot_os" is set to "yes", then the OS (Linux) is booted. Otherwise
> the "real" U-Boot is booted. For this env checking in the SPL, a small
> restructuring of the env code has been done.
> 
> Comments welcome!

My first comment is, yay!  In general, things look good, and I've just
got a few questions I've replied to the respective patch with.

-- 
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-23 Thread Tom Rini
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?

-- 
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-23 Thread Tom Rini
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!

-- 
Tom

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


[U-Boot] [PATCH 9/9] cmd_reiser: use common get_device_and_partition function

2012-08-23 Thread Rob Herring
From: Rob Herring 

Convert reiserload and reiserls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring 
---
 common/cmd_reiser.c |   81 +++
 fs/reiserfs/dev.c   |   29 +++---
 include/reiserfs.h  |2 +-
 3 files changed, 28 insertions(+), 84 deletions(-)

diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c
index fbb9484..2865014 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -50,43 +50,27 @@
 int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
char *filename = "/";
-   int dev=0;
-   int part=1;
-   char *ep;
+   int dev, part;
block_dev_desc_t *dev_desc=NULL;
-   int part_length;
+   disk_partition_t info;
 
if (argc < 3)
return CMD_RET_USAGE;
 
-   dev = (int)simple_strtoul (argv[2], &ep, 16);
-   dev_desc = get_dev(argv[1],dev);
-
-   if (dev_desc == NULL) {
-   printf ("\n** Block device %s %d not supported\n", argv[1], 
dev);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
-
-   if (*ep) {
-   if (*ep != ':') {
-   puts ("\n** Invalid boot device, use `dev[:part]' 
**\n");
-   return 1;
-   }
-   part = (int)simple_strtoul(++ep, NULL, 16);
-   }
 
if (argc == 4) {
filename = argv[3];
}
 
+   dev = dev_desc->dev;
PRINTF("Using device %s %d:%d, directory: %s\n", argv[1], dev, part, 
filename);
 
-   if ((part_length = reiserfs_set_blk_dev(dev_desc, part)) == 0) {
-   printf ("** Bad partition - %s %d:%d **\n",  argv[1], dev, 
part);
-   return 1;
-   }
+   reiserfs_set_blk_dev(dev_desc, &info);
 
-   if (!reiserfs_mount(part_length)) {
+   if (!reiserfs_mount(info.size)) {
printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n",  
argv[1], dev, part);
return 1;
}
@@ -112,9 +96,8 @@ U_BOOT_CMD(
 int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
char *filename = NULL;
-   char *ep;
-   int dev, part = 0;
-   ulong addr = 0, part_length, filelen;
+   int dev, part;
+   ulong addr = 0, filelen;
disk_partition_t info;
block_dev_desc_t *dev_desc = NULL;
char buf [12];
@@ -157,49 +140,19 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
return 1;
}
 
-   dev = (int)simple_strtoul (argv[2], &ep, 16);
-   dev_desc = get_dev(argv[1],dev);
-   if (dev_desc==NULL) {
-   printf ("\n** Block device %s %d not supported\n", argv[1], 
dev);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
-   if (*ep) {
-   if (*ep != ':') {
-   puts ("\n** Invalid boot device, use `dev[:part]' 
**\n");
-   return 1;
-   }
-   part = (int)simple_strtoul(++ep, NULL, 16);
-   }
 
-   PRINTF("Using device %s%d, partition %d\n", argv[1], dev, part);
+   dev = dev_desc->dev;
 
-   if (part != 0) {
-   if (get_partition_info (dev_desc, part, &info)) {
-   printf ("** Bad partition %d **\n", part);
-   return 1;
-   }
+   printf("Loading file \"%s\" from %s device %d%c%c\n",
+   filename, argv[1], dev,
+   part ? ':' : ' ', part ? part + '0' : ' ');
 
-   if (strncmp((char *)info.type, BOOT_PART_TYPE, 
sizeof(info.type)) != 0) {
-   printf ("\n** Invalid partition type \"%.32s\""
-   " (expect \"" BOOT_PART_TYPE "\")\n",
-   info.type);
-   return 1;
-   }
-   PRINTF ("\nLoading from block device %s device %d, partition 
%d: "
-   "Name: %.32s  Type: %.32s  File:%s\n",
-   argv[1], dev, part, info.name, info.type, filename);
-   } else {
-   PRINTF ("\nLoading from block device %s device %d, File:%s\n",
-   argv[1], dev, filename);
-   }
-
-
-   if ((part_length = reiserfs_set_blk_dev(dev_desc, part)) == 0) {
-   printf ("** Bad partition - %s %d:%d **\n",  argv[1], dev, 
part);
-   return 1;
-   }
+   reiserfs_set_blk_dev(dev_desc, &info);
 
-   if (!reiserfs_mount(part_length)) {
+   if (!reiserfs_mount(info.size)) {
printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n",  
argv[1], dev, part);
return 1;
  

[U-Boot] [PATCH 8/9] cmd_zfs: use common get_device_and_partition function

2012-08-23 Thread Rob Herring
From: Rob Herring 

Convert zfsload and zfsls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring 
---
 common/cmd_zfs.c |   88 +++---
 fs/zfs/dev.c |   35 +++-
 include/zfs_common.h |5 +--
 3 files changed, 31 insertions(+), 97 deletions(-)

diff --git a/common/cmd_zfs.c b/common/cmd_zfs.c
index a6ea2c0..27f8856 100644
--- a/common/cmd_zfs.c
+++ b/common/cmd_zfs.c
@@ -49,12 +49,11 @@
 static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
char *filename = NULL;
-   char *ep;
int dev;
-   unsigned long part = 1;
+   int part;
ulong addr = 0;
-   ulong part_length;
disk_partition_t info;
+   block_dev_desc_t *dev_desc;
char buf[12];
unsigned long count;
const char *addr_str;
@@ -95,48 +94,17 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int 
argc, char *argv[])
return 1;
}
 
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   zfs_dev_desc = get_dev(argv[1], dev);
-   if (zfs_dev_desc == NULL) {
-   printf("** Block device %s %d not supported\n", argv[1], dev);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
 
-   if (*ep) {
-   if (*ep != ':') {
-   puts("** Invalid boot device, use `dev[:part]' **\n");
-   return 1;
-   }
-   part = simple_strtoul(++ep, NULL, 16);
-   }
+   dev = dev_desc->dev;
+   printf("Loading file \"%s\" from %s device %d%c%c\n",
+   filename, argv[1], dev,
+   part ? ':' : ' ', part ? part + '0' : ' ');
 
-   if (part != 0) {
-   if (get_partition_info(zfs_dev_desc, part, &info)) {
-   printf("** Bad partition %lu **\n", part);
-   return 1;
-   }
-
-   if (strncmp((char *)info.type, BOOT_PART_TYPE,
-   strlen(BOOT_PART_TYPE)) != 0) {
-   printf("** Invalid partition type \"%s\" (expect \"" 
BOOT_PART_TYPE "\")\n",
-  info.type);
-   return 1;
-   }
-   printf("Loading file \"%s\" "
-  "from %s device %d:%lu %s\n",
-  filename, argv[1], dev, part, info.name);
-   } else {
-   printf("Loading file \"%s\" from %s device %d\n",
-  filename, argv[1], dev);
-   }
-
-   part_length = zfs_set_blk_dev(zfs_dev_desc, part);
-   if (part_length == 0) {
-   printf("**Bad partition - %s %d:%lu **\n", argv[1], dev, part);
-   return 1;
-   }
-
-   vdev.part_length = part_length;
+   zfs_set_blk_dev(dev_desc, &info);
+   vdev.part_length = info.size;
 
memset(&zfile, 0, sizeof(zfile));
zfile.device = &vdev;
@@ -149,7 +117,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int 
argc, char *argv[])
zfile.size = (uint64_t)count;
 
if (zfs_read(&zfile, (char *)addr, zfile.size) != zfile.size) {
-   printf("** Unable to read \"%s\" from %s %d:%lu **\n",
+   printf("** Unable to read \"%s\" from %s %d:%d **\n",
   filename, argv[1], dev, part);
zfs_close(&zfile);
return 1;
@@ -181,41 +149,23 @@ int zfs_print(const char *entry, const struct 
zfs_dirhook_info *data)
 static int do_zfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
const char *filename = "/";
-   int dev;
-   unsigned long part = 1;
-   char *ep;
-   int part_length;
+   int part;
+   block_dev_desc_t *dev_desc;
+   disk_partition_t info;
struct device_s vdev;
 
-   if (argc < 3)
+   if (argc < 2)
return cmd_usage(cmdtp);
 
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   zfs_dev_desc = get_dev(argv[1], dev);
-
-   if (zfs_dev_desc == NULL) {
-   printf("\n** Block device %s %d not supported\n", argv[1], dev);
-   return 1;
-   }
-
-   if (*ep) {
-   if (*ep != ':') {
-   puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   return 1;
-   }
-   part = simple_strtoul(++ep, NULL, 16);
-   }
-
if (argc == 4)
filename = argv[3];
 
-   part_length = zfs_set_blk_dev(zfs_dev_desc, part);
-   if (part_length == 0) {
-   printf("** Bad partition - %s %d:%lu **\n", argv[1], dev, part);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (p

[U-Boot] [PATCH 7/9] cmd_disk: use common get_device_and_partition function

2012-08-23 Thread Rob Herring
From: Rob Herring 

Signed-off-by: Rob Herring 
---
 common/cmd_disk.c |   77 +
 1 file changed, 19 insertions(+), 58 deletions(-)

diff --git a/common/cmd_disk.c b/common/cmd_disk.c
index 38420dc..e6676b0 100644
--- a/common/cmd_disk.c
+++ b/common/cmd_disk.c
@@ -1,13 +1,15 @@
 #include 
 #include 
+#include 
 
+#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_SCSI) || \
+   defined(CONFIG_USB_STORAGE)
 int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, 
char *const argv[])
 {
-   char *boot_device = NULL;
-   char *ep;
-   int dev, part = 0;
-   ulong addr, cnt;
+   int dev, part;
+   ulong addr = CONFIG_SYS_LOAD_ADDR;
+   ulong cnt;
disk_partition_t info;
image_header_t *hdr;
block_dev_desc_t *dev_desc;
@@ -17,72 +19,30 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int 
argc,
 #endif
 
bootstage_mark(BOOTSTAGE_ID_IDE_START);
-   switch (argc) {
-   case 1:
-   addr = CONFIG_SYS_LOAD_ADDR;
-   boot_device = getenv("bootdevice");
-   break;
-   case 2:
-   addr = simple_strtoul(argv[1], NULL, 16);
-   boot_device = getenv("bootdevice");
-   break;
-   case 3:
-   addr = simple_strtoul(argv[1], NULL, 16);
-   boot_device = argv[2];
-   break;
-   default:
+   if (argc > 3) {
bootstage_error(BOOTSTAGE_ID_IDE_ADDR);
return CMD_RET_USAGE;
}
bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
 
-   if (!boot_device) {
-   puts("\n** No boot device **\n");
-   bootstage_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
-   return 1;
-   }
-   bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
+   if (argc > 1)
+   addr = simple_strtoul(argv[1], NULL, 16);
 
-   dev = simple_strtoul(boot_device, &ep, 16);
+   bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
-   dev_desc = get_dev(intf, dev);
-   if (dev_desc->type == DEV_TYPE_UNKNOWN) {
-   printf("\n** Device %d not available\n", dev);
+   part = get_device_and_partition(intf, (argc == 3) ? argv[2] : NULL,
+   &dev_desc, &info);
+   if (part < 0) {
bootstage_error(BOOTSTAGE_ID_IDE_TYPE);
return 1;
}
-   bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
-
-   if (*ep) {
-   if (*ep != ':') {
-   puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   bootstage_error(BOOTSTAGE_ID_IDE_PART);
-   return 1;
-   }
-   part = simple_strtoul(++ep, NULL, 16);
-   }
-   bootstage_mark(BOOTSTAGE_ID_IDE_PART);
 
-   if (get_partition_info(dev_desc, part, &info)) {
-   bootstage_error(BOOTSTAGE_ID_IDE_PART_INFO);
-   return 1;
-   }
-   bootstage_mark(BOOTSTAGE_ID_IDE_PART_INFO);
-
-   if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)
-   &&
-   (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
-  ) {
-   printf("\n** Invalid partition type \"%.32s\"" " (expect \""
-   BOOT_PART_TYPE "\")\n",
-   info.type);
-   bootstage_error(BOOTSTAGE_ID_IDE_PART_TYPE);
-   return 1;
-   }
-   bootstage_mark(BOOTSTAGE_ID_IDE_PART_TYPE);
+   dev = dev_desc->dev;
+   bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
 
-   printf("\nLoading from disk device %d, partition %d: "
-  "Name: %.32s  Type: %.32s\n", dev, part, info.name, info.type);
+   printf("\nLoading from %s device %d, partition %d: "
+  "Name: %.32s  Type: %.32s\n", intf, dev, part, info.name,
+  info.type);
 
debug("First Block: %ld,  # of blocks: %ld, Block Size: %ld\n",
  info.start, info.size, info.blksz);
@@ -158,4 +118,5 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int 
argc,
 
return bootm_maybe_autostart(cmdtp, argv[0]);
 }
+#endif
 
-- 
1.7.9.5

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


[U-Boot] [PATCH 6/9] cmd_fat: use common get_device_and_partition function

2012-08-23 Thread Rob Herring
From: Rob Herring 

Convert fatload, fatls, and fatinfo to use common device and partition
parsing function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring 
---
 common/cmd_fat.c |  100 +++---
 1 file changed, 34 insertions(+), 66 deletions(-)

diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 559a16d..90412d6 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -40,29 +40,20 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
unsigned long count;
char buf [12];
block_dev_desc_t *dev_desc=NULL;
-   int dev=0;
-   int part=1;
-   char *ep;
+   disk_partition_t info;
+   int part, dev;
 
if (argc < 5) {
-   printf( "usage: fatload   "
+   printf("usage: fatload  [] "
"  [bytes]\n");
return 1;
}
 
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   dev_desc = get_dev(argv[1],dev);
-   if (dev_desc == NULL) {
-   puts("\n** Invalid boot device **\n");
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
-   if (*ep) {
-   if (*ep != ':') {
-   puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   return 1;
-   }
-   part = (int)simple_strtoul(++ep, NULL, 16);
-   }
+
+   dev = dev_desc->dev;
if (fat_register_device(dev_desc,part)!=0) {
printf("\n** Unable to use %s %d:%d for fatload **\n",
argv[1], dev, part);
@@ -93,7 +84,7 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 U_BOOT_CMD(
fatload,6,  0,  do_fat_fsload,
"load binary file from a dos filesystem",
-   " [bytes]\n"
+   " [][bytes]\n"
"- load binary file 'filename' from 'dev' on 'interface'\n"
"  to address 'addr' from dos filesystem"
 );
@@ -101,29 +92,20 @@ U_BOOT_CMD(
 int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
char *filename = "/";
-   int ret;
-   int dev=0;
-   int part=1;
-   char *ep;
+   int ret, dev, part;
block_dev_desc_t *dev_desc=NULL;
+   disk_partition_t info;
 
-   if (argc < 3) {
-   printf("usage: fatls   [directory]\n");
+   if (argc < 2) {
+   printf("usage: fatls  [] [directory]\n");
return 0;
}
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   dev_desc = get_dev(argv[1],dev);
-   if (dev_desc == NULL) {
-   puts("\n** Invalid boot device **\n");
+
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
-   if (*ep) {
-   if (*ep != ':') {
-   puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   return 1;
-   }
-   part = (int)simple_strtoul(++ep, NULL, 16);
-   }
+
+   dev = dev_desc->dev;
if (fat_register_device(dev_desc,part)!=0) {
printf("\n** Unable to use %s %d:%d for fatls **\n",
argv[1], dev, part);
@@ -142,34 +124,26 @@ int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 U_BOOT_CMD(
fatls,  4,  1,  do_fat_ls,
"list files in a directory (default /)",
-   "  [directory]\n"
+   " [] [directory]\n"
"- list files from 'dev' on 'interface' in a 'directory'"
 );
 
 int do_fat_fsinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   int dev=0;
-   int part=1;
-   char *ep;
-   block_dev_desc_t *dev_desc=NULL;
+   int dev, part;
+   block_dev_desc_t *dev_desc;
+   disk_partition_t info;
 
if (argc < 2) {
-   printf("usage: fatinfo  \n");
+   printf("usage: fatinfo  []\n");
return 0;
}
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   dev_desc = get_dev(argv[1],dev);
-   if (dev_desc == NULL) {
-   puts("\n** Invalid boot device **\n");
+
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
-   if (*ep) {
-   if (*ep != ':') {
-   puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   return 1;
-   }
-   part = (int)simple_strtoul(++ep, NULL, 16);
-   }
+
+   dev = dev_desc->dev;
if (fat_register_device(dev_desc,part)!=0) {
printf("\n** Unable to use %s %d:%d for fatinfo **\n",
argv[1], dev, part);
@@ -181,7 +155

[U-Boot] [PATCH 5/9] cmd_extX: use common get_device_and_partition function

2012-08-23 Thread Rob Herring
From: Rob Herring 

Convert ext2/4 load, ls, and write functions to use common device and
partition parsing function. With the common function "dev:part" can come
from the environment and a '-' can be used in that case.

Signed-off-by: Rob Herring 
---
 common/cmd_ext4.c   |  102 ---
 common/cmd_ext_common.c |   95 +++
 fs/ext4/dev.c   |   32 ++-
 fs/ext4/ext4_common.h   |1 -
 fs/ext4/ext4fs.c|1 -
 include/ext4fs.h|3 +-
 include/ext_common.h|2 +
 7 files changed, 46 insertions(+), 190 deletions(-)

diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index e92c02f..48f9ba3 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -56,21 +56,6 @@
 #include 
 #endif
 
-#if !defined(CONFIG_DOS_PARTITION) && !defined(CONFIG_EFI_PARTITION)
-#error DOS or EFI partition support must be selected
-#endif
-
-uint64_t total_sector;
-uint64_t part_offset;
-#if defined(CONFIG_CMD_EXT4_WRITE)
-static uint64_t part_size;
-static uint16_t cur_part = 1;
-#endif
-
-#define DOS_PART_MAGIC_OFFSET  0x1fe
-#define DOS_FS_TYPE_OFFSET 0x36
-#define DOS_FS32_TYPE_OFFSET   0x52
-
 int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
 {
@@ -89,77 +74,24 @@ int do_ext4_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 }
 
 #if defined(CONFIG_CMD_EXT4_WRITE)
-static int ext4_register_device(block_dev_desc_t *dev_desc, int part_no)
-{
-   unsigned char buffer[SECTOR_SIZE];
-   disk_partition_t info;
-
-   if (!dev_desc->block_read)
-   return -1;
-
-   /* check if we have a MBR (on floppies we have only a PBR) */
-   if (dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) {
-   printf("** Can't read from device %d **\n", dev_desc->dev);
-   return -1;
-   }
-   if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
-   buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
-   /* no signature found */
-   return -1;
-   }
-
-   /* First we assume there is a MBR */
-   if (!get_partition_info(dev_desc, part_no, &info)) {
-   part_offset = info.start;
-   cur_part = part_no;
-   part_size = info.size;
-   } else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],
-   "FAT", 3) == 0) || (strncmp((char *)&buffer
-   [DOS_FS32_TYPE_OFFSET],
-   "FAT32", 5) == 0)) {
-   /* ok, we assume we are on a PBR only */
-   cur_part = 1;
-   part_offset = 0;
-   } else {
-   printf("** Partition %d not valid on device %d **\n",
-  part_no, dev_desc->dev);
-   return -1;
-   }
-
-   return 0;
-}
-
 int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
 {
const char *filename = "/";
-   int part_length;
-   unsigned long part = 1;
-   int dev;
-   char *ep;
+   int dev, part;
unsigned long ram_address;
unsigned long file_size;
disk_partition_t info;
-   struct ext_filesystem *fs;
+   block_dev_desc_t *dev_desc;
 
if (argc < 6)
return cmd_usage(cmdtp);
 
-   dev = (int)simple_strtoul(argv[2], &ep, 16);
-   ext4_dev_desc = get_dev(argv[1], dev);
-   if (ext4_dev_desc == NULL) {
-   printf("Block device %s %d not supported\n", argv[1], dev);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   if (part < 0)
return 1;
-   }
 
-   fs = get_fs();
-   if (*ep) {
-   if (*ep != ':') {
-   puts("Invalid boot device, use `dev[:part]'\n");
-   goto fail;
-   }
-   part = simple_strtoul(++ep, NULL, 16);
-   }
+   dev = dev_desc->dev;
 
/* get the filename */
filename = argv[3];
@@ -171,30 +103,10 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
file_size = simple_strtoul(argv[5], NULL, 10);
 
/* set the device as block device */
-   part_length = ext4fs_set_blk_dev(ext4_dev_desc, part);
-   if (part_length == 0) {
-   printf("Bad partition - %s %d:%lu\n", argv[1], dev, part);
-   goto fail;
-   }
-
-   /* register the device and partition */
-   if (ext4_register_device(ext4_dev_desc, part) != 0) {
-   printf("Unable to use %s %d:%lu for fattable\n",
-  argv[1], dev, part);
-   goto fail;
-   }
-
-   /* get the partition information */
-   if (!get_partition_info(ext4_dev_desc, part, &info)) {
-   total_sector = 

[U-Boot] [PATCH 4/9] ext4: remove init_fs/deinit_fs

2012-08-23 Thread Rob Herring
From: Rob Herring 

There's no real need to expose this and it can be removed by using a static
allocation.

Signed-off-by: Rob Herring 
---
 common/cmd_ext4.c   |   10 +++---
 common/cmd_ext_common.c |   19 +++
 fs/ext4/ext4fs.c|   36 ++--
 include/ext4fs.h|2 --
 include/zfs_common.h|2 --
 5 files changed, 8 insertions(+), 61 deletions(-)

diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index 77094c4..e92c02f 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -151,8 +151,6 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
printf("Block device %s %d not supported\n", argv[1], dev);
return 1;
}
-   if (init_fs(ext4_dev_desc))
-   return 1;
 
fs = get_fs();
if (*ep) {
@@ -173,21 +171,21 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
file_size = simple_strtoul(argv[5], NULL, 10);
 
/* set the device as block device */
-   part_length = ext4fs_set_blk_dev(fs->dev_desc, part);
+   part_length = ext4fs_set_blk_dev(ext4_dev_desc, part);
if (part_length == 0) {
printf("Bad partition - %s %d:%lu\n", argv[1], dev, part);
goto fail;
}
 
/* register the device and partition */
-   if (ext4_register_device(fs->dev_desc, part) != 0) {
+   if (ext4_register_device(ext4_dev_desc, part) != 0) {
printf("Unable to use %s %d:%lu for fattable\n",
   argv[1], dev, part);
goto fail;
}
 
/* get the partition information */
-   if (!get_partition_info(fs->dev_desc, part, &info)) {
+   if (!get_partition_info(ext4_dev_desc, part, &info)) {
total_sector = (info.size * info.blksz) / SECTOR_SIZE;
fs->total_sect = total_sector;
} else {
@@ -207,13 +205,11 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
goto fail;
}
ext4fs_close();
-   deinit_fs(fs->dev_desc);
 
return 0;
 
 fail:
ext4fs_close();
-   deinit_fs(fs->dev_desc);
 
return 1;
 }
diff --git a/common/cmd_ext_common.c b/common/cmd_ext_common.c
index 56ee9a5..8972ccc 100644
--- a/common/cmd_ext_common.c
+++ b/common/cmd_ext_common.c
@@ -75,7 +75,6 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
ulong part_length;
int filelen;
disk_partition_t info;
-   struct ext_filesystem *fs;
char buf[12];
unsigned long count;
const char *addr_str;
@@ -117,10 +116,7 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
printf("** Block device %s %d not supported\n", argv[1], dev);
return 1;
}
-   if (init_fs(ext4_dev_desc))
-   return 1;
 
-   fs = get_fs();
if (*ep) {
if (*ep != ':') {
puts("** Invalid boot device, use `dev[:part]' **\n");
@@ -130,7 +126,7 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
}
 
if (part != 0) {
-   if (get_partition_info(fs->dev_desc, part, &info)) {
+   if (get_partition_info(ext4_dev_desc, part, &info)) {
printf("** Bad partition %lu **\n", part);
goto fail;
}
@@ -149,7 +145,7 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
   filename, argv[1], dev);
}
 
-   part_length = ext4fs_set_blk_dev(fs->dev_desc, part);
+   part_length = ext4fs_set_blk_dev(ext4_dev_desc, part);
if (part_length == 0) {
printf("**Bad partition - %s %d:%lu **\n", argv[1], dev, part);
ext4fs_close();
@@ -180,7 +176,6 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
}
 
ext4fs_close();
-   deinit_fs(fs->dev_desc);
/* Loading ok, update default load address */
load_addr = addr;
 
@@ -190,7 +185,6 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
 
return 0;
 fail:
-   deinit_fs(fs->dev_desc);
return 1;
 }
 
@@ -200,7 +194,6 @@ int do_ext_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
int dev;
unsigned long part = 1;
char *ep;
-   struct ext_filesystem *fs;
int part_length;
if (argc < 3)
return cmd_usage(cmdtp);
@@ -214,10 +207,6 @@ int do_ext_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return 1;
}
 
-   if (init_fs(ext4_dev_desc))
-   return 1;
-
-   fs = get_fs();
if (*ep) {
if (*ep != ':') {
puts("\n** Invalid boot device, use `dev[:part]' **\n");
@@ -229,7 +218,7 @@ int do_ext_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
if (argc == 4)
filename = argv[3];
 
-   part_length 

[U-Boot] [PATCH 3/9] disk/part: introduce get_device_and_partition

2012-08-23 Thread Rob Herring
From: Rob Herring 

All block device related commands (scsiboot, fatload, ext2ls, etc.) have
simliar duplicated device and partition parsing and selection code. This
adds a common function to replace various implementations.

The new function has some enhancements over current versions. If no device
or partition is specified on the command line, the bootdevice env variable
will be used (scsiboot does this). If the partition is not specified and
the device has partitions, then the first bootable partition will be used.
If a bootable partition is not found, the first valid partition is used.
The ret value is not needed since part will be zero when no partition is
found.

Signed-off-by: Rob Herring 
---
 disk/part.c|   90 ++--
 include/part.h |   13 ++--
 2 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 76f3939..1284e1a 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -70,7 +70,7 @@ static const struct block_drvr block_drvr[] = {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-block_dev_desc_t *get_dev(char* ifname, int dev)
+block_dev_desc_t *get_dev(const char *ifname, int dev)
 {
const struct block_drvr *drvr = block_drvr;
block_dev_desc_t* (*reloc_get_dev)(int dev);
@@ -97,7 +97,7 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
return NULL;
 }
 #else
-block_dev_desc_t *get_dev(char* ifname, int dev)
+block_dev_desc_t *get_dev(const char *ifname, int dev)
 {
return NULL;
 }
@@ -288,6 +288,7 @@ void init_part (block_dev_desc_t * dev_desc)
return;
}
 #endif
+   dev_desc->part_type = PART_TYPE_UNKNOWN;
 }
 
 
@@ -433,3 +434,88 @@ void print_part (block_dev_desc_t * dev_desc)
 #endif
 
 #endif
+
+int get_device_and_partition(const char *ifname, const char *dev_str,
+block_dev_desc_t **dev_desc,
+disk_partition_t *info)
+{
+   int ret;
+   char *ep;
+   int dev;
+   block_dev_desc_t *desc;
+   int p;
+   int part = 0;
+   char *part_str;
+   disk_partition_t *best_part = NULL;
+
+   if (dev_str)
+   dev = simple_strtoul(dev_str, &ep, 16);
+
+   if (!dev_str || (dev_str == ep)) {
+   dev_str = getenv("bootdevice");
+   if (dev_str)
+   dev = simple_strtoul(dev_str, &ep, 16);
+   if (!dev_str || (dev_str == ep))
+   goto err;
+   }
+
+   desc = get_dev(ifname, dev);
+   if (!desc || (desc->type == DEV_TYPE_UNKNOWN))
+   goto err;
+
+   if (desc->part_type == PART_TYPE_UNKNOWN) {
+   /* disk doesn't use partition table */
+   if (!desc->lba) {
+   printf("**Bad disk size - %s %d:0 **\n", ifname, dev);
+   return -1;
+   }
+   info->start = 0;
+   info->size = desc->lba;
+   info->blksz = desc->blksz;
+
+   *dev_desc = desc;
+   return 0;
+   }
+
+   part_str = strchr(dev_str, ':');
+   if (part_str) {
+   part = (int)simple_strtoul(++part_str, NULL, 16);
+   ret = get_partition_info(desc, part, info);
+   } else {
+   /* find the first bootable partition. If none are bootable,
+* fall back to the first valid partition */
+   for (p = 1; p < 16; p++) {
+   ret = get_partition_info(desc, p, info);
+   if (ret)
+   continue;
+
+   if (!best_part || info->bootable) {
+   best_part = info;
+   part = p;
+   }
+
+   if (info->bootable)
+   break;
+   }
+   info = best_part;
+   if (part)
+   ret = 0;
+   }
+   if (ret) {
+   printf("** Invalid partition %d, use `dev[:part]' **\n", part);
+   return -1;
+   }
+   if (strncmp((char *)info->type, BOOT_PART_TYPE, sizeof(info->type)) != 
0) {
+   printf("** Invalid partition type \"%.32s\""
+   " (expect \"" BOOT_PART_TYPE "\")\n",
+   info->type);
+   return -1;
+   }
+
+   *dev_desc = desc;
+   return part;
+
+ err:
+   puts("** Invalid boot device, use `dev[:part]' **\n");
+   return -1;
+}
diff --git a/include/part.h b/include/part.h
index 447f69d..a6d06f3 100644
--- a/include/part.h
+++ b/include/part.h
@@ -98,7 +98,7 @@ typedef struct disk_partition {
 
 /* Misc _get_dev functions */
 #ifdef CONFIG_PARTITIONS
-block_dev_desc_t* get_dev(char* ifname, int dev);
+block_dev_desc_t *get_dev(const char *ifname, int dev);
 block_dev_desc_t* ide_get_dev(int dev);
 block_dev_desc_t* sata_get_dev(int dev);
 block_dev_desc_t* scsi_

[U-Boot] [PATCH 1/9] combine block device load commands into common function

2012-08-23 Thread Rob Herring
From: Rob Herring 

All the raw block load commands duplicate the same code. Starting with
the ide version as it has progress updates convert ide, usb, and scsi boot
commands to all use a common version.

Signed-off-by: Rob Herring 
---
 common/Makefile   |1 +
 common/cmd_disk.c |  161 +
 common/cmd_ide.c  |  151 +
 common/cmd_scsi.c |  123 +---
 common/cmd_usb.c  |  138 +
 include/command.h |4 ++
 6 files changed, 169 insertions(+), 409 deletions(-)
 create mode 100644 common/cmd_disk.c

diff --git a/common/Makefile b/common/Makefile
index 4273484..0fac6d0 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
 COBJS-y += s_record.o
 COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 COBJS-y += xyzModem.o
+COBJS-y += cmd_disk.o
 
 # core command
 COBJS-y += cmd_boot.o
diff --git a/common/cmd_disk.c b/common/cmd_disk.c
new file mode 100644
index 000..38420dc
--- /dev/null
+++ b/common/cmd_disk.c
@@ -0,0 +1,161 @@
+#include 
+#include 
+
+int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, 
+   char *const argv[])
+{
+   char *boot_device = NULL;
+   char *ep;
+   int dev, part = 0;
+   ulong addr, cnt;
+   disk_partition_t info;
+   image_header_t *hdr;
+   block_dev_desc_t *dev_desc;
+
+#if defined(CONFIG_FIT)
+   const void *fit_hdr = NULL;
+#endif
+
+   bootstage_mark(BOOTSTAGE_ID_IDE_START);
+   switch (argc) {
+   case 1:
+   addr = CONFIG_SYS_LOAD_ADDR;
+   boot_device = getenv("bootdevice");
+   break;
+   case 2:
+   addr = simple_strtoul(argv[1], NULL, 16);
+   boot_device = getenv("bootdevice");
+   break;
+   case 3:
+   addr = simple_strtoul(argv[1], NULL, 16);
+   boot_device = argv[2];
+   break;
+   default:
+   bootstage_error(BOOTSTAGE_ID_IDE_ADDR);
+   return CMD_RET_USAGE;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
+
+   if (!boot_device) {
+   puts("\n** No boot device **\n");
+   bootstage_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
+
+   dev = simple_strtoul(boot_device, &ep, 16);
+
+   dev_desc = get_dev(intf, dev);
+   if (dev_desc->type == DEV_TYPE_UNKNOWN) {
+   printf("\n** Device %d not available\n", dev);
+   bootstage_error(BOOTSTAGE_ID_IDE_TYPE);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_TYPE);
+
+   if (*ep) {
+   if (*ep != ':') {
+   puts("\n** Invalid boot device, use `dev[:part]' **\n");
+   bootstage_error(BOOTSTAGE_ID_IDE_PART);
+   return 1;
+   }
+   part = simple_strtoul(++ep, NULL, 16);
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_PART);
+
+   if (get_partition_info(dev_desc, part, &info)) {
+   bootstage_error(BOOTSTAGE_ID_IDE_PART_INFO);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_PART_INFO);
+
+   if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)
+   &&
+   (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
+  ) {
+   printf("\n** Invalid partition type \"%.32s\"" " (expect \""
+   BOOT_PART_TYPE "\")\n",
+   info.type);
+   bootstage_error(BOOTSTAGE_ID_IDE_PART_TYPE);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_PART_TYPE);
+
+   printf("\nLoading from disk device %d, partition %d: "
+  "Name: %.32s  Type: %.32s\n", dev, part, info.name, info.type);
+
+   debug("First Block: %ld,  # of blocks: %ld, Block Size: %ld\n",
+ info.start, info.size, info.blksz);
+
+   if (dev_desc->block_read(dev, info.start, 1, (ulong *) addr) != 1) {
+   printf("** Read error on %d:%d\n", dev, part);
+   bootstage_error(BOOTSTAGE_ID_IDE_PART_READ);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_PART_READ);
+
+   switch (genimg_get_format((void *) addr)) {
+   case IMAGE_FORMAT_LEGACY:
+   hdr = (image_header_t *) addr;
+
+   bootstage_mark(BOOTSTAGE_ID_IDE_FORMAT);
+
+   if (!image_check_hcrc(hdr)) {
+   puts("\n** Bad Header Checksum **\n");
+   bootstage_error(BOOTSTAGE_ID_IDE_CHECKSUM);
+   return 1;
+   }
+   bootstage_mark(BOOTSTAGE_ID_IDE_CHECKSUM);
+
+   image_print_contents(hdr);
+
+   cn

[U-Boot] [PATCH 0/9] Auto partition selection and fs partition consolidation

2012-08-23 Thread Rob Herring
From: Rob Herring 

The primary goal of this series is to enable auto selection of a partition
using the 1st bootable partition as the default partition for disk based
boot commands. If a bootable partition is not found and partition is not
specified, then the first valid partition is used.

Every command that takes a "[:]" option duplicates the same
parsing code, so this series consolidates the parsing code to a single
function and converts all block based filesystem code over to use th

This is based on Wolfgang's ext4 branch.

Rob

Rob Herring (9):
  combine block device load commands into common function
  disk/part: check bootable flag for DOS partitions
  disk/part: introduce get_device_and_partition
  ext4: remove init_fs/deinit_fs
  cmd_extX: use common get_device_and_partition function
  cmd_fat: use common get_device_and_partition function
  cmd_disk: use common get_device_and_partition function
  cmd_zfs: use common get_device_and_partition function
  cmd_reiser: use common get_device_and_partition function

 common/Makefile |1 +
 common/cmd_disk.c   |  122 ++
 common/cmd_ext4.c   |  106 +++--
 common/cmd_ext_common.c |  108 -
 common/cmd_fat.c|  100 +++
 common/cmd_ide.c|  151 +--
 common/cmd_reiser.c |   81 ++---
 common/cmd_scsi.c   |  123 +-
 common/cmd_usb.c|  138 +--
 common/cmd_zfs.c|   88 ++-
 disk/part.c |   90 +++-
 disk/part_dos.c |   11 +++-
 fs/ext4/dev.c   |   32 --
 fs/ext4/ext4_common.h   |1 -
 fs/ext4/ext4fs.c|   37 +---
 fs/reiserfs/dev.c   |   29 -
 fs/zfs/dev.c|   35 ---
 include/command.h   |4 ++
 include/ext4fs.h|5 +-
 include/ext_common.h|2 +
 include/part.h  |   14 -
 include/reiserfs.h  |2 +-
 include/zfs_common.h|7 +--
 23 files changed, 380 insertions(+), 907 deletions(-)
 create mode 100644 common/cmd_disk.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 2/9] disk/part: check bootable flag for DOS partitions

2012-08-23 Thread Rob Herring
From: Rob Herring 

Determine which partitions are bootable/active. In the partition listing,
print "Boot" for partitions with the bootable/active flag set.

Signed-off-by: Rob Herring 
---
 disk/part_dos.c |   11 +--
 include/part.h  |1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index a43dd9c..24ac00c 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -60,14 +60,20 @@ static inline int is_extended(int part_type)
part_type == 0x85);
 }
 
+static inline int is_bootable(dos_partition_t *p)
+{
+   return p->boot_ind == 0x80;
+}
+
 static void print_one_part (dos_partition_t *p, int ext_part_sector, int 
part_num)
 {
int lba_start = ext_part_sector + le32_to_int (p->start4);
int lba_size  = le32_to_int (p->size4);
 
-   printf ("%5d\t\t%10d\t%10d\t%2x%s\n",
+   printf("%5d\t\t%10d\t%10d\t%2x%s%s\n",
part_num, lba_start, lba_size, p->sys_ind,
-   (is_extended (p->sys_ind) ? " Extd" : ""));
+   (is_extended(p->sys_ind) ? " Extd" : ""),
+   (is_bootable(p) ? " Boot" : ""));
 }
 
 static int test_block_type(unsigned char *buffer)
@@ -222,6 +228,7 @@ static int get_partition_info_extended (block_dev_desc_t 
*dev_desc, int ext_part
}
/* sprintf(info->type, "%d, pt->sys_ind); */
sprintf ((char *)info->type, "U-Boot");
+   info->bootable = is_bootable(pt);
return 0;
}
 
diff --git a/include/part.h b/include/part.h
index e1478f4..447f69d 100644
--- a/include/part.h
+++ b/include/part.h
@@ -93,6 +93,7 @@ typedef struct disk_partition {
ulong   blksz;  /* block size in bytes  */
uchar   name[32];   /* partition name   */
uchar   type[32];   /* string type description  */
+   int bootable;   /* Active/Bootable flag is set  */
 } disk_partition_t;
 
 /* Misc _get_dev functions */
-- 
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 04/12] tools/env: Reduce the impact on real-time processes

2012-08-23 Thread Mike Frysinger
On Thursday 23 August 2012 12:26:08 Joe Hershberger wrote:
> On Wed, Aug 22, 2012 at 10:30 PM, Mike Frysinger wrote:
> > On Friday 17 August 2012 16:49:38 Joe Hershberger wrote:
> >> +  * Break reads up into very small chunks so fw_printenv doesn't
> >> +  * block the kernel long enough to starve other kernel tasks.
> > 
> > err, this sounds like a bug in your kernel driver.  why should userspace
> > be working around buggy drivers ?
> 
> The problem is something to do with the mtd driver blocking some
> resource on large reads that starves USB transfers.  We never fully
> investigated it.  It's true that this is a work-around.  Is that so
> bad?  Maybe so.

i think it's a bad precedent that we shouldn't encourage.  you add your wonky 
hardware workaround, and then the next guy will want to add his hack for their 
broken driver, and we're left with an ugly unmaintainable pile.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-08-23 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.

Signed-off-by: Matt Sealey 
Cc: Stefano Babic 
Cc: Marek Vasut 
---
 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 
+# 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
@@ -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


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

2012-08-23 Thread Tom Rini
On 08/23/2012 11:16 AM, Stefan Roese wrote:
> On 08/23/2012 07:10 PM, Tom Rini wrote:
>>> +#ifdef CONFIG_ARM
>>>  /* Define global data structure pointer to it*/
>>>  gd_t gdata __attribute__ ((section(".data")));
>>> +#endif
>>
>> So you handle cleaning up the BSS differently, interesting.  I'm going
>> to see if that would work for ARM too..
> 
> Yes. Might be that I missed something though. I'll re-check tomorrow.
> 
>> [snip]
>>> @@ -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).

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


Re: [U-Boot] [PATCHv2 1/2] mpc85xx: Initial SP alignment is wrong.

2012-08-23 Thread Joakim Tjernlund
Scott Wood  wrote on 2012/08/23 18:53:14:
>
> On 08/23/2012 02:21 AM, Joakim Tjernlund wrote:
> > Andy Fleming  wrote on 2012/08/22 23:08:45:
> >>
> >> On Mon, Jul 23, 2012 at 3:58 PM, Joakim Tjernlund
> >>  wrote:
> >>> PowerPC mandates SP to be 16 bytes aligned.
> >>> Furthermore, a stack frame is added, pointing to the reset vector
> >>> which may in the way when gdb is walking the stack because
> >>> the reset vector may not accessible depending on emulator settings.
> >>> Also use a temp register so gdb doesn't pick up intermediate values.
> >>>
> >>> Signed-off-by: Joakim Tjernlund 
> >>> ---
> >>>
> >>>  v2 - Address Scott Wood's comments
> >>>  arch/powerpc/cpu/mpc85xx/start.S |   16 +---
> >>>  1 files changed, 5 insertions(+), 11 deletions(-)
> >>>
> >>> diff --git arch/powerpc/cpu/mpc85xx/start.S 
> >>> arch/powerpc/cpu/mpc85xx/start.S
> >>
> >>
> >> Why are your patches different from everyone else's? When I try to
> >> apply this, I get errors because it can't find
> >> "powerpc/cpu/mpc85xx...". git am leaves off the first directory,
> >> because the usual practice is to send patches with these filenames:
> >
> > Ahh, recently I set (in ny git config):
> > [diff]
> >noprefix = true
> > because I got tired off stripping off that prefix each time I cut and
> > paste file names into emacs and similar.
> >
> > Seems like git really likes to see that prefix when applying patches.
> > Don't know if git could learn not to complain about missing prefix?
>
> It's not just git, but also direct use of the patch command when a patch
> fails to apply cleanly.  A user shouldn't have to inspect a patch to
> determine whether to use -p0 or -p1.  -p1 is standard.

Right

>
> How often do you copy and paste filenames out of your own patches?
>

>From patches seldom, from git diff to emacs every now and then.

I guess I will have to change back as I won't remember to switch this
feature off before generating patches.

 Jocke

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


Re: [U-Boot] [PATCH v2 0/5] Tegra 2 USB ULPI series

2012-08-23 Thread Stephen Warren
On 08/21/2012 02:18 PM, Lucas Stach wrote:
> With this series we are able to initialize USB controllers
> using an external ULPI phy AKA USB2 on Tegra 2 devices.
> 
> This was tested to work on a Toradex Colibri T20 board,
> where USB2 is used to access the ASIX ethernet chipset.
> Testing was done with "tegra20: usb: rework set_host_mode" [1]
> applied. I did not spot any regressions on the UTMI ports.
> 
> v2 incorporates all the review feedback I've got so far,
> including now trying harder to enable VBus in all configurations.
> 
> Patch 3 is already in u-boot-usb and only provided as the ULPI
> init code now depends on it.
> Igor could you please take a look at Patch 4?
> 
> Patchset is based on top of u-boot-tegra/next
> 
> [1] http://lists.denx.de/pipermail/u-boot/2012-August/130177.html

OK, with the addition of an appropriate pin_mux_usb() function to
harmony.c, this works now. So, please consider the series,

Tested-by: Stephen Warren 

Note that I did see the following:

Tegra20 (Harmony) # usb start
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 5 USB Device(s) found
   scanning bus for storage devices... Device NOT ready
   Request Sense returned 02 3A 00
2 Storage Device(s) found
   scanning bus for ethernet devices... 1 Ethernet Device(s) found

However, both "usb tree" and then "ext2ls" on the USB device succeeded
without issue, so I think that's tested well enough. I even booted a
kernel from the USB device, and the kernel was able to use the USB
device for the root filesystem, so U-Boot hadn't broken it in any way:-)
___
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-23 Thread Stefan Roese
On 08/23/2012 07:10 PM, Tom Rini wrote:
>> +#ifdef CONFIG_ARM
>>  /* Define global data structure pointer to it*/
>>  gd_t gdata __attribute__ ((section(".data")));
>> +#endif
> 
> So you handle cleaning up the BSS differently, interesting.  I'm going
> to see if that would work for ARM too..

Yes. Might be that I missed something though. I'll re-check tomorrow.

> [snip]
>> @@ -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?

Thanks,
Stefan

___
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-23 Thread Scott Wood
On 08/23/2012 01:03 PM, Andy Fleming wrote:
> On Thu, Aug 23, 2012 at 12:57 PM, Scott Wood  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
>>>  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 
>>>
>>
>> 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.

-Scott


___
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-23 Thread Tabi Timur-B04825
On Thu, Aug 23, 2012 at 12:24 PM, Andy Fleming  wrote:

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

Maybe there are places where we can use raw I/O instead of accessors?
Matt posted a patch like that a few weeks ago.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
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-23 Thread Andy Fleming
Very top of Wolfgang's master branch.

On Thu, Aug 23, 2012 at 12:57 PM, Scott Wood  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
>>  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 
>>
>
> It builds OK for me using that same toolchain.  What SHA1 are you building?
>
> -Scott
>
>
> ___
> 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


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

2012-08-23 Thread Scott Wood
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
>  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 
> 

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

-Scott


___
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-23 Thread Prabhakar Kushwaha

On 08/23/2012 10:54 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
 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 


if this patch is creating problem. Please revert it, till a proper 
solution is not found.


Thanks,
Prabhakar




___
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-23 Thread Andy Fleming
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
 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 
___
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-23 Thread Tom Rini
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
>  /* Define global data structure pointer to it*/
>  gd_t gdata __attribute__ ((section(".data")));
> +#endif

So you handle cleaning up the BSS differently, interesting.  I'm going
to see if that would work for ARM too..

[snip]
> @@ -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...

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


Re: [U-Boot] [PATCHv2 1/2] mpc85xx: Initial SP alignment is wrong.

2012-08-23 Thread Scott Wood
On 08/23/2012 02:21 AM, Joakim Tjernlund wrote:
> Andy Fleming  wrote on 2012/08/22 23:08:45:
>>
>> On Mon, Jul 23, 2012 at 3:58 PM, Joakim Tjernlund
>>  wrote:
>>> PowerPC mandates SP to be 16 bytes aligned.
>>> Furthermore, a stack frame is added, pointing to the reset vector
>>> which may in the way when gdb is walking the stack because
>>> the reset vector may not accessible depending on emulator settings.
>>> Also use a temp register so gdb doesn't pick up intermediate values.
>>>
>>> Signed-off-by: Joakim Tjernlund 
>>> ---
>>>
>>>  v2 - Address Scott Wood's comments
>>>  arch/powerpc/cpu/mpc85xx/start.S |   16 +---
>>>  1 files changed, 5 insertions(+), 11 deletions(-)
>>>
>>> diff --git arch/powerpc/cpu/mpc85xx/start.S arch/powerpc/cpu/mpc85xx/start.S
>>
>>
>> Why are your patches different from everyone else's? When I try to
>> apply this, I get errors because it can't find
>> "powerpc/cpu/mpc85xx...". git am leaves off the first directory,
>> because the usual practice is to send patches with these filenames:
> 
> Ahh, recently I set (in ny git config):
> [diff]
>   noprefix = true
> because I got tired off stripping off that prefix each time I cut and
> paste file names into emacs and similar.
> 
> Seems like git really likes to see that prefix when applying patches.
> Don't know if git could learn not to complain about missing prefix?

It's not just git, but also direct use of the patch command when a patch
fails to apply cleanly.  A user shouldn't have to inspect a patch to
determine whether to use -p0 or -p1.  -p1 is standard.

How often do you copy and paste filenames out of your own patches?

-Scott


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


Re: [U-Boot] [PATCH] mx5:Use IMX_GPIO_NR macro

2012-08-23 Thread Fabio Estevam
On Thu, Aug 23, 2012 at 1:43 PM, Ashok  wrote:
> From 9f76cd6a79c6595fc058e9103d9d4eebd138a2af Mon Sep 17 00:00:00 2001
> From: Ashok Kumar Reddy 
> Date: Thu, 23 Aug 2012 21:24:53 +0530
> Subject: [PATCH] mx5:Use IMX_GPIO_NR macro
>
> Signed-off-by: Ashok Kumar Reddy 

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


[U-Boot] [PATCH] mx5:Use IMX_GPIO_NR macro

2012-08-23 Thread Ashok

From 9f76cd6a79c6595fc058e9103d9d4eebd138a2af Mon Sep 17 00:00:00 2001
From: Ashok Kumar Reddy 
Date: Thu, 23 Aug 2012 21:24:53 +0530
Subject: [PATCH] mx5:Use IMX_GPIO_NR macro

Signed-off-by: Ashok Kumar Reddy 
---
 board/freescale/mx51evk/mx51evk.c   |   12 ++--
 board/freescale/mx53ard/mx53ard.c   |8 
 board/freescale/mx53evk/mx53evk.c   |8 
 board/freescale/mx53loco/mx53loco.c |8 
 board/freescale/mx53smd/mx53smd.c   |4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c

index 514a7ac..55cdbed 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -319,11 +319,11 @@ static void power_init(void)
pmic_reg_write(p, REG_MODE_1, val);

mxc_request_iomux(MX51_PIN_EIM_A20, IOMUX_CONFIG_ALT1);
-   gpio_direction_output(46, 0);
+   gpio_direction_output(IMX_GPIO_NR(2,14), 0);

udelay(500);

-   gpio_set_value(46, 1);
+   gpio_set_value(IMX_GPIO_NR(2,14), 1);
 }

 #ifdef CONFIG_FSL_ESDHC
@@ -333,14 +333,14 @@ int board_mmc_getcd(struct mmc *mmc)
int ret;

mxc_request_iomux(MX51_PIN_GPIO1_0, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(0);
+   gpio_direction_input(IMX_GPIO_NR(1,0));
mxc_request_iomux(MX51_PIN_GPIO1_6, IOMUX_CONFIG_ALT0);
-   gpio_direction_input(6);
+   gpio_direction_input(IMX_GPIO_NR(1,6));

if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-   ret = !gpio_get_value(0);
+   ret = !gpio_get_value(IMX_GPIO_NR(1,0));
else
-   ret = !gpio_get_value(6);
+   ret = !gpio_get_value(IMX_GPIO_NR(1,6));

return ret;
 }
diff --git a/board/freescale/mx53ard/mx53ard.c 
b/board/freescale/mx53ard/mx53ard.c

index 2d21584..ee5bd43 100644
--- a/board/freescale/mx53ard/mx53ard.c
+++ b/board/freescale/mx53ard/mx53ard.c
@@ -89,14 +89,14 @@ int board_mmc_getcd(struct mmc *mmc)
int ret;

mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(1);
+   gpio_direction_input(IMX_GPIO_NR(1,1));
mxc_request_iomux(MX53_PIN_GPIO_4, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(4);
+   gpio_direction_input(IMX_GPIO_NR(1,4));

if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-   ret = !gpio_get_value(1); /* GPIO1_1 */
+   ret = !gpio_get_value(IMX_GPIO_NR(1,1));
else
-   ret = !gpio_get_value(4); /* GPIO1_4 */
+   ret = !gpio_get_value(IMX_GPIO_NR(1,4));

return ret;
 }
diff --git a/board/freescale/mx53evk/mx53evk.c 
b/board/freescale/mx53evk/mx53evk.c

index 8a6e31d..ed23e28 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -214,14 +214,14 @@ int board_mmc_getcd(struct mmc *mmc)
int ret;

mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(75);
+   gpio_direction_input(IMX_GPIO_NR(3,11));
mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(77);
+   gpio_direction_input(IMX_GPIO_NR(3,13));

if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-   ret = !gpio_get_value(77); /* GPIO3_13 */
+   ret = !gpio_get_value(IMX_GPIO_NR(3,13));
else
-   ret = !gpio_get_value(75); /* GPIO3_11 */
+   ret = !gpio_get_value(IMX_GPIO_NR(3,11));

return ret;
 }
diff --git a/board/freescale/mx53loco/mx53loco.c 
b/board/freescale/mx53loco/mx53loco.c

index cbdcfad..8cb9bd9 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -175,14 +175,14 @@ int board_mmc_getcd(struct mmc *mmc)
int ret;

mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(75);
+   gpio_direction_input(IMX_GPIO_NR(3,11));
mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(77);
+   gpio_direction_input(IMX_GPIO_NR(3,13));

if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-   ret = !gpio_get_value(77); /* GPIO3_13 */
+   ret = !gpio_get_value(IMX_GPIO_NR(3,13));
else
-   ret = !gpio_get_value(75); /* GPIO3_11 */
+   ret = !gpio_get_value(IMX_GPIO_NR(3,11));

return ret;
 }
diff --git a/board/freescale/mx53smd/mx53smd.c 
b/board/freescale/mx53smd/mx53smd.c

index c237980..cca9e99 100644
--- a/board/freescale/mx53smd/mx53smd.c
+++ b/board/freescale/mx53smd/mx53smd.c
@@ -135,8 +135,8 @@ struct fsl_esdhc_cfg esdhc_cfg[1] = {
 int board_mmc_getcd(struct mmc *mmc)
 {
mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
-   gpio_direction_input(77);
-   return !gpio_get_value(77); /* GPIO3_13 */
+   gpio_direction_input(IMX_GPIO_NR(3,13));
+   return !gpio_get_value(IMX_GPIO_NR(3,13));
 }

 int board_mmc_init(bd_t

Re: [U-Boot] [PATCH] mx6qarm2:Use IMX_GPIO_NR macro

2012-08-23 Thread Stefano Babic
On 23/08/2012 18:11, Ashok wrote:
> From 0a92ab264ca7f87f198afe401bc552000fe2bd12 Mon Sep 17 00:00:00 2001
> From: Ashok Kumar Reddy 
> Date: Thu, 23 Aug 2012 21:01:34 +0530
> Subject: [PATCH] mx6qarm2:Use IMX_GPIO_NR macro
> 
> Signed-off-by: Ashok Kumar Reddy 
> ---
>  board/freescale/mx6qarm2/mx6qarm2.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/board/freescale/mx6qarm2/mx6qarm2.c
> b/board/freescale/mx6qarm2/mx6qarm2.c
> index 340c4c4..3218993 100644
> --- a/board/freescale/mx6qarm2/mx6qarm2.c
> +++ b/board/freescale/mx6qarm2/mx6qarm2.c
> @@ -126,8 +126,8 @@ int board_mmc_getcd(struct mmc *mmc)
>  int ret;
> 
>  if (cfg->esdhc_base == USDHC3_BASE_ADDR) {
> -gpio_direction_input(171); /*GPIO6_11*/
> -ret = !gpio_get_value(171);
> +gpio_direction_input(IMX_GPIO_NR(6,11));
> +ret = !gpio_get_value(IMX_GPIO_NR(6,11));
>  } else /* Don't have the CD GPIO pin on board */
>  ret = 1;
> 

Acked-by: Stefano Babic 

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] mx6qarm2:Use IMX_GPIO_NR macro

2012-08-23 Thread Fabio Estevam
On Thu, Aug 23, 2012 at 1:11 PM, Ashok  wrote:
> From 0a92ab264ca7f87f198afe401bc552000fe2bd12 Mon Sep 17 00:00:00 2001
> From: Ashok Kumar Reddy 
> Date: Thu, 23 Aug 2012 21:01:34 +0530
> Subject: [PATCH] mx6qarm2:Use IMX_GPIO_NR macro
>
> Signed-off-by: Ashok Kumar Reddy 

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


[U-Boot] ubifsload does not support relative symbolic link

2012-08-23 Thread Dev Ma
Hi,

I found ubifsload does not support relative symbolic link.

A patch in 2009 said that it could resolve relative symlink. It has
already been merged into "fs/ubifs/ubifs.c". But it does not work
today.

Direct symlink, i.e. "to_target" or "/path/to_target", works. But
relative symlink, i.e. "./to_target" or "../path/to_target", does not
work.

I read ubifs.c in kernel source tree, and found folder "." and ".."
are treated differently.

Can anybody give a solution?

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


Re: [U-Boot] [PATCH 04/12] tools/env: Reduce the impact on real-time processes

2012-08-23 Thread Joe Hershberger
Hi Mike,

On Wed, Aug 22, 2012 at 10:30 PM, Mike Frysinger  wrote:
> On Friday 17 August 2012 16:49:38 Joe Hershberger wrote:
>> + * Break reads up into very small chunks so fw_printenv doesn't
>> + * block the kernel long enough to starve other kernel tasks.
>
> err, this sounds like a bug in your kernel driver.  why should userspace be
> working around buggy drivers ?

The problem is something to do with the mtd driver blocking some
resource on large reads that starves USB transfers.  We never fully
investigated it.  It's true that this is a work-around.  Is that so
bad?  Maybe so.

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


Re: [U-Boot] [PATCH v3 17/19] da850: Add README.da850

2012-08-23 Thread Tom Rini
On 08/23/2012 05:52 AM, Christian Riesch wrote:
> Hi Tom,
> 
> On Thu, Aug 23, 2012 at 1:19 AM, Tom Rini  wrote:
>> This file documents when to build for da850evm and when to build for
>> da850_am18xxevm.  It also documents how to write the u-boot.ais file to
>> persistent storage (such as SPI), in some cases as well as how to write
>> a recovery image.
>>
>> Signed-off-by: Tom Rini 
>> ---
>> Changes in v2:
>> - Add
>>
>> Changes in v3:
>> - Fix thinko, Nand -> SPI (spotted by Prabhakar Lad)
>> - Rename to README.da850, add more direct recovery method (Christian Riesch)
>>
>>  board/davinci/da8xxevm/README.da850 |   62 
>> +++
>>  1 file changed, 62 insertions(+)
>>  create mode 100644 board/davinci/da8xxevm/README.da850
>>
>> diff --git a/board/davinci/da8xxevm/README.da850 
>> b/board/davinci/da8xxevm/README.da850
>> new file mode 100644
>> index 000..55291f3
>> --- /dev/null
>> +++ b/board/davinci/da8xxevm/README.da850
>> @@ -0,0 +1,62 @@
>> +Summary
>> +===
>> +The README is for the boot procedure used for various DA850 (or compatible
>> +parts such as the AM1808) based boards.
>> +
>> +The board is booted in three stages. The initial bootloader which executes
>> +upon reset is the ROM Boot Loader (RBL) which sits in the internal ROM. The
>> +RBL initializes the memory and then depending on the exact board will
> 
> The RBL can initialize the PLLs and the memory (I assume you are
> talking about DDR/SDRAM here), but only if the AIS tells it to do so
> and provides the configuration data like timing etc. However, for the
> da850evm configuration the AIS only tells the RBL to copy the SPL to
> the internal SRAM of the SoC. Then, the SPL initializes the DDR
> memory.
> 
> Actually we wouldn't need SPL to boot from SPI on the da850. We could
> as well do memory initialization with AIS/RBL and then let the RBL
> copy u-boot to DDR memory. The reason why I introduced SPL for booting
> from SPI here is that it gives us more flexibility, e.g. on my custom
> board I must check the board revision before configuring the PLLs
> because I have different oscillator frequencies on different
> revisions.

True.  I suppose this is what I get for copy/pasting docs from a similar
board and focusing more on the "write these bits to hardware" rather
than "what do these bits do exactly" :)  Thanks, I'll re-word things a
bit more.

>> +initialize another controller (such as SPI or NAND) to continue the boot
>> +process.
>> +
>> +AIS is an image format defined by TI for the images that are to be
>> +loaded to memory by the RBL. The image is divided into a series of
>> +sections and the image's entry point is specified. Each section comes
>> +with meta data like the target address the section is to be copied to
>> +and the size of the section, which is used by the RBL to load the
>> +image. At the end of the image the RBL jumps to the image entry
>> +point.
>> +
>> +The secondary stage bootloader (SPL) which is loaded by the RBL then
> 
> ... initializes the PLLs and the memory controller and ...
> 
>> loads
>> +the u-boot from a predefined location in persistent storage to DDR and
>> +jumps to the u-boot entry point.
>> +
>> +
>> +Compilation
>> +===
>> +The exact build target you need will depend on the board you have.  For
>> +Logic PD boards, or other boards which store the ethernet MAC address at
>> +the end of SPI flash, run 'make da850evm'.  For boards which store the
>> +ethernet MAC address in the i2c EEPROM located at 0x50, run
>> +'make da850_am18xxevm'.  Once this build completes you will have a
>> +u-boot.ais file that needs to be written to the correct persistent
>> +storage.
>> +
>> +
>> +Flashing the images to SPI
>> +==
>> +The AIS image can be written to SPI flash using the following commands.
>> +Assuming that the network is configured and enabled and the u-boot.ais file
>> +is tftp'able.
>> +
>> +U-Boot > sf probe 0
>> +U-Boot > sf erase 0 +32
>> +U-Boot > tftp u-boot.ais
>> +U-Boot > sf write c070 0 $filesize
>> +
>> +
>> +Recovery
>> +
>> +
>> +In the case of a "bricked" board, you need to use the TI tools found
>> +here[1] to write the u-boot.ais file.  An example of recovering to the SPI
>> +flash would be:
>> +
>> +$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \
>> +   -flash_noubl /path/to/u-boot.ais
>> +
> 
> I believe for the OMAP-L138 boards you will need -targetType OMAPL138
> (or just omit the option because OMAPL138 is the default).

Indeed, I should say it's an example for AM1808.

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


[U-Boot] [PATCH] mx6qarm2:Use IMX_GPIO_NR macro

2012-08-23 Thread Ashok

From 0a92ab264ca7f87f198afe401bc552000fe2bd12 Mon Sep 17 00:00:00 2001
From: Ashok Kumar Reddy 
Date: Thu, 23 Aug 2012 21:01:34 +0530
Subject: [PATCH] mx6qarm2:Use IMX_GPIO_NR macro

Signed-off-by: Ashok Kumar Reddy 
---
 board/freescale/mx6qarm2/mx6qarm2.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qarm2/mx6qarm2.c 
b/board/freescale/mx6qarm2/mx6qarm2.c

index 340c4c4..3218993 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -126,8 +126,8 @@ int board_mmc_getcd(struct mmc *mmc)
int ret;

if (cfg->esdhc_base == USDHC3_BASE_ADDR) {
-   gpio_direction_input(171); /*GPIO6_11*/
-   ret = !gpio_get_value(171);
+   gpio_direction_input(IMX_GPIO_NR(6,11));
+   ret = !gpio_get_value(IMX_GPIO_NR(6,11));
} else /* Don't have the CD GPIO pin on board */
ret = 1;

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


Re: [U-Boot] [U-Boot-DM] dwc_ahsata vs ahci

2012-08-23 Thread Marek Vasut
Dear Lv Terry-R65388,

> > Hi Pavel,
> > 
> > The ahci.c is a ahci driver using pci interface, while dwc_asata is not.
> > 
> >  u-boot don't have a pure ahci driver now, thus we have to reuse some
> 
> ahci
> 
> > parts from ahci.c in dwc_asata.c.
> 
> Ok, I think we can unify that eventually.
[...]

Bump? Any effort to do so ?

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 01/12] tools/env: Use a board-specific default env

2012-08-23 Thread Joe Hershberger
Hi Mike,

On Wed, Aug 22, 2012 at 10:17 PM, Mike Frysinger  wrote:
> On Friday 17 August 2012 16:49:35 Joe Hershberger wrote:
>>   */
>>  #define CONFIG_FILE "/etc/fw_env.config"
>>
>> +#ifndef CONFIG_FILE
>
> this doesn't make any sense.  CONFIG_FILE is defined literally right above 
> this
> check.

The comment right above that says:

/*
 * To build the utility with the static configuration
 * comment out the next line.
 * See included "fw_env.config" sample file
 * for notes on configuration.
 */

...so the reason for the #ifndef is for the case where you comment out
that line.  The other option is to just delete all of that stuff and
the user can add it all back if they want to operate with no config
file.

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


Re: [U-Boot] [PATCH 1/3] nand: Add support for unlock.invert

2012-08-23 Thread Joe Hershberger
Hi Scott,

On Wed, Aug 22, 2012 at 8:38 PM, Scott Wood  wrote:
> On 08/22/2012 03:34 PM, Joe Hershberger wrote:
>> Hi Scott,
>>
>> On Fri, Aug 17, 2012 at 3:53 PM, Scott Wood  wrote:
>>> On 08/17/2012 03:31 PM, Joe Hershberger wrote:
 NAND unlock command allows an invert bit to be set to unlock all but
 the selected page range.

 Signed-off-by: Joe Hershberger 
 ---
  common/cmd_nand.c| 13 ++---
  drivers/mtd/nand/nand_util.c |  9 ++---
  include/nand.h   |  4 ++--
  3 files changed, 18 insertions(+), 8 deletions(-)

 @@ -368,6 +369,8 @@ int nand_unlock(struct mtd_info *mtd, ulong start, 
 ulong length)

   /* submit ADDRESS of LAST page to unlock */
   page += (int)(length >> chip->page_shift);
 + if (invert)
 + page |= 1;
   chip->cmdfunc(mtd, NAND_CMD_UNLOCK2, -1, page & chip->pagemask);
>>>
>>> Why |= 1?  Is this some magic that the chip recognizes to implement
>>> "invert"?  Do all chips that support lock/unlock support this (none of
>>> the NAND chip manuals I have document lock/unlock at all as far as I
>>> could find)?  What if you want to unlock a non-inverted range that ends
>>> in a page with the low bit set?
>>
>> According to the data sheet for the part I'm working with
>> (MT29F4G08ABADAH4) the unlock command has 2 commands... 0x23 and 0x24.
>>  The invert bit only exists for 0x24 (NAND_CMD_UNLOCK2).  The format
>> of the unlock commands specifys that block addresses are used,
>> therefore the LSb would never be set.  This bit-0 is defined to be
>> "invert area" for 0x24 and always LOW for 0x23.
>
> Please add a code comment to this effect.

This is what the code does... Can you recommend a comment that you would like?

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


Re: [U-Boot] [PATCH 1/6] SPL: Add NOR flash booting support

2012-08-23 Thread Stefan Roese
On 08/23/2012 05:07 PM, Tom Rini wrote:
> On 08/23/2012 01:12 AM, Stefan Roese wrote:
>> SPL NOR flash booting support is quite simple. Only copying of the
>> images is needed.
>>
>> On MPC5xxx we need to make sure to only use the standard memcpy()
>> implementation and not the MPC5xxx specific one. As the MPC5xxx
>> version has some complexity which is not needed for this SPL
>> booting.
> 
> I assume there's good reason to use SPL on NOR here?  Is a near-future
> goal to do SPL-boots-Linux and thus the desire for a very small loader?

Yes. As explained in the cover-letter, the board port using this SPL NOR
support (MPC5200 based) mainly uses this SPL framework to speed up
booting into Linux. Less code loaded from NOR, zero relocation (on this
PPC port at least), etc.

My first quick tests show a boot to Linux speedup by approx. 0.5 seconds
compared to the good-old U-Boot -> Linux booting. So it definitely makes
sense in time-critical bootup situation.

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 1/6] SPL: Add NOR flash booting support

2012-08-23 Thread Tom Rini
On 08/23/2012 01:12 AM, Stefan Roese wrote:
> SPL NOR flash booting support is quite simple. Only copying of the
> images is needed.
> 
> On MPC5xxx we need to make sure to only use the standard memcpy()
> implementation and not the MPC5xxx specific one. As the MPC5xxx
> version has some complexity which is not needed for this SPL
> booting.

I assume there's good reason to use SPL on NOR here?  Is a near-future
goal to do SPL-boots-Linux and thus the desire for a very small loader?
 Thanks!

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


Re: [U-Boot] [PATCH] Add U_BOOT_TIMESTAMP definition

2012-08-23 Thread Matt Sealey
On Thu, Aug 23, 2012 at 9:49 AM, Stefano Babic  wrote:
> On 23/08/2012 16:44, Matt Sealey wrote:
>> This gives us a string like "20120822150855" which encodes the build time.
>>
>> This allows automated version checking and flashing of U-Boot to be 
>> performed,
>> for example, in boot.scr files (or scripting in general).
>>
>> Signed-off-by: Matt Sealey 
>> Cc: Stefano Babic 
>> Cc: Marek Vasut 
>> ---
>
> Hi Matt,
>
>>  Makefile |1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Makefile b/Makefile
>> index 1df4c1d..c042206 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -664,6 +664,7 @@ $(TIMESTAMP_FILE):
>>   @mkdir -p $(dir $(TIMESTAMP_FILE))
>>   @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
>>   @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
>> + @LC_ALL=C date +'#define U_BOOT_TIMESTAMP "%Y%m%d%H%M%S"' >> 
>> $@.tmp
>>   @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
>>
>
> This is not related to iMX only. I set CC to Wolfgang.

Noted, totally my fault.

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


[U-Boot] [PATCH] efikamx: update MAINTAINERS for Genesi Efika MX systems

2012-08-23 Thread Matt Sealey
Update maintainer for "efikamx" and "efikasb" to myself.

Signed-off-by: Matt Sealey 
Cc: Stefano Babic 
Cc: Marek Vasut 
---
 MAINTAINERS |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1abaf2e..77e099d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -877,6 +877,11 @@ Michael Schwingen 
actux4  xscale/ixp
dvlhost xscale/ixp
 
+Matt Sealey 
+
+   efikamx i.MX51
+   efikasb i.MX51
+
 Bo Shen 
at91sam9x5ekARM926EJS (AT91SAM9G15,G25,G35,X25,X35 SoC)
 
@@ -906,8 +911,6 @@ Marek Vasut 
zipitz2 xscale/pxa
m28evk  i.MX28
sc_sps_1i.MX28
-   efikamx i.MX51
-   efikasb i.MX51
 
 Hugo Villeneuve 
 
-- 
1.7.9.5

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


[U-Boot] [PATCH 2/2] efikamx: update and clean up configuration

2012-08-23 Thread Matt Sealey
Rewrite and refine the configuration for the Efika MX to support the
board features effectively.

In summary:

* Reorder configuration so it is more readable
* Bring the configuration up to a production-compatible boot process
  by implementing scanning of bootable partitions on MMC and ATA
  media, and the environment required to support this.
* Refine configuration settings to save space and disable arguably
  unused features like gzip support (not required for booting).
* Add CONFIG_EFI_PARTITION, CONFIG_OF_FDT and CONFIG_CMD_BOOTZ support.
* Refine memtest ranges
* Remove SPI flash environment saving since modifying the environment
  can stop boot, and in any case can be modified or supplemented from
  any supported boot media via the "boot.scr" script or through the
  serial console each boot.
* USB default to port 0 which is the Smarttop USBDR port (Ethernet)
* Make CONFIG_CMD_NET 'depend' on CONFIG_CMD_USB (CONFIG_CMD_USB is not
  currently optional, though, but it makes more sense this way)
* Remove CONFIG_PREBOOT and CONFIG_USB_KEYBOARD

Requires the patch "Add U_BOOT_TIMESTAMP definition."

Signed-off-by: Matt Sealey 
Cc: Marek Vasut 
Cc: Stefano Babic 
---
 include/configs/mx51_efikamx.h |  486 
 1 file changed, 291 insertions(+), 195 deletions(-)

diff --git a/include/configs/mx51_efikamx.h b/include/configs/mx51_efikamx.h
index 143b0f0..449f61b 100644
--- a/include/configs/mx51_efikamx.h
+++ b/include/configs/mx51_efikamx.h
@@ -1,9 +1,11 @@
 /*
  * Copyright (C) 2007, Guennadi Liakhovetski 
+ * Copyright (C) 2009 Freescale Semiconductor, Inc.
+ * Copyright (C) 2009 Pegatron Corporation
+ * Copyright (C) 2009-2012, Genesi USA, Inc.
  *
- * (C) Copyright 2009 Freescale Semiconductor, Inc.
- *
- * Configuration settings for the MX51EVK Board
+ * Configuration settings for the Genesi Efika MX Smarttop & Smartbook
+ * based on MX51EVK settings
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -25,250 +27,344 @@
 #define __CONFIG_H
 
 #include 
+#include 
 
 /*
- * High Level Board Configuration Options
+ * U-Boot on the Efika MX is limited in some ways to a 256KiB binary (assuming
+ * we stick with the config in the legacy kernels which gives U-Boot a 256KiB
+ * MTD partition). With a lot of boot device support and full system 
configuration
+ * we manage to break this limit with some toolchains or miscellaneous 
settings,
+ * so we do some damage limitation by making sure the build is as fine-tuned as
+ * possible.
+ *
+ * We don't support compressing scripts, kernels, ramdisks or device trees
+ * because Linux will decompress itself at runtime, ramdisks stay compressed,
+ * scripts and device trees have minimal space saving anyway. Therefore we
+ * don't need zlib, gzip etc.
+ *
+ * We also don't really care about NetBSD or RTEMS, PCMCIA or weirder load
+ * methods right now which saves a little more space.
  */
-/* An i.MX51 CPU */
-#define CONFIG_MX51
+#undef CONFIG_ZLIB
+#undef CONFIG_GZIP
+#undef CONFIG_BOOTM_NETBSD
+#undef CONFIG_BOOTM_RTEMS
+#undef CONFIG_CMD_SETGETDCR
+#undef CONFIG_CMD_PCMCIA
+#undef CONFIG_PCMCIA
+#undef CONFIG_CMD_LOADB
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_LOADY
+#undef CONFIG_CMD_IMLS
 
-#definemachine_is_efikamx()(CONFIG_MACH_TYPE == 
MACH_TYPE_MX51_EFIKAMX)
-#definemachine_is_efikasb()(CONFIG_MACH_TYPE == 
MACH_TYPE_MX51_EFIKASB)
+/*
+ * We will need to undefine this to save even more space if we break the 256KiB
+ * limit.. but for now we just squeak in and it would be nicer to users if
+ * space was optimized elsewhere first.
+ */
+#define CONFIG_SYS_LONGHELP
 
-#include 
+/*
+ * We want to explicitly enable these in case they're not.
+ */
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_CACHE
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMD_BOOTZ
 
+#define CONFIG_MX51
 #define CONFIG_SYS_MX5_HCLK2400
 #define CONFIG_SYS_MX5_CLK32   32768
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_SYS_TEXT_BASE   0x9780
+#define machine_is_efikamx()   (CONFIG_MACH_TYPE == MACH_TYPE_MX51_EFIKAMX)
+#define machine_is_efikasb()   (CONFIG_MACH_TYPE == MACH_TYPE_MX51_EFIKASB)
+
+#include 
+#include 
+
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_REVISION_TAG
+
+#define CONFIG_MXC_GPIO
 
-#defineCONFIG_L2_OFF
-#defineCONFIG_SYS_ICACHE_OFF
-#defineCONFIG_SYS_DCACHE_OFF
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE   UART1_BASE
+#define CONFIG_CONS_INDEX  1
+#define CONFIG_BAUDRATE115200
 
 /*
- * Bootloader Components Configuration
+ * Genesi do not support saving the U-Boot environment at runtime. If you
+ * need new environment, write a boot.scr that changes the variables before
+ * you boot. This reduces the amount of odd behavior possible from 
m

[U-Boot] [PATCH 1/2] efikamx: refine USB support

2012-08-23 Thread Matt Sealey
Because of the way USB pad settings are handled it doesn't make sense to
be able to build the Efika MX board support without CONFIG_CMD_USB turned
on. So, we change the build to always compile in USB support.

We do not need to check for CONFIG_CMD_USB like we do with CONFIG_MXC_SPI
since the USB subsystem will error out of the compile for us.

Additionally, the following behaviors have changed;

* Smartbook "preboot" should not set input and output to USB keyboard as
  there is no display support
* board_eth_init is implemented such that it does not cause U-Boot to
  report an explicit failure ("CPU Net Initialization Failed").

Since Ethernet is implemented via USB (fixed on Smarttop, pluggable on
Smartbook, and handled by "usb start") - the warning that is left
("No ethernet found") is perfectly reasonable at the point it is printed
since the USB system hasn't been started and nothing has been probed yet.

Signed-off-by: Matt Sealey 
Cc: Stefano Babic 
Cc: Marek Vasut 
---
 board/genesi/mx51_efikamx/Makefile  |6 +-
 board/genesi/mx51_efikamx/efikamx-usb.c |   12 
 board/genesi/mx51_efikamx/efikamx.c |3 ---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/board/genesi/mx51_efikamx/Makefile 
b/board/genesi/mx51_efikamx/Makefile
index bd2174f..f95356f 100644
--- a/board/genesi/mx51_efikamx/Makefile
+++ b/board/genesi/mx51_efikamx/Makefile
@@ -27,11 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  := efikamx.o
-
-ifdef  CONFIG_CMD_USB
-COBJS  += efikamx-usb.o
-endif
+COBJS  := efikamx.o efikamx-usb.o
 
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/genesi/mx51_efikamx/efikamx-usb.c 
b/board/genesi/mx51_efikamx/efikamx-usb.c
index abd358a..ae6d1be 100644
--- a/board/genesi/mx51_efikamx/efikamx-usb.c
+++ b/board/genesi/mx51_efikamx/efikamx-usb.c
@@ -201,3 +201,15 @@ void board_ehci_hcd_postinit(struct usb_ehci *ehci, int 
port)
   IMX_GPIO_NR(2, 20));
}
 }
+
+/*
+ * Ethernet on the Smarttop is on the USB bus. Rather than give an error about
+ * "CPU Net Initialization Failed", just pass this test since no other settings
+ * are required. Smartbook doesn't have built-in Ethernet but we will let it
+ * pass anyway considering someone may have plugged in a USB stick and all
+ * they need to do is run "usb start".
+ */
+int board_eth_init(bd_t *bis)
+{
+   return 0;
+}
diff --git a/board/genesi/mx51_efikamx/efikamx.c 
b/board/genesi/mx51_efikamx/efikamx.c
index b9064fb..d9c499d 100644
--- a/board/genesi/mx51_efikamx/efikamx.c
+++ b/board/genesi/mx51_efikamx/efikamx.c
@@ -484,9 +484,6 @@ int board_late_init(void)
imx_iomux_v3_setup_multiple_pads(efikamx_pata_pads, 
ARRAY_SIZE(efikamx_pata_pads));
efikamx_usb_setup_pads();
 
-   if (machine_is_efikasb())
-   setenv("preboot", "usb reset ; setenv stdin usbkbd\0");
-
return 0;
 }
 
-- 
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] Add U_BOOT_TIMESTAMP definition

2012-08-23 Thread Stefano Babic
On 23/08/2012 16:44, Matt Sealey wrote:
> This gives us a string like "20120822150855" which encodes the build time.
> 
> This allows automated version checking and flashing of U-Boot to be performed,
> for example, in boot.scr files (or scripting in general).
> 
> Signed-off-by: Matt Sealey 
> Cc: Stefano Babic 
> Cc: Marek Vasut 
> ---

Hi Matt,

>  Makefile |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index 1df4c1d..c042206 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -664,6 +664,7 @@ $(TIMESTAMP_FILE):
>   @mkdir -p $(dir $(TIMESTAMP_FILE))
>   @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
>   @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
> + @LC_ALL=C date +'#define U_BOOT_TIMESTAMP "%Y%m%d%H%M%S"' >> 
> $@.tmp
>   @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
>  

This is not related to iMX only. I set CC to Wolfgang.

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] [PATCH] Add U_BOOT_TIMESTAMP definition

2012-08-23 Thread Matt Sealey
This gives us a string like "20120822150855" which encodes the build time.

This allows automated version checking and flashing of U-Boot to be performed,
for example, in boot.scr files (or scripting in general).

Signed-off-by: Matt Sealey 
Cc: Stefano Babic 
Cc: Marek Vasut 
---
 Makefile |1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 1df4c1d..c042206 100644
--- a/Makefile
+++ b/Makefile
@@ -664,6 +664,7 @@ $(TIMESTAMP_FILE):
@mkdir -p $(dir $(TIMESTAMP_FILE))
@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
+   @LC_ALL=C date +'#define U_BOOT_TIMESTAMP "%Y%m%d%H%M%S"' >> 
$@.tmp
@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
 
 easylogo env gdb:
-- 
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 1/2] gpio: add gpio api support to mx27 (v2)

2012-08-23 Thread Stefano Babic
On 06/08/2012 17:29, Philippe Reynes wrote:
> 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 
> ---

Hi Philippe,

>  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 
>  #include 
>  #include 
> +#include 
>  #ifdef CONFIG_MXC_MMC
>  #include 
>  #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(®s->port[port].ddir) | 1 << pin,
> - ®s->port[port].ddir);
> + writel(readl(®s->port[port].gpio_dir) | 1 << pin,
> + ®s->port[port].gpio_dir);
>   } else {
> - writel(readl(®s->port[port].ddir) & ~(1 << pin),
> - ®s->port[port].ddir);
> + writel(readl(®s->port[port].gpio_dir) & ~(1 << pin),
> + ®s->port[port].gpio_dir);
>   }

This is strange, because it does not make use of
gpio_direction_output(). However, if we use it, generic.c depends on
CONFIG_MXC_GPIO. Ok


>  
> +#ifndef CONFIG_MX27
>   val = (readl(®s->gpio_dr) >> gpio) & 0x01;
> +#else
> + val = (readl(®s->ssr) >> gpio) & 0x01;
> +#endif
>  

A recent patch uses psr on the other SOC instead of dr to read directly
the pad status instead of the internal shadow register. If you rename
your ssr into gpio_psr we do not need this #ifdef.

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 V3 0/4] add mips64 cpu support

2012-08-23 Thread Zhi-zhou Zhang
On Thu, Aug 23, 2012 at 11:04 AM, Mike Frysinger  wrote:

> On Monday 20 August 2012 10:22:22 Zhizhou Zhang wrote:
> > This patch add mips64 cpu support.
> > Changes in V3:
> >   - merge related files into one patch, no longer one file one patch.
> >   - add detailed commit message.
> >   - remove standalone example. it's too complicate.
>
> do you keep sending these patchsets in duplicate on purpose ?  your v2 and
> v3
> series both were doubly sent.
> -mike
>

I'm sorry, I'm a fresh to mail-list. I used to think I should send a patch
diff from master branch.
 Thanks for you guidance.
-- 
Regards,
Zhizhou Zhang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 16/19] ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK

2012-08-23 Thread Tom Rini
On 08/23/2012 06:14 AM, Christian Riesch wrote:
> Hi Tom,
> 
> On Thu, Aug 23, 2012 at 1:19 AM, Tom Rini  wrote:
>> - Convert the non-relocation part of board_init_f to spl_board_init,
>>   turn on CONFIG_SPL_BOARD_INIT in the configs.
>> - Remove duplicated code.
>> - Add spl_boot_device() that returns the statically chosen boot device.
>>
>> Signed-off-by: Tom Rini 
> [...]
>> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c 
>> b/arch/arm/cpu/arm926ejs/davinci/spl.c
>> index 74632e5..46c0bfd 100644
>> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>> @@ -21,6 +21,7 @@
>>   * MA 02111-1307 USA
>>   */
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -29,14 +30,7 @@
>>  #include 
>>  #include 
>>
>> -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
>> -
>> -DECLARE_GLOBAL_DATA_PTR;
>> -/* Define global data structure pointer to it*/
>> -static gd_t gdata __attribute__ ((section(".data")));
>> -static bd_t bdata __attribute__ ((section(".data")));
>> -
>> -#else
>> +#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
>>
>>  void puts(const char *str)
>>  {
>> @@ -54,43 +48,37 @@ void putc(char c)
>>
>>  #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
>>
>> -inline void hang(void)
>> -{
>> -   puts("### ERROR ### Please RESET the board ###\n");
>> -   for (;;)
>> -   ;
>> -}
>> -
>>  void board_init_f(ulong dummy)
>>  {
>> +   /* First, perform our low-level init. */
>>  #ifdef CONFIG_SOC_DM365
>> dm36x_lowlevel_init(0);
>>  #endif
>>  #ifdef CONFIG_SOC_DA8XX
>> arch_cpu_init();
>>  #endif
>> -   relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE);
>> +
>> +   /*
>> +* Next we call relocate_code() with relocation target same as the
>> +* CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting
>> +* skipped. Instead, only .bss initialization will happen.
>> +*/
>> +   relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);
>>  }
>>
>> -void board_init_r(gd_t *id, ulong dummy)
>> +void spl_board_init(void)
>>  {
>> -#ifdef CONFIG_SPL_NAND_LOAD
>> -   nand_init();
>> -   puts("Nand boot...\n");
>> -   nand_boot();
>> -#endif
>> -#ifdef CONFIG_SPL_SPI_LOAD
>> -   mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>> -   CONFIG_SYS_MALLOC_LEN);
>> -
>> -   gd = &gdata;
>> -   gd->bd = &bdata;
>> -   gd->flags |= GD_FLG_RELOC;
>> -   gd->baudrate = CONFIG_BAUDRATE;
>> -   serial_init();  /* serial communications setup */
>> -   gd->have_console = 1;
>> +   preloader_console_init();
>> +}
>>
>> -   puts("SPI boot...\n");
>> -   spi_boot();
>> +u32 spl_boot_device(void)
>> +{
>> +#ifdef CONFIG_SPL_NAND_LOAD
>> +   return BOOT_DEVICE_NAND;
>> +#elif defined(CONFIG_SPL_SPI_LOAD)
>> +   return BOOT_DEVICE_SPI;
>> +#else
> 
> This will not apply on u-boot-ti since it is missing the MMC-SPL
> patches that have already been merged, right?

Indeed, there will be a certain amount of merge-pain I will have to deal
with to get this to apply.  There's also conflicts with some of the
am33xx enhancements there or that I plan to push there shortly.

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


Re: [U-Boot] [PATCH] mxc: Make gpio_get_value() use PSR

2012-08-23 Thread Stefano Babic
On 20/08/2012 22:55, Benoît Thébaudeau wrote:
> gpio_get_value() should use PSR like Linux, not DR, because DR does not always
> reflect the pin state, while PSR does. This is especially useful to detect a
> short circuit on a GPIO pin configured as output, or to read the level of a 
> pin
> controlled by a non-GPIO IOMUX function.
> 
> Signed-off-by: Benoît Thébaudeau 
> Cc: Stefano Babic 
> ---
> This patch depends on http://patchwork.ozlabs.org/patch/178694/ .
> 
>  .../drivers/gpio/mxc_gpio.c|2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c 
> u-boot-imx-84ab1cb/drivers/gpio/mxc_gpio.c
> index 6615535..e9bf278 100644
> --- u-boot-imx-84ab1cb.orig/drivers/gpio/mxc_gpio.c
> +++ u-boot-imx-84ab1cb/drivers/gpio/mxc_gpio.c
> @@ -116,7 +116,7 @@ int gpio_get_value(unsigned gpio)
>  
>   regs = (struct gpio_regs *)gpio_ports[port];
>  
> - val = (readl(®s->gpio_dr) >> gpio) & 0x01;
> + val = (readl(®s->gpio_psr) >> gpio) & 0x01;
>  
>   return val;
>  }
> 

Applied to u-boot-imx, thanks.

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 V3 1/4] [MIPS] Add support for MIPS64 cpus

2012-08-23 Thread Zhi-zhou Zhang
On Thu, Aug 23, 2012 at 11:07 AM, Mike Frysinger  wrote:

> On Monday 20 August 2012 10:22:23 Zhizhou Zhang wrote:
> > +void __weak _machine_restart(void)
> > +{
> > +}
>
> this should be:
> void __noreturn __weak _machine_restart(void)
> {
> while (1);
> }
>
> there should also be a prototype for this in one of the mips64 headers
>
> > +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> > +{
> > + _machine_restart();
> > +
> > + fprintf(stderr, "*** reset failed ***\n");
> > + return 0;
> > +}
>
> then this would be:
> int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> {
> _machine_restart();
> }
> -mike
>

Yes, you are right. thanks

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


Re: [U-Boot] [PATCH 3/5] Add fuse API and commands

2012-08-23 Thread Eric Nelson

On 08/23/2012 03:31 AM, Stefano Babic wrote:

On 22/08/2012 12:43, Dirk Behme wrote:

On 14.08.2012 14:52, Benoît Thébaudeau wrote:

This can be useful for fuse-like hardware, OTP SoC options, etc.


For i.MX6, I have a port of the OTP support from Freescale's U-Boot to
our mainline U-Boot in the queue [1].

As I don't have the overview over the various i.MXxx SoCs and don't
understand much of this patch below: Should this implement the same
functionality like my patch [1] for i.MX6?


I have not checked the details. but seeing the code it looks that the
procedure to read / write are different. In this case, a further driver
is ok.

Anyway, you should take a look if your patches can be used on a mxs
(MX28) device, because they should be closer. And then I will not like
to have a driver for each SOC.

Generally, I think we should use the approach of the common command and
a specific fuse implementation. Then this API should be used by your
patches as well.


I agree.

The use of the fuse API will likely result in more code than the
imxotp implementation, and more importantly, it will make the usage
more confusing by introducing terms bank and row.

Reading and writing fuses is probably not an area that we want
confusion.

Regards,


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


Re: [U-Boot] [PATCH v3 16/19] ARM: SPL: Convert davinci to CONFIG_SPL_FRAMEWORK

2012-08-23 Thread Christian Riesch
Hi Tom,

On Thu, Aug 23, 2012 at 1:19 AM, Tom Rini  wrote:
> - Convert the non-relocation part of board_init_f to spl_board_init,
>   turn on CONFIG_SPL_BOARD_INIT in the configs.
> - Remove duplicated code.
> - Add spl_boot_device() that returns the statically chosen boot device.
>
> Signed-off-by: Tom Rini 
[...]
> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c 
> b/arch/arm/cpu/arm926ejs/davinci/spl.c
> index 74632e5..46c0bfd 100644
> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> @@ -21,6 +21,7 @@
>   * MA 02111-1307 USA
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -29,14 +30,7 @@
>  #include 
>  #include 
>
> -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> -
> -DECLARE_GLOBAL_DATA_PTR;
> -/* Define global data structure pointer to it*/
> -static gd_t gdata __attribute__ ((section(".data")));
> -static bd_t bdata __attribute__ ((section(".data")));
> -
> -#else
> +#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
>
>  void puts(const char *str)
>  {
> @@ -54,43 +48,37 @@ void putc(char c)
>
>  #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
>
> -inline void hang(void)
> -{
> -   puts("### ERROR ### Please RESET the board ###\n");
> -   for (;;)
> -   ;
> -}
> -
>  void board_init_f(ulong dummy)
>  {
> +   /* First, perform our low-level init. */
>  #ifdef CONFIG_SOC_DM365
> dm36x_lowlevel_init(0);
>  #endif
>  #ifdef CONFIG_SOC_DA8XX
> arch_cpu_init();
>  #endif
> -   relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE);
> +
> +   /*
> +* Next we call relocate_code() with relocation target same as the
> +* CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting
> +* skipped. Instead, only .bss initialization will happen.
> +*/
> +   relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);
>  }
>
> -void board_init_r(gd_t *id, ulong dummy)
> +void spl_board_init(void)
>  {
> -#ifdef CONFIG_SPL_NAND_LOAD
> -   nand_init();
> -   puts("Nand boot...\n");
> -   nand_boot();
> -#endif
> -#ifdef CONFIG_SPL_SPI_LOAD
> -   mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
> -   CONFIG_SYS_MALLOC_LEN);
> -
> -   gd = &gdata;
> -   gd->bd = &bdata;
> -   gd->flags |= GD_FLG_RELOC;
> -   gd->baudrate = CONFIG_BAUDRATE;
> -   serial_init();  /* serial communications setup */
> -   gd->have_console = 1;
> +   preloader_console_init();
> +}
>
> -   puts("SPI boot...\n");
> -   spi_boot();
> +u32 spl_boot_device(void)
> +{
> +#ifdef CONFIG_SPL_NAND_LOAD
> +   return BOOT_DEVICE_NAND;
> +#elif defined(CONFIG_SPL_SPI_LOAD)
> +   return BOOT_DEVICE_SPI;
> +#else

This will not apply on u-boot-ti since it is missing the MMC-SPL
patches that have already been merged, right?
Regards, Christian

> +   puts("Unknown boot device\n");
> +   hang();
>  #endif
>  }
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 17/19] da850: Add README.da850

2012-08-23 Thread Christian Riesch
Hi Tom,

On Thu, Aug 23, 2012 at 1:19 AM, Tom Rini  wrote:
> This file documents when to build for da850evm and when to build for
> da850_am18xxevm.  It also documents how to write the u-boot.ais file to
> persistent storage (such as SPI), in some cases as well as how to write
> a recovery image.
>
> Signed-off-by: Tom Rini 
> ---
> Changes in v2:
> - Add
>
> Changes in v3:
> - Fix thinko, Nand -> SPI (spotted by Prabhakar Lad)
> - Rename to README.da850, add more direct recovery method (Christian Riesch)
>
>  board/davinci/da8xxevm/README.da850 |   62 
> +++
>  1 file changed, 62 insertions(+)
>  create mode 100644 board/davinci/da8xxevm/README.da850
>
> diff --git a/board/davinci/da8xxevm/README.da850 
> b/board/davinci/da8xxevm/README.da850
> new file mode 100644
> index 000..55291f3
> --- /dev/null
> +++ b/board/davinci/da8xxevm/README.da850
> @@ -0,0 +1,62 @@
> +Summary
> +===
> +The README is for the boot procedure used for various DA850 (or compatible
> +parts such as the AM1808) based boards.
> +
> +The board is booted in three stages. The initial bootloader which executes
> +upon reset is the ROM Boot Loader (RBL) which sits in the internal ROM. The
> +RBL initializes the memory and then depending on the exact board will

The RBL can initialize the PLLs and the memory (I assume you are
talking about DDR/SDRAM here), but only if the AIS tells it to do so
and provides the configuration data like timing etc. However, for the
da850evm configuration the AIS only tells the RBL to copy the SPL to
the internal SRAM of the SoC. Then, the SPL initializes the DDR
memory.

Actually we wouldn't need SPL to boot from SPI on the da850. We could
as well do memory initialization with AIS/RBL and then let the RBL
copy u-boot to DDR memory. The reason why I introduced SPL for booting
from SPI here is that it gives us more flexibility, e.g. on my custom
board I must check the board revision before configuring the PLLs
because I have different oscillator frequencies on different
revisions.

> +initialize another controller (such as SPI or NAND) to continue the boot
> +process.
> +
> +AIS is an image format defined by TI for the images that are to be
> +loaded to memory by the RBL. The image is divided into a series of
> +sections and the image's entry point is specified. Each section comes
> +with meta data like the target address the section is to be copied to
> +and the size of the section, which is used by the RBL to load the
> +image. At the end of the image the RBL jumps to the image entry
> +point.
> +
> +The secondary stage bootloader (SPL) which is loaded by the RBL then

... initializes the PLLs and the memory controller and ...

> loads
> +the u-boot from a predefined location in persistent storage to DDR and
> +jumps to the u-boot entry point.
> +
> +
> +Compilation
> +===
> +The exact build target you need will depend on the board you have.  For
> +Logic PD boards, or other boards which store the ethernet MAC address at
> +the end of SPI flash, run 'make da850evm'.  For boards which store the
> +ethernet MAC address in the i2c EEPROM located at 0x50, run
> +'make da850_am18xxevm'.  Once this build completes you will have a
> +u-boot.ais file that needs to be written to the correct persistent
> +storage.
> +
> +
> +Flashing the images to SPI
> +==
> +The AIS image can be written to SPI flash using the following commands.
> +Assuming that the network is configured and enabled and the u-boot.ais file
> +is tftp'able.
> +
> +U-Boot > sf probe 0
> +U-Boot > sf erase 0 +32
> +U-Boot > tftp u-boot.ais
> +U-Boot > sf write c070 0 $filesize
> +
> +
> +Recovery
> +
> +
> +In the case of a "bricked" board, you need to use the TI tools found
> +here[1] to write the u-boot.ais file.  An example of recovering to the SPI
> +flash would be:
> +
> +$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \
> +   -flash_noubl /path/to/u-boot.ais
> +

I believe for the OMAP-L138 boards you will need -targetType OMAPL138
(or just omit the option because OMAPL138 is the default).

Thanks!
Regards, Christian

> +
> +Links
> +=
> +[1]
> + 
> http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L137
> --
> 1.7.9.5
>
> ___
> 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


Re: [U-Boot] [PATCH v3 0/19] ARM: SPL: Make more generic, merge DaVinci and OMAP

2012-08-23 Thread Christian Riesch
Hi Tom,

On Thu, Aug 23, 2012 at 1:19 AM, Tom Rini  wrote:
> 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
> - Add CONFIG_SYS_SPL_MALLOC_START / SIZE defines from Christian Riesch
> - 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.

Tested it on the LogicPD AM1808 experimenter's kit, works fine now :-)
Thanks!
Christian

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


Re: [U-Boot] [PATCH v3 0/19] ARM: SPL: Make more generic, merge DaVinci and OMAP

2012-08-23 Thread Stefano Babic
On 23/08/2012 01:19, Tom Rini wrote:
> 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.
> 

Nice Work !

Tested on a MX35 board.

Acked-by: Stefano Babic 

Regards,
Stefano

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


[U-Boot] [PATCH 6/6 v2] arm:exynos4:universal: Eliminated low level init

2012-08-23 Thread Piotr Wilczek
Low level initialisation is done by another bootloader

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
Changes for v2:
- no changes

 board/samsung/universal_c210/Makefile|1 -
 board/samsung/universal_c210/lowlevel_init.S |  395 --
 board/samsung/universal_c210/universal.c |8 +
 include/configs/s5pc210_universal.h  |2 +
 4 files changed, 10 insertions(+), 396 deletions(-)
 delete mode 100644 board/samsung/universal_c210/lowlevel_init.S

diff --git a/board/samsung/universal_c210/Makefile 
b/board/samsung/universal_c210/Makefile
index bfec08f..587cc1b 100644
--- a/board/samsung/universal_c210/Makefile
+++ b/board/samsung/universal_c210/Makefile
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(BOARD).o
 
 COBJS-y:= universal.o onenand.o
-SOBJS  := lowlevel_init.o
 
 SRCS:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
diff --git a/board/samsung/universal_c210/lowlevel_init.S 
b/board/samsung/universal_c210/lowlevel_init.S
deleted file mode 100644
index dc7f69e..000
--- a/board/samsung/universal_c210/lowlevel_init.S
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Lowlevel setup for universal board based on EXYNOS4210
- *
- * Copyright (C) 2010 Samsung Electronics
- * Kyungmin Park 
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include 
-#include 
-#include 
-#include 
-
-/*
- * Register usages:
- *
- * r5 has zero always
- * r7 has GPIO part1 base 0x1140
- * r6 has GPIO part2 base 0x1100
- */
-
-   .globl lowlevel_init
-lowlevel_init:
-   mov r11, lr
-
-   /* r5 has always zero */
-   mov r5, #0
-
-   ldr r7, =EXYNOS4_GPIO_PART1_BASE
-   ldr r6, =EXYNOS4_GPIO_PART2_BASE
-
-   /* System Timer */
-   ldr r0, =EXYNOS4_SYSTIMER_BASE
-   ldr r1, =0x5000
-   str r1, [r0, #0x0]
-   ldr r1, =0x
-   str r1, [r0, #0x8]
-   ldr r1, =0x49
-   str r1, [r0, #0x4]
-
-   /* PMIC manual reset */
-   /* nPOWER: XEINT_23: GPX2[7] */
-   add r0, r6, #0xC40  @ EXYNOS4_GPIO_X2_OFFSET
-   ldr r1, [r0, #0x0]
-   bic r1, r1, #(0xf << 28)@ 28 = 7 * 4-bit
-   orr r1, r1, #(0x1 << 28)@ Output
-   str r1, [r0, #0x0]
-
-   ldr r1, [r0, #0x4]
-   orr r1, r1, #(1 << 7)   @ 7 = 7 * 1-bit
-   str r1, [r0, #0x4]
-
-   /* init system clock */
-   bl  system_clock_init
-
-   /* Disable Watchdog */
-   ldr r0, =EXYNOS4_WATCHDOG_BASE  @0x1006
-   str r5, [r0]
-
-   /* UART */
-   bl  uart_asm_init
-
-   /* PMU init */
-   bl  system_power_init
-
-   bl  tzpc_init
-
-   mov lr, r11
-   mov pc, lr
-   nop
-   nop
-   nop
-
-/*
- * uart_asm_init: Initialize UART's pins
- */
-uart_asm_init:
-   /*
-* setup UART0-UART4 GPIOs (part1)
-* GPA1CON[3] = I2C_3_SCL (3)
-* GPA1CON[2] = I2C_3_SDA (3)
-*/
-   mov r0, r7
-   ldr r1, =0x
-   str r1, [r0, #0x00] @ EXYNOS4_GPIO_A0_OFFSET
-   ldr r1, =0x00223322
-   str r1, [r0, #0x20] @ EXYNOS4_GPIO_A1_OFFSET
-
-   /* UART_SEL GPY4[7] (part2) at EXYNOS4 */
-   add r0, r6, #0x1A0  @ EXYNOS4_GPIO_Y4_OFFSET
-   ldr r1, [r0, #0x0]
-   bic r1, r1, #(0xf << 28)@ 28 = 7 * 4-bit
-   orr r1, r1, #(0x1 << 28)
-   str r1, [r0, #0x0]
-
-   ldr r1, [r0, #0x8]
-   bic r1, r1, #(0x3 << 14)@ 14 = 7 * 2-bit
-   orr r1, r1, #(0x3 << 14)@ Pull-up enabled
-   str r1, [r0, #0x8]
-
-   ldr r1, [r0, #0x4]
-   orr r1, r1, #(1 << 7)   @ 7 = 7 * 1-bit
-   str r1, [r0, #0x4]
-
-   mov pc, lr
-   nop
-   nop
-   nop
-
-system_clock_init:
-   ldr r0, =EXYNOS4_CLOCK_BASE
-
-   /* APLL(1), MPLL(1), CORE(0), HPM(0) */
-   ldr r1, =0x0101
-   ldr r2, =0x14200@ CLK_

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

2012-08-23 Thread Piotr Wilczek
This patch use the pinmux for mmc configuration for Trats

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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;
}
 
/*
@@ -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);
}
 
-- 
1.7.5.4

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


[U-Boot] [PATCH 5/6 v2] arm:exynos4:universal: Use pinmux for mmc configuration

2012-08-23 Thread Piotr Wilczek
This patch use the pinmux for mmc configuration for Universal C210

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
Changes for v2:
- mmc initialisation using pinmux

 board/samsung/universal_c210/universal.c |   70 ++---
 1 files changed, 15 insertions(+), 55 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index 90fff5c..f6bc51d 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -177,7 +178,7 @@ int checkboard(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-   int i, err;
+   int err;
 
switch (get_hwrev()) {
case 0:
@@ -199,46 +200,12 @@ int board_mmc_init(bd_t *bis)
break;
}
 
-   /*
-* 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(&gpio2->k0, i, 0x2);
-   /* GPK0[0:6] pull disable */
-   s5p_gpio_set_pull(&gpio2->k0, i, GPIO_PULL_NONE);
-   /* GPK0[0:6] drv 4x */
-   s5p_gpio_set_drv(&gpio2->k0, i, GPIO_DRV_4X);
-   }
-
-   for (i = 3; i < 7; i++) {
-   /* GPK1[3:6] special function 3 */
-   s5p_gpio_cfg_pin(&gpio2->k1, i, 0x3);
-   /* GPK1[3:6] pull disable */
-   s5p_gpio_set_pull(&gpio2->k1, i, GPIO_PULL_NONE);
-   /* GPK1[3:6] drv 4x */
-   s5p_gpio_set_drv(&gpio2->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;
}
 
-   /* T-flash detect */
-   s5p_gpio_cfg_pin(&gpio2->x3, 4, 0xf);
-   s5p_gpio_set_pull(&gpio2->x3, 4, GPIO_PULL_UP);
-
/*
 * MMC device init
 * mmc0  : eMMC (8-bit buswidth)
@@ -246,28 +213,21 @@ int board_mmc_init(bd_t *bis)
 */
err = s5p_mmc_init(0, 8);
 
+   /* T-flash detect */
+   s5p_gpio_cfg_pin(&gpio2->x3, 4, 0xf);
+   s5p_gpio_set_pull(&gpio2->x3, 4, GPIO_PULL_UP);
+
/*
 * Check the T-flash  detect pin
 * GPX3[4] T-flash detect pin
 */
if (!s5p_gpio_get_value(&gpio2->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(&gpio2->k2, i, 0x2);
-   /* GPK2[0:6] pull disable */
-   s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE);
-   /* GPK2[0:6] drv 4x */
-   s5p_gpio_set_drv(&gpio2->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);
}
 
-- 
1.7.5.4

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


[U-Boot] [PATCH 3/6 v2] arm:exynos4:pinmux: Modify the gpio function for mmc

2012-08-23 Thread Piotr Wilczek
This patch add pinmux settings for Exynos4 for mmc0 and mmc2

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
Changes for v2:
- mmc initialisation code moved to pinmux instead of creating a new common code 
file

 arch/arm/cpu/armv7/exynos/pinmux.c|   56 +
 arch/arm/include/asm/arch-exynos/periph.h |1 +
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
b/arch/arm/cpu/armv7/exynos/pinmux.c
index d2b7d2c..84ee05c 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -209,10 +209,66 @@ static int exynos5_pinmux_config(int peripheral, int 
flags)
return 0;
 }
 
+static int exynos4_mmc_config(int peripheral, int flags)
+{
+   struct exynos4_gpio_part2 *gpio2 =
+   (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
+   struct s5p_gpio_bank *bank, *bank_ext;
+   int i;
+
+   switch (peripheral) {
+   case PERIPH_ID_SDMMC0:
+   bank = &gpio2->k0;
+   bank_ext = &gpio2->k1;
+   break;
+   case PERIPH_ID_SDMMC2:
+   bank = &gpio2->k2;
+   bank_ext = &gpio2->k3;
+   break;
+   }
+   for (i = 0; i < 7; i++) {
+   if (i == 2)
+   continue;
+   s5p_gpio_cfg_pin(bank, i,  GPIO_FUNC(0x2));
+   s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
+   s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
+   }
+   if (flags & PINMUX_FLAG_8BIT_MODE) {
+   for (i = 3; i < 7; i++) {
+   s5p_gpio_cfg_pin(bank_ext, i,  GPIO_FUNC(0x3));
+   s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE);
+   s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
+   }
+   }
+
+   return 0;
+}
+
+static int exynos4_pinmux_config(int peripheral, int flags)
+{
+   switch (peripheral) {
+   case PERIPH_ID_SDMMC0:
+   case PERIPH_ID_SDMMC2:
+   return exynos4_mmc_config(peripheral, flags);
+   case PERIPH_ID_SDMMC1:
+   case PERIPH_ID_SDMMC3:
+   case PERIPH_ID_SDMMC4:
+   printf("SDMMC device %d not implemented\n", peripheral);
+   return -1;
+   default:
+   debug("%s: invalid peripheral %d", __func__, peripheral);
+   return -1;
+   }
+
+   return 0;
+}
+
 int exynos_pinmux_config(int peripheral, int flags)
 {
if (cpu_is_exynos5())
return exynos5_pinmux_config(peripheral, flags);
+   else if (cpu_is_exynos4())
+   return exynos4_pinmux_config(peripheral, flags);
else {
debug("pinmux functionality not supported\n");
return -1;
diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
b/arch/arm/include/asm/arch-exynos/periph.h
index 5db25aa..4e1da82 100644
--- a/arch/arm/include/asm/arch-exynos/periph.h
+++ b/arch/arm/include/asm/arch-exynos/periph.h
@@ -34,6 +34,7 @@ enum periph_id {
PERIPH_ID_SDMMC1,
PERIPH_ID_SDMMC2,
PERIPH_ID_SDMMC3,
+   PERIPH_ID_SDMMC4,
PERIPH_ID_SROMC,
PERIPH_ID_UART0,
PERIPH_ID_UART1,
-- 
1.7.5.4

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


[U-Boot] [PATCH 2/6 v2] arm:exynos4:trats: Fix SDRAM size

2012-08-23 Thread Piotr Wilczek
Full 1GiB is visible

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
Changes for v2:
- no chages

 board/samsung/trats/trats.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index a8b2b11..f5df56c 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -76,7 +76,9 @@ int board_init(void)
 int dram_init(void)
 {
gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
-   get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
+   get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE) +
+   get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE) +
+   get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
 
return 0;
 }
@@ -87,6 +89,10 @@ void dram_init_banksize(void)
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+   gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+   gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+   gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+   gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
 }
 
 static unsigned int get_hw_revision(void)
-- 
1.7.5.4

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


[U-Boot] [PATCH 1/6 v2] arm:exynos4:trats: Correct SDRAM configuration for trats

2012-08-23 Thread Piotr Wilczek
SDRAM setup alike to ORIGEN Dev board.

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
CC: Minkyu Kang 
---
Changes for v2:
- no changes

 include/configs/trats.h |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 185cb68..f391227 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -170,12 +170,17 @@
 /* Stack sizes */
 #define CONFIG_STACKSIZE   (256 << 10) /* regular stack 256KB */
 
-/* TRATS has 2 banks of DRAM */
-#define CONFIG_NR_DRAM_BANKS   2
-#define PHYS_SDRAM_1   CONFIG_SYS_SDRAM_BASE   /* LDDDR2 DMC 0 */
-#define PHYS_SDRAM_1_SIZE  (512 << 20) /* 512 MB in CS 0 */
-#define PHYS_SDRAM_2   0x5000  /* LPDDR2 DMC 1 */
-#define PHYS_SDRAM_2_SIZE  (512 << 20) /* 512 MB in CS 0 */
+/* TRATS has 4 banks of DRAM */
+#define CONFIG_NR_DRAM_BANKS   4
+#define SDRAM_BANK_SIZE(256UL << 20UL) /* 256 MB */
+#define PHYS_SDRAM_1   CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_1_SIZE  SDRAM_BANK_SIZE
+#define PHYS_SDRAM_2   (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE)
+#define PHYS_SDRAM_2_SIZE  SDRAM_BANK_SIZE
+#define PHYS_SDRAM_3   (CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_3_SIZE  SDRAM_BANK_SIZE
+#define PHYS_SDRAM_4   (CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_4_SIZE  SDRAM_BANK_SIZE
 
 #define CONFIG_SYS_MEM_TOP_HIDE(1 << 20)   /* ram console 
*/
 
-- 
1.7.5.4

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


[U-Boot] [PATCH 0/6 v2] Code cleaup for trats and universal

2012-08-23 Thread Piotr Wilczek
This patch fixes SDRAM configuration and size visibility fot Trats board.

Code for MMC initialisation is moved from board file to pinmux.
MMC0 and MMC2 are supported. Both tested on Trats and Universal C210 boards.
MMC initialisation for boards Trats and Universal C210 is done using pinmux.

Low level initialisation in u-boot is eliminated as it done by
previous bootloader.

Piotr Wilczek (6):
  arm:exynos4:trats: Correct SDRAM configuration for trats
  arm:exynos4:trats: Fix SDRAM size
  arm:exynos4:pinmux: Modify the gpio function for mmc
  arm:exynos4:trats: Use pinmux for mmc configuration
  arm:exynos4:universal: Use pinmux for mmc configuration
  arm:exynos4:universal: Eliminated low level init

 arch/arm/cpu/armv7/exynos/pinmux.c   |   56 
 arch/arm/include/asm/arch-exynos/periph.h|1 +
 board/samsung/trats/trats.c  |   70 ++
 board/samsung/universal_c210/Makefile|1 -
 board/samsung/universal_c210/lowlevel_init.S |  395 --
 board/samsung/universal_c210/universal.c |   78 ++
 include/configs/s5pc210_universal.h  |2 +
 include/configs/trats.h  |   17 +-
 8 files changed, 111 insertions(+), 509 deletions(-)
 delete mode 100644 board/samsung/universal_c210/lowlevel_init.S

-- 
1.7.5.4

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


Re: [U-Boot] [PATCH v3 0/19] ARM: SPL: Make more generic, merge DaVinci and OMAP

2012-08-23 Thread Stefan Roese
Hi Tom,

On 08/23/2012 01:19 AM, Tom Rini wrote:
> 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

As you might have seen, I based my powerpc SPL NOR flash booting series
on this series (git repository):

http://www.mail-archive.com/u-boot@lists.denx.de/msg91443.html

Nice work, thanks.

So, for the generic SPL patches of your series:

Acked-by: Stefan Roese 

Thanks,
Stefan

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


Re: [U-Boot] [PATCH V2] SPL: do not use fix value for u-boot size

2012-08-23 Thread Stefan Roese
On 08/23/2012 12:46 PM, Stefano Babic wrote:
> If an u-boot image is not found, SPL thinks to load a bare
> u-boot.bin image with a maximum size of 200KB.
> Use CONFIG_SYS_MONITOR_LEN instead.
> 
> Signed-off-by: Stefano Babic 
> CC: Tom Rini 
> CC: Stefan Roese 

Acked-by: Stefan Roese 

Thanks,
Stefan

___
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-23 Thread Stefan Roese
Hi Pavel,

On 08/23/2012 12:43 PM, Pavel Machek wrote:
 +static unsigned long spl_parse_image_header(const struct image_header
 *header) +{
 +  /* checking for mkimage signature */
 +  if (__be32_to_cpu(header->ih_magic) == IH_MAGIC) {
 +  /* Valid image. Extract information out of header */
 +  spl_image.size = __be32_to_cpu(header->ih_size);
 +  spl_image.entry_point = __be32_to_cpu(header->ih_load);
 +  spl_image.load_addr = __be32_to_cpu(header->ih_load);
 +  spl_image.os = header->ih_os;
 +  spl_image.name = (const char *)&header->ih_name;
 +  spl_image.crc = __be32_to_cpu(header->ih_dcrc);
 +  debug("Subsequent boot image info\n");
 +  debug("   Image Name:   %.*s\n", IH_NMLEN, spl_image.name);
 +  debug("   Data Size:%d\n", spl_image.size);
 +  debug("   Load Address: 0x%x\n", spl_image.load_addr);
 +  debug("   Entry Point:  0x%X\n", spl_image.entry_point);
 +  } else {
 +  /* Not a valid image as mkimage signature not found */
 +  printf("Error : mkimage signature not found - ih_magic = %x\n",
 +  header->ih_magic);
 +  return 1;
 +  }
 +
 +  /* Checking image type. Do any customize stuff per image type here */
 +  switch (spl_image.os) {
 +  case IH_OS_U_BOOT:
 +  debug("   Image Type:   U-Boot\n");
 +  break;
 +  default:
 +  printf("   Image Type:   Unknown (%d)\n", spl_image.os);
 +  ;
 +  }
 +  return 0;
 +}
>>>
>>> I think I don't even wanna know what's the purpose here :-)
>>
>> 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?

Yes, that might happen. But we learned in the past that if we don't try
to do such code consolidations right from the beginning, it won't happen
at all (most of the time). So I'm also in favor of using the common SPL
framework now. Please take a look at Tom Rini's v3 series:

http://www.mail-archive.com/u-boot@lists.denx.de/msg91405.html

I also based my powerpc SPL NOR flash booting series on it:

http://www.mail-archive.com/u-boot@lists.denx.de/msg91443.html

Thanks,
Stefan


___
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-23 Thread Pavel Machek
On Wed 2012-08-22 18:13:53, Tom Rini wrote:
> On Thu, Aug 23, 2012 at 12:26:53AM +0200, Marek Vasut wrote:
> > Dear dingu...@altera.com,
> > 
> > > From: Dinh Nguyen 
> > > 
> > > Add minimal support for Altera's SOCFPGA Cyclone 5 hardware.
> > > 
> > > Signed-off-by: Dinh Nguyen 
> > > Signed-off-by: Pavel Machek 
> > 
> > [...]
> > 
> > Please CC albert with new arches.
> > 
> > > diff --git a/Makefile b/Makefile
> > > index 5ce5cc3..12aa372 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -369,7 +369,7 @@ BOARD_SIZE_CHECK =
> > >  endif
> > > 
> > >  # Always append ALL so that arch config.mk's can add custom ones
> > > -ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
> > > +ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)u-boot.img
> > > $(obj)System.map
> > 
> > This won't slide
> 
> You can place this into arch/arm/cpu/armv7/socfpga/config.mk (see
> am33xx/config.mk or any of the others) for examples.

Thanks. This does the trick.
Pavel

commit aa0c16f34948deb16f1d64417c0ce119a721103b
Author: Pavel 
Date:   Thu Aug 23 12:54:51 2012 +0200

Move build of u-boot.img to config.mk from main Makefile.

diff --git a/Makefile b/Makefile
index f12ccbe..73c8e39 100644
--- a/Makefile
+++ b/Makefile
@@ -374,7 +374,7 @@ BOARD_SIZE_CHECK =
 endif
 
 # Always append ALL so that arch config.mk's can add custom ones
-ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)u-boot.img $(obj)System.map
+ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
diff --git a/arch/arm/cpu/armv7/socfpga/config.mk 
b/arch/arm/cpu/armv7/socfpga/config.mk
new file mode 100644
index 000..b72ed1e
--- /dev/null
+++ b/arch/arm/cpu/armv7/socfpga/config.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.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 "as is" WITHOUT ANY WARRANTY of any
+# kind, whether express or implied; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+ifndef CONFIG_SPL_BUILD
+ALL-y  += $(obj)u-boot.img
+endif


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
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-23 Thread Pavel Machek
Hi!

> > +/*
> > + * Release peripherals from reset based on handoff
> > + */
> > +void reset_deassert_peripherals_handoff(void)
> > +{
> > +   unsigned int val = 0;
> > +   writel(val, &reset_manager_base->per_mod_reset);
> 
> writel(0, ...

Ok.

> > +int dram_init(void)
> > +{
> > +   gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
> > +   return 0;
> > +}
> 
> Can all this be concentrated into single file (reset, sdram, etc. all those 
> small functions).

I created misc.c with those.

> > +   }
> > +   return 0;
> > +}
> 
> I think I don't even wanna know what's the purpose here :-)

Lets leave SPL for next mail :-).
Pavel

commit ae990b2c7d7ffd0d57e594ec6cdadb769dcc2a9b
Author: Pavel 
Date:   Thu Aug 23 12:48:59 2012 +0200

Cleanups suggested by Marek Vasut: use constant zero instead of
assigning it to variable, merge reset_manager.c and sdram.c into
misc.c

Signed-off-by: Pavel Machek 

diff --git a/arch/arm/cpu/armv7/socfpga/Makefile 
b/arch/arm/cpu/armv7/socfpga/Makefile
index e4c1213..376a4bd 100644
--- a/arch/arm/cpu/armv7/socfpga/Makefile
+++ b/arch/arm/cpu/armv7/socfpga/Makefile
@@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk
 LIB=  $(obj)lib$(SOC).o
 
 SOBJS  := lowlevel_init.o
-COBJS-y:= reset_manager.o sdram.o timer.o
+COBJS-y:= misc.o timer.o
 COBJS-$(CONFIG_SPL_BUILD) += spl.o
 
 COBJS  := $(COBJS-y)
diff --git a/arch/arm/cpu/armv7/socfpga/misc.c 
b/arch/arm/cpu/armv7/socfpga/misc.c
new file mode 100644
index 000..f0229e8
--- /dev/null
+++ b/arch/arm/cpu/armv7/socfpga/misc.c
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2012 Altera Corporation 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct socfpga_reset_manager *reset_manager_base =
+   (void *)SOCFPGA_RSTMGR_ADDRESS;
+
+/*
+ * Write the reset manager register to cause reset
+ */
+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 */
+   while (1)
+   ;
+}
+
+/*
+ * Release peripherals from reset based on handoff
+ */
+void reset_deassert_peripherals_handoff(void)
+{
+   writel(0, &reset_manager_base->per_mod_reset);
+}
+
+int dram_init(void)
+{
+   gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
+   return 0;
+}
diff --git a/arch/arm/cpu/armv7/socfpga/reset_manager.c 
b/arch/arm/cpu/armv7/socfpga/reset_manager.c
deleted file mode 100644
index b0fa211..000
--- a/arch/arm/cpu/armv7/socfpga/reset_manager.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Copyright (C) 2012 Altera Corporation 
- *
- * 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, see .
- */
-
-#include 
-#include 
-#include 
-
-static const struct socfpga_reset_manager *reset_manager_base =
-   (void *)SOCFPGA_RSTMGR_ADDRESS;
-
-/*
- * Write the reset manager register to cause reset
- */
-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 */
-   while (1)
-   ;
-}
-
-/*
- * Release peripherals from reset based on handoff
- */
-void reset_deassert_peripherals_handoff(void)
-{
-   unsigned int val = 0;
-   writel(val, &reset_manager_base->per_mod_reset);
-}
diff --git a/arch/arm/cpu/armv7/socfpga/sdram.c 
b/arch/arm/cpu/armv7/socfpga/sdram.c
deleted file mode 100644
index 6714983..000
--- a/arch/arm/cpu/armv7/socfpga/sdram.c

[U-Boot] [PATCH V2] SPL: do not use fix value for u-boot size

2012-08-23 Thread Stefano Babic
If an u-boot image is not found, SPL thinks to load a bare
u-boot.bin image with a maximum size of 200KB.
Use CONFIG_SYS_MONITOR_LEN instead.

Signed-off-by: Stefano Babic 
CC: Tom Rini 
CC: Stefan Roese 
---

Changes:

- move the #ifdef out of the C code (Stefan Roese)

 common/spl/spl.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7d15460..d9e4b62 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -36,6 +36,10 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifndef CONFIG_SYS_MONITOR_LEN
+#define CONFIG_SYS_MONITOR_LEN (200 * 1024)
+#endif
+
 u32* boot_params_ptr = NULL;
 struct spl_image_info spl_image;
 
@@ -100,7 +104,7 @@ void spl_parse_image_header(const struct image_header 
*header)
debug("mkimage signature not found - ih_magic = %x\n",
header->ih_magic);
/* Let's assume U-Boot will not be more than 200 KB */
-   spl_image.size = 200 * 1024;
+   spl_image.size = CONFIG_SYS_MONITOR_LEN;
spl_image.entry_point = CONFIG_SYS_TEXT_BASE;
spl_image.load_addr = CONFIG_SYS_TEXT_BASE;
spl_image.os = IH_OS_U_BOOT;
-- 
1.7.9.5

___
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-23 Thread Pavel Machek
Hi!

> > > diff --git a/Makefile b/Makefile
> > > index 5ce5cc3..12aa372 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -369,7 +369,7 @@ BOARD_SIZE_CHECK =
> > >  endif
> > > 
> > >  # Always append ALL so that arch config.mk's can add custom ones
> > > -ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
> > > +ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)u-boot.img
> > > $(obj)System.map
> > 
> > This won't slide
> 
> You can place this into arch/arm/cpu/armv7/socfpga/config.mk (see
> am33xx/config.mk or any of the others) for examples.

Thanks.

> > > +static unsigned long spl_parse_image_header(const struct image_header
> > > *header) +{
> > > + /* checking for mkimage signature */
> > > + if (__be32_to_cpu(header->ih_magic) == IH_MAGIC) {
> > > + /* Valid image. Extract information out of header */
> > > + spl_image.size = __be32_to_cpu(header->ih_size);
> > > + spl_image.entry_point = __be32_to_cpu(header->ih_load);
> > > + spl_image.load_addr = __be32_to_cpu(header->ih_load);
> > > + spl_image.os = header->ih_os;
> > > + spl_image.name = (const char *)&header->ih_name;
> > > + spl_image.crc = __be32_to_cpu(header->ih_dcrc);
> > > + debug("Subsequent boot image info\n");
> > > + debug("   Image Name:   %.*s\n", IH_NMLEN, spl_image.name);
> > > + debug("   Data Size:%d\n", spl_image.size);
> > > + debug("   Load Address: 0x%x\n", spl_image.load_addr);
> > > + debug("   Entry Point:  0x%X\n", spl_image.entry_point);
> > > + } else {
> > > + /* Not a valid image as mkimage signature not found */
> > > + printf("Error : mkimage signature not found - ih_magic = %x\n",
> > > + header->ih_magic);
> > > + return 1;
> > > + }
> > > +
> > > + /* Checking image type. Do any customize stuff per image type here */
> > > + switch (spl_image.os) {
> > > + case IH_OS_U_BOOT:
> > > + debug("   Image Type:   U-Boot\n");
> > > + break;
> > > + default:
> > > + printf("   Image Type:   Unknown (%d)\n", spl_image.os);
> > > + ;
> > > + }
> > > + return 0;
> > > +}
> > 
> > I think I don't even wanna know what's the purpose here :-)
> 
> 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?
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] atmel: sam9g10: correct the text base and move into config.mk

2012-08-23 Thread Andreas Bießmann
Dear Bo Shen,

On 23.08.2012 11:34, Bo Shen wrote:
> This patch correct the text base for at91sam9g10ek board
> Move the text base define to config.mk
> 
> Signed-off-by: Bo Shen 
> ---
>  board/atmel/at91sam9261ek/config.mk |1 +
>  include/configs/at91sam9261ek.h |1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
>  create mode 100644 board/atmel/at91sam9261ek/config.mk
> 
> diff --git a/board/atmel/at91sam9261ek/config.mk 
> b/board/atmel/at91sam9261ek/config.mk
> new file mode 100644
> index 000..e554a45
> --- /dev/null
> +++ b/board/atmel/at91sam9261ek/config.mk
> @@ -0,0 +1 @@
> +CONFIG_SYS_TEXT_BASE = 0x23f0

NAK, these configuration should go into the board config header or maybe
the boards.cfg.
For this board please read commit f7aea46d6ad9c257d2fbea7238cc8796aaa733f1

Another point is, the 23f0 is (possibly) not far enough from
position the start.S code will relocate the u-boot (depends on size of
gd_t, bd_t, malloc arena, some special env, a.s.o). That was changed in
f7aea46 by intention. Please fix at91bootstrap instead (or start
integrating at91 for common SPL framework in u-boot; still on my plan
for this year but I couldn't manage to start until yet).

> diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
> index 014437b..718ac60 100644
> --- a/include/configs/at91sam9261ek.h
> +++ b/include/configs/at91sam9261ek.h
> @@ -52,7 +52,6 @@
>  #define CONFIG_DISPLAY_CPUINFO
>  
>  #define CONFIG_ATMEL_LEGACY
> -#define CONFIG_SYS_TEXT_BASE 0x21f0
>  
>  /*
>   * Hardware drivers
> 

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


Re: [U-Boot] [PATCH 3/5] Add fuse API and commands

2012-08-23 Thread Stefano Babic
On 22/08/2012 12:43, Dirk Behme wrote:
> On 14.08.2012 14:52, Benoît Thébaudeau wrote:
>> This can be useful for fuse-like hardware, OTP SoC options, etc.
> 
> For i.MX6, I have a port of the OTP support from Freescale's U-Boot to
> our mainline U-Boot in the queue [1].
> 
> As I don't have the overview over the various i.MXxx SoCs and don't
> understand much of this patch below: Should this implement the same
> functionality like my patch [1] for i.MX6?

I have not checked the details. but seeing the code it looks that the
procedure to read / write are different. In this case, a further driver
is ok.

Anyway, you should take a look if your patches can be used on a mxs
(MX28) device, because they should be closer. And then I will not like
to have a driver for each SOC.

Generally, I think we should use the approach of the common command and
a specific fuse implementation. Then this API should be used by your
patches as well.

Best regards,
Stefano

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


Re: [U-Boot] [PATCH 4/4] efikamx: update to Efika MX Smarttop and Smartbook boards

2012-08-23 Thread Stefano Babic
On 22/08/2012 21:25, Matt Sealey wrote:
> This is a rework of a previously submitted patchset and bundles the
> main board support and USB support into a single commit.
> 
> It requires the patch "mx5: add iomux-mx51.h include"
> 
> * Use iomux-mx51.h include to simplify board configuration.
> * Simplify LED support (remove efikamx_toggle_led, change lit LEDs).
> * Simplify MMC support for CD and WP pin differences.
> * Fix broken CPU voltage setting - comment said 1.1V but the code set to
>   1.2V. It should never have been set to 1.2V even on i.MX51 TO2 and
>   all available Linux kernels would drop the voltage to 1.1V anyway and
>   work reliably. This should lower power consumption during the boot
>   process.
> * Function renames for readability.
> * Some board identification string changes to match actual product names.
> 
> Signed-off-by: Matt Sealey 
> ---
>  board/genesi/mx51_efikamx/efikamx-usb.c |  159 
>  board/genesi/mx51_efikamx/efikamx.c |  603 
> ---
>  2 files changed, 298 insertions(+), 464 deletions(-)
> 
> diff --git a/board/genesi/mx51_efikamx/efikamx-usb.c 
> b/board/genesi/mx51_efikamx/efikamx-usb.c
> index e9273d0..abd358a 100644
> --- a/board/genesi/mx51_efikamx/efikamx-usb.c
> +++ b/board/genesi/mx51_efikamx/efikamx-usb.c
> @@ -1,7 +1,7 @@
>  /*
> + * Copyright (C) 2009 Freescale Semiconductor, Inc.
>   * Copyright (C) 2010 Marek Vasut 
> - *
> - * (C) Copyright 2009 Freescale Semiconductor, Inc.
> + * Copyright (C) 2009-2012 Genesi USA, Inc.
>   *
>   * See file CREDITS for list of people who contributed to this
>   * project.
> @@ -25,9 +25,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -35,103 +33,93 @@
>  
>  #include "../../../drivers/usb/host/ehci.h"
>  
> -/* USB pin configuration */
> -#define USB_PAD_CONFIG   (PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST | \
> - PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU | \
> - PAD_CTL_HYS_ENABLE | PAD_CTL_PUE_PULL)
> -
> -/*
> - * Configure the USB H1 and USB H2 IOMUX
> - */
> -void setup_iomux_usb(void)
> -{
> - setup_iomux_usb_h1();
> -
> - if (machine_is_efikasb())
> - setup_iomux_usb_h2();
> -
> - /* USB PHY reset */
> - mxc_request_iomux(MX51_PIN_EIM_D27, IOMUX_CONFIG_ALT1);
> - mxc_iomux_set_pad(MX51_PIN_EIM_D27, PAD_CTL_PKE_ENABLE |
> - PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
> -
> - /* USB HUB reset */
> - mxc_request_iomux(MX51_PIN_GPIO1_5, IOMUX_CONFIG_ALT0);
> - mxc_iomux_set_pad(MX51_PIN_GPIO1_5, PAD_CTL_PKE_ENABLE |
> - PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
> -
> - /* WIFI EN (act low) */
> - mxc_request_iomux(MX51_PIN_EIM_A22, IOMUX_CONFIG_GPIO);
> - mxc_iomux_set_pad(MX51_PIN_EIM_A22, 0);
> - /* WIFI RESET */
> - mxc_request_iomux(MX51_PIN_EIM_A16, IOMUX_CONFIG_GPIO);
> - mxc_iomux_set_pad(MX51_PIN_EIM_A16, 0);
> - /* BT EN (act low) */
> - mxc_request_iomux(MX51_PIN_EIM_A17, IOMUX_CONFIG_GPIO);
> - mxc_iomux_set_pad(MX51_PIN_EIM_A17, 0);
> -}
> -
> -/*
> - * Enable devices connected to USB BUSes
> - */
> -static void efika_usb_enable_devices(void)
> +static iomux_v3_cfg_t efikamx_usbh1_pads[] = {
> + MX51_PAD_USBH1_CLK__USBH1_CLK,
> + MX51_PAD_USBH1_DIR__USBH1_DIR,
> + MX51_PAD_USBH1_STP__USBH1_STP,
> + MX51_PAD_USBH1_NXT__USBH1_NXT,
> + MX51_PAD_USBH1_DATA0__USBH1_DATA0,
> + MX51_PAD_USBH1_DATA1__USBH1_DATA1,
> + MX51_PAD_USBH1_DATA2__USBH1_DATA2,
> + MX51_PAD_USBH1_DATA3__USBH1_DATA3,
> + MX51_PAD_USBH1_DATA4__USBH1_DATA4,
> + MX51_PAD_USBH1_DATA5__USBH1_DATA5,
> + MX51_PAD_USBH1_DATA6__USBH1_DATA6,
> + MX51_PAD_USBH1_DATA7__USBH1_DATA7,
> +};
> +
> +static iomux_v3_cfg_t efikasb_usbh2_pads[] = {
> + MX51_PAD_EIM_A24__USBH2_CLK,
> + MX51_PAD_EIM_A25__USBH2_DIR,
> + MX51_PAD_EIM_A26__USBH2_STP,
> + MX51_PAD_EIM_A27__USBH2_NXT,
> + MX51_PAD_EIM_D16__USBH2_DATA0,
> + MX51_PAD_EIM_D17__USBH2_DATA1,
> + MX51_PAD_EIM_D18__USBH2_DATA2,
> + MX51_PAD_EIM_D19__USBH2_DATA3,
> + MX51_PAD_EIM_D20__USBH2_DATA4,
> + MX51_PAD_EIM_D21__USBH2_DATA5,
> + MX51_PAD_EIM_D22__USBH2_DATA6,
> + MX51_PAD_EIM_D23__USBH2_DATA7,
> +};
> +
> +static iomux_v3_cfg_t efikamx_usbctrl_pads[] = {
> + MX51_PAD_EIM_D27__GPIO2_9,
> + MX51_PAD_GPIO1_5__GPIO1_5,
> +};
> +
> +#define EFIKAMX_USB_HUB_RESETIMX_GPIO_NR(1, 5)
> +#define EFIKAMX_USB_PHY_RESETIMX_GPIO_NR(2, 9)
> +
> +void efikamx_usb_setup_pads(void)
>  {
> - /* Enable Bluetooth */
> - gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 0);
> - udelay(1);
> - gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 1);
> + imx_iomux_v3_setup_multiple_pads(efikamx_usbh1_pads, 
> ARRAY_SIZE(efikamx_usbh1_pads));
>  
> - /* Enable WiFi */
> - gpio_direction_output(IOMUX_TO_GPIO(MX51_P

Re: [U-Boot] [PATCH v2 1/4] efikamx: move and rename Efika MX directories and config files to prepare for new boards

2012-08-23 Thread Stefano Babic
On 22/08/2012 21:25, Matt Sealey wrote:
> * Move Efika MX Smarttop and Smartbook boards into a "genesi" vendor directory
> * Rename efikamx -> mx51_efikamx since there is an mx53_efikamx and 
> mx6_efikamx to come
> 
> Signed-off-by: Matt Sealey 
> ---
>  board/{efikamx => genesi/mx51_efikamx}/Makefile|0
>  .../{efikamx => genesi/mx51_efikamx}/efikamx-usb.c |2 +-
>  board/{efikamx => genesi/mx51_efikamx}/efikamx.c   |0
>  .../mx51_efikamx}/imximage_mx.cfg  |0
>  .../mx51_efikamx}/imximage_sb.cfg  |0
>  boards.cfg |4 ++--
>  include/configs/{efikamx.h => mx51_efikamx.h}  |0
>  7 files changed, 3 insertions(+), 3 deletions(-)
>  rename board/{efikamx => genesi/mx51_efikamx}/Makefile (100%)
>  rename board/{efikamx => genesi/mx51_efikamx}/efikamx-usb.c (99%)
>  rename board/{efikamx => genesi/mx51_efikamx}/efikamx.c (100%)
>  rename board/{efikamx => genesi/mx51_efikamx}/imximage_mx.cfg (100%)
>  rename board/{efikamx => genesi/mx51_efikamx}/imximage_sb.cfg (100%)
>  rename include/configs/{efikamx.h => mx51_efikamx.h} (100%)
> 
> diff --git a/board/efikamx/Makefile b/board/genesi/mx51_efikamx/Makefile
> similarity index 100%
> rename from board/efikamx/Makefile
> rename to board/genesi/mx51_efikamx/Makefile
> diff --git a/board/efikamx/efikamx-usb.c 
> b/board/genesi/mx51_efikamx/efikamx-usb.c
> similarity index 99%
> rename from board/efikamx/efikamx-usb.c
> rename to board/genesi/mx51_efikamx/efikamx-usb.c
> index 618b39d..e9273d0 100644
> --- a/board/efikamx/efikamx-usb.c
> +++ b/board/genesi/mx51_efikamx/efikamx-usb.c
> @@ -33,7 +33,7 @@
>  #include 
>  #include 
>  
> -#include "../../drivers/usb/host/ehci.h"
> +#include "../../../drivers/usb/host/ehci.h"
>  
>  /* USB pin configuration */
>  #define USB_PAD_CONFIG   (PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST | \
> diff --git a/board/efikamx/efikamx.c b/board/genesi/mx51_efikamx/efikamx.c
> similarity index 100%
> rename from board/efikamx/efikamx.c
> rename to board/genesi/mx51_efikamx/efikamx.c
> diff --git a/board/efikamx/imximage_mx.cfg 
> b/board/genesi/mx51_efikamx/imximage_mx.cfg
> similarity index 100%
> rename from board/efikamx/imximage_mx.cfg
> rename to board/genesi/mx51_efikamx/imximage_mx.cfg
> diff --git a/board/efikamx/imximage_sb.cfg 
> b/board/genesi/mx51_efikamx/imximage_sb.cfg
> similarity index 100%
> rename from board/efikamx/imximage_sb.cfg
> rename to board/genesi/mx51_efikamx/imximage_sb.cfg
> diff --git a/boards.cfg b/boards.cfg
> index edd750c..a9ec44b 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -215,8 +215,8 @@ integratorcp_cm946es arm arm946es
> integrator  armltd
>  ca9x4_ct_vxp arm armv7   vexpress
> armltd
>  am335x_evm   arm armv7   am335x  ti  
>am33xx
>  highbank arm armv7   highbank-   
>highbank
> -efikamx  arm armv7   efikamx -   
>mx5  
> efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/efikamx/imximage_mx.cfg
> -efikasb  arm armv7   efikamx -   
>mx5  
> efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/efikamx/imximage_sb.cfg
> +mx51_efikamx arm armv7   mx51_efikamx
> genesi mx5  
> mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg
> +mx51_efikasb arm armv7   mx51_efikamx
> genesi mx5  
> mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg
>  mx51evk  arm armv7   mx51evk 
> freescale  mx5  
> mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
>  mx53ard  arm armv7   mx53ard 
> freescale  mx5  
> mx53ard:IMX_CONFIG=board/freescale/mx53ard/imximage_dd3.cfg
>  mx53evk  arm armv7   mx53evk 
> freescale  mx5  
> mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
> diff --git a/include/configs/efikamx.h b/include/configs/mx51_efikamx.h
> similarity index 100%
> rename from include/configs/efikamx.h
> rename to include/configs/mx51_efikamx.h
> 

It is fine with me.

Acked-by: Stefano Babic 

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 m

Re: [U-Boot] [PATCH 3/4] efikamx: configure Smarttop PCBID and LED pads in DCD for convenience

2012-08-23 Thread Stefano Babic
On 22/08/2012 21:25, Matt Sealey wrote:
> PCBID pads seem to need time to settle due to external pulldowns, otherwise
> we are reading floating GPIO pins with implicit pad pullups and get the wrong
> data. However we can't "wait" at the time we need them before relocation,
> since timers are not available. The time taken to get from DCD to the code
> requiring the pads set seems to be more than long enough (even with caches
> enabled).
> 
> We have space in the DCD due to the DDR settings changes to configure all
> the pad settings we need for this, plus the LED pad settings too which
> reduces the amount of code required later on.
> 
> Signed-off-by: Matt Sealey 
> ---
>  board/genesi/mx51_efikamx/imximage_mx.cfg |   10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/board/genesi/mx51_efikamx/imximage_mx.cfg 
> b/board/genesi/mx51_efikamx/imximage_mx.cfg
> index ea6b271..38fa760 100644
> --- a/board/genesi/mx51_efikamx/imximage_mx.cfg
> +++ b/board/genesi/mx51_efikamx/imximage_mx.cfg
> @@ -45,6 +45,16 @@ BOOT_FROM  spi
>  #Address   absolute address of the register
>  #value value to be stored in the register
>  
> +# Essential GPIO settings to be done as early as possible
> +# PCBIDn pad settings are all the defaults except #2 which needs HVE off
> +DATA 4 0x73fa8134 0x3# PCBID0 ALT3 GPIO 3_16
> +DATA 4 0x73fa8130 0x3# PCBID1 ALT3 GPIO 3_17
> +DATA 4 0x73fa8128 0x3# PCBID2 ALT3 GPIO 3_11
> +DATA 4 0x73fa8504 0xe4   # PCBID2 PAD ~HVE
> +DATA 4 0x73fa8198 0x3# LED0 ALT3 GPIO 3_13
> +DATA 4 0x73fa81c4 0x3# LED1 ALT3 GPIO 3_14
> +DATA 4 0x73fa81c8 0x3# LED2 ALT3 GPIO 3_15
> +
>  # DDR bus IOMUX PAD settings
>  DATA 4 0x73fa850c 0x20c5 # SDODT1
>  DATA 4 0x73fa8510 0x20c5 # SDODT0
> 

Acked-by: Stefano Babic 

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 2/4] efikamx: remove drive strength function and roll its functionality into the DCD

2012-08-23 Thread Stefano Babic
On 22/08/2012 21:25, Matt Sealey wrote:
> Efika MX boards configure their DDR pad settings twice, one in the DCD 
> generated
> from imximage_*.cfg and again in init_drive_strength called before relocation.
> 
> Rather than doing this, roll the changes it makes into the DCD so DDR is set 
> up
> before a single line of code in U-Boot is run.
> 
> The settings are identical with this DCD block which is shorter (by 7 entries)
> than the old one, and after the output of init_drive_strength since a lot of 
> the
> functionality in the existing DCD and init_drive_strength function was just
> setting the POR defaults. This goes to explain some now-missing entries.
> 
> Several hundred rounds of mtest have been run to test the settings before and
> after to confirm DDR is stable and no ill-effects have been found.
> 
> Signed-off-by: Matt Sealey 
> ---
>  board/genesi/mx51_efikamx/efikamx.c   |   77 
> -
>  board/genesi/mx51_efikamx/imximage_mx.cfg |   42 +++-
>  2 files changed, 18 insertions(+), 101 deletions(-)
> 
> diff --git a/board/genesi/mx51_efikamx/efikamx.c 
> b/board/genesi/mx51_efikamx/efikamx.c
> index e88b2ed..12371c9 100644
> --- a/board/genesi/mx51_efikamx/efikamx.c
> +++ b/board/genesi/mx51_efikamx/efikamx.c
> @@ -597,85 +597,8 @@ void efikamx_toggle_led(uint32_t mask)
>  /*
>   * Board initialization
>   */
> -static void init_drive_strength(void)
> -{
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_DDR_INPUT_CMOS);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEADDR, PAD_CTL_PKE_ENABLE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPKS, PAD_CTL_PUE_KEEPER);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPUS, PAD_CTL_100K_PU);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_A1, PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A0, PAD_CTL_DRV_HIGH);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A1, PAD_CTL_DRV_HIGH);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_RAS,
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CAS,
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_PKE_ENABLE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPKS, PAD_CTL_PUE_KEEPER);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR0, PAD_CTL_HYS_NONE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR1, PAD_CTL_HYS_NONE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR2, PAD_CTL_HYS_NONE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR3, PAD_CTL_HYS_NONE);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B0, PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B1, PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B2, PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B4, PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPUS, PAD_CTL_100K_PU);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_INMODE1, PAD_CTL_DDR_INPUT_CMOS);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B0, PAD_CTL_DRV_MEDIUM);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B1, PAD_CTL_DRV_MEDIUM);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B2, PAD_CTL_DRV_MEDIUM);
> - mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B4, PAD_CTL_DRV_MEDIUM);
> -
> - /* Setting pad options */
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDWE,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE0,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE1,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCLK,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS0,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS1,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS2,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS3,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS0,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS1,
> - PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
> - PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
> - mxc_iomux_set_pad(MX51_PIN_

Re: [U-Boot] [PATCH] mxs: Convert timeout parameter to 'unsigned int'

2012-08-23 Thread Stefano Babic
On 22/08/2012 22:10, Fabio Estevam wrote:
> From: Fabio Estevam >
> 
> For representing a timeout value, it makes more sense to pass it as
> 'unsigned int'.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  arch/arm/cpu/arm926ejs/mxs/mxs.c  |6 --
>  arch/arm/include/asm/arch-mxs/sys_proto.h |4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c 
> b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> index c028e5e..19c79f2 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -81,7 +81,8 @@ void enable_caches(void)
>  #endif
>  }
>  
> -int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t mask, int 
> timeout)
> +int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t mask, unsigned
> + int timeout)
>  {
>   while (--timeout) {
>   if ((readl(®->reg) & mask) == mask)
> @@ -92,7 +93,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t 
> mask, int timeout)
>   return !timeout;
>  }
>  
> -int mxs_wait_mask_clr(struct mxs_register_32 *reg, uint32_t mask, int 
> timeout)
> +int mxs_wait_mask_clr(struct mxs_register_32 *reg, uint32_t mask, unsigned
> + int timeout)
>  {
>   while (--timeout) {
>   if ((readl(®->reg) & mask) == 0)
> diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h 
> b/arch/arm/include/asm/arch-mxs/sys_proto.h
> index 4610363..983b888 100644
> --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
> @@ -26,10 +26,10 @@
>  int mxs_reset_block(struct mxs_register_32 *reg);
>  int mxs_wait_mask_set(struct mxs_register_32 *reg,
>  uint32_t mask,
> -int timeout);
> +unsigned int timeout);
>  int mxs_wait_mask_clr(struct mxs_register_32 *reg,
>  uint32_t mask,
> -int timeout);
> +unsigned int timeout);
>  
>  int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int));
>  
> 

Acked-by: Stefano Babic 

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] [PATCH v3 5/5] at91: 9x5: Enable PMECC for 5series ek board.

2012-08-23 Thread Josh Wu
Signed-off-by: Josh Wu 
---
 include/configs/at91sam9x5ek.h |7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 82f6b48..3a5a7e6 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -120,6 +120,13 @@
 #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
 #define CONFIG_SYS_NAND_READY_PIN  AT91_PIN_PD5
 
+/* PMECC & PMERRLOC */
+#define CONFIG_ATMEL_NAND_HWECC1
+#define CONFIG_ATMEL_NAND_HW_PMECC 1
+#define CONFIG_PMECC_CAP   2
+#define CONFIG_PMECC_SECTOR_SIZE   512
+#define CONFIG_PMECC_INDEX_TABLE_OFFSET0x8000
+
 #define CONFIG_MTD_DEVICE
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_MTD_PARTITIONS
-- 
1.7.9.5

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


[U-Boot] [PATCH v3 3/5] at91: atmel_nand: Update driver to support Programmable Multibit ECC controller

2012-08-23 Thread Josh Wu
The Programmable Multibit ECC (PMECC) controller is a programmable binary
BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder. This controller
can be used to support both SLC and MLC NAND Flash devices. It supports to
generate ECC to correct 2, 4, 8, 12 or 24 bits of error per sector of data.

To use PMECC in this driver, the user needs to set the PMECC correction
capability, the sector size and ROM lookup table offsets in board config file.

This driver is ported from Linux kernel atmel_nand PMECC patch. The main 
difference
is in this version it uses registers structure access hardware instead of using 
macros.
It is tested in 9x5 serial boards.

Signed-off-by: Josh Wu 
---
Changes since v2:
   add timeout when read hardware register.
   add README document for atmel pmecc.
   according to Scott and Andreas' suggestion, refined the pmecc_get_sigma() 
 function and add more comments for the function.

 doc/README.atmel_pmecc|   44 +++
 drivers/mtd/nand/atmel_nand.c |  680 -
 drivers/mtd/nand/atmel_nand_ecc.h |  113 ++
 3 files changed, 836 insertions(+), 1 deletion(-)
 create mode 100644 doc/README.atmel_pmecc

diff --git a/doc/README.atmel_pmecc b/doc/README.atmel_pmecc
new file mode 100644
index 000..b483744
--- /dev/null
+++ b/doc/README.atmel_pmecc
@@ -0,0 +1,44 @@
+How to enable PMECC(Programmable Multibit ECC) for nand on Atmel SoCs
+---
+2012-08-22 Josh Wu 
+
+The Programmable Multibit ECC (PMECC) controller is a programmable binary
+BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder. This controller
+can be used to support both SLC and MLC NAND Flash devices. It supports to
+generate ECC to correct 2, 4, 8, 12 or 24 bits of error per sector (512 or
+1024 bytes) of data.
+
+Following Atmel AT91 products support PMECC.
+- AT91SAM9X25, X35, G25, G15, G35 (tested)
+- AT91SAM9N12 (not tested, Should work)
+
+As soon as your nand flash software ECC works, you can enable PMECC.
+
+To use PMECC in this driver, the user needs to set:
+   1. the PMECC correction error bits capability: CONFIG_PMECC_CAP.
+  It can be 2, 4, 8, 12 or 24.
+   2. The PMECC sector size: CONFIG_PMECC_SECTOR_SIZE.
+  It only can be 512 or 1024.
+   3. The PMECC index lookup table's offsets in ROM code: 
CONFIG_PMECC_INDEX_TABLE_OFFSET.
+  In the chip datasheet section "Boot Stragegies", you can find
+  two Galois Field Table in the ROM code. One table is for 512-bytes
+  sector. Another is for 1024-byte sector. Each Galois Field includes
+  two sub-table: indext table & alpha table.
+  In the beginning of each Galois Field Table is the index table,
+  Alpha table is in the following.
+  So the index table's offset is same as the Galois Field Table.
+
+  Please set CONFIG_PMECC_INDEX_TABLE_OFFSET correctly according the
+  Galois Field Table's offset base on the sector size you used.
+
+Take AT91SAM9X5EK as an example, the board definition file likes:
+
+/* PMECC & PMERRLOC */
+#define CONFIG_ATMEL_NAND_HWECC1
+#define CONFIG_ATMEL_NAND_HW_PMECC 1
+#define CONFIG_PMECC_CAP   2
+#define CONFIG_PMECC_SECTOR_SIZE   512
+#define CONFIG_PMECC_INDEX_TABLE_OFFSET0x8000
+
+NOTE: If you use 1024 as the sector size, then need set 0x1 as the
+ CONFIG_PMECC_INDEX_TABLE_OFFSET
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 05a6317..70b3ce4 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -5,6 +5,9 @@
  *
  * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas
  *
+ * Add Programmable Multibit ECC support for various AT91 SoC
+ * (C) Copyright 2012 ATMEL, Hong Xu
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -30,6 +33,7 @@
 #include 
 
 #include 
+#include 
 
 #ifdef CONFIG_ATMEL_NAND_HWECC
 
@@ -41,6 +45,674 @@
 
 #include "atmel_nand_ecc.h"/* Hardware ECC registers */
 
+#ifdef CONFIG_ATMEL_NAND_HW_PMECC
+
+struct atmel_nand_host {
+   struct pmecc_regs __iomem *pmecc;
+   struct pmecc_errloc_regs __iomem *pmerrloc;
+   void __iomem*pmecc_rom_base;
+
+   u8  pmecc_corr_cap;
+   u16 pmecc_sector_size;
+   u32 pmecc_index_table_offset;
+
+   int pmecc_bytes_per_sector;
+   int pmecc_sector_number;
+   int pmecc_degree;   /* Degree of remainders */
+   int pmecc_cw_len;   /* Length of codeword */
+
+   /* lookup table for alpha_to and index_of */
+   void __iomem*pmecc_alpha_to;
+   void __iomem*pmecc_index_of;
+
+   /* data for pmecc computation */
+   int16_t pmecc_smu[(CONFIG_PMECC_CAP + 2) * (2 * CONFIG_PMECC_CAP + 1)];
+   int16_t pmecc_partial_syn[2 * CONFIG_PMECC_CAP + 1];
+   in

[U-Boot] [PATCH v3 2/5] at91: atmel_nand: remove unused variables.

2012-08-23 Thread Josh Wu
Signed-off-by: Josh Wu 
Acked-by: Scott Wood 
---
 drivers/mtd/nand/atmel_nand.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 21dc4f5..05a6317 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -79,7 +79,6 @@ static struct nand_ecclayout atmel_oobinfo_small = {
 static int atmel_nand_calculate(struct mtd_info *mtd,
const u_char *dat, unsigned char *ecc_code)
 {
-   struct nand_chip *nand_chip = mtd->priv;
unsigned int ecc_value;
 
/* get the first 2 ECC bytes */
@@ -167,7 +166,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char 
*dat,
u_char *read_ecc, u_char *isnull)
 {
struct nand_chip *nand_chip = mtd->priv;
-   unsigned int ecc_status, ecc_parity, ecc_mode;
+   unsigned int ecc_status;
unsigned int ecc_word, ecc_bit;
 
/* get the status from the Status Register */
-- 
1.7.9.5

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


[U-Boot] [PATCH v3 4/5] at91: 9x5: change SMC config timing that both works for PMECC & non-PMECC.

2012-08-23 Thread Josh Wu
Signed-off-by: Josh Wu 
---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c 
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 88b3478..ae408bc 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -65,13 +65,13 @@ static void at91sam9x5ek_nand_hw_init(void)
writel(csa, &matrix->ebicsa);
 
/* Configure SMC CS3 for NAND/SmartMedia */
-   writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
-   AT91_SMC_SETUP_NRD(2) | AT91_SMC_SETUP_NCS_RD(0),
+   writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
+   AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
&smc->cs[3].setup);
-   writel(AT91_SMC_PULSE_NWE(4) | AT91_SMC_PULSE_NCS_WR(4) |
-   AT91_SMC_PULSE_NRD(4) | AT91_SMC_PULSE_NCS_RD(4),
+   writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(5) |
+   AT91_SMC_PULSE_NRD(4) | AT91_SMC_PULSE_NCS_RD(6),
&smc->cs[3].pulse);
-   writel(AT91_SMC_CYCLE_NWE(7) | AT91_SMC_CYCLE_NRD(7),
+   writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(6),
&smc->cs[3].cycle);
writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
AT91_SMC_MODE_EXNW_DISABLE |
@@ -80,7 +80,7 @@ static void at91sam9x5ek_nand_hw_init(void)
 #else /* CONFIG_SYS_NAND_DBW_8 */
AT91_SMC_MODE_DBW_8 |
 #endif
-   AT91_SMC_MODE_TDF_CYCLE(3),
+   AT91_SMC_MODE_TDF_CYCLE(1),
&smc->cs[3].mode);
 
writel(1 << ATMEL_ID_PIOCD, &pmc->pcer);
-- 
1.7.9.5

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


  1   2   >