[U-Boot] Pull request: u-boot-sh/maste

2014-03-14 Thread Nobuhiro Iwamatsu
Dear Tom Rini.

Please pull u-boot-sh master branch.

The following changes since commit 2e50f6dccb3eeb1a20993c9da73fe355da35cf04:

  kbuild: delete *.pyc files by make distclean (2014-03-12 17:05:00 -0400)

are available in the git repository at:

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

for you to fetch changes up to 194ba5d4ecb2ad1195333cc7453f291e5b316479:

  sh: ecovec: correct romImage address in comment (2014-03-14 14:50:28 +0900)


Baruch Siach (2):
  sh: fix PFC registers definition for SH772{2, 3, 4}
  sh: ecovec: correct romImage address in comment

 arch/sh/include/asm/cpu_sh7722.h | 5 +++--
 arch/sh/include/asm/cpu_sh7723.h | 5 +++--
 arch/sh/include/asm/cpu_sh7724.h | 5 +++--
 board/renesas/ecovec/lowlevel_init.S | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)


-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] arm64 patch: gicv3 support

2014-03-14 Thread fenghua
From: David Feng feng...@phytium.com.cn

This patch add gicv3 support to uboot armv8 platform.

Changes for v2:
  - rename arm/cpu/armv8/gic.S with arm/lib/gic_64.S
  - move smp_kick_all_cpus() from gic.S to start.S, it would be
implementation dependent.
  - Each core initialize it's own ReDistributor instead of master
initializeing all ReDistributors. This is advised by arnab.basu
arnab.b...@freescale.com.

Signed-off-by: David Feng feng...@phytium.com.cn
---
 arch/arm/cpu/armv8/Makefile   |1 -
 arch/arm/cpu/armv8/gic.S  |  106 
 arch/arm/cpu/armv8/start.S|   46 +++--
 arch/arm/include/asm/gic.h|   56 +++
 arch/arm/lib/Makefile |1 +
 arch/arm/lib/gic_64.S |  194 +
 include/configs/vexpress_aemv8a.h |7 ++
 7 files changed, 297 insertions(+), 114 deletions(-)
 delete mode 100644 arch/arm/cpu/armv8/gic.S
 create mode 100644 arch/arm/lib/gic_64.S

diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
index b6eb6de..7d93f59 100644
--- a/arch/arm/cpu/armv8/Makefile
+++ b/arch/arm/cpu/armv8/Makefile
@@ -13,5 +13,4 @@ obj-y += cache_v8.o
 obj-y  += exceptions.o
 obj-y  += cache.o
 obj-y  += tlb.o
-obj-y  += gic.o
 obj-y  += transition.o
diff --git a/arch/arm/cpu/armv8/gic.S b/arch/arm/cpu/armv8/gic.S
deleted file mode 100644
index 599aa8f..000
--- a/arch/arm/cpu/armv8/gic.S
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * GIC Initialization Routines.
- *
- * (C) Copyright 2013
- * David Feng feng...@phytium.com.cn
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include asm-offsets.h
-#include config.h
-#include linux/linkage.h
-#include asm/macro.h
-#include asm/gic.h
-
-
-/*
- *
- * void gic_init(void) __attribute__((weak));
- *
- * Currently, this routine only initialize secure copy of GIC
- * with Security Extensions at EL3.
- *
- */
-WEAK(gic_init)
-   branch_if_slave x0, 2f
-
-   /* Initialize Distributor and SPIs */
-   ldr x1, =GICD_BASE
-   mov w0, #0x3/* EnableGrp0 | EnableGrp1 */
-   str w0, [x1, GICD_CTLR] /* Secure GICD_CTLR */
-   ldr w0, [x1, GICD_TYPER]
-   and w2, w0, #0x1f   /* ITLinesNumber */
-   cbz w2, 2f  /* No SPIs */
-   add x1, x1, (GICD_IGROUPRn + 4)
-   mov w0, #~0 /* Config SPIs as Grp1 */
-1: str w0, [x1], #0x4
-   sub w2, w2, #0x1
-   cbnzw2, 1b
-
-   /* Initialize SGIs and PPIs */
-2: ldr x1, =GICD_BASE
-   mov w0, #~0 /* Config SGIs and PPIs as Grp1 */
-   str w0, [x1, GICD_IGROUPRn] /* GICD_IGROUPR0 */
-   mov w0, #0x1/* Enable SGI 0 */
-   str w0, [x1, GICD_ISENABLERn]
-
-   /* Initialize Cpu Interface */
-   ldr x1, =GICC_BASE
-   mov w0, #0x1e7  /* Disable IRQ/FIQ Bypass  */
-   /* Enable Ack Group1 Interrupt  */
-   /* EnableGrp0  EnableGrp1 */
-   str w0, [x1, GICC_CTLR] /* Secure GICC_CTLR */
-
-   mov w0, #0x1  7   /* Non-Secure access to GICC_PMR */
-   str w0, [x1, GICC_PMR]
-
-   ret
-ENDPROC(gic_init)
-
-
-/*
- *
- * void gic_send_sgi(u64 sgi) __attribute__((weak));
- *
- */
-WEAK(gic_send_sgi)
-   ldr x1, =GICD_BASE
-   mov w2, #0x8000
-   movkw2, #0x100, lsl #16
-   orr w2, w2, w0
-   str w2, [x1, GICD_SGIR]
-   ret
-ENDPROC(gic_send_sgi)
-
-
-/*
- *
- * void wait_for_wakeup(void) __attribute__((weak));
- *
- * Wait for SGI 0 from master.
- *
- */
-WEAK(wait_for_wakeup)
-   ldr x1, =GICC_BASE
-0: wfi
-   ldr w0, [x1, GICC_AIAR]
-   str w0, [x1, GICC_AEOIR]
-   cbnzw0, 0b
-   ret
-ENDPROC(wait_for_wakeup)
-
-
-/*
- *
- * void smp_kick_all_cpus(void) __attribute__((weak));
- *
- */
-WEAK(smp_kick_all_cpus)
-   /* Kick secondary cpus up by SGI 0 interrupt */
-   mov x0, xzr /* SGI 0 */
-   mov x29, lr /* Save LR */
-   bl  gic_send_sgi
-   mov lr, x29 /* Restore LR */
-   ret
-ENDPROC(smp_kick_all_cpus)
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index bcc2603..4d304cf 100644
--- 

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

2014-03-14 Thread Albert ARIBAUD
Hi Minkyu,

On Thu, 13 Mar 2014 15:10:46 +0900, Minkyu Kang mk7.k...@samsung.com
wrote:

 Dear Albert,
 
 The following changes since commit 8ee950dd273aef6a074d41bf2ee4ef11d6f848fb:
 
   Prepare v2014.04-rc2 (2014-03-10 17:21:06 -0400)
 
 are available in the git repository at:
 
   http://git.denx.de/u-boot-samsung 
 
 for you to fetch changes up to b627eb461bb281a00b543e72e74edc197b5f7b5e:
 
   usb: dfu: add static alt num count in dfu_config_entities() (2014-03-13 
 10:30:56 +0900)
 
 
 Marek Vasut (1):
   arm: exynos: Squash bogus warnings in pinmux
 
 Piotr Wilczek (12):
   exynos4:pinmux:fdt: decode peripheral id
   video:mipidsim:fdt: Add DT support for mipi dsim driver
   video:exynos_fb:fdt: add additional fdt data
   drivers:mmc:sdhci: enable support for DT
   board:samsung: move checkboard to common file
   arm:exynos: add common DTS file for exynos 4
   board:samsung:common: move max77686 init function
   arm:exynos: enable sdhci and misc_init to common board
   board:origen: Enable device tree on Origen
   board:universal: Enable device tree on Universal
   board:trats: Enable device tree on Trats
   board:trats2: Enable device tree on Trats2
 
 Przemyslaw Marczak (2):
   Trats/Trats2: Update Tizen partitions layout and dfu entities
   usb: dfu: add static alt num count in dfu_config_entities()
 
  arch/arm/cpu/armv7/exynos/pinmux.c |   29 ++
  arch/arm/dts/Makefile  |5 +
  arch/arm/dts/exynos4.dtsi  |  138 +++
  arch/arm/dts/exynos4210-origen.dts |   45 ++
  arch/arm/dts/exynos4210-trats.dts  |  120 ++
  arch/arm/dts/exynos4210-universal_c210.dts |   83 
  arch/arm/dts/exynos4412-trats2.dts |  434 
 
  arch/arm/include/asm/arch-exynos/board.h   |   12 +
  arch/arm/include/asm/arch-exynos/mipi_dsim.h   |5 +
  arch/arm/include/asm/arch-exynos/mmc.h |7 +
  board/samsung/common/board.c   |  180 +++-
  board/samsung/origen/origen.c  |  112 +
  board/samsung/smdk5250/exynos5-dt.c|   15 -
  board/samsung/smdk5250/smdk5250.c  |  125 ++
  board/samsung/smdk5420/smdk5420.c  |   15 -
  board/samsung/trats/trats.c|  213 +-
  board/samsung/trats2/trats2.c  |  233 +--
  board/samsung/universal_c210/universal.c   |  204 +++--
  doc/device-tree-bindings/video/exynos_mipi_dsi.txt |   82 
  drivers/dfu/dfu.c  |6 +-
  drivers/mmc/s5p_sdhci.c|  129 ++
  drivers/video/exynos_fb.c  |   12 +
  drivers/video/exynos_mipi_dsi.c|   96 +
  include/configs/exynos4-dt.h   |  138 +++
  include/configs/origen.h   |  110 ++---
  include/configs/s5pc210_universal.h|  152 +++
  include/configs/trats.h|  225 +++---
  include/configs/trats2.h   |  218 +++---
  include/fdtdec.h   |2 +
  include/sdhci.h|5 +
  lib/fdtdec.c   |2 +
  31 files changed, 1802 insertions(+), 1350 deletions(-)
  create mode 100644 arch/arm/dts/exynos4.dtsi
  create mode 100644 arch/arm/dts/exynos4210-origen.dts
  create mode 100644 arch/arm/dts/exynos4210-trats.dts
  create mode 100644 arch/arm/dts/exynos4210-universal_c210.dts
  create mode 100644 arch/arm/dts/exynos4412-trats2.dts
  create mode 100644 doc/device-tree-bindings/video/exynos_mipi_dsi.txt
  create mode 100644 include/configs/exynos4-dt.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


[U-Boot] [PATCH 1/3 v2] net/phy: enable get_phy_id redefinable

2014-03-14 Thread Shengzhou Liu
As some PHYs have non-standard PHY ID registers, PHY Id can't
be read correctly by current get_phy_id function, so we enable
get_phy_id redefinable to permit specific PHY driver having own
specific get_phy_id function.

Signed-off-by: Shengzhou Liu shengzhou@freescale.com
---
v2: use __weak

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c691fbb..da65329 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -18,6 +18,7 @@
 #include phy.h
 #include errno.h
 #include linux/err.h
+#include linux/compiler.h
 
 /* Generic PHY support and helper functions */
 
@@ -577,7 +578,7 @@ static struct phy_device *phy_device_create(struct mii_dev 
*bus, int addr,
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, stores it in @phy_id and returns zero on success.
  */
-static int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
+int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
 {
int phy_reg;
 
-- 
1.8.0


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


[U-Boot] Swiching u-boot image in SPI-NOR

2014-03-14 Thread JYOTI DUBEY
Hello
  I am trying to bring in u-boot.imx (uboot image of u-boot 2013) onto
SPI-NOR of nitrogen 6x board.I used following commands:
 sf probe 1
sf erase 0 0x4
 fatload mmc 0:1 1200 u-boot.imx
reading u-boot.imx
343040 bytes read in 54 ms (6.1 MiB/s)
sf write 0x1200 0x0 343040
ERROR: attempting write past flash size (0x20)

I have no clue as how to overcome this error.Can somebody help me with this
error.


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


Re: [U-Boot] [PATCH] arm: Handle .gnu.hash section in ldscripts

2014-03-14 Thread Lukasz Majewski
Hi Albert,

 Hi Lukasz,
 
 On Thu, 13 Mar 2014 16:43:09 +0100, Lukasz Majewski
 l.majew...@samsung.com wrote:
 
  I can report the same issue with OBS build of u-boot.
  
  When u-boot is build with qemu emulated environment with gcc-4.8.2
  (native armv7l toolchain) in the OBS it needs patch prepared by
  Andreas.
 
 Hmm, ok, so maybe I can reproduce this by building U-Boot on native
 armv7 hardware. Any target which systematically fails building?

The Trats2 fails to be build. But to me it seems like compiler and
linker issue.

 
  However I can build the same code from u-boot directory (without
  this patch) with following toolchain:
  arm-v7a-linux-gnueabi-gcc (OSELAS.Toolchain-2013.12.0
  linaro-4.8-2013.11) 4.8.3 2013
 
 Hmm... So it depends on the toolchain.
 
  Any ideas how to solve this?
 
 Are both toolchains you used available somewhere so that I can fetch
 them and experiment locally?

Yes they are available. References below:

arm-v7a-linux-gnueabi-gcc
(OSELAS.Toolchain-2013.12.0linaro-4.8-2013.11) 4.8.3 2013
linaro-4.8-2013.11) 4.8.3 2013
http://www.ptxdist.org/software/ptxdist/index_en.html


The one which is used in the OBS:
gcc-4.8-2.56.armv7l.rpm

can be download from:
http://download.tizen.org/snapshots/tizen/rd-pq/latest/repos/mobile/armv7l/packages/armv7l/

I hope, that it helps.

 
 Amicalement,



-- 
Best regards,

Lukasz Majewski

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


[U-Boot] Enabling uart 3 in arndale

2014-03-14 Thread armdev
Hi,

We are trying to enable the UART3 on COM18 pins of arndale board. The UART3 RXD 
and TXD are on pins 2 and 4 which as per the base board specification is 
connected as 

XuRXD3 : UART_3_RXD/GPA1[4] : 2
XuTXD3 : UART_3_TXD/GPA1[5] : 4

As per the public reference manual of exynos 5250, there is a register GPACON 
(0x1140_) 
Setting GPACON |= 0x0010_ should enable the pins, but I am not able to see 
any output on UART3.

Can you please suggest what is the right procedure

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


Re: [U-Boot] [PATCH] cfi_flash: Micron Nor flash don't support read operation after send

2014-03-14 Thread qiwang
Hi Wolfgang,

  Micron Nor flash don't support read operation after send write command.
 As below,
 
 I understand you attempt to copy data between two different areas on
 the same NOR device?  This is not supported.

  If the src address locate in NOR flash, flash_read operation will be failed.
  So, read out the data to DRAM before send write command operation.
  ---
   drivers/mtd/cfi_flash.c |   70 +++--
 --
   1 file changed, 46 insertions(+), 24 deletions(-)
 
 Thanks, but NAK.
 
 If the source address range and the target address range are both in
 the same NOR flash device, please use a two step approach instead:
 first copy the data to RAM, then copy from RAM to NOR.
 
 No code changes are needed for this.

Yes, I totally agree with you, copy from NOR flash to NOR flash is not support.

But in the flash_write_cfibuffer() function, flash_read16(src) is used to read 
data
from src address, I think this flash_read function give users much mislead, 
src address
can be located in flash address range, not only can be in RAM.

And currently, one of micron customers uses cp.b command to copy data from 
NOR flash 
to Nor flash, such as cp.b src_addr dest_addr len, both src_addr and 
dest_addr are 
located in NOR flash address range. Some manufactory's Nor flash can work fine 
under 
this command, but micron nor flash cannot. 

As you said, copy from NOR flash to NOR flash is forbidden. 
In the cp command function, 
do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]),
you can see below code, it just judge if the dest address is located in NOR 
flash, but
don't do any detect on src address.

#ifndef CONFIG_SYS_NO_FLASH
/* check if we are copying to Flash */
if ( (addr2info(dest) != NULL)
#ifdef CONFIG_HAS_DATAFLASH
(!addr_dataflash(dest))
#endif
   ) {
int rc;

puts (Copy to Flash... );

rc = flash_write ((char *)addr, dest, count*size);
if (rc != 0) {
flash_perror (rc);
return (1);
}
puts (done\n);
return 0;
}
#endif

So my suggestion is,
1. don't use flash_read function in flash_write_cfibuffer() function, use 
   readb(),readw(), readl() function instead.
2. add detection in do_mem_cp() function, check if src address is locate in NOR 
flash address range.

So what's your opinions?
Thanks for your help.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] arm: exynos: pinmux: Add sdmmc4 gpio configuration

2014-03-14 Thread Beomho Seo
For use dwmmc controller at exynos4, add SDMMC gpio configuration.
In case SDMMC2, do not use 8bit mode at exynos4.

Signed-off-by: Beomho Seo beomho@samsung.com
Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- Fixed value initialise.
- Comment add in function.

 arch/arm/cpu/armv7/exynos/pinmux.c |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
b/arch/arm/cpu/armv7/exynos/pinmux.c
index 9edb475..3dce5d2 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -632,16 +632,26 @@ static int exynos4_mmc_config(int peripheral, int flags)
struct exynos4_gpio_part2 *gpio2 =
(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
struct s5p_gpio_bank *bank, *bank_ext;
+   unsigned int  func, func_ext;
int i;

switch (peripheral) {
case PERIPH_ID_SDMMC0:
bank = gpio2-k0;
bank_ext = gpio2-k1;
+   func = GPIO_FUNC(0x2);
+   func_ext = GPIO_FUNC(0x3);
break;
case PERIPH_ID_SDMMC2:
bank = gpio2-k2;
-   bank_ext = gpio2-k3;
+   func = GPIO_FUNC(0x2);
+   func_ext = 0;
+   break;
+   case PERIPH_ID_SDMMC4:
+   bank = gpio2-k0;
+   bank_ext = gpio2-k1;
+   func = GPIO_FUNC(0x3);
+   func_ext = GPIO_FUNC(0x4);
break;
default:
return -1;
@@ -649,13 +659,14 @@ static int exynos4_mmc_config(int peripheral, int flags)
for (i = 0; i  7; i++) {
if (i == 2)
continue;
-   s5p_gpio_cfg_pin(bank, i,  GPIO_FUNC(0x2));
+   s5p_gpio_cfg_pin(bank, i,  func);
s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
}
+   /* SDMMC do not use 8bit mode at exynos4 */
if (flags  PINMUX_FLAG_8BIT_MODE) {
for (i = 3; i  7; i++) {
-   s5p_gpio_cfg_pin(bank_ext, i,  GPIO_FUNC(0x3));
+   s5p_gpio_cfg_pin(bank_ext, i,  func_ext);
s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE);
s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
}
@@ -722,10 +733,10 @@ static int exynos4_pinmux_config(int peripheral, int 
flags)
break;
case PERIPH_ID_SDMMC0:
case PERIPH_ID_SDMMC2:
+   case PERIPH_ID_SDMMC4:
return exynos4_mmc_config(peripheral, flags);
case PERIPH_ID_SDMMC1:
case PERIPH_ID_SDMMC3:
-   case PERIPH_ID_SDMMC4:
debug(SDMMC device %d not implemented\n, peripheral);
return -1;
default:
-- 
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 0/4] samsung: Add mmc controller to use dwmmc

2014-03-14 Thread Beomho Seo
This patch set for use dw mmc controller.
Patch enable supporting device tree for dw mmc controller.
For use dwmmc controller on trats2 board, enable configuration
dw_mmc, exynos_dwmmc, bounce_buffer and then disable sdhci configuration.
This patch set tested on TRATS2 board.

Changes for v2:
- Use device tree for dw mmc controller.
- dw mmc node is added device node on exynos4 device tree.
- dw mmc controller driver is fixed for use exynos4 and 5.
- add fdt compat id of exynos4 dwmmc.
- Add comment.

Beomho Seo (4):
  drivers: mmc: dwmmc: enable support for DT
  arm: exynos: pinmux: Add sdmmc4 gpio configuration
  arm: exynos: clock: Remove exynos4x12_set_mmc_clk function
  board: trats2: Enable device tree on Trats2

 arch/arm/cpu/armv7/exynos/clock.c  |   29 +
 arch/arm/cpu/armv7/exynos/pinmux.c |   19 +++
 arch/arm/dts/exynos4.dtsi  |8 
 arch/arm/dts/exynos4412-trats2.dts |8 
 drivers/mmc/exynos_dw_mmc.c|   20 
 include/fdtdec.h   |1 +
 lib/fdtdec.c   |1 +
 7 files changed, 50 insertions(+), 36 deletions(-)

-- 
1.7.9.5

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


[U-Boot] [PATCH v2 1/4] drivers: mmc: dwmmc: enable support for DT

2014-03-14 Thread Beomho Seo
This patch enable support for device tree for dw-mmc driver.
Driver have been fixed because it is used exynos5 and exynos4.
And then, add fdt compat id of exynos4 dwmmc.

Signed-off-by: Beomho Seo beomho@samsung.com
Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/mmc/exynos_dw_mmc.c |   20 
 include/fdtdec.h|1 +
 lib/fdtdec.c|1 +
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index de8cdcc..47119e2 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -13,6 +13,7 @@
 #include asm/arch/dwmmc.h
 #include asm/arch/clk.h
 #include asm/arch/pinmux.h
+#include asm/gpio.h

 #defineDWMMC_MAX_CH_NUM4
 #defineDWMMC_MAX_FREQ  5200
@@ -118,15 +119,21 @@ int exynos_dwmmc_init(const void *blob)
 {
int index, bus_width;
int node_list[DWMMC_MAX_CH_NUM];
-   int err = 0, dev_id, flag, count, i;
+   int err = 0, dev_id, flag, count, i, compat_id;
u32 clksel_val, base, timing[3];

+#ifdef CONFIG_EXYNOS4
+   compat_id = COMPAT_SAMSUNG_EXYNOS4_DWMMC;
+#else
+   compat_id = COMPAT_SAMSUNG_EXYNOS5_DWMMC;
+#endif
+
count = fdtdec_find_aliases_for_id(blob, mmc,
-   COMPAT_SAMSUNG_EXYNOS5_DWMMC, node_list,
-   DWMMC_MAX_CH_NUM);
+   compat_id, node_list, DWMMC_MAX_CH_NUM);

for (i = 0; i  count; i++) {
int node = node_list[i];
+   struct fdt_gpio_state pwr_gpio;

if (node = 0)
continue;
@@ -145,6 +152,9 @@ int exynos_dwmmc_init(const void *blob)
else
flag = PINMUX_FLAG_NONE;

+   fdtdec_decode_gpio(blob, node, pwr-gpios, pwr_gpio);
+   if (fdt_gpio_isvalid(pwr_gpio))
+   gpio_direction_output(pwr_gpio.gpio, 1);
/* config pinmux for each mmc channel */
err = exynos_pinmux_config(dev_id, flag);
if (err) {
@@ -152,7 +162,9 @@ int exynos_dwmmc_init(const void *blob)
return err;
}

-   index = dev_id - PERIPH_ID_SDMMC0;
+   index = fdtdec_get_int(blob, node, index, dev_id);
+   if (index == dev_id)
+   index = dev_id - PERIPH_ID_SDMMC0;

/* Get the base address from the device node */
base = fdtdec_get_addr(blob, node, reg);
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 63027bd..15f50fe 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -83,6 +83,7 @@ enum fdt_compat_id {
COMPAT_SAMSUNG_EXYNOS5_DP,  /* Exynos Display port controller */
COMPAT_SAMSUNG_EXYNOS5_DWMMC,   /* Exynos5 DWMMC controller */
COMPAT_SAMSUNG_EXYNOS_MMC,  /* Exynos MMC controller */
+   COMPAT_SAMSUNG_EXYNOS4_DWMMC,   /* Exynos4 DWMMC controller */
COMPAT_SAMSUNG_EXYNOS_SERIAL,   /* Exynos UART */
COMPAT_MAXIM_MAX77686_PMIC, /* MAX77686 PMIC */
COMPAT_GENERIC_SPI_FLASH,   /* Generic SPI Flash chip */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index be04598..79179cf 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -56,6 +56,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(SAMSUNG_EXYNOS5_DP, samsung,exynos5-dp),
COMPAT(SAMSUNG_EXYNOS5_DWMMC, samsung,exynos5250-dwmmc),
COMPAT(SAMSUNG_EXYNOS_MMC, samsung,exynos-mmc),
+   COMPAT(SAMSUNG_EXYNOS4_DWMMC, samsung,exynos4412-dwmmc),
COMPAT(SAMSUNG_EXYNOS_SERIAL, samsung,exynos4210-uart),
COMPAT(MAXIM_MAX77686_PMIC, maxim,max77686_pmic),
COMPAT(GENERIC_SPI_FLASH, spi-flash),
-- 
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] arm: exynos: clock: Remove exynos4x12_set_mmc_clk function

2014-03-14 Thread Beomho Seo
exynos4x12_set_mmc_clk function have been removed.
Because exynos4x12_clock and exynos4_clock return same div_fsys* value.

Signed-off-by: Beomho Seo beomho@samsung.com
Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- None.

 arch/arm/cpu/armv7/exynos/clock.c |   29 +
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
b/arch/arm/cpu/armv7/exynos/clock.c
index 1fea4d6..2c2029a 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -893,30 +893,6 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned 
int div)
(div  0xff)  ((dev_index  4) + 8));
 }

