[U-Boot] [PATCH 1/1] efi_loader: set image_base and image_size to correct values

2018-09-29 Thread Heinrich Schuchardt
From: AKASHI Takahiro 

Currently, image's image_base points to an address where the image was
temporarily uploaded for further loading. Since efi_loader relocates
the image to final destination, image_base and image_size should reflect
that.

This bug was detected in UEFI SCT, "Loaded Image Protocol Test - test 2,"
which shows that 'Unload' function doesn't fit into a range suggested by
image_base and image_size.
TestCase/UEFI/EFI/Protocol/LoadedImage/BlackBoxTest/
LoadedImageBBTestMain.c:1002

This patch also reverts a patch, "efi_loader: save image relocation address
and size" since newly added fields are no longer needed.

Signed-off-by: AKASHI Takahiro 

Rebase the patch. Keep the relocation address in struct efi_image_object.
We will use the address to free the image in UnloadImage.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_image_loader.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_image_loader.c 
b/lib/efi_loader/efi_image_loader.c
index a18ce0a5705..39902152f3c 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -212,7 +212,6 @@ void *efi_load_pe(struct efi_loaded_image_obj *handle, void 
*efi,
int rel_idx = IMAGE_DIRECTORY_ENTRY_BASERELOC;
void *entry;
uint64_t image_base;
-   uint64_t image_size;
unsigned long virt_size = 0;
int supported = 0;
 
@@ -256,7 +255,6 @@ void *efi_load_pe(struct efi_loaded_image_obj *handle, void 
*efi,
IMAGE_NT_HEADERS64 *nt64 = (void *)nt;
IMAGE_OPTIONAL_HEADER64 *opt = >OptionalHeader;
image_base = opt->ImageBase;
-   image_size = opt->SizeOfImage;
efi_set_code_and_data_type(loaded_image_info, opt->Subsystem);
efi_reloc = efi_alloc(virt_size,
  loaded_image_info->image_code_type);
@@ -272,7 +270,6 @@ void *efi_load_pe(struct efi_loaded_image_obj *handle, void 
*efi,
} else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
IMAGE_OPTIONAL_HEADER32 *opt = >OptionalHeader;
image_base = opt->ImageBase;
-   image_size = opt->SizeOfImage;
efi_set_code_and_data_type(loaded_image_info, opt->Subsystem);
efi_reloc = efi_alloc(virt_size,
  loaded_image_info->image_code_type);
@@ -315,10 +312,10 @@ void *efi_load_pe(struct efi_loaded_image_obj *handle, 
void *efi,
invalidate_icache_all();
 
/* Populate the loaded image interface bits */
-   loaded_image_info->image_base = efi;
-   loaded_image_info->image_size = image_size;
handle->reloc_base = efi_reloc;
handle->reloc_size = virt_size;
+   loaded_image_info->image_base = efi_reloc;
+   loaded_image_info->image_size = virt_size;
 
return entry;
 }
-- 
2.19.0

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


Re: [U-Boot] Pull request: u-boot-sunxi/master

2018-09-29 Thread Tom Rini
On Fri, Sep 28, 2018 at 10:14:28PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> thanks,
> Jagan.
> 
> The following changes since commit bbef20d479441b01d62252cf127498c58078b2c3:
> 
>   Merge tag 'xilinx-for-v2018.11' of git://git.denx.de/u-boot-microblaze 
> (2018-09-27 08:29:10 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sunxi.git master
> 
> for you to fetch changes up to 9ad93c0c968c8e6cd1273b73c44ec7262c616408:
> 
>   ARM: dts: sun8i: Update A23/A33/r16 dts(i) files from Linux-v4.18-rc3 
> (2018-09-28 22:09:24 +0530)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-09-29 Thread Tom Rini
On Fri, Sep 28, 2018 at 03:35:52PM +, York Sun wrote:

> Tom,
> 
> The following changes since commit 9dc8d155d4e88563f572ee79aab758eb4272f3fd:
> 
>   Merge git://git.denx.de/u-boot-imx (2018-09-19 20:35:27 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-mpc85xx.git tags/mpc85xx-for-v2018.11-rc1
> 
> for you to fetch changes up to 432054b947a79dbf0f1554f6d6814e8ea8ecb623:
> 
>   powerpc: dts: Enable device tree support for T2080QDS (2018-09-27
> 10:14:14 -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-09-29 Thread Tom Rini
On Fri, Sep 28, 2018 at 03:04:42PM +, York Sun wrote:

> Tom,
> 
> The following changes since commit 9dc8d155d4e88563f572ee79aab758eb4272f3fd:
> 
>   Merge git://git.denx.de/u-boot-imx (2018-09-19 20:35:27 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-fsl-qoriq.git tags/fsl-qoriq-for-v2018.11-rc1
> 
> for you to fetch changes up to 26cbc0d663555b8af7d40ecfd0d0fefe960d9686:
> 
>   armv7: ls102xa: Disable QE before enter deep sleep (2018-09-27
> 10:01:28 -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/5] video: anx6345: don't fail if there's no sleep or reset GPIOs

2018-09-29 Thread Vagrant Cascadian
From: Vasily Khoruzhick 

If there's no sleep or reset GPIOs, video_bridge_set_active() returns
-ENOENT. Don't fail in this case, since these GPIOs are optional.

Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Vagrant Cascadian 
---

 drivers/video/bridge/anx6345.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c
index 3e3f0e2ce6..28cf2a9c2d 100644
--- a/drivers/video/bridge/anx6345.c
+++ b/drivers/video/bridge/anx6345.c
@@ -274,7 +274,7 @@ static int anx6345_enable(struct udevice *dev)
 
/* Deassert reset and enable power */
ret = video_bridge_set_active(dev, true);
-   if (ret)
+   if (ret && ret != -ENOENT)
return ret;
 
/* Reset */
-- 
2.11.0

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


[U-Boot] [PATCH 2/5] dm: video: bridge: don't fail to activate bridge if sleep gpio is missing

2018-09-29 Thread Vagrant Cascadian
From: Vasily Khoruzhick 

Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio.
We shouldn't fail early in case of missing sleep gpio, otherwise we won't
deassert reset.

Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Vagrant Cascadian 
---

 drivers/video/bridge/video-bridge-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/bridge/video-bridge-uclass.c 
b/drivers/video/bridge/video-bridge-uclass.c
index cd4959cc71..46936a0626 100644
--- a/drivers/video/bridge/video-bridge-uclass.c
+++ b/drivers/video/bridge/video-bridge-uclass.c
@@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool 
active)
 
debug("%s: %d\n", __func__, active);
ret = dm_gpio_set_value(_priv->sleep, !active);
-   if (ret)
+   if (ret != -ENOENT)
return ret;
if (active) {
ret = dm_gpio_set_value(_priv->reset, true);
@@ -120,7 +120,7 @@ int video_bridge_set_active(struct udevice *dev, bool 
active)
ret = dm_gpio_set_value(_priv->reset, false);
}
 
-   return ret;
+   return 0;
 }
 
 UCLASS_DRIVER(video_bridge) = {
-- 
2.11.0

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


[U-Boot] [PATCH 4/5] sun50i: a64: add support for R_I2C controller

2018-09-29 Thread Vagrant Cascadian
From: Vasily Khoruzhick 

Allwinner A64 has a I2C controller, which is in the R_ MMIO zone and has
two groups of pinmuxes on PL bank, so it's called R_I2C.

Add support for this I2C controller and the pinmux which doesn't conflict
with RSB

Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Vagrant Cascadian 
---

 arch/arm/dts/sun50i-a64.dtsi   | 17 +
 arch/arm/include/asm/arch-sunxi/gpio.h |  1 +
 arch/arm/mach-sunxi/Kconfig|  1 +
 board/sunxi/board.c|  6 ++
 4 files changed, 25 insertions(+)

diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
index 7a083637c4..80ddcf0af3 100644
--- a/arch/arm/dts/sun50i-a64.dtsi
+++ b/arch/arm/dts/sun50i-a64.dtsi
@@ -627,6 +627,18 @@
};
};
 
+   r_i2c: i2c@1f02400 {
+   compatible = "allwinner,sun50i-a64-i2c",
+"allwinner,sun6i-a31-i2c";
+   reg = <0x01f02400 0x400>;
+   interrupts = ;
+   clocks = <_ccu 9>;
+   resets = <_ccu 5>;
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+
gic: interrupt-controller@1c81000 {
compatible = "arm,gic-400";
reg = <0x01c81000 0x1000>,
@@ -679,6 +691,11 @@
pins = "PL0", "PL1";
function = "s_rsb";
};
+
+   r_i2c_pins_a: i2c-a {
+   pins = "PL8", "PL9";
+   function = "s_i2c";
+   };
};
 
r_rsb: rsb@1f03400 {
diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
b/arch/arm/include/asm/arch-sunxi/gpio.h
index 6a5eafc3d3..2daf23f6f5 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -211,6 +211,7 @@ enum sunxi_gpio_number {
 #define SUN8I_H3_GPL_R_TWI 2
 #define SUN8I_A23_GPL_R_TWI3
 #define SUN8I_GPL_R_UART   2
+#define SUN50I_GPL_R_TWI   2
 
 #define SUN9I_GPN_R_RSB3
 
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index ae77ee9e8e..fccef9d706 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -273,6 +273,7 @@ config MACH_SUN50I
select DM_I2C
select MMC_SUNXI_SUPPORTS_CALIBRATION
select PHY_SUN4I_USB
+   select SUN6I_PRCM
select SUNXI_DE2
select SUNXI_GEN_SUN6I
select SUPPORT_SPL
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index d1d7f9f400..90f8bc0a6e 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -168,10 +168,16 @@ void i2c_init_board(void)
 #endif
 
 #ifdef CONFIG_R_I2C_ENABLE
+#ifdef CONFIG_MACH_SUN50I
+   clock_twi_onoff(5, 1);
+   sunxi_gpio_set_cfgpin(SUNXI_GPL(8), SUN50I_GPL_R_TWI);
+   sunxi_gpio_set_cfgpin(SUNXI_GPL(9), SUN50I_GPL_R_TWI);
+#else
clock_twi_onoff(5, 1);
sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
 #endif
+#endif
 }
 
 #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
-- 
2.11.0

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


[U-Boot] [PATCH 5/5] sunxi: add support for Pinebook

2018-09-29 Thread Vagrant Cascadian
From: Vasily Khoruzhick 

Pinebook is a laptop produced by Pine64, with USB-connected keyboard,
USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP
bridge from Analogix.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 

Signed-off-by: Vagrant Cascadian 
---

 arch/arm/dts/Makefile|  3 +-
 arch/arm/dts/sun50i-a64-pinebook.dts | 99 
 configs/pinebook_defconfig   | 32 
 3 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts
 create mode 100644 configs/pinebook_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 44ebc50bfa..1bb5d0d47e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -403,7 +403,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-orangepi-win.dtb \
sun50i-a64-pine64-plus.dtb \
sun50i-a64-pine64.dtb \
-   sun50i-a64-sopine-baseboard.dtb
+   sun50i-a64-sopine-baseboard.dtb \
+   sun50i-a64-pinebook.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
sun9i-a80-optimus.dtb \
sun9i-a80-cubieboard4.dtb \
diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts 
b/arch/arm/dts/sun50i-a64-pinebook.dts
new file mode 100644
index 00..48bee4cc7f
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-pinebook.dts
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include 
+#include "sun50i-a64-pine64.dts"
+
+/ {
+   model = "Pinebook";
+   compatible = "pine64,pinebook", "allwinner,sun50i-a64";
+
+   aliases {
+   serial0 = 
+   i2c0 = "/i2c@1f02400";
+   };
+
+   vdd_bl: regulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "bl-3v3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   gpio = < 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
+   enable-active-high;
+   };
+
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 0>;
+   brightness-levels = <0 10 20 30 40 50 60 70 100>;
+   default-brightness-level = <3>;
+   enable-gpios = < 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
+   power-supply = <_bl>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory {
+   reg = <0x4000 0x4000>;
+   };
+};
+
+ {
+   status = "okay";
+};
+
+_i2c {
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c_pins_a>;
+   status = "okay";
+   anx6345: edp-bridge@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
+   status = "okay";
+   };
+};
diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig
new file mode 100644
index 00..15d0f50c41
--- /dev/null
+++ 

[U-Boot] [PATCH 1/5] mmc: sunxi: add support for automatic delay calibration

2018-09-29 Thread Vagrant Cascadian
From: Vasily Khoruzhick 

A64 supports automatic delay calibration and Linux driver uses it
instead of hardcoded delays. Add support for it to u-boot driver.

Fixes eMMC instability on Pinebook

Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Vagrant Cascadian 
---

 arch/arm/include/asm/arch-sunxi/mmc.h |  6 +-
 arch/arm/mach-sunxi/Kconfig   |  1 +
 drivers/mmc/Kconfig   |  4 
 drivers/mmc/sunxi_mmc.c   | 20 +++-
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h 
b/arch/arm/include/asm/arch-sunxi/mmc.h
index d98c53faaa..f2deafddd2 100644
--- a/arch/arm/include/asm/arch-sunxi/mmc.h
+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
@@ -46,7 +46,9 @@ struct sunxi_mmc {
u32 cbda;   /* 0x94 */
u32 res2[26];
 #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
-   u32 res3[64];
+   u32 res3[17];
+   u32 samp_dl;
+   u32 res4[46];
 #endif
u32 fifo;   /* 0x100 / 0x200 FIFO access address */
 };
@@ -130,5 +132,7 @@ struct sunxi_mmc {
 #define SUNXI_MMC_COMMON_CLK_GATE  (1 << 16)
 #define SUNXI_MMC_COMMON_RESET (1 << 18)
 
+#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7)
+
 struct mmc *sunxi_mmc_init(int sdc_no);
 #endif /* _SUNXI_MMC_H */
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 686f38fec4..ae77ee9e8e 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -271,6 +271,7 @@ config MACH_SUN50I
bool "sun50i (Allwinner A64)"
select ARM64
select DM_I2C
+   select MMC_SUNXI_SUPPORTS_CALIBRATION
select PHY_SUN4I_USB
select SUNXI_DE2
select SUNXI_GEN_SUN6I
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 0a0d4aaf6c..fb8f6697d4 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -569,6 +569,10 @@ config MMC_SUNXI_HAS_NEW_MODE
bool
depends on MMC_SUNXI
 
+config MMC_SUNXI_SUPPORTS_CALIBRATION
+   bool
+   depends on MMC_SUNXI
+
 config GENERIC_ATMEL_MCI
bool "Atmel Multimedia Card Interface support"
depends on DM_MMC && BLK && ARCH_AT91
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 39f15eb423..7b064b482c 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -99,11 +99,15 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, 
unsigned int hz)
 {
unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly;
bool new_mode = false;
+   bool calibrate = false;
u32 val = 0;
 
if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
new_mode = true;
 
+   if (IS_ENABLED(CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION))
+   calibrate = true;
+
/*
 * The MMC clock has an extra /2 post-divider when operating in the new
 * mode.
@@ -174,7 +178,11 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, 
unsigned int hz)
val = CCM_MMC_CTRL_MODE_SEL_NEW;
setbits_le32(>reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW);
 #endif
-   } else {
+   } else if (!calibrate) {
+   /*
+* Use hardcoded delay values if controller doesn't support
+* calibration
+*/
val = CCM_MMC_CTRL_OCLK_DLY(oclk_dly) |
CCM_MMC_CTRL_SCLK_DLY(sclk_dly);
}
@@ -228,6 +236,16 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, 
struct mmc *mmc)
rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK;
writel(rval, >reg->clkcr);
 
+#ifdef CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION
+   /* A64 supports calibration of delays on MMC controller and we
+* have to set delay of zero before starting calibration.
+* Allwinner BSP driver sets a delay only in the case of
+* using HS400 which is not supported by mainline U-Boot or
+* Linux at the moment
+*/
+   writel(SUNXI_MMC_CAL_DL_SW_EN, >reg->samp_dl);
+#endif
+
/* Re-enable Clock */
rval |= SUNXI_MMC_CLK_ENABLE;
writel(rval, >reg->clkcr);
-- 
2.11.0

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


