Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Javier Martinez Canillas
On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg  wrote:
> On 12/27/12 15:36, Javier Martinez Canillas wrote:
>> This patch adds an GPIO LED boot status for IGEP boards.
>>
>> The GPIO LED used is the red LED0 while the Linux kernel
>> uses the green LED0 as the boot status.
>>
>> By using different GPIO LEDs, the user can know in which
>> step of the boot process the board currently is.
>>
>> Signed-off-by: Javier Martinez Canillas 
>
> Acked-by: Igor Grinberg 
>

Hello Tom,

Any news of merging this patch?

Thanks a lot and best regards,
Javier
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] patches status

2013-01-10 Thread Angelo Dureghello
Dear All,

sorry if i ask, don't want to put any pressure.

I am currently blocked to port a new board patch on the list, depending on 
two patches i posted in november:

[U-Boot,1/1] m68k/lib: fix serial driver relocation
http://patchwork.ozlabs.org/patch/201421/

[U-Boot,1/1] mtd/cfi: add support for SST 4KB sector granularity
http://patchwork.ozlabs.org/patch/203086/

The first one is related tho serial routines erroneously running from flash.
This is important for me to be accepted to proceed with the board patch, but
the issues affects currently all coldfire boards.

The second is less important, i can write my own flash.c, but would be nice 
to know if there is any chance it can eb accepted.

Regards,
Angelo Dureghello

Dear All,

sorry if i ask, don't want to put any pressure.

I am currently blocked to port a new board patch on the list, depending on 
two patches i posted in november:

[U-Boot,1/1] m68k/lib: fix serial driver relocation
http://patchwork.ozlabs.org/patch/201421/

[U-Boot,1/1] mtd/cfi: add support for SST 4KB sector granularity
http://patchwork.ozlabs.org/patch/203086/

The first one is related tho serial routines erroneously running from flash.
This is important for me to be accepted to proceed with the board patch, but
the issues affects currently all coldfire boards.

The second is less important, i can write my own flash.c, but would be nice 
to know if there is any chance it can eb accepted.

Regards,
Angelo Dureghello

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


[U-Boot] [PATCH] powerpc/mpc85xx: Add property 'fsl, sec-era' in device tree node 'crypto'.

2013-01-10 Thread Vakul Garg
If property 'fsl,sec-era' is already present, it is updated.
This property is required so that applications can ascertain which
descriptor commands are supported on a particular CAAM version.

Signed-off-by: Vakul Garg 
Cc: Andy Fleming 
---
 arch/powerpc/cpu/mpc85xx/fdt.c|8 +++
 arch/powerpc/cpu/mpc8xxx/fdt.c|   78 -
 arch/powerpc/include/asm/immap_85xx.h |6 +++
 3 files changed, 91 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 5af2661..e7b5dfd 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -591,6 +591,14 @@ void ft_cpu_setup(void *blob, bd_t *bd)
/* delete crypto node if not on an E-processor */
if (!IS_E_PROCESSOR(get_svr()))
fdt_fixup_crypto_node(blob, 0);
+#if CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC 4.x/5.x */
+   else {
+   ccsr_sec_t *sec;
+
+   sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
+   fdt_fixup_crypto_node(blob, in_be32(&sec->secvid_ms));
+   }
+#endif
 
fdt_fixup_ethernet(blob);
 
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index 68db8e2..20cbb45 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -297,10 +297,86 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
   fdt_strerror(err));
 }
 #elif CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC4 */
+static u8 caam_get_era(void)
+{
+   static const struct {
+   u16 ip_id;
+   u8 maj_rev;
+   u8 era;
+   } caam_eras[] = {
+   {0x0A10, 1, 1},
+   {0x0A10, 2, 2},
+   {0x0A12, 1, 3},
+   {0x0A14, 1, 3},
+   {0x0A14, 2, 4},
+   {0x0A16, 1, 4},
+   {0x0A10, 3, 4},
+   {0x0A11, 1, 4},
+   {0x0A18, 1, 4},
+   {0x0A11, 2, 5},
+   {0x0A12, 2, 5},
+   {0x0A13, 1, 5},
+   {0x0A1C, 1, 5}
+   };
+
+   ccsr_sec_t *sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
+   u32 secvid_ms = in_be32(&sec->secvid_ms);
+   u32 ccbvid = in_be32(&sec->ccbvid);
+   u16 ip_id = (secvid_ms & SEC_SECVID_MS_IPID_MASK) >>
+   SEC_SECVID_MS_IPID_SHIFT;
+   u8 maj_rev = (secvid_ms & SEC_SECVID_MS_MAJ_REV_MASK) >>
+   SEC_SECVID_MS_MAJ_REV_SHIFT;
+   u8 era = (ccbvid & SEC_CCBVID_ERA_MASK) >> SEC_CCBVID_ERA_SHIFT;
+
+   int i;
+
+   if (era)/* This is '0' prior to CAAM ERA-6 */
+   return era;
+
+   for (i = 0; i < ARRAY_SIZE(caam_eras); i++)
+   if (caam_eras[i].ip_id == ip_id &&
+   caam_eras[i].maj_rev == maj_rev)
+   return caam_eras[i].era;
+
+   return 0;
+}
+
+static void fdt_fixup_crypto_era(void *blob, u32 era)
+{
+   int err;
+   int crypto_node;
+
+   crypto_node = fdt_path_offset(blob, "crypto");
+   if (crypto_node < 0) {
+   printf("WARNING: Missing crypto node\n");
+   return;
+   }
+
+   err = fdt_setprop(blob, crypto_node, "fsl,sec-era", &era,
+ sizeof(era));
+   if (err < 0) {
+   printf("ERROR: could not set fsl,sec-era property: %s\n",
+  fdt_strerror(err));
+   }
+}
+
 void fdt_fixup_crypto_node(void *blob, int sec_rev)
 {
-   if (!sec_rev)
+   u8 era;
+
+   if (!sec_rev) {
fdt_del_node_and_alias(blob, "crypto");
+   return;
+   }
+
+   /* Add SEC ERA information in compatible */
+   era = caam_get_era();
+   if (era) {
+   fdt_fixup_crypto_era(blob, era);
+   } else {
+   printf("WARNING: Unable to get ERA for CAAM rev: %d\n",
+   sec_rev);
+   }
 }
 #endif
 
diff --git a/arch/powerpc/include/asm/immap_85xx.h 
b/arch/powerpc/include/asm/immap_85xx.h
index 70608fe..6b2c05c 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -2757,6 +2757,12 @@ typedef struct ccsr_sec {
 #define SEC_CHANUM_MS_JRNUM_SHIFT  28
 #define SEC_CHANUM_MS_DECONUM_MASK 0x0f00
 #define SEC_CHANUM_MS_DECONUM_SHIFT24
+#define SEC_SECVID_MS_IPID_MASK0x
+#define SEC_SECVID_MS_IPID_SHIFT   16
+#define SEC_SECVID_MS_MAJ_REV_MASK 0xff00
+#define SEC_SECVID_MS_MAJ_REV_SHIFT8
+#define SEC_CCBVID_ERA_MASK0xff00
+#define SEC_CCBVID_ERA_SHIFT   24
 #endif
 
 typedef struct ccsr_qman {
-- 
1.7.7


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


Re: [U-Boot] patches status

2013-01-10 Thread Stefan Roese
Hi Angelo,

On 01/10/2013 10:53 AM, Angelo Dureghello wrote:
> I am currently blocked to port a new board patch on the list, depending on 
> two patches i posted in november:
> 
> [U-Boot,1/1] m68k/lib: fix serial driver relocation
> http://patchwork.ozlabs.org/patch/201421/
> 
> [U-Boot,1/1] mtd/cfi: add support for SST 4KB sector granularity
> http://patchwork.ozlabs.org/patch/203086/

I'll re-check tomorrow and when I see no problems I'll push it upstream
with the other pending CFI patches.

Sorry for the delay.

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


Re: [U-Boot] [PATCH] powerpc/mpc85xx: Add property 'fsl, sec-era' in device tree node 'crypto'.

2013-01-10 Thread Tabi Timur-B04825
On Thu, Jan 10, 2013 at 5:49 AM, Vakul Garg  wrote:
> If property 'fsl,sec-era' is already present, it is updated.
> This property is required so that applications can ascertain which
> descriptor commands are supported on a particular CAAM version.
>
> Signed-off-by: Vakul Garg 
> Cc: Andy Fleming 
> ---
>  arch/powerpc/cpu/mpc85xx/fdt.c|8 +++
>  arch/powerpc/cpu/mpc8xxx/fdt.c|   78 
> -
>  arch/powerpc/include/asm/immap_85xx.h |6 +++
>  3 files changed, 91 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
> index 5af2661..e7b5dfd 100644
> --- a/arch/powerpc/cpu/mpc85xx/fdt.c
> +++ b/arch/powerpc/cpu/mpc85xx/fdt.c
> @@ -591,6 +591,14 @@ void ft_cpu_setup(void *blob, bd_t *bd)
> /* delete crypto node if not on an E-processor */
> if (!IS_E_PROCESSOR(get_svr()))
> fdt_fixup_crypto_node(blob, 0);
> +#if CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC 4.x/5.x */
> +   else {
> +   ccsr_sec_t *sec;

ccsr_sec_t __iomem *sec;

> +
> +   sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
> +   fdt_fixup_crypto_node(blob, in_be32(&sec->secvid_ms));
> +   }
> +#endif
>
> fdt_fixup_ethernet(blob);
>
> diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
> index 68db8e2..20cbb45 100644
> --- a/arch/powerpc/cpu/mpc8xxx/fdt.c
> +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
> @@ -297,10 +297,86 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
>fdt_strerror(err));
>  }
>  #elif CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC4 */
> +static u8 caam_get_era(void)
> +{
> +   static const struct {
> +   u16 ip_id;
> +   u8 maj_rev;
> +   u8 era;
> +   } caam_eras[] = {
> +   {0x0A10, 1, 1},
> +   {0x0A10, 2, 2},
> +   {0x0A12, 1, 3},
> +   {0x0A14, 1, 3},
> +   {0x0A14, 2, 4},
> +   {0x0A16, 1, 4},
> +   {0x0A10, 3, 4},
> +   {0x0A11, 1, 4},
> +   {0x0A18, 1, 4},
> +   {0x0A11, 2, 5},
> +   {0x0A12, 2, 5},
> +   {0x0A13, 1, 5},
> +   {0x0A1C, 1, 5}
> +   };
> +
> +   ccsr_sec_t *sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;

same here

-- 
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] [RFC 3/3] MIPS: bootm.c: integrate QEMU specific functions

2013-01-10 Thread Gabor Juhos
2013.01.08. 20:14 keltezéssel, Gabor Juhos írta:
> The linux starting code of the qemu specific bootm
> implementation is very similar to the one which is
> used for regular boards. The preparation code is
> different but it makes no sense to keep that in a
> separate file.
> 
> The pach moves the qemu specific code into bootm.c,
> and removes the custom file. This allows to get rid
> of some duplicated code, and it collects bootm specific
> code into a single file. Additionaly, this allows to use
> the prep,go subcommands in qemu as well.
> 
> Signed-off-by: Gabor Juhos 
> Cc: Daniel Schwierzeck 
> ---
> This is compile tested only. I don't have suitable kernel
> images for mips,mipsel,mips64,mipsel64 systems to try it yet.

Ok, I have tried this with the sample vmlinux image provided here:
ftp://ftp.denx.de/pub/contrib/Jean-Christophe_Plagniol-Villard/qemu_mips/

It works as expected:

> U-Boot 2013.01-rc2-00139-g926b2e4-dirty (Jan 10 2013 - 13:43:18)
> 
> Board: Qemu -M mips CPU: 24Kf proc_id=0x19300
> DRAM:  128 MiB
> ## Unknown flash on Bank 1 - Size = 0x = 0 MB
> Flash: 0 Bytes
> *** Warning - bad CRC, using default environment
> 
> In:serial
> Out:   serial
> Err:   serial
> Net:   NE2000
> Hit any key to stop autoboot:  0 
> qemu-mips # run load_tftp
> Using NE2000 device
> TFTP from server 10.0.2.2; our IP address is 10.0.2.1
> Filename '/initrd.gz'.
> Load address: 0x8080
> Loading: #
>  #
>  #
>  #
>  #
>  #
>  #
>  #
>  #
> done
> Bytes transferred = 2663940 (28a604 hex)
> Using NE2000 device
> TFTP from server 10.0.2.2; our IP address is 10.0.2.1
> Filename 'uImage'.
> Load address: 0x8050
> Loading: #
>  #
>  #
>  #
>  
> done
> Bytes transferred = 1368045 (14dfed hex)
> qemu-mips # bootm start 0x8050
> ## Booting kernel from Legacy Image at 8050 ...
>Image Name:   Linux 2.6.24.y
>Created:  2013-01-09  16:27:15 UTC
>Image Type:   MIPS Linux Kernel Image (gzip compressed)
>Data Size:1367981 Bytes = 1.3 MiB
>Load Address: 8001
>Entry Point:  80245650
>Verifying Checksum ... OK
> qemu-mips # bootm loados
>Uncompressing Kernel Image ... OK
> qemu-mips # bootm prep
> qemu-mips # bootm go
> 
> Starting kernel ...
> 
> Linux version 2.6.24.7-dirty (j...@game.jcrosoft.org) (gcc version 4.2.1) #17 
> Sat Sep 6 19:31:26 CEST 2008
> console [early0] enabled
> CPU revision is: 00019300 (MIPS 24K)
> FPU revision is: 
> Determined physical RAM map:
>  memory: 0800 @  (usable)
> Initial ramdisk at: 0x8080 (2663940 bytes)
> Zone PFN ranges:
>   DMA 0 -> 4096
>   Normal   4096 ->32768
> Movable zone start PFN for each node
> early_node_map[1] active PFN ranges
> 0:0 ->32768
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
> Kernel command line: root=/dev/ram0 init=/bin/sh console=ttyS0,115200 
> rd_start=0x8080 rd_size=0x28A604 ethaddr=52:54:00:12:34:56 panic=1
> Primary instruction cache 2kB, VIPT, 2-way, linesize 16 bytes.
> Primary data cache 2kB, 2-way, VIPT, no aliases, linesize 16 bytes
> Synthesized clear page handler (13 instructions).
> Synthesized copy page handler (22 instructions).
> Synthesized TLB refill handler (20 instructions).
> Synthesized TLB load handler fastpath (32 instructions).
> Synthesized TLB store handler fastpath (32 instructions).
> Synthesized TLB modify handler fastpath (31 instructions).
> Cache parity protection disabled
> PID hash table entries: 512 (order: 9, 2048 bytes)
> Console: colour dummy device 80x25
> Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
> Memory: 119096k/131072k available (2272k kernel code, 11928k reserved, 483k 
> data, 148k init, 0k highmem)
> Mount-cache hash table entries: 512
> net_namespace: 64 bytes
> NET: Registered protocol family 16
> NET: Registered protocol family 2
> Time: MIPS clocksource has been installed.
> IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
> TCP established hash table entries: 4096 (order: 3, 32768 bytes)
> TC

Re: [U-Boot] [RFC 3/3] MIPS: bootm.c: integrate QEMU specific functions

2013-01-10 Thread Daniel Schwierzeck
2013/1/10 Gabor Juhos :
> 2013.01.08. 20:14 keltezéssel, Gabor Juhos írta:
>> The linux starting code of the qemu specific bootm
>> implementation is very similar to the one which is
>> used for regular boards. The preparation code is
>> different but it makes no sense to keep that in a
>> separate file.
>>
>> The pach moves the qemu specific code into bootm.c,
>> and removes the custom file. This allows to get rid
>> of some duplicated code, and it collects bootm specific
>> code into a single file. Additionaly, this allows to use
>> the prep,go subcommands in qemu as well.
>>
>> Signed-off-by: Gabor Juhos 
>> Cc: Daniel Schwierzeck 
>> ---
>> This is compile tested only. I don't have suitable kernel
>> images for mips,mipsel,mips64,mipsel64 systems to try it yet.
>
> Ok, I have tried this with the sample vmlinux image provided here:
> ftp://ftp.denx.de/pub/contrib/Jean-Christophe_Plagniol-Villard/qemu_mips/
>
> It works as expected:
>
>
> Additionally, I wanted to compile a Linux kernel for mips64/mipsel/mipsel64 to
> test these patches on those as well. However when I have tried to configure a
> recent kernel I noticed that it has no MIPS QEMU platform. That has been
> completely removed from Linux five years ago by:
>
> commit 302922e5f6901eb6f29c58539631f71b3d9746b8
> Author: Ralf Baechle 
> Date:   Tue Jan 29 10:15:02 2008 +
>
> [MIPS] Qemu: Remove platform.
>
> The Qemu platform was originally implemented to have an easily supportable
> platform until Qemu reaches a state where it emulates a real world system.
> Since the latest release Qemu is capable of emulating the MIPSsim and
> Malta platforms, so this goal has been reached.  The Qemu plaform is also
> rather underfeatured so less useful than a Malta emulation.
>

yes, I figured that too yesterday while testing.

> Maybe the qemu_mips specific bootm stuff should be removed completely from 
> U-Boot?
>
> -Gabor

I agree. Maybe we should convert the current MIPS Qemu port to MTI
Malta. I have seen
that BareBox already supports Qemu Malta.
For supporting real MTI Malta hardware there is AFAIK some work in progress [1].

[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/140428/focus=140541

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


Re: [U-Boot] [PATCH 1/1] mtd/cfi: add support for SST 4KB sector granularity

2013-01-10 Thread Stefan Roese
On 12/01/2012 01:14 AM, Angelo Dureghello wrote:
> Add support for SST 4KB sector granularity.
> 
> Many recent SST flashes, i.e. SST39VF3201B and similar of this family 
> are declared CFI-conformant from SST. They support CFI query, but implement 
> 2 different sector sizes in the same memory: a 64KB sector (they call it 
> "block", std AMD erase cmd=0x30), and a 4KB sector (they call it "sector", 
> erase cmd=0x50). Also, CFI query on these chips, reading from address 0x2dh 
> of cfi query struct, detects a number of secotrs for the 4KB granularity
> (flinfo shows it). 
> 
> For all other aspects, they are CFI compliant, so, as Linux do, i think 
> it's a good idea to handle these chips in the CFI driver, with a fixup
> to allow 4KB granularity, as should be expected, instead of 64KB.

Applied to u-boot-cfi-flash/master. Thanks.

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


[U-Boot] [PATCH] mx6qsabresd: Fix mmc boot by making USDHC3 be 'dev 0'

2013-01-10 Thread Fabio Estevam
By default, we boot from USDHC3 on mx6qsabresd, so let it be mmc dev 0.

Without this fix kernel cannot be retrieved from mmc with the default 
environment.

Signed-off-by: Fabio Estevam 
---
 board/freescale/mx6qsabresd/mx6qsabresd.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c 
b/board/freescale/mx6qsabresd/mx6qsabresd.c
index 65c4a1a..fbcb6cd 100644
--- a/board/freescale/mx6qsabresd/mx6qsabresd.c
+++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
@@ -134,8 +134,8 @@ static void setup_iomux_uart(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg usdhc_cfg[3] = {
-   {USDHC2_BASE_ADDR},
{USDHC3_BASE_ADDR},
+   {USDHC2_BASE_ADDR},
{USDHC4_BASE_ADDR},
 };
 
@@ -162,13 +162,13 @@ int board_mmc_init(bd_t *bis)
 
for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
switch (i) {
-   case 0:
+   case 1:
imx_iomux_v3_setup_multiple_pads(
usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
gpio_direction_input(USDHC2_CD_GPIO);
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
break;
-   case 1:
+   case 0:
imx_iomux_v3_setup_multiple_pads(
usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
gpio_direction_input(USDHC3_CD_GPIO);
-- 
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 00/12] cmd_sf: Add support for read and write instructions

2013-01-10 Thread Langer Thomas (LQDE RD ST PON SW)
Hello Jagan,

> All these patches are added a support for read and write instruction
> for programming/reading SPI flash.

I have written some weeks ago that I would really appreciate the support of 
dual and quad IO accesses for serial flashes. I just  think, this is not an 
acceptable
way to do this.

It is important to know for all, who do not know the details on the hardware
requirements of this feature, that these new transfers require a special SPI
controller! A standard SPI hardware, which is being used on most (maybe all) 
existing boards, cannot use the dual or quad IO features at all! 

And in addition, I still haven't seen any change, which indicates the required 
transfer mode to the SPI layer! How do you tell your SPI driver, which part
of the transfer should be done in dual or quad mode?

> 
> Read and Write instruction are implemented as a command line
> arguments for 'sf write' , 'sf read' and 'sf update' commands.
> 
> Currently I have added below instructions those are commonly available
> on all flash types.
> pp - Page Program (existing one)
> qpp - Quad-input Page Program
> afr - Array Fast Read (existing one)
> asr - Array Slow Read
> dofr - Dual Output Fast Read
> qofr - Quad Output Fast Read
> diofr - Dual IO Fast Read
> qiofr - Quad IO Fast Read
> 
> I have tested mostly of the instruction on real h/w.
> 
> This entire implementation will change the current sf framework little bit but
> I thought these changes are worth to add.

This means, all your patches adding new code, which has no benefit for existing 
boards, but changing the commands in an incompatible way, which forces all users
to adapt their definitions!
I don't think this will be accepted, as I would not.

The biggest question is: Do somebody really need the flexibility to select the
used instruction at this level?
If you have a platform, which contains an extended SPI controller and has also 
a 
supported flash, I expect it would be okay to always use the dual or quad 
instructions!
And this can be completely handled by the lower level functions, no need to 
expose
this to the command line!

I think, first of all, you should add some config options (e.g. 
CONFIG_SYS_SF_DUAL / 
CONFIG_SYS_SF_QUAD) to indicate, that the platform / board will support these.
Then, during "sf probe", there should be a detection, if the flash will support 
this
(depending on the type) and is enabled (checking the config bit for quad IO).
Depending on this, either specific functions for read/write could be assigned or
some other data, which indicate the usable instructions, can be set.

As it depends on the flash type and manufacturer, how the lower sequence must
look like (for the command/address/data phases, it might be 1-1-4, 1-4-4 or 
even 4-4-4),
this should be flexible to be assigned from the detection code.
For example, please check the differences between Spansion and Macronix!

> 
> Request for all your comment, so-that I can move forward.
> Please let me know for any issue regarding this new implementation.
> 
> Thanks,
> Jagan.
> 

Please think about my comments. I just want to avoid to bloat the code with 
something,
which is currently not usable for existing boards (as far as I know) and not 
flexible enough
to support different, manufacturer specific command sets.

Best Regards,
Thomas

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


[U-Boot] Please pull u-boot-cfi-flash/master

2013-01-10 Thread Stefan Roese
Hi Tom,

please pull the following patches pending for quite some time:

The following changes since commit 642ef40bdc95bef829ae3aadc217f829c4c298c4:

  Merge branch 'master' of git://git.denx.de/u-boot-arm (2013-01-09 08:13:22 
-0700)

are available in the git repository at:


  git://www.denx.de/git/u-boot-cfi-flash.git master

for you to fetch changes up to d2af028db3f75390f56f018e16c0f269521e07c5:

  cfi_flash: Report Advanced Sector Protection (PPB) with flinfo cmd 
(2013-01-10 14:40:00 +0100)


Angelo Dureghello (1):
  mtd/cfi: add support for SST 4KB sector granularity

Stefan Roese (4):
  cfi_flash: Add manufact_match helper function
  cfi_flash: Read PPB sector protection from device for AMD/Spansion chips
  cfi_flash: Enable PPB protection for all AMD cmdset flash chips
  cfi_flash: Report Advanced Sector Protection (PPB) with flinfo cmd

 drivers/mtd/cfi_flash.c | 71 -
 include/flash.h |  1 +
 2 files changed, 59 insertions(+), 13 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] cfi_flash: Add manufact_match helper function

2013-01-10 Thread Stefan Roese
On 12/06/2012 03:44 PM, Stefan Roese wrote:
> Consolidate manufacturer matching into the function manufact_match()
> and use it.

For all patches of this series (1...4):

Applied to u-boot-cfi-flash/master.

Thanks,
Stefan

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


Re: [U-Boot] [PATCH] mx6qsabresd: Fix mmc boot by making USDHC3 be 'dev 0'

2013-01-10 Thread Benoît Thébaudeau
Hi Fabio,

On Thursday, January 10, 2013 3:32:25 PM, Fabio Estevam wrote:
> By default, we boot from USDHC3 on mx6qsabresd, so let it be mmc dev
> 0.
> 
> Without this fix kernel cannot be retrieved from mmc with the default
> environment.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/mx6qsabresd/mx6qsabresd.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c
> b/board/freescale/mx6qsabresd/mx6qsabresd.c
> index 65c4a1a..fbcb6cd 100644
> --- a/board/freescale/mx6qsabresd/mx6qsabresd.c
> +++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
> @@ -134,8 +134,8 @@ static void setup_iomux_uart(void)
>  
>  #ifdef CONFIG_FSL_ESDHC
>  struct fsl_esdhc_cfg usdhc_cfg[3] = {
> - {USDHC2_BASE_ADDR},
>   {USDHC3_BASE_ADDR},
> + {USDHC2_BASE_ADDR},
>   {USDHC4_BASE_ADDR},
>  };
>  
> @@ -162,13 +162,13 @@ int board_mmc_init(bd_t *bis)
>  
>   for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
>   switch (i) {
> - case 0:
> + case 1:
>   imx_iomux_v3_setup_multiple_pads(
>   usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
>   gpio_direction_input(USDHC2_CD_GPIO);
>   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
  ^ should be changed to 1 or i

>   break;
> - case 1:
> + case 0:
>   imx_iomux_v3_setup_multiple_pads(
>   usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
>   gpio_direction_input(USDHC3_CD_GPIO);

Ditto (with 0 or i) for the following hidden lines.

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


[U-Boot] [RFC PATCH 0/22] RFC: image: Reduce code duplication and refactor

2013-01-10 Thread Simon Glass
In creating a new feature[*] I found that the image code includes quite
a bit of duplication in places. In particular the code to load a kernel,
FDT and ramdisk is all fairly similar, but subtly different.

This series introduces a new function fit_image_load() which loads an image
from a FIT and supports the various features. For the bootstage updates,
these are standardised so that each file has its own range and the events
within that range have corresponding numbers. This means that the boot
progress numbers will change slightly with this series.

The image.c file is still very long. Rather than perpetuate the #ifdefs
in the code I have split out the image.c code that is dependent on
CONFIG_OF_LIBFDT into image-fdt.c.

Several architectures have their own way of setting up a ramdisk and FDT
for booting. An attempt is made here to unify these by providing a function
image_setup_linux() to handle the overall task, and image_setup_fdt() to set
up the FDT.

For ARM, the bootm code is a maze of #ifdefs, which means that many boards
compile the code differently and it takes longer to detect breakages. To get
around this, some defines are added to ARM's bootm.h to permit the use of
if() instead of #ifdef, making use of the compiler's dead code elimination.

Also this series introduces a very basic test of image loading using sandbox.
Some patches add bootm support for sandbox, and also a 'sb save' command to
save memory to a host file (used to check that the bootm actually worked).

A test program for sandbox is added as a basic sanity check of image loading
as performed by bootm.

This series depends on the verified boot series since it builds on the
clean-up in that. You can get this series from:

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

branch name 'image'.

* The new feature is support for FIT booting on x86, will get back to this
later.


Simon Glass (22):
  sandbox: Allow -c argument to provide a command list
  sandbox: Support 'source' command
  fs: Add support for saving data to filesystems
  sandbox: fs: Add support for saving files to host filesystem
  image: Split libfdt code into image-fdt.c
  image: Add device tree setup to image library
  arm: Refactor bootm to reduce #ifdefs
  arm: Use image_setup_linux() instead of local code
  powerpc: Use image_setup_linux() instead of local code
  m68k: Use image_setup_linux() instead of local code
  sparc: Use image_setup_linux() instead of local code
  bootstage: Introduce sub-IDs for use with image loading
  mkimage: Add map_sysmem() and IH_ARCH_DEFAULT to simplfy building
  image: Introduce fit_image_load() to load images from FITs
  image: Use fit_image_load() to load ramdisk
  image: Use fit_image_load() to load FDT
  sandbox: Adjust bootm command to work with sandbox
  image: Use fit_image_load() to load kernel
  sandbox: image: Adjust FIT image printing to work with sandbox
  bootstage: Remove unused entries related to kernel/ramdisk/fdt load
  sandbox: image: Create a test for loading FIT images
  WIP: sandbox: config: Remove boot command

 arch/arm/include/asm/bootm.h  |   54 +++-
 arch/arm/include/asm/u-boot-arm.h |2 -
 arch/arm/lib/Makefile |1 +
 arch/arm/lib/bootm-fdt.c  |   52 +++
 arch/arm/lib/bootm.c  |  145 +---
 arch/m68k/lib/bootm.c |   15 +-
 arch/powerpc/lib/bootm.c  |   84 +-
 arch/sandbox/cpu/start.c  |2 +-
 arch/sparc/lib/bootm.c|   13 +-
 common/Makefile   |1 +
 common/cmd_bootm.c|  182 ++
 common/cmd_sandbox.c  |   18 +-
 common/cmd_source.c   |   11 +-
 common/image-fdt.c|  512 +
 common/image-fit.c|  293 +++-
 common/image.c|  738 -
 fs/fs.c   |   75 
 fs/sandbox/sandboxfs.c|   33 ++
 include/bootstage.h   |   51 ++--
 include/common.h  |9 +
 include/configs/sandbox.h |1 -
 include/fdt_support.h |2 -
 include/fs.h  |2 +
 include/image.h   |  145 +++-
 include/lmb.h |2 -
 include/sandboxfs.h   |1 +
 test/image/test-fit.py|  422 +
 tools/mkimage.h   |   12 +
 28 files changed, 1674 insertions(+), 1204 deletions(-)
 create mode 100644 arch/arm/lib/bootm-fdt.c
 create mode 100644 common/image-fdt.c
 create mode 100755 test/image/test-fit.py

-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 07/22] arm: Refactor bootm to reduce #ifdefs

2013-01-10 Thread Simon Glass
With fewer #ifdefs the code is more readable and more of the code is
compiled for all boards. Add defines in the header file to control
what features are enabled, and then use if() instead of #ifdef.

Signed-off-by: Simon Glass 
---
 arch/arm/include/asm/bootm.h  |   54 +++-
 arch/arm/include/asm/u-boot-arm.h |2 -
 arch/arm/lib/bootm.c  |   83 
 3 files changed, 71 insertions(+), 68 deletions(-)

diff --git a/arch/arm/include/asm/bootm.h b/arch/arm/include/asm/bootm.h
index db2ff94..2c4fa19 100644
--- a/arch/arm/include/asm/bootm.h
+++ b/arch/arm/include/asm/bootm.h
@@ -1,4 +1,7 @@
-/* Copyright (C) 2011
+/*
+ * Copyright (c) 2013, Google Inc.
+ *
+ * Copyright (C) 2011
  * Corscience GmbH & Co. KG - Simon Schwarz 
  *
  * This program is free software; you can redistribute it and/or modify
@@ -19,8 +22,55 @@
 #ifndef ARM_BOOTM_H
 #define ARM_BOOTM_H
 
-#ifdef CONFIG_USB_DEVICE
 extern void udc_disconnect(void);
+
+#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
+   defined(CONFIG_CMDLINE_TAG) || \
+   defined(CONFIG_INITRD_TAG) || \
+   defined(CONFIG_SERIAL_TAG) || \
+   defined(CONFIG_REVISION_TAG)
+# define BOOTM_ENABLE_TAGS 1
+#else
+# define BOOTM_ENABLE_TAGS 0
+#endif
+
+#ifdef CONFIG_SETUP_MEMORY_TAGS
+# define BOOTM_ENABLE_MEMORY_TAGS  1
+#else
+# define BOOTM_ENABLE_MEMORY_TAGS  0
+#endif
+
+#ifdef CONFIG_CMDLINE_TAG
+ #define BOOTM_ENABLE_CMDLINE_TAG  1
+#else
+ #define BOOTM_ENABLE_CMDLINE_TAG  0
+#endif
+
+#ifdef CONFIG_INITRD_TAG
+ #define BOOTM_ENABLE_INITRD_TAG   1
+#else
+ #define BOOTM_ENABLE_INITRD_TAG   0
+#endif
+
+#ifdef CONFIG_SERIAL_TAG
+ #define BOOTM_ENABLE_SERIAL_TAG   1
+void get_board_serial(struct tag_serialnr *serialnr);
+#else
+ #define BOOTM_ENABLE_SERIAL_TAG   0
+static inline void get_board_serial(struct tag_serialnr *serialnr)
+{
+}
+#endif
+
+#ifdef CONFIG_REVISION_TAG
+ #define BOOTM_ENABLE_REVISION_TAG 1
+u32 get_board_rev(void);
+#else
+ #define BOOTM_ENABLE_REVISION_TAG 0
+static inline u32 get_board_rev(void)
+{
+   return 0;
+}
 #endif
 
 #endif
diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index 9f3cae5..9032c13 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -58,8 +58,6 @@ int   arch_early_init_r(void);
 intboard_init(void);
 intdram_init (void);
 void   dram_init_banksize (void);
-void   setup_serial_tag (struct tag **params);
-void   setup_revision_tag (struct tag **params);
 
 /* cpu/.../interrupt.c */
 intarch_interrupt_init (void);
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 1bd2730..78fc013 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -38,13 +38,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
-   defined(CONFIG_CMDLINE_TAG) || \
-   defined(CONFIG_INITRD_TAG) || \
-   defined(CONFIG_SERIAL_TAG) || \
-   defined(CONFIG_REVISION_TAG)
 static struct tag *params;
-#endif
 
 static ulong get_sp(void)
 {
@@ -110,11 +104,6 @@ static void announce_and_cleanup(void)
cleanup_before_linux();
 }
 
-#if defined(CONFIG_SETUP_MEMORY_TAGS) || \
-   defined(CONFIG_CMDLINE_TAG) || \
-   defined(CONFIG_INITRD_TAG) || \
-   defined(CONFIG_SERIAL_TAG) || \
-   defined(CONFIG_REVISION_TAG)
 static void setup_start_tag (bd_t *bd)
 {
params = (struct tag *)bd->bi_boot_params;
@@ -128,9 +117,7 @@ static void setup_start_tag (bd_t *bd)
 
params = tag_next (params);
 }
-#endif
 
-#ifdef CONFIG_SETUP_MEMORY_TAGS
 static void setup_memory_tags(bd_t *bd)
 {
int i;
@@ -145,9 +132,7 @@ static void setup_memory_tags(bd_t *bd)
params = tag_next (params);
}
 }
-#endif
 
-#ifdef CONFIG_CMDLINE_TAG
 static void setup_commandline_tag(bd_t *bd, char *commandline)
 {
char *p;
@@ -172,9 +157,7 @@ static void setup_commandline_tag(bd_t *bd, char 
*commandline)
 
params = tag_next (params);
 }
-#endif
 
-#ifdef CONFIG_INITRD_TAG
 static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end)
 {
/* an ATAG_INITRD node tells the kernel where the compressed
@@ -188,14 +171,11 @@ static void setup_initrd_tag(bd_t *bd, ulong 
initrd_start, ulong initrd_end)
 
params = tag_next (params);
 }
-#endif
 
-#ifdef CONFIG_SERIAL_TAG
-void setup_serial_tag(struct tag **tmp)
+static void setup_serial_tag(struct tag **tmp)
 {
struct tag *params = *tmp;
struct tag_serialnr serialnr;
-   void get_board_serial(struct tag_serialnr *serialnr);
 
get_board_serial(&serialnr);
params->hdr.tag = ATAG_SERIAL;
@@ -205,13 +185,10 @@ void setup_serial_tag(struct tag **tmp)
params = tag_next (params);
*tmp = params;
 }
-#endif
 
-#ifdef CONFIG_REVISION_TAG
-void setup_revision_tag(struct tag **in_par

[U-Boot] [RFC PATCH 01/22] sandbox: Allow -c argument to provide a command list

2013-01-10 Thread Simon Glass
This allows passing of entire scripts to sandbox with the -c argument,
which is useful for testing. Commands can be delimited with a newline
or semicolon.

Signed-off-by: Simon Glass 
---
 arch/sandbox/cpu/start.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 8589da2..ce47e7e 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -90,7 +90,7 @@ int sandbox_main_loop_init(void)
 
/* Execute command if required */
if (state->cmd) {
-   run_command(state->cmd, 0);
+   run_command_list(state->cmd, -1, 0);
os_exit(state->exit_type);
}
 
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 04/22] sandbox: fs: Add support for saving files to host filesystem

2013-01-10 Thread Simon Glass
This allows write of files from the host filesystem in sandbox. There is
currently no concept of overwriting the file and removing its existing
contents - all writing is done on top of what is there. This means that
writing 10 bytes to the start of a 1KB file will only update those 10
bytes, not truncate the file to 10 byte slong.

If the file does not exist it is created.

Signed-off-by: Simon Glass 
---
 common/cmd_sandbox.c   |   18 ++
 fs/fs.c|1 +
 fs/sandbox/sandboxfs.c |   33 +
 include/sandboxfs.h|1 +
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
index 206a486..a28a844 100644
--- a/common/cmd_sandbox.c
+++ b/common/cmd_sandbox.c
@@ -32,9 +32,16 @@ static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int 
argc,
return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
+}
+
 static cmd_tbl_t cmd_sandbox_sub[] = {
-   U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, "", ""),
+   U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
+   U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
 };
 
 static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -56,8 +63,11 @@ static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
 }
 
 U_BOOT_CMD(
-   sb, 6,  1,  do_sandbox,
+   sb, 8,  1,  do_sandbox,
"Miscellaneous sandbox commands",
-   "load host   [ ]  - load a file from 
host\n"
-   "sb ls host   - save a file to host"
+   "load host[ ]  - "
+   "load a file from host\n"
+   "sb ls host   - list files on host\n"
+   "sb save host [] - "
+   "save a file to host\n"
 );