-/* exynos4x12: set the mmc clock */
-static void exynos4x12_set_mmc_clk(int dev_index, unsigned int div)
-{
-   struct exynos4x12_clock *clk =
-   (struct exynos4x12_clock *)samsung_get_base_clock();
-   unsigned int addr;
-
-   /*
-* CLK_DIV_FSYS1
-* MMC0_PRE_RATIO [15:8], MMC1_PRE_RATIO [31:24]
-* CLK_DIV_FSYS2
-* MMC2_PRE_RATIO [15:8], MMC3_PRE_RATIO [31:24]
-*/
-   if (dev_index  2) {
-   addr = (unsigned int)clk-div_fsys1;
-   } else {
-   addr = (unsigned int)clk-div_fsys2;
-   dev_index -= 2;
-   }
-
-   clrsetbits_le32(addr, 0xff  ((dev_index  4) + 8),
-   (div  0xff)  ((dev_index  4) + 8));
-}
-
 /* exynos5: set the mmc clock */
 static void exynos5_set_mmc_clk(int dev_index, unsigned int div)
 {
@@ -1612,10 +1588,7 @@ void set_mmc_clk(int dev_index, unsigned int div)
else
exynos5_set_mmc_clk(dev_index, div);
} else {
-   if (proid_is_exynos4412())
-   exynos4x12_set_mmc_clk(dev_index, div);
-   else
-   exynos4_set_mmc_clk(dev_index, div);
+   exynos4_set_mmc_clk(dev_index, div);
}
 }

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


[U-Boot] [PATCH v2 4/4] board: trats2: Enable device tree on Trats2

2014-03-14 Thread Beomho Seo
This patch add dwmmc emmc controller node on exynos4 and exynos4412 device tree.

Signed-off-by: Beomho Seo beomho@samsung.com
Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- None.

 arch/arm/dts/exynos4.dtsi  |8 
 arch/arm/dts/exynos4412-trats2.dts |8 
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/dts/exynos4.dtsi b/arch/arm/dts/exynos4.dtsi
index 71dc7eb..ab99906 100644
--- a/arch/arm/dts/exynos4.dtsi
+++ b/arch/arm/dts/exynos4.dtsi
@@ -128,6 +128,14 @@
interrupts = 0 78 0;
};

+   dwmmc@1255 {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = samsung,exynos4412-dwmmc;
+   reg = 0x1255 0x1000;
+   interrupts = 0 131 0;
+   };
+
gpio: gpio {
gpio-controller;
#gpio-cells = 2;
diff --git a/arch/arm/dts/exynos4412-trats2.dts 
b/arch/arm/dts/exynos4412-trats2.dts
index 7d32067..438e70e 100644
--- a/arch/arm/dts/exynos4412-trats2.dts
+++ b/arch/arm/dts/exynos4412-trats2.dts
@@ -31,6 +31,7 @@
console = /serial@1382;
mmc0 = sdhci@1251;
mmc2 = sdhci@1253;
+   mmc4 = dwmmc@1255;
};

i2c@138d {
@@ -431,4 +432,11 @@
sdhci@1254 {
status = disabled;
};
+
+   dwmmc@1255 {
+   samsung,bus-width = 8;
+   samsung,timing = 0 1 0;
+   pwr-gpios = gpio 0x2004002 0;
+   index = 4;
+   };
 };
-- 
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Swiching u-boot image in SPI-NOR

2014-03-14 Thread Wolfgang Denk
Dear JYOTI DUBEY,

In message CAE0zQkuaek52RPtRoMM=lgvha5ocsamywx+fbag8sedc3yn...@mail.gmail.com 
you wrote:

  fatload mmc 0:1 1200 u-boot.imx
 reading u-boot.imx
 343040 bytes read in 54 ms (6.1 MiB/s)

The size is here printed as a decimal number, but ...

 sf write 0x1200 0x0 343040
 ERROR: attempting write past flash size (0x20)

...sf expexts hex input; so you actually passed 0x343040 which is
about 10 times the correct value.

You can easily avoid this problem by using the automatially set
variable filesize instead.

 I have no clue as how to overcome this error.Can somebody help me with this
 error.

Try:

fatload mmc 0:1 1200 u-boot.imx
sf write 1200 0 $filesize

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
We all agree on the necessity of compromise. We just can't agree  on
when it's necessary to compromise.
- Larry Wall in  1991nov13.194420.28...@netlabs.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] A proposal/hack for an efficient USB DFU for linux based boards

2014-03-14 Thread Lukasz Majewski
Hi Krishna,

 Hi,
 
 Thanks for your time,
 
  Please find following comments:
 
 
  1. Current solution (u-boot):
  - It is possible to specify your own dfu_alt_info environment
variable when you call dfu command.
 
  2. Speed improvement - section Making it faster from:
  http://codelectron.wordpress.com/2014/02/28/flexible-firmware-upgrade/
 
  - I've noticed that you are referring to following dfu-util version:
  dfu-util - (C) 2007 by Openmoko Inc.
 
  It seems to be a bit old one.
 
 
 I just used the content from my old documentation, But im referring to
 current implementation.
 
 
  The newest GIT repo can be found at:
  git://gitorious.org/dfu-util/dfu-util.git
 
  I'm referring to following SHA1 (master branch):
  bda43a52a6c5e9dcd159236553b0d5c511616e77
 
  The code at dfuload_do_dnload() function is already rewritten to
  only wait:
  milli_sleep(dst.bwPollTimeout);
 
  which is correct, since non-zero values are explicitly specified in
  u-boot (when e.g. target expects that eMMC data will be written).
 
  It seems that the proposed improvement is already implemented.
 
 
 I dont think its implemented, you can refer here, its the block of
 code what I am referring to,
 
 https://gitorious.org/dfu-util/dfu-util/source/bda43a52a6c5e9dcd159236553b0d5c511616e77:src/dfu_load.c#L123
 https://gitorious.org/dfu-util/dfu-util/source/bda43a52a6c5e9dcd159236553b0d5c511616e77:src/dfu_load.c#L137

Ok, so there is the current code:

do {
ret = dfu_get_status(dif, dst);
if (ret  0) {
errx(EX_IOERR, Error during download get_status);
goto out_free;
}

if (dst.bState == DFU_STATE_dfuDNLOAD_IDLE ||
dst.bState == DFU_STATE_dfuERROR)
break;

/* Wait while device executes flashing */
milli_sleep(dst.bwPollTimeout);
} while (1);

And the code you refer in your webpage:
http://codelectron.wordpress.com/2014/02/28/flexible-firmware-upgrade/
do {
ret = dfu_get_status(dif-dev_handle, dif-interface, dst);
if (ret  0) {
fprintf(stderr, “Error during download get_status\n”);
goto out_free;
}
if (dst.bState == DFU_STATE_dfuDNLOAD_IDLE ||
dst.bState == DFU_STATE_dfuERROR)
break;
/* Wait while device executes flashing */
if (quirks  QUIRK_POLLTIMEOUT)
milli_sleep(DEFAULT_POLLTIMEOUT);
else
milli_sleep(dst.bwPollTimeout);
} while (1);

I'm a bit confused here, since it looks like the
milli_sleep(DEFAULT_POLLTIMEOUT); is already removed.

Am I missing something?

 
 
  As a side note:
  To improve transmission speed we were even trying to increase the
  EP0 packet size on HOST machine. Unfortunately it has some
  limitations (4 KiB if I'm not wrong).
 
 Yes I do think so about the limitation, as a standard EP0 should
 support atleast 64 bytes and DFU is based on that.
 
 
  Anyway, I'm open for potential DFU transmission speed improvements.
 
 
  3. Flexibility improvement - section Making it flexible
 
  The idea of adding headers seems appealing - but there are as usual
  some corner cases:
 
  - Backward compatibility - dfu-util and dfu use number of alt
  settings to chose the memory region to be written. That is why you
  observe a lot of alt=X when you type dfu-util -l. We would need
  some extra switch in the dfu-util to support yours header based
  approach.
 
  - In u-boot we would like to have some degree of control of where
  and if we flash data. I personally like to specify beforehand (in
  envs) what parts of memory are available for flashing.
 
 
 I developed it keeping in mind a situation in field where there can
 be a complete change in memory organisation.

Maybe some special alt setting could be defined for such a behavior in
u-boot? We can think about that if it solves a real problem.

 
 
  - Some more complicated schemes shall be considered as well. I've
  got some pending patches to support eMMC's bootparts flashing via
  DFU.
 
  - Also the header itself only assumes NAND being the backing
  memory. But we now also alter content of eMMC and RAM with DFU.
  This is missing.
 
  - The information provided by headers is already stored at
dfu_alt_info environment variable. It is also used by other
  gadgets.
 
 
 It was an example code based on what I had implemented some time
 back. It was based on nand flash, but the idea will be the same for
 any other  type.
 
 I just wanted to share the idea of a different type of implementation
 of USB DFU.

I'm happy, that you had shared this fresh view.

Do you have any other ideas for improvements?

 
 
 Krishna
 www.codelectron.com



-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de

[U-Boot] [PATCH 2/2] board/t208xrdb: Add support of 2-stage NAND bootloader

2014-03-14 Thread Shengzhou Liu
Add support of 2-stage NAND boot loader using SPL framework on T2080RDB.
PBL initialise the internal SRAM and copy SPL(96K), this further
initialise DDR using SPD and environment and copy u-boot from NAND
to DDR, finally SPL transfer control to u-boot.

Signed-off-by: Shengzhou Liu shengzhou@freescale.com
---
 board/freescale/t208xrdb/Makefile |  5 
 board/freescale/t208xrdb/README   |  8 +++---
 board/freescale/t208xrdb/ddr.c|  7 +++--
 board/freescale/t208xrdb/tlb.c|  4 ++-
 boards.cfg|  2 +-
 include/configs/T208xRDB.h| 58 +++
 6 files changed, 71 insertions(+), 13 deletions(-)

diff --git a/board/freescale/t208xrdb/Makefile 
b/board/freescale/t208xrdb/Makefile
index 092c9ff..9605f8b 100644
--- a/board/freescale/t208xrdb/Makefile
+++ b/board/freescale/t208xrdb/Makefile
@@ -4,10 +4,15 @@
 # SPDX-License-Identifier:  GPL-2.0+
 #
 
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
 obj-$(CONFIG_T2080RDB) += t208xrdb.o
 obj-$(CONFIG_T2080RDB) += eth_t208xrdb.o
 obj-$(CONFIG_T2080RDB) += cpld.o
 obj-$(CONFIG_PCI)  += pci.o
+endif
+
 obj-y   += ddr.o
 obj-y   += law.o
 obj-y   += tlb.o
diff --git a/board/freescale/t208xrdb/README b/board/freescale/t208xrdb/README
index 0012c6c..dfa73ae 100644
--- a/board/freescale/t208xrdb/README
+++ b/board/freescale/t208xrdb/README
@@ -164,10 +164,10 @@ Software configurations and board settings
 2. NAND Boot:
a. build PBL image for NAND boot
$ make T2080RDB_NAND_config
-   $ make u-boot.pbl
-   b. program u-boot.pbl to NAND flash
-   = tftp 100 u-boot.pbl
-   = nand erase 0 d
+   $ make u-boot-with-spl-pbl.bin
+   b. program u-boot-with-spl-pbl.bin to NAND flash
+   = tftp 100 u-boot-with-spl-pbl.bin
+   = nand erase 0 c
= nand write 100 0 $filesize
set SW1[1:8] = '1010', SW2[1] = '1', SW3[4] = '1' for NAND boot
 
diff --git a/board/freescale/t208xrdb/ddr.c b/board/freescale/t208xrdb/ddr.c
index 01e9173..18c9abd 100644
--- a/board/freescale/t208xrdb/ddr.c
+++ b/board/freescale/t208xrdb/ddr.c
@@ -102,11 +102,14 @@ phys_size_t initdram(int board_type)
 
puts(Initializingusing SPD\n);
 
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
dram_size = fsl_ddr_sdram();
 
dram_size = setup_ddr_tlbs(dram_size / 0x10);
dram_size *= 0x10;
-
-   puts(DDR: );
+#else
+   puts(DDR has been initialised by first stage boot loader\n);
+   dram_size =  0x8000;
+#endif
return dram_size;
 }
diff --git a/board/freescale/t208xrdb/tlb.c b/board/freescale/t208xrdb/tlb.c
index 085d9f5..2ebea36 100644
--- a/board/freescale/t208xrdb/tlb.c
+++ b/board/freescale/t208xrdb/tlb.c
@@ -65,6 +65,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
  MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
  0, 2, BOOKE_PAGESZ_256M, 1),
 
+#ifndef CONFIG_SPL_BUILD
/* *I*G* - PCIe 1, 0x8000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -110,6 +111,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  0, 12, BOOKE_PAGESZ_16M, 1),
 #endif
+#endif
 #ifdef CONFIG_SYS_DCSRBAR_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -140,7 +142,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
  0, 18, BOOKE_PAGESZ_1M, 1),
 #endif
-#if defined(CONFIG_SYS_RAMBOOT)
+#if defined(CONFIG_RAMBOOT_PBL)  !defined(CONFIG_SPL_BUILD)
SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
  MAS3_SX|MAS3_SW|MAS3_SR, 0,
  0, 19, BOOKE_PAGESZ_2G, 1)
diff --git a/boards.cfg b/boards.cfg
index 2715a20..17d8133 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -986,7 +986,7 @@ Active  powerpc mpc85xx-   freescale
   t208xqds
 Active  powerpc mpc85xx-   freescale   t208xrdb
T2080RDB  T208xRDB:PPC_T2080
 Active  powerpc mpc85xx-   freescale   t208xrdb
T2080RDB_SDCARD   
T208xRDB:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF4
 Active  powerpc mpc85xx-   freescale   t208xrdb
T2080RDB_SPIFLASH 
T208xRDB:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF4
-Active  powerpc mpc85xx-   freescale   t208xrdb
T2080RDB_NAND 
T208xRDB:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF4
+Active  powerpc mpc85xx-   freescale   t208xrdb
T2080RDB_NAND T208xRDB:PPC_T2080,RAMBOOT_PBL,RAMBOOT_SPLPBL,NAND
 Active  powerpc mpc85xx-   freescale   

[U-Boot] [PATCH 1/2] board/t208xqds: Add support of 2-stage NAND bootloader

2014-03-14 Thread Shengzhou Liu
Add support of 2 stage NAND boot loader using SPL framework.
PBL initialise the internal SRAM and copy SPL(96K), this further
initialise DDR using SPD and environment and copy u-boot from NAND
to DDR, finally SPL transfer control to u-boot.

Signed-off-by: Shengzhou Liu shengzhou@freescale.com
---
 board/freescale/t208xqds/Makefile |   5 ++
 board/freescale/t208xqds/ddr.c|   6 +-
 board/freescale/t208xqds/spl.c| 123 ++
 board/freescale/t208xqds/tlb.c|   7 +++
 boards.cfg|   4 +-
 include/configs/T208xQDS.h|  62 ---
 6 files changed, 197 insertions(+), 10 deletions(-)
 create mode 100644 board/freescale/t208xqds/spl.c

diff --git a/board/freescale/t208xqds/Makefile 
b/board/freescale/t208xqds/Makefile
index 947b7f7..6cb72c9 100644
--- a/board/freescale/t208xqds/Makefile
+++ b/board/freescale/t208xqds/Makefile
@@ -4,11 +4,16 @@
 # SPDX-License-Identifier:  GPL-2.0+
 #
 
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
 obj-$(CONFIG_T2080QDS) += t208xqds.o
 obj-$(CONFIG_T2080QDS) += eth_t208xqds.o
 obj-$(CONFIG_T2081QDS) += t208xqds.o
 obj-$(CONFIG_T2081QDS) += eth_t208xqds.o
 obj-$(CONFIG_PCI)  += pci.o
+endif
+
 obj-y   += ddr.o
 obj-y   += law.o
 obj-y   += tlb.o
diff --git a/board/freescale/t208xqds/ddr.c b/board/freescale/t208xqds/ddr.c
index ed1334d..11a60ff 100644
--- a/board/freescale/t208xqds/ddr.c
+++ b/board/freescale/t208xqds/ddr.c
@@ -109,11 +109,15 @@ phys_size_t initdram(int board_type)
 
puts(Initializingusing SPD\n);
 
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
dram_size = fsl_ddr_sdram();
 
dram_size = setup_ddr_tlbs(dram_size / 0x10);
dram_size *= 0x10;
+#else
+   puts(DDR has been initialised by first stage boot loader\n);
+   dram_size =  0x8000;
+#endif
 
-   puts(DDR: );
return dram_size;
 }
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c
new file mode 100644
index 000..deb759a
--- /dev/null
+++ b/board/freescale/t208xqds/spl.c
@@ -0,0 +1,123 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include asm/spl.h
+#include malloc.h
+#include ns16550.h
+#include nand.h
+#include i2c.h
+#include ../common/qixis.h
+#include t208xqds_qixis.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+phys_size_t get_effective_memsize(void)
+{
+   return CONFIG_SYS_L3_SIZE;
+}
+
+unsigned long get_board_sys_clk(void)
+{
+   u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
+
+   switch (sysclk_conf  0x0F) {
+   case QIXIS_SYSCLK_83:
+   return 8333;
+   case QIXIS_SYSCLK_100:
+   return 1;
+   case QIXIS_SYSCLK_125:
+   return 12500;
+   case QIXIS_SYSCLK_133:
+   return 1;
+   case QIXIS_SYSCLK_150:
+   return 15000;
+   case QIXIS_SYSCLK_160:
+   return 16000;
+   case QIXIS_SYSCLK_166:
+   return 1;
+   }
+   return ;
+}
+
+unsigned long get_board_ddr_clk(void)
+{
+   u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
+
+   switch ((ddrclk_conf  0x30)  4) {
+   case QIXIS_DDRCLK_100:
+   return 1;
+   case QIXIS_DDRCLK_125:
+   return 12500;
+   case QIXIS_DDRCLK_133:
+   return 1;
+   }
+   return ;
+}
+
+void board_init_f(ulong bootflag)
+{
+   u32 plat_ratio, sys_clk, ccb_clk;
+   ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+   /* Memcpy existing GD at CONFIG_SPL_GD_ADDR */
+   memcpy((void *)CONFIG_SPL_GD_ADDR, (void *)gd, sizeof(gd_t));
+
+   /* Update GD pointer */
+   gd = (gd_t *)(CONFIG_SPL_GD_ADDR);
+   __asm__ __volatile__( : : : memory);
+
+   console_init_f();
+
+   /* initialize selected port with appropriate baud rate */
+   sys_clk = get_board_sys_clk();
+   plat_ratio = (in_be32(gur-rcwsr[0])  25)  0x1f;
+   ccb_clk = sys_clk * plat_ratio / 2;
+
+   NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+ccb_clk / 16 / CONFIG_BAUDRATE);
+
+   relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+   bd_t *bd;
+
+   bd = (bd_t *)(gd + sizeof(gd_t));
+   memset(bd, 0, sizeof(bd_t));
+   gd-bd = bd;
+   bd-bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
+   bd-bi_memsize = CONFIG_SYS_L3_SIZE;
+
+   probecpu();
+   get_clocks();
+   mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+   CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+#ifndef CONFIG_SPL_NAND_BOOT
+   env_init();
+#endif
+
+   /* relocate environment function pointers etc. */
+#ifdef CONFIG_SPL_NAND_BOOT
+   nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+   (uchar 

Re: [U-Boot] [PATCH] cfi_flash: Micron Nor flash don't support read operation after send

2014-03-14 Thread Wolfgang Denk
Dear Qi Wang 王起 (qiwang),

In message 
71cf8d7f32c5c24c9cd1d0e02d52498a770d1...@ntxxiambx02.xacn.micron.com you 
wrote:

 Yes, I totally agree with you, copy from NOR flash to NOR flash is not 
 support.

Fine.

 But in the flash_write_cfibuffer() function, flash_read16(src) is used to 
 read data
 from src address, I think this flash_read function give users much mislead, 
 src address
 can be located in flash address range, not only can be in RAM.

Well, we cannot prevent users from misinterpreting the code.

 And currently, one of micron customers uses cp.b command to copy data from 
 NOR flash 
 to Nor flash, such as cp.b src_addr dest_addr len, both src_addr and 
 dest_addr are 
 located in NOR flash address range. Some manufactory's Nor flash can work 
 fine under 
 this command, but micron nor flash cannot. 

U-Boot is a boot loader, i. e. we have always to find a compromize
between resource consumption and functionality.  Just because a user
tries to do something that is not supported does not mean we should
make the code bigger and more complex - users will find all kinds of
exotic ways to do things.

In this specific case, there is a simple and efficient way to perform
the operation attempted by the user without code changes, so it makes
sense to just educate this user.

 As you said, copy from NOR flash to NOR flash is forbidden. 
 In the cp command function, 
 do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]),
 you can see below code, it just judge if the dest address is located in NOR 
 flash, but
 don't do any detect on src address.

Yes, and this is perfectly OK so.  Consider the case we have more than
one NOR flash device on a system.  It is perfectly legal to copy data
from one NOR flash chip into another one.

 So my suggestion is,
 1. don't use flash_read function in flash_write_cfibuffer() function, use 
readb(),readw(), readl() function instead.
 2. add detection in do_mem_cp() function, check if src address is locate in 
 NOR flash address range.
 
 So what's your opinions?

I see no need for any code changes.  Everything is working as
expected.

I repeat: U-Boot is a boot loader, not a general purpose OS.  This
means, that users of the command line interface aresupposed to
understand what they are doing.  There is no such strict error
checking and measures against all possible kinds of incorrect or
illegal input as you might expect from user space applications or from
the OS.

I think the only thing that should be done is to improve the
documentation and explicitly warn that copying of data within the same
bank of NOR flash cannot work.  Please feel free to edit [1] as
needed.  Thanks.

[1] http://www.denx.de/wiki/view/DULG/UBootCmdGroupFlash#Section_5.9.3.1.

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
A consultant is a person who borrows your watch, tells you what  time
it is, pockets the watch, and sends you a bill for it.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] p1010rdb-pb/usb: remove re-power on for p1010rdb-pb

2014-03-14 Thread Zhao Qiang
usb hub for p1010rdb-pb is not needed to re-power on
when init it.

Signed-off-by: Zhao Qiang b45...@freescale.com
---
 common/usb_hub.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index ffac0e7..edb1fc0 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -90,12 +90,15 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
int i;
struct usb_device *dev;
unsigned pgood_delay = hub-desc.bPwrOn2PwrGood * 2;
+#ifndef CONFIG_P1010RDB_PB
ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
unsigned short portstatus;
int ret;
+#endif
 
dev = hub-pusb_dev;
 