[U-Boot] [PATCH 0/5]

2018-09-29 Thread Vagrant Cascadian
This series adds support for the Pinebook, an allwinner A64 laptop
produced by Pine64. It also adds support for mmc delay calibration,
and the anx6345 video bridge, used on the Pinebook.


Vasily Khoruzhick (5):
  mmc: sunxi: add support for automatic delay calibration
  dm: video: bridge: don't fail to activate bridge if sleep gpio is
missing
  video: anx6345: don't fail if there's no sleep or reset GPIOs
  sun50i: a64: add support for R_I2C controller
  sunxi: add support for Pinebook

 arch/arm/dts/Makefile  |  3 +-
 arch/arm/dts/sun50i-a64-pinebook.dts   | 99 ++
 arch/arm/dts/sun50i-a64.dtsi   | 17 +
 arch/arm/include/asm/arch-sunxi/gpio.h |  1 +
 arch/arm/include/asm/arch-sunxi/mmc.h  |  6 +-
 arch/arm/mach-sunxi/Kconfig|  2 +
 board/sunxi/board.c|  6 ++
 configs/pinebook_defconfig | 32 ++
 drivers/mmc/Kconfig|  4 ++
 drivers/mmc/sunxi_mmc.c| 20 +-
 drivers/video/bridge/anx6345.c |  2 +-
 drivers/video/bridge/video-bridge-uclass.c |  4 +-
 12 files changed, 190 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts
 create mode 100644 configs/pinebook_defconfig

-- 
2.11.0

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


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

2018-09-29 Thread Anatolij Gustschin
Hi Tom,

The following changes since commit bbef20d479441b01d62252cf127498c58078b2c3:

  Merge tag 'xilinx-for-v2018.11' of git://git.denx.de/u-boot-microblaze 
(2018-09-27 08:29:10 -0400)

are available in the Git repository at:

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

for you to fetch changes up to c1a65a8c598d27379db91cd47d30103d76311398:

  video: Add support for Arm's Mali Display Processors (2018-09-28 19:11:44 
+0200)


Heinrich Schuchardt (3):
  MAINTAINERS: assign include/video*.h
  dm: video: adjust struct vidconsole_priv description
  dm: video: support more escape sequences

Liviu Dudau (3):
  include/video.h: Remove declaration of functions that don't exist.
  video: Add support for NXP's TDA19988 HDMI encoder
  video: Add support for Arm's Mali Display Processors

Mario Six (6):
  drivers: Add OSD uclass
  video_osd: Add ihs_video_out driver
  video_osd: Add osd sandbox driver and tests
  test: Add ut_asserteq_mem
  test: list: Add tests for hexdump.c
  cmd: Add osd commands

Sébastien Szymanski (1):
  video: cfb_console: flush cache in display_rle8_bitmap

 MAINTAINERS|  12 +
 arch/sandbox/dts/test.dts  |   5 +
 arch/sandbox/include/asm/test.h|   8 +
 board/gdsys/common/Makefile|   4 +
 board/gdsys/common/osd_cmd.c   | 146 +
 board/gdsys/mpc8308/Kconfig|  11 +
 cmd/Kconfig|   8 +
 cmd/Makefile   |   1 +
 cmd/osd.c  | 291 +
 configs/sandbox64_defconfig|   3 +
 configs/sandbox_defconfig  |   3 +
 configs/sandbox_flattree_defconfig |   3 +
 configs/sandbox_noblk_defconfig|   3 +
 configs/sandbox_spl_defconfig  |   3 +
 .../video/osd/gdsys,ihs_video_out.txt  |  23 +
 drivers/video/Kconfig  |  39 ++
 drivers/video/Makefile |   5 +
 drivers/video/cfb_console.c|   4 +
 drivers/video/ihs_video_out.c  | 341 +++
 drivers/video/mali_dp.c| 405 +
 drivers/video/sandbox_osd.c| 161 +
 drivers/video/sandbox_osd.h|  13 +
 drivers/video/tda19988.c   | 653 +
 drivers/video/vidconsole-uclass.c  |  75 ++-
 drivers/video/video_osd-uclass.c   |  45 ++
 include/dm/uclass-id.h |   1 +
 include/test/ut.h  |  18 +
 include/video.h|   6 -
 include/video_console.h|  28 +-
 include/video_osd.h| 192 ++
 test/Makefile  |   1 +
 test/dm/Makefile   |   1 +
 test/dm/osd.c  | 210 +++
 test/lib/Makefile  |   5 +
 test/lib/hexdump.c |  95 +++
 35 files changed, 2791 insertions(+), 31 deletions(-)
 create mode 100644 board/gdsys/common/osd_cmd.c
 create mode 100644 cmd/osd.c
 create mode 100644 doc/device-tree-bindings/video/osd/gdsys,ihs_video_out.txt
 create mode 100644 drivers/video/ihs_video_out.c
 create mode 100644 drivers/video/mali_dp.c
 create mode 100644 drivers/video/sandbox_osd.c
 create mode 100644 drivers/video/sandbox_osd.h
 create mode 100644 drivers/video/tda19988.c
 create mode 100644 drivers/video/video_osd-uclass.c
 create mode 100644 include/video_osd.h
 create mode 100644 test/dm/osd.c
 create mode 100644 test/lib/Makefile
 create mode 100644 test/lib/hexdump.c

Build logs: https://travis-ci.org/vdsao/u-boot-video/builds/434718521

Please pull. Thanks!

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


Re: [U-Boot] [PATCH v2] video: Add support for NXP's TDA19988 HDMI encoder

2018-09-29 Thread Anatolij Gustschin
On Fri, 28 Sep 2018 13:49:31 +0100
Liviu Dudau liviu.du...@foss.arm.com wrote:

> Add support for the NXP TDA19988 HDMI encoder as used on the Juno
> development board from Arm.
> 
> Signed-off-by: Liviu Dudau 
> ---
> Changelog:
>   - v2: Added MAINTAINERS entry and fixed checkpatch warnings.
> 
>  MAINTAINERS  |   5 +
>  drivers/video/Kconfig|   8 +
>  drivers/video/Makefile   |   1 +
>  drivers/video/tda19988.c | 653 +++
>  4 files changed, 667 insertions(+)
>  create mode 100644 drivers/video/tda19988.c

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

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


Re: [U-Boot] [PATCH v2] video: Add support for Arm's Mali Display Processors

2018-09-29 Thread Anatolij Gustschin
On Fri, 28 Sep 2018 13:50:53 +0100
Liviu Dudau liviu.du...@foss.arm.com wrote:

> Add support for Arm Mali Display Processors DP500, DP550 and DP650.
> Only one layer is being used to display the console or boot logo,
> even if more layers are supported in the hardware.
> 
> Signed-off-by: Liviu Dudau 
> ---
> Changelog:
>   - v2: Added MAINTAINERS entry and fixed checkpatch warnings.
> 
>  MAINTAINERS |   6 +
>  drivers/video/Kconfig   |   8 +
>  drivers/video/Makefile  |   1 +
>  drivers/video/mali_dp.c | 405 
>  4 files changed, 420 insertions(+)
>  create mode 100644 drivers/video/mali_dp.c

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

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


[U-Boot] [PATCH v2 17/18] test: Reduce the number of tests run with sandbox_flattree

2018-09-29 Thread Simon Glass
We only need to run driver-model tests with this config, since this is the
only thing that is different when CONFIG_OF_LIVE is not defined. Filter
out the other tests to same time.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to reduce the number of tests run with sandbox_flattree

 test/run | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/run b/test/run
index d64581ab140..fb8ff5da0cb 100755
--- a/test/run
+++ b/test/run
@@ -25,7 +25,8 @@ run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl 
--build \
 # build which does not enable CONFIG_OF_LIVE for the live device tree, so we 
can
 # check that functionality is the same. The standard sandbox build (above) uses
 # CONFIG_OF_LIVE.
-run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build
+run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build \
+   -k test_ut
 
 # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
 # provides and which is built by the sandbox_spl config.
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 18/18] binman: Run tests concurrently

2018-09-29 Thread Simon Glass
At present the tests run one after the other using a single CPU. This is
not very efficient. Bring in the concurrencytest module and run the tests
concurrently, using one process for each CPU by default. A -P option
allows this to be overridden, which is necessary for code-coverage to
function correctly.

This requires fixing a few tests which are currently not fully
independent.

At some point we might consider doing this across all pytests in U-Boot.
There is a pytest version that supports specifying the number of processes
to use, but it did not work for me.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add a patch to run binman tests concurrently

 .travis.yml  |   1 +
 test/py/README.md|   1 +
 tools/binman/binman.py   |  26 +++-
 tools/binman/cmdline.py  |   2 +
 tools/binman/entry_test.py   |   7 +-
 tools/binman/ftest.py|  34 +++---
 tools/concurrencytest/.gitignore |   1 +
 tools/concurrencytest/README.md  |  74 
 tools/concurrencytest/concurrencytest.py | 144 +++
 tools/dtoc/dtoc.py   |   2 +
 tools/dtoc/test_fdt.py   |   2 +
 tools/patman/test_util.py|   2 +-
 12 files changed, 274 insertions(+), 22 deletions(-)
 create mode 100644 tools/concurrencytest/.gitignore
 create mode 100644 tools/concurrencytest/README.md
 create mode 100644 tools/concurrencytest/concurrencytest.py

diff --git a/.travis.yml b/.travis.yml
index ea3b20e0632..6bed41b5837 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,6 +46,7 @@ install:
  - virtualenv /tmp/venv
  - . /tmp/venv/bin/activate
  - pip install pytest
+ - pip install python-subunit
  - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi 
lsefisystab efinet tftp minicmd
  - mkdir ~/grub2-arm
  - ( cd ~/grub2-arm; wget -O - 
http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm
 | rpm2cpio | cpio -di )
diff --git a/test/py/README.md b/test/py/README.md
index aed2fd063a8..4d9d2b81d1e 100644
--- a/test/py/README.md
+++ b/test/py/README.md
@@ -29,6 +29,7 @@ tests. Similar package names should exist in other 
distributions.
 | -- | - |
 | python | 2.7.5-5ubuntu3|
 | python-pytest  | 2.5.1-1   |
+| python-subunit | - |
 | gdisk  | 0.8.8-1ubuntu0.1  |
 | dfu-util   | 0.5-1 |
 | dtc| 1.4.0+dfsg-1  |
diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index f5af5359f3c..439908e6650 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -10,6 +10,7 @@
 """See README for more information"""
 
 import glob
+import multiprocessing
 import os
 import sys
 import traceback
@@ -17,7 +18,7 @@ import unittest
 
 # Bring in the patman and dtoc libraries
 our_path = os.path.dirname(os.path.realpath(__file__))
-for dirname in ['../patman', '../dtoc', '..']:
+for dirname in ['../patman', '../dtoc', '..', '../concurrencytest']:
 sys.path.insert(0, os.path.join(our_path, dirname))
 
 # Bring in the libfdt module
@@ -27,16 +28,22 @@ sys.path.insert(0, os.path.join(our_path,
 
 import cmdline
 import command
+use_concurrent = True
+try:
+from concurrencytest import ConcurrentTestSuite, fork_for_tests
+except:
+use_concurrent = False
 import control
 import test_util
 
-def RunTests(debug, args):
+def RunTests(debug, processes, args):
 """Run the functional tests and any embedded doctests
 
 Args:
 debug: True to enable debugging, which shows a full stack trace on 
error
 args: List of positional args provided to binman. This can hold a test
 name to execute (as in 'binman -t testSections', for example)
+processes: Number of processes to use to run tests (None=same as #CPUs)
 """
 import elf_test
 import entry_test
@@ -54,19 +61,28 @@ def RunTests(debug, args):
 sys.argv = [sys.argv[0]]
 if debug:
 sys.argv.append('-D')
+if debug:
+sys.argv.append('-D')
 
 # Run the entry tests first ,since these need to be the first to import the
 # 'entry' module.
 test_name = args and args[0] or None
+suite = unittest.TestSuite()
+loader = unittest.TestLoader()
 for module in (entry_test.TestEntry, ftest.TestFunctional, 
fdt_test.TestFdt,
elf_test.TestElf, image_test.TestImage):
 if test_name:
 try:
-suite = unittest.TestLoader().loadTestsFromName(test_name, 
module)
+suite.addTests(loader.loadTestsFromName(test_name, module))
 except AttributeError:
 continue
 else:
-suite = unittest.TestLoader().loadTestsFromTestCase(module)
+

[U-Boot] [PATCH v2 06/18] binman: Reorder tests to put helper functions first

2018-09-29 Thread Simon Glass
At present some helper functions are mixed in with the tests. Tidy this
up by moving them to the top. For the few helpers that don't need to be
full class members, make them nested functions.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/binman/ftest.py | 249 +-
 1 file changed, 124 insertions(+), 125 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index abf02b62e81..b90928e738a 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -421,6 +421,111 @@ class TestFunctional(unittest.TestCase):
 AddNode(dtb.GetRoot(), '')
 return tree
 
+def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False):
+"""Handle running a test for insertion of microcode
+
+Args:
+dts_fname: Name of test .dts file
+nodtb_data: Data that we expect in the first section
+ucode_second: True if the microsecond entry is second instead of
+third
+
+Returns:
+Tuple:
+Contents of first region (U-Boot or SPL)
+Offset and size components of microcode pointer, as inserted
+in the above (two 4-byte words)
+"""
+data = self._DoReadFile(dts_fname, True)
+
+# Now check the device tree has no microcode
+if ucode_second:
+ucode_content = data[len(nodtb_data):]
+ucode_pos = len(nodtb_data)
+dtb_with_ucode = ucode_content[16:]
+fdt_len = self.GetFdtLen(dtb_with_ucode)
+else:
+dtb_with_ucode = data[len(nodtb_data):]
+fdt_len = self.GetFdtLen(dtb_with_ucode)
+ucode_content = dtb_with_ucode[fdt_len:]
+ucode_pos = len(nodtb_data) + fdt_len
+fname = tools.GetOutputFilename('test.dtb')
+with open(fname, 'wb') as fd:
+fd.write(dtb_with_ucode)
+dtb = fdt.FdtScan(fname)
+ucode = dtb.GetNode('/microcode')
+self.assertTrue(ucode)
+for node in ucode.subnodes:
+self.assertFalse(node.props.get('data'))
+
+# Check that the microcode appears immediately after the Fdt
+# This matches the concatenation of the data properties in
+# the /microcode/update@xxx nodes in 34_x86_ucode.dts.
+ucode_data = struct.pack('>4L', 0x12345678, 0x12345679, 0xabcd,
+ 0x78235609)
+self.assertEqual(ucode_data, ucode_content[:len(ucode_data)])
+
+# Check that the microcode pointer was inserted. It should match the
+# expected offset and size
+pos_and_size = struct.pack('<2L', 0xfe00 + ucode_pos,
+   len(ucode_data))
+u_boot = data[:len(nodtb_data)]
+return u_boot, pos_and_size
+
+def _RunPackUbootSingleMicrocode(self):
+"""Test that x86 microcode can be handled correctly
+
+We expect to see the following in the image, in order:
+u-boot-nodtb.bin with a microcode pointer inserted at the correct
+place
+u-boot.dtb with the microcode
+an empty microcode region
+"""
+# We need the libfdt library to run this test since only that allows
+# finding the offset of a property. This is required by
+# Entry_u_boot_dtb_with_ucode.ObtainContents().
+data = self._DoReadFile('35_x86_single_ucode.dts', True)
+
+second = data[len(U_BOOT_NODTB_DATA):]
+
+fdt_len = self.GetFdtLen(second)
+third = second[fdt_len:]
+second = second[:fdt_len]
+
+ucode_data = struct.pack('>2L', 0x12345678, 0x12345679)
+self.assertIn(ucode_data, second)
+ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA)
+
+# Check that the microcode pointer was inserted. It should match the
+# expected offset and size
+pos_and_size = struct.pack('<2L', 0xfe00 + ucode_pos,
+   len(ucode_data))
+first = data[:len(U_BOOT_NODTB_DATA)]
+self.assertEqual('nodtb with microcode' + pos_and_size +
+ ' somewhere in here', first)
+
+def _PackUbootSplMicrocode(self, dts, ucode_second=False):
+"""Helper function for microcode tests
+
+We expect to see the following in the image, in order:
+u-boot-spl-nodtb.bin with a microcode pointer inserted at the
+correct place
+u-boot.dtb with the microcode removed
+the microcode
+
+Args:
+dts: Device tree file to use for test
+ucode_second: True if the microsecond entry is second instead of
+third
+"""
+# ELF file with a '_dt_ucode_base_size' symbol
+with open(self.TestFile('u_boot_ucode_ptr')) as fd:
+TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
+first, 

[U-Boot] [PATCH v2 08/18] test: Simplify the PATH setup

2018-09-29 Thread Simon Glass
Use 'export' to avoid repeating the path setup for each command.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/run | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/test/run b/test/run
index d77a1c371b4..6b73813f9bc 100755
--- a/test/run
+++ b/test/run
@@ -16,23 +16,23 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k 
test_ofplatdata.py
 # Run tests for the flat DT version of sandbox
 ./test/py/test.py --bd sandbox_flattree --build
 
+# Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
+# provides and which is built by the sandbox_spl config.
 DTC_DIR=build-sandbox_spl/scripts/dtc
+export PYTHONPATH=${DTC_DIR}/pylibfdt
+export DTC=${DTC_DIR}/dtc
 
-PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
-   ./tools/binman/binman -t
+run_test ./tools/binman/binman -t
 run_test ./tools/patman/patman --test
 run_test ./tools/buildman/buildman -t
-PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test ./tools/dtoc/dtoc -t
+run_test ./tools/dtoc/dtoc -t
 
 # This needs you to set up Python test coverage tools.
 # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
 #   $ sudo apt-get install python-pytest python-coverage
-PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
-   ./tools/binman/binman -T
-PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
-   ./tools/dtoc/dtoc -T
-PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
-   ./tools/dtoc/test_fdt -T
+run_test ./tools/binman/binman -T
+run_test ./tools/dtoc/dtoc -T
+run_test ./tools/dtoc/test_fdt -T
 
 if [ $result == 0 ]; then
echo "Tests passed!"
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 12/18] binman: Fix up removal of temporary directories

2018-09-29 Thread Simon Glass
At present 'make check' leaves some temporary directories around. Part of
this is because we call tools.PrepareOutputDir() twice in some cases,
without calling tools.FinaliseOutputDir() in between.

Fix this.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/binman/elf_test.py   |  5 +
 tools/binman/entry_test.py |  8 ++--
 tools/binman/fdt_test.py   |  4 
 tools/binman/ftest.py  |  8 +++-
 tools/dtoc/test_fdt.py | 10 +++---
 5 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index c16f71401d1..b68530c19ba 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -10,6 +10,7 @@ import unittest
 
 import elf
 import test_util
+import tools
 
 binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
 
@@ -46,6 +47,10 @@ class FakeSection:
 
 
 class TestElf(unittest.TestCase):
+@classmethod
+def setUpClass(self):
+tools.SetInputDirs(['.'])
+
 def testAllSymbols(self):
 """Test that we can obtain a symbol from the ELF file"""
 fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 69d85b4cedb..a8bc938f9e9 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -14,9 +14,14 @@ import fdt_util
 import tools
 
 class TestEntry(unittest.TestCase):
+def setUp(self):
+tools.PrepareOutputDir(None)
+
+def tearDown(self):
+tools.FinaliseOutputDir()
+
 def GetNode(self):
 binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
-tools.PrepareOutputDir(None)
 fname = fdt_util.EnsureCompiled(
 os.path.join(binman_dir,('test/05_simple.dts')))
 dtb = fdt.FdtScan(fname)
@@ -35,7 +40,6 @@ class TestEntry(unittest.TestCase):
 global entry
 reload(entry)
 entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
-tools._RemoveOutputDir()
 del entry
 
 def testEntryContents(self):
diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py
index 8ea098f38ae..b9167012d25 100644
--- a/tools/binman/fdt_test.py
+++ b/tools/binman/fdt_test.py
@@ -21,6 +21,10 @@ class TestFdt(unittest.TestCase):
 self._indir = tempfile.mkdtemp(prefix='binmant.')
 tools.PrepareOutputDir(self._indir, True)
 
+@classmethod
+def tearDownClass(self):
+tools._FinaliseForTest()
+
 def TestFile(self, fname):
 return os.path.join(self._binman_dir, 'test', fname)
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index b90928e738a..a58804c10fe 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -113,7 +113,6 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA)
 TestFunctional._MakeInputDir('devkeys')
 TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
-self._output_setup = False
 
 # ELF file with a '_dt_ucode_base_size' symbol
 with open(self.TestFile('u_boot_ucode_ptr')) as fd:
@@ -228,14 +227,13 @@ class TestFunctional(unittest.TestCase):
 Returns:
 Contents of device-tree binary
 """
-if not self._output_setup:
-tools.PrepareOutputDir(self._indir, True)
-self._output_setup = True
+tools.PrepareOutputDir(None)
 dtb = fdt_util.EnsureCompiled(self.TestFile(fname))
 with open(dtb) as fd:
 data = fd.read()
 TestFunctional._MakeInputFile(outfile, data)
-return data
+tools.FinaliseOutputDir()
+return data
 
 def _GetDtbContentsForSplTpl(self, dtb_data, name):
 """Create a version of the main DTB for SPL or SPL
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index d2597020500..2e6febe8f38 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -60,7 +60,7 @@ class TestFdt(unittest.TestCase):
 
 @classmethod
 def tearDownClass(cls):
-tools._FinaliseForTest()
+tools.FinaliseOutputDir()
 
 def setUp(self):
 self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -128,7 +128,7 @@ class TestNode(unittest.TestCase):
 
 @classmethod
 def tearDownClass(cls):
-tools._FinaliseForTest()
+tools.FinaliseOutputDir()
 
 def setUp(self):
 self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -209,7 +209,7 @@ class TestProp(unittest.TestCase):
 
 @classmethod
 def tearDownClass(cls):
-tools._FinaliseForTest()
+tools.FinaliseOutputDir()
 
 def setUp(self):
 self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -427,6 +427,10 @@ class TestFdtUtil(unittest.TestCase):
 def setUpClass(cls):
 tools.PrepareOutputDir(None)
 
+@classmethod
+def tearDownClass(cls):
+tools.FinaliseOutputDir()
+
 def setUp(self):
 

[U-Boot] [PATCH v2 02/18] sandbox: Unprotect DATA regions in bus tests

2018-09-29 Thread Simon Glass
On my Ubuntu 18.04.1 machine two driver-model bus tests have started
failing recently. The problem appears to be that the DATA region of the
executable is protected. This does not seem correct, but perhaps there
is a reason.

To work around it, unprotect the regions in these tests before accessing
them.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/cpu/os.c | 11 +++
 include/os.h  | 12 
 test/dm/bus.c | 12 
 3 files changed, 35 insertions(+)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 9fbcb9ef92f..d4d6d78dc74 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -636,3 +636,14 @@ void os_abort(void)
 {
abort();
 }
+
+int os_mprotect_allow(void *start, size_t len)
+{
+   int page_size = getpagesize();
+
+   /* Move start to the start of a page, len to the end */
+   start = (void *)(((ulong)start) & ~(page_size - 1));
+   len = (len + page_size * 2) & ~(page_size - 1);
+
+   return mprotect(start, len, PROT_READ | PROT_WRITE);
+}
diff --git a/include/os.h b/include/os.h
index 5c797212c25..7116f875780 100644
--- a/include/os.h
+++ b/include/os.h
@@ -334,4 +334,16 @@ void os_localtime(struct rtc_time *rt);
  * os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger)
  */
 void os_abort(void);
+
+/**
+ * os_mprotect_allow() - Remove write-protection on a region of memory
+ *
+ * The start and length will be page-aligned before use.
+ *
+ * @start: Region start
+ * @len:   Region length in bytes
+ * @return 0 if OK, -1 on error from mprotect()
+ */
+int os_mprotect_allow(void *start, size_t len);
+
 #endif
diff --git a/test/dm/bus.c b/test/dm/bus.c
index e9a4028f047..08137a2216a 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -4,6 +4,9 @@
  */
 
 #include 
+#ifdef CONFIG_SANDBOX
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -297,6 +300,11 @@ static int dm_test_bus_parent_data_uclass(struct 
unit_test_state *uts)
ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, ));
drv = (struct driver *)bus->driver;
size = drv->per_child_auto_alloc_size;
+
+#ifdef CONFIG_SANDBOX
+   os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv));
+   os_mprotect_allow(drv, sizeof(*drv));
+#endif
bus->uclass->uc_drv->per_child_auto_alloc_size = size;
drv->per_child_auto_alloc_size = 0;
ret = test_bus_parent_data(uts);
@@ -440,6 +448,10 @@ static int dm_test_bus_parent_platdata_uclass(struct 
unit_test_state *uts)
ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, ));
drv = (struct driver *)bus->driver;
size = drv->per_child_platdata_auto_alloc_size;
+#ifdef CONFIG_SANDBOX
+   os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv));
+   os_mprotect_allow(drv, sizeof(*drv));
+#endif
bus->uclass->uc_drv->per_child_platdata_auto_alloc_size = size;
drv->per_child_platdata_auto_alloc_size = 0;
ret = test_bus_parent_platdata(uts);
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 14/18] buildman: dtoc: Suppress unwanted output from test

2018-09-29 Thread Simon Glass
There are a few test cases which print output. Suppress this so that tests
can run silently in the normal case.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/buildman/test.py  | 4 +++-
 tools/dtoc/test_dtoc.py | 6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 7259f7b6507..e0c9d6da6a0 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -20,6 +20,7 @@ import control
 import command
 import commit
 import terminal
+import test_util
 import toolchain
 
 use_network = True
@@ -422,7 +423,8 @@ class TestBuild(unittest.TestCase):
 def testToolchainDownload(self):
 """Test that we can download toolchains"""
 if use_network:
-url = self.toolchains.LocateArchUrl('arm')
+with test_util.capture_sys_output() as (stdout, stderr):
+url = self.toolchains.LocateArchUrl('arm')
 self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/'
 'crosstool/files/bin/x86_64/.*/'
 'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz')
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index 72bcb37244e..11bead12607 100644
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -385,7 +385,8 @@ U_BOOT_DEVICE(phandle_source2) = {
 
 def test_phandle_bad(self):
 """Test a node containing an invalid phandle fails"""
-dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts')
+dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts',
+capture_stderr=True)
 output = tools.GetOutputFilename('output')
 with self.assertRaises(ValueError) as e:
 dtb_platdata.run_steps(['struct'], dtb_file, False, output)
@@ -394,7 +395,8 @@ U_BOOT_DEVICE(phandle_source2) = {
 
 def test_phandle_bad2(self):
 """Test a phandle target missing its #*-cells property"""
-dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts')
+dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts',
+capture_stderr=True)
 output = tools.GetOutputFilename('output')
 with self.assertRaises(ValueError) as e:
 dtb_platdata.run_steps(['struct'], dtb_file, False, output)
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 16/18] patman: Don't clear progress in tout unless it was used

2018-09-29 Thread Simon Glass
At present calling Uninit() always called ClearProgress() which outputs
a \r character as well as spaces to remove any progress information on the
line. This can mess up the normal output of binman and other tools. Fix
this by outputing this only when progress information has actually been
previous written.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/patman/tout.py | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 4cd49e1c685..4957c7ae1df 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -15,6 +15,8 @@ NOTICE = 2
 INFO = 3
 DEBUG = 4
 
+in_progress = False
+
 """
 This class handles output of progress and other useful information
 to the user. It provides for simple verbosity level control and can
@@ -48,9 +50,11 @@ def UserIsPresent():
 
 def ClearProgress():
 """Clear any active progress message on the terminal."""
-if verbose > 0 and stdout_is_tty:
+global in_progress
+if verbose > 0 and stdout_is_tty and in_progress:
 _stdout.write('\r%s\r' % (" " * len (_progress)))
 _stdout.flush()
+in_progress = False
 
 def Progress(msg, warning=False, trailer='...'):
 """Display progress information.
@@ -58,6 +62,7 @@ def Progress(msg, warning=False, trailer='...'):
 Args:
 msg: Message to display.
 warning: True if this is a warning."""
+global in_progress
 ClearProgress()
 if verbose > 0:
 _progress = msg + trailer
@@ -65,6 +70,7 @@ def Progress(msg, warning=False, trailer='...'):
 col = _color.YELLOW if warning else _color.GREEN
 _stdout.write('\r' + _color.Color(col, _progress))
 _stdout.flush()
+in_progress = True
 else:
 _stdout.write(_progress + '\n')
 
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 10/18] test: Tidy up comments and variable name

2018-09-29 Thread Simon Glass
The 'result' variable counts the number of failures in running the tests.
Rename it to 'failures' to make this more obvious. Also tidy up a few
comments.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/run | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/run b/test/run
index d9901ae9f72..d64581ab140 100755
--- a/test/run
+++ b/test/run
@@ -9,10 +9,10 @@ run_test() {
echo -n "$1: "
shift
"$@"
-   [ $? -ne 0 ] && result=$((result+1))
+   [ $? -ne 0 ] && failures=$((failures+1))
 }
 
-result=0
+failures=0
 
 # Run all tests that the standard sandbox build can support
 run_test "sandbox" ./test/py/test.py --bd sandbox --build
@@ -21,7 +21,10 @@ run_test "sandbox" ./test/py/test.py --bd sandbox --build
 run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
-k test_ofplatdata.py
 
-# Run tests for the flat DT version of sandbox
+# Run tests for the flat-device-tree version of sandbox. This is a special
+# build which does not enable CONFIG_OF_LIVE for the live device tree, so we 
can
+# check that functionality is the same. The standard sandbox build (above) uses
+# CONFIG_OF_LIVE.
 run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build
 
 # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
@@ -33,6 +36,7 @@ export DTC=${DTC_DIR}/dtc
 run_test "binman" ./tools/binman/binman -t
 run_test "patman" ./tools/patman/patman --test
 run_test "buildman" ./tools/buildman/buildman -t
+run_test "fdt" ./tools/dtoc/test_fdt -t
 run_test "dtoc" ./tools/dtoc/dtoc -t
 
 # This needs you to set up Python test coverage tools.
@@ -42,7 +46,7 @@ run_test "binman code coverage" ./tools/binman/binman -T
 run_test "dtoc code coverage" ./tools/dtoc/dtoc -T
 run_test "fdt code coverage" ./tools/dtoc/test_fdt -T
 
-if [ $result == 0 ]; then
+if [ $failures == 0 ]; then
echo "Tests passed!"
 else
echo "Tests FAILED"
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 03/18] patman: Handle unicode in _ProjectConfigParser tests

2018-09-29 Thread Simon Glass
With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/patman/settings.py | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index ca4334426ba..ea2bc74f759 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -58,25 +58,25 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 >>> config = _ProjectConfigParser("zzz")
 >>> config.readfp(StringIO(sample_config))
 >>> config.get("alias", "enemies")
-'Evil '
+u'Evil '
 
 # Check to make sure that alias gets overridden by project.
 >>> config = _ProjectConfigParser("sm")
 >>> config.readfp(StringIO(sample_config))
 >>> config.get("alias", "enemies")
-'Green G. '
+u'Green G. '
 
 # Check to make sure that settings get merged with project.
 >>> config = _ProjectConfigParser("linux")
 >>> config.readfp(StringIO(sample_config))
 >>> sorted(config.items("settings"))
-[('am_hero', 'True'), ('process_tags', 'False')]
+[(u'am_hero', u'True'), (u'process_tags', u'False')]
 
 # Check to make sure that settings works with unknown project.
 >>> config = _ProjectConfigParser("unknown")
 >>> config.readfp(StringIO(sample_config))
 >>> sorted(config.items("settings"))
-[('am_hero', 'True')]
+[(u'am_hero', u'True')]
 """
 def __init__(self, project_name):
 """Construct _ProjectConfigParser.
@@ -99,6 +99,17 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 for setting_name, setting_value in project_defaults.items():
 self.set(project_settings, setting_name, setting_value)
 
+def _to_unicode(self, val):
+"""Make sure a value is of type 'unicode'
+
+Args:
+val: string or unicode object
+
+Returns:
+unicode version of val
+"""
+return val if isinstance(val, unicode) else val.decode('utf-8')
+
 def get(self, section, option, *args, **kwargs):
 """Extend SafeConfigParser to try project_section before section.
 
@@ -108,14 +119,15 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 See SafeConfigParser.
 """
 try:
-return ConfigParser.SafeConfigParser.get(
+val = ConfigParser.SafeConfigParser.get(
 self, "%s_%s" % (self._project_name, section), option,
 *args, **kwargs
 )
 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
-return ConfigParser.SafeConfigParser.get(
+val = ConfigParser.SafeConfigParser.get(
 self, section, option, *args, **kwargs
 )
+return self._to_unicode(val)
 
 def items(self, section, *args, **kwargs):
 """Extend SafeConfigParser to add project_section to section.
@@ -150,7 +162,8 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 
 item_dict = dict(top_items)
 item_dict.update(project_items)
-return item_dict.items()
+return {(self._to_unicode(item), self._to_unicode(val))
+for item, val in item_dict.iteritems()}
 
 def ReadGitAliases(fname):
 """Read a git alias file. This is in the form used by git:
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 11/18] binman: Add a default path to libfdt.py

2018-09-29 Thread Simon Glass
This module is often available in the sandbox_spl build created by
'make check'. Use this as a default path so that just typing 'binman -t'
(without setting PYTHONPATH) will generally run the tests.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/binman/binman.py | 2 ++
 tools/dtoc/dtoc.py | 5 +
 2 files changed, 7 insertions(+)

diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 1536e956517..f5af5359f3c 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -22,6 +22,8 @@ for dirname in ['../patman', '../dtoc', '..']:
 
 # Bring in the libfdt module
 sys.path.insert(0, 'scripts/dtc/pylibfdt')
+sys.path.insert(0, os.path.join(our_path,
+'../../build-sandbox_spl/scripts/dtc/pylibfdt'))
 
 import cmdline
 import command
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index 827094e72ab..33b2589c561 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -34,6 +34,11 @@ import unittest
 our_path = os.path.dirname(os.path.realpath(__file__))
 sys.path.append(os.path.join(our_path, '../patman'))
 
+# Bring in the libfdt module
+sys.path.insert(0, 'scripts/dtc/pylibfdt')
+sys.path.insert(0, os.path.join(our_path,
+'../../build-sandbox_spl/scripts/dtc/pylibfdt'))
+
 import dtb_platdata
 import test_util
 
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 13/18] binman: Separate out testSplBssPad()

2018-09-29 Thread Simon Glass
At present this test runs binman twice, which means that the temporary
files from the first run do not get cleaned up. Split this into two tests
to fix this problem.

Signed-off-by: Simon Glass 
---

Changes in v2: None

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

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a58804c10fe..cbde8beb5ab 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1028,10 +1028,12 @@ class TestFunctional(unittest.TestCase):
 data = self._DoReadFile('47_spl_bss_pad.dts')
 self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data)
 
+def testSplBssPadMissing(self):
+"""Test that a missing symbol is detected"""
 with open(self.TestFile('u_boot_ucode_ptr')) as fd:
 TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
 with self.assertRaises(ValueError) as e:
-data = self._DoReadFile('47_spl_bss_pad.dts')
+self._DoReadFile('47_spl_bss_pad.dts')
 self.assertIn('Expected __bss_size symbol in spl/u-boot-spl',
   str(e.exception))
 
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 09/18] test: Print the name of each test before running it

2018-09-29 Thread Simon Glass
At present the tests are run without any indication of what is running.
For the tests which start with a build this is pretty obvious, but for
tools it is not.

Add a name for each test we run, and print it before starting the test.
Signed-off-by: Simon Glass 
---

Changes in v2:
- Quote @$ correctly so that quoted arguments can be passed to run_test

 test/run | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/test/run b/test/run
index 6b73813f9bc..d9901ae9f72 100755
--- a/test/run
+++ b/test/run
@@ -1,20 +1,28 @@
 #!/bin/bash
 
+# Script to run all U-Boot tests that use sandbox.
+
+# Runs a test and checks the exit code to decide if it passed
+#  $1: Test name
+#  $2 onwards: command line to run
 run_test() {
-   $@
+   echo -n "$1: "
+   shift
+   "$@"
[ $? -ne 0 ] && result=$((result+1))
 }
 
 result=0
 
 # Run all tests that the standard sandbox build can support
-run_test ./test/py/test.py --bd sandbox --build
+run_test "sandbox" ./test/py/test.py --bd sandbox --build
 
 # Run tests which require sandbox_spl
-run_test ./test/py/test.py --bd sandbox_spl --build -k test_ofplatdata.py
+run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
+   -k test_ofplatdata.py
 
 # Run tests for the flat DT version of sandbox
-./test/py/test.py --bd sandbox_flattree --build
+run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build
 
 # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
 # provides and which is built by the sandbox_spl config.
@@ -22,17 +30,17 @@ DTC_DIR=build-sandbox_spl/scripts/dtc
 export PYTHONPATH=${DTC_DIR}/pylibfdt
 export DTC=${DTC_DIR}/dtc
 
-run_test ./tools/binman/binman -t
-run_test ./tools/patman/patman --test
-run_test ./tools/buildman/buildman -t
-run_test ./tools/dtoc/dtoc -t
+run_test "binman" ./tools/binman/binman -t
+run_test "patman" ./tools/patman/patman --test
+run_test "buildman" ./tools/buildman/buildman -t
+run_test "dtoc" ./tools/dtoc/dtoc -t
 
 # This needs you to set up Python test coverage tools.
 # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
 #   $ sudo apt-get install python-pytest python-coverage
-run_test ./tools/binman/binman -T
-run_test ./tools/dtoc/dtoc -T
-run_test ./tools/dtoc/test_fdt -T
+run_test "binman code coverage" ./tools/binman/binman -T
+run_test "dtoc code coverage" ./tools/dtoc/dtoc -T
+run_test "fdt code coverage" ./tools/dtoc/test_fdt -T
 
 if [ $result == 0 ]; then
echo "Tests passed!"
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 07/18] Makefile: Add a 'check' target for make

2018-09-29 Thread Simon Glass
At present we use 'make tests' to run the tests. For many projects
'make check' is more common, so support that as well. Also add some help
to 'make help'.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 Makefile | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3561fb0ca3b..8b471a22ed2 100644
--- a/Makefile
+++ b/Makefile
@@ -1674,6 +1674,10 @@ help:
@echo  'Configuration targets:'
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
@echo  ''
+   @echo  'Test targets:'
+   @echo  ''
+   @echo  '  check   - Run all automated tests that use sandbox'
+   @echo  ''
@echo  'Other generic targets:'
@echo  '  all - Build all necessary images depending on 
configuration'
@echo  '  tests   - Build U-Boot for sandbox and run tests'
@@ -1712,7 +1716,7 @@ help:
@echo  'Execute "make" or "make all" to build all targets marked with 
[*] '
@echo  'For further info see the ./README file'
 
-tests:
+tests check:
$(srctree)/test/run
 
 # Documentation targets
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 15/18] tools: Set an initial value for indir

2018-09-29 Thread Simon Glass
This variable is not documented or set up in the module. Fix this.

Signed-off-by: Simon Glass 
---

Changes in v2: None

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

diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 1c9bf4e8100..bf099798e65 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -28,6 +28,9 @@ packages = {
 'lz4': 'liblz4-tool',
 }
 
+# List of paths to use when looking for an input file
+indir = []
+
 def PrepareOutputDir(dirname, preserve=False):
 """Select an output directory, ensuring it exists.
 
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 04/18] test/py: Fix unicode handling for log filtering

2018-09-29 Thread Simon Glass
At present the unicode filtering seems to get confused at times with
this error:

  UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
 32: ordinal not in range(128)

It seems to be due to self._nonprint being interpreted as UTF-8. Fix it
by using ordinals instead of characters, changing the string to set.

Signed-off-by: Simon Glass 
Reviewed-by: Stephen Warren 
---

Changes in v2: None

 test/py/multiplexed_log.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index f23d5dec68c..637a3bd257b 100644
--- a/test/py/multiplexed_log.py
+++ b/test/py/multiplexed_log.py
@@ -314,8 +314,9 @@ $(document).ready(function () {
 
 # The set of characters that should be represented as hexadecimal codes in
 # the log file.
-_nonprint = ('%' + ''.join(chr(c) for c in range(0, 32) if c not in (9, 
10)) +
- ''.join(chr(c) for c in range(127, 256)))
+_nonprint = {ord('%')}
+_nonprint.update({c for c in range(0, 32) if c not in (9, 10)})
+_nonprint.update({c for c in range(127, 256)})
 
 def _escape(self, data):
 """Render data format suitable for inclusion in an HTML document.
@@ -331,7 +332,7 @@ $(document).ready(function () {
 """
 
 data = data.replace(chr(13), '')
-data = ''.join((c in self._nonprint) and ('%%%02x' % ord(c)) or
+data = ''.join((ord(c) in self._nonprint) and ('%%%02x' % ord(c)) or
c for c in data)
 data = cgi.escape(data)
 return data
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 05/18] buildman: Make the toolchain test more forgiving

2018-09-29 Thread Simon Glass
The filenames of the toolchains on kernel.org changes every now and then.
Fix it for the current change, and make the test use a regex so that it
has a better chance of passing with future changes too.

Signed-off-by: Simon Glass 
---

Changes in v2: None

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

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index c36bcdf6fb7..7259f7b6507 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -422,8 +422,10 @@ class TestBuild(unittest.TestCase):
 def testToolchainDownload(self):
 """Test that we can download toolchains"""
 if use_network:
-
self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz',
-self.toolchains.LocateArchUrl('arm'))
+url = self.toolchains.LocateArchUrl('arm')
+self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/'
+'crosstool/files/bin/x86_64/.*/'
+'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz')
 
 
 if __name__ == "__main__":
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 01/18] test/py: ignore console read exceptions after test failure

2018-09-29 Thread Simon Glass
From: Stephen Warren 

After a test has failed, test/py drains the U-Boot console log to ensure
that any relevant output is captured. At this point, we don't care about
detecting any additional errors, since the test is already known to have
failed, and U-Boot will be restarted. To ensure that the test cleanup code
is not interrupted, and can correctly terminate the log sections for the
failed test, ignore any exception that occurs while reading the U-Boot
console output during this limited period of time.

Signed-off-by: Stephen Warren 
Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/py/u_boot_console_base.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index a14bad6e8c5..326b2ac51fb 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -304,7 +304,17 @@ class ConsoleBase(object):
 # Wait for something U-Boot will likely never send. This will
 # cause the console output to be read and logged.
 self.p.expect(['This should never match U-Boot output'])
-except u_boot_spawn.Timeout:
+except:
+# We expect a timeout, since U-Boot won't print what we waited
+# for. Squash it when it happens.
+#
+# Squash any other exception too. This function is only used to
+# drain (and log) the U-Boot console output after a failed test.
+# The U-Boot process will be restarted, or target board reset, once
+# this function returns. So, we don't care about detecting any
+# additional errors, so they're squashed so that the rest of the
+# post-test-failure cleanup code can continue operation, and
+# correctly terminate any log sections, etc.
 pass
 finally:
 self.p.timeout = orig_timeout
-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH v2 00/18] test: Various test refinements and improvements

2018-09-29 Thread Simon Glass
This series includes a number of small changes designed to make tests run
more smoothly. The overall goal is that 'make check' runs cleanly without
unnecessary output and all temporary files aare cleaned up.

Changes in v2:
- Quote @$ correctly so that quoted arguments can be passed to run_test
- Add new patch to reduce the number of tests run with sandbox_flattree
- Add a patch to run binman tests concurrently

Simon Glass (17):
  sandbox: Unprotect DATA regions in bus tests
  patman: Handle unicode in _ProjectConfigParser tests
  test/py: Fix unicode handling for log filtering
  buildman: Make the toolchain test more forgiving
  binman: Reorder tests to put helper functions first
  Makefile: Add a 'check' target for make
  test: Simplify the PATH setup
  test: Print the name of each test before running it
  test: Tidy up comments and variable name
  binman: Add a default path to libfdt.py
  binman: Fix up removal of temporary directories
  binman: Separate out testSplBssPad()
  buildman: dtoc: Suppress unwanted output from test
  tools: Set an initial value for indir
  patman: Don't clear progress in tout unless it was used
  test: Reduce the number of tests run with sandbox_flattree
  binman: Run tests concurrently

Stephen Warren (1):
  test/py: ignore console read exceptions after test failure

 .travis.yml  |   1 +
 Makefile |   6 +-
 arch/sandbox/cpu/os.c|  11 +
 include/os.h |  12 +
 test/dm/bus.c|  12 +
 test/py/README.md|   1 +
 test/py/multiplexed_log.py   |   7 +-
 test/py/u_boot_console_base.py   |  12 +-
 test/run |  57 +++--
 tools/binman/binman.py   |  28 ++-
 tools/binman/cmdline.py  |   2 +
 tools/binman/elf_test.py |   5 +
 tools/binman/entry_test.py   |  15 +-
 tools/binman/fdt_test.py |   4 +
 tools/binman/ftest.py| 289 ---
 tools/buildman/test.py   |   8 +-
 tools/concurrencytest/.gitignore |   1 +
 tools/concurrencytest/README.md  |  74 ++
 tools/concurrencytest/concurrencytest.py | 144 +++
 tools/dtoc/dtoc.py   |   7 +
 tools/dtoc/test_dtoc.py  |   6 +-
 tools/dtoc/test_fdt.py   |  12 +-
 tools/patman/settings.py |  27 ++-
 tools/patman/test_util.py|   2 +-
 tools/patman/tools.py|   3 +
 tools/patman/tout.py |   8 +-
 26 files changed, 560 insertions(+), 194 deletions(-)
 create mode 100644 tools/concurrencytest/.gitignore
 create mode 100644 tools/concurrencytest/README.md
 create mode 100644 tools/concurrencytest/concurrencytest.py

-- 
2.19.0.605.g01d371f741-goog

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


[U-Boot] [PATCH 3/5] ARM: DTS: Add support for Logic PD OMAP35 Torpedo & SOM-LV

2018-09-29 Thread Adam Ford
The baseboards and SOM's are virtually identical to their DM37
counterparts, but OMAP36/37 and OMAP3 have some minor register
differences.  With the boards being mostly driven by device trees
now, this synchronizes their respective device trees with linux-omap
for-next branch destined for 4.20 (or whatever the version after 4.19
will be called)

Signed-off-by: Adam Ford 

diff --git a/arch/arm/dts/logicpd-som-lv-35xx-devkit.dts 
b/arch/arm/dts/logicpd-som-lv-35xx-devkit.dts
new file mode 100644
index 00..4cd72b5e61
--- /dev/null
+++ b/arch/arm/dts/logicpd-som-lv-35xx-devkit.dts
@@ -0,0 +1,32 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include "omap34xx.dtsi"
+#include "logicpd-som-lv.dtsi"
+#include "logicpd-som-lv-baseboard.dtsi"
+#include "omap-gpmc-smsc9221.dtsi"
+
+/ {
+   model = "LogicPD Zoom OMAP35xx SOM-LV Development Kit";
+   compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3";
+};
+
+_pmx_core2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_2_pins>;
+   hsusb2_2_pins: pinmux_hsusb2_2_pins {
+   pinctrl-single,pins = <
+   OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)
/* etk_d10.hsusb2_clk */
+   OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)
/* etk_d11.hsusb2_stp */
+   OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d12.hsusb2_dir */
+   OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d13.hsusb2_nxt */
+   OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d14.hsusb2_data0 */
+   OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d15.hsusb2_data1 */
+   >;
+   };
+};
diff --git a/arch/arm/dts/logicpd-torpedo-35xx-devkit.dts 
b/arch/arm/dts/logicpd-torpedo-35xx-devkit.dts
new file mode 100644
index 00..d7cb659656
--- /dev/null
+++ b/arch/arm/dts/logicpd-torpedo-35xx-devkit.dts
@@ -0,0 +1,17 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include "omap34xx.dtsi"
+#include "logicpd-torpedo-som.dtsi"
+#include "logicpd-torpedo-baseboard.dtsi"
+#include "omap-gpmc-smsc9221.dtsi"
+
+/ {
+   model = "LogicPD Zoom OMAP35xx Torpedo Development Kit";
+   compatible = "logicpd,dm3730-torpedo-devkit", "ti,omap3";
+};
-- 
2.17.1

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


[U-Boot] [PATCH 4/5] ARM: DTS: Add Logic PD OMAP35/DM37 SOM-LV and OMAP35 Torpedo

2018-09-29 Thread Adam Ford
With the device trees doing most of the work of pin-muxing and
DM doing much of the peripheral initialization, this creates
new defconfig files for each of the Logic PD variants with
proper register settings/pin-muxing.

Signed-off-by: Adam Ford 

diff --git a/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi 
b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi
new file mode 100644
index 00..6445048fe0
--- /dev/null
+++ b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017
+ * Logic PD - http://www.logicpd.com
+ */
+
+/ {
+   chosen {
+   stdout-path = 
+   };
+};
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+   cd-gpios = < 14 GPIO_ACTIVE_LOW>; /* gpio_110 */
+};
+
+ {
+  status = "disabled";
+};
+
+ {
+  status = "disabled";
+};
+
diff --git a/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi 
b/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi
new file mode 100644
index 00..6445048fe0
--- /dev/null
+++ b/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017
+ * Logic PD - http://www.logicpd.com
+ */
+
+/ {
+   chosen {
+   stdout-path = 
+   };
+};
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+   cd-gpios = < 14 GPIO_ACTIVE_LOW>; /* gpio_110 */
+};
+
+ {
+  status = "disabled";
+};
+
+ {
+  status = "disabled";
+};
+
diff --git a/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi 
b/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi
new file mode 100644
index 00..41ed5d7e17
--- /dev/null
+++ b/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017
+ * Logic PD - http://www.logicpd.com
+ */
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+   clock-frequency = <40>;
+};
+
+ {
+  status = "disabled";
+};
+
+ {
+  status = "disabled";
+};
+
diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig
new file mode 100644
index 00..54c40d8c42
--- /dev/null
+++ b/configs/omap35_logic_defconfig
@@ -0,0 +1,72 @@
+CONFIG_ARM=y
+CONFIG_ARCH_OMAP2PLUS=y
+CONFIG_TI_COMMON_CMD_OPTIONS=y
+# CONFIG_SPL_GPIO_SUPPORT is not set
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_OMAP3_LOGIC=y
+# CONFIG_SPL_OMAP3_ID_NAND is not set
+CONFIG_SPL=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=2
+# CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_SYS_PROMPT="OMAP Logic # "
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NAND_OFS=0x24
+CONFIG_CMD_SPL_WRITE_SIZE=0x2
+# CONFIG_CMD_EEPROM is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_NAND=y
+CONFIG_CMD_NAND_LOCK_UNLOCK=y
+CONFIG_CMD_CACHE=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:512k(MLO),1792k(u-boot),128k(spl-os),128k(u-boot-env),6m(kernel),-(fs)"
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="logicpd-torpedo-35xx-devkit"
+CONFIG_SPL_OF_PLATDATA=y
+# CONFIG_ENV_IS_IN_FAT is not set
+CONFIG_ENV_IS_IN_NAND=y
+CONFIG_SPL_DM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x8200
+CONFIG_DM_I2C=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_OMAP_HS=y
+CONFIG_NAND=y
+CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
+CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
+CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_SMC911X=y
+CONFIG_SMC911X_BASE=0x0800
+CONFIG_SMC911X_32_BIT=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_DM_PMIC=y
+# CONFIG_SPL_PMIC_CHILDREN is not set
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_OMAP3_SPI=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_MUSB_OMAP2PLUS=y
+CONFIG_TWL4030_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="TI"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0451
+CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
+CONFIG_USB_ETHER=y
+CONFIG_BCH=y
+# CONFIG_SPL_OF_LIBFDT is not set
diff --git a/configs/omap35_logic_somlv_defconfig 
b/configs/omap35_logic_somlv_defconfig
new file mode 100644
index 00..4521aedb2a
--- /dev/null
+++ b/configs/omap35_logic_somlv_defconfig
@@ -0,0 +1,72 @@
+CONFIG_ARM=y
+CONFIG_ARCH_OMAP2PLUS=y
+CONFIG_TI_COMMON_CMD_OPTIONS=y
+# CONFIG_SPL_GPIO_SUPPORT is not set
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_OMAP3_LOGIC=y
+# CONFIG_SPL_OMAP3_ID_NAND is not set
+CONFIG_SPL=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=2
+# CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_VERSION_VARIABLE=y

[U-Boot] [PATCH 5/5] ARM: LogicPD: omap3logic: Remove Torpedo/SOM-LV autodection

2018-09-29 Thread Adam Ford
With there now being four device tree files, and 4 separate
defconfig files, the code necessary to determine which board is
being used is no longer necessary as the corresponding pin-muxing
and board names are determined by the device tree.

Signed-off-by: Adam Ford 

diff --git a/board/logicpd/omap3som/README b/board/logicpd/omap3som/README
index b77b3d63db..5aaf58f0a6 100644
--- a/board/logicpd/omap3som/README
+++ b/board/logicpd/omap3som/README
@@ -1,21 +1,15 @@
 Summary
 ===
 
-The source for omap3som encompases the DM3730 SOM-LV and DM3730 Torpedo 
platforms.
+The source for omap3logic.c encompases the OMAP35 and DM3730 SOM-LV and DM3730 
Torpedo platforms, but there are device trees custom taylored to each board.
 
-By default, the Torpedo Device Tree is integrated into U-Boot,but the MMC 
controller, GPIO and I2C controllers are the same, so for the purposes of 
loading U-Boot, it should be sufficient.  However this will display the Model 
as "LogicPD Zoom DM3730 Torpedo + Wireless Development Kit" upon boot.
+omap3_logic_defconfig = DM37 Torpedo / Torpedo + Wireless
+omap35_logic_defconfig = OMAP35 Torpedo
+omap3_logic_somlv_defconfig = DM37 SOM-LV
+omap35_logic_somlv_defconfig = OMAP35 SOM-LV
 
-The actual board remains autodetected and the Board will read "DM37xx SOM LV" 
when used on the DM37 SOM-LV.  The device tree loaded with Linux is also 
correct.
-
-Integrating the SOM-LV Device Tree into U-Boot
-==
-
-This step is optional, but should you want to change the default to the 
SOM-LV, locate the configs/omap3_logic_defconfig file and make the following 
change.
-
-  CONFIG_DEFAULT_DEVICE_TREE="logicpd-som-lv-37xx-devkit"
-
-  make distclean
-  make omap3_logic_defconfig
+The device tree included with each of the defconfig files will also direct the 
board as to which dtb file to load when loading the kernel, so it is not
+recomended to mix and match the defconfig files.
 
 Falcon Mode: FAT SD cards
 =
diff --git a/board/logicpd/omap3som/omap3logic.c 
b/board/logicpd/omap3som/omap3logic.c
index 48d886930f..4507b1ed99 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -70,40 +70,6 @@ U_BOOT_DEVICE(am335x_mmc0) = {
 
 #endif
 
-/*
- * two dimensional array of strucures containining board name and Linux
- * machine IDs; row it selected based on CPU column is slected based
- * on hsusb0_data5 pin having a pulldown resistor
- */
-static struct board_id {
-   char *name;
-   int machine_id;
-   char *fdtfile;
-} boards[2][2] = {
-   {
-   {
-   .name   = "OMAP35xx SOM LV",
-   .machine_id = MACH_TYPE_OMAP3530_LV_SOM,
-   .fdtfile= "logicpd-som-lv-35xx-devkit.dtb",
-   },
-   {
-   .name   = "OMAP35xx Torpedo",
-   .machine_id = MACH_TYPE_OMAP3_TORPEDO,
-   .fdtfile= "logicpd-torpedo-35xx-devkit.dtb",
-   },
-   },
-   {
-   {
-   .name   = "DM37xx SOM LV",
-   .fdtfile= "logicpd-som-lv-37xx-devkit.dtb",
-   },
-   {
-   .name   = "DM37xx Torpedo",
-   .fdtfile= "logicpd-torpedo-37xx-devkit.dtb",
-   },
-   },
-};
-
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
@@ -226,7 +192,6 @@ int ehci_hcd_stop(int index)
 
 #endif /* CONFIG_USB_EHCI_HCD */
 
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -243,11 +208,6 @@ int misc_init_r(void)
return 0;
 }
 
-/*
- * BOARD_ID_GPIO - GPIO of pin with optional pulldown resistor on SOM LV
- */
-#define BOARD_ID_GPIO  189 /* hsusb0_data5 pin */
-
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -275,54 +235,6 @@ static void unlock_nand(void)
 
 int board_late_init(void)
 {
-   struct board_id *board;
-   unsigned int val;
-
-   /*
-* To identify between a SOM LV and Torpedo module,
-* a pulldown resistor is on hsusb0_data5 for the SOM LV module.
-* Drive the pin (and let it soak), then read it back.
-* If the pin is still high its a Torpedo.  If low its a SOM LV
-*/
-
-   /* Mux hsusb0_data5 as a GPIO */
-   MUX_VAL(CP(HSUSB0_DATA5),   (IEN  | PTD | DIS | M4));
-
-   if (gpio_request(BOARD_ID_GPIO, "husb0_data5.gpio_189") == 0) {
-
-   /*
-* Drive BOARD_ID_GPIO - the pulldown resistor on the SOM LV
-* will drain the voltage.
-*/
-   gpio_direction_output(BOARD_ID_GPIO, 0);
-   gpio_set_value(BOARD_ID_GPIO, 1);
-
-   /* Let it soak for a bit */
-   sdelay(0x100);
-
-   /*
-* Read state of 

[U-Boot] [PATCH 2/5] ARM: DTS: Remove unnecessary u-boot.dtsi options from omap3/36xx

2018-09-29 Thread Adam Ford
With the introduction of the omap serial driver, the need for some
of these U-Boot specific modifications is gone.  This cleans up
this unnneeded stuff.

Signed-off-by: Adam Ford 

diff --git a/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi 
b/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi
index d584b4a9ab..41ed5d7e17 100644
--- a/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi
+++ b/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi
@@ -4,14 +4,6 @@
  * Logic PD - http://www.logicpd.com
  */
 
-/ {
-   model = "LogicPD Zoom OMAP3 Development Kit";
-
-   chosen {
-   stdout-path = 
-   };
-};
-
  {
clock-frequency = <40>;
 };
@@ -28,15 +20,3 @@
   status = "disabled";
 };
 
- {
-   reg-shift = <2>;
-};
-
- {
-   reg-shift = <2>;
-};
-
- {
-   reg-shift = <2>;
-};
-
diff --git a/arch/arm/dts/omap3-u-boot.dtsi b/arch/arm/dts/omap3-u-boot.dtsi
deleted file mode 100644
index 633153a41e..00
--- a/arch/arm/dts/omap3-u-boot.dtsi
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2017
- * Logic PD - http://www.logicpd.com
- */
-
- {
-   reg-shift = <2>;
-};
-
- {
-   reg-shift = <2>;
-};
-
- {
-   reg-shift = <2>;
-};
-
diff --git a/arch/arm/dts/omap36xx-u-boot.dtsi 
b/arch/arm/dts/omap36xx-u-boot.dtsi
deleted file mode 100644
index 374499dcb2..00
--- a/arch/arm/dts/omap36xx-u-boot.dtsi
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2017
- * Logic PD - http://www.logicpd.com
- */
-
- {
-   reg-shift = <2>;
-};
-- 
2.17.1

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


[U-Boot] [PATCH 1/5] ARM: DTS: LogicPD-SOM-LV & Torpedo: Resync DTS with Kernel

2018-09-29 Thread Adam Ford
The device tree entries are from linux-omap's for-next branch
destined to me put into 4.20 (or whatever the version is after 4.19)

Signed-off-by: Adam Ford 

diff --git a/arch/arm/dts/logicpd-som-lv-37xx-devkit.dts 
b/arch/arm/dts/logicpd-som-lv-37xx-devkit.dts
index 2428373952..2aca9111c6 100644
--- a/arch/arm/dts/logicpd-som-lv-37xx-devkit.dts
+++ b/arch/arm/dts/logicpd-som-lv-37xx-devkit.dts
@@ -15,3 +15,18 @@
model = "LogicPD Zoom DM3730 SOM-LV Development Kit";
compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3";
 };
+
+_pmx_core2 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_2_pins>;
+   hsusb2_2_pins: pinmux_hsusb2_2_pins {
+   pinctrl-single,pins = <
+   OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)
/* etk_d10.hsusb2_clk */
+   OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)
/* etk_d11.hsusb2_stp */
+   OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d12.hsusb2_dir */
+   OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d13.hsusb2_nxt */
+   OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d14.hsusb2_data0 */
+   OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d15.hsusb2_data1 */
+   >;
+   };
+};
diff --git a/arch/arm/dts/logicpd-som-lv.dtsi b/arch/arm/dts/logicpd-som-lv.dtsi
index 3bb28c03ca..03485509c8 100644
--- a/arch/arm/dts/logicpd-som-lv.dtsi
+++ b/arch/arm/dts/logicpd-som-lv.dtsi
@@ -129,7 +129,7 @@
 };
 
  {
-   interrupts-extended = < 94 _pmx_core2 0x46>;
+   interrupts-extended = < 94>;
pinctrl-0 = <_pins _gpio>;
pinctrl-names = "default";
vmmc-supply = <_vmmc>;
@@ -142,7 +142,7 @@
compatible = "ti,wl1273";
reg = <2>;
interrupt-parent = <>;
-   interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; /* gpio 2 */
+   interrupts = <2 IRQ_TYPE_EDGE_RISING>; /* gpio 2 */
ref-clock-frequency = <2600>;
};
 };
@@ -232,6 +232,20 @@
>;
};
 
+   i2c2_pins: pinmux_i2c2_pins {
+   pinctrl-single,pins = <
+   OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0)
/* i2c2_scl */
+   OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0)
/* i2c2_sda */
+   >;
+   };
+
+   i2c3_pins: pinmux_i2c3_pins {
+   pinctrl-single,pins = <
+   OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0)
/* i2c3_scl */
+   OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0)
/* i2c3_sda */
+   >;
+   };
+
tsc2004_pins: pinmux_tsc2004_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE4)
/* mcbsp4_dr.gpio_153 */
@@ -253,33 +267,6 @@
OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4)
/* sys_boot1.gpio_3 */
>;
};
-   i2c2_pins: pinmux_i2c2_pins {
-   pinctrl-single,pins = <
-   OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0)
/* i2c2_scl */
-   OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0)
/* i2c2_sda */
-   >;
-   };
-   i2c3_pins: pinmux_i2c3_pins {
-   pinctrl-single,pins = <
-   OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0)
/* i2c3_scl */
-   OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0)
/* i2c3_sda */
-   >;
-   };
-};
-
-_pmx_core2 {
-   pinctrl-names = "default";
-   pinctrl-0 = <_2_pins>;
-   hsusb2_2_pins: pinmux_hsusb2_2_pins {
-   pinctrl-single,pins = <
-   OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)
/* etk_d10.hsusb2_clk */
-   OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)
/* etk_d11.hsusb2_stp */
-   OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d12.hsusb2_dir */
-   OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d13.hsusb2_nxt */
-   OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d14.hsusb2_data0 */
-   OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)/* etk_d15.hsusb2_data1 */
-   >;
-   };
 };
 
  {
diff --git a/arch/arm/dts/logicpd-torpedo-37xx-devkit.dts 
b/arch/arm/dts/logicpd-torpedo-37xx-devkit.dts
index 234afd6d60..9d5d53fbe9 100644
--- a/arch/arm/dts/logicpd-torpedo-37xx-devkit.dts
+++ b/arch/arm/dts/logicpd-torpedo-37xx-devkit.dts
@@ -48,7 +48,7 @@
compatible = 

Re: [U-Boot] [PATCH 01/15] sandbox: Unprotect DATA regions in bus tests

2018-09-29 Thread Simon Glass
Hi Alex,

On 23 September 2018 at 23:34, Alexander Graf  wrote:
>
>
> On 24.09.18 00:47, Simon Glass wrote:
>> On my Ubuntu 18.04.1 machine two driver-model bus tests have started
>> failing recently. The problem appears to be that the DATA region of the
>
> Are you sure it's .data and not .rodata?
>
> The linker script should really put all those lists into its own
> section, so I'm not sure how you end up with them getting write
> protected. Can you please run

It doesn't happen on my normal computer, but I upgraded one to Ubuntu
18.04 and noticed this. It's a bit odd, but I wonder if it is deciding
that the section name means it is rodata?

>
>   $ objdump -h u-boot
>
> on your broken binary? Also do
>
>   $ nm u-boot | grep .u_boot_list
>
> so we can correlate whether the symbols ended up in the correct section.

Yes, please see below.

/tmp/b/sandbox/u-boot: file format elf64-x86-64

Sections:
Idx Name  Size  VMA   LMA   File off  Algn
  0 .interp   001c  0238  0238  0238  2**0
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 0020  0254  0254  0254  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.gnu.build-id 0024  0274  0274
0274  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.hash 0284  0298  0298  0298  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym   0d50  0520  0520  0520  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr   0558  1270  1270  1270  2**0
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  011c  17c8  17c8  17c8  2**1
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 0040  18e8  18e8  18e8  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn 0001bca8  1928  1928  1928  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt 0558  0001d5d0  0001d5d0  0001d5d0  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init 0017  0001db28  0001db28  0001db28  2**2
  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt  03a0  0001db40  0001db40  0001db40  2**4
  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .plt.got  0008  0001dee0  0001dee0  0001dee0  2**3
  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .text 000b6ce0  0001def0  0001def0  0001def0  2**4
  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .fini 0009  000d4bd0  000d4bd0  000d4bd0  2**2
  CONTENTS, ALLOC, LOAD, READONLY, CODE
 15 .rodata   0005b6d3  000d4be0  000d4be0  000d4be0  2**5
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .dtb.init.rodata 07c0  001302c0  001302c0
001302c0  2**4
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .eh_frame_hdr 829c  00130a80  00130a80  00130a80  2**2
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 18 .eh_frame 0002dc70  00138d20  00138d20  00138d20  2**3
  CONTENTS, ALLOC, LOAD, READONLY, DATA
 19 .init_array   0008  00367010  00367010  00167010  2**3
  CONTENTS, ALLOC, LOAD, DATA
 20 .fini_array   0008  00367018  00367018  00167018  2**3
  CONTENTS, ALLOC, LOAD, DATA
 21 .data.rel.ro  5180  00367020  00367020  00167020  2**5
  CONTENTS, ALLOC, LOAD, DATA
 22 .dynamic  0210  0036c1a0  0036c1a0  0016c1a0  2**3
  CONTENTS, ALLOC, LOAD, DATA
 23 .got  0288  0036c3b0  0036c3b0  0016c3b0  2**3
  CONTENTS, ALLOC, LOAD, DATA
 24 .u_boot_list  9938  0036c638  0036c638  0016c638  2**2
  CONTENTS, ALLOC, LOAD, DATA
 25 _u_boot_sandbox_getopt 0088  00375f70
00375f70  00175f70  2**3
  CONTENTS, ALLOC, LOAD, DATA
 26 .data bd98  00376000  00376000  00176000  2**5
  CONTENTS, ALLOC, LOAD, DATA
 27 .bss  00037450  00381da0  00381da0  00181d98  2**5
  ALLOC
 28 .comment  0024      00181d98  2**0
  CONTENTS, READONLY
 29 .debug_aranges 62a0      00181dbc  2**0
  CONTENTS, READONLY, DEBUGGING
 30 .debug_info   00436065      0018805c  

Re: [U-Boot] [U-Boot, v4, 24/34] board: sama5d4_xplained: add pda detect call at init time

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:47AM +0300, Eugen Hristev wrote:

> Call the PDA detection mechanism at boot time so we can have
> the pda environment variable ready for use.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 22/34] board: sama5d27_som1_ek: add pda detect call at init time

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:45AM +0300, Eugen Hristev wrote:

> Call the PDA detection mechanism at boot time so we can have
> the pda environment variable ready for use.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 25/34] configs: sama5d2_xplained: add fdt overlay support

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:48AM +0300, Eugen Hristev wrote:

> Add commands for fdt overlay merging. This is required for the boot scripts
> that detect PDAs and apply specific overlays to the DTB passed on to kernel.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 09/34] dt-bindings: w1-eeprom: eep_sandbox: create bindings

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:32AM +0300, Eugen Hristev wrote:

> Bindings for sandbox onewire eeprom driver
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v4,02/34] w1: Add 1-Wire gpio driver

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:25AM +0300, Eugen Hristev wrote:

> From: Maxime Ripard 
> 
> Add a bus driver for bitbanging a 1-Wire bus over a GPIO.
> 
> Signed-off-by: Maxime Ripard 
> [eugen.hris...@microchip.com: fixed some issues]
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 10/34] w1: add command for onewire protocol

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:33AM +0300, Eugen Hristev wrote:

> Add basic command for bus information and read for onewire
> bus using Dallas 1-Wire protocol.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 26/34] configs: sama5d3_xplained: add fdt overlay support

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:49AM +0300, Eugen Hristev wrote:

> Add commands for fdt overlay merging. This is required for the boot scripts
> that detect PDAs and apply specific overlays to the DTB passed on to kernel.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 33/34] ARM: dts: at91: sama5d2_ptc: add onewire connector for LCD eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:56AM +0300, Eugen Hristev wrote:

> Add onewire node in device tree for TM series LCDs
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 16/34] configs: sama5d27_som1_ek: add onewire and eeprom drivers

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:39AM +0300, Eugen Hristev wrote:

> SAMA5D2 SoC can have extra clip boards (PDAs) connected, which have
> an EEPROM memory for identification. A special GPIO can be used to read
> this memory over 1wire protocol.
> Enabling one wire and eeprom drivers for this memory.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 06/34] W1-EEPROM: add support for Maxim DS24 eeprom families

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:29AM +0300, Eugen Hristev wrote:

> From: Maxime Ripard 
> 
> Add a driver that supports Maxim 1 wire EEPROMs families
> DS24B33 and DS2431.
> Can be extended for other families as well.
> 
> Signed-off-by: Maxime Ripard 
> [eugen.hris...@microchip.com: reworked driver]
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 30/34] ARM: dts: at91: sama5d2_xplained: add onewire connector for LCD eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:53AM +0300, Eugen Hristev wrote:

> Add onewire node in device tree for TM series LCDs
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v4,01/34] w1: Add 1-Wire uclass

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:24AM +0300, Eugen Hristev wrote:

> From: Maxime Ripard 
> 
> We might want to use 1-Wire devices connected on boards such as EEPROMs in
> U-Boot.
> 
> Provide a framework to be able to do that.
> 
> Signed-off-by: Maxime Ripard 
> [eugen.hris...@microchip.com: reworked]
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 03/34] dt-bindings: W1: w1-gpio: added bindings for w1-gpio

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:26AM +0300, Eugen Hristev wrote:

> Added bindings specification for bitbanged gpio driver for Dallas
> one wire protocol
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v4,08/34] W1-EEPROM: add sandbox driver

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:31AM +0300, Eugen Hristev wrote:

> Add a sandbox driver for a one wire EEPROM memory
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 17/34] configs: sama5d2_ptc_ek: add onewire and eeprom drivers

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:40AM +0300, Eugen Hristev wrote:

> SAMA5D2 SoC can have extra clip boards (PDAs) connected, which have
> an EEPROM memory for identification. A special GPIO can be used to read
> this memory over 1wire protocol.
> Enabling one wire and eeprom drivers for this memory.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Convert CONFIG_DISABLE_CONSOLE to Kconfig

2018-09-29 Thread Tom Rini
On Mon, Sep 10, 2018 at 12:43:16PM +0200, Christian Gmeiner wrote:

> This converts the following to Kconfig:
>CONFIG_DISABLE_CONSOLE
> 
> Signed-off-by: Christian Gmeiner 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 15/34] configs: sama5d3_xplained: add onewire and eeprom drivers

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:38AM +0300, Eugen Hristev wrote:

> SAMA5D3 SoC can have extra clip boards (PDAs) connected, which have
> an EEPROM memory for identification. A special GPIO can be used to read
> this memory over 1wire protocol.
> Enabling one wire and eeprom drivers for this memory.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 05/34] w1: identify devices with w1-eeprom uclass

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:28AM +0300, Eugen Hristev wrote:

> When a new device is discovered, this may be a w1 eeprom device.
> Attempt to find the proper node and driver from the w1-eeprom subsystem.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 13/34] configs: sandbox: add onewire w1 and sandbox eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:36AM +0300, Eugen Hristev wrote:

> To be able to test Dallas onewire protocol and one wire eeproms driver
> and subsystem, add in sandbox defconfig the drivers' config.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/2] ARM: da850evm: Pinctrl for da850evm

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 08:50:40AM -0500, Adam Ford wrote:

> The simple pin controller works for da850, so this patch enables
> this to pin-mux the pins defined in the device tree for the da850evm.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
> index 812de499ba..12614289b7 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 14/34] configs: sama5d2_xplained: add onewire and eeprom drivers

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:37AM +0300, Eugen Hristev wrote:

> SAMA5D2 SoC can have extra clip boards (PDAs) connected, which have
> an EEPROM memory for identification. A special GPIO can be used to read
> this memory over 1wire protocol.
> Enabling one wire and eeprom drivers for this memory.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 12/34] sandbox: DTS: w1: add node for one wire interface on GPIO

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:35AM +0300, Eugen Hristev wrote:

> Add a node for the one wire uclass and one wire gpio driver
> in sandbox.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: omap3_logic: Remove non-DM MMC initialization

2018-09-29 Thread Tom Rini
On Tue, Sep 11, 2018 at 10:15:05PM -0500, Adam Ford wrote:

> With DM_MMC working for both SPL and U-Boot, this patch removes
> the legacy style of initializing the MMC driver.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/board/logicpd/omap3som/omap3logic.c 
> b/board/logicpd/omap3som/omap3logic.c
> index 6054ed8739..4507b1ed99 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 18/34] configs: sama5d4_xplained: add onewire and eeprom drivers

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:41AM +0300, Eugen Hristev wrote:

> SAMA5D4 SoC can have extra clip boards (PDAs) connected, which have
> an EEPROM memory for identification. A special GPIO can be used to read
> this memory over 1wire protocol.
> Enabling one wire and eeprom drivers for this memory.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, V2, 2/2] ARM: DTS: various omap3: Remove cd-inverted from u-boot.dtsi

2018-09-29 Thread Tom Rini
On Sat, Sep 08, 2018 at 08:16:24AM -0500, Adam Ford wrote:

> With the omap_mmc driver no longer supporting cd-inverted, this
> patch removes all these references since they are not needed.
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 21/34] board: sama5d3_xplained: add pda detect call at init time

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:44AM +0300, Eugen Hristev wrote:

> Call the PDA detection mechanism at boot time so we can have
> the pda environment variable ready for use.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 27/34] configs: sama5d2_ptc_ek: add fdt overlay support

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:50AM +0300, Eugen Hristev wrote:

> Add commands for fdt overlay merging. This is required for the boot scripts
> that detect PDAs and apply specific overlays to the DTB passed on to kernel.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 04/34] W1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:27AM +0300, Eugen Hristev wrote:

> From: Maxime Ripard 
> 
> We might want to access data stored onto one wire EEPROMs.
> Create a framework to provide a consistent API.
> 
> Signed-off-by: Maxime Ripard 
> [eugen.hris...@microchip.com: reworked patch]
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, V2, 1/2] mmc: omap_mmc: Remove invert references

2018-09-29 Thread Tom Rini
On Sat, Sep 08, 2018 at 08:16:23AM -0500, Adam Ford wrote:

> With DM_GPIO and DM_MMC translating GPIO_ACTIVE_LOW, any boards
> using the 'cd-invert' option will no longer need to do this.  This
> patch removes the support for 'invert' from the MMC driver.
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 5/6] doc: dtbinding: Add file system firmware loader binding document

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:27:35PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> Add a document to describe file system firmware loader binding
> information.
> 
> Signed-off-by: Tien Fong Chee 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 07/34] dt-bindings: w1-eeprom: ds24xxx: create bindings

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:30AM +0300, Eugen Hristev wrote:

> Bindings for Maxim's ds24 onewire EEPROM families driver
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 28/34] configs: sama5d27_som1_ek: add fdt overlay support

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:51AM +0300, Eugen Hristev wrote:

> Add commands for fdt overlay merging. This is required for the boot scripts
> that detect PDAs and apply specific overlays to the DTB passed on to kernel.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 2/6] cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:26:01PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> cmd_ubifs_mount() function would be called directly instead of
> involving whole command machinery for mounting ubifs in
> generic firmware loader, so some checking codes need to be factored out
> into cmd_ubifs_mount() without breaking original functionality design.
> 
> Signed-off-by: Tien Fong Chee 
> Reviewed-by: Marek Vasut 
> Reviewed-by: Heiko Schocher 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 23/34] board: sama5d2_ptc_ek: add pda detect call at init time

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:46AM +0300, Eugen Hristev wrote:

> Call the PDA detection mechanism at boot time so we can have
> the pda environment variable ready for use.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 32/34] ARM: dts: at91: sama5d27_som1_ek: add onewire connector for LCD eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:55AM +0300, Eugen Hristev wrote:

> Add onewire node in device tree for TM series LCDs
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] cmd: Relocate poweroff under Device access commands

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 07:05:57AM -0500, Adam Ford wrote:

> Previously poweroff was located under boot.  It seems to make more
> sense to have it located under the Device access commands.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 13d4c991bf..56f70a7f6e 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 34/34] ARM: dts: at91: sama5d4_xplained: add onewire connector for LCD eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:57AM +0300, Eugen Hristev wrote:

> Add onewire node in device tree for TM series LCDs
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 11/34] pinctrl: sandbox: add gpio onewire w1 group

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:34AM +0300, Eugen Hristev wrote:

> Add onewire "w1" groups and pin function for onewire GPIOs in sandbox.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: am3517_evm: Enable TCA6416PW GPIO Expander

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 09:21:21AM -0500, Adam Ford wrote:

> With DM_I2C and DM_GPIO working, this patch can enable the
> GPIO expander on the I2C bus.  This GPIO expander is connected
> to some of the DIP switches and can now read the status of these
> pins.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
> index 985ef73292..1ee24375fb 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 19/34] board: atmel: add support for pda detection

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:42AM +0300, Eugen Hristev wrote:

> This adds the support for PDA detection as common code for
> Atmel boards.
> Using the one wire interface over GPIO , an EEPROM memory is read
> and compared to preprogrammed values for PDA screens TM4300, TM7000
> and TM7000B.
> Once the PDA is detected, an environment variable is set accordingly.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: omap3_logic: Remove some manual pin-muxing

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 04:12:11PM -0500, Adam Ford wrote:

> With the pinctrl function enabled and the device tree setting up
> the pins we want to use, this patch removes the manual pinmuxing
> except for that which is not done by the device tree and minimal
> pins necessary for SPL (like serial, GPMC, and MMC)
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/board/logicpd/omap3som/omap3logic.h 
> b/board/logicpd/omap3som/omap3logic.h
> index a5601f7a7b..aeb26b90d7 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 20/34] board: sama5d2_xplained: add pda detect call at init time

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:43AM +0300, Eugen Hristev wrote:

> Call the PDA detection mechanism at boot time so we can have
> the pda environment variable ready for use.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ARM: am3517_evm: Enable Pinctrl

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 07:25:30AM -0500, Adam Ford wrote:

> The simple pinctrl driver currently available works with the omap3.
> Enabling this will use the device tree to automatically set the
> pin-muxing for various drivers.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
> index e845e35d7d..985ef73292 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 31/34] ARM: dts: at91: sama5d3_xplained: add onewire connector for LCD eeprom

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:54AM +0300, Eugen Hristev wrote:

> Add onewire node in device tree for TM series LCDs
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, V3] ARM: da850evm_direct_nor_defconfig: Enable DM_SERIAL

2018-09-29 Thread Tom Rini
On Wed, Sep 19, 2018 at 04:06:49PM -0500, Adam Ford wrote:

> With DM enabled, this patch enables DM_SERIAL and removes
> the NS16550 initialization from da850_lowlevel since the driver
> will take care of that itself.
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 29/34] configs: sama5d4_xplained: add fdt overlay support

2018-09-29 Thread Tom Rini
On Tue, Sep 18, 2018 at 10:35:52AM +0300, Eugen Hristev wrote:

> Add commands for fdt overlay merging. This is required for the boot scripts
> that detect PDAs and apply specific overlays to the DTB passed on to kernel.
> 
> Signed-off-by: Eugen Hristev 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 6/6] common: Generic loader for file system

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:28:03PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> This is file system generic loader which can be used to load
> the file image from the storage into target such as memory.
> The consumer driver would then use this loader to program whatever,
> ie. the FPGA device.
> 
> Signed-off-by: Tien Fong Chee 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 3/6] block: Add a function to find block device descriptor

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:26:36PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> Add a function to find the block device descriptor of the parent
> device.
> 
> Signed-off-by: Tien Fong Chee 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/2] ARM: da850evm: Enable CMD_DM for da850evm

2018-09-29 Thread Tom Rini
On Sun, Sep 09, 2018 at 08:50:39AM -0500, Adam Ford wrote:

> With DM enabled, this patch enables the 'dm' command to access
> the dm tree, uclass and devres.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
> index 0369e93eb2..812de499ba 100644

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 4/6] doc: Add new doc for file system firmware loader driver model

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:27:08PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> Provide information about
> 
> - overview of file system firmware loader driver model
> - describe storage device and partition in device tree source
> - describe fie system firmware loader API
> 
> Signed-off-by: Tien Fong Chee 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v4, 1/6] cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount()

2018-09-29 Thread Tom Rini
On Fri, Jul 06, 2018 at 04:25:12PM +0800, tien.fong.c...@intel.com wrote:

> From: Tien Fong Chee 
> 
> cmd_ubifs_umount() function would be called directly instead of involving
> whole command machinery in generic firmware loader, so checking on
> ubifs_initialized status need to be done in cmd_ubifs_umount() without
> breaking original functionality design.
> 
> Signed-off-by: Tien Fong Chee 
> Reviewed-by: Marek Vasut 
> Reviewed-by: Heiko Schocher 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC/RESEND PATCH v1 2/2] board: ks2: move uinitrd fixup logic inside ft_board_setup_ex

2018-09-29 Thread Tom Rini
On Thu, Sep 27, 2018 at 10:01:48AM +0200, Nicholas Faustini wrote:

> The uinitrd fixup logic should be executed after the FDT /chosen
> node has been properly populated by fdt_initrd()
> 
> Signed-off-by: Nicholas Faustini 
> 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC/RESEND PATCH v1 1/2] fdt: add call to ft_board_setup_ex() for ks2 boards

2018-09-29 Thread Tom Rini
On Thu, Sep 27, 2018 at 10:01:47AM +0200, Nicholas Faustini wrote:

> When updating the board FDT, some of the operations
> are performed by ft_board_setup_ex() and should be
> executed also by the fdt command.
> 
> Signed-off-by: Nicholas Faustini 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] warp7: configs: add CONFIG_FIT option

2018-09-29 Thread Pierre-Jean Texier
This enable FIT image support.

Signed-off-by: Pierre-Jean Texier 
---
 configs/warp7_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 15a6673..919d484 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -8,6 +8,8 @@ CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg"
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTD is not set
-- 
2.7.4

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


[U-Boot] [PATCH] warp7: configs: add CONFIG_FIT option

2018-09-29 Thread Pierre-Jean Texier
This enable FIT image support.

Signed-off-by: Pierre-Jean Texier 
---
 configs/warp7_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 15a6673..919d484 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -8,6 +8,8 @@ CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg"
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTD is not set
-- 
2.7.4

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


[U-Boot] [PATCH v12 7/8] cmd: ubi: clean the partition handling

2018-09-29 Thread Miquel Raynal
UBI should not mess with MTD partitions, now that the partitions are
handled in a clean way, clean the ubi command and avoid using this
uneeded extra-glue to reference the devices.

Signed-off-by: Miquel Raynal 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 cmd/Kconfig |  2 ++
 cmd/ubi.c   | 96 ++---
 2 files changed, 27 insertions(+), 71 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0778d2ecff..4deec0b238 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1815,6 +1815,8 @@ config CMD_UBI
  capabilities. Please, consult the MTD web site for more details
  (www.linux-mtd.infradead.org). Activate this option if you want
  to use U-Boot UBI commands.
+ It is also strongly encouraged to also enable CONFIG_MTD to get full
+ partition support.
 
 config CMD_UBIFS
tristate "Enable UBIFS - Unsorted block images filesystem commands"
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 0a3405a3b1..bb8f97fc28 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -29,17 +30,6 @@
 
 /* Private own data */
 static struct ubi_device *ubi;
-static char buffer[80];
-static int ubi_initialized;
-
-struct selected_dev {
-   char part_name[80];
-   int selected;
-   int nr;
-   struct mtd_info *mtd_info;
-};
-
-static struct selected_dev ubi_dev;
 
 #ifdef CONFIG_CMD_UBIFS
 int ubifs_is_mounted(void);
@@ -404,43 +394,24 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
return err;
 }
 
-static int ubi_dev_scan(struct mtd_info *info, char *ubidev,
-   const char *vid_header_offset)
+static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)
 {
-   struct mtd_device *dev;
-   struct part_info *part;
-   struct mtd_partition mtd_part;
char ubi_mtd_param_buffer[80];
-   u8 pnum;
int err;
 
-   if (find_dev_and_part(ubidev, , , ) != 0)
-   return 1;
+   if (!vid_header_offset)
+   sprintf(ubi_mtd_param_buffer, "%s", info->name);
+   else
+   sprintf(ubi_mtd_param_buffer, "%s,%s", info->name,
+   vid_header_offset);
 
-   sprintf(buffer, "mtd=%d", pnum);
-   memset(_part, 0, sizeof(mtd_part));
-   mtd_part.name = buffer;
-   mtd_part.size = part->size;
-   mtd_part.offset = part->offset;
-   add_mtd_partitions(info, _part, 1);
-
-   strcpy(ubi_mtd_param_buffer, buffer);
-   if (vid_header_offset)
-   sprintf(ubi_mtd_param_buffer, "mtd=%d,%s", pnum,
-   vid_header_offset);
err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL);
-   if (err) {
-   del_mtd_partitions(info);
+   if (err)
return -err;
-   }
 
err = ubi_init();
-   if (err) {
-   del_mtd_partitions(info);
+   if (err)
return -err;
-   }
-
-   ubi_initialized = 1;
 
return 0;
 }
@@ -465,50 +436,33 @@ int ubi_detach(void)
/*
 * Call ubi_exit() before re-initializing the UBI subsystem
 */
-   if (ubi_initialized) {
+   if (ubi)
ubi_exit();
-   del_mtd_partitions(ubi_dev.mtd_info);
-   ubi_initialized = 0;
-   }
 
-   ubi_dev.selected = 0;
+   ubi = NULL;
+
return 0;
 }
 
 int ubi_part(char *part_name, const char *vid_header_offset)
 {
+   struct mtd_info *mtd;
int err = 0;
-   char mtd_dev[16];
-   struct mtd_device *dev;
-   struct part_info *part;
-   u8 pnum;
 
ubi_detach();
-   /*
-* Search the mtd device number where this partition
-* is located
-*/
-   if (find_dev_and_part(part_name, , , )) {
+
+   mtd_probe_devices();
+   mtd = get_mtd_device_nm(part_name);
+   if (IS_ERR(mtd)) {
printf("Partition %s not found!\n", part_name);
return 1;
}
-   sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
-   ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
-   if (IS_ERR(ubi_dev.mtd_info)) {
-   printf("Partition %s not found on device %s!\n", part_name,
-  mtd_dev);
-   return 1;
-   }
+   put_mtd_device(mtd);
 
-   ubi_dev.selected = 1;
-
-   strcpy(ubi_dev.part_name, part_name);
-   err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
-   vid_header_offset);
+   err = ubi_dev_scan(mtd, vid_header_offset);
if (err) {
printf("UBI init error %d\n", err);
printf("Please check, if the correct MTD partition is used 
(size big enough?)\n");
-   ubi_dev.selected = 0;
return err;
}
 
@@ -539,13 +493,13 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int 

[U-Boot] [PATCH v12 8/8] cmd: mtdparts: describe as legacy

2018-09-29 Thread Miquel Raynal
The 'mtdparts' command is not needed anymore. While the environment
variable is still valid (and useful, along with the 'mtdids' one), the
command has been replaced by 'mtd' which is much more close to the MTD
stack and do not add its own specific glue.

Signed-off-by: Miquel Raynal 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 cmd/Kconfig | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4deec0b238..12f3eabfab 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1673,7 +1673,11 @@ config CMD_MTDPARTS
bool "MTD partition support"
select MTD_DEVICE if (CMD_NAND || NAND)
help
- MTD partition support
+ MTD partitioning tool support.
+ It is strongly encouraged to avoid using this command
+ anymore along with 'sf', 'nand', 'onenand'. One can still
+ declare the partitions in the mtdparts environment variable
+ but better use the MTD stack and the 'mtd' command instead.
 
 config MTDIDS_DEFAULT
string "Default MTD IDs"
-- 
2.17.1

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


[U-Boot] [PATCH v12 4/8] mtd: uboot: search for an equivalent MTD name with the mtdids

2018-09-29 Thread Miquel Raynal
Using an MTD device (resp. partition) name in mtdparts is simple and
straightforward. However, for a long time already, another name was
given in mtdparts to indicate a device (resp. partition) so the
"mtdids" environment variable was created to do the match.

Let's create a function that, from an MTD device (resp. partition)
name, search for the equivalent name in the "mtdparts" environment
variable thanks to the "mtdids" string.

Signed-off-by: Miquel Raynal 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 drivers/mtd/mtd_uboot.c | 65 -
 include/linux/mtd/mtd.h |  5 
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 2b3b2eecca..8d7e7890b7 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -5,7 +5,70 @@
  */
 #include 
 #include 
-#include 
+#include  /* Legacy */
+
+/**
+ * mtd_search_alternate_name - Search an alternate name for @mtdname thanks to
+ * the mtdids legacy environment variable.
+ *
+ * The mtdids string is a list of comma-separated 'dev_id=mtd_id' tupples.
+ * Check if one of the mtd_id matches mtdname, in this case save dev_id in
+ * altname.
+ *
+ * @mtdname: Current MTD device name
+ * @altname: Alternate name to return
+ * @max_len: Length of the alternate name buffer
+ *
+ * @return 0 on success, an error otherwise.
+ */
+int mtd_search_alternate_name(const char *mtdname, char *altname,
+ unsigned int max_len)
+{
+   const char *mtdids, *equal, *comma, *dev_id, *mtd_id;
+   int dev_id_len, mtd_id_len;
+
+   mtdids = env_get("mtdids");
+   if (!mtdids)
+   return -EINVAL;
+
+   do {
+   /* Find the '=' sign */
+   dev_id = mtdids;
+   equal = strchr(dev_id, '=');
+   if (!equal)
+   break;
+   dev_id_len = equal - mtdids;
+   mtd_id = equal + 1;
+
+   /* Find the end of the tupple */
+   comma = strchr(mtdids, ',');
+   if (comma)
+   mtd_id_len = comma - mtd_id;
+   else
+   mtd_id_len = [strlen(mtdids)] - mtd_id + 1;
+
+   if (!dev_id_len || !mtd_id_len)
+   return -EINVAL;
+
+   if (dev_id_len + 1 > max_len)
+   continue;
+
+   /* Compare the name we search with the current mtd_id */
+   if (!strncmp(mtdname, mtd_id, mtd_id_len)) {
+   strncpy(altname, dev_id, dev_id_len);
+   altname[dev_id_len] = 0;
+
+   return 0;
+   }
+
+   /* Go to the next tupple */
+   mtdids = comma + 1;
+   } while (comma);
+
+   return -EINVAL;
+}
+
+/* Legacy */
 
 static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
loff_t *maxsize, int devtype)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index b8c2c3fd59..af6f4a61f8 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -549,5 +549,10 @@ int mtd_arg_off_size(int argc, char *const argv[], int 
*idx, loff_t *off,
 void mtd_get_len_incl_bad(struct mtd_info *mtd, uint64_t offset,
  const uint64_t length, uint64_t *len_incl_bad,
  int *truncated);
+
+/* drivers/mtd/mtd_uboot.c */
+int mtd_search_alternate_name(const char *mtdname, char *altname,
+ unsigned int max_len);
+
 #endif
 #endif /* __MTD_MTD_H__ */
-- 
2.17.1

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


[U-Boot] [PATCH v12 6/8] cmd: mtd: add 'mtd' command

2018-09-29 Thread Miquel Raynal
There should not be a 'nand' command, a 'sf' command and certainly not
a new 'spi-nand' command. Write a 'mtd' command instead to manage all
MTD devices/partitions at once. This should be the preferred way to
access any MTD device.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 cmd/Kconfig |  10 +-
 cmd/Makefile|   1 +
 cmd/mtd.c   | 473 
 drivers/mtd/Makefile|   2 +-
 drivers/mtd/mtd_uboot.c | 161 +-
 include/mtd.h   |   1 +
 6 files changed, 644 insertions(+), 4 deletions(-)
 create mode 100644 cmd/mtd.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index ef43ed8dda..0778d2ecff 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -847,6 +847,12 @@ config CMD_MMC_SWRITE
  Enable support for the "mmc swrite" command to write Android sparse
  images to eMMC.
 
+config CMD_MTD
+   bool "mtd"
+   select MTD_PARTITIONS
+   help
+ MTD commands support.
+
 config CMD_NAND
bool "nand"
default y if NAND_SUNXI
@@ -1671,14 +1677,14 @@ config CMD_MTDPARTS
 
 config MTDIDS_DEFAULT
string "Default MTD IDs"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD IDs list for use with MTD partitions in the
  Linux MTD command line partitions format.
 
 config MTDPARTS_DEFAULT
string "Default MTD partition scheme"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD partitioning scheme in the Linux MTD command
  line partitions format
diff --git a/cmd/Makefile b/cmd/Makefile
index 323f1fd2c7..32fd102189 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -90,6 +90,7 @@ obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MMC) += mmc.o
 obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o
 obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_CMD_MTD) += mtd.o
 obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o
 obj-$(CONFIG_CMD_NAND) += nand.o
 obj-$(CONFIG_CMD_NET) += net.o
diff --git a/cmd/mtd.c b/cmd/mtd.c
new file mode 100644
index 00..6142223984
--- /dev/null
+++ b/cmd/mtd.c
@@ -0,0 +1,473 @@
+// SPDX-License-Identifier:  GPL-2.0+
+/*
+ * mtd.c
+ *
+ * Generic command to handle basic operations on any memory device.
+ *
+ * Copyright: Bootlin, 2018
+ * Author: Miquèl Raynal 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static uint mtd_len_to_pages(struct mtd_info *mtd, u64 len)
+{
+   do_div(len, mtd->writesize);
+
+   return len;
+}
+
+static bool mtd_is_aligned_with_min_io_size(struct mtd_info *mtd, u64 size)
+{
+   return !do_div(size, mtd->writesize);
+}
+
+static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size)
+{
+   return !do_div(size, mtd->erasesize);
+}
+
+static void mtd_dump_buf(const u8 *buf, uint len, uint offset)
+{
+   int i, j;
+
+   for (i = 0; i < len; ) {
+   printf("0x%08x:\t", offset + i);
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf(" ");
+   i += 8;
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf("\n");
+   i += 8;
+   }
+}
+
+static void mtd_dump_device_buf(struct mtd_info *mtd, u64 start_off,
+   const u8 *buf, u64 len, bool woob)
+{
+   bool has_pages = mtd->type == MTD_NANDFLASH ||
+   mtd->type == MTD_MLCNANDFLASH;
+   int npages = mtd_len_to_pages(mtd, len);
+   uint page;
+
+   if (has_pages) {
+   for (page = 0; page < npages; page++) {
+   u64 data_off = page * mtd->writesize;
+
+   printf("\nDump %d data bytes from 0x%08llx:\n",
+  mtd->writesize, start_off + data_off);
+   mtd_dump_buf([data_off],
+mtd->writesize, start_off + data_off);
+
+   if (woob) {
+   u64 oob_off = page * mtd->oobsize;
+
+   printf("Dump %d OOB bytes from page at 
0x%08llx:\n",
+  mtd->oobsize, start_off + data_off);
+   mtd_dump_buf([len + oob_off],
+mtd->oobsize, 0);
+   }
+   }
+   } else {
+   printf("\nDump %lld data bytes from 0x%llx:\n",
+  len, start_off);
+   mtd_dump_buf(buf, len, start_off);
+   }
+}
+
+static void mtd_show_parts(struct mtd_info *mtd, int level)
+{
+   struct mtd_info *part;
+   int i;
+
+   list_for_each_entry(part, >partitions, node) {
+   

[U-Boot] [PATCH v12 5/8] mtd: mtdpart: implement proper partition handling

2018-09-29 Thread Miquel Raynal
Instead of collecting partitions in a flat list, create a hierarchy
within the mtd_info structure: use a partitions list to keep track of
the partitions of an MTD device (which might be itself a partition of
another MTD device), a pointer to the parent device (NULL when the MTD
device is the root one, not a partition).

By also saving directly in mtd_info the offset of the partition, we
can get rid of the mtd_part structure.

Signed-off-by: Miquel Raynal 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 drivers/mtd/mtdcore.c  |   2 +
 drivers/mtd/mtdpart.c  | 413 ++---
 include/linux/mtd/mtd.h|  32 +++
 include/linux/mtd/partitions.h |   1 -
 4 files changed, 209 insertions(+), 239 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index fb1d68d5e2..fb6c779abb 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -426,6 +426,8 @@ int add_mtd_device(struct mtd_info *mtd)
mtd->index = i;
mtd->usecount = 0;
 
+   INIT_LIST_HEAD(>partitions);
+
/* default value if not set by driver */
if (mtd->bitflip_threshold == 0)
mtd->bitflip_threshold = mtd->ecc_strength;
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 49353b038a..4d2ac8107f 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -30,29 +30,12 @@
 
 #include "mtdcore.h"
 
-/* Our partition linked list */
-static LIST_HEAD(mtd_partitions);
 #ifndef __UBOOT__
 static DEFINE_MUTEX(mtd_partitions_mutex);
 #else
 DEFINE_MUTEX(mtd_partitions_mutex);
 #endif
 
-/* Our partition node structure */
-struct mtd_part {
-   struct mtd_info mtd;
-   struct mtd_info *master;
-   uint64_t offset;
-   struct list_head list;
-};
-
-/*
- * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
- * the pointer to that structure with this macro.
- */
-#define PART(x)  ((struct mtd_part *)(x))
-
-
 #ifdef __UBOOT__
 /* from mm/util.c */
 
@@ -294,19 +277,18 @@ void mtd_free_parsed_partitions(struct mtd_partition 
*parts,
 static int part_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
 {
-   struct mtd_part *part = PART(mtd);
struct mtd_ecc_stats stats;
int res;
 
-   stats = part->master->ecc_stats;
-   res = part->master->_read(part->master, from + part->offset, len,
- retlen, buf);
+   stats = mtd->parent->ecc_stats;
+   res = mtd->parent->_read(mtd->parent, from + mtd->offset, len,
+retlen, buf);
if (unlikely(mtd_is_eccerr(res)))
mtd->ecc_stats.failed +=
-   part->master->ecc_stats.failed - stats.failed;
+   mtd->parent->ecc_stats.failed - stats.failed;
else
mtd->ecc_stats.corrected +=
-   part->master->ecc_stats.corrected - stats.corrected;
+   mtd->parent->ecc_stats.corrected - stats.corrected;
return res;
 }
 
@@ -314,17 +296,13 @@ static int part_read(struct mtd_info *mtd, loff_t from, 
size_t len,
 static int part_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys)
 {
-   struct mtd_part *part = PART(mtd);
-
-   return part->master->_point(part->master, from + part->offset, len,
-   retlen, virt, phys);
+   return mtd->parent->_point(mtd->parent, from + mtd->offset, len,
+  retlen, virt, phys);
 }
 
 static int part_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
 {
-   struct mtd_part *part = PART(mtd);
-
-   return part->master->_unpoint(part->master, from + part->offset, len);
+   return mtd->parent->_unpoint(mtd->parent, from + mtd->offset, len);
 }
 #endif
 
@@ -333,17 +311,13 @@ static unsigned long part_get_unmapped_area(struct 
mtd_info *mtd,
unsigned long offset,
unsigned long flags)
 {
-   struct mtd_part *part = PART(mtd);
-
-   offset += part->offset;
-   return part->master->_get_unmapped_area(part->master, len, offset,
-   flags);
+   offset += mtd->offset;
+   return mtd->parent->_get_unmapped_area(mtd->parent, len, offset, flags);
 }
 
 static int part_read_oob(struct mtd_info *mtd, loff_t from,
struct mtd_oob_ops *ops)
 {
-   struct mtd_part *part = PART(mtd);
int res;
 
if (from >= mtd->size)
@@ -368,7 +342,7 @@ static int part_read_oob(struct mtd_info *mtd, loff_t from,
return -EINVAL;
}
 
-   res = part->master->_read_oob(part->master, from + part->offset, ops);
+   res = mtd->parent->_read_oob(mtd->parent, from + mtd->offset, ops);
if (unlikely(res)) {
   

[U-Boot] [PATCH v12 3/8] mtd: mtdpart: add a generic mtdparts-like parser

2018-09-29 Thread Miquel Raynal
The current parser is very specific to U-Boot mtdparts implementation.
It does not use MTD structures like mtd_info and mtd_partition. Copy
and adapt the current parser in drivers/mtd/mtd-uclass.c (to not break
the current use of mtdparts.c itself) and write some kind of a wrapper
around the current implementation to allow other commands to benefit
from this parsing in a user-friendly way.

This new function will allocate an mtd_partition array for each
successful call. This array must be freed after use by the caller.
The given 'mtdparts' buffer pointer will be moved forward to the next
MTD device (if any, it will point towards a '\0' character otherwise).

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
Reviewed-by: Stefan Roese 
Reviewed-by: Boris Brezillon 
---
 drivers/mtd/mtdpart.c  | 210 +
 include/linux/mtd/partitions.h |  21 
 2 files changed, 231 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 9ccb1b3361..49353b038a 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "mtdcore.h"
 
@@ -76,6 +77,215 @@ char *kstrdup(const char *s, gfp_t gfp)
 }
 #endif
 
+#define MTD_SIZE_REMAINING (~0LLU)
+#define MTD_OFFSET_NOT_SPECIFIED   (~0LLU)
+
+/**
+ * mtd_parse_partition - Parse @mtdparts partition definition, fill @partition
+ *   with it and update the @mtdparts string pointer.
+ *
+ * The partition name is allocated and must be freed by the caller.
+ *
+ * This function is widely inspired from part_parse (mtdparts.c).
+ *
+ * @mtdparts: String describing the partition with mtdparts command syntax
+ * @partition: MTD partition structure to fill
+ *
+ * @return 0 on success, an error otherwise.
+ */
+static int mtd_parse_partition(const char **_mtdparts,
+  struct mtd_partition *partition)
+{
+   const char *mtdparts = *_mtdparts;
+   const char *name = NULL;
+   int name_len;
+   char *buf;
+
+   /* Ensure the partition structure is empty */
+   memset(partition, 0, sizeof(struct mtd_partition));
+
+   /* Fetch the partition size */
+   if (*mtdparts == '-') {
+   /* Assign all remaining space to this partition */
+   partition->size = MTD_SIZE_REMAINING;
+   mtdparts++;
+   } else {
+   partition->size = ustrtoull(mtdparts, (char **), 0);
+   if (partition->size < SZ_4K) {
+   printf("Minimum partition size 4kiB, %lldB requested\n",
+  partition->size);
+   return -EINVAL;
+   }
+   }
+
+   /* Check for the offset */
+   partition->offset = MTD_OFFSET_NOT_SPECIFIED;
+   if (*mtdparts == '@') {
+   mtdparts++;
+   partition->offset = ustrtoull(mtdparts, (char **), 0);
+   }
+
+   /* Now look for the name */
+   if (*mtdparts == '(') {
+   name = ++mtdparts;
+   mtdparts = strchr(name, ')');
+   if (!mtdparts) {
+   printf("No closing ')' found in partition name\n");
+   return -EINVAL;
+   }
+   name_len = mtdparts - name + 1;
+   if ((name_len - 1) == 0) {
+   printf("Empty partition name\n");
+   return -EINVAL;
+   }
+   mtdparts++;
+   } else {
+   /* Name will be of the form size@offset */
+   name_len = 22;
+   }
+
+   /* Check if the partition is read-only */
+   if (strncmp(mtdparts, "ro", 2) == 0) {
+   partition->mask_flags |= MTD_WRITEABLE;
+   mtdparts += 2;
+   }
+
+   /* Check for a potential next partition definition */
+   if (*mtdparts == ',') {
+   if (partition->size == MTD_SIZE_REMAINING) {
+   printf("No partitions allowed after a fill-up\n");
+   return -EINVAL;
+   }
+   ++mtdparts;
+   } else if ((*mtdparts == ';') || (*mtdparts == '\0')) {
+   /* NOP */
+   } else {
+   printf("Unexpected character '%c' in mtdparts\n", *mtdparts);
+   return -EINVAL;
+   }
+
+   /*
+* Allocate a buffer for the name and either copy the provided name or
+* auto-generate it with the form 'size@offset'.
+*/
+   buf = malloc(name_len);
+   if (!buf)
+   return -ENOMEM;
+
+   if (name)
+   strncpy(buf, name, name_len - 1);
+   else
+   snprintf(buf, name_len, "0x%08llx@0x%08llx",
+partition->size, partition->offset);
+
+   buf[name_len - 1] = '\0';
+   partition->name = buf;
+
+   *_mtdparts = mtdparts;
+
+   return 0;
+}
+
+/**
+ * mtd_parse_partitions - Create a 

[U-Boot] [PATCH v12 0/8] SPI-NAND support (third batch)

2018-09-29 Thread Miquel Raynal
During the last months, Boris Brezillon shared his work to support
serial flashes within Linux. First, he delivered (and merged) a new
layer called spi-mem. He also initiated in Linux MTD subsystem the move
of all 'raw' NAND related code to a raw/ subdirectory, adding at the
same time a NAND core that would be shared with all NAND devices. Then,
he contributed a generic SPI-NAND driver, making use of this NAND core,
as well as some vendor code to drive a few chips.

On top of this work, I made some cleanups in the MTD layer and added an
'mtd' U-Boot command to handle all sort of MTD devices. This should
become the default command instead of having one per flash flavor
('sf', 'nand', 'spi-nand' ?).

The series has been tested on an Ocelot board PCB123 (VSC7514),
featuring a Macronix SPI NAND chip.

TL;DR: the series contains (stripped version since ~30 patches have
already been taken):
- Support for spi-nand devices in mtdparts.
- Generics mtdparts/mtdids parsers.
- A new 'mtd' command.
- A note to set mtdparts command legacy.

To test your SPI-NAND device with U-Boot, you can test someting like:

> setenv mtdparts 'spi-nand0:1m(foo),-(bar)'
> setenv mtdids 'spi-nand0=spi0.0' # spi0.0 is Linux MTD name for this device
> ubi part bar # create a static UBI volume in the bar partition
> mtd list # show the current MTD devices/partitions

Thanks,
Miquèl


NB1: If UBI refuses to attach, verify the partition is epty with
 # mtd erase bar

NB2: If your U-Boot crashes and you are using a non SPI-NAND device,
 don't forget to probe your device *first* (sf probe, ...).


Changes since v11:
--
* Due to the number of small changes I had to do to handle the various
  build failures reported by Travis, I decided to send a full v12 so
  that all the patches can be replaced and are known to compile
  properly.
* Adding a patch to drop an unused helper in mtd_uboot.c that in some
  cases causes build issues (if compiled without DM support enabled).
* Travis CI status (build success except for one unrelated issue):
  https://travis-ci.org/miquelraynal/u-boot/builds/434796123

Changes since v10:
--
* Only two patches sent independently with small fixes to handle build
  failures for some configurations (reported by Travis)

Changes since v9:
-
* mtd_search_alternate_name() is moved in mtd_uboot.c (generic code,
  everybody wants to use mtdids).
* mtd_parse_partitions() is still in mtdparts.c because it depends on
  partitions support, but the header file declaring it
  (include/linux/mtd/partitions.h) also has a dummy function if
  #if IS_ENABLED(CONFIG_MTD_PARTITIONS) is false.
* Typo corrected in mtd_parse_partitions prototype
  (s/_nb_parts/_nparts/).
* Added Boris' R-b tags.

Changes since v8 (called v7 by mistake):

* Moved most of the generic logic to the core (mtd_uboot.c) so that it
  can be reused by other parts of U-Boot without depending on anything
  else than the MTD core itself.
* Removed the "#ifdef CONFIG_MTD" around mtd_probe_devices() calls now
  that the code is in the core.
* Created an helper for partitions deletion (as there is one to
  parse/create partition objects).
* Drop "cmd: mtdparts: try to probe the MTD devices as a fallback" to
  actually deprecate the command.
* Enhanced a bit the text in Kconfig about deprecating mtdparts.
* Fixed checkpatch.pl warnings in the mtdparts driver.

cmd/mtd.c:
* The logic in the mtd_is_aligned_with_*() functions was wrong, inversed
  it so the result is what the reader expects (the logic in the end was
  valid, though).
* Discriminate two path: for NAND-like devices (pages, OOB, raw mode,
  bad blocks) and the others.
* Add the "bad" feature to display all bad blocks (if any).
* Fix some typos/display strings.
* Moved the refcounting put_mtd_device() below in the code as suggested
  by Boris.
* Avoid writing empty pages by default (add an option to force the
  writing).
* Always skip bad blocks.
* Lightened the code by creating helpers.

Changes since v7:
-
* Added Stefan R-b tags.
* Used tolower() as suggested by Stefan in lib/strto.c.
* Added a mention saying that we continue to abuse the kB suffix in
  lib/strto.c by not making a difference between kB and kiB which both
  mean "* 1024" for us. This has been added in the commit log.
* Fixed various bugs in the mtd command and in the parsers, they should
  be pretty stable now (tested with two MTD devices probed and several
  different partition configurations).
* mtdids is not deprecated at all as opposed at what I wrote in
  v6. U-Boot still uses its own MTD names (being  like nor0
  or spi-nand1) and mtdids is still needed to do the glue.
* Removed a useless patch removing a Kconfig entry I added myself since
  during a rebase someone else also added this symbol.

Changes since v6:
-
* Squashed Boris' fixes about build issues in Travis.
* Merged Stefan Roese's 

  1   2   >