Re: [U-Boot] [PATCH v2 5/7] i2c: at91_i2c: Change error return -ENODEV to -EINVAL

2016-09-18 Thread Heiko Schocher

Hello Wenyou Yang,

Am 18.09.2016 um 08:53 schrieb Wenyou Yang:

Change the error return value -ENODEV from to -EINVAL for more
reasonable.

Signed-off-by: Wenyou Yang 
---

Changes in v2: None

  drivers/i2c/at91_i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Heiko Schocher 

bye,
Heiko


diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c
index 73f29e3..472420b 100644
--- a/drivers/i2c/at91_i2c.c
+++ b/drivers/i2c/at91_i2c.c
@@ -190,7 +190,7 @@ static int at91_i2c_enable_clk(struct udevice *dev)

clk_rate = clk_get_rate();
if (!clk_rate)
-   return -ENODEV;
+   return -EINVAL;

bus->bus_clk_rate = clk_rate;




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


Re: [U-Boot] [PATCH v2 4/7] i2c: at91_i2c: Remove unneccessary clock calling

2016-09-18 Thread Heiko Schocher

Hello Wenyou Yang,

Am 18.09.2016 um 08:53 schrieb Wenyou Yang:

Due to the peripheral clock driver improvement, remove the
unneccessary clock calling.

Signed-off-by: Wenyou Yang 
---

Changes in v2: None

  drivers/i2c/at91_i2c.c | 16 
  1 file changed, 16 deletions(-)


Reviewed-by: Heiko Schocher 

bye,
Heiko


diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c
index 8e9c3ad..73f29e3 100644
--- a/drivers/i2c/at91_i2c.c
+++ b/drivers/i2c/at91_i2c.c
@@ -176,34 +176,18 @@ static void at91_calc_i2c_clock(struct udevice *dev, int 
i2c_clk)
  static int at91_i2c_enable_clk(struct udevice *dev)
  {
struct at91_i2c_bus *bus = dev_get_priv(dev);
-   struct udevice *dev_clk;
struct clk clk;
ulong clk_rate;
-   int periph;
int ret;

ret = clk_get_by_index(dev, 0, );
if (ret)
return -EINVAL;

-   periph = fdtdec_get_uint(gd->fdt_blob, clk.dev->of_offset, "reg", -1);
-   if (periph < 0)
-   return -EINVAL;
-
-   dev_clk = dev_get_parent(clk.dev);
-   ret = clk_request(dev_clk, );
-   if (ret)
-   return ret;
-
-   clk.id = periph;
ret = clk_enable();
if (ret)
return ret;

-   ret = clk_get_by_index(dev_clk, 0, );
-   if (ret)
-   return ret;
-
clk_rate = clk_get_rate();
if (!clk_rate)
return -ENODEV;



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


Re: [U-Boot] [PATCH v2 03/17] thermal: Kconfig: Add IMX_THERMAL entry

2016-09-18 Thread Peng Fan
Hi Jagan,
On Sat, Sep 17, 2016 at 02:18:35AM +0530, Jagan Teki wrote:
>Added kconfig for IMX_THERMAL driver.
>
>Cc: Simon Glass 
>Cc: Fabio Estevam 
>Cc: Stefano Babic 
>Cc: Peng Fan 
>Cc: Matteo Lisi 
>Cc: Michael Trimarchi 
>Signed-off-by: Jagan Teki 
>---
> drivers/thermal/Kconfig | 13 +
> 1 file changed, 13 insertions(+)
>
>diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
>index 8e22ea7..f0ffbb3 100644
>--- a/drivers/thermal/Kconfig
>+++ b/drivers/thermal/Kconfig
>@@ -5,3 +5,16 @@ config DM_THERMAL
> temperature sensors to permit warnings, speed throttling or even
> automatic power-off when the temperature gets too high or low. Other
> devices may be discrete but connected on a suitable bus.
>+
>+if DM_THERMAL
>+
>+config IMX_THERMAL
>+  bool "Temperature sensor driver for Freescale i.MX SoCs"
>+  depends on MX6

MX6 and MX7.
Also I think this line could be dropped, add "selects IMX_THERMAL" in board 
Kconfig
entry.

Regards,
Peng.

>+  help
>+Support for Temperature Monitor (TEMPMON) found on Freescale i.MX 
>SoCs.
>+  It supports one critical trip point and one passive trip point.  The
>+  cpufreq is used as the cooling device to throttle CPUs when the
>+  passive trip is crossed.
>+
>+endif # if DM_THERMAL
>-- 
>2.7.4
>
>___
>U-Boot mailing list
>U-Boot@lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 02/17] serial: Kconfig: Add MXC_UART entry

2016-09-18 Thread Peng Fan
Hi Jagan,
On Sat, Sep 17, 2016 at 02:18:34AM +0530, Jagan Teki wrote:
>Added kconfig for MXC_UART driver.
>
>Cc: Simon Glass 
>Cc: Fabio Estevam 
>Cc: Stefano Babic 
>Cc: Peng Fan 
>Cc: Matteo Lisi 
>Cc: Michael Trimarchi 
>Signed-off-by: Jagan Teki 
>---
> drivers/serial/Kconfig | 7 +++
> 1 file changed, 7 insertions(+)
>
>diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>index ab5df70..9abf158 100644
>--- a/drivers/serial/Kconfig
>+++ b/drivers/serial/Kconfig
>@@ -295,6 +295,13 @@ config FSL_LPUART
> Select this to enable a Low Power UART for Freescale VF610 and
> QorIQ Layerscape devices.
> 
>+config MXC_UART
>+  bool "IMX serial port support"
>+  depends on MX6

Not only MX6. I think this line could be removed. 
Add "selects MXC_UART" in arch/arm/cpu/armv7/mx6/Kconfig or just add 
"CONFIG_MXC_UART"
in defconfig.

Regards,
Peng.

>+  help
>+If you have a machine based on a Motorola IMX CPU you
>+can enable its onboard serial port by enabling this option.
>+
> config PIC32_SERIAL
>   bool "Support for Microchip PIC32 on-chip UART"
>   depends on DM_SERIAL && MACH_PIC32
>-- 
>2.7.4
>
>___
>U-Boot mailing list
>U-Boot@lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/5] power: regulator: palmas: Add regulator support

2016-09-18 Thread Keerthy



On Monday 19 September 2016 09:21 AM, Keerthy wrote:

The driver provides regulator set/get voltage
enable/disable functions for palmas family of PMICs.

Signed-off-by: Keerthy 
Reviewed-by: Simon Glass 
---

Changes in v2:

  * Converted all dm_i2c_reg to dm_i2c_read_reg
  * Removed an instance of double blank lines.
  * Added Simon's Reviewed-by.

 drivers/power/regulator/Kconfig|   8 +
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/palmas_regulator.c | 459 +
 3 files changed, 468 insertions(+)
 create mode 100644 drivers/power/regulator/palmas_regulator.c

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 17f22dd..adb710a 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -115,3 +115,11 @@ config REGULATOR_TPS65090
regulators, one for each FET. The standard regulator interface is
supported, but it is only possible to turn the regulators on or off.
There is no voltage/current control.
+
+config DM_REGULATOR_PALMAS
+   bool "Enable driver for PALMAS PMIC regulators"
+   depends on PMIC_PALMAS
+   ---help---
+   This enables implementation of driver-model regulator uclass
+   features for REGULATOR PALMAS and the family of PALMAS PMICs.
+   The driver implements get/set api for: value and enable.
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index 1590d85..75080d4 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_REGULATOR_RK808) += rk808.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
 obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
diff --git a/drivers/power/regulator/palmas_regulator.c 
b/drivers/power/regulator/palmas_regulator.c
new file mode 100644
index 000..8212bf2
--- /dev/null
+++ b/drivers/power/regulator/palmas_regulator.c
@@ -0,0 +1,459 @@
+/*
+ * (C) Copyright 2016
+ * Texas Instruments Incorporated, 
+ *
+ * Keerthy 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#defineREGULATOR_ON0x1
+#defineREGULATOR_OFF   0x0
+
+#defineSMPS_MODE_MASK  0x3
+#defineSMPS_MODE_SHIFT 0x0
+#defineLDO_MODE_MASK   0x1
+#defineLDO_MODE_SHIFT  0x0
+
+static const char palmas_smps_ctrl[][PALMAS_SMPS_NUM] = {
+   {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c},
+   {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38},
+   {0x20, 0x24, 0x2c, 0x30, 0x38},
+};
+
+static const char palmas_smps_volt[][PALMAS_SMPS_NUM] = {
+   {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b, 0x3c},
+   {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b},
+   {0x23, 0x27, 0x2f, 0x33, 0x3B}
+};
+
+static const char palmas_ldo_ctrl[][PALMAS_LDO_NUM] = {
+   {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+   {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+   {0x50, 0x52, 0x54, 0x5e, 0x62}
+};
+
+static const char palmas_ldo_volt[][PALMAS_LDO_NUM] = {
+   {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+   {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+   {0x51, 0x53, 0x55, 0x5f, 0x63}
+};
+
+static int palmas_smps_enable(struct udevice *dev, int op, bool *enable)
+{
+   int ret;
+   uint8_t val;
+   unsigned int adr;
+   struct dm_regulator_uclass_platdata *uc_pdata;
+
+   uc_pdata = dev_get_uclass_platdata(dev);
+   adr = uc_pdata->ctrl_reg;
+
+   val = dm_i2c_reg_read(dev->parent, adr);
+   if (val < 0)
+   return val;
+
+   if (op == PMIC_OP_GET) {
+   val &= PALMAS_SMPS_STATUS_MASK;
+
+   if (val)
+   *enable = true;
+   else
+   *enable = false;
+
+   return 0;
+   } else if (op == PMIC_OP_SET) {
+   if (*enable)
+   val |= PALMAS_SMPS_MODE_MASK;
+   else
+   val &= ~(PALMAS_SMPS_MODE_MASK);
+
+   dm_i2c_write(dev->parent, adr, , 1);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+
+static int palmas_smps_volt2hex(int uV)
+{
+   if (uV > PALMAS_LDO_VOLT_MAX)
+   return -EINVAL;
+
+   if (uV > 165)
+   return (uV - 100) / 2 + 0x6;
+
+   if (uV == 50)
+   return 0x6;
+   else
+   return 0x6 + ((uV - 50) / 1);
+}
+
+static int palmas_smps_hex2volt(int hex, bool range)
+{
+   unsigned 

[U-Boot] [PATCH 5/5] imx: mx6ullevk: correct boot device macro

2016-09-18 Thread van . freenix
From: Peng Fan 

Correct boot device macro according to kconfig entry
in common/Kconfig

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
---
 board/freescale/mx6ullevk/imximage.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6ullevk/imximage.cfg 
b/board/freescale/mx6ullevk/imximage.cfg
index 4604b62..e78e839 100644
--- a/board/freescale/mx6ullevk/imximage.cfg
+++ b/board/freescale/mx6ullevk/imximage.cfg
@@ -21,9 +21,9 @@ IMAGE_VERSION 2
  * spi/sd/nand/onenand, qspi/nor
  */
 
-#ifdef CONFIG_SYS_BOOT_QSPI
+#ifdef CONFIG_QSPI_BOOT
 BOOT_FROM  qspi
-#elif defined(CONFIG_SYS_BOOT_EIMNOR)
+#elif defined(CONFIG_NOR_BOOT)
 BOOT_FROM  nor
 #else
 BOOT_FROM  sd
-- 
2.6.2

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


[U-Boot] [PATCH 2/5] imx: mx6: Add plugin support

2016-09-18 Thread van . freenix
From: Peng Fan 

Add mx6_plugin.S which calls boot rom setup function, generate the second ivt,
and jump back to boot rom.

Signed-off-by: Peng Fan 
Signed-off-by: Ye Li 
Signed-off-by: Utkarsh Gupta 
---
 arch/arm/include/asm/arch-mx6/mx6_plugin.S | 159 +
 1 file changed, 159 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6_plugin.S