+#ifndef CONFIG_P1010RDB_PB
/*
 * Enable power to the ports:
 * Here we Power-cycle the ports: aka,
@@ -132,6 +135,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
continue;
}
}
+#endif
 
for (i = 0; i  dev-maxchild; i++) {
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
-- 
1.8.5


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


Re: [U-Boot] Swiching u-boot image in SPI-NOR

2014-03-14 Thread Stefano Babic
Hi Jvoty,

On 14/03/2014 08:17, JYOTI DUBEY wrote:
 Hello
   I am trying to bring in u-boot.imx (uboot image of u-boot 2013) onto
 SPI-NOR of nitrogen 6x board.I used following commands:
 sf probe 1
 sf erase 0 0x4
 fatload mmc 0:1 1200 u-boot.imx
 reading u-boot.imx
 343040 bytes read in 54 ms (6.1 MiB/s)
 sf write 0x1200 0x0 343040
 ERROR: attempting write past flash size (0x20)
 

Please read *carefully* the i.MX manual. The SOC expects to read the
i.MX header at a specific address, depending on the selected media. On
most media (SD, SPI,..) this is 0x400. It is wrong to copy u-boot.imx at
the beginning of the flash.

And, as already remarked by Wolfgang, U-Boot uses hexadecimal values,
not decimal.

You are not erasing enough flash. Check the size, for a nitrogen quad I get:

-rw-rw-r-- 1 stefano stefano 363520 mar 14 10:03 u-boot.imx

You are erasing only 256KB, this is not enough.

Try:

sf erase 0 6
sf write 0x1200 400 ${filesize}

Best regards,
Stefano Babic

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


[U-Boot] FSL eSPI driver is a mess, hack attached.

2014-03-14 Thread Joakim Tjernlund
The fsl_espi.c is wreck w.r.t large TX data.
Below is what I had to hack to load a FPGA over SPI and
what is the malloc hack good for? This does not work
well for TXing several MB data.

The driver needs to be rewritten and I do not have the
time so I post what I got in the hope it can help someone
else or trigger a rewrite.

---
 drivers/spi/fsl_espi.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index 7c84582..2843a8e 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -28,8 +28,9 @@ struct fsl_spi_slave {
 
 #define ESPI_MAX_CS_NUM4
 
-#define ESPI_EV_RNE(1  9)
-#define ESPI_EV_TNF(1  8)
+#define ESPI_EV_DON(1  (31 - 17))
+#define ESPI_EV_RNE(1  (31 - 22))
+#define ESPI_EV_TNF(1  (31 - 23))
 
 #define ESPI_MODE_EN   (1  31)   /* Enable interface */
 #define ESPI_MODE_TXTHR(x) ((x)  8)  /* Tx FIFO threshold */
@@ -37,6 +38,8 @@ struct fsl_spi_slave {
 
 #define ESPI_COM_CS(x) ((x)  30)
 #define ESPI_COM_TRANLEN(x)((x)  0)
+#define ESPI_COM_TO (1  (31 - 4))
+
 
 #define ESPI_CSMODE_CI_INACTIVEHIGH(1  31)
 #define ESPI_CSMODE_CP_BEGIN_EDGCLK(1  30)
@@ -146,8 +149,9 @@ int spi_claim_bus(struct spi_slave *slave)
| ESPI_CSMODE_CI_INACTIVEHIGH);
 
/* Character bit order: msb first */
-   out_be32(espi-csmode[cs], in_be32(espi-csmode[cs])
-   | ESPI_CSMODE_REV_MSB_FIRST);
+   if (!(mode  SPI_LSB_FIRST))
+   out_be32(espi-csmode[cs], in_be32(espi-csmode[cs])
+| ESPI_CSMODE_REV_MSB_FIRST);
 
/* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
out_be32(espi-csmode[cs], in_be32(espi-csmode[cs])
@@ -172,7 +176,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, 
const void *data_out,
int len = 0;
int num_blks, num_chunks, max_tran_len, tran_len;
int num_bytes;
-   unsigned char *ch;
+   //unsigned char *ch;
unsigned char *buffer = NULL;
size_t buf_len;
u8 *cmd_buf = fsl-cmd_buf;
@@ -216,20 +220,21 @@ int spi_xfer(struct spi_slave *slave, unsigned int 
bitlen, const void *data_out,
cmd_len = 0;
break;
}
-
+   dout = data_out;
debug(spi_xfer: slave %u:%u dout %08X(%p) din %08X(%p) len %u\n,
  slave-bus, slave-cs, *(uint *) dout,
  dout, *(uint *) din, din, len);
 
num_chunks = DIV_ROUND_UP(data_len, max_tran_len);
+   dout = buffer;
while (num_chunks--) {
if (data_in)
din = buffer + rx_offset;
-   dout = buffer;
tran_len = min(data_len , max_tran_len);
num_blks = DIV_ROUND_UP(tran_len + cmd_len, 4);
num_bytes = (tran_len + cmd_len) % 4;
fsl-data_len = tran_len + cmd_len;
+   data_len -= tran_len;
spi_cs_activate(slave);
 
/* Clear all eSPI events */
@@ -253,11 +258,12 @@ int spi_xfer(struct spi_slave *slave, unsigned int 
bitlen, const void *data_out,
}
 
/* Wait for eSPI transmit to get out */
-   udelay(80);
+   udelay(5);
 
event = in_be32(espi-event);
if (event  ESPI_EV_RNE) {
tmpdin = in_be32(espi-rx);
+#if 0
if (num_blks == 0  num_bytes != 0) {
ch = (unsigned char *)tmpdin;
while (num_bytes--)
@@ -266,7 +272,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, 
const void *data_out,
*(u32 *) din = tmpdin;
din += 4;
}
-
+#endif
out_be32(espi-event, in_be32(espi-event)
| ESPI_EV_RNE);
debug(***spi_xfer:...%08x readed\n, tmpdin);
@@ -301,6 +307,7 @@ void spi_cs_activate(struct spi_slave *slave)
 
com = ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0x));
com |= ESPI_COM_CS(slave-cs);
+   com |= ESPI_COM_TO;
com |= ESPI_COM_TRANLEN(data_len - 1);
out_be32(espi-com, com);
 }
-- 
1.8.3.2

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


Re: [U-Boot] Swiching u-boot image in SPI-NOR

2014-03-14 Thread JYOTI DUBEY
Yeah got it. Just specified the correct offset and converted the file size
to hex value.

Thank you!


On Fri, Mar 14, 2014 at 2:43 PM, Stefano Babic sba...@denx.de wrote:

 Hi Jvoty,

 On 14/03/2014 08:17, JYOTI DUBEY wrote:
  Hello
I am trying to bring in u-boot.imx (uboot image of u-boot 2013)
 onto
  SPI-NOR of nitrogen 6x board.I used following commands:
  sf probe 1
  sf erase 0 0x4
  fatload mmc 0:1 1200 u-boot.imx
  reading u-boot.imx
  343040 bytes read in 54 ms (6.1 MiB/s)
  sf write 0x1200 0x0 343040
  ERROR: attempting write past flash size (0x20)
 

 Please read *carefully* the i.MX manual. The SOC expects to read the
 i.MX header at a specific address, depending on the selected media. On
 most media (SD, SPI,..) this is 0x400. It is wrong to copy u-boot.imx at
 the beginning of the flash.

 And, as already remarked by Wolfgang, U-Boot uses hexadecimal values,
 not decimal.

 You are not erasing enough flash. Check the size, for a nitrogen quad I
 get:

 -rw-rw-r-- 1 stefano stefano 363520 mar 14 10:03 u-boot.imx

 You are erasing only 256KB, this is not enough.

 Try:

 sf erase 0 6
 sf write 0x1200 400 ${filesize}

 Best regards,
 Stefano Babic

 --
 =
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
 =

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


