Re: [U-Boot] [PATCH 0/2 V2] EXYNOS5: Enable Gigabyte device GD25LQ and GD25Q64B

2013-03-26 Thread Minkyu Kang
Dear Rajeshwari and Simon,

On 12/03/13 15:13, Rajeshwari Birje wrote:
> Hi Minkyu,
> 
> Yes it is based on the following patches submitted by Simon Glass and
> link for the same.
> 
> "sf: Add spi_flash_alloc() to create a new SPI flash struct"
> http://patchwork.ozlabs.org/patch/208228/
> 
> "sf: Use spi_flash_alloc() in each SPI flash driver":
>  http://patchwork.ozlabs.org/patch/226582/
> 

Those patches are merged?

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


Re: [U-Boot] [PATCH] arm: omap: emif: Support for ddr3 after warm reset

2013-03-26 Thread Lokesh Vutla

On Wednesday 27 March 2013 10:41 AM, Sricharan R wrote:

On Wednesday 27 March 2013 09:55 AM, Lokesh Vutla wrote:

EMIF supports a global warm reset mode, during which the
EMIF keeps the SDRAM content. But if leveling is enabled
at the time of warm reset for DDR3, the following steps
needs to be done after warm reset:
1) Keep EMIF in self refresh mode.
2) Reset PHY to bring back the PHY to a known state.
3) Start Levelling procedure.
Doing the same.
And also enabling DLL lock and code output after warm reset.



  Should the $subject be something like
Fix DDR3 initialisation after warm reset ?

Ok I ll change it.



Tested on OMAP5432 ES2.0

Signed-off-by: Lokesh Vutla 
---
  arch/arm/cpu/armv7/omap-common/emif-common.c |   12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c 
b/arch/arm/cpu/armv7/omap-common/emif-common.c
index 9eb1279..8811958 100644
--- a/arch/arm/cpu/armv7/omap-common/emif-common.c
+++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
@@ -1072,6 +1072,12 @@ static void do_sdram_init(u32 base)
else
ddr3_init(base, regs);
}
+   if (!in_sdram && warm_reset() &&
+   (emif_sdram_type() == EMIF_SDRAM_TYPE_DDR3)) {
+   set_lpmode_selfrefresh(base);
+   emif_reset_phy(base);
+   ddr3_leveling(base, regs);
+   }



Why do we need !in_sdram check here ?. Otherwise, good..

DDR3 leveling cannot happen from SDRAM. So I kept a check here.

Thanks and Regards,
Lokesh


Reviewed-by: R Sricharan 


Regards,
  Sricharan



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


Re: [U-Boot] [PATCH 1/4] MMC: DWMMC: Modified fifo size computation

2013-03-26 Thread Minkyu Kang
Dear Amar,

On 27/03/13 14:18, Amarendra Reddy wrote:
> Dear Minkyu,
> 

please don't top posting.

> The definition of "RX_WMARK" is present in "[PATCH V7 04/10] EXYNOS5: DWMMC: 
> Added FDT support for DWMMC".
> 
> Here is the URL, 
> http://www.mail-archive.com/u-boot@lists.denx.de/msg107515.html

Then please move it to this patch.

> 
> Thanks & Regards
> Amarendra Reddy
> 
> On 27 March 2013 10:33, Minkyu Kang  > wrote:
> 
> Dear Amar,
> 
> On 05/12/12 22:31, Amar wrote:
> > The current implementation of fifo size computation was giving improper
> > values for eMMC channel. Modified the computation as per user manual.
> >
> > Signed-off-by: Amarendra Reddy  >
> > ---
> >  drivers/mmc/dw_mmc.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> > index 4070d4e..62dc152 100644
> > --- a/drivers/mmc/dw_mmc.c
> > +++ b/drivers/mmc/dw_mmc.c
> > @@ -332,6 +332,8 @@ 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(0xFFF)) >> 16) + 1;
> 
> The definition of RX_WMARK is missing.
> 
> > +
> >   if (host->fifoth_val)
> >   fifoth_val = host->fifoth_val;
> >   else
> >
> 
> Thanks,
> Minkyu Kang.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de 
> http://lists.denx.de/mailman/listinfo/u-boot
> 
> 

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


Re: [U-Boot] [PATCH 2/4] MMC: EXYNOS: Added call back function for clock get

2013-03-26 Thread Amarendra Reddy
Dear Minkyu,

Please refer to the latest version of emmc patchset, which is V7 patchset.

The function definition 'exynos_dwmci_init()' has been changed when
compared to V1 patchset.

Here is the URL for latest version.
http://www.mail-archive.com/u-boot@lists.denx.de/msg107511.html

Thanks & Regards
Amarendra

On 27 March 2013 10:44, Minkyu Kang  wrote:

> Dear Amar,
>
> On 05/12/12 22:31, Amar wrote:
> > This patch defines the call back required by dw mmc driver to get the
> > clock value. It also adds function to set the dw mmc clock divider ratio.
> >
> > Signed-off-by: Amarendra Reddy 
> > ---
> >  drivers/mmc/exynos_dw_mmc.c |   14 +-
> >  1 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> > index 72a31b7..7cc8aba 100644
> > --- a/drivers/mmc/exynos_dw_mmc.c
> > +++ b/drivers/mmc/exynos_dw_mmc.c
> > @@ -30,25 +30,37 @@ 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_SET_DRV_CLK(DWMCI_SHIFT_0) |
> > + DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
> >
> >   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;
> > + int div = 0;
>
> please add a blank line here.
>
> >   host = malloc(sizeof(struct dwmci_host));
> >   if (!host) {
> >   printf("dwmci_host malloc fail!\n");
> >   return 1;
> >   }
> >
> > + div = 1;
>
> ditto.
>
> > + /* Set the mmc clock divider ratio & pre-ratio */
> > + set_mmc_clk(index, div);
>
> If the div is constant value, then just put 1.
> I think.. it's better.
> set_mmc_clk(index, 1);
>
> > +
> >   host->name = EXYNOS_NAME;
> >   host->ioaddr = (void *)regbase;
> >   host->buswidth = bus_width;
> >   host->clksel = exynos_dwmci_clksel;
> >   host->dev_index = index;
> > + host->mmc_clk = exynos_dwmci_get_clk;
> >
> >   add_dwmci(host, 5200, 40);
> >
> >
>
> Thanks,
> Minkyu Kang.
>
> ___
> 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 1/4] MMC: DWMMC: Modified fifo size computation

2013-03-26 Thread Amarendra Reddy
Dear Minkyu,

The definition of "RX_WMARK" is present in "[PATCH V7 04/10] EXYNOS5:
DWMMC: Added FDT support for DWMMC".

Here is the URL,
http://www.mail-archive.com/u-boot@lists.denx.de/msg107515.html

Thanks & Regards
Amarendra Reddy

On 27 March 2013 10:33, Minkyu Kang  wrote:

> Dear Amar,
>
> On 05/12/12 22:31, Amar wrote:
> > The current implementation of fifo size computation was giving improper
> > values for eMMC channel. Modified the computation as per user manual.
> >
> > Signed-off-by: Amarendra Reddy 
> > ---
> >  drivers/mmc/dw_mmc.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> > index 4070d4e..62dc152 100644
> > --- a/drivers/mmc/dw_mmc.c
> > +++ b/drivers/mmc/dw_mmc.c
> > @@ -332,6 +332,8 @@ 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(0xFFF)) >> 16) + 1;
>
> The definition of RX_WMARK is missing.
>
> > +
> >   if (host->fifoth_val)
> >   fifoth_val = host->fifoth_val;
> >   else
> >
>
> Thanks,
> Minkyu Kang.
> ___
> 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 2/4] MMC: EXYNOS: Added call back function for clock get

2013-03-26 Thread Minkyu Kang
Dear Amar,

On 05/12/12 22:31, Amar wrote:
> This patch defines the call back required by dw mmc driver to get the
> clock value. It also adds function to set the dw mmc clock divider ratio.
> 
> Signed-off-by: Amarendra Reddy 
> ---
>  drivers/mmc/exynos_dw_mmc.c |   14 +-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> index 72a31b7..7cc8aba 100644
> --- a/drivers/mmc/exynos_dw_mmc.c
> +++ b/drivers/mmc/exynos_dw_mmc.c
> @@ -30,25 +30,37 @@ 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_SET_DRV_CLK(DWMCI_SHIFT_0) |
> + DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
>  
>   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;
> + int div = 0;

please add a blank line here.

>   host = malloc(sizeof(struct dwmci_host));
>   if (!host) {
>   printf("dwmci_host malloc fail!\n");
>   return 1;
>   }
>  
> + div = 1;

ditto.

> + /* Set the mmc clock divider ratio & pre-ratio */
> + set_mmc_clk(index, div);

If the div is constant value, then just put 1.
I think.. it's better.
set_mmc_clk(index, 1);

> +
>   host->name = EXYNOS_NAME;
>   host->ioaddr = (void *)regbase;
>   host->buswidth = bus_width;
>   host->clksel = exynos_dwmci_clksel;
>   host->dev_index = index;
> + host->mmc_clk = exynos_dwmci_get_clk;
>  
>   add_dwmci(host, 5200, 40);
>  
> 

Thanks,
Minkyu Kang.

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


Re: [U-Boot] [PATCH] arm: omap: emif: Support for ddr3 after warm reset

2013-03-26 Thread Sricharan R
On Wednesday 27 March 2013 09:55 AM, Lokesh Vutla wrote:
> EMIF supports a global warm reset mode, during which the
> EMIF keeps the SDRAM content. But if leveling is enabled
> at the time of warm reset for DDR3, the following steps
> needs to be done after warm reset:
> 1) Keep EMIF in self refresh mode.
> 2) Reset PHY to bring back the PHY to a known state.
> 3) Start Levelling procedure.
> Doing the same.
> And also enabling DLL lock and code output after warm reset.
>

 Should the $subject be something like
   Fix DDR3 initialisation after warm reset ?

> Tested on OMAP5432 ES2.0
> 
> Signed-off-by: Lokesh Vutla 
> ---
>  arch/arm/cpu/armv7/omap-common/emif-common.c |   12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c 
> b/arch/arm/cpu/armv7/omap-common/emif-common.c
> index 9eb1279..8811958 100644
> --- a/arch/arm/cpu/armv7/omap-common/emif-common.c
> +++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
> @@ -1072,6 +1072,12 @@ static void do_sdram_init(u32 base)
>   else
>   ddr3_init(base, regs);
>   }
> + if (!in_sdram && warm_reset() &&
> + (emif_sdram_type() == EMIF_SDRAM_TYPE_DDR3)) {
> + set_lpmode_selfrefresh(base);
> + emif_reset_phy(base);
> + ddr3_leveling(base, regs);
> + }
>  

   Why do we need !in_sdram check here ?. Otherwise, good..

   Reviewed-by: R Sricharan 


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


Re: [U-Boot] [PATCH 1/4] MMC: DWMMC: Modified fifo size computation

2013-03-26 Thread Minkyu Kang
Dear Amar,

On 05/12/12 22:31, Amar wrote:
> The current implementation of fifo size computation was giving improper
> values for eMMC channel. Modified the computation as per user manual.
> 
> Signed-off-by: Amarendra Reddy 
> ---
>  drivers/mmc/dw_mmc.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index 4070d4e..62dc152 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -332,6 +332,8 @@ 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(0xFFF)) >> 16) + 1;

The definition of RX_WMARK is missing.

> +
>   if (host->fifoth_val)
>   fifoth_val = host->fifoth_val;
>   else
> 

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


Re: [U-Boot] [PATCH 1/1 v2] omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

2013-03-26 Thread Manfred Huber

Please test the Patch. It is very simple on a Beagleboard. I guess you
have flashed the actual SPL and u-boot and Beagleboard boots correctly.
Now press and hold 'User' button and connect power. SPL should hang.
You can see some symbols on the console from the ROM code.

Install the Patch, compile it and flash the NAND. Beagleboard still
boots correctly. Now press and hold 'User' button again and Beagleboard
should also boot correctly. The Patch works.

I suspect the IGEP board has the same bug. If so, the Patch should work
on this board too and we don't need CONFIG_SYS_NS16550_BROKEN_TEMT
anymore.

If you don't want a patch for this bug please let me know. I will not
bother you again.

Best regards,
Manfred


On 2013-03-25 23:02, Manfred Huber wrote:

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not
set if UART3 is configured before (only THRE is set). Reason is the
disabling of UART3 even though the Transmitter is not empty. Enabling
UART3 allows the Transmitter to be empty.

Signed-off-by: Manfred Huber 
---
  drivers/serial/ns16550.c |   12 ++--
  1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index b2da8b3..24ff84f 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -36,10 +36,18 @@

  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
== UART_LSR_THRE) {
+serial_out(UART_LCR_DLAB, &com_port->lcr);
+serial_out(baud_divisor & 0xff, &com_port->dll);
+serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+serial_out(UART_LCRVAL, &com_port->lcr);
+serial_out(0, &com_port->mdr1);
+}
+#endif
+
  while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
  ;
-#endif

  serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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


[U-Boot] [PATCH] arm: omap: emif: Support for ddr3 after warm reset

2013-03-26 Thread Lokesh Vutla
EMIF supports a global warm reset mode, during which the
EMIF keeps the SDRAM content. But if leveling is enabled
at the time of warm reset for DDR3, the following steps
needs to be done after warm reset:
1) Keep EMIF in self refresh mode.
2) Reset PHY to bring back the PHY to a known state.
3) Start Levelling procedure.
Doing the same.
And also enabling DLL lock and code output after warm reset.

Tested on OMAP5432 ES2.0

Signed-off-by: Lokesh Vutla 
---
 arch/arm/cpu/armv7/omap-common/emif-common.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c 
b/arch/arm/cpu/armv7/omap-common/emif-common.c
index 9eb1279..8811958 100644
--- a/arch/arm/cpu/armv7/omap-common/emif-common.c
+++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
@@ -1072,6 +1072,12 @@ static void do_sdram_init(u32 base)
else
ddr3_init(base, regs);
}
+   if (!in_sdram && warm_reset() &&
+   (emif_sdram_type() == EMIF_SDRAM_TYPE_DDR3)) {
+   set_lpmode_selfrefresh(base);
+   emif_reset_phy(base);
+   ddr3_leveling(base, regs);
+   }
 
/* Write to the shadow registers */
emif_update_timings(base, regs);
@@ -1259,10 +1265,10 @@ void sdram_init(void)
in_sdram = running_from_sdram();
debug("in_sdram = %d\n", in_sdram);
 
-   if (!(in_sdram || warm_reset())) {
-   if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2)
+   if (!in_sdram) {
+   if ((sdram_type == EMIF_SDRAM_TYPE_LPDDR2) && !warm_reset())
bypass_dpll((*prcm)->cm_clkmode_dpll_core);
-   else
+   else if (sdram_type == EMIF_SDRAM_TYPE_DDR3)
writel(CM_DLL_CTRL_NO_OVERRIDE, (*prcm)->cm_dll_ctrl);
}
 
-- 
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 V3 00/10] OMAP3-5: TWL[46]03[05]: cleanup register access and misc minimal cleanups

2013-03-26 Thread Sricharan R
Hi Nishanth,

On Tuesday 26 March 2013 08:50 PM, Nishanth Menon wrote:
> This series helps standardize register parameters for TWL4030, 6030 and 6035
> used in various OMAP3,4,5 based platforms.
> 
> For historical reasons, we have been following val, reg as the order of
> parameters while we have reg, val in every other i2c apis including i2c
> mw/mr command @ u-boot cmd line, with kernel APIs, i2cget, i2cset utilities.
> 
> Instead of maintaining this forked implementation, it is never too late to
> fix them.
> 
> Since TPS659038/TWL6035/TWL6037 all belong to the Palmas family of TI PMICs
> and are mostly compatible among each other, we rename twl6035 to palmas as 
> part
> of this cleanup.
> 
> Build tested (MAKEALL) platforms-at least these seem to be be impacted ones:
> cm_t35
> devkit8000
> dig297
> igep0020
> igep0020_nand
> igep0030
> igep0030_nand
> nokia_rx51
> omap3_beagle
> omap3_evm
> omap3_evm_quick_mmc
> omap3_evm_quick_nand
> omap3_logic
> omap3_mvblx
> omap3_overo
> omap3_pandora
> omap3_sdp3430
> omap3_zoom1
> omap3_zoom2
> omap4_panda
> omap4_sdp4430
> omap5_evm
> tricorder
> dra7xx_evm
> 
> Boot tested platforms (upto kernel+shell with dtb):
> omap3_beagle - tested on beagle XM (C1), beagle(C1D) - TWL4030
> omap4_panda - tested on PandaBoard(A3) and PandaBoard-ES(EB3) - TWL6030
> omap5_evm - OMAP5 uEVM - TWL6035
> 
> twl4030 changes are little wider in scope, so I have split them
> into two patches to help review
> 
> Series is based on u-boot master:
>  master  8b906a9 Merge branch 'spi' of git://git.denx.de/u-boot-x86
> (rationale being the changes if done on v2013.04-rc1 have much changes to
>  allow this series to apply cleanly on the latest)
> 
> NOTE: the series tries to cleanup existing indentation style to allow the
> new code to be in sync with checkpatch suggestions.
> 
> V2: http://marc.info/?t=13639881686&r=1&w=2
> V1: http://patchwork.ozlabs.org/patch/227112/
> 
> Changes since V2 in this series:
>   - rename of twl6035 to palmas and associated changes
>   - minor updates to cleaup checkpatch warnings 
> 
> Nishanth Menon (10):
>   twl4030: make twl4030_i2c_write_u8 prototype consistent
>   twl4030: make twl4030_i2c_read_u8 prototype consistent
>   twl6030: twl6030_i2c_[read|write]_u8 prototype consistent
>   twl6030: move twl6030 register access functions to common header file
>   twl6030: add header guard
>   twl6035: rename to palmas
>   palmas: rename init_settings to an generic palmas init
>   palmas: rename twl6035_mmc1_poweron_ldo with an palmas generic
> function
>   palmas: use palmas_i2c_[read|write]_u8
>   palmas: add header guard
> 
>  board/cm_t35/cm_t35.c |   24 +--
>  board/nokia/rx51/rx51.c   |   52 +++
>  board/pandora/pandora.c   |3 +-
>  board/ti/dra7xx/evm.c |2 +-
>  board/ti/omap5_evm/evm.c  |6 +--
>  drivers/misc/twl4030_led.c|4 +-
>  drivers/mmc/omap_hsmmc.c  |8 ++--
>  drivers/power/Makefile|2 +-
>  drivers/power/{twl6035.c => palmas.c} |   34 +++
>  drivers/power/twl4030.c   |   16 +++
>  drivers/power/twl6030.c   |   75 
> ++---
>  drivers/usb/phy/twl4030.c |   48 ++---
>  include/configs/omap5_evm.h   |2 +-
>  include/{twl6035.h => palmas.h}   |   28 +---
>  include/twl4030.h |4 +-
>  include/twl6030.h |   16 +++
>  16 files changed, 162 insertions(+), 162 deletions(-)
>  rename drivers/power/{twl6035.c => palmas.c} (61%)
>  rename include/{twl6035.h => palmas.h} (68%)
> 
> Regards,
> Nishanth Menon

 Acked-by: R Sricharan  for the series

Regards,
 Sricharan

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


Re: [U-Boot] [PATCH 3/3] arm:goni: Add support for USB mass storage

2013-03-26 Thread Minkyu Kang
Dear Arkadiusz Wlodarczyk,

On 18/02/13 19:18, a.wlodarc...@samsung.com wrote:
> From: Arkadiusz Wlodarczyk 
> 
> Signed-off-by: Arkadiusz Wlodarczyk 
> Signed-off-by: Kyungmin Park 
> Tested-by: Arkadiusz Wlodarczyk 
> Cc: Minkyu Kang 
> ---
> Changes
> Switch on USB gadget mass storage and ums command in
> configuration for goni target; Add code supporting USB gadget
> mass storage in board/samsung/goni/goni.c
> ---
> Depends on implementation of USB mass storage
> for Samsung.
> http://patchwork.ozlabs.org/patch/219744/
> http://patchwork.ozlabs.org/patch/219746/
> http://patchwork.ozlabs.org/patch/219745/
> ---
>  board/samsung/goni/goni.c  |   68 
> 
>  include/configs/s5p_goni.h |5 +++
>  2 files changed, 73 insertions(+), 0 deletions(-)
> 
> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
> index 3c53106..a09daca 100644
> --- a/board/samsung/goni/goni.c
> +++ b/board/samsung/goni/goni.c
> @@ -29,6 +29,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  static struct s5pc110_gpio *s5pc110_gpio;
> @@ -163,3 +164,70 @@ void board_usb_init(void)
>  }
>  
>  #endif
> +
> +#ifdef CONFIG_USB_GADGET_MASS_STORAGE
> +static int ums_read_sector(struct ums_device *ums_dev,
> + ulong start, lbaint_t blkcnt, void *buf)
> +{
> + if (ums_dev->mmc->block_dev.block_read(ums_dev->dev_num,
> + start + ums_dev->offset, blkcnt, buf) != blkcnt)
> + return -1;
> +
> + return 0;
> +}
> +
> +static int ums_write_sector(struct ums_device *ums_dev,
> + ulong start, lbaint_t blkcnt, const void *buf)
> +{
> + if (ums_dev->mmc->block_dev.block_write(ums_dev->dev_num,
> + start + ums_dev->offset, blkcnt, buf) != blkcnt)
> + return -1;
> +
> + return 0;
> +}
> +
> +static void ums_get_capacity(struct ums_device *ums_dev,
> + long long int *capacity)
> +{
> + long long int tmp_capacity;
> +
> + tmp_capacity = (long long int) ((ums_dev->offset + ums_dev->part_size)
> + * SECTOR_SIZE);
> + *capacity = ums_dev->mmc->capacity - tmp_capacity;
> +}
> +
> +static struct ums_board_info ums_board = {
> + .read_sector = ums_read_sector,
> + .write_sector = ums_write_sector,
> + .get_capacity = ums_get_capacity,
> + .name = "GONI UMS disk",
> + .ums_dev = {
> + .mmc = NULL,
> + .dev_num = 0,
> + .offset = 0,
> + .part_size = 0.
> + },
> +};
> +
> +struct ums_board_info *board_ums_init(unsigned int dev_num, unsigned int 
> offset,
> + unsigned int part_size)
> +{
> + struct mmc *mmc;
> +
> + mmc = find_mmc_device(dev_num);
> + /* mmc initialization is necessary prior to the ums command usage
> +  * due to fact that on goni target environment is read from oneNand
> +  * memory, so the mmc remains uninitialized whenu-boot prompt appears
> +  * */

please check multi line comments rule.

> + if (!mmc || mmc_init(mmc))

why don't you separate this statement?

> + return NULL;
> +
> + ums_board.ums_dev.mmc = mmc;
> + ums_board.ums_dev.dev_num = dev_num;
> + ums_board.ums_dev.offset = offset;
> + ums_board.ums_dev.part_size = part_size;
> +
> + return &ums_board;
> +}
> +
> +#endif
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index e8f2639..1cfbb88 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -269,4 +269,9 @@
>  #define CONFIG_USB_GADGET_DUALSPEED
>  #define CONFIG_USB_GADGET_VBUS_DRAW 2
>  
> +#define CONFIG_CMD_USB_MASS_STORAGE
> +#if defined(CONFIG_CMD_USB_MASS_STORAGE)

I think, this ifdef is unnecessary.

> +#define CONFIG_USB_GADGET_MASS_STORAGE
> +#endif
> +
>  #endif   /* __CONFIG_H */
> 

Thanks,
Minkyu Kang.

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


Re: [U-Boot] [PATCH 1/3] arm:goni: Adjustment of configuration for goni target

2013-03-26 Thread Minkyu Kang
Dear Arkadiusz Wlodarczyk,

On 18/02/13 19:18, a.wlodarc...@samsung.com wrote:
> From: Arkadiusz Wlodarczyk 
> 
> Signed-off-by: Arkadiusz Wlodarczyk 
> Signed-off-by: Kyungmin Park 
> Tested-by: Arkadiusz Wlodarczyk 
> Cc: Minkyu Kang 
> ---
> Changes
> This change encompasses set of adjustments in the configuration
> of the u-boot in the include/configs/s5p_goni.h, particularly
> change of rootfs type, change in kernel booting method and added DFU
> support. All those changes are connected with adjusting of existing
> goni configuration to latest changes in kernel.
> ---
>  board/samsung/goni/goni.c  |7 +++
>  include/configs/s5p_goni.h |   37 -
>  2 files changed, 39 insertions(+), 5 deletions(-)
> 
> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
> index ff76963..3c53106 100644
> --- a/board/samsung/goni/goni.c
> +++ b/board/samsung/goni/goni.c
> @@ -155,4 +155,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
>   .regs_otg = S5PC110_OTG_BASE,
>   .usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
>  };
> +
> +void board_usb_init(void)
> +{
> + debug("USB_udc_probe\n");
> + s3c_udc_probe(&s5pc110_otg_data);
> +}

I think, this is unrelated changes to subject.

> +
>  #endif
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index 56e8347..8a824c7 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -86,6 +86,17 @@
>  #define CONFIG_CMD_ONENAND
>  #define CONFIG_CMD_MTDPARTS
>  #define CONFIG_CMD_MMC
> +#define CONFIG_CMD_DFU
> +
> +/* USB Composite download gadget - g_dnl */
> +#define CONFIG_USBDOWNLOAD_GADGET
> +#define CONFIG_DFU_FUNCTION
> +#define CONFIG_DFU_MMC
> +
> +/* USB Samsung's IDs */
> +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
> +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
> +#define CONFIG_G_DNL_MANUFACTURER "Samsung"
>  
>  #define CONFIG_BOOTDELAY 1
>  #define CONFIG_ZERO_BOOTDELAY_CHECK
> @@ -105,9 +116,13 @@
>   ",60m(qboot)"\
>   ",-(UBI)\0"
>  
> +#define CONFIG_DFU_ALT \
> + "u-boot mmc 80 400;" \
> + "uImage fat 0 2\0" \
> +
>  #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
>  
> -#define CONFIG_BOOTCOMMAND   "run ubifsboot"
> +#define CONFIG_BOOTCOMMAND   "run mmcboot"
>  
>  #define CONFIG_DEFAULT_CONSOLE   "console=ttySAC2,115200n8\0"
>  
> @@ -137,7 +152,7 @@
>   "onenand erase 0x0156 0x1eaa;" \
>   "onenand write 0x3200 0x126 0x8C\0" \
>   "bootk=" \
> - "onenand read 0x30007FC0 0xc0 0x60;" \
> + "run loaduimage;" \
>   "bootm 0x30007FC0\0" \
>   "flashboot=" \
>   "set bootargs root=/dev/mtdblock${bootblock} " \
> @@ -156,21 +171,28 @@
>   "set bootargs " CONFIG_RAMDISK_BOOT \
>   " initrd=0x3300,8M ramdisk=8192\0" \
>   "mmcboot=" \
> - "set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
> + "set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
> + "rootfstype=${rootfstype}" \
>   CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
>   CONFIG_COMMON_BOOT "; run bootk\0" \
>   "boottrace=setenv opts initcall_debug; run bootcmd\0" \
>   "bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
>   "verify=n\0" \
> - "rootfstype=cramfs\0" \
> + "rootfstype=ext4\0" \
>   "console=" CONFIG_DEFAULT_CONSOLE \
>   "mtdparts=" MTDPARTS_DEFAULT \
>   "meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0" \
> + "loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
> + "mmcdev=0\0" \
> + "mmcbootpart=2\0" \
> + "mmcrootpart=5\0" \
>   "mmcblk=/dev/mmcblk1p1\0" \
>   "bootblock=9\0" \
>   "ubiblock=8\0" \
>   "ubi=enabled\0" \
> - "opts=always_resume=1"
> + "opts=always_resume=1\0" \
> + "dfu_alt_info=" CONFIG_DFU_ALT
> +
>  
>  /* Miscellaneous configurable options */
>  #define CONFIG_SYS_LONGHELP  /* undef to save memory */
> @@ -211,6 +233,10 @@
>  
>  #define CONFIG_DOS_PARTITION 1
>  
> +/* FAT */
> +#define CONFIG_CMD_FAT
> +#define CONFIG_FAT_WRITE
> +
>  #define CONFIG_SYS_INIT_SP_ADDR  (CONFIG_SYS_LOAD_ADDR - 0x100)
>  
>  #define CONFIG_SYS_CACHELINE_SIZE   64
> @@ -233,5 +259,6 @@
>  #define CONFIG_USB_GADGET
>  #define CONFIG_USB_GADGET_S3C_UDC_OTG
>  #define CONFIG_USB_GADGET_DUALSPEED
> +#define CONFIG_USB_GADGET_VBUS_DRAW 2
>  
>  #endif   /* __CONFIG_H */
> 