diff --git a/fs/fs.c b/fs/fs.c
index eee7e23..99e516a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -93,6 +93,7 @@ static struct fstype_info fstypes[] = {
.close = sandbox_fs_close,
.ls = sandbox_fs_ls,
.read = fs_read_sandbox,
+   .write = fs_write_sandbox,
},
 #endif
{
diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c
index 02d26ff..89769e8 100644
--- a/fs/sandbox/sandboxfs.c
+++ b/fs/sandbox/sandboxfs.c
@@ -48,6 +48,26 @@ long sandbox_fs_read_at(const char *filename, unsigned long 
pos,
return size;
 }
 
+long sandbox_fs_write_at(const char *filename, unsigned long pos,
+void *buffer, unsigned long towrite)
+{
+   ssize_t size;
+   int fd, ret;
+
+   fd = os_open(filename, OS_O_RDWR | OS_O_CREAT);
+   if (fd < 0)
+   return fd;
+   ret = os_lseek(fd, pos, OS_SEEK_SET);
+   if (ret == -1) {
+   os_close(fd);
+   return ret;
+   }
+   size = os_write(fd, buffer, towrite);
+   os_close(fd);
+
+   return size;
+}
+
 int sandbox_fs_ls(const char *dirname)
 {
struct os_dirent_node *head, *node;
@@ -81,3 +101,16 @@ int fs_read_sandbox(const char *filename, void *buf, int 
offset, int len)
 
return len_read;
 }
+
+int fs_write_sandbox(const char *filename, void *buf, int offset, int len)
+{
+   int len_written;
+
+   len_written = sandbox_fs_write_at(filename, offset, buf, len);
+   if (len_written == -1) {
+   printf("** Unable to write file %s **\n", filename);
+   return -1;
+   }
+
+   return len_written;
+}
diff --git a/include/sandboxfs.h b/include/sandboxfs.h
index f5213ac..8ea8cb7 100644
--- a/include/sandboxfs.h
+++ b/include/sandboxfs.h
@@ -26,5 +26,6 @@ long sandbox_fs_read_at(const char *filename, unsigned long 
pos,
 void sandbox_fs_close(void);
 int sandbox_fs_ls(const char *dirname);
 int fs_read_sandbox(const char *filename, void *buf, int offset, int len);
+int fs_write_sandbox(const char *filename, void *buf, int offset, int len);
 
 #endif
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 02/22] sandbox: Support 'source' command

2013-01-10 Thread Simon Glass
Enhance the source command to work with sandbox, by using map_sysmem() to
convert a ulong address into a pointer.

Signed-off-by: Simon Glass 
---
 common/cmd_source.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/cmd_source.c b/common/cmd_source.c
index 6a82fb2..0417898 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_8xx)
 #include 
 #endif
@@ -44,9 +45,10 @@ int
 source (ulong addr, const char *fit_uname)
 {
ulong   len;
-   image_header_t  *hdr;
+   const image_header_t *hdr;
ulong   *data;
int verify;
+   const void *buf;
 #if defined(CONFIG_FIT)
const void* fit_hdr;
int noffset;
@@ -56,9 +58,10 @@ source (ulong addr, const char *fit_uname)
 
verify = getenv_yesno ("verify");
 
-   switch (genimg_get_format ((void *)addr)) {
+   buf = map_sysmem(addr, 0);
+   switch (genimg_get_format(buf)) {
case IMAGE_FORMAT_LEGACY:
-   hdr = (image_header_t *)addr;
+   hdr = buf;
 
if (!image_check_magic (hdr)) {
puts ("Bad magic number\n");
@@ -104,7 +107,7 @@ source (ulong addr, const char *fit_uname)
return 1;
}
 
-   fit_hdr = (const void *)addr;
+   fit_hdr = buf;
if (!fit_check_format (fit_hdr)) {
puts ("Bad FIT image format\n");
return 1;
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 13/22] mkimage: Add map_sysmem() and IH_ARCH_DEFAULT to simplfy building

2013-01-10 Thread Simon Glass
These are not actually used in mkimage itself, but the image code (which
is common with mkimage) does use them. To avoid #ifdefs in the image code
just for mkimage, define dummy version of these here. The compiler will
eliminate the dead code anyway.

A better way to handle this might be to split out more things from common.h
so that mkimage can include them. At present any file that mkimage uses
has to be very careful what headers it includes.

Signed-off-by: Simon Glass 
---
 tools/mkimage.h |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/mkimage.h b/tools/mkimage.h
index d82be17..1d9984e 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -44,12 +44,24 @@
 
 #define ARRAY_SIZE(x)  (sizeof(x) / sizeof((x)[0]))
 
+static inline void *map_sysmem(ulong paddr, unsigned long len)
+{
+   return (void *)(uintptr_t)paddr;
+}
+
+static inline ulong map_to_sysmem(void *ptr)
+{
+   return (ulong)(uintptr_t)ptr;
+}
+
 #define MKIMAGE_TMPFILE_SUFFIX ".tmp"
 #define MKIMAGE_MAX_TMPFILE_LEN256
 #define MKIMAGE_DEFAULT_DTC_OPTIONS"-I dts -O dtb -p 500"
 #define MKIMAGE_MAX_DTC_CMDLINE_LEN512
 #define MKIMAGE_DTC"dtc"   /* assume dtc is in $PATH */
 
+#define IH_ARCH_DEFAULTIH_ARCH_INVALID
+
 /*
  * This structure defines all such variables those are initialized by
  * mkimage main core and need to be referred by image type specific
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 08/22] arm: Use image_setup_linux() instead of local code

2013-01-10 Thread Simon Glass
Use the common FDT setup function that is now available in image. Move
the FDT-specific code to a new bootm-fdt.c and remove unused headers
from bootm.c.

Signed-off-by: Simon Glass 
---
 arch/arm/lib/Makefile|1 +
 arch/arm/lib/bootm-fdt.c |   52 ++
 arch/arm/lib/bootm.c |   62 +-
 3 files changed, 54 insertions(+), 61 deletions(-)
 create mode 100644 arch/arm/lib/bootm-fdt.c

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 3422ac1..eca8964 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -39,6 +39,7 @@ GLCOBJS   += div0.o
 ifndef CONFIG_SPL_BUILD
 COBJS-y+= board.o
 COBJS-y+= bootm.o
+COBJS-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 COBJS-y+= interrupts.o
 COBJS-y+= reset.o
diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c
new file mode 100644
index 000..93888f8
--- /dev/null
+++ b/arch/arm/lib/bootm-fdt.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013, Google Inc.
+ *
+ * Copyright (C) 2011
+ * Corscience GmbH & Co. KG - Simon Schwarz 
+ *  - Added prep subcommand support
+ *  - Reorganized source - modeled after powerpc version
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH 
+ * Marius Groeger 
+ *
+ * Copyright (C) 2001  Erik Mouw (j.a.k.m...@its.tudelft.nl)
+ *
+ * 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 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int arch_fixup_memory_node(void *blob)
+{
+   bd_t *bd = gd->bd;
+   int bank;
+   u64 start[CONFIG_NR_DRAM_BANKS];
+   u64 size[CONFIG_NR_DRAM_BANKS];
+
+   for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+   start[bank] = bd->bi_dram[bank].start;
+   size[bank] = bd->bi_dram[bank].size;
+   }
+
+   return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
+}
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 78fc013..0b7a5bb 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -22,17 +22,11 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 USA
- *
  */
 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 
@@ -70,23 +64,6 @@ void arch_lmb_reserve(struct lmb *lmb)
gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
-#ifdef CONFIG_OF_LIBFDT
-static int fixup_memory_node(void *blob)
-{
-   bd_t*bd = gd->bd;
-   int bank;
-   u64 start[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
-
-   for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-   start[bank] = bd->bi_dram[bank].start;
-   size[bank] = bd->bi_dram[bank].size;
-   }
-
-   return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
-}
-#endif
-
 static void announce_and_cleanup(void)
 {
printf("\nStarting kernel ...\n\n");
@@ -203,43 +180,6 @@ static void setup_end_tag(bd_t *bd)
params->hdr.size = 0;
 }
 
-#ifdef CONFIG_OF_LIBFDT
-static int create_fdt(bootm_headers_t *images)
-{
-   ulong of_size = images->ft_len;
-   char **of_flat_tree = &images->ft_addr;
-   ulong *initrd_start = &images->initrd_start;
-   ulong *initrd_end = &images->initrd_end;
-   struct lmb *lmb = &images->lmb;
-   ulong rd_len;
-   int ret;
-
-   debug("using: FDT\n");
-
-   boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
-
-   rd_len = images->rd_end - images->rd_start;
-   ret = boot_ramdisk_high(lmb, images->rd_start, rd_len,
-   initrd_start, initrd_end);
-   if (ret)
-   return ret;
-
-   ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
-   if (ret)
-   return ret;
-
-   fdt_chosen(*of_flat_tree, 1);
-   fixup_memory_node(*of_flat_tree);
-   fdt_fixup_ethernet(*of_flat_tree);
-   fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1);
-#ifdef CONFIG_OF_BOARD_

[U-Boot] [RFC PATCH 05/22] image: Split libfdt code into image-fdt.c

2013-01-10 Thread Simon Glass
The image file is still very large, and some of the code is only used when
libfdt is in use. Move this code into a new file.

Signed-off-by: Simon Glass 
---
 common/Makefile|1 +
 common/image-fdt.c |  608 
 common/image.c |  566 
 3 files changed, 609 insertions(+), 566 deletions(-)
 create mode 100644 common/image-fdt.c

diff --git a/common/Makefile b/common/Makefile
index 8208b0b..b688a91 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -223,6 +223,7 @@ COBJS-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o
 COBJS-y += console.o
 COBJS-y += dlmalloc.o
 COBJS-y += image.o
+COBJS-$(CONFIG_OF_LIBFDT) += image-fdt.o
 COBJS-$(CONFIG_FIT) += image-fit.o
 COBJS-$(CONFIG_FIT_SIGNATURE) += image-sig.o
 COBJS-y += memsize.o
diff --git a/common/image-fdt.c b/common/image-fdt.c
new file mode 100644
index 000..1c88a16
--- /dev/null
+++ b/common/image-fdt.c
@@ -0,0 +1,608 @@
+/*
+ * Copyright (c) 2013, Google Inc.
+ *
+ * (C) Copyright 2008 Semihalf
+ *
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef CONFIG_SYS_FDT_PAD
+#define CONFIG_SYS_FDT_PAD 0x3000
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void fdt_error(const char *msg)
+{
+   puts("ERROR: ");
+   puts(msg);
+   puts(" - must RESET the board to recover.\n");
+}
+
+static const image_header_t *image_get_fdt(ulong fdt_addr)
+{
+   const image_header_t *fdt_hdr = map_sysmem(fdt_addr, 0);
+
+   image_print_contents(fdt_hdr);
+
+   puts("   Verifying Checksum ... ");
+   if (!image_check_hcrc(fdt_hdr)) {
+   fdt_error("fdt header checksum invalid");
+   return NULL;
+   }
+
+   if (!image_check_dcrc(fdt_hdr)) {
+   fdt_error("fdt checksum invalid");
+   return NULL;
+   }
+   puts("OK\n");
+
+   if (!image_check_type(fdt_hdr, IH_TYPE_FLATDT)) {
+   fdt_error("uImage is not a fdt");
+   return NULL;
+   }
+   if (image_get_comp(fdt_hdr) != IH_COMP_NONE) {
+   fdt_error("uImage is compressed");
+   return NULL;
+   }
+   if (fdt_check_header((char *)image_get_data(fdt_hdr)) != 0) {
+   fdt_error("uImage data is not a fdt");
+   return NULL;
+   }
+   return fdt_hdr;
+}
+
+/**
+ * boot_fdt_add_mem_rsv_regions - Mark the memreserve sections as unusable
+ * @lmb: pointer to lmb handle, will be used for memory mgmt
+ * @fdt_blob: pointer to fdt blob base address
+ *
+ * Adds the memreserve regions in the dtb to the lmb block.  Adding the
+ * memreserve regions prevents u-boot from using them to store the initrd
+ * or the fdt blob.
+ */
+void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob)
+{
+   uint64_t addr, size;
+   int i, total;
+
+   if (fdt_check_header(fdt_blob) != 0)
+   return;
+
+   total = fdt_num_mem_rsv(fdt_blob);
+   for (i = 0; i < total; i++) {
+   if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) != 0)
+   continue;
+   printf("   reserving fdt memory region: addr=%llx size=%llx\n",
+   (unsigned long long)addr, (unsigned long long)size);
+   lmb_reserve(lmb, addr, size);
+   }
+}
+
+/**
+ * boot_relocate_fdt - relocate flat device tree
+ * @lmb: pointer to lmb handle, will be used for memory mgmt
+ * @of_flat_tree: pointer to a char* variable, will hold fdt start address
+ * @of_size: pointer to a ulong variable, will hold fdt length
+ *
+ * boot_relocate_fdt() allocates a region of memory within the bootmap and
+ * relocates the of_flat_tree into that region, even if the fdt is already in
+ * the bootmap.  It also expands the size of the fdt by CONFIG_SYS_FDT_PAD
+ * bytes.
+ *
+ * of_flat_tree and of_size are set to final (after relocation) values
+ *
+ * returns:
+ *  0 - success
+ *  1 - failure
+ */
+int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
+{
+   void*fdt_

[U-Boot] [RFC PATCH 17/22] sandbox: Adjust bootm command to work with sandbox

2013-01-10 Thread Simon Glass
Use map_sysmem() when converting from addresses to pointers, so that
bootm can be used with sandbox.

Signed-off-by: Simon Glass 
---
 common/cmd_bootm.c |   25 -
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 33320cb..2dbf4df 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -325,12 +325,15 @@ static int bootm_load_os(image_info_t os, ulong 
*load_end, int boot_progress)
ulong image_len = os.image_len;
__maybe_unused uint unc_len = CONFIG_SYS_BOOTM_LEN;
int no_overlap = 0;
+   void *load_buf, *image_buf;
 #if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
int ret;
 #endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
 
const char *type_name = genimg_get_type_name(os.type);
 
+   load_buf = map_sysmem(load, image_len);
+   image_buf = map_sysmem(image_start, image_len);
switch (comp) {
case IH_COMP_NONE:
if (load == blob_start || load == image_start) {
@@ -338,8 +341,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
no_overlap = 1;
} else {
printf("   Loading %s ... ", type_name);
-   memmove_wd((void *)load, (void *)image_start,
-   image_len, CHUNKSZ);
+   memmove_wd(load_buf, image_buf, image_len, CHUNKSZ);
}
*load_end = load + image_len;
puts("OK\n");
@@ -347,8 +349,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
 #ifdef CONFIG_GZIP
case IH_COMP_GZIP:
printf("   Uncompressing %s ... ", type_name);
-   if (gunzip((void *)load, unc_len,
-   (uchar *)image_start, &image_len) != 0) {
+   if (gunzip(load_buf, unc_len, image_buf, &image_len) != 0) {
puts("GUNZIP: uncompress, out-of-mem or overwrite "
"error - must RESET board to recover\n");
if (boot_progress)
@@ -367,9 +368,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
 * use slower decompression algorithm which requires
 * at most 2300 KB of memory.
 */
-   int i = BZ2_bzBuffToBuffDecompress((char *)load,
-   &unc_len, (char *)image_start, 
image_len,
-   CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 
0);
+   int i = BZ2_bzBuffToBuffDecompress(load_buf, &unc_len,
+   image_buf, image_len,
+   CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
if (i != BZ_OK) {
printf("BUNZIP2: uncompress or overwrite error %d "
"- must RESET board to recover\n", i);
@@ -386,9 +387,8 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
SizeT lzma_len = unc_len;
printf("   Uncompressing %s ... ", type_name);
 
-   ret = lzmaBuffToBuffDecompress(
-   (unsigned char *)load, &lzma_len,
-   (unsigned char *)image_start, image_len);
+   ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len,
+  image_buf, image_len);
unc_len = lzma_len;
if (ret != SZ_OK) {
printf("LZMA: uncompress or overwrite error %d "
@@ -404,9 +404,8 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
case IH_COMP_LZO:
printf("   Uncompressing %s ... ", type_name);
 
-   ret = lzop_decompress((const unsigned char *)image_start,
- image_len, (unsigned char *)load,
- &unc_len);
+   ret = lzop_decompress(image_buf, image_len, load_buf,
+ &unc_len);
if (ret != LZO_E_OK) {
printf("LZO: uncompress or overwrite error %d "
  "- must RESET board to recover\n", ret);
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 22/22] WIP: sandbox: config: Remove boot command

2013-01-10 Thread Simon Glass
We don't really need this now that we can provide a script to sandbox using
-c.

This is a test commit only - please do not apply.

Signed-off-by: Simon Glass 
---
 include/configs/sandbox.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index baf892a..3d69b85 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -120,7 +120,6 @@
"stderr=serial\0" \
CONFIG_SANDBOX_ENV
 
-#define CONFIG_BOOTCOMMAND "run test"
 #define CONFIG_BOOTDELAY   0   /* -1 to disable auto boot */
 
 #endif
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 06/22] image: Add device tree setup to image library

2013-01-10 Thread Simon Glass
This seems to be a common function for several architectures, so create
a common function rather than duplicating the code in each arch.

Also make an attempt to avoid introducing #ifdefs in the new code, partly
by removing useless #ifdefs around function declarations in the image.h
header.

Signed-off-by: Simon Glass 
---
 common/image-fdt.c|   62 +
 common/image.c|   50 +++
 include/common.h  |9 +++
 include/fdt_support.h |2 -
 include/image.h   |   62 +---
 include/lmb.h |2 -
 6 files changed, 174 insertions(+), 13 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 1c88a16..e317735 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -606,3 +606,65 @@ error:
*of_size = 0;
return 1;
 }
+
+/*
+ * Verify the device tree.
+ *
+ * This function is called after all device tree fix-ups have been enacted,
+ * so that the final device tree can be verified.  The definition of "verified"
+ * is up to the specific implementation.  However, it generally means that the
+ * addresses of some of the devices in the device tree are compared with the
+ * actual addresses at which U-Boot has placed them.
+ *
+ * Returns 1 on success, 0 on failure.  If 0 is returned, U-boot will halt the
+ * boot process.
+ */
+__weak int ft_verify_fdt(void *fdt)
+{
+   return 1;
+}
+
+__weak int arch_fixup_memory_node(void *blob)
+{
+   return 0;
+}
+
+int image_setup_libfdt(bootm_headers_t *images, void *blob,
+  int of_size, struct lmb *lmb)
+{
+   ulong *initrd_start = &images->initrd_start;
+   ulong *initrd_end = &images->initrd_end;
+   int ret;
+
+   if (fdt_chosen(blob, 1) < 0) {
+   puts("ERROR: /chosen node create failed");
+   puts(" - must RESET the board to recover.\n");
+   return -1;
+   }
+   arch_fixup_memory_node(blob);
+   if (IMAAGE_OF_BOARD_SETUP)
+   ft_board_setup(blob, gd->bd);
+   fdt_fixup_ethernet(blob);
+
+   /* Delete the old LMB reservation */
+   lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
+   (phys_size_t)fdt_totalsize(blob));
+
+   ret = fdt_resize(blob);
+   if (ret < 0)
+   return ret;
+   of_size = ret;
+
+   if (*initrd_start && *initrd_end) {
+   of_size += FDT_RAMDISK_OVERHEAD;
+   fdt_set_totalsize(blob, of_size);
+   }
+   /* Create a new LMB reservation */
+   lmb_reserve(lmb, (ulong)blob, of_size);
+
+   fdt_initrd(blob, *initrd_start, *initrd_end, 1);
+   if (!ft_verify_fdt(blob))
+   return -1;
+
+   return 0;
+}
diff --git a/common/image.c b/common/image.c
index aa2818e..a5bae46 100644
--- a/common/image.c
+++ b/common/image.c
@@ -71,6 +71,10 @@ static const image_header_t *image_get_ramdisk(ulong 
rd_addr, uint8_t arch,
 
 #include 
 
+#ifndef CONFIG_SYS_BARGSIZE
+#define CONFIG_SYS_BARGSIZE 512
+#endif
+
 static const table_entry_t uimage_arch[] = {
{   IH_ARCH_INVALID,NULL,   "Invalid ARCH", },
{   IH_ARCH_ALPHA,  "alpha","Alpha",},
@@ -1223,4 +1227,50 @@ int boot_get_kbd(struct lmb *lmb, bd_t **kbd)
return 0;
 }
 #endif /* CONFIG_SYS_BOOT_GET_KBD */
+
+#ifdef CONFIG_LMB
+int image_setup_linux(bootm_headers_t *images)
+{
+   ulong of_size = images->ft_len;
+   char **of_flat_tree = &images->ft_addr;
+   ulong *initrd_start = &images->initrd_start;
+   ulong *initrd_end = &images->initrd_end;
+   struct lmb *lmb = &images->lmb;
+   ulong rd_len;
+   int ret;
+
+   if (IMAGE_ENABLE_OF_LIBFDT)
+   boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
+
+   if (IMAGE_BOOT_GET_CMDLINE) {
+   ret = boot_get_cmdline(lmb, &images->cmdline_start,
+   &images->cmdline_end);
+   if (ret) {
+   puts("ERROR with allocation of cmdline\n");
+   return ret;
+   }
+   }
+   if (IMAGE_ENABLE_RAMDISK_HIGH) {
+   rd_len = images->rd_end - images->rd_start;
+   ret = boot_ramdisk_high(lmb, images->rd_start, rd_len,
+   initrd_start, initrd_end);
+   if (ret)
+   return ret;
+   }
+
+   if (IMAGE_ENABLE_OF_LIBFDT) {
+   ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
+   if (ret)
+   return ret;
+   }
+
+   if (IMAGE_ENABLE_OF_LIBFDT && of_size) {
+   ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+#endif /* CONFIG_LMB */
 #endif /* !USE_HOSTCC */
diff --git a/include/common.h b/includ

[U-Boot] [RFC PATCH 09/22] powerpc: Use image_setup_linux() instead of local code

2013-01-10 Thread Simon Glass
Rather than having similar code in powerpc, use image_setup_linux() which
should be common across all architectures that use the FDT.

Signed-off-by: Simon Glass 
---
 arch/powerpc/lib/bootm.c |   84 +-
 1 files changed, 1 insertions(+), 83 deletions(-)

diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 7088293..3091af7 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -222,101 +222,19 @@ static int boot_bd_t_linux(bootm_headers_t *images)
return ret;
 }
 
-/*
- * Verify the device tree.
- *
- * This function is called after all device tree fix-ups have been enacted,
- * so that the final device tree can be verified.  The definition of "verified"
- * is up to the specific implementation.  However, it generally means that the
- * addresses of some of the devices in the device tree are compared with the
- * actual addresses at which U-Boot has placed them.
- *
- * Returns 1 on success, 0 on failure.  If 0 is returned, U-boot will halt the
- * boot process.
- */
-static int __ft_verify_fdt(void *fdt)
-{
-   return 1;
-}
-__attribute__((weak, alias("__ft_verify_fdt"))) int ft_verify_fdt(void *fdt);
-
 static int boot_body_linux(bootm_headers_t *images)
 {
-   ulong rd_len;
-   struct lmb *lmb = &images->lmb;
-   ulong *initrd_start = &images->initrd_start;
-   ulong *initrd_end = &images->initrd_end;
-#if defined(CONFIG_OF_LIBFDT)
-   ulong of_size = images->ft_len;
-   char **of_flat_tree = &images->ft_addr;
-#endif
-
int ret;
 
-#if defined(CONFIG_OF_LIBFDT)
-   boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
-#endif
-
-   /* allocate space and init command line */
-   ret = boot_cmdline_linux(images);
-   if (ret)
-   return ret;
-
/* allocate space for kernel copy of board info */
ret = boot_bd_t_linux(images);
if (ret)
return ret;
 
-   rd_len = images->rd_end - images->rd_start;
-   ret = boot_ramdisk_high (lmb, images->rd_start, rd_len, initrd_start, 
initrd_end);
-   if (ret)
-   return ret;
-
-#if defined(CONFIG_OF_LIBFDT)
-   ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
+   ret = image_setup_linux(images);
if (ret)
return ret;
 
-   /*
-* Add the chosen node if it doesn't exist, add the env and bd_t
-* if the user wants it (the logic is in the subroutines).
-*/
-   if (of_size) {
-   if (fdt_chosen(*of_flat_tree, 1) < 0) {
-   puts ("ERROR: ");
-   puts ("/chosen node create failed");
-   puts (" - must RESET the board to recover.\n");
-   return -1;
-   }
-#ifdef CONFIG_OF_BOARD_SETUP
-   /* Call the board-specific fixup routine */
-   ft_board_setup(*of_flat_tree, gd->bd);
-#endif
-
-   /* Delete the old LMB reservation */
-   lmb_free(lmb, (phys_addr_t)(u32)*of_flat_tree,
-   (phys_size_t)fdt_totalsize(*of_flat_tree));
-
-   ret = fdt_resize(*of_flat_tree);
-   if (ret < 0)
-   return ret;
-   of_size = ret;
-
-   if (*initrd_start && *initrd_end) {
-   of_size += FDT_RAMDISK_OVERHEAD;
-   fdt_set_totalsize(*of_flat_tree, of_size);
-   }
-   /* Create a new LMB reservation */
-   lmb_reserve(lmb, (ulong)*of_flat_tree, of_size);
-
-   /* fixup the initrd now that we know where it should be */
-   if (*initrd_start && *initrd_end)
-   fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 
1);
-
-   if (!ft_verify_fdt(*of_flat_tree))
-   return -1;
-   }
-#endif /* CONFIG_OF_LIBFDT */
return 0;
 }
 
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 19/22] sandbox: image: Adjust FIT image printing to work with sandbox

2013-01-10 Thread Simon Glass
Use map_sysmem() to convert from address to pointer, so that sandbox can
print FIT information without crashing.

Signed-off-by: Simon Glass 
---
 common/image-fit.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index ef21112..9f3ece2 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -373,7 +373,7 @@ void fit_image_print(const void *fit, int image_noffset, 
const char *p)
if (ret)
printf("unavailable\n");
else
-   printf("0x%08lx\n", (ulong)data);
+   printf("0x%08lx\n", (ulong)map_to_sysmem((char *)data));
 #endif
 
printf("%s  Data Size:", p);
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 20/22] bootstage: Remove unused entries related to kernel/ramdisk/fdt load

2013-01-10 Thread Simon Glass
Now that the code for loading these three images from a FIT is common, we
don't need individual boostage IDs for each of them.

Note: there are some minor changes in the bootstage numbering, particuarly
for kernel loading. I don't believe this matters.

Signed-off-by: Simon Glass 
---
 include/bootstage.h |   29 +++--
 1 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/include/bootstage.h b/include/bootstage.h
index f577ba8..2a28e23 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -161,20 +161,10 @@ enum bootstage_id {
 * bit wonky.
 */
BOOTSTAGE_ID_FIT_KERNEL_START = 100,
-   BOOTSTAGE_ID_FIT_FORMAT = 100,
-   BOOTSTAGE_ID_FIT_NO_UNIT_NAME,
-   BOOTSTAGE_ID_FIT_UNIT_NAME,
-   BOOTSTAGE_ID_FIT_CONFIG,
-   BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE,
-   BOOTSTAGE_ID_FIT_CHECK_HASH = 104,
-
-   BOOTSTAGE_ID_FIT_CHECK_ARCH,
-   BOOTSTAGE_ID_FIT_CHECK_KERNEL,
-   BOOTSTAGE_ID_FIT_CHECKED,
-
-   BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR = 107,
-   BOOTSTAGE_ID_FIT_KERNEL_INFO,
+
+   BOOTSTAGE_ID_FIT_CONFIG = 110,
BOOTSTAGE_ID_FIT_TYPE,
+   BOOTSTAGE_ID_FIT_KERNEL_INFO,
 
BOOTSTAGE_ID_FIT_COMPRESSION,
BOOTSTAGE_ID_FIT_OS,
@@ -183,19 +173,6 @@ enum bootstage_id {
 
/* Next 10 IDs used by BOOTSTAGE_SUB_... */
BOOTSTAGE_ID_FIT_RD_START = 120,/* Ramdisk stages */
-   BOOTSTAGE_ID_FIT_RD_FORMAT = 120,
-   BOOTSTAGE_ID_FIT_RD_FORMAT_OK,
-   BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME,
-   BOOTSTAGE_ID_FIT_RD_UNIT_NAME,
-   BOOTSTAGE_ID_FIT_RD_SUBNODE,
-
-   BOOTSTAGE_ID_FIT_RD_CHECK,
-   BOOTSTAGE_ID_FIT_RD_HASH = 125,
-   BOOTSTAGE_ID_FIT_RD_CHECK_ALL,
-   BOOTSTAGE_ID_FIT_RD_GET_DATA,
-   BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK = 127,
-   BOOTSTAGE_ID_FIT_RD_GET_DATA_OK,
-   BOOTSTAGE_ID_FIT_RD_LOAD,
 
BOOTSTAGE_ID_IDE_FIT_READ = 140,
BOOTSTAGE_ID_IDE_FIT_READ_OK,
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 03/22] fs: Add support for saving data to filesystems

2013-01-10 Thread Simon Glass
Add a new method for saving that filesystems can implement. This mirrors the
existing load method.

Signed-off-by: Simon Glass 
---
 fs/fs.c  |   74 ++
 include/fs.h |2 +
 2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 6f5063c..eee7e23 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -47,6 +47,12 @@ static inline int fs_read_unsupported(const char *filename, 
void *buf,
return -1;
 }
 
+static inline int fs_write_unsupported(const char *filename, void *buf,
+ int offset, int len)
+{
+   return -1;
+}
+
 static inline void fs_close_unsupported(void)
 {
 }
@@ -57,6 +63,7 @@ struct fstype_info {
 disk_partition_t *fs_partition);
int (*ls)(const char *dirname);
int (*read)(const char *filename, void *buf, int offset, int len);
+   int (*write)(const char *filename, void *buf, int offset, int len);
void (*close)(void);
 };
 
@@ -94,6 +101,7 @@ static struct fstype_info fstypes[] = {
.close = fs_close_unsupported,
.ls = fs_ls_unsupported,
.read = fs_read_unsupported,
+   .write = fs_write_unsupported,
},
 };
 
@@ -125,6 +133,7 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype)
info->close += gd->reloc_off;
info->ls += gd->reloc_off;
info->read += gd->reloc_off;
+   info->write += gd->reloc_off;
}
relocated = 1;
}
@@ -196,6 +205,30 @@ int fs_read(const char *filename, ulong addr, int offset, 
int len)
return ret;
 }
 