[U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Ian Campbell
Hi,

This is my first cut at an upstreamable series based upon the
https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
intention is to present a minimal starting point for upstreaming to
which support for other processors, peripherals, boards etc can be
added in the future. Therefore this has been stripped right back and
currently supports only sun7i processors and the cubietruck
board. Supported peripherals are UART, MMC and Ethernet.

The code here is from sunxi.git#sunxi[0] changeset d854c4de2f57 arm:
Handle .gnu.hash section in ldscripts and applied to u-boot v2014.01.

This series can also be found at:

git://gitorious.org/ijc/u-boot.git sunxi-mainlining-v1

There is no SMP here, since that relies on the PSCI support from Marc
Zyngier which has yet to land in mainline AFAIK.

I've tried to give corect credit and S-o-b based upon:
  git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u
  git log linux-sunxi/sunxi -- [PATHS] | grep -i signed.off.by  | sort -u
  Manual inspection

This will tend to over credit, since it will include folks who
contributed code which has since been removed as well as those who
contributed code which is not included in this patch set, but I think
it is better to be conservative and include too many rather than
incorrectly exclude people. Doing better than this would be IMHO too
hard to be worth it (e.g. git blame would prefer a recent whitespace
cleanup to the actual author of the code and prefer someone did code
motion over the original author, so it would be a massive  manual
process).

I considered using the sunxi.git#sunxi-patchqueue branch but it was
151 patches and there didn't seem to be a small enough set of prefix
patches which I was comfortable starting from.

Cheers,
Ian.

[0] https://github.com/linux-sunxi/u-boot-sunxi.git


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


[U-Boot] [PATCH v1 1/9] sunxi: initial sun7i clocks and timer support.

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

This has been stripped back for mainlining and supports only sun7i. These
changes are not useful by themselves but are split out to make the patch sizes
more manageable.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Alejandro Mery
  Carl van Schaik
  Stefan Roese
  Tom Cubie
  yemao

Signed-off-by: Alexandru Gagniuc mr.nuke...@gmail.com
Signed-off-by: Chen-Yu Tsai w...@csie.org
Signed-off-by: Emilio López emi...@elopez.com.ar
Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Jens Kuske jensku...@gmail.com
Signed-off-by: Luke Leighton l...@lkcl.net
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Ian Campbell i...@hellion.org.uk

---
Contributors:
  git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u
---
 arch/arm/cpu/armv7/sunxi/Makefile   |  28 
 arch/arm/cpu/armv7/sunxi/clock.c| 177 +
 arch/arm/cpu/armv7/sunxi/timer.c| 120 ++
 arch/arm/include/asm/arch-sunxi/clock.h | 238 
 arch/arm/include/asm/arch-sunxi/sys_proto.h |  33 
 arch/arm/include/asm/arch-sunxi/timer.h | 104 
 6 files changed, 700 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/Makefile
 create mode 100644 arch/arm/cpu/armv7/sunxi/clock.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/timer.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/clock.h
 create mode 100644 arch/arm/include/asm/arch-sunxi/sys_proto.h
 create mode 100644 arch/arm/include/asm/arch-sunxi/timer.h

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile 
b/arch/arm/cpu/armv7/sunxi/Makefile
new file mode 100644
index 000..b56c32b
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -0,0 +1,28 @@
+#
+# (C) Copyright 2012 Henrik Nordstrom hen...@henriknordstrom.net
+#
+# Based on some other Makefile
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will 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
+#
+
+obj-y  += timer.o
+obj-y  += clock.o
diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
new file mode 100644
index 000..e3abaf0
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/clock.c
@@ -0,0 +1,177 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton l...@lkcl.net
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/gpio.h
+#include asm/arch/sys_proto.h
+
+#ifdef CONFIG_SPL_BUILD
+static void clock_init_safe(void)
+{
+   struct sunxi_ccm_reg * const ccm =
+   (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+   /* Set safe defaults until PMU is configured */
+   writel(AXI_DIV_1  0 | AHB_DIV_2  4 | APB0_DIV_1  8 |
+  CPU_CLK_SRC_OSC24M  16, ccm-cpu_ahb_apb0_cfg);
+   writel(0xa1005000, ccm-pll1_cfg);
+   sdelay(200);
+   writel(AXI_DIV_1  0 | AHB_DIV_2  4 | APB0_DIV_1  8 |
+  CPU_CLK_SRC_PLL1  16, ccm-cpu_ahb_apb0_cfg);
+   writel(0x1  6 | readl(ccm-ahb_gate0), ccm-ahb_gate0);
+   writel(0x1  31 | readl(ccm-pll6_cfg), ccm-pll6_cfg);
+}
+#endif
+
+int 

[U-Boot] [PATCH v1 2/9] sunxi: initial sun7i pinmux and gpio support

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

This has been stripped back for mainlining and supports only sun7i. These
changes are not useful by themselves but are split out to make the patch sizes
more manageable.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Carl van Schaik
  Henrik Nordstrom
  Stefan Roese
  Tom Cubie

Signed-off-by: Chen-Yu Tsai w...@csie.org
Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Ma Haijun mahaij...@gmail.com
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/cpu/armv7/sunxi/Makefile  |   1 +
 arch/arm/cpu/armv7/sunxi/pinmux.c  |  96 ++
 arch/arm/include/asm/arch-sunxi/gpio.h | 179 +
 3 files changed, 276 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/pinmux.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/gpio.h

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile 
b/arch/arm/cpu/armv7/sunxi/Makefile
index b56c32b..b4298c0 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -26,3 +26,4 @@
 
 obj-y  += timer.o
 obj-y  += clock.o
+obj-y  += pinmux.o
diff --git a/arch/arm/cpu/armv7/sunxi/pinmux.c 
b/arch/arm/cpu/armv7/sunxi/pinmux.c
new file mode 100644
index 000..56671f6
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/pinmux.c
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include asm/io.h
+#include asm/arch/gpio.h
+
+int sunxi_gpio_set_cfgpin(u32 pin, u32 val)
+{
+   u32 cfg;
+   u32 bank = GPIO_BANK(pin);
+   u32 index = GPIO_CFG_INDEX(pin);
+   u32 offset = GPIO_CFG_OFFSET(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   cfg = readl(pio-cfg[0] + index);
+   cfg = ~(0xf  offset);
+   cfg |= val  offset;
+
+   writel(cfg, pio-cfg[0] + index);
+
+   return 0;
+}
+
+int sunxi_gpio_get_cfgpin(u32 pin)
+{
+   u32 cfg;
+   u32 bank = GPIO_BANK(pin);
+   u32 index = GPIO_CFG_INDEX(pin);
+   u32 offset = GPIO_CFG_OFFSET(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   cfg = readl(pio-cfg[0] + index);
+   cfg = offset;
+
+   return cfg  0xf;
+}
+
+int sunxi_gpio_set_drv(u32 pin, u32 val)
+{
+   u32 drv;
+   u32 bank = GPIO_BANK(pin);
+   u32 index = GPIO_DRV_INDEX(pin);
+   u32 offset = GPIO_DRV_OFFSET(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   drv = readl(pio-drv[0] + index);
+   drv = ~(0x3  offset);
+   drv |= val  offset;
+
+   writel(drv, pio-drv[0] + index);
+
+   return 0;
+}
+
+int sunxi_gpio_set_pull(u32 pin, u32 val)
+{
+   u32 pull;
+   u32 bank = GPIO_BANK(pin);
+   u32 index = GPIO_PULL_INDEX(pin);
+   u32 offset = GPIO_PULL_OFFSET(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   pull = readl(pio-pull[0] + index);
+   pull = ~(0x3  offset);
+   pull |= val  offset;
+
+   writel(pull, pio-pull[0] + index);
+
+   return 0;
+}
diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
b/arch/arm/include/asm/arch-sunxi/gpio.h
new file mode 100644
index 000..79b4f21
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -0,0 +1,179 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the 

[U-Boot] [PATCH v1 6/9] sunxi: add support for Cubietruck booting in FEL mode

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 board/sunxi/dram_cubietruck.c | 31 +++
 boards.cfg|  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 board/sunxi/dram_cubietruck.c

diff --git a/board/sunxi/dram_cubietruck.c b/board/sunxi/dram_cubietruck.c
new file mode 100644
index 000..1e7c94a
--- /dev/null
+++ b/board/sunxi/dram_cubietruck.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 432,
+   .type = 3,
+   .rank_num = 1,
+   .density = 8192,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 9,
+   .zq = 0x7f,
+   .odt_en = 0,
+   .size = 2048,
+   .tpr0 = 0x42d899b7,
+   .tpr1 = 0xa090,
+   .tpr2 = 0x22a00,
+   .tpr3 = 0x0,
+   .tpr4 = 0x1,
+   .tpr5 = 0x0,
+   .emr1 = 0x4,
+   .emr2 = 0x10,
+   .emr3 = 0x0,
+};
+
+unsigned long sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index a8336cc..6c35a40 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -353,6 +353,7 @@ Active  arm armv7  rmobile renesas  
   koelsch
 Active  arm armv7  s5pc1xx samsung goni
s5p_goni -  

   Mateusz Zalega m.zal...@samsung.com
 Active  arm armv7  s5pc1xx samsung smdkc100
smdkc100 -  

   Minkyu Kang mk7.k...@samsung.com
 Active  arm armv7  socfpga altera  socfpga 
socfpga_cyclone5 -  

   -
+Active  arm armv7  sunxi   -   sunxi   
Cubietruck_FEL   sun7i:CUBIETRUCK,SPL_FEL   

   -
 Active  arm armv7  u8500   st-ericsson snowball
snowball -  

   Mathieu Poirier mathieu.poir...@linaro.org
 Active  arm armv7  u8500   st-ericsson u8500   
u8500_href   -  

   -
 Active  arm armv7  vf610   freescale   vf610twr
vf610twr 
vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg   
  Alison Wang 
b18...@freescale.com
-- 
1.8.5.3

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


[U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

This has been stripped back for mainlining and supports only sun7i. These
changes are not useful by themselves but are split out to make the patch sizes
more manageable.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Alejandro Mery
  Carl van Schaik
  Tom Cubie

Signed-off-by: Alexandru Gagniuc mr.nuke...@gmail.com
Signed-off-by: Emilio López emi...@elopez.com.ar
Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Ian Campbell i...@hellion.org.uk
Signed-off-by: Luke Leighton l...@lkcl.net
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/cpu/armv7/sunxi/Makefile  |   1 +
 arch/arm/cpu/armv7/sunxi/dram.c| 530 +
 arch/arm/include/asm/arch-sunxi/dram.h | 191 
 3 files changed, 722 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/dram.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/dram.h

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile 
b/arch/arm/cpu/armv7/sunxi/Makefile
index b4298c0..41d843f 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -25,5 +25,6 @@
 #
 
 obj-y  += timer.o
+obj-y  += dram.o
 obj-y  += clock.o
 obj-y  += pinmux.o
diff --git a/arch/arm/cpu/armv7/sunxi/dram.c b/arch/arm/cpu/armv7/sunxi/dram.c
new file mode 100644
index 000..81b1f50
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/dram.c
@@ -0,0 +1,530 @@
+/*
+ * sunxi DRAM controller initialization
+ * (C) Copyright 2012 Henrik Nordstrom hen...@henriknordstrom.net
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton l...@lkcl.net
+ *
+ * Based on sun4i Linux kernel sources mach-sunxi/pm/standby/dram*.c
+ * and earlier U-Boot Allwiner A10 SPL work
+ *
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Berg Xing bergx...@allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/dram.h
+#include asm/arch/timer.h
+#include asm/arch/sys_proto.h
+
+#define CPU_CFG_CHIP_VER(n) ((n)  6)
+#define CPU_CFG_CHIP_VER_MASK CPU_CFG_CHIP_VER(0x3)
+#define CPU_CFG_CHIP_REV_A 0x0
+#define CPU_CFG_CHIP_REV_C1 0x1
+#define CPU_CFG_CHIP_REV_C2 0x2
+#define CPU_CFG_CHIP_REV_B 0x3
+
+static void mctl_ddr3_reset(void)
+{
+   struct sunxi_dram_reg *dram =
+   (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+   {
+   clrbits_le32(dram-mcr, DRAM_MCR_RESET);
+   udelay(2);
+   setbits_le32(dram-mcr, DRAM_MCR_RESET);
+   }
+}
+
+static void mctl_set_drive(void)
+{
+   struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+   clrsetbits_le32(dram-mcr, DRAM_MCR_MODE_NORM(0x3) | (0x3  28),
+   DRAM_MCR_MODE_EN(0x3) |
+   0xffc);
+}
+
+static void mctl_itm_disable(void)
+{
+   struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+   clrsetbits_le32(dram-ccr, DRAM_CCR_INIT, DRAM_CCR_ITM_OFF);
+}
+
+static void mctl_itm_enable(void)
+{
+   struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+   clrbits_le32(dram-ccr, DRAM_CCR_ITM_OFF);
+}
+
+static void mctl_enable_dll0(u32 phase)
+{
+   struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+   clrsetbits_le32(dram-dllcr[0], 0x3f  6,
+   ((phase  16)  0x3f)  6);
+   clrsetbits_le32(dram-dllcr[0], DRAM_DLLCR_NRESET, DRAM_DLLCR_DISABLE);
+   udelay(2);
+
+   clrbits_le32(dram-dllcr[0], DRAM_DLLCR_NRESET | DRAM_DLLCR_DISABLE);
+   udelay(22);
+
+   clrsetbits_le32(dram-dllcr[0], DRAM_DLLCR_DISABLE, DRAM_DLLCR_NRESET);
+   udelay(22);
+}
+
+/*
+ * Note: This differs from pm/standby in that it checks the bus width
+ */
+static void mctl_enable_dllx(u32 phase)
+{
+   struct sunxi_dram_reg 

[U-Boot] [PATCH v1 7/9] sunxi: mmc support

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Stefan Roese
  Tom Cubie
  yemao

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Luke Leighton l...@lkcl.net
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Wills Wang wills.wang.o...@gmail.com
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/include/asm/arch-sunxi/mmc.h |  66 
 board/sunxi/board.c   |  13 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/sunxi_mmc.c   | 650 ++
 include/configs/sunxi-common.h|  11 +
 5 files changed, 741 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-sunxi/mmc.h
 create mode 100755 drivers/mmc/sunxi_mmc.c

diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h 
b/arch/arm/include/asm/arch-sunxi/mmc.h
new file mode 100644
index 000..639a7fc
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
@@ -0,0 +1,66 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Aaron leafy.m...@allwinnertech.com
+ *
+ * MMC register definition for allwinner sunxi platform.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _SUNXI_MMC_H
+#define _SUNXI_MMC_H
+
+#include linux/types.h
+
+struct sunxi_mmc {
+   u32 gctrl;  /* (0x00) SMC Global Control Register */
+   u32 clkcr;  /* (0x04) SMC Clock Control Register */
+   u32 timeout;/* (0x08) SMC Time Out Register */
+   u32 width;  /* (0x0c) SMC Bus Width Register */
+   u32 blksz;  /* (0x10) SMC Block Size Register */
+   u32 bytecnt;/* (0x14) SMC Byte Count Register */
+   u32 cmd;/* (0x18) SMC Command Register */
+   u32 arg;/* (0x1c) SMC Argument Register */
+   u32 resp0;  /* (0x20) SMC Response Register 0 */
+   u32 resp1;  /* (0x24) SMC Response Register 1 */
+   u32 resp2;  /* (0x28) SMC Response Register 2 */
+   u32 resp3;  /* (0x2c) SMC Response Register 3 */
+   u32 imask;  /* (0x30) SMC Interrupt Mask Register */
+   u32 mint;   /* (0x34) SMC Masked Interrupt Status Reg */
+   u32 rint;   /* (0x38) SMC Raw Interrupt Status Register */
+   u32 status; /* (0x3c) SMC Status Register */
+   u32 ftrglevel;  /* (0x40) SMC FIFO Threshold Watermark Reg */
+   u32 funcsel;/* (0x44) SMC Function Select Register */
+   u32 cbcr;   /* (0x48) SMC CIU Byte Count Register */
+   u32 bbcr;   /* (0x4c) SMC BIU Byte Count Register */
+   u32 dbgc;   /* (0x50) SMC Debug Enable Register */
+   u32 res0[11];   /* (0x54~0x7c) */
+   u32 dmac;   /* (0x80) SMC IDMAC Control Register */
+   u32 dlba;   /* (0x84) SMC IDMAC Descr List Base Addr Reg */
+   u32 idst;   /* (0x88) SMC IDMAC Status Register */
+   u32 idie;   /* (0x8c) SMC IDMAC Interrupt Enable Register */
+   u32 chda;   /* (0x90) */
+   u32 cbda;   /* (0x94) */
+   u32 res1[26];   /* (0x98~0xff) */
+   u32 fifo;   /* (0x100) SMC FIFO Access Address */
+};
+
+int sunxi_mmc_init(int sdc_no);
+#endif /* _SUNXI_MMC_H */
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index bffef4f..5dbcf2a 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -30,6 +30,7 @@
 #include common.h
 #include asm/arch/clock.h
 #include asm/arch/dram.h
+#include asm/arch/mmc.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -59,6 +60,18 @@ int dram_init(void)
return 0;
 }
 
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+   sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
+#if !defined (CONFIG_SPL_BUILD)  defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
+   sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+#endif
+
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_BUILD
 void 

[U-Boot] [PATCH v1 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Henrik Nordstrom
  Tom Cubie

Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 Makefile|  15 +++
 arch/arm/cpu/armv7/sunxi/config.mk  |   8 ++
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  69 ++
 boards.cfg  |   1 +
 include/configs/sunxi-common.h  |  45 +
 spl/Makefile|  12 +++
 tools/.gitignore|   1 +
 tools/Makefile  |   6 ++
 tools/mksunxiboot.README|  13 +++
 tools/mksunxiboot.c | 163 
 10 files changed, 333 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/config.mk
 create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
 create mode 100644 tools/mksunxiboot.README
 create mode 100644 tools/mksunxiboot.c

diff --git a/Makefile b/Makefile
index 47a03e3..ff1f64e 100644
--- a/Makefile
+++ b/Makefile
@@ -491,6 +491,16 @@ $(obj)u-boot.spr:  $(obj)u-boot.img 
$(obj)spl/u-boot-spl.bin
--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
cat $(obj)u-boot.img  $@
 
+# sunxi: Combined object with SPL U-Boot with sunxi header (sunxi-spl.bin)
+# and the full-blown U-Boot attached to it
+$(obj)u-boot-sunxi-with-spl.bin: $(obj)spl/sunxi-spl.bin $(obj)u-boot.img
+   tr \000 \377  /dev/zero | dd ibs=1 
count=$(CONFIG_SPL_PAD_TO) \
+   of=$(obj)spl/sunxi-spl-pad.bin 2/dev/null
+   dd if=$(obj)spl/sunxi-spl.bin of=$(obj)spl/sunxi-spl-pad.bin \
+   conv=notrunc 2/dev/null
+   cat $(obj)spl/sunxi-spl-pad.bin $(obj)u-boot.img  $@
+   rm $(obj)spl/sunxi-spl-pad.bin
+
 ifneq ($(CONFIG_TEGRA),)
 $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O 
binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
@@ -578,6 +588,9 @@ $(obj)spl/u-boot-spl.bin:   $(SUBDIR_TOOLS) depend
 $(obj)tpl/u-boot-tpl.bin:  $(SUBDIR_TOOLS) depend
$(MAKE) -C spl all CONFIG_TPL_BUILD=y
 
+$(obj)spl/sunxi-spl.bin:   $(SUBDIR_TOOLS) depend
+   $(MAKE) -C spl all
+
 # Explicitly make _depend in subdirs containing multiple targets to prevent
 # parallel sub-makes creating .depend files simultaneously.
 depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \
@@ -799,6 +812,7 @@ clean:
   $(obj)tools/dump{env,}image\
   $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk \
   $(obj)tools/mk{$(BOARD),}spl   \
+  $(obj)tools/mksunxiboot\
   $(obj)tools/mxsboot\
   $(obj)tools/ncb $(obj)tools/ubsha1 \
   $(obj)tools/kernel-doc/docproc \
@@ -855,6 +869,7 @@ clobber:tidy
@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name * -type l 
-print | xargs rm -f
@rm -f $(obj)dts/*.tmp
@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
+   @rm -f $(obj)spl/sun?i-spl.bin
 
 mrproper \
 distclean: clobber unconfig
diff --git a/arch/arm/cpu/armv7/sunxi/config.mk 
b/arch/arm/cpu/armv7/sunxi/config.mk
new file mode 100644
index 000..9ce48b4
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/config.mk
@@ -0,0 +1,8 @@
+# Build a combined spl + u-boot image
+ifdef CONFIG_SPL
+ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_SPL_FEL
+ALL-y = $(obj)u-boot-sunxi-with-spl.bin
+endif
+endif
+endif
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds 
b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
new file mode 100644
index 000..2a3b497
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
@@ -0,0 +1,69 @@
+/*
+ * (C) Copyright 2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * Based on omap-common/u-boot-spl.lds:
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, ga...@denx.de
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, www.ti.com
+ * Aneesh V ane...@ti.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A 

[U-Boot] [PATCH v1 9/9] sunxi: add gmac Ethernet support

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

Signed-off-by: Chen-Yu Tsai w...@csie.org
Signed-off-by: Jens Kuske jensku...@gmail.com
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/cpu/armv7/sunxi/board.c | 15 +
 boards.cfg   |  4 +--
 drivers/net/Makefile |  1 +
 drivers/net/sunxi_gmac.c | 34 
 include/configs/sunxi-common.h   | 68 
 5 files changed, 120 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/sunxi_gmac.c

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 98cad43..73b4cf0 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -27,6 +27,8 @@
  */
 
 #include common.h
+#include netdev.h
+#include miiphy.h
 #include serial.h
 #ifdef CONFIG_SPL_BUILD
 #include spl.h
@@ -102,3 +104,16 @@ void enable_caches(void)
dcache_enable();
 }
 #endif
+
+#if defined(CONFIG_SUNXI_GMAC)
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int cpu_eth_init(bd_t *bis)
+{
+   sunxi_gmac_initialize(bis);
+
+   return 0;
+}
+#endif
diff --git a/boards.cfg b/boards.cfg
index a513376..090e956 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -353,8 +353,8 @@ Active  arm armv7  rmobile renesas  
   koelsch
 Active  arm armv7  s5pc1xx samsung goni
s5p_goni -  

   Mateusz Zalega m.zal...@samsung.com
 Active  arm armv7  s5pc1xx samsung smdkc100
smdkc100 -  

   Minkyu Kang mk7.k...@samsung.com
 Active  arm armv7  socfpga altera  socfpga 
socfpga_cyclone5 -  

   -
-Active  arm armv7  sunxi   -   sunxi   
Cubietruck   sun7i:CUBIETRUCK,SPL   

   -
-Active  arm armv7  sunxi   -   sunxi   
Cubietruck_FEL   sun7i:CUBIETRUCK,SPL_FEL   

   -
+Active  arm armv7  sunxi   -   sunxi   
Cubietruck   sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII  

   -
+Active  arm armv7  sunxi   -   sunxi   
Cubietruck_FEL   
sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII   
  -
 Active  arm armv7  u8500   st-ericsson snowball
snowball -  

   Mathieu Poirier mathieu.poir...@linaro.org
 Active  arm armv7  u8500   st-ericsson u8500   
u8500_href   -  

   -
 Active  arm armv7  vf610   freescale   vf610twr
vf610twr 
vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg   
  Alison Wang 
b18...@freescale.com
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 7f9ce90..2300c00 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_SH_ETHER) += sh_eth.o
 obj-$(CONFIG_SMC9) += smc9.o
 obj-$(CONFIG_SMC911X) += smc911x.o
 obj-$(CONFIG_SUNXI_WEMAC) += sunxi_wemac.o
+obj-$(CONFIG_SUNXI_GMAC) += sunxi_gmac.o
 obj-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
 obj-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
diff --git a/drivers/net/sunxi_gmac.c b/drivers/net/sunxi_gmac.c
new file mode 100644
index 000..432d7b2
--- /dev/null
+++ b/drivers/net/sunxi_gmac.c
@@ -0,0 +1,34 @@
+#include common.h
+#include netdev.h
+#include miiphy.h
+#include asm/gpio.h
+#include asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/gpio.h
+
+int sunxi_gmac_initialize(bd_t *bis)

Re: [U-Boot] [PATCH 1/3] usb, dfu: extract flush code into seperate function

2014-03-14 Thread Lukasz Majewski
Hi Heiko,

I'm also CCing Pantelis to the loop.

 Hello Marek,
 
 Am 12.03.2014 12:43, schrieb Marek Vasut:
  On Wednesday, March 12, 2014 at 11:01:19 AM, Heiko Schocher wrote:
  move the flushing code into an extra function dfu_flush(),
  so it can be used from other code.
 
  Signed-off-by: Heiko Schocherh...@denx.de
  Cc: Lukasz Majewskil.majew...@samsung.com
  Cc: Kyungmin Parkkyungmin.p...@samsung.com
  Cc: Marek Vasutma...@denx.de
  ---
drivers/dfu/dfu.c | 46
  ++ include/dfu.h
  |  1 + 2 files changed, 27 insertions(+), 20 deletions(-)
 
  diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
  index 56e69fd..193e047 100644
  --- a/drivers/dfu/dfu.c
  +++ b/drivers/dfu/dfu.c
  @@ -127,6 +127,31 @@ static int dfu_write_buffer_drain(struct
  dfu_entity *dfu) return ret;
}
 
  +int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int
  blk_seq_num) +{
  +  int ret = 0;
  +
  +  /* end? */
 
  What does this comment mean ? I don't understand it ...
 
 Comes from original code... Thinking about it, it seems better to
 let this comment and the below if in the dfu_write function...

This comment doesn't bring any meaningful information, so can be
removed.

 
  +  if (size == 0) {
 
  You can check this like so:
 
  if (size)
 return;
 
 ... as when moving this if back to dfu_write(), this if kindly
 disappears in the patch 2/3 of this series, as calling dfu_flush()
 is only in the new dfuMANIFEST state necessary, which is called at
 the end of the dfu transfer, so no need for checking, if end of
 size is reached!

So, in my opinion, this if can be safely removed.

 
 
  code
  code
  code
 
  This would cut down the indent, no ?
 
 Yes. Did the above change and this if is no longer necessary ;-)
 
 I will wait for comments from Lukasz before posting v2.
 
  Please let's fix this when this popped up, either in separate patch
  or wrap it into this one.
 
  +  /* Now try and flush to the medium if needed. */
  +  if (dfu-flush_medium)
  +  ret = dfu-flush_medium(dfu);
  +  printf(\nDFU complete CRC32: 0x%08x\n,
  dfu-crc); +
  +  /* clear everything */
  +  dfu_free_buf();
  +  dfu-crc = 0;
  +  dfu-offset = 0;
  +  dfu-i_blk_seq_num = 0;
  +  dfu-i_buf_start = dfu_buf;
  +  dfu-i_buf_end = dfu_buf;
  +  dfu-i_buf = dfu-i_buf_start;
  +
  +  dfu-inited = 0;
  +  }
  +  return ret;
  +}
  [...]
 
 Thanks!
 
 bye,
 Heiko

BTW: Thanks for proper extension of the DFU state machine in u-boot :-).

-- 
Best regards,

Lukasz Majewski

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


Re: [U-Boot] A proposal/hack for an efficient USB DFU for linux based boards

2014-03-14 Thread Krishna Pattabiraman
Ok, so there is the current code:


 do {
 ret = dfu_get_status(dif, dst);
 if (ret  0) {
 errx(EX_IOERR, Error during download get_status);
 goto out_free;
 }

 if (dst.bState == DFU_STATE_dfuDNLOAD_IDLE ||
 dst.bState == DFU_STATE_dfuERROR)
 break;

 /* Wait while device executes flashing */
 milli_sleep(dst.bwPollTimeout);
 } while (1);

 And the code you refer in your webpage:
 http://codelectron.wordpress.com/2014/02/28/flexible-firmware-upgrade/
 do {
 ret = dfu_get_status(dif-dev_handle, dif-interface, dst);
 if (ret  0) {
 fprintf(stderr, Error during download get_status\n);
 goto out_free;
 }
 if (dst.bState == DFU_STATE_dfuDNLOAD_IDLE ||
 dst.bState == DFU_STATE_dfuERROR)
 break;
 /* Wait while device executes flashing */
 if (quirks  QUIRK_POLLTIMEOUT)
 milli_sleep(DEFAULT_POLLTIMEOUT);
 else
 milli_sleep(dst.bwPollTimeout);
 } while (1);

 I'm a bit confused here, since it looks like the
 milli_sleep(DEFAULT_POLLTIMEOUT); is already removed.

 Am I missing something?

No not in the code. Yes they are different code but what I am speaking
about in the blog  is the removal of the whole block and removing the
corresponding states in u-boot also. I have also given the reasons for it
in the blog.



 I developed it keeping in mind a situation in field where there can
 be a complete change in memory organisation.

Maybe some special alt setting could be defined for such a behavior in
 u-boot? We can think about that if it solves a real problem.

Its a difference between a partition table style vs free style. My reason
for choosing the latter was
1. The partition table is actually inside the linux kernel and to change
partition, we need upgrade to u-boot-env as well as Linux kernel. Risk of
bricking was higher.
Like here
http://lxr.free-electrons.com/source/arch/arm/mach-omap2/board-omap3beagle.c?v=2.6.36#L53

2. I used SAM9G45 and for normal booting of Linux and U-boot for upgrade
and other maintanence purpose.
http://free-electrons.com/blog/at91bootstrap-linux/ .

I haven't considered other types of storage devices and boards, but I think
that the concept is very same for other devices too.



 I'm happy, that you had shared this fresh view.

 Do you have any other ideas for improvements?


Yes, When you plug the DFU enabled device to PC as per standard it should
show as Device Firware Updrade in the Device class. Device manager in
windows and any similar appplication in other OS will show that. I haven't
checked the current implementation in U-boot. It can be done by changing
the configuration descriptor in the USB driver. The class is FE and sub
class is 01 you can refer here
http://www.usb.org/developers/defined_class/#BaseClassFEh .

Thank you for your time.

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


[U-Boot] [PATCH v1 5/9] sunxi: generic sun7i build infrastructure.

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

This has been stripped back for mainlining and supports only sun7i booting via
FEL mode. These changes are not useful by themselves but are split out to make
the patch sizes more manageable.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Almo Nito
  Carl van Schaik
  FUKAUMI Naoki
  hehopmajieh
  j
  Sergey Lapin
  Tom Cubie

Signed-off-by: Adam Sampson a...@offog.org
Signed-off-by: Aleksei Mamlin mamli...@gmail.com
Signed-off-by: Chen-Yu Tsai w...@csie.org
Signed-off-by: Emilio López emi...@elopez.com.ar
Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Jens Kuske jensku...@gmail.com
Signed-off-by: Luc Verhaegen l...@skynet.be
Signed-off-by: Luke Leighton l...@lkcl.net
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Patrick Wood patrickhw...@gmail.com
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Wills Wang wills.wang.o...@gmail.com
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/cpu/armv7/Makefile |   2 +-
 arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds |  59 +++
 arch/arm/include/asm/arch-sunxi/spl.h   |  36 +++
 board/sunxi/Makefile|   1 +
 include/configs/sun7i.h |  41 
 include/configs/sunxi-common.h  | 154 
 6 files changed, 292 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
 create mode 100644 arch/arm/include/asm/arch-sunxi/spl.h
 create mode 100644 include/configs/sun7i.h
 create mode 100644 include/configs/sunxi-common.h

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 0467d00..71c233c 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -12,7 +12,7 @@ obj-y += cache_v7.o
 obj-y  += cpu.o
 obj-y  += syslib.o
 
-ifneq 
($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY),)
+ifneq 
($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),)
 ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
 obj-y  += lowlevel_init.o
 endif
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds 
b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
new file mode 100644
index 000..cf02300
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
@@ -0,0 +1,59 @@
+OUTPUT_FORMAT(elf32-littlearm, elf32-littlearm, elf32-littlearm)
+OUTPUT_ARCH(arm)
+ENTRY(s_init)
+SECTIONS
+{
+ . = 0x2000;
+ . = ALIGN(4);
+ .text :
+ {
+  *(.text.s_init)
+  *(.text*)
+ }
+ . = ALIGN(4);
+ .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+ . = ALIGN(4);
+ .data : {
+  *(.data*)
+ }
+ . = ALIGN(4);
+ . = .;
+ . = ALIGN(4);
+ .rel.dyn : {
+  __rel_dyn_start = .;
+  *(.rel*)
+  __rel_dyn_end = .;
+ }
+ .dynsym : {
+  __dynsym_start = .;
+  *(.dynsym)
+ }
+ . = ALIGN(4);
+ .note.gnu.build-id :
+ {
+   *(.note.gnu.build-id)
+ }
+ _end = .;
+ . = ALIGN(4096);
+ .mmutable : {
+  *(.mmutable)
+ }
+ .bss_start __rel_dyn_start (OVERLAY) : {
+  KEEP(*(.__bss_start));
+  __bss_base = .;
+ }
+ .bss __bss_base (OVERLAY) : {
+  *(.bss*)
+   . = ALIGN(4);
+   __bss_limit = .;
+ }
+ .bss_end __bss_limit (OVERLAY) : {
+  KEEP(*(.__bss_end));
+ }
+ /DISCARD/ : { *(.dynstr*) }
+ /DISCARD/ : { *(.dynamic*) }
+ /DISCARD/ : { *(.plt*) }
+ /DISCARD/ : { *(.interp*) }
+ /DISCARD/ : { *(.gnu*) }
+ /DISCARD/ : { *(.note*) }
+}
diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
b/arch/arm/include/asm/arch-sunxi/spl.h
new file mode 100644
index 000..6a47d14
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/spl.h
@@ -0,0 +1,36 @@
+/*
+ * This is a copy of omap3/spl.h:
+ *
+ * (C) Copyright 2012
+ * Texas Instruments, www.ti.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef_ASM_ARCH_SPL_H_
+#define_ASM_SPL_H_
+
+#define BOOT_DEVICE_NONE   0
+#define BOOT_DEVICE_XIP1
+#define 

[U-Boot] [PATCH v1 4/9] sunxi: initial generic sun7i cpu, board and start of day support

2014-03-14 Thread Ian Campbell
Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
ldscripts vs v2014.01.

This has been stripped back for mainlining and supports only sun7i. These
changes are not useful by themselves but are split out to make the patch sizes
more manageable.

As well as the following signed-off-by the sunxi branch shows commits to these
files authored by the following:
  Almo Nito
  Carl van Schaik
  FUKAUMI Naoki
  hehopmajieh
  j
  Sergey Lapin
  Tom Cubie

Signed-off-by: Aleksei Mamlin mamli...@gmail.com
Signed-off-by: Alexandru Gagniuc mr.nuke...@gmail.com
Signed-off-by: Chen-Yu Tsai w...@csie.org
Signed-off-by: Emilio López emi...@elopez.com.ar
Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Ian Campbell i...@hellion.org.uk
Signed-off-by: Jens Kuske jensku...@gmail.com
Signed-off-by: Luc Verhaegen l...@skynet.be
Signed-off-by: Luke Leighton l...@lkcl.net
Signed-off-by: Oliver Schinagl oli...@schinagl.nl
Signed-off-by: Patrick Wood patrickhw...@gmail.com
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Wills Wang wills.wang.o...@gmail.com
Signed-off-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/cpu/armv7/sunxi/Makefile |  11 +++
 arch/arm/cpu/armv7/sunxi/board.c  | 104 +
 arch/arm/cpu/armv7/sunxi/cpu_info.c   |  35 +
 arch/arm/cpu/armv7/sunxi/start.c  |   1 +
 arch/arm/include/asm/arch-sunxi/cpu.h | 138 ++
 board/sunxi/Makefile  |  28 +++
 board/sunxi/board.c   |  91 ++
 7 files changed, 408 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/board.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/cpu_info.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/start.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/cpu.h
 create mode 100644 board/sunxi/Makefile
 create mode 100644 board/sunxi/board.c

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile 
b/arch/arm/cpu/armv7/sunxi/Makefile
index 41d843f..3e8a36c 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -26,5 +26,16 @@
 
 obj-y  += timer.o
 obj-y  += dram.o
+obj-y  += board.o
 obj-y  += clock.o
 obj-y  += pinmux.o
+
+ifndef CONFIG_SPL_BUILD
+obj-y  += cpu_info.o
+endif
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_FEL
+obj-y  += start.o
+endif
+endif
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
new file mode 100644
index 000..98cad43
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -0,0 +1,104 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom hen...@henriknordstrom.net
+ *
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * Some init for sunxi platform.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include serial.h
+#ifdef CONFIG_SPL_BUILD
+#include spl.h
+#endif
+#include asm/gpio.h
+#include asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/gpio.h
+#include asm/arch/sys_proto.h
+#include asm/arch/timer.h
+
+#ifdef CONFIG_SPL_BUILD
+/* Pointer to the global data structure for SPL */
+DECLARE_GLOBAL_DATA_PTR;
+
+/* The sunxi internal brom will try to loader external bootloader
+ * from mmc0, nannd flash, mmc2.
+ * Unfortunately we can't check how SPL was loaded so assume
+ * it's always the first SD/MMC controller
+ */
+u32 spl_boot_device(void)
+{
+   return BOOT_DEVICE_MMC1;
+}
+
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(void)
+{
+   return MMCSD_MODE_RAW;
+}
+#endif
+
+int gpio_init(void)
+{
+   sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB22_UART0_TX);
+   sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB23_UART0_RX);
+   sunxi_gpio_set_pull(SUNXI_GPB(23), 1);
+
+   return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+}
+
+/* do some early init */
+void s_init(void)
+{
+#if !defined CONFIG_SPL_BUILD
+   /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
+   asm volatile(
+   mrc p15, 0, r0, c1, c0, 1\n
+   orr r0, r0, #0x40\n
+   mcr p15, 0, r0, c1, 

Re: [U-Boot] [PATCH 3/3] am335x, dfu: add DFU_MANIFEST_POLL_TIMEOUT to the siemens boards

2014-03-14 Thread Lukasz Majewski
Hi Heiko,

 as the siemens boards use dfu for updating a nand ubi partition
 add DFU_MANIFEST_POLL_TIMEOUT to them, so dfu host waits after
 complete transfer of the new image for DFU_MANIFEST_POLL_TIMEOUT
 ms before sending again an usb request. So the board have enough
 time to erase rest of the nand sectors.
 
 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Tom Rini tr...@ti.com
 ---
  include/configs/siemens-am33x-common.h | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/include/configs/siemens-am33x-common.h
 b/include/configs/siemens-am33x-common.h index 98b6e72..721c4e6 100644
 --- a/include/configs/siemens-am33x-common.h
 +++ b/include/configs/siemens-am33x-common.h
 @@ -265,6 +265,7 @@
  #define CONFIG_DFU_NAND
  #define CONFIG_CMD_DFU
  #define CONFIG_SYS_DFU_DATA_BUF_SIZE (1  20)
 +#define DFU_MANIFEST_POLL_TIMEOUT25000
  
  #endif /* CONFIG_SPL_BUILD */
  

Reviewed-by: Lukasz Majewski l.majew...@samsung.com

-- 
Best regards,

Lukasz Majewski

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


Re: [U-Boot] [PATCH 2/3] usb: dfu: introduce dfuMANIFEST state

2014-03-14 Thread Lukasz Majewski
Hi Heiko,

 on nand flash using ubi, after the download of the new image into
 the flash, the rest of the nand sectors get erased while flushing
 the medium. With current u-boot version dfu-util may show:
 
 Starting download:
 [##] finished!
 state(7) = dfuMANIFEST, status(0) = No error condition is present
 unable to read DFU status
 
 as get_status is not answered while erasing sectors, if erasing
 needs some time.
 
 So do the following changes to prevent this:
 
 - introduce dfuManifest state
   According to dfu specification
   ( http://www.usb.org/developers/devclass_docs/usbdfu10.pdf )
 section 7: the device enters the dfuMANIFEST-SYNC state and awaits
 the solicitation of the status report by the host. Upon receipt of
 the anticipated DFU_GETSTATUS, the device enters the dfuMANIFEST
 state, where it completes its reprogramming operations.
 
 - when stepping into dfuManifest state, sending a PollTimeout
   DFU_MANIFEST_POLL_TIMEOUT in ms, to the host, so the host
   (dfu-util) waits the PollTimeout before sending a get_status again.
 
 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 ---
  README |  5 
  drivers/dfu/dfu.c  |  1 -
  drivers/usb/gadget/f_dfu.c | 60
 +++---
 include/dfu.h  |  3 +++ 4 files changed, 59
 insertions(+), 10 deletions(-)
 
 diff --git a/README b/README
 index 216f0c7..5076248 100644
 --- a/README
 +++ b/README
 @@ -1525,6 +1525,11 @@ The following options need to be configured:
   this to the maximum filesize (in bytes) for the
 buffer. Default is 4 MiB if undefined.
  
 + DFU_MANIFEST_POLL_TIMEOUT
 + Poll timeout [ms], which the device sends to the
 host when
 + entering dfuMANIFEST state. Host waits this timeout,
 before
 + sending again an USB request to the device.
 +

Could you also add information about the DFU_DEFAULT_POLL_TIMEOUT to
the README, please (I've forgotten to do that)? 

  - Journaling Flash filesystem support:
   CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF,
 CONFIG_JFFS2_NAND_SIZE, CONFIG_JFFS2_NAND_DEV
 diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
 index 193e047..f61e166 100644
 --- a/drivers/dfu/dfu.c
 +++ b/drivers/dfu/dfu.c
 @@ -222,7 +222,6 @@ int dfu_write(struct dfu_entity *dfu, void *buf,
 int size, int blk_seq_num) ret = tret;
   }
  
 - ret = dfu_flush(dfu, buf, size, blk_seq_num);
   return ret = 0 ? size : ret;
  }
  
 diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
 index a045864..f4bf918 100644
 --- a/drivers/usb/gadget/f_dfu.c
 +++ b/drivers/usb/gadget/f_dfu.c
 @@ -164,15 +164,22 @@ static void dnload_request_complete(struct
 usb_ep *ep, struct usb_request *req) 
   dfu_write(dfu_get_entity(f_dfu-altsetting), req-buf,
 req-length, f_dfu-blk_seq_num);
 +}
  
 - if (req-length == 0)
 - puts(DOWNLOAD ... OK\nCtrl+C to exit ...\n);
 +static void dnload_request_flush(struct usb_ep *ep, struct
 usb_request *req) +{
 + struct f_dfu *f_dfu = req-context;
 +
 + req-length = 0;
 + dfu_flush(dfu_get_entity(f_dfu-altsetting), req-buf,
 +   req-length, f_dfu-blk_seq_num);
  }
  
  static void handle_getstatus(struct usb_request *req)
  {
   struct dfu_status *dstat = (struct dfu_status *)req-buf;
   struct f_dfu *f_dfu = req-context;
 + int setpolltimeout = 1;

We can go away with this flag. Please see below.

  
   switch (f_dfu-dfu_state) {
   case DFU_STATE_dfuDNLOAD_SYNC:
 @@ -180,17 +187,24 @@ static void handle_getstatus(struct usb_request
 *req) f_dfu-dfu_state = DFU_STATE_dfuDNLOAD_IDLE;
   break;
   case DFU_STATE_dfuMANIFEST_SYNC:
 + f_dfu-dfu_state = DFU_STATE_dfuMANIFEST;
   break;
 + case DFU_STATE_dfuMANIFEST:
 + dfu_set_poll_timeout(dstat,
 DFU_MANIFEST_POLL_TIMEOUT);
 + setpolltimeout = 0;
   default:
   break;
   }
  
 - dfu_set_poll_timeout(dstat, 0);
 + if (setpolltimeout) {
 + dfu_set_poll_timeout(dstat, 0);
  
 - if (f_dfu-poll_timeout)
 - if (!(f_dfu-blk_seq_num %
 -   (dfu_get_buf_size() / DFU_USB_BUFSIZ)))
 - dfu_set_poll_timeout(dstat,
 f_dfu-poll_timeout);
 + if (f_dfu-poll_timeout)
 + if (!(f_dfu-blk_seq_num %
 +   (dfu_get_buf_size() / DFU_USB_BUFSIZ)))
 + dfu_set_poll_timeout(dstat,
 +
 f_dfu-poll_timeout);
 + }

What about this solution:

dfu_set_poll_timeout(dstat, 0);

switch (f_dfu-dfu_state) {
case DFU_STATE_dfuDNLOAD_SYNC:
case DFU_STATE_dfuDNBUSY:
f_dfu-dfu_state = DFU_STATE_dfuDNLOAD_IDLE;

[U-Boot] [PATCH 2/2] board/t208xrdb: Add support of 2-stage NAND bootloader

2014-03-14 Thread Shengzhou Liu
Add support of 2-stage NAND boot loader using SPL framework on T2080RDB.
PBL initialise the internal SRAM and copy SPL(96K), this further
initialise DDR using SPD and environment and copy u-boot from NAND
to DDR, finally SPL transfer control to u-boot.

Signed-off-by: Shengzhou Liu shengzhou@freescale.com
---
 board/freescale/t208xrdb/Makefile |  5 +++
 board/freescale/t208xrdb/README   |  8 ++--
 board/freescale/t208xrdb/ddr.c|  7 ++-
 board/freescale/t208xrdb/spl.c| 93 +++
 board/freescale/t208xrdb/tlb.c|  4 +-
 boards.cfg|  2 +-
 include/configs/T208xRDB.h| 58 +---
 7 files changed, 164 insertions(+), 13 deletions(-)
 create mode 100644 board/freescale/t208xrdb/spl.c

diff --git a/board/freescale/t208xrdb/Makefile 
b/board/freescale/t208xrdb/Makefile
index 092c9ff..9605f8b 100644
--- a/board/freescale/t208xrdb/Makefile
+++ b/board/freescale/t208xrdb/Makefile
@@ -4,10 +4,15 @@
 # SPDX-License-Identifier:  GPL-2.0+
 #
 
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
 obj-$(CONFIG_T2080RDB) += t208xrdb.o
 obj-$(CONFIG_T2080RDB) += eth_t208xrdb.o
 obj-$(CONFIG_T2080RDB) += cpld.o
 obj-$(CONFIG_PCI)  += pci.o
+endif
+
 obj-y   += ddr.o
 obj-y   += law.o
 obj-y   += tlb.o
diff --git a/board/freescale/t208xrdb/README b/board/freescale/t208xrdb/README
index 0012c6c..dfa73ae 100644
--- a/board/freescale/t208xrdb/README
+++ b/board/freescale/t208xrdb/README
@@ -164,10 +164,10 @@ Software configurations and board settings
 2. NAND Boot:
a. build PBL image for NAND boot
$ make T2080RDB_NAND_config
-   $ make u-boot.pbl
-   b. program u-boot.pbl to NAND flash
-   = tftp 100 u-boot.pbl
-   = nand erase 0 d
+   $ make u-boot-with-spl-pbl.bin
+   b. program u-boot-with-spl-pbl.bin to NAND flash
+   = tftp 100 u-boot-with-spl-pbl.bin
+   = nand erase 0 c
= nand write 100 0 $filesize
set SW1[1:8] = '1010', SW2[1] = '1', SW3[4] = '1' for NAND boot
 
diff --git a/board/freescale/t208xrdb/ddr.c b/board/freescale/t208xrdb/ddr.c
index 01e9173..18c9abd 100644
--- a/board/freescale/t208xrdb/ddr.c
+++ b/board/freescale/t208xrdb/ddr.c
@@ -102,11 +102,14 @@ phys_size_t initdram(int board_type)
 
puts(Initializingusing SPD\n);
 
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
dram_size = fsl_ddr_sdram();
 
dram_size = setup_ddr_tlbs(dram_size / 0x10);
dram_size *= 0x10;
-
-   puts(DDR: );
+#else
+   puts(DDR has been initialised by first stage boot loader\n);
+   dram_size =  0x8000;
+#endif
return dram_size;
 }
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c
new file mode 100644
index 000..648481c
--- /dev/null
+++ b/board/freescale/t208xrdb/spl.c
@@ -0,0 +1,93 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include asm/spl.h
+#include malloc.h
+#include ns16550.h
+#include nand.h
+#include i2c.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+phys_size_t get_effective_memsize(void)
+{
+   return CONFIG_SYS_L3_SIZE;
+}
+
+unsigned long get_board_sys_clk(void)
+{
+   return CONFIG_SYS_CLK_FREQ;
+}
+
+unsigned long get_board_ddr_clk(void)
+{
+   return CONFIG_DDR_CLK_FREQ;
+}
+
+void board_init_f(ulong bootflag)
+{
+   u32 plat_ratio, sys_clk, ccb_clk;
+   ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+   /* Memcpy existing GD at CONFIG_SPL_GD_ADDR */
+   memcpy((void *)CONFIG_SPL_GD_ADDR, (void *)gd, sizeof(gd_t));
+
+   /* Update GD pointer */
+   gd = (gd_t *)(CONFIG_SPL_GD_ADDR);
+   __asm__ __volatile__( : : : memory);
+
+   console_init_f();
+
+   /* initialize selected port with appropriate baud rate */
+   sys_clk = get_board_sys_clk();
+   plat_ratio = (in_be32(gur-rcwsr[0])  25)  0x1f;
+   ccb_clk = sys_clk * plat_ratio / 2;
+
+   NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+ccb_clk / 16 / CONFIG_BAUDRATE);
+
+   relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+   bd_t *bd;
+
+   bd = (bd_t *)(gd + sizeof(gd_t));
+   memset(bd, 0, sizeof(bd_t));
+   gd-bd = bd;
+   bd-bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
+   bd-bi_memsize = CONFIG_SYS_L3_SIZE;
+
+   probecpu();
+   get_clocks();
+   mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+   CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+#ifndef CONFIG_SPL_NAND_BOOT
+   env_init();
+#endif
+
+   /* relocate environment function pointers etc. */
+#ifdef CONFIG_SPL_NAND_BOOT
+   nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+   (uchar *)CONFIG_ENV_ADDR);
+   gd-env_addr  = (ulong)(CONFIG_ENV_ADDR);
+   gd-env_valid = 1;
+#else
+   

Re: [U-Boot] [linux-sunxi] [PATCH v1 9/9] sunxi: add gmac Ethernet support

2014-03-14 Thread Ian Campbell
On Fri, 2014-03-14 at 19:11 +0800, Chen-Yu Tsai wrote:
 Thanks for working on this!

No problem.

 I see you left out all the CONFIG_RGMII ifdefs from this file. Not
 sure if it's because you're aiming to support only the Cubietruck
 first.

Yes, exactly.

 I think you should keep them in the same patch. You can then
 just add the appropriate config options when support of other A20
 boards roll in.

I don't have any boards which require this, so I cannot test it. I'd
prefer to leave it to whoever adds support for the first such board to
put this stuff back in, it's a pretty trivial git diff invocation to
spot the needed bits.

 There are 3 changes to the designware driver since u-boot-sunxi's
 last merge (2014.1-rc1):
 
 50b0df8 net/designware: make driver compatible with data cache
 92a190a net/designware - switch driver to phylib usage
 74cb708 net/designware: add explicit reset of {tx|rx}_currdescnum
 
 The move to phylib will likely break the current code. Maybe we could
 merge 2014.4-rc1 in to fix it first.

I'm happy to track any merges updates etc, sounds like at least this
patch will need some rebasing. Since this one is last I think it needn't
stop the rest going in (although I anticipate at least some review and
rebasing for all of it).

 Also, GMAC support depends on
 
 5a51af3 net/designware: Reduce DMA burst length
 
 by Jens Kuske (jemk). Neither of us bothered to send this upstream yet.

I think I saw that in the sunxi tree but since it touched core code I
punted on it for now since I wasn't sure how to reconcile it with
non-sunxi platforms (i.e. what is the downside for other boards? Worse
performance?)

Thanks for your feedback.

Ian.

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:

 Hi,
 
 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
 intention is to present a minimal starting point for upstreaming to
 which support for other processors, peripherals, boards etc can be
 added in the future. Therefore this has been stripped right back and
 currently supports only sun7i processors and the cubietruck
 board. Supported peripherals are UART, MMC and Ethernet.

First of all, yay.  Second, how hard would it be to add sun5i /
a13-olinuxino-micro support on top of this?  I ask since I've got one of
those sitting around here.  Would we be talking just board level things
or is sun5i vs sun7i a big deal?  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 v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Albert ARIBAUD
Hi Ian,

On Fri, 14 Mar 2014 10:33:32 +, Ian Campbell i...@hellion.org.uk
wrote:

 Hi,
 
 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
 intention is to present a minimal starting point for upstreaming to
 which support for other processors, peripherals, boards etc can be
 added in the future. Therefore this has been stripped right back and
 currently supports only sun7i processors and the cubietruck
 board. Supported peripherals are UART, MMC and Ethernet.

I am not familiar with all of AllWinner's CPUs, so please forgive me if
I'm saying something stupid. Does sun7i support mean that A31 might be
supported as well? From what I understand, UART and Eth should be
somewhat common between A20 and A31, but MMC won't.

In any case, I am willing to try and add Mele A1000G U-Boot support
based on your series if that makes any sense. :)

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Maxime Ripard
Hi Albert,

On Fri, Mar 14, 2014 at 02:02:29PM +0100, Albert ARIBAUD wrote:
 Hi Ian,
 
 On Fri, 14 Mar 2014 10:33:32 +, Ian Campbell i...@hellion.org.uk
 wrote:
 
  Hi,
  
  This is my first cut at an upstreamable series based upon the
  https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
  intention is to present a minimal starting point for upstreaming to
  which support for other processors, peripherals, boards etc can be
  added in the future. Therefore this has been stripped right back and
  currently supports only sun7i processors and the cubietruck
  board. Supported peripherals are UART, MMC and Ethernet.
 
 I am not familiar with all of AllWinner's CPUs, so please forgive me if
 I'm saying something stupid. Does sun7i support mean that A31 might be
 supported as well? From what I understand, UART and Eth should be
 somewhat common between A20 and A31, but MMC won't.
 
 In any case, I am willing to try and add Mele A1000G U-Boot support
 based on your series if that makes any sense. :)