Thanks,
Minkyu Kang.

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


[U-Boot] [PATCH v2 4/7] patman: Provide option to ignore bad aliases

2013-03-26 Thread Simon Glass
Often it happens that patches include tags which don't have aliases. It
is annoying that patman fails in this case, and provides no option to
continue other than adding empty tags to the .patman file.

Correct this by adding a '-t' option to ignore tags that don't exist.
Print a warning instead.

Since running the tests is not a common operation, move this to --test
instead, to reserve -t for this new option.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Add comment about meaning of raise_on_error=False
- Remove 'ignore_errors' and just use 'raise_on_error' everywhere
- Use keyword args for raise_on_error

 tools/patman/gitutil.py | 65 +++--
 tools/patman/patman.py  | 10 +---
 tools/patman/series.py  | 10 +---
 3 files changed, 61 insertions(+), 24 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index c35d209..f70f851 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -159,7 +159,7 @@ def ApplyPatches(verbose, args, start_point):
 print stdout, stderr
 return error_count == 0
 
-def BuildEmailList(in_list, tag=None, alias=None):
+def BuildEmailList(in_list, tag=None, alias=None, raise_on_error=True):
 """Build a list of email addresses based on an input list.
 
 Takes a list of email addresses and aliases, and turns this into a list
@@ -172,6 +172,9 @@ def BuildEmailList(in_list, tag=None, alias=None):
 Args:
 in_list:List of aliases/email addresses
 tag:Text to put before each address
+alias:  Alias dictionary
+raise_on_error: True to raise an error when an alias fails to match,
+False to just print a message.
 
 Returns:
 List of email addresses
@@ -193,7 +196,7 @@ def BuildEmailList(in_list, tag=None, alias=None):
 quote = '"' if tag and tag[0] == '-' else ''
 raw = []
 for item in in_list:
-raw += LookupEmail(item, alias)
+raw += LookupEmail(item, alias, raise_on_error=raise_on_error)
 result = []
 for item in raw:
 if not item in result:
@@ -202,7 +205,7 @@ def BuildEmailList(in_list, tag=None, alias=None):
 return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
 return result
 
-def EmailPatches(series, cover_fname, args, dry_run, cc_fname,
+def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
 self_only=False, alias=None, in_reply_to=None):
 """Email a patch series.
 
@@ -211,6 +214,8 @@ def EmailPatches(series, cover_fname, args, dry_run, 
cc_fname,
 cover_fname: filename of cover letter
 args: list of filenames of patch files
 dry_run: Just return the command that would be run
+raise_on_error: True to raise an error when an alias fails to match,
+False to just print a message.
 cc_fname: Filename of Cc file for per-commit Cc
 self_only: True to just email to yourself as a test
 in_reply_to: If set we'll pass this to git as --in-reply-to.
@@ -233,20 +238,21 @@ def EmailPatches(series, cover_fname, args, dry_run, 
cc_fname,
 >>> series = series.Series()
 >>> series.to = ['fred']
 >>> series.cc = ['mary']
->>> EmailPatches(series, 'cover', ['p1', 'p2'], True, 'cc-fname', False, \
-alias)
+>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \
+False, alias)
 'git send-email --annotate --to "f.blo...@napier.co.nz" --cc \
 "m.popp...@cloud.net" --cc-cmd "./patman --cc-cmd cc-fname" cover p1 p2'
->>> EmailPatches(series, None, ['p1'], True, 'cc-fname', False, alias)
+>>> EmailPatches(series, None, ['p1'], True, True, 'cc-fname', False, \
+alias)
 'git send-email --annotate --to "f.blo...@napier.co.nz" --cc \
 "m.popp...@cloud.net" --cc-cmd "./patman --cc-cmd cc-fname" p1'
 >>> series.cc = ['all']
->>> EmailPatches(series, 'cover', ['p1', 'p2'], True, 'cc-fname', True, \
-alias)
+>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \
+True, alias)
 'git send-email --annotate --to "this-is...@me.com" --cc-cmd "./patman \
 --cc-cmd cc-fname" cover p1 p2'
->>> EmailPatches(series, 'cover', ['p1', 'p2'], True, 'cc-fname', False, \
-alias)
+>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \
+False, alias)
 'git send-email --annotate --to "f.blo...@napier.co.nz" --cc \
 "f.blo...@napier.co.nz" --cc "j.blo...@napier.co.nz" --cc \
 "m.popp...@cloud.net" --cc-cmd "./patman --cc-cmd cc-fname" cover p1 p2'
@@ -254,14 +260,14 @@ def EmailPatches(series, cover_fname, args, dry_run, 
cc_fname,
 # Restore argv[0] since we clobbered it.
 >>> sys.argv[0] = _old_argv0
 """
-to = BuildEmailList(series.get('to'), '--to', alias)
+to = BuildEmailList(series.get('to'), '--to', alias, raise_on_error)
 if not t

[U-Boot] [PATCH v2 7/7] patman: Minor help message/README fixes

2013-03-26 Thread Simon Glass
A few of the help messages are not quite right, and there is a typo
in the README. Fix these.

Signed-off-by: Simon Glass 
Reviewed-by: Doug Anderson 
---
Changes in v2: None

 tools/patman/README| 2 +-
 tools/patman/patman.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 0bdaa63..8cffcd1 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -68,7 +68,7 @@ will get a consistent result each time.
 How to configure it
 ===
 
-For most cases of using patman for U-Boot developement patman will
+For most cases of using patman for U-Boot development, patman will
 locate and use the file 'doc/git-mailrc' in your U-Boot directory.
 This contains most of the aliases you will need.
 
diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index 7a86b43..a8061a9 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -52,7 +52,7 @@ parser.add_option('-i', '--ignore-errors', 
action='store_true',
dest='ignore_errors', default=False,
help='Send patches email even if patch errors are found')
 parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
-   default=False, help="Do a try run (create but don't email patches)")
+   default=False, help="Do a dry run (create but don't email patches)")
 parser.add_option('-p', '--project', default=project.DetectProject(),
   help="Project name; affects default option values and "
   "aliases [default: %default]")
@@ -77,7 +77,7 @@ parser.add_option('--no-tags', action='store_false', 
dest='process_tags',
 parser.usage = """patman [options]
 
 Create patches from commits in a branch, check them and email them as
-specified by tags you place in the commits. Use -n to """
+specified by tags you place in the commits. Use -n to do a dry run first."""
 
 
 # Parse options twice: first to get the project and second to handle
-- 
1.8.1.3

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


[U-Boot] [PATCH v2 3/7] patman: Fix the comment in CheckTags to mention multiple tags

2013-03-26 Thread Simon Glass
This comment is less than helpful. Since multiple tags are supported, add
an example of how multiple tags work.

Signed-off-by: Simon Glass 
Reviewed-by: Doug Anderson 
---
Changes in v2: None

 tools/patman/commit.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/patman/commit.py b/tools/patman/commit.py
index cbfbc46..468b50c 100644
--- a/tools/patman/commit.py
+++ b/tools/patman/commit.py
@@ -61,9 +61,10 @@ class Commit:
 
 Subject tags look like this:
 
-propounder: Change the widget to propound correctly
+propounder: fort: Change the widget to propound correctly
 
-Multiple tags are supported. The list is updated in self.tag
+Here the tags are propounder and fort. Multiple tags are supported.
+The list is updated in self.tag.
 
 Returns:
 None if ok, else the name of a tag with no email alias
-- 
1.8.1.3

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


[U-Boot] [PATCH v2 6/7] patman: Add Series-process-log tag to sort/uniq change logs

2013-03-26 Thread Simon Glass
For some series with lots of changes it is annoying that duplicate change
log items are not caught. It is also helpful sometimes to sort the change
logs.

Add a Series-process-log tag to enable this, which can be placed in a
commit to control this.

The change to the Cc: line is to fix a checkpatch warning.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Require sort, uniq tags to be comma-separated

 tools/patman/README | 9 -
 tools/patman/patchstream.py | 2 +-
 tools/patman/series.py  | 9 +++--
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 9922f2a..0bdaa63 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -225,9 +225,16 @@ Series-changes: n
to update the log there and then, knowing that the script will
do the rest.
 
-Cc: Their Name 
+ Cc: Their Name 
This copies a single patch to another email address.
 
+Series-process-log: sort, uniq
+   This tells patman to sort and/or uniq the change logs. It is
+   assumed that each change log entry is only a single line long.
+   Use 'sort' to sort the entries, and 'uniq' to include only
+   unique entries. If omitted, no change log processing is done.
+   Separate each tag with a comma.
+
 Various other tags are silently removed, like these Chrome OS and
 Gerrit tags:
 
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index a4f2f31..9d8a918 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -46,7 +46,7 @@ re_cover = re.compile('^Cover-letter:')
 re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
 
 # Patch series tag
-re_series = re.compile('^Series-(\w*): *(.*)')
+re_series = re.compile('^Series-([a-z-]*): *(.*)')
 
 # Commit tags that we want to collect and keep
 re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Cc): (.*)')
diff --git a/tools/patman/series.py b/tools/patman/series.py
index eb5a00c..783b3dd 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -28,7 +28,7 @@ import terminal
 
 # Series-xxx tags that we understand
 valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
-'cover-cc']
+'cover-cc', 'process_log']
 
 class Series(dict):
 """Holds information about a patch series, including all tags.
@@ -167,15 +167,20 @@ class Series(dict):
 etc.
 """
 final = []
+process_it = self.get('process_log', '').split(',')
+process_it = [item.strip() for item in process_it]
 need_blank = False
 for change in sorted(self.changes, reverse=True):
 out = []
 for this_commit, text in self.changes[change]:
 if commit and this_commit != commit:
 continue
-out.append(text)
+if 'uniq' not in process_it or text not in out:
+out.append(text)
 line = 'Changes in v%d:' % change
 have_changes = len(out) > 0
+if 'sort' in process_it:
+out = sorted(out)
 if have_changes:
 out.insert(0, line)
 else:
-- 
1.8.1.3

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


[U-Boot] [PATCH v2 2/7] patman: Don't allow spaces in tags

2013-03-26 Thread Simon Glass
At present something like:

   Revert "arm: Add cache operations"

will try to use

   Revert "arm

as a tag. Clearly this is wrong, so fix it.

If the revert is intended to be tagged, then the tag can come before
the revert, perhaps. Alternatively the 'Cc' tag can be used in the commit
messages.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Adjust to not allow any spaces in tags, change commit title

 tools/patman/commit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/patman/commit.py b/tools/patman/commit.py
index 7144e54..cbfbc46 100644
--- a/tools/patman/commit.py
+++ b/tools/patman/commit.py
@@ -22,7 +22,7 @@
 import re
 
 # Separates a tag: at the beginning of the subject from the rest of it
-re_subject_tag = re.compile('([^:]*):\s*(.*)')
+re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
 
 class Commit:
 """Holds information about a single commit/patch in the series.
-- 
1.8.1.3

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


[U-Boot] [PATCH v2 5/7] patman: Add -a option to refrain from test-applying the patches

2013-03-26 Thread Simon Glass
Especially with the Linux kernel, it takes a long time (a minute or more)
to test-apply the patches, so patman becomes significantly less useful.
The only real problem that is found with this apply step is trailing spaces.
Provide a -a option to skip this step, for those working with clean patches.

Signed-off-by: Simon Glass 
Reviewed-by: Doug Anderson 
---
Changes in v2: None

 tools/patman/patman.py | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index 023dceb..7a86b43 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -41,6 +41,9 @@ import test
 
 
 parser = OptionParser()
+parser.add_option('-a', '--no-apply', action='store_false',
+  dest='apply_patches', default=True,
+  help="Don't test-apply patches with git am")
 parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
default=False, help='Display the README file')
 parser.add_option('-c', '--count', dest='count', type='int',
@@ -157,9 +160,10 @@ else:
 ok = checkpatch.CheckPatches(options.verbose, args)
 else:
 ok = True
-if not gitutil.ApplyPatches(options.verbose, args,
-options.count + options.start):
-ok = False
+if options.apply_patches:
+if not gitutil.ApplyPatches(options.verbose, args,
+options.count + options.start):
+ok = False
 
 cc_file = series.MakeCcFile(options.process_tags, cover_fname,
 not options.ignore_bad_tags)
-- 
1.8.1.3

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


[U-Boot] [PATCH v2 1/7] patman: Fix up checkpatch parsing to deal with 'CHECK' lines

2013-03-26 Thread Simon Glass
checkpatch has a new type of warning, a 'CHECK'. At present patman fails
with these, which makes it less than useful.

Add support for checks, making it backwards compatible with the old
checkpatch.

At the same time, clean up formatting of the CheckPatches() output,
fix erroneous "internal error" if multiple patches have warnings and
be more robust to new types of problems.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Update code to remove match_count
- Update commit message to add detail on what is changing
- Update tests to check the 'checks' value, and add a new test
- Use namedtuple to hold the return value from CheckPatch() function

 tools/patman/checkpatch.py | 110 -
 tools/patman/test.py   |  64 +-
 2 files changed, 112 insertions(+), 62 deletions(-)

diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index d3a0477..83aaf71 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -19,6 +19,7 @@
 # MA 02111-1307 USA
 #
 
+import collections
 import command
 import gitutil
 import os
@@ -57,63 +58,86 @@ def CheckPatch(fname, verbose=False):
 """Run checkpatch.pl on a file.
 
 Returns:
-4-tuple containing:
-result: False=failure, True=ok
+namedtuple containing:
+ok: False=failure, True=ok
 problems: List of problems, each a dict:
 'type'; error or warning
 'msg': text message
 'file' : filename
 'line': line number
+errors: Number of errors
+warnings: Number of warnings
+checks: Number of checks
 lines: Number of lines
+stdout: Full output of checkpatch
 """
-result = False
-error_count, warning_count, lines = 0, 0, 0
-problems = []
+fields = ['ok', 'problems', 'errors', 'warnings', 'checks', 'lines',
+  'stdout']
+result = collections.namedtuple('CheckPatchResult', fields)
+result.ok = False
+result.errors, result.warning, result.checks = 0, 0, 0
+result.lines = 0
+result.problems = []
 chk = FindCheckPatch()
 item = {}
-stdout = command.Output(chk, '--no-tree', fname)
+result.stdout = command.Output(chk, '--no-tree', fname)
 #pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)
 #stdout, stderr = pipe.communicate()
 
 # total: 0 errors, 0 warnings, 159 lines checked
+# or:
+# total: 0 errors, 2 warnings, 7 checks, 473 lines checked
 re_stats = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)')
+re_stats_full = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)'
+   ' checks, (\d+)')
 re_ok = re.compile('.*has no obvious style problems')
 re_bad = re.compile('.*has style problems, please review')
 re_error = re.compile('ERROR: (.*)')
 re_warning = re.compile('WARNING: (.*)')
+re_check = re.compile('CHECK: (.*)')
 re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):')
 
-for line in stdout.splitlines():
+for line in result.stdout.splitlines():
 if verbose:
 print line
 
 # A blank line indicates the end of a message
 if not line and item:
-problems.append(item)
+result.problems.append(item)
 item = {}
-match = re_stats.match(line)
+match = re_stats_full.match(line)
+if not match:
+match = re_stats.match(line)
 if match:
-error_count = int(match.group(1))
-warning_count = int(match.group(2))
-lines = int(match.group(3))
+result.errors = int(match.group(1))
+result.warnings = int(match.group(2))
+if len(match.groups()) == 4:
+result.checks = int(match.group(3))
+result.lines = int(match.group(4))
+else:
+result.lines = int(match.group(3))
 elif re_ok.match(line):
-result = True
+result.ok = True
 elif re_bad.match(line):
-result = False
-match = re_error.match(line)
-if match:
-item['msg'] = match.group(1)
+result.ok = False
+err_match = re_error.match(line)
+warn_match = re_warning.match(line)
+file_match = re_file.match(line)
+check_match = re_check.match(line)
+if err_match:
+item['msg'] = err_match.group(1)
 item['type'] = 'error'
-match = re_warning.match(line)
-if match:
-item['msg'] = match.group(1)
+elif warn_match:
+item['msg'] = warn_match.group(1)
 item['type'] = 'warning'
-match = re_file.match(line)
-if match:
-item['file'] = match.group(1)
-item['line'] = int(match.group(2))
+elif check_match:
+item['msg'] = check_match.g

[U-Boot] [PATCH v2 0/7] Various patman fixes

2013-03-26 Thread Simon Glass
Since checkpatch has changed in U-Boot, patman no longer detects errors
properly. It seems like a good oppotunity to fix some of the bugs and
annoying habits of patman that people have mentioned on the list.

If I have missed any bugs / problems in this sweep, please let me know.

Changes in v2:
- Add comment about meaning of raise_on_error=False
- Adjust to not allow any spaces in tags, change commit title
- Remove 'ignore_errors' and just use 'raise_on_error' everywhere
- Require sort, uniq tags to be comma-separated
- Update code to remove match_count
- Update commit message to add detail on what is changing
- Update tests to check the 'checks' value, and add a new test
- Use keyword args for raise_on_error
- Use namedtuple to hold the return value from CheckPatch() function

Simon Glass (7):
  patman: Fix up checkpatch parsing to deal with 'CHECK' lines
  patman: Don't allow spaces in tags
  patman: Fix the comment in CheckTags to mention multiple tags
  patman: Provide option to ignore bad aliases
  patman: Add -a option to refrain from test-applying the patches
  patman: Add Series-process-log tag to sort/uniq change logs
  patman: Minor help message/README fixes

 tools/patman/README |  11 -
 tools/patman/checkpatch.py  | 110 +++-
 tools/patman/commit.py  |   7 +--
 tools/patman/gitutil.py |  65 ++
 tools/patman/patchstream.py |   2 +-
 tools/patman/patman.py  |  24 ++
 tools/patman/series.py  |  19 ++--
 tools/patman/test.py|  64 ++
 8 files changed, 203 insertions(+), 99 deletions(-)

-- 
1.8.1.3

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


Re: [U-Boot] [PATCH 5/8] patman: Provide option to ignore bad aliases

2013-03-26 Thread Simon Glass
Hi Doug,

On Thu, Mar 21, 2013 at 10:09 AM, Doug Anderson  wrote:
> Simon,
>
> Nothing critical and this could go in as-is, but a few nits below.
>
>
> On Wed, Mar 20, 2013 at 7:42 PM, Simon Glass  wrote:
>> -raw += LookupEmail(item, alias)
>> +raw += LookupEmail(item, alias, raise_on_error=not ignore_errors)
>
> optional: Change it so functions are consistent about whether it's
> "raise_on_error" or "ignore_errors"

Will do.

>
>
>> +>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, False, 
>> 'cc-fname', \
>> +False, alias)
>
> Doctest that actually tests the raise_on_error?  See doctests in
> gitutil.py for example syntax.

It is tested by LookupEmail() below.

>
>
>> -def LookupEmail(lookup_name, alias=None, level=0):
>> +def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0):
>>  """If an email address is an alias, look it up and return the full name
>>
>>  TODO: Why not just use git's own alias feature?
>>
>>  Args:
>>  lookup_name: Alias or email address to look up
>> +alias: Dictionary containing aliases (None to use settings default)
>> +raise_on_error: True to raise an error when an alias fails to match
>
> ...and what happens if you pass False?

Will add comment.

>
>
>> +>>> LookupEmail('odd', alias, False)
>> +\033[1;31mAlias 'odd' not found\033[0m
>> +[]
>> +>>> # In this case the loop part will effectively be ignored.
>> +>>> LookupEmail('loop', alias, False)
>> +\033[1;31mRecursive email alias at 'other'\033[0m
>> +\033[1;31mRecursive email alias at 'john'\033[0m
>> +\033[1;31mRecursive email alias at 'mary'\033[0m
>> +['j.blo...@napier.co.nz', 'm.popp...@cloud.net']
>
> optional nit: for optional args it's nice to specify them with keywords, like
>   >>> LookupEmail('loop', alias=alias, raise_on_error=False)
>
> Please test the raise_on_error=True case.

Yes, that's the current ignore_errors=False I think, so I will keep this.

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


Re: [U-Boot] [PATCH 8/8] patman: Add Series-process-log tag to sort/uniq change logs

2013-03-26 Thread Simon Glass
Hi Doug,

On Thu, Mar 21, 2013 at 10:51 AM, Doug Anderson  wrote:
> Simon,
>
> On Wed, Mar 20, 2013 at 7:43 PM, Simon Glass  wrote:
>> For some series with lots of changes it is annoying that duplicate change
>> log items are not caught. It is also helpful sometimes to sort the change
>> logs.
>>
>> Add a Series-process-log tag to enable this, which can be placed in a
>> commit to control this.
>>
>> The change to the Cc: line is to fix a checkpatch warning.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>  tools/patman/README | 8 +++-
>>  tools/patman/patchstream.py | 2 +-
>>  tools/patman/series.py  | 8 ++--
>>  3 files changed, 14 insertions(+), 4 deletions(-)
>
> Not sure I'd find this terribly useful myself, but I don't see
> anything wrong with it.  I think my change log items tend to be more
> than one line long for one...

I use it a lot. Brevity is a virtue :-)

>
>> +if not ('uniq' in process_it and text in out):
>
> optional: My brain had a hard time processing this.  I did the logic
> transformation myself:
>
>   if 'uniq' not in process_it or text not in out:

Will update.

>
>
> Also: Do you really want the "process_it" to be so free-form?  That
> seems like it might be asking for disaster.  Why not specify that it's
> comma-separated and be done.

OK I'll add processing to check that.

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


Re: [U-Boot] [PATCH 2/8] patman: Don't look for tags inside quotes

2013-03-26 Thread Simon Glass
Hi Doug,

On Thu, Mar 21, 2013 at 9:50 AM, Doug Anderson  wrote:
> Simon,
>
> On Wed, Mar 20, 2013 at 7:42 PM, Simon Glass  wrote:
>>  # Separates a tag: at the beginning of the subject from the rest of it
>> -re_subject_tag = re.compile('([^:]*):\s*(.*)')
>> +re_subject_tag = re.compile('([^:"]*):\s*(.*)')
>
> I'd go further and prevent all spaces.
>   re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
>
> I ran into a similar problem with my patch I sent up earlier:
>
>   patman: Add Cover-letter-cc: tag to Cc cover letter to people
>
> I "fixed" that by removing the extra colon, but that was sorta lame.
> We shouldn't have tags with spaces in them anyway...
>
>   patman: Add Cover-letter-cc tag to Cc cover letter to people

Yes - will update this, thanks.

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


Re: [U-Boot] [PATCH 1/8] patman: Fix up checkpatch parsing to deal with 'CHECK' lines

2013-03-26 Thread Simon Glass
Hi Doug,

On Thu, Mar 21, 2013 at 9:35 AM, Doug Anderson  wrote:
> Simon,
>
> On Wed, Mar 20, 2013 at 7:42 PM, Simon Glass  wrote:
>> checkpatch has a new type of warning, a 'CHECK'. At present patman fails
>> with these, which makes it less than useful.
>>
>> Add support for checks, making it backwards compatible with the old
>> checkpatch.
>
> There are also a few other minor fixups in this:
> * Cleanup formatting of the CheckPatches() output.
> * Fix erroneous "internal error" if multiple patches have warnings.
> * Be more robust to new types of problems.

Yes - I'll add them to the commit message.

>
>
>> @@ -64,10 +64,14 @@ def CheckPatch(fname, verbose=False):
>>  'msg': text message
>>  'file' : filename
>>  'line': line number
>> +error_count: Number of errors
>> +warning_count: Number of warnings
>> +check_count: Number of checks
>>  lines: Number of lines
>> +stdout: Full output of checkpatch
>
> nit: Right above this it says you're returning a 4-tuple.  That's no
> longer true.  Could just remove the "4-".
>
> optional: I've found that returning big tuples like this is
> problematic.  Whenever you change the number of things returned you've
> got to modify any callers that call like:
>
> a, b, c, d = CheckPatch(...)
>
> to now be:
>
> a, b, c, d, e = CheckPatch(...)
>
> ...or never use the above syntax and use:
>
> result = CheckPatch(...)
> blah = result[0]
>
> Maybe use a namedtuple so that callers can use the result more cleanly?

Yes, we are well past the point of needing something like that, so will add it.

>
>
>>  if match:
>>  error_count = int(match.group(1))
>>  warning_count = int(match.group(2))
>> -lines = int(match.group(3))
>> +match_count = int(match.group(3))
>> +if len(match.groups()) == 4:
>> +   check_count = match_count
>> +   lines = int(match.group(4))
>
> I'm confused about match_count here.  What is it supposed to contain?
> I can't tell from the name of it.  It looks like a temporary variable
> holding either check_count or lines.  ...but you forget to assign
> "lines = match_count" in an "else" case so things are broken with old
> versions of checkpatch, right?

Yes - we don't currently use the return value. But I will fix it.

Regards,
Simon

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


[U-Boot] [PATCH v2 6/6] env: Add redundant env support to UBI env

2013-03-26 Thread Joe Hershberger
Allow the user to specify two UBI volumes to use for the environment

Signed-off-by: Joe Hershberger 
---
Changes in v2:
- Added curly braces on "multi-line" statements

 README|   6 +++
 common/env_ubi.c  | 117 ++
 include/environment.h |   3 ++
 tools/env/fw_env.c|   3 ++
 4 files changed, 129 insertions(+)

diff --git a/README b/README
index 1a389e2..f241d54 100644
--- a/README
+++ b/README
@@ -3457,6 +3457,12 @@ but it can not erase, write this NOR flash by SRIO or 
PCIE interface.
  Define this to the name of the volume that you want to store the
  environment in.
 
+   - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+ Define this to the name of another volume to store a second copy of
+ the environment in.  This will enable redundant environments in UBI.
+ It is assumed that both volumes are in the same MTD partition.
+
 - CONFIG_SYS_SPI_INIT_OFFSET
 
Defines offset to the initial SPI buffer area in DPRAM. The
diff --git a/common/env_ubi.c b/common/env_ubi.c
index 9a47fd2..ab647ff 100644
--- a/common/env_ubi.c
+++ b/common/env_ubi.c
@@ -47,6 +47,58 @@ int env_init(void)
 }
 
 #ifdef CONFIG_CMD_SAVEENV
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
+static unsigned char env_flags;
+
+int saveenv(void)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
+   ssize_t len;
+   char *res;
+
+   res = (char *)&env_new->data;
+   len = hexport_r(&env_htab, '\0', 0, &res, ENV_SIZE, 0, NULL);
+   if (len < 0) {
+   error("Cannot export environment: errno = %d\n", errno);
+   return 1;
+   }
+
+   if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+   printf("\n** Cannot find mtd partition \"%s\"\n",
+   CONFIG_ENV_UBI_PART);
+   return 1;
+   }
+
+   env_new->crc = crc32(0, env_new->data, ENV_SIZE);
+   env_new->flags = ++env_flags; /* increase the serial */
+
+   if (gd->env_valid == 1) {
+   puts("Writing to redundant UBI... ");
+   if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME_REDUND,
+   (void *)env_new, CONFIG_ENV_SIZE)) {
+   printf("\n** Unable to write env to %s:%s **\n",
+   CONFIG_ENV_UBI_PART,
+   CONFIG_ENV_UBI_VOLUME_REDUND);
+   return 1;
+   }
+   } else {
+   puts("Writing to UBI... ");
+   if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME,
+   (void *)env_new, CONFIG_ENV_SIZE)) {
+   printf("\n** Unable to write env to %s:%s **\n",
+   CONFIG_ENV_UBI_PART,
+   CONFIG_ENV_UBI_VOLUME);
+   return 1;
+   }
+   }
+
+   puts("done\n");
+
+   gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+
+   return 0;
+}
+#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
 int saveenv(void)
 {
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
@@ -78,8 +130,72 @@ int saveenv(void)
puts("done\n");
return 0;
 }