diff --git a/arch/arm/include/asm/arch-mx6/mx6_plugin.S 
b/arch/arm/include/asm/arch-mx6/mx6_plugin.S
new file mode 100644
index 000..b7d1b20
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx6/mx6_plugin.S
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+#ifdef CONFIG_ROM_UNIFIED_SECTIONS
+#define ROM_API_TABLE_BASE_ADDR_LEGACY 0x180
+#define ROM_VERSION_OFFSET 0x80
+#else
+#define ROM_API_TABLE_BASE_ADDR_LEGACY 0xC0
+#define ROM_VERSION_OFFSET 0x48
+#endif
+#define ROM_API_TABLE_BASE_ADDR_MX6DQ_TO15 0xC4
+#define ROM_API_TABLE_BASE_ADDR_MX6DL_TO12 0xC4
+#define ROM_API_HWCNFG_SETUP_OFFSET0x08
+#define ROM_VERSION_TO10   0x10
+#define ROM_VERSION_TO12   0x12
+#define ROM_VERSION_TO15   0x15
+
+plugin_start:
+
+   push{r0-r4, lr}
+
+   imx6_ddr_setting
+   imx6_clock_gating
+   imx6_qos_setting
+
+/*
+ * The following is to fill in those arguments for this ROM function
+ * pu_irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data)
+ * This function is used to copy data from the storage media into DDR.
+ * start - Initial (possibly partial) image load address on entry.
+ * Final image load address on exit.
+ * bytes - Initial (possibly partial) image size on entry.
+ * Final image size on exit.
+ * boot_data - Initial @ref ivt Boot Data load address.
+ */
+   adr r0, boot_data2
+   adr r1, image_len2
+   adr r2, boot_data2
+
+#ifdef CONFIG_NOR_BOOT
+#ifdef CONFIG_MX6SX
+   ldr r3, =ROM_VERSION_OFFSET
+   ldr r4, [r3]
+   cmp r4, #ROM_VERSION_TO10
+   bgt before_calling_rom___pu_irom_hwcnfg_setup
+   ldr r3, =0x00900b00
+   ldr r4, =0x5000
+   str r4, [r3, #0x5c]
+#else
+   ldr r3, =0x00900800
+   ldr r4, =0x0800
+   str r4, [r3, #0xc0]
+#endif
+#endif
+
+/*
+ * check the _pu_irom_api_table for the address
+ */
+before_calling_rom___pu_irom_hwcnfg_setup:
+   ldr r3, =ROM_VERSION_OFFSET
+   ldr r4, [r3]
+#if defined(CONFIG_MX6SOLO) || defined(CONFIG_MX6DL)
+   ldr r3, =ROM_VERSION_TO12
+   cmp r4, r3
+   ldrge r3, =ROM_API_TABLE_BASE_ADDR_MX6DL_TO12
+   ldrlt r3, =ROM_API_TABLE_BASE_ADDR_LEGACY
+#elif defined(CONFIG_MX6Q)
+   ldr r3, =ROM_VERSION_TO15
+   cmp r4, r3
+   ldrge r3, =ROM_API_TABLE_BASE_ADDR_MX6DQ_TO15
+   ldrlt r3, =ROM_API_TABLE_BASE_ADDR_LEGACY
+#else
+   ldr r3, =ROM_API_TABLE_BASE_ADDR_LEGACY
+#endif
+   ldr r4, [r3, #ROM_API_HWCNFG_SETUP_OFFSET]
+   blx r4
+after_calling_rom___pu_irom_hwcnfg_setup:
+
+/*
+ * ROM_API_HWCNFG_SETUP function enables MMU & Caches.
+ * Thus disable MMU & Caches.
+ */
+
+   mrc p15, 0, r0, c1, c0, 0   /* read CP15 register 1 into r0*/
+   andsr0, r0, #0x1/* check if MMU is enabled */
+   beq mmu_disable_notreq  /* exit if MMU is already disabled */
+
+   /* Disable caches, MMU */
+   mrc p15, 0, r0, c1, c0, 0   /* read CP15 register 1 into r0 */
+   bic r0, r0, #(1 << 2)   /* disable D Cache */
+   bic r0, r0, #0x1/* clear bit 0 ; MMU off */
+
+   bic r0, r0, #(0x1 << 11)/* disable Z, branch prediction */
+   bic r0, r0, #(0x1 << 1) /* disable A, Strict alignment */
+   /* check enabled. */
+   mcr p15, 0, r0, c1, c0, 0   /* write CP15 register 1 */
+   mov r0, r0
+   mov r0, r0
+   mov r0, r0
+   mov r0, r0
+
+mmu_disable_notreq:
+NOP
+
+/* To return to ROM from plugin, we need to fill in these argument.
+ * Here is what need to do:
+ * Need to construct the paramters for this function before return to ROM:
+ * plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset)
+ */
+   pop {r0-r4, lr}
+   push {r5}
+   ldr r5, boot_data2
+   str r5, [r0]
+   ldr r5, image_len2
+   str r5, [r1]
+   ldr r5, second_ivt_offset
+   str r5, [r2]
+   mov r0, #1
+   pop {r5}
+
+   /* return back to ROM code */
+   bx lr
+
+/* make the following data right in the end of the output*/
+.ltorg
+
+#if (defined(CONFIG_NOR_BOOT) || defined(CONFIG_QSPI_BOOT))
+#define FLASH_OFFSET 0x1000
+#else
+#define FLASH_OFFSET 0x400
+#endif
+
+/*
+ * second_ivt_offset is the offset from the "second_ivt_header" to
+ * 

[U-Boot] [PATCH 4/5] imx: mx6ullevk: support plugin

2016-09-18 Thread van . freenix
From: Peng Fan 

Add plugin code for mx6ullevk.
Define CONFIG_USE_PLUGIN in include/configs/mx6ullevk.h to use plugin code.

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
---
 board/freescale/mx6ullevk/Makefile |   4 ++
 board/freescale/mx6ullevk/plugin.S | 139 +
 2 files changed, 143 insertions(+)
 create mode 100644 board/freescale/mx6ullevk/plugin.S

diff --git a/board/freescale/mx6ullevk/Makefile 
b/board/freescale/mx6ullevk/Makefile
index c64fba4..0ee905b 100644
--- a/board/freescale/mx6ullevk/Makefile
+++ b/board/freescale/mx6ullevk/Makefile
@@ -4,3 +4,7 @@
 #
 
 obj-y  := mx6ullevk.o
+
+extra-$(CONFIG_USE_PLUGIN) :=  plugin.bin
+$(obj)/plugin.bin: $(obj)/plugin.o
+   $(OBJCOPY) -O binary --gap-fill 0xff $< $@
diff --git a/board/freescale/mx6ullevk/plugin.S 
b/board/freescale/mx6ullevk/plugin.S
new file mode 100644
index 000..65a3c45
--- /dev/null
+++ b/board/freescale/mx6ullevk/plugin.S
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+/* DDR script */
+.macro imx6ull_ddr3_evk_setting
+   ldr r0, =IOMUXC_BASE_ADDR
+   ldr r1, =0x000C
+   str r1, [r0, #0x4B4]
+   ldr r1, =0x
+   str r1, [r0, #0x4AC]
+   ldr r1, =0x0030
+   str r1, [r0, #0x27C]
+   ldr r1, =0x0030
+   str r1, [r0, #0x250]
+   str r1, [r0, #0x24C]
+   str r1, [r0, #0x490]
+   ldr r1, =0x000C0030
+   str r1, [r0, #0x288]
+
+   ldr r1, =0x
+   str r1, [r0, #0x270]
+
+   ldr r1, =0x0030
+   str r1, [r0, #0x260]
+   str r1, [r0, #0x264]
+   str r1, [r0, #0x4A0]
+
+   ldr r1, =0x0002
+   str r1, [r0, #0x494]
+
+   ldr r1, =0x0030
+   str r1, [r0, #0x280]
+   ldr r1, =0x0030
+   str r1, [r0, #0x284]
+
+   ldr r1, =0x0002
+   str r1, [r0, #0x4B0]
+
+   ldr r1, =0x0030
+   str r1, [r0, #0x498]
+   str r1, [r0, #0x4A4]
+   str r1, [r0, #0x244]
+   str r1, [r0, #0x248]
+
+   ldr r0, =MMDC_P0_BASE_ADDR
+   ldr r1, =0x8000
+   str r1, [r0, #0x1C]
+   ldr r1, =0xA1390003
+   str r1, [r0, #0x800]
+   ldr r1, =0x0004
+   str r1, [r0, #0x80C]
+   ldr r1, =0x41640158
+   str r1, [r0, #0x83C]
+   ldr r1, =0x40403237
+   str r1, [r0, #0x848]
+   ldr r1, =0x40403C33
+   str r1, [r0, #0x850]
+   ldr r1, =0x
+   str r1, [r0, #0x81C]
+   str r1, [r0, #0x820]
+   ldr r1, =0xF333
+   str r1, [r0, #0x82C]
+   str r1, [r0, #0x830]
+   ldr r1, =0x00944009
+   str r1, [r0, #0x8C0]
+   ldr r1, =0x0800
+   str r1, [r0, #0x8B8]
+   ldr r1, =0x0002002D
+   str r1, [r0, #0x004]
+   ldr r1, =0x1B333030
+   str r1, [r0, #0x008]
+   ldr r1, =0x676B52F3
+   str r1, [r0, #0x00C]
+   ldr r1, =0xB66D0B63
+   str r1, [r0, #0x010]
+   ldr r1, =0x01FF00DB
+   str r1, [r0, #0x014]
+   ldr r1, =0x00201740
+   str r1, [r0, #0x018]
+   ldr r1, =0x8000
+   str r1, [r0, #0x01C]
+   ldr r1, =0x26D2
+   str r1, [r0, #0x02C]
+   ldr r1, =0x006B1023
+   str r1, [r0, #0x030]
+   ldr r1, =0x004F
+   str r1, [r0, #0x040]
+   ldr r1, =0x8418
+   str r1, [r0, #0x000]
+   ldr r1, =0x0040
+   str r1, [r0, #0x890]
+   ldr r1, =0x02008032
+   str r1, [r0, #0x01C]
+   ldr r1, =0x8033
+   str r1, [r0, #0x01C]
+   ldr r1, =0x00048031
+   str r1, [r0, #0x01C]
+   ldr r1, =0x15208030
+   str r1, [r0, #0x01C]
+   ldr r1, =0x04008040
+   str r1, [r0, #0x01C]
+   ldr r1, =0x0800
+   str r1, [r0, #0x020]
+   ldr r1, =0x0227
+   str r1, [r0, #0x818]
+   ldr r1, =0x0002552D
+   str r1, [r0, #0x004]
+   ldr r1, =0x00011006
+   str r1, [r0, #0x404]
+   ldr r1, =0x
+   str r1, [r0, #0x01C]
+.endm
+
+.macro imx6_clock_gating
+   ldr r0, =CCM_BASE_ADDR
+   ldr r1, =0x
+   str r1, [r0, #0x68]
+   str r1, [r0, #0x6C]
+   str r1, [r0, #0x70]
+   str r1, [r0, #0x74]
+   str r1, [r0, #0x78]
+   str r1, [r0, #0x7C]
+   str r1, [r0, #0x80]
+.endm
+
+.macro imx6_qos_setting
+.endm
+
+.macro imx6_ddr_setting
+   imx6ull_ddr3_evk_setting
+.endm
+
+/* include the common plugin code here */
+#include 
-- 
2.6.2

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


[U-Boot] [PATCH 1/5] tools: imximage: add plugin support

2016-09-18 Thread van . freenix
From: Peng Fan 

Add plugin support for imximage.
Define CONFIG_USE_PLUGIN to enable using plugin.

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
Cc: Eric Nelson 
Cc: Ye Li 
---
 tools/imximage.c | 260 ---
 tools/imximage.h |  10 ++-
 2 files changed, 218 insertions(+), 52 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 092d550..88233ac 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -27,6 +27,9 @@ static table_entry_t imximage_cmds[] = {
{CMD_CHECK_BITS_CLR,"CHECK_BITS_CLR",   "Reg Check bits clr", },
{CMD_CSF,   "CSF",   "Command Sequence File", },
{CMD_IMAGE_VERSION, "IMAGE_VERSION","image version",  },
+#ifdef CONFIG_USE_PLUGIN
+   {CMD_PLUGIN,"PLUGIN",   "file plugin_addr",  },
+#endif
{-1,"", "",   },
 };
 
@@ -80,6 +83,8 @@ static uint32_t imximage_ivt_offset = UNDEFINED;
 static uint32_t imximage_csf_size = UNDEFINED;
 /* Initial Load Region Size */
 static uint32_t imximage_init_loadsize;
+static uint32_t imximage_iram_free_start;
+static uint32_t imximage_plugin_size;
 
 static set_dcd_val_t set_dcd_val;
 static set_dcd_param_t set_dcd_param;
@@ -118,7 +123,11 @@ static uint32_t detect_imximage_version(struct imx_header 
*imx_hdr)
 
/* Try to detect V2 */
if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
-   (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+   (hdr_v2->data.dcd_table.header.tag == DCD_HEADER_TAG))
+   return IMXIMAGE_V2;
+
+   if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+   hdr_v2->boot_data.plugin)
return IMXIMAGE_V2;
 
return IMXIMAGE_VER_INVALID;
@@ -165,7 +174,7 @@ static struct dcd_v2_cmd *gd_last_cmd;
 static void set_dcd_param_v2(struct imx_header *imxhdr, uint32_t dcd_len,
int32_t cmd)
 {
-   dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
+   dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
struct dcd_v2_cmd *d = gd_last_cmd;
struct dcd_v2_cmd *d2;
int len;
@@ -261,21 +270,23 @@ static void set_dcd_rst_v1(struct imx_header *imxhdr, 
uint32_t dcd_len,
 static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len,
char *name, int lineno)
 {
-   dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
-   struct dcd_v2_cmd *d = gd_last_cmd;
-   int len;
-
-   if (!d)
-   d = _v2->dcd_cmd;
-   len = be16_to_cpu(d->write_dcd_command.length);
-   if (len > 4)
-   d = (struct dcd_v2_cmd *)(((char *)d) + len);
-
-   len = (char *)d - (char *)_v2->header;
-
-   dcd_v2->header.tag = DCD_HEADER_TAG;
-   dcd_v2->header.length = cpu_to_be16(len);
-   dcd_v2->header.version = DCD_VERSION;
+   if (!imxhdr->header.hdr_v2.boot_data.plugin) {
+   dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
+   struct dcd_v2_cmd *d = gd_last_cmd;
+   int len;
+
+   if (!d)
+   d = _v2->dcd_cmd;
+   len = be16_to_cpu(d->write_dcd_command.length);
+   if (len > 4)
+   d = (struct dcd_v2_cmd *)(((char *)d) + len);
+
+   len = (char *)d - (char *)_v2->header;
+
+   dcd_v2->header.tag = DCD_HEADER_TAG;
+   dcd_v2->header.length = cpu_to_be16(len);
+   dcd_v2->header.version = DCD_VERSION;
+   }
 }
 
 static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
@@ -317,24 +328,93 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, 
uint32_t dcd_len,
fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
fhdr_v2->header.version = IVT_VERSION; /* 0x40 */
 
-   fhdr_v2->entry = entry_point;
-   fhdr_v2->reserved1 = fhdr_v2->reserved2 = 0;
-   hdr_base = entry_point - imximage_init_loadsize +
-   flash_offset;
-   fhdr_v2->self = hdr_base;
-   if (dcd_len > 0)
-   fhdr_v2->dcd_ptr = hdr_base
-   + offsetof(imx_header_v2_t, dcd_table);
-   else
+   if (!hdr_v2->boot_data.plugin) {
+   fhdr_v2->entry = entry_point;
+   fhdr_v2->reserved1 = 0;
+   fhdr_v2->reserved1 = 0;
+   hdr_base = entry_point - imximage_init_loadsize +
+   flash_offset;
+   fhdr_v2->self = hdr_base;
+   if (dcd_len > 0)
+   fhdr_v2->dcd_ptr = hdr_base +
+   offsetof(imx_header_v2_t, data);
+   else
+   fhdr_v2->dcd_ptr = 0;
+   fhdr_v2->boot_data_ptr = hdr_base
+   + offsetof(imx_header_v2_t, boot_data);
+  

[U-Boot] [PATCH 3/5] imx: mx7: Add plugin support

2016-09-18 Thread van . freenix
From: Peng Fan 

Add mx7_plugin.S which calls boot rom setup function, generate the second ivt,
and jump back to boot rom.

Signed-off-by: Peng Fan 
Signed-off-by: Ye Li 
Cc: Stefano Babic 
---
 arch/arm/include/asm/arch-mx7/mx7_plugin.S | 111 +
 1 file changed, 111 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mx7/mx7_plugin.S

diff --git a/arch/arm/include/asm/arch-mx7/mx7_plugin.S 
b/arch/arm/include/asm/arch-mx7/mx7_plugin.S
new file mode 100644
index 000..41336b4
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx7/mx7_plugin.S
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+#define ROM_API_TABLE_BASE_ADDR_LEGACY 0x180
+#define ROM_VERSION_OFFSET 0x80
+#define ROM_API_HWCNFG_SETUP_OFFSET0x08
+
+plugin_start:
+
+   push{r0-r4, lr}
+
+   imx7_ddr_setting
+   imx7_clock_gating
+   imx7_qos_setting
+
+/*
+ * Check if we are in USB serial download mode and immediately return to ROM
+ * Need to check USB CTRL clock firstly, then check the USBx_nASYNCLISTADDR
+ */
+   ldr r0, =0x30384680
+   ldr r1, [r0]
+   cmp r1, #0
+   beq normal_boot
+
+   ldr r0, =0x30B10158
+   ldr r1, [r0]
+   cmp r1, #0
+   beq normal_boot
+
+   pop {r0-r4, lr}
+   bx lr
+
+normal_boot:
+
+/*
+ * The following is to fill in those arguments for this ROM function
+ * pu_irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data)
+ * This function is used to copy data from the storage media into DDR.
+ * start - Initial (possibly partial) image load address on entry.
+ * Final image load address on exit.
+ * bytes - Initial (possibly partial) image size on entry.
+ * Final image size on exit.
+ * boot_data - Initial @ref ivt Boot Data load address.
+ */
+   adr r0, boot_data2
+   adr r1, image_len2
+   adr r2, boot_data2
+
+/*
+ * check the _pu_irom_api_table for the address
+ */
+before_calling_rom___pu_irom_hwcnfg_setup:
+   ldr r3, =ROM_VERSION_OFFSET
+   ldr r4, [r3]
+   ldr r3, =ROM_API_TABLE_BASE_ADDR_LEGACY
+   ldr r4, [r3, #ROM_API_HWCNFG_SETUP_OFFSET]
+   blx r4
+after_calling_rom___pu_irom_hwcnfg_setup:
+
+
+/* To return to ROM from plugin, we need to fill in these argument.
+ * Here is what need to do:
+ * Need to construct the paramters for this function before return to ROM:
+ * plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset)
+ */
+   pop {r0-r4, lr}
+   push {r5}
+   ldr r5, boot_data2
+   str r5, [r0]
+   ldr r5, image_len2
+   str r5, [r1]
+   ldr r5, second_ivt_offset
+   str r5, [r2]
+   mov r0, #1
+   pop {r5}
+
+   /* return back to ROM code */
+   bx lr
+
+/* make the following data right in the end of the output*/
+.ltorg
+
+#define FLASH_OFFSET 0x400
+
+/*
+ * second_ivt_offset is the offset from the "second_ivt_header" to
+ * "image_copy_start", which involves FLASH_OFFSET, plus the first
+ * ivt_header, the plugin code size itself recorded by "ivt2_header"
+ */
+
+second_ivt_offset:  .long (ivt2_header + 0x2C + FLASH_OFFSET)
+
+/*
+ * The following is the second IVT header plus the second boot data
+ */
+ivt2_header:.long 0x0
+app2_code_jump_v:   .long 0x0
+reserv3:.long 0x0
+dcd2_ptr:   .long 0x0
+boot_data2_ptr: .long 0x0
+self_ptr2:  .long 0x0
+app_code_csf2:  .long 0x0
+reserv4:.long 0x0
+boot_data2: .long 0x0
+image_len2: .long 0x0
+plugin2:.long 0x0
-- 
2.6.2

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


[U-Boot] [PATCH v2 4/5] configs: am57xx_evm_defconfig: Enable PALMAS options

2016-09-18 Thread Keerthy
Enable palmas PMIC config options.

Signed-off-by: Keerthy 
---
 configs/am57xx_evm_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index d49129d..b277783 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -39,6 +39,9 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_PALMAS=y
+CONFIG_DM_REGULATOR_PALMAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
-- 
1.9.1

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


[U-Boot] [PATCH v2 5/5] configs: dra7xx_evm_defconfig: Enable PALMAS options

2016-09-18 Thread Keerthy
Enable palmas PMIC config options.

Signed-off-by: Keerthy 
---
 configs/dra7xx_evm_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 64184de..882e615 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -43,8 +43,11 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_DM_ETH=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_PALMAS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_PALMAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
-- 
1.9.1

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


[U-Boot] [PATCH v2 2/5] power: pmic: Palmas: Add the base pmic support

2016-09-18 Thread Keerthy
Add support to bind the regulators/child nodes with the pmic.

Signed-off-by: Keerthy 
Reviewed-by: Simon Glass 
---

Changes in v2:

  * Added Simon's Reviewed-by.

 drivers/power/pmic/Kconfig  |  7 +
 drivers/power/pmic/Makefile |  1 +
 drivers/power/pmic/palmas.c | 77 +
 include/power/palmas.h  | 25 +++
 4 files changed, 110 insertions(+)
 create mode 100644 drivers/power/pmic/palmas.c
 create mode 100644 include/power/palmas.h

diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 69f8d51..92931c5 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -135,3 +135,10 @@ config PMIC_TPS65090
FETs and a battery charger. This driver provides register access
only, and you can enable the regulator/charger drivers separately if
required.
+
+config PMIC_PALMAS
+   bool "Enable driver for Texas Instruments PALMAS PMIC"
+   depends on DM_PMIC
+   ---help---
+   The PALMAS is a PMIC containing several LDOs, SMPS.
+   This driver binds the pmic children.
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 52b4f71..828c0cf 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_PMIC_PM8916) += pm8916.o
 obj-$(CONFIG_PMIC_RK808) += rk808.o
 obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
 obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o
+obj-$(CONFIG_$(SPL_)PMIC_PALMAS) += palmas.o
 
 obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
 obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
new file mode 100644
index 000..3cef2c9
--- /dev/null
+++ b/drivers/power/pmic/palmas.c
@@ -0,0 +1,77 @@
+/*
+ * (C) Copyright 2016 Texas Instruments Incorporated, 
+ * Keerthy 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+   { .prefix = "ldo", .driver = PALMAS_LDO_DRIVER },
+   { .prefix = "smps", .driver = PALMAS_SMPS_DRIVER },
+   { },
+};
+
+static int palmas_bind(struct udevice *dev)
+{
+   int pmic_node = -1, regulators_node;
+   const void *blob = gd->fdt_blob;
+   int children;
+   int node = dev->of_offset;
+   int subnode, len;
+
+   fdt_for_each_subnode(blob, subnode, node) {
+   const char *name;
+   char *temp;
+
+   name = fdt_get_name(blob, subnode, );
+   temp = strstr(name, "pmic");
+   if (temp) {
+   pmic_node = subnode;
+   break;
+   }
+   }
+
+   if (pmic_node <= 0) {
+   printf("%s: %s pmic subnode not found!", __func__, dev->name);
+   return -ENXIO;
+   }
+
+   regulators_node = fdt_subnode_offset(blob, pmic_node, "regulators");
+
+   if (regulators_node <= 0) {
+   printf("%s: %s reg subnode not found!", __func__, dev->name);
+   return -ENXIO;
+   }
+
+   children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+   if (!children)
+   printf("%s: %s - no child found\n", __func__, dev->name);
+
+   /* Always return success for this device */
+   return 0;
+}
+
+static const struct udevice_id palmas_ids[] = {
+   { .compatible = "ti,tps659038", .data = TPS659038 },
+   { .compatible = "ti,tps65917" , .data = TPS65917 },
+   { }
+};
+
+U_BOOT_DRIVER(pmic_palmas) = {
+   .name = "palmas_pmic",
+   .id = UCLASS_PMIC,
+   .of_match = palmas_ids,
+   .bind = palmas_bind,
+};
diff --git a/include/power/palmas.h b/include/power/palmas.h
new file mode 100644
index 000..bad5a35
--- /dev/null
+++ b/include/power/palmas.h
@@ -0,0 +1,25 @@
+#definePALMAS  0x0
+#define TPS659038  0x1
+#define TPS65917   0x2
+
+/* I2C device address for pmic palmas */
+#define PALMAS_I2C_ADDR(0x12 >> 1)
+#define PALMAS_LDO_NUM 11
+#define PALMAS_SMPS_NUM8
+
+/* Drivers name */
+#define PALMAS_LDO_DRIVER "palmas_ldo"
+#define PALMAS_SMPS_DRIVER"palmas_smps"
+
+#define PALMAS_SMPS_VOLT_MASK  0x7F
+#define PALMAS_SMPS_RANGE_MASK 0x80
+#define PALMAS_SMPS_VOLT_MAX_HEX   0x7F
+#define PALMAS_SMPS_VOLT_MAX   330
+#define PALMAS_SMPS_MODE_MASK  0x3
+#definePALMAS_SMPS_STATUS_MASK 0x30
+
+#define PALMAS_LDO_VOLT_MASK0x3F
+#define PALMAS_LDO_VOLT_MAX_HEX 0x3F
+#define PALMAS_LDO_VOLT_MAX 330
+#define PALMAS_LDO_MODE_MASK   0x1
+#define PALMAS_LDO_STATUS_MASK 0x10
-- 
1.9.1

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


[U-Boot] [PATCH v2 3/5] power: regulator: palmas: Add regulator support

2016-09-18 Thread Keerthy
The driver provides regulator set/get voltage
enable/disable functions for palmas family of PMICs.

Signed-off-by: Keerthy 
Reviewed-by: Simon Glass 
---

Changes in v2:

  * Converted all dm_i2c_reg to dm_i2c_read_reg
  * Removed an instance of double blank lines.
  * Added Simon's Reviewed-by.

 drivers/power/regulator/Kconfig|   8 +
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/palmas_regulator.c | 459 +
 3 files changed, 468 insertions(+)
 create mode 100644 drivers/power/regulator/palmas_regulator.c

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 17f22dd..adb710a 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -115,3 +115,11 @@ config REGULATOR_TPS65090
regulators, one for each FET. The standard regulator interface is
supported, but it is only possible to turn the regulators on or off.
There is no voltage/current control.
+
+config DM_REGULATOR_PALMAS
+   bool "Enable driver for PALMAS PMIC regulators"
+   depends on PMIC_PALMAS
+   ---help---
+   This enables implementation of driver-model regulator uclass
+   features for REGULATOR PALMAS and the family of PALMAS PMICs.
+   The driver implements get/set api for: value and enable.
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index 1590d85..75080d4 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_REGULATOR_RK808) += rk808.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
 obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
diff --git a/drivers/power/regulator/palmas_regulator.c 
b/drivers/power/regulator/palmas_regulator.c
new file mode 100644
index 000..8212bf2
--- /dev/null
+++ b/drivers/power/regulator/palmas_regulator.c
@@ -0,0 +1,459 @@
+/*
+ * (C) Copyright 2016
+ * Texas Instruments Incorporated, 
+ *
+ * Keerthy 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#defineREGULATOR_ON0x1
+#defineREGULATOR_OFF   0x0
+
+#defineSMPS_MODE_MASK  0x3
+#defineSMPS_MODE_SHIFT 0x0
+#defineLDO_MODE_MASK   0x1
+#defineLDO_MODE_SHIFT  0x0
+
+static const char palmas_smps_ctrl[][PALMAS_SMPS_NUM] = {
+   {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c},
+   {0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38},
+   {0x20, 0x24, 0x2c, 0x30, 0x38},
+};
+
+static const char palmas_smps_volt[][PALMAS_SMPS_NUM] = {
+   {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b, 0x3c},
+   {0x23, 0x27, 0x2b, 0x2f, 0x33, 0x37, 0x3b},
+   {0x23, 0x27, 0x2f, 0x33, 0x3B}
+};
+
+static const char palmas_ldo_ctrl[][PALMAS_LDO_NUM] = {
+   {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+   {0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64},
+   {0x50, 0x52, 0x54, 0x5e, 0x62}
+};
+
+static const char palmas_ldo_volt[][PALMAS_LDO_NUM] = {
+   {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+   {0x51, 0x53, 0x55, 0x57, 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65},
+   {0x51, 0x53, 0x55, 0x5f, 0x63}
+};
+
+static int palmas_smps_enable(struct udevice *dev, int op, bool *enable)
+{
+   int ret;
+   uint8_t val;
+   unsigned int adr;
+   struct dm_regulator_uclass_platdata *uc_pdata;
+
+   uc_pdata = dev_get_uclass_platdata(dev);
+   adr = uc_pdata->ctrl_reg;
+
+   val = dm_i2c_reg_read(dev->parent, adr);
+   if (val < 0)
+   return val;
+
+   if (op == PMIC_OP_GET) {
+   val &= PALMAS_SMPS_STATUS_MASK;
+
+   if (val)
+   *enable = true;
+   else
+   *enable = false;
+
+   return 0;
+   } else if (op == PMIC_OP_SET) {
+   if (*enable)
+   val |= PALMAS_SMPS_MODE_MASK;
+   else
+   val &= ~(PALMAS_SMPS_MODE_MASK);
+
+   dm_i2c_write(dev->parent, adr, , 1);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+
+static int palmas_smps_volt2hex(int uV)
+{
+   if (uV > PALMAS_LDO_VOLT_MAX)
+   return -EINVAL;
+
+   if (uV > 165)
+   return (uV - 100) / 2 + 0x6;
+
+   if (uV == 50)
+   return 0x6;
+   else
+   return 0x6 + ((uV - 50) / 1);
+}
+
+static int palmas_smps_hex2volt(int hex, bool range)
+{
+   unsigned int uV = 0;
+
+   if (hex > PALMAS_SMPS_VOLT_MAX_HEX)
+ 

[U-Boot] [PATCH v2 1/5] power: regulator: Add ctrl_reg and volt_reg fields for pmic

2016-09-18 Thread Keerthy
The ctrl reg contains bit fields to enable and disable regulators,
and volt_reg has the bit fields to configure the voltage values.
The registers are frequently accessed hence make them part
of dm_regulator_uclass_platdata structure.

Signed-off-by: Keerthy 
---
 include/power/regulator.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/power/regulator.h b/include/power/regulator.h
index 9bcd728..57b14a3 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -171,6 +171,8 @@ struct dm_regulator_uclass_platdata {
bool boot_on;
const char *name;
int flags;
+   u8 ctrl_reg;
+   u8 volt_reg;
 };
 
 /* Regulator device operations */
-- 
1.9.1

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


[U-Boot] [PATCH v2 0/5] power: pmic: Add support for Palmas family of PMICs

2016-09-18 Thread Keerthy
The series adds support for Palmas family of PMICs.
Implements functions to configure regulators. Enable/Disable
Get/Set voltages of regulators.

Supports TPS659038, TPS65917, Palmas.

Tested on TPS659038, TPS65917 using DRA7XX-EVM and AM57XX-EVM. 

Keerthy (5):
  power: regulator: Add ctrl_reg and volt_reg fields for pmic
  power: pmic: Palmas: Add the base pmic support
  power: regulator: palmas: Add regulator support
  configs: am57xx_evm_defconfig: Enable PALMAS options
  configs: dra7xx_evm_defconfig: Enable PALMAS options

 configs/am57xx_evm_defconfig   |   3 +
 configs/dra7xx_evm_defconfig   |   3 +
 drivers/power/pmic/Kconfig |   7 +
 drivers/power/pmic/Makefile|   1 +
 drivers/power/pmic/palmas.c|  77 +
 drivers/power/regulator/Kconfig|   8 +
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/palmas_regulator.c | 459 +
 include/power/palmas.h |  25 ++
 include/power/regulator.h  |   2 +
 10 files changed, 586 insertions(+)
 create mode 100644 drivers/power/pmic/palmas.c
 create mode 100644 drivers/power/regulator/palmas_regulator.c
 create mode 100644 include/power/palmas.h

-- 
1.9.1

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


Re: [U-Boot] [PATCH 3/5] power: regulator: palmas: Add regulator support

2016-09-18 Thread Keerthy



On Monday 19 September 2016 06:28 AM, Simon Glass wrote:

On 13 September 2016 at 22:28, Keerthy  wrote:

The driver provides regulator set/get voltage
enable/disable functions for palmas family of PMICs.

Signed-off-by: Keerthy 
---
 drivers/power/regulator/Kconfig|   8 +
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/palmas_regulator.c | 460 +
 3 files changed, 469 insertions(+)
 create mode 100644 drivers/power/regulator/palmas_regulator.c


Reviewed-by: Simon Glass 

But please consider using dm_i2c_reg_read()

Also you have two blank lines at one point.


Sure i will fix them and repost.
Thanks for the review.




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


Re: [U-Boot] [PATCH 08/27] spl: Add a way to declare an SPL image loader

2016-09-18 Thread Simon Glass
Hi Tom,

On 18 September 2016 at 16:15, Tom Rini  wrote:
> On Sun, Sep 18, 2016 at 01:44:57PM -0600, Simon Glass wrote:
>> Add a linker list macro which can be used to declare an SPL image loader.
>> Update spl_load_image() to search available loaders for the correct one.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  common/spl/spl.c | 20 
>>  include/spl.h| 32 
>>  2 files changed, 52 insertions(+)
>>
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index 3716e6a..719ae6e 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -344,12 +344,32 @@ static void announce_boot_device(u32 boot_device)
>>  static inline void announce_boot_device(u32 boot_device) { }
>>  #endif
>>
>> +static struct spl_image_loader *spL_find_loader(uint boot_device)
>
> I don't like spL here, I mis-read that as a typo the second time I saw
> it.  Maybe a function comment and spl_ll_find_loader ?

Oops that was a typo. Fixed, thanks.

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


[U-Boot] Please pull u-boot-rockchip

2016-09-18 Thread Simon Glass
Hi Tom,

Here is some more RK3399 support and a few other changes.


The following changes since commit 9a6535e05f17acf03e891266a650cb6029124743:

  Merge branch 'master' of git://git.denx.de/u-boot-uniphier
(2016-09-18 14:05:30 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-rockchip.git

for you to fetch changes up to 257aec27f4e694a68c9d7569db9e0ebd05b88aa6:

  clk: rk3288: add PWM clock get rate (2016-09-18 21:05:02 -0600)


Kever Yang (14):
  rk3399: syscon: add support for pmugrf
  pinctrl: add driver for rk3399
  config: evb-rk3399: enable pinctrl driver
  rk3399: enable the pwm2/3 pinctrl in board init
  dts: rk3399: add pinctrl for sdmmc
  rk_pwm: use clock framework API to get module clock
  rk_pwm: remove grf setting code from driver
  rk3288: add arch_cpu_init for rk3288
  dts: rk3399-evb: add regulator-fixed for usb host vbus
  board: evb-rk3399: enable usb 2.0 host vbus power on board_init
  config: evb-rk3399: enable fixed regulator
  rk3399: add a empty "sys_proto.h" header file
  clk: rk3399: add pmucru controller support
  clk: rk3288: add PWM clock get rate

MengDongyang (4):
  usb: xhci-rockchip: add rockchip dwc3 controller driver
  rockchip: select DM_USB for rockchip SoC
  config: rk3399: add usb related configs
  dts: rk3399: add dwc3_typec node for rk3399

Xu Ziyuan (2):
  rockchip: use dummy byte only enable OF_PLATDATA
  rockchip: rk3288: skip lowlevel_init process

 arch/arm/Kconfig|   1 +
 arch/arm/dts/rk3399-evb.dts |  14 ++
 arch/arm/dts/rk3399.dtsi|  82 
 arch/arm/include/asm/arch-rockchip/clock.h  |   1 +
 arch/arm/include/asm/arch-rockchip/grf_rk3399.h | 321

 arch/arm/include/asm/arch-rockchip/sdram.h  |   4 +
 arch/arm/include/asm/arch-rockchip/sys_proto.h  |  10 ++
 arch/arm/mach-rockchip/board.c  |   4 -
 arch/arm/mach-rockchip/rk3288-board-spl.c   |   4 -
 arch/arm/mach-rockchip/rk3288/Makefile  |   1 +
 arch/arm/mach-rockchip/rk3288/rk3288.c  |  19 +++
 arch/arm/mach-rockchip/rk3399/syscon_rk3399.c   |   1 +
 board/rockchip/evb_rk3399/evb-rk3399.c  |  44 ++-
 configs/evb-rk3399_defconfig|  11 ++
 drivers/clk/rockchip/clk_rk3288.c   |   2 +
 drivers/clk/rockchip/clk_rk3399.c   | 177 -
 drivers/pinctrl/Kconfig |   9 ++
 drivers/pinctrl/rockchip/Makefile   |   1 +
 drivers/pinctrl/rockchip/pinctrl_rk3399.c   | 439
+
 drivers/pwm/rk_pwm.c|  26 ++--
 drivers/usb/host/Makefile   |   1 +
 drivers/usb/host/xhci-rockchip.c| 211
+
 include/configs/rk3288_common.h |   1 +
 include/configs/rk3399_common.h |  13 ++
 include/linux/usb/dwc3.h|  14 ++
 25 files changed, 1385 insertions(+), 26 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3399.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sys_proto.h
 create mode 100644 arch/arm/mach-rockchip/rk3288/rk3288.c
 create mode 100644 drivers/pinctrl/rockchip/pinctrl_rk3399.c
 create mode 100644 drivers/usb/host/xhci-rockchip.c

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


[U-Boot] Please pull u-boot-dm

2016-09-18 Thread Simon Glass
Hi Tom,

This includes some refactoring to improve the dtoc code.


The following changes since commit 9a6535e05f17acf03e891266a650cb6029124743:

  Merge branch 'master' of git://git.denx.de/u-boot-uniphier
(2016-09-18 14:05:30 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-dm.git

for you to fetch changes up to 8f224b3734d042884a8981a14db64c48e87b87a2:

  dtoc: Add methods for reading data from properties (2016-09-18 21:04:39 -0600)


Simon Glass (19):
  patman: Adjust command.Output() to raise an error by default
  dtoc: Move the struct import into the correct order
  dtoc: Move the fdt library selection into fdt_select
  dtoc: Rename fdt.py to fdt_normal.py
  dtoc: Create a base class for Fdt
  dtoc: Move BytesToValue() and GetEmpty() into PropBase
  dtoc: Move Widen() and GetPhandle() into the base class
  dtoc: Move a few more common functions into fdt.py
  patman: Add a tools library for using temporary files
  patman: Add a library to handle logging and progress
  dtoc: Allow the device tree to be compiled from source
  dtoc: Drop the convert_dash parameter to GetProps()
  dtoc: Prepare for supporting changing of device trees
  dtoc: Move to using bytearray
  dtoc: Support deleting device tree properties
  dtoc: Support packing the device tree
  dtoc: Support finding the offset of a property
  dtoc: Correct quotes in fdt_util
  dtoc: Add methods for reading data from properties

Stefan Brüns (2):
  sandbox: document support of block device emulation
  sandbox: Add "host size" hostfs command for fs test

 board/sandbox/README.sandbox |  19 +++
 cmd/host.c   |   8 +++
 lib/libfdt/libfdt.swig   |  24 +
 tools/buildman/control.py|   2 +-
 tools/dtoc/dtoc.py   |  38 +-
 tools/dtoc/fdt.py| 219
+---
 tools/dtoc/fdt_fallback.py   | 138
+++-
 tools/dtoc/fdt_normal.py | 228

 tools/dtoc/fdt_select.py |  26 ++
 tools/dtoc/fdt_util.py   | 126 ++--
 tools/patman/checkpatch.py   |   3 +-
 tools/patman/command.py  |   5 +-
 tools/patman/gitutil.py  |   3 +-
 tools/patman/tools.py| 120 ++
 tools/patman/tout.py | 166
++
 15 files changed, 882 insertions(+), 243 deletions(-)
 create mode 100644 tools/dtoc/fdt_normal.py
 create mode 100644 tools/dtoc/fdt_select.py
 create mode 100644 tools/patman/tools.py
 create mode 100644 tools/patman/tout.py

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


Re: [U-Boot] [PATCH 02/21] mmc: tegra: use correct alias for SDHCI/MMC nodes

2016-09-18 Thread Jaehoon Chung
On 09/14/2016 01:45 AM, Stephen Warren wrote:
> From: Stephen Warren 
> 
> The Tegra MMC driver currently honors "sdhci" entries in /aliases. The
> MMC core however uses "mmc" entries in /aliases. This difference will be
> relevant once the Tegra MMC driver is converted to DM, and the MMC core
> handles alias lookups. To avoid issues during that conversion, fix the
> Tegra MMC driver and all Tegra DTs to use the same alias name as the MMC
> core does.
> 
> Cc: Jaehoon Chung 
> Signed-off-by: Stephen Warren 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
>  arch/arm/dts/tegra114-dalmore.dts |  4 ++--
>  arch/arm/dts/tegra124-cei-tk1-som.dts |  4 ++--
>  arch/arm/dts/tegra124-jetson-tk1.dts  |  4 ++--
>  arch/arm/dts/tegra124-nyan-big.dts|  4 ++--
>  arch/arm/dts/tegra124-venice2.dts |  4 ++--
>  arch/arm/dts/tegra186-p2771-.dtsi |  4 ++--
>  arch/arm/dts/tegra20-colibri.dts  |  2 +-
>  arch/arm/dts/tegra20-harmony.dts  |  4 ++--
>  arch/arm/dts/tegra20-medcom-wide.dts  |  2 +-
>  arch/arm/dts/tegra20-paz00.dts|  4 ++--
>  arch/arm/dts/tegra20-plutux.dts   |  2 +-
>  arch/arm/dts/tegra20-seaboard.dts |  4 ++--
>  arch/arm/dts/tegra20-tec.dts  |  2 +-
>  arch/arm/dts/tegra20-trimslice.dts|  4 ++--
>  arch/arm/dts/tegra20-ventana.dts  |  4 ++--
>  arch/arm/dts/tegra20-whistler.dts |  4 ++--
>  arch/arm/dts/tegra210-e2220-1170.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2371-.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2371-2180.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2571.dts   |  4 ++--
>  arch/arm/dts/tegra30-apalis.dts   |  6 +++---
>  arch/arm/dts/tegra30-beaver.dts   |  4 ++--
>  arch/arm/dts/tegra30-cardhu.dts   |  4 ++--
>  arch/arm/dts/tegra30-colibri.dts  |  4 ++--
>  arch/arm/dts/tegra30-tamonten.dtsi|  6 +++---
>  drivers/mmc/tegra_mmc.c   | 10 +-
>  26 files changed, 53 insertions(+), 53 deletions(-)
> 
> diff --git a/arch/arm/dts/tegra114-dalmore.dts 
> b/arch/arm/dts/tegra114-dalmore.dts
> index f0331a740178..9325149cba6f 100644
> --- a/arch/arm/dts/tegra114-dalmore.dts
> +++ b/arch/arm/dts/tegra114-dalmore.dts
> @@ -16,8 +16,8 @@
>   i2c2 = "/i2c@7000c400";
>   i2c3 = "/i2c@7000c500";
>   i2c4 = "/i2c@7000c700";
> - sdhci0 = "/sdhci@78000600";
> - sdhci1 = "/sdhci@78000400";
> + mmc0 = "/sdhci@78000600";
> + mmc1 = "/sdhci@78000400";
>   usb0 = "/usb@7d00";
>   usb1 = "/usb@7d008000";
>   };
> diff --git a/arch/arm/dts/tegra124-cei-tk1-som.dts 
> b/arch/arm/dts/tegra124-cei-tk1-som.dts
> index d22c0cabec7a..c4d4f9d89f12 100644
> --- a/arch/arm/dts/tegra124-cei-tk1-som.dts
> +++ b/arch/arm/dts/tegra124-cei-tk1-som.dts
> @@ -16,8 +16,8 @@
>   i2c2 = "/i2c@7000c400";
>   i2c3 = "/i2c@7000c500";
>   i2c4 = "/i2c@7000c700";
> - sdhci0 = "/sdhci@700b0600";
> - sdhci1 = "/sdhci@700b0400";
> + mmc0 = "/sdhci@700b0600";
> + mmc1 = "/sdhci@700b0400";
>   spi0 = "/spi@7000d400";
>   spi1 = "/spi@7000da00";
>   usb0 = "/usb@7d00";
> diff --git a/arch/arm/dts/tegra124-jetson-tk1.dts 
> b/arch/arm/dts/tegra124-jetson-tk1.dts
> index 4a63b6d86160..f1db952355b8 100644
> --- a/arch/arm/dts/tegra124-jetson-tk1.dts
> +++ b/arch/arm/dts/tegra124-jetson-tk1.dts
> @@ -16,8 +16,8 @@
>   i2c2 = "/i2c@7000c400";
>   i2c3 = "/i2c@7000c500";
>   i2c4 = "/i2c@7000c700";
> - sdhci0 = "/sdhci@700b0600";
> - sdhci1 = "/sdhci@700b0400";
> + mmc0 = "/sdhci@700b0600";
> + mmc1 = "/sdhci@700b0400";
>   spi0 = "/spi@7000d400";
>   spi1 = "/spi@7000da00";
>   usb0 = "/usb@7d00";
> diff --git a/arch/arm/dts/tegra124-nyan-big.dts 
> b/arch/arm/dts/tegra124-nyan-big.dts
> index 20e0be30e980..a0f1d09bee58 100644
> --- a/arch/arm/dts/tegra124-nyan-big.dts
> +++ b/arch/arm/dts/tegra124-nyan-big.dts
> @@ -17,8 +17,8 @@
>   i2c5 = "/i2c@7000d100";
>   rtc0 = "/i2c@0,7000d000/pmic@40";
>   rtc1 = "/rtc@0,7000e000";
> - sdhci0 = "/sdhci@700b0600";
> - sdhci1 = "/sdhci@700b0400";
> + mmc0 = "/sdhci@700b0600";
> + mmc1 = "/sdhci@700b0400";
>   spi0 = "/spi@7000d400";
>   spi1 = "/spi@7000da00";
>   usb0 = "/usb@7d00";
> diff --git a/arch/arm/dts/tegra124-venice2.dts 
> b/arch/arm/dts/tegra124-venice2.dts
> index 6c39563bfc64..add9244e6874 100644
> --- a/arch/arm/dts/tegra124-venice2.dts
> +++ b/arch/arm/dts/tegra124-venice2.dts
> @@ -17,8 +17,8 @@
>   i2c3 = "/i2c@7000c500";
>   i2c4 = "/i2c@7000c700";
>   i2c5 = 

[U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request

2016-09-18 Thread Ziyuan Xu
From: "jacob2.chen" 

When DTO interrupt occurred, there are any remaining data still in FIFO
due to RX FIFO threshold is larger than remaining data. It also
causes that dwmmc didn't trigger RXDR interrupt, so is TX.

It's responsibility of driver to read remaining bytes on seeing DTO
interrupt.

Signed-off-by: jacob2.chen 
Signed-off-by: Ziyuan Xu 
---

 drivers/mmc/dw_mmc.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index afc674d..074f86c 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, 
struct mmc_data *data)
 
if (host->fifo_mode && size) {
len = 0;
-   if (data->flags == MMC_DATA_READ) {
-   if ((dwmci_readl(host, DWMCI_RINTSTS) &
-DWMCI_INTMSK_RXDR)) {
+   if (data->flags == MMC_DATA_READ &&
+   (mask & DWMCI_INTMSK_RXDR)) {
+   while (size) {
len = dwmci_readl(host, DWMCI_STATUS);
len = (len >> DWMCI_FIFO_SHIFT) &
DWMCI_FIFO_MASK;
@@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, 
struct mmc_data *data)
for (i = 0; i < len; i++)
*buf++ =
dwmci_readl(host, DWMCI_DATA);
-   dwmci_writel(host, DWMCI_RINTSTS,
-DWMCI_INTMSK_RXDR);
+   size = size > len ? (size - len) : 0;
}
-   } else {
-   if ((dwmci_readl(host, DWMCI_RINTSTS) &
-DWMCI_INTMSK_TXDR)) {
+   dwmci_writel(host, DWMCI_RINTSTS,
+DWMCI_INTMSK_RXDR);
+   } else if (data->flags == MMC_DATA_WRITE &&
+  (mask & DWMCI_INTMSK_TXDR)) {
+   while (size) {
len = dwmci_readl(host, DWMCI_STATUS);
len = fifo_depth - ((len >>
   DWMCI_FIFO_SHIFT) &
@@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, 
struct mmc_data *data)
for (i = 0; i < len; i++)
dwmci_writel(host, DWMCI_DATA,
 *buf++);
-   dwmci_writel(host, DWMCI_RINTSTS,
-DWMCI_INTMSK_TXDR);
+   size = size > len ? (size - len) : 0;
}
+   dwmci_writel(host, DWMCI_RINTSTS,
+DWMCI_INTMSK_TXDR);
}
-   size = size > len ? (size - len) : 0;
}
 
/* Data arrived correctly. */
-- 
2.9.2


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


Re: [U-Boot] [PATCH v1 2/3] arm: mvebu: add DB-88F6820-AMC board

2016-09-18 Thread Chris Packham
On Mon, Sep 19, 2016 at 12:58 PM, Simon Glass  wrote:
> Hi Chris,
>
> On 13 September 2016 at 19:42, Chris Packham  wrote:
>> This board is a plug in card for Marvell's switch system development
>> kits. Form-factor aside it is similar to the DB-88F6820-GP with the
>> following differences.
>> - TCLK is 200MHz
>> - SPI1 is used
>> - No SATA
>> - No MMC
>> - NAND flash
>>
>> Signed-off-by: Chris Packham 
>> ---
>> I've used my work email address for the MAINTAINERS entry. Mainly
>> because it gives a better chance at finding someone else to contact
>> rather than a random gmail address.
>>
>> I've also left the copyright assignments to Stefan and Gregory since the
>> code was derived from the -GP board.
>>
>>  arch/arm/dts/Makefile |   1 +
>>  arch/arm/dts/armada-385-amc.dts   | 155 
>> ++
>>  arch/arm/mach-mvebu/Kconfig   |   7 ++
>>  board/Marvell/db-88f6820-amc/MAINTAINERS  |   6 +
>>  board/Marvell/db-88f6820-amc/Makefile |   7 ++
>>  board/Marvell/db-88f6820-amc/db-88f6820-amc.c | 129 +
>>  board/Marvell/db-88f6820-amc/kwbimage.cfg |  12 ++
>>  configs/db-88f6820-amc_defconfig  |  38 +++
>>  include/configs/db-88f6820-amc.h  | 130 +
>>  9 files changed, 485 insertions(+)
>>  create mode 100644 arch/arm/dts/armada-385-amc.dts
>>  create mode 100644 board/Marvell/db-88f6820-amc/MAINTAINERS
>>  create mode 100644 board/Marvell/db-88f6820-amc/Makefile
>>  create mode 100644 board/Marvell/db-88f6820-amc/db-88f6820-amc.c
>>  create mode 100644 board/Marvell/db-88f6820-amc/kwbimage.cfg
>>  create mode 100644 configs/db-88f6820-amc_defconfig
>>  create mode 100644 include/configs/db-88f6820-amc.h
>
> The SPL_xxx_SUPPORT options have now moved to Kconfig, but other than that:
>
> Reviewed-by: Simon Glass 
>

Hi Simon,

Thanks for the review.  I've moved the SPL_*_SUPPORT to the defconfig
locally, I'll wait to see if there are any other comments before
sending a v2.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] kconfig: introduce kconfig for UBI

2016-09-18 Thread Simon Glass
On 13 September 2016 at 23:03, Heiko Schocher  wrote:
> move the UBI config options into Kconfig.
>
> Signed-off-by: Heiko Schocher 
> ---
> Tested with tbot:
> http://lists.denx.de/pipermail/u-boot/2016-June/258119.html
>
> result:
> Boards  : 1196
> compile err : 36
> not checked : 0
> U-Boot good : 1157 bad 3
> SPL good: 427 bad 0
> ('compile err :', [...]
> ('bad :', ['sandbox', 'sandbox_noblk', 'sandbox_spl'])
>
> I have 36 boards, which do not compile, at least with my
> toolchains used, see:
> https://github.com/hsdenx/tbot/blob/master/config/tbot_uboot_kconfig_check.cfg#L68
> but none of them had UBI support, so this should be OK.

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


Re: [U-Boot] [PATCH 00/27] spl: Use linker list and parameters for SPL image loading

2016-09-18 Thread Simon Glass
Hi Tom,

On 18 September 2016 at 16:14, Tom Rini  wrote:
> On Sun, Sep 18, 2016 at 01:44:49PM -0600, Simon Glass wrote:
>
>> At present the SPL code uses a global spl_image variable which is shared
>> amongst lots of files, some in common/spl and some elsewhere. There is no
>> need for this to be global, and in fact a parameter makes it easier to
>> understand what information the functions act on. It also reduces the BSS
>> use in the SPL (at the expense of stack) which is useful on boards which
>> don't have BSS available early on.
>
> Thanks for taking a stab at cleaning this up.

I ran into it with the 64-bit x86 stuff and decided to take a detour :-)

>
> [snip]
>> There is a priorty value attached to each loader which should allow the
>> existing ordering to be maintained.
>
> I worry here about some of the corner cases, but it's probably no more
> or less fragile than currently at least.  I'm actually not sure how
> that's working in this version of the series, everyone gets priority 0
> filled in so it seems like we're on linker order.  But I'm also not
> convinced that it's a problem here.  As far as I can recall, the use
> cases are that a given binary will support say NAND and MMC, and at run
> time knows that it came from NAND or MMC, and thus we need to look at
> the same device for U-Boot itself.  So order doesn't matter there.  So
> we can just drop that part I think.

I see in the code that if Ubifs is enabled, it uses that instead of
NAND and ONENAND. There is another case too - SPI might have a
board-specific loader which takes precedence (although I suspect in
the sunxi case the generic loader is not present).

If these are not needed then we can drop it.

At present priority is handled by adding the priority value into the
linker list element name. Since they are sorted in order within the
image, this gives the required result.

>
>> Code size is about 20 bytes larger on average which I think is acceptable.
>> The BSS size drops by about 64 bytes, but really this just transfers to
>> the stack.
>
> How about the worst case growths in what we have today?

Ah well that's something buildman cannot tell me! There is a small
overhead for the lookup code (about 20-30 bytes) and 8-12 bytes for
each loader method. Here's the buildman summary.

$ buildman -b spl -s --step 0 -S
boards.cfg is up to date. Nothing to do.
Summary of 2 commits for 1196 boards (32 threads, 1 job per thread)
01: Makefile: Give a build error if ad-hoc CONFIG options are added
  blackfin:  +   cm-bf527 bf609-ezkit bf537-stamp
 sparc:  +   grsim grsim_leon2 gr_cpci_ax2000 gr_xc3s_1500 gr_ep2s60
 nios2:  +   10m50 3c120
microblaze:  +   microblaze-generic
  openrisc:  +   openrisc-generic
28: spl: Make spl_boot_list a local variable
   aarch64: (for 51/51 boards)  spl/u-boot-spl:all +36.8
spl/u-boot-spl:bss -6.3  spl/u-boot-spl:data +5.6
spl/u-boot-spl:rodata +7.5  spl/u-boot-spl:text +29.9
   powerpc: (for 415/415 boards)  spl/u-boot-spl:all -24.7
spl/u-boot-spl:bss -0.1  spl/u-boot-spl:data -0.1
spl/u-boot-spl:rodata -15.9  spl/u-boot-spl:text -8.6
   sandbox: (for 3/3 boards)  spl/u-boot-spl:all +37.3
spl/u-boot-spl:bss -10.7  spl/u-boot-spl:rodata +10.7
spl/u-boot-spl:text +37.3
   arm: (for 552/552 boards)  all -0.8  bss -0.8  data -0.1
spl/u-boot-spl:all -66.3  spl/u-boot-spl:bss -22.3
spl/u-boot-spl:data -5.1  spl/u-boot-spl:rodata +0.5
spl/u-boot-spl:text -39.3

>
>> There is an obvious follow-on from this, to move boot_name_table[] into the
>> same linker list struct (i.e. add a name field to struct spl_image_loader).
>> The complication here is that we don't want naming if
>> CONFIG_SPL_LIBCOMMON_SUPPORT is not enabled, since it bloats the code. In
>> addition I think that common/spl/spl.c can be tidied up a little.
>
> Yeah, I worry about size growth in doing that too.  But maybe we can be
> a little clever when declaring the ll and just not have the strings if
> !LIBCOMMON ?

Yes I think so...perhaps someone else might take a look, or I'll wait
for a rainy day!

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


Re: [U-Boot] [PATCH v2] power: regulator: Add support for gpio regulators

2016-09-18 Thread Simon Glass
On 15 September 2016 at 05:34, Keerthy  wrote:
> Add support for gpio regulators. As of now this driver caters
> to gpio regulators with one gpio. Supports setting voltage values to gpio
> regulators and retrieving the values.
>
> Signed-off-by: Keerthy 
> ---
>
> Changes in v2:
>
>   * Added states and voltages as part of plat data to have
> a generic state to voltage mapping removing any assumptions.
>
>  drivers/power/regulator/Kconfig  |   8 ++
>  drivers/power/regulator/Makefile |   1 +
>  drivers/power/regulator/gpio-regulator.c | 137 
> +++
>  include/power/regulator.h|   1 +
>  4 files changed, 147 insertions(+)
>  create mode 100644 drivers/power/regulator/gpio-regulator.c

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


Re: [U-Boot] [PATCH 3/3] ARM: tegra: fix ULPI PHY on Ventana and Seaboard

2016-09-18 Thread Simon Glass
On 15 September 2016 at 12:19, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Commit ce02a71c2374 "tegra: dts: Sync tegra20 device tree files with
> Linux" enabled the ULPI USB port on Ventana, but made no attempt to ensure
> that U-Boot code could handle this. In practice, various code is missing,
> and various configuration options are not enabled, which causes U-Boot to
> hang when attempting to initialize this USB port. This patch enables ULPI
> PHY support on Ventana, and adds the required pinmux setup for the port to
> operate. Note that Ventana is so similar to Seaboard that this change is
> made in the Seaboard board file, which is shared with Ventana.
>
> Seaboard also has the ULPI USB port wired up in hardware, although to an
> internal port that often doesn't have anything attached to it. However,
> the DT nodes for the USB controller and PHY had different status property
> values, so the port was not initialized by U-Boot. Fix this inconsistency,
> and enable the ULPI port, just like in the Linux kernel DT. This likewise
> requires enabling ULPI support in the Seaboard defconfig.
>
> Cc: Marcel Ziswiler 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra20-seaboard.dts | 2 +-
>  board/nvidia/seaboard/seaboard.c  | 8 +++-
>  configs/seaboard_defconfig| 2 ++
>  configs/ventana_defconfig | 2 ++
>  4 files changed, 12 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH] image: Fix expected return value

2016-09-18 Thread Simon Glass
On 16 September 2016 at 06:34, Mario Six  wrote:
> Commit bac17b7 ("image-fit: switch ENOLINK to ENOENT") changed the
> return value of fit_get_node_from_config from ENOLINK to ENOENT.
>
> This causes a problem in boot_get_ramdisk, which treats the return value
> -ENOLINK differently from other errors (namely, it does not signal a
> failure if -ENOLINK is returned). As a result, booting a FIT image on
> the Armada platform (and possibly others) fails with a "Ramdisk image is
> corrupt or invalid" message, rendering FIT images unusable.
>
> This patch fixes the error by changing the "special" return value in
> boot_get_ramdisk from -ENOLINK to -ENOENT, so that the original behavior
> is restored.
>
> Reviewed-by: Jonathan Gray 
> Signed-off-by: Mario Six 
> ---
>  common/image.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] power: regulator: palmas: Add regulator support

2016-09-18 Thread Simon Glass
On 13 September 2016 at 22:28, Keerthy  wrote:
> The driver provides regulator set/get voltage
> enable/disable functions for palmas family of PMICs.
>
> Signed-off-by: Keerthy 
> ---
>  drivers/power/regulator/Kconfig|   8 +
>  drivers/power/regulator/Makefile   |   1 +
>  drivers/power/regulator/palmas_regulator.c | 460 
> +
>  3 files changed, 469 insertions(+)
>  create mode 100644 drivers/power/regulator/palmas_regulator.c

Reviewed-by: Simon Glass 

But please consider using dm_i2c_reg_read()

Also you have two blank lines at one point.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] ARM: tegra: fix USB controller aliases

2016-09-18 Thread Simon Glass
On 15 September 2016 at 12:19, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Some boards have a different set of USB controllers enabled in DT than
> the set referenced by /alias entries. This patch fixes that. For
> example, this avoids the following message while booting on Ventana,
> which is caused by the fact that the USB0 controller had no alias, and
> defaulted to wanting a sequence number of 0, which was later explicitly
> requested by the alias for USB controller 2.
>
> USB2:   Device 'usb@c5008000': seq 0 is in use by 'usb@c500'
>
> This didn't affect USB operation in any way though.
>
> Related, there's no need for the USB controller aliases to have an order
> that's different from the HW order, so re-order any aliases to match the
> HW ordering. This has the benefit that since USB controller 0 is the only
> one that supports device-mode in HW, and U-Boot only supports enabling
> device move on controller 0, there's now good synergy in the ordering! For
> Tegra20, that's not relevant at present since USB device mode doesn't work
> correctly on that SoC, but it will save some head-scratching later.
>
> This patch doesn't fix the colibri_t20 board, even though it has the same
> issue, since Marcel already sent a patch for that.
>
> Cc: Marcel Ziswiler 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra20-harmony.dts   | 3 ++-
>  arch/arm/dts/tegra20-seaboard.dts  | 5 +++--
>  arch/arm/dts/tegra20-trimslice.dts | 3 +--
>  arch/arm/dts/tegra20-ventana.dts   | 4 +++-
>  4 files changed, 9 insertions(+), 6 deletions(-)

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


Re: [U-Boot] [PATCH 1/3] ARM: tegra: fix USB ULPI PHY reset signal inversion confusion

2016-09-18 Thread Simon Glass
On 15 September 2016 at 12:19, Stephen Warren  wrote:
> From: Stephen Warren 
>
> USB ULPI PHY reset signals are typically active low. Consequently, they
> should be marked as GPIO_ACTIVE_LOW in device tree, and indeed they are in
> the Linux kernel DTs, and in DT properties that U-Boot doesn't yet use.
> However, in DT properties that U-Boot does use, the value has been set to
> 0 (== GPIO_ACTIVE_HIGH) to work around a bug in U-Boot.
>
> This change fixes the DT to correctly represent the HW, and fixes the
> Tegra USB driver to cope with the fact that dm_gpio_set_value() internally
> handles any inversions implied by the DT value GPIO_ACTIVE_LOW.
>
> Cc: Marcel Ziswiler 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra20-colibri.dts |  3 ++-
>  arch/arm/dts/tegra20-harmony.dts |  3 ++-
>  drivers/usb/host/ehci-tegra.c| 13 +++--
>  3 files changed, 15 insertions(+), 4 deletions(-)

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


Re: [U-Boot] [PATCH] Revert "Increase default of CONFIG_SYS_MALLOC_F_LEN for SPL_OF_CONTROL"

2016-09-18 Thread Simon Glass
On 15 September 2016 at 05:12, Masahiro Yamada
 wrote:
> This reverts commit 90c08d9e08c7a108ab904f3bbdeb558081757892.
>
> I took a closer look at this and found CONFIG_SYS_MALLOC_F_LEN=0x2000
> was too much to enable SPL_OF_CONTROL.  Perhaps 0x800 is enough, but
> the situation varies board by board.
>
> Postpone the decision until we come up with a good idea.
>
> Signed-off-by: Masahiro Yamada 
> ---

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


Re: [U-Boot] [PATCH 2/5] power: pmic: Palmas: Add the base pmic support

2016-09-18 Thread Simon Glass
On 13 September 2016 at 22:28, Keerthy  wrote:
> Add support to bind the regulators/child nodes with the pmic.
>
> Signed-off-by: Keerthy 
> ---
>  drivers/power/pmic/Kconfig  |  7 +
>  drivers/power/pmic/Makefile |  1 +
>  drivers/power/pmic/palmas.c | 77 
> +
>  include/power/palmas.h  | 25 +++
>  4 files changed, 110 insertions(+)
>  create mode 100644 drivers/power/pmic/palmas.c
>  create mode 100644 include/power/palmas.h

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


Re: [U-Boot] [PATCH v1 2/3] arm: mvebu: add DB-88F6820-AMC board

2016-09-18 Thread Simon Glass
Hi Chris,

On 13 September 2016 at 19:42, Chris Packham  wrote:
> This board is a plug in card for Marvell's switch system development
> kits. Form-factor aside it is similar to the DB-88F6820-GP with the
> following differences.
> - TCLK is 200MHz
> - SPI1 is used
> - No SATA
> - No MMC
> - NAND flash
>
> Signed-off-by: Chris Packham 
> ---
> I've used my work email address for the MAINTAINERS entry. Mainly
> because it gives a better chance at finding someone else to contact
> rather than a random gmail address.
>
> I've also left the copyright assignments to Stefan and Gregory since the
> code was derived from the -GP board.
>
>  arch/arm/dts/Makefile |   1 +
>  arch/arm/dts/armada-385-amc.dts   | 155 
> ++
>  arch/arm/mach-mvebu/Kconfig   |   7 ++
>  board/Marvell/db-88f6820-amc/MAINTAINERS  |   6 +
>  board/Marvell/db-88f6820-amc/Makefile |   7 ++
>  board/Marvell/db-88f6820-amc/db-88f6820-amc.c | 129 +
>  board/Marvell/db-88f6820-amc/kwbimage.cfg |  12 ++
>  configs/db-88f6820-amc_defconfig  |  38 +++
>  include/configs/db-88f6820-amc.h  | 130 +
>  9 files changed, 485 insertions(+)
>  create mode 100644 arch/arm/dts/armada-385-amc.dts
>  create mode 100644 board/Marvell/db-88f6820-amc/MAINTAINERS
>  create mode 100644 board/Marvell/db-88f6820-amc/Makefile
>  create mode 100644 board/Marvell/db-88f6820-amc/db-88f6820-amc.c
>  create mode 100644 board/Marvell/db-88f6820-amc/kwbimage.cfg
>  create mode 100644 configs/db-88f6820-amc_defconfig
>  create mode 100644 include/configs/db-88f6820-amc.h

The SPL_xxx_SUPPORT options have now moved to Kconfig, but other than that:

Reviewed-by: Simon Glass 

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


Re: [U-Boot] [PATCH 01/21] ARM: tegra: fdt: Add 'non-removable' property to all eMMC nodes

2016-09-18 Thread Simon Glass
On 13 September 2016 at 10:45, Stephen Warren  wrote:
> From: Tom Warren 
>
> During debug of the DM_MMC changes to the Tegra MMC driver, I
> noticed that the 'removable' property wasn't being set correctly
> for the eMMC parts on most Tegra boards. Since the kernel DTS has
> this property set correctly, it should be in U-Boot's Tegra DT too.
>
> Signed-off-by: Tom Warren 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra114-dalmore.dts | 1 +
>  arch/arm/dts/tegra124-jetson-tk1.dts  | 1 +
>  arch/arm/dts/tegra124-venice2.dts | 1 +
>  arch/arm/dts/tegra186-p2771-.dtsi | 1 +
>  arch/arm/dts/tegra20-paz00.dts| 1 +
>  arch/arm/dts/tegra20-whistler.dts | 1 +
>  arch/arm/dts/tegra210-e2220-1170.dts  | 1 +
>  arch/arm/dts/tegra210-p2371-.dts  | 1 +
>  arch/arm/dts/tegra210-p2371-2180.dts  | 1 +
>  arch/arm/dts/tegra210-p2571.dts   | 1 +
>  arch/arm/dts/tegra30-beaver.dts   | 1 +
>  arch/arm/dts/tegra30-cardhu.dts   | 1 +
>  arch/arm/dts/tegra30-tamonten.dtsi| 1 +
>  13 files changed, 13 insertions(+)

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


Re: [U-Boot] [PATCH 02/21] mmc: tegra: use correct alias for SDHCI/MMC nodes

2016-09-18 Thread Simon Glass
On 13 September 2016 at 10:45, Stephen Warren  wrote:
> From: Stephen Warren 
>
> The Tegra MMC driver currently honors "sdhci" entries in /aliases. The
> MMC core however uses "mmc" entries in /aliases. This difference will be
> relevant once the Tegra MMC driver is converted to DM, and the MMC core
> handles alias lookups. To avoid issues during that conversion, fix the
> Tegra MMC driver and all Tegra DTs to use the same alias name as the MMC
> core does.
>
> Cc: Jaehoon Chung 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra114-dalmore.dts |  4 ++--
>  arch/arm/dts/tegra124-cei-tk1-som.dts |  4 ++--
>  arch/arm/dts/tegra124-jetson-tk1.dts  |  4 ++--
>  arch/arm/dts/tegra124-nyan-big.dts|  4 ++--
>  arch/arm/dts/tegra124-venice2.dts |  4 ++--
>  arch/arm/dts/tegra186-p2771-.dtsi |  4 ++--
>  arch/arm/dts/tegra20-colibri.dts  |  2 +-
>  arch/arm/dts/tegra20-harmony.dts  |  4 ++--
>  arch/arm/dts/tegra20-medcom-wide.dts  |  2 +-
>  arch/arm/dts/tegra20-paz00.dts|  4 ++--
>  arch/arm/dts/tegra20-plutux.dts   |  2 +-
>  arch/arm/dts/tegra20-seaboard.dts |  4 ++--
>  arch/arm/dts/tegra20-tec.dts  |  2 +-
>  arch/arm/dts/tegra20-trimslice.dts|  4 ++--
>  arch/arm/dts/tegra20-ventana.dts  |  4 ++--
>  arch/arm/dts/tegra20-whistler.dts |  4 ++--
>  arch/arm/dts/tegra210-e2220-1170.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2371-.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2371-2180.dts  |  4 ++--
>  arch/arm/dts/tegra210-p2571.dts   |  4 ++--
>  arch/arm/dts/tegra30-apalis.dts   |  6 +++---
>  arch/arm/dts/tegra30-beaver.dts   |  4 ++--
>  arch/arm/dts/tegra30-cardhu.dts   |  4 ++--
>  arch/arm/dts/tegra30-colibri.dts  |  4 ++--
>  arch/arm/dts/tegra30-tamonten.dtsi|  6 +++---
>  drivers/mmc/tegra_mmc.c   | 10 +-
>  26 files changed, 53 insertions(+), 53 deletions(-)

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


Re: [U-Boot] [PATCH 2/2] cros_ec: Add crosec flashinfo command

2016-09-18 Thread Simon Glass
Hi Moritz,

On 13 September 2016 at 15:44, Moritz Fischer  wrote:
> Add command to print out the flash info as reported by the
> ec. The data read back includes size, write block size,
> erase block size.
>
> Signed-off-by: Moritz Fischer 
> Cc: Simon Glass 
> Cc: u-boot@lists.denx.de
> ---
>  drivers/misc/cros_ec.c | 10 ++
>  1 file changed, 10 insertions(+)

Acked-by: Simon Glass 

If you have the energy, it might be useful to move the command code
from this file into cmd/cros_ec.c

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


Re: [U-Boot] [PATCH 1/2] cros_ec: Add function to read back flash parameters

2016-09-18 Thread Simon Glass
On 13 September 2016 at 15:44, Moritz Fischer  wrote:
> Add support for reading back flash parameters as reported by
> the ec.
>
> Signed-off-by: Moritz Fischer 
> Cc: Simon Glass 
> Cc: u-boot@lists.denx.de
> ---
>  drivers/misc/cros_ec.c | 21 +
>  1 file changed, 21 insertions(+)

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


Re: [U-Boot] [PATCH 2/4] ARM: tegra: configure Ethernet address on Tegra186

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:51, Stephen Warren  wrote:
> From: Stephen Warren 
>
> On Tegra186, the bootloader which runs before U-Boot passes the Ethernet
> MAC address to U-Boot using device tree. Extract this value and write it
> to the environment, so that the Ethernet uclass picks it up and uses it
> for the built-in Ethernet device.
>
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/mach-tegra/tegra186/Makefile|  1 +
>  arch/arm/mach-tegra/tegra186/nvtboot_board.c | 54 
> 
>  2 files changed, 55 insertions(+)
>  create mode 100644 arch/arm/mach-tegra/tegra186/nvtboot_board.c

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


Re: [U-Boot] [PATCH 3/4] ARM: tegra: add DWC EQoS (ethernet) to Tegra186 DT

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:51, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Tegra186 includes a Synopsys DWC EQoS (Ethernet) device. Add this to the
> Tegra186 SoC DT so that boards can make use of it.
>
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra186.dtsi | 20 
>  1 file changed, 20 insertions(+)

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


Re: [U-Boot] [PATCH 4/4] ARM: tegra: enable Ethernet on p2771-0000

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:51, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Enable the Ethernet device in DT, provide board-specific configuration,
> and enable the driver in Kconfig.
>
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/dts/tegra186-p2771-.dtsi | 5 +
>  configs/p2771--000_defconfig  | 1 +
>  configs/p2771--500_defconfig  | 1 +
>  3 files changed, 7 insertions(+)

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


Re: [U-Boot] [PATCH 2/2] net: add driver for Synopsys Ethernet QoS device

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:48, Stephen Warren  wrote:
> From: Stephen Warren 
>
> This driver supports the Synopsys Designware Ethernet QoS (Quality of
> Service) a/k/a eqos IP block, which is a different design than the HW
> supported by the existing designware.c driver. The IP supports many
> options for bus type, clocking/reset structure, and feature list. This
> driver currently supports the specific configuration used in NVIDIA's
> Tegra186 chip, but should be extensible to other combinations quite
> easily, as explained in the source.
>
> Signed-off-by: Stephen Warren 
> ---
>  drivers/net/Kconfig   |   11 +
>  drivers/net/Makefile  |1 +
>  drivers/net/dwc_eth_qos.c | 1492 
> +
>  3 files changed, 1504 insertions(+)
>  create mode 100644 drivers/net/dwc_eth_qos.c

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


Re: [U-Boot] [PATCH 1/2] dt: net: add DWC EQoS binding

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:48, Stephen Warren  wrote:
> From: Stephen Warren 
>
> The Synopsys DWC EQoS is a configurable Ethernet MAC/DMA IP block which
> supports multiple options for bus type, clocking and reset structure, and
> feature list.
>
> This patch imports the binding from the Linux kernel, including my V3
> patch to extend the binding to cover the Tegra186, which is applied for
> next-20160912. So far, my changes have been acked by Lars Persson, the
> original author of the binding.
>
> Signed-off-by: Stephen Warren 
> ---
>  .../net/snps,dwc-qos-ethernet.txt  | 166 
> +
>  1 file changed, 166 insertions(+)
>  create mode 100644 doc/device-tree-bindings/net/snps,dwc-qos-ethernet.txt

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


Re: [U-Boot] [PATCH 1/4] ARM: tegra: add SoC-level hook for board_late_init()

2016-09-18 Thread Simon Glass
On 12 September 2016 at 11:51, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Extend the Tegra186 implementation of board_late_init() to call a per-SoC
> "hook" function. This will allow SoC-specific (rather than Tegra-wide)
> functionality to be implemented without the core Tegra code needing to be
> aware of the details. While board186.c is currently only used for
> Tegra186, it should be applicable to any other future SoC, and perhaps its
> simple design could be back-ported to older SoCs in the future too.
>
> Signed-off-by: Stephen Warren 
> ---
> This series logically relies on the DWC EQOS driver series that I just
> sent in order for the device to actually work. However, the code should
> compile and even run (albeit without yet enabling Ethernet) even without
> both series applied. So, the two series don't need to be applied in any
> particular order, nor in the same branch.
>
>  arch/arm/mach-tegra/board186.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH 4/4] cmd/fat: Do not crash on write when is not specified

2016-09-18 Thread Simon Glass
On 11 September 2016 at 14:51, Stefan Brüns
 wrote:
> argc is checked, but is off by one. In case  is not specified,
> create an empty file, which is identical to the ext4write behaviour.
>
> Signed-off-by: Stefan Brüns 
> ---
>  cmd/fat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 1/3] treewide: rename CONFIG_SPL_SERIAL_SUPPORT to CONFIG_SPL_SERIAL

2016-09-18 Thread Simon Glass
Hi,

On 11 September 2016 at 08:21, Masahiro Yamada
 wrote:
> We conventionally named SPL options in CONFIG_SPL_*_SUPPORT format,
> but the suffix _SUPPORT did not add any value.  Besides, it prevents
> us from exploiting the CONFIG_IS_ENABLED() macro.
>
> If we move the option to defconfig files (that are often re-synced),
> the renaming would be more conflict-happy, so I want to do this now.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  README |  2 +-
>  common/Makefile|  2 +-
>  common/spl/spl.c   |  2 +-
>  doc/README.SPL |  2 +-
>  drivers/Makefile   |  2 +-
>  include/common.h   |  2 +-
>  include/configs/B4860QDS.h |  2 +-
>  include/configs/BSC9131RDB.h   |  2 +-
>  include/configs/BSC9132QDS.h   |  2 +-
>  include/configs/C29XPCIE.h |  4 ++--
>  include/configs/MPC8313ERDB.h  |  2 +-
>  include/configs/P1010RDB.h | 10 +-
>  include/configs/P1022DS.h  |  8 
>  include/configs/T102xQDS.h |  2 +-
>  include/configs/T102xRDB.h |  2 +-
>  include/configs/T104xRDB.h |  2 +-
>  include/configs/T208xQDS.h |  2 +-
>  include/configs/T208xRDB.h |  2 +-
>  include/configs/T4240QDS.h |  2 +-
>  include/configs/T4240RDB.h |  2 +-
>  include/configs/a3m071.h   |  2 +-
>  include/configs/am3517_crane.h |  2 +-
>  include/configs/am3517_evm.h   |  2 +-
>  include/configs/apf27.h|  2 +-
>  include/configs/at91sam9m10g45ek.h |  2 +-
>  include/configs/at91sam9n12ek.h|  2 +-
>  include/configs/at91sam9x5ek.h |  2 +-
>  include/configs/bur_am335x_common.h|  2 +-
>  include/configs/clearfog.h |  2 +-
>  include/configs/cm_t35.h   |  2 +-
>  include/configs/corvus.h   |  2 +-
>  include/configs/da850evm.h |  2 +-
>  include/configs/db-88f6720.h   |  2 +-
>  include/configs/db-88f6820-gp.h|  2 +-
>  include/configs/db-mv784mp-gp.h|  2 +-
>  include/configs/devkit3250.h   |  2 +-
>  include/configs/ds414.h|  2 +-
>  include/configs/edminiv2.h |  2 +-
>  include/configs/imx6_spl.h |  2 +-
>  include/configs/ipam390.h  |  2 +-
>  include/configs/kc1.h  |  2 +-
>  include/configs/ls1021aqds.h   |  4 ++--
>  include/configs/ls1021atwr.h   |  2 +-
>  include/configs/ls1043a_common.h   |  4 ++--
>  include/configs/ls2080a_common.h   |  2 +-
>  include/configs/m53evk.h   |  2 +-
>  include/configs/ma5d4evk.h |  2 +-
>  include/configs/maxbcm.h   |  2 +-
>  include/configs/mcx.h  |  2 +-
>  include/configs/microblaze-generic.h   |  2 +-
>  include/configs/mx31pdk.h  |  2 +-
>  include/configs/mxs.h  |  2 +-
>  include/configs/omap3_evm.h|  2 +-
>  include/configs/omapl138_lcdk.h|  2 +-
>  include/configs/p1_p2_rdb_pc.h |  8 
>  include/configs/picosam9g45.h  |  2 +-
>  include/configs/rk3036_common.h|  2 +-
>  include/configs/rk3288_common.h|  2 +-
>  include/configs/sama5d2_ptc.h  |  2 +-
>  include/configs/sama5d2_xplained.h |  2 +-
>  include/configs/sama5d3_xplained.h |  2 +-
>  include/configs/sama5d3xek.h   |  2 +-
>  include/configs/sama5d4_xplained.h |  2 +-
>  include/configs/sama5d4ek.h|  2 +-
>  include/configs/sandbox_spl.h  |  2 +-
>  include/configs/siemens-am33x-common.h |  2 +-
>  include/configs/sniper.h   |  2 +-
>  include/configs/socfpga_common.h   |  2 +-
>  include/configs/sunxi-common.h |  2 +-
>  include/configs/tam3517-common.h   |  2 +-
>  include/configs/tao3530.h  |  2 +-
>  include/configs/taurus.h   |  2 +-
>  include/configs/tegra-common.h |  2 +-
>  include/configs/theadorable.h  |  2 +-
>  include/configs/ti814x_evm.h   |  2 +-
>  include/configs/ti816x_evm.h   |  2 +-
>  include/configs/ti_armv7_common.h  |  2 +-
>  include/configs/tricorder.h|  2 +-
>  include/configs/uniphier.h |  2 +-
>  include/configs/woodburn_sd.h  |  2 +-
>  include/configs/work_92105.h   |  2 +-
>  include/configs/x600.h |  2 +-
>  include/configs/xilinx_zynqmp.h|  2 +-
>  include/configs/zynq-common.h  |  2 +-
>  lib/Makefile   |  4 ++--
>  lib/hang.c |  2 +-
>  86 files changed, 100 insertions(+), 100 deletions(-)

This seems like a good idea, but needs to be updated now that things
are in Kconfig.

Regards,
Simon

Re: [U-Boot] [PATCH] rockchip: miniarm: remove eMMC support

2016-09-18 Thread Simon Glass
On 9 September 2016 at 07:44, Ziyuan Xu  wrote:
> The latest rk3288-miniarm board doesn't have eMMC device, so remove it.
>
> Signed-off-by: Ziyuan Xu 
> ---
>
>  arch/arm/dts/rk3288-miniarm.dtsi   | 12 
>  board/rockchip/miniarm_rk3288/miniarm-rk3288.c |  8 
>  include/configs/miniarm_rk3288.h   |  7 ++-
>  3 files changed, 6 insertions(+), 21 deletions(-)

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


Re: [U-Boot] [PATCH v2 4/4] fastboot: move FASTBOOT_FLASH options into Kconfig

2016-09-18 Thread Simon Glass
On 9 September 2016 at 02:27, Petr Kulhavy  wrote:
> Move FASTBOOT_MBR_NAME and FASTBOOT_GPT_NAME into Kconfig.
> Add dependency on the FASTBOOT_FLASH setting (also for FASTBOOT_MBR_NAME).
> Remove the now redundant GPT_ENTRY_NAME.
>
> Signed-off-by: Petr Kulhavy 
> ---
> v2: initial
>
>  README   |  2 +-
>  cmd/fastboot/Kconfig | 24 
>  common/fb_mmc.c  |  9 -
>  include/part_efi.h   |  1 -
>  4 files changed, 25 insertions(+), 11 deletions(-)

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


Re: [U-Boot] [RFC v2] bootm: fix passing argc to standalone apps

2016-09-18 Thread Simon Glass
On 9 September 2016 at 02:18, Zubair Lutfullah Kakakhel
 wrote:
> This bug appears in b6396403 which makes u-boot unable to pass
> arguments via bootm to a standalone application without this patch.
>
> Steps to reproduce.
>
> Compile a u-boot. Use mkimage to package the standalone hello_world.bin
> file.
>
> e.g. For the MIPS Boston platform
>
> mkimage -n "hello" -A mips -O u-boot -C none -T standalone \
>  -a 0x8020 -d hello_world.bin \
>  -ep 0x8020 hello_out
>
> Then tftp hello_out and run it using
>
> boston # dhcp 192.168.154.45:hello_out
> ...
> boston # bootm $loadaddr 123 321
>
> Without the patch the following output is observed.
>
> boston # bootm $loadaddr 123 321
>Image Name:   hello
>Image Type:   MIPS U-Boot Standalone Program (uncompressed)
>Data Size:1240 Bytes = 1.2 KiB
>Load Address: 8020
>Entry Point:  8020
>Verifying Checksum ... OK
>Loading Standalone Program ... OK
> Example expects ABI version 8
> Actual U-Boot ABI version 8
> Hello World
> argc = 0
> argv[0] = "0x8800"
>
> With the patch, you see the following.
>
> boston # bootm $loadaddr 123 321
>Image Name:   hello
>Image Type:   MIPS U-Boot Standalone Program (uncompressed)
>Data Size:1240 Bytes = 1.2 KiB
>Load Address: 8020
>Entry Point:  8020
>Verifying Checksum ... OK
>Loading Standalone Program ... OK
> Example expects ABI version 8
> Actual U-Boot ABI version 8
> Hello World
> argc = 3
> argv[0] = "0x8800"
> argv[1] = "123"
> argv[2] = "321"
> argv[3] = ""
>
> Without the patch, the go command at the entry point seems to work.
>
> boston # go 0x8020 123 321
> Example expects ABI version 8
> Actual U-Boot ABI version 8
> Hello World
> argc = 3
> argv[0] = "0x8020"
> argv[1] = "123"
> argv[2] = "321"
> argv[3] = ""
> Hit any key to exit ...
>
> Signed-off-by: Zubair Lutfullah Kakakhel 
>
> ---
>
> Tested on the MIPS Boston platform.
> ---
>  common/bootm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/common/bootm.c b/common/bootm.c
> index e6da551..a26ada4 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -602,10 +602,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[],
> if (!ret && (states & BOOTM_STATE_FINDOS))
> ret = bootm_find_os(cmdtp, flag, argc, argv);
>
> -   if (!ret && (states & BOOTM_STATE_FINDOTHER)) {
> +   if (!ret && (states & BOOTM_STATE_FINDOTHER))
> ret = bootm_find_other(cmdtp, flag, argc, argv);
> -   argc = 0;   /* consume the args */
> -   }
>
> /* Load the OS */
> if (!ret && (states & BOOTM_STATE_LOADOS)) {
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH v2 2/4] fastboot: add support for writing MBR

2016-09-18 Thread Simon Glass
On 9 September 2016 at 02:27, Petr Kulhavy  wrote:
> Add special target "mbr" (otherwise configurable via CONFIG_FASTBOOT_MBR_NAME)
> to write MBR partition table.
> Partitions are now searched using the generic function which finds any
> partiiton by name. For MBR the partition names hda1, sda1, etc. are used.
>
> Signed-off-by: Petr Kulhavy 
> Reviewed-by: Tom Rini 
> ---
> v1: initial
> v2: no change
>
>  README  |  7 +++
>  common/fb_mmc.c | 40 ++--
>  disk/part_dos.c | 20 
>  doc/README.android-fastboot | 37 +
>  include/part.h  | 23 +++
>  5 files changed, 121 insertions(+), 6 deletions(-)

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


Re: [U-Boot] [PATCH v2 1/4] disk: part: implement generic function part_get_info_by_name()

2016-09-18 Thread Simon Glass
On 9 September 2016 at 02:27, Petr Kulhavy  wrote:
> So far partition search by name has been supported only on the EFI partition
> table. This patch extends the search to all partition tables.
>
> Rename part_get_info_efi_by_name() to part_get_info_by_name(), move it from
> part_efi.c into part.c and make it a generic function which traverses all part
> drivers and searches all partitions (in the order given by the linked list).
>
> For this a new variable struct part_driver.max_entries is added, which limits
> the number of partitions searched. For EFI this was GPT_ENTRY_NUMBERS.
> Similarly the limit is defined for DOS, ISO, MAC and AMIGA partition tables.
>
> Signed-off-by: Petr Kulhavy 
> Reviewed-by: Tom Rini 
> ---
> v1: initial
> v2: no change
>
>  common/fb_mmc.c   |  4 ++--
>  disk/part.c   | 26 ++
>  disk/part_amiga.c |  1 +
>  disk/part_dos.c   |  1 +
>  disk/part_efi.c   | 20 +---
>  disk/part_iso.c   |  1 +
>  disk/part_mac.c   |  1 +
>  include/part.h| 32 
>  8 files changed, 53 insertions(+), 33 deletions(-)

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


Re: [U-Boot] [PATCH v2 01/10] board_f: Add a mach_cpu_init callback

2016-09-18 Thread Simon Glass
On 9 September 2016 at 07:44, Paul Burton  wrote:
> Currently we have a mismash of architectures which use arch_cpu_init
> from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
> and architectures which use arch_cpu_init from machine/SoC level code
> (arm, x86).
>
> In order to clean this mess up & allow for both use cases, introduce a
> new mach_cpu_init callback which is run immediately after arch_cpu_init.
> This will allow for architectures to have arch-wide code without needing
> individual machines to all implement their own arch_cpu_init with a call
> to some common function.
>
> Signed-off-by: Paul Burton 
>
> ---
>
> Changes in v2:
> - Use a weak function, make it generic not MIPS-specific
>
>  common/board_f.c | 6 ++
>  1 file changed, 6 insertions(+)

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


Re: [U-Boot] [PATCH v2 3/4] disk: part: refactor generic name creation for DOS and ISO

2016-09-18 Thread Simon Glass
On 9 September 2016 at 02:27, Petr Kulhavy  wrote:
> In both DOS and ISO partition tables the same code to create partition name
> like "hda1" was repeated.
>
> Code moved to into a new function part_set_generic_name() in part.c and 
> optimized.
> Added recognition of MMC and SD types, name is like "mmcsda1".
>
> Signed-off-by: Petr Kulhavy 
> Reviewed-by: Tom Rini 
> ---
> v1: initial
> v2: no change
>
>  disk/part.c | 32 
>  disk/part_dos.c | 31 ++-
>  disk/part_iso.c | 25 +
>  doc/README.android-fastboot |  1 +
>  include/part.h  | 14 ++
>  5 files changed, 50 insertions(+), 53 deletions(-)

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


Re: [U-Boot] [PATCH 1/2] sandbox, x86: select DM_KEYBOARD instead of default y entry

2016-09-18 Thread Simon Glass
On 8 September 2016 at 03:47, Masahiro Yamada
 wrote:
> Once we migrate to DM-based drivers, we cannot go back to legacy
> ones, i.e. config options like DM_* are not user-configurable.
>
> Make SANDBOX and X86 select DM_KEYBOARD like other platforms do.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  arch/Kconfig | 2 ++
>  arch/sandbox/Kconfig | 3 ---
>  arch/x86/Kconfig | 3 ---
>  3 files changed, 2 insertions(+), 6 deletions(-)

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


Re: [U-Boot] [PATCH 2/2] input: specify the default of I8042_KEYB in more correct manner

2016-09-18 Thread Simon Glass
Hi Masahiro,

On 8 September 2016 at 03:47, Masahiro Yamada
 wrote:
> Creating multiple entries of "config FOO" often gives us bad
> experiences.  In this case, we should specify "default X86"
> as platforms that want this keyboard by default.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  arch/x86/Kconfig  | 3 ---
>  drivers/input/Kconfig | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 9207549..ac2d598 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -546,9 +546,6 @@ config I8254_TIMER
>   Intel 8254 timer contains three counters which have fixed uses.
>   Include this to have U-Boot set up the timer correctly.
>
> -config I8042_KEYB
> -   default y
> -
>  config SEABIOS
> bool "Support booting SeaBIOS"
> help
> diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
> index d560328..b3873c1 100644
> --- a/drivers/input/Kconfig
> +++ b/drivers/input/Kconfig
> @@ -17,6 +17,7 @@ config CROS_EC_KEYB
>  config I8042_KEYB
> bool "Enable Intel i8042 keyboard support"
> depends on DM_KEYBOARD
> +   default X86

What does this mean?

> help
>   This adds a driver for the i8042 keyboard controller, allowing the
>   keyboard to be used on devices which support this controller. The
> --
> 1.9.1
>

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


Re: [U-Boot] [PATCH] test/py/tests/test_vboot.py: Add check that we boot the image

2016-09-18 Thread Simon Glass
On 18 September 2016 at 07:46, Tom Rini  wrote:
>
> Make sure that when we're telling bootm to boot an image, and we expect
> the image to boot we get the output from sandbox that we attempted to
> run Linux and that U-Boot completed its job.
>
> Cc: Simon Glass 
> Cc: Stephen Warren 
> Signed-off-by: Tom Rini 
> ---
>  test/py/tests/test_vboot.py | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)

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


Re: [U-Boot] [PATCH v3 00/45] Kconfig: Move CONFIG_SPL_..._SUPPORT to Kconfig

2016-09-18 Thread Simon Glass
Hi Tom,

On 18 September 2016 at 09:58, Tom Rini  wrote:
> On Mon, Sep 12, 2016 at 11:18:18PM -0600, Simon Glass wrote:
>
>> This series moves all the CONFIG_SPL_..._SUPPORT options to Kconfig and
>> fixes up existing boards to continue to build.
>>
>> It also adds a few small but useful features to moveconfig.
>>
>> There is existing work going on in this area, so some of these patches may
>> be superseded. It has taken me a while to get this building cleanly. But I
>> have run out of time so want to get this out.
>>
>> As mentioned on a recent thread [1] there is some confusion about whether an
>> option means enabling driver support or media support. Andrew's recent
>> series seems like a good vehicle to tidy that up. But I hope this series
>> will make it easier.
>>
>> NOTE: in the v2 series I have tried to use common things in Kconfig to
>> reduce the diffs in the defconfig files. This has helped a fair bit. But it
>> is very error-prone and time consuming. Also I have had to add some
>> exceptions (disabling an option in specific board configs). Overall it was
>> not a pleasant experience :-(
>>
>> There are a few strange features of this conversion. The main difficulty is
>> that some PowerPC boards do things like this in their board config file:
>>
>> This means that TPL reuses the SPL options. We can't support this in Kconfig
>> so I have added a small number of CONFIG_TPL_xxx_SUPPORT options to cope
>> with this. This made the conversion more painful than it should have been.
>>
>> A related issue is boards using a common header file and setting options only
>> for SPL:
>>
>> This is not noticed by moveconfig so we have to clean it up manually. Also
>> there are a few incorrect things where Kconfig options are set with #define:
>>
>> Finally, many defconfig files are not ordered correctly, resulting in larger
>> patches than we might like. It would be great to have a solution for this,
>> perhaps with buildman providing a warning. But it might slow down
>> development.
>>
>> The series is fully build-tested (for bisectability) and causes no failures
>> for the boards that already pass. The following boards fail for me at
>> present on mainline (which I have not yet looked at):
>>
>> 01: buildman
>>   blackfin:  +   cm-bf527 bf609-ezkit bf537-stamp
>>  sparc:  +   grsim grsim_leon2 gr_cpci_ax2000 gr_xc3s_1500 gr_ep2s60
>>  nios2:  +   10m50 3c120
>> microblaze:  +   microblaze-generic
>>   openrisc:  +   openrisc-generic
>>
>> [1] https://patchwork.ozlabs.org/patch/661511/
>
> This is not totally size neutral.  I've looked over the changes and in
> some cases, strings just get resized slightly, and, it happens.  In
> other cases, it comes down to the "fun" games I did on am335x to support
> network booting in SPL and the size constrains that can be run into
> there, along with just including extra stuff.  It all still links, so
> I'll clean up that config afterwards.

The latter is a funny case. I assumed something interesting was going
on but didn't dig into what.

It would be helpful if SoC maintainers would take a look at the
resulting defconfig files with their boards and see if some of the
variation could be removed. E.g. I suspect that some boards disable a
particular option for no particular reason. More uniformity (by
setting defaults in Kconfig however distasteful) will reduce the
defconfig size.

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


Re: [U-Boot] [PATCH] ARM: Respect CONFIG_SPL_STACK define in lowlevel_init.S

2016-09-18 Thread Simon Glass
On 4 September 2016 at 21:36, Siarhei Siamashka
 wrote:
> The SPL and U-Boot proper may use different initial stack
> locations, which are configured via CONFIG_SPL_STACK and
> CONFIG_SYS_INIT_SP_ADDR defines. The lowlevel_init.S
> code needs to handle this in the same way as crt0.S
>
> Without this fix, setting the U-Boot stack location to some
> place, which is not safely accessible by the SPL (such as
> the DRAM), causes a very early SPL deadlock.
>
> Signed-off-by: Siarhei Siamashka 
> ---
>  arch/arm/cpu/armv7/lowlevel_init.S | 4 
>  1 file changed, 4 insertions(+)

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


Re: [U-Boot] [PATCH] cmd/fdt: add possibilty to have 'extrasize' on fdt resize

2016-09-18 Thread Simon Glass
Hi Hannes,

On 5 September 2016 at 02:00, Hannes Schmelzer
 wrote:
> Sometimes devicetree nodes and or properties are added out of the u-boot
> console, maybe through some script or manual interaction.
>
> The devicetree as loaded or embedded is quite small, so the devicetree
> has to be resized to take up those new nodes/properties.
>
> In original the devicetree was only extended by effective
> 4 * add_mem_rsv.
>
> With this commit we can add an argument to the "fdt resize" command,
> which takes the extrasize to be added.
>
> Signed-off-by: Hannes Schmelzer 
>
> ---
>
>  board/compulab/cm_fx6/cm_fx6.c | 2 +-
>  cmd/fdt.c  | 9 +++--
>  common/fdt_support.c   | 3 ++-
>  common/image-fdt.c | 2 +-
>  include/fdt_support.h  | 2 +-
>  5 files changed, 12 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass 

>
> diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
> index 566c19b..fbd6226 100644
> --- a/board/compulab/cm_fx6/cm_fx6.c
> +++ b/board/compulab/cm_fx6/cm_fx6.c
> @@ -602,7 +602,7 @@ int ft_board_setup(void *blob, bd_t *bd)
> char baseboard_name[16];
> int err;
>
> -   fdt_shrink_to_minimum(blob); /* Make room for new properties */
> +   fdt_shrink_to_minimum(blob, 0); /* Make room for new properties */
>
> /* MAC addr */
> if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
> diff --git a/cmd/fdt.c b/cmd/fdt.c
> index 58af772..b503357 100644
> --- a/cmd/fdt.c
> +++ b/cmd/fdt.c
> @@ -662,7 +662,12 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>  #endif
> /* resize the fdt */
> else if (strncmp(argv[1], "re", 2) == 0) {
> -   fdt_shrink_to_minimum(working_fdt);
> +   uint extrasize;
> +   if (argc > 2)
> +   extrasize = simple_strtoul(argv[2], NULL, 16);
> +   else
> +   extrasize = 0;
> +   fdt_shrink_to_minimum(working_fdt, extrasize);
> }
> else {
> /* Unrecognized command */
> @@ -1056,7 +1061,7 @@ static char fdt_help_text[] =
> "fdt systemsetup - Do system-specific set up\n"
>  #endif
> "fdt move  - Copy the fdt to  and 
> make it active\n"
> -   "fdt resize  - Resize fdt to size + padding 
> to 4k addr\n"
> +   "fdt resize []- Resize fdt to size + padding 
> to 4k addr + some optional  if needed\n"
> "fdt print   []  - Recursive print starting at 
> \n"
> "fdt list[]  - Print one level starting at 
> \n"
> "fdt get value  - Get  and store in 
> \n"
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 2020586..0609470 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -523,7 +523,7 @@ void fdt_fixup_ethernet(void *fdt)
>  }
>
>  /* Resize the fdt to its actual size + a bit of padding */
> -int fdt_shrink_to_minimum(void *blob)
> +int fdt_shrink_to_minimum(void *blob, uint extrasize)
>  {
> int i;
> uint64_t addr, size;
> @@ -551,6 +551,7 @@ int fdt_shrink_to_minimum(void *blob)
> actualsize = fdt_off_dt_strings(blob) +
> fdt_size_dt_strings(blob) + 5 * sizeof(struct 
> fdt_reserve_entry);
>
> +   actualsize += extrasize;
> /* Make it so the fdt ends on a page boundary */
> actualsize = ALIGN(actualsize + ((uintptr_t)blob & 0xfff), 0x1000);
> actualsize = actualsize - ((uintptr_t)blob & 0xfff);
> diff --git a/common/image-fdt.c b/common/image-fdt.c
> index d6ee225..2ef1253 100644
> --- a/common/image-fdt.c
> +++ b/common/image-fdt.c
> @@ -503,7 +503,7 @@ int image_setup_libfdt(bootm_headers_t *images, void 
> *blob,
> lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
>  (phys_size_t)fdt_totalsize(blob));
>
> -   ret = fdt_shrink_to_minimum(blob);
> +   ret = fdt_shrink_to_minimum(blob, 0);
> if (ret < 0)
> goto err;
> of_size = ret;
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index e9f3497..2957fbc 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -167,7 +167,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
>  int ft_system_setup(void *blob, bd_t *bd);
>
>  void set_working_fdt_addr(ulong addr);
> -int fdt_shrink_to_minimum(void *blob);
> +int fdt_shrink_to_minimum(void *blob, uint extrasize);

Can you please add a function comment for this?

>  int fdt_increase_size(void *fdt, int add_len);
>
>  int fdt_fixup_nor_flash_size(void *blob);
> --
> 1.9.1
>

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


Re: [U-Boot] Please pull ARC changes

2016-09-18 Thread Tom Rini
On Fri, Sep 16, 2016 at 11:30:34AM +, Alexey Brodkin wrote:

> Hi Tom,
> 
> That's a minor change that accommodates changes in upcoming ARC GNU tools.
> 
> The following changes since commit 8cbb389bb3da80cbf8911f8386cbff92c6a78afe:
> 
>   Prepare v2016.09 (2016-09-12 10:05:51 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-arc.git 
> 
> for you to fetch changes up to 7c8d81605302e7d7fdd3e7d8eb69302bddc64a2c:
> 
>   arc: Use -mcpu=XXX instead of obsolete -marcXXX (2016-09-16 12:12:26 +0300)
> 

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] [PATCH 26/27] spl: Update spl_load_simple_fit() to take an spl_image param

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:15PM -0600, Simon Glass wrote:

> Upda the SPL FIT code to use the spl_image parameter.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-sunxi master

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 04:56:19PM +0200, Hans de Goede wrote:

> Hi Tom,
> 
> Here is the first sunxi pull-req for v2016.11.
> 
> This consists of a couple of small bug-fixes /
> defconfig improvements + 1 new board.
> 
> The following changes since commit 8cbb389bb3da80cbf8911f8386cbff92c6a78afe:
> 
>   Prepare v2016.09 (2016-09-12 10:05:51 -0400)
> 
> are available in the git repository at:
> 
>   http://git.denx.de/u-boot-sunxi.git master
> 
> for you to fetch changes up to ca7628a91136364235de8fb4bd699944b981c504:
> 
>   sunxi: Enable USB gadget support for Sinlinx SinA33 (2016-09-18 14:39:16 
> +0200)
> 

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] [PATCH 27/27] spl: Make spl_boot_list a local variable

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:16PM -0600, Simon Glass wrote:

> There is no need for this to be in the BSS region. By moving it we can delay
> use of BSS in SPL. This is useful for machines where the BSS region is not
> in writeable space. On 64-bit x86, SPL runs from SPI flash and it is easier
> to eliminate BSS use than link SPL to run with BSS at a particular
> cache-as-RAM (CAR) address.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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] pull request: u-boot-uniphier/master (2nd round)

2016-09-18 Thread Tom Rini
On Mon, Sep 19, 2016 at 12:35:55AM +0900, Masahiro Yamada wrote:

> Hi Tom,
> 
> Here is the revised version of my pull request
> for the v2016.11 development cycle.
> 
> The following UniPhier updates are included:
> 
>   - DM migration
>   * remove legacy xHCI driver
>   * convert MMC driver to CONFIG_BLOCK
>   - Pinctrl driver improvements
>   * New pin-group
>   * Macro cleanup
>   * Remove ad-hoc pin-mux code
>   - Misc fixes, cleanups
>   * Fix DRAM size of LD21 SoC
>   * Consolidate board init functions
>   - PLL init code cleanups and new SoC support
>   - Update DRAM init code for LD20 SoC
> 
> Please pull!
> 
> 
> The following changes since commit 8cbb389bb3da80cbf8911f8386cbff92c6a78afe:
> 
>   Prepare v2016.09 (2016-09-12 10:05:51 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-uniphier.git master
> 
> for you to fetch changes up to f9d7e17e844f9e94c39a8c95f73a4454097a6948:
> 
>   ARM: uniphier: update DRAM init code for LD20 SoC (2016-09-19 00:12:26 
> +0900)
> 

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] [PATCH 25/27] spl: Update fat functions to take an spl_image parameter

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:14PM -0600, Simon Glass wrote:

> Update the fat loader to avoid using the spl_image global variable.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 24/27] spl: Update ext functions to take an spl_image parameter

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:13PM -0600, Simon Glass wrote:

> Update the ext loader to avoid using the spl_image global variable.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 18/27] spl: spi: Move the generic SPI loader into common/spl

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:07PM -0600, Simon Glass wrote:

> All the other SPL loaders are in this directory, so move the SPI one in
> there too.
> 
> There are two board-specific SPI loaders (fsl and sunxi). These remain in
> the drivers/mtd/spi directory, since they do not contain generic code.
> 
> Signed-off-by: Simon Glass 

I think this was probably a historical mistake, so..

Reviewed-by: Tom Rini 

-- 
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 23/27] spl: Pass spl_image as a parameter to load_image() methods

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:45:12PM -0600, Simon Glass wrote:

> Rather than having a global variable, pass the spl_image as a parameter.
> This avoids BSS use, and makes it clearer what the function is actually
> doing.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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] [v2, 1/5] mmc: fsl_esdhc: don't set XFERTYP_RSPTYP_48_BUSY for CMD with busy response

2016-09-18 Thread Jaehoon Chung
On 09/13/2016 04:30 PM, Y.B. Lu wrote:
> Hi York,
> 
> I found the MMC maintainer had been changed to Jeahoon.
> It seems Panto haven't commented on upstream for a very long time.
> 
> MMC
> M:  Jaehoon Chung 
> S:  Maintained
> T:  git git://git.denx.de/u-boot-mmc.git
> F:  drivers/mmc/
> 
> Thanks.

Thanks for reminding. I missed these patchset.
Sorry.

Best Regards,
Jaehoon Chung

> 
> 
> Best regards,
> Yangbo Lu
> 
> 
>> -Original Message-
>> From: york sun
>> Sent: Tuesday, September 13, 2016 3:24 AM
>> To: Y.B. Lu; u-boot@lists.denx.de; Pantelis Antoniou
>> Cc: Jaehoon Chung
>> Subject: Re: [v2, 1/5] mmc: fsl_esdhc: don't set XFERTYP_RSPTYP_48_BUSY
>> for CMD with busy response
>>
>> Panto,
>>
>> On 08/02/2016 02:32 AM, Yangbo Lu wrote:
>>> For CMD with busy response, the eSDHC driver would poll DAT0 until CMD
>>> completion rather than polling IRQSTAT. So, don't set
>>> XFERTYP_RSPTYP_48_BUSY to avoid interrupts (DTOE or TC) in IRQSTAT.
>>>
>>> Signed-off-by: Yangbo Lu 
>>> ---
>>> Changes for v2:
>>> - None
>>> ---
>>>  drivers/mmc/fsl_esdhc.c | 12 ++--
>>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>
>> I noticed this set wasn't CC'ing you. Can you check and comment/ack this
>> set?
>>
>> York
> 
> 
> 
> 

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


Re: [U-Boot] [v2, 4/5] mmc: add workaround for eSDHC erratum A009620

2016-09-18 Thread Jaehoon Chung
On 08/02/2016 06:20 PM, Yangbo Lu wrote:
> Erratum Title:
> Data timeout error not getting set in case of command with busy
> response (R1b) as well as for busy period after last write block
> transfer.
> 
> Description:
> In the event that a busy timeout occurs for a command with a busy
> response (e.g. R1b response) as well as busy period after the last
> write block, the eSDHC does not set the IRQSTAT[DTOE] bit or the
> IRQSTAT[TC]. Therefore, the current command transfer is never completed.
> 
> Workaround:
> Workaround for CMD with busy:
> Don't set the XFRTYP[RSP]=2'b11 for commands with busy response and
> poll the busy status of the card from the PRSSTAT[DLSL]
> 
> Workaround for busy period after last write block:
> 1. After the command completion interrupt (IRQSTAT[CC]), wait for
>de-assertion of PRSTAT[WTA].
> 2. Once PRSTAT[WTA] is de-asserted, start the software timer and poll
>the busy signal (DAT0) using PRSTAT[DLSL[0]].
> 3. Wait for DAT0 signal to go high (which indicate transfer complete)
>or software timer expiry (which indicate data timeout error).
> 4. Issue soft reset for data (SYSCTL[RSTD]).
> 5. In case of data timeout error (detected in step 3) perform the
>error recovery.
> 
> The workaround for CMD with busy has already been applied in eSDHC
> driver. This patch is to add workaround for the 2nd issue.

This workaround is used the CONFIG_SYS_FSL_ERRATUM_ESDHC_A009620?..
Then if this config is disabled..how is it handling?

> 
> Signed-off-by: Yangbo Lu 
> ---
> Changes for v2:
>   - Split original patch into config part and mmc part
> ---
>  drivers/mmc/fsl_esdhc.c | 26 ++
>  include/fsl_esdhc.h |  1 +
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 80bc177..99cadae 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -482,6 +482,32 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, 
> struct mmc_data *data)
>  #ifdef CONFIG_SYS_FSL_ESDHC_USE_PIO
>   esdhc_pio_read_write(mmc, data);
>  #else
> +#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC_A009620
> + int timeout = 5000;
> + if (data->flags & MMC_DATA_WRITE) {
> + while (esdhc_read32(>prsstat) & PRSSTAT_WTA)
> + ;

I don't want to have the potential infinite loop.

Best Regards,
Jaehoon Chung

> +
> + /* Poll on DATA0 line for 500 ms */
> + while (!(esdhc_read32(>prsstat) & PRSSTAT_DAT0)) {
> + udelay(100);
> + timeout--;
> + if (timeout <= 0) {
> + err = TIMEOUT;
> + break;
> + }
> + }
> + if (!err) {
> + esdhc_write32(>sysctl,
> +   esdhc_read32(>sysctl) |
> +   SYSCTL_RSTD);
> + while ((esdhc_read32(>sysctl) &
> + SYSCTL_RSTD))
> + ;
> + }
> + goto out;
> + }
> +#endif
>   do {
>   irqstat = esdhc_read32(>irqstat);
>  
> diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
> index c6f4666..3f146f7 100644
> --- a/include/fsl_esdhc.h
> +++ b/include/fsl_esdhc.h
> @@ -97,6 +97,7 @@
>  #define PRSSTAT_CINS (0x0001)
>  #define PRSSTAT_BREN (0x0800)
>  #define PRSSTAT_BWEN (0x0400)
> +#define PRSSTAT_WTA  (0x0100)
>  #define PRSSTAT_SDSTB(0X0008)
>  #define PRSSTAT_DLA  (0x0004)
>  #define PRSSTAT_CICHB(0x0002)
> 

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


Re: [U-Boot] [v2, 2/5] mmc: send STOP command when the READ/WRITE commands fail

2016-09-18 Thread Jaehoon Chung
Hi Yangbo,

On 08/02/2016 06:20 PM, Yangbo Lu wrote:
> The STOP command should be sent to stop data transfer when the
> READ/WRITE commands fail. Otherwise, any subsequent command will
> fail to be sent.
> 
> Signed-off-by: Yangbo Lu 
> ---
> Changes for v2:
>   - None
> ---
>  drivers/mmc/mmc.c | 28 +++-
>  drivers/mmc/mmc_private.h |  1 +
>  drivers/mmc/mmc_write.c   |  8 ++--
>  3 files changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index f8e5f7a..85d1e18 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -188,6 +188,21 @@ int mmc_set_blocklen(struct mmc *mmc, int len)
>   return mmc_send_cmd(mmc, , NULL);
>  }
>  
> +int mmc_send_stop(struct mmc *mmc)
> +{
> + struct mmc_cmd cmd;
> + int err;
> +
> + cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
> + cmd.cmdarg = 0;
> + cmd.resp_type = MMC_RSP_R1b;
> +
> + err = mmc_send_cmd(mmc, , NULL);
> + if (err)
> + printf("mmc fail to send stop cmd\n");
> + return err;
> +}
> +
>  static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
>  lbaint_t blkcnt)
>  {
> @@ -211,19 +226,14 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, 
> lbaint_t start,
>   data.blocksize = mmc->read_bl_len;
>   data.flags = MMC_DATA_READ;
>  
> - if (mmc_send_cmd(mmc, , ))
> + if (mmc_send_cmd(mmc, , )) {
> + mmc_send_stop(mmc);

If mmc_send_stop() is also failed, is it doesn't need to return error number?

>   return 0;
> + }
>  
>   if (blkcnt > 1) {
> - cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
> - cmd.cmdarg = 0;
> - cmd.resp_type = MMC_RSP_R1b;
> - if (mmc_send_cmd(mmc, , NULL)) {
> -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
> - printf("mmc fail to send stop cmd\n");
> -#endif
> + if (mmc_send_stop(mmc))
>   return 0;
> - }
>   }
>  
>   return blkcnt;
> diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h
> index 49ec022..2791125 100644
> --- a/drivers/mmc/mmc_private.h
> +++ b/drivers/mmc/mmc_private.h
> @@ -16,6 +16,7 @@ extern int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd 
> *cmd,
>   struct mmc_data *data);
>  extern int mmc_send_status(struct mmc *mmc, int timeout);
>  extern int mmc_set_blocklen(struct mmc *mmc, int len);
> +int mmc_send_stop(struct mmc *mmc);
>  #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
>  void mmc_adapter_card_type_ident(void);
>  #endif
> diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
> index 0f8b5c7..fb8488c 100644
> --- a/drivers/mmc/mmc_write.c
> +++ b/drivers/mmc/mmc_write.c
> @@ -150,6 +150,7 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t 
> start,
>  
>   if (mmc_send_cmd(mmc, , )) {
>   printf("mmc write failed\n");
> + mmc_send_stop(mmc);

ditto.

Best Regards,
Jaehoon Chung

>   return 0;
>   }
>  
> @@ -157,13 +158,8 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t 
> start,
>* token, not a STOP_TRANSMISSION request.
>*/
>   if (!mmc_host_is_spi(mmc) && blkcnt > 1) {
> - cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
> - cmd.cmdarg = 0;
> - cmd.resp_type = MMC_RSP_R1b;
> - if (mmc_send_cmd(mmc, , NULL)) {
> - printf("mmc fail to send stop cmd\n");
> + if (mmc_send_stop(mmc))
>   return 0;
> - }
>   }
>  
>   /* Waiting for the ready status */
> 

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


Re: [U-Boot] [v2, 1/5] mmc: fsl_esdhc: don't set XFERTYP_RSPTYP_48_BUSY for CMD with busy response

2016-09-18 Thread Jaehoon Chung
Hi Yangbo,

On 08/02/2016 06:20 PM, Yangbo Lu wrote:
> For CMD with busy response, the eSDHC driver would poll DAT0 until
> CMD completion rather than polling IRQSTAT. So, don't set
> XFERTYP_RSPTYP_48_BUSY to avoid interrupts (DTOE or TC) in IRQSTAT.

Sorry for late.. I missed your patchset.

> 
> Signed-off-by: Yangbo Lu 
> ---
> Changes for v2:
>   - None
> ---
>  drivers/mmc/fsl_esdhc.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index a865c7b..b23845d 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -136,8 +136,16 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct 
> mmc_data *data)
>   xfertyp |= XFERTYP_CICEN;
>   if (cmd->resp_type & MMC_RSP_136)
>   xfertyp |= XFERTYP_RSPTYP_136;
> - else if (cmd->resp_type & MMC_RSP_BUSY)
> - xfertyp |= XFERTYP_RSPTYP_48_BUSY;
> + /*
> +  * For CMD with busy response, the eSDHC driver would poll DAT0
> +  * until CMD completion rather than polling IRQSTAT. So, don't
> +  * set XFERTYP_RSPTYP_48_BUSY to avoid interrupts (DTOE or TC)
> +  * in IRQSTAT.
> +  *
> +  * Remove:
> +  * else if (cmd->resp_type & MMC_RSP_BUSY)
> +  *  xfertyp |= XFERTYP_RSPTYP_48_BUSY;
> +  */

I don't have the board that is using the fsl_esdhc driver.
I wonder that it doesn't need to set XFERTYP_RSPTYP_48_BUSY in future.
If so be, is it possible to remove this comments?

Why add this comment?

Best Regards,
Jaehoon Chung

>   else if (cmd->resp_type & MMC_RSP_PRESENT)
>   xfertyp |= XFERTYP_RSPTYP_48;
>  
> 

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


Re: [U-Boot] [PATCH] ML: SPL: NOR: Add CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE define to enable whole image copy from NOR

2016-09-18 Thread Lukasz Majewski
Hi Tom,

> On Sun, Sep 18, 2016 at 09:10:34PM +0200, Lukasz Majewski wrote:
> > Hi Tom,
> > 
> > > On Fri, Sep 16, 2016 at 10:43:51AM +0200, Lukasz Majewski wrote:
> > > 
> > > > This define gives the possibility to copy entire image
> > > > (including header) from NOR parallel memory to e.g. SDRAM.
> > > > 
> > > > The legacy behavior is preserved, since other board don't
> > > > enabled this option.
> > > 
> > > What's the use case?
> > 
> > This code is used on some boards (ppc [1]) in which we copy only
> > payload of the image (i.e. we drop the package metadata).
> > 
> > In my particular case I would like to copy the image with its meta
> > data (in similar way works spl_nand.c and spl_mmc.c).
> > 
> > Since, I wanted to avoid code duplication, I've decided to add this
> > flag.
> 
> So another way of saying this, if I follow correctly, is that today
> SPL NOR doesn't work with u-boot.img but only u-boot.bin ?

Yes, exactly.

> 
> > > > Signed-off-by: Lukasz Majewski 
> > > > ---
> > > >  Kconfig  | 10 ++
> > > 
> > > This should now get moved to common/spl/Kconfig
> > 
> > OK.
> > 
> > As a side note - I do have some other patches which move some
> > SPL_NOR options to Kconfig.
> > 
> > However, I omitted them when I saw great work done by Simon to move
> > a lot of SPL options to Kconfig. I hope them will be merged soon :-)
> 
> It's in now :)

Great :-)

> 
> > > >  README   |  4 
> > > 
> > > This can be dropped.
> > 
> > So, we don't add any new entries to README and now rely solely on
> > Kconfig "help" sections?
> 
> Correct.

OK.

> 
> > > [snip]
> > > > diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
> > > > index 8ea874c..1e0f739 100644
> > > > --- a/common/spl/spl_nor.c
> > > > +++ b/common/spl/spl_nor.c
> > > > @@ -9,13 +9,15 @@
> > > >  
> > > >  int spl_nor_load_image(void)
> > > >  {
> > > > +   void *img_src;
> > > > int ret;
> > > > +#ifndef CONFIG_SPL_NOR_COPY_ENTIRE_IMAGE
> > > > /*
> > > >  * Loading of the payload to SDRAM is done with
> > > > skipping of
> > > >  * the mkimage header in this SPL NOR driver
> > > >  */
> > > > spl_image.flags |= SPL_COPY_PAYLOAD_ONLY;
> > > > -
> > > > +#endif
> > > >  #ifdef CONFIG_SPL_OS_BOOT
> > > > if (!spl_start_uboot()) {
> > > > const struct image_header *header;
> > > > @@ -64,9 +66,13 @@ int spl_nor_load_image(void)
> > > > if (ret)
> > > > return ret;
> > > >  
> > > 
> > > We should have a comment here about how we're calculating the
> > > base of where to copy from.
> > 
> > I will be more verbose with v2 :-).
> > 
> > Thanks for review.
> 
> No problem, thank you!
> 

Best regards,
Łukasz Majewski



pgp3I2Gpoi5qu.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Revert "image-fit: switch ENOLINK to ENOENT"

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 03:14:30PM +0200, Marek Vasut wrote:
> On 09/17/2016 05:42 AM, Jonathan Gray wrote:
> > On Fri, Sep 16, 2016 at 10:21:43PM +0100, Paul Burton wrote:
> >> Commit bac17b78dace ("image-fit: switch ENOLINK to ENOENT") changed
> >> fit_get_node_from_config to return -ENOENT when a property doesn't
> >> exist, but didn't change any of its callers which check return values.
> >> Notably it didn't change boot_get_ramdisk, which leads to U-Boot failing
> >> to boot FIT images which don't include ramdisks with the following
> >> message:
> >>
> >>   Ramdisk image is corrupt or invalid
> >>
> >> The offending commit seems to dislike ENOLINK due to it not existing on
> >> OpenBSD, but I'm not sure why that matters as we define it in
> >> include/asm-generic/errno.h anyway so simply revert the commit to fix
> >> FIT image handling.
> > 
> > That header is not used when building native tools.
> > So reverting it will break the build of u-boot on OpenBSD.
> > 
> >   WRAPtools/common/image-fit.c
> >   HOSTCC  tools/common/image-fit.o
> > In file included from tools/common/image-fit.c:1:
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c: In function 
> > 'fit_get_node_from_config':
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: 
> > 'ENOLINK' undeclared (first use in this function)
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: (Each 
> > undeclared identifier is reported only once
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: for each 
> > function it appears in.)
> > 
> 
> I seriously do not care if it's broken on OpenBSD if there is about one
> user of such system. The problem is the original patch broke booting of
> fitImage-wrapped kernels and this is serious breakage which makes
> 2016.09 release effectively useless.
> 
> I do support this revert and we will likely need v2016.09.1 unfortunately.

Lets take a step back.  It's my fault that things broke in the release
as I assumed that the tests I was automatically running to exercise FIT
stuff included a successful boot check.  They didn't, so this slipped
in.  I've posted an update to make sure that the FIT tests will cover
this kind of thing in the future.

And non-Linux support, both host and target, is something I see as a
valuable and important use case for U-Boot.  This includes more and less
public and visible and open and commercial things.

> 
> -- 
> Best regards,
> Marek Vasut

-- 
Tom


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


[U-Boot] [PATCH 11/13] buildman: Drop the 'active' flag in the builder

2016-09-18 Thread Simon Glass
This serves no real purpose, since when we are not active, we exit. Drop it.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py   |  7 ---
 tools/buildman/builderthread.py | 10 +-
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index e774c2d..95369f0 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -130,7 +130,6 @@ class Builder:
 """Class for building U-Boot for a particular commit.
 
 Public members: (many should ->private)
-active: True if the builder is active and has not been stopped
 already_done: Number of builds already completed
 base_dir: Base directory to use for builder
 checkout: True to check out source, False to skip that step.
@@ -241,7 +240,6 @@ class Builder:
 self.base_dir = base_dir
 self._working_dir = os.path.join(base_dir, '.bm-work')
 self.threads = []
-self.active = True
 self.do_make = self.Make
 self.gnu_make = gnu_make
 self.checkout = checkout
@@ -401,11 +399,6 @@ class Builder:
 if result:
 target = result.brd.target
 
-if result.return_code < 0:
-self.active = False
-command.StopAll()
-return
-
 self.upto += 1
 if result.return_code != 0:
 self.fail += 1
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index a30e4fd..06be5d9 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -478,14 +478,6 @@ class BuilderThread(threading.Thread):
 alive = True
 while True:
 job = self.builder.queue.get()
-if self.builder.active and alive:
+if alive:
 self.RunJob(job)
-'''
-try:
-if self.builder.active and alive:
-self.RunJob(job)
-except Exception as err:
-alive = False
-print err
-'''
 self.builder.queue.task_done()
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 10/13] buildman: Allow builds to terminate cleanly

2016-09-18 Thread Simon Glass
It is annoying that buildman does not respond cleanly to Ctrl-C or SIGINT,
particularly on machines with lots of CPUS. Unfortunately queue.join()
blocks the main thread and does not allow it to see the signal. Use a
separate thread instead,

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index d4ea13e..e774c2d 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -14,6 +14,7 @@ import Queue
 import shutil
 import string
 import sys
+import threading
 import time
 
 import builderthread
@@ -1456,8 +1457,11 @@ class Builder:
 job.step = self._step
 self.queue.put(job)
 
-# Wait until all jobs are started
-self.queue.join()
+term = threading.Thread(target=self.queue.join)
+term.setDaemon(True)
+term.start()
+while term.isAlive():
+term.join(100)
 
 # Wait until we have processed all output
 self.out_queue.join()
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 07/13] buildman: Print a message when removing old directories

2016-09-18 Thread Simon Glass
When buildman starts, it prepares its output directory by removing any old
build directories which will not be used this time. This can happen if a
previous build left directories around for commit hashes which are no-longer
part of the branch.

This can take quite a while, so print a message to indicate what is going
on.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 7c237a5..a80333f 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1410,8 +1410,14 @@ class Builder:
 for commit_upto in range(self.commit_count):
 dir_list.append(self._GetOutputDir(commit_upto))
 
+to_remove = []
 for dirname in glob.glob(os.path.join(self.base_dir, '*')):
 if dirname not in dir_list:
+to_remove.append(dirname)
+if to_remove:
+Print('Removing %d old build directories' % len(to_remove),
+  newline=False)
+for dirname in to_remove:
 shutil.rmtree(dirname)
 
 def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 13/13] buildman: Drop the 'alive' flag in BuilderThread

2016-09-18 Thread Simon Glass
This is not used, so drop it.

Signed-off-by: Simon Glass 
---

 tools/buildman/builderthread.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 06be5d9..a02aa19 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -475,9 +475,7 @@ class BuilderThread(threading.Thread):
 This thread picks a job from the queue, runs it, and then goes to the
 next job.
 """
-alive = True
 while True:
 job = self.builder.queue.get()
-if alive:
-self.RunJob(job)
+self.RunJob(job)
 self.builder.queue.task_done()
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 06/13] buildman: Tidy up the 'cloning' message

2016-09-18 Thread Simon Glass
On a machine with a lot of CPUs this prints a lot of useless lines of the
form:

   Cloning repo for thread 

Adjust the output so that these all appear on one line, and disappear when
the cloning is complete.

Note: This cloning is actually unnecessary and very wasteful on disk space
(about 3.5GB each time). It would be better to create symlinks.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 2aca189..7c237a5 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1379,8 +1379,10 @@ class Builder:
 if os.path.exists(git_dir):
 gitutil.Fetch(git_dir, thread_dir)
 else:
-Print('Cloning repo for thread %d' % thread_num)
+Print('\rCloning repo for thread %d' % thread_num,
+  newline=False)
 gitutil.Clone(src_dir, thread_dir)
+Print('\r%s\r' % (' ' * 30), newline=False)
 
 def _PrepareWorkingSpace(self, max_threads, setup_git):
 """Prepare the working directory for use.
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 05/13] patman: Flush output when there is no newline

2016-09-18 Thread Simon Glass
Output which does not include a newline will not be displayed unless
flushed. Add a flush to ensure that it becomes visible.

Signed-off-by: Simon Glass 
---

 tools/patman/terminal.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index e78a7c1..af3593e 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -55,6 +55,8 @@ def Print(text='', newline=True, colour=None):
 print text,
 if newline:
 print
+else:
+sys.stdout.flush()
 
 def SetPrintTestMode():
 """Go into test mode, where all printing is recorded"""
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 09/13] buildman: Put our local libraries first in the path

2016-09-18 Thread Simon Glass
If patman is installed on the machine (e.g. in the standard dist-packages
directory), it will find libraries from there in preference to our local
libraries. Adjust the order of the path to ensure that local libraries are
found first.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py
index d0afeda..607429d 100755
--- a/tools/buildman/buildman.py
+++ b/tools/buildman/buildman.py
@@ -15,7 +15,7 @@ import unittest
 
 # Bring in the patman libraries
 our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
+sys.path.insert(1, os.path.join(our_path, '../patman'))
 
 # Our modules
 import board
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 12/13] buildman: Don't show a stacktrace on Ctrl-C

2016-09-18 Thread Simon Glass
When Ctrl-C is pressed, just exited quietly. There is no sense in displaying
a stack trace since buildman will always be in the same place: waiting for
threads to complete building all the jobs on the queue.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 95369f0..6905ed9 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -12,6 +12,7 @@ import os
 import re
 import Queue
 import shutil
+import signal
 import string
 import sys
 import threading
@@ -293,11 +294,17 @@ class Builder:
 ignore_lines = ['(make.*Waiting for unfinished)', '(Segmentation 
fault)']
 self.re_make_err = re.compile('|'.join(ignore_lines))
 
+# Handle existing graceful with SIGINT / Ctrl-C
+signal.signal(signal.SIGINT, self.signal_handler)
+
 def __del__(self):
 """Get rid of all threads created by the builder"""
 for t in self.threads:
 del t
 
+def signal_handler(self, signal, frame):
+sys.exit(1)
+
 def SetDisplayOptions(self, show_errors=False, show_sizes=False,
   show_detail=False, show_bloat=False,
   list_error_boards=False, show_config=False):
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 08/13] buildman: Print a message indicating the build is starting

2016-09-18 Thread Simon Glass
Make it clear when buildman actually starts building. This happens when it
has prepared the threads, working directory and output directories.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 1 +
 tools/buildman/test.py| 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index a80333f..d4ea13e 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1443,6 +1443,7 @@ class Builder:
 self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)),
 commits is not None)
 self._PrepareOutputSpace()
+Print('\rStarting build...', newline=False)
 self.SetupBuild(board_selected, commits)
 self.ProcessResult(None)
 
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index d8f3c81..ed2a3a8 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -198,9 +198,9 @@ class TestBuild(unittest.TestCase):
 if line.text.strip():
 count += 1
 
-# We should get one starting message, then an update for every commit
+# We should get two starting messages, then an update for every commit
 # built.
-self.assertEqual(count, len(commits) * len(boards) + 1)
+self.assertEqual(count, len(commits) * len(boards) + 2)
 build.SetDisplayOptions(show_errors=True);
 build.ShowSummary(self.commits, board_selected)
 #terminal.EchoPrintTestLines()
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 01/13] Makefile: Add a target to create the .cfg files

2016-09-18 Thread Simon Glass
A common requirement when converting CONFIG options to Kconfig is to check
that the effective configuration has not changed due to the conversion. Add
a target which creates this configuration (in the form of u-boot.cfg) but
does not build U-Boot. This speeds up the checking.

Signed-off-by: Simon Glass 
---

 Makefile | 9 +
 scripts/Makefile.spl | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/Makefile b/Makefile
index fffc188..f835780 100644
--- a/Makefile
+++ b/Makefile
@@ -812,6 +812,14 @@ append = cat $(filter-out $< $(PHONY), $^) >> $@
 quiet_cmd_pad_cat = CAT $@
 cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
 
+cfg: u-boot.cfg $(if $(CONFIG_SPL),cfg-spl) $(if $(CONFIG_TPL),cfg-tpl)
+
+cfg-spl:
+   $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl cfg
+
+cfg-tpl:
+   $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl cfg
+
 all:   $(ALL-y)
 ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
@echo "= WARNING =="
@@ -1517,6 +1525,7 @@ help:
@echo  '  cscope  - Generate cscope index'
@echo  '  ubootrelease- Output the release version string (use with 
make -s)'
@echo  '  ubootversion- Output the version stored in Makefile (use 
with make -s)'
+   @echo  "  cfg - Don't build, just create the .cfg files"
@echo  ''
@echo  'Static analysers'
@echo  '  checkstack  - Generate a list of stack hogs'
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 4994fa8..21bdcf2 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -219,6 +219,8 @@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) 
$(LDPPFLAGS) -ansi \
 $(obj)/$(SPL_BIN).cfg: include/config.h FORCE
$(call if_changed,cpp_cfg)
 
+cfg: $(obj)/$(SPL_BIN).cfg
+
 pythonpath = PYTHONPATH=tools
 
 quiet_cmd_dtocc = DTOC C  $@
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 04/13] buildman: Squash useless output from -K

2016-09-18 Thread Simon Glass
When using #define CONFIG_SOME_OPTION, the value it set to '1'. When using
defconfig (i.e. CONFIG_SOME_OPTION=y) the value is set to 'y'. This results
in differences showing up with -K. These differences are seldom useful.

Adjust buildman to suppress these differences by default.

Signed-off-by: Simon Glass 
---

 tools/buildman/README | 12 
 tools/buildman/builder.py | 34 ++
 tools/buildman/cmdline.py |  2 ++
 tools/buildman/control.py |  3 ++-
 4 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index ee330ba..4b34cdb 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -995,6 +995,18 @@ configuration you can in fact avoid doing a full build, 
using -D. This tells
 buildman to configuration U-Boot and create the .cfg files, but not actually
 build the source. This is 5-10 times faster than doing a full build.
 
+By default buildman considers the follow two configuration methods
+equivalent:
+
+   #define CONFIG_SOME_OPTION
+
+   CONFIG_SOME_OPTION=y
+
+The former would appear in a header filer and the latter in a defconfig
+file. The achieve this, buildman considers 'y' to be '1' in configuration
+variables. This avoids lots of useless output when converting a CONFIG
+option to Kconfig. To disable this behaviour, use --squash-config-y.
+
 
 Other options
 =
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 98f1091..2aca189 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -96,19 +96,22 @@ OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN 
= range(4)
 # Translate a commit subject into a valid filename
 trans_valid_chars = string.maketrans("/: ", "---")
 
-CONFIG_FILENAMES = [
+BASE_CONFIG_FILENAMES = [
+'u-boot.cfg', 'u-boot-spl.cfg', 'u-boot-tpl.cfg'
+]
+
+EXTRA_CONFIG_FILENAMES = [
 '.config', '.config-spl', '.config-tpl',
 'autoconf.mk', 'autoconf-spl.mk', 'autoconf-tpl.mk',
 'autoconf.h', 'autoconf-spl.h','autoconf-tpl.h',
-'u-boot.cfg', 'u-boot-spl.cfg', 'u-boot-tpl.cfg'
 ]
 
 class Config:
 """Holds information about configuration settings for a board."""
-def __init__(self, target):
+def __init__(self, config_filename, target):
 self.target = target
 self.config = {}
-for fname in CONFIG_FILENAMES:
+for fname in config_filename:
 self.config[fname] = {}
 
 def Add(self, fname, key, value):
@@ -207,7 +210,7 @@ class Builder:
  gnu_make='make', checkout=True, show_unknown=True, step=1,
  no_subdirs=False, full_path=False, verbose_build=False,
  incremental=False, per_board_out_dir=False,
- config_only=False):
+ config_only=False, squash_config_y=False):
 """Create a new Builder object
 
 Args:
@@ -231,6 +234,7 @@ class Builder:
 per_board_out_dir: Build in a separate persistent directory per
 board rather than a thread-specific directory
 config_only: Only configure each build, don't build it
+squash_config_y: Convert CONFIG options with the value 'y' to '1'
 """
 self.toolchains = toolchains
 self.base_dir = base_dir
@@ -260,6 +264,10 @@ class Builder:
 self.full_path = full_path
 self.verbose_build = verbose_build
 self.config_only = config_only
+self.squash_config_y = squash_config_y
+self.config_filenames = BASE_CONFIG_FILENAMES
+if not self.squash_config_y:
+self.config_filenames += EXTRA_CONFIG_FILENAMES
 
 self.col = terminal.Color()
 
@@ -585,13 +593,15 @@ class Builder:
 key, value = values
 else:
 key = values[0]
-value = ''
+value = '1' if self.squash_config_y else ''
 if not key.startswith('CONFIG_'):
 continue
 elif not line or line[0] in ['#', '*', '/']:
 continue
 else:
 key, value = line.split('=', 1)
+if self.squash_config_y and value == 'y':
+value = '1'
 config[key] = value
 return config
 
@@ -658,7 +668,7 @@ class Builder:
 
 if read_config:
 output_dir = self.GetBuildDir(commit_upto, target)
-for name in CONFIG_FILENAMES:
+for name in self.config_filenames:
 fname = os.path.join(output_dir, name)
 config[name] = self._ProcessConfig(fname)
 
@@ -735,8 +745,8 @@ class Builder:
 line, board)
 last_was_warning = is_warning
 last_func = None

[U-Boot] [PATCH 00/13] buildman: Threading and output improvements

2016-09-18 Thread Simon Glass
This series includes a few minor improvements to buildman:

- Cleaner output and updates on what buildman is doing at the start
- a way to generate only the CONFIG options in a build, for speed (-D)
- a fix for pressing Ctrl-C during a build (so that it exits cleanly).


Simon Glass (13):
  Makefile: Add a target to create the .cfg files
  buildman: Add an option to just create the config
  buildman: Add documentation for CONFIG checking
  buildman: Squash useless output from -K
  patman: Flush output when there is no newline
  buildman: Tidy up the 'cloning' message
  buildman: Print a message when removing old directories
  buildman: Print a message indicating the build is starting
  buildman: Put our local libraries first in the path
  buildman: Allow builds to terminate cleanly
  buildman: Drop the 'active' flag in the builder
  buildman: Don't show a stacktrace on Ctrl-C
  buildman: Drop the 'alive' flag in BuilderThread

 Makefile|  9 ++
 scripts/Makefile.spl|  2 ++
 tools/buildman/README   | 49 +
 tools/buildman/builder.py   | 70 -
 tools/buildman/builderthread.py | 29 +++--
 tools/buildman/buildman.py  |  2 +-
 tools/buildman/cmdline.py   |  4 +++
 tools/buildman/control.py   |  4 ++-
 tools/buildman/test.py  |  4 +--
 tools/patman/terminal.py|  2 ++
 10 files changed, 132 insertions(+), 43 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 03/13] buildman: Add documentation for CONFIG checking

2016-09-18 Thread Simon Glass
The -K option is not mentioned in the README at present. Add some notes
to describe how this is used.

Signed-off-by: Simon Glass 
---

 tools/buildman/README | 37 +
 1 file changed, 37 insertions(+)

diff --git a/tools/buildman/README b/tools/buildman/README
index 8c5f861..ee330ba 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -959,6 +959,43 @@ of the source tree, thus allowing rapid tested evolution 
of the code.
 SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -I -P tegra
 
 
+Checking configuration
+==
+
+A common requirement when converting CONFIG options to Kconfig is to check
+that the effective configuration has not changed due to the conversion.
+Buildman supports this with the -K option, used after a build. This shows
+differences in effective configuration between one commit and the next.
+
+For example:
+
+$ buildman -b kc4 -sK
+...
+43: Convert CONFIG_SPL_USBETH_SUPPORT to Kconfig
+arm:
++ u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1
++ u-boot-spl.cfg: CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1
++ all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC_SUPPORT=1 
CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1
+am335x_evm_usbspl :
++ u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1
++ u-boot-spl.cfg: CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1
++ all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC_SUPPORT=1 
CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1
+44: Convert CONFIG_SPL_USB_HOST_SUPPORT to Kconfig
+...
+
+This shows that commit 44 enabled three new options for the board
+am335x_evm_usbspl which were not enabled in commit 43. There is also a
+summary for 'arm' showing all the changes detected for that architecture.
+In this case there is only one board with changes, so 'arm' output is the
+same as 'am335x_evm_usbspl'/
+
+The -K option uses the u-boot.cfg, spl/u-boot-spl.cfg and tpl/u-boot-tpl.cfg
+files which are produced by a build. If all you want is to check the
+configuration you can in fact avoid doing a full build, using -D. This tells
+buildman to configuration U-Boot and create the .cfg files, but not actually
+build the source. This is 5-10 times faster than doing a full build.
+
+
 Other options
 =
 
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 02/13] buildman: Add an option to just create the config

2016-09-18 Thread Simon Glass
Normally buildman does a full build of a board. This includes creating the
u-boot.cfg file which contains all the configuration options. Buildman uses
this file with the -K option, to show differences in effective configuration
for each commit.

Doing a full build of U-Boot just to create the u-boot.cfg file is wasteful.
Add a -D option which causes buildman to only create the configuration. This
is enough to support use of -K and can be done much more quickly (typically
5-10 times faster).

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py   |  5 -
 tools/buildman/builderthread.py | 17 +++--
 tools/buildman/cmdline.py   |  2 ++
 tools/buildman/control.py   |  3 ++-
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 8ec3551..98f1091 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -206,7 +206,8 @@ class Builder:
 def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs,
  gnu_make='make', checkout=True, show_unknown=True, step=1,
  no_subdirs=False, full_path=False, verbose_build=False,
- incremental=False, per_board_out_dir=False):
+ incremental=False, per_board_out_dir=False,
+ config_only=False):
 """Create a new Builder object
 
 Args:
@@ -229,6 +230,7 @@ class Builder:
 mrproper when configuring
 per_board_out_dir: Build in a separate persistent directory per
 board rather than a thread-specific directory
+config_only: Only configure each build, don't build it
 """
 self.toolchains = toolchains
 self.base_dir = base_dir
@@ -257,6 +259,7 @@ class Builder:
 self.no_subdirs = no_subdirs
 self.full_path = full_path
 self.verbose_build = verbose_build
+self.config_only = config_only
 
 self.col = terminal.Color()
 
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index c512d3b..a30e4fd 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -110,8 +110,8 @@ class BuilderThread(threading.Thread):
 return self.builder.do_make(commit, brd, stage, cwd, *args,
 **kwargs)
 
-def RunCommit(self, commit_upto, brd, work_dir, do_config, force_build,
-  force_build_failures):
+def RunCommit(self, commit_upto, brd, work_dir, do_config, do_build,
+  force_build, force_build_failures):
 """Build a particular commit.
 
 If the build is already done, and we are not forcing a build, we skip
@@ -122,6 +122,7 @@ class BuilderThread(threading.Thread):
 brd: Board object to build
 work_dir: Directory to which the source will be checked out
 do_config: True to run a make _defconfig on the source
+do_build: Try to build the source
 force_build: Force a build even if one was previously done
 force_build_failures: Force a bulid if the previous result showed
 failure
@@ -231,6 +232,8 @@ class BuilderThread(threading.Thread):
 config_out += result.combined
 do_config = False   # No need to configure next time
 if result.return_code == 0:
+if not do_build:
+args.append('cfg')
 result = self.Make(commit, brd, 'build', cwd, *args,
 env=env)
 result.stderr = result.stderr.replace(src_dir + '/', '')
@@ -405,7 +408,7 @@ class BuilderThread(threading.Thread):
 force_build = False
 for commit_upto in range(0, len(job.commits), job.step):
 result, request_config = self.RunCommit(commit_upto, brd,
-work_dir, do_config,
+work_dir, do_config, not self.builder.config_only,
 force_build or self.builder.force_build,
 self.builder.force_build_failures)
 failed = result.return_code or result.stderr
@@ -415,9 +418,10 @@ class BuilderThread(threading.Thread):
 # with a reconfig.
 if self.builder.force_config_on_failure:
 result, request_config = self.RunCommit(commit_upto,
-brd, work_dir, True, True, False)
+brd, work_dir, True, False, True, False)
 did_config = True
-if not self.builder.force_reconfig:
+if (not self.builder.force_reconfig and
+not self.builder.config_only):
 do_config = request_config
 
 # If we built that commit, then config is done. But if we got
@@ -459,7 +463,8 @@ class 

Re: [U-Boot] [PATCH] Revert "image-fit: switch ENOLINK to ENOENT"

2016-09-18 Thread Jonathan Gray
On Sun, Sep 18, 2016 at 03:14:30PM +0200, Marek Vasut wrote:
> On 09/17/2016 05:42 AM, Jonathan Gray wrote:
> > On Fri, Sep 16, 2016 at 10:21:43PM +0100, Paul Burton wrote:
> >> Commit bac17b78dace ("image-fit: switch ENOLINK to ENOENT") changed
> >> fit_get_node_from_config to return -ENOENT when a property doesn't
> >> exist, but didn't change any of its callers which check return values.
> >> Notably it didn't change boot_get_ramdisk, which leads to U-Boot failing
> >> to boot FIT images which don't include ramdisks with the following
> >> message:
> >>
> >>   Ramdisk image is corrupt or invalid
> >>
> >> The offending commit seems to dislike ENOLINK due to it not existing on
> >> OpenBSD, but I'm not sure why that matters as we define it in
> >> include/asm-generic/errno.h anyway so simply revert the commit to fix
> >> FIT image handling.
> > 
> > That header is not used when building native tools.
> > So reverting it will break the build of u-boot on OpenBSD.
> > 
> >   WRAPtools/common/image-fit.c
> >   HOSTCC  tools/common/image-fit.o
> > In file included from tools/common/image-fit.c:1:
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c: In function 
> > 'fit_get_node_from_config':
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: 
> > 'ENOLINK' undeclared (first use in this function)
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: (Each 
> > undeclared identifier is reported only once
> > /usr/users/jsg/src/u-boot/tools/../common/image-fit.c:1569: error: for each 
> > function it appears in.)
> > 
> 
> I seriously do not care if it's broken on OpenBSD if there is about one
> user of such system. The problem is the original patch broke booting of
> fitImage-wrapped kernels and this is serious breakage which makes
> 2016.09 release effectively useless.

So in your view uboot should remove support for hardware you don't have
and booting methods you don't use and not strive to remove the use of
non-portable interfaces?

Not having to deal with wrapped kernels with the efi interface present
in uboot >= 2016.05 and being able to have entry points for basic things
like character io and reading blocks off disks is what made uboot actually
useable for many people that previously had to deal with the largely
unmaintained api interface.

> 
> I do support this revert and we will likely need v2016.09.1 unfortunately.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/27] spl: Convert boot_device into a struct

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:56PM -0600, Simon Glass wrote:

> At present some spl_xxx_load_image() functions take a parameter and some
> don't. Of those that do, most take an integer but one takes a string.
> 
> Convert this parameter into a struct so that we can pass all functions the
> same thing. This will allow us to use a common function signature.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 00/27] spl: Use linker list and parameters for SPL image loading

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:49PM -0600, Simon Glass wrote:

> At present the SPL code uses a global spl_image variable which is shared
> amongst lots of files, some in common/spl and some elsewhere. There is no
> need for this to be global, and in fact a parameter makes it easier to
> understand what information the functions act on. It also reduces the BSS
> use in the SPL (at the expense of stack) which is useful on boards which
> don't have BSS available early on.

Thanks for taking a stab at cleaning this up.

[snip]
> There is a priorty value attached to each loader which should allow the
> existing ordering to be maintained.

I worry here about some of the corner cases, but it's probably no more
or less fragile than currently at least.  I'm actually not sure how
that's working in this version of the series, everyone gets priority 0
filled in so it seems like we're on linker order.  But I'm also not
convinced that it's a problem here.  As far as I can recall, the use
cases are that a given binary will support say NAND and MMC, and at run
time knows that it came from NAND or MMC, and thus we need to look at
the same device for U-Boot itself.  So order doesn't matter there.  So
we can just drop that part I think.

> Code size is about 20 bytes larger on average which I think is acceptable.
> The BSS size drops by about 64 bytes, but really this just transfers to
> the stack.

How about the worst case growths in what we have today?

> There is an obvious follow-on from this, to move boot_name_table[] into the
> same linker list struct (i.e. add a name field to struct spl_image_loader).
> The complication here is that we don't want naming if
> CONFIG_SPL_LIBCOMMON_SUPPORT is not enabled, since it bloats the code. In
> addition I think that common/spl/spl.c can be tidied up a little.

Yeah, I worry about size growth in doing that too.  But maybe we can be
a little clever when declaring the ll and just not have the strings if
!LIBCOMMON ?

-- 
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 08/27] spl: Add a way to declare an SPL image loader

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:57PM -0600, Simon Glass wrote:
> Add a linker list macro which can be used to declare an SPL image loader.
> Update spl_load_image() to search available loaders for the correct one.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  common/spl/spl.c | 20 
>  include/spl.h| 32 
>  2 files changed, 52 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 3716e6a..719ae6e 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -344,12 +344,32 @@ static void announce_boot_device(u32 boot_device)
>  static inline void announce_boot_device(u32 boot_device) { }
>  #endif
>  
> +static struct spl_image_loader *spL_find_loader(uint boot_device)

I don't like spL here, I mis-read that as a typo the second time I saw
it.  Maybe a function comment and spl_ll_find_loader ?

-- 
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 06/27] spl: Kconfig: Move SPL_DISPLAY_PRINT to Kconfig

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:55PM -0600, Simon Glass wrote:

> Move this option to Kconfig and tidy up existing uses. Also add a function
> comment to the header file.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 05/27] spl: Add function comments to spl_start_uboot()

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:54PM -0600, Simon Glass wrote:

> Add some comments to describe this function.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 04/27] spl: Add a parameter to jump_to_image_linux()

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:53PM -0600, Simon Glass wrote:

> Instead of using the global spl_image variable, pass the required struct in
> as an argument.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 03/27] spl: Add a parameter to spl_parse_image_header()

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:52PM -0600, Simon Glass wrote:

> Instead of using the global spl_image variable, pass the required struct in
> as an argument.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 01/27] spl: Move spl_board_load_image() into a generic header

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:50PM -0600, Simon Glass wrote:

> At present this is only used on ARM and sandbox, but it is just as
> applicable to other architectures. Move the function prototype into the
> generic SPL header.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
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 02/27] spl: Add a parameter to spl_set_header_raw_uboot()

2016-09-18 Thread Tom Rini
On Sun, Sep 18, 2016 at 01:44:51PM -0600, Simon Glass wrote:

> Rather than act on the global variable, pass the required struct in as a
> parameter.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


[U-Boot] [PATCH 19/27] spl: Convert spl_spi_load_image() to use linker list

2016-09-18 Thread Simon Glass
Add a linker list declaration for this method and remove the explicit
switch() code. Also set up the sunxi function.

Signed-off-by: Simon Glass 
---

 common/spl/spl.c| 4 
 common/spl/spl_spi.c| 4 +++-
 drivers/mtd/spi/sunxi_spi_spl.c | 4 +++-
 include/spl.h   | 3 ---
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 5dd2548..1d4f258 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -373,10 +373,6 @@ static int spl_load_image(u32 boot_device)
return loader->load_image();
 
switch (boot_device) {
-#if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT)
-   case BOOT_DEVICE_SPI:
-   return spl_spi_load_image();
-#endif
 #ifdef CONFIG_SPL_ETH_SUPPORT
case BOOT_DEVICE_CPGMAC:
 #ifdef CONFIG_SPL_ETH_DEVICE
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index e4cc0d0..b9294f2 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -65,7 +65,7 @@ static ulong spl_spi_fit_read(struct spl_load_info *load, 
ulong sector,
  * configured and available since this code loads the main U-Boot image
  * from SPI into SDRAM and starts it from there.
  */
-int spl_spi_load_image(struct spl_boot_device *bootdev)
+static int spl_spi_load_image(struct spl_boot_device *bootdev)
 {
int err = 0;
struct spi_flash *flash;
@@ -121,3 +121,5 @@ int spl_spi_load_image(struct spl_boot_device *bootdev)
 
return err;
 }
+/* Use priorty 1 so that boards can override this */
+SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_SPI, spl_spi_load_image);
diff --git a/drivers/mtd/spi/sunxi_spi_spl.c b/drivers/mtd/spi/sunxi_spi_spl.c
index 767959c..70d6d15 100644
--- a/drivers/mtd/spi/sunxi_spi_spl.c
+++ b/drivers/mtd/spi/sunxi_spi_spl.c
@@ -262,7 +262,7 @@ static void spi0_read_data(void *buf, u32 addr, u32 len)
 
 /*/
 
-int spl_spi_load_image(struct spl_boot_device *bootdev)
+static int spl_spi_load_image(struct spl_boot_device *bootdev)
 {
int err;
struct image_header *header;
@@ -281,3 +281,5 @@ int spl_spi_load_image(struct spl_boot_device *bootdev)
spi0_deinit();
return 0;
 }
+/* Use priorty 0 to override the default if it happens to be linked in */
+SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SPI, spl_spi_load_image);
diff --git a/include/spl.h b/include/spl.h
index 279896d..29dcf5b 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -181,9 +181,6 @@ struct spl_image_loader {
.load_image = __method, \
}
 
-/* SPI SPL functions */
-int spl_spi_load_image(struct spl_boot_device *bootdev);
-
 /* Ethernet SPL functions */
 int spl_net_load_image(struct spl_boot_device *bootdev);
 
-- 
2.8.0.rc3.226.g39d4020

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


[U-Boot] [PATCH 24/27] spl: Update ext functions to take an spl_image parameter

2016-09-18 Thread Simon Glass
Update the ext loader to avoid using the spl_image global variable.

Signed-off-by: Simon Glass 
---

 common/spl/spl_ext.c| 21 -
 common/spl/spl_mmc.c|  4 ++--
 drivers/mtd/spi/sunxi_spi_spl.c |  9 +
 include/spl.h   |  6 --
 4 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index e5af24e..b93e1ea 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -10,9 +10,9 @@
 #include 
 
 #ifdef CONFIG_SPL_EXT_SUPPORT
-int spl_load_image_ext(struct blk_desc *block_dev,
-   int partition,
-   const char *filename)
+int spl_load_image_ext(struct spl_image_info *spl_image,
+  struct blk_desc *block_dev, int partition,
+  const char *filename)
 {
s32 err;
struct image_header *header;
@@ -48,13 +48,13 @@ int spl_load_image_ext(struct blk_desc *block_dev,
goto end;
}
 
-   err = spl_parse_image_header(_image, header);
+   err = spl_parse_image_header(spl_image, header);
if (err < 0) {
puts("spl: ext: failed to parse image header\n");
goto end;
}
 
-   err = ext4fs_read((char *)spl_image.load_addr, filelen, );
+   err = ext4fs_read((char *)spl_image->load_addr, filelen, );
 
 end:
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
@@ -67,7 +67,8 @@ end:
 }
 
 #ifdef CONFIG_SPL_OS_BOOT
-int spl_load_image_ext_os(struct blk_desc *block_dev, int partition)
+int spl_load_image_ext_os(struct spl_image_info *spl_image,
+ struct blk_desc *block_dev, int partition)
 {
int err;
__maybe_unused loff_t filelen, actlen;
@@ -104,7 +105,8 @@ int spl_load_image_ext_os(struct blk_desc *block_dev, int 
partition)
}
file = getenv("falcon_image_file");
if (file) {
-   err = spl_load_image_ext(block_dev, partition, file);
+   err = spl_load_image_ext(spl_image, block_dev,
+partition, file);
if (err != 0) {
puts("spl: falling back to default\n");
goto defaults;
@@ -134,11 +136,12 @@ defaults:
return -1;
}
 
-   return spl_load_image_ext(block_dev, partition,
+   return spl_load_image_ext(spl_image, block_dev, partition,
CONFIG_SPL_FS_LOAD_KERNEL_NAME);
 }
 #else
-int spl_load_image_ext_os(struct blk_desc *block_dev, int partition)
+int spl_load_image_ext_os(struct spl_image_info *spl_image,
+ struct blk_desc *block_dev, int partition)
 {
return -ENOSYS;
 }
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 6536e66..5f5d9d0 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -245,13 +245,13 @@ static int spl_mmc_do_fs_boot(struct spl_image_info 
*spl_image, struct mmc *mmc)
 #endif
 #ifdef CONFIG_SPL_EXT_SUPPORT
if (!spl_start_uboot()) {
-   err = spl_load_image_ext_os(>block_dev,
+   err = spl_load_image_ext_os(spl_image, >block_dev,
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION);
if (!err)
return err;
}
 #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-   err = spl_load_image_ext(>block_dev,
+   err = spl_load_image_ext(spl_image, >block_dev,
 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
if (!err)
diff --git a/drivers/mtd/spi/sunxi_spi_spl.c b/drivers/mtd/spi/sunxi_spi_spl.c
index 70d6d15..67c7edd 100644
--- a/drivers/mtd/spi/sunxi_spi_spl.c
+++ b/drivers/mtd/spi/sunxi_spi_spl.c
@@ -262,7 +262,8 @@ static void spi0_read_data(void *buf, u32 addr, u32 len)
 
 /*/
 
-static int spl_spi_load_image(struct spl_boot_device *bootdev)
+static int spl_spi_load_image(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev)
 {
int err;
struct image_header *header;
@@ -271,12 +272,12 @@ static int spl_spi_load_image(struct spl_boot_device 
*bootdev)
spi0_init();
 
spi0_read_data((void *)header, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40);
-   err = spl_parse_image_header(_image, header);
+   err = spl_parse_image_header(spl_image, header);
if (err)
return err;
 
-   spi0_read_data((void *)spl_image.load_addr, CONFIG_SYS_SPI_U_BOOT_OFFS,
-  spl_image.size);
+   spi0_read_data((void *)spl_image->load_addr, CONFIG_SYS_SPI_U_BOOT_OFFS,
+  spl_image->size);
 
spi0_deinit();
return 0;
diff --git 

  1   2   3   >