Actually, between A20 and A31, a lot are common, but some IPs that are
of particular interest to u-boot aren't.

Most notably, the A20 and A31 share the same CPUs, interrupt
controller (GIC), timers (that are also shared with all the other
Allwinner SoCs), UART (designware's), ethernet (designware's GMAC
IP). MMC should be common too.

However, the A31 introduces a new RAM controller, a new DMA
controller, a new bus to interact with the PMIC, most notably.

So while we will be able to reuse some of that code, the A31 needs a
significant additional effort. The good news is that the newer
Allwinner SoCs seem to drop the old (and by old I mean
A10/A10s/A13/A20) IPs in favour of the one introduced in the A31. So
it's definitely worth doing this effort.

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


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 v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Ian Campbell
On Fri, 2014-03-14 at 08:55 -0400, Tom Rini wrote:
 On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:
 
  Hi,
  
  This is my first cut at an upstreamable series based upon the
  https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
  intention is to present a minimal starting point for upstreaming to
  which support for other processors, peripherals, boards etc can be
  added in the future. Therefore this has been stripped right back and
  currently supports only sun7i processors and the cubietruck
  board. Supported peripherals are UART, MMC and Ethernet.
 
 First of all, yay.  Second, how hard would it be to add sun5i /
 a13-olinuxino-micro support on top of this?  I ask since I've got one of
 those sitting around here.  Would we be talking just board level things
 or is sun5i vs sun7i a big deal?  Thanks!
 

I think it would be pretty small, if you fetch my tree and git diff it
against the sunxi.git tree the diff bits with sun5i in them stand out
reasonably clearly.

I don't have such a platform myself though which is why I've not just
done it.

Ian.


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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Ian Campbell
On Fri, 2014-03-14 at 14:02 +0100, Albert ARIBAUD wrote:
 Hi Ian,
 
 On Fri, 14 Mar 2014 10:33:32 +, Ian Campbell i...@hellion.org.uk
 wrote:
 
  Hi,
  
  This is my first cut at an upstreamable series based upon the
  https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
  intention is to present a minimal starting point for upstreaming to
  which support for other processors, peripherals, boards etc can be
  added in the future. Therefore this has been stripped right back and
  currently supports only sun7i processors and the cubietruck
  board. Supported peripherals are UART, MMC and Ethernet.
 
 I am not familiar with all of AllWinner's CPUs, so please forgive me if
 I'm saying something stupid.

I probably should have included some context here anyway, since I guess
a lot of folks aren't familiar with Allwinner/sunxi.

 Does sun7i support mean that A31 might be
 supported as well?

sun7i == A20 processors while A31 is sun6i (yes, this seems somewhat
backwards to me as well), so there is no A31 support present in this
series. As Maxime says sun6i shares some but not all stuff with sun7i
and the bits which aren't still require work (which I believe people are
doing).

Ian.

  From what I understand, UART and Eth should be
 somewhat common between A20 and A31, but MMC won't.
 
 In any case, I am willing to try and add Mele A1000G U-Boot support
 based on your series if that makes any sense. :)
 
 Amicalement,


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


[U-Boot] Relocation

2014-03-14 Thread mahsmak
Hi,

Can anyone please explain how relocation address is calculated in uboot ? 

Also, I want to know whether relocation will happen or not when uboot is
running from RAM already? If yes, then can it be disabled ?

Thank you,



--
View this message in context: 
http://u-boot.10912.n7.nabble.com/Relocation-tp175974.html
Sent from the U-Boot mailing list archive at Nabble.com.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] [PATCH v1 9/9] sunxi: add gmac Ethernet support

2014-03-14 Thread Chen-Yu Tsai
On Fri, Mar 14, 2014 at 6:33 PM, Ian Campbell i...@hellion.org.uk wrote:
 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.

 Signed-off-by: Chen-Yu Tsai w...@csie.org
 Signed-off-by: Jens Kuske jensku...@gmail.com
 Signed-off-by: Ian Campbell i...@hellion.org.uk
 ---
  arch/arm/cpu/armv7/sunxi/board.c | 15 +
  boards.cfg   |  4 +--
  drivers/net/Makefile |  1 +
  drivers/net/sunxi_gmac.c | 34 
  include/configs/sunxi-common.h   | 68 
 
  5 files changed, 120 insertions(+), 2 deletions(-)
  create mode 100644 drivers/net/sunxi_gmac.c
[..]
 diff --git a/drivers/net/sunxi_gmac.c b/drivers/net/sunxi_gmac.c
 new file mode 100644
 index 000..432d7b2
 --- /dev/null
 +++ b/drivers/net/sunxi_gmac.c
 @@ -0,0 +1,34 @@
 +#include common.h
 +#include netdev.h
 +#include miiphy.h
 +#include asm/gpio.h
 +#include asm/io.h
 +#include asm/arch/clock.h
 +#include asm/arch/gpio.h
 +
 +int sunxi_gmac_initialize(bd_t *bis)
 +{
 +   int pin;
 +   struct sunxi_ccm_reg *const ccm =
 +   (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 +
 +   /* Set up clock gating */
 +   setbits_le32(ccm-ahb_gate1, 0x1  AHB_GATE_OFFSET_GMAC);
 +
 +   /* Set MII clock */
 +   setbits_le32(ccm-gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
 +   CCM_GMAC_CTRL_GPIT_RGMII);
 +
 +   /* Configure pin mux settings for GMAC */
 +   for (pin = SUNXI_GPA(0); pin = SUNXI_GPA(16); pin++) {
 +   /* skip unused pins in RGMII mode */
 +   if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
 +   continue;
 +   sunxi_gpio_set_cfgpin(pin, 5);
 +   sunxi_gpio_set_drv(pin, 3);
 +   }
 +
 +   designware_initialize(0, SUNXI_GMAC_BASE, 0x1, 
 PHY_INTERFACE_MODE_RGMII);

Hi,

Thanks for working on this!

I see you left out all the CONFIG_RGMII ifdefs from this file. Not
sure if it's because you're aiming to support only the Cubietruck
first. I think you should keep them in the same patch. You can then
just add the appropriate config options when support of other A20
boards roll in.

There are 3 changes to the designware driver since u-boot-sunxi's
last merge (2014.1-rc1):

50b0df8 net/designware: make driver compatible with data cache
92a190a net/designware - switch driver to phylib usage
74cb708 net/designware: add explicit reset of {tx|rx}_currdescnum

The move to phylib will likely break the current code. Maybe we could
merge 2014.4-rc1 in to fix it first.

Also, GMAC support depends on

5a51af3 net/designware: Reduce DMA burst length

by Jens Kuske (jemk). Neither of us bothered to send this upstream yet.

Cheers
ChenYu


 +
 +   return 0;
 +}
[..]
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:

 Hi,
 
 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
 intention is to present a minimal starting point for upstreaming to
 which support for other processors, peripherals, boards etc can be
 added in the future. Therefore this has been stripped right back and
 currently supports only sun7i processors and the cubietruck
 board. Supported peripherals are UART, MMC and Ethernet.

Some global comments:
- If you haven't already, make sure it's all checkpatch clean.
- Use the SPDX tags rather than including the GPL boilerplate.
- Please re-word the commit messages.  The how we got here / where this
  is from is fine for the cover letter.
- Magic numbers need to be defined.

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 v1 2/9] sunxi: initial sun7i pinmux and gpio support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:44AM +, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
 
 This has been stripped back for mainlining and supports only sun7i. These
 changes are not useful by themselves but are split out to make the patch sizes
 more manageable.
 
 As well as the following signed-off-by the sunxi branch shows commits to these
 files authored by the following:
   Carl van Schaik
   Henrik Nordstrom
   Stefan Roese
   Tom Cubie
 
 Signed-off-by: Chen-Yu Tsai w...@csie.org
 Signed-off-by: Hans de Goede hdego...@redhat.com
 Signed-off-by: Ma Haijun mahaij...@gmail.com
 Signed-off-by: Oliver Schinagl oli...@schinagl.nl
 Signed-off-by: Ian Campbell i...@hellion.org.uk

Aside from the global comments:

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

-- 
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 v1 1/9] sunxi: initial sun7i clocks and timer support.

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:43AM +, Ian Campbell wrote:

[snip]
 + writel(0xa1005000, ccm-pll1_cfg);
 + sdelay(200);
 + writel(AXI_DIV_1  0 | AHB_DIV_2  4 | APB0_DIV_1  8 |
 +CPU_CLK_SRC_PLL1  16, ccm-cpu_ahb_apb0_cfg);
 + writel(0x1  6 | readl(ccm-ahb_gate0), ccm-ahb_gate0);
 + writel(0x1  31 | readl(ccm-pll6_cfg), ccm-pll6_cfg);

All magic bits and shifts need defining.

 +/*
 + * This function is derived from PowerPC code (timebase clock frequency).
 + * On ARM it returns the number of timer ticks per second.
 + */
 +ulong get_tbclk(void)
 +{
 + ulong tbclk;
 + tbclk = CONFIG_SYS_HZ;
 + return tbclk;
 +}

So, just return CONFIG_SYS_HZ ?

-- 
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 v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:45AM +, Ian Campbell wrote:

[snip]
 +static void mctl_ddr3_reset(void)
 +{
 + struct sunxi_dram_reg *dram =
 + (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
 +
 + {
 + clrbits_le32(dram-mcr, DRAM_MCR_RESET);
 + udelay(2);
 + setbits_le32(dram-mcr, DRAM_MCR_RESET);
 + }

That seems like an odd construction, why the extra braces?

And as for the rest of the code, lots of magic numbers to #define
what/why (why udelay(2) and 22?)

-- 
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 v1 6/9] sunxi: add support for Cubietruck booting in FEL mode

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:48AM +, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
 
 Signed-off-by: Oliver Schinagl oli...@schinagl.nl
 Signed-off-by: Ian Campbell i...@hellion.org.uk

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

-- 
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 v1 7/9] sunxi: mmc support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:49AM +, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
 
 As well as the following signed-off-by the sunxi branch shows commits to these
 files authored by the following:
   Stefan Roese
   Tom Cubie
   yemao
 
 Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
 Signed-off-by: Luke Leighton l...@lkcl.net
 Signed-off-by: Oliver Schinagl oli...@schinagl.nl
 Signed-off-by: Wills Wang wills.wang.o...@gmail.com
 Signed-off-by: Ian Campbell i...@hellion.org.uk

Just the general problems.  Pantelis?

-- 
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 v1 9/9] sunxi: add gmac Ethernet support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:51AM +, Ian Campbell wrote:

[snip]
 +#ifdef CONFIG_SUNXI_GMAC
 +#define CONFIG_DESIGNWARE_ETH/* GMAC can use designware 
 driver */
 +#define CONFIG_DW_AUTONEG
 +#define CONFIG_PHY_GIGE  /* GMAC can use gigabit PHY 
 */
 +#define CONFIG_SYS_DCACHE_OFF/* dw driver doesn't support 
 dcache */

I think that was fixed recently..

 +
 +#ifdef CONFIG_CMD_NET
 +#define CONFIG_CMD_PING
 +#define CONFIG_CMD_DHCP
 +#define CONFIG_CMD_NFS
 +#define CONFIG_CMD_SNTP
 +#define CONFIG_TIMESTAMP /* Needed by SNTP */
 +#define CONFIG_CMD_DNS
 +#define CONFIG_NETCONSOLE
 +#define CONFIG_BOOTP_SUBNETMASK
 +#define CONFIG_BOOTP_GATEWAY
 +#define CONFIG_BOOTP_HOSTNAME
 +#define CONFIG_BOOTP_NISDOMAIN
 +#define CONFIG_BOOTP_BOOTPATH
 +#define CONFIG_BOOTP_BOOTFILESIZE
 +#define CONFIG_BOOTP_DNS
 +#define CONFIG_BOOTP_DNS2
 +#define CONFIG_BOOTP_SEND_HOSTNAME
 +#define CONFIG_BOOTP_NTPSERVER
 +#define CONFIG_BOOTP_TIMEOFFSET
 +#define CONFIG_BOOTP_MAY_FAIL
 +#define CONFIG_BOOTP_SERVERIP
 +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY  5
 +#define CONFIG_CMD_ELF
 +#endif