+int fs_write(const char *filename, ulong addr, int offset, int len)
+{
+   struct fstype_info *info = fs_get_info(fs_type);
+   void *buf;
+   int ret;
+
+   /*
+* We don't actually know how many bytes are being read, since len==0
+* means read the whole file.
+*/
+   buf = map_sysmem(addr, len);
+   ret = info->write(filename, buf, offset, len);
+   unmap_sysmem(buf);
+
+   /* If we requested a specific number of bytes, check we got it */
+   if (ret >= 0 && len && ret != len) {
+   printf("** Unable to write file %s **\n", filename);
+   ret = -1;
+   }
+   fs_close();
+
+   return ret;
+}
+
 int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int fstype, int cmdline_base)
 {
@@ -277,3 +310,44 @@ int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
 
return 0;
 }
+
+int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+   int fstype, int cmdline_base)
+{
+   unsigned long addr;
+   const char *filename;
+   unsigned long bytes;
+   unsigned long pos;
+   int len;
+   unsigned long time;
+
+   if (argc < 6 || argc > 7)
+   return CMD_RET_USAGE;
+
+   if (fs_set_blk_dev(argv[1], argv[2], fstype))
+   return 1;
+
+   filename = argv[3];
+   addr = simple_strtoul(argv[4], NULL, cmdline_base);
+   bytes = simple_strtoul(argv[5], NULL, cmdline_base);
+   if (argc >= 7)
+   pos = simple_strtoul(argv[6], NULL, cmdline_base);
+   else
+   pos = 0;
+
+   time = get_timer(0);
+   len = fs_write(filename, addr, pos, bytes);
+   time = get_timer(time);
+   if (len <= 0)
+   return 1;
+
+   printf("%d bytes written in %lu ms", len, time);
+   if (time > 0) {
+   puts(" (");
+   print_size(len / time * 1000, "/s");
+   puts(")");
+   }
+   puts("\n");
+
+   return 0;
+}
diff --git a/include/fs.h b/include/fs.h
index b6d69e5..c837bae 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -62,5 +62,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
int fstype, int cmdline_base);
 int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int fstype);
+int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+   int fstype, int cmdline_base);
 
 #endif /* _FS_H */
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 15/22] image: Use fit_image_load() to load ramdisk

2013-01-10 Thread Simon Glass
Use the new common code to load a ramdisk. The functionality should not
change.

Signed-off-by: Simon Glass 
---
 common/image-fit.c |   62 --
 common/image.c |  122 +++-
 include/image.h|1 -
 3 files changed, 16 insertions(+), 169 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index ef736f3..84462ec 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1412,25 +1412,6 @@ int fit_conf_get_kernel_node(const void *fit, int 
noffset)
 }
 
 /**
- * fit_conf_get_ramdisk_node - get ramdisk image node offset that corresponds 
to
- * a given configuration
- * @fit: pointer to the FIT format image header
- * @noffset: configuration node offset
- *
- * fit_conf_get_ramdisk_node() retrives ramdisk image node unit name from
- * configuration FIT_KERNEL_PROP property and translates it to the node
- * offset.
- *
- * returns:
- * image node offset when found (>=0)
- * negative number on failure (FDT_ERR_* code)
- */
-int fit_conf_get_ramdisk_node(const void *fit, int noffset)
-{
-   return fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP);
-}
-
-/**
  * fit_conf_get_fdt_node - get fdt image node offset that corresponds to
  * a given configuration
  * @fit: pointer to the FIT format image header
@@ -1508,49 +1489,6 @@ int fit_image_select(const void *fit, int rd_noffset, 
int verify)
return 0;
 }
 
-/**
- * fit_check_ramdisk - verify FIT format ramdisk subimage
- * @fit_hdr: pointer to the FIT ramdisk header
- * @rd_noffset: ramdisk subimage node offset within FIT image
- * @arch: requested ramdisk image architecture type
- * @verify: data CRC verification flag
- *
- * fit_check_ramdisk() verifies integrity of the ramdisk subimage and from
- * specified FIT image.
- *
- * returns:
- * 1, on success
- * 0, on failure
- */
-int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
-   int verify)
-{
-   fit_image_print(fit, rd_noffset, "   ");
-
-   if (verify) {
-   puts("   Verifying Hash Integrity ... ");
-   if (!fit_image_verify(fit, rd_noffset)) {
-   puts("Bad Data Hash\n");
-   bootstage_error(BOOTSTAGE_ID_FIT_RD_HASH);
-   return 0;
-   }
-   puts("OK\n");
-   }
-
-   bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
-   if (!fit_image_check_os(fit, rd_noffset, IH_OS_LINUX) ||
-   !fit_image_check_arch(fit, rd_noffset, arch) ||
-   !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
-   printf("No Linux %s Ramdisk Image\n",
-   genimg_get_arch_name(arch));
-   bootstage_error(BOOTSTAGE_ID_FIT_RD_CHECK_ALL);
-   return 0;
-   }
-
-   bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK);
-   return 1;
-}
-
 int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
ulong addr)
 {
diff --git a/common/image.c b/common/image.c
index a5bae46..26b9653 100644
--- a/common/image.c
+++ b/common/image.c
@@ -52,6 +52,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef CONFIG_CMD_BDI
@@ -810,14 +811,10 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
char *end;
 #endif
 #if defined(CONFIG_FIT)
-   void*fit_hdr;
const char  *fit_uname_config = NULL;
const char  *fit_uname_ramdisk = NULL;
ulong   default_addr;
int rd_noffset;
-   int cfg_noffset;
-   const void  *data;
-   size_t  size;
 #endif
 
*rd_start = 0;
@@ -865,32 +862,16 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
 #if defined(CONFIG_FIT)
} else {
/* use FIT configuration provided in first bootm
-* command argument
+* command argument. If the property is not defined,
+* quit silently.
 */
rd_addr = map_to_sysmem(images->fit_hdr_os);
-   fit_uname_config = images->fit_uname_cfg;
-   debug("*  ramdisk: using config '%s' from image "
-   "at 0x%08lx\n",
-   fit_uname_config, rd_addr);
-
-   /*
-* Check whether configuration has ramdisk defined,
-* if not, don't try to use it, quit silently.
-*/
-   fit_hdr = images->fit_hdr_os;
-   cfg_noffset = fit_conf_get_node(fit_hdr,
-   fit_uname_config);
-   if (cfg_noffset < 0) {
-   debug("*  ramdisk: no 

[U-Boot] [RFC PATCH 21/22] sandbox: image: Create a test for loading FIT images

2013-01-10 Thread Simon Glass
The image code is fairly complex with various different options. It would
be useful to have comprehensive tests for this.

As a start, create a script which tries out loading a kernel/ramdisk/fdt
from a FIT and checks that the images appear in the right place in memory.

This uses sandbox which now supports bootm and related features.

Signed-off-by: Simon Glass 
---
 test/image/test-fit.py |  422 
 1 files changed, 422 insertions(+), 0 deletions(-)
 create mode 100755 test/image/test-fit.py

diff --git a/test/image/test-fit.py b/test/image/test-fit.py
new file mode 100755
index 000..c4e8211
--- /dev/null
+++ b/test/image/test-fit.py
@@ -0,0 +1,422 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2013, Google Inc.
+#
+# Sanity check of the FIT handling in U-Boot
+#
+# 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
+#
+# To run this:
+#
+# make O=sandbox sandbox_config
+# make O=sandbox
+# ./test/image/test-fit.py -u sandbox/u-boot
+
+import doctest
+from optparse import OptionParser
+import os
+import shutil
+import struct
+import sys
+import tempfile
+
+# The 'command' library in patman is convenient for running commands
+base_path = os.path.dirname(sys.argv[0])
+patman = os.path.join(base_path, '../../tools/patman')
+sys.path.append(patman)
+
+import command
+
+# Define a base ITS which we can adjust using % and a dictionary
+base_its = '''
+/dts-v1/;
+
+/ {
+description = "Chrome OS kernel image with one or more FDT blobs";
+#address-cells = <1>;
+
+images {
+kernel@1 {
+data = /incbin/("%(kernel)s");
+type = "kernel";
+arch = "sandbox";
+os = "linux";
+compression = "none";
+load = <0x4>;
+entry = <0x8>;
+};
+fdt@1 {
+description = "snow";
+data = /incbin/("u-boot.dtb");
+type = "flat_dt";
+arch = "sandbox";
+%(fdt_load)s
+compression = "none";
+signature@1 {
+algo = "sha1,rsa2048";
+key-name-hint = "dev";
+};
+};
+ramdisk@1 {
+description = "snow";
+data = /incbin/("%(ramdisk)s");
+type = "ramdisk";
+arch = "sandbox";
+os = "linux";
+%(ramdisk_load)s
+compression = "none";
+};
+};
+configurations {
+default = "conf@1";
+conf@1 {
+kernel = "kernel@1";
+fdt = "fdt@1";
+%(ramdisk_config)s
+};
+};
+};
+'''
+
+# Define a base FDT - currently we don't use anything in this
+base_fdt = '''
+/dts-v1/;
+
+/ {
+model = "Sandbox Verified Boot Test";
+compatible = "sandbox";
+
+};
+'''
+
+# This is the U-Boot script that is run for each test. First load the fit,
+# then do the 'bootm' command, then save out memory from the places where
+# we expect 'bootm' to write things. Then quit.
+base_script = '''
+sb load host 0 %(fit_addr)x %(fit)s
+fdt addr %(fit_addr)x
+bootm start %(fit_addr)x
+bootm loados
+sb save host 0 %(kernel_out)s %(kernel_addr)x %(kernel_size)x
+sb save host 0 %(fdt_out)s %(fdt_addr)x %(fdt_size)x
+sb save host 0 %(ramdisk_out)s %(ramdisk_addr)x %(ramdisk_size)x
+reset
+'''
+
+def make_fname(leaf):
+"""Make a temporary filename
+
+Args:
+leaf: Leaf name of file to create (within temporary directory)
+Return:
+Temporary filename
+"""
+global base_dir
+
+return os.path.join(base_dir, leaf)
+
+def filesize(fname):
+"""Get the size of a file
+
+Args:
+fname: Filename to check
+Return:
+Size of file in bytes
+"""
+return os.stat(fname).st_size
+
+def read_file(fname):
+"""Read the contents of a file
+
+Args:
+fname: Filename to read
+Returns:
+C

[U-Boot] [RFC PATCH 14/22] image: Introduce fit_image_load() to load images from FITs

2013-01-10 Thread Simon Glass
At present code to load an image from a FIT is duplicated in the three
places where it is needed (kernel, fdt, ramdisk).

The differences between these different code copies is fairly minor.
Create a new function in the fit code which can handle any of the
requirements of those cases.

Signed-off-by: Simon Glass 
---
 common/image-fit.c |  221 
 include/image.h|   77 ++-
 2 files changed, 296 insertions(+), 2 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 9f17924..ef736f3 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -32,6 +32,7 @@
 #else
 #include 
 #include 
+#include 
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
 
@@ -1491,6 +1492,22 @@ void fit_conf_print(const void *fit, int noffset, const 
char *p)
printf("%s  FDT:  %s\n", p, uname);
 }
 
+int fit_image_select(const void *fit, int rd_noffset, int verify)
+{
+   fit_image_print(fit, rd_noffset, "   ");
+
+   if (verify) {
+   puts("   Verifying Hash Integrity ... ");
+   if (!fit_image_verify(fit, rd_noffset)) {
+   puts("Bad Data Hash\n");
+   return -EACCES;
+   }
+   puts("OK\n");
+   }
+
+   return 0;
+}
+
 /**
  * fit_check_ramdisk - verify FIT format ramdisk subimage
  * @fit_hdr: pointer to the FIT ramdisk header
@@ -1533,3 +1550,207 @@ int fit_check_ramdisk(const void *fit, int rd_noffset, 
uint8_t arch,
bootstage_mark(BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK);
return 1;
 }
+
+int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
+   ulong addr)
+{
+   int cfg_noffset;
+   void *fit_hdr;
+   int noffset;
+
+   debug("*  %s: using config '%s' from image at 0x%08lx\n",
+ prop_name, images->fit_uname_cfg, addr);
+
+   /* Check whether configuration has this property defined */
+   fit_hdr = map_sysmem(addr, 0);
+   cfg_noffset = fit_conf_get_node(fit_hdr, images->fit_uname_cfg);
+   if (cfg_noffset < 0) {
+   debug("*  %s: no such config\n", prop_name);
+   return -ENOENT;
+   }
+
+   noffset = fit_conf_get_prop_node(fit_hdr, cfg_noffset, prop_name);
+   if (noffset < 0) {
+   debug("*  %s: no %s in config\n", prop_name, prop_name);
+   return -ENOLINK;
+   }
+
+   return noffset;
+}
+
+int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
+  const char **fit_unamep, const char *fit_uname_config,
+  int arch, int image_type, int bootstage_id,
+  enum fit_load_op load_op, ulong *datap, ulong *lenp)
+{
+   int cfg_noffset, noffset;
+   const char *fit_uname;
+   const void *fit;
+   const void *buf;
+   size_t size;
+   int type_ok, os_ok;
+   ulong load, data, len;
+   int ret;
+
+   fit = map_sysmem(addr, 0);
+   fit_uname = fit_unamep ? *fit_unamep : NULL;
+   printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr);
+
+   bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT);
+   if (!fit_check_format(fit)) {
+   printf("Bad FIT %s image format!\n", prop_name);
+   bootstage_error(bootstage_id + BOOTSTAGE_SUB_FORMAT);
+   return -ENOEXEC;
+   }
+   bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT_OK);
+   if (fit_uname) {
+   /* get ramdisk component image node offset */
+   bootstage_mark(bootstage_id + BOOTSTAGE_SUB_UNIT_NAME);
+   noffset = fit_image_get_node(fit, fit_uname);
+   } else {
+   /*
+* no image node unit name, try to get config
+* node first. If config unit node name is NULL
+* fit_conf_get_node() will try to find default config node
+*/
+   bootstage_mark(bootstage_id + BOOTSTAGE_SUB_NO_UNIT_NAME);
+   if (IMAGE_ENABLE_BEST_MATCH && !fit_uname_config) {
+   cfg_noffset = fit_conf_find_compat(fit, gd_fdt_blob());
+   } else {
+   cfg_noffset = fit_conf_get_node(fit,
+   fit_uname_config);
+   }
+   if (cfg_noffset < 0) {
+   puts("Could not find configuration node\n");
+   bootstage_error(bootstage_id +
+   BOOTSTAGE_SUB_NO_UNIT_NAME);
+   return -ENOENT;
+   }
+   fit_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
+   printf("   Using '%s' configuration\n", fit_uname_config);
+   if (image_type == IH_TYPE_KERNEL) {
+   /* Remember (and possibly verify) this config */
+   images->fit_uname_cfg =

[U-Boot] [RFC PATCH 11/22] sparc: Use image_setup_linux() instead of local code

2013-01-10 Thread Simon Glass
Sparc only really sets up the ramdisk, but we should still use
image_setup_linux() so that setup is common across all architectures
that use the FDT.

Signed-off-by: Simon Glass 
---
 arch/sparc/lib/bootm.c |   13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/sparc/lib/bootm.c b/arch/sparc/lib/bootm.c
index bcc6358..472f9ac 100644
--- a/arch/sparc/lib/bootm.c
+++ b/arch/sparc/lib/bootm.c
@@ -131,17 +131,16 @@ int do_bootm_linux(int flag, int argc, char * const 
argv[], bootm_headers_t * im
 * extracted and is writeable.
 */
 
+   ret = image_setup_boot(images);
+   if (ret) {
+   puts("### Failed to relocate RAM disk\n");
+   goto error;
+   }
+
/* Calc length of RAM disk, if zero no ramdisk available */
rd_len = images->rd_end - images->rd_start;
 
if (rd_len) {
-   ret = boot_ramdisk_high(lmb, images->rd_start, rd_len,
-   &initrd_start, &initrd_end);
-   if (ret) {
-   puts("### Failed to relocate RAM disk\n");
-   goto error;
-   }
-
/* Update SPARC kernel header so that Linux knows
 * what is going on and where to find RAM disk.
 *
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 18/22] image: Use fit_image_load() to load kernel

2013-01-10 Thread Simon Glass
Use the new common code to load a kernel. The functionality should not
change.

Signed-off-by: Simon Glass 
---
 common/cmd_bootm.c |  153 +++-
 common/image-fit.c |   19 ---
 include/image.h|1 -
 3 files changed, 8 insertions(+), 165 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2dbf4df..58eec83 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -88,11 +88,6 @@ static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[]);
 static void fixup_silent_linux(void);
 #endif
 
-static image_header_t *image_get_kernel(ulong img_addr, int verify);
-#if defined(CONFIG_FIT)
-static int fit_check_kernel(const void *fit, int os_noffset, int verify);
-#endif
-
 static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], bootm_headers_t *images,
ulong *os_data, ulong *os_len);
@@ -778,54 +773,6 @@ static image_header_t *image_get_kernel(ulong img_addr, 
int verify)
 }
 
 /**
- * fit_check_kernel - verify FIT format kernel subimage
- * @fit_hdr: pointer to the FIT image header
- * os_noffset: kernel subimage node offset within FIT image
- * @verify: data CRC verification flag
- *
- * fit_check_kernel() verifies integrity of the kernel subimage and from
- * specified FIT image.
- *
- * returns:
- * 1, on success
- * 0, on failure
- */
-#if defined(CONFIG_FIT)
-static int fit_check_kernel(const void *fit, int os_noffset, int verify)
-{
-   fit_image_print(fit, os_noffset, "   ");
-
-   if (verify) {
-   puts("   Verifying Hash Integrity ... ");
-   if (!fit_image_verify(fit, os_noffset)) {
-   puts("Bad Data Hash\n");
-   bootstage_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
-   return 0;
-   }
-   puts("OK\n");
-   }
-   bootstage_mark(BOOTSTAGE_ID_FIT_CHECK_ARCH);
-
-   if (!fit_image_check_target_arch(fit, os_noffset)) {
-   puts("Unsupported Architecture\n");
-   bootstage_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
-   return 0;
-   }
-
-   bootstage_mark(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
-   if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
-   !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
-   puts("Not a kernel image\n");
-   bootstage_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
-   return 0;
-   }
-
-   bootstage_mark(BOOTSTAGE_ID_FIT_CHECKED);
-   return 1;
-}
-#endif /* CONFIG_FIT */
-
-/**
  * boot_get_kernel - find kernel image
  * @os_data: pointer to a ulong variable, will hold os data start address
  * @os_len: pointer to a ulong variable, will hold os data length
@@ -845,12 +792,8 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int 
flag, int argc,
ulong   img_addr;
const void *buf;
 #if defined(CONFIG_FIT)
-   const void  *fit_hdr;
const char  *fit_uname_config = NULL;
const char  *fit_uname_kernel = NULL;
-   const void  *data;
-   size_t  len;
-   int cfg_noffset;
int os_noffset;
 #endif
 
@@ -927,96 +870,16 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int 
flag, int argc,
break;
 #if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
-   fit_hdr = buf;
-   printf("## Booting kernel from FIT Image at %08lx ...\n",
-   img_addr);
-
-   if (!fit_check_format(fit_hdr)) {
-   puts("Bad FIT kernel image format!\n");
-   bootstage_error(BOOTSTAGE_ID_FIT_FORMAT);
+   os_noffset = fit_image_load(images, FIT_KERNEL_PROP,
+   img_addr,
+   &fit_uname_kernel, fit_uname_config,
+   IH_ARCH_DEFAULT, IH_TYPE_KERNEL,
+   BOOTSTAGE_ID_FIT_KERNEL_START,
+   FIT_LOAD_IGNORED, os_data, os_len);
+   if (os_noffset < 0)
return NULL;
-   }
-   bootstage_mark(BOOTSTAGE_ID_FIT_FORMAT);
-
-   if (!fit_uname_kernel) {
-   /*
-* no kernel image node unit name, try to get config
-* node first. If config unit node name is NULL
-* fit_conf_get_node() will try to find default config
-* node
-*/
-   bootstage_mark(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);
-#ifdef CONFIG_FIT_BEST_MATCH
-   if (fit_uname_config)
-   cfg_noffset =
-   fit_conf_get_node(fit_hdr,
-   

[U-Boot] [RFC PATCH 16/22] image: Use fit_image_load() to load FDT

2013-01-10 Thread Simon Glass
Use the new common code to load a flat device tree. Also fix up a few casts
so that this code works with sandbox. Other than that the functionality
should not change.

Signed-off-by: Simon Glass 
---
 common/cmd_bootm.c |4 +-
 common/image-fdt.c |  214 +++-
 common/image-fit.c |   19 -
 include/image.h|6 +-
 4 files changed, 33 insertions(+), 210 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d71ffb5..33320cb 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -295,7 +295,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
 
 #if defined(CONFIG_OF_LIBFDT)
/* find flattened device tree */
-   ret = boot_get_fdt(flag, argc, argv, &images,
+   ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
   &images.ft_addr, &images.ft_len);
if (ret) {
puts("Could not find a valid device tree\n");
@@ -1609,7 +1609,7 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int 
argc,
 
 #if defined(CONFIG_OF_LIBFDT)
/* find flattened device tree */
-   ret = boot_get_fdt(flag, argc, argv, images,
+   ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, images,
   &images->ft_addr, &images->ft_len);
if (ret) {
puts("Could not find a valid device tree\n");
diff --git a/common/image-fdt.c b/common/image-fdt.c
index e317735..d4bcad8 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -212,51 +212,11 @@ error:
return 1;
 }
 
-#if defined(CONFIG_FIT)
-/**
- * fit_check_fdt - verify FIT format FDT subimage
- * @fit_hdr: pointer to the FIT  header
- * fdt_noffset: FDT subimage node offset within FIT image
- * @verify: data CRC verification flag
- *
- * fit_check_fdt() verifies integrity of the FDT subimage and from
- * specified FIT image.
- *
- * returns:
- * 1, on success
- * 0, on failure
- */
-static int fit_check_fdt(const void *fit, int fdt_noffset, int verify)
-{
-   fit_image_print(fit, fdt_noffset, "   ");
-
-   if (verify) {
-   puts("   Verifying Hash Integrity ... ");
-   if (!fit_image_verify(fit, fdt_noffset)) {
-   fdt_error("Bad Data Hash");
-   return 0;
-   }
-   puts("OK\n");
-   }
-
-   if (!fit_image_check_type(fit, fdt_noffset, IH_TYPE_FLATDT)) {
-   fdt_error("Not a FDT image");
-   return 0;
-   }
-
-   if (!fit_image_check_comp(fit, fdt_noffset, IH_COMP_NONE)) {
-   fdt_error("FDT image is compressed");
-   return 0;
-   }
-
-   return 1;
-}
-#endif
-
 /**
  * boot_get_fdt - main fdt handling routine
  * @argc: command argument count
  * @argv: command argument list
+ * @arch: architecture (IH_ARCH_...)
  * @images: pointer to the bootm images structure
  * @of_flat_tree: pointer to a char* variable, will hold fdt start address
  * @of_size: pointer to a ulong variable, will hold fdt length
@@ -274,24 +234,20 @@ static int fit_check_fdt(const void *fit, int 
fdt_noffset, int verify)
  * 1, if fdt image is found but corrupted
  * of_flat_tree and of_size are set to 0 if no fdt exists
  */
-int boot_get_fdt(int flag, int argc, char * const argv[],
+int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
 {
const image_header_t *fdt_hdr;
ulong   fdt_addr;
char*fdt_blob = NULL;
ulong   image_start, image_data, image_end;
-   ulong   load_start, load_end;
+   ulong   load, load_end;
void*buf;
 #if defined(CONFIG_FIT)
-   void*fit_hdr;
const char  *fit_uname_config = NULL;
const char  *fit_uname_fdt = NULL;
ulong   default_addr;
-   int cfg_noffset;
int fdt_noffset;
-   const void  *data;
-   size_t  size;
 #endif
 
*of_flat_tree = NULL;
@@ -337,32 +293,14 @@ int boot_get_fdt(int flag, int argc, char * const argv[],
 * command argument
 */
fdt_addr = map_to_sysmem(images->fit_hdr_os);
-   fit_uname_config = images->fit_uname_cfg;
-   debug("*  fdt: using config '%s' from image "
-   "at 0x%08lx\n",
-   fit_uname_config, fdt_addr);
-
-   /*
-* Check whether configuration has FDT blob defined,
-* if not quit silently.
-*/
-   fit_hdr = images->fit_hdr_os;
-   cfg_noffset = fit_conf_

[U-Boot] [RFC PATCH 12/22] bootstage: Introduce sub-IDs for use with image loading

2013-01-10 Thread Simon Glass
Loading a ramdisk, kernel or FDT goes through similar stages. Create
a block of IDs for each task, and define a consistent numbering within
the block. This will allow use of common code for image loading.

Signed-off-by: Simon Glass 
---
 include/bootstage.h |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/bootstage.h b/include/bootstage.h
index 08bf2b0..f577ba8 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -37,6 +37,24 @@ enum bootstage_flags {
BOOTSTAGEF_ALLOC= 1 << 1,   /* Allocate an id */
 };
 
+/* bootstate sub-IDs used for kernel and ramdisk ranges */
+enum {
+   BOOTSTAGE_SUB_FORMAT,
+   BOOTSTAGE_SUB_FORMAT_OK,
+   BOOTSTAGE_SUB_NO_UNIT_NAME,
+   BOOTSTAGE_SUB_UNIT_NAME,
+   BOOTSTAGE_SUB_SUBNODE,
+
+   BOOTSTAGE_SUB_CHECK,
+   BOOTSTAGE_SUB_HASH = 5,
+   BOOTSTAGE_SUB_CHECK_ARCH = 5,
+   BOOTSTAGE_SUB_CHECK_ALL,
+   BOOTSTAGE_SUB_GET_DATA,
+   BOOTSTAGE_SUB_CHECK_ALL_OK = 7,
+   BOOTSTAGE_SUB_GET_DATA_OK,
+   BOOTSTAGE_SUB_LOAD,
+};
+
 /*
  * A list of boot stages that we know about. Each of these indicates the
  * state that we are at, and the action that we are about to perform. For
@@ -137,10 +155,12 @@ enum bootstage_id {
BOOTSTAGE_ID_NET_DONE_ERR,
BOOTSTAGE_ID_NET_DONE,
 
+   BOOTSTAGE_ID_FIT_FDT_START = 90,
/*
 * Boot stages related to loading a FIT image. Some of these are a
 * bit wonky.
 */
+   BOOTSTAGE_ID_FIT_KERNEL_START = 100,
BOOTSTAGE_ID_FIT_FORMAT = 100,
BOOTSTAGE_ID_FIT_NO_UNIT_NAME,
BOOTSTAGE_ID_FIT_UNIT_NAME,
@@ -161,6 +181,8 @@ enum bootstage_id {
BOOTSTAGE_ID_FIT_LOADADDR,
BOOTSTAGE_ID_OVERWRITTEN,
 
+   /* Next 10 IDs used by BOOTSTAGE_SUB_... */
+   BOOTSTAGE_ID_FIT_RD_START = 120,/* Ramdisk stages */
BOOTSTAGE_ID_FIT_RD_FORMAT = 120,
BOOTSTAGE_ID_FIT_RD_FORMAT_OK,
BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME,
-- 
1.7.7.3

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


[U-Boot] [RFC PATCH 10/22] m68k: Use image_setup_linux() instead of local code

2013-01-10 Thread Simon Glass
Rather than having similar code in m68k, use image_setup_linux() which
should be common across all architectures that use the FDT.

Signed-off-by: Simon Glass 
---
 arch/m68k/lib/bootm.c |   15 +++
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index d506d0c..56b6512 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -78,13 +78,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
 
-   /* allocate space and init command line */
-   ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end);
-   if (ret) {
-   puts("ERROR with allocation of cmdline\n");
-   goto error;
-   }
-
/* allocate space for kernel copy of board info */
ret = boot_get_kbd (lmb, &kbd);
if (ret) {
@@ -93,14 +86,12 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
}
set_clocks_in_mhz(kbd);
 
-   kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))images->ep;
-
-   rd_len = images->rd_end - images->rd_start;
-   ret = boot_ramdisk_high (lmb, images->rd_start, rd_len,
-   &initrd_start, &initrd_end);
+   ret = image_setup_linux(images);
if (ret)
goto error;
 
+   kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))images->ep;
+
debug("## Transferring control to Linux (at address %08lx) ...\n",
  (ulong) kernel);
 
-- 
1.7.7.3

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


Re: [U-Boot] [PATCH 2/3 V4] EXYNOS5: Add device node for PMIC

2013-01-10 Thread Simon Glass
On Thu, Jan 3, 2013 at 9:38 PM, Rajeshwari Shinde
 wrote:
> Add device node for MAX77686
>
> Signed-off-by: Rajeshwari Shinde 

Acked-by: Simon Glass 

> ---
> Changes in V2:
> - Changed reg value from 06 to 6.
> Chnages in V3:
> - converted the pmic name to small letters.
> Changes in V4:
> - Corrected PMIC register address
>  board/samsung/dts/exynos5250-smdk5250.dts |7 +++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/board/samsung/dts/exynos5250-smdk5250.dts 
> b/board/samsung/dts/exynos5250-smdk5250.dts
> index a8e62da..f168a17 100644
> --- a/board/samsung/dts/exynos5250-smdk5250.dts
> +++ b/board/samsung/dts/exynos5250-smdk5250.dts
> @@ -59,4 +59,11 @@
> compatible = "wolfson,wm8994-codec";
> };
> };
> +
> +   i2c@12c6 {
> +   pmic@9 {
> +   reg = <0x9>;
> +   compatible = "maxim,max77686_pmic";
> +   };
> +   };
>  };
> --
> 1.7.4.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 V4] PMIC: MAX77686: Add FDT Support

2013-01-10 Thread Simon Glass
On Thu, Jan 3, 2013 at 9:38 PM, Rajeshwari Shinde
 wrote:
> This patch adds fdt support to MAX77686.
>
> Signed-off-by: Rajeshwari Shinde 

Acked-by: Simon Glass 

> ---
> Changes in V2:
> - Corrected indentation errors.
> Changes in V3:
> - Rebased on top of the latest implementation
> of PMIC
> Changes in V4:
> - Corrected PMIC register address
>  drivers/power/pmic/pmic_max77686.c |   37 +--
>  1 files changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/pmic/pmic_max77686.c 
> b/drivers/power/pmic/pmic_max77686.c
> index fce0183..a1ee04e 100644
> --- a/drivers/power/pmic/pmic_max77686.c
> +++ b/drivers/power/pmic/pmic_max77686.c
> @@ -22,10 +22,14 @@
>   */
>
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  int pmic_init(unsigned char bus)
>  {
> static const char name[] = "MAX77686_PMIC";
> @@ -36,13 +40,40 @@ int pmic_init(unsigned char bus)
> return -ENOMEM;
> }
>
> -   puts("Board PMIC init\n");
> +#ifdef CONFIG_OF_CONTROL
> +   const void *blob = gd->fdt_blob;
> +   int node, parent;
> +
> +   node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC);
> +   if (node < 0) {
> +   debug("PMIC: No node for PMIC Chip in device tree\n");
> +   debug("node = %d\n", node);
> +   return -1;
> +   }
> +
> +   parent = fdt_parent_offset(blob, node);
> +   if (parent < 0) {
> +   debug("%s: Cannot find node parent\n", __func__);
> +   return -1;
> +   }
> +
> +   p->bus = i2c_get_bus_num_fdt(parent);
> +   if (p->bus < 0) {
> +   debug("%s: Cannot find I2C bus\n", __func__);
> +   return -1;
> +   }
> +   p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 9);
> +#else
> +   p->bus = bus;
> +   p->hw.i2c.addr = MAX77686_I2C_ADDR;
> +#endif
> +
> p->name = name;
> p->interface = PMIC_I2C;
> p->number_of_regs = PMIC_NUM_OF_REGS;
> -   p->hw.i2c.addr = MAX77686_I2C_ADDR;
> p->hw.i2c.tx_num = 1;
> -   p->bus = bus;
> +
> +   puts("Board PMIC init\n");
>
> return 0;
>  }
> --
> 1.7.4.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] pcm051: Add support for Phytec phyCORE-AM335x

2013-01-10 Thread Tom Rini
On Thu, Jan 10, 2013 at 08:30:09AM +0100, Lars Poeschel wrote:
> Hi Wolfgang, hi Tom,
> 
> as I almost have the changes requested by Wolfgang in place, you two can 
> choose, which version I should resubmit. ;)
> 
> Am 09.01.2013 um 20:34 schrieb Tom Rini:
[snip]
> >>> + if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
> >>> + debug(" not set. Reading from E-fuse\n");
> >> 
> >> This should be a printf().  Any such automatic changes are always
> >> worth to be told explicitly.
> > 
> > This is the normal case of asking the hardware what MAC it shipped with.
> > Why do we want to tell the user the expected has happened?
> 
> Here I'd prefer the printf variant, because for a common user it is not 
> obivous, that it is reading the MAC from efuse. So this message is helpful.

OK, please also patch board/ti/am335x/board.c to also printf here then.
Other than that, yes, I'd be happy to see you make the other changes you
said.  Just partially trying to help explain the SoC to Wolfgang :)

-- 
Tom


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


Re: [U-Boot] [PATCH V4 2/9] EXYNOS5: FDT: Add DWMMC device node data

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch adds DWMMC device node data for exynos5.
> This patch also adds binding file for DWMMC device node.
>
> Changes from V1:
> 1)Added binding file for DWMMC device node at the location
> "doc/device-tree-bindings/exynos/dwmmc.txt".
> 2)Removed the propname 'index' from device node.
> 3)Prefixed the vendor name 'samsung' before propname in device node.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> No change.

Sorry I may be too late with this comment.

>
> Signed-off-by: Vivek Gautam 
> Signed-off-by: Amar X
> ---
>  arch/arm/dts/exynos5250.dtsi  | 32 
> +++
>  board/samsung/dts/exynos5250-smdk5250.dts | 22 +
>  doc/device-tree-bindings/exynos/dwmmc.txt | 29 
>  3 files changed, 83 insertions(+)
>  create mode 100644 doc/device-tree-bindings/exynos/dwmmc.txt
>
> diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
> index 1008797..b701ae5 100644
> --- a/arch/arm/dts/exynos5250.dtsi
> +++ b/arch/arm/dts/exynos5250.dtsi
> @@ -138,4 +138,36 @@
> reg = <0x131b 0x30>;
> interrupts = <0 130 0>;
> };
> +
> +   dwmmc@1220 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "samsung,exynos5250-dwmmc";
> +   reg = <0x1220 0x1000>;
> +   interrupts = <0 75 0>;
> +   };
> +
> +   dwmmc@1221 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "samsung,exynos5250-dwmmc";
> +   reg = <0x1221 0x1000>;
> +   interrupts = <0 76 0>;
> +   };
> +
> +   dwmmc@1222 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "samsung,exynos5250-dwmmc";
> +   reg = <0x1222 0x1000>;
> +   interrupts = <0 77 0>;
> +   };
> +
> +   dwmmc@1223 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "samsung,exynos5250-dwmmc";
> +   reg = <0x1223 0x1000>;
> +   interrupts = <0 78 0>;
> +   };
>  };
> diff --git a/board/samsung/dts/exynos5250-smdk5250.dts 
> b/board/samsung/dts/exynos5250-smdk5250.dts
> index a8e62da..9baf622 100644
> --- a/board/samsung/dts/exynos5250-smdk5250.dts
> +++ b/board/samsung/dts/exynos5250-smdk5250.dts
> @@ -30,6 +30,10 @@
> spi2 = "/spi@12d4";
> spi3 = "/spi@131a";
> spi4 = "/spi@131b";
> +   dwmmc0 = "/dwmmc@1220";
> +   dwmmc1 = "/dwmmc@1221";
> +   dwmmc2 = "/dwmmc@1222";
> +   dwmmc3 = "/dwmmc@1223";

I think this should be mmc0, mmc1 instead of dwmmc0, dwmmc1, since
ultimate we might want to support different drivers for each. The
alias is support to link the generic mmc device number with the
driver, and I don't think the numbering should be specific to the
driver.

> };
>
> sromc@1225 {
> @@ -59,4 +63,22 @@
> compatible = "wolfson,wm8994-codec";
> };
> };
> +
> +   dwmmc@1220 {
> +   samsung,bus-width = <8>;
> +   samsung,timing = <1 3 3>;
> +   };
> +
> +   dwmmc@1221 {
> +   status = "disabled";
> +   };
> +
> +   dwmmc@1222 {
> +   samsung,bus-width = <4>;
> +   samsung,timing = <1 2 3>;
> +   };
> +
> +   dwmmc@1223 {
> +   status = "disabled";
> +   };
>  };
> diff --git a/doc/device-tree-bindings/exynos/dwmmc.txt 
> b/doc/device-tree-bindings/exynos/dwmmc.txt
> new file mode 100644
> index 000..6232ad6
> --- /dev/null
> +++ b/doc/device-tree-bindings/exynos/dwmmc.txt
> @@ -0,0 +1,29 @@
> +* Exynos 5250 DWC_mobile_storage
> +
> +The Exynos 5250 provides DWC_mobile_storage interface which supports
> +. Embedded Multimedia Cards (EMMC-version 4.5)
> +. Secure Digital memory (SD mem-version 2.0)
> +. Secure Digital I/O (SDIO-version 3.0)
> +. Consumer Electronics Advanced Transport Architecture (CE-ATA-version 1.1)
> +
> +The Exynos 5250 DWC_mobile_storage provides four channels.
> +SOC specific and Board specific properties are channel specific.
> +
> +Required SoC Specific Properties:
> +
> +- compatible: should be
> +   - samsung,exynos5250-dwmmc: for exynos5250 platforms
> +
> +- reg: physical base address of the controller and length of memory mapped
> +   region.
> +
> +- interrupts: The interrupt number to the cpu.
> +
> +Required Board Specific Properties:
> +
> +- #address-cells: should be 1.
> +- #size-cells: should be 0.
> +- samsung,bus-width: The width of the bus used to

Re: [U-Boot] [PATCH V4 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch enumerates dwmci and set auto stop command during
> dwmci initialisation.
> EMMC read/write is not happening in current implementation
> due to improper fifo size computation. Hence Modified the fifo size
> computation to resolve EMMC read write issues.
>
> Changes from V1:
> 1)Created the macros RX_WMARK_SHIFT and RX_WMARK_MASK in header file.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> 1)Updated to use the macro DWMCI_CTRL_SEND_AS_CCSD instead of
> the hard coded value (1 << 10).

I suggest you take a look at patman which might simplify your patch
sending and change logs - see tools/patman/README for details.

>
> Signed-off-by: Amar 
> ---
>  drivers/mmc/dw_mmc.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index 4070d4e..776fdb6 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -136,6 +136,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd 
> *cmd,
> return TIMEOUT;
> }
> timeout--;
> +   mdelay(1);

How long will this delay in total?

> }
>
> dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL);
> @@ -314,7 +315,7 @@ static void dwmci_set_ios(struct mmc *mmc)
>  static int dwmci_init(struct mmc *mmc)
>  {
> struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
> -   u32 fifo_size, fifoth_val;
> +   u32 fifo_size, fifoth_val, ier;
>
> dwmci_writel(host, DWMCI_PWREN, 1);
>
> @@ -323,6 +324,14 @@ static int dwmci_init(struct mmc *mmc)
> return -1;
> }
>
> +   /* Enumerate at 400KHz */
> +   dwmci_setup_bus(host, mmc->f_min);
> +
> +   /* Set auto stop command */
> +   ier = dwmci_readl(host, DWMCI_CTRL);
> +   ier |= DWMCI_CTRL_SEND_AS_CCSD;
> +   dwmci_writel(host, DWMCI_CTRL, ier);
> +
> dwmci_writel(host, DWMCI_RINTSTS, 0x);
> dwmci_writel(host, DWMCI_INTMASK, 0);
>
> @@ -332,10 +341,11 @@ static int dwmci_init(struct mmc *mmc)
> dwmci_writel(host, DWMCI_BMOD, 1);
>
> fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
> +   fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
> if (host->fifoth_val)
> fifoth_val = host->fifoth_val;
> else
> -   fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
> +   fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 - 1) |
> TX_WMARK(fifo_size/2);

{} around this else I think. Also space around /

> dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
>
> --
> 1.8.0
>

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


[U-Boot] [PATCHv1] powerpc/mpc85xx: Add property 'fsl, sec-era' in device tree node 'crypto'.

2013-01-10 Thread Vakul Garg
If property 'fsl,sec-era' is already present, it is updated.
This property is required so that applications can ascertain which
descriptor commands are supported on a particular CAAM version.

Signed-off-by: Vakul Garg 
Cc: Andy Fleming 
---
 arch/powerpc/cpu/mpc85xx/fdt.c|8 +++
 arch/powerpc/cpu/mpc8xxx/fdt.c|   78 -
 arch/powerpc/include/asm/immap_85xx.h |6 +++
 3 files changed, 91 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 5af2661..e7b5dfd 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -591,6 +591,14 @@ void ft_cpu_setup(void *blob, bd_t *bd)
/* delete crypto node if not on an E-processor */
if (!IS_E_PROCESSOR(get_svr()))
fdt_fixup_crypto_node(blob, 0);
+#if CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC 4.x/5.x */
+   else {
+   ccsr_sec_t __iomem *sec;
+
+   sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
+   fdt_fixup_crypto_node(blob, in_be32(&sec->secvid_ms));
+   }
+#endif
 
fdt_fixup_ethernet(blob);
 
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index 68db8e2..20cbb45 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -297,10 +297,86 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
   fdt_strerror(err));
 }
 #elif CONFIG_SYS_FSL_SEC_COMPAT >= 4  /* SEC4 */
+static u8 caam_get_era(void)
+{
+   static const struct {
+   u16 ip_id;
+   u8 maj_rev;
+   u8 era;
+   } caam_eras[] = {
+   {0x0A10, 1, 1},
+   {0x0A10, 2, 2},
+   {0x0A12, 1, 3},
+   {0x0A14, 1, 3},
+   {0x0A14, 2, 4},
+   {0x0A16, 1, 4},
+   {0x0A10, 3, 4},
+   {0x0A11, 1, 4},
+   {0x0A18, 1, 4},
+   {0x0A11, 2, 5},
+   {0x0A12, 2, 5},
+   {0x0A13, 1, 5},
+   {0x0A1C, 1, 5}
+   };
+
+   ccsr_sec_t __iomem *sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
+   u32 secvid_ms = in_be32(&sec->secvid_ms);
+   u32 ccbvid = in_be32(&sec->ccbvid);
+   u16 ip_id = (secvid_ms & SEC_SECVID_MS_IPID_MASK) >>
+   SEC_SECVID_MS_IPID_SHIFT;
+   u8 maj_rev = (secvid_ms & SEC_SECVID_MS_MAJ_REV_MASK) >>
+   SEC_SECVID_MS_MAJ_REV_SHIFT;
+   u8 era = (ccbvid & SEC_CCBVID_ERA_MASK) >> SEC_CCBVID_ERA_SHIFT;
+
+   int i;
+
+   if (era)/* This is '0' prior to CAAM ERA-6 */
+   return era;
+
+   for (i = 0; i < ARRAY_SIZE(caam_eras); i++)
+   if (caam_eras[i].ip_id == ip_id &&
+   caam_eras[i].maj_rev == maj_rev)
+   return caam_eras[i].era;
+
+   return 0;
+}
+
+static void fdt_fixup_crypto_era(void *blob, u32 era)
+{
+   int err;
+   int crypto_node;
+
+   crypto_node = fdt_path_offset(blob, "crypto");
+   if (crypto_node < 0) {
+   printf("WARNING: Missing crypto node\n");
+   return;
+   }
+
+   err = fdt_setprop(blob, crypto_node, "fsl,sec-era", &era,
+ sizeof(era));
+   if (err < 0) {
+   printf("ERROR: could not set fsl,sec-era property: %s\n",
+  fdt_strerror(err));
+   }
+}
+
 void fdt_fixup_crypto_node(void *blob, int sec_rev)
 {
-   if (!sec_rev)
+   u8 era;
+
+   if (!sec_rev) {
fdt_del_node_and_alias(blob, "crypto");
+   return;
+   }
+
+   /* Add SEC ERA information in compatible */
+   era = caam_get_era();
+   if (era) {
+   fdt_fixup_crypto_era(blob, era);
+   } else {
+   printf("WARNING: Unable to get ERA for CAAM rev: %d\n",
+   sec_rev);
+   }
 }
 #endif
 
diff --git a/arch/powerpc/include/asm/immap_85xx.h 
b/arch/powerpc/include/asm/immap_85xx.h
index 70608fe..6b2c05c 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -2757,6 +2757,12 @@ typedef struct ccsr_sec {
 #define SEC_CHANUM_MS_JRNUM_SHIFT  28
 #define SEC_CHANUM_MS_DECONUM_MASK 0x0f00
 #define SEC_CHANUM_MS_DECONUM_SHIFT24
+#define SEC_SECVID_MS_IPID_MASK0x
+#define SEC_SECVID_MS_IPID_SHIFT   16
+#define SEC_SECVID_MS_MAJ_REV_MASK 0xff00
+#define SEC_SECVID_MS_MAJ_REV_SHIFT8
+#define SEC_CCBVID_ERA_MASK0xff00
+#define SEC_CCBVID_ERA_SHIFT   24
 #endif
 
 typedef struct ccsr_qman {
-- 
1.7.7


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


Re: [U-Boot] [PATCH V4 4/9] EXYNOS5: DWMMC: Added FDT support for DWMMC

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch adds FDT support for DWMMC, by reading the DWMMC node data
> from the device tree and initialising DWMMC channels as per data
> obtained from the node.
>
> Changes from V1:
> 1)Updated code to have same signature for the function
> exynos_dwmci_init() for both FDT and non-FDT versions.
> 2)Updated code to pass device_id parameter to the function
> exynos5_mmc_set_clk_div() instead of index.
> 3)Updated code to decode the value of "samsung,width" from FDT.
> 4)Channel index is computed instead of getting from FDT.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> 1)Replaced the new function exynos5_mmc_set_clk_div() with the
> existing function set_mmc_clk(). set_mmc_clk() will do the purpose.
> 2)Computation of FSYS block clock divisor (pre-ratio) is added.
>
> Signed-off-by: Vivek Gautam 
> Signed-off-by: Amar 
> ---
>  arch/arm/include/asm/arch-exynos/dwmmc.h |   4 +
>  drivers/mmc/exynos_dw_mmc.c  | 129 
> +--
>  include/dwmmc.h  |   4 +
>  3 files changed, 130 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-exynos/dwmmc.h 
> b/arch/arm/include/asm/arch-exynos/dwmmc.h
> index 8acdf9b..40dcc7b 100644
> --- a/arch/arm/include/asm/arch-exynos/dwmmc.h
> +++ b/arch/arm/include/asm/arch-exynos/dwmmc.h
> @@ -29,8 +29,12 @@
>
>  int exynos_dwmci_init(u32 regbase, int bus_width, int index);
>
> +#ifdef CONFIG_OF_CONTROL
> +unsigned int exynos_dwmmc_init(const void *blob);
> +#else
>  static inline unsigned int exynos_dwmmc_init(int index, int bus_width)

Why unsigned?

I'm really not that keen on functions which change their signature
based on an #ifdef. Can we perhaps have

int exynos_dwmmc_init(const void *blob);

which will pass NULL when there is no FDT, and

int exynos_dwmmc_add_port(int index, int bus_width)

for use by non-FDT boards?

>  {
> unsigned int base = samsung_get_base_mmc() + (0x1 * index);
> return exynos_dwmci_init(base, bus_width, index);
>  }
> +#endif
> diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> index 72a31b7..d7ca7d0 100644
> --- a/drivers/mmc/exynos_dw_mmc.c
> +++ b/drivers/mmc/exynos_dw_mmc.c
> @@ -19,39 +19,154 @@
>   */
>
>  #include 
> -#include 
>  #include 
> +#include 
> +#include 
> +#include 
>  #include 
>  #include 
> +#include 
> +
> +#defineDWMMC_MAX_CH_NUM4
> +#defineDWMMC_MAX_FREQ  5200
> +#defineDWMMC_MIN_FREQ  40
> +#defineDWMMC_MMC0_CLKSEL_VAL   0x03030001
> +#defineDWMMC_MMC2_CLKSEL_VAL   0x03020001
> +#defineONE_MEGA_HZ 100
> +#defineSCALED_VAL_FOUR_HUNDRED 400

I don't think you need these last two - you can just write the number
in the code

>
>  static char *EXYNOS_NAME = "EXYNOS DWMMC";

Same with this I think

> +u32 timing[3];
>
> +/*
> + * Function used as callback function to initialise the
> + * CLKSEL register for every mmc channel.
> + */
>  static void exynos_dwmci_clksel(struct dwmci_host *host)
>  {
> -   u32 val;
> -   val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
> -   DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
> +   dwmci_writel(host, DWMCI_CLKSEL, host->clksel_val);
> +}
>
> -   dwmci_writel(host, DWMCI_CLKSEL, val);
> +unsigned int exynos_dwmci_get_clk(int dev_index)
> +{
> +   return get_mmc_clk(dev_index);
>  }
>
>  int exynos_dwmci_init(u32 regbase, int bus_width, int index)
>  {
> struct dwmci_host *host = NULL;
> +   unsigned int clock, div;
> host = malloc(sizeof(struct dwmci_host));
> if (!host) {
> printf("dwmci_host malloc fail!\n");
> return 1;
> }
>
> +   /*
> +* The max operating freq of FSYS block is 400MHz.
> +* Scale down the 400MHz to number 400.
> +* Scale down the MPLL clock by dividing MPLL_CLK with ONE_MEGA_HZ.
> +* Arrive at the divisor value taking 400 as the reference.
> +*/
> +
> +   /* get mpll clock and divide it by ONE_MEGA_HZ */
> +   clock = get_pll_clk(MPLL) / ONE_MEGA_HZ;
> +
> +   /* Arrive at the divisor value. */
> +   for (div = 0; div <= 0xf; div++) {
> +   if ((clock / (div + 1)) <= SCALED_VAL_FOUR_HUNDRED)
> +   break;
> +   }

What if you don't find the right divisor?
> +
> +   /* set the clock divisor for mmc */
> +   set_mmc_clk(index, div);
> +
> host->name = EXYNOS_NAME;
> host->ioaddr = (void *)regbase;
> host->buswidth = bus_width;
> +#ifdef CONFIG_OF_CONTROL
> +   host->clksel_val = (DWMCI_SET_SAMPLE_CLK(timing[0]) |
> +   DWMCI_SET_DRV

Re: [U-Boot] [PATCH V4 5/9] EXYNOS5: DWMMC: API to set mmc clock divisor

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This API computes the divisor value based on MPLL clock and
> writes it into the FSYS1 register.
>
> Changes from V1:
> 1)Updated the function exynos5_mmc_set_clk_div() to receive
> 'device_i'd as input parameter instead of 'index'.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> 1)Removed the new API exynos5_mmc_set_clk_div() from clock.c,
> because existing API set_mmc_clk() can be used to set mmc clock.
>
> Signed-off-by: Amar 
> ---
>  arch/arm/cpu/armv7/exynos/clock.c  | 4 ++--
>  arch/arm/include/asm/arch-exynos/clk.h | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
> b/arch/arm/cpu/armv7/exynos/clock.c
> index 973b84e..89574ba 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -490,7 +490,7 @@ static unsigned long exynos4_get_mmc_clk(int dev_index)
> (struct exynos4_clock *)samsung_get_base_clock();
> unsigned long uclk, sclk;
> unsigned int sel, ratio, pre_ratio;
> -   int shift;
> +   int shift = 0;

Is this fixing a warning?

>
> sel = readl(&clk->src_fsys);
> sel = (sel >> (dev_index << 2)) & 0xf;
> @@ -539,7 +539,7 @@ static unsigned long exynos5_get_mmc_clk(int dev_index)
> (struct exynos5_clock *)samsung_get_base_clock();
> unsigned long uclk, sclk;
> unsigned int sel, ratio, pre_ratio;
> -   int shift;
> +   int shift = 0;
>
> sel = readl(&clk->src_fsys);
> sel = (sel >> (dev_index << 2)) & 0xf;
> diff --git a/arch/arm/include/asm/arch-exynos/clk.h 
> b/arch/arm/include/asm/arch-exynos/clk.h
> index 1935b0b..a4d5b4e 100644
> --- a/arch/arm/include/asm/arch-exynos/clk.h
> +++ b/arch/arm/include/asm/arch-exynos/clk.h
> @@ -29,6 +29,9 @@
>  #define VPLL   4
>  #define BPLL   5
>
> +#define FSYS1_MMC0_DIV_MASK0xff0f
> +#define FSYS1_MMC0_DIV_VAL 0x0701

What is this used for? I don't see it in this patch.

Overall it is not clear what this patch is for.

> +
>  unsigned long get_pll_clk(int pllreg);
>  unsigned long get_arm_clk(void);
>  unsigned long get_i2c_clk(void);
> --
> 1.8.0
>

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


Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/10/2013 04:43 AM, Javier Martinez Canillas wrote:
> On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg
>  wrote:
>> On 12/27/12 15:36, Javier Martinez Canillas wrote:
>>> This patch adds an GPIO LED boot status for IGEP boards.
>>> 
>>> The GPIO LED used is the red LED0 while the Linux kernel uses
>>> the green LED0 as the boot status.
>>> 
>>> By using different GPIO LEDs, the user can know in which step
>>> of the boot process the board currently is.
>>> 
>>> Signed-off-by: Javier Martinez Canillas
>>> 
>> 
>> Acked-by: Igor Grinberg 
>> 
> 
> Hello Tom,
> 
> Any news of merging this patch?

Things look good, sorry.  I'm going to try and get to starting a next
branch but I might not get a chance before the next release.

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

iQIcBAEBAgAGBQJQ7t/CAAoJENk4IS6UOR1WvFQP/3XHlrYBbksBo2OZ4Q8pNC44
V8VYI2voK05WSy6sOdOPenoycCgbwsLSSY6c8UjL89QCkQUs9PcoD5PwHk91IAyu
xQgrMB3IuyedTEWkDydxNQnQpo26r74kFUC8cminhwSwMl7Z9aRIB62AKDe+6bpb
55ByYPw0jocaCGy8uKf7OVYhmGdQVuhhUsdAnTOmYxttxkfZGuoE9DwcCI7ciTyT
P0fCHiW8gbRYTu5Jd9r/9YPCHRznCUMB/xeDlO2gKZQxwE9N09w7vJsKsF9cU3Hq
yh35yG+mqilcLsO0kMvZ47VFpYBlFhjV52iEyNUQ5RBbDepqgLtmA0+W/8XOLFim
j9HbBrjVeFqp1NrXFKl+u1mVQd+dY1dSfKTgo5w6e4xmHChGXI02dlf2BYI6dJLF
yg/q+djIvW64fmW5wNue4rTEiHQmhCFfkcVoUMSZnZ+kFfzBEqb8IUk2WB61ULRt
3ZiKqYJ7qkzPF4OjiV4xJFaowSaHcmAONPvCD23f8wG1MuKRD+ls77cGS3mWV/Zd
qzuoInRlj/gTmaPlmuR/RVr7fJAsScAQtp21aO97exhtWRi0rvDwwaS4nz4WzpYM
EImbHhi3rAUzcvh5wmdbmojNKbu1ueXac+OxYvIyU83SnOZO4KVNiu5+ijl9GI6G
P5l9EJKo+32MUSY3B43j
=2eCE
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx6qsabresd: Fix mmc boot by making USDHC3 be 'dev 0'

2013-01-10 Thread Fabio Estevam
Hi Benoît,

On Thu, Jan 10, 2013 at 12:43 PM, Benoît Thébaudeau
 wrote:

>>   switch (i) {
>> - case 0:
>> + case 1:
>>   imx_iomux_v3_setup_multiple_pads(
>>   usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
>>   gpio_direction_input(USDHC2_CD_GPIO);
>>   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
>   ^ should be changed to 1 or i

Good catch, thanks.

I just found out a proper fix for this and will submit shortly.

Regards,

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


[U-Boot] [PATCH] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Fabio Estevam
commit 49ea0ff5 (mx6qsabresd: use on-board eMMC to store environment) broke 
booting a uImage from SDHC3.

Adapt the default environment to use CONFIG_SYS_MMC_ENV_DEV as the correct mmc
node for loading the kernel, since mmcdev should not be harcoded to zero.

While at it, go back to using SDHC3 as default mmc, since we have Yocto images
that generate an SD card containing U-boot,kernel and rootfs, so it is more 
convenient to keep using SDHC3 as it was originally.

Signed-off-by: Fabio Estevam 
---
 include/configs/mx6qsabre_common.h |2 +-
 include/configs/mx6qsabresd.h  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/mx6qsabre_common.h 
b/include/configs/mx6qsabre_common.h
index bd2fb10..5d03b3d 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -86,7 +86,7 @@
"console=" CONFIG_CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
"initrd_high=0x\0" \
-   "mmcdev=0\0" \
+   "mmcdev=CONFIG_SYS_MMC_ENV_DEV\0" \
"mmcpart=1\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
index a1d9285..ccb7751 100644
--- a/include/configs/mx6qsabresd.h
+++ b/include/configs/mx6qsabresd.h
@@ -27,7 +27,7 @@
 
 #define CONFIG_SYS_FSL_USDHC_NUM   3
 #if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV 2   /* eMMC/uSDHC4 */
+#define CONFIG_SYS_MMC_ENV_DEV 1   /* SDHC3 */
 #define CONFIG_SYS_MMC_ENV_PART1   /* Boot partition 1 */
 #endif
 
-- 
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] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Otavio Salvador
On Thu, Jan 10, 2013 at 2:02 PM, Fabio Estevam
 wrote:
> commit 49ea0ff5 (mx6qsabresd: use on-board eMMC to store environment) broke
> booting a uImage from SDHC3.
>
> Adapt the default environment to use CONFIG_SYS_MMC_ENV_DEV as the correct mmc
> node for loading the kernel, since mmcdev should not be harcoded to zero.
>
> While at it, go back to using SDHC3 as default mmc, since we have Yocto images
> that generate an SD card containing U-boot,kernel and rootfs, so it is more
> convenient to keep using SDHC3 as it was originally.
>
> Signed-off-by: Fabio Estevam 
> ---
>  include/configs/mx6qsabre_common.h |2 +-
>  include/configs/mx6qsabresd.h  |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/configs/mx6qsabre_common.h 
> b/include/configs/mx6qsabre_common.h
> index bd2fb10..5d03b3d 100644
> --- a/include/configs/mx6qsabre_common.h
> +++ b/include/configs/mx6qsabre_common.h
> @@ -86,7 +86,7 @@
> "console=" CONFIG_CONSOLE_DEV "\0" \
> "fdt_high=0x\0"   \
> "initrd_high=0x\0" \
> -   "mmcdev=0\0" \
> +   "mmcdev=CONFIG_SYS_MMC_ENV_DEV\0" \

I think you need to split the string so the macro is expanded. as:
"mmcdev=" CONFIG_SYS_MMC_ENV_DEV "\0" \

On am I missing something?

> "mmcpart=1\0" \
> "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
> "mmcargs=setenv bootargs console=${console},${baudrate} " \
> diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
> index a1d9285..ccb7751 100644
> --- a/include/configs/mx6qsabresd.h
> +++ b/include/configs/mx6qsabresd.h
> @@ -27,7 +27,7 @@
>
>  #define CONFIG_SYS_FSL_USDHC_NUM   3
>  #if defined(CONFIG_ENV_IS_IN_MMC)
> -#define CONFIG_SYS_MMC_ENV_DEV 2   /* eMMC/uSDHC4 */
> +#define CONFIG_SYS_MMC_ENV_DEV 1   /* SDHC3 */
>  #define CONFIG_SYS_MMC_ENV_PART1   /* Boot partition 1 */
>  #endif
>
> --
> 1.7.9.5
>
>



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


Re: [U-Boot] [RFC 3/3] MIPS: bootm.c: integrate QEMU specific functions

2013-01-10 Thread Gabor Juhos
2013.01.10. 15:22 keltezéssel, Daniel Schwierzeck írta:

> yes, I figured that too yesterday while testing.

:)

>> Maybe the qemu_mips specific bootm stuff should be removed completely from 
>> U-Boot?
>>
>> -Gabor
> 
> I agree. Maybe we should convert the current MIPS Qemu port to MTI Malta. 

That is a good idea.

> I have seen that BareBox already supports Qemu Malta.

Yes, although that only supports the UART perperial at the moment.

> For supporting real MTI Malta hardware there is AFAIK some work in progress 
> [1].
> 
> [1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/140428/focus=140541

Nice!

-Gabor

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


Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Javier Martinez Canillas
On Thu, Jan 10, 2013 at 4:35 PM, Tom Rini  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 01/10/2013 04:43 AM, Javier Martinez Canillas wrote:
>> On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg
>>  wrote:
>>> On 12/27/12 15:36, Javier Martinez Canillas wrote:
 This patch adds an GPIO LED boot status for IGEP boards.

 The GPIO LED used is the red LED0 while the Linux kernel uses
 the green LED0 as the boot status.

 By using different GPIO LEDs, the user can know in which step
 of the boot process the board currently is.

 Signed-off-by: Javier Martinez Canillas
 
>>>
>>> Acked-by: Igor Grinberg 
>>>
>>
>> Hello Tom,
>>
>> Any news of merging this patch?
>
> Things look good, sorry.  I'm going to try and get to starting a next
> branch but I might not get a chance before the next release.
>
> - --
> Tom

Great, waiting for the next release is not an issue.

There are also two more patches for IGEP boards that were acked but
not picked for this release:

[U-Boot,v2,1/2] OMAP3: use a single board file for IGEP devices [1]
[U-Boot,1/1] OMAP3: igep00x0: add CONFIG_SPL_BOARD_INIT for
CONFIG_SPL_NAND_SUPPORT [2]

Thanks a lot and best regards,
Javier

[1]: http://patchwork.ozlabs.org/patch/208296/
[2]: http://patchwork.ozlabs.org/patch/208481/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Fabio Estevam
Since commit de7d02aeb (mx6qsabresd: add usdhc2 and usdhc4 support) 
SDHC3 device node is no longer 0, which breaks loading a uImage from SDHC3.

Fix it by adapting the default environment to use CONFIG_SYS_MMC_ENV_DEV as the 
correct mmc node for loading the kernel from.

While at it, go back to using SDHC3 as the default mmc, since we have Yocto 
images that generate an SD card containing U-boot,kernel and rootfs, so it is
more convenient to keep using SDHC3 as it was originally.

Signed-off-by: Fabio Estevam 
---
Changes since v1:
- Properly expand mmcdev macro
- Improve commit log

 include/configs/mx6qsabre_common.h |2 +-
 include/configs/mx6qsabresd.h  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/mx6qsabre_common.h 
b/include/configs/mx6qsabre_common.h
index bd2fb10..5d03b3d 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -86,7 +86,7 @@
"console=" CONFIG_CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
"initrd_high=0x\0" \
-   "mmcdev=0\0" \
+   "mmcdev=" CONFIG_SYS_MMC_ENV_DEV "\0" \
"mmcpart=1\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
index a1d9285..ccb7751 100644
--- a/include/configs/mx6qsabresd.h
+++ b/include/configs/mx6qsabresd.h
@@ -27,7 +27,7 @@
 
 #define CONFIG_SYS_FSL_USDHC_NUM   3
 #if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV 2   /* eMMC/uSDHC4 */
+#define CONFIG_SYS_MMC_ENV_DEV 1   /* SDHC3 */
 #define CONFIG_SYS_MMC_ENV_PART1   /* Boot partition 1 */
 #endif
 
-- 
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 V4 8/9] SMDK5250: Enable EMMC booting

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch adds support for EMMC booting on SMDK5250.
>
> Changes from V1:
> 1)Updated spl_boot.c file to maintain irom pointer table
> instead of using the #define values defined in header file.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> No change.
>
> Signed-off-by: Amar 
> ---
>  board/samsung/smdk5250/clock_init.c | 15 +++
>  board/samsung/smdk5250/clock_init.h |  5 
>  board/samsung/smdk5250/spl_boot.c   | 52 
> -
>  3 files changed, 65 insertions(+), 7 deletions(-)
>
> diff --git a/board/samsung/smdk5250/clock_init.c 
> b/board/samsung/smdk5250/clock_init.c
> index c009ae5..154993c 100644
> --- a/board/samsung/smdk5250/clock_init.c
> +++ b/board/samsung/smdk5250/clock_init.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "clock_init.h"
>  #include "setup.h"
> @@ -664,3 +665,17 @@ void clock_init_dp_clock(void)
> /* We run DP at 267 Mhz */
> setbits_le32(&clk->div_disp1_0, CLK_DIV_DISP1_0_FIMD1);
>  }
> +
> +/*
> + * Set clock divisor value for booting from EMMC.
> + * Set DWMMC channel-0 clk div to operate mmc0 device at 50MHz.
> + */
> +void emmc_boot_clk_div_set(void)
> +{
> +   struct exynos5_clock *clk = (struct exynos5_clock 
> *)EXYNOS5_CLOCK_BASE;
> +   unsigned int div_mmc;
> +
> +   div_mmc = readl((unsigned int) &clk->div_fsys1) & 
> ~FSYS1_MMC0_DIV_MASK;
> +   div_mmc |= FSYS1_MMC0_DIV_VAL;
> +   writel(div_mmc, (unsigned int) &clk->div_fsys1);
> +}
> diff --git a/board/samsung/smdk5250/clock_init.h 
> b/board/samsung/smdk5250/clock_init.h
> index f751bcb..20a1d47 100644
> --- a/board/samsung/smdk5250/clock_init.h
> +++ b/board/samsung/smdk5250/clock_init.h
> @@ -146,4 +146,9 @@ struct mem_timings *clock_get_mem_timings(void);
>   * Initialize clock for the device
>   */
>  void system_clock_init(void);
> +
> +/*
> + * Set clock divisor value for booting from EMMC.
> + */
> +void emmc_boot_clk_div_set(void);
>  #endif
> diff --git a/board/samsung/smdk5250/spl_boot.c 
> b/board/samsung/smdk5250/spl_boot.c
> index d8f3c1e..906e197 100644
> --- a/board/samsung/smdk5250/spl_boot.c
> +++ b/board/samsung/smdk5250/spl_boot.c
> @@ -23,16 +23,38 @@
>  #include
>  #include
>
> +#include 
> +#include 
> +#include 
> +
> +#include "clock_init.h"
> +
> +/* Index into irom ptr table */
> +enum index {
> +   MMC_INDEX,
> +   EMMC44_INDEX,
> +   EMMC44_END_INDEX,
> +   SPI_INDEX,
> +};
> +
> +/* IROM Function Pointers Table */
> +u32 irom_ptr_table[] = {
> +   [MMC_INDEX] = 0x02020030,   /* iROM Function Pointer-SDMMC boot */
> +   [EMMC44_INDEX] = 0x02020044,/* iROM Function Pointer-EMMC4.4 
> boot*/
> +   [EMMC44_END_INDEX] = 0x02020048,/* iROM Function Pointer
> +   -EMMC4.4 end boot operation */
> +   [SPI_INDEX] = 0x02020058,   /* iROM Function Pointer-SPI boot */
> +   };
> +
>  enum boot_mode {
> BOOT_MODE_MMC = 4,
> BOOT_MODE_SERIAL = 20,
> +   BOOT_MODE_EMMC = 8, /* EMMC4.4 */
> /* Boot based on Operating Mode pin settings */
> BOOT_MODE_OM = 32,
> BOOT_MODE_USB,  /* Boot using USB download */
>  };
>
> -   typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst);
> -
>  /*
>  * Copy U-boot from mmc to RAM:
>  * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains
> @@ -40,23 +62,39 @@ enum boot_mode {
>  */
>  void copy_uboot_to_ram(void)
>  {
> -   spi_copy_func_t spi_copy;
> enum boot_mode bootmode;
> -   u32 (*copy_bl2)(u32, u32, u32);
> -
> +   u32 (*spi_copy)(u32 offset, u32 nblock, u32 dst);
> +   u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst);
> +   u32 (*copy_bl2_from_emmc)(u32 nblock, u32 dst);
> +   void (*end_bootop_from_emmc)(void);
> +   /* read Operation Mode ststus register to find the bootmode */
> bootmode = readl(EXYNOS5_POWER_BASE) & OM_STAT;
>
> switch (bootmode) {
> case BOOT_MODE_SERIAL:
> -   spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR;
> +   spi_copy = (void *) *(u32 *)irom_ptr_table[SPI_INDEX];

This looks OK to me. My only suggestion is to put the lookup in a function like:

static void *get_irom_func(int index)

and avoid all the casting here.

> spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE,
> CONFIG_SYS_TEXT_BASE);
> break;

Re SPI, the IROM performance is quite slow - do you plan to send up
the U-Boot SPI code version? with a 32KB SPL there might be room to
just use the normal driver.

> case BOOT_MODE_MMC:
> -   copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR;
> +   copy_bl2 = (void *) *(u32 *)irom_ptr_table[MMC_INDEX];
>

Re: [U-Boot] [PATCH V4 9/9] COMMON: MMC: Command to support EMMC booting and to

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch adds commands to open, close and resize boot partitions on EMMC.
>
> Changes from V1:
> 1)Combined the common piece of code between 'open' and 'close'
> operations.
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> No change.
>
> Signed-off-by: Amar 
> ---
>  common/cmd_mmc.c | 84 
> +++-
>  1 file changed, 83 insertions(+), 1 deletion(-)
>
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index 7dacd51..1dabb5b 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -248,6 +248,84 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[])
> curr_device, mmc->part_num);
>
> return 0;
> +   } else if ((strcmp(argv[1], "open") == 0) ||
> +   (strcmp(argv[1], "close") == 0)) {

How about putting this block in its own function?

> +   int dev;
> +   struct mmc *mmc;
> +
> +   if (argc == 2)
> +   dev = curr_device;
> +   else if (argc == 3)
> +   dev = simple_strtoul(argv[2], NULL, 10);
> +   else
> +   return CMD_RET_USAGE;
> +
> +   mmc = find_mmc_device(dev);
> +   if (!mmc) {
> +   printf("no mmc device at slot %x\n", dev);
> +   return 1;
> +   }
> +
> +   if (IS_SD(mmc)) {
> +   printf("SD device cannot be opened/closed\n");
> +   return 1;
> +   }
> +
> +   if (strcmp(argv[1], "open") == 0) {
> +   if (!(mmc_boot_open(mmc))) {
> +   printf("EMMC OPEN Success.\n");
> +   printf("\t\t\t!!!Notice!!!\n");
> +   printf("!You must close EMMC"
> +   " boot Partition after all"
> +   " images are written\n");

Do you need to split these strings so much? Perhaps when it is in a
function the indenting will be less?

> +   printf("!EMMC boot partition"
> +   " has continuity at"
> +   " image writing time.\n");
> +   printf("!So, Do not close boot"
> +   " partition, Before, all"
> +   " images are written.\n");
> +   return 0;
> +   } else {
> +   printf("EMMC OPEN Failed.\n");
> +   return 1;

You could put this above the other block and reduce indenting:

if (mmc_boot_open(mmc)) {
   printf("EMMC OPEN Failed.\n");
   return 1;
}
...code continues

> +   }
> +   }
> +
> +   if (strcmp(argv[1], "close") == 0) {
> +   if (!(mmc_boot_close(mmc))) {
> +   printf("EMMC CLOSE Success.\n");

Shouldn't print a message on success

> +   return 0;
> +   } else {
> +   printf("EMMC CLOSE Failed.\n");
> +   return 1;
> +   }
> +   }
> +   } else if (strcmp(argv[1], "bootpart") == 0) {
> +   int dev;
> +   dev = simple_strtoul(argv[2], NULL, 10);
> +
> +   u32 bootsize = simple_strtoul(argv[3], NULL, 10);
> +   u32 rpmbsize = simple_strtoul(argv[4], NULL, 10);
> +   struct mmc *mmc = find_mmc_device(dev);
> +   if (!mmc) {
> +   printf("no mmc device at slot %x\n", dev);
> +   return 1;
> +   }
> +
> +   if (IS_SD(mmc)) {
> +   printf("It is not a EMMC device\n");
> +   return 1;
> +   }
> +
> +   if (0 == mmc_boot_partition_size_change(mmc,
> +   bootsize, rpmbsize)) {
> +   printf("EMMC boot partition Size %d MB\n", bootsize);
> +   printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
> +   return 0;
> +   } else {
> +   printf("EMMC boot partition Size change Failed.\n");
> +   return 1;
> +   }
> }
>
> state = MMC_INVALID;
> @@ -317,5 +395,9 @@ U_BOOT_CMD(
> "mmc rescan\n"
> "mmc part - lists available partition on current mmc device\n"
> "mmc dev [dev] [part] - show or set current mm

Re: [U-Boot] [PATCH V4 6/9] SMDK5250: Initialise and Enable DWMMC, support FDT and non-FDT

2013-01-10 Thread Simon Glass
Hi Amar,

On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
> This patch enables and initialises DWMMC for SMDK5250.
> Supports both FDT and non-FDT. This patch creates a new file
> 'exynos5-dt.c' meant for FDT support.
> exynos5-dt.c:   This file shall contain all code which supports FDT.
> Any addition of FDT support for any module needs to be
> added in this file.
> smdk5250.c: This file shall contain the code which supports 
> non-FDT.
> version. Any addition of non-FDT support for any 
> module
> needs to be added in this file.
> May be, the file smdk5250.c can be removed in near 
> future
> when non-FDT is not required.
>
> The Makefile is updated to compile only one of the files
> exynos5-dt.c / smdk5250.c based on FDT configuration.
>
> NOTE:
> Please note that all additions corresponding to FDT need to be added into the
> file exynos5-dt.c.
> At same time if non-FDT support is required then add the corresponding
> updations into smdk5250.c.
>
> Changes from V1:
> 1)A new file 'exynos5-dt.c' is created meant for FDT support
> 2)Makefile is updated to compile only one of the files
> exynos5-dt.c / smdk5250.c based on FDT configuration
>
> Changes from V2:
> 1)Updation of commit message and resubmition of proper patch set.
>
> Changes from V3:
> No change.
>
> Signed-off-by: Amar 
> ---
>  board/samsung/smdk5250/Makefile |   4 +
>  board/samsung/smdk5250/exynos5-dt.c | 242 
> 
>  board/samsung/smdk5250/smdk5250.c   |  97 +++
>  include/configs/exynos5250-dt.h |   2 +
>  include/i2c.h   |   2 +
>  5 files changed, 292 insertions(+), 55 deletions(-)
>  create mode 100644 board/samsung/smdk5250/exynos5-dt.c
>
> diff --git a/board/samsung/smdk5250/Makefile b/board/samsung/smdk5250/Makefile
> index 47c6a5a..ecca9f3 100644
> --- a/board/samsung/smdk5250/Makefile
> +++ b/board/samsung/smdk5250/Makefile
> @@ -32,8 +32,12 @@ COBJS+= tzpc_init.o
>  COBJS  += smdk5250_spl.o
>
>  ifndef CONFIG_SPL_BUILD
> +ifdef CONFIG_OF_CONTROL
> +COBJS  += exynos5-dt.o
> +else
>  COBJS  += smdk5250.o
>  endif
> +endif
>
>  ifdef CONFIG_SPL_BUILD
>  COBJS  += spl_boot.o
> diff --git a/board/samsung/smdk5250/exynos5-dt.c 
> b/board/samsung/smdk5250/exynos5-dt.c
> new file mode 100644
> index 000..da539ca
> --- /dev/null
> +++ b/board/samsung/smdk5250/exynos5-dt.c
> @@ -0,0 +1,242 @@
> +/*
> + * Copyright (C) 2012 Samsung Electronics
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +int board_init(void)
> +{
> +   gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
> +#ifdef CONFIG_EXYNOS_SPI
> +   spi_init();
> +#endif
> +   return 0;
> +}
> +
> +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_3, 
> PHYS_SDRAM_3_SIZE)
> +   + get_ram_size((long *)PHYS_SDRAM_4, 
> PHYS_SDRAM_4_SIZE)
> +   + get_ram_size((long *)PHYS_SDRAM_5, 
> PHYS_SDRAM_7_SIZE)
> +   + get_ram_size((long *)PHYS_SDRAM_6, 
> PHYS_SDRAM_7_SIZE)
> +   + get_ram_size((long *)PHYS_SDRAM_7, 
> PHYS_SDRAM_7_SIZE)
> +   + get_ram_size((long *)PHYS_SDRAM_8, 
> PHYS_SDRAM_8_SIZE);

This looks ugly - is there any other way of doing this? Also 7 appears
in more than one line.

Since the banks are all SDRAM_BANK_SIZE apart, perhaps you could just
use a for loop with a single base address?

If this function is common with the other file then perhaps it should
go in a common file?

> +   return 0;
> +}
> +
> +#if defined(CONFIG_POWER)
> +int power_init_board(void)
> +{
> +   i

Re: [U-Boot] [RFC] mmc:fix: Increase the timeout value for SDHCI_send_command()

2013-01-10 Thread Lukasz Majewski
Hi Jaehoon,

> Hi All,
> 
> I think this problem is produced when card is running write/erase
> operation. We used the mmc_send_status() into driver/mmc/mmc.c.
> When That command is sending, i found the inhibit released log.
> 
> I think problem that SDHCI_DATA_INHIBIT is set at every command.
> if didn't have data and response type is not busy-wait type,
> SDHCI_DATA_INHIBIT didn't need to set.
> 
> How about this? It is more reasonable than increasing timeout value.
> 
> @@ -141,7 +143,10 @@ int sdhci_send_command(struct mmc *mmc, struct
> mmc_cmd *cmd, timeout = 10;
>  
>   sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);
> - mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT;
> + mask = SDHCI_CMD_INHIBIT;
> +
> + if ((data != NULL) || (cmd->resp_type & MMC_RSP_BUSY))
> + mask |= SDHCI_DATA_INHIBIT;
>  

I will test this and let you know.

>   /* We shouldn't wait for data inihibit for stop commands,
> even though they might use busy signaling */
> 
> Best Regards,
> Jaehoon Chung
> 
> On 01/10/2013 05:12 AM, Wolfgang Denk wrote:
> > Dear Lukasz Majewski,
> > 
> > In message
> > <1357665792-8141-1-git-send-email-l.majew...@samsung.com> you wrote:
> >> I'd like to ask for your opinion about the following problem:
> > 
> > I cannot comment on the problem - only a bit about the proposed
> > patch ;-)
> > 
> >> From a brief checking I can say that it happens when we are doing
> >> consecutive MMC operations (i.e. many reads), and the 10ms timeout
> >> might be too short when eMMC firmware is forced to do some internal
> >> time consuming operations (e.g. flash blocks management, wear
> >> leveling).
> >> In this situation, the SDHCI_CMD_INHIBIT bit is set, which means
> >> that SDHCI controller didn't received response from eMMC.
> >>
> >> One proposition would be to define the per device/per memory chip
> >> specific timeouts, to replace those defined
> >> at ./drivers/mmc/sdhci.c file.
> > 
> > Is there no way to ask the device and/or controller when it is done,
> > so we can poll for ready state instead of adding delays, which will
> > always have to be tailored for the so far known worst case, i. e.
> > they will be always too long on all almost all systems.
> > 
> >> --- a/drivers/mmc/sdhci.c
> >> +++ b/drivers/mmc/sdhci.c
> >> @@ -137,8 +137,8 @@ int sdhci_send_command(struct mmc *mmc, struct
> >> mmc_cmd *cmd, unsigned int timeout, start_addr = 0;
> >>unsigned int retry = 1;
> >>  
> >> -  /* Wait max 10 ms */
> >> -  timeout = 10;
> >> +  /* Wait max 100 ms */
> >> +  timeout = 100;
> > 
> > We have cases where we struggle for sub-second boot times.  Adding
> > 100 ms delay here is clearly prohbitive.  [Even the 10 ms are way
> > too long IMHO.]  There must be a better way to handle this.
> > 
> > Best regards,
> > 
> > Wolfgang Denk
> > 
> 



-- 
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] EXYNOS5: Make all display related code dependent on CONFIG_LCD

2013-01-10 Thread Simon Glass
Hi Ajay,

On Wed, Jan 9, 2013 at 11:45 PM, Ajay Kumar  wrote:
> u-boot compilation fails for smdk5250 when we deselect CONFIG_LCD
> from the main config file. This patch fixes it.
>
> Signed-off-by: Ajay Kumar 

Acked-by: Simon Glass 

What is the error?


> ---
>  board/samsung/smdk5250/smdk5250.c | 2 ++
>  include/configs/exynos5250-dt.h   | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c 
> b/board/samsung/smdk5250/smdk5250.c
> index 9c4bf9b..7a5f132 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -281,6 +281,7 @@ int board_early_init_f(void)
>  }
>  #endif
>
> +#ifdef CONFIG_LCD
>  void cfg_lcd_gpio(void)
>  {
> struct exynos5_gpio_part1 *gpio1 =
> @@ -374,3 +375,4 @@ void init_panel_info(vidinfo_t *vid)
>
> exynos_set_dp_platform_data(&dp_platform_data);
>  }
> +#endif
> diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
> index 07bca1d..298bae9 100644
> --- a/include/configs/exynos5250-dt.h
> +++ b/include/configs/exynos5250-dt.h
> @@ -299,10 +299,12 @@
>
>  /* Display */
>  #define CONFIG_LCD
> +#ifdef CONFIG_LCD
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_EXYNOS_DP
>  #define LCD_XRES   2560
>  #define LCD_YRES   1600
>  #define LCD_BPPLCD_COLOR16
> +#endif
>
>  #endif /* __CONFIG_H */
> --
> 1.8.0
>

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


Re: [U-Boot] [PATCH v4] patman: Allow use outside of u-boot tree

2013-01-10 Thread Simon Glass
Hi Vadim,

On Wed, Jan 9, 2013 at 6:00 PM, Vadim Bendebury  wrote:
> To make it usable in git trees not providing a patch checker
> implementation, add a command line option, allowing to suppress patch
> check. While we are at it, sort debug options alphabetically.
>
> Also, do not raise an exception if checkpatch.pl is not found - just
> print an error message suggesting to use the new option, and return
> nonzero status.
>
>. unit test passes:
> $ ./patman  -t
> 
>. successfully used patman in the autotest tree to generate a patch
>  email (with --no-check option)
>. successfully used patman in the u-boot tree to generate a patch
>  email
>. `patman --help' now shows command line options ordered
>  alphabetically
>
> Signed-off-by: Vadim Bendebury 

Acked-by: Simon Glass 

BTW what is this patch against - it doesn't seem to apply to mainline for me.

> ---
> Changes in v4:
>   . now properly corrected typo in the error message
>
> Changes in v3:
>   . corrected typo in the error message
>
> Changes in v2:
>   . addressed comments WRT use of double negative
>   . added code to gracefully handle absence of checkpatch.cl
>
>  tools/patman/checkpatch.py |   10 +-
>  tools/patman/patman.py |   14 ++
>  2 files changed, 15 insertions(+), 9 deletions(-)
[snip]

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


Re: [U-Boot] [PATCH 2/2] EXYNOS5: Enable console multiplexing in u-boot when LCD support is enabled

2013-01-10 Thread Simon Glass
Hi Ajay,

On Wed, Jan 9, 2013 at 11:45 PM, Ajay Kumar  wrote:
> With this patch, stdout/stderr is assigned to serial and also to LCD.
> Initially, u-boot output console is observed via serial port.
> If you also have a DP panel connected onto your SMDK5250 board,
> you can switch to LCD console by typing "setenv stdout lcd".
> You can always switch back to serial using "setenv stdout serial".
> You can switch error console(stderr) as well, using similar commands.
>
> Signed-off-by: Ajay Kumar 

Acked-by: Simon Glass 

This is OK for now. You could perhaps see what Tegra does here - there
is code to patch up the stdout value based on settings I think.

We probably want CONFIG_CONSOLE_MUX to be always defined, so perhaps
think about that for a future patch.

> ---
>  include/configs/exynos5250-dt.h | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
> index 298bae9..49c0adf 100644
> --- a/include/configs/exynos5250-dt.h
> +++ b/include/configs/exynos5250-dt.h
> @@ -305,6 +305,12 @@
>  #define LCD_XRES   2560
>  #define LCD_YRES   1600
>  #define LCD_BPPLCD_COLOR16
> +
> +/* Override console configuration when LCD is present */
> +#define CONFIG_CONSOLE_MUX
> +#define CONFIG_SYS_CONSOLE_IS_IN_ENV
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +   "stdout=serial,lcd\0"
>  #endif
>
>  #endif /* __CONFIG_H */
> --
> 1.8.0
>

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


Re: [U-Boot] [PATCH v2] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Otavio Salvador
On Thu, Jan 10, 2013 at 2:19 PM, Fabio Estevam
 wrote:
> Since commit de7d02aeb (mx6qsabresd: add usdhc2 and usdhc4 support)
> SDHC3 device node is no longer 0, which breaks loading a uImage from SDHC3.
>
> Fix it by adapting the default environment to use CONFIG_SYS_MMC_ENV_DEV as 
> the
> correct mmc node for loading the kernel from.
>
> While at it, go back to using SDHC3 as the default mmc, since we have Yocto
> images that generate an SD card containing U-boot,kernel and rootfs, so it is
> more convenient to keep using SDHC3 as it was originally.
>
> Signed-off-by: Fabio Estevam 

Acked-by: Otavio Salvador 

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


Re: [U-Boot] [PATCH 1/4 V2] EXYNOS: Add functions for power initialisation

2013-01-10 Thread Simon Glass
Hi Rajeshwari,

On Mon, Jan 7, 2013 at 5:08 AM, Rajeshwari Shinde
 wrote:
> This patch adds functions to intialsise power registers during
> spl boot.
>
> Signed-off-by: Rajeshwari Shinde 
> ---
> Changes in V2:
> - Moved from second patch to first patch
> - Renamed ps_hold_setup to power_ps_hold_setup
> - Added explanation before each power function definition
>  arch/arm/cpu/armv7/exynos/power.c|   27 +++
>  arch/arm/include/asm/arch-exynos/power.h |   10 ++
>  2 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/power.c 
> b/arch/arm/cpu/armv7/exynos/power.c
> index d4bce6d..f0c107c 100644
> --- a/arch/arm/cpu/armv7/exynos/power.c
> +++ b/arch/arm/cpu/armv7/exynos/power.c
> @@ -95,3 +95,30 @@ void set_dp_phy_ctrl(unsigned int enable)
> if (cpu_is_exynos5())
> exynos5_dp_phy_control(enable);
>  }
> +
> +uint32_t power_read_reset_status(void)
> +{
> +   struct exynos5_power *power =
> +   (struct exynos5_power *)samsung_get_base_power();
> +
> +   return power->inform1;
> +}
> +
> +void power_ps_hold_setup(void)
> +{
> +   struct exynos5_power *power =
> +   (struct exynos5_power *)samsung_get_base_power();
> +
> +   /* Set PS-Hold high */
> +   setbits_le32(&power->ps_hold_control,
> +   EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
> +}
> +
> +void power_exit_wakeup(void)
> +{
> +   struct exynos5_power *power =
> +   (struct exynos5_power *)samsung_get_base_power();
> +   typedef void (*resume_func)(void);
> +
> +   ((resume_func)power->inform0)();
> +}
> diff --git a/arch/arm/include/asm/arch-exynos/power.h 
> b/arch/arm/include/asm/arch-exynos/power.h
> index d2fdb59..f6d0278 100644
> --- a/arch/arm/include/asm/arch-exynos/power.h
> +++ b/arch/arm/include/asm/arch-exynos/power.h
> @@ -864,4 +864,14 @@ void set_dp_phy_ctrl(unsigned int enable);
>
>  #define EXYNOS_DP_PHY_ENABLE   (1 << 0)
>
> +#define EXYNOS_PS_HOLD_CONTROL_DATA_HIGH   (1 << 8)
> +
> +/* Read inform1 to get the reset status */
> +uint32_t power_read_reset_status(void);
> +
> +/*Set ps_hold data drving value high */

driving

While you are there I suggest you add that this enables the machine to
stay powered on after the initial power-on condition goes away (e.g.
power button).

> +void power_ps_hold_setup(void);
> +
> +/* Read the resume function and call it */
> +void power_exit_wakeup(void);
>  #endif
> --
> 1.7.4.4
>

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


Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/10/2013 11:16 AM, Javier Martinez Canillas wrote:
> On Thu, Jan 10, 2013 at 4:35 PM, Tom Rini  wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>> 
>> On 01/10/2013 04:43 AM, Javier Martinez Canillas wrote:
>>> On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg 
>>>  wrote:
 On 12/27/12 15:36, Javier Martinez Canillas wrote:
> This patch adds an GPIO LED boot status for IGEP boards.
> 
> The GPIO LED used is the red LED0 while the Linux kernel 
> uses the green LED0 as the boot status.
> 
> By using different GPIO LEDs, the user can know in which 
> step of the boot process the board currently is.
> 
> Signed-off-by: Javier Martinez Canillas 
> 
 
 Acked-by: Igor Grinberg 
 
>>> 
>>> Hello Tom,
>>> 
>>> Any news of merging this patch?
>> 
>> Things look good, sorry.  I'm going to try and get to starting a
>>  next branch but I might not get a chance before the next 
>> release.
>> 
>> - -- Tom
> 
> Great, waiting for the next release is not an issue.
> 
> There are also two more patches for IGEP boards that were acked
> but not picked for this release:
> 
> [U-Boot,v2,1/2] OMAP3: use a single board file for IGEP devices
> [1] [U-Boot,1/1] OMAP3: igep00x0: add CONFIG_SPL_BOARD_INIT for 
> CONFIG_SPL_NAND_SUPPORT [2]

For the second path, did SPL+NAND for the IGEP devices get added already?

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

iQIcBAEBAgAGBQJQ7vnPAAoJENk4IS6UOR1WmtQP/00tbURLxdS+NBKLnOvNQcek
cYdAuYOhuNTmCIAJcGBTUDwn6Qt4OeAqSHi4H9ylsliNiDMMaQ9RuhIg9biXb3Hn
5ICeMwCgpoFhjjlxaEtMIrc2ZwxKMOfLyetrx10IM2dldzSFG5dScT2rXeyYjNkv
XAEh/h8/lXOs42YacBTOa6Lew57U6mw+u+1OAhYkw/EGN3WAph4V3FKmBLxWfad7
OZlE//oOwyIlTlcVYTTp74ugXU36eURL+B8qyFXO26Z3U+H+bi3BDaj7DDQ0Z03Q
yTJ10w+7TR9UyLGLcfwOtzHwrSgZK71Y90yhTuAbGheBcj+aX6Gvfl3jov9cWvk4
W/sg6zwKtDpypTXpZtHmWLiQwvhGUhz1VMZE1ECrDH7+LmJgcNWlEPNwXXvNTn3i
bz/pGdA275hdiXmslPQKUteuqN2781qFr2EQQDs7i4HzMjKN5G3xisivqhQDv3cg
ebLHjCfIM9Qa7LT4eLoRTy14TZLvY27ZrEVrgBObm57yRBjZEALTwCLMwJl6s/px
mi7ZbO1xmnF7H0OefEGAlgfE42lAw+luMnbkw6FbxgGVyTHDmKlK+EaEcJZONrIE
younmDvDYSK7BwN1WQe2yFBVjmxIMG8Vbx34/Qh6rCs9GmPgxBx0HXs/3aFgYlRZ
1GMy8UMZWqVXjYllR5xt
=RaiF
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] patman: Allow use outside of u-boot tree

2013-01-10 Thread Vadim Bendebury
On Thu, Jan 10, 2013 at 9:05 AM, Simon Glass  wrote:
> Hi Vadim,
>
> On Wed, Jan 9, 2013 at 6:00 PM, Vadim Bendebury  wrote:
>> To make it usable in git trees not providing a patch checker
>> implementation, add a command line option, allowing to suppress patch
>> check. While we are at it, sort debug options alphabetically.
>>
>> Also, do not raise an exception if checkpatch.pl is not found - just
>> print an error message suggesting to use the new option, and return
>> nonzero status.
>>
>>. unit test passes:
>> $ ./patman  -t
>> 
>>. successfully used patman in the autotest tree to generate a patch
>>  email (with --no-check option)
>>. successfully used patman in the u-boot tree to generate a patch
>>  email
>>. `patman --help' now shows command line options ordered
>>  alphabetically
>>
>> Signed-off-by: Vadim Bendebury 
>
> Acked-by: Simon Glass 
>
> BTW what is this patch against - it doesn't seem to apply to mainline for me.
>

Right, it depends on the previous patches which still have not been
applied to the upstream ToT.

cheers,
/vb

>> ---
>> Changes in v4:
>>   . now properly corrected typo in the error message
>>
>> Changes in v3:
>>   . corrected typo in the error message
>>
>> Changes in v2:
>>   . addressed comments WRT use of double negative
>>   . added code to gracefully handle absence of checkpatch.cl
>>
>>  tools/patman/checkpatch.py |   10 +-
>>  tools/patman/patman.py |   14 ++
>>  2 files changed, 15 insertions(+), 9 deletions(-)
> [snip]
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4 V2] SMDK5250: Convert lowlevel_init.S to lowlevel_init.c

2013-01-10 Thread Simon Glass
Hi Rajeshwari,

On Mon, Jan 7, 2013 at 5:08 AM, Rajeshwari Shinde
 wrote:
> This patch converts lowlevel_init.S to lowlevel_init_c.c for
> SMDK5250.
> Lowlevel.S as of now added only for SMDK5250 and same can be
> extended to other SOC in future.

Should perhaps also mention new feature (controllable memory reset for resume?)

>
> Signed-off-by: Rajeshwari Shinde 
> ---
> Changes in V2:
> - Renamed lowlevel_init.S to lowlevel.S and moved to
> arch/arm/cpu/armv7/exynos/
> - Moved power mode defines to power.h
> - Added early serial support.
> - Renamed mem_reset to reset.
>  arch/arm/cpu/armv7/exynos/Makefile   |6 ++
>  arch/arm/cpu/armv7/exynos/lowlevel.S |   35 
>  arch/arm/include/asm/arch-exynos/power.h |8 ++
>  board/samsung/smdk5250/Makefile  |2 +-
>  board/samsung/smdk5250/dmc_common.c  |4 +-
>  board/samsung/smdk5250/dmc_init_ddr3.c   |6 +-
>  board/samsung/smdk5250/lowlevel_init.S   |   96 
>  board/samsung/smdk5250/lowlevel_init.c   |   81 +

Any change we could move all of this to arch/arm/cpu/armv7/exynos...?

It really doesn't relate to this board alone, but to the chip.

>  board/samsung/smdk5250/setup.h   |   19 -
>  board/samsung/smdk5250/spl_boot.c|  140 +++--
>  spl/Makefile |4 +
>  11 files changed, 288 insertions(+), 113 deletions(-)
>  create mode 100644 arch/arm/cpu/armv7/exynos/lowlevel.S
>  delete mode 100644 board/samsung/smdk5250/lowlevel_init.S
>  create mode 100644 board/samsung/smdk5250/lowlevel_init.c
>
> diff --git a/arch/arm/cpu/armv7/exynos/Makefile 
> b/arch/arm/cpu/armv7/exynos/Makefile
> index 9119961..2aa2722 100644
> --- a/arch/arm/cpu/armv7/exynos/Makefile
> +++ b/arch/arm/cpu/armv7/exynos/Makefile
> @@ -22,6 +22,12 @@ include $(TOPDIR)/config.mk
>
>  LIB= $(obj)lib$(SOC).o
>
> +ifdef CONFIG_SMDK5250
> +ifdef CONFIG_SPL
> +COBJS  += lowlevel.o

Could do:

COBJS-$(CONFIG_SPL)  += lowlevel.o

and remove the inner ifdef

> +endif
> +endif
> +
>  COBJS  += clock.o power.o soc.o system.o pinmux.o
>
>  SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> diff --git a/arch/arm/cpu/armv7/exynos/lowlevel.S 
> b/arch/arm/cpu/armv7/exynos/lowlevel.S
> new file mode 100644
> index 000..7307959
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/exynos/lowlevel.S
> @@ -0,0 +1,35 @@
> +/*
> + * Lowlevel setup for SMDK5250 board based on S5PC520
> + *
> + * Copyright (C) 2012 Samsung Electronics
> + *
> + * 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 
> +
> +   .globl lowlevel_init
> +lowlevel_init:
> +   /*
> +* Set the stack pointer, although it will be overwritten by the 
> caller
> +* It seems we will not boot if this function is empty.
> +*/
> +   ldr sp, =CONFIG_IRAM_STACK
> +   mov pc, lr
> diff --git a/arch/arm/include/asm/arch-exynos/power.h 
> b/arch/arm/include/asm/arch-exynos/power.h
> index f6d0278..d6fd29e 100644
> --- a/arch/arm/include/asm/arch-exynos/power.h
> +++ b/arch/arm/include/asm/arch-exynos/power.h
> @@ -874,4 +874,12 @@ void power_ps_hold_setup(void);
>
>  /* Read the resume function and call it */
>  void power_exit_wakeup(void);
> +
> +
> +/* Power Down Modes
> + * User defined values in inform1 register
> + */
> +#define EXYNOS_CHECK_SLEEP 0x0BAD
> +#define EXYNOS_CHECK_DIDLE 0xBAD0
> +#define EXYNOS_CHECK_LPA   0xABAD
>  #endif
> diff --git a/board/samsung/smdk5250/Makefile b/board/samsung/smdk5250/Makefile
> index 47c6a5a..7eaef09 100644
> --- a/board/samsung/smdk5250/Makefile
> +++ b/board/samsung/smdk5250/Makefile
> @@ -24,7 +24,6 @@ include $(TOPDIR)/config.mk
>
>  LIB= $(obj)lib$(BOARD).o
>
> -SOBJS  := lowlevel_init.o
>
>  COBJS  := clock_init.o
>  COBJS  += dmc_common.o dmc_init_ddr3.o
> @@ -37,6 +36,7 @@ endif
>
>  ifdef CONFIG_SPL_BUILD
>  COBJS  += spl_boot.o
> +COBJS  += lowlevel_init.o

Can you use this form instead of ifdef here?

COBJS-$(CONFIG_SPL)  += lowlevel_init.o


>  endif
>
>  SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> diff --git a/board/samsung/smdk5250/dmc_com

Re: [U-Boot] [PATCH v2] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Fabio Estevam
Stefano,

On Thu, Jan 10, 2013 at 2:19 PM, Fabio Estevam
 wrote:
> Since commit de7d02aeb (mx6qsabresd: add usdhc2 and usdhc4 support)
> SDHC3 device node is no longer 0, which breaks loading a uImage from SDHC3.
>
> Fix it by adapting the default environment to use CONFIG_SYS_MMC_ENV_DEV as 
> the
> correct mmc node for loading the kernel from.
>
> While at it, go back to using SDHC3 as the default mmc, since we have Yocto
> images that generate an SD card containing U-boot,kernel and rootfs, so it is
> more convenient to keep using SDHC3 as it was originally.
>
> Signed-off-by: Fabio Estevam 

Sorry, please discard this one. Will send another version.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/4 V2] SMDK5250: Add PMIC voltage settings

2013-01-10 Thread Simon Glass
Hi Rajeshwari,

On Mon, Jan 7, 2013 at 5:08 AM, Rajeshwari Shinde
 wrote:
> This patch adds required pmic voltage settings for SMDK5250.
>
> Signed-off-by: Rajeshwari Shinde 
> ---
> Changes in V2:
> - Added  pmic_reg_update static function.
> - Added error check.
>  board/samsung/smdk5250/smdk5250.c |  110 
> -
>  include/power/max77686_pmic.h |   30 ++
>  2 files changed, 138 insertions(+), 2 deletions(-)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c 
> b/board/samsung/smdk5250/smdk5250.c
> index 73c3ec0..9b0fe39 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -24,14 +24,17 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -58,12 +61,115 @@ int dram_init(void)
>  }
>
>  #if defined(CONFIG_POWER)
> +static int pmic_reg_update(struct pmic *p, int reg, uint regval)
> +{
> +   u32 val;
> +   int ret = 0;
> +
> +   ret = pmic_reg_read(p, reg, &val);
> +   if (ret) {
> +   debug("%s: PMIC register read failed\n", __func__);

Perhaps add register number here

> +   return -1;
> +   }
> +   val |= regval;
> +   ret = pmic_reg_write(p, reg, val);
> +   if (ret) {
> +   debug("%s: PMIC register write failed\n", __func__);

and here

> +   return -1;
> +   }
> +   return 0;
> +}
> +
>  int power_init_board(void)
>  {
> +   struct pmic *p;
> +
> +   power_ps_hold_setup();
> +
> +   i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> +
> if (pmic_init(I2C_PMIC))
> return -1;
> -   else
> -   return 0;
> +
> +   p = pmic_get("MAX77686_PMIC");
> +   if (!p)
> +   return -ENODEV;
> +
> +   if (pmic_probe(p))
> +   return -1;
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_32KHZ, MAX77686_32KHCP_EN))
> +   return -1;
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_BBAT,
> +   (MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V)))

You could remove the brackets around the | expressions in this patch
if you like.

> +   return -1;
> +
> +   /* VDD_MIF */
> +   if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1OUT,
> +   MAX77686_BUCK1OUT_1V)) {
> +   debug("%s: PMIC BUCK1OUT register write failed\n", __func__);

You can probably remove this debug() if you do what I suggest above.
Same applies below I think.

> +   return -1;
> +   }
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK1CRTL,
> +   MAX77686_BUCK1CTRL_EN))
> +   return -1;
> +
> +   /* VDD_ARM */
> +   if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2DVS1,
> +   MAX77686_BUCK2DVS1_1_3V)) {
> +   debug("%s: PMIC BUCK2DVS1 register write failed\n", __func__);
> +   return -1;
> +   }
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK2CTRL1,
> +   MAX77686_BUCK2CTRL_ON))
> +   return -1;
> +
> +   /* VDD_INT */
> +   if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3DVS1,
> +   MAX77686_BUCK3DVS1_1_0125V)) {
> +   debug("%s: PMIC BUCK3DVS1 register write failed\n", __func__);
> +   return -1;
> +   }
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK3CTRL,
> +   MAX77686_BUCK3CTRL_ON))
> +   return -1;
> +
> +   /* VDD_G3D */
> +   if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4DVS1,
> +   MAX77686_BUCK4DVS1_1_2V)) {
> +   debug("%s: PMIC BUCK4DVS1 register write failed\n", __func__);
> +   return -1;
> +   }
> +
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK4CTRL1,
> +   MAX77686_BUCK3CTRL_ON))
> +   return -1;
> +
> +   /* VDD_LDO2 */
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO2CTRL1,
> +   (MAX77686_LD02CTRL1_1_5V | EN_LDO)))
> +   return -1;
> +
> +   /* VDD_LDO3 */
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO3CTRL1,
> +   (MAX77686_LD03CTRL1_1_8V | EN_LDO)))
> +   return -1;
> +
> +   /* VDD_LDO5 */
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO5CTRL1,
> +   (MAX77686_LD05CTRL1_1_8V | EN_LDO)))
> +   return -1;
> +
> +   /* VDD_LDO10 */
> +   if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO10CTRL1,
> +   (MAX77686_LD10CTRL1_1_8V | EN_LDO)))
> + 

Re: [U-Boot] [PATCH v3] SMDK5250: Enable VBus for USB 2.0 controller

2013-01-10 Thread Simon Glass
On Mon, Jan 7, 2013 at 10:30 PM, Vivek Gautam  wrote:
> This patch enables Vbus required for USB 2.0 controller.
>
> Signed-off-by: Vivek Gautam 
> Signed-off-by: Rajeshwari Shinde 

Acked-by: Simon Glass 

> ---
>
> Changes from v2:
> - Rebased on top of u-boot-usb/next
> - Enclosed the function definition for board_usb_vbus_init()
>   inside "CONFIG_USB_EHCI_EXYNOS"
>
> Changes from v1:
> - Using the old school method of setting up gpio instead
>   of using the pinmux method, since the required gpio line
>   here is board specific.
>
>  board/samsung/smdk5250/smdk5250.c |   19 +++
>  1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c 
> b/board/samsung/smdk5250/smdk5250.c
> index a5816e4..cf7f801 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -60,9 +60,28 @@ static int smc9115_pre_init(void)
>  }
>  #endif
>
> +#ifdef CONFIG_USB_EHCI_EXYNOS
> +int board_usb_vbus_init(void)
> +{
> +   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> +   samsung_get_base_gpio_part1();
> +
> +   /* Enable VBUS power switch */
> +   s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> +
> +   /* VBUS turn ON time */
> +   mdelay(3);
> +
> +   return 0;
> +}
> +#endif
> +
>  int board_init(void)
>  {
> gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
> +#ifdef CONFIG_USB_EHCI_EXYNOS
> +   board_usb_vbus_init();
> +#endif
> return 0;
>  }
>
> --
> 1.7.6.5
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] SMDK5250: Enable VBus for USB 2.0 controller

2013-01-10 Thread Simon Glass
Hi Vivek,

On Thu, Jan 10, 2013 at 10:16 AM, Simon Glass  wrote:
> On Mon, Jan 7, 2013 at 10:30 PM, Vivek Gautam  
> wrote:
>> This patch enables Vbus required for USB 2.0 controller.
>>
>> Signed-off-by: Vivek Gautam 
>> Signed-off-by: Rajeshwari Shinde 
>
> Acked-by: Simon Glass 

Sorry, I can't resist one little comment - I wonder if this USB init
can be delayed until USB is actually used? Perhaps we need such an API
call in the USB subsystem?

Regards,
Simon

>
>> ---
>>
>> Changes from v2:
>> - Rebased on top of u-boot-usb/next
>> - Enclosed the function definition for board_usb_vbus_init()
>>   inside "CONFIG_USB_EHCI_EXYNOS"
>>
>> Changes from v1:
>> - Using the old school method of setting up gpio instead
>>   of using the pinmux method, since the required gpio line
>>   here is board specific.
>>
>>  board/samsung/smdk5250/smdk5250.c |   19 +++
>>  1 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/board/samsung/smdk5250/smdk5250.c 
>> b/board/samsung/smdk5250/smdk5250.c
>> index a5816e4..cf7f801 100644
>> --- a/board/samsung/smdk5250/smdk5250.c
>> +++ b/board/samsung/smdk5250/smdk5250.c
>> @@ -60,9 +60,28 @@ static int smc9115_pre_init(void)
>>  }
>>  #endif
>>
>> +#ifdef CONFIG_USB_EHCI_EXYNOS
>> +int board_usb_vbus_init(void)
>> +{
>> +   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
>> +   
>> samsung_get_base_gpio_part1();
>> +
>> +   /* Enable VBUS power switch */
>> +   s5p_gpio_direction_output(&gpio1->x2, 6, 1);
>> +
>> +   /* VBUS turn ON time */
>> +   mdelay(3);
>> +
>> +   return 0;
>> +}
>> +#endif
>> +
>>  int board_init(void)
>>  {
>> gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
>> +#ifdef CONFIG_USB_EHCI_EXYNOS
>> +   board_usb_vbus_init();
>> +#endif
>> return 0;
>>  }
>>
>> --
>> 1.7.6.5
>>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] mx6qsabresd: Fix booting the kernel from SDHC3

2013-01-10 Thread Fabio Estevam
Since commit de7d02aeb (mx6qsabresd: add usdhc2 and usdhc4 support) 
SDHC3 device node is no longer 0, which breaks loading a uImage from SDHC3.

Fix it by adapting the default environment to use CONFIG_SYS_MMC_ENV_DEV as the 
correct mmc node for loading the kernel from.

While at it, go back to using SDHC3 as the default mmc, since we have Yocto 
images that generate an SD card containing U-boot,kernel and rootfs, so it is
more convenient to keep using SDHC3 as it was originally.

Signed-off-by: Fabio Estevam 
---
Changes since v2:
- Use __stringify to properly pass CONFIG_SYS_MMC_ENV_DEV
Changes since v1:
- Properly expand mmcdev macro
- Improve commit log
 include/configs/mx6qsabre_common.h |2 +-
 include/configs/mx6qsabresd.h  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/mx6qsabre_common.h 
b/include/configs/mx6qsabre_common.h
index bd2fb10..95ebd98 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -86,7 +86,7 @@
"console=" CONFIG_CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
"initrd_high=0x\0" \
-   "mmcdev=0\0" \
+   "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
"mmcpart=1\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
index a1d9285..ccb7751 100644
--- a/include/configs/mx6qsabresd.h
+++ b/include/configs/mx6qsabresd.h
@@ -27,7 +27,7 @@
 
 #define CONFIG_SYS_FSL_USDHC_NUM   3
 #if defined(CONFIG_ENV_IS_IN_MMC)
-#define CONFIG_SYS_MMC_ENV_DEV 2   /* eMMC/uSDHC4 */
+#define CONFIG_SYS_MMC_ENV_DEV 1   /* SDHC3 */
 #define CONFIG_SYS_MMC_ENV_PART1   /* Boot partition 1 */
 #endif
 
-- 
1.7.9.5


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


Re: [U-Boot] [RFC] Is anyone interested IPv6 support for u-boot

2013-01-10 Thread Joe Hershberger
Hi Chris,

On Wed, Jan 9, 2013 at 9:25 PM, Chris Packham  wrote:
> Hi,
>
> Here at $dayjob we make embedded network devices (routers & switches).
> Because we have an interest in getting people to adopt IPv6 we've added code
> to our local u-boot repository to add basic IPv6 support on our boards. It's
> not a fully conformant IPv6 host implementation but it is enough to be able
> to statically configure an IPv6 address and download images from a v6
> capable TFTP server.
>
> We're trying to be better FLOSS citizens so I'm proposing to my colleagues
> that we put some effort in getting this pushed upstream. The first step of
> which would be to see if anyone wants the feature and is the /net maintainer
> willing to take on this code (not that we intend to dump and run).

I'm certainly interested in entertaining any network stack patches,
and IPv6 support is certainly useful.

> Our existing code is a little too tightly coupled to our out of tree board
> support so I don't have a preliminary patchset to provide. If there is
> interest I'll work on porting it from our tree to a vanilla u-boot tree (we
> have a couple of supported eval boards around).

Please make sure you have a look at
http://www.denx.de/wiki/U-Boot/Patches if you haven't already.  That
will make it much easier to accept your patches.  You may also want to
use the patman and buildman tools to help you manage your
patch-series.

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


Re: [U-Boot] NAND flash - bad blocks

2013-01-10 Thread Scott Wood

On 01/10/2013 01:56:30 AM, Dimitar Penev wrote:

Hello,

First of all sorry if this question was already answered here.

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices.
On the first erase in uboot 2011.09 I got bunch of mostly consecutive  
bad blocks.
According to the datasheet we should get not more then 80 bad blocks  
for our chip

but I get something like 240 bad blocks for most of the NAND chips.

I seems to be able to fix this using the following procedure:


Call your NAND vendor and complain?

After making sure that there's nothing wrong with your NAND driver or  
controller that causes the OOB to be read incorrectly.  Did you do  
anything to the NAND chip prior to this "first erase"?  In particular,  
did you write to the OOB?



In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.


You're not fixing anything -- you're wiping out all bad block  
information.  Those "1,2 bad blocks" are not actually bad blocks, but  
are the bad block table which appears "bad" to reserve it.  These  
should be at the end of flash.  Or, possibly, they're blocks that  
happen to be damaged in a way that prevents the bad block marker from  
becoming 0xff.



In Linux we have few mtd partitions on this NAND chip.
Unmount all of them and for all of them :
linux>nandtest -m /dev/mtdx
Usually this doesn't add any new badblocks on top of what I get on  
nand erase in uboot,

but I really haven't tested that much device to say.

After this procedure the NAND flash seems to work fine.
Do you think this is reliable way?


No.

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


Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Javier Martinez Canillas
On Thu, Jan 10, 2013 at 6:26 PM, Tom Rini  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 01/10/2013 11:16 AM, Javier Martinez Canillas wrote:
>> On Thu, Jan 10, 2013 at 4:35 PM, Tom Rini  wrote:
>>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>>>
>>> On 01/10/2013 04:43 AM, Javier Martinez Canillas wrote:
 On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg
  wrote:
> On 12/27/12 15:36, Javier Martinez Canillas wrote:
>> This patch adds an GPIO LED boot status for IGEP boards.
>>
>> The GPIO LED used is the red LED0 while the Linux kernel
>> uses the green LED0 as the boot status.
>>
>> By using different GPIO LEDs, the user can know in which
>> step of the boot process the board currently is.
>>
>> Signed-off-by: Javier Martinez Canillas
>> 
>
> Acked-by: Igor Grinberg 
>

 Hello Tom,

 Any news of merging this patch?
>>>
>>> Things look good, sorry.  I'm going to try and get to starting a
>>>  next branch but I might not get a chance before the next
>>> release.
>>>
>>> - -- Tom
>>
>> Great, waiting for the next release is not an issue.
>>
>> There are also two more patches for IGEP boards that were acked
>> but not picked for this release:
>>
>> [U-Boot,v2,1/2] OMAP3: use a single board file for IGEP devices
>> [1] [U-Boot,1/1] OMAP3: igep00x0: add CONFIG_SPL_BOARD_INIT for
>> CONFIG_SPL_NAND_SUPPORT [2]
>
> For the second path, did SPL+NAND for the IGEP devices get added already?
>
> - --
> Tom

Yes, it was added on mainline commit d271a6114 "OMAP3: igep00x0: add
SPL support for IGEP-based boards"

Before posting that patch I only tested SPL booting from the uSD/MMC
and later when trying SPL boot from NAND I realized that
CONFIG_SPL_BOARD_INIT was missing to initialize the GPMC.

Sorry, my bad. I should have tested both MMC and NAND booting before
posting the SPL support patch.

Thanks a lot and best regards,
Javier
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 2/2] OMAP3: igep00x0: add boot status GPIO LED

2013-01-10 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/10/2013 02:26 PM, Javier Martinez Canillas wrote:
> On Thu, Jan 10, 2013 at 6:26 PM, Tom Rini  wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>> 
>> On 01/10/2013 11:16 AM, Javier Martinez Canillas wrote:
>>> On Thu, Jan 10, 2013 at 4:35 PM, Tom Rini  
>>> wrote:
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
 
 On 01/10/2013 04:43 AM, Javier Martinez Canillas wrote:
> On Thu, Dec 27, 2012 at 3:25 PM, Igor Grinberg 
>  wrote:
>> On 12/27/12 15:36, Javier Martinez Canillas wrote:
>>> This patch adds an GPIO LED boot status for IGEP 
>>> boards.
>>> 
>>> The GPIO LED used is the red LED0 while the Linux 
>>> kernel uses the green LED0 as the boot status.
>>> 
>>> By using different GPIO LEDs, the user can know in 
>>> which step of the boot process the board currently is.
>>> 
>>> Signed-off-by: Javier Martinez Canillas 
>>> 
>> 
>> Acked-by: Igor Grinberg 
>> 
> 
> Hello Tom,
> 
> Any news of merging this patch?
 
 Things look good, sorry.  I'm going to try and get to 
 starting a next branch but I might not get a chance before 
 the next release.
 
 - -- Tom
>>> 
>>> Great, waiting for the next release is not an issue.
>>> 
>>> There are also two more patches for IGEP boards that were acked
>>> but not picked for this release:
>>> 
>>> [U-Boot,v2,1/2] OMAP3: use a single board file for IGEP devices
>>> [1] [U-Boot,1/1] OMAP3: igep00x0: add CONFIG_SPL_BOARD_INIT for
>>> CONFIG_SPL_NAND_SUPPORT [2]
>> 
>> For the second path, did SPL+NAND for the IGEP devices get added 
>> already?
>> 
>> - -- Tom
> 
> Yes, it was added on mainline commit d271a6114 "OMAP3: igep00x0: 
> add SPL support for IGEP-based boards"
> 
> Before posting that patch I only tested SPL booting from the 
> uSD/MMC and later when trying SPL boot from NAND I realized that 
> CONFIG_SPL_BOARD_INIT was missing to initialize the GPMC.
> 
> Sorry, my bad. I should have tested both MMC and NAND booting 
> before posting the SPL support patch.

OK, that makes it a bugfix.  Albert, OK if I pull a bugfix patch
(adding a #define to a config) for a TI platform into master or do you
want it to go via u-boot-ti -> u-boot-arm ?  Thanks!

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

iQIcBAEBAgAGBQJQ7xklAAoJENk4IS6UOR1WxckQAKzSJF9cmf5uH2dTAWZ++r7f
Y5CS/Ro5E72OWgpjZCNwWts6Rr1uiP8hU15rOSq3a3An1tWPZuP6+xb4YTb2cvpb
X8EgeFQs9R++hJssCLn9lOYCmNdfF73siXJGSunVNUjxWlZePAHIUhLHeXFlYH8C
qAJ4chtD08fWJ5I/XWW5QdX8zAeF9M41U3jwYg1baeg0wiVWX7loV5s3AO76Wogp
qa6OLGXdvWzpV6+1A+vgRzjI9r0GA/rhpCD4vuoComenP6sBJezAK0Mn7s2slqmo
tXLMfi0G1FD7NF37wm3VYXLB8FlPJQfxfxbAk5oreIzl/BYieiGT27NiNrv1mzmm
5e/m1D7e7LJpJSeEJsRcwVrV1P9usEH1n1TVhMhlGOD3Z/XMC2sFX5GOPG4sMgkq
FxmXSM7mTrbYi/kvB16QWV5gn8r9e6Pl1a570+RJcwVKHMgWomvhWV5ihHb3UFww
VH3DBF1Xp3BuYrSmUgWelHCHI5QiZrLnwJoMDxj9jSRumQ0vAgjPPtbzZrNW43Xb
9URHP2oDyO7VEZnqZDMacEhIUHuZ96ENk7nEUWtpTqasCRdWHVTkM4HV5AHYiUxn
UwlcuVL6+4TWHgA1cfCyIcfGHh0zPzjgsDAO49GXGDzYPAEo/Wl3KDggiNZIFzwL
PcNb54gxJj+XEEi2bmRH
=oJ0U
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v6 0/6] Improve default environment for easy use

2013-01-10 Thread Otavio Salvador
This patchset improves the default environment of machines currently
supported in OpenEmbedded and Yocto to  make it compatible with
mainline and Freescale BSP Linux kernel.

A new patch has been add to change the format in mx6qsabrelite in
environment setting and already merged patches removed from this new
pull request.

Changes in v6:
- Fix reformat
- Fix mmcargs set
- Fix netboot fdt
- Raise SYS_CBSIZE to 512 to fix a runtime error

Changes in v5:
- Change subject
- Reword the warning
- Change subject

Changes in v4:
- Use a warning, instead of error when failing to fetch fdt
- Drop exit use
- Fix netboot
- Use fdt instead of ftd

Changes in v3:
- Add loadfdt
- Use loadfdt
- Call exit to abort script

Changes in v2:
- New patch
- Reformat environment change to fit in 80 cols
- Allow use of dynamic/static ip
- Allow force use, or not, of fdt
- Change 'auto' to 'try'

Otavio Salvador (6):
  mx6qsabrelite: Use tabs to environment setting
  mx28evk: We shouldn't hardcode a rootfs filesystem type
  mx28evk: Add support to dynamically choose between fdt use or not
  mx53loco: Add support to dynamically choose between fdt use or not
  mx6qsabrelite: Add support to dynamically choose between fdt use or
not
  mx6qsabre{auto,sd}: Add support to dynamically choose between fdt use
or not

 include/configs/mx28evk.h  |   47 ++---
 include/configs/mx53loco.h |   44 ++--
 include/configs/mx6qsabre_common.h |   41 +--
 include/configs/mx6qsabreauto.h|1 +
 include/configs/mx6qsabrelite.h|  101 
 include/configs/mx6qsabresd.h  |1 +
 6 files changed, 188 insertions(+), 47 deletions(-)

-- 
1.7.10.4

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


[U-Boot] [PATCH v6 1/6] mx6qsabrelite: Use tabs to environment setting

2013-01-10 Thread Otavio Salvador
This rework the environment to use tabs for environment setting as
done in other boards.

Signed-off-by: Otavio Salvador 
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- New patch

 include/configs/mx6qsabrelite.h |   66 +++
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 0f6bbb4..ee86f9b 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -152,43 +152,43 @@
 #define CONFIG_SYS_TEXT_BASE  0x1780
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-   "script=boot.scr\0" \
-   "uimage=uImage\0" \
+   "script=boot.scr\0" \
+   "uimage=uImage\0" \
"console=ttymxc1\0" \
-   "fdt_high=0x\0"   \
+   "fdt_high=0x\0" \
"initrd_high=0x\0" \
-   "mmcdev=0\0" \
-   "mmcpart=2\0" \
-   "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
-   "mmcargs=setenv bootargs console=${console},${baudrate} " \
-  "root=${mmcroot}\0" \
-   "loadbootscript=" \
-  "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-   "bootscript=echo Running bootscript from mmc ...; " \
-  "source\0" \
-   "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
-   "mmcboot=echo Booting from mmc ...; " \
-  "run mmcargs; " \
-  "bootm\0" \
-   "netargs=setenv bootargs console=${console},${baudrate} " \
-  "root=/dev/nfs " \
-  "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-   "netboot=echo Booting from net ...; " \
-  "run netargs; " \
-  "dhcp ${uimage}; bootm\0" \
+   "mmcdev=0\0" \
+   "mmcpart=2\0" \
+   "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
+   "mmcargs=setenv bootargs console=${console},${baudrate} " \
+   "root=${mmcroot}\0" \
+   "loadbootscript=" \
+   "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+   "bootscript=echo Running bootscript from mmc ...; " \
+   "source\0" \
+   "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+   "mmcboot=echo Booting from mmc ...; " \
+   "run mmcargs; " \
+   "bootm\0" \
+   "netargs=setenv bootargs console=${console},${baudrate} " \
+   "root=/dev/nfs " \
+   "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+   "netboot=echo Booting from net ...; " \
+   "run netargs; " \
+   "dhcp ${uimage}; bootm\0"
 
 #define CONFIG_BOOTCOMMAND \
-   "mmc dev ${mmcdev};" \
-   "mmc dev ${mmcdev}; if mmc rescan; then " \
-  "if run loadbootscript; then " \
-  "run bootscript; " \
-  "else " \
-  "if run loaduimage; then " \
-  "run mmcboot; " \
-  "else run netboot; " \
-  "fi; " \
-  "fi; " \
-   "else run netboot; fi"
+  "mmc dev ${mmcdev};" \
+  "mmc dev ${mmcdev}; if mmc rescan; then " \
+  "if run loadbootscript; then " \
+  "run bootscript; " \
+  "else " \
+  "if run loaduimage; then " \
+  "run mmcboot; " \
+  "else run netboot; " \
+  "fi; " \
+  "fi; " \
+  "else run netboot; fi"
 
 #define CONFIG_ARP_TIMEOUT 200UL
 
-- 
1.7.10.4

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


[U-Boot] [PATCH v6 6/6] mx6qsabre{auto, sd}: Add support to dynamically choose between fdt use or not

2013-01-10 Thread Otavio Salvador
Signed-off-by: Otavio Salvador 
---
Changes in v6:
- Fix netboot fdt
- Rebase on top of 'mx6qsabresd: Fix booting the kernel from SDHC3'

Changes in v5:
- Change subject
- Reword the warning

Changes in v4:
- Use a warning, instead of error when failing to fetch fdt
- Drop exit use
- Fix netboot
- Use fdt instead of ftd

Changes in v3:
- Add loadfdt
- Use loadfdt
- Call exit to abort script

Changes in v2:
- Allow use of dynamic/static ip
- Allow force use, or not, of fdt
- Change 'auto' to 'try'

 include/configs/mx6qsabre_common.h |   41 +---
 include/configs/mx6qsabreauto.h|1 +
 include/configs/mx6qsabresd.h  |1 +
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/include/configs/mx6qsabre_common.h 
b/include/configs/mx6qsabre_common.h
index 95ebd98..cda4512 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -83,6 +83,10 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
"script=boot.scr\0" \
"uimage=uImage\0" \
+   "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+   "fdt_addr=0x1100\0" \
+   "boot_fdt=try\0" \
+   "ip_dyn=yes\0" \
"console=" CONFIG_CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
"initrd_high=0x\0" \
@@ -96,15 +100,46 @@
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
-   "mmcboot=echo Booting from mmc ...; " \
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+   "mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
-   "bootm\0" \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if run loadfdt; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0" \
"netargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
"run netargs; " \
-   "dhcp ${uimage}; bootm\0" \
+   "if test ${ip_dyn} = yes; then " \
+   "setenv get_cmd dhcp; " \
+   "else " \
+   "setenv get_cmd tftp; " \
+   "fi; " \
+   "${get_cmd} ${uimage}; " \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev};" \
diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h
index f1ff201..f4a082a 100644
--- a/include/configs/mx6qsabreauto.h
+++ b/include/configs/mx6qsabreauto.h
@@ -15,6 +15,7 @@
 #define CONFIG_MACH_TYPE   3529
 #define CONFIG_MXC_UART_BASE   UART4_BASE
 #define CONFIG_CONSOLE_DEV "ttymxc3"
+#define CONFIG_DEFAULT_FDT_FILE"imx6q-sabreauto.dtb"
 #define CONFIG_MMCROOT "/dev/mmcblk0p2"
 #define PHYS_SDRAM_SIZE(2u * 1024 * 1024 * 1024)
 
diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
index ccb7751..3b8d752 100644
--- a/include/configs/mx6qsabresd.h
+++ b/include/configs/mx6qsabresd.h
@@ -21,6 +21,7 @@
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 #define CONFIG_CONSOLE_DEV "ttymxc0"
 #define CONFIG_MMCROOT "/dev/mmcblk1p2"
+#define CONFIG_DEFAULT_FDT_FILE"imx6q-sabresd.dtb"
 #define PHYS_SDRAM_SIZE(1u * 1024 * 1024 * 1024)
 
 #include "mx6qsabre_common.h"
-- 
1.7.10.4

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


[U-Boot] [PATCH v6 5/6] mx6qsabrelite: Add support to dynamically choose between fdt use or not

2013-01-10 Thread Otavio Salvador
Signed-off-by: Otavio Salvador 
---
Changes in v6:
- Fix netboot fdt

Changes in v5:
- Change subject
- Reword the warning

Changes in v4:
- Use a warning, instead of error when failing to fetch fdt
- Drop exit use
- Fix netboot
- Use fdt instead of ftd

Changes in v3:
- Add loadfdt
- Use loadfdt
- Call exit to abort script

Changes in v2:
- Allow use of dynamic/static ip
- Allow force use, or not, of fdt
- Change 'auto' to 'try'

 include/configs/mx6qsabrelite.h |   39 +--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index ee86f9b..752f098 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -157,6 +157,10 @@
"console=ttymxc1\0" \
"fdt_high=0x\0" \
"initrd_high=0x\0" \
+   "fdt_file=imx6q-sabrelite.dtb\0" \
+   "fdt_addr=0x1100\0" \
+   "boot_fdt=try\0" \
+   "ip_dyn=yes\0" \
"mmcdev=0\0" \
"mmcpart=2\0" \
"mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
@@ -167,15 +171,46 @@
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
-   "bootm\0" \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if run loadfdt; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0" \
"netargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
"run netargs; " \
-   "dhcp ${uimage}; bootm\0"
+   "if test ${ip_dyn} = yes; then " \
+   "setenv get_cmd dhcp; " \
+   "else " \
+   "setenv get_cmd tftp; " \
+   "fi; " \
+   "${get_cmd} ${uimage}; " \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
   "mmc dev ${mmcdev};" \
-- 
1.7.10.4

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


[U-Boot] [PATCH v6 2/6] mx28evk: We shouldn't hardcode a rootfs filesystem type

2013-01-10 Thread Otavio Salvador
For a generic environment, we shouldn't have a fixed rootfs filesystem
so we drop it from env.

Signed-off-by: Otavio Salvador 
---
Changes in v6:
- Fix reformat

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Reformat environment change to fit in 80 cols

 include/configs/mx28evk.h |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index cdf3e15..a13478d 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -292,11 +292,9 @@
"console_mainline=ttyAMA0\0" \
"mmcdev=0\0" \
"mmcpart=2\0" \
-   "mmcroot=/dev/mmcblk0p3 rw\0" \
-   "mmcrootfstype=ext3 rootwait\0" \
+   "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
"mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \
-   "root=${mmcroot} " \
-   "rootfstype=${mmcrootfstype}\0" \
+   "root=${mmcroot}\0" \
"loadbootscript="  \
"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
-- 
1.7.10.4

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


[U-Boot] [PATCH v6 3/6] mx28evk: Add support to dynamically choose between fdt use or not

2013-01-10 Thread Otavio Salvador
Signed-off-by: Otavio Salvador 
---
Changes in v6: None
Changes in v5:
- Change subject
- Reword the warning

Changes in v4:
- Use a warning, instead of error when failing to fetch fdt
- Drop exit use
- Fix netboot
- Use fdt instead of ftd

Changes in v3:
- Add loadfdt
- Use loadfdt
- Call exit to abort script

Changes in v2:
- Allow use of dynamic/static ip
- Allow force use, or not, of fdt
- Change 'auto' to 'try'

 include/configs/mx28evk.h |   41 ++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index a13478d..dd0ef21 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -290,6 +290,10 @@
"uimage=uImage\0" \
"console_fsl=ttyAM0\0" \
"console_mainline=ttyAMA0\0" \
+   "fdt_file=imx28-evk.dtb\0" \
+   "fdt_addr=0x4100\0" \
+   "boot_fdt=try\0" \
+   "ip_dyn=yes\0" \
"mmcdev=0\0" \
"mmcpart=2\0" \
"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
@@ -300,15 +304,46 @@
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
"mmcboot=echo Booting from mmc ...; " \
-   "run mmcargs; " \
-   "bootm\0" \
+   "run mmcargs; " \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if run loadfdt; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0" \
"netargs=setenv bootargs console=${console_mainline},${baudrate} " \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
"run netargs; " \
-   "dhcp ${uimage}; bootm\0"
+   "if test ${ip_dyn} = yes; then " \
+   "setenv get_cmd dhcp; " \
+   "else " \
+   "setenv get_cmd tftp; " \
+   "fi; " \
+   "${get_cmd} ${uimage}; " \
+   "if test ${boot_fdt} = yes; then " \
+   "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi;" \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev}; if mmc rescan; then " \
-- 
1.7.10.4

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


[U-Boot] [PATCH v6 4/6] mx53loco: Add support to dynamically choose between fdt use or not

2013-01-10 Thread Otavio Salvador
The CONFIG_SYS_CBSIZE has been change to 512 to avoid runtime errors as:

,---[ Runtime error ]
| Hit any key to stop autoboot:  0
| MX53LOCO U-Boot > pri netboot
| netboot=echo Booting from net ...; run netargs; if test ...
| prefetch abort
| pc : [<20747368>]  lr : [<20747365>]
| sp : af566e20  ip :  fp : 
| r10: 0002  r9 : af6dfc28 r8 : af566f58
| r7 : af6dfc10  r6 : 0001 r5 : 0002  r4 : 74206669
| r3 :   r2 : 0060 r1 : 0020  r0 : 018e
| Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
| Resetting CPU ...
|
| resetting ...
`---

Signed-off-by: Otavio Salvador 
---
Changes in v6:
- Fix mmcargs set
- Fix netboot fdt
- Raise SYS_CBSIZE to 512 to fix a runtime error

Changes in v5:
- Change subject
- Reword the warning

Changes in v4:
- Use a warning, instead of error when failing to fetch fdt
- Drop exit use
- Fix netboot
- Use fdt instead of ftd

Changes in v3:
- Add loadfdt
- Use loadfdt
- Call exit to abort script

Changes in v2:
- Allow use of dynamic/static ip
- Allow force use, or not, of fdt
- Change 'auto' to 'try'

 include/configs/mx53loco.h |   44 
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index 996396b..a4b610f 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -119,24 +119,60 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
"script=boot.scr\0" \
"uimage=uImage\0" \
+   "fdt_file=imx53-qsb.dtb\0" \
+   "fdt_addr=0x7100\0" \
+   "boot_fdt=try\0" \
+   "ip_dyn=yes\0" \
"mmcdev=0\0" \
"mmcpart=2\0" \
"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
-   "mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot} " \
+   "mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot}\0" 
\
"loadbootscript=" \
"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
-   "bootm\0" \
+   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+   "if run loadfdt; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo WARN: Cannot load the DT; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0" \
"netargs=setenv bootargs console=ttymxc0,${baudrate} " \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
"run netargs; " \
-   "dhcp ${uimage}; bootm\0" \
+   "if test ${ip_dyn} = yes; then " \
+   "setenv get_cmd dhcp; " \
+   "else " \
+   "setenv get_cmd tftp; " \
+   "fi; " \
+   "${get_cmd} ${uimage}; " \
+   "if test ${boot_fdt} = yes ||  test ${boot_fdt} = try; then " \
+   "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+   "bootm ${loadaddr} - ${fdt_addr}; " \
+   "else " \
+   "if test ${boot_fdt} = try; then " \
+   "bootm; " \
+   "else " \
+   "echo ERROR: Cannot load the DT; " \
+   "exit; " \
+   "fi; " \
+   "fi; " \
+   "else " \
+   "bootm; " \
+   "fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev}; if mmc rescan; then " \
@@ -157,7 +193,7 @@
 #define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
 #define CONFIG_SYS_PROMPT  "MX53LOCO U-Boot > "
 #define CONFIG_AUTO_COMPLETE
-#define CONFIG_SYS_CBSIZE  256 /* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE  512 /* Console I/O Buffer Size */
 
 /* Print Buffer Size */
 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH v6 6/6] mx6qsabre{auto, sd}: Add support to dynamically choose between fdt use or not

2013-01-10 Thread Fabio Estevam
On Thu, Jan 10, 2013 at 5:45 PM, Otavio Salvador
 wrote:
> Signed-off-by: Otavio Salvador 

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


Re: [U-Boot] [RFC] Is anyone interested IPv6 support for u-boot

2013-01-10 Thread Chris Packham
On Fri, Jan 11, 2013 at 8:16 AM, Joe Hershberger
wrote:

> Hi Chris,
>
> On Wed, Jan 9, 2013 at 9:25 PM, Chris Packham 
> wrote:
> > Hi,
> >
> > Here at $dayjob we make embedded network devices (routers & switches).
> > Because we have an interest in getting people to adopt IPv6 we've added
> code
> > to our local u-boot repository to add basic IPv6 support on our boards.
> It's
> > not a fully conformant IPv6 host implementation but it is enough to be
> able
> > to statically configure an IPv6 address and download images from a v6
> > capable TFTP server.
> >
> > We're trying to be better FLOSS citizens so I'm proposing to my
> colleagues
> > that we put some effort in getting this pushed upstream. The first step
> of
> > which would be to see if anyone wants the feature and is the /net
> maintainer
> > willing to take on this code (not that we intend to dump and run).
>
> I'm certainly interested in entertaining any network stack patches,
> and IPv6 support is certainly useful.
>

OK. I'll try and get started as soon as I get a chance. Might need to get
some clearance from $overlords to spend work time on it (or $wife to spend
spare time on it). Should I base the patches on git://
git.denx.de/u-boot-net.git or the main u-boot.git or something else?


> > Our existing code is a little too tightly coupled to our out of tree
> board
> > support so I don't have a preliminary patchset to provide. If there is
> > interest I'll work on porting it from our tree to a vanilla u-boot tree
> (we
> > have a couple of supported eval boards around).
>
> Please make sure you have a look at
> http://www.denx.de/wiki/U-Boot/Patches if you haven't already.  That
> will make it much easier to accept your patches.  You may also want to
> use the patman and buildman tools to help you manage your
> patch-series.
>

Yep will do. Part of the reason I haven't sent what we've got currently is
that it would be a big amorphous dump of code and I don't want to waste
peoples time when I should be able to break it up into a series of logical
commits.


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


Re: [U-Boot] bootm: relocate names of sub-command table for archs with CONFIG_NEEDS_MANUAL_RELOC

2013-01-10 Thread Tom Rini
On Mon, Jan 07, 2013 at 06:54:52AM -, Daniel Schwierzeck wrote:

> From: Daniel Schwierzeck 
> 
> To make bootm sub-command feature working on archs with 
> CONFIG_NEEDS_MANUAL_RELOC,
> the name pointers in the sub-command table need to be relocated.
> 
> Signed-off-by: Daniel Schwierzeck 

Applied to u-boot/master, thanks!

-- 
Tom


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


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

2013-01-10 Thread Tom Rini
On Thu, Jan 10, 2013 at 03:37:30PM +0100, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the following patches pending for quite some time:
> 
> The following changes since commit 642ef40bdc95bef829ae3aadc217f829c4c298c4:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-arm (2013-01-09 08:13:22 
> -0700)
> 
> are available in the git repository at:
> 
> 
>   git://www.denx.de/git/u-boot-cfi-flash.git master
> 
> for you to fetch changes up to d2af028db3f75390f56f018e16c0f269521e07c5:
> 
>   cfi_flash: Report Advanced Sector Protection (PPB) with flinfo cmd 
> (2013-01-10 14:40:00 +0100)
> 
> 
> Angelo Dureghello (1):
>   mtd/cfi: add support for SST 4KB sector granularity
> 
> Stefan Roese (4):
>   cfi_flash: Add manufact_match helper function
>   cfi_flash: Read PPB sector protection from device for AMD/Spansion chips
>   cfi_flash: Enable PPB protection for all AMD cmdset flash chips
>   cfi_flash: Report Advanced Sector Protection (PPB) with flinfo cmd
> 
>  drivers/mtd/cfi_flash.c | 71 
> -
>  include/flash.h |  1 +
>  2 files changed, 59 insertions(+), 13 deletions(-)

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [STATUS] v2013.01-rc3 out

2013-01-10 Thread Tom Rini
Hey all,

As a reminder, we're scheduled for v2013.01 on the 15th.  I've pushed
out v2013.01-rc3 now.  I still expect:
- At least one more u-boot-arm PR
- Any other outstand bug fixes

I saw there was a request for an m68k change to come in from a
developer, Jason can you review and pass along please?  It is assigned
to you in patchwork.  And I suspect there's a few more bugfixes out
there we need to handle (I know of 2 different one for IGEP boards).

Please remind me here if there's something else that needs reviewing and
going in, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 01/10] arm: move flush_dcache_all() to just before disable cache

2013-01-10 Thread Albert ARIBAUD
Hi Simon,

On Fri, 30 Nov 2012 15:01:14 -0800, Simon Glass 
wrote:

> From: Arun Mankuzhi 
> 
> In Cortex-A15 architecture, when we run cache invalidate
> the cache clean operation executes automatically.
> So if there are any dirty cache lines before disabling the L2 cache
> these will be synchronized with the main memory when
> invalidate_dcache_all() runs in the last part of U-boot
> 
> The two functions after flush_dcache_all is using the stack. So this
> data will be on the cache. After disable when invalidate is called the
> data will be flushed from cache to memory. This corrupts the stack in
> invalida_dcache_all. So this change is required to avoid the u-boot
> hang.
> 
> So flush has to be done just before clearing CR_C bit
> 
> Signed-off-by: Arun Mankuzhi 
> Signed-off-by: Simon Glass 
> ---
> Changes in v2: None
> 
>  arch/arm/lib/cache-cp15.c |5 -
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
> index 939de10..06119c8 100644
> --- a/arch/arm/lib/cache-cp15.c
> +++ b/arch/arm/lib/cache-cp15.c
> @@ -124,8 +124,11 @@ static void cache_disable(uint32_t cache_bit)
>   return;
>   /* if disabling data cache, disable mmu too */
>   cache_bit |= CR_M;
> - flush_dcache_all();
>   }
> + reg = get_cr();
> + cp_delay();
> + if (cache_bit == (CR_C | CR_M))
> + flush_dcache_all();
>   set_cr(reg & ~cache_bit);
>  }
>  #endif

Applied the whole series to u-boot-arm/master, thanks!

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


Re: [U-Boot] [PATCH] Makefile: remove MLO.byteswap on clobber

2013-01-10 Thread Nishanth Menon
Gentle reminder on this - if this is interesting..

On Wed, Jan 2, 2013 at 11:59 AM, Nishanth Menon  wrote:
> On clobber, do a cleanup even for SPL build else, we'd have
> MLO.byteswap remaining for certain platforms like am33xx SPL builds
>
> Signed-off-by: Nishanth Menon 
> ---
> To notice the missing cleanup:
>
> With the cross compile flags set, do:
> make am335x_evm_config; make; make clobber; git status
>  On branch master
>  Untracked files:
>(use "git add ..." to include in what will be committed)
>
> MLO.byteswap
>
> Patch based on:v2013.01-rc2-172-gf8cfcf1 (master)
> git://git.denx.de/u-boot.git
>
>  Makefile |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index a7b6cd1..4e64622 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -869,7 +869,7 @@ clobber:tidy
> @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
> @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
> @rm -f $(obj)spl/{u-boot-spl.lds,u-boot.lst}
> -   @rm -f $(obj)MLO
> +   @rm -f $(obj)MLO MLO.byteswap
> @rm -f $(obj)SPL
> @rm -f $(obj)tools/xway-swap-bytes
> @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
> --
> 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] [RFC] Is anyone interested IPv6 support for u-boot

2013-01-10 Thread Joe Hershberger
Hi Chris,

On Thu, Jan 10, 2013 at 3:34 PM, Chris Packham  wrote:
>
> On Fri, Jan 11, 2013 at 8:16 AM, Joe Hershberger 
> wrote:
>>
>> Hi Chris,
>>
>> On Wed, Jan 9, 2013 at 9:25 PM, Chris Packham 
>> wrote:
>> > Hi,
>> >
>> > Here at $dayjob we make embedded network devices (routers & switches).
>> > Because we have an interest in getting people to adopt IPv6 we've added
>> > code
>> > to our local u-boot repository to add basic IPv6 support on our boards.
>> > It's
>> > not a fully conformant IPv6 host implementation but it is enough to be
>> > able
>> > to statically configure an IPv6 address and download images from a v6
>> > capable TFTP server.
>> >
>> > We're trying to be better FLOSS citizens so I'm proposing to my
>> > colleagues
>> > that we put some effort in getting this pushed upstream. The first step
>> > of
>> > which would be to see if anyone wants the feature and is the /net
>> > maintainer
>> > willing to take on this code (not that we intend to dump and run).
>>
>> I'm certainly interested in entertaining any network stack patches,
>> and IPv6 support is certainly useful.
>
>
> OK. I'll try and get started as soon as I get a chance. Might need to get
> some clearance from $overlords to spend work time on it (or $wife to spend
> spare time on it). Should I base the patches on
> git://git.denx.de/u-boot-net.git or the main u-boot.git or something else?

Please base it on the main u-boot.git.

>>
>> > Our existing code is a little too tightly coupled to our out of tree
>> > board
>> > support so I don't have a preliminary patchset to provide. If there is
>> > interest I'll work on porting it from our tree to a vanilla u-boot tree
>> > (we
>> > have a couple of supported eval boards around).
>>
>> Please make sure you have a look at
>> http://www.denx.de/wiki/U-Boot/Patches if you haven't already.  That
>> will make it much easier to accept your patches.  You may also want to
>> use the patman and buildman tools to help you manage your
>> patch-series.
>
>
> Yep will do. Part of the reason I haven't sent what we've got currently is
> that it would be a big amorphous dump of code and I don't want to waste
> peoples time when I should be able to break it up into a series of logical
> commits.


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


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

2013-01-10 Thread Tom Rini
Hello,

The following changes since commit 612404c28a64a6df300642a1550a65dcc8e01f82:

  Merge 'u-boot-atmel/master' into 'u-boot-arm/master' (2013-01-09 20:01:48 
+0100)

are available in the git repository at:


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

for you to fetch changes up to 039cbaefcf57338cc9b6a3c656db64e7907838db:

  OMAP3: igep00x0: add CONFIG_SYS_NS16550_BROKEN_TEMT (2013-01-10 15:09:24 
-0700)


Javier Martinez Canillas (3):
  OMAP3: igep00x0: add CONFIG_SPL_BOARD_INIT for CONFIG_SPL_NAND_SUPPORT
  serial/ns16550: add an option to avoid hanging on broken platforms
  OMAP3: igep00x0: add CONFIG_SYS_NS16550_BROKEN_TEMT

Nishanth Menon (1):
  Makefile: remove MLO.byteswap on clobber

 Makefile   |2 +-
 README |8 
 drivers/serial/ns16550.c   |2 ++
 include/configs/igep00x0.h |4 
 4 files changed, 15 insertions(+), 1 deletion(-)

These are all small but important fixes that either localized to a set
of machines (IGEP devices) or fixing the 'clean' rules.  I've put this
through the build cycle I normally do on master and nothing unexpected
shows up (but not everything builds as u-boot-arm is behind master).

-- 
Tom


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


Re: [U-Boot] [PATCH 01/12] cmd_sf: Add wr_inst argument to 'sf write' command

2013-01-10 Thread Simon Glass
Hi Jagannadha,

On Mon, Dec 31, 2012 at 3:13 AM, Jagannadha Sutradharudu Teki
 wrote:
> This patch provides a support to add a write instruction(wr_inst)
> argument to 'sf write' command.
>
> User will dynamically use the specific write instruction while
> programming the flash using 'sf write' command.
> Currently added an existing write instruction called pp(Page Program).

I wonder if you might look at using an hyphen option system like:

-p for page program
-x for something else

>
> Example:
> write 0x2000 length bytes from memory at 0x1 address to
> flash offset at 0x0 using pp write instruction.
> u-boot> sf write pp 0x1 0x0 0x2000
>
> Signed-off-by: Jagannadha Sutradharudu Teki 
> ---
>  common/cmd_sf.c  |   36 +++--
>  drivers/mtd/spi/spi_flash.c  |4 +-
>  drivers/mtd/spi/spi_flash_internal.h |2 +-
>  include/spi_flash.h  |   10 
>  include/spi_flash_inst.h |   30 
>  5 files changed, 63 insertions(+), 19 deletions(-)
>  create mode 100644 include/spi_flash_inst.h
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index b175358..e7843f3 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -9,6 +9,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -234,20 +235,21 @@ static int do_spi_flash_read_write(int argc, char * 
> const argv[])
> unsigned long len;
> void *buf;
> char *endp;
> +   u8 wr_inst;
> int ret;
>
> -   if (argc < 4)
> +   if (argc < 5)
> return -1;
>
> -   addr = simple_strtoul(argv[1], &endp, 16);
> -   if (*argv[1] == 0 || *endp != 0)
> -   return -1;
> -   offset = simple_strtoul(argv[2], &endp, 16);
> +   addr = simple_strtoul(argv[2], &endp, 16);
> if (*argv[2] == 0 || *endp != 0)
> return -1;
> -   len = simple_strtoul(argv[3], &endp, 16);
> +   offset = simple_strtoul(argv[3], &endp, 16);
> if (*argv[3] == 0 || *endp != 0)
> return -1;
> +   len = simple_strtoul(argv[4], &endp, 16);
> +   if (*argv[4] == 0 || *endp != 0)
> +   return -1;
>
> /* Consistency checking */
> if (offset + len > flash->size) {
> @@ -266,8 +268,17 @@ static int do_spi_flash_read_write(int argc, char * 
> const argv[])
> ret = spi_flash_update(flash, offset, len, buf);
> else if (strcmp(argv[0], "read") == 0)
> ret = spi_flash_read(flash, offset, len, buf);
> -   else
> -   ret = spi_flash_write(flash, offset, len, buf);
> +   else {
> +   if (strcmp(argv[1], "pp") == 0)
> +   wr_inst = CMD_PAGE_PROGRAM;
> +   else {
> +   printf("SF: Unknown %s wr_inst on 'sf write'\n",

Single quotes around %s I think

> +   argv[1]);
> +   return 1;
> +   }
> +
> +   ret = spi_flash_write(flash, wr_inst, offset, len, buf);
> +   }
>
> unmap_physmem(buf, len);
>
> @@ -520,14 +531,17 @@ usage:
>  #endif
>
>  U_BOOT_CMD(
> -   sf, 5,  1,  do_spi_flash,
> +   sf, 6,  1,  do_spi_flash,
> "SPI flash sub-system",
> "probe [[bus:]cs] [hz] [mode]   - init flash device on given SPI 
> bus\n"
> " and chip select\n"
> "sf read addr offset len- read `len' bytes starting at\n"
> " `offset' to memory at `addr'\n"
> -   "sf write addr offset len   - write `len' bytes from memory\n"
> -   " at `addr' to flash at `offset'\n"
> +   "sf write wr_inst addr offset len\n"

I think wr_inst is optional, so should have [] around it

> +   "   - write `len' bytes from memory\n"
> +   " at `addr' to flash at `offset' 
> using\n"
> +   " pp `wr_inst' write instruction\n"

options are: pp (only)

W

> +   " pp (Page Program, 02h)\n"
> "sf erase offset [+]len - erase `len' bytes from `offset'\n"
> " `+len' round up `len' to block 
> size\n"
> "sf update addr offset len  - erase and write `len' bytes from 
> memory\n"
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 4dacdc7..8ba2c65 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -65,7 +65,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 
> *cmd, size_t cmd_len,
> return spi_flash_read_write(spi, cmd, cmd_len, data, NULL, data_len);
>  }
>
> -int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,
> +int spi_flash_cmd_write_multi(struct spi_flash *fl

Re: [U-Boot] [PATCH 00/12] cmd_sf: Add support for read and write instructions

2013-01-10 Thread Simon Glass
Hi Jagannadha,

On Mon, Dec 31, 2012 at 3:13 AM, Jagannadha Sutradharudu Teki
 wrote:
> All these patches are added a support for read and write instruction
> for programming/reading SPI flash.
>

I think this is all great and very useful - since no one else has
commented I will have a try.

> Read and Write instruction are implemented as a command line
> arguments for 'sf write' , 'sf read' and 'sf update' commands.
>
> Currently I have added below instructions those are commonly available
> on all flash types.

Maybe you could use flags like -d for dual, -q for quad, -p for page,
-s for slow, -o for output only. So maybe:

-p > pp - Page Program (existing one)
-qp > qpp - Quad-input Page Program
 > afr - Array Fast Read (existing one)
-s > asr - Array Slow Read
-do > dofr - Dual Output Fast Read
-qo > qofr - Quad Output Fast Read
-d > diofr - Dual IO Fast Read
-q > qiofr - Quad IO Fast Read

I worry that your scheme would be hard to remember.


>
> I have tested mostly of the instruction on real h/w.
>
> This entire implementation will change the current sf framework little bit but
> I thought these changes are worth to add.

Yes very much so.

>
> Request for all your comment, so-that I can move forward.
> Please let me know for any issue regarding this new implementation.

Regards,
Simon

>
> Thanks,
> Jagan.
>
> Jagannadha Sutradharudu Teki (12):
>   cmd_sf: Add wr_inst argument to 'sf write' command
>   cmd_sf: Add rd_inst argument to 'sf read' command
>   cmd_sf: Add wr_inst argument to 'sf update' command
>   cmd_sf: Add rd_inst argument to 'sf update' command
>   cmd_sf: Define a functions for parsing read and write instructions
>   cmd_sf: Add QPP(Quad-input Page Program) write instruction support
>   cmd_sf: Add ASR(Array Slow Read) read instruction support
>   cmd_sf: Add DOFR(Dual Output Fast Read) read instruction support
>   cmd_sf: Add QOFR(Quad Output Fast Read) read instruction support
>   cmd_sf: Add DIOFR(Dual IO Fast Read) read instruction support
>   cmd_sf: Add QIOFR(Quad IO Fast Read) read instruction support
>   sf: Pass rd_qeb_req variable as 0 for status and config reg reads
>
>  common/cmd_sf.c  |  198 
> +-
>  drivers/mtd/spi/spi_flash.c  |   40 +--
>  drivers/mtd/spi/spi_flash_internal.h |   10 +-
>  include/spi_flash.h  |   22 ++--
>  include/spi_flash_inst.h |   39 +++
>  5 files changed, 257 insertions(+), 52 deletions(-)
>  create mode 100644 include/spi_flash_inst.h
>
> ___
> 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 00/12] cmd_sf: Add support for read and write instructions

2013-01-10 Thread Simon Glass
Hi Jagannadha,

On Mon, Dec 31, 2012 at 3:13 AM, Jagannadha Sutradharudu Teki
 wrote:
> All these patches are added a support for read and write instruction
> for programming/reading SPI flash.
>

I think this is all great and very useful - since no one else has
commented I will have a try.

> Read and Write instruction are implemented as a command line
> arguments for 'sf write' , 'sf read' and 'sf update' commands.
>
> Currently I have added below instructions those are commonly available
> on all flash types.

Maybe you could use flags like -d for dual, -q for quad, -p for page,
-s for slow, -o for output only. So maybe:

-p > pp - Page Program (existing one)
-qp > qpp - Quad-input Page Program
 > afr - Array Fast Read (existing one)
-s > asr - Array Slow Read
-do > dofr - Dual Output Fast Read
-qo > qofr - Quad Output Fast Read
-d > diofr - Dual IO Fast Read
-q > qiofr - Quad IO Fast Read

I worry that your scheme would be hard to remember.


>
> I have tested mostly of the instruction on real h/w.
>
> This entire implementation will change the current sf framework little bit but
> I thought these changes are worth to add.

Yes very much so.

>
> Request for all your comment, so-that I can move forward.
> Please let me know for any issue regarding this new implementation.

Regards,
Simon

>
> Thanks,
> Jagan.
>
> Jagannadha Sutradharudu Teki (12):
>   cmd_sf: Add wr_inst argument to 'sf write' command
>   cmd_sf: Add rd_inst argument to 'sf read' command
>   cmd_sf: Add wr_inst argument to 'sf update' command
>   cmd_sf: Add rd_inst argument to 'sf update' command
>   cmd_sf: Define a functions for parsing read and write instructions
>   cmd_sf: Add QPP(Quad-input Page Program) write instruction support
>   cmd_sf: Add ASR(Array Slow Read) read instruction support
>   cmd_sf: Add DOFR(Dual Output Fast Read) read instruction support
>   cmd_sf: Add QOFR(Quad Output Fast Read) read instruction support
>   cmd_sf: Add DIOFR(Dual IO Fast Read) read instruction support
>   cmd_sf: Add QIOFR(Quad IO Fast Read) read instruction support
>   sf: Pass rd_qeb_req variable as 0 for status and config reg reads
>
>  common/cmd_sf.c  |  198 
> +-
>  drivers/mtd/spi/spi_flash.c  |   40 +--
>  drivers/mtd/spi/spi_flash_internal.h |   10 +-
>  include/spi_flash.h  |   22 ++--
>  include/spi_flash_inst.h |   39 +++
>  5 files changed, 257 insertions(+), 52 deletions(-)
>  create mode 100644 include/spi_flash_inst.h
>
> ___
> 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 05/12] cmd_sf: Define a functions for parsing read and write instructions

2013-01-10 Thread Simon Glass
Hi Jagannadha,

On Mon, Dec 31, 2012 at 3:13 AM, Jagannadha Sutradharudu Teki
 wrote:
> This patch provides to define a separate functions for parsing read
> and write instructions by taking instruction argument from user.
>
> So-that the common functions can used in a different levels for
> parsing read and write instructions.
>
> Signed-off-by: Jagannadha Sutradharudu Teki 
> ---
>  common/cmd_sf.c |   70 ++
>  1 files changed, 54 insertions(+), 16 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index 4cfd48a..d59ecce 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -234,6 +234,48 @@ static int spi_flash_update(struct spi_flash *flash, u8 
> wr_inst, u8 rd_inst,
> return 0;
>  }
>
> +/*
> + * This function parsed the write instruction for write operation
> + *
> + * Input:
> + *arg: specified write instruction from user
> + * Output:
> + *wr_inst: parsed write instruction for write operation
> + * Return:
> + *1: for Unknown wr_inst from user
> + *0: Success
> + */
> +static int sf_parse_wr_inst_arg(char *arg, u8 *wr_inst)
> +{
> +   if (strcmp(arg, "pp") == 0)
> +   *wr_inst = CMD_PAGE_PROGRAM;
> +   else
> +   return 1;
> +
> +   return 0;
> +}
> +
> +/*
> + * This function parsed the read instruction for read operation
> + *
> + * Input:
> + *arg: specified read instruction from user
> + * Output:
> + *rd_inst: parsed read instruction for write operation
> + * Return:
> + *1: for Unknown rd_inst from user
> + *0: Success
> + */
> +static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst)
> +{
> +   if (strcmp(arg, "afr") == 0)
> +   *rd_inst = CMD_READ_ARRAY_FAST;
> +   else
> +   return 1;
> +
> +   return 0;
> +}
> +
>  static int do_spi_flash_read_write(int argc, char * const argv[])
>  {
> unsigned long addr;
> @@ -281,41 +323,37 @@ static int do_spi_flash_read_write(int argc, char * 
> const argv[])
> }
>
> if (strcmp(argv[0], "update") == 0) {
> -   if (strcmp(argv[1], "pp") == 0)
> -   wr_inst = CMD_PAGE_PROGRAM;
> -   else {
> +   ret = sf_parse_wr_inst_arg(argv[1], &wr_inst);
> +   if (ret) {
> printf("SF: Unknown %s wr_inst on 'sf update'\n",
> argv[1]);
> -   return 1;
> +   return ret;
> }
>
> -   if (strcmp(argv[2], "afr") == 0)
> -   rd_inst = CMD_READ_ARRAY_FAST;
> -   else {

Are you removing code you added in a previous patch? Why not just
define sf_parse_rd_inst_arg() in the first patch and use it
everywhere?

Also do you need to parse differently for read and write? Would be
nice to avoid that.

> +   ret = sf_parse_rd_inst_arg(argv[2], &rd_inst);
> +   if (ret) {
> printf("SF: Unknown %s rd_inst on 'sf update'\n",
> argv[2]);
> -   return 1;
> +   return ret;
> }
>
> ret = spi_flash_update(flash, wr_inst, rd_inst,
> offset, len, buf);
> } else if (strcmp(argv[0], "read") == 0) {
> -   if (strcmp(argv[1], "afr") == 0)
> -   rd_inst = CMD_READ_ARRAY_FAST;
> -   else {
> +   ret = sf_parse_rd_inst_arg(argv[1], &rd_inst);
> +   if (ret) {
> printf("SF: Unknown %s rd_inst on 'sf read'\n",
> argv[1]);
> -   return 1;
> +   return ret;
> }
>
> ret = spi_flash_read(flash, rd_inst, offset, len, buf);
> } else {
> -   if (strcmp(argv[1], "pp") == 0)
> -   wr_inst = CMD_PAGE_PROGRAM;
> -   else {
> +   ret = sf_parse_wr_inst_arg(argv[1], &wr_inst);
> +   if (ret) {
> printf("SF: Unknown %s wr_inst on 'sf write'\n",
> argv[1]);
> -   return 1;
> +   return ret;
> }
>
> ret = spi_flash_write(flash, wr_inst, offset, len, buf);
> --
> 1.7.0.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

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


Re: [U-Boot] [PATCH 12/12] sf: Pass rd_qeb_req variable as 0 for status and config reg reads

2013-01-10 Thread Simon Glass
Hi Jagannadha,

On Mon, Dec 31, 2012 at 4:14 AM, Jagannadha Sutradharudu Teki
 wrote:
> Config and Status register reads doesn't require to set
> the quad enable bit, hence rd_qeb_req variable passed as 0.
>
> Signed-off-by: Jagannadha Sutradharudu Teki 

A few more general comments:

Please can you look at enhancing 'sf test' to support your modes. Then
we can run 'sf test' and test which ones work.

I wonder if we should something to help with things like
spi_flash_read_common(flash, &cmd, sizeof(cmd), (void *)data, 1);

Perhaps you should define spi_flash_xfer_byte(flash, int cmd, int *resp)

which writes a single byte command and reads a single byte response?

Regards,
Simon

> ---
>  drivers/mtd/spi/spi_flash.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 15ad05c..7a15a69 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -293,7 +293,8 @@ int spi_flash_cmd_read_status(struct spi_flash *flash, 
> void *data)
> int ret;
>
> cmd = CMD_READ_STATUS;
> -   ret = spi_flash_read_common(flash, &cmd, sizeof(cmd), (void *)data, 
> 1);
> +   ret = spi_flash_read_common(flash, &cmd, 0,
> +   sizeof(cmd), (void *)data, 1);
> if (ret < 0) {
> debug("SF: fail to read status register\n");
> return ret;
> @@ -343,7 +344,8 @@ int spi_flash_cmd_read_config(struct spi_flash *flash, 
> void *data)
> int ret;
>
> cmd = CMD_READ_CONFIG;
> -   ret = spi_flash_read_common(flash, &cmd, sizeof(cmd), (void *)data, 
> 1);
> +   ret = spi_flash_read_common(flash, &cmd, 0,
> +   sizeof(cmd), (void *)data, 1);
> if (ret < 0) {
> debug("SF: fail to read config register\n");
> return ret;
> --
> 1.7.0.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATH v3 1/2] sf: Add status register reading support

2013-01-10 Thread Simon Glass
Hi Jagannadha

On Thu, Jan 3, 2013 at 6:51 AM, Jagannadha Sutradharudu Teki
 wrote:
> This patch provides support to read a flash status register.
>
> Status register contains a control bits used to verify
> the progress of flash program and erase operations.
>
> User need to get the data through spi_flash_cmd_read_status()
> based on their usage.

Do you have a console command for this, and the control register also?

Regards,
Simon

>
> Signed-off-by: Jagannadha Sutradharudu Teki 
> ---
> Changes in v3:
> improved coding style
>
>  drivers/mtd/spi/spi_flash.c  |8 
>  drivers/mtd/spi/spi_flash_internal.h |3 +++
>  2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 9e8939c..0f05b91 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -264,6 +264,14 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, 
> u8 sr)
> return 0;
>  }
>
> +int spi_flash_cmd_read_status(struct spi_flash *flash, void *data)
> +{
> +   u8 cmd;
> +
> +   cmd = CMD_READ_STATUS;
> +   return spi_flash_read_common(flash, &cmd, sizeof(cmd), (void *)data, 
> 1);
> +}
> +
>  /*
>   * The following table holds all device probe functions
>   *
> diff --git a/drivers/mtd/spi/spi_flash_internal.h 
> b/drivers/mtd/spi/spi_flash_internal.h
> index 141cfa8..8232595 100644
> --- a/drivers/mtd/spi/spi_flash_internal.h
> +++ b/drivers/mtd/spi/spi_flash_internal.h
> @@ -77,6 +77,9 @@ static inline int spi_flash_cmd_write_disable(struct 
> spi_flash *flash)
>  /* Program the status register. */
>  int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr);
>
> +/* Read the status register */
> +int spi_flash_cmd_read_status(struct spi_flash *flash, void *data);
> +
>  /*
>   * Same as spi_flash_cmd_read() except it also claims/releases the SPI
>   * bus. Used as common part of the ->read() operation.
> --
> 1.7.0.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 00/12] cmd_sf: Add support for read and write instructions

2013-01-10 Thread Simon Glass
Hi,

On Thu, Jan 10, 2013 at 6:33 AM, Langer Thomas (LQDE RD ST PON SW)
 wrote:
> Hello Jagan,
>
>> All these patches are added a support for read and write instruction
>> for programming/reading SPI flash.

Hmmm just saw this comment.

>
> I have written some weeks ago that I would really appreciate the support of
> dual and quad IO accesses for serial flashes. I just  think, this is not an 
> acceptable
> way to do this.
>
> It is important to know for all, who do not know the details on the hardware
> requirements of this feature, that these new transfers require a special SPI
> controller! A standard SPI hardware, which is being used on most (maybe all)
> existing boards, cannot use the dual or quad IO features at all!
>
> And in addition, I still haven't seen any change, which indicates the required
> transfer mode to the SPI layer! How do you tell your SPI driver, which part
> of the transfer should be done in dual or quad mode?
>
>>
>> Read and Write instruction are implemented as a command line
>> arguments for 'sf write' , 'sf read' and 'sf update' commands.
>>
>> Currently I have added below instructions those are commonly available
>> on all flash types.
>> pp - Page Program (existing one)
>> qpp - Quad-input Page Program
>> afr - Array Fast Read (existing one)
>> asr - Array Slow Read
>> dofr - Dual Output Fast Read
>> qofr - Quad Output Fast Read
>> diofr - Dual IO Fast Read
>> qiofr - Quad IO Fast Read
>>
>> I have tested mostly of the instruction on real h/w.
>>
>> This entire implementation will change the current sf framework little bit 
>> but
>> I thought these changes are worth to add.
>
> This means, all your patches adding new code, which has no benefit for 
> existing
> boards, but changing the commands in an incompatible way, which forces all 
> users
> to adapt their definitions!
> I don't think this will be accepted, as I would not.
>
> The biggest question is: Do somebody really need the flexibility to select the
> used instruction at this level?
> If you have a platform, which contains an extended SPI controller and has 
> also a
> supported flash, I expect it would be okay to always use the dual or quad 
> instructions!
> And this can be completely handled by the lower level functions, no need to 
> expose
> this to the command line!
>
> I think, first of all, you should add some config options (e.g. 
> CONFIG_SYS_SF_DUAL /
> CONFIG_SYS_SF_QUAD) to indicate, that the platform / board will support these.
> Then, during "sf probe", there should be a detection, if the flash will 
> support this
> (depending on the type) and is enabled (checking the config bit for quad IO).
> Depending on this, either specific functions for read/write could be assigned 
> or
> some other data, which indicate the usable instructions, can be set.

I suspect the SPI device will need to provide some flags to indicate
that it supports it, and then we will probably need some new SPI_...
flags in spi.h to select the required behaviour?

>
> As it depends on the flash type and manufacturer, how the lower sequence must
> look like (for the command/address/data phases, it might be 1-1-4, 1-4-4 or 
> even 4-4-4),
> this should be flexible to be assigned from the detection code.
> For example, please check the differences between Spansion and Macronix!

Well maybe we could deal with that later? I think it would be good to
get some basic framework in there, and people can then adapt for their
chips, etc.

>
>>
>> Request for all your comment, so-that I can move forward.
>> Please let me know for any issue regarding this new implementation.
>>
>> Thanks,
>> Jagan.
>>
>
> Please think about my comments. I just want to avoid to bloat the code with 
> something,
> which is currently not usable for existing boards (as far as I know) and not 
> flexible enough
> to support different, manufacturer specific command sets.

I'm sure some boards can use it. I'm interested in knowing which board
this was tested on.

I sent a few patches to make it easier to extend SPI and SPI flash
interfaces without breaking old drivers.

http://patchwork.ozlabs.org/patch/208226/
http://patchwork.ozlabs.org/patch/208228/

Regards,
Simon

>
> Best Regards,
> Thomas
>
> ___
> 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 V4 5/9] EXYNOS5: DWMMC: API to set mmc clock divisor

2013-01-10 Thread Jaehoon Chung
On 01/11/2013 12:35 AM, Simon Glass wrote:
> Hi Amar,
> 
> On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
>> This API computes the divisor value based on MPLL clock and
>> writes it into the FSYS1 register.
>>
>> Changes from V1:
>> 1)Updated the function exynos5_mmc_set_clk_div() to receive
>> 'device_i'd as input parameter instead of 'index'.
>>
>> Changes from V2:
>> 1)Updation of commit message and resubmition of proper patch set.
>>
>> Changes from V3:
>> 1)Removed the new API exynos5_mmc_set_clk_div() from clock.c,
>> because existing API set_mmc_clk() can be used to set mmc clock.
>>
>> Signed-off-by: Amar 
>> ---
>>  arch/arm/cpu/armv7/exynos/clock.c  | 4 ++--
>>  arch/arm/include/asm/arch-exynos/clk.h | 3 +++
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
>> b/arch/arm/cpu/armv7/exynos/clock.c
>> index 973b84e..89574ba 100644
>> --- a/arch/arm/cpu/armv7/exynos/clock.c
>> +++ b/arch/arm/cpu/armv7/exynos/clock.c
>> @@ -490,7 +490,7 @@ static unsigned long exynos4_get_mmc_clk(int dev_index)
>> (struct exynos4_clock *)samsung_get_base_clock();
>> unsigned long uclk, sclk;
>> unsigned int sel, ratio, pre_ratio;
>> -   int shift;
>> +   int shift = 0;
> 
> Is this fixing a warning?
Maybe..fix the compiler warning..
> 
>>
>> sel = readl(&clk->src_fsys);
>> sel = (sel >> (dev_index << 2)) & 0xf;
>> @@ -539,7 +539,7 @@ static unsigned long exynos5_get_mmc_clk(int dev_index)
>> (struct exynos5_clock *)samsung_get_base_clock();
>> unsigned long uclk, sclk;
>> unsigned int sel, ratio, pre_ratio;
>> -   int shift;
>> +   int shift = 0;
>>
>> sel = readl(&clk->src_fsys);
>> sel = (sel >> (dev_index << 2)) & 0xf;
>> diff --git a/arch/arm/include/asm/arch-exynos/clk.h 
>> b/arch/arm/include/asm/arch-exynos/clk.h
>> index 1935b0b..a4d5b4e 100644
>> --- a/arch/arm/include/asm/arch-exynos/clk.h
>> +++ b/arch/arm/include/asm/arch-exynos/clk.h
>> @@ -29,6 +29,9 @@
>>  #define VPLL   4
>>  #define BPLL   5
>>
>> +#define FSYS1_MMC0_DIV_MASK0xff0f
>> +#define FSYS1_MMC0_DIV_VAL 0x0701
> 
> What is this used for? I don't see it in this patch.
> 
> Overall it is not clear what this patch is for.
This define didn't need. That value is not static value, isn't?

Best Regards,
Jaehoon Chung
> 
>> +
>>  unsigned long get_pll_clk(int pllreg);
>>  unsigned long get_arm_clk(void);
>>  unsigned long get_i2c_clk(void);
>> --
>> 1.8.0
>>
> 
> Regards,
> Simon
> 

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


Re: [U-Boot] [PATCH V4 9/9] COMMON: MMC: Command to support EMMC booting and to

2013-01-10 Thread Jaehoon Chung
On 01/11/2013 01:46 AM, Simon Glass wrote:
> Hi Amar,
> 
> On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
>> This patch adds commands to open, close and resize boot partitions on EMMC.
>>
>> Changes from V1:
>> 1)Combined the common piece of code between 'open' and 'close'
>> operations.
>>
>> Changes from V2:
>> 1)Updation of commit message and resubmition of proper patch set.
>>
>> Changes from V3:
>> No change.
>>
>> Signed-off-by: Amar 
>> ---
>>  common/cmd_mmc.c | 84 
>> +++-
>>  1 file changed, 83 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
>> index 7dacd51..1dabb5b 100644
>> --- a/common/cmd_mmc.c
>> +++ b/common/cmd_mmc.c
>> @@ -248,6 +248,84 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int 
>> argc, char * const argv[])
>> curr_device, mmc->part_num);
>>
>> return 0;
>> +   } else if ((strcmp(argv[1], "open") == 0) ||
>> +   (strcmp(argv[1], "close") == 0)) {
> 
> How about putting this block in its own function?
> 
>> +   int dev;
>> +   struct mmc *mmc;
>> +
>> +   if (argc == 2)
>> +   dev = curr_device;
>> +   else if (argc == 3)
>> +   dev = simple_strtoul(argv[2], NULL, 10);
>> +   else
>> +   return CMD_RET_USAGE;
>> +
>> +   mmc = find_mmc_device(dev);
>> +   if (!mmc) {
>> +   printf("no mmc device at slot %x\n", dev);
>> +   return 1;
>> +   }
>> +
>> +   if (IS_SD(mmc)) {
>> +   printf("SD device cannot be opened/closed\n");
>> +   return 1;
>> +   }
>> +
>> +   if (strcmp(argv[1], "open") == 0) {
>> +   if (!(mmc_boot_open(mmc))) {
>> +   printf("EMMC OPEN Success.\n");
>> +   printf("\t\t\t!!!Notice!!!\n");
>> +   printf("!You must close EMMC"
>> +   " boot Partition after all"
>> +   " images are written\n");
> 
> Do you need to split these strings so much? Perhaps when it is in a
> function the indenting will be less?
> 
>> +   printf("!EMMC boot partition"
>> +   " has continuity at"
>> +   " image writing time.\n");
>> +   printf("!So, Do not close boot"
>> +   " partition, Before, all"
>> +   " images are written.\n");
>> +   return 0;
>> +   } else {
>> +   printf("EMMC OPEN Failed.\n");
>> +   return 1;
> 
> You could put this above the other block and reduce indenting:
> 
> if (mmc_boot_open(mmc)) {
>printf("EMMC OPEN Failed.\n");
>return 1;
> }
> ...code continues
> 
>> +   }
>> +   }
>> +
>> +   if (strcmp(argv[1], "close") == 0) {
>> +   if (!(mmc_boot_close(mmc))) {
>> +   printf("EMMC CLOSE Success.\n");
> 
> Shouldn't print a message on success
> 
>> +   return 0;
>> +   } else {
>> +   printf("EMMC CLOSE Failed.\n");
>> +   return 1;
>> +   }
>> +   }
>> +   } else if (strcmp(argv[1], "bootpart") == 0) {
>> +   int dev;
>> +   dev = simple_strtoul(argv[2], NULL, 10);
>> +
>> +   u32 bootsize = simple_strtoul(argv[3], NULL, 10);
>> +   u32 rpmbsize = simple_strtoul(argv[4], NULL, 10);
>> +   struct mmc *mmc = find_mmc_device(dev);
>> +   if (!mmc) {
>> +   printf("no mmc device at slot %x\n", dev);
>> +   return 1;
>> +   }
>> +
>> +   if (IS_SD(mmc)) {
>> +   printf("It is not a EMMC device\n");
>> +   return 1;
>> +   }
>> +
>> +   if (0 == mmc_boot_partition_size_change(mmc,
>> +   bootsize, rpmbsize)) {
>> +   printf("EMMC boot partition Size %d MB\n", bootsize);
>> +   printf("EMMC RPMB partition Size %d MB\n", rpmbsize);
>> +   return 0;
>> +   } else {
>> +   printf("EMMC boot partition Size change Failed.\n");
>> +   return 1;
>> +   }
>> }
>>
>> state = MMC_IN

Re: [U-Boot] [PATCH V4 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues

2013-01-10 Thread Jaehoon Chung
On 01/11/2013 12:26 AM, Simon Glass wrote:
> Hi Amar,
> 
> On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
>> This patch enumerates dwmci and set auto stop command during
>> dwmci initialisation.
>> EMMC read/write is not happening in current implementation
>> due to improper fifo size computation. Hence Modified the fifo size
>> computation to resolve EMMC read write issues.
>>
>> Changes from V1:
>> 1)Created the macros RX_WMARK_SHIFT and RX_WMARK_MASK in header file.
>>
>> Changes from V2:
>> 1)Updation of commit message and resubmition of proper patch set.
>>
>> Changes from V3:
>> 1)Updated to use the macro DWMCI_CTRL_SEND_AS_CCSD instead of
>> the hard coded value (1 << 10).
> 
> I suggest you take a look at patman which might simplify your patch
> sending and change logs - see tools/patman/README for details.
> 
>>
>> Signed-off-by: Amar 
>> ---
>>  drivers/mmc/dw_mmc.c | 14 --
>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
>> index 4070d4e..776fdb6 100644
>> --- a/drivers/mmc/dw_mmc.c
>> +++ b/drivers/mmc/dw_mmc.c
>> @@ -136,6 +136,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct 
>> mmc_cmd *cmd,
>> return TIMEOUT;
>> }
>> timeout--;
>> +   mdelay(1);
> 
> How long will this delay in total?
i didn't sure why add the mdelay(1)..i think mdelay(1) is too long.
Isn't there other approach to resolve read/write issue?

Best Regards,
Jaehoon Chung
> 
>> }
>>
>> dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL);
>> @@ -314,7 +315,7 @@ static void dwmci_set_ios(struct mmc *mmc)
>>  static int dwmci_init(struct mmc *mmc)
>>  {
>> struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
>> -   u32 fifo_size, fifoth_val;
>> +   u32 fifo_size, fifoth_val, ier;
>>
>> dwmci_writel(host, DWMCI_PWREN, 1);
>>
>> @@ -323,6 +324,14 @@ static int dwmci_init(struct mmc *mmc)
>> return -1;
>> }
>>
>> +   /* Enumerate at 400KHz */
>> +   dwmci_setup_bus(host, mmc->f_min);
>> +
>> +   /* Set auto stop command */
>> +   ier = dwmci_readl(host, DWMCI_CTRL);
>> +   ier |= DWMCI_CTRL_SEND_AS_CCSD;
>> +   dwmci_writel(host, DWMCI_CTRL, ier);
>> +
>> dwmci_writel(host, DWMCI_RINTSTS, 0x);
>> dwmci_writel(host, DWMCI_INTMASK, 0);
>>
>> @@ -332,10 +341,11 @@ static int dwmci_init(struct mmc *mmc)
>> dwmci_writel(host, DWMCI_BMOD, 1);
>>
>> fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
>> +   fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
>> if (host->fifoth_val)
>> fifoth_val = host->fifoth_val;
>> else
>> -   fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
>> +   fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 - 1) |
>> TX_WMARK(fifo_size/2);
> 
> {} around this else I think. Also space around /
> 
>> dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
>>
>> --
>> 1.8.0
>>
> 
> Regards,
> Simon
> 

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


Re: [U-Boot] [PATCH V4 4/9] EXYNOS5: DWMMC: Added FDT support for DWMMC

2013-01-10 Thread Jaehoon Chung
On 01/11/2013 12:33 AM, Simon Glass wrote:
> Hi Amar,
> 
> On Fri, Jan 4, 2013 at 1:34 AM, Amar  wrote:
>> This patch adds FDT support for DWMMC, by reading the DWMMC node data
>> from the device tree and initialising DWMMC channels as per data
>> obtained from the node.
>>
>> Changes from V1:
>> 1)Updated code to have same signature for the function
>> exynos_dwmci_init() for both FDT and non-FDT versions.
>> 2)Updated code to pass device_id parameter to the function
>> exynos5_mmc_set_clk_div() instead of index.
>> 3)Updated code to decode the value of "samsung,width" from FDT.
>> 4)Channel index is computed instead of getting from FDT.
>>
>> Changes from V2:
>> 1)Updation of commit message and resubmition of proper patch set.
>>
>> Changes from V3:
>> 1)Replaced the new function exynos5_mmc_set_clk_div() with the
>> existing function set_mmc_clk(). set_mmc_clk() will do the purpose.
>> 2)Computation of FSYS block clock divisor (pre-ratio) is added.
>>
>> Signed-off-by: Vivek Gautam 
>> Signed-off-by: Amar 
>> ---
>>  arch/arm/include/asm/arch-exynos/dwmmc.h |   4 +
>>  drivers/mmc/exynos_dw_mmc.c  | 129 
>> +--
>>  include/dwmmc.h  |   4 +
>>  3 files changed, 130 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-exynos/dwmmc.h 
>> b/arch/arm/include/asm/arch-exynos/dwmmc.h
>> index 8acdf9b..40dcc7b 100644
>> --- a/arch/arm/include/asm/arch-exynos/dwmmc.h
>> +++ b/arch/arm/include/asm/arch-exynos/dwmmc.h
>> @@ -29,8 +29,12 @@
>>
>>  int exynos_dwmci_init(u32 regbase, int bus_width, int index);
>>
>> +#ifdef CONFIG_OF_CONTROL
>> +unsigned int exynos_dwmmc_init(const void *blob);
>> +#else
>>  static inline unsigned int exynos_dwmmc_init(int index, int bus_width)
> 
> Why unsigned?
> 
> I'm really not that keen on functions which change their signature
> based on an #ifdef. Can we perhaps have
> 
> int exynos_dwmmc_init(const void *blob);
> 
> which will pass NULL when there is no FDT, and
> 
> int exynos_dwmmc_add_port(int index, int bus_width)
> 
> for use by non-FDT boards?
> 
>>  {
>> unsigned int base = samsung_get_base_mmc() + (0x1 * index);
>> return exynos_dwmci_init(base, bus_width, index);
>>  }
>> +#endif
>> diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
>> index 72a31b7..d7ca7d0 100644
>> --- a/drivers/mmc/exynos_dw_mmc.c
>> +++ b/drivers/mmc/exynos_dw_mmc.c
>> @@ -19,39 +19,154 @@
>>   */
>>
>>  #include 
>> -#include 
>>  #include 
>> +#include 
>> +#include 
>> +#include 
>>  #include 
>>  #include 
>> +#include 
>> +
>> +#defineDWMMC_MAX_CH_NUM4
>> +#defineDWMMC_MAX_FREQ  5200
>> +#defineDWMMC_MIN_FREQ  40
>> +#defineDWMMC_MMC0_CLKSEL_VAL   0x03030001
>> +#defineDWMMC_MMC2_CLKSEL_VAL   0x03020001
>> +#defineONE_MEGA_HZ 100
>> +#defineSCALED_VAL_FOUR_HUNDRED 400
> 
> I don't think you need these last two - you can just write the number
> in the code
Why didn't add into the dwmmc.h?
> 
>>
>>  static char *EXYNOS_NAME = "EXYNOS DWMMC";
> 
> Same with this I think
Sorry..What means? Also need not?
> 
>> +u32 timing[3];
>>
>> +/*
>> + * Function used as callback function to initialise the
>> + * CLKSEL register for every mmc channel.
>> + */
>>  static void exynos_dwmci_clksel(struct dwmci_host *host)
>>  {
>> -   u32 val;
>> -   val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
>> -   DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
>> +   dwmci_writel(host, DWMCI_CLKSEL, host->clksel_val);
>> +}
>>
>> -   dwmci_writel(host, DWMCI_CLKSEL, val);
>> +unsigned int exynos_dwmci_get_clk(int dev_index)
>> +{
>> +   return get_mmc_clk(dev_index);
>>  }
>>
>>  int exynos_dwmci_init(u32 regbase, int bus_width, int index)
>>  {
>> struct dwmci_host *host = NULL;
>> +   unsigned int clock, div;
>> host = malloc(sizeof(struct dwmci_host));
>> if (!host) {
>> printf("dwmci_host malloc fail!\n");
>> return 1;
>> }
>>
>> +   /*
>> +* The max operating freq of FSYS block is 400MHz.
>> +* Scale down the 400MHz to number 400.
>> +* Scale down the MPLL clock by dividing MPLL_CLK with ONE_MEGA_HZ.
>> +* Arrive at the divisor value taking 400 as the reference.
>> +*/
>> +
>> +   /* get mpll clock and divide it by ONE_MEGA_HZ */
>> +   clock = get_pll_clk(MPLL) / ONE_MEGA_HZ;
>> +
>> +   /* Arrive at the divisor value. */
>> +   for (div = 0; div <= 0xf; div++) {
>> +   if ((clock / (div + 1)) <= SCALED_VAL_FOUR_HUNDRED)
>> +   break;
>> +   }
> 
> What if you don't find the right divisor?
i want to use like this.

sclk = mmc_get_clk(); -> then we can g

Re: [U-Boot] [RFC PATCH 2/2] USB: xHCI: Add stack support for xHCI

2013-01-10 Thread Satendra Pratap
Vivek Gautam  gmail.com> writes:

> 
> Hi,
> 
> On Tue, Oct 23, 2012 at 6:30 PM, Wolfgang Denk  denx.de> wrote:
> > Dear Vivek Gautam,
> >
> > In message <1350989687-32102-3-git-send-email-gautam.vivek  
> > samsung.com> 
you wrote:
> >> This adds stack layer for eXtensible Host Controller Interface
> >> which facilitates use of USB 3.0 in host mode.
> >>
> >> This work is based on xHCI host controller driver in linux-kernel
> >> by Sarah Sharp.
> >
> > When copying code from Linux, then please always provide exact
> > reference.  Please see especially bullet # 4 at
> > http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
> >
> Thanks for pointing out. I shall keep this in mind, and update proper
> references here also.
> 
> > Best regards,
> >
> > Wolfgang Denk
> >
> > --
> > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd  denx.de
> >  EARTH
> >  smog  |   bricks
> >  AIR  --  mud  --  FIRE
> > soda water |   tequila
> >  WATER
> > ___
> > U-Boot mailing list
> > U-Boot  lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> 
> Thanks & Regards
> Vivek
> 
Hi Vivek,
I have been trying to port your xHCI patches from U-Boot to barebox. I took 
your 
xHCI patch from 
http://patchwork.ozlabs.org/patch/193477/

Could you please let me know whether those are the latest patches? If not, 
could 
you please send me the latest patch?

What about xHCI testing?

Thanks,
Satendra




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


  1   2   >