+#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
 #endif /* CONFIG_CMD_SAVEENV */
 
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
+void env_relocate_spec(void)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
+   ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
+   int crc1_ok = 0, crc2_ok = 0;
+   env_t *ep, *tmp_env1, *tmp_env2;
+
+   tmp_env1 = (env_t *)env1_buf;
+   tmp_env2 = (env_t *)env2_buf;
+
+   if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+   printf("\n** Cannot find mtd partition \"%s\"\n",
+   CONFIG_ENV_UBI_PART);
+   set_default_env(NULL);
+   return;
+   }
+
+   if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
+   CONFIG_ENV_SIZE)) {
+   printf("\n** Unable to read env from %s:%s **\n",
+   CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
+   }
+
+   if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME_REDUND, (void *)tmp_env2,
+   CONFIG_ENV_SIZE)) {
+   printf("\n** Unable to read redundant env from %s:%s **\n",
+   CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME_REDUND);
+   }
+
+   crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
+   crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc;
+
+   if (!crc1_ok && !crc2_ok) {
+   set_default_env("!bad CRC");
+   return;
+   } else if (crc1_ok && !crc2_ok) {
+   gd->env_valid = 1;
+   } else if (!crc1_ok && crc2_ok) {
+   gd->env_valid = 2;
+   } else {
+   /* both ok - check serial */
+   if (tmp_env1->flags == 255 && tmp_env2->flags == 0)
+   gd->env_valid = 2;
+   else if (tmp_env2->fl

[U-Boot] [PATCH v2 4/6] mtd: Make mtdparts work with pre-reloc env

2013-03-26 Thread Joe Hershberger
The env in UBI needs to look up the mtd partition as part of relocation,
which happens before relocation.  Make the mtdparts code capable of
working on the default env to start with.

The code tries to set values in the env as well, but again, the env
isn't there yet, so add a check to setenv to not allow sets before the
env is relocated.

Signed-off-by: Joe Hershberger 
---
Changes in v2: None

 common/cmd_mtdparts.c | 23 +--
 common/cmd_nvedit.c   |  4 
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 06fc171..e72dc38 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -106,6 +106,8 @@
 #include 
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* special size referring to all the remaining space in a partition */
 #define SIZE_REMAINING 0x
 
@@ -1539,6 +1541,7 @@ static int parse_mtdparts(const char *const mtdparts)
const char *p = mtdparts;
struct mtd_device *dev;
int err = 1;
+   char tmp_parts[MTDPARTS_MAXLEN];
 
debug("\n---parse_mtdparts---\nmtdparts = %s\n\n", p);
 
@@ -1549,7 +1552,12 @@ static int parse_mtdparts(const char *const mtdparts)
}
 
/* re-read 'mtdparts' variable, mtd_devices_init may be updating env */
-   p = getenv("mtdparts");
+   if (gd->flags & GD_FLG_ENV_READY) {
+   p = getenv("mtdparts");
+   } else {
+   p = tmp_parts;
+   getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN);
+   }
 
if (strncmp(p, "mtdparts=", 9) != 0) {
printf("mtdparts variable doesn't start with 'mtdparts='\n");
@@ -1707,6 +1715,7 @@ int mtdparts_init(void)
const char *current_partition;
int ids_changed;
char tmp_ep[PARTITION_MAXLEN];
+   char tmp_parts[MTDPARTS_MAXLEN];
 
debug("\n---mtdparts_init---\n");
if (!initialized) {
@@ -1720,7 +1729,17 @@ int mtdparts_init(void)
 
/* get variables */
ids = getenv("mtdids");
-   parts = getenv("mtdparts");
+   /*
+* The mtdparts variable tends to be long. If we need to access it
+* before the env is relocated, then we need to use our own stack
+* buffer.  gd->env_buf will be too small.
+*/
+   if (gd->flags & GD_FLG_ENV_READY) {
+   parts = getenv("mtdparts");
+   } else {
+   parts = tmp_parts;
+   getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN);
+   }
current_partition = getenv("partition");
 
/* save it for later parsing, cannot rely on current partition pointer
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 7633f0c..c7c6440 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -273,6 +273,10 @@ int setenv(const char *varname, const char *varvalue)
 {
const char * const argv[4] = { "setenv", varname, varvalue, NULL };
 
+   /* before import into hashtable */
+   if (!(gd->flags & GD_FLG_ENV_READY))
+   return 1;
+
if (varvalue == NULL || varvalue[0] == '\0')
return _do_env_set(0, 2, (char * const *)argv);
else
-- 
1.7.11.5

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


[U-Boot] [PATCH v2 1/6] ubi: Fix broken cleanup code in attach_by_scanning

2013-03-26 Thread Joe Hershberger
The unwind code was not reversing operations correctly and was causing
a hang on any error condition.

Signed-off-by: Joe Hershberger 
---
Changes in v2:
- Fixed error handling bug that prevents fail-over to default env on error

 drivers/mtd/ubi/build.c | 8 
 drivers/mtd/ubi/wl.c| 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index d144ac2..a708162 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -478,19 +478,19 @@ static int attach_by_scanning(struct ubi_device *ubi)
 
err = ubi_eba_init_scan(ubi, si);
if (err)
-   goto out_wl;
+   goto out_vtbl;
 
err = ubi_wl_init_scan(ubi, si);
if (err)
-   goto out_vtbl;
+   goto out_eba;
 
ubi_scan_destroy_si(si);
return 0;
 
+out_eba:
+   ubi_eba_close(ubi);
 out_vtbl:
vfree(ubi->vtbl);
-out_wl:
-   ubi_wl_close(ubi);
 out_si:
ubi_scan_destroy_si(si);
return err;
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 88b867a..d1ba722 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1538,6 +1538,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct 
ubi_scan_info *si)
if (ubi->avail_pebs < WL_RESERVED_PEBS) {
ubi_err("no enough physical eraseblocks (%d, need %d)",
ubi->avail_pebs, WL_RESERVED_PEBS);
+   err = -ENOSPC;
goto out_free;
}
ubi->avail_pebs -= WL_RESERVED_PEBS;
-- 
1.7.11.5

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


[U-Boot] [PATCH v2 0/6] Add support for using an UBI volume for environment

2013-03-26 Thread Joe Hershberger
NAND is not good at handling absolute addresses to sectors for storing
particular data.  The current implementation of the NAND env support
works around this in several ways such as storing a pointer to the
sector in the OOB of the first sector (interferes with some CRC) or
supporting a range of sectors (which unless it is huge is not
guaranteed to be safe).  None of these options address wear-leveling
concerns or bad block handling.

Accessing the u-boot env from UBI eliminates these concerns.  However,
it does require some of the basic settings for finding the UBI env to
be in the default u-boot env.

Changes in v2:
- Fixed error handling bug that prevents fail-over to default env on error
- Added curly braces on "multi-line" statements
- Added extern consistently in header
- Cleaned up the msg print silencing
- Added curly braces on "multi-line" statements

Joe Hershberger (6):
  ubi: Fix broken cleanup code in attach_by_scanning
  ubi: Expose a few simple functions from the cmd_ubi
  ubi: ubifs: Turn off verbose prints
  mtd: Make mtdparts work with pre-reloc env
  env: Add support for UBI environment
  env: Add redundant env support to UBI env

 README  |  21 +
 common/Makefile |   1 +
 common/cmd_mtdparts.c   |  23 -
 common/cmd_nvedit.c |   7 +-
 common/cmd_ubi.c| 153 ++---
 common/env_ubi.c| 220 
 drivers/mtd/mtdpart.c   |  14 +--
 drivers/mtd/ubi/build.c |   8 +-
 drivers/mtd/ubi/ubi.h   |   4 +
 drivers/mtd/ubi/wl.c|   1 +
 fs/ubifs/ubifs.h|   4 +
 include/environment.h   |  18 
 include/ubi_uboot.h |   3 +
 tools/env/fw_env.c  |   6 +-
 14 files changed, 402 insertions(+), 81 deletions(-)
 create mode 100644 common/env_ubi.c

-- 
1.7.11.5

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


[U-Boot] [PATCH v2 5/6] env: Add support for UBI environment

2013-03-26 Thread Joe Hershberger
UBI is a better place for the environment on NAND devices because it
handles wear-leveling and bad blocks.

Gluebi is needed in Linux to access the env as an MTD partition.

Signed-off-by: Joe Hershberger 
---
Changes in v2: None

 README|  15 
 common/Makefile   |   1 +
 common/cmd_nvedit.c   |   3 +-
 common/env_ubi.c  | 103 ++
 include/environment.h |  15 
 tools/env/fw_env.c|   3 +-
 6 files changed, 138 insertions(+), 2 deletions(-)
 create mode 100644 common/env_ubi.c

diff --git a/README b/README
index d8cb394..1a389e2 100644
--- a/README
+++ b/README
@@ -3442,6 +3442,21 @@ but it can not erase, write this NOR flash by SRIO or 
PCIE interface.
environment. If redundant environment is used, it will be copied to
CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE.
 
+- CONFIG_ENV_IS_IN_UBI:
+
+   Define this if you have an UBI volume that you want to use for the
+   environment.  This has the benefit of wear-leveling the environment
+   accesses, which is important on NAND.
+
+   - CONFIG_ENV_UBI_PART:
+
+ Define this to a string that is the mtd partition containing the UBI.
+
+   - CONFIG_ENV_UBI_VOLUME:
+
+ Define this to the name of the volume that you want to store the
+ environment in.
+
 - CONFIG_SYS_SPI_INIT_OFFSET
 
Defines offset to the initial SPI buffer area in DPRAM. The
diff --git a/common/Makefile b/common/Makefile
index 54fcc81..9ff59c5 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -62,6 +62,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
 COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
 COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
 COBJS-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
+COBJS-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
 COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
 
 # command
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index c7c6440..960b22c 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -62,9 +62,10 @@ DECLARE_GLOBAL_DATA_PTR;
!defined(CONFIG_ENV_IS_IN_ONENAND)  && \
!defined(CONFIG_ENV_IS_IN_SPI_FLASH)&& \
!defined(CONFIG_ENV_IS_IN_REMOTE)   && \
+   !defined(CONFIG_ENV_IS_IN_UBI)  && \
!defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|NVRAM|MMC|FAT|REMOTE} or CONFIG_ENV_IS_NOWHERE
+SPI_FLASH|NVRAM|MMC|FAT|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
 
 /*
diff --git a/common/env_ubi.c b/common/env_ubi.c
new file mode 100644
index 000..9a47fd2
--- /dev/null
+++ b/common/env_ubi.c
@@ -0,0 +1,103 @@
+/*
+ * (c) Copyright 2012 by National Instruments,
+ *Joe Hershberger 
+ *
+ * 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 
+#undef crc32
+
+char *env_name_spec = "UBI";
+
+env_t *env_ptr;
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int env_init(void)
+{
+   /* use default */
+   gd->env_addr = (ulong)&default_environment[0];
+   gd->env_valid = 1;
+
+   return 0;
+}
+
+#ifdef CONFIG_CMD_SAVEENV
+int saveenv(void)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
+   ssize_t len;
+   char *res;
+
+   res = (char *)&env_new->data;
+   len = hexport_r(&env_htab, '\0', 0, &res, ENV_SIZE, 0, NULL);
+   if (len < 0) {
+   error("Cannot export environment: errno = %d\n", errno);
+   return 1;
+   }
+
+   if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+   printf("\n** Cannot find mtd partition \"%s\"\n",
+   CONFIG_ENV_UBI_PART);
+   return 1;
+   }
+
+   env_new->crc = crc32(0, env_new->data, ENV_SIZE);
+
+   if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME, (void *)env_new,
+   CONFIG_ENV_SIZE)) {
+   printf("\n** Unable to write env to %s:%s **\n",
+   CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
+   return 1;
+   }
+
+   puts("done\n");
+   return 0;
+}
+#endif /* CONFIG_CMD_SAVEENV */
+
+void env_relocate_spec(void)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, buf

[U-Boot] [PATCH v2 2/6] ubi: Expose a few simple functions from the cmd_ubi

2013-03-26 Thread Joe Hershberger
Part, Read, and Write functionality that will be used by env_ubi.

Signed-off-by: Joe Hershberger 
---
Changes in v2:
- Added curly braces on "multi-line" statements
- Added extern consistently in header

 common/cmd_ubi.c| 150 +---
 include/ubi_uboot.h |   3 ++
 2 files changed, 86 insertions(+), 67 deletions(-)

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 35b1d31..7ca3bfa 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -263,7 +263,7 @@ out_err:
return err;
 }
 
-static int ubi_volume_write(char *volume, void *buf, size_t size)
+int ubi_volume_write(char *volume, void *buf, size_t size)
 {
int err = 1;
int rsvd_bytes = 0;
@@ -308,12 +308,10 @@ static int ubi_volume_write(char *volume, void *buf, 
size_t size)
ubi_gluebi_updated(vol);
}
 
-   printf("%d bytes written to volume %s\n", size, volume);
-
return 0;
 }
 