We end up duplicating this in the next part of the hunk.

-- 
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 v1 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:50AM +, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
[snip]
 +/* Flat Device Tree (FDT/DT) support */
 +#define CONFIG_OF_LIBFDT
 +#define CONFIG_SYS_BOOTMAPSZ (16  20)

This seems pretty small.  This is to keep things from being relocated
into highmem right?

-- 
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 v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 01:59:38PM +, Ian Campbell wrote:
 On Fri, 2014-03-14 at 08:55 -0400, Tom Rini wrote:
  On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:
  
   Hi,
   
   This is my first cut at an upstreamable series based upon the
   https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
   intention is to present a minimal starting point for upstreaming to
   which support for other processors, peripherals, boards etc can be
   added in the future. Therefore this has been stripped right back and
   currently supports only sun7i processors and the cubietruck
   board. Supported peripherals are UART, MMC and Ethernet.
  
  First of all, yay.  Second, how hard would it be to add sun5i /
  a13-olinuxino-micro support on top of this?  I ask since I've got one of
  those sitting around here.  Would we be talking just board level things
  or is sun5i vs sun7i a big deal?  Thanks!
 
 I think it would be pretty small, if you fetch my tree and git diff it
 against the sunxi.git tree the diff bits with sun5i in them stand out
 reasonably clearly.
 
 I don't have such a platform myself though which is why I've not just
 done it.

OK good, I think Albert and I might end up starting the sun4i/sun5i
stuff as those are the boards we've got sitting around.

-- 
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 v1 5/9] sunxi: generic sun7i build infrastructure.

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:47AM +, Ian Campbell wrote:

[snip]
 +#define CONFIG_SUN7I /* sun7i SoC generation */
[snip]
 +#define CONFIG_ALLWINNER /* It's a Allwinner chip */
 +#define CONFIG_SUNXI /* which is sunxi family */

Please make sure we end up using all 3 of these.  I know I spotted a
CONFIG_SUNXI in use, but I don't know about ALLWINNER or SUN7I.

 +/*
 + * Size of malloc() pool
 + * 1MB = 0x10, 0x10 = 1024 * 1024
 + */
 +#define CONFIG_SYS_MALLOC_LEN(CONFIG_ENV_SIZE + (1  20))

This is really really small, and precludes using UBI on NAND for
example.

 +#define CONFIG_SYS_PROMPT_HUSH_PS2

Not needed.

 +/* memtest works on */
 +#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
 +#define CONFIG_SYS_MEMTEST_END   (CONFIG_SYS_SDRAM_BASE + (256 
  20))

Please see doc/README.memory-test

 +#define CONFIG_SYS_BAUDRATE_TABLE{ 9600, 19200, 38400, 57600, 115200 }

Please use the default table.

-- 
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 v1 4/9] sunxi: initial generic sun7i cpu, board and start of day support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 10:33:46AM +, Ian Campbell wrote:

[snip]
 +/* The sunxi internal brom will try to loader external bootloader
 + * from mmc0, nannd flash, mmc2.

Typo.

 +#ifdef CONFIG_SPL_BUILD
 +void sunxi_board_init(void)
 +{
 + int power_failed = 0;
 + unsigned long ramsize;
 +
 + printf(DRAM:);
 + ramsize = sunxi_dram_init();
 + if (!ramsize) {
 + printf( ?);
 + ramsize = sunxi_dram_init();
 + }
 + if (!ramsize) {
 + printf( ?);
 + ramsize = sunxi_dram_init();
 + }

We have to try 3 times?  What?

 + /*
 +  * Only clock up the CPU to full speed if we are reasonably
 +  * assured it's being powered with suitable core voltage
 +  */
 + if (!power_failed)
 + clock_set_pll1(91200);

Define that please.

-- 
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] [linux-sunxi] [PATCH v1 9/9] sunxi: add gmac Ethernet support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 11:28:06AM +, Ian Campbell wrote:
 On Fri, 2014-03-14 at 19:11 +0800, Chen-Yu Tsai wrote:
[snip]
  I think you should keep them in the same patch. You can then
  just add the appropriate config options when support of other A20
  boards roll in.
 
 I don't have any boards which require this, so I cannot test it. I'd
 prefer to leave it to whoever adds support for the first such board to
 put this stuff back in, it's a pretty trivial git diff invocation to
 spot the needed bits.

I agree with this as well.

-- 
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 v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Marek Vasut
On Friday, March 14, 2014 at 11:33:32 AM, Ian Campbell wrote:
 Hi,
 
 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
 intention is to present a minimal starting point for upstreaming to
 which support for other processors, peripherals, boards etc can be
 added in the future. Therefore this has been stripped right back and
 currently supports only sun7i processors and the cubietruck
 board. Supported peripherals are UART, MMC and Ethernet.
 
 The code here is from sunxi.git#sunxi[0] changeset d854c4de2f57 arm:
 Handle .gnu.hash section in ldscripts and applied to u-boot v2014.01.
 
 This series can also be found at:
 
 git://gitorious.org/ijc/u-boot.git sunxi-mainlining-v1

Nice, finally!

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


[U-Boot] [PATCH v3 3/3] cmd:gpt: randomly generate each partition uuid if undefined

2014-03-14 Thread Przemyslaw Marczak
Changes:
- randomly generate partition uuid if any is undefined
- print info about set/unset/generated uuid
- update doc/README.gpt

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Jason Hobbs jason.ho...@calxeda.com
Cc: Stephen Warren swar...@nvidia.com
Cc: Lukasz Majewski l.majew...@samsung.com

---
Changes v2:
- cmd_gpt: extract_env: change return type from char to int
- add tmp array to generate uuid string
- store generated uuid in env and next get it from it - don't need to alloc
  and maintain allcoated memory outside extract_env()

Changes v3:
- print info if uuid_gpt_* env is get from env/set random
- change some word in README.gpt to meaningful
---
 common/cmd_gpt.c | 36 +---
 doc/README.gpt   |  1 +
 include/common.h |  3 ++-
 lib/Makefile |  1 +
 4 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index 1f12e6d..31a3fe1 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -29,9 +29,11 @@
  *
  * @return - zero on successful expand and env is set
  */
-static char extract_env(const char *str, char **env)
+static int extract_env(const char *str, char **env)
 {
+   int ret = -1;
char *e, *s;
+   char uuid_str[37];
 
if (!str || strlen(str)  4)
return -1;
@@ -43,16 +45,28 @@ static char extract_env(const char *str, char **env)
memset(s + strlen(s) - 1, '\0', 1);
memmove(s, s + 2, strlen(s) - 1);
e = getenv(s);
-   free(s);
if (e == NULL) {
-   printf(Environmental '%s' not set\n, str);
-   return -1; /* env not set */
+   printf(%s , str);
+   gen_rand_uuid_str(uuid_str);
+   setenv(s, uuid_str);
+
+   e = getenv(s);
+   if (e) {
+   puts(set to random.\n);
+   ret = 0;
+   } else {
+   puts(unset - can't get random UUID.\n);
+   }
+   } else {
+   printf(%s get from environment.\n, str);
+   ret = 0;
}
+
*env = e;
-   return 0;
+   free(s);
}
 
-   return -1;
+   return ret;
 }
 
 /**
@@ -299,8 +313,16 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
return CMD_RET_FAILURE;
}
 
-   if (gpt_default(blk_dev_desc, argv[4]))
+   puts(Writing GPT:\n);
+
+   ret = gpt_default(blk_dev_desc, argv[4]);
+   if (!ret) {
+   puts(success!\n);
+   return CMD_RET_SUCCESS;
+   } else {
+   puts(error!\n);
return CMD_RET_FAILURE;
+   }
} else {
return CMD_RET_USAGE;
}
diff --git a/doc/README.gpt b/doc/README.gpt
index 5c133f3..9d0a8df 100644
--- a/doc/README.gpt
+++ b/doc/README.gpt
@@ -176,3 +176,4 @@ Please, pay attention at -l switch for parted.
 uuid program is recommended to generate UUID string. Moreover it can decode
 (-d switch) passed in UUID string. It can be used to generate partitions UUID
 passed to u-boot environment variables.
+If any partition uuid no exists then it will be randomly generated.
diff --git a/include/common.h b/include/common.h
index 20e9ae6..665c98f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -834,7 +834,8 @@ char *  strmhz(char *buf, unsigned long hz);
 #if defined(CONFIG_RANDOM_MACADDR) || \
defined(CONFIG_BOOTP_RANDOM_DELAY) || \
defined(CONFIG_CMD_LINK_LOCAL) || \
-   defined(CONFIG_RANDOM_UUID)
+   defined(CONFIG_RANDOM_UUID) || \
+   defined(CONFIG_PARTITION_UUIDS)
 #define RAND_MAX -1U
 void srand(unsigned int seed);
 unsigned int rand(void);
diff --git a/lib/Makefile b/lib/Makefile
index fc7a24a..f4c06c6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -66,6 +66,7 @@ obj-$(CONFIG_PARTITION_UUIDS) += rand.o
 obj-y += vsprintf.o
 obj-$(CONFIG_RANDOM_UUID) += uuid.o
 obj-$(CONFIG_RANDOM_UUID) += rand.o
+obj-$(CONFIG_PARTITION_UUIDS) += rand.o
 obj-$(CONFIG_RANDOM_MACADDR) += rand.o
 obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
 obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
-- 
1.9.0

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


[U-Boot] [PATCH v3 1/3] part_efi: move uuid-string conversion functions into lib/uuid.c

2014-03-14 Thread Przemyslaw Marczak
Changes:
- move uuid-string conversion functions into lib/uuid.c so they can be
  used by code outside part_efi.c.
- rename uuid_string() to uuid_bin_to_str() for consistency with existing
  uuid_str_to_bin()
- add an error return code to uuid_str_to_bin()

Update existing code to the new library functions.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Cc: Jason Hobbs jason.ho...@calxeda.com
Cc: Stephen Warren swar...@nvidia.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: tr...@ti.com

---
Changes v2:
- This commit is new after separate:
  [PATCH 1/2] lib: uuid: add function to generate UUID version 4
- it introduces small refactor of common lib uuid functions

Changes v3:
- reword commit message
- add UUID_STR_LEN definition in lib/uuid.c
- remove unused string pointer from uuid_bin_to_str()
---
 disk/part_efi.c  | 90 +++-
 include/common.h |  3 +-
 lib/Makefile |  1 +
 lib/uuid.c   | 34 +++--
 4 files changed, 45 insertions(+), 83 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 733d5bd..a280ab5 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -63,26 +63,6 @@ static char *print_efiname(gpt_entry *pte)
return name;
 }
 
-static void uuid_string(unsigned char *uuid, char *str)
-{
-   static const u8 le[16] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11,
- 12, 13, 14, 15};
-   int i;
-
-   for (i = 0; i  16; i++) {
-   sprintf(str, %02x, uuid[le[i]]);
-   str += 2;
-   switch (i) {
-   case 3:
-   case 5:
-   case 7:
-   case 9:
-   *str++ = '-';
-   break;
-   }
-   }
-}
-
 static efi_guid_t system_guid = PARTITION_SYSTEM_GUID;
 
 static inline int is_bootable(gpt_entry *p)
@@ -103,6 +83,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
gpt_entry *gpt_pte = NULL;
int i = 0;
char uuid[37];
+   unsigned char *uuid_bin;
 
if (!dev_desc) {
printf(%s: Invalid Argument(s)\n, __func__);
@@ -132,9 +113,11 @@ void print_part_efi(block_dev_desc_t * dev_desc)
le64_to_cpu(gpt_pte[i].ending_lba),
print_efiname(gpt_pte[i]));
printf(\tattrs:\t0x%016llx\n, gpt_pte[i].attributes.raw);
-   uuid_string(gpt_pte[i].partition_type_guid.b, uuid);
+   uuid_bin = (unsigned char *)gpt_pte[i].partition_type_guid.b;
+   uuid_bin_to_str(uuid_bin, uuid);
printf(\ttype:\t%s\n, uuid);
-   uuid_string(gpt_pte[i].unique_partition_guid.b, uuid);
+   uuid_bin = (unsigned char *)gpt_pte[i].unique_partition_guid.b;
+   uuid_bin_to_str(uuid_bin, uuid);
printf(\tuuid:\t%s\n, uuid);
}
 
@@ -182,7 +165,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int 
part,
sprintf((char *)info-type, U-Boot);
info-bootable = is_bootable(gpt_pte[part - 1]);
 #ifdef CONFIG_PARTITION_UUIDS
-   uuid_string(gpt_pte[part - 1].unique_partition_guid.b, info-uuid);
+   uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info-uuid);
 #endif
 
debug(%s: start 0x LBAF , size 0x LBAF , name %s, __func__,
@@ -237,60 +220,6 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc)
return 0;
 }
 
-/**
- * string_uuid(); Convert UUID stored as string to bytes
- *
- * @param uuid - UUID represented as string
- * @param dst - GUID buffer
- *
- * @return return 0 on successful conversion
- */
-static int string_uuid(char *uuid, u8 *dst)
-{
-   efi_guid_t guid;
-   u16 b, c, d;
-   u64 e;
-   u32 a;
-   u8 *p;
-   u8 i;
-
-   const u8 uuid_str_len = 36;
-
-   /* The UUID is written in text: */
-   /* 1914   19   24 */
-   /* ---- */
-
-   debug(%s: uuid: %s\n, __func__, uuid);
-
-   if (strlen(uuid) != uuid_str_len)
-   return -1;
-
-   for (i = 0; i  uuid_str_len; i++) {
-   if ((i == 8) || (i == 13) || (i == 18) || (i == 23)) {
-   if (uuid[i] != '-')
-   return -1;
-   } else {
-   if (!isxdigit(uuid[i]))
-   return -1;
-   }
-   }
-
-   a = (u32)simple_strtoul(uuid, NULL, 16);
-   b = (u16)simple_strtoul(uuid + 9, NULL, 16);
-   c = (u16)simple_strtoul(uuid + 14, NULL, 16);
-   d = (u16)simple_strtoul(uuid + 19, NULL, 16);
-   e = (u64)simple_strtoull(uuid + 24, NULL, 16);
-
-   p = (u8 *) e;
-   guid = EFI_GUID(a, b, c, d  8, d  0xFF,
-   *(p + 5), *(p + 4), *(p + 3),
-   *(p + 2), *(p + 1) , *p);
-
-   memcpy(dst, guid.b, sizeof(efi_guid_t));
-
-   return 0;
-}
-
 int 

Re: [U-Boot] Relocation

2014-03-14 Thread Albert ARIBAUD
Hi mahsmak,

On Fri, 14 Mar 2014 06:38:34 -0700 (PDT), mahsmak
kshamim...@gmail.com wrote:

 Hi,
 
 Can anyone please explain how relocation address is calculated in uboot ? 

U-Boot tries to relocate itself as high in RAM as possible so that the
lower area is available to e.g. the Linux kernel it will chainload.

Therefore, the usual process is that U-Boot first reserves whatever
amount of memory it needs at end of RAM, then relocates itself just
below that.

 Also, I want to know whether relocation will happen or not when uboot is
 running from RAM already? If yes, then can it be disabled ?

Relocation will always happen, and there is no provision for avoiding
it.

 Thank you,

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


[U-Boot] [PATCH v3 2/3] lib: uuid: add functions to generate UUID version 4

2014-03-14 Thread Przemyslaw Marczak
This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- add new config: CONFIG_RANDOM_UUID: compile uuid.c and rand.c

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
  UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
  ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
Cc: Jason Hobbs jason.ho...@calxeda.com
Cc: Stephen Warren swar...@nvidia.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: tr...@ti.com

---
Changes v2:
- put uuid generation changes in a separate commit
- get_uuid_str() - change name to gen_rand_uuid_str()
- add new function: gen_rand_uuid()
- remove unnecessary '\0' at the end of uuid string
- drop unnecessary error checking
- functions now takes pointers to allocated memory instead of alloc it itself
- add new config option: CONFIG_RANDOM_UUID

Changes v3:
- remove unused UUID_STR_BYTE_LEN
- reword comments
- remove null pointer checking from gen_rand_uuid() and gen_rand_uuid_str()
- remove unneeded memset from gen_rand_uuid()
- undo moving vsprintf.o object in lib/Makefile
- add attribute packed to the uuid structure
- gen_rand_uuid(): add endian functions for modify uuid data
- gen_rand_uuid(): use memcpy() to store uuid data into given buffer for avoid
  unaligned access issues
- change uuid version and variant masks to proper for use with clrsetbits_*
- add #ifdef CONFIG_RANDOM_UUID to random uuid code for avoid warnings
---
 include/common.h |  5 +++-
 lib/Makefile |  3 +++
 lib/uuid.c   | 78 +++-
 3 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/include/common.h b/include/common.h
index 32377ad..20e9ae6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -815,6 +815,8 @@ voidudelay(unsigned long);
 void mdelay(unsigned long);
 
 /* lib/uuid.c */
+void gen_rand_uuid(unsigned char *uuid_bin);
+void gen_rand_uuid_str(char *uuid_str);
 void uuid_bin_to_str(unsigned char *uuid, char *str);
 int uuid_str_to_bin(char *uuid, unsigned char *out);
 int uuid_str_valid(const char *uuid);
@@ -831,7 +833,8 @@ char *  strmhz(char *buf, unsigned long hz);
 /* lib/rand.c */
 #if defined(CONFIG_RANDOM_MACADDR) || \
defined(CONFIG_BOOTP_RANDOM_DELAY) || \
-   defined(CONFIG_CMD_LINK_LOCAL)
+   defined(CONFIG_CMD_LINK_LOCAL) || \
+   defined(CONFIG_RANDOM_UUID)
 #define RAND_MAX -1U
 void srand(unsigned int seed);
 unsigned int rand(void);
diff --git a/lib/Makefile b/lib/Makefile
index 70962b2..fc7a24a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -62,7 +62,10 @@ obj-y += time.o
 obj-$(CONFIG_TRACE) += trace.o
 obj-$(CONFIG_BOOTP_PXE) += uuid.o
 obj-$(CONFIG_PARTITION_UUIDS) += uuid.o
+obj-$(CONFIG_PARTITION_UUIDS) += rand.o
 obj-y += vsprintf.o
+obj-$(CONFIG_RANDOM_UUID) += uuid.o
+obj-$(CONFIG_RANDOM_UUID) += rand.o
 obj-$(CONFIG_RANDOM_MACADDR) += rand.o
 obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
 obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
diff --git a/lib/uuid.c b/lib/uuid.c
index 925e501..0f22e14 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -7,8 +7,30 @@
 #include linux/ctype.h
 #include errno.h
 #include common.h
+#include asm/io.h
+#include part_efi.h
+#include malloc.h
 
 #define UUID_STR_LEN   36
+#define UUID_BIN_LEN   16
+
+#define UUID_VERSION_MASK  0xf000
+#define UUID_VERSION_SHIFT 12
+#define UUID_VERSION   0x4
+
+#define UUID_VARIANT_MASK  0xc0
+#define UUID_VARIANT_SHIFT 7
+#define UUID_VARIANT   0x1
+
+/* This is structure is in big-endian */
+struct uuid {
+   unsigned int time_low;
+   unsigned short time_mid;
+   unsigned short time_hi_and_version;
+   unsigned char clock_seq_hi_and_reserved;
+   unsigned char clock_seq_low;
+   unsigned char node[6];
+} __packed;
 
 /*
  * This is what a UUID string looks like.
@@ -21,7 +43,6 @@
  * ----
  *le le   le   be   be
  */
-
 int uuid_str_valid(const char *uuid)
 {
int i, valid;
@@ -95,3 +116,58 @@ void uuid_bin_to_str(unsigned char *uuid, char *str)
}
}
 }