-static int ubi_volume_read(char *volume, char *buf, size_t size)
+int ubi_volume_read(char *volume, char *buf, size_t size)
 {
int err, lnum, off, len, tbuf_size;
void *tbuf;
@@ -325,8 +323,6 @@ static int ubi_volume_read(char *volume, char *buf, size_t 
size)
if (vol == NULL)
return ENODEV;
 
-   printf("Read %d bytes from volume %s to %p\n", size, volume, buf);
-
if (vol->updating) {
printf("updating");
return EBUSY;
@@ -431,26 +427,82 @@ static int ubi_dev_scan(struct mtd_info *info, char 
*ubidev,
return 0;
 }
 
-static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int ubi_part(char *part_name, const char *vid_header_offset)
 {
-   size_t size = 0;
-   ulong addr = 0;
int err = 0;
-
-   if (argc < 2)
-   return CMD_RET_USAGE;
+   char mtd_dev[16];
+   struct mtd_device *dev;
+   struct part_info *part;
+   u8 pnum;
 
if (mtdparts_init() != 0) {
printf("Error initializing mtdparts!\n");
return 1;
}
 
+#ifdef CONFIG_CMD_UBIFS
+   /*
+* Automatically unmount UBIFS partition when user
+* changes the UBI device. Otherwise the following
+* UBIFS commands will crash.
+*/
+   if (ubifs_is_mounted())
+   cmd_ubifs_umount();
+#endif
+
+   /* todo: get dev number for NAND... */
+   ubi_dev.nr = 0;
+
+   /*
+* Call ubi_exit() before re-initializing the UBI subsystem
+*/
+   if (ubi_initialized) {
+   ubi_exit();
+   del_mtd_partitions(ubi_dev.mtd_info);
+   }
+
+   /*
+* Search the mtd device number where this partition
+* is located
+*/
+   if (find_dev_and_part(part_name, &dev, &pnum, &part)) {
+   printf("Partition %s not found!\n", part_name);
+   return 1;
+   }
+   sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
+   ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
+   if (IS_ERR(ubi_dev.mtd_info)) {
+   printf("Partition %s not found on device %s!\n", part_name,
+   mtd_dev);
+   return 1;
+   }
+
+   ubi_dev.selected = 1;
+
+   strcpy(ubi_dev.part_name, part_name);
+   err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
+   vid_header_offset);
+   if (err) {
+   printf("UBI init error %d\n", err);
+   ubi_dev.selected = 0;
+   return err;
+   }
+
+   ubi = ubi_devices[0];
+
+   return 0;
+}
+
+static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   size_t size = 0;
+   ulong addr = 0;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
if (strcmp(argv[1], "part") == 0) {
-   char mtd_dev[16];
-   struct mtd_device *dev;
-   struct part_info *part;
const char *vid_header_offset = NULL;
-   u8 pnum;
 
/* Print current partition */
if (argc == 2) {
@@ -467,58 +519,10 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[])
if (argc < 3)
return CMD_RET_USAGE;
 
-#ifdef CONFIG_CMD_UBIFS
-   /*
-* Automatically unmount UBIFS partition when user
-* changes the UBI device. Otherwise the following
-* UBIFS commands will crash.
-*/
-   if (ubifs_is_mounted())
-   cmd_ubifs_umount();
-#endif
-
-   /* todo: get dev number for NAND... */
-   ubi_dev.nr = 0;
-
-   /*
-* Call ubi_exit() before re-initializing the UBI subsystem
-*/
-   if (ubi_initialized) {
-   ubi_exit();
-   del_mtd_partitions(ubi_dev

[U-Boot] [PATCH v2 3/6] ubi: ubifs: Turn off verbose prints

2013-03-26 Thread Joe Hershberger
The prints are out of control.  SILENCE!

Signed-off-by: Joe Hershberger 
---
Changes in v2:
- Cleaned up the msg print silencing

 common/cmd_ubi.c  |  3 +++
 drivers/mtd/mtdpart.c | 14 --
 drivers/mtd/ubi/ubi.h |  4 
 fs/ubifs/ubifs.h  |  4 
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 7ca3bfa..70a8019 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -23,6 +23,9 @@
 #include 
 #include 
 
+#undef ubi_msg
+#define ubi_msg(fmt, ...) printk(KERN_NOTICE "UBI: " fmt "\n", ##__VA_ARGS__)
+
 #define DEV_TYPE_NONE  0
 #define DEV_TYPE_NAND  1
 #define DEV_TYPE_ONENAND   2
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 96dcda2..2c60293 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -347,16 +347,18 @@ static struct mtd_part *add_one_partition(struct mtd_info 
*master,
if (mtd_mod_by_eb(cur_offset, master) != 0) {
/* Round up to next erasesize */
slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) 
* master->erasesize;
-   printk(KERN_NOTICE "Moving partition %d: "
-  "0x%012llx -> 0x%012llx\n", partno,
-  (unsigned long long)cur_offset, (unsigned long 
long)slave->offset);
+   debug("Moving partition %d: 0x%012llx -> 0x%012llx\n",
+   partno, (unsigned long long)cur_offset,
+   (unsigned long long)slave->offset);
}
}
if (slave->mtd.size == MTDPART_SIZ_FULL)
slave->mtd.size = master->size - slave->offset;
 
-   printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long 
long)slave->offset,
-   (unsigned long long)(slave->offset + slave->mtd.size), 
slave->mtd.name);
+   debug("0x%012llx-0x%012llx : \"%s\"\n",
+   (unsigned long long)slave->offset,
+   (unsigned long long)(slave->offset + slave->mtd.size),
+   slave->mtd.name);
 
/* let's do some sanity checks */
if (slave->offset >= master->size) {
@@ -463,7 +465,7 @@ int add_mtd_partitions(struct mtd_info *master,
if (mtd_partitions.next == NULL)
INIT_LIST_HEAD(&mtd_partitions);
 
-   printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, 
master->name);
+   debug("Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
 
for (i = 0; i < nbparts; i++) {
slave = add_one_partition(master, parts + i, i, cur_offset);
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 14c3a5f..e2c416f 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -59,7 +59,11 @@
 #define UBI_NAME_STR "ubi"
 
 /* Normal UBI messages */
+#if DEBUG
 #define ubi_msg(fmt, ...) printk(KERN_NOTICE "UBI: " fmt "\n", ##__VA_ARGS__)
+#else
+#define ubi_msg(fmt, ...)
+#endif
 /* UBI warning messages */
 #define ubi_warn(fmt, ...) printk(KERN_WARNING "UBI warning: %s: " fmt "\n", \
  __func__, ##__VA_ARGS__)
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 0af471a..11dd170 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -463,8 +463,12 @@ static inline ino_t parent_ino(struct dentry *dentry)
 #define UBIFS_VERSION 1
 
 /* Normal UBIFS messages */
+#if DEBUG
 #define ubifs_msg(fmt, ...) \
printk(KERN_NOTICE "UBIFS: " fmt "\n", ##__VA_ARGS__)
+#else
+#define ubifs_msg(fmt, ...)
+#endif
 /* UBIFS error messages */
 #define ubifs_err(fmt, ...)  \
printk(KERN_ERR "UBIFS error (pid %d): %s: " fmt "\n", 0, \
-- 
1.7.11.5

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


[U-Boot] [PATCH v3 7/7] imx: Document fuse assignments for MAC addresses

2013-03-26 Thread Benoßt Thébaudeau
Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - New patch.

Changes in v2: None

 doc/README.imx25 |   10 ++
 doc/README.imx27 |   10 ++
 doc/README.imx5  |6 ++
 doc/README.imx6  |   10 ++
 4 files changed, 36 insertions(+)
 create mode 100644 doc/README.imx25
 create mode 100644 doc/README.imx27
 create mode 100644 doc/README.imx6

diff --git a/doc/README.imx25 b/doc/README.imx25
new file mode 100644
index 000..0ca21b6
--- /dev/null
+++ b/doc/README.imx25
@@ -0,0 +1,10 @@
+U-Boot for Freescale i.MX25
+
+This file contains information for the port of U-Boot to the Freescale i.MX25
+SoC.
+
+1. CONVENTIONS FOR FUSE ASSIGNMENTS
+---
+
+1.1 MAC Address: It is stored in the words 26 to 31 of fuse bank 0, using the
+natural MAC byte order (i.e. MSB first).
diff --git a/doc/README.imx27 b/doc/README.imx27
new file mode 100644
index 000..6f92cb4
--- /dev/null
+++ b/doc/README.imx27
@@ -0,0 +1,10 @@
+U-Boot for Freescale i.MX27
+
+This file contains information for the port of U-Boot to the Freescale i.MX27
+SoC.
+
+1. CONVENTIONS FOR FUSE ASSIGNMENTS
+---
+
+1.1 MAC Address: It is stored in the words 4 to 9 of fuse bank 0, using the
+reversed MAC byte order (i.e. LSB first).
diff --git a/doc/README.imx5 b/doc/README.imx5
index e08941e..c5312b6 100644
--- a/doc/README.imx5
+++ b/doc/README.imx5
@@ -20,3 +20,9 @@ i.MX5x SoCs.
 This option should be enabled for boards having a SYS_ON_OFF_CTL signal
 connected to GPIO1[23] and triggering the MAIN_PWR_ON signal like in the
 reference designs.
+
+2. CONVENTIONS FOR FUSE ASSIGNMENTS
+---
+
+2.1 MAC Address: It is stored in the words 9 to 14 of fuse bank 1, using the
+natural MAC byte order (i.e. MSB first).
diff --git a/doc/README.imx6 b/doc/README.imx6
new file mode 100644
index 000..d20c3e1
--- /dev/null
+++ b/doc/README.imx6
@@ -0,0 +1,10 @@
+U-Boot for Freescale i.MX6x
+
+This file contains information for the port of U-Boot to the Freescale i.MX6x
+SoCs.
+
+1. CONVENTIONS FOR FUSE ASSIGNMENTS
+---
+
+1.1 MAC Address: It is stored in fuse bank 4, with the 32 lsbs in word 2 and 
the
+16 msbs in word 3.
-- 
1.7.10.4

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


[U-Boot] [PATCH v3 5/7] mpc: iim: Switch to common fsl_iim

2013-03-26 Thread Benoßt Thébaudeau
Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3: None
Changes in v2:
 - Rebase against latest master.

 arch/powerpc/cpu/mpc512x/Makefile   |1 -
 arch/powerpc/cpu/mpc512x/iim.c  |  394 ---
 board/davedenx/aria/aria.c  |2 +-
 board/esd/mecp5123/mecp5123.c   |2 +-
 board/freescale/mpc5121ads/mpc5121ads.c |2 +-
 board/pdm360ng/pdm360ng.c   |2 +-
 include/configs/aria.h  |2 +-
 include/configs/mecp5123.h  |2 +-
 include/configs/mpc5121ads.h|2 +-
 9 files changed, 7 insertions(+), 402 deletions(-)
 delete mode 100644 arch/powerpc/cpu/mpc512x/iim.c

diff --git a/arch/powerpc/cpu/mpc512x/Makefile 
b/arch/powerpc/cpu/mpc512x/Makefile
index b53232f..4f4c9ec 100644
--- a/arch/powerpc/cpu/mpc512x/Makefile
+++ b/arch/powerpc/cpu/mpc512x/Makefile
@@ -38,7 +38,6 @@ COBJS-y += serial.o
 COBJS-y += speed.o
 COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
 COBJS-$(CONFIG_CMD_IDE) += ide.o
-COBJS-$(CONFIG_IIM) += iim.o
 COBJS-$(CONFIG_PCI) += pci.o
 
 # Stub implementations of cache management functions for USB
diff --git a/arch/powerpc/cpu/mpc512x/iim.c b/arch/powerpc/cpu/mpc512x/iim.c
deleted file mode 100644
index abec8f6..000
--- a/arch/powerpc/cpu/mpc512x/iim.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright 2008 Silicon Turnkey Express, Inc.
- * Martha Marx 
- *
- * ADS5121 IIM (Fusebox) Interface
- *
- * 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 
-
-#ifdef CONFIG_CMD_FUSE
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static char cur_bank = '1';
-
-char *iim_err_msg(u32 err)
-{
-   static char *IIM_errs[] = {
-   "Parity Error in cache",
-   "Explicit Sense Cycle Error",
-   "Write to Locked Register Error",
-   "Read Protect Error",
-   "Override Protect Error",
-   "Write Protect Error"};
-
-   int i;
-
-   if (!err)
-   return "";
-   for (i = 1; i < 8; i++)
-   if (err & (1 << i))
-   printf("IIM - %s\n", IIM_errs[i-1]);
-   return "";
-}
-
-int in_range(int n, int min, int max, char *err, char *usg)
-{
-   if (n > max || n < min) {
-   printf(err);
-   printf("Usage:\n%s\n", usg);
-   return 0;
-   }
-   return 1;
-}
-
-int ads5121_fuse_read(int bank, int fstart, int num)
-{
-   iim512x_t *iim = &((immap_t *) CONFIG_SYS_IMMR)->iim;
-   u32 *iim_fb, dummy;
-   int f, ctr;
-
-   out_be32(&iim->err, in_be32(&iim->err));
-   if (bank == 0)
-   iim_fb = (u32 *)&(iim->fbac0);
-   else
-   iim_fb = (u32 *)&(iim->fbac1);
-/* try a read to see if Read Protect is set */
-   dummy = in_be32(&iim_fb[0]);
-   if (in_be32(&iim->err) & IIM_ERR_RPE) {
-   printf("\tRead protect fuse is set\n");
-   out_be32(&iim->err, IIM_ERR_RPE);
-   return 0;
-   }
-   printf("Reading Bank %d cache\n", bank);
-   for (f = fstart, ctr = 0; num > 0; ctr++, num--, f++) {
-   if (ctr % 4 == 0)
-   printf("F%2d:", f);
-   printf("\t%#04x", (u8)(iim_fb[f]));
-   if (ctr % 4 == 3)
-   printf("\n");
-   }
-   if (ctr % 4 != 0)
-   printf("\n");
-}
-
-int ads5121_fuse_override(int bank, int f, u8 val)
-{
-   iim512x_t *iim = &((immap_t *) CONFIG_SYS_IMMR)->iim;
-   u32 *iim_fb;
-   u32 iim_stat;
-   int i;
-
-   out_be32(&iim->err, in_be32(&iim->err));
-   if (bank == 0)
-   iim_fb = (u32 *)&(iim->fbac0);
-   else
-   iim_fb = (u32 *)&(iim->fbac1);
-/* try a read to see if Read Protect is set */
-   iim_stat = in_be32(&iim_fb[0]);
-   if (in_be32(&iim->err) & IIM_ERR_RPE) {
-   printf("Read protect fuse is set on bank %d;"
-   "Override protect may also be set\n", bank);
-   printf("An attempt will be made to override\n");
-   out_be32(&iim->err, IIM_ERR_RPE);
-   }
-   if (iim_stat & IIM_FBAC_FBOP) {
-   printf("Override protect 

[U-Boot] [PATCH v3 3/7] Add fuse API and commands

2013-03-26 Thread Benoßt Thébaudeau
This can be useful for fuse-like hardware, OTP SoC options, etc.

Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - Rebase against latest u-boot-imx/master.
 - Update copyright years.
 - Rename the "ovride" command to "override" as it is nicer to read.
 - For obvious safety reasons, ask the user to confirm each fuse programming
   operation, unless the '-y' command line option was given, which can be used
   in scripts.
 - Rename "row" to "word" since it is less confusing and it is vocabulary common
   to iim and ocotp in the reference manuals.
 - Add doc/README.fuse.

Changes in v2:
 - Rebase against latest master.

 README   |1 +
 common/Makefile  |1 +
 common/cmd_fuse.c|  214 ++
 doc/README.fuse  |   73 
 include/config_cmd_all.h |1 +
 include/fuse.h   |   49 +++
 6 files changed, 339 insertions(+)
 create mode 100644 common/cmd_fuse.c
 create mode 100644 doc/README.fuse
 create mode 100644 include/fuse.h

diff --git a/README b/README
index e45ae4a..14ab9df 100644
--- a/README
+++ b/README
@@ -844,6 +844,7 @@ The following options need to be configured:
CONFIG_CMD_FDOS * Dos diskette Support
CONFIG_CMD_FLASH  flinfo, erase, protect
CONFIG_CMD_FPGA   FPGA device initialization support
+   CONFIG_CMD_FUSE   Device fuse support
CONFIG_CMD_GETTIME  * Get time since boot
CONFIG_CMD_GO   * the 'go' command (exec code)
CONFIG_CMD_GREPENV  * search environment
diff --git a/common/Makefile b/common/Makefile
index 719fc23..7207ad7 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -105,6 +105,7 @@ ifdef CONFIG_FPGA
 COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o
 endif
 COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o
+COBJS-$(CONFIG_CMD_FUSE) += cmd_fuse.o
 COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o
 COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
 COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
diff --git a/common/cmd_fuse.c b/common/cmd_fuse.c
new file mode 100644
index 000..862efda
--- /dev/null
+++ b/common/cmd_fuse.c
@@ -0,0 +1,214 @@
+/*
+ * (C) Copyright 2009-2013 ADVANSEE
+ * Benoßt Thébaudeau 
+ *
+ * Based on the mpc512x iim code:
+ * Copyright 2008 Silicon Turnkey Express, Inc.
+ * Martha Marx 
+ *
+ * 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 
+
+static int strtou32(const char *str, unsigned int base, u32 *result)
+{
+   char *ep;
+
+   *result = simple_strtoul(str, &ep, base);
+   if (ep == str || *ep != '\0')
+   return -EINVAL;
+
+   return 0;
+}
+
+static int confirm_prog(void)
+{
+   puts("Warning: Programming fuses is an irreversible operation!\n"
+   " This may brick your system.\n"
+   " Use this command only if you are sure of "
+   "what you are doing!\n"
+   "\nReally perform this fuse programming? \n");
+
+   if (getc() == 'y') {
+   int c;
+
+   putc('y');
+   c = getc();
+   putc('\n');
+   if (c == '\r')
+   return 1;
+   }
+
+   puts("Fuse programming aborted\n");
+   return 0;
+}
+
+static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+   const char *op = argc >= 2 ? argv[1] : NULL;
+   int confirmed = argc >= 3 && !strcmp(argv[2], "-y");
+   u32 bank, word, bit, cnt, val;
+   int ret, i;
+
+   argc -= 2 + confirmed;
+   argv += 2 + confirmed;
+
+   if (argc < 2 || strtou32(argv[0], 0, &bank) ||
+   strtou32(argv[1], 0, &word))
+   return CMD_RET_USAGE;
+
+   if (!strcmp(op, "read.bit")) {
+   if (argc != 3 || strtou32(argv[2], 0, &bit))
+   return CMD_RET_USAGE;
+
+   printf("Reading bank %u word 0x%.8x bit %u: ", bank, word, bit);
+   ret = fuse_read_bit(bank, word, bit, &val);
+   if (ret)
+   goto err;
+
+  

[U-Boot] [PATCH v3 6/7] mx51evk: Enable support for iim

2013-03-26 Thread Benoßt Thébaudeau
This allows to test the iim driver in the mainline tree.

Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - New patch.

Changes in v2: None

 include/configs/mx51evk.h |4 
 1 file changed, 4 insertions(+)

diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index cb3d938..cdd72cc 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -53,6 +53,10 @@
 /*
  * Hardware drivers
  */
+#define CONFIG_FSL_IIM
+#define CONFIG_SYS_FSL_IIM_ADDRIIM_BASE_ADDR
+#define CONFIG_CMD_FUSE
+
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 #define CONFIG_MXC_GPIO
-- 
1.7.10.4

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


[U-Boot] [PATCH v3 4/7] Add fsl_iim driver

2013-03-26 Thread Benoßt Thébaudeau
Add a fsl_iim driver common to i.MX and MPC.

Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - Update copyright years.
 - Rename "row" to "word" since it is less confusing and it is vocabulary common
   to iim and ocotp in the reference manuals.
 - Add doc/README.fsl_iim.

Changes in v2:
 - Rebase against latest master.

 doc/README.fsl_iim |   51 
 drivers/misc/Makefile  |1 +
 drivers/misc/fsl_iim.c |  318 
 3 files changed, 370 insertions(+)
 create mode 100644 doc/README.fsl_iim
 create mode 100644 drivers/misc/fsl_iim.c

diff --git a/doc/README.fsl_iim b/doc/README.fsl_iim
new file mode 100644
index 000..2472521
--- /dev/null
+++ b/doc/README.fsl_iim
@@ -0,0 +1,51 @@
+Driver implementing the fuse API for Freescale's IC Identification Module (IIM)
+
+This IP can be found on the following SoCs:
+ - MPC512x,
+ - i.MX25,
+ - i.MX27,
+ - i.MX31,
+ - i.MX35,
+ - i.MX51,
+ - i.MX53.
+
+The section numbers in this file refer to the i.MX25 Reference Manual.
+
+A fuse word contains 8 fuse bit slots, as explained in 30.4.2.2.1.
+
+A bank contains 256 fuse word slots, as shown by the memory map in 30.3.1.
+
+Some fuse bit or word slots may not have the corresponding fuses actually
+implemented in the fusebox.
+
+See the README files of the SoCs using this driver in order to know the
+conventions used by U-Boot to store some specific data in the fuses, e.g. MAC
+addresses.
+
+Fuse operations:
+
+   Read
+  Read operations are implemented as read accesses to the shadow registers,
+  using "Word y of Bank x" from the register summary in 30.3.2. This is
+  explained in detail in 30.4.5.1.
+
+   Sense
+  Sense operations are implemented as explained in 30.4.5.2.
+
+   Program
+  Program operations are implemented as explained in 30.4.5.3. Following
+  this operation, the shadow registers are reloaded by the hardware (not
+  immediately, but this does not make any difference for a user reading
+  these registers).
+
+   Override
+  Override operations are implemented as write accesses to the shadow
+  registers, as explained in 30.4.5.4.
+
+Configuration:
+
+   CONFIG_FSL_IIM
+  Define this to enable the fsl_iim driver.
+
+   CONFIG_SYS_FSL_IIM_ADDR
+  This should be defined to the base address of the IIM IP.
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 8cdc3b6..c6dadd4 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -28,6 +28,7 @@ LIB   := $(obj)libmisc.o
 COBJS-$(CONFIG_ALI152X) += ali512x.o
 COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
+COBJS-$(CONFIG_FSL_IIM) += fsl_iim.o
 COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
 COBJS-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
new file mode 100644
index 000..33b9c9a
--- /dev/null
+++ b/drivers/misc/fsl_iim.c
@@ -0,0 +1,318 @@
+/*
+ * (C) Copyright 2009-2013 ADVANSEE
+ * Benoßt Thébaudeau 
+ *
+ * Based on the mpc512x iim code:
+ * Copyright 2008 Silicon Turnkey Express, Inc.
+ * Martha Marx 
+ *
+ * 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 
+
+/* FSL IIM-specific constants */
+#define STAT_BUSY  0x80
+#define STAT_PRGD  0x02
+#define STAT_SNSD  0x01
+
+#define STATM_PRGD_M   0x02
+#define STATM_SNSD_M   0x01
+
+#define ERR_PRGE   0x80
+#define ERR_WPE0x40
+#define ERR_OPE0x20
+#define ERR_RPE0x10
+#define ERR_WLRE   0x08
+#define ERR_SNSE   0x04
+#define ERR_PARITYE0x02
+
+#define EMASK_PRGE_M   0x80
+#define EMASK_WPE_M0x40
+#define EMASK_OPE_M0x20
+#define EMASK_RPE_M0x10
+#define EMASK_WLRE_M   0x08
+#define EMASK_SNSE_M   0x04
+#define EMASK_PARITYE_M0x02
+
+#define FCTL_DPC   0x80
+#define FCTL_PRG_LENGTH_MASK   0x70
+#define FCTL_ESNS_N0x08
+#define FCTL_ESNS_00x04
+#define 

[U-Boot] [PATCH v3 1/7] imx: Homogenize and fix fuse register definitions

2013-03-26 Thread Benoßt Thébaudeau
IIM:
 - Homogenize prg_p naming (the reference manuals are not always self-consistent
   for that).
 - Add missing SCSx and bank registers.
 - Fix the number of banks on i.MX53.

OCOTP:
 - Rename iim to ocotp in order to avoid confusion.
 - Rename fuse_data to read_fuse_data, and sticky to sw_sticky, according to the
   reference manual.
 - Merge the existing spinoff gp1 fuse definition on i.MX6.
 - Fix the number of banks on i.MX6.

Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - Rebase against latest u-boot-imx/master.
 - Fix the number of banks on i.MX6.
 - Rename iim to ocotp on i.MX6 in order to avoid confusion, and merge in the
   existing gp1 fuse definition.
 - Rename fuse_data to read_fuse_data, and sticky to sw_sticky, according to the
   reference manual.

Changes in v2:
 - Rebase against latest master.

 arch/arm/cpu/armv7/mx6/soc.c  |4 ++--
 arch/arm/include/asm/arch-mx25/imx-regs.h |8 ++--
 arch/arm/include/asm/arch-mx27/imx-regs.h |2 +-
 arch/arm/include/asm/arch-mx31/imx-regs.h |9 +++--
 arch/arm/include/asm/arch-mx35/imx-regs.h |7 ++-
 arch/arm/include/asm/arch-mx5/imx-regs.h  |6 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h  |   19 +++
 board/freescale/mx6qsabreauto/mx6qsabreauto.c |5 -
 8 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 193ba12..dd32969 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -153,8 +153,8 @@ void enable_caches(void)
 #if defined(CONFIG_FEC_MXC)
 void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 {
-   struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
-   struct fuse_bank *bank = &iim->bank[4];
+   struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+   struct fuse_bank *bank = &ocotp->bank[4];
struct fuse_bank4_regs *fuse =
(struct fuse_bank4_regs *)bank->fuse_regs;
 
diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h 
b/arch/arm/include/asm/arch-mx25/imx-regs.h
index 5f4b543..99c32d4 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -113,8 +113,12 @@ struct iim_regs {
u32 iim_sdat;
u32 iim_prev;
u32 iim_srev;
-   u32 iim_prog_p;
-   u32 res1[0x1f5];
+   u32 iim_prg_p;
+   u32 iim_scs0;
+   u32 iim_scs1;
+   u32 iim_scs2;
+   u32 iim_scs3;
+   u32 res1[0x1f1];
struct fuse_bank {
u32 fuse_regs[0x20];
u32 fuse_rsvd[0xe0];
diff --git a/arch/arm/include/asm/arch-mx27/imx-regs.h 
b/arch/arm/include/asm/arch-mx27/imx-regs.h
index 2f6c823..aee058f 100644
--- a/arch/arm/include/asm/arch-mx27/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx27/imx-regs.h
@@ -176,7 +176,7 @@ struct iim_regs {
u32 iim_sdat;
u32 iim_prev;
u32 iim_srev;
-   u32 iim_prog_p;
+   u32 iim_prg_p;
u32 iim_scs0;
u32 iim_scs1;
u32 iim_scs2;
diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h 
b/arch/arm/include/asm/arch-mx31/imx-regs.h
index 3f58318..f67f49c 100644
--- a/arch/arm/include/asm/arch-mx31/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx31/imx-regs.h
@@ -68,7 +68,7 @@ struct cspi_regs {
u32 test;
 };
 
-/* IIM Control Registers */
+/* IIM control registers */
 struct iim_regs {
u32 iim_stat;
u32 iim_statm;
@@ -80,11 +80,16 @@ struct iim_regs {
u32 iim_sdat;
u32 iim_prev;
u32 iim_srev;
-   u32 iim_prog_p;
+   u32 iim_prg_p;
u32 iim_scs0;
u32 iim_scs1;
u32 iim_scs2;
u32 iim_scs3;
+   u32 res[0x1f1];
+   struct fuse_bank {
+   u32 fuse_regs[0x20];
+   u32 fuse_rsvd[0xe0];
+   } bank[3];
 };
 
 struct iomuxc_regs {
diff --git a/arch/arm/include/asm/arch-mx35/imx-regs.h 
b/arch/arm/include/asm/arch-mx35/imx-regs.h
index 7f337be..64546d2 100644
--- a/arch/arm/include/asm/arch-mx35/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx35/imx-regs.h
@@ -262,11 +262,16 @@ struct iim_regs {
u32 iim_sdat;
u32 iim_prev;
u32 iim_srev;
-   u32 iim_prog_p;
+   u32 iim_prg_p;
u32 iim_scs0;
u32 iim_scs1;
u32 iim_scs2;
u32 iim_scs3;
+   u32 res1[0x1f1];
+   struct fuse_bank {
+   u32 fuse_regs[0x20];
+   u32 fuse_rsvd[0xe0];
+   } bank[3];
 };
 
 /* General Purpose Timer (GPT) registers */
diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h 
b/arch/arm/include/asm/arch-mx5/imx-regs.h
index 249d15a..f457b4e 100644
--- a/arch/arm/include/asm/arch-mx5/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
@@ -498,7 +498,7 @@ struct iim_regs {
u32 sdat;
u32 prev;
u32 srev;
-   u32 preg_p;
+   u32 prg_p;
u32 scs0;
u32 scs1

[U-Boot] [PATCH v3 2/7] imx: Add useful fuse definitions

2013-03-26 Thread Benoßt Thébaudeau
Define the UID (SoC unique ID) fuses, and the fuses available for the user.

Signed-off-by: Benoßt Thébaudeau 
---
Changes in v3:
 - Add i.MX6 GP2.

Changes in v2:
 - Rebase against latest master.

 arch/arm/include/asm/arch-mx25/imx-regs.h |   11 ++-
 arch/arm/include/asm/arch-mx31/imx-regs.h |   12 
 arch/arm/include/asm/arch-mx35/imx-regs.h |   12 
 arch/arm/include/asm/arch-mx5/imx-regs.h  |   16 +++-
 arch/arm/include/asm/arch-mx6/imx-regs.h  |4 +++-
 5 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h 
b/arch/arm/include/asm/arch-mx25/imx-regs.h
index 99c32d4..cf7bb5a 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -126,10 +126,19 @@ struct iim_regs {
 };
 
 struct fuse_bank0_regs {
-   u32 fuse0_25[0x1a];
+   u32 fuse0_7[8];
+   u32 uid[8];
+   u32 fuse16_25[0xa];
u32 mac_addr[6];
 };
 
+struct fuse_bank1_regs {
+   u32 fuse0_21[0x16];
+   u32 usr5;
+   u32 fuse23_29[7];
+   u32 usr6[2];
+};
+
 /* Multi-Layer AHB Crossbar Switch (MAX) registers */
 struct max_regs {
u32 mpr0;
diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h 
b/arch/arm/include/asm/arch-mx31/imx-regs.h
index f67f49c..5d8d8f4 100644
--- a/arch/arm/include/asm/arch-mx31/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx31/imx-regs.h
@@ -92,6 +92,18 @@ struct iim_regs {
} bank[3];
 };
 
+struct fuse_bank0_regs {
+   u32 fuse0_5[6];
+   u32 usr;
+   u32 fuse7_15[9];
+};
+
+struct fuse_bank2_regs {
+   u32 fuse0;
+   u32 uid[8];
+   u32 fuse9_15[7];
+};
+
 struct iomuxc_regs {
u32 unused1;
u32 unused2;
diff --git a/arch/arm/include/asm/arch-mx35/imx-regs.h 
b/arch/arm/include/asm/arch-mx35/imx-regs.h
index 64546d2..63c6e24 100644
--- a/arch/arm/include/asm/arch-mx35/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx35/imx-regs.h
@@ -274,6 +274,18 @@ struct iim_regs {
} bank[3];
 };
 
+struct fuse_bank0_regs {
+   u32 fuse0_7[8];
+   u32 uid[8];
+   u32 fuse16_31[0x10];
+};
+
+struct fuse_bank1_regs {
+   u32 fuse0_21[0x16];
+   u32 usr;
+   u32 fuse23_31[9];
+};
+
 /* General Purpose Timer (GPT) registers */
 struct gpt_regs {
u32 ctrl;   /* control */
diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h 
b/arch/arm/include/asm/arch-mx5/imx-regs.h
index f457b4e..8fce11b 100644
--- a/arch/arm/include/asm/arch-mx5/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
@@ -515,8 +515,14 @@ struct iim_regs {
 };
 
 struct fuse_bank0_regs {
-   u32 fuse0_23[24];
+   u32 fuse0_7[8];
+   u32 uid[8];
+   u32 fuse16_23[8];
+#if defined(CONFIG_MX51)
+   u32 imei[8];
+#elif defined(CONFIG_MX53)
u32 gp[8];
+#endif
 };
 
 struct fuse_bank1_regs {
@@ -525,6 +531,14 @@ struct fuse_bank1_regs {
u32 fuse15_31[0x11];
 };
 
+#if defined(CONFIG_MX53)
+struct fuse_bank4_regs {
+   u32 fuse0_4[5];
+   u32 gp[3];
+   u32 fuse8_31[0x18];
+};
+#endif
+
 #endif /* __ASSEMBLER__*/
 
 #endif /* __ASM_ARCH_MX5_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index cdaf5f8..efab943 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -405,7 +405,9 @@ struct fuse_bank4_regs {
u32 mac_addr_high;
u32 rsvd3[0xb];
u32 gp1;
-   u32 rsvd4[7];
+   u32 rsvd4[3];
+   u32 gp2;
+   u32 rsvd5[3];
 };
 
 struct aipstz_regs {
-- 
1.7.10.4

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


[U-Boot] unaligned access in part_efi.c

2013-03-26 Thread Marc Dietrich
Hi,

access to part->start_sect in pmbr_part_valid() (form disk/part_efi.c) and 
propably other positions/fields causes an unaligned access on ARM (tegra in my 
case) and a uboot crash. This was introduced by commit fae2bf22 [1] which 
changed le32_to_int (which is a byte access) to le32_to_cpu (which is a 32bit 
access).

I'm not sure how to fix this as I'm not very familar with this kind of 
problems. Any help?

Thanks!

Marc

[1] gpt: The leXX_to_int() calls replaced with ones defined at 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] nitrogen6x: Pass the correct CPU revision to the kernel

2013-03-26 Thread Fabio Estevam
Hi Eric,

On Tue, Mar 26, 2013 at 12:24 PM, Eric Nelson
 wrote:

> Since this convention is shared among at least SABRE Lite, SABRE SD,
> Nitrogen6x and Wandboard, wouldn't a weak function in imx-common/cpu.c
> be a better choice?
>
> +#ifdef CONFIG_REVISION_TAG
> +u32 __weak get_board_rev(void)
> +{
> +   return get_cpu_rev();
> +}
> +#endif
>
> Then boards could override things, but will do the reasonable thing
> without the extra code.

I like this idea. Will submit this change with the get_cpu_rev()
tomorrow, after I get more comments on the proposed get_cpu_rev patch.

Thanks,

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


Re: [U-Boot] [PATCH] Tegra: enable verify support for the crc32 command

2013-03-26 Thread Simon Glass
On Tue, Mar 26, 2013 at 10:52 AM, Tom Warren  wrote:
> Some 3rd-party flash tools use the -v (verify) option of crc32 command.
>
> Signed-off-by: Tom Warren 

Acked-by: Simon Glass 

> ---
>  include/configs/tegra-common.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
> index 036ded0..30dc736 100644
> --- a/include/configs/tegra-common.h
> +++ b/include/configs/tegra-common.h
> @@ -168,7 +168,9 @@
>  #define CONFIG_SPL_GPIO_SUPPORT
>
>  #define CONFIG_SYS_GENERIC_BOARD
> +

Do you want this blank line?

>  /* Misc utility code */
>  #define CONFIG_BOUNCE_BUFFER
> +#define CONFIG_CRC32_VERIFY
>
>  #endif /* _TEGRA_COMMON_H_ */
> --
> 1.8.1.5
>

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


[U-Boot] [PATCH] Tegra: enable verify support for the crc32 command

2013-03-26 Thread Tom Warren
Some 3rd-party flash tools use the -v (verify) option of crc32 command.

Signed-off-by: Tom Warren 
---
 include/configs/tegra-common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index 036ded0..30dc736 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -168,7 +168,9 @@
 #define CONFIG_SPL_GPIO_SUPPORT
 
 #define CONFIG_SYS_GENERIC_BOARD
+
 /* Misc utility code */
 #define CONFIG_BOUNCE_BUFFER
+#define CONFIG_CRC32_VERIFY
 
 #endif /* _TEGRA_COMMON_H_ */
-- 
1.8.1.5

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


Re: [U-Boot] [RFC] Bootcount improvements

2013-03-26 Thread Wolfgang Denk
Dear Alexandre,

In message <1822628084.945501.1364317027872.javamail.r...@openwide.fr> you 
wrote:
>
> In fact I would like to keep the bootcount value after a shutdown
> to handle update failures. Some embedded systems have only network
> access for administration and if you install an updated system with a
> misconfiguration of the network interface, you can't access anymore
> to the machine and you can't reset it. So the only way to reset the
> device is to unplug and replug but bootcount value is reset... So you
> can't switch back to a safe system...

You can define your own mechanism to do something like that, but
please do not misuse the bootcount for something it was never meant
for.   The bootcount is defined to count the number of boots after
power on; i. e. when you power on a board, the boot counter must by
definition start with the value zero.

> > If you move the bootcount into a non-volatile memory, you add a
> > history
> > to the process and breaks this assumption.
> 
> That's why I suggest to use an environment variable (and may be a
> configuration option) to enable/disable this features.

It should be easy and straightforward to implement such a feature by
defining a new environment variable.  All this can be done using
standard scripting, i. e. you do not need any code changes and thus no
new config options.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
There is wisdom in turning as often as possible from the familiar  to
the  unfamiliar: it keeps the mind nimble, it kills prejudice, and it
fosters humor. - George Santayana
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx6: Fix the reading of CPU revision

2013-03-26 Thread Fabio Estevam
Hi Dirk,

On Tue, Mar 26, 2013 at 12:43 PM, Dirk Behme  wrote:
> Hi Fabio,
>
>
> On 26.03.2013 13:54, Fabio Estevam wrote:
>>
>> Currently when booting a mx6 solo processor get_cpu_rev() returns 0x62xxx,
>> which
>> is an invalid mx6 CPU revision.
>
>
> Do you have somewhere a list of valid CPU revisions? From two points of
> view:
>
> a) the i.MX6 hardware spec
>
> b) the VPU library

Sorry, I don't. I am basing the CPU revision numbers from FSL U-boot:
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/board/freescale/common/fsl_sys_rev.c?h=imx_v2009.08_3.0.0

Adding Jason, in case he could clarify it.

> You remove Troy's code here introduced with
>
> http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=20332a066aff98f39419495821e14edd10b2a3f8
>
> Troy's detection you remove here intentionally distinguishes between
> DualLite and Solo. You now re-introduce a common DL_S, again.
>
> Additionally, you completely seem to drop checking for scu->config. I've
> already seen some (broken?) i.MX6Solo where this check was essential.
>
> I can't talk about the "problems when trying to use VPU library in the
> kernel" (btw, which problems?) and the invalid 0x62xxx, but we used Troy's
> version of the detection successfully.

Passing 0x62xxx as cpu_rev on a mx6solo caused the VPU issues described here:
https://community.freescale.com/thread/305396

Which cpu_rev value is returned with your mx6solo? Are you able to use VPU lib?

I will test solo lite when I have chance to add support for it.

Regards,

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


Re: [U-Boot] [RFC] Bootcount improvements

2013-03-26 Thread Alexandre Dilly
> > Hi,
> > 
> 
> Hi Alexandre,

Hi Stefano,

> > I'm working on an open source automatic updater for embedded
> > systems. The goal of this project is to split a flash memory or
> > disk in multiple partition (2 or more) and install a new root
> > filesystem  on an empty or outdated partition.
> > 
> > After reboot, we count the boot attempts on this new version of the
> > system and if it fails to boot, we switch back to the last working
> > partition. This guarantees that we will eventually boot on a
> > correct partition and that there is no chance to have an
> > unsupervised equipment hang at the u-boot prompt.
> > 
> > The u-boot environment would contain the name of the partition to
> > test and the partition to fallback to. I would rewrite the u-boot
> > environment after installing the new partition and use
> >  CONFIG_ENV_OFFSET_REDUND to make it powerfail-safe.
> > 
> > To handle the boot attempts count, I've seen the 'bootcount'
> > driver. However, it doesn't support all cpu and memories.
> > 
> > I intend to improve the 'bootcount' driver by adding two features:
> > - add  eeprom and flash memories as places to load/save the
> > bootcount value.
> 
> There are good reason to use volatile memory (in most case, the
> internal
> RAM of the processor) to store the bootcount value. We should be sure
> that the system is clean after a power-cycle. There are a lot of
> different causes for a failing boot: a different network setup, other
> devices attached to the board, and so on. If the reason depends on
> the
> environment the board works, we should be sure that changing the
> hardware the system is able to try again from a clean situation.
> 
In fact I would like to keep the bootcount value after a shutdown to handle 
update failures. Some embedded systems have only network access for 
administration and if you install an updated system with a misconfiguration of 
the network interface, you can't access anymore to the machine and you can't 
reset it. So the only way to reset the device is to unplug and replug but 
bootcount value is reset... So you can't switch back to a safe system...

> If you move the bootcount into a non-volatile memory, you add a
> history
> to the process and breaks this assumption.

That's why I suggest to use an environment variable (and may be a configuration 
option) to enable/disable this features.

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


Re: [U-Boot] [PATCH] mx6: Fix the reading of CPU revision

2013-03-26 Thread Dirk Behme

Hi Fabio,

On 26.03.2013 13:54, Fabio Estevam wrote:

Currently when booting a mx6 solo processor get_cpu_rev() returns 0x62xxx, which
is an invalid mx6 CPU revision.


Do you have somewhere a list of valid CPU revisions? From two points of 
view:


a) the i.MX6 hardware spec

b) the VPU library


This causes run-time problems when trying to use
VPU library in the kernel, as this library loads the VPU firmware according
to the CPU type.

Fix get_cpu_rev() so that it correctly returns 0x61xxx for a mx6 solo.

While at it, also remove the duplicate definitions for MXC_CPU_ types.

Tested on a Wandboard solo and on a mx6qsabresd.

Signed-off-by: Fabio Estevam 
---
 arch/arm/cpu/armv7/mx6/soc.c  |   28 
 arch/arm/imx-common/cpu.c |   16 ++--
 arch/arm/include/asm/arch-mx5/sys_proto.h |7 ---
 arch/arm/include/asm/arch-mx6/sys_proto.h |7 ---
 4 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 193ba12..87725eb 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -43,22 +43,18 @@ struct scu_regs {
 u32 get_cpu_rev(void)
 {
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
-   u32 reg = readl(&anatop->digprog_sololite);
-   u32 type = ((reg >> 16) & 0xff);
-
-   if (type != MXC_CPU_MX6SL) {
-   reg = readl(&anatop->digprog);
-   type = ((reg >> 16) & 0xff);
-   if (type == MXC_CPU_MX6DL) {
-   struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
-   u32 cfg = readl(&scu->config) & 3;
-
-   if (!cfg)
-   type = MXC_CPU_MX6SOLO;
-   }
-   }
-   reg &= 0xff;/* mx6 silicon revision */
-   return (type << 12) | (reg + 0x10);
+   u32 fsl_system_rev;
+   u32 cpu_rev = readl(&anatop->digprog);
+
+   /* Chip Silicon ID */
+   fsl_system_rev = ((cpu_rev >> 16) & 0xFF) << 12;
+   /* Chip silicon major revision */
+   fsl_system_rev |= ((cpu_rev >> 8) & 0xFF) << 4;
+   fsl_system_rev += 0x10;
+   /* Chip silicon minor revision */
+   fsl_system_rev |= cpu_rev & 0xFF;


You remove Troy's code here introduced with

http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=20332a066aff98f39419495821e14edd10b2a3f8

Troy's detection you remove here intentionally distinguishes between 
DualLite and Solo. You now re-introduce a common DL_S, again.


Additionally, you completely seem to drop checking for scu->config. I've 
already seen some (broken?) i.MX6Solo where this check was essential.


I can't talk about the "problems when trying to use VPU library in the 
kernel" (btw, which problems?) and the invalid 0x62xxx, but we used 
Troy's version of the detection successfully.


Best regards

Dirk


 void init_aips(void)
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index a9b86c1..2f518c5 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -117,15 +117,19 @@ unsigned imx_ddr_size(void)
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
+#define MXC_CPU_MX51		0x51

+#define MXC_CPU_MX53   0x53
+#define MXC_CPU_MX6SL  0x60
+#define MXC_CPU_MX6DL_S0x61
+#define MXC_CPU_MX6Q_D 0x63
+
 const char *get_imx_type(u32 imxtype)
 {
switch (imxtype) {
-   case MXC_CPU_MX6Q:
-   return "6Q";  /* Quad-core version of the mx6 */
-   case MXC_CPU_MX6DL:
-   return "6DL"; /* Dual Lite version of the mx6 */
-   case MXC_CPU_MX6SOLO:
-   return "6SOLO";   /* Solo version of the mx6 */
+   case MXC_CPU_MX6Q_D:
+   return "6Q/D";/* Quad/Dual version of the mx6 */
+   case MXC_CPU_MX6DL_S:
+   return "6DL/S";   /* Dual-Lite/Solo version of the mx6 */
case MXC_CPU_MX6SL:
return "6SL"; /* Solo-Lite version of the mx6 */
case MXC_CPU_MX51:
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index 93ad1c6..a2e88bb 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -24,13 +24,6 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-#define MXC_CPU_MX51		0x51

-#define MXC_CPU_MX53   0x53
-#define MXC_CPU_MX6SL  0x60
-#define MXC_CPU_MX6DL  0x61
-#define MXC_CPU_MX6SOLO0x62
-#define MXC_CPU_MX6Q   0x63
-
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
 unsigned imx_ddr_size(void);
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 3193297..0278317 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -24,13 +24,6 @@
 #ifndef _SYS_PROT

Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-26 Thread Pali RohĂĄr
On Monday 25 March 2013 20:29:23 Anatolij Gustschin wrote:
> Hi,
> 
> On Sun, 24 Mar 2013 01:53:08 +0100
> 
> Anatolij Gustschin  wrote:
> > From: Pali RohĂĄr 
> > 
> > The "bootmenu" command uses U-Boot menu interfaces and
> > provides a simple mechanism for creating menus with several
> > boot items.
> 
> Could you please test v4 patches. I've tested them in sandbox
> and on a frame buffer device (cfb_console) and didn't see any
> issues. I'm going to apply these patches in a few days.
> 
> Thanks,
> 
> Anatolij

Hi,

I tested them on Nokia N900 and in qemu (hw n900). Working fine.

-- 
Pali RohĂĄr
pali.ro...@gmail.com


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


Re: [U-Boot] [PATCH 1/2] nitrogen6x: Pass the correct CPU revision to the kernel

2013-03-26 Thread Eric Nelson

On 03/26/2013 08:24 AM, Eric Nelson wrote:

Hi Fabio,


> 
>

--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -330,7 +330,7 @@ int board_mmc_init(bd_t *bis)

  u32 get_board_rev(void)
  {
-return 0x63000;
+return get_cpu_rev();
  }

  #ifdef CONFIG_MXC_SPI



Since this convention is shared among at least SABRE Lite, SABRE SD,
Nitrogen6x and Wandboard, wouldn't a weak function in imx-common/cpu.c
be a better choice?



Oops.

I meant to say arch/arm/cpu/armv7/mx6/soc.c, not imx-common/cpu.c.

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


Re: [U-Boot] [PATCH 1/2] nitrogen6x: Pass the correct CPU revision to the kernel

2013-03-26 Thread Eric Nelson

Hi Fabio,

On 03/15/2013 02:06 PM, Fabio Estevam wrote:

From: Fabio Estevam 

As nitrogen6x boards support different i.MX6 flavors (quad, dual-lite and solo)
the correct CPU revision needs to passed to the kernel, so call get_cpu_rev()
instead of hardcoding it.

Freescale 3.0.35 kernel assumes that the CPU revision is passed passed from the
bootloader.

Signed-off-by: Fabio Estevam 
---
  board/boundary/nitrogen6x/nitrogen6x.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/nitrogen6x.c 
b/board/boundary/nitrogen6x/nitrogen6x.c
index 229c237..fec0e3a 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -330,7 +330,7 @@ int board_mmc_init(bd_t *bis)

  u32 get_board_rev(void)
  {
-   return 0x63000;
+   return get_cpu_rev();
  }

  #ifdef CONFIG_MXC_SPI



Since this convention is shared among at least SABRE Lite, SABRE SD,
Nitrogen6x and Wandboard, wouldn't a weak function in imx-common/cpu.c
be a better choice?

+#ifdef CONFIG_REVISION_TAG
+u32 __weak get_board_rev(void)
+{
+   return get_cpu_rev();
+}
+#endif

Then boards could override things, but will do the reasonable thing
without the extra code.

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


[U-Boot] [PATCH V3 02/10] twl4030: make twl4030_i2c_read_u8 prototype consistent

2013-03-26 Thread Nishanth Menon
u-boot standard i2c read prototype is
i2c_read(addr, reg, 1, &buf, 1)

twl4030_i2c_read_u8(u8 addr, u8 *val, u8 reg)
does not provide consistency, so switch the prototype to be
consistent with rest of u-boot i2c operations:
twl4030_i2c_read_u8(u8 addr, u8 reg, u8 *val)

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230260/
Changes since v2:
- checkpatch cleanup
 board/cm_t35/cm_t35.c |4 ++--
 board/nokia/rx51/rx51.c   |   16 
 drivers/power/twl4030.c   |4 ++--
 drivers/usb/phy/twl4030.c |2 +-
 include/twl4030.h |2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index bccfacd..9f8108d 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -385,7 +385,7 @@ int board_mmc_getcd(struct mmc *mmc)
 {
u8 val;
 
-   if (twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, &val, TWL4030_BASEADD_GPIO))
+   if (twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, TWL4030_BASEADD_GPIO, &val))
return -1;
 
return !(val & 1);
@@ -534,7 +534,7 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, 
struct ehci_hcor **hcor)
udelay(1000);
 
offset = TWL4030_BASEADD_GPIO + TWL4030_GPIO_GPIODATADIR1;
-   twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, &val, offset);
+   twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, offset, &val);
/* Set GPIO6 and GPIO7 of TPS65930 as output */
val |= 0xC0;
twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, offset, val);
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 860d52d..42bf8b6 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -406,8 +406,8 @@ int misc_init_r(void)
TWL4030_PM_RECEIVER_DEV_GRP_P1);
 
/* store I2C access state */
-   twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &state,
-   TWL4030_PM_MASTER_PB_CFG);
+   twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, TWL4030_PM_MASTER_PB_CFG,
+   &state);
 
/* enable I2C access to powerbus (needed for twl4030 regulator) */
twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, TWL4030_PM_MASTER_PB_CFG,
@@ -475,8 +475,8 @@ void hw_watchdog_reset(void)
return;
 
/* read actual watchdog timeout */
-   twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER, &timeout,
-   TWL4030_PM_RECEIVER_WATCHDOG_CFG);
+   twl4030_i2c_read_u8(TWL4030_CHIP_PM_RECEIVER,
+   TWL4030_PM_RECEIVER_WATCHDOG_CFG, &timeout);
 
/* timeout 0 means watchdog is disabled */
/* reset watchdog timeout to 31s (maximum) */
@@ -531,8 +531,8 @@ int rx51_kp_init(void)
 {
int ret = 0;
u8 ctrl;
-   ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &ctrl,
-   TWL4030_KEYPAD_KEYP_CTRL_REG);
+   ret = twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD,
+ TWL4030_KEYPAD_KEYP_CTRL_REG, &ctrl);
 
if (ret)
return ret;
@@ -615,8 +615,8 @@ int rx51_kp_tstc(void)
for (i = 0; i < 2; i++) {
 
/* check interrupt register for events */
-   twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD, &intr,
-   TWL4030_KEYPAD_KEYP_ISR1+(2*i));
+   twl4030_i2c_read_u8(TWL4030_CHIP_KEYPAD,
+   TWL4030_KEYPAD_KEYP_ISR1 + (2 * i), &intr);
 
/* no event */
if (!(intr&1))
diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c
index 2bf94b1..6610f78 100644
--- a/drivers/power/twl4030.c
+++ b/drivers/power/twl4030.c
@@ -45,8 +45,8 @@
 void twl4030_power_reset_init(void)
 {
u8 val = 0;
-   if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val,
-   TWL4030_PM_MASTER_P1_SW_EVENTS)) {
+   if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER,
+   TWL4030_PM_MASTER_P1_SW_EVENTS, &val)) {
printf("Error:TWL4030: failed to read the power register\n");
printf("Could not initialize hardware reset\n");
} else {
diff --git a/drivers/usb/phy/twl4030.c b/drivers/usb/phy/twl4030.c
index f41cc07..74f1dcc 100644
--- a/drivers/usb/phy/twl4030.c
+++ b/drivers/usb/phy/twl4030.c
@@ -66,7 +66,7 @@ static int twl4030_usb_read(u8 address)
u8 data;
int ret;
 
-   ret = twl4030_i2c_read_u8(TWL4030_CHIP_USB, &data, address);
+   ret = twl4030_i2c_read_u8(TWL4030_CHIP_USB, address, &data);
if (ret == 0)
ret = data;
else
diff --git a/include/twl4030.h b/include/twl4030.h
index aca695d..569ad27 100644
--- a/include/twl4030.h
+++ b/include/twl4030.h
@@ -643,7 +643,7 @@ static inline int twl4030_i2c_write_u8(u8 chip_no, u8 reg, 
u8 val)
return i2c_write(chip_no, reg, 1, &val, 1);
 }
 
-static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
+static inline

[U-Boot] [PATCH V3 01/10] twl4030: make twl4030_i2c_write_u8 prototype consistent

2013-03-26 Thread Nishanth Menon
u-boot standard i2c register write prototype is
i2c_reg_write(u8 addr, u8 reg, u8 val)

twl4030_i2c_write_u8(u8 addr, u8 val, u8 reg)
does not provide consistency, so switch the prototype to be
consistent with rest of u-boot i2c operations:
twl4030_i2c_write_u8(u8 addr, u8 reg, u8 val)

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230267/
Changes since v2:
- checkpatch cleanup

 board/cm_t35/cm_t35.c  |   20 +--
 board/nokia/rx51/rx51.c|   36 +-
 board/pandora/pandora.c|3 ++-
 drivers/misc/twl4030_led.c |4 ++--
 drivers/power/twl4030.c|   12 ++--
 drivers/usb/phy/twl4030.c  |   46 ++--
 include/twl4030.h  |2 +-
 7 files changed, 62 insertions(+), 61 deletions(-)

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index e0e8235..bccfacd 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -430,17 +430,17 @@ static void setup_net_chip_gmpc(void)
 static void reset_net_chip(void)
 {
/* Set GPIO1 of TPS65930 as output */
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
-   TWL4030_BASEADD_GPIO + 0x03);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, TWL4030_BASEADD_GPIO + 0x03,
+0x02);
/* Send a pulse on the GPIO pin */
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
-   TWL4030_BASEADD_GPIO + 0x0C);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, TWL4030_BASEADD_GPIO + 0x0C,
+0x02);
udelay(1);
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
-   TWL4030_BASEADD_GPIO + 0x09);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, TWL4030_BASEADD_GPIO + 0x09,
+0x02);
mdelay(40);
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
-   TWL4030_BASEADD_GPIO + 0x0C);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, TWL4030_BASEADD_GPIO + 0x0C,
+0x02);
mdelay(1);
 }
 #else