+
+/*
+ * gen_rand_uuid() - this function generates a random binary UUID v4 and stores
+ *   it into the memory pointed at by the supplied pointer,
+ *   which must be 16 bytes in size
+ *
+ * Layout of UUID Version 4:
+ * timestamp - 60-bit: time_low, time_mid, time_hi_and_version
+ * version   - 4 bit (bit 4 through 7 of the time_hi_and_version)
+ * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low
+ * variant:  - bit 6 and 7 of clock_seq_hi_and_reserved
+ * node  - 48 bit
+ * In this version all fields beside 4 bit version are randomly generated.
+ * source: 

Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Albert ARIBAUD
Hi Tom,

On Fri, 14 Mar 2014 10:19:27 -0400, Tom Rini tr...@ti.com wrote:

 OK good, I think Albert and I might end up starting the sun4i/sun5i
 stuff as those are the boards we've got sitting around.

As I have a Mele A1000G (A31), that would be sun6i, not sun4i/sun5i --
and yes, I would like to contribute support for it.

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Ian Campbell
On Fri, 2014-03-14 at 10:16 -0400, Tom Rini wrote:
 On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:
 
  Hi,
  
  This is my first cut at an upstreamable series based upon the
  https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
  intention is to present a minimal starting point for upstreaming to
  which support for other processors, peripherals, boards etc can be
  added in the future. Therefore this has been stripped right back and
  currently supports only sun7i processors and the cubietruck
  board. Supported peripherals are UART, MMC and Ethernet.
 
 Some global comments:
 - If you haven't already, make sure it's all checkpatch clean.

I hadn't realised u-boot had a checkpatch. I shall do this.

 - Use the SPDX tags rather than including the GPL boilerplate.

Agreed, I already sent out a patch to sunxi.git to make this happen
there so I could sync it to this tree (so sunxi guys consider this a
ping on 1394161088-9835-1-git-send-email-...@hellion.org.uk ;-))

I suppose I don't need to wait, but it was convenient to have a diff
which always shrank...

 - Please re-word the commit messages.  The how we got here / where this
   is from is fine for the cover letter.

OK, that was mostly for my own reference. Mind if I put it at the end
after --- so git am will strip it?

 - Magic numbers need to be defined.

Will do.

Thanks,
Ian.


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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 03:04:28PM +, Ian Campbell wrote:
 On Fri, 2014-03-14 at 10:16 -0400, Tom Rini wrote:
  On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:
  
   Hi,
   
   This is my first cut at an upstreamable series based upon the
   https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
   intention is to present a minimal starting point for upstreaming to
   which support for other processors, peripherals, boards etc can be
   added in the future. Therefore this has been stripped right back and
   currently supports only sun7i processors and the cubietruck
   board. Supported peripherals are UART, MMC and Ethernet.
  
  Some global comments:
[snip]
  - Please re-word the commit messages.  The how we got here / where this
is from is fine for the cover letter.
 
 OK, that was mostly for my own reference. Mind if I put it at the end
 after --- so git am will strip it?

Yeah, that's a good idea.

  - Magic numbers need to be defined.
 
 Will do.

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 v1 7/9] sunxi: mmc support

2014-03-14 Thread Pantelis Antoniou
Hi Ian,

On Mar 14, 2014, at 12:33 PM, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
 
 As well as the following signed-off-by the sunxi branch shows commits to these
 files authored by the following:
  Stefan Roese
  Tom Cubie
  yemao
 
 Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
 Signed-off-by: Luke Leighton l...@lkcl.net
 Signed-off-by: Oliver Schinagl oli...@schinagl.nl
 Signed-off-by: Wills Wang wills.wang.o...@gmail.com
 Signed-off-by: Ian Campbell i...@hellion.org.uk
 ---
 arch/arm/include/asm/arch-sunxi/mmc.h |  66 
 board/sunxi/board.c   |  13 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/sunxi_mmc.c   | 650 ++
 include/configs/sunxi-common.h|  11 +
 5 files changed, 741 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-sunxi/mmc.h
 create mode 100755 drivers/mmc/sunxi_mmc.c
 
 diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h 
 b/arch/arm/include/asm/arch-sunxi/mmc.h
 new file mode 100644
 index 000..639a7fc
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-sunxi/mmc.h
 @@ -0,0 +1,66 @@
 +/*
 + * (C) Copyright 2007-2011
 + * Allwinner Technology Co., Ltd. www.allwinnertech.com
 + * Aaron leafy.m...@allwinnertech.com
 + *
 + * MMC register definition for allwinner sunxi platform.
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +#ifndef _SUNXI_MMC_H
 +#define _SUNXI_MMC_H
 +
 +#include linux/types.h
 +
 +struct sunxi_mmc {
 + u32 gctrl;  /* (0x00) SMC Global Control Register */
 + u32 clkcr;  /* (0x04) SMC Clock Control Register */
 + u32 timeout;/* (0x08) SMC Time Out Register */
 + u32 width;  /* (0x0c) SMC Bus Width Register */
 + u32 blksz;  /* (0x10) SMC Block Size Register */
 + u32 bytecnt;/* (0x14) SMC Byte Count Register */
 + u32 cmd;/* (0x18) SMC Command Register */
 + u32 arg;/* (0x1c) SMC Argument Register */
 + u32 resp0;  /* (0x20) SMC Response Register 0 */
 + u32 resp1;  /* (0x24) SMC Response Register 1 */
 + u32 resp2;  /* (0x28) SMC Response Register 2 */
 + u32 resp3;  /* (0x2c) SMC Response Register 3 */
 + u32 imask;  /* (0x30) SMC Interrupt Mask Register */
 + u32 mint;   /* (0x34) SMC Masked Interrupt Status Reg */
 + u32 rint;   /* (0x38) SMC Raw Interrupt Status Register */
 + u32 status; /* (0x3c) SMC Status Register */
 + u32 ftrglevel;  /* (0x40) SMC FIFO Threshold Watermark Reg */
 + u32 funcsel;/* (0x44) SMC Function Select Register */
 + u32 cbcr;   /* (0x48) SMC CIU Byte Count Register */
 + u32 bbcr;   /* (0x4c) SMC BIU Byte Count Register */
 + u32 dbgc;   /* (0x50) SMC Debug Enable Register */
 + u32 res0[11];   /* (0x54~0x7c) */
 + u32 dmac;   /* (0x80) SMC IDMAC Control Register */
 + u32 dlba;   /* (0x84) SMC IDMAC Descr List Base Addr Reg */
 + u32 idst;   /* (0x88) SMC IDMAC Status Register */
 + u32 idie;   /* (0x8c) SMC IDMAC Interrupt Enable Register */
 + u32 chda;   /* (0x90) */
 + u32 cbda;   /* (0x94) */
 + u32 res1[26];   /* (0x98~0xff) */
 + u32 fifo;   /* (0x100) SMC FIFO Access Address */
 +};
 +
 +int sunxi_mmc_init(int sdc_no);
 +#endif /* _SUNXI_MMC_H */
 diff --git a/board/sunxi/board.c b/board/sunxi/board.c
 index bffef4f..5dbcf2a 100644
 --- a/board/sunxi/board.c
 +++ b/board/sunxi/board.c
 @@ -30,6 +30,7 @@
 #include common.h
 #include asm/arch/clock.h
 #include asm/arch/dram.h
 +#include asm/arch/mmc.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
 @@ -59,6 +60,18 @@ int dram_init(void)
   return 0;
 }
 
 +#ifdef CONFIG_GENERIC_MMC
 +int board_mmc_init(bd_t *bis)
 +{
 + sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
 +#if !defined (CONFIG_SPL_BUILD)  defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
 + 

Re: [U-Boot] [PATCH v3 1/3] part_efi: move uuid-string conversion functions into lib/uuid.c

2014-03-14 Thread Wolfgang Denk
Dear Przemyslaw Marczak,

In message 
5ef7cdb8df4fb05c3c371e29d7a61e28e1563a68.1394807506.git.p.marc...@samsung.com 
you wrote:
 Changes:
 - move uuid-string conversion functions into lib/uuid.c so they can be
   used by code outside part_efi.c.
 - rename uuid_string() to uuid_bin_to_str() for consistency with existing
   uuid_str_to_bin()
 - add an error return code to uuid_str_to_bin()
 
 Update existing code to the new library functions.
...
 +void uuid_bin_to_str(unsigned char *uuid, char *str)
 +{
 + static const u8 le[16] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11,
 +   12, 13, 14, 15};
 + int i;
 +
 + for (i = 0; i  16; i++) {
 + sprintf(str, %02x, uuid[le[i]]);

You mentioned before that the UUID format was big endian.  Hoever,
here you always use trhe same byte order 3-2-1-0 when formatting the
initi int field - you do not take into account whether this code is
running on a BE or a LE system.  Is this code not only correct for LE
systems, but broken when running on a BE machine?

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
Of course there's no reason for it, it's just our policy.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Henrik Nordström
fre 2014-03-14 klockan 10:33 + skrev Ian Campbell:

 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree.

Thanks for picking this up. Much needed.

Regards
Henrik

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


Re: [U-Boot] [PATCH v3 2/3] lib: uuid: add functions to generate UUID version 4

2014-03-14 Thread Wolfgang Denk
Dear Przemyslaw Marczak,

In message 
bf85640549b0798b838145e9bad6dcc59454e7ae.1394807506.git.p.marc...@samsung.com 
you wrote:
 This patch adds support to generate UUID (Universally Unique Identifier)
 in version 4 based on RFC4122, which is randomly.
 
 Source: https://www.ietf.org/rfc/rfc4122.txt
...

 +#define UUID_BIN_LEN 16
...
 +struct uuid {
 + unsigned int time_low;
 + unsigned short time_mid;
 + unsigned short time_hi_and_version;
 + unsigned char clock_seq_hi_and_reserved;
 + unsigned char clock_seq_low;
 + unsigned char node[6];
 +} __packed;

Maybe we should define UUID_BIN_LEN as sizeof(struct uuid) ?


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
To the systems programmer,  users  and  applications  serve  only  to
provide a test load.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/3] cmd:gpt: randomly generate each partition uuid if undefined

2014-03-14 Thread Wolfgang Denk
Dear Przemyslaw Marczak,

In message 
e7d9246677ecb9a8c774e9e5f8d31ae3fd53d487.1394807506.git.p.marc...@samsung.com 
you wrote:
 Changes:
 - randomly generate partition uuid if any is undefined
 - print info about set/unset/generated uuid
 - update doc/README.gpt
...
 + int ret = -1;
   char *e, *s;
 + char uuid_str[37];

Should we not rather use a #defined macro here instead of the magic
number 37 ?

 - printf(Environmental '%s' not set\n, str);
 - return -1; /* env not set */
 + printf(%s , str);
 + gen_rand_uuid_str(uuid_str);
 + setenv(s, uuid_str);
 +
 + e = getenv(s);
 + if (e) {
 + puts(set to random.\n);

Can we keep the var not set part, so the user understands why U-Boot
assigns a random ID here?

 + } else {
 + printf(%s get from environment.\n, str);

Make this debug() ?

 + puts(Writing GPT:\n);
 +
 + ret = gpt_default(blk_dev_desc, argv[4]);
 + if (!ret) {
 + puts(success!\n);
 + return CMD_RET_SUCCESS;
 + } else {
 + puts(error!\n);
   return CMD_RET_FAILURE;

This code is too verbose - I suggest to turn all these puts() into
debug().

   } else {
   return CMD_RET_USAGE;
   }

Please invert the logic so you can bail out early and reduce the
indentation level.

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
Work 8 hours, sleep 8 hours; but not the same 8 hours.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] Re: [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Henrik Nordström
fre 2014-03-14 klockan 10:17 -0400 skrev Tom Rini:

 And as for the rest of the code, lots of magic numbers to #define
 what/why (why udelay(2) and 22?)

Unfortunately the only documentation we have on the sun7i DRAM
controller is Allwinner boot0 + boot1 code, and that code uses.. magic
numbers  shifts with no explanations.

We have guessed some small bits, but a lot is completely unknown.

Regards
Henriki

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


Re: [U-Boot] [PATCH 01/11] ARM: tegra: pinctrl: remove func_safe

2014-03-14 Thread Simon Glass
Hi Stephen,

On 13 March 2014 11:41, Stephen Warren swar...@wwwdotorg.org wrote:

 From: Stephen Warren swar...@nvidia.com

 This field isn't used anywhere, so remove it. Note that PIN() macros are
 left unchanged for now, to avoid many diffs to them; later commits will
 completely rewrite them just one time.

I recall this being a way of putting pins into a 'safe' state which is
not incompatible with other changes. I suppose we could look up the
details, but if it isn't actually used, we should drop it.


 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/11] ARM: tegra: pinctrl: remove vddio

2014-03-14 Thread Simon Glass
On 13 March 2014 11:41, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 This field isn't used anywhere, so remove it. Note that PIN() macros are
 left unchanged for now, to avoid many diffs to them; later commits will
 completely rewrite them just one time.

 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/11] ARM: tegra: pinctrl: make pmux_func values consistent on Tegra20

2014-03-14 Thread Simon Glass
On 13 March 2014 11:41, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 For consistency with other SoCs, modify Tegra20's enum pmux_func to:

 * Remove PMUX_FUNC values that aren't real
 * Use the same PMUX_FUNC_RSVD[1-4] values, and ensure (RSVD1  3)==0;
   this will be assumed by pinmux_set_func() in a future patch.

 Unfortunately, PMUX_FUNC_RSVD is still used in the pin macros. Use a
 private define inside the driver to prevent this from causing compilaton
 errors. This will be cleaned up when the pin tables are re-written in a
 later patch in this series.

 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/11] ARM: tegra: prototype pinmux_init() in board.h

2014-03-14 Thread Simon Glass
On 13 March 2014 11:42, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 pinmux_init() is a board-level function, not a pinmux driver function.
 Move the prototype to a board header rather than the driver header.

 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] setting Ethernet address

2014-03-14 Thread Benedict Hewson
I am trying to get network support working on the Embest imx6 Marsboard.
I have been reading through the various imx6 boards and it appears that some 
at least store a MAC address in the fuse memory. 

This does not appear to be set on the MarSboard - the fuse memory contains 0.
The original 2009 version used the ethaddr environment variable.
If I try to include this in the config header file either as part of the 
CONFIG_EXTRA_ENV_SETTINGS - 

#define CONFIG_ETHADDR 00:01:02:03:04:05

#define CONFIG_EXTRA_ENV_SETTINGS \
ethaddr=__stringify(CONFIG_ETHADDR)\0 \

or more simply as in the original version

ethaddr=00:01:02:03:04:05\0 \

everything compiles, but when booting I get Warning: failed to set MAC 
address  and when listing the environment variables ethhaddr is missing.
If I manually set ethaddr and ipaddr the networking seems to work as I can 
ping the board successfully.

I assume I am missing something somewhere and I expect if I go through the 
source I will eventually find it, but it is probably going to be quicker to 
ask.


many thanks
Ben


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


Re: [U-Boot] [linux-sunxi] Re: [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Luke Kenneth Casson Leighton
On Fri, Mar 14, 2014 at 4:28 PM, Henrik Nordström
hen...@henriknordstrom.net wrote:
 fre 2014-03-14 klockan 10:17 -0400 skrev Tom Rini:

 And as for the rest of the code, lots of magic numbers to #define
 what/why (why udelay(2) and 22?)

 Unfortunately the only documentation we have on the sun7i DRAM
 controller is Allwinner boot0 + boot1 code, and that code uses.. magic
 numbers  shifts with no explanations.

 a terse comment at the top to that effect would likely be worthwhile.

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


Re: [U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Alex G.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/14/2014 09:17 AM, Tom Rini wrote:
 On Fri, Mar 14, 2014 at 10:33:45AM +, Ian Campbell wrote:
 
 [snip]
 +static void mctl_ddr3_reset(void) +{ +  struct sunxi_dram_reg 
 *dram = +(struct sunxi_dram_reg *)SUNXI_DRAMC_BASE; + +  
 { + 
 clrbits_le32(dram-mcr, DRAM_MCR_RESET); +  udelay(2); + 
 setbits_le32(dram-mcr, DRAM_MCR_RESET); +  }
 
 That seems like an odd construction, why the extra braces?
 
This originally had a conditional depending on the SoC family. (Yeah,
they need to reset the ram differently). It seems it wasn't removed
properly.

 And as for the rest of the code, lots of magic numbers to #define 
 what/why (why udelay(2) and 22?)
 
Before going into more detail, remember this is ram initialization
code. That's always going to be a pain :(.
There's nothing magic here. It's just a fact of life. Every step is
going to need a different delay. No need to bloat the headers by
#defining each. It also makes raminit code more unreadable.

We got these numbers from allwinner code dumps. We used to have these
as sdelay() numbers, which usually meant units of 2 clock cycles. So
we had to convert them to udelay() to at least make the delays
independent of CPU clock. The old sdelay() numbers made no sense either.

Alex
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTIzsgAAoJEL0kPHNPXJJKasUQAKygf9UpJc6IINH41LKOFnBf
fBEVB8ECIu96JWUDE9r0BQw0l6Pc82Mqx+XUZdbNhhZNhhVf8EJ/9koHQrP/X8By
J8MninT7pgDi7IH9Y+U5GfuHEA1nDQT0kf+nYMNrUIx1b9cuv5vLvhpeKL0AJotb
DE8miBRCcuRcAivCjERjlVFKCicMERKx1cTrris7+aQyNAxPEGrFj0pS8RBpSgBF
j+NkRSjbdnAOKHOfpXZi7VMqhHIt6NDxsuSrM0roSJz1v79+J5TGqUdPFKvGVZro
BbsWB3pRq8zSdO6OYvojUjyWPG95PfhDQvLSlvKA5Z1AlgNHu32YGkFWGbUve/z7
8dn057RjY4KtrAn+jVOL8+sBAj6yr0VIJmxqa1xPqGOMBAn0Cn+JJZ6auCNPZGqx
yt5glg0B5lHsVgCnmDGvoKs8SAv7n7IQfmiF+gvD8Pn0/NC31UQ2WA3khJoPt6Gp
9G5q+sn6BRrUpQOiQmhJTPX4W3g3nmXFqWYkd+VAWEHeEfHTIuqOlcfgdwMmP4Ti
hrhrk/CWSOPjtYuI5yByA6RCZ93smb4uexSmrzzafzuYrdwK/DmP+TumFrE8pycT
cMsxAx40UEElJ5OHN7YaWtt6NNhCT6BVlo76awqFY/vGme0cef74SQqB8EdyVYSE
PDoq+Sog13y4A8OjQ5rT
=e7kN
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] setting Ethernet address

2014-03-14 Thread Fabio Estevam
On Fri, Mar 14, 2014 at 3:29 PM, Benedict Hewson
bened...@hewson-venieri.com wrote:
 I am trying to get network support working on the Embest imx6 Marsboard.
 I have been reading through the various imx6 boards and it appears that some
 at least store a MAC address in the fuse memory.

 This does not appear to be set on the MarSboard - the fuse memory contains 0.
 The original 2009 version used the ethaddr environment variable.
 If I try to include this in the config header file either as part of the
 CONFIG_EXTRA_ENV_SETTINGS -

I would suggest you to add support for this board in mainline U-boot
and the MAC address will be read from fuse without problems.

Regards,

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


Re: [U-Boot] [PATCH 01/11] ARM: tegra: pinctrl: remove func_safe

2014-03-14 Thread Stephen Warren
On 03/14/2014 12:22 PM, Simon Glass wrote:
 Hi Stephen,
 
 On 13 March 2014 11:41, Stephen Warren swar...@wwwdotorg.org wrote:

 From: Stephen Warren swar...@nvidia.com

 This field isn't used anywhere, so remove it. Note that PIN() macros are
 left unchanged for now, to avoid many diffs to them; later commits will
 completely rewrite them just one time.

 I recall this being a way of putting pins into a 'safe' state which is
 not incompatible with other changes. I suppose we could look up the
 details, but if it isn't actually used, we should drop it.

Yes, that's what the data is for.

However, I think the place to use that data is when constructing the
pinmux table for a board, when one is selecting which mux function to
use for each pin. This happens offline rather than at run-time, so the
data isn't needed at run-time.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 12:23:50PM -0500, Alex G. wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 03/14/2014 09:17 AM, Tom Rini wrote:
  On Fri, Mar 14, 2014 at 10:33:45AM +, Ian Campbell wrote:
  
  [snip]
  +static void mctl_ddr3_reset(void) +{ +struct sunxi_dram_reg 
  *dram = +  (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE; + +  
  { + 
  clrbits_le32(dram-mcr, DRAM_MCR_RESET); +udelay(2); + 
  setbits_le32(dram-mcr, DRAM_MCR_RESET); +}
  
  That seems like an odd construction, why the extra braces?
  
 This originally had a conditional depending on the SoC family. (Yeah,
 they need to reset the ram differently). It seems it wasn't removed
 properly.
 
  And as for the rest of the code, lots of magic numbers to #define 
  what/why (why udelay(2) and 22?)
  
 Before going into more detail, remember this is ram initialization
 code. That's always going to be a pain :(.
 There's nothing magic here. It's just a fact of life. Every step is
 going to need a different delay. No need to bloat the headers by
 #defining each. It also makes raminit code more unreadable.
 
 We got these numbers from allwinner code dumps. We used to have these
 as sdelay() numbers, which usually meant units of 2 clock cycles. So
 we had to convert them to udelay() to at least make the delays
 independent of CPU clock. The old sdelay() numbers made no sense either.

Yeah, I can accept a certain amount of black magic here.  We need to
make sure things are commented as much as it can be.

-- 
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 v1 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-03-14 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/14/2014 02:50 PM, Hans de Goede wrote:
 Hi,
 
 On 03/14/2014 03:17 PM, Tom Rini wrote:
 On Fri, Mar 14, 2014 at 10:33:50AM +, Ian Campbell wrote:

 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section 
 in
 ldscripts vs v2014.01.
 [snip]
 +/* Flat Device Tree (FDT/DT) support */
 +#define CONFIG_OF_LIBFDT
 +#define CONFIG_SYS_BOOTMAPSZ   (16  20)

 This seems pretty small.  This is to keep things from being relocated
 into highmem right?
 
 Hmm, this reminds me that we currently need to do a env set fdt_high 
 
 in our boot scripts to get ftd to work at all. Would be nice to fix this for
 upstream. I'm afraid I'm clueless as to why we (sunxi) need it, but we do.

You want to be setting bootm_low (even for bootz, it's about the
underlying boot mechanics that bootz and bootelf and ... hook into) to
the amount of lowmem the kernel will have.  We do this because we do
want to make sure that the device tree isn't overwritten by the kernel
BSS or similar.  Everyone with more DDR than kernel lowmem needs to be
doing something along these lines.

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

iQIcBAEBAgAGBQJTI1J0AAoJENk4IS6UOR1WUocP/Aojl084qj0+sibvo6r7xb0T
23QaTqoGo+0i48mssFhiCo3KY1RMTiokQ0VgE0r29GQSipc5y75nIj24p0SpFD9N
H2e2hWoTTQ106+MFx4upK61KLvmDA7LUJIHkVYWmgyOP7qL1wdwB5/5hqHuLkSlF
Osz37r2JSbrWgYG+hs8Yby5D/fVizOTpf8f8F5GHrDA+3qlsOOHxUogfPGQeTPpk
9EhrLPSWWIN5l6qnykiiYz0QHDotJvrKoCVm2DJ4APnsIBS3/QyFNkePjVRRrmIT
1zob5wmprYywOjVNeBZ10HjPM8AHuyO2xBr+H3ZwcjfgI4MYiTJiG3eSJ1lTcveY
FGbQa7HFzpnp9vwvvpWtT720D58WYdkjYQRarYHBWpXn+i2xKf4zGggX14jytUXU
dFrqSDQ1hIEZd6uWj/jQMqHuZWDvnJ46ySqlE37UCZwcO1dQ/6WkNrve+XK1+HGQ
EQlTlfRD64a+U2Plh2qoU/xadb+cWNV3fOppUgiwjdvx/+H/8TXsj6h0euaUe7JG
ej+xqeH1a5HoVg5g30Ihn/KHNHwefG6ap3/vsdGH6hq5euodNxIzfBNZAEJ+dY58
tUkfuB3G5OeKV6JvbfD2vOJOl7AHRgqabXNHcNDS3AWAFnodcsgRO2E0od1ao7Ii
n6pN0HAAzINC4y1kR/tJ
=6IRY
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] lsxl: rework boot scripts

2014-03-14 Thread Michael Walle
Am Donnerstag, 13. März 2014, 00:42:49 schrieb Tom Rini:
  How much memory do these platforms have?
  
  LS-CHLv2 has 64MB and LS-XHL has 256MB. The kernel_addr and
  ramdisk_addr are the value which was also used in the original
  bootloader.
 
 OK, so we don't have to worry about relocation to bad places...
 
  Having just spent a bunch of
  time issues about where to load what on TI platforms, I'm a little
  
  worried about some of the locations:
  + kernel_addr=0x0010\0  \
  
  Below 32MB which isn't optimal.
  
  why is that? iirc the kernel is unpacked to 0x8000, isn't it? ok
  there might be some problems unpacking the kernel.
 
 Documentation/arm/Booting in the kernel suggests above 32MB to avoid
 relocation.
 
  + ramdisk_addr=0x0080\0 \
  + fdt_addr=0x007f\0 \
  
  This doesn't leave a whole lot of space for the kernel before
  overwriting either of these.
  
  I must admit i've never worried about where to put these. Any
  suggestions? initrd at the end of the ram? although i'd like to keep
  both platforms the same, eg. i'd take 64MB as the end of ram.
 
 Well, I guess it comes down to how much you worry about things like
 Fedora or SuSE running on the system.  I'd suggest moving the above to
 32MB/just below 32MB to allow a fairly bigish kernel to still work as
 that's one of the thing that will bite commodity distro kernels.

I've just looked at the load addresses. First, in case of the lsxl, neither 
initrd_high nor fdt_high is set to 0x. Therefore, the ramdisk and the 
fdt blob are relocated to the top of the ram. The kernel itself is relocated 
to whatever the uimage loadaddr is set to. In case of debian and the original 
uImage this is 0x8000 and both are zImages. So i can't do anything to avoid 
relocating in the decompressor again.

So the only restrictions should be:
 - 0x0080 - 0x0010 = 7 MB for the kernel
 - 64 kB for the fdt

Hope i get everything right :) I'll post an updated patch with the 
{fat,ext2}load replaced with load in the near future.

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


Re: [U-Boot] [PATCH v1 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-03-14 Thread Hans de Goede
Hi,

On 03/14/2014 03:17 PM, Tom Rini wrote:
 On Fri, Mar 14, 2014 at 10:33:50AM +, Ian Campbell wrote:
 
 Based linux-sunxi#sunxi commit d854c4de2f57 arm: Handle .gnu.hash section in
 ldscripts vs v2014.01.
 [snip]
 +/* Flat Device Tree (FDT/DT) support */
 +#define CONFIG_OF_LIBFDT
 +#define CONFIG_SYS_BOOTMAPSZ(16  20)
 
 This seems pretty small.  This is to keep things from being relocated
 into highmem right?

Hmm, this reminds me that we currently need to do a env set fdt_high 
in our boot scripts to get ftd to work at all. Would be nice to fix this for
upstream. I'm afraid I'm clueless as to why we (sunxi) need it, but we do.

Regards,

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Hans de Goede
Hi,

First of all: Ian: Many many thanks for working on this, you rock!

On 03/14/2014 04:01 PM, Albert ARIBAUD wrote:
 Hi Tom,
 
 On Fri, 14 Mar 2014 10:19:27 -0400, Tom Rini tr...@ti.com wrote:
 
 OK good, I think Albert and I might end up starting the sun4i/sun5i
 stuff as those are the boards we've got sitting around.
 
 As I have a Mele A1000G (A31), that would be sun6i, not sun4i/sun5i

So I'm very interested in getting sunxi support in upstream u-boot too, and
I've a ton of sunxi devices. I'll start working on doing a sun4i patch-set
on top of Ian's sun7i patch-set. Then Tom can start working on sun5i.

Tom, since I've started working on sunxi stuff 2 years ago I've gained a lot
of experience with these little SoCs so let me know if you hit some roadblock
and I can take a look.

Disclaimer I'm more of a kernel / device driver guy, all the low-level
RAM init (and having to think about where in memory to put all the bits)
is mostly new, so have some patience with me please :)

 and yes, I would like to contribute support for it.

If someone can start working on sun6i support that would be awesome.

My sunxi-next u-boot branch:
https://github.com/jwrdegoede/u-boot-sunxi/commits/sunxi-next

Has some minimal patches by Maxime to get u-boot to run as a secondary
boot-loader, using allwinner's boot0 and boot1 as primary loader.

What we really want is to get a working SPL for sun6i, there are 2 ways
to get to a working SPL:

1) Use allwinners special USB boot mode called FEL, this way no MMC / NAND
reading code is necessary.
2) First get MMC to work using uboot as a secondary loader only, and
once we've working MMC code try to get a SPL which can read the
real u-boot directly from MMC.

And then for 2, there is the option to first get MMC for sun6i working in the
upstream Linux kernel, so that we know exactly what changes are needed compared
to sun5i / sun7i MMC (which are identical).

I've done a lot of work on the upstream kernel mmc host driver, and I actually
wanted to start looking into MMC for sun6i in the upstream kernel one of these
days. But now that Ian has published his awesome work to get sunxi support 
upstream,
my first priority is to get sun4i + sun5i support added on top of Ian's patches.

Regards,

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Hans de Goede
Hi,

snip

 and yes, I would like to contribute support for it.
 
 If someone can start working on sun6i support that would be awesome.

p.s. One thing I forgot about sun6i / A31 support Oliver Schinagl has
some preliminary u-boot patches for it here:
https://github.com/oliv3r/u-boot-sunxi/commits/wip/a31

AFAIK these are based on various allwinner source dumps, and are untested
as Oliver does not have an A31 device.

Regards,

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


Re: [U-Boot] [PATCH 05/11] ARM: tegra: pinctrl: remove duplication

2014-03-14 Thread Simon Glass
Hi Stephen,

On 13 March 2014 11:42, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 Much of arch/arm/cpu/tegra*-common/pinmux.c is identical. Remove the
 duplication by creating pinmux-common.c for all the identical code.

 This leaves:
 * arch/arm/include/asm/arch-tegra*/pinmux.h defining only the names of
   the various pins/pin groups, drive groups, and mux functions.
 * arch/arm/cpu/tegra*-common/pinmux.c containing only the lookup table
   stating which pin groups support which mux functions.

 The code in pinmux-common.c is semantically identical to that in the
 various original pinmux.c, but had some consistency and cleanup fixes
 applied during migration.

This patch is very welcome, as You know I was not keen on the
duplication going in in the first place.


 I removed the definition of struct pmux_tri_ctlr, since this is different
 between SoCs (especially Tegra20 vs all others), and it's much simpler to
 deal with this via the new REG/MUX_REG/... defines. spl.c, warmboot.c,
 and warmboot_avp.c needed updates due to this, since they previously
 hijacked this struct to encode the location of some non-pinmux registers.
 Now, that code simply calculates these register addresses directly using
 simple and obvious math. I like this method better irrespective of the
 pinmux code cleanup anyway.

Not as keen as you - U-Boot normally uses structures for access to
hardware registers.


 Signed-off-by: Stephen Warren swar...@nvidia.com
 ---
  arch/arm/cpu/arm720t/tegra-common/spl.c |   4 +-
  arch/arm/cpu/tegra-common/Makefile  |   6 +-
  arch/arm/cpu/tegra-common/pinmux-common.c   | 507 
 
  arch/arm/cpu/tegra114-common/pinmux.c   | 430 +--
  arch/arm/cpu/tegra124-common/pinmux.c   | 429 +--
  arch/arm/cpu/tegra20-common/pinmux.c| 124 +--
  arch/arm/cpu/tegra20-common/warmboot.c  |   5 +-
  arch/arm/cpu/tegra20-common/warmboot_avp.c  |   4 +-
  arch/arm/cpu/tegra30-common/pinmux.c| 400 +-
  arch/arm/include/asm/arch-tegra/pinmux.h| 189 +++
  arch/arm/include/asm/arch-tegra114/pinmux.h | 219 +---
  arch/arm/include/asm/arch-tegra124/pinmux.h | 216 +---
  arch/arm/include/asm/arch-tegra20/pinmux.h  |  85 +
  arch/arm/include/asm/arch-tegra30/pinmux.h  | 199 +--
  14 files changed, 738 insertions(+), 2079 deletions(-)
  create mode 100644 arch/arm/cpu/tegra-common/pinmux-common.c
  create mode 100644 arch/arm/include/asm/arch-tegra/pinmux.h

 diff --git a/arch/arm/cpu/arm720t/tegra-common/spl.c 
 b/arch/arm/cpu/arm720t/tegra-common/spl.c
 index 5171a8f907a1..4097f3b04362 100644
 --- a/arch/arm/cpu/arm720t/tegra-common/spl.c
 +++ b/arch/arm/cpu/arm720t/tegra-common/spl.c
 @@ -19,10 +19,10 @@

  void spl_board_init(void)
  {
 -   struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr 
 *)NV_PA_APB_MISC_BASE;
 +   u32 *cfg_ctl = (u32 *)(NV_PA_APB_MISC_BASE + 0x24);

Open-coded address offset? To me it seems better to have a specific
Tegra20 structure (normal U-Boot approach), or failing  that, worst
case, a #define for this field. Also you should ask your hardware
designers to stop moving things around :-)


 /* enable JTAG */
 -   writel(0xC0, pmt-pmt_cfg_ctl);
 +   writel(0xC0, cfg_ctl);

 board_init_uart_f();

 diff --git a/arch/arm/cpu/tegra-common/Makefile 
 b/arch/arm/cpu/tegra-common/Makefile
 index 34d57349afb5..892556e64451 100644
 --- a/arch/arm/cpu/tegra-common/Makefile
 +++ b/arch/arm/cpu/tegra-common/Makefile
 @@ -7,6 +7,10 @@
  # SPDX-License-Identifier: GPL-2.0+
  #

 +obj-y += ap.o
 +obj-y += board.o
 +obj-y += cache.o
 +obj-y += clock.o
  obj-y += lowlevel_init.o
 -obj-y  += ap.o board.o clock.o cache.o
 +obj-y += pinmux-common.o
  obj-$(CONFIG_DISPLAY_CPUINFO) += sys_info.o
 diff --git a/arch/arm/cpu/tegra-common/pinmux-common.c 
 b/arch/arm/cpu/tegra-common/pinmux-common.c
 new file mode 100644
 index ..10f68ba98b52
 --- /dev/null
 +++ b/arch/arm/cpu/tegra-common/pinmux-common.c
 @@ -0,0 +1,507 @@
 +/*
 + * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
 + * Copyright (c) 2011 The Chromium OS Authors.
 + *
 + * SPDX-License-Identifier: GPL-2.0+
 + */
 +
 +#include common.h
 +#include asm/io.h
 +#include asm/arch/pinmux.h
 +
 +/* return 1 if a pingrp is in range */
 +#define pmux_pingrp_isvalid(pin) (((pin) = 0)  ((pin)  PINGRP_COUNT))
 +
 +/* return 1 if a pmux_func is in range */
 +#define pmux_func_isvalid(func) \
 +   func) = 0)  ((func)  PMUX_FUNC_COUNT)) || \
 +(((func) = PMUX_FUNC_RSVD1)  ((func) = PMUX_FUNC_RSVD4)))
 +
 +/* return 1 if a pin_pupd_is in range */
 +#define pmux_pin_pupd_isvalid(pupd) \
 +   (((pupd) = PMUX_PULL_NORMAL)  ((pupd) = PMUX_PULL_UP))
 +
 +/* return 1 if a pin_tristate_is in range */
 +#define pmux_pin_tristate_isvalid(tristate) \
 +   (((tristate) = PMUX_TRI_NORMAL)  

Re: [U-Boot] [PATCH 06/11] ARM: tegra: reduce public pinmux API

2014-03-14 Thread Simon Glass
On 13 March 2014 11:42, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 Remove a few unused functions from the pinmux header. They aren't
 currently used, and removing them prevents any new usage from appearing.
 This will ease moving to just pinmux_config_table() and
 padgrp_config_table() in the future.

 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/11] ARM: tegra: pinmux naming consistency fixes

2014-03-14 Thread Simon Glass
Hi Stephen,

On 13 March 2014 11:42, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 Clean up the naming of pinmux-related objects:
 * Refer to drive groups rather than pad groups to match the Linux kernel.
 * Ensure all pinmux API types are prefixed with pmux_, values (defines)
   are prefixed with PMUX_, and functions prefixed with pinmux_.
 * Modify a few type names to make their content clearer.
 * Minimal changes to SoC-specific .h/.c files are made so the code still
   compiles. A separate per-SoC change will be made immediately following,
   in order to keep individual patch size down.

 Signed-off-by: Stephen Warren swar...@nvidia.com

Acked-by: Simon Glass s...@chromium.org

A few comments below.

 ---
  arch/arm/cpu/tegra-common/pinmux-common.c  | 122 
 +++--
  arch/arm/cpu/tegra114-common/pinmux.c  |   4 +-
  arch/arm/cpu/tegra124-common/pinmux.c  |   4 +-
  arch/arm/cpu/tegra20-common/funcmux.c  |   6 +-
  arch/arm/cpu/tegra20-common/pinmux.c   |   4 +-
  arch/arm/cpu/tegra30-common/pinmux.c   |   4 +-
  arch/arm/include/asm/arch-tegra/pinmux.h   |  88 +++
  arch/arm/include/asm/arch-tegra114/pinmux.h|   8 +-
  arch/arm/include/asm/arch-tegra124/pinmux.h|   8 +-
  arch/arm/include/asm/arch-tegra20/pinmux.h |   2 +-
  arch/arm/include/asm/arch-tegra30/pinmux.h |   8 +-
  .../common/pinmux-config-tamonten-ng.h |  30 ++---
  board/avionic-design/common/tamonten-ng.c  |  12 +-
  board/nvidia/cardhu/cardhu.c   |   6 +-
  board/nvidia/cardhu/pinmux-config-cardhu.h |  30 ++---
  board/nvidia/dalmore/dalmore.c |   9 +-
  board/nvidia/dalmore/pinmux-config-dalmore.h   |  40 +++
  board/nvidia/venice2/pinmux-config-venice2.h   |  40 +++
  board/nvidia/venice2/venice2.c |  15 +--
  19 files changed, 223 insertions(+), 217 deletions(-)


...

 diff --git a/arch/arm/cpu/tegra114-common/pinmux.c 
 b/arch/arm/cpu/tegra114-common/pinmux.c
 index af8b7ca5fc79..efe5163084c1 100644
 --- a/arch/arm/cpu/tegra114-common/pinmux.c
 +++ b/arch/arm/cpu/tegra114-common/pinmux.c
 @@ -41,7 +41,7 @@
  #define PIN_RESERVED \
 PIN(NONE, NONE, INVALID, INVALID, INVALID, INVALID, NONE)

 -const struct tegra_pingroup_desc tegra114_pingroups[PINGRP_COUNT] = {
 +const struct pmux_pingrp_desc tegra114_pingroups[PMUX_PINGRP_COUNT] = {

Can some of these be static?

 /*  NAME  VDD  f0   f1 f2   f3  */
 PINI(ULPI_DATA0,  BB,  SPI3,   HSI,UARTA,   ULPI),
 PINI(ULPI_DATA1,  BB,  SPI3,   HSI,UARTA,   ULPI),
 @@ -303,4 +303,4 @@ const struct tegra_pingroup_desc 
 tegra114_pingroups[PINGRP_COUNT] = {
 PIN_RESERVED,   /* Reserved by t114: 0x3404 */
 PINO(RESET_OUT_N, SYS, RSVD1,  RSVD2,  RSVD3, 
 RESET_OUT_N),
  };
 -const struct tegra_pingroup_desc *tegra_soc_pingroups = tegra114_pingroups;
 +const struct pmux_pingrp_desc *tegra_soc_pingroups = tegra114_pingroups;

...

 diff --git a/arch/arm/include/asm/arch-tegra114/pinmux.h 
 b/arch/arm/include/asm/arch-tegra114/pinmux.h
 index 00ef5423547d..070745933503 100644
 --- a/arch/arm/include/asm/arch-tegra114/pinmux.h
 +++ b/arch/arm/include/asm/arch-tegra114/pinmux.h
 @@ -202,10 +202,10 @@ enum pmux_pingrp {
 PINGRP_SDMMC3_CLK_LB_IN,
 PINGRP_SDMMC3_CLK_LB_OUT,
 PINGRP_RESET_OUT_N = PINGRP_SDMMC3_CLK_LB_OUT + 2,
 -   PINGRP_COUNT,
 +   PMUX_PINGRP_COUNT,

It seems odd that this doesn't match the others. Why not a PMUX_
prefix on all of them? Same comment in other cases below.

  };

 -enum pdrive_pingrp {
 +enum pmux_drvgrp {
 PDRIVE_PINGROUP_AO1 = 0, /* offset 0x868 */
 PDRIVE_PINGROUP_AO2,
 PDRIVE_PINGROUP_AT1,
 @@ -244,7 +244,7 @@ enum pdrive_pingrp {
 PDRIVE_PINGROUP_HVC,
 PDRIVE_PINGROUP_SDIO4,
 PDRIVE_PINGROUP_AO0,
 -   PDRIVE_PINGROUP_COUNT,
 +   PMUX_DRVGRP_COUNT,
  };

  /*
 @@ -378,7 +378,7 @@ enum pmux_func {

  #define TEGRA_PMX_HAS_PIN_IO_BIT_ETC
  #define TEGRA_PMX_HAS_RCV_SEL
 -#define TEGRA_PMX_HAS_PADGRPS
 +#define TEGRA_PMX_HAS_DRVGRPS
  #include asm/arch-tegra/pinmux.h

  #endif /* _TEGRA114_PINMUX_H_ */

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Dennis Gilmore
On Fri, 14 Mar 2014 10:16:42 -0400
Tom Rini tr...@ti.com wrote:

 On Fri, Mar 14, 2014 at 10:33:32AM +, Ian Campbell wrote:
 
  Hi,
  
  This is my first cut at an upstreamable series based upon the
  https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree. The
  intention is to present a minimal starting point for upstreaming to
  which support for other processors, peripherals, boards etc can be
  added in the future. Therefore this has been stripped right back and
  currently supports only sun7i processors and the cubietruck
  board. Supported peripherals are UART, MMC and Ethernet.
 
 Some global comments:
 - If you haven't already, make sure it's all checkpatch clean.
 - Use the SPDX tags rather than including the GPL boilerplate.
 - Please re-word the commit messages.  The how we got here / where
 this is from is fine for the cover letter.
 - Magic numbers need to be defined.

I have a quick request also, Please incorporate the ongoing generic
distro work as most if not all of the sunxi systems I know of are
targets for generic distros.

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


Re: [U-Boot] Pull request: u-boot-sh/maste

2014-03-14 Thread Tom Rini
On Fri, Mar 14, 2014 at 03:15:27PM +0900, Nobuhiro Iwamatsu wrote:

 Dear Tom Rini.
 
 Please pull u-boot-sh master branch.
 
 The following changes since commit 2e50f6dccb3eeb1a20993c9da73fe355da35cf04:
 
   kbuild: delete *.pyc files by make distclean (2014-03-12 17:05:00 -0400)
 
 are available in the git repository at:
 
   git://git.denx.de/u-boot-sh.git master
 
 for you to fetch changes up to 194ba5d4ecb2ad1195333cc7453f291e5b316479:
 
   sh: ecovec: correct romImage address in comment (2014-03-14 14:50:28 +0900)
 
 
 Baruch Siach (2):
   sh: fix PFC registers definition for SH772{2, 3, 4}
   sh: ecovec: correct romImage address in comment
 
  arch/sh/include/asm/cpu_sh7722.h | 5 +++--
  arch/sh/include/asm/cpu_sh7723.h | 5 +++--
  arch/sh/include/asm/cpu_sh7724.h | 5 +++--
  board/renesas/ecovec/lowlevel_init.S | 2 +-
  4 files changed, 10 insertions(+), 7 deletions(-)

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [RFC PATCH 6/6] fpga: xilinx: Simplify load/dump/info function handling

2014-03-14 Thread Tom Rini
On Thu, Mar 13, 2014 at 03:52:48PM +0100, Michal Simek wrote:

 Connect FPGA version with appropriate operations
 to remove huge switch-cases for every FPGA family.
 Tested on Zynq. Spartan2/Spartan3/Virtex2 just compile test.
 
 Signed-off-by: Michal Simek michal.si...@xilinx.com

I like the concept.  Did you go through the u-boot.map files on
spartan/etc to make sure we aren't discarding things now?  That'd be the
follow up on compile testing the series.

-- 
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/3] mmc: Remove ops from struct mmc and put in mmc_ops

2014-03-14 Thread Simon Glass
Hi,

On 12 March 2014 04:24, Pantelis Antoniou pa...@antoniou-consulting.com wrote:
 Remove the in-structure ops and put them in mmc_ops with
 a constant pointer to it.

 This makes the mmc structure smaller as well as conserving
 code space (in theory).

You might be able to run buildman (and use -S) to check this.

These changes look good to me, and will make it easier to move to
driver model I suspect.

Regards,
Simon


 All in-tree drivers are converted as well; this is done in a
 single patch in order to not break git bisect.

 Changes since V1:
 Fix compilation b0rked issue on omap platforms where OMAP_GPIO was
 not set.

 Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] mmc: Convert mmc struct's name array to a pointer

2014-03-14 Thread Simon Glass
Hi,

On 12 March 2014 04:24, Pantelis Antoniou pa...@antoniou-consulting.com wrote:
 Using an array is pointless; even more pointless (and scary) is using
 sprintf to fill it without a format string.

This is certainly better, but how about an mmc structure init function
which sets this up?

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


Re: [U-Boot] [PATCH 3/3] mmc: Split mmc struct, rework mmc initialization

2014-03-14 Thread Simon Glass
On 12 March 2014 04:24, Pantelis Antoniou pa...@antoniou-consulting.com wrote:
 The way that struct mmc was implemented was a bit of a mess;
 configuration and internal state all jumbled up in a single structure.

 On top of that the way initialization is done with mmc_register leads
 to a lot of duplicated code in drivers.

 Typically the initialization got something like this in every driver.

 struct mmc *mmc = malloc(sizeof(struct mmc));
 memset(mmc, 0, sizeof(struct mmc);
 /* fill in fields of mmc struct */
 /* store private data pointer */
 mmc_register(mmc);

 By using the new mmc_create call one just passes an mmc config struct
 and an optional private data pointer like this:

 struct mmc = mmc_create(cfg, priv);

 All in tree drivers have been updated to the new form, and expect
 mmc_register to go away before long.

Looks like a big improvement!


 Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] FSL eSPI driver is a mess, hack attached.

2014-03-14 Thread Michael Walle
Am Freitag, 14. März 2014, 10:46:26 schrieb Joakim Tjernlund:
 The fsl_espi.c is wreck w.r.t large TX data.
 Below is what I had to hack to load a FPGA over SPI and
 what is the malloc hack good for? This does not work
 well for TXing several MB data.
 
 The driver needs to be rewritten and I do not have the
 time so I post what I got in the hope it can help someone
 else or trigger a rewrite.

although this is a bit harsh, i'm inclined to agree. last time i tried this 
driver, apart from reading from a spi flash, nothing else was working. even a 
spi unlock was broken. if you actually capture the spi pins on a scope you see 
that mostly garbage is transmitted in some cases (eg. using the raw spi 
commands on the cli). fun fact: the spi unlock actually resulted in a spi lock 
;)

i guess freescale haven't put much love into this one ;)


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


Re: [U-Boot] [PATCH 07/11] ARM: tegra: pinmux naming consistency fixes

2014-03-14 Thread Stephen Warren
On 03/14/2014 02:15 PM, Simon Glass wrote:
 Hi Stephen,
 
 On 13 March 2014 11:42, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 Clean up the naming of pinmux-related objects:
 * Refer to drive groups rather than pad groups to match the Linux kernel.
 * Ensure all pinmux API types are prefixed with pmux_, values (defines)
   are prefixed with PMUX_, and functions prefixed with pinmux_.
 * Modify a few type names to make their content clearer.
 * Minimal changes to SoC-specific .h/.c files are made so the code still
   compiles. A separate per-SoC change will be made immediately following,
   in order to keep individual patch size down.

 diff --git a/arch/arm/include/asm/arch-tegra114/pinmux.h 
 b/arch/arm/include/asm/arch-tegra114/pinmux.h

 @@ -202,10 +202,10 @@ enum pmux_pingrp {
 PINGRP_SDMMC3_CLK_LB_IN,
 PINGRP_SDMMC3_CLK_LB_OUT,
 PINGRP_RESET_OUT_N = PINGRP_SDMMC3_CLK_LB_OUT + 2,
 -   PINGRP_COUNT,
 +   PMUX_PINGRP_COUNT,
 
 It seems odd that this doesn't match the others. Why not a PMUX_
 prefix on all of them? Same comment in other cases below.

This is fixed in the per-SoC patches that follow, which replace the
contents of all the data tables with fresh content. Logically, those
patches are also part of this patch, but I split them up into a core
patch which made minimal changes to the per-SoC files, and per-SoC
patches, simply to keep the patch size down.

I'll look into your other comments when I get back on Wednesday; I have
a short trip planned:-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] mmc: Convert mmc struct's name array to a pointer

2014-03-14 Thread Marek Vasut
On Friday, March 14, 2014 at 09:55:08 PM, Simon Glass wrote:
 Hi,
 
 On 12 March 2014 04:24, Pantelis Antoniou pa...@antoniou-consulting.com 
wrote:
  Using an array is pointless; even more pointless (and scary) is using
  sprintf to fill it without a format string.
 
 This is certainly better, but how about an mmc structure init function
 which sets this up?

You mean DM's .probe() ? :-)

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


Re: [U-Boot] [PATCH 1/3] mmc: Remove ops from struct mmc and put in mmc_ops

2014-03-14 Thread Marek Vasut
On Friday, March 14, 2014 at 09:53:51 PM, Simon Glass wrote:
 Hi,
 
 On 12 March 2014 04:24, Pantelis Antoniou pa...@antoniou-consulting.com 
wrote:
  Remove the in-structure ops and put them in mmc_ops with
  a constant pointer to it.
  
  This makes the mmc structure smaller as well as conserving
  code space (in theory).
 
 You might be able to run buildman (and use -S) to check this.
 
 These changes look good to me, and will make it easier to move to
 driver model I suspect.

Full ack on the driver model part.

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


Re: [U-Boot] U-Boot doesn't silent the output

2014-03-14 Thread Simon Glass
Hi Frank,


On 4 March 2014 01:43, Frank Ihle frank.i...@hs-offenburg.de wrote:

 Hi everyone,

 I searched the Internet but the help I found didn't work. I hope someone here 
 may know how to fix it, here's the situation:

 I have this ARM9 SAM9G25 which is accessed by its ttyS0. I
  want to disable all of the output, that was made during the U-Boot (v. 
 2010.06)
 boot, to decrease the CPU's load. Therefore there is the


   setenv silent 1



 parameter, which i put into the BOOTCMD string like:



   #define CONFIG_BOOTCOMMANDsetenv silent 1; \

 bootm 


The check is done in console_init_f(), the 'f' meaning before
relocation, and thus before the environment is loaded and much before
the boot command is run. You need to put silent=1 into your built-in
environment in the board config file.

See also serial_s5p.c which uses the device tree to make the console
silent based on a device tree setting (i.e. not compiled into U-Boot).
However, I doubt your board is using device tree.




 and there is (as mentioned in the Readme.silent 
 http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=doc/README.silent;hb=v2013.10
  ) the
 #define CONFIG_SILENT_CONSOLE
 #define CONFIG_SYS_DEVICE_NULLDEV
 #define CONFIG_SILENT_CONSOLE_UPDATE_ON_SET


Maybe you need CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC?



 command, neither one is working (the lines printed out are still the same and 
 the boot time didn't change). Whereas the
  setenv varify n
 is working, just to give an example.

 Does somebody see the error ?

 BTW (I'm not sure if this is related to this) in the referenced link there is 
 the information, that u-boot sets the kernel command line to console= so 
 that in the end there will be no output for the kernel too, but that didn't 
 happen and it doesn't even happen if i force to boot Linux with console= in 
 the default Linux command line string


Do you see that in the Linux command line on boot?

If you have silent_linux=yes in U-Boot, then it will make Linux
silent. See fixup_silent_linux() for the full details.

Regards,
Simon


 Thanks for your help.
 Kind Regards,
 Frank




 ___
 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


  1   2   >