@@ -537,10 +537,10 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, 
struct ehci_hcor **hcor)
twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, &val, offset);
/* Set GPIO6 and GPIO7 of TPS65930 as output */
val |= 0xC0;
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, val, offset);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, offset, val);
offset = TWL4030_BASEADD_GPIO + TWL4030_GPIO_SETGPIODATAOUT1;
/* Take both PHYs out of reset */
-   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0xC0, offset);
+   twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, offset, 0xC0);
udelay(1);
 
return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 48eb65f..860d52d 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -332,10 +332,10 @@ void *video_hw_init(void)
 static void twl4030_regulator_set_mode(u8 id, u8 mode)
 {
u16 msg = MSG_SINGULAR(DEV_GRP_P1, id, mode);
-   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg >> 8,
-   TWL4030_PM_MASTER_PB_WORD_MSB);
-   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, msg & 0xff,
-   TWL4030_PM_MASTER_PB_WORD_LSB);
+   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER,
+TWL4030_PM_MASTER_PB_WORD_MSB, msg >> 8);
+   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER,
+TWL4030_PM_MASTER_PB_WORD_LSB, msg & 0xff);
 }
 
 static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
@@ -410,8 +410,8 @@ int misc_init_r(void)
TWL4030_PM_MASTER_PB_CFG);
 
/* enable I2C access to powerbus (needed for twl4030 regulator) */
-   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, 0x02,
-   TWL4030_PM_MASTER_PB_CFG);
+   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, TWL4030_PM_MASTER_PB_CFG,
+0x02);
 
/* set VAUX3, VSIM and VMMC1 state to active - enable eMMC memory */
twl4030_regulator_set_mode(RES_VAUX3, RES_STATE_ACTIVE);
@@ -419,8 +419,8 @@ int misc_init_r(void)
twl4030_regulator_set_mode(RES_VMMC1, RES_STATE_ACTIVE);
 
/* restore I2C access state */
-   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, state,
-   TWL4030_PM_MASTER_PB_CFG);
+   twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, TWL4030_PM_MASTER_PB_CFG,
+state);
 
/* set env variable attkernaddr for relocated kernel */
sprintf(buf, "%#x", KERNEL_ADDRESS);
@@ -481,8 +481,8 @@ void hw_watchdog_reset(void)
/* timeout 0 means watchdog is disabled */
/* reset watchdog timeout to 31s (maximum) */
if (timeout != 0)
-   twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, 31,
-

[U-Boot] [PATCH V3 04/10] twl6030: move twl6030 register access functions to common header file

2013-03-26 Thread Nishanth Menon
twl6030_i2c_[read|write]_u8 can be used else where to access
multi-function device such as twl6030, so move the register access
functions to the common twl6030.h header file.

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230259/
Changes since v2:
- no change
 drivers/power/twl6030.c |   11 ---
 include/twl6030.h   |   11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index 58ad4ad..d421e60 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -25,17 +25,6 @@
 
 #include 
 
-/* Functions to read and write from TWL6030 */
-static inline int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
-{
-   return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-static inline int twl6030_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
-{
-   return i2c_read(chip_no, reg, 1, val, 1);
-}
-
 static int twl6030_gpadc_read_channel(u8 channel_no)
 {
u8 lsb = 0;
diff --git a/include/twl6030.h b/include/twl6030.h
index a9fcadb..f7ba3c7 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -126,6 +126,17 @@
 #define GPCH0_LSB  0x57
 #define GPCH0_MSB  0x58
 
+/* Functions to read and write from TWL6030 */
+static inline int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
+{
+   return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+static inline int twl6030_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
+{
+   return i2c_read(chip_no, reg, 1, val, 1);
+}
+
 void twl6030_init_battery_charging(void);
 void twl6030_usb_device_settings(void);
 void twl6030_start_usb_charging(void);
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 10/10] palmas: add header guard

2013-03-26 Thread Nishanth Menon
Add an header guard to common header file to prevent multiple
includes messing things up.

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230264/
Changes since V2:
- use PALMAS instead of TWL6035
 include/palmas.h |4 
 1 file changed, 4 insertions(+)

diff --git a/include/palmas.h b/include/palmas.h
index e629fbf..3b18589 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -20,6 +20,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
+#ifndef PALMAS_H
+#define PALMAS_H
 
 #include 
 #include 
@@ -52,3 +54,5 @@ static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 
*val)
 
 void palmas_init_settings(void);
 int palmas_mmc1_poweron_ldo(void);
+
+#endif /* PALMAS_H */
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 06/10] twl6035: rename to palmas

2013-03-26 Thread Nishanth Menon
TPS659038/TWL6035/TWL6037 all belong to palmas family of TI PMICs
Rename twl6035 to palmas to allow reuse across multiple current and
future platforms

As part of this change, change the CONFIG_TWL6035_POWER to
CONFIG_PALMAS_POWER and update usage of header file accordingly.

Signed-off-by: Nishanth Menon 
---
V3: new patch
 board/ti/dra7xx/evm.c |2 +-
 board/ti/omap5_evm/evm.c  |4 ++--
 drivers/mmc/omap_hsmmc.c  |6 +++---
 drivers/power/Makefile|2 +-
 drivers/power/{twl6035.c => palmas.c} |4 ++--
 include/configs/omap5_evm.h   |2 +-
 include/{twl6035.h => palmas.h}   |4 ++--
 7 files changed, 12 insertions(+), 12 deletions(-)
 rename drivers/power/{twl6035.c => palmas.c} (97%)
 rename include/{twl6035.h => palmas.h} (95%)

diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 7bbb549..bf7e091 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -27,7 +27,7 @@
  * MA 02111-1307 USA
  */
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c
index 55337c0..701842b 100644
--- a/board/ti/omap5_evm/evm.c
+++ b/board/ti/omap5_evm/evm.c
@@ -23,7 +23,7 @@
  * MA 02111-1307 USA
  */
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -63,7 +63,7 @@ int board_eth_init(bd_t *bis)
  */
 int misc_init_r(void)
 {
-#ifdef CONFIG_TWL6035_POWER
+#ifdef CONFIG_PALMAS_POWER
twl6035_init_settings();
 #endif
return 0;
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 67cfcc2..b7a9eb0 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -107,7 +107,7 @@ static void omap4_vmmc_pbias_config(struct mmc *mmc)
 }
 #endif
 
-#if defined(CONFIG_OMAP54XX) && defined(CONFIG_TWL6035_POWER)
+#if defined(CONFIG_OMAP54XX) && defined(CONFIG_PALMAS_POWER)
 static void omap5_pbias_config(struct mmc *mmc)
 {
u32 value = 0;
@@ -178,7 +178,7 @@ unsigned char mmc_board_init(struct mmc *mmc)
if (mmc->block_dev.dev == 0)
omap4_vmmc_pbias_config(mmc);
 #endif
-#if defined(CONFIG_OMAP54XX) && defined(CONFIG_TWL6035_POWER)
+#if defined(CONFIG_OMAP54XX) && defined(CONFIG_PALMAS_POWER)
if (mmc->block_dev.dev == 0)
omap5_pbias_config(mmc);
 #endif
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 8c71901..a2a5bd2 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -29,7 +29,7 @@ COBJS-$(CONFIG_FTPMU010_POWER)+= ftpmu010.o
 COBJS-$(CONFIG_TPS6586X_POWER) += tps6586x.o
 COBJS-$(CONFIG_TWL4030_POWER)  += twl4030.o
 COBJS-$(CONFIG_TWL6030_POWER)  += twl6030.o
-COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
+COBJS-$(CONFIG_PALMAS_POWER)   += palmas.o
 
 COBJS-$(CONFIG_POWER) += power_core.o
 COBJS-$(CONFIG_DIALOG_POWER) += power_dialog.o
diff --git a/drivers/power/twl6035.c b/drivers/power/palmas.c
similarity index 97%
rename from drivers/power/twl6035.c
rename to drivers/power/palmas.c
index d3de698..8ed7742 100644
--- a/drivers/power/twl6035.c
+++ b/drivers/power/palmas.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2012
+ * (C) Copyright 2012-2013
  * Texas Instruments, 
  *
  * See file CREDITS for list of people who contributed to this
@@ -21,7 +21,7 @@
  * MA 02111-1307 USA
  */
 #include 
-#include 
+#include 
 
 /* Functions to read and write from TWL6030 */
 int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
diff --git a/include/configs/omap5_evm.h b/include/configs/omap5_evm.h
index 22a8e13..4ad943a 100644
--- a/include/configs/omap5_evm.h
+++ b/include/configs/omap5_evm.h
@@ -32,7 +32,7 @@
 
 /* TWL6035 */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_TWL6035_POWER
+#define CONFIG_PALMAS_POWER
 #endif
 
 #define CONFIG_SYS_PROMPT  "OMAP5430 EVM # "
diff --git a/include/twl6035.h b/include/palmas.h
similarity index 95%
rename from include/twl6035.h
rename to include/palmas.h
index ce74348..cf836d7 100644
--- a/include/twl6035.h
+++ b/include/palmas.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2012
+ * (C) Copyright 2012-2013
  * Texas Instruments, 
  *
  * See file CREDITS for list of people who contributed to this
@@ -25,7 +25,7 @@
 #include 
 
 /* I2C chip addresses */
-#define TWL6035_CHIP_ADDR  0x48
+#define PALMAS_CHIP_ADDR   0x48
 
 /* 0x1XY translates to page 1, register address 0xXY */
 #define LDO9_CTRL  0x60
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 07/10] palmas: rename init_settings to an generic palmas init

2013-03-26 Thread Nishanth Menon
Since TPS659038/TWL6035/TWL6037 all belong to palmas family of TI PMICs,
rename twl6035_init_settings with an more generic palmas_init_settings

Signed-off-by: Nishanth Menon 
---
V3: new patch
 board/ti/omap5_evm/evm.c |2 +-
 drivers/power/palmas.c   |2 +-
 include/palmas.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c
index 701842b..46db1bf 100644
--- a/board/ti/omap5_evm/evm.c
+++ b/board/ti/omap5_evm/evm.c
@@ -64,7 +64,7 @@ int board_eth_init(bd_t *bis)
 int misc_init_r(void)
 {
 #ifdef CONFIG_PALMAS_POWER
-   twl6035_init_settings();
+   palmas_init_settings();
 #endif
return 0;
 }
diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index 8ed7742..bf36a19 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -45,7 +45,7 @@ static inline int palmas_read_u8(u8 chip_no, u8 reg, u8 *val)
return i2c_read(chip_no, reg, 1, val, 1);
 }
 
-void twl6035_init_settings(void)
+void palmas_init_settings(void)
 {
return;
 }
diff --git a/include/palmas.h b/include/palmas.h
index cf836d7..6618aad 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -38,5 +38,5 @@
 
 int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
 int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
-void twl6035_init_settings(void);
+void palmas_init_settings(void);
 int twl6035_mmc1_poweron_ldo(void);
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 05/10] twl6030: add header guard

2013-03-26 Thread Nishanth Menon
Add an header guard to common header file to prevent multiple includes
messing things up.

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230265/
Changes since v2:
- no change
 include/twl6030.h |5 +
 1 file changed, 5 insertions(+)

diff --git a/include/twl6030.h b/include/twl6030.h
index f7ba3c7..029b21f 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -21,6 +21,9 @@
  * MA 02111-1307 USA
  */
 
+#ifndef TWL6030_H
+#define TWL6030_H
+
 #include 
 #include 
 
@@ -144,3 +147,5 @@ void twl6030_stop_usb_charging(void);
 int twl6030_get_battery_voltage(void);
 int twl6030_get_battery_current(void);
 void twl6030_power_mmc_init(void);
+
+#endif /* TWL6030_H */
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 08/10] palmas: rename twl6035_mmc1_poweron_ldo with an palmas generic function

2013-03-26 Thread Nishanth Menon
Since TPS659038/TWL6035/TWL6037 all belong to palmas family of TI PMICs,
rename twl6035_mmc1_poweron_ldo by a more generic palmas_mmc1_poweron_ldo
function.

Signed-off-by: Nishanth Menon 
---
V3: new patch
 drivers/mmc/omap_hsmmc.c |2 +-
 drivers/power/palmas.c   |2 +-
 include/palmas.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index b7a9eb0..e07d488 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -117,7 +117,7 @@ static void omap5_pbias_config(struct mmc *mmc)
value |= SDCARD_BIAS_HIZ_MODE;
writel(value, (*ctrl)->control_pbias);
 
-   twl6035_mmc1_poweron_ldo();
+   palmas_mmc1_poweron_ldo();
 
value = readl((*ctrl)->control_pbias);
value &= ~SDCARD_BIAS_HIZ_MODE;
diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index bf36a19..489a7a9 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -50,7 +50,7 @@ void palmas_init_settings(void)
return;
 }
 
-int twl6035_mmc1_poweron_ldo(void)
+int palmas_mmc1_poweron_ldo(void)
 {
u8 val = 0;
 
diff --git a/include/palmas.h b/include/palmas.h
index 6618aad..305092e 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -39,4 +39,4 @@
 int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
 int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
 void palmas_init_settings(void);
-int twl6035_mmc1_poweron_ldo(void);
+int palmas_mmc1_poweron_ldo(void);
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 03/10] twl6030: twl6030_i2c_[read|write]_u8 prototype consistent

2013-03-26 Thread Nishanth Menon
u-boot standard i2c register access prototype is
i2c_read(addr, reg, 1, &buf, 1)
i2c_reg_write(u8 addr, u8 reg, u8 val)

twl6030_i2c_read_u8(u8 addr, u8 *val, u8 reg)
twl6030_i2c_write_u8(u8 addr, u8 val, u8 reg)
does not provide consistency, so switch the prototype to be
consistent with rest of u-boot i2c operations:
twl6030_i2c_read_u8(u8 addr, u8 reg, u8 *val)
twl6030_i2c_write_u8(u8 addr, u8 reg, u8 val)

Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230266/
Changes since v2:
- checkpatch cleanup
 drivers/power/twl6030.c |   68 +++
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index c5a0038..58ad4ad 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -26,12 +26,12 @@
 #include 
 
 /* Functions to read and write from TWL6030 */
-static inline int twl6030_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
+static inline int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
 {
return i2c_write(chip_no, reg, 1, &val, 1);
 }
 
-static inline int twl6030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
+static inline int twl6030_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
 {
return i2c_read(chip_no, reg, 1, val, 1);
 }
@@ -42,13 +42,13 @@ static int twl6030_gpadc_read_channel(u8 channel_no)
u8 msb = 0;
int ret = 0;
 
-   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, &lsb,
-   GPCH0_LSB + channel_no * 2);
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
+ GPCH0_LSB + channel_no * 2, &lsb);
if (ret)
return ret;
 
-   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, &msb,
-   GPCH0_MSB + channel_no * 2);
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
+ GPCH0_MSB + channel_no * 2, &msb);
if (ret)
return ret;
 
@@ -60,7 +60,7 @@ static int twl6030_gpadc_sw2_trigger(void)
u8 val;
int ret = 0;
 
-   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC, CTRL_P2_SP2, CTRL_P2);
+   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC, CTRL_P2, CTRL_P2_SP2);
if (ret)
return ret;
 
@@ -68,7 +68,7 @@ static int twl6030_gpadc_sw2_trigger(void)
val =  CTRL_P2_BUSY;
 
while (!((val & CTRL_P2_EOCP2) && (!(val & CTRL_P2_BUSY {
-   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, &val, CTRL_P2);
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, CTRL_P2, &val);
if (ret)
return ret;
udelay(1000);
@@ -79,29 +79,29 @@ static int twl6030_gpadc_sw2_trigger(void)
 
 void twl6030_stop_usb_charging(void)
 {
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, 0, CONTROLLER_CTRL1);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CONTROLLER_CTRL1, 0);
 
return;
 }
 
 void twl6030_start_usb_charging(void)
 {
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_VICHRG_1500,
-   CHARGERUSB_VICHRG);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_CIN_LIMIT_NONE,
-   CHARGERUSB_CINLIMIT);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, MBAT_TEMP,
-   CONTROLLER_INT_MASK);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, MASK_MCHARGERUSB_THMREG,
-   CHARGERUSB_INT_MASK);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_VOREG_4P0,
-   CHARGERUSB_VOREG);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_CTRL2_VITERM_400,
-   CHARGERUSB_CTRL2);
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, TERM, CHARGERUSB_CTRL1);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CHARGERUSB_VICHRG, CHARGERUSB_VICHRG_1500);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CHARGERUSB_CINLIMIT, CHARGERUSB_CIN_LIMIT_NONE);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CONTROLLER_INT_MASK, MBAT_TEMP);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CHARGERUSB_INT_MASK, MASK_MCHARGERUSB_THMREG);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CHARGERUSB_VOREG, CHARGERUSB_VOREG_4P0);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER,
+CHARGERUSB_CTRL2, CHARGERUSB_CTRL2_VITERM_400);
+   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CHARGERUSB_CTRL1, TERM);
/* Enable USB charging */
-   twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, CONTROLLER_CTRL1_EN_CHARGER,
-   CONTROLLER_CTRL1);
+ 

[U-Boot] [PATCH V3 00/10] OMAP3-5: TWL[46]03[05]: cleanup register access and misc minimal cleanups

2013-03-26 Thread Nishanth Menon
This series helps standardize register parameters for TWL4030, 6030 and 6035
used in various OMAP3,4,5 based platforms.

For historical reasons, we have been following val, reg as the order of
parameters while we have reg, val in every other i2c apis including i2c
mw/mr command @ u-boot cmd line, with kernel APIs, i2cget, i2cset utilities.

Instead of maintaining this forked implementation, it is never too late to
fix them.

Since TPS659038/TWL6035/TWL6037 all belong to the Palmas family of TI PMICs
and are mostly compatible among each other, we rename twl6035 to palmas as part
of this cleanup.

Build tested (MAKEALL) platforms-at least these seem to be be impacted ones:
cm_t35
devkit8000
dig297
igep0020
igep0020_nand
igep0030
igep0030_nand
nokia_rx51
omap3_beagle
omap3_evm
omap3_evm_quick_mmc
omap3_evm_quick_nand
omap3_logic
omap3_mvblx
omap3_overo
omap3_pandora
omap3_sdp3430
omap3_zoom1
omap3_zoom2
omap4_panda
omap4_sdp4430
omap5_evm
tricorder
dra7xx_evm

Boot tested platforms (upto kernel+shell with dtb):
omap3_beagle - tested on beagle XM (C1), beagle(C1D) - TWL4030
omap4_panda - tested on PandaBoard(A3) and PandaBoard-ES(EB3) - TWL6030
omap5_evm - OMAP5 uEVM - TWL6035

twl4030 changes are little wider in scope, so I have split them
into two patches to help review

Series is based on u-boot master:
 master  8b906a9 Merge branch 'spi' of git://git.denx.de/u-boot-x86
(rationale being the changes if done on v2013.04-rc1 have much changes to
 allow this series to apply cleanly on the latest)

NOTE: the series tries to cleanup existing indentation style to allow the
new code to be in sync with checkpatch suggestions.

V2: http://marc.info/?t=13639881686&r=1&w=2
V1: http://patchwork.ozlabs.org/patch/227112/

Changes since V2 in this series:
- rename of twl6035 to palmas and associated changes
- minor updates to cleaup checkpatch warnings 

Nishanth Menon (10):
  twl4030: make twl4030_i2c_write_u8 prototype consistent
  twl4030: make twl4030_i2c_read_u8 prototype consistent
  twl6030: twl6030_i2c_[read|write]_u8 prototype consistent
  twl6030: move twl6030 register access functions to common header file
  twl6030: add header guard
  twl6035: rename to palmas
  palmas: rename init_settings to an generic palmas init
  palmas: rename twl6035_mmc1_poweron_ldo with an palmas generic
function
  palmas: use palmas_i2c_[read|write]_u8
  palmas: add header guard

 board/cm_t35/cm_t35.c |   24 +--
 board/nokia/rx51/rx51.c   |   52 +++
 board/pandora/pandora.c   |3 +-
 board/ti/dra7xx/evm.c |2 +-
 board/ti/omap5_evm/evm.c  |6 +--
 drivers/misc/twl4030_led.c|4 +-
 drivers/mmc/omap_hsmmc.c  |8 ++--
 drivers/power/Makefile|2 +-
 drivers/power/{twl6035.c => palmas.c} |   34 +++
 drivers/power/twl4030.c   |   16 +++
 drivers/power/twl6030.c   |   75 ++---
 drivers/usb/phy/twl4030.c |   48 ++---
 include/configs/omap5_evm.h   |2 +-
 include/{twl6035.h => palmas.h}   |   28 +---
 include/twl4030.h |4 +-
 include/twl6030.h |   16 +++
 16 files changed, 162 insertions(+), 162 deletions(-)
 rename drivers/power/{twl6035.c => palmas.c} (61%)
 rename include/{twl6035.h => palmas.h} (68%)

Regards,
Nishanth Menon
-- 
1.7.9.5

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


[U-Boot] [PATCH V3 09/10] palmas: use palmas_i2c_[read|write]_u8

2013-03-26 Thread Nishanth Menon
commit 21144298 (power: twl6035: add palmas PMIC support)
introduced twl6035_i2c_[read|write]_u8
Then, commit dd23e59d (omap5: pbias ldo9 turn on)
introduced palmas_[read|write]_u8 for precisely the same access
function. TWL6035 belongs to the palmas family, so instead of having
an twl6035 API, we could use an generic palmas API instead.

To stay consistent with the function naming of twl4030,6030 accessors,
we use palmas_i2c_[read|write]_u8

Cc: Balaji T K 
Cc: Sricharan R 
Reported-by: Ruchika Kharwar 
Signed-off-by: Nishanth Menon 
---
V2: http://patchwork.ozlabs.org/patch/230261/
Changes since V2:
- uses palmas_i2c_[read|write]_u8

 drivers/power/palmas.c |   26 ++
 include/palmas.h   |   16 ++--
 2 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index 489a7a9..09c832d 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -23,28 +23,6 @@
 #include 
 #include 
 
-/* Functions to read and write from TWL6030 */
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
-{
-   return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
-{
-   return i2c_read(chip_no, reg, 1, val, 1);
-}
-
-/* To align with i2c mw/mr address, reg, val command syntax */
-static inline int palmas_write_u8(u8 chip_no, u8 reg, u8 val)
-{
-   return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-static inline int palmas_read_u8(u8 chip_no, u8 reg, u8 *val)
-{
-   return i2c_read(chip_no, reg, 1, val, 1);
-}
-
 void palmas_init_settings(void)
 {
return;
@@ -57,7 +35,7 @@ int palmas_mmc1_poweron_ldo(void)
/* set LDO9 TWL6035 to 3V */
val = 0x2b; /* (3 -.9)*28 +1 */
 
-   if (palmas_write_u8(0x48, LDO9_VOLTAGE, val)) {
+   if (palmas_i2c_write_u8(0x48, LDO9_VOLTAGE, val)) {
printf("twl6035: could not set LDO9 voltage.\n");
return 1;
}
@@ -65,7 +43,7 @@ int palmas_mmc1_poweron_ldo(void)
/* TURN ON LDO9 */
val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
 
-   if (palmas_write_u8(0x48, LDO9_CTRL, val)) {
+   if (palmas_i2c_write_u8(0x48, LDO9_CTRL, val)) {
printf("twl6035: could not turn on LDO9.\n");
return 1;
}
diff --git a/include/palmas.h b/include/palmas.h
index 305092e..e629fbf 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -36,7 +36,19 @@
 #define LDO_MODE_SLEEP (1 << 2)
 #define LDO_MODE_ACTIVE(1 << 0)
 
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
+/*
+ * Functions to read and write from TPS659038/TWL6035/TWL6037
+ * or other Palmas family of TI PMICs
+ */
+static inline int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
+{
+   return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
+{
+   return i2c_read(chip_no, reg, 1, val, 1);
+}
+
 void palmas_init_settings(void);
 int palmas_mmc1_poweron_ldo(void);
-- 
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] mx6: Fix the reading of CPU revision

2013-03-26 Thread Eric Nelson

Hi Fabio,

On 03/26/2013 05:54 AM, Fabio Estevam wrote:

Currently when booting a mx6 solo processor get_cpu_rev() returns 0x62xxx, which
is an invalid mx6 CPU revision. This causes run-time problems when trying to use
VPU library in the kernel, as this library loads the VPU firmware according
to the CPU type.

Fix get_cpu_rev() so that it correctly returns 0x61xxx for a mx6 solo.

While at it, also remove the duplicate definitions for MXC_CPU_ types.

Tested on a Wandboard solo and on a mx6qsabresd.

Signed-off-by: Fabio Estevam 
---
  arch/arm/cpu/armv7/mx6/soc.c  |   28 
  arch/arm/imx-common/cpu.c |   16 ++--
  arch/arm/include/asm/arch-mx5/sys_proto.h |7 ---
  arch/arm/include/asm/arch-mx6/sys_proto.h |7 ---
  4 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 193ba12..87725eb 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -43,22 +43,18 @@ struct scu_regs {
  u32 get_cpu_rev(void)
  {
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
-   u32 reg = readl(&anatop->digprog_sololite);
-   u32 type = ((reg >> 16) & 0xff);
-
-   if (type != MXC_CPU_MX6SL) {
-   reg = readl(&anatop->digprog);
-   type = ((reg >> 16) & 0xff);
-   if (type == MXC_CPU_MX6DL) {
-   struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
-   u32 cfg = readl(&scu->config) & 3;
-
-   if (!cfg)
-   type = MXC_CPU_MX6SOLO;
-   }
-   }
-   reg &= 0xff;/* mx6 silicon revision */
-   return (type << 12) | (reg + 0x10);
+   u32 fsl_system_rev;
+   u32 cpu_rev = readl(&anatop->digprog);
+
+   /* Chip Silicon ID */
+   fsl_system_rev = ((cpu_rev >> 16) & 0xFF) << 12;
+   /* Chip silicon major revision */
+   fsl_system_rev |= ((cpu_rev >> 8) & 0xFF) << 4;
+   fsl_system_rev += 0x10;
+   /* Chip silicon minor revision */
+   fsl_system_rev |= cpu_rev & 0xFF;


Nitpick: 0x0F to avoid trashing major revision?

Tested on Quad (TO 1.0) and Solo (TO 1.1)

Tested-By: Eric Nelson 

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


Re: [U-Boot] [PATCH 2/2] mmc: omap_hsmmc.c: only register getcd/getwp callbacks if gpio could be used

2013-03-26 Thread Tom Rini
On Thu, Mar 21, 2013 at 03:00:04PM +0100, Peter Korsgaard wrote:

> Gets rid of warnings from omap_gpio:
> ERROR : check_gpio: invalid GPIO -1
> 
> (and undefined behaviour as the -1 error code is interpreted as gpio value)
> 
> Signed-off-by: Peter Korsgaard 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] am335x_evm: Add better timings for the new BeagleBoard DDR3 part

2013-03-26 Thread Tom Rini
On Thu, Mar 21, 2013 at 04:30:02AM -, Tom Rini wrote:

> Tested-by: Rao Bodapati 
> Signed-off-by: Tom Rini 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] igep00x0: Enable CONFIG_CMD_BOOTZ

2013-03-26 Thread Tom Rini
On Fri, Mar 15, 2013 at 02:32:35AM -, Enric Balletbo i Serra wrote:

> From: Enric Balletbo i Serra 
> 
> With v3.9 and later of the Linux Kernel defaulting to multi-platform
> images with omap2plus_defconfig, uImage isn't builtable anymore by
> default.  Add CONFIG_CMD_BOOTZ so that we can still boot something the
> kernel spits out.
> 
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Javier Martinez Canillas 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] ARM: AM33XX: Fix typo that causes an AM duplication in CPU name.

2013-03-26 Thread Tom Rini
On Fri, Mar 15, 2013 at 01:35:37AM -, Enric Balletbo i Serra wrote:

> From: Enric Balletbo i Serra 
> 
> Just fix a typo displaying the CPU info. With CONFIG_DISPLAY_INFO we see
> something like AMAM335X-GP rev 0 instead of AM335X-GP rev 0.
> 
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Javier Martinez Canillas 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] am335x: Enable DDR PHY dynamic power down bit for DDR3 boards

2013-03-26 Thread Tom Rini
On Thu, Mar 14, 2013 at 09:11:16PM -, hvaib...@ti.com wrote:

> Enable DDR PHY dynamic power down bit, which enables
> powering down the IO receiver when not performing read.
> 
> This also helps in reducing overall power consumption in
> low power states (suspend/standby).
> 
> Signed-off-by: Vaibhav Hiremath 
> Signed-off-by: Satyanarayana, Sandhya 
> Cc: Tom Rini 
> Reviewed-by: Tom Rini 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
thanks!

-- 
Tom


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


Re: [U-Boot] am33xx: Add required includes to some omap/am33xx code

2013-03-26 Thread Tom Rini
On Thu, Mar 14, 2013 at 11:15:25AM -, Tom Rini wrote:

> - In arch/arm/cpu/armv7/omap-common/timer.c,
>   drivers/mtd/nand/omap_gpmc.c and drivers/net/cpsw.c add #include files
>   that the driver needs but had been relying on  to bring in.
> - In arch/arm/cpu/armv7/omap-common/lowlevel_init.S add 
> - In am335x_evm.h and pcm051.h don't globally include
>and  but just 
>   as that is the only include which defines things the config uses.
> 
> Cc: Lars Poeschel 
> Signed-off-by: Tom Rini 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
thanks!

-- 
Tom


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


Re: [U-Boot] am33xx:ddr:Fix config_sdram to work for all DDR

2013-03-26 Thread Tom Rini
On Fri, Mar 08, 2013 at 07:40:58AM -, Tom Rini wrote:

> From: Steve Kipisz 
>
> The original write to sdram_config is correct for DDR3 but incorrect
> for DDR2 so SPL was hanging. For DDR2, the write to sdram_config
> should be after the writes to ref_ctrl. This was working for DDR3
> because there was a write of 0x2800 to ref_ctrl before a write
> to sdram_config.
>
> Tested on: GP EVM 1.1A (DDR2), GP EVM 1.5A (DDR3),
>Beaglebone A6 (DDR2), Beagleone Blacd A4A (DDR3)
>
> Signed-off-by: Steve Kipisz 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
thanks!

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


Re: [U-Boot] arm: Correct CONFIG_STANDALONE_LOAD_ADDR for AM33XX/OMAP* platforms

2013-03-26 Thread Tom Rini
On Thu, Mar 14, 2013 at 06:49:04AM -, Tom Rini wrote:

> All of these platforms have memory starting at 0x8000, so this is
> the correct CONFIG_STANDALONE_LOAD_ADDR for all of them.
> 
> Signed-off-by: Tom Rini 
> Acked-by: Peter Korsgaard 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] [U-Boot, v3, 1/3] am335x_evm: add support for BeagleBone Black DT name

2013-03-26 Thread Tom Rini
On Thu, Mar 14, 2013 at 05:55:19AM -, Tom Rini wrote:

> From: Koen Kooi 
> 
> Cc: Matt Porter 
> Cc: Nishanth Menon 
> Signed-off-by: Koen Kooi 
> Signed-off-by: Tom Rini 
> Acked-by: Matt Porter 
> Acked-by: Peter Korsgaard 
> Acked-by: Nishanth Menon 

Along with the rest of the series, applied to u-boot-ti/master (and
already pulled into u-boot-arm/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] [U-Boot, v4] Allow AM335x MPU core clock speed to be specified in the board config file

2013-03-26 Thread Tom Rini
On Mon, Mar 04, 2013 at 01:27:20AM -, Mark Jackson wrote:

> Allow AM335x MPU core clock speed to be specified in the board config file.
> To use, add the following to the board's config file:-
> 
> #define CONFIG_SYS_MPUCLK 
> 
> Signed-off-by: Mark Jackson 
> Acked-by: Peter Korsgaard 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] Initialise correct GPMC WAITx irq for AM33xx

2013-03-26 Thread Tom Rini
On Thu, Feb 21, 2013 at 02:49:38AM -, Mark Jackson wrote:

> Currently WAIT0 irq is reset and then WAIT1 irq is enabled.
> Fix it such that WAIT0 irq is enabled instead.
> 
> Signed-off-by: Mark Jackson 
> Acked-by: Peter Korsgaard 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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] [U-Boot, 5/5] cm-t35: add support for loading splash image from NAND

2013-03-26 Thread Tom Rini
On Sat, Dec 22, 2012 at 09:03:48PM -, Nikita Kiryanov wrote:

> Add support for loading splash image from NAND
> 
> Signed-off-by: Nikita Kiryanov 
> Signed-off-by: Igor Grinberg 

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
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 1/2] mmc: mmc_getcd/getwp: use sensible defaults

2013-03-26 Thread Tom Rini
On Thu, Mar 21, 2013 at 03:00:03PM +0100, Peter Korsgaard wrote:

> Let mmc_getcd() return true and mmc_getwp() false if mmc driver doesn't
> provide handlers for them.
> 
> Signed-off-by: Peter Korsgaard 
> ---
>  drivers/mmc/mmc.c |   14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 7b5fdd9..54d23eb 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -51,8 +51,11 @@ int mmc_getwp(struct mmc *mmc)
>  
>   wp = board_mmc_getwp(mmc);
>  
> - if ((wp < 0) && mmc->getwp)
> - wp = mmc->getwp(mmc);
> + if (wp < 0)
> + if (mmc->getwp)
> + wp = mmc->getwp(mmc);
> + else
> + wp = 0;
>  
>   return wp;
>  }
> @@ -692,8 +695,11 @@ int mmc_getcd(struct mmc *mmc)
>  
>   cd = board_mmc_getcd(mmc);
>  
> - if ((cd < 0) && mmc->getcd)
> - cd = mmc->getcd(mmc);
> + if (cd < 0)
> + if (mmc->getcd)
> + cd = mmc->getcd(mmc);
> + else
> + cd = 1;
>  
>   return cd;
>  }

With the following to fix a build warning:

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 54d23eb..d732581 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -51,11 +51,12 @@ int mmc_getwp(struct mmc *mmc)
 
wp = board_mmc_getwp(mmc);
 
-   if (wp < 0)
+   if (wp < 0) {
if (mmc->getwp)
wp = mmc->getwp(mmc);
else
wp = 0;
+   }
 
return wp;
 }
@@ -695,11 +696,12 @@ int mmc_getcd(struct mmc *mmc)
 
cd = board_mmc_getcd(mmc);
 
-   if (cd < 0)
+   if (cd < 0) {
if (mmc->getcd)
cd = mmc->getcd(mmc);
else
cd = 1;
+   }
 
return cd;
 }

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

-- 
Tom


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


Re: [U-Boot] [PATCH v4 0/9] Add TI814x EVM Support

2013-03-26 Thread Tom Rini
On Fri, Mar 15, 2013 at 04:07:01PM -0400, Matt Porter wrote:

> This series adds support for the PG1.0 TI814x EVM board. TI814x
> fits into the existing AM33XX SoC support with some refactoring
> of the AM33XX-specific emif4, clock, and mux code.
> 
> It has been tested booting up a Linux kernel and regression tested
> on BeagleBone and EVM-SK AM33XX boards. It has also been MAKEALL
> tested for all am33xx platforms.
> 
> The series applies on top of the "add required includes patch" from
> Tom Rini at http://patchwork.ozlabs.org/patch/227804/
> 
> Changes since v3:
>   - Fix pcm051 build breakage
>   - Fix unused variable warning in emif4 support
>   - Remove unused includes (fixed by required includes patch)
>   - Remove unused CONFIG_FS_* options (fixed by above patch)
> 
> Changes since v2:
>   - Fix EMIF/L3F clock enable ordering issue
> 
> Changes since v1:
>   - Fix warnings in ddr.c
>   - Split hardware.h -> hardware_am33xx.h/ti814x.h
>   - Remove unused dmtimer support
>   - Add register structs bit definitions
>   - Rename soc-specific clock files for consistency
>   - Move soc-specific defs only used in one place to clock_*.c
>   - fix copyright dates and filenames in headers
>   - remove clocks_*.h and go back to clock.h
>   - Rename mux includes for consistency
>   - Correct mmc reference clock for ti814x
>   - Squash MAINTAINERS and build bits to board support commit
>   - Config fixes (copyright, mtest, findfdt, fs options, cleanups)
>   - Fix wdtimer warning
> 
> Matt Porter (9):
>   am33xx: convert defines from am33xx-specific to generic names
>   am33xx: refactor emif4/ddr to support multiple EMIF instances
>   am33xx: refactor am33xx clocks and add ti814x support
>   am33xx: refactor am33xx mux support and add ti814x support
>   am33xx: add ti814x specific register definitions
>   am33xx: add dmm support to emif4 library
>   am33xx: support ti814x mmc reference clock
>   ns16550: enable quirks for ti814x
>   ti814x_evm: add ti814x evm board support
> 
>  MAINTAINERS|4 +
>  Makefile   |2 +-
>  arch/arm/cpu/armv7/Makefile|2 +-
>  arch/arm/cpu/armv7/am33xx/Makefile |3 +-
>  arch/arm/cpu/armv7/am33xx/board.c  |4 +-
>  .../cpu/armv7/am33xx/{clock.c => clock_am33xx.c}   |   34 +-
>  arch/arm/cpu/armv7/am33xx/clock_ti814x.c   |  406 
> 
>  arch/arm/cpu/armv7/am33xx/ddr.c|   99 +++--
>  arch/arm/cpu/armv7/am33xx/emif4.c  |   57 ++-
>  arch/arm/cpu/armv7/am33xx/sys_info.c   |3 +
>  arch/arm/cpu/armv7/omap-common/Makefile|2 +-
>  arch/arm/include/asm/arch-am33xx/clock.h   |2 +-
>  arch/arm/include/asm/arch-am33xx/clocks_am33xx.h   |   33 +-
>  arch/arm/include/asm/arch-am33xx/cpu.h |   11 +-
>  arch/arm/include/asm/arch-am33xx/ddr_defs.h|   57 ++-
>  arch/arm/include/asm/arch-am33xx/hardware.h|   40 +-
>  arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |   54 +++
>  arch/arm/include/asm/arch-am33xx/hardware_ti814x.h |   53 +++
>  arch/arm/include/asm/arch-am33xx/mmc_host_def.h|4 +
>  arch/arm/include/asm/arch-am33xx/mux.h |  235 +--
>  arch/arm/include/asm/arch-am33xx/mux_am33xx.h  |  247 
>  arch/arm/include/asm/arch-am33xx/mux_ti814x.h  |  311 +++
>  arch/arm/include/asm/arch-am33xx/omap.h|5 +
>  arch/arm/include/asm/arch-am33xx/spl.h |5 +
>  board/phytec/pcm051/board.c|8 +-
>  board/ti/am335x/board.c|   12 +-
>  board/ti/ti814x/Makefile   |   46 +++
>  board/ti/ti814x/evm.c  |  198 ++
>  board/ti/ti814x/evm.h  |7 +
>  board/ti/ti814x/mux.c  |   51 +++
>  boards.cfg |1 +
>  drivers/serial/ns16550.c   |5 +-
>  include/configs/ti814x_evm.h   |  220 +++
>  spl/Makefile   |2 +-
>  34 files changed, 1851 insertions(+), 372 deletions(-)
>  rename arch/arm/cpu/armv7/am33xx/{clock.c => clock_am33xx.c} (91%)
>  create mode 100644 arch/arm/cpu/armv7/am33xx/clock_ti814x.c
>  create mode 100644 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h
>  create mode 100644 arch/arm/include/asm/arch-am33xx/hardware_ti814x.h
>  create mode 100644 arch/arm/include/asm/arch-am33xx/mux_am33xx.h
>  create mode 100644 arch/arm/include/asm/arch-am33xx/mux_ti814x.h
>  create mode 100644 board/ti/ti814x/Makefile
>  create mode 100644 board/ti/ti814x/evm.c
>  create mode 100644 board/ti/ti814x/evm.h
>  create mode 100644 board/ti/ti814x/mux.c
>  create mode 100644 

Re: [U-Boot] [PATCH] disk: part_dos: check harder for partition table.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364288765-2637-1-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> Devices that used to have a whole disk FAT filesystem but got then
> partitioned will most likely still have a FAT or FAT32 signature
> in the first sector as this sector does not get overwritten by
> a partitioning tool (otherwise the tool would risk to kill the mbr).

Patch version missing.  Patch change history missing. Checkpatch
errors and warnings.  Please fix!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
People are always a lot more complicated than you  think.  It's  very
important to remember that. - Terry Pratchett, _Truckers_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd/gpt: Support gpt command for all devices.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364288746-2597-1-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> The gpt command was only implemented for mmc devices. There is no reason
> why this command should not be generalized and be applied all other
> storage device classes.
> This change both simplifies the implementation and eliminates a
> build failure for systems that don't support mmcs.
> 
> Signed-off-by: Egbert Eich 
> ---
>  common/cmd_gpt.c |   43 ++-
>  1 files changed, 18 insertions(+), 25 deletions(-)

Please mark resubmits of new versions of patches as such; also, please
provide a change log so we can see what you actually changed.  Please
see [1] for detailled instructions, and consider using patman to help
you doing this.

[1] http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Note that this patch is still not checkpatch-clean:

WARNING: line over 80 characters
#195: FILE: common/cmd_gpt.c:310:
+   printf("%s: %s dev %d NOT available\n", __func__, 
argv[2], dev);

Please fix!!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
As a general rule, the freedom of any people can  be  judged  by  the
volume of their laughter.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] disk/part_dos: check harder for partition table

2013-03-26 Thread Egbert Eich
From: Egbert Eich 

Devices that used to have a whole disk FAT filesystem but got then
partitioned will most likely still have a FAT or FAT32 signature
in the first sector as this sector does not get overwritten by
a partitioning tool (otherwise the tool would risk to kill the mbr).

The current partition search algorithm will erronously detect such
a device as a raw FAT device.

Instead of looking for the FAT or FAT32 signatures immediately we
use the same algorithm as used by the Linux kernel and first check
for a valid boot indicator flag on each of the 4 partitions.
If the value of this flag is invalid for the first entry we then
do the raw partition check.
If the flag for any higher partition is wrong we assume the device
is neiter a MBR nor PBR device.

v2: Coding style cleanup.

Signed-off-by: Egbert Eich 
---
 disk/part_dos.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index 37087a6..3fc8564 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -74,13 +74,25 @@ static void print_one_part(dos_partition_t *p, int 
ext_part_sector,
 
 static int test_block_type(unsigned char *buffer)
 {
+   int slot;
+   struct dos_partition *p;
+
if((buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
(buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
return (-1);
} /* no DOS Signature at all */
-   if (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0 ||
-   strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET],"FAT32",5)==0) {
-   return DOS_PBR; /* is PBR */
+   p = (struct dos_partition *)&buffer[DOS_PART_TBL_OFFSET];
+   for (slot = 0; slot < 3; slot++) {
+   if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+   if (!slot &&
+   (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],
+"FAT", 3) == 0 ||
+strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET],
+"FAT32", 5) == 0)) {
+   return DOS_PBR; /* is PBR */
+   } else
+   return -1;
+   }
}
return DOS_MBR; /* Is MBR */
 }
-- 
1.7.7

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


Re: [U-Boot] [PATCH V2 0/9] OMAP3-5: TWL[46]03[05]: cleanup register access and misc minimal cleanups

2013-03-26 Thread Sricharan R
On Tuesday 26 March 2013 06:55 PM, Nishanth Menon wrote:
> On 15:01-20130326, Sricharan R wrote:
>> approach we will end up creating a new tps659038.h which does exactly
>> the same thing. This does not feel correct. Can't we differentiate
>>  using register names that are passed instead ?
> tps659038/twl6035/twl6037 all belong to palmas family of PMICs. So, how about
> renaming the file to palmas.c and use palmas_i2c_read/write functions?
> 
Yes, sounds good.

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


Re: [U-Boot] [PATCH V2 0/9] OMAP3-5: TWL[46]03[05]: cleanup register access and misc minimal cleanups

2013-03-26 Thread Nishanth Menon
On 15:01-20130326, Sricharan R wrote:
> approach we will end up creating a new tps659038.h which does exactly
> the same thing. This does not feel correct. Can't we differentiate
>  using register names that are passed instead ?
tps659038/twl6035/twl6037 all belong to palmas family of PMICs. So, how about
renaming the file to palmas.c and use palmas_i2c_read/write functions?

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


[U-Boot] [PATCH v2] cmd/gpt: Support gpt command for all devices.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

The gpt command was only implemented for mmc devices. There is no reason
why this command should not be generalized and be applied all other
storage device classes.
This change both simplifies the implementation and eliminates a
build failure for systems that don't support mmcs.

Signed-off-by: Egbert Eich 
---
 common/cmd_gpt.c |   44 +++-
 1 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index efd7934..3594dca 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -134,7 +133,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
int errno = 0;
uint64_t size_ll, start_ll;
 
-   debug("%s: MMC lba num: 0x%x %d\n", __func__,
+   debug("%s:  lba num: 0x%x %d\n", __func__,
  (unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
 
if (str_part == NULL)
@@ -247,25 +246,18 @@ err:
return errno;
 }
 
-static int gpt_mmc_default(int dev, const char *str_part)
+static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
 {
int ret;
char *str_disk_guid;
u8 part_count = 0;
disk_partition_t *partitions = NULL;
 
-   struct mmc *mmc = find_mmc_device(dev);
-
-   if (mmc == NULL) {
-   printf("%s: mmc dev %d NOT available\n", __func__, dev);
-   return CMD_RET_FAILURE;
-   }
-
if (!str_part)
return -1;
 
/* fill partitions */
-   ret = set_gpt_info(&mmc->block_dev, str_part,
+   ret = set_gpt_info(blk_dev_desc, str_part,
&str_disk_guid, &partitions, &part_count);
if (ret) {
if (ret == -1)
@@ -278,7 +270,7 @@ static int gpt_mmc_default(int dev, const char *str_part)
}
 
/* save partitions layout to disk */
-   gpt_restore(&mmc->block_dev, str_disk_guid, partitions, part_count);
+   gpt_restore(&blk_dev_desc, str_disk_guid, partitions, part_count);
free(str_disk_guid);
free(partitions);
 
@@ -306,20 +298,22 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
/* command: 'write' */
if ((strcmp(argv[1], "write") == 0) && (argc == 5)) {
-   /* device: 'mmc' */
-   if (strcmp(argv[2], "mmc") == 0) {
-   /* check if 'dev' is a number */
-   for (pstr = argv[3]; *pstr != '\0'; pstr++)
-   if (!isdigit(*pstr)) {
-   printf("'%s' is not a number\n",
-   argv[3]);
-   return CMD_RET_USAGE;
-   }
-   dev = (int)simple_strtoul(argv[3], NULL, 10);
-   /* write to mmc */
-   if (gpt_mmc_default(dev, argv[4]))
-   return CMD_RET_FAILURE;
+   char *ep;
+   block_dev_desc_t *blk_dev_desc;
+   dev = (int)simple_strtoul(argv[3], NULL, 10);
+   if (*ep) {
+   printf("'%s' is not a number\n", argv[3]);
+   return CMD_RET_USAGE;
}
+   blk_dev_desc = get_dev(argv[2], dev);
+   if (!blk_dev_desc) {
+   printf("%s: %s dev %d NOT available\n",
+  __func__, argv[2], dev);
+   return CMD_RET_FAILURE;
+   }
+
+   if (gpt_default(blk_dev_desc, argv[4]))
+   return CMD_RET_FAILURE;
} else {
return CMD_RET_USAGE;
}
-- 
1.7.7

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


[U-Boot] [PATCH v2] part/dev_desc: Add log2 of Blocksize to block_dev_desc data struct.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

This value serves as the shift value used to calculate the block number
to read in file systems when implementing aviable block sizes.

Signed-off-by: Egbert Eich 
---
 common/cmd_ide.c  |5 +
 common/cmd_sata.c |1 +
 common/cmd_scsi.c |4 
 common/usb_storage.c  |1 +
 drivers/block/ata_piix.c  |1 +
 drivers/block/pata_bfin.c |2 ++
 drivers/block/systemace.c |1 +
 drivers/mmc/mmc.c |1 +
 include/part.h|5 +
 9 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 0105bdb..78b4aa7 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -455,6 +455,8 @@ void ide_init(void)
ide_dev_desc[i].dev = i;
ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
ide_dev_desc[i].blksz = 0;
+   ide_dev_desc[i].log2blksz =
+   LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz));
ide_dev_desc[i].lba = 0;
ide_dev_desc[i].block_read = ide_read;
ide_dev_desc[i].block_write = ide_write;
@@ -806,6 +808,7 @@ static void ide_ident(block_dev_desc_t *dev_desc)
/* assuming HD */
dev_desc->type = DEV_TYPE_HARDDISK;
dev_desc->blksz = ATA_BLOCKSIZE;
+   dev_desc->log2blksz = LOG2(dev_desc->blksz);
dev_desc->lun = 0;  /* just to fill something in... */
 
 #if 0  /* only used to test the powersaving mode,
@@ -1448,6 +1451,7 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
dev_desc->lun = 0;
dev_desc->lba = 0;
dev_desc->blksz = 0;
+   dev_desc->log2blksz = LOG2_INVALID(typeof(dev_desc->log2blksz));
dev_desc->type = iobuf[0] & 0x1f;
 
if ((iobuf[1] & 0x80) == 0x80)
@@ -1492,6 +1496,7 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
dev_desc->blksz = ((unsigned long) iobuf[4] << 24) +
((unsigned long) iobuf[5] << 16) +
((unsigned long) iobuf[6] << 8) + ((unsigned long) iobuf[7]);
+   dev_desc->log2blksz = LOG2(dev_desc->blksz);
 #ifdef CONFIG_LBA48
/* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
dev_desc->lba48 = 0;
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index 8d57285..5a57a37 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -44,6 +44,7 @@ int __sata_initialize(void)
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
sata_dev_desc[i].lba = 0;
sata_dev_desc[i].blksz = 512;
+   sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz);
sata_dev_desc[i].block_read = sata_read;
sata_dev_desc[i].block_write = sata_write;
 
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 266bfa6..192a439 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -106,6 +106,8 @@ void scsi_scan(int mode)
scsi_dev_desc[i].lun=0xff;
scsi_dev_desc[i].lba=0;
scsi_dev_desc[i].blksz=0;
+   scsi_dev_desc[i].log2blksz =
+   LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz));
scsi_dev_desc[i].type=DEV_TYPE_UNKNOWN;
scsi_dev_desc[i].vendor[0]=0;
scsi_dev_desc[i].product[0]=0;
@@ -166,6 +168,8 @@ void scsi_scan(int mode)
}
scsi_dev_desc[scsi_max_devs].lba=capacity;
scsi_dev_desc[scsi_max_devs].blksz=blksz;
+   scsi_dev_desc[scsi_max_devs].log2blksz =
+   LOG2(scsi_dev_desc[scsi_max_devs].blksz);
scsi_dev_desc[scsi_max_devs].type=perq;
init_part(&scsi_dev_desc[scsi_max_devs]);
 removable:
diff --git a/common/usb_storage.c b/common/usb_storage.c
index fb322b4..c5db044 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1430,6 +1430,7 @@ int usb_stor_get_info(struct usb_device *dev, struct 
us_data *ss,
*capacity, *blksz);
dev_desc->lba = *capacity;
dev_desc->blksz = *blksz;
+   dev_desc->log2blksz = LOG2(dev_desc->blksz);
dev_desc->type = perq;
USB_STOR_PRINTF(" address %d\n", dev_desc->target);
USB_STOR_PRINTF("partype: %d\n", dev_desc->part_type);
diff --git a/drivers/block/ata_piix.c b/drivers/block/ata_piix.c
index 1e33a66..fcae448 100644
--- a/drivers/block/ata_piix.c
+++ b/drivers/block/ata_piix.c
@@ -406,6 +406,7 @@ void sata_identify(int num, int dev)
/* assuming HD */
sata_dev_desc[devno].type = DEV_TYPE_HARDDISK;
sata_dev_desc[devno].blksz = ATA_BLOCKSIZE;
+   sata_dev_desc[devno].log2blksz = LOG2(sata_dev_desc[devno].blksz);
sata_dev_desc[devno].lun = 0;   /* just to fill something in... */
 }
 
diff --git a/drivers/block/pata_bfin.c b/drivers/block/pata_bfin.c
index b847dd9..27ecaf4

[U-Boot] [PATCH v2] disk/gpt: Fix GPT Partition handling for Blocksize != 512.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

Disks beyond 2T in size use blocksizes of 4096 bytes. However a lot of
code in u-boot  still assumes a 512 byte blocksize.

Signed-off-by: Egbert Eich 
---
 disk/part_efi.c|   38 ++
 include/common.h   |   11 +--
 include/part.h |4 
 include/part_efi.h |2 --
 4 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index b3fd0e9..ba86aa5 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -114,7 +114,7 @@ static inline int is_bootable(gpt_entry *p)
 
 void print_part_efi(block_dev_desc_t * dev_desc)
 {
-   ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
+   ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
gpt_entry *gpt_pte = NULL;
int i = 0;
char uuid[37];
@@ -161,7 +161,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
 int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
disk_partition_t * info)
 {
-   ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
+   ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
gpt_entry *gpt_pte = NULL;
 
/* "part" argument must be at least 1 */
@@ -189,7 +189,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int 
part,
/* The ending LBA is inclusive, to calculate size, add 1 to it */
info->size = ((u64)le64_to_cpu(gpt_pte[part - 1].ending_lba) + 1)
 - info->start;
-   info->blksz = GPT_BLOCK_SIZE;
+   info->blksz = dev_desc->blksz;
 
sprintf((char *)info->name, "%s",
print_efiname(&gpt_pte[part - 1]));
@@ -209,7 +209,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int 
part,
 
 int test_part_efi(block_dev_desc_t * dev_desc)
 {
-   ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, legacymbr, 1);
+   ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz);
 
/* Read legacy MBR from block 0 and validate it */
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *)legacymbr) != 1)
@@ -310,9 +310,8 @@ static int string_uuid(char *uuid, u8 *dst)
 int write_gpt_table(block_dev_desc_t *dev_desc,
gpt_header *gpt_h, gpt_entry *gpt_e)
 {
-   const int pte_blk_num = (gpt_h->num_partition_entries
-   * sizeof(gpt_entry)) / dev_desc->blksz;
-
+   const int pte_blk_cnt = BLOCK_CNT((gpt_h->num_partition_entries
+  * sizeof(gpt_entry)), dev_desc);
u32 calc_crc32;
u64 val;
 
@@ -335,8 +334,8 @@ int write_gpt_table(block_dev_desc_t *dev_desc,
if (dev_desc->block_write(dev_desc->dev, 1, 1, gpt_h) != 1)
goto err;
 
-   if (dev_desc->block_write(dev_desc->dev, 2, pte_blk_num, gpt_e)
-   != pte_blk_num)
+   if (dev_desc->block_write(dev_desc->dev, 2, pte_blk_cnt, gpt_e)
+   != pte_blk_cnt)
goto err;
 
/* recalculate the values for the Second GPT Header */
@@ -351,7 +350,7 @@ int write_gpt_table(block_dev_desc_t *dev_desc,
 
if (dev_desc->block_write(dev_desc->dev,
  le32_to_cpu(gpt_h->last_usable_lba + 1),
- pte_blk_num, gpt_e) != pte_blk_num)
+ pte_blk_cnt, gpt_e) != pte_blk_cnt)
goto err;
 
if (dev_desc->block_write(dev_desc->dev,
@@ -461,13 +460,18 @@ int gpt_restore(block_dev_desc_t *dev_desc, char 
*str_disk_guid,
 {
int ret;
 
-   gpt_header *gpt_h = calloc(1, sizeof(gpt_header));
+   gpt_header *gpt_h = calloc(1, PAD_TO_BLOCKSIZE(sizeof(gpt_header),
+  dev_desc));
+   gpt_entry *gpt_e;
+
if (gpt_h == NULL) {
printf("%s: calloc failed!\n", __func__);
return -1;
}
 
-   gpt_entry *gpt_e = calloc(GPT_ENTRY_NUMBERS, sizeof(gpt_entry));
+   gpt_e = calloc(1, PAD_TO_BLOCKSIZE(GPT_ENTRY_NUMBERS
+  * sizeof(gpt_entry),
+  dev_desc));
if (gpt_e == NULL) {
printf("%s: calloc failed!\n", __func__);
free(gpt_h);
@@ -651,7 +655,7 @@ static int is_gpt_valid(block_dev_desc_t * dev_desc, 
unsigned long long lba,
 static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
 gpt_header * pgpt_head)
 {
-   size_t count = 0;
+   size_t count = 0, blk_cnt;
gpt_entry *pte = NULL;
 
if (!dev_desc || !pgpt_head) {
@@ -668,7 +672,8 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * 
dev_desc,
 
/* Allocate memory for PTE, remember to FREE */
if (count != 0) {
-   pte = memalign(ARCH_DMA_MINALIGN, count);
+   pte = memalign(ARCH_DMA_MINALIGN,
+ 

[U-Boot] [PATCH v2] fs/ext4: Support device block sizes != 512 bytes.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

The 512 byte block size was hard coded in the ext4 file systems. Large
harddisks today support bigger block sizes typically 4096 bytes.

Signed-off-by: Egbert Eich 
---
 fs/ext4/dev.c  |   60 +++
 fs/ext4/ext4_common.c  |   42 ++---
 fs/ext4/ext4_common.h  |2 +-
 fs/ext4/ext4_journal.c |6 +---
 fs/ext4/ext4_write.c   |   32 +
 fs/ext4/ext4fs.c   |   14 ++
 include/ext4fs.h   |1 +
 include/ext_common.h   |   12 ++---
 8 files changed, 94 insertions(+), 75 deletions(-)

diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c
index 464a67d..7b6fd16 100644
--- a/fs/ext4/dev.c
+++ b/fs/ext4/dev.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include "ext4_common.h"
 
 unsigned long part_offset;
 
@@ -48,37 +49,41 @@ static disk_partition_t *part_info;
 
 void ext4fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
 {
+   assert(rbdd->blksz == (1 << rbdd->log2blksz));
ext4fs_block_dev_desc = rbdd;
part_info = info;
part_offset = info->start;
-   get_fs()->total_sect = (info->size * info->blksz) / SECTOR_SIZE;
+   get_fs()->total_sect = (info->size * info->blksz) >>
+   get_fs()->dev_desc->log2blksz;
get_fs()->dev_desc = rbdd;
 }
 
 int ext4fs_devread(int sector, int byte_offset, int byte_len, char *buf)
 {
-   ALLOC_CACHE_ALIGN_BUFFER(char, sec_buf, SECTOR_SIZE);
unsigned block_len;
+   int log2blksz = ext4fs_block_dev_desc->log2blksz;
+   ALLOC_CACHE_ALIGN_BUFFER(char, sec_buf, (ext4fs_block_dev_desc ?
+ext4fs_block_dev_desc->blksz :
+0));
+   if (ext4fs_block_dev_desc == NULL) {
+   printf("** Invalid Block Device Descriptor (NULL)\n");
+   return 0;
+   }
 
/* Check partition boundaries */
if ((sector < 0)
-   || ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) >=
-   part_info->size)) {
+   || ((sector + ((byte_offset + byte_len - 1) >> log2blksz))
+   >= part_info->size)) {
printf("%s read outside partition %d\n", __func__, sector);
return 0;
}
 
/* Get the read to the beginning of a partition */
-   sector += byte_offset >> SECTOR_BITS;
-   byte_offset &= SECTOR_SIZE - 1;
+   sector += byte_offset >> log2blksz;
+   byte_offset &= ext4fs_block_dev_desc->blksz - 1;
 
debug(" <%d, %d, %d>\n", sector, byte_offset, byte_len);
 
-   if (ext4fs_block_dev_desc == NULL) {
-   printf("** Invalid Block Device Descriptor (NULL)\n");
-   return 0;
-   }
-
if (byte_offset != 0) {
/* read first part which isn't aligned with start of sector */
if (ext4fs_block_dev_desc->
@@ -89,9 +94,12 @@ int ext4fs_devread(int sector, int byte_offset, int 
byte_len, char *buf)
return 0;
}
memcpy(buf, sec_buf + byte_offset,
-   min(SECTOR_SIZE - byte_offset, byte_len));
-   buf += min(SECTOR_SIZE - byte_offset, byte_len);
-   byte_len -= min(SECTOR_SIZE - byte_offset, byte_len);
+   min(ext4fs_block_dev_desc->blksz
+   - byte_offset, byte_len));
+   buf += min(ext4fs_block_dev_desc->blksz
+  - byte_offset, byte_len);
+   byte_len -= min(ext4fs_block_dev_desc->blksz
+   - byte_offset, byte_len);
sector++;
}
 
@@ -99,12 +107,12 @@ int ext4fs_devread(int sector, int byte_offset, int 
byte_len, char *buf)
return 1;
 
/* read sector aligned part */
-   block_len = byte_len & ~(SECTOR_SIZE - 1);
+   block_len = byte_len & ~(ext4fs_block_dev_desc->blksz - 1);
 
if (block_len == 0) {
-   ALLOC_CACHE_ALIGN_BUFFER(u8, p, SECTOR_SIZE);
+   ALLOC_CACHE_ALIGN_BUFFER(u8, p, ext4fs_block_dev_desc->blksz);
 
-   block_len = SECTOR_SIZE;
+   block_len = ext4fs_block_dev_desc->blksz;
ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc->dev,
  part_info->start + sector,
  1, (unsigned long *)p);
@@ -114,16 +122,16 @@ int ext4fs_devread(int sector, int byte_offset, int 
byte_len, char *buf)
 
if (ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc->dev,
   part_info->start + sector,
-  block_len / SECTOR_SIZE,
+  block_len >> log2blksz,
   (unsigned long *) buf) !=
-

[U-Boot] [PATCH] disk: part_dos: check harder for partition table.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

Devices that used to have a whole disk FAT filesystem but got then
partitioned will most likely still have a FAT or FAT32 signature
in the first sector as this sector does not get overwritten by
a partitioning tool (otherwise the tool would risk to kill the mbr).

The current partition search algorithm will erronosly detect such
a device as a raw FAT device.

Instead of looking for the FAT or FAT32 signatures immediately we
use the same algorithm as used by the Linux kernel and first check
for a valid boot indicator flag on each of the 4 partitions.
If the value of this flag is invalid for the first entry we then
do the raw partition check.
If the flag for any higher partition is wrong we assume the device
is neiter a MBR nor PBR device.

Signed-off-by: Egbert Eich 
---
 disk/part_dos.c |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index 37087a6..8a23495 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -74,13 +74,23 @@ static void print_one_part(dos_partition_t *p, int 
ext_part_sector,
 
 static int test_block_type(unsigned char *buffer)
 {
+   int slot;
+   struct dos_partition *p;
+
if((buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
(buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
return (-1);
} /* no DOS Signature at all */
-   if (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0 ||
-   strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET],"FAT32",5)==0) {
-   return DOS_PBR; /* is PBR */
+   p = ( struct dos_partition *)&buffer[DOS_PART_TBL_OFFSET];
+   for (slot = 0; slot < 3; slot++) {
+   if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+   if (!slot &&
+   (strncmp((char 
*)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0 ||
+strncmp((char 
*)&buffer[DOS_PBR32_FSTYPE_OFFSET],"FAT32",5)==0)) {
+   return DOS_PBR; /* is PBR */
+   } else
+   return -1;
+   }
}
return DOS_MBR; /* Is MBR */
 }
-- 
1.7.7

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


[U-Boot] [PATCH] cmd/gpt: Support gpt command for all devices.

2013-03-26 Thread egbert . eich
From: Egbert Eich 

The gpt command was only implemented for mmc devices. There is no reason
why this command should not be generalized and be applied all other
storage device classes.
This change both simplifies the implementation and eliminates a
build failure for systems that don't support mmcs.

Signed-off-by: Egbert Eich 
---
 common/cmd_gpt.c |   43 ++-
 1 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index efd7934..1a72e8e 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -134,7 +133,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
int errno = 0;
uint64_t size_ll, start_ll;
 
-   debug("%s: MMC lba num: 0x%x %d\n", __func__,
+   debug("%s:  lba num: 0x%x %d\n", __func__,
  (unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
 
if (str_part == NULL)
@@ -247,25 +246,18 @@ err:
return errno;
 }
 
-static int gpt_mmc_default(int dev, const char *str_part)
+static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
 {
int ret;
char *str_disk_guid;
u8 part_count = 0;
disk_partition_t *partitions = NULL;
 
-   struct mmc *mmc = find_mmc_device(dev);
-
-   if (mmc == NULL) {
-   printf("%s: mmc dev %d NOT available\n", __func__, dev);
-   return CMD_RET_FAILURE;
-   }
-
if (!str_part)
return -1;
 
/* fill partitions */
-   ret = set_gpt_info(&mmc->block_dev, str_part,
+   ret = set_gpt_info(blk_dev_desc, str_part,
&str_disk_guid, &partitions, &part_count);
if (ret) {
if (ret == -1)
@@ -278,7 +270,7 @@ static int gpt_mmc_default(int dev, const char *str_part)
}
 
/* save partitions layout to disk */
-   gpt_restore(&mmc->block_dev, str_disk_guid, partitions, part_count);
+   gpt_restore(&blk_dev_desc, str_disk_guid, partitions, part_count);
free(str_disk_guid);
free(partitions);
 
@@ -306,20 +298,21 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
/* command: 'write' */
if ((strcmp(argv[1], "write") == 0) && (argc == 5)) {
-   /* device: 'mmc' */
-   if (strcmp(argv[2], "mmc") == 0) {
-   /* check if 'dev' is a number */
-   for (pstr = argv[3]; *pstr != '\0'; pstr++)
-   if (!isdigit(*pstr)) {
-   printf("'%s' is not a number\n",
-   argv[3]);
-   return CMD_RET_USAGE;
-   }
-   dev = (int)simple_strtoul(argv[3], NULL, 10);
-   /* write to mmc */
-   if (gpt_mmc_default(dev, argv[4]))
-   return CMD_RET_FAILURE;
+   char *ep;
+   block_dev_desc_t *blk_dev_desc;
+   dev = (int)simple_strtoul(argv[3], NULL, 10);
+   if (*ep) {
+   printf("'%s' is not a number\n", argv[3]);
+   return CMD_RET_USAGE;
}
+   blk_dev_desc = get_dev(argv[2], dev);
+   if (!blk_dev_desc) {
+   printf("%s: %s dev %d NOT available\n", __func__, 
argv[2], dev);
+   return CMD_RET_FAILURE;
+   }
+
+   if (gpt_default(blk_dev_desc, argv[4]))
+   return CMD_RET_FAILURE;
} else {
return CMD_RET_USAGE;
}
-- 
1.7.7

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


[U-Boot] [PATCH] mx6: Fix the reading of CPU revision

2013-03-26 Thread Fabio Estevam
Currently when booting a mx6 solo processor get_cpu_rev() returns 0x62xxx, which
is an invalid mx6 CPU revision. This causes run-time problems when trying to use
VPU library in the kernel, as this library loads the VPU firmware according
to the CPU type.

Fix get_cpu_rev() so that it correctly returns 0x61xxx for a mx6 solo.

While at it, also remove the duplicate definitions for MXC_CPU_ types.

Tested on a Wandboard solo and on a mx6qsabresd.

Signed-off-by: Fabio Estevam 
---
 arch/arm/cpu/armv7/mx6/soc.c  |   28 
 arch/arm/imx-common/cpu.c |   16 ++--
 arch/arm/include/asm/arch-mx5/sys_proto.h |7 ---
 arch/arm/include/asm/arch-mx6/sys_proto.h |7 ---
 4 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 193ba12..87725eb 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -43,22 +43,18 @@ struct scu_regs {
 u32 get_cpu_rev(void)
 {
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
-   u32 reg = readl(&anatop->digprog_sololite);
-   u32 type = ((reg >> 16) & 0xff);
-
-   if (type != MXC_CPU_MX6SL) {
-   reg = readl(&anatop->digprog);
-   type = ((reg >> 16) & 0xff);
-   if (type == MXC_CPU_MX6DL) {
-   struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
-   u32 cfg = readl(&scu->config) & 3;
-
-   if (!cfg)
-   type = MXC_CPU_MX6SOLO;
-   }
-   }
-   reg &= 0xff;/* mx6 silicon revision */
-   return (type << 12) | (reg + 0x10);
+   u32 fsl_system_rev;
+   u32 cpu_rev = readl(&anatop->digprog);
+
+   /* Chip Silicon ID */
+   fsl_system_rev = ((cpu_rev >> 16) & 0xFF) << 12;
+   /* Chip silicon major revision */
+   fsl_system_rev |= ((cpu_rev >> 8) & 0xFF) << 4;
+   fsl_system_rev += 0x10;
+   /* Chip silicon minor revision */
+   fsl_system_rev |= cpu_rev & 0xFF;
+
+   return fsl_system_rev;
 }
 
 void init_aips(void)
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index a9b86c1..2f518c5 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -117,15 +117,19 @@ unsigned imx_ddr_size(void)
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
+#define MXC_CPU_MX51   0x51
+#define MXC_CPU_MX53   0x53
+#define MXC_CPU_MX6SL  0x60
+#define MXC_CPU_MX6DL_S0x61
+#define MXC_CPU_MX6Q_D 0x63
+
 const char *get_imx_type(u32 imxtype)
 {
switch (imxtype) {
-   case MXC_CPU_MX6Q:
-   return "6Q";/* Quad-core version of the mx6 */
-   case MXC_CPU_MX6DL:
-   return "6DL";   /* Dual Lite version of the mx6 */
-   case MXC_CPU_MX6SOLO:
-   return "6SOLO"; /* Solo version of the mx6 */
+   case MXC_CPU_MX6Q_D:
+   return "6Q/D";  /* Quad/Dual version of the mx6 */
+   case MXC_CPU_MX6DL_S:
+   return "6DL/S"; /* Dual-Lite/Solo version of the mx6 */
case MXC_CPU_MX6SL:
return "6SL";   /* Solo-Lite version of the mx6 */
case MXC_CPU_MX51:
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index 93ad1c6..a2e88bb 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -24,13 +24,6 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-#define MXC_CPU_MX51   0x51
-#define MXC_CPU_MX53   0x53
-#define MXC_CPU_MX6SL  0x60
-#define MXC_CPU_MX6DL  0x61
-#define MXC_CPU_MX6SOLO0x62
-#define MXC_CPU_MX6Q   0x63
-
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
 unsigned imx_ddr_size(void);
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 3193297..0278317 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -24,13 +24,6 @@
 #ifndef _SYS_PROTO_H_
 #define _SYS_PROTO_H_
 
-#define MXC_CPU_MX51   0x51
-#define MXC_CPU_MX53   0x53
-#define MXC_CPU_MX6SL  0x60
-#define MXC_CPU_MX6DL  0x61
-#define MXC_CPU_MX6SOLO0x62
-#define MXC_CPU_MX6Q   0x63
-
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
 const char *get_imx_type(u32 imxtype);
-- 
1.7.9.5


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


Re: [U-Boot] [PATCH 3/3] exynos5250: Add arndale board support

2013-03-26 Thread Wolfgang Denk
Dear Inderpal Singh,

In message <1364290670-7443-4-git-send-email-inderpal.si...@linaro.org> you 
wrote:
> Arndale board is based on samsung's exynos5250 soc.


WARNING: Avoid CamelCase: 
#618: FILE: board/samsung/arndale/clock_init.c:213:
+   .memconfig = DMC_MEMCONFIGx_CHIP_MAP_INTERLEAVED |

WARNING: Avoid CamelCase: 
#1860: FILE: board/samsung/arndale/setup.h:102:
+#define DMC_MEMBASECONFIGx_CHIP_BASE(x) (x << 16)

WARNING: Avoid CamelCase: 
#1861: FILE: board/samsung/arndale/setup.h:103:
+#define DMC_MEMBASECONFIGx_CHIP_MASK(x) (x << 0)

ERROR: Macros with complex values should be enclosed in parenthesis
#2116: FILE: board/samsung/arndale/setup.h:358:
+#define SCLK_SRC_ISP_VAL   (SPI1_ISP_SEL << 4) \
+   | (SPI0_ISP_SEL << 0)

ERROR: Macros with complex values should be enclosed in parenthesis
#2122: FILE: board/samsung/arndale/setup.h:364:
+#define SCLK_DIV_ISP_VAL   (SPI1_ISP_RATIO << 12) \
+   | (SPI0_ISP_RATIO << 0)

ERROR: Macros with complex values should be enclosed in parenthesis
#2416: FILE: include/configs/arndale.h:29:
+#define CONFIG_DEFAULT_DEVICE_TREE exynos5250-arndale

total: 3 errors, 3 warnings, 2235 lines checked

/home/wd/Mail/U-Boot/7161 has style problems, please review.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
The manager will be continually amazed that policies he took for com-
mon knowledge are totally unknown by some member of his  team.  Since
his fundamental job is to keep everybody going in the same direction,
his chief daily task will be communication, not decision-making.
  - Fred Brooks, "The Mythical Man Month"
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx23_olinuxino: Fix netboot console

2013-03-26 Thread Otavio Salvador
On Tue, Mar 26, 2013 at 1:23 AM, Alexandre Pereira da Silva
 wrote:
> The netargs variable was referencing the non-existing variable
> console_mainline. Change that to console variable instead.
>
> Signed-off-by: Alexandre Pereira da Silva 

Acked-by: Otavio Salvador 

Thanks by spotting it, it is clearly a fix. I have added Stefano to CC
list so he can process it to imx tree.

--
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 5/5] fs/ext4: Support device block sizes != 512 bytes.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364285735-2364-6-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> The 512 byte block size was hard coded in the ext4 file systems. Large
> harddisks today support bigger block sizes typically 4096 bytes.
> 
> Signed-off-by: Egbert Eich 
> ---
>  fs/ext4/dev.c  |   52 +--
>  fs/ext4/ext4_common.c  |   26 +++
>  fs/ext4/ext4_common.h  |2 +-
>  fs/ext4/ext4_journal.c |6 +---
>  fs/ext4/ext4_write.c   |   27 
>  fs/ext4/ext4fs.c   |   11 +
>  include/ext4fs.h   |1 +
>  include/ext_common.h   |9 +---
>  8 files changed, 68 insertions(+), 66 deletions(-)


WARNING: line over 80 characters
#139: FILE: fs/ext4/dev.c:56:
+   get_fs()->total_sect = (info->size * info->blksz) >> 
get_fs()->dev_desc->log2blksz;

WARNING: line over 80 characters
#148: FILE: fs/ext4/dev.c:64:
+(ext4fs_block_dev_desc ? 
ext4fs_block_dev_desc->blksz: 0));

ERROR: spaces required around that ':' (ctx:VxW)
#148: FILE: fs/ext4/dev.c:64:
+(ext4fs_block_dev_desc ? 
ext4fs_block_dev_desc->blksz: 0));

  ^

WARNING: line over 80 characters
#157: FILE: fs/ext4/dev.c:72:
+   || ((sector + ((byte_offset + byte_len - 1) >> 
ext4fs_block_dev_desc->log2blksz)) >=

WARNING: line over 80 characters
#186: FILE: fs/ext4/dev.c:94:
+   min(ext4fs_block_dev_desc->blksz - byte_offset, 
byte_len));

WARNING: line over 80 characters
#187: FILE: fs/ext4/dev.c:95:
+   buf += min(ext4fs_block_dev_desc->blksz - byte_offset, 
byte_len);

WARNING: line over 80 characters
#188: FILE: fs/ext4/dev.c:96:
+   byte_len -= min(ext4fs_block_dev_desc->blksz - byte_offset, 
byte_len);

WARNING: line over 80 characters
#213: FILE: fs/ext4/dev.c:119:
+  block_len >> 
ext4fs_block_dev_desc->log2blksz,

WARNING: line over 80 characters
#216: FILE: fs/ext4/dev.c:121:
+  block_len >> 
ext4fs_block_dev_desc->log2blksz) {

WARNING: line over 80 characters
#279: FILE: fs/ext4/ext4_common.c:106:
+ size >> 
fs->dev_desc->log2blksz,

WARNING: line over 80 characters
#288: FILE: fs/ext4/ext4_common.c:1471:
+   return ext4fs_devread(blkno << (LOG2_BLOCK_SIZE(data) - 
get_fs()->dev_desc->log2blksz),

WARNING: line over 80 characters
#297: FILE: fs/ext4/ext4_common.c:1497:
+   status = ext4fs_devread(blkno << (LOG2_BLOCK_SIZE(data) - 
fs->dev_desc->log2blksz), blkoff,

WARNING: line over 80 characters
#306: FILE: fs/ext4/ext4_common.c:1517:
+   log2_blksz = LOG2_BLOCK_SIZE(ext4fs_root) - 
get_fs()->dev_desc->log2blksz;

ERROR: space prohibited after that open parenthesis '('
#388: FILE: fs/ext4/ext4_write.c:623:
+   if (!ext4_read_superblock( (char *)fs->sb))

WARNING: line over 80 characters
#406: FILE: fs/ext4/ext4_write.c:768:
+   int log2blocksize = LOG2_BLOCK_SIZE(ext4fs_root) - 
fs->dev_desc->log2blksz;

WARNING: line over 80 characters
#415: FILE: fs/ext4/ext4_write.c:797:
+   delayed_next += blockend >> 
fs->dev_desc->log2blksz;

WARNING: line over 80 characters
#420: FILE: fs/ext4/ext4_write.c:800:
+
fs->dev_desc->log2blksz),

WARNING: line over 80 characters
#429: FILE: fs/ext4/ext4_write.c:808:
+   (blockend >> 
fs->dev_desc->log2blksz);

WARNING: line over 80 characters
#446: FILE: fs/ext4/ext4_write.c:822:
+fs->dev_desc->log2blksz), 
delayed_buf,

WARNING: line over 80 characters
#464: FILE: fs/ext4/ext4_write.c:923:
+   file_inode->blockcnt = (blks_reqd_for_file * fs->blksz) >> 
fs->dev_desc->log2blksz;

WARNING: line over 80 characters
#481: FILE: fs/ext4/ext4fs.c:66:
+   int log2blocksize = LOG2_BLOCK_SIZE(node->data) - 
fs->dev_desc->log2blksz;

WARNING: line over 80 characters
#491: FILE: fs/ext4/ext4fs.c:114:
+   delayed_next += blockend >> 
fs->dev_desc->log2blksz;

WARNING: line over 80 characters
#500: FILE: fs/ext4/ext4fs.c:128:
+   (blockend >> 
fs->dev_desc->log2blksz);

WARNING: line over 80 characters
#551: FILE: include/ext_common.h:65:
+   (data->sblock.log2_block_size) + 
EXT2_MIN_BLOCK_LOG_SIZE)

total: 2 errors, 22 warnings, 375 lines checked

/home/wd/Mail/U-Boot/7153 has style problems, please review.


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 Fa

Re: [U-Boot] [PATCH 4/5] part/dev_desc: Add log2 of Blocksize to block_dev_desc data struct.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364285735-2364-5-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> This value serves as the shift value used to calculate the block number
> to read in file systems when implementing aviable block sizes.
> 
> Signed-off-by: Egbert Eich 
> ---
>  common/cmd_ide.c  |4 
>  common/cmd_sata.c |1 +
>  common/cmd_scsi.c |2 ++
>  common/usb_storage.c  |1 +
>  drivers/block/ata_piix.c  |1 +
>  drivers/block/pata_bfin.c |1 +
>  drivers/block/systemace.c |1 +
>  drivers/mmc/mmc.c |1 +
>  include/part.h|5 +
>  9 files changed, 17 insertions(+), 0 deletions(-)


WARNING: line over 80 characters
#127: FILE: common/cmd_ide.c:458:
+   ide_dev_desc[i].log2blksz = 
LOG2_INVALID(typeof(ide_dev_desc[i].log2blksz)); /* just init to an invalid 
value */

WARNING: line over 80 characters
#143: FILE: common/cmd_ide.c:1453:
+   dev_desc->log2blksz = LOG2_INVALID(typeof(dev_desc->log2blksz)); /* 
just init to an invalid value */

WARNING: line over 80 characters
#175: FILE: common/cmd_scsi.c:109:
+   scsi_dev_desc[i].log2blksz = 
LOG2_INVALID(typeof(scsi_dev_desc[i].log2blksz)); /* just init to an invalid 
value */

WARNING: line over 80 characters
#183: FILE: common/cmd_scsi.c:170:
+   scsi_dev_desc[scsi_max_devs].log2blksz = 
LOG2(scsi_dev_desc[scsi_max_devs].blksz);

WARNING: line over 80 characters
#219: FILE: drivers/block/pata_bfin.c:900:
+   sata_dev_desc[ap->port_no].log2blksz = 
LOG2(sata_dev_desc[ap->port_no].blksz);

total: 0 errors, 5 warnings, 101 lines checked

/home/wd/Mail/U-Boot/7152 has style problems, please review.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"It follows that any commander in chief who undertakes to carry out a
plan which he considers defective is at fault; he must put forth  his
reasons,  insist  of  the  plan being changed, and finally tender his
resignation rather than be the instrument of his army's downfall."
- Napoleon, "Military Maxims and Thought"
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] disk/gpt: Fix GPT Partition handling for Blocksize != 512.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364285735-2364-2-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> Disks beyond 2T in size use blocksizes of 4096 bytes. However a lot of
> code in u-boot  still assumes a 512 byte blocksize.
> 
> Signed-off-by: Egbert Eich 
> ---
>  disk/part_efi.c|   32 
>  include/common.h   |   10 --
>  include/part.h |3 +++
>  include/part_efi.h |2 --
>  4 files changed, 27 insertions(+), 20 deletions(-)

WARNING: line over 80 characters
#192: FILE: disk/part_efi.c:463:
+   gpt_header *gpt_h = calloc(1, PAD_TO_BLOCKSIZE(sizeof(gpt_header), 
dev_desc));

WARNING: line over 80 characters
#199: FILE: disk/part_efi.c:469:
+   gpt_entry *gpt_e = calloc(1, PAD_TO_BLOCKSIZE(GPT_ENTRY_NUMBERS * 
sizeof(gpt_entry), dev_desc));

WARNING: line over 80 characters
#217: FILE: disk/part_efi.c:670:
+   pte = memalign(ARCH_DMA_MINALIGN, 
PAD_TO_BLOCKSIZE(count,dev_desc));

ERROR: space required after that ',' (ctx:VxV)
#217: FILE: disk/part_efi.c:670:
+   pte = memalign(ARCH_DMA_MINALIGN, 
PAD_TO_BLOCKSIZE(count,dev_desc));
^

WARNING: line over 80 characters
#248: FILE: include/common.h:996:
+   char __##name[ROUND(PAD_SIZE(size * sizeof(type),pad), align) + (align 
- 1)]; \

ERROR: space required after that ',' (ctx:VxV)
#248: FILE: include/common.h:996:
+   char __##name[ROUND(PAD_SIZE(size * sizeof(type),pad), align) + (align 
- 1)]; \
^

WARNING: line over 80 characters
#267: FILE: include/part.h:59:
+#define PAD_TO_BLOCKSIZE(size, block_dev_desc) (PAD_SIZE(size, 
block_dev_desc->blksz))

total: 2 errors, 5 warnings, 146 lines checked

/home/wd/Mail/U-Boot/7149 has style problems, please review.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I wish Captain Vimes were here. He wouldn't have  known  what  to  do
either, but he's got a much better vocabulary to be baffled in.
 - Terry Pratchett, _Guards! Guards!_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd/gpt: Support gpt command for all devices.

2013-03-26 Thread Wolfgang Denk
Dear egbert.e...@googlemail.com,

In message <1364284913-2277-1-git-send-email-egbert.e...@gmail.com> you wrote:
> From: Egbert Eich 
> 
> The gpt command was only implemented for mmc devices. There is no reason
> why this command should not be generalized and be applied all other
> storage device classes.
> This change both simplifies the implementation and eliminates a
> build failure for systems that don't support mmcs.
> 
> Signed-off-by: Egbert Eich 
> ---
>  common/cmd_gpt.c |   43 ++-
>  1 files changed, 18 insertions(+), 25 deletions(-)

WARNING: line over 80 characters
#198: FILE: common/cmd_gpt.c:310:
+   printf("%s: %s dev %d NOT available\n", __func__, 
argv[2], dev);

Please fix.

and please always run all your patches through checkpatch - before
submitting!


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"May the forces of evil become confused on the way to your house."
- George Carlin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] exynos5250: remove redundant SPI related configs

2013-03-26 Thread Rajeshwari Birje
Hi Inderpal Singh,

I observed even this defined twice can you please remove the same also
in your patch.
/* PMIC */
#define CONFIG_POWER
#define CONFIG_POWER_I2C
#define CONFIG_POWER_MAX77686

Regards,
Rajeshwari Shinde.

On Tue, Mar 26, 2013 at 3:07 PM, Inderpal Singh
 wrote:
> They have been defined once already. Hence remove the redundant definitions.
>
> Signed-off-by: Inderpal Singh 
> ---
>  include/configs/exynos5250-dt.h |   21 -
>  1 file changed, 21 deletions(-)
>
> diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
> index 7308522..d5d8e3a 100644
> --- a/include/configs/exynos5250-dt.h
> +++ b/include/configs/exynos5250-dt.h
> @@ -267,27 +267,6 @@
>  #define CONFIG_POWER_I2C
>  #define CONFIG_POWER_MAX77686
>
> -/* SPI */
> -#define CONFIG_ENV_IS_IN_SPI_FLASH
> -#define CONFIG_SPI_FLASH
> -
> -#ifdef CONFIG_SPI_FLASH
> -#define CONFIG_EXYNOS_SPI
> -#define CONFIG_CMD_SF
> -#define CONFIG_CMD_SPI
> -#define CONFIG_SPI_FLASH_WINBOND
> -#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
> -#define CONFIG_SF_DEFAULT_SPEED5000
> -#define EXYNOS5_SPI_NUM_CONTROLLERS5
> -#endif
> -
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> -#define CONFIG_ENV_SPI_MODESPI_MODE_0
> -#define CONFIG_ENV_SECT_SIZE   CONFIG_ENV_SIZE
> -#define CONFIG_ENV_SPI_BUS 1
> -#define CONFIG_ENV_SPI_MAX_HZ  5000
> -#endif
> -
>  /* Ethernet Controllor Driver */
>  #ifdef CONFIG_CMD_NET
>  #define CONFIG_SMC911X
> --
> 1.7.9.5
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



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


Re: [U-Boot] pull request for u-boot-tegra/master into ARM/master

2013-03-26 Thread Albert ARIBAUD
Hi Tom,

On Mon, 25 Mar 2013 10:43:22 -0700, Tom Warren
 wrote:

> Albert,
> 
> Please pull u-boot-tegra/master into ARM/master. Thanks!
> 
> ./MAKEALL for all the Tegra boards is OK, running a ./MAKEALL -a arm
> now. Checkpatch.pl is clean.
> 
> The following changes since commit b6379e15a70cc2e22486e5962927d9de374d877b:
> 
>   Merge branch 'u-boot-ti/master' into 'u-boot-arm/master' (2013-03-24
> 17:52:22 +0100)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-tegra master
> 
> for you to fetch changes up to f789be6086f3e6302fe4b163fa9b7bd6b358c4ce:
> 
>   Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
> (2013-03-25 09:56:08 -0700)
> 
> 
> Allen Martin (13):
>   tegra: remove support for UART SPI switch
>   tegra: spi: rename tegra SPI drivers
>   tegra: spi: remove non fdt support
>   tegra: spi: pull register structs out of headers
>   tegra20: spi: move fdt probe to spi_init
>   spi: add common fdt SPI driver interface
>   sf: winbond: add W25Q32DW
>   tegra114: fdt: add compatible string for tegra114 SPI ctrl
>   tegra114: fdt: add apbdma block
>   tegra114: fdt: add SPI blocks
>   tegra114: dalmore: fdt: enable dalmore SPI controller
>   tegra114: add SPI driver
>   tegra114: dalmore: config: enable SPI
> 
> Tom Warren (4):
>   Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for
> now)
>   Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table
>   Tegra114: MMC: Add SD bus power-rail init routine
>   Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore
> boards
> 
>  arch/arm/dts/tegra114.dtsi | 141 +++
>  arch/arm/include/asm/arch-tegra/board.h|   3 +-
>  arch/arm/include/asm/arch-tegra/tegra_slink.h  |  84 -
>  arch/arm/include/asm/arch-tegra/tegra_spi.h|  75 
>  arch/arm/include/asm/arch-tegra114/gp_padctrl.h|   6 +
>  arch/arm/include/asm/arch-tegra114/tegra114_spi.h  |  41 +++
>  arch/arm/include/asm/arch-tegra20/tegra20_sflash.h |  41 +++
>  arch/arm/include/asm/arch-tegra20/tegra20_slink.h  |  41 +++
>  .../arm/include/asm/arch-tegra20/uart-spi-switch.h |  46 ---
>  board/nvidia/common/board.c|   5 +-
>  board/nvidia/common/common.mk  |   1 -
>  board/nvidia/common/uart-spi-switch.c  | 125 ---
>  board/nvidia/dalmore/dalmore.c |  66 
>  board/nvidia/dalmore/pinmux-config-dalmore.h   |   6 +
>  board/nvidia/dts/tegra114-dalmore.dts  |  18 +
>  board/nvidia/seaboard/seaboard.c   |   2 +-
>  drivers/mtd/spi/winbond.c  |   5 +
>  drivers/spi/Makefile   |   6 +-
>  drivers/spi/fdt_spi.c  | 186 ++
>  drivers/spi/tegra114_spi.c | 405
> +
>  drivers/spi/{tegra_spi.c => tegra20_sflash.c}  | 215 ++-
>  drivers/spi/{tegra_slink.c => tegra20_slink.c} | 128 ---
>  include/configs/cardhu.h   |   2 +-
>  include/configs/dalmore.h  |  23 +-
>  include/configs/tegra-common-post.h|   4 +
>  include/configs/trimslice.h|   2 +-
>  include/fdtdec.h   |   1 +
>  lib/fdtdec.c   |   1 +
>  28 files changed, 1188 insertions(+), 491 deletions(-)
>  delete mode 100644 arch/arm/include/asm/arch-tegra/tegra_slink.h
>  delete mode 100644 arch/arm/include/asm/arch-tegra/tegra_spi.h
>  create mode 100644 arch/arm/include/asm/arch-tegra114/tegra114_spi.h
>  create mode 100644 arch/arm/include/asm/arch-tegra20/tegra20_sflash.h
>  create mode 100644 arch/arm/include/asm/arch-tegra20/tegra20_slink.h
>  delete mode 100644 arch/arm/include/asm/arch-tegra20/uart-spi-switch.h
>  delete mode 100644 board/nvidia/common/uart-spi-switch.c
>  create mode 100644 drivers/spi/fdt_spi.c
>  create mode 100644 drivers/spi/tegra114_spi.c
>  rename drivers/spi/{tegra_spi.c => tegra20_sflash.c} (57%)
>  rename drivers/spi/{tegra_slink.c => tegra20_slink.c} (72%)
> 
>  

Applied 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


[U-Boot] [PATCH 2/3] exynos5250: move board specific configs to board specific config file

2013-03-26 Thread Inderpal Singh
Not all boards based on exynos5250 have SPI flash, same serial port and might
not require the same lds script. Hence move them to board specific config file

Signed-off-by: Inderpal Singh 
---
 include/configs/exynos5250-dt.h |8 +---
 include/configs/smdk5250.h  |   12 ++--
 include/configs/snow.h  |   12 ++--
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index d5d8e3a..615b788 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -29,7 +29,6 @@
 #define CONFIG_SAMSUNG /* in a SAMSUNG core */
 #define CONFIG_S5P /* S5P Family */
 #define CONFIG_EXYNOS5 /* which is in a Exynos5 Family */
-#define CONFIG_SMDK5250/* which is in a SMDK5250 */
 
 #include   /* get chip and board defs */
 
@@ -73,7 +72,6 @@
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (4 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL3 /* use SERIAL 3 */
 #define CONFIG_BAUDRATE115200
 #define EXYNOS5_DEFAULT_UART_OFFSET0x01
 
@@ -132,8 +130,6 @@
 #define CONFIG_SPL
 #define COPY_BL2_FNPTR_ADDR0x02020030
 
-/* specific .lds file */
-#define CONFIG_SPL_LDSCRIPT"board/samsung/smdk5250/smdk5250-uboot-spl.lds"
 #define CONFIG_SPL_TEXT_BASE   0x02023400
 #define CONFIG_SPL_MAX_SIZE(14 * 1024)
 
@@ -142,7 +138,7 @@
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser*/
-#define CONFIG_SYS_PROMPT  "SMDK5250 # "
+#define CONFIG_SYS_PROMPT  "EXYNOS5250 # "
 #define CONFIG_SYS_CBSIZE  256 /* Console I/O Buffer Size */
 #define CONFIG_SYS_PBSIZE  384 /* Print Buffer Size */
 #define CONFIG_SYS_MAXARGS 16  /* max number of command args */
@@ -182,7 +178,6 @@
 /* FLASH and environment organization */
 #define CONFIG_SYS_NO_FLASH
 #undef CONFIG_CMD_IMLS
-#define CONFIG_IDENT_STRING" for SMDK5250"
 
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
@@ -242,7 +237,6 @@
 #define CONFIG_PMIC_MAX77686
 
 /* SPI */
-#define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_SPI_FLASH
 
 #ifdef CONFIG_SPI_FLASH
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 81f83a8..487505b 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -25,9 +25,17 @@
 #ifndef __CONFIG_SMDK_H
 #define __CONFIG_SMDK_H
 
-#include 
-
 #undef CONFIG_DEFAULT_DEVICE_TREE
 #define CONFIG_DEFAULT_DEVICE_TREE exynos5250-smdk5250
 
+#define CONFIG_SMDK5250/* which is in a SMDK5250 */
+#define CONFIG_SERIAL3 /* use SERIAL 3 */
+
+/* specific .lds file */
+#define CONFIG_SPL_LDSCRIPT"board/samsung/smdk5250/smdk5250-uboot-spl.lds"
+#define CONFIG_IDENT_STRING" for SMDK5250"
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+
+#include 
+
 #endif /* __CONFIG_SMDK_H */
diff --git a/include/configs/snow.h b/include/configs/snow.h
index b8460fd..a1f8404 100644
--- a/include/configs/snow.h
+++ b/include/configs/snow.h
@@ -25,9 +25,17 @@
 #ifndef __CONFIG_SNOW_H
 #define __CONFIG_SNOW_H
 
-#include 
-
 #undef CONFIG_DEFAULT_DEVICE_TREE
 #define CONFIG_DEFAULT_DEVICE_TREE exynos5250-snow
 
+#define CONFIG_SMDK5250/* which is in a SMDK5250 */
+#define CONFIG_SERIAL3 /* use SERIAL 3 */
+
+/* specific .lds file */
+#define CONFIG_SPL_LDSCRIPT"board/samsung/smdk5250/smdk5250-uboot-spl.lds"
+#define CONFIG_IDENT_STRING" for SMDK5250"
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+
+#include 
+
 #endif /* __CONFIG_SNOW_H */
-- 
1.7.9.5

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


[U-Boot] [PATCH 1/3] exynos5250: remove redundant SPI related configs

2013-03-26 Thread Inderpal Singh
They have been defined once already. Hence remove the redundant definitions.

Signed-off-by: Inderpal Singh 
---
 include/configs/exynos5250-dt.h |   21 -
 1 file changed, 21 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 7308522..d5d8e3a 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -267,27 +267,6 @@
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_MAX77686
 
-/* SPI */
-#define CONFIG_ENV_IS_IN_SPI_FLASH
-#define CONFIG_SPI_FLASH
-
-#ifdef CONFIG_SPI_FLASH
-#define CONFIG_EXYNOS_SPI
-#define CONFIG_CMD_SF
-#define CONFIG_CMD_SPI
-#define CONFIG_SPI_FLASH_WINBOND
-#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
-#define CONFIG_SF_DEFAULT_SPEED5000
-#define EXYNOS5_SPI_NUM_CONTROLLERS5
-#endif
-
-#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
-#define CONFIG_ENV_SPI_MODESPI_MODE_0
-#define CONFIG_ENV_SECT_SIZE   CONFIG_ENV_SIZE
-#define CONFIG_ENV_SPI_BUS 1
-#define CONFIG_ENV_SPI_MAX_HZ  5000
-#endif
-
 /* Ethernet Controllor Driver */
 #ifdef CONFIG_CMD_NET
 #define CONFIG_SMC911X
-- 
1.7.9.5

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


[U-Boot] [PATCH 0/3] Add Arndale board support

2013-03-26 Thread Inderpal Singh
The Arndale board is based on samsung's exynos5250 SOC.

First patch just removes the redundant SPI configs from common exynos5250
config file. Second patch moves the board specific configs to board specific
config file. The third adds the andale board support.

This patchset depends on [1] for tzpc initialization, on [2] for copying
u-boot to RAM from spl, and on first 6 patches of [3] for mmc support.

[1] http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/156168
[2] http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/156272
[3] http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/155368

Inderpal Singh (3):
  exynos5250: remove redundant SPI related configs
  exynos5250: move board specific configs to board specific config file
  exynos5250: Add arndale board support

 MAINTAINERS  |4 +
 board/samsung/arndale/Makefile   |   54 +++
 board/samsung/arndale/arndale.c  |  117 ++
 board/samsung/arndale/arndale_spl.c  |   66 +++
 board/samsung/arndale/clock_init.c   |  655 ++
 board/samsung/arndale/clock_init.h   |  149 +++
 board/samsung/arndale/dmc_common.c   |  199 +
 board/samsung/arndale/dmc_init_ddr3.c|  228 +++
 board/samsung/arndale/lowlevel_init.S|   92 +
 board/samsung/arndale/setup.h|  569 ++
 board/samsung/dts/exynos5250-arndale.dts |   36 ++
 boards.cfg   |1 +
 include/configs/arndale.h|   39 ++
 include/configs/exynos5250-dt.h  |   29 +-
 include/configs/smdk5250.h   |   12 +-
 include/configs/snow.h   |   12 +-
 tools/Makefile   |2 +
 17 files changed, 2232 insertions(+), 32 deletions(-)
 create mode 100644 board/samsung/arndale/Makefile
 create mode 100644 board/samsung/arndale/arndale.c
 create mode 100644 board/samsung/arndale/arndale_spl.c
 create mode 100644 board/samsung/arndale/clock_init.c
 create mode 100644 board/samsung/arndale/clock_init.h
 create mode 100644 board/samsung/arndale/dmc_common.c
 create mode 100644 board/samsung/arndale/dmc_init_ddr3.c
 create mode 100644 board/samsung/arndale/lowlevel_init.S
 create mode 100644 board/samsung/arndale/setup.h
 create mode 100644 board/samsung/dts/exynos5250-arndale.dts
 create mode 100644 include/configs/arndale.h

-- 
1.7.9.5

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


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

2013-03-26 Thread Albert ARIBAUD
Hi Minkyu,

On Thu, 21 Mar 2013 18:54:28 +0900, Minkyu Kang 
wrote:

> Dear Albert,
> 
> The following changes since commit 9f024f62e4604274a23213dcee30016092e32e7b:
> 
>   Merge branch 'fixes' of git://git.denx.de/u-boot-mips (2013-02-15 12:23:42 
> -0500)
> 
> are available in the git repository at:
> 
> 
>   git://git.denx.de/u-boot-samsung master
> 
> for you to fetch changes up to ce0c1bc13556fbf1bdfa2a4a27ca6744e7beb32a:
> 
>   mmc:sdhci:fix: Change default interrupts enabled at SDHCI initialization 
> (2013-03-12 19:50:49 +0900)
> 
> 
> Akshay Saraswat (8):
>   Exynos5: TMU: Add driver for Thermal Management Unit
>   Exynos5: FDT: Add TMU device node values
>   Exynos5: TMU: Add TMU init and status check
>   Exynos5: Config: Enable support for Exynos TMU driver
>   TMU: Add TMU support in dtt command
>   Exynos5: Config: Enable dtt command for TMU
>   Exynos5: TMU: Add hardware tripping
>   Exynos5: FDT: Add a H/W-trip member to TMU node
> 
> Rajeshwari Shinde (11):
>   EXYNOS5: Add function to setup set ps hold
>   SMDK5250: Add PMIC voltage settings
>   EXYNOS5: Add function to enable XXTI clock source
>   Sound: MAX98095: Add the driver for codec
>   Sound: Support for MAX98095 codec in driver
>   EXYNOS5: GPIO to enable MAX98095
>   EXYNOS5: FDT: Add compatible strings for MAX98095
>   config: Snow: Enable MAX98095 codec
>   SMDK5250: FDT: Retrieve board model via DT
>   EXYNOS5: Add initial DTS file for Snow.
>   EXYNOS5: Snow: Add a configuration file
> 
> Simon Glass (1):
>   EXYNOS: Correct ordering of SPL machine_params
> 
> Ɓukasz Majewski (1):
>   mmc:sdhci:fix: Change default interrupts enabled at SDHCI initialization
> 
>  MAINTAINERS   |4 +
>  arch/arm/cpu/armv7/exynos/power.c |   45 +++
>  arch/arm/dts/exynos5250.dtsi  |5 +
>  arch/arm/include/asm/arch-exynos/power.h  |   24 ++
>  arch/arm/include/asm/arch-exynos/spl.h|3 +-
>  arch/arm/include/asm/arch-exynos/tmu.h|   58 +++
>  board/samsung/dts/exynos5250-smdk5250.dts |   13 +
>  board/samsung/dts/exynos5250-snow.dts |   58 +++
>  board/samsung/smdk5250/smdk5250.c |  178 +-
>  boards.cfg|1 +
>  common/cmd_dtt.c  |   32 +-
>  doc/device-tree-bindings/exynos/tmu.txt   |   44 +++
>  drivers/mmc/sdhci.c   |8 +-
>  drivers/power/Makefile|1 +
>  drivers/power/exynos-tmu.c|  319 +
>  drivers/sound/Makefile|1 +
>  drivers/sound/max98095.c  |  550 
> +
>  drivers/sound/max98095.h  |  311 
>  drivers/sound/sound.c |9 +-
>  include/configs/exynos5250-dt.h   |6 +
>  include/configs/snow.h|   33 ++
>  include/fdtdec.h  |2 +
>  include/power/max77686_pmic.h |   32 ++
>  include/sound.h   |1 +
>  include/tmu.h |   46 +++
>  lib/fdtdec.c  |2 +
>  26 files changed, 1776 insertions(+), 10 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-exynos/tmu.h
>  create mode 100644 board/samsung/dts/exynos5250-snow.dts
>  create mode 100644 doc/device-tree-bindings/exynos/tmu.txt
>  create mode 100644 drivers/power/exynos-tmu.c
>  create mode 100644 drivers/sound/max98095.c
>  create mode 100644 drivers/sound/max98095.h
>  create mode 100644 include/configs/snow.h
>  create mode 100644 include/tmu.h
> 

Applied 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


  1   2   >