Re: [U-Boot] [PATCH 12/12] sunxi: add a defconfig for SoPine w/ official baseboard

2017-06-02 Thread icenowy

在 2017-06-03 09:19,André Przywara 写道:

Hi,

On 26/04/17 15:50, Icenowy Zheng wrote:
The SoPine is a SoM by Pine64, with an Allwinner A64 SoC, a LPDDR3 
DRAM

chip, an AXP803 PMIC, a SPI NOR Flash and a MicroSD slot. The card
detect pin of the MicroSD slot is broken, however, it doesn't matter 
as

the design of SoPine didn't allow hot-swapping the MicroSD card (The
MicroSD slot is at the back of the SoM, and when the SoM is installed 
on

the baseboard, it's nearly impossible to remove the MicroSD).

The official baseboard of it is a board with nearly the same 
connectors

with the original Pine64+, with the MicroUSB power jack replaced, and
at the position of MicroSD slot a eMMC module slot is added.

Add support for SoPine with the official baseboard by adding its
defconfig file. It still uses the device tree of Pine64, however, it
will change after a proper device tree of SoPine with baseboard is
accepted by Linux mainline.


There is some point in this, but I wonder if we actually need to wait
for Linux. In fact since the SoPine has SPI flash, we don't desperately
need a DT in the Linux source tree, since it could just come with the
device - as in U-Boot's DT passed through to the kernel.

So can we have a separate DT, probably including -pine64.dts and at
least adding the eMMC? Could be copy version of the BPi-M64, for
instance.


In fact changing the defconfig is now enough to initialize the MMC2
controller.

See "CONFIG_MMC_SUNXI_SLOT_EXTRA=2" below.



One more below 


Signed-off-by: Icenowy Zheng 
---
 configs/sopine_baseboard_defconfig | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 configs/sopine_baseboard_defconfig

diff --git a/configs/sopine_baseboard_defconfig 
b/configs/sopine_baseboard_defconfig

new file mode 100644
index 00..02ffb43d54
--- /dev/null
+++ b/configs/sopine_baseboard_defconfig
@@ -0,0 +1,22 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I=y
+CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
+CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
+CONFIG_DRAM_CLK=552
+CONFIG_DRAM_ZQ=3881949
+CONFIG_DRAM_ODT_EN=y
+CONFIG_MMC0_CD_PIN=""
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_CONSOLE_MUX=y
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y


Can you add the SPL SPI flash options here? This allows loading U-Boot
from SPI flash and makes this much more useful.


Yes, seems useful...



Cheers,
Andre.

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


[U-Boot] [PATCH v2 26/31] dm: serial: Separate out the core serial-device finding code

2017-06-02 Thread Simon Glass
This function is quite long. Move the core code into a separate function
in preparation for adding livetree support.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/serial/serial-uclass.c | 84 ++
 1 file changed, 44 insertions(+), 40 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index a9c4f89e1a..ede5c2c0be 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -27,11 +26,53 @@ static const unsigned long baudrate_table[] = 
CONFIG_SYS_BAUDRATE_TABLE;
 #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN 
to make this work"
 #endif
 
+static int serial_check_stdout(const void *blob, struct udevice **devp)
+{
+   int node;
+
+   /* Check for a chosen console */
+   node = fdtdec_get_chosen_node(blob, "stdout-path");
+   if (node < 0) {
+   const char *str, *p, *name;
+
+   /*
+* Deal with things like
+*  stdout-path = "serial0:115200n8";
+*
+* We need to look up the alias and then follow it to the
+* correct node.
+*/
+   str = fdtdec_get_chosen_prop(blob, "stdout-path");
+   if (str) {
+   p = strchr(str, ':');
+   name = fdt_get_alias_namelen(blob, str,
+   p ? p - str : strlen(str));
+   if (name)
+   node = fdt_path_offset(blob, name);
+   }
+   }
+   if (node < 0)
+   node = fdt_path_offset(blob, "console");
+   if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, devp))
+   return 0;
+
+   /*
+* If the console is not marked to be bound before relocation, bind it
+* anyway.
+*/
+   if (node > 0 && !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
+   devp)) {
+   if (!device_probe(*devp))
+   return 0;
+   }
+
+   return -ENODEV;
+}
+
 static void serial_find_console_or_panic(void)
 {
const void *blob = gd->fdt_blob;
struct udevice *dev;
-   int node;
 
if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
uclass_first_device(UCLASS_SERIAL, );
@@ -40,47 +81,10 @@ static void serial_find_console_or_panic(void)
return;
}
} else if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) {
-   /* Check for a chosen console */
-   node = fdtdec_get_chosen_node(blob, "stdout-path");
-   if (node < 0) {
-   const char *str, *p, *name;
-
-   /*
-* Deal with things like
-*  stdout-path = "serial0:115200n8";
-*
-* We need to look up the alias and then follow it to
-* the correct node.
-*/
-   str = fdtdec_get_chosen_prop(blob, "stdout-path");
-   if (str) {
-   p = strchr(str, ':');
-   name = fdt_get_alias_namelen(blob, str,
-   p ? p - str : strlen(str));
-   if (name)
-   node = fdt_path_offset(blob, name);
-   }
-   }
-   if (node < 0)
-   node = fdt_path_offset(blob, "console");
-   if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node,
-   )) {
+   if (!serial_check_stdout(blob, )) {
gd->cur_serial_dev = dev;
return;
}
-
-   /*
-* If the console is not marked to be bound before relocation,
-* bind it anyway.
-*/
-   if (node > 0 &&
-   !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
-   )) {
-   if (!device_probe(dev)) {
-   gd->cur_serial_dev = dev;
-   return;
-   }
-   }
}
if (!SPL_BUILD || !CONFIG_IS_ENABLED(OF_CONTROL) || !blob) {
/*
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 29/31] fdtdec: Drop old compatible values

2017-06-02 Thread Simon Glass
These are not needed now since the drivers now use driver model. Drop
them.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 include/fdtdec.h | 6 --
 lib/fdtdec.c | 6 --
 2 files changed, 12 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index eda2ffaf66..4a0947c626 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -119,12 +119,6 @@ enum fdt_compat_id {
COMPAT_NVIDIA_TEGRA20_EMC,  /* Tegra20 memory controller */
COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */
COMPAT_NVIDIA_TEGRA20_NAND, /* Tegra2 NAND controller */
-   COMPAT_NVIDIA_TEGRA124_PMC, /* Tegra 124 power mgmt controller */
-   COMPAT_NVIDIA_TEGRA186_SDMMC,   /* Tegra186 SDMMC controller */
-   COMPAT_NVIDIA_TEGRA210_SDMMC,   /* Tegra210 SDMMC controller */
-   COMPAT_NVIDIA_TEGRA124_SDMMC,   /* Tegra124 SDMMC controller */
-   COMPAT_NVIDIA_TEGRA30_SDMMC,/* Tegra30 SDMMC controller */
-   COMPAT_NVIDIA_TEGRA20_SDMMC,/* Tegra20 SDMMC controller */
COMPAT_NVIDIA_TEGRA124_XUSB_PADCTL,
/* Tegra124 XUSB pad controller */
COMPAT_NVIDIA_TEGRA210_XUSB_PADCTL,
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 5a5645a0bf..a45783dbf8 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -33,12 +33,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA20_EMC, "nvidia,tegra20-emc"),
COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
-   COMPAT(NVIDIA_TEGRA124_PMC, "nvidia,tegra124-pmc"),
-   COMPAT(NVIDIA_TEGRA186_SDMMC, "nvidia,tegra186-sdhci"),
-   COMPAT(NVIDIA_TEGRA210_SDMMC, "nvidia,tegra210-sdhci"),
-   COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
-   COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
-   COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
COMPAT(NVIDIA_TEGRA210_XUSB_PADCTL, "nvidia,tegra210-xusb-padctl"),
COMPAT(SMSC_LAN9215, "smsc,lan9215"),
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 27/31] dm: serial: Add livetree support

2017-06-02 Thread Simon Glass
Add support for a live device tree to the core serial uclass.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/serial/serial-uclass.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index ede5c2c0be..976b99ce7c 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -81,9 +82,20 @@ static void serial_find_console_or_panic(void)
return;
}
} else if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) {
-   if (!serial_check_stdout(blob, )) {
-   gd->cur_serial_dev = dev;
-   return;
+   /* Live tree has support for stdout */
+   if (of_live_active()) {
+   struct device_node *np = of_get_stdout();
+
+   if (np && !uclass_get_device_by_ofnode(UCLASS_SERIAL,
+   np_to_ofnode(np), )) {
+   gd->cur_serial_dev = dev;
+   return;
+   }
+   } else {
+   if (!serial_check_stdout(blob, )) {
+   gd->cur_serial_dev = dev;
+   return;
+   }
}
}
if (!SPL_BUILD || !CONFIG_IS_ENABLED(OF_CONTROL) || !blob) {
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 21/31] dm: tegra: mmc: Convert to livetree

2017-06-02 Thread Simon Glass
Update the tegra mmc driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/mmc/tegra_mmc.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
index 338e42b528..9f7e7195f1 100644
--- a/drivers/mmc/tegra_mmc.c
+++ b/drivers/mmc/tegra_mmc.c
@@ -11,10 +11,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -599,8 +599,7 @@ static int tegra_mmc_probe(struct udevice *dev)
 
cfg->name = dev->name;
 
-   bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-  "bus-width", 1);
+   bus_width = dev_read_u32_default(dev, "bus-width", 1);
 
cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
cfg->host_caps = 0;
@@ -621,7 +620,7 @@ static int tegra_mmc_probe(struct udevice *dev)
 
cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
 
-   priv->reg = (void *)devfdt_get_addr(dev);
+   priv->reg = (void *)dev_read_addr(dev);
 
ret = reset_get_by_name(dev, "sdhci", >reset_ctl);
if (ret) {
@@ -648,12 +647,10 @@ static int tegra_mmc_probe(struct udevice *dev)
return ret;
 
/* These GPIOs are optional */
-   gpio_request_by_name(dev, "cd-gpios", 0, >cd_gpio,
-GPIOD_IS_IN);
-   gpio_request_by_name(dev, "wp-gpios", 0, >wp_gpio,
-GPIOD_IS_IN);
-   gpio_request_by_name(dev, "power-gpios", 0,
->pwr_gpio, GPIOD_IS_OUT);
+   gpio_request_by_name(dev, "cd-gpios", 0, >cd_gpio, GPIOD_IS_IN);
+   gpio_request_by_name(dev, "wp-gpios", 0, >wp_gpio, GPIOD_IS_IN);
+   gpio_request_by_name(dev, "power-gpios", 0, >pwr_gpio,
+GPIOD_IS_OUT);
if (dm_gpio_is_valid(>pwr_gpio))
dm_gpio_set_value(>pwr_gpio, 1);
 
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 30/31] tegra: fdt: Ensure that the console UART is enabled

2017-06-02 Thread Simon Glass
Many tegra boards have the console UART node disabled. With livetree this
prevents serial from working since it does not 'force' the console to be
bound. Updates the affected boards to fix this error.

The boards were checked with:

for b in $(grep  tegra boards.cfg  |grep -v integrator | \
awk '{print $7}' | sort); do
echo $b;
fdtgrep -c nvidia,tegra20-uart b/$b/u-boot.dtb |grep okay;
done

Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to ensure that the console UART is enabled

 arch/arm/dts/tegra114-dalmore.dts | 4 
 arch/arm/dts/tegra124-cei-tk1-som.dts | 4 
 arch/arm/dts/tegra124-jetson-tk1.dts  | 4 
 arch/arm/dts/tegra124-venice2.dts | 4 
 arch/arm/dts/tegra186-p2771-.dtsi | 4 
 arch/arm/dts/tegra20-colibri.dts  | 4 
 arch/arm/dts/tegra20-harmony.dts  | 4 
 arch/arm/dts/tegra20-trimslice.dts| 4 
 arch/arm/dts/tegra20-whistler.dts | 4 
 arch/arm/dts/tegra210-e2220-1170.dts  | 4 
 arch/arm/dts/tegra210-p2371-.dts  | 4 
 arch/arm/dts/tegra210-p2371-2180.dts  | 4 
 arch/arm/dts/tegra210-p2571.dts   | 4 
 arch/arm/dts/tegra30-apalis.dts   | 4 
 arch/arm/dts/tegra30-beaver.dts   | 4 
 arch/arm/dts/tegra30-cardhu.dts   | 4 
 arch/arm/dts/tegra30-colibri.dts  | 4 
 arch/arm/dts/tegra30-tec-ng.dts   | 4 
 18 files changed, 72 insertions(+)

diff --git a/arch/arm/dts/tegra114-dalmore.dts 
b/arch/arm/dts/tegra114-dalmore.dts
index 5f4df88f84..18bcb75faf 100644
--- a/arch/arm/dts/tegra114-dalmore.dts
+++ b/arch/arm/dts/tegra114-dalmore.dts
@@ -93,3 +93,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra124-cei-tk1-som.dts 
b/arch/arm/dts/tegra124-cei-tk1-som.dts
index c4d4f9d89f..b1dd4181ac 100644
--- a/arch/arm/dts/tegra124-cei-tk1-som.dts
+++ b/arch/arm/dts/tegra124-cei-tk1-som.dts
@@ -475,3 +475,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra124-jetson-tk1.dts 
b/arch/arm/dts/tegra124-jetson-tk1.dts
index f1db952355..d6420436cd 100644
--- a/arch/arm/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/dts/tegra124-jetson-tk1.dts
@@ -480,3 +480,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra124-venice2.dts 
b/arch/arm/dts/tegra124-venice2.dts
index add9244e68..7e9c6aa183 100644
--- a/arch/arm/dts/tegra124-venice2.dts
+++ b/arch/arm/dts/tegra124-venice2.dts
@@ -109,3 +109,7 @@
};
 
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra186-p2771-.dtsi 
b/arch/arm/dts/tegra186-p2771-.dtsi
index 54b2539ff4..a1319dc493 100644
--- a/arch/arm/dts/tegra186-p2771-.dtsi
+++ b/arch/arm/dts/tegra186-p2771-.dtsi
@@ -76,3 +76,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra20-colibri.dts b/arch/arm/dts/tegra20-colibri.dts
index 3c10dd6630..9171319d98 100644
--- a/arch/arm/dts/tegra20-colibri.dts
+++ b/arch/arm/dts/tegra20-colibri.dts
@@ -162,3 +162,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra20-harmony.dts b/arch/arm/dts/tegra20-harmony.dts
index dcbde7c2ed..0c907054db 100644
--- a/arch/arm/dts/tegra20-harmony.dts
+++ b/arch/arm/dts/tegra20-harmony.dts
@@ -812,3 +812,7 @@
clock-names = "pll_a", "pll_a_out0", "mclk";
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra20-trimslice.dts 
b/arch/arm/dts/tegra20-trimslice.dts
index 7fb7dd0b58..31f509ab12 100644
--- a/arch/arm/dts/tegra20-trimslice.dts
+++ b/arch/arm/dts/tegra20-trimslice.dts
@@ -129,3 +129,7 @@
};
 
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra20-whistler.dts 
b/arch/arm/dts/tegra20-whistler.dts
index 447874674d..074d377ca1 100644
--- a/arch/arm/dts/tegra20-whistler.dts
+++ b/arch/arm/dts/tegra20-whistler.dts
@@ -75,3 +75,7 @@
};
 
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra210-e2220-1170.dts 
b/arch/arm/dts/tegra210-e2220-1170.dts
index 70cd72b561..e6b06862d8 100644
--- a/arch/arm/dts/tegra210-e2220-1170.dts
+++ b/arch/arm/dts/tegra210-e2220-1170.dts
@@ -57,3 +57,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra210-p2371-.dts 
b/arch/arm/dts/tegra210-p2371-.dts
index d9612962bd..539e7cef93 100644
--- a/arch/arm/dts/tegra210-p2371-.dts
+++ b/arch/arm/dts/tegra210-p2371-.dts
@@ -58,3 +58,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/tegra210-p2371-2180.dts 
b/arch/arm/dts/tegra210-p2371-2180.dts
index 0dc06a4721..da4349bd03 100644
--- a/arch/arm/dts/tegra210-p2371-2180.dts
+++ b/arch/arm/dts/tegra210-p2371-2180.dts
@@ -109,3 +109,7 @@
};
};
 };
+
+ {
+   status = "okay";
+};
diff --git 

[U-Boot] [PATCH v2 25/31] dm: serial: ns16550: Convert to livetree

2017-06-02 Thread Simon Glass
Update this driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/serial/ns16550.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 52c52c1ad1..330c5e186a 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -395,7 +394,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
int err;
 
/* try Processor Local Bus device first */
-   addr = devfdt_get_addr(dev);
+   addr = dev_read_addr(dev);
 #if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
if (addr == FDT_ADDR_T_NONE) {
/* then try pci device */
@@ -434,11 +433,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE);
 #endif
 
-   plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-"reg-offset", 0);
-   plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-"reg-shift", 0);
-
+   plat->reg_offset = dev_read_u32_default(dev, "reg-offset", 0);
+   plat->reg_shift = dev_read_u32_default(dev, "reg-shift", 0);
err = clk_get_by_index(dev, 0, );
if (!err) {
err = clk_get_rate();
@@ -450,9 +446,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
}
 
if (!plat->clock)
-   plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-"clock-frequency",
-CONFIG_SYS_NS16550_CLK);
+   plat->clock = dev_read_u32_default(dev, "clock-frequency",
+  CONFIG_SYS_NS16550_CLK);
if (!plat->clock) {
debug("ns16550 clock not defined\n");
return -EINVAL;
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 23/31] power: Add a GPIO driver for the as3722 PMIC

2017-06-02 Thread Simon Glass
This pmic includes GPIOs which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass 
Reviewed-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/power/pmic/as3722_gpio.c | 120 +++
 include/power/as3722.h   |   5 ++
 2 files changed, 125 insertions(+)
 create mode 100644 drivers/power/pmic/as3722_gpio.c

diff --git a/drivers/power/pmic/as3722_gpio.c b/drivers/power/pmic/as3722_gpio.c
new file mode 100644
index 00..d0b681ca4a
--- /dev/null
+++ b/drivers/power/pmic/as3722_gpio.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2014 NVIDIA Corporation
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define NUM_GPIOS  8
+
+int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
+ unsigned long flags)
+{
+   u8 value = 0;
+   int err;
+
+   if (flags & AS3722_GPIO_OUTPUT_VDDH)
+   value |= AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDH;
+
+   if (flags & AS3722_GPIO_INVERT)
+   value |= AS3722_GPIO_CONTROL_INVERT;
+
+   err = pmic_reg_write(pmic, AS3722_GPIO_CONTROL(gpio), value);
+   if (err) {
+   error("failed to configure GPIO#%u: %d", gpio, err);
+   return err;
+   }
+
+   return 0;
+}
+
+static int as3722_gpio_set_value(struct udevice *dev, unsigned int gpio,
+int level)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   const char *l;
+   u8 value;
+   int err;
+
+   if (gpio >= NUM_GPIOS)
+   return -EINVAL;
+
+   err = pmic_reg_read(pmic, AS3722_GPIO_SIGNAL_OUT);
+   if (err < 0) {
+   error("failed to read GPIO signal out register: %d", err);
+   return err;
+   }
+   value = err;
+
+   if (level == 0) {
+   value &= ~(1 << gpio);
+   l = "low";
+   } else {
+   value |= 1 << gpio;
+   l = "high";
+   }
+
+   err = pmic_reg_write(pmic, AS3722_GPIO_SIGNAL_OUT, value);
+   if (err) {
+   error("failed to set GPIO#%u %s: %d", gpio, l, err);
+   return err;
+   }
+
+   return 0;
+}
+
+int as3722_gpio_direction_output(struct udevice *dev, unsigned int gpio,
+int value)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   int err;
+
+   if (gpio > 7)
+   return -EINVAL;
+
+   if (value == 0)
+   value = AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDL;
+   else
+   value = AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDH;
+
+   err = pmic_reg_write(pmic, AS3722_GPIO_CONTROL(gpio), value);
+   if (err) {
+   error("failed to configure GPIO#%u as output: %d", gpio, err);
+   return err;
+   }
+
+   err = as3722_gpio_set_value(pmic, gpio, value);
+   if (err < 0) {
+   error("failed to set GPIO#%u high: %d", gpio, err);
+   return err;
+   }
+
+   return 0;
+}
+
+static int as3722_gpio_probe(struct udevice *dev)
+{
+   struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+
+   uc_priv->gpio_count = NUM_GPIOS;
+   uc_priv->bank_name = "as3722_";
+
+   return 0;
+}
+
+static const struct dm_gpio_ops gpio_as3722_ops = {
+   .direction_output   = as3722_gpio_direction_output,
+   .set_value  = as3722_gpio_set_value,
+};
+
+U_BOOT_DRIVER(gpio_as3722) = {
+   .name   = "gpio_as3722",
+   .id = UCLASS_GPIO,
+   .ops= _as3722_ops,
+   .probe  = as3722_gpio_probe,
+};
diff --git a/include/power/as3722.h b/include/power/as3722.h
index 14afa0c81a..713e79840f 100644
--- a/include/power/as3722.h
+++ b/include/power/as3722.h
@@ -20,6 +20,11 @@
 #define AS3722_ASIC_ID1 0x90
 #define AS3722_ASIC_ID2 0x91
 
+#define AS3722_GPIO_CONTROL(n) (0x08 + (n))
+#define AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDH (1 << 0)
+#define AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDL (7 << 0)
+#define AS3722_GPIO_CONTROL_INVERT (1 << 7)
+
 struct udevice;
 
 int as3722_init(struct udevice **devp);
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 28/31] tegra: Show a debug message if the LCD PMIC fails to start

2017-06-02 Thread Simon Glass
This error condition should have a debug() message. Add it.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-tegra/board2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 0291c7fb33..e0a39e1a32 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -150,8 +150,10 @@ int board_init(void)
 #if defined(CONFIG_DM_VIDEO)
board_id = tegra_board_id();
err = tegra_lcd_pmic_init(board_id);
-   if (err)
+   if (err) {
+   debug("Failed to set up LCD PMIC\n");
return err;
+   }
 #endif
 
 #ifdef CONFIG_TEGRA_NAND
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 17/31] dm: tegra: usb: Convert to livetree

2017-06-02 Thread Simon Glass
Update the Tegra EHCI driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/usb/host/ehci-tegra.c | 34 ++
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 873bf8ecfd..1c72330b0c 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "ehci.h"
 
@@ -695,12 +694,11 @@ static void config_clock(const u32 timing[])
 
 static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config)
 {
-   const void *blob = gd->fdt_blob;
-   int node = dev_of_offset(dev);
const char *phy, *mode;
 
-   config->reg = (struct usb_ctlr *)devfdt_get_addr(dev);
-   mode = fdt_getprop(blob, node, "dr_mode", NULL);
+   config->reg = (struct usb_ctlr *)dev_read_addr(dev);
+   debug("reg=%p\n", config->reg);
+   mode = dev_read_string(dev, "dr_mode");
if (mode) {
if (0 == strcmp(mode, "host"))
config->dr_mode = DR_MODE_HOST;
@@ -717,28 +715,24 @@ static int fdt_decode_usb(struct udevice *dev, struct 
fdt_usb *config)
config->dr_mode = DR_MODE_HOST;
}
 
-   phy = fdt_getprop(blob, node, "phy_type", NULL);
+   phy = dev_read_string(dev, "phy_type");
config->utmi = phy && 0 == strcmp("utmi", phy);
config->ulpi = phy && 0 == strcmp("ulpi", phy);
-   config->enabled = fdtdec_get_is_enabled(blob, node);
-   config->has_legacy_mode = fdtdec_get_bool(blob, node,
- "nvidia,has-legacy-mode");
+   config->has_legacy_mode = dev_read_bool(dev, "nvidia,has-legacy-mode");
config->periph_id = clock_decode_periph_id(dev);
if (config->periph_id == PERIPH_ID_NONE) {
debug("%s: Missing/invalid peripheral ID\n", __func__);
return -EINVAL;
}
-   gpio_request_by_name_nodev(offset_to_ofnode(node), "nvidia,vbus-gpio",
-  0, >vbus_gpio, GPIOD_IS_OUT);
-   gpio_request_by_name_nodev(offset_to_ofnode(node),
-  "nvidia,phy-reset-gpio", 0,
-  >phy_reset_gpio, GPIOD_IS_OUT);
-   debug("enabled=%d, legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, "
-   "vbus=%d, phy_reset=%d, dr_mode=%d\n",
-   config->enabled, config->has_legacy_mode, config->utmi,
-   config->ulpi, config->periph_id,
-   gpio_get_number(>vbus_gpio),
-   gpio_get_number(>phy_reset_gpio), config->dr_mode);
+   gpio_request_by_name(dev, "nvidia,vbus-gpio", 0, >vbus_gpio,
+GPIOD_IS_OUT);
+   gpio_request_by_name(dev, "nvidia,phy-reset-gpio", 0,
+>phy_reset_gpio, GPIOD_IS_OUT);
+   debug("legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, vbus=%d, 
phy_reset=%d, dr_mode=%d, reg=%p\n",
+ config->has_legacy_mode, config->utmi, config->ulpi,
+ config->periph_id, gpio_get_number(>vbus_gpio),
+ gpio_get_number(>phy_reset_gpio), config->dr_mode,
+ config->reg);
 
return 0;
 }
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 13/31] dm: video: tegra124: Convert to livetree

2017-06-02 Thread Simon Glass
Update these drives to support a live device tree.

Signed-off-by: Simon Glass 
Acked-by: Anatolij Gustschin 
---

Changes in v2: None

 drivers/video/tegra124/display.c |  8 +++-
 drivers/video/tegra124/dp.c  |  3 +--
 drivers/video/tegra124/sor.c | 25 +++--
 3 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index 47752b27f1..4164fa1bd9 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -334,7 +333,6 @@ static int display_init(struct udevice *dev, void *lcdbase,
 {
struct display_plat *disp_uc_plat;
struct dc_ctlr *dc_ctlr;
-   const void *blob = gd->fdt_blob;
struct udevice *dp_dev;
const int href_to_sync = 1, vref_to_sync = 1;
int panel_bpp = 18; /* default 18 bits per pixel */
@@ -363,9 +361,8 @@ static int display_init(struct udevice *dev, void *lcdbase,
return ret;
}
 
-   dc_ctlr = (struct dc_ctlr *)fdtdec_get_addr(blob, dev_of_offset(dev),
-   "reg");
-   if (fdtdec_decode_display_timing(blob, dev_of_offset(dev), 0, timing)) {
+   dc_ctlr = (struct dc_ctlr *)dev_read_addr(dev);
+   if (ofnode_decode_display_timing(dev_ofnode(dev), 0, timing)) {
debug("%s: Failed to decode display timing\n", __func__);
return -EINVAL;
}
@@ -416,6 +413,7 @@ static int display_init(struct udevice *dev, void *lcdbase,
debug("dc: failed to update window\n");
return ret;
}
+   debug("%s: ready\n", __func__);
 
return 0;
 }
diff --git a/drivers/video/tegra124/dp.c b/drivers/video/tegra124/dp.c
index c38b3e5335..95d743d0f4 100644
--- a/drivers/video/tegra124/dp.c
+++ b/drivers/video/tegra124/dp.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1572,7 +1571,7 @@ static int tegra_dp_ofdata_to_platdata(struct udevice 
*dev)
 {
struct tegra_dp_plat *plat = dev_get_platdata(dev);
 
-   plat->base = devfdt_get_addr(dev);
+   plat->base = dev_read_addr(dev);
 
return 0;
 }
diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c
index 5e4140ff53..1f5e572bda 100644
--- a/drivers/video/tegra124/sor.c
+++ b/drivers/video/tegra124/sor.c
@@ -7,9 +7,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -750,15 +750,12 @@ int tegra_dc_sor_attach(struct udevice *dc_dev, struct 
udevice *dev,
const struct display_timing *timing)
 {
struct tegra_dc_sor_data *sor = dev_get_priv(dev);
-   const void *blob = gd->fdt_blob;
struct dc_ctlr *disp_ctrl;
u32 reg_val;
-   int node;
 
/* Use the first display controller */
debug("%s\n", __func__);
-   node = dev_of_offset(dc_dev);
-   disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
+   disp_ctrl = (struct dc_ctlr *)dev_read_addr(dc_dev);
 
tegra_dc_sor_enable_dc(disp_ctrl);
tegra_dc_sor_config_panel(sor, 0, link_cfg, timing);
@@ -965,16 +962,13 @@ int tegra_dc_sor_detach(struct udevice *dc_dev, struct 
udevice *dev)
 {
struct tegra_dc_sor_data *sor = dev_get_priv(dev);
int dc_reg_ctx[DC_REG_SAVE_SPACE];
-   const void *blob = gd->fdt_blob;
struct dc_ctlr *disp_ctrl;
unsigned long dc_int_mask;
-   int node;
int ret;
 
debug("%s\n", __func__);
/* Use the first display controller */
-   node = dev_of_offset(dc_dev);
-   disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
+   disp_ctrl = (struct dc_ctlr *)dev_read_addr(dev);
 
/* Sleep mode */
tegra_sor_writel(sor, SUPER_STATE1, SUPER_STATE1_ASY_HEAD_OP_SLEEP |
@@ -1041,18 +1035,13 @@ static int tegra_sor_set_backlight(struct udevice *dev, 
int percent)
 static int tegra_sor_ofdata_to_platdata(struct udevice *dev)
 {
struct tegra_dc_sor_data *priv = dev_get_priv(dev);
-   const void *blob = gd->fdt_blob;
-   int node;
int ret;
 
-   priv->base = (void *)fdtdec_get_addr(blob, dev_of_offset(dev), "reg");
+   priv->base = (void *)dev_read_addr(dev);
 
-   node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA124_PMC);
-   if (node < 0) {
-   debug("%s: Cannot find PMC\n", __func__);
-   return -ENOENT;
-   }
-   priv->pmc_base = (void *)fdtdec_get_addr(blob, node, "reg");
+   priv->pmc_base = (void *)syscon_get_first_range(TEGRA_SYSCON_PMC);
+   if (IS_ERR(priv->pmc_base))
+   return PTR_ERR(priv->pmc_base);
 
ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev, "nvidia,panel",
 

[U-Boot] [PATCH v2 14/31] tegra: Don't set up the UART clocks again in U-Boot

2017-06-02 Thread Simon Glass
This UART clocks are already set up in SPL so we don't need to do it again
in U-Boot. This seems to cause a hang on Nyan.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-tegra/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
index b3a041b539..c478420655 100644
--- a/arch/arm/mach-tegra/board.c
+++ b/arch/arm/mach-tegra/board.c
@@ -187,7 +187,9 @@ static void setup_uarts(int uart_ids)
enum periph_id id = id_for_uart[i];
 
funcmux_select(id, uart_configs[i]);
+#ifdef CONFIG_SPL_BUILD
clock_ll_start_uart(id);
+#endif
}
}
 }
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 19/31] dm: tegra: i2c: Convert to livetree

2017-06-02 Thread Simon Glass
Update the tegra i2c driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/i2c/tegra_i2c.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 055f48153a..4163d798d5 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -365,7 +365,11 @@ static int tegra_i2c_probe(struct udevice *dev)
 
i2c_bus->id = dev->seq;
i2c_bus->type = dev_get_driver_data(dev);
-   i2c_bus->regs = (struct i2c_ctlr *)devfdt_get_addr(dev);
+   i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
+   if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) {
+   debug("%s: Cannot get regs address\n", __func__);
+   return -EINVAL;
+   }
 
ret = reset_get_by_name(dev, "i2c", _bus->reset_ctl);
if (ret) {
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 07/31] video: simple-panel: Add a little more debugging

2017-06-02 Thread Simon Glass
Add some debugging to show when the backlight is enabled.

Signed-off-by: Simon Glass 
Acked-by: Anatolij Gustschin 
---

Changes in v2: None

 drivers/video/simple_panel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c
index baa95f6a12..c0ce199c6a 100644
--- a/drivers/video/simple_panel.c
+++ b/drivers/video/simple_panel.c
@@ -25,8 +25,10 @@ static int simple_panel_enable_backlight(struct udevice *dev)
struct simple_panel_priv *priv = dev_get_priv(dev);
int ret;
 
+   debug("%s: start, backlight = '%s'\n", __func__, priv->backlight->name);
dm_gpio_set_value(>enable, 1);
ret = backlight_enable(priv->backlight);
+   debug("%s: done, ret = %d\n", __func__, ret);
if (ret)
return ret;
 
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 09/31] tegra: spl: Enable debug UART

2017-06-02 Thread Simon Glass
Enable the debug UART in SPL to allow early serial output even if the
standard UART does not work (e.g. due to driver model problem).

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-tegra/spl.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-tegra/spl.c b/arch/arm/mach-tegra/spl.c
index 41c88cb2b4..189b3da026 100644
--- a/arch/arm/mach-tegra/spl.c
+++ b/arch/arm/mach-tegra/spl.c
@@ -7,6 +7,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 #include 
+#include 
 #include 
 
 #include 
@@ -32,6 +33,9 @@ void spl_board_init(void)
gpio_early_init_uart();
 
clock_early_init();
+#ifdef CONFIG_DEBUG_UART
+   debug_uart_init();
+#endif
preloader_console_init();
 }
 
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 08/31] tegra: Fix up include file ordering

2017-06-02 Thread Simon Glass
Update these two files so include files in the right order.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/mach-tegra/board2.c | 22 --
 arch/arm/mach-tegra/clock.c  |  4 ++--
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 84f1ee5035..943ee24e59 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -9,14 +9,8 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -25,17 +19,17 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #ifdef CONFIG_TEGRA_CLOCK_SCALING
 #include 
 #endif
-#include 
-#ifdef CONFIG_USB_EHCI_TEGRA
-#include 
-#endif
-#include 
 #include 
-#include 
-#include 
 #include "emc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 3bb72331a4..f547942022 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -7,6 +7,8 @@
 /* Tegra SoC common clock control functions */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -15,8 +17,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 
 /*
  * This is our record of the current clock rate of each clock. We don't
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 12/31] dm: tegra: Convert clock_decode_periph_id() to support livetree

2017-06-02 Thread Simon Glass
Adjust this to take a device as a parameter instead of a node.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra/clock.h | 2 +-
 arch/arm/mach-tegra/clock.c | 5 ++---
 drivers/spi/tegra114_spi.c  | 2 +-
 drivers/spi/tegra20_sflash.c| 2 +-
 drivers/spi/tegra20_slink.c | 2 +-
 drivers/spi/tegra210_qspi.c | 2 +-
 drivers/usb/host/ehci-tegra.c   | 2 +-
 7 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
b/arch/arm/include/asm/arch-tegra/clock.h
index 388afcb723..301de4a899 100644
--- a/arch/arm/include/asm/arch-tegra/clock.h
+++ b/arch/arm/include/asm/arch-tegra/clock.h
@@ -266,7 +266,7 @@ void clock_ll_start_uart(enum periph_id periph_id);
  * @param node Node to look at
  * @return peripheral ID, or PERIPH_ID_NONE if none
  */
-enum periph_id clock_decode_periph_id(const void *blob, int node);
+int clock_decode_periph_id(struct udevice *dev);
 
 /**
  * Checks if the oscillator bypass is enabled (XOBP bit)
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index f547942022..090dba629c 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -652,14 +652,13 @@ void clock_ll_start_uart(enum periph_id periph_id)
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
-int clock_decode_periph_id(const void *blob, int node)
+int clock_decode_periph_id(struct udevice *dev)
 {
enum periph_id id;
u32 cell[2];
int err;
 
-   err = fdtdec_get_int_array(blob, node, "clocks", cell,
-  ARRAY_SIZE(cell));
+   err = dev_read_u32_array(dev, "clocks", cell, ARRAY_SIZE(cell));
if (err)
return -1;
id = clk_id_to_periph_id(cell[1]);
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 802117eb49..86b1019585 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -104,7 +104,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice 
*bus)
int node = dev_of_offset(bus);
 
plat->base = devfdt_get_addr(bus);
-   plat->periph_id = clock_decode_periph_id(blob, node);
+   plat->periph_id = clock_decode_periph_id(bus);
 
if (plat->periph_id == PERIPH_ID_NONE) {
debug("%s: could not decode periph id %d\n", __func__,
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index 299e1b44fa..e70210d7ab 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -91,7 +91,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice 
*bus)
int node = dev_of_offset(bus);
 
plat->base = devfdt_get_addr(bus);
-   plat->periph_id = clock_decode_periph_id(blob, node);
+   plat->periph_id = clock_decode_periph_id(bus);
 
if (plat->periph_id == PERIPH_ID_NONE) {
debug("%s: could not decode periph id %d\n", __func__,
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index 4cbde7b22f..f242574760 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -97,7 +97,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
int node = dev_of_offset(bus);
 
plat->base = devfdt_get_addr(bus);
-   plat->periph_id = clock_decode_periph_id(blob, node);
+   plat->periph_id = clock_decode_periph_id(bus);
 
if (plat->periph_id == PERIPH_ID_NONE) {
debug("%s: could not decode periph id %d\n", __func__,
diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c
index 6d0b5da261..2a35a583f5 100644
--- a/drivers/spi/tegra210_qspi.c
+++ b/drivers/spi/tegra210_qspi.c
@@ -100,7 +100,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice 
*bus)
int node = dev_of_offset(bus);
 
plat->base = devfdt_get_addr(bus);
-   plat->periph_id = clock_decode_periph_id(blob, node);
+   plat->periph_id = clock_decode_periph_id(bus);
 
if (plat->periph_id == PERIPH_ID_NONE) {
debug("%s: could not decode periph id %d\n", __func__,
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 7dc37f045d..873bf8ecfd 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -723,7 +723,7 @@ static int fdt_decode_usb(struct udevice *dev, struct 
fdt_usb *config)
config->enabled = fdtdec_get_is_enabled(blob, node);
config->has_legacy_mode = fdtdec_get_bool(blob, node,
  "nvidia,has-legacy-mode");
-   config->periph_id = clock_decode_periph_id(blob, node);
+   config->periph_id = clock_decode_periph_id(dev);
if (config->periph_id == PERIPH_ID_NONE) {
debug("%s: Missing/invalid peripheral ID\n", __func__);
return -EINVAL;
-- 
2.13.0.506.g27d5fe0cd-goog


[U-Boot] [PATCH v2 24/31] dm: power: Convert as3722 to driver model

2017-06-02 Thread Simon Glass
Convert this PMIC driver to driver model and fix up other users. The
regulator and GPIO functions are now handled by separate drivers.

Update nyan-big to work correct. Three boards will need to be updated by
the maintainers: apalis-tk1, jetson-tk1, cei-tk1-som

Signed-off-by: Simon Glass 
Reviewed-by: Lukasz Majewski 
---

Changes in v2: None

 arch/arm/mach-tegra/board2.c  |   6 -
 board/cei/cei-tk1-som/cei-tk1-som.c   |   2 +
 board/nvidia/jetson-tk1/jetson-tk1.c  |   2 +
 board/nvidia/nyan-big/nyan-big.c  |  22 +--
 board/toradex/apalis-tk1/apalis-tk1.c |   6 +
 configs/apalis-tk1_defconfig  |   3 +
 configs/cei-tk1-som_defconfig |   3 +
 configs/jetson-tk1_defconfig  |   3 +
 configs/nyan-big_defconfig|   1 +
 drivers/power/pmic/Makefile   |   2 +-
 drivers/power/pmic/as3722.c   | 292 --
 include/power/as3722.h|  18 +--
 12 files changed, 133 insertions(+), 227 deletions(-)

diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 5aedd3ef9d..0291c7fb33 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -29,7 +29,6 @@
 #ifdef CONFIG_TEGRA_CLOCK_SCALING
 #include 
 #endif
-#include 
 #include "emc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -142,11 +141,6 @@ int board_init(void)
debug("Memory controller init failed: %d\n", err);
 #  endif
 # endif /* CONFIG_TEGRA_PMU */
-#ifdef CONFIG_PMIC_AS3722
-   err = as3722_init(NULL);
-   if (err && err != -ENODEV)
-   return err;
-#endif
 #endif /* CONFIG_SYS_I2C_TEGRA */
 
 #ifdef CONFIG_USB_EHCI_TEGRA
diff --git a/board/cei/cei-tk1-som/cei-tk1-som.c 
b/board/cei/cei-tk1-som/cei-tk1-som.c
index 9ba7490c38..7c87bd1eb1 100644
--- a/board/cei/cei-tk1-som/cei-tk1-som.c
+++ b/board/cei/cei-tk1-som/cei-tk1-som.c
@@ -39,6 +39,7 @@ void pinmux_init(void)
 #ifdef CONFIG_PCI_TEGRA
 int tegra_pcie_board_init(void)
 {
+/* TODO: Convert to driver model
struct udevice *pmic;
int err;
 
@@ -59,6 +60,7 @@ int tegra_pcie_board_init(void)
error("failed to set SD4 voltage: %d\n", err);
return err;
}
+*/
 
return 0;
 }
diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c 
b/board/nvidia/jetson-tk1/jetson-tk1.c
index a66b710cdd..48272d086c 100644
--- a/board/nvidia/jetson-tk1/jetson-tk1.c
+++ b/board/nvidia/jetson-tk1/jetson-tk1.c
@@ -39,6 +39,7 @@ void pinmux_init(void)
 #ifdef CONFIG_PCI_TEGRA
 int tegra_pcie_board_init(void)
 {
+/* TODO: Convert to driver model
struct udevice *pmic;
int err;
 
@@ -59,6 +60,7 @@ int tegra_pcie_board_init(void)
error("failed to set SD4 voltage: %d\n", err);
return err;
}
+*/
 
return 0;
 }
diff --git a/board/nvidia/nyan-big/nyan-big.c b/board/nvidia/nyan-big/nyan-big.c
index 8f68ae9fbe..54acf5418d 100644
--- a/board/nvidia/nyan-big/nyan-big.c
+++ b/board/nvidia/nyan-big/nyan-big.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -46,20 +47,23 @@ int tegra_board_id(void)
 
 int tegra_lcd_pmic_init(int board_id)
 {
-   struct udevice *pmic;
+   struct udevice *dev;
int ret;
 
-   ret = as3722_get();
-   if (ret)
-   return -ENOENT;
+   ret = uclass_get_device_by_driver(UCLASS_PMIC,
+ DM_GET_DRIVER(pmic_as3722), );
+   if (ret) {
+   debug("%s: Failed to find PMIC\n", __func__);
+   return ret;
+   }
 
if (board_id == 0)
-   as3722_write(pmic, 0x00, 0x3c);
+   pmic_reg_write(dev, 0x00, 0x3c);
else
-   as3722_write(pmic, 0x00, 0x50);
-   as3722_write(pmic, 0x12, 0x10);
-   as3722_write(pmic, 0x0c, 0x07);
-   as3722_write(pmic, 0x20, 0x10);
+   pmic_reg_write(dev, 0x00, 0x50);
+   pmic_reg_write(dev, 0x12, 0x10);
+   pmic_reg_write(dev, 0x0c, 0x07);
+   pmic_reg_write(dev, 0x20, 0x10);
 
return 0;
 }
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c 
b/board/toradex/apalis-tk1/apalis-tk1.c
index c7e519c19b..5de61e7c2b 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -61,6 +61,7 @@ void pinmux_init(void)
 #ifdef CONFIG_PCI_TEGRA
 int tegra_pcie_board_init(void)
 {
+   /* TODO: Convert to driver model
struct udevice *pmic;
int err;
 
@@ -94,6 +95,7 @@ int tegra_pcie_board_init(void)
error("failed to set GPIO#2 high: %d\n", err);
return err;
}
+   */
 
/* Reset I210 Gigabit Ethernet Controller */
gpio_request(LAN_RESET_N, "LAN_RESET_N");
@@ -110,6 +112,7 @@ int tegra_pcie_board_init(void)
gpio_direction_output(TEGRA_GPIO(O, 6), 0);
 
/* Make sure LDO9 and LDO10 are initially enabled @ 0V */
+   /* TODO: Convert to driver model
   

[U-Boot] [PATCH v2 16/31] dm: tegra: gpio: Convert to support livetree

2017-06-02 Thread Simon Glass
Update the GPIO driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/gpio/tegra_gpio.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 687cd74fee..4965583158 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -337,11 +337,13 @@ static int gpio_tegra_bind(struct udevice *parent)
 * This driver does not make use of interrupts, other than to figure
 * out the number of GPIO banks
 */
-   if (!fdt_getprop(gd->fdt_blob, dev_of_offset(parent), "interrupts",
-))
-   return -EINVAL;
+   len = dev_read_size(parent, "interrupts");
+   if (len < 0)
+   return len;
bank_count = len / 3 / sizeof(u32);
-   ctlr = (struct gpio_ctlr *)devfdt_get_addr(parent);
+   ctlr = (struct gpio_ctlr *)dev_read_addr(parent);
+   if ((ulong)ctlr == FDT_ADDR_T_NONE)
+   return -EINVAL;
}
 #endif
for (bank = 0; bank < bank_count; bank++) {
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 11/31] dm: tegra: Convert USB setup to livetree

2017-06-02 Thread Simon Glass
Adjust this code to support a live device tree. This should be implemented
as a PHY driver but that is left as an exercise for the maintainer.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra/xusb-padctl.h |  2 +-
 arch/arm/mach-tegra/board2.c  |  2 +-
 arch/arm/mach-tegra/tegra124/xusb-padctl.c| 36 +---
 arch/arm/mach-tegra/tegra210/xusb-padctl.c| 40 +
 arch/arm/mach-tegra/xusb-padctl-common.c  | 84 ++-
 arch/arm/mach-tegra/xusb-padctl-common.h  | 11 ++--
 arch/arm/mach-tegra/xusb-padctl-dummy.c   |  2 +-
 7 files changed, 112 insertions(+), 65 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/xusb-padctl.h 
b/arch/arm/include/asm/arch-tegra/xusb-padctl.h
index b4b4c8ba4d..deccdf455d 100644
--- a/arch/arm/include/asm/arch-tegra/xusb-padctl.h
+++ b/arch/arm/include/asm/arch-tegra/xusb-padctl.h
@@ -15,7 +15,7 @@ struct tegra_xusb_phy;
  */
 struct tegra_xusb_phy *tegra_xusb_phy_get(unsigned int type);
 
-void tegra_xusb_padctl_init(const void *fdt);
+void tegra_xusb_padctl_init(void);
 int tegra_xusb_phy_prepare(struct tegra_xusb_phy *phy);
 int tegra_xusb_phy_enable(struct tegra_xusb_phy *phy);
 int tegra_xusb_phy_disable(struct tegra_xusb_phy *phy);
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 943ee24e59..5aedd3ef9d 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -164,7 +164,7 @@ int board_init(void)
pin_mux_nand();
 #endif
 
-   tegra_xusb_padctl_init(gd->fdt_blob);
+   tegra_xusb_padctl_init();
 
 #ifdef CONFIG_TEGRA_LP0
/* save Sdram params to PMC 2, 4, and 24 for WB0 */
diff --git a/arch/arm/mach-tegra/tegra124/xusb-padctl.c 
b/arch/arm/mach-tegra/tegra124/xusb-padctl.c
index 76af924b94..d326a6ae57 100644
--- a/arch/arm/mach-tegra/tegra124/xusb-padctl.c
+++ b/arch/arm/mach-tegra/tegra124/xusb-padctl.c
@@ -8,6 +8,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include "../xusb-padctl-common.h"
 
@@ -317,13 +319,33 @@ static const struct tegra_xusb_padctl_soc 
tegra124_socdata = {
.num_phys = ARRAY_SIZE(tegra124_phys),
 };
 
-void tegra_xusb_padctl_init(const void *fdt)
+void tegra_xusb_padctl_init(void)
 {
-   int count, nodes[1];
+   ofnode nodes[1];
+   int count = 0;
+   int ret;
+
+   debug("%s: start\n", __func__);
+   if (of_live_active()) {
+   struct device_node *np = of_find_compatible_node(NULL, NULL,
+   "nvidia,tegra124-xusb-padctl");
+
+   debug("np=%p\n", np);
+   if (np) {
+   nodes[0] = np_to_ofnode(np);
+   count = 1;
+   }
+   } else {
+   int node_offsets[1];
+   int i;
+
+   count = fdtdec_find_aliases_for_id(gd->fdt_blob, "padctl",
+   COMPAT_NVIDIA_TEGRA124_XUSB_PADCTL,
+   node_offsets, ARRAY_SIZE(node_offsets));
+   for (i = 0; i < count; i++)
+   nodes[i] = offset_to_ofnode(node_offsets[i]);
+   }
 
-   count = fdtdec_find_aliases_for_id(fdt, "padctl",
-  COMPAT_NVIDIA_TEGRA124_XUSB_PADCTL,
-  nodes, ARRAY_SIZE(nodes));
-   if (tegra_xusb_process_nodes(fdt, nodes, count, _socdata))
-   return;
+   ret = tegra_xusb_process_nodes(nodes, count, _socdata);
+   debug("%s: done, ret=%d\n", __func__, ret);
 }
diff --git a/arch/arm/mach-tegra/tegra210/xusb-padctl.c 
b/arch/arm/mach-tegra/tegra210/xusb-padctl.c
index 9ec93e7c4c..fde76dda01 100644
--- a/arch/arm/mach-tegra/tegra210/xusb-padctl.c
+++ b/arch/arm/mach-tegra/tegra210/xusb-padctl.c
@@ -8,6 +8,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include "../xusb-padctl-common.h"
 
@@ -421,17 +423,33 @@ static const struct tegra_xusb_padctl_soc 
tegra210_socdata = {
.num_phys = ARRAY_SIZE(tegra210_phys),
 };
 
-void tegra_xusb_padctl_init(const void *fdt)
+void tegra_xusb_padctl_init(void)
 {
-   int count, nodes[1];
-
-   debug("> %s(fdt=%p)\n", __func__, fdt);
-
-   count = fdtdec_find_aliases_for_id(fdt, "padctl",
-  COMPAT_NVIDIA_TEGRA210_XUSB_PADCTL,
-  nodes, ARRAY_SIZE(nodes));
-   if (tegra_xusb_process_nodes(fdt, nodes, count, _socdata))
-   return;
+   ofnode nodes[1];
+   int count = 0;
+   int ret;
+
+   debug("%s: start\n", __func__);
+   if (of_live_active()) {
+   struct device_node *np = of_find_compatible_node(NULL, NULL,
+   "nvidia,tegra210-xusb-padctl");
+
+   debug("np=%p\n", np);
+   if (np) {
+   nodes[0] = np_to_ofnode(np);
+  

[U-Boot] [PATCH v2 31/31] dm: tegra: Move nyan-big and beaver to livetree

2017-06-02 Thread Simon Glass
Change these board to use a live device tree after relocation.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Enable livetree for beaver also
- Add timing information

 configs/beaver_defconfig   | 1 +
 configs/nyan-big_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig
index 71d6cd52c1..10fd50d925 100644
--- a/configs/beaver_defconfig
+++ b/configs/beaver_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index 16993b46b9..1a4398612f 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -36,6 +36,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 18/31] dm: tegra: spi: Convert to livetree

2017-06-02 Thread Simon Glass
Update the tegra114 spi driver to support a live device tree.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/spi/tegra114_spi.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 86b1019585..013bc82380 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "tegra_spi.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -100,10 +99,8 @@ struct tegra114_spi_priv {
 static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
 {
struct tegra_spi_platdata *plat = bus->platdata;
-   const void *blob = gd->fdt_blob;
-   int node = dev_of_offset(bus);
 
-   plat->base = devfdt_get_addr(bus);
+   plat->base = dev_read_addr(bus);
plat->periph_id = clock_decode_periph_id(bus);
 
if (plat->periph_id == PERIPH_ID_NONE) {
@@ -113,10 +110,10 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice 
*bus)
}
 
/* Use 500KHz as a suitable default */
-   plat->frequency = fdtdec_get_int(blob, node, "spi-max-frequency",
-   50);
-   plat->deactivate_delay_us = fdtdec_get_int(blob, node,
-   "spi-deactivate-delay", 0);
+   plat->frequency = dev_read_u32_default(bus, "spi-max-frequency",
+  50);
+   plat->deactivate_delay_us = dev_read_u32_default(bus,
+   "spi-deactivate-delay", 0);
debug("%s: base=%#08lx, periph_id=%d, max-frequency=%d, 
deactivate_delay=%d\n",
  __func__, plat->base, plat->periph_id, plat->frequency,
  plat->deactivate_delay_us);
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 15/31] tegra: dts: Move stdout-path to /chosen

2017-06-02 Thread Simon Glass
This property should be in the /chosen node, not /aliases.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/dts/tegra124-nyan-big.dts | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/tegra124-nyan-big.dts 
b/arch/arm/dts/tegra124-nyan-big.dts
index 62f89d0f1a..f1c97052a8 100644
--- a/arch/arm/dts/tegra124-nyan-big.dts
+++ b/arch/arm/dts/tegra124-nyan-big.dts
@@ -8,7 +8,6 @@
 
aliases {
console = 
-   stdout-path = 
i2c0 = "/i2c@7000d000";
i2c1 = "/i2c@7000c000";
i2c2 = "/i2c@7000c400";
@@ -26,6 +25,10 @@
usb2 = "/usb@7d004000";
};
 
+   chosen {
+   stdout-path = 
+   };
+
host1x@5000 {
dc@5420 {
display-timings {
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 05/31] dm: video: Sync display on backspace

2017-06-02 Thread Simon Glass
We should sync the display (e.g. flush cache) when backspace is pressed
to ensure that the character is erased correctly.

Signed-off-by: Simon Glass 
Acked-by: Anatolij Gustschin 
---

Changes in v2: None

 drivers/video/vidconsole-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index e9a90b1b9b..b5afd72227 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -77,6 +77,7 @@ static int vidconsole_back(struct udevice *dev)
if (priv->ycur < 0)
priv->ycur = 0;
}
+   video_sync(dev->parent);
 
return 0;
 }
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 22/31] power: Add a regulator driver for the as3722 PMIC

2017-06-02 Thread Simon Glass
This pmic includes regulators which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass 
Reviewed-by: Lukasz Majewski 
---

Changes in v2: None

 drivers/power/regulator/Kconfig|   9 ++
 drivers/power/regulator/Makefile   |   1 +
 drivers/power/regulator/as3722_regulator.c | 149 +
 include/power/as3722.h |   8 ++
 4 files changed, 167 insertions(+)
 create mode 100644 drivers/power/regulator/as3722_regulator.c

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index ef057e0e2f..2583a19910 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -34,6 +34,15 @@ config REGULATOR_ACT8846
by the PMIC device. This driver is controlled by a device tree node
which includes voltage limits.
 
+config REGULATOR_AS3722
+   bool "Enable driver for AS7322 regulator"
+   depends on DM_REGULATOR && PMIC_AS3722
+   help
+ Enable support for the regulator functions of the AS3722. The
+ driver implements enable/disable for step-down bucks and LDOs,
+ but does not yet support change voltages. Currently this must be
+ done using direct register writes to the PMIC.
+
 config DM_REGULATOR_PFUZE100
bool "Enable Driver Model for REGULATOR PFUZE100"
depends on DM_REGULATOR && DM_PMIC_PFUZE100
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index 3e01021b76..48d3735d6c 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -7,6 +7,7 @@
 
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += regulator-uclass.o
 obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o
+obj-$(CONFIG_REGULATOR_AS3722) += as3722_regulator.o
 obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
 obj-$(CONFIG_DM_REGULATOR_PFUZE100) += pfuze100.o
 obj-$(CONFIG_REGULATOR_PWM) += pwm_regulator.o
diff --git a/drivers/power/regulator/as3722_regulator.c 
b/drivers/power/regulator/as3722_regulator.c
new file mode 100644
index 00..0122e1e389
--- /dev/null
+++ b/drivers/power/regulator/as3722_regulator.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2017 Google, Inc
+ * Written by Simon Glass 
+ *
+ * Placeholder regulator driver for as3722.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int stepdown_get_value(struct udevice *dev)
+{
+   return -ENOSYS;
+}
+
+static int stepdown_set_value(struct udevice *dev, int uvolt)
+{
+   return -ENOSYS;
+}
+
+static int stepdown_set_enable(struct udevice *dev, bool enable)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   int sd = dev->driver_data;
+   int ret;
+
+   ret = pmic_clrsetbits(pmic, AS3722_SD_CONTROL, 0, 1 << sd);
+   if (ret < 0) {
+   debug("%s: failed to write SD control register: %d", __func__,
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static bool stepdown_get_enable(struct udevice *dev)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   int sd = dev->driver_data;
+   int ret;
+
+   ret = pmic_reg_read(pmic, AS3722_SD_CONTROL);
+   if (ret < 0) {
+   debug("%s: failed to read SD control register: %d", __func__,
+ ret);
+   return false;
+   }
+
+   return ret & (1 << sd) ? true : false;
+}
+
+static int ldo_get_value(struct udevice *dev)
+{
+   return -ENOSYS;
+}
+
+static int ldo_set_value(struct udevice *dev, int uvolt)
+{
+   return -ENOSYS;
+}
+
+static int ldo_set_enable(struct udevice *dev, bool enable)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   int ldo = dev->driver_data;
+   int ret;
+
+   ret = pmic_clrsetbits(pmic, AS3722_LDO_CONTROL, 0, 1 << ldo);
+   if (ret < 0) {
+   debug("%s: failed to write LDO control register: %d", __func__,
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static bool ldo_get_enable(struct udevice *dev)
+{
+   struct udevice *pmic = dev_get_parent(dev);
+   int ldo = dev->driver_data;
+   int ret;
+
+   ret = pmic_reg_read(pmic, AS3722_LDO_CONTROL);
+   if (ret < 0) {
+   debug("%s: failed to read SD control register: %d", __func__,
+ ret);
+   return false;
+   }
+
+   return ret & (1 << ldo) ? true : false;
+}
+
+static int as3722_stepdown_probe(struct udevice *dev)
+{
+   struct dm_regulator_uclass_platdata *uc_pdata;
+
+   uc_pdata = dev_get_uclass_platdata(dev);
+
+   uc_pdata->type = REGULATOR_TYPE_BUCK;
+
+   return 0;
+}
+
+static int as3722_ldo_probe(struct udevice *dev)
+{
+   struct dm_regulator_uclass_platdata *uc_pdata;
+
+   uc_pdata = dev_get_uclass_platdata(dev);
+
+   uc_pdata->type = 

[U-Boot] [PATCH v2 10/31] tegra: nyan: Add a PMC syscon driver

2017-06-02 Thread Simon Glass
The PMC can be modelled as a syscon peripheral. Add a driver for this
so that it can be accessed by drivers when needed.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/arm/include/asm/arch-tegra/tegra.h |  5 +
 arch/arm/mach-tegra/tegra124/Makefile   |  1 +
 arch/arm/mach-tegra/tegra124/pmc.c  | 19 +++
 configs/nyan-big_defconfig  |  2 ++
 4 files changed, 27 insertions(+)
 create mode 100644 arch/arm/mach-tegra/tegra124/pmc.c

diff --git a/arch/arm/include/asm/arch-tegra/tegra.h 
b/arch/arm/include/asm/arch-tegra/tegra.h
index 3add1b3c09..3b9711d28e 100644
--- a/arch/arm/include/asm/arch-tegra/tegra.h
+++ b/arch/arm/include/asm/arch-tegra/tegra.h
@@ -97,6 +97,11 @@ enum {
TEGRA_SOC_UNKNOWN   = -1,
 };
 
+/* Tegra system controller (SYSCON) devices */
+enum {
+   TEGRA_SYSCON_PMC,
+};
+
 #else  /* __ASSEMBLY__ */
 #define PRM_RSTCTRLNV_PA_PMC_BASE
 #endif
diff --git a/arch/arm/mach-tegra/tegra124/Makefile 
b/arch/arm/mach-tegra/tegra124/Makefile
index c00de6151e..d275dafdc4 100644
--- a/arch/arm/mach-tegra/tegra124/Makefile
+++ b/arch/arm/mach-tegra/tegra124/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_SPL_BUILD) += cpu.o
 obj-y  += clock.o
 obj-y  += funcmux.o
 obj-y  += pinmux.o
+obj-y  += pmc.o
 obj-y  += xusb-padctl.o
 obj-y  += ../xusb-padctl-common.o
 
diff --git a/arch/arm/mach-tegra/tegra124/pmc.c 
b/arch/arm/mach-tegra/tegra124/pmc.c
new file mode 100644
index 00..be82acf11e
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra124/pmc.c
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+static const struct udevice_id tegra124_syscon_ids[] = {
+   { .compatible = "nvidia,tegra124-pmc", .data = TEGRA_SYSCON_PMC },
+};
+
+U_BOOT_DRIVER(syscon_tegra124) = {
+   .name = "tegra124_syscon",
+   .id = UCLASS_SYSCON,
+   .of_match = tegra124_syscon_ids,
+};
diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index 827df8af49..7723f7ebfb 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -37,6 +37,8 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 02/31] tegra: nyan-big: Enable the debug UART

2017-06-02 Thread Simon Glass
Enable this to allow debugging when the serial UART driver is
misconfigured.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 configs/nyan-big_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig
index f0fad3e459..cfadee9ee8 100644
--- a/configs/nyan-big_defconfig
+++ b/configs/nyan-big_defconfig
@@ -45,6 +45,10 @@ CONFIG_PMIC_AS3722=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_PWM_TEGRA=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0x70006000
+CONFIG_DEBUG_UART_CLOCK=40800
+CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_TEGRA114_SPI=y
 CONFIG_TPM_TIS_INFINEON=y
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 01/31] tegra: video: Time the LCD init

2017-06-02 Thread Simon Glass
Calculate the time taken to set up the LCD.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/video/tegra124/display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index bbbca13bdc..47752b27f1 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -471,7 +471,9 @@ static int tegra124_lcd_probe(struct udevice *dev)
int ret;
 
start = get_timer(0);
+   bootstage_start(BOOTSTAGE_ID_ACCUM_LCD, "lcd");
ret = tegra124_lcd_init(dev, (void *)plat->base, VIDEO_BPP16);
+   bootstage_accum(BOOTSTAGE_ID_ACCUM_LCD);
debug("LCD init took %lu ms\n", get_timer(start));
if (ret)
printf("%s: Error %d\n", __func__, ret);
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 06/31] dm: video: Update pwm_backlight to support livetree

2017-06-02 Thread Simon Glass
Update this driver to support a live device tree.

Signed-off-by: Simon Glass 
Acked-by: Anatolij Gustschin 
---

Changes in v2: None

 drivers/video/pwm_backlight.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index 3697f4905c..fbd7bf7838 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -28,11 +28,13 @@ struct pwm_backlight_priv {
 static int pwm_backlight_enable(struct udevice *dev)
 {
struct pwm_backlight_priv *priv = dev_get_priv(dev);
+   struct dm_regulator_uclass_platdata *plat;
uint duty_cycle;
int ret;
 
-   debug("%s: Enable '%s', regulator '%s'\n", __func__, dev->name,
- priv->reg->name);
+   plat = dev_get_uclass_platdata(priv->reg);
+   debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, dev->name,
+ priv->reg->name, plat->name);
ret = regulator_set_enable(priv->reg, true);
if (ret) {
debug("%s: Cannot enable regulator for PWM '%s'\n", __func__,
@@ -59,12 +61,11 @@ static int pwm_backlight_enable(struct udevice *dev)
 static int pwm_backlight_ofdata_to_platdata(struct udevice *dev)
 {
struct pwm_backlight_priv *priv = dev_get_priv(dev);
-   struct fdtdec_phandle_args args;
-   const void *blob = gd->fdt_blob;
-   int node = dev_of_offset(dev);
+   struct ofnode_phandle_args args;
int index, ret, count, len;
const u32 *cell;
 
+   debug("%s: start\n", __func__);
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
   "power-supply", >reg);
if (ret) {
@@ -79,14 +80,14 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice 
*dev)
if (ret != -ENOENT)
return ret;
}
-   ret = fdtdec_parse_phandle_with_args(blob, node, "pwms", "#pwm-cells",
-0, 0, );
+   ret = dev_read_phandle_with_args(dev, "pwms", "#pwm-cells", 0, 0,
+);
if (ret) {
debug("%s: Cannot get PWM phandle: ret=%d\n", __func__, ret);
return ret;
}
 
-   ret = uclass_get_device_by_of_offset(UCLASS_PWM, args.node, >pwm);
+   ret = uclass_get_device_by_ofnode(UCLASS_PWM, args.node, >pwm);
if (ret) {
debug("%s: Cannot get PWM: ret=%d\n", __func__, ret);
return ret;
@@ -94,8 +95,8 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice 
*dev)
priv->channel = args.args[0];
priv->period_ns = args.args[1];
 
-   index = fdtdec_get_int(blob, node, "default-brightness-level", 255);
-   cell = fdt_getprop(blob, node, "brightness-levels", );
+   index = dev_read_u32_default(dev, "default-brightness-level", 255);
+   cell = dev_read_prop(dev, "brightness-levels", );
count = len / sizeof(u32);
if (cell && count > index) {
priv->default_level = fdt32_to_cpu(cell[index]);
@@ -104,6 +105,7 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice 
*dev)
priv->default_level = index;
priv->max_level = 255;
}
+   debug("%s: done\n", __func__);
 
 
return 0;
-- 
2.13.0.506.g27d5fe0cd-goog

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


[U-Boot] [PATCH v2 00/31] dm: tegra: Move nyan-big and beaver to livetree

2017-06-02 Thread Simon Glass
This moves an entire board to use a live device tree as an example of the
impact.

Nyan-big was chosen because I can easily and boot U-Boot without any
media swapping, etc. Beaver is enabled as well since it failed to boot
with serial v1 due to a disabled console node.

Total code size impact on this board is approximately 9KB on U-Boot and
64 bytes on SPL:

27: dm: tegra: nyan-big: Move to livetree
   arm: (for 1/1 boards) all +9264.0 bss -16.0 data +44.0 rodata +92.0
  spl/u-boot-spl:all +326.0 spl/u-boot-spl:rodata +262.0
  spl/u-boot-spl:text +64.0 text +9144.0

Tegra does not use Thumb2, which would likely reduce the code size by about
25%, indicating a code-size impact of perhaps 7KB.

Boot time is affected slightly. For nyan-big the times with flat tree are:

 2,108  dm_r
 7,924  dm_spl
   120,724  dm_f
   171,816  lcd

With the livetree:

   721  dm_r
 3,764  of_live
 7,990  dm_spl
   120,736  dm_f
   168,215  lcd

As expected the spl and pre-relocation times are not affected. In the
post-relocation case, the live tree must be built, which here takes about
3.8ms. Driver-model device creation takes a bit of 1ms less time with the
livetree, so all up the cost is about 2.4ms. After DM init there appears
to be a slight reduction in the time taken to set up devices (from 327ms
to 319ms) so overall the live tree does not appear to be any slower. This
is because pre-parsing the device tree makes reading it later faster.

The use of livetree is controlled by a the CONFIG_OF_LIVE option. When
enabled, U-Boot builds a livetree immediately after relocation and uses
it from then on.

This series is available at u-boot-dm/livet-working

Changes in v2:
- Add new patch to enable bootstage for nyan-big
- Add new patch to ensure that the console UART is enabled
- Enable livetree for beaver also
- Add timing information

Simon Glass (31):
  tegra: video: Time the LCD init
  tegra: nyan-big: Enable the debug UART
  dm: Fix error handling when unflattening the DT
  tegra: nyan-big: Enable bootstage
  dm: video: Sync display on backspace
  dm: video: Update pwm_backlight to support livetree
  video: simple-panel: Add a little more debugging
  tegra: Fix up include file ordering
  tegra: spl: Enable debug UART
  tegra: nyan: Add a PMC syscon driver
  dm: tegra: Convert USB setup to livetree
  dm: tegra: Convert clock_decode_periph_id() to support livetree
  dm: video: tegra124: Convert to livetree
  tegra: Don't set up the UART clocks again in U-Boot
  tegra: dts: Move stdout-path to /chosen
  dm: tegra: gpio: Convert to support livetree
  dm: tegra: usb: Convert to livetree
  dm: tegra: spi: Convert to livetree
  dm: tegra: i2c: Convert to livetree
  dm: tegra: pwm: Convert to livetree
  dm: tegra: mmc: Convert to livetree
  power: Add a regulator driver for the as3722 PMIC
  power: Add a GPIO driver for the as3722 PMIC
  dm: power: Convert as3722 to driver model
  dm: serial: ns16550: Convert to livetree
  dm: serial: Separate out the core serial-device finding code
  dm: serial: Add livetree support
  tegra: Show a debug message if the LCD PMIC fails to start
  fdtdec: Drop old compatible values
  tegra: fdt: Ensure that the console UART is enabled
  dm: tegra: Move nyan-big and beaver to livetree

 arch/arm/dts/tegra114-dalmore.dts |   4 +
 arch/arm/dts/tegra124-cei-tk1-som.dts |   4 +
 arch/arm/dts/tegra124-jetson-tk1.dts  |   4 +
 arch/arm/dts/tegra124-nyan-big.dts|   5 +-
 arch/arm/dts/tegra124-venice2.dts |   4 +
 arch/arm/dts/tegra186-p2771-.dtsi |   4 +
 arch/arm/dts/tegra20-colibri.dts  |   4 +
 arch/arm/dts/tegra20-harmony.dts  |   4 +
 arch/arm/dts/tegra20-trimslice.dts|   4 +
 arch/arm/dts/tegra20-whistler.dts |   4 +
 arch/arm/dts/tegra210-e2220-1170.dts  |   4 +
 arch/arm/dts/tegra210-p2371-.dts  |   4 +
 arch/arm/dts/tegra210-p2371-2180.dts  |   4 +
 arch/arm/dts/tegra210-p2571.dts   |   4 +
 arch/arm/dts/tegra30-apalis.dts   |   4 +
 arch/arm/dts/tegra30-beaver.dts   |   4 +
 arch/arm/dts/tegra30-cardhu.dts   |   4 +
 arch/arm/dts/tegra30-colibri.dts  |   4 +
 arch/arm/dts/tegra30-tec-ng.dts   |   4 +
 arch/arm/include/asm/arch-tegra/clock.h   |   2 +-
 arch/arm/include/asm/arch-tegra/tegra.h   |   5 +
 arch/arm/include/asm/arch-tegra/xusb-padctl.h |   2 +-
 arch/arm/mach-tegra/board.c   |   2 +
 arch/arm/mach-tegra/board2.c  |  34 ++-
 arch/arm/mach-tegra/clock.c   |   9 +-
 arch/arm/mach-tegra/spl.c |   4 +
 arch/arm/mach-tegra/tegra124/Makefile |   1 +
 arch/arm/mach-tegra/tegra124/pmc.c|  19 ++
 arch/arm/mach-tegra/tegra124/xusb-padctl.c|  36 

[U-Boot] [PATCH v3 4/5] rename GPT partitions to detect boot failure

2017-06-02 Thread alison
From: Alison Chaiken 

This patch provides support in u-boot for renaming GPT
partitions.  The renaming is accomplished via a new 'gpt flip'
command.

The concept for the bootloader state machine is the following:

-- u-boot renames ‘primary’ partitions as ‘candidate’ and tries
   to boot them.
-- Linux, at boot, will rename ‘candidate’ partitions as
   ‘primary’.
-- If u-boot sees a ‘candidate’ partition after a boot attempt,
   it tries to boot the ‘backup’ partition.

Rewriting the partition table has the side-effect that all partitions
end up with "msftdata" flag set.  The reason is that partition type
PARTITION_BASIC_DATA_GUID is hard-coded in the gpt_fill_pte()
function.  This does not appear to cause any harm.

Signed-off-by: Alison Chaiken 
---
 cmd/Kconfig|   7 ++
 cmd/gpt.c  | 199 +++--
 doc/README.gpt |  13 
 3 files changed, 215 insertions(+), 4 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 6f75b86..8b925e5 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -593,6 +593,13 @@ config CMD_GPT
  Enable the 'gpt' command to ready and write GPT style partition
  tables.
 
+config CMD_GPT_FLIP
+   bool "GPT flip-partitions command"
+   depends on CMD_GPT
+   help
+ Enables the 'gpt' command to write modified GPT partition
+ tables via the 'gpt flip' command.
+
 config CMD_ARMFLASH
#depends on FLASH_CFI_DRIVER
bool "armflash"
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 5c2651f..f6968de 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static LIST_HEAD(disk_partitions);
 
@@ -190,16 +191,33 @@ static struct disk_part 
*allocate_disk_part(disk_partition_t *info, int partnum)
return newpart;
 }
 
+static void prettyprint_part_size(char *sizestr, unsigned long partsize,
+ unsigned long blksize)
+{
+   unsigned long long partbytes;
+   unsigned long partmegabytes;
+
+   partbytes = partsize * blksize;
+   partmegabytes = lldiv(partbytes, SZ_1M);
+   snprintf(sizestr, 16, "%luMiB", partmegabytes);
+}
+
 static void print_gpt_info(void)
 {
struct list_head *pos;
struct disk_part *curr;
+   char partstartstr[16];
+   char partsizestr[16];
 
list_for_each(pos, _partitions) {
curr = list_entry(pos, struct disk_part, list);
+   prettyprint_part_size(partstartstr, (unsigned 
long)curr->gpt_part_info.start,
+ (unsigned long) 
curr->gpt_part_info.blksz);
+   prettyprint_part_size(partsizestr, (unsigned 
long)curr->gpt_part_info.size,
+ (unsigned long) 
curr->gpt_part_info.blksz);
+
printf("Partition %d:\n", curr->partnum);
-   printf("1st block %x, size %x\n", 
(unsigned)curr->gpt_part_info.start,
-  (unsigned)curr->gpt_part_info.size);
+   printf("Start %s, size %s\n", partstartstr, partsizestr);
printf("Block size %lu, name %s\n", curr->gpt_part_info.blksz,
   curr->gpt_part_info.name);
printf("Type %s, bootable %d\n", curr->gpt_part_info.type,
@@ -211,6 +229,85 @@ static void print_gpt_info(void)
}
 }
 
+#ifdef CONFIG_CMD_GPT_FLIP
+static int calc_parts_list_len(int numparts)
+{
+   /*
+* prefatory string:
+* doc/README.GPT, suggests that
+* int partlistlen = UUID_STR_LEN + 1 + strlen("partitions=uuid_disk=");
+* is correct, but extract_val() expects "uuid_disk" first.
+*/
+   int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
+   /* for the comma */
+   partlistlen++;
+
+   /* per-partition additions; numparts starts at 1, so this should be 
correct */
+   partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN + 1);
+   /* 17 because partstr in create_gpt_partitions_list() is 16 chars */
+   partlistlen += numparts * (strlen("start=MiB,") + 17);
+   partlistlen += numparts * (strlen("size=MiB,") + 17);
+   partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1);
+   /* for the terminating null */
+   partlistlen++;
+   debug("Length of partitions_list is %d for %d partitions\n", 
partlistlen,
+  numparts);
+   return partlistlen;
+}
+
+/*
+ * create the string that upstream 'gpt write' command will accept as an
+ * argument
+ *
+ * From doc/README.gpt, Format of partitions layout:
+ *"partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+ * name=kernel,size=60MiB,uuid=...;"
+ * The fields 'name' and 'size' are mandatory for every partition.
+ * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
+ * are optional if CONFIG_RANDOM_UUID is enabled.
+ */
+static int create_gpt_partitions_list(int numparts, const char 

[U-Boot] [PATCH v3 5/5] GPT: fix error in partitions string doc

2017-06-02 Thread alison
From: Alison Chaiken 

The existing partitions-list parsing in cmd/gpt.c passes a value
from gpt_default() to set_gpt_info() that README.gpt suggests
should begin with 'partitions='.  Partition-list strings should
in fact begin with 'uuid_disk', as otherwise the call from
set_gpt_info() to extract_val() to find 'uuid_disk' will fail.
Change README.gpt and file comments accordingly.

Signed-off-by: Alison Chaiken 
---
 cmd/gpt.c  | 13 +
 doc/README.gpt |  8 
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index f6968de..e2cb2a1 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -232,12 +232,6 @@ static void print_gpt_info(void)
 #ifdef CONFIG_CMD_GPT_FLIP
 static int calc_parts_list_len(int numparts)
 {
-   /*
-* prefatory string:
-* doc/README.GPT, suggests that
-* int partlistlen = UUID_STR_LEN + 1 + strlen("partitions=uuid_disk=");
-* is correct, but extract_val() expects "uuid_disk" first.
-*/
int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
/* for the comma */
partlistlen++;
@@ -260,7 +254,7 @@ static int calc_parts_list_len(int numparts)
  * argument
  *
  * From doc/README.gpt, Format of partitions layout:
- *"partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+ *"uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
  * name=kernel,size=60MiB,uuid=...;"
  * The fields 'name' and 'size' are mandatory for every partition.
  * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
@@ -275,11 +269,6 @@ static int create_gpt_partitions_list(int numparts, const 
char *guid, char *part
if (!partitions_list)
return -1;
 
-   /*
-* README.gpt specifies starting with "partitions=" like so:
-*  strcpy(partitions_list, "partitions=uuid_disk=");
-* but that breaks extract_val, which doesn't skip over 'partitions='.
-*/
strcpy(partitions_list, "uuid_disk=");
strncat(partitions_list, guid, UUID_STR_LEN + 1);
strcat(partitions_list, ";");
diff --git a/doc/README.gpt b/doc/README.gpt
index e29b188..754e490 100644
--- a/doc/README.gpt
+++ b/doc/README.gpt
@@ -156,10 +156,10 @@ Creating GPT partitions in U-Boot:
 To restore GUID partition table one needs to:
 1. Define partition layout in the environment.
Format of partitions layout:
- "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+ "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
name=kernel,size=60MiB,uuid=...;"
  or
- "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
+ "uuid_disk=${uuid_gpt_disk};name=${uboot_name},
size=${uboot_size},uuid=${uboot_uuid};"
 
The fields 'name' and 'size' are mandatory for every partition.
@@ -233,7 +233,7 @@ PARTITION_BASIC_DATA_GUID 
(EBD0A0A2-B9E5-4433-87C0-68B6B72699C7).
 If you define 'CONFIG_PARTITION_TYPE_GUID', a optionnal parameter 'type'
 can specify a other partition type guid:
 
- "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+ "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
name=kernel,size=60MiB,uuid=...,
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"
 
@@ -255,7 +255,7 @@ Some strings can be also used at the place of known GUID :
"lvm"= PARTITION_LINUX_LVM_GUID
   (E6D6D379-F507-44C2-A23C-238F2A3DF928)
 
-"partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+"uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
name=kernel,size=60MiB,uuid=...,type=linux;"
 
 They are also used to display the type of partition in "part list" command.
-- 
2.1.4

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


[U-Boot] [PATCH v3 2/5] partitions: increase MAX_SEARCH_PARTITIONS and move to part.h

2017-06-02 Thread alison
From: Alison Chaiken 

Move MAX_SEARCH_PARTITIONS to part.h so that functions in cmd
directory can find it.  At the same time, increase the value to
64 since some operating systems use many, and the resources
consumed by a larger value are minimal.

Signed-off-by: Alison Chaiken 
---
 disk/part.c| 1 -
 include/part.h | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/disk/part.c b/disk/part.c
index 491b02d..e640a55 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -388,7 +388,6 @@ cleanup:
 
 #define PART_UNSPECIFIED -2
 #define PART_AUTO -1
-#define MAX_SEARCH_PARTITIONS 16
 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 struct blk_desc **dev_desc,
 disk_partition_t *info, int allow_whole_dev)
diff --git a/include/part.h b/include/part.h
index 16c4a46..c41aa6a 100644
--- a/include/part.h
+++ b/include/part.h
@@ -49,6 +49,7 @@ struct block_drvr {
 
 #define PART_NAME_LEN 32
 #define PART_TYPE_LEN 32
+#define MAX_SEARCH_PARTITIONS 64
 
 typedef struct disk_partition {
lbaint_tstart;  /* # of first block in partition*/
-- 
2.1.4

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


[U-Boot] [PATCH v3 3/5] GPT: read partition table from device into a data structure

2017-06-02 Thread alison
From: Alison Chaiken 

Make the partition table available for modification by reading it from
the user-specified device into a linked list.   Provide an accessor
function for command-line testing.

Signed-off-by: Alison Chaiken 
---
 cmd/gpt.c  | 112 +
 include/part.h |   7 
 2 files changed, 119 insertions(+)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 4d00a35..5c2651f 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -19,6 +19,9 @@
 #include 
 #include 
 #include 
+#include 
+
+static LIST_HEAD(disk_partitions);
 
 /**
  * extract_env(): Expand env name from string format '&{env_name}'
@@ -151,6 +154,111 @@ static bool found_key(const char *str, const char *key)
return result;
 }
 
+static void del_gpt_info(void)
+{
+   struct list_head *pos = _partitions;
+   struct disk_part *curr;
+   while (!list_empty(pos)) {
+   curr = list_entry(pos->next, struct disk_part, list);
+   list_del(pos->next);
+   free(curr);
+   }
+}
+
+static struct disk_part *allocate_disk_part(disk_partition_t *info, int 
partnum)
+{
+   struct disk_part *newpart;
+   newpart = (struct disk_part *)malloc(sizeof(*newpart));
+   if (!newpart)
+   return ERR_PTR(-ENOMEM);
+   memset(newpart, '\0', sizeof(newpart));
+
+   newpart->gpt_part_info.start = info->start;
+   newpart->gpt_part_info.size = info->size;
+   newpart->gpt_part_info.blksz = info->blksz;
+   strncpy((char *)newpart->gpt_part_info.name, (const char *)info->name, 
PART_NAME_LEN);
+   newpart->gpt_part_info.name[PART_NAME_LEN - 1] = '\0';
+   strncpy((char *)newpart->gpt_part_info.type, (const char *)info->type, 
PART_TYPE_LEN);
+   newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0';
+   newpart->gpt_part_info.bootable = info->bootable;
+#ifdef CONFIG_PARTITION_UUIDS
+   strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid,
+   UUID_STR_LEN);
+#endif
+   newpart->partnum = partnum;
+
+   return newpart;
+}
+
+static void print_gpt_info(void)
+{
+   struct list_head *pos;
+   struct disk_part *curr;
+
+   list_for_each(pos, _partitions) {
+   curr = list_entry(pos, struct disk_part, list);
+   printf("Partition %d:\n", curr->partnum);
+   printf("1st block %x, size %x\n", 
(unsigned)curr->gpt_part_info.start,
+  (unsigned)curr->gpt_part_info.size);
+   printf("Block size %lu, name %s\n", curr->gpt_part_info.blksz,
+  curr->gpt_part_info.name);
+   printf("Type %s, bootable %d\n", curr->gpt_part_info.type,
+  curr->gpt_part_info.bootable);
+#ifdef CONFIG_PARTITION_UUIDS
+   printf("UUID %s\n", curr->gpt_part_info.uuid);
+#endif
+   printf("\n");
+   }
+}
+
+/*
+ * read partition info into disk_partitions list where
+ * it can be printed or modified
+ */
+static int get_gpt_info(struct blk_desc *dev_desc)
+{
+   /* start partition numbering at 1, as U-Boot does */
+   int valid_parts = 1, p, ret;
+   disk_partition_t info;
+   struct disk_part *new_disk_part;
+
+   if (disk_partitions.next == NULL)
+   INIT_LIST_HEAD(_partitions);
+
+   for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
+   ret = part_get_info(dev_desc, p, );
+   if (ret)
+   continue;
+
+   new_disk_part = allocate_disk_part(, valid_parts);
+   if (IS_ERR(new_disk_part) && valid_parts >= 2)
+   return -ENODEV;
+
+   list_add_tail(_disk_part->list, _partitions);
+   valid_parts++;
+   }
+   if (!valid_parts) {
+   printf("** No valid partitions found **\n");
+   del_gpt_info();
+   return -ENODEV;
+   }
+   return --valid_parts;
+}
+
+/* a wrapper to test get_gpt_info */
+static int do_get_gpt_info(struct blk_desc *dev_desc)
+{
+   int ret;
+
+   ret = get_gpt_info(dev_desc);
+   if (ret > 0) {
+   print_gpt_info();
+   del_gpt_info();
+   }
+   return ret;
+}
+
+
 /**
  * set_gpt_info(): Fill partition information from string
  * function allocates memory, remember to free!
@@ -455,6 +563,8 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
printf("Verify GPT: ");
} else if (strcmp(argv[1], "guid") == 0) {
return do_disk_guid(blk_dev_desc, argv[4]);
+   } else if (strcmp(argv[1], "read") == 0) {
+   return do_get_gpt_info(blk_dev_desc);
} else {
return CMD_RET_USAGE;
}
@@ -477,6 +587,8 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
" Example usage:\n"
" gpt write mmc 0 $partitions\n"
" gpt verify mmc 0 

[U-Boot] [PATCH v3 1/5] GPT: add accessor function for disk GUID

2017-06-02 Thread alison
From: Alison Chaiken 

In order to read the GPT, modify the partition name strings, and then
write out a new GPT, the disk GUID is needed.  While there is an
existing accessor for the partition UUIDs, there is none yet for the
disk GUID.

Signed-off-by: Alison Chaiken 
---
 cmd/gpt.c   | 26 ++
 disk/part_efi.c | 31 +++
 doc/README.gpt  |  3 ++-
 include/part.h  | 15 +++
 4 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 3e98821..4d00a35 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -398,6 +398,23 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const 
char *str_part)
return ret;
 }
 
+static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr)
+{
+   int ret;
+   char disk_guid[UUID_STR_LEN + 1];
+
+   ret = get_disk_guid(dev_desc, disk_guid);
+   if (ret < 0)
+   return CMD_RET_FAILURE;
+
+   if (namestr)
+   setenv(namestr, disk_guid);
+   else
+   printf("%s\n", disk_guid);
+
+   return ret;
+}
+
 /**
  * do_gpt(): Perform GPT operations
  *
@@ -436,6 +453,8 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
} else if ((strcmp(argv[1], "verify") == 0)) {
ret = gpt_verify(blk_dev_desc, argv[4]);
printf("Verify GPT: ");
+   } else if (strcmp(argv[1], "guid") == 0) {
+   return do_disk_guid(blk_dev_desc, argv[4]);
} else {
return CMD_RET_USAGE;
}
@@ -458,4 +477,11 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
" Example usage:\n"
" gpt write mmc 0 $partitions\n"
" gpt verify mmc 0 $partitions\n"
+   " guid  \n"
+   "- print disk GUID\n"
+   " guid   \n"
+   "- set environment variable to disk GUID\n"
+   " Example usage:\n"
+   " gpt guid mmc 0\n"
+   " gpt guid mmc 0 varname\n"
 );
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 20d33ef..71c3cb3 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -178,6 +178,37 @@ static void prepare_backup_gpt_header(gpt_header *gpt_h)
  * Public Functions (include/part.h)
  */
 
+/*
+ * UUID is displayed as 32 hexadecimal digits, in 5 groups,
+ * separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters
+ */
+int get_disk_guid(struct blk_desc * dev_desc, char *guid)
+{
+   ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
+   gpt_entry *gpt_pte = NULL;
+   unsigned char *guid_bin;
+
+   /* This function validates AND fills in the GPT header and PTE */
+   if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
+gpt_head, _pte) != 1) {
+   printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
+   if (is_gpt_valid(dev_desc, dev_desc->lba - 1,
+gpt_head, _pte) != 1) {
+   printf("%s: *** ERROR: Invalid Backup GPT ***\n",
+  __func__);
+   return -EINVAL;
+   } else {
+   printf("%s: ***Using Backup GPT ***\n",
+  __func__);
+   }
+   }
+
+   guid_bin = gpt_head->disk_guid.b;
+   uuid_bin_to_str(guid_bin, guid, UUID_STR_FORMAT_GUID);
+
+   return 0;
+}
+
 void part_print_efi(struct blk_desc *dev_desc)
 {
ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
diff --git a/doc/README.gpt b/doc/README.gpt
index 3fcd835..c0779a4 100644
--- a/doc/README.gpt
+++ b/doc/README.gpt
@@ -171,7 +171,8 @@ To restore GUID partition table one needs to:
The fields 'uuid' and 'uuid_disk' are optional if CONFIG_RANDOM_UUID is
enabled. A random uuid will be used if omitted or they point to an empty/
non-existent environment variable. The environment variable will be set to
-   the generated UUID.
+   the generated UUID.  The 'gpt guid' command reads the current value of the
+   uuid_disk from the GPT.
 
The field 'bootable' is optional, it is used to mark the GPT partition
bootable (set attribute flags "Legacy BIOS bootable").
diff --git a/include/part.h b/include/part.h
index 87b..16c4a46 100644
--- a/include/part.h
+++ b/include/part.h
@@ -371,6 +371,21 @@ int gpt_verify_headers(struct blk_desc *dev_desc, 
gpt_header *gpt_head,
 int gpt_verify_partitions(struct blk_desc *dev_desc,
  disk_partition_t *partitions, int parts,
  gpt_header *gpt_head, gpt_entry **gpt_pte);
+
+
+/**
+ * get_disk_guid() - Function to read the GUID string from a device's GPT
+ *
+ * This function reads the GUID string from a block device whose descriptor
+ * is provided.
+ *
+ * @param dev_desc - block device descriptor
+ * @param guid - pre-allocated string in which to return the GUID
+ *
+ 

[U-Boot] [PATCH v3 0/5] add support for GPT partition name manipulation

2017-06-02 Thread alison
From: Alison Chaiken 

One way for userspace and the bootloader to exchange information about
dynamic image selection is via the storage device partition table, as
described at

https://source.android.com/devices/tech/ota/ab_updates

The scheme described there relies on setting partitions' "boot" flag.
When no partition on a device is bootable since the kernel and U-Boot
are stored elsewhere, the name field in the GPT partition table offers
another logical place to store information.  These patches allow users
to easily modify GPT partition names via bootscripts that can select
different images based on a boot-failure counter, or when userspace
installs a software update.

These patches have been (re)tested on a TI DRA7xx-based SOM with
U-Boot 2015.07.  The storage device is an eMMC.

Significant changes since v2:
-- Got rid of the need to allocate memory for the GUID string in
   do_gpt();
-- Fixed the problems with string NULL termination in
   allocate_disk_part();
-- Removed duplicate definition of MAX_SEARCH_PARTITIONS from
   disk/part.c and increased the value in include/part.h to 64;
-- Improved the commit message for "rename GPT partitions to detect
   boot failure" to better describe the version of the patch I
   submitted;
-- Fixed numerous small problems with function return values.

Significant changes since v1:
-- Put the gpt_flip() function and auxiliary ones inside a new
   CONFIG_CMD_GPT_FLIP option that depends on CMD_GPT.
-- Replace intentional overwriting of name and type string arrays with
   memset() instead.
-- Move part.h changes earlier in the patchset.
-- Add a few lines to README.gpt about the new gpt subcommands.

Added a few simple patches to do the following:
-- Replace remaining occurrences of '37' with UUID_STR_LEN+1;
-- Introduce new macros to get rid of the similar '32';
-- fix a smaller error in doc/README.gpt.

There are also some fixups of whitespace and formatting errors (plus
usual inevitable addition of new ones).

To do in future:
-- Add support for preserving the type flag for partitions. The u-boot
   version on which this patchset is based did not have this feature,
   and it's easy to add, but I need to figure how to test it first.

-- Add tests for the new gpt commands to the sandbox.


Alison Chaiken (5):
  GPT: add accessor function for disk GUID
  partitions: increase MAX_SEARCH_PARTITIONS and move to part.h
  GPT: read partition table from device into a data structure
  rename GPT partitions to detect boot failure
  GPT: fix error in partitions string doc

 cmd/Kconfig |   7 ++
 cmd/gpt.c   | 318 
 disk/part.c |   1 -
 disk/part_efi.c |  31 ++
 doc/README.gpt  |  24 -
 include/part.h  |  23 
 6 files changed, 398 insertions(+), 6 deletions(-)

-- 
2.1.4

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


Re: [U-Boot] [PATCH 12/12] sunxi: add a defconfig for SoPine w/ official baseboard

2017-06-02 Thread André Przywara
Hi,

On 26/04/17 15:50, Icenowy Zheng wrote:
> The SoPine is a SoM by Pine64, with an Allwinner A64 SoC, a LPDDR3 DRAM
> chip, an AXP803 PMIC, a SPI NOR Flash and a MicroSD slot. The card
> detect pin of the MicroSD slot is broken, however, it doesn't matter as
> the design of SoPine didn't allow hot-swapping the MicroSD card (The
> MicroSD slot is at the back of the SoM, and when the SoM is installed on
> the baseboard, it's nearly impossible to remove the MicroSD).
> 
> The official baseboard of it is a board with nearly the same connectors
> with the original Pine64+, with the MicroUSB power jack replaced, and
> at the position of MicroSD slot a eMMC module slot is added.
> 
> Add support for SoPine with the official baseboard by adding its
> defconfig file. It still uses the device tree of Pine64, however, it
> will change after a proper device tree of SoPine with baseboard is
> accepted by Linux mainline.

There is some point in this, but I wonder if we actually need to wait
for Linux. In fact since the SoPine has SPI flash, we don't desperately
need a DT in the Linux source tree, since it could just come with the
device - as in U-Boot's DT passed through to the kernel.

So can we have a separate DT, probably including -pine64.dts and at
least adding the eMMC? Could be copy version of the BPi-M64, for
instance.

One more below 

> Signed-off-by: Icenowy Zheng 
> ---
>  configs/sopine_baseboard_defconfig | 22 ++
>  1 file changed, 22 insertions(+)
>  create mode 100644 configs/sopine_baseboard_defconfig
> 
> diff --git a/configs/sopine_baseboard_defconfig 
> b/configs/sopine_baseboard_defconfig
> new file mode 100644
> index 00..02ffb43d54
> --- /dev/null
> +++ b/configs/sopine_baseboard_defconfig
> @@ -0,0 +1,22 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_SUNXI=y
> +CONFIG_MACH_SUN50I=y
> +CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
> +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
> +CONFIG_DRAM_CLK=552
> +CONFIG_DRAM_ZQ=3881949
> +CONFIG_DRAM_ODT_EN=y
> +CONFIG_MMC0_CD_PIN=""
> +CONFIG_MMC_SUNXI_SLOT_EXTRA=2
> +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus"
> +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
> +CONFIG_CONSOLE_MUX=y
> +CONFIG_SPL=y
> +# CONFIG_CMD_IMLS is not set
> +# CONFIG_CMD_FLASH is not set
> +# CONFIG_CMD_FPGA is not set
> +# CONFIG_SPL_DOS_PARTITION is not set
> +# CONFIG_SPL_ISO_PARTITION is not set
> +# CONFIG_SPL_EFI_PARTITION is not set
> +CONFIG_SUN8I_EMAC=y
> +CONFIG_USB_EHCI_HCD=y

Can you add the SPL SPI flash options here? This allows loading U-Boot
from SPI flash and makes this much more useful.

Cheers,
Andre.

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


Re: [U-Boot] [PATCH 00/12] Big work on sunxi DW DRAM controllers and some new DDR type support

2017-06-02 Thread André Przywara
On 02/06/17 19:34, Jagan Teki wrote:
> On Wed, Apr 26, 2017 at 8:19 PM, Icenowy Zheng  wrote:
>> This patchset contains several works on the sunxi DesignWare DRAM
>> controllers.
>>
>> The 1st patch made an option for H3-like DRAM controllers
>> (DesignWare ones), which can ease further import of alike controllers.
>>
>> The 2nd and 3rd patches are for supporting 16-bit DW DRAM controllers,
>> in order to add V3s DRAM support (The controller on V3s is 16-bit).
>>
>> The 4th patch adds bank detection code, in order to support some DDR2
>> chips.
>>
>> The 5th patch adds a framework for select DRAM type and timing -- it's
>> needed for boards that use DRAM chips rather than DDR3.
>>
>> The 6th patch enables dual rank detection in the DW DRAM code on SoCs
>> except R40. For R40 the dual rank facility is still not so clear, so it's
>> temporarily disabled.
>>
>> The 7th~9th patches enables support for DRAM initialization and SPL for
>> the V3s SoC, which integrates a DDR2 chip.
>>
>> The 10th and 11th patches adds support for LPDDR3, with the stock boot0
>> timing. (Seen in A83T boot0 source and some leaked H5/R40 libdram source)
>>
>> The 12th patches adds a defconfig for SoPine w/ official baseboard, which
>> utilizes LPDDR3.
>>
>> Icenowy Zheng (12):
>>   sunxi: makes an invisible option for H3-like DRAM controllers
>>   sunxi: Rename bus-width related macros in H3 DRAM code
>>   sunxi: add option for 16-bit DW DRAM controller
>>   sunxi: add bank detection code to H3 DRAM initialization code
>>   sunxi: Add selective DRAM type and timing
>>   sunxi: enable dual rank detection in DesignWare-like DRAM code
>>   sunxi: add support for the DDR2 in V3s SoC
>>   sunxi: add support for V3s DRAM controller
>>   sunxi: enable DRAM initialization and SPL for V3s SoC
>>   sunxi: add LPDDR3 DRAM type support for DesignWare-like DRAM
>> controller
>>   sunxi: add LPDDR3 timing from stock boot0
>>   sunxi: add a defconfig for SoPine w/ official baseboard
> 
> Can you rebase on master and sen it again, difficult to fix the things
> while applying.

... maybe on the way fix the minor things I mentioned in the lower part
of my reply to 11/12?
https://lists.denx.de/pipermail/u-boot/2017-May/290436.html

Cheers,
Andre.

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


Re: [U-Boot] [PATCH 12/12] sunxi: add a defconfig for SoPine w/ official baseboard

2017-06-02 Thread André Przywara
On 03/06/17 00:59, André Przywara wrote:
> Hi,
> 
> On 02/06/17 19:32, Jagan Teki wrote:
>> On Wed, Apr 26, 2017 at 8:20 PM, Icenowy Zheng  wrote:
>>> The SoPine is a SoM by Pine64, with an Allwinner A64 SoC, a LPDDR3 DRAM
>>> chip, an AXP803 PMIC, a SPI NOR Flash and a MicroSD slot. The card
>>> detect pin of the MicroSD slot is broken, however, it doesn't matter as
>>> the design of SoPine didn't allow hot-swapping the MicroSD card (The
>>> MicroSD slot is at the back of the SoM, and when the SoM is installed on
>>> the baseboard, it's nearly impossible to remove the MicroSD).
>>>
>>> The official baseboard of it is a board with nearly the same connectors
>>> with the original Pine64+, with the MicroUSB power jack replaced, and
>>> at the position of MicroSD slot a eMMC module slot is added.
>>>
>>> Add support for SoPine with the official baseboard by adding its
>>> defconfig file. It still uses the device tree of Pine64, however, it
>>> will change after a proper device tree of SoPine with baseboard is
>>> accepted by Linux mainline.
>>>
>>> Signed-off-by: Icenowy Zheng 
>>> ---
>>>  configs/sopine_baseboard_defconfig | 22 ++
>>>  1 file changed, 22 insertions(+)
>>>  create mode 100644 configs/sopine_baseboard_defconfig
>>>
>>> diff --git a/configs/sopine_baseboard_defconfig
>>
>> Can't this be simply sopine_defconfig
> 
> No, because the SoPine module itself is not complete and the system's DT


> may be much different between using different baseboards. So using the
> term "baseboard" in there is correct. Question is whether we want to
> have a separate sopine.dtsi, which just describes the module, then
> (multiple) baseboard .dts files including this sopine.dtsi. But this is
> a bit premature until we actually see a second baseboard, at which point
> we could still split this up then.

Argh, just saw that I misread defconfig for DT here, sorry. But the
argument still stands: the SoPine module itself has only a bit of
functionality and is not usable on its own, so any board configuration
must be considered as being together with some kind of base board.
For instance the eMMC, HDMI socket and Ethernet PHY is not on the SoPine
module.

Cheers,
Andre.

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


Re: [U-Boot] [PATCH 12/12] sunxi: add a defconfig for SoPine w/ official baseboard

2017-06-02 Thread André Przywara
Hi,

On 02/06/17 19:32, Jagan Teki wrote:
> On Wed, Apr 26, 2017 at 8:20 PM, Icenowy Zheng  wrote:
>> The SoPine is a SoM by Pine64, with an Allwinner A64 SoC, a LPDDR3 DRAM
>> chip, an AXP803 PMIC, a SPI NOR Flash and a MicroSD slot. The card
>> detect pin of the MicroSD slot is broken, however, it doesn't matter as
>> the design of SoPine didn't allow hot-swapping the MicroSD card (The
>> MicroSD slot is at the back of the SoM, and when the SoM is installed on
>> the baseboard, it's nearly impossible to remove the MicroSD).
>>
>> The official baseboard of it is a board with nearly the same connectors
>> with the original Pine64+, with the MicroUSB power jack replaced, and
>> at the position of MicroSD slot a eMMC module slot is added.
>>
>> Add support for SoPine with the official baseboard by adding its
>> defconfig file. It still uses the device tree of Pine64, however, it
>> will change after a proper device tree of SoPine with baseboard is
>> accepted by Linux mainline.
>>
>> Signed-off-by: Icenowy Zheng 
>> ---
>>  configs/sopine_baseboard_defconfig | 22 ++
>>  1 file changed, 22 insertions(+)
>>  create mode 100644 configs/sopine_baseboard_defconfig
>>
>> diff --git a/configs/sopine_baseboard_defconfig
> 
> Can't this be simply sopine_defconfig

No, because the SoPine module itself is not complete and the system's DT
may be much different between using different baseboards. So using the
term "baseboard" in there is correct. Question is whether we want to
have a separate sopine.dtsi, which just describes the module, then
(multiple) baseboard .dts files including this sopine.dtsi. But this is
a bit premature until we actually see a second baseboard, at which point
we could still split this up then.

Cheers,
Andre.

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


Re: [U-Boot] [PATCH 1/2] rockchip: video: document externally visible functions for rk_hdmi

2017-06-02 Thread Simon Glass
On 2 June 2017 at 08:06, Philipp Tomsich
 wrote:
> Documents the externally visible functions shared between the HDMI
> drivers for the RK3288 and RK3399.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  drivers/video/rockchip/rk_hdmi.h | 44 
> 
>  1 file changed, 44 insertions(+)

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


Re: [U-Boot] [PATCH 2/2] rockchip: video: document externally visible functions for rk_vop

2017-06-02 Thread Simon Glass
On 2 June 2017 at 08:06, Philipp Tomsich
 wrote:
> Documents the externally visible functions shared between the VOP
> drivers for the RK3288 and RK3399.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  drivers/video/rockchip/rk_vop.h | 34 ++
>  1 file changed, 34 insertions(+)

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


Re: [U-Boot] [PATCH] fdt: Report libfdt error to stderr

2017-06-02 Thread Simon Glass
Hi,

On 31 May 2017 at 19:32, Simon Glass  wrote:
> This error needs to go to stderr otherwise it will not be reported by
> buildman. Fix it.
>
> Signed-off-by: Simon Glass 
> ---
>
>  Makefile | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 89e0451a49..c13937c3a8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1357,12 +1357,13 @@ $(timestamp_h): $(srctree)/Makefile FORCE
>
>  checkbinman: tools
> @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
> -   echo '*** binman needs the Python libfdt library. Either '; \
> -   echo '*** install it on your system, or try:'; \
> -   echo '***'; \
> -   echo '*** sudo apt-get install swig libpython-dev'; \
> -   echo '***'; \
> -   echo '*** to have U-Boot build its own version.'; \
> +   echo >&2; \
> +   echo >&2 '*** binman needs the Python libfdt library.'; \
> +   echo >&2 '*** Either install it on your system, or try:'; \
> +   echo >&2 '***'; \
> +   echo >&2 '*** sudo apt-get install swig libpython-dev'; \
> +   echo >&2 '***'; \
> +   echo >&2 '*** to have U-Boot build its own version.'; \
> false; \
> fi
>
> --
> 2.13.0.219.gdb65acc882-goog
>

I have squashed this into 'fdt: Makefile: Build python libfdt library
if needed' since it fixes up that patch.

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


[U-Boot] Please pull u-boot-fdt (take 4)

2017-06-02 Thread Simon Glass
Hi Tom,

This includes moving the error message to stderr so that buildman picks it up.



The following changes since commit 46bac66b20da6d50e757bdca74703153f233090b:

  sandbox: Move to use live tree (2017-06-01 07:03:17 -0600)

are available in the git repository at:

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

for you to fetch changes up to 99ed4a2e979150879fb70aea71898709536375d3:

  fdt: Drop fdt_select.py (2017-06-02 10:18:20 -0600)


Simon Glass (20):
  fdt: Add Python bindings
  pci: Correct cast for sandbox
  fdt: Correct cast for sandbox in fdtdec_setup_memory_size()
  fdt: Use SPDX format for licenses in the libfdt headers
  fdt: Move header files into lib/libfdt
  fdt: Allow swig options to be provided by Makefile
  fdt: Add all source files to the libfdt build
  fdt: Rename existing python libfdt module
  fdt: Build the new python libfdt module
  fdt: Update fdt_test to use 'dt' instead of 'fdt'
  fdt: dtoc: Add a full set of property tests
  fdt: Support use of the new python libfdt library
  fdt: Makefile: Build python libfdt library if needed
  fdt: Stop building the old python libfdt module
  fdt: Drop use of the legacy libfdt python module
  fdt: Drop fdt_fallback library
  binman: Drop a special case related to fdt_fallback
  fdt: Merge fdt_normal with its base class
  binman: Rename fdt variable to dtb
  fdt: Drop fdt_select.py

 Makefile|   17 +-
 cmd/pci.c   |3 +-
 include/fdt.h   |  112 +-
 include/libfdt.h| 2138 +-
 lib/fdtdec.c|3 +-
 lib/libfdt/fdt.h|   67 +
 lib/libfdt/libfdt.h | 2144 +++
 lib/libfdt/libfdt.swig  |  113 --
 lib/libfdt/pylibfdt/libfdt.i|  389 +
 lib/libfdt/pylibfdt/setup.py|  123 ++
 lib/libfdt/setup.py |   38 -
 scripts/Makefile.spl|   17 +-
 tools/Makefile  |   54 +-
 tools/binman/binman.py  |3 +
 tools/binman/control.py |   12 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |   24 +-
 tools/binman/fdt_test.py|   64 +-
 tools/binman/func_test.py   |   48 +-
 tools/binman/test/45_prop_test.dts  |   23 +
 tools/dtoc/dtoc.py  |3 +-
 tools/dtoc/fdt.py   |  183 ++-
 tools/dtoc/fdt_fallback.py  |  181 ---
 tools/dtoc/fdt_normal.py|  225 ---
 tools/dtoc/fdt_select.py|   36 -
 24 files changed, 3061 insertions(+), 2959 deletions(-)
 create mode 100644 lib/libfdt/fdt.h
 create mode 100644 lib/libfdt/libfdt.h
 delete mode 100644 lib/libfdt/libfdt.swig
 create mode 100644 lib/libfdt/pylibfdt/libfdt.i
 create mode 100755 lib/libfdt/pylibfdt/setup.py
 delete mode 100644 lib/libfdt/setup.py
 create mode 100644 tools/binman/test/45_prop_test.dts
 delete mode 100644 tools/dtoc/fdt_fallback.py
 delete mode 100644 tools/dtoc/fdt_normal.py
 delete mode 100644 tools/dtoc/fdt_select.py

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


Re: [U-Boot] [PATCH 2/2] board: ti: AM43XX: Add ddr voltage rail configuration

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 03:00:31PM +0530, Keerthy wrote:

> Add ddr voltage rail (dcdc3) configuration. Set the dcdc3
> DDR supply to 1.35V.
> 
> Signed-off-by: Keerthy 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 1/2] power: pmic: tps65218: Add DCDC3 configuration

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 03:00:30PM +0530, Keerthy wrote:

> Some boards like am437x-gp-evm require dcdc3 also to be configured
> as it feeds on to ddr. Hence add the capability as well.
> 
> Signed-off-by: Keerthy 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] binman: 'module' object has no attribute 'FinaliseOutputDir'

2017-06-02 Thread Kevin Hilman
On Fri, Jun 2, 2017 at 11:00 AM, Simon Glass  wrote:
> Hi Kevin,
>
> On 1 June 2017 at 17:08, Kevin Hilman  wrote:
>>
>> On Thu, Jun 1, 2017 at 8:23 AM, Simon Glass  wrote:
>> > Hi Kevin,
>> >
>> > On 1 June 2017 at 07:55, Kevin Hilman  wrote:
>> >> On Wed, May 31, 2017 at 12:19 PM, Simon Glass  wrote:
>> >>> Hi Kevin,
>> >>>
>> >>> On 31 May 2017 at 12:13, Kevin Hilman  wrote:
>>  While trying to build v2017.05 for sun5i-r8-chip (CHIP_defconfig), I get
>>  the following build error.  I'm not familiar with binman, so not sure
>>  what I should be looking for.
>> 
>>  $ CROSS_COMPILE=arm-linux-gnueabihf- make
>> 
>>  [...]
>> 
>>   LD  spl/drivers/serial/built-in.o
>>   LD  spl/drivers/built-in.o
>>   LD  spl/common/built-in.o
>>   LD  spl/lib/built-in.o
>>   LD  spl/u-boot-spl
>>   OBJCOPY spl/u-boot-spl-nodtb.bin
>>   COPYspl/u-boot-spl.bin
>>   MKSUNXI spl/sunxi-spl.bin
>>   BINMAN  u-boot-sunxi-with-spl.bin
>>   binman: 'module' object has no attribute 'FinaliseOutputDir'
>>   Makefile:1107: recipe for target 'u-boot-sunxi-with-spl.bin' failed
>>   make: *** [u-boot-sunxi-with-spl.bin] Error 1
>> 
>> 
>>  If it matters, compiler is: gcc version 5.3.1 20160412 (Linaro GCC 
>>  5.3-2016.05)
>> >>>
>> >>> Do you know what version of python you are using? I cannot imagine
>> >>> what is happening here.
>> >>
>> >> $ python
>> >> Python 2.7.12 (default, Nov 19 2016, 06:48:10)
>> >> [GCC 5.4.0 20160609] on linux2
>> >> Type "help", "copyright", "credits" or "license" for more information.
>> >
>> >>
>> >> and fwiw, this is on Ubuntu 16.04 LTS.
>> >
>> > That's what I am using too. This is really mystifying. Are you able to
>> > debug the python code?
>>
>> If you give me some pointers/suggestions, I'd be glad to, but I don't
>> currently have much time to go wandering too deep into the uboot
>> weeds.
>
> My guess is that you have a tools.py file somewhere in your Python
> site_packages. You should be able to test this with:
>
> python
>> import tools
>
> Perhaps 'dpkg -S tools.py' will tell you what package installed it.

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> import tools
>>> print os.path.abspath(tools.__file__)
/usr/local/lib/python2.7/dist-packages/tools/__init__.pyc
>>>

So since this is in /usr/local, dpkg -S didn't help, so it was
something installed by pip.  Turns out that it was the jira-python
package, installed by pip that had installed this tools dir.

> If you don't get an error then it suggests you already have this
> package. That in turn would suggest that the fix is that the path
> should be prepended instead of appended at the top of binman.py.

"pip uninstall jira-python" also did the trick, but prepending worked
too.  I suppose having a name slightly less generic than "tools" would
also work.

Anyways, I got it building now, so I'll let you decide which is the
"right way" to fix.

Thanks,

Kevin

[1]
$ git diff tools/binman/
diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 857d698b4c24..535bcece274f 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -17,7 +17,7 @@ import unittest

 # Bring in the patman and dtoc libraries
 our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
+sys.path.insert(1, os.path.join(our_path, '../patman'))
 sys.path.append(os.path.join(our_path, '../dtoc'))
 sys.path.append(os.path.join(our_path, '../'))
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] net: pch_gbe: Fix rx descriptor buffer addresses

2017-06-02 Thread Joe Hershberger
Hi Daniel,

https://patchwork.ozlabs.org/patch/756916/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: pch_gbe: CPU accessible addresses are virtual

2017-06-02 Thread Joe Hershberger
Hi Daniel,

https://patchwork.ozlabs.org/patch/756918/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: phy: marvell 88e151x: Fix handling of RGMII interface types

2017-06-02 Thread Joe Hershberger
Hi Phil,

https://patchwork.ozlabs.org/patch/766483/ was applied to u-boot-net.git.

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


Re: [U-Boot] armv8/ls1046a: RGMII PHY requires internal delay on Tx

2017-06-02 Thread Joe Hershberger
Hi Madalin,

https://patchwork.ozlabs.org/patch/746836/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: zynq_gem: Dont flush dummy descriptors

2017-06-02 Thread Joe Hershberger
Hi Michal,

https://patchwork.ozlabs.org/patch/768580/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: pch_gbe: Add cache maintenance

2017-06-02 Thread Joe Hershberger
Hi Daniel,

https://patchwork.ozlabs.org/patch/756915/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: core: avoid possible NULL pointer dereference

2017-06-02 Thread Joe Hershberger
Hi xypron.g...@gmx.de,

https://patchwork.ozlabs.org/patch/762783/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: zynq_gem: Use wait_for_bit with non breakable

2017-06-02 Thread Joe Hershberger
Hi Michal,

https://patchwork.ozlabs.org/patch/768585/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: pch_gbe: Reset during probe

2017-06-02 Thread Joe Hershberger
Hi Daniel,

https://patchwork.ozlabs.org/patch/756914/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: macb: Fix GMAC not work when enable DM_ETH

2017-06-02 Thread Joe Hershberger
Hi Wenyou,

https://patchwork.ozlabs.org/patch/752614/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: mvpp2.c: Enable 10G support for port 0 (SFI)

2017-06-02 Thread Joe Hershberger
Hi Stefan,

https://patchwork.ozlabs.org/patch/747807/ was applied to u-boot-net.git.

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


Re: [U-Boot] drivers: net: cpsw: abort init() on aneg timeout

2017-06-02 Thread Joe Hershberger
Hi Sekhar,

https://patchwork.ozlabs.org/patch/759682/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: zynq_gem: Do not return -ENOSYS on success

2017-06-02 Thread Joe Hershberger
Hi Olliver,

https://patchwork.ozlabs.org/patch/746814/ was applied to u-boot-net.git.

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


Re: [U-Boot] armv8/ls1043a: RGMII PHY requires internal delay on Tx

2017-06-02 Thread Joe Hershberger
Hi Madalin,

https://patchwork.ozlabs.org/patch/746818/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: designware: Add phy supply support

2017-06-02 Thread Joe Hershberger
Hi Jacob,

https://patchwork.ozlabs.org/patch/743661/ was applied to u-boot-net.git.

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


Re: [U-Boot] net: Kconfig:make PHY_GIGE and individual Micrel PHYs selectable

2017-06-02 Thread Joe Hershberger
Hi Philipp,

https://patchwork.ozlabs.org/patch/743553/ was applied to u-boot-net.git.

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


[U-Boot] Pull request: u-boot-net.git master

2017-06-02 Thread Joe Hershberger
Hi Tom,

The following changes since commit 46bac66b20da6d50e757bdca74703153f233090b:

  sandbox: Move to use live tree (2017-06-01 07:03:17 -0600)

are available in the git repository at:

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

for you to fetch changes up to 2303bff7d55df47105740e5d635d50ef9f6856b6:

  net: pch_gbe: Add cache maintenance (2017-06-02 14:44:20 -0500)


Jacob Chen (1):
  net: designware: Add phy supply support

Madalin Bucur (2):
  armv8/ls1043a: RGMII PHY requires internal delay on Tx
  armv8/ls1046a: RGMII PHY requires internal delay on Tx

Olliver Schinagl (1):
  net: zynq_gem: Do not return -ENOSYS on success

Paul Burton (4):
  net: pch_gbe: Reset during probe
  net: pch_gbe: Fix rx descriptor buffer addresses
  net: pch_gbe: CPU accessible addresses are virtual
  net: pch_gbe: Add cache maintenance

Phil Edworthy (1):
  net: phy: marvell 88e151x: Fix handling of RGMII interface types

Philipp Tomsich (1):
  net: Kconfig:make PHY_GIGE and individual Micrel PHYs selectable

Sekhar Nori (1):
  drivers: net: cpsw: abort init() on aneg timeout

Siva Durga Prasad Paladugu (2):
  net: zynq_gem: Use wait_for_bit with non breakable
  net: zynq_gem: Dont flush dummy descriptors

Stefan Chulski (1):
  net: mvpp2.c: Enable 10G support for port 0 (SFI)

Wenyou Yang (1):
  net: macb: Fix GMAC not work when enable DM_ETH

xypron.g...@gmx.de (1):
  net: core: avoid possible NULL pointer dereference

 drivers/net/Kconfig   |  8 +++
 drivers/net/cpsw.c| 34 ++---
 drivers/net/designware.c  | 17 +++
 drivers/net/fm/ls1043.c   |  4 ++--
 drivers/net/fm/ls1046.c   |  4 ++--
 drivers/net/macb.c|  7 ++
 drivers/net/mvpp2.c   | 55 ++-
 drivers/net/pch_gbe.c | 44 ++---
 drivers/net/phy/Kconfig   | 34 +
 drivers/net/phy/marvell.c | 45 +-
 drivers/net/zynq_gem.c| 16 +-
 net/eth-uclass.c  |  3 ++-
 12 files changed, 209 insertions(+), 62 deletions(-)

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


Re: [U-Boot] [PATCH 00/12] Big work on sunxi DW DRAM controllers and some new DDR type support

2017-06-02 Thread Jagan Teki
On Wed, Apr 26, 2017 at 8:19 PM, Icenowy Zheng  wrote:
> This patchset contains several works on the sunxi DesignWare DRAM
> controllers.
>
> The 1st patch made an option for H3-like DRAM controllers
> (DesignWare ones), which can ease further import of alike controllers.
>
> The 2nd and 3rd patches are for supporting 16-bit DW DRAM controllers,
> in order to add V3s DRAM support (The controller on V3s is 16-bit).
>
> The 4th patch adds bank detection code, in order to support some DDR2
> chips.
>
> The 5th patch adds a framework for select DRAM type and timing -- it's
> needed for boards that use DRAM chips rather than DDR3.
>
> The 6th patch enables dual rank detection in the DW DRAM code on SoCs
> except R40. For R40 the dual rank facility is still not so clear, so it's
> temporarily disabled.
>
> The 7th~9th patches enables support for DRAM initialization and SPL for
> the V3s SoC, which integrates a DDR2 chip.
>
> The 10th and 11th patches adds support for LPDDR3, with the stock boot0
> timing. (Seen in A83T boot0 source and some leaked H5/R40 libdram source)
>
> The 12th patches adds a defconfig for SoPine w/ official baseboard, which
> utilizes LPDDR3.
>
> Icenowy Zheng (12):
>   sunxi: makes an invisible option for H3-like DRAM controllers
>   sunxi: Rename bus-width related macros in H3 DRAM code
>   sunxi: add option for 16-bit DW DRAM controller
>   sunxi: add bank detection code to H3 DRAM initialization code
>   sunxi: Add selective DRAM type and timing
>   sunxi: enable dual rank detection in DesignWare-like DRAM code
>   sunxi: add support for the DDR2 in V3s SoC
>   sunxi: add support for V3s DRAM controller
>   sunxi: enable DRAM initialization and SPL for V3s SoC
>   sunxi: add LPDDR3 DRAM type support for DesignWare-like DRAM
> controller
>   sunxi: add LPDDR3 timing from stock boot0
>   sunxi: add a defconfig for SoPine w/ official baseboard

Can you rebase on master and sen it again, difficult to fix the things
while applying.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 12/12] sunxi: add a defconfig for SoPine w/ official baseboard

2017-06-02 Thread Jagan Teki
On Wed, Apr 26, 2017 at 8:20 PM, Icenowy Zheng  wrote:
> The SoPine is a SoM by Pine64, with an Allwinner A64 SoC, a LPDDR3 DRAM
> chip, an AXP803 PMIC, a SPI NOR Flash and a MicroSD slot. The card
> detect pin of the MicroSD slot is broken, however, it doesn't matter as
> the design of SoPine didn't allow hot-swapping the MicroSD card (The
> MicroSD slot is at the back of the SoM, and when the SoM is installed on
> the baseboard, it's nearly impossible to remove the MicroSD).
>
> The official baseboard of it is a board with nearly the same connectors
> with the original Pine64+, with the MicroUSB power jack replaced, and
> at the position of MicroSD slot a eMMC module slot is added.
>
> Add support for SoPine with the official baseboard by adding its
> defconfig file. It still uses the device tree of Pine64, however, it
> will change after a proper device tree of SoPine with baseboard is
> accepted by Linux mainline.
>
> Signed-off-by: Icenowy Zheng 
> ---
>  configs/sopine_baseboard_defconfig | 22 ++
>  1 file changed, 22 insertions(+)
>  create mode 100644 configs/sopine_baseboard_defconfig
>
> diff --git a/configs/sopine_baseboard_defconfig

Can't this be simply sopine_defconfig

Please add MAINTAINERS entry as well

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/5] armv8: layerscape: Make U-Boot EL2 safe

2017-06-02 Thread york sun
On 05/15/2017 08:52 AM, York Sun wrote:
> When U-Boot boots from EL2, skip some lowlevel init code requiring
> EL3, including CCI-400/CCN-504, trust zone, GIC, etc. These
> initialization tasks are carried out before U-Boot runs. This applies
> to the RAM version image used for SPL boot if PPA is loaded first.
> 
> Signed-off-by: York Sun
> ---
> 
>   arch/arm/cpu/armv8/fsl-layerscape/cpu.c  | 11 ++-
>   arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 16 +++-
>   arch/arm/cpu/armv8/fsl-layerscape/ppa.c  |  7 +++
>   arch/arm/cpu/armv8/fsl-layerscape/soc.c  | 14 --
>   arch/arm/cpu/armv8/sec_firmware.c|  2 +-
>   arch/arm/cpu/armv8/start.S   |  3 +++
>   board/freescale/common/ns_access.c   |  5 -
>   7 files changed, 52 insertions(+), 6 deletions(-)

Applied this set (with patch v2 4/5) to fsl-qoriq master, awaiting upstream.

York

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


[U-Boot] [PATCH] ls1088a: Disable default enabled DISPLAY_BOARDINFO

2017-06-02 Thread Amrita Kumari
Signed-off-by: Amrita Kumari 
---
 configs/ls1088aqds_qspi_defconfig| 1 +
 configs/ls1088aqds_sdcard_qspi_defconfig | 1 +
 configs/ls1088ardb_qspi_defconfig| 1 +
 configs/ls1088ardb_sdcard_qspi_defconfig | 1 +
 4 files changed, 4 insertions(+)

diff --git a/configs/ls1088aqds_qspi_defconfig 
b/configs/ls1088aqds_qspi_defconfig
index ae6da5e..7bb63f9 100644
--- a/configs/ls1088aqds_qspi_defconfig
+++ b/configs/ls1088aqds_qspi_defconfig
@@ -35,3 +35,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_STORAGE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/ls1088aqds_sdcard_qspi_defconfig 
b/configs/ls1088aqds_sdcard_qspi_defconfig
index ceed7f6..cd15f24 100644
--- a/configs/ls1088aqds_sdcard_qspi_defconfig
+++ b/configs/ls1088aqds_sdcard_qspi_defconfig
@@ -37,3 +37,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_STORAGE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/ls1088ardb_qspi_defconfig 
b/configs/ls1088ardb_qspi_defconfig
index c9d590d..3f2451e 100644
--- a/configs/ls1088ardb_qspi_defconfig
+++ b/configs/ls1088ardb_qspi_defconfig
@@ -39,3 +39,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_STORAGE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig 
b/configs/ls1088ardb_sdcard_qspi_defconfig
index ee63786..7dc5091 100644
--- a/configs/ls1088ardb_sdcard_qspi_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_defconfig
@@ -37,3 +37,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_STORAGE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
-- 
2.7.4

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


Re: [U-Boot] binman: 'module' object has no attribute 'FinaliseOutputDir'

2017-06-02 Thread Simon Glass
Hi Kevin,

On 1 June 2017 at 17:08, Kevin Hilman  wrote:
>
> On Thu, Jun 1, 2017 at 8:23 AM, Simon Glass  wrote:
> > Hi Kevin,
> >
> > On 1 June 2017 at 07:55, Kevin Hilman  wrote:
> >> On Wed, May 31, 2017 at 12:19 PM, Simon Glass  wrote:
> >>> Hi Kevin,
> >>>
> >>> On 31 May 2017 at 12:13, Kevin Hilman  wrote:
>  While trying to build v2017.05 for sun5i-r8-chip (CHIP_defconfig), I get
>  the following build error.  I'm not familiar with binman, so not sure
>  what I should be looking for.
> 
>  $ CROSS_COMPILE=arm-linux-gnueabihf- make
> 
>  [...]
> 
>   LD  spl/drivers/serial/built-in.o
>   LD  spl/drivers/built-in.o
>   LD  spl/common/built-in.o
>   LD  spl/lib/built-in.o
>   LD  spl/u-boot-spl
>   OBJCOPY spl/u-boot-spl-nodtb.bin
>   COPYspl/u-boot-spl.bin
>   MKSUNXI spl/sunxi-spl.bin
>   BINMAN  u-boot-sunxi-with-spl.bin
>   binman: 'module' object has no attribute 'FinaliseOutputDir'
>   Makefile:1107: recipe for target 'u-boot-sunxi-with-spl.bin' failed
>   make: *** [u-boot-sunxi-with-spl.bin] Error 1
> 
> 
>  If it matters, compiler is: gcc version 5.3.1 20160412 (Linaro GCC 
>  5.3-2016.05)
> >>>
> >>> Do you know what version of python you are using? I cannot imagine
> >>> what is happening here.
> >>
> >> $ python
> >> Python 2.7.12 (default, Nov 19 2016, 06:48:10)
> >> [GCC 5.4.0 20160609] on linux2
> >> Type "help", "copyright", "credits" or "license" for more information.
> >
> >>
> >> and fwiw, this is on Ubuntu 16.04 LTS.
> >
> > That's what I am using too. This is really mystifying. Are you able to
> > debug the python code?
>
> If you give me some pointers/suggestions, I'd be glad to, but I don't
> currently have much time to go wandering too deep into the uboot
> weeds.

My guess is that you have a tools.py file somewhere in your Python
site_packages. You should be able to test this with:

python
> import tools

Perhaps 'dpkg -S tools.py' will tell you what package installed it.

If you don't get an error then it suggests you already have this
package. That in turn would suggest that the fix is that the path
should be prepended instead of appended at the top of binman.py.

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


Re: [U-Boot] [PATCH v2] sun50i: h5: Add initial Orangepi Prime support

2017-06-02 Thread Jagan Teki
On Fri, Jun 2, 2017 at 6:53 PM, Maxime Ripard
 wrote:
> On Thu, Jun 01, 2017 at 03:25:32PM +, Jagan Teki wrote:
>> From: Jagan Teki 
>>
>> Orangepi Prime is an open-source single-board computer
>> using the Allwinner h5 SOC.
>>
>> H5 Orangepi Prime has
>> - Quad-core Cortex-A53
>> - 2GB DDR3
>> - Debug TTL UART
>> - 1000M/100M Ethernet RJ45
>> - Three USB 2.0
>> - HDMI
>> - Audio and MIC
>> - Wifi + BT
>> - IR receiver
>> - HDMI
>> - Wifi + BT
>>
>> Boot from MMC:
>> -
>> U-Boot SPL 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14)
>> DRAM: 2048 MiB
>> Trying to boot from MMC1
>> NOTICE:  BL3-1: Running on H5 (1718) in SRAM A2 (@0x44000)
>> NOTICE:  Configuring SPC Controller
>> NOTICE:  BL3-1: v1.0(debug):aa75c8d
>> NOTICE:  BL3-1: Built : 18:28:27, May 24 2017
>> INFO:BL3-1: Initializing runtime services
>> INFO:BL3-1: Preparing for EL3 exit to normal world
>> INFO:BL3-1: Next image address: 0x4a00, SPSR: 0x3c9
>>
>> U-Boot 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14 +) Allwinner 
>> Technology
>>
>> CPU:   Allwinner H5 (SUN50I)
>> Model: OrangePi Prime
>> DRAM:  2 GiB
>> MMC:   SUNXI SD/MMC: 0
>> *** Warning - bad CRC, using default environment
>>
>> In:serial
>> Out:   serial
>> Err:   serial
>> Net:   phy interface7
>> eth0: ethernet@1c3
>> starting USB...
>> USB0:   USB EHCI 1.00
>> USB1:   USB OHCI 1.0
>> scanning bus 0 for devices... 1 USB Device(s) found
>>scanning usb for storage devices... 0 Storage Device(s) found
>> Hit any key to stop autoboot:  0
>>
>> Signed-off-by: Jagan Teki 
>
> Acked-by: Maxime Ripard 

Applied to u-boot-sunxi/master

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/5] sun50i: a64/h5: Add orangepi boards

2017-06-02 Thread Jagan Teki
On Fri, May 26, 2017 at 1:05 AM, Jagan Teki  wrote:
> From: Jagan Teki 
>
> This series add Allwinner Cortex A-53 boards from OrangePI.
> - Orangepi Win/WinPlus
> - Orangepi Prime
> - Orangepi Zero Plus 2
>
> thanks!
> Jagan.
>
> Jagan Teki (5):
>   sun50i: a64: Add initial Orangepi Win/WinPlus support

>   arm64: dts: sun50i: Add sun50i-h5.dtsi
>   arm64: dts: sun50i: h5: orangepi-pc2: Use GPIO flag binding macro

These two

Applied to u-boot-sunxi/master

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] armv8: ls1046a: Enable spl_board_init() function

2017-06-02 Thread york sun
On 06/01/2017 10:16 AM, York Sun wrote:
> CONFIG_SPL_BOARD_INIT is used for SPL boot. It is only enabled for
> secure boot at this moment. Enable it in defconfig files for SPL
> build.
> 
> Signed-off-by: York Sun
> ---
> Change log
>   v2: CONFIG_SPL_BOARD_INIT has been converted to Kconfig by 0680f1b1f.
>   Adjust this patch accordingly.
> 
>   configs/ls1046aqds_nand_defconfig   | 1 +
>   configs/ls1046aqds_sdcard_ifc_defconfig | 1 +
>   configs/ls1046aqds_sdcard_qspi_defconfig| 1 +
>   configs/ls1046ardb_emmc_defconfig   | 1 +
>   configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig | 1 +
>   configs/ls1046ardb_sdcard_defconfig | 1 +
>   6 files changed, 6 insertions(+)

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH 1/2][v5] armv8: ls2080a: Reorganise NAND_BOOT code in config flag

2017-06-02 Thread york sun
On 05/05/2017 03:09 AM, Santan Kumar wrote:
> Add CONFIG_NAND_BOOT config flag to organise
> NAND_BOOT specific code in config flag like
> -nand-boot specfic errata errata_rcw_src()
> -CONFIG_SYS_NAND_U_BOOT_DST,etc
> 
> Signed-off-by: Santan Kumar
> Signed-off-by: Priyanka Jain
> Signed-off-by: Abhimanyu Saini
> ---
> Changes in v5:
>   Rebase in latest code base
> 
>   arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 +-
>   configs/ls2080aqds_nand_defconfig   | 1 +
>   include/configs/ls2080a_common.h| 2 ++
>   include/configs/ls2080aqds.h| 4 +++-
>   4 files changed, 7 insertions(+), 2 deletions(-)

You missed ls2080ardb_nand_defconfig.

Added CONFIG_NAND_BOOT=y to ls2080ardb_nand_defconfig. Applied to 
fsl-qoriq master, awaiting upstream. Thanks.

York

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


Re: [U-Boot] [PATCH v3 2/2] drivers: net: fsl-mc: Include MAC addr fixup to DPL

2017-06-02 Thread york sun
On 05/24/2017 09:40 AM, Bogdan Purcareata wrote:
> Previous to MC v10.x, port mac address was specified via DPL. Since
> newer MC versions are compatible with old style DPLs, make the u-boot
> env mac addresses visible there. This applies only to DPLs that have an
> older version.
> 
> DPLs use 32 bit values for specifying MAC addresses. U-boot environment
> variables take precedence over the MAC addresses already visible in the
> DPL/DPC.
> 
> Signed-off-by: Bogdan Purcareata 
> Signed-off-by: Heinz Wrobel 
> ---
> v2 -> v3:
> - no changes
> 
> v1 -> v2:
> - initialize variables to fix compiler warnings
> - remove prints
> 
>   drivers/net/fsl-mc/mc.c | 258 
> 
>   1 file changed, 195 insertions(+), 63 deletions(-)
> 

Minor reformatting commit message to wrap back before 70 characters.
Applied to fsl-qoriq master, awaiting upstream. Thanks.

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


Re: [U-Boot] [PATCH v3 1/2] drivers: net: fsl-mc: Link MC boot to PHY_RESET_R

2017-06-02 Thread york sun
On 05/24/2017 09:40 AM, Bogdan Purcareata wrote:
> DPAA2 platforms boot the Management Complex based on the u-boot env
> variable "mcinitcmd". Instead of doing this step on each platform
> individually, define a single mc_env_boot function in the MC driver,
> since it's semantically tied to it.
> 
> Call the function in a per-board reset_phy hook, as it gets called at a
> later moment, when all board PHY devices have been initialized.
> 
> Signed-off-by: Bogdan Purcareata 
> Signed-off-by: Heinz Wrobel 
> ---
> v2 -> v3:
> - add dummy reset_phy() implementation in board/freescale/ls2080a/ls2080a.c
>for proper compilation on ls2080a_simu and ls2080a_emu
> 
> v1 -> v2:
> - keep the reset_phy implementation on each board; some boards might
>want to do something else besides booting the MC.
> 
>   board/freescale/ls2080a/ls2080a.c  |  6 ++
>   board/freescale/ls2080aqds/eth.c   | 13 ++---
>   board/freescale/ls2080ardb/eth_ls2080rdb.c | 14 --
>   drivers/net/fsl-mc/mc.c| 16 
>   include/configs/ls2080a_common.h   |  5 +
>   include/fsl-mc/fsl_mc.h|  1 +
>   6 files changed, 42 insertions(+), 13 deletions(-)
> 

Added "#include " to both 
board/freescale/ls2080aqds/eth.c and 
board/freescale/ls2080ardb/eth_ls2080rdb.c to fix compiling warning. 
Applied to fsl-qoriq master, awaiting upstream. Thanks.

York

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


Re: [U-Boot] [PATCH v5] QE: add QE support on SD boot

2017-06-02 Thread york sun
On 05/24/2017 07:03 PM, Zhao Qiang wrote:
> modify u_qe_init to upload QE firmware from SD card when it is SD
> boot
> 
> Signed-off-by: Zhao Qiang 
> ---
> Changes for v2:
>   - fix issue of memory leak
> Changes for v3:
>   - add CONFIG_SYS_QE_FMAN_FW_IN_NOR to ls1021a
> Changes for v4:
>   - rebase due to memory-mapping conflict
> Changes for v5:
>   - fix compile issue for PowerPC
>

Applied to fsl-qoriq master, awaiting upstream. Thanks.

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


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

2017-06-02 Thread york sun
Tom,

The following changes since commit 380e86f361e4e2aef83295972863654fde157560:

   Merge git://git.denx.de/u-boot-fsl-qoriq (2017-05-26 11:19:27 -0400)

are available in the git repository at:

   git://git.denx.de/u-boot-fsl-qoriq.git

for you to fetch changes up to 8d75d52878514e23e0bd9c30743255570d05409c:

   armv8: ls1046ardb: Enable loading PPA during SPL stage for SD boot 
(2017-06-01 19:57:24 -0700)


Bogdan Purcareata (2):
   drivers: net: fsl-mc: Link MC boot to PHY_RESET_R
   drivers: net: fsl-mc: Include MAC addr fixup to DPL

Santan Kumar (2):
   armv8: ls2080a: Reorganise NAND_BOOT code in config flag
   armv8: ls2080aqds: Add support for SD boot

York Sun (5):
   armv8: layerscape: Make U-Boot EL2 safe
   armv8: layerscape: Enabling loading PPA during SPL stage
   armv8: ls1043ardb: Enable loading PPA during SPL stage for SD boot
   armv8: ls1046a: Enable spl_board_init() function
   armv8: ls1046ardb: Enable loading PPA during SPL stage for SD boot

Zhao Qiang (1):
   QE: add QE support on SD boot

  arch/arm/cpu/armv8/fsl-layerscape/Kconfig  |  13 +
  arch/arm/cpu/armv8/fsl-layerscape/cpu.c|  17 +-
  .../cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c|   6 +-
  arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S   |  16 +-
  arch/arm/cpu/armv8/fsl-layerscape/ppa.c|   7 +
  arch/arm/cpu/armv8/fsl-layerscape/soc.c|  16 +-
  arch/arm/cpu/armv8/fsl-layerscape/spl.c|  41 ++-
  arch/arm/cpu/armv8/sec_firmware.c  |   2 +-
  arch/arm/cpu/armv8/start.S |   3 +
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |   1 +
  board/freescale/common/ns_access.c |   5 +-
  board/freescale/ls2080a/ls2080a.c  |  12 +-
  board/freescale/ls2080aqds/MAINTAINERS |   1 +
  board/freescale/ls2080aqds/README  |  13 +
  board/freescale/ls2080aqds/eth.c   |  18 +-
  board/freescale/ls2080aqds/ls2080aqds.c|   4 +-
  board/freescale/ls2080ardb/eth_ls2080rdb.c |  15 +-
  configs/ls1043ardb_sdcard_defconfig|   1 +
  configs/ls1046aqds_nand_defconfig  |   1 +
  configs/ls1046aqds_sdcard_ifc_defconfig|   1 +
  configs/ls1046aqds_sdcard_qspi_defconfig   |   1 +
  configs/ls1046ardb_emmc_defconfig  |   1 +
  configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig|   1 +
  configs/ls1046ardb_sdcard_defconfig|   2 +
  configs/ls2080aqds_nand_defconfig  |   1 +
  configs/ls2080aqds_sdcard_defconfig|  56 +
  configs/ls2080ardb_nand_defconfig  |   1 +
  drivers/net/fsl-mc/mc.c| 274 
-
  drivers/qe/qe.c|  36 ++-
  include/configs/ls1021aqds.h   |   1 +
  include/configs/ls1021atwr.h   |   1 +
  include/configs/ls1043a_common.h   |   2 +
  include/configs/ls1043ardb.h   |   4 +-
  include/configs/ls2080a_common.h   |  14 ++
  include/configs/ls2080aqds.h   |  29 ++-
  include/fsl-mc/fsl_mc.h|   1 +
  36 files changed, 515 insertions(+), 103 deletions(-)
  create mode 100644 configs/ls2080aqds_sdcard_defconfig

Thanks.

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


Re: [U-Boot] [PATCH v2 3/6] arch/arm/dts: Add Turris Omnia device tree

2017-06-02 Thread Andreas Färber
Am 02.06.2017 um 18:58 schrieb Marek Behun:
> From: Marek Behún 
> 
> This device tree is taken from mainline Linux kernel commit
> 7b7db5ab

Thanks for that clarification.

> with certain modifications:
> 
>   - aliases for I2C devices are added, because u-boot i2cmux
> doesn't work otherwise

Sorry, my question may not have been clear enough: You should not add
anything to the .dts. Use a new -u-boot.dtsi for any additions instead,
so that we can update the .dts file from Linux.

>   - the ATSHA204A node is added in the i2c@5 node
>   - "u-boot,dm-pre-reloc"s are added in needed nodes for SPL
> build to work correctly
> 
> Signed-off-by: Marek Behun 
> 
>  create mode 100644 arch/arm/dts/armada-385-turris-omnia.dts
[snip]

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 5/6] drivers/misc: Add basic support for ATSHA204A Crypto module

2017-06-02 Thread Marek Behun
From: Marek Behún 

This module can be found on the Turris Omnia board connected
via the I2C interface.

Among some cryptographic functions, the chip has a 512 bit
One Time Programmable memory, 88 byte configuration memory
and 512 byte general purpose memory.

The Turris Omnia stores serial number and device MAC address in
the OTP memory.

This commit adds basic support for reading the EEPROM and also
exposes the chips Random Number Generator.

The driver is based on code by
  Josh Datko, Cryptotronix, j...@cryptotronix.com
and also
  Tomas Hlavacek, CZ.NIC, tomas.hlava...@nic.cz

Signed-off-by: Tomas Hlavacek 
Signed-off-by: Marek Behun 

 create mode 100644 drivers/misc/atsha204a-i2c.c
 create mode 100644 include/atsha204a-i2c.h

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index ecca159d14..8073cdc628 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -20,6 +20,14 @@ config ALTERA_SYSID
  Select this to enable a sysid for Altera devices. Please find
  details on the "Embedded Peripherals IP User Guide" of Altera.
 
+config ATSHA204A
+   bool "Support for Atmel ATSHA204A module"
+   depends on MISC
+   help
+  Enable support for I2C connected Atmel's ATSHA204A
+  CryptoAuthentication module found for example on the Turris Omnia
+  board.
+
 config CMD_CROS_EC
bool "Enable crosec command"
depends on CROS_EC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 4543cd647e..bb51f9fafe 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_MISC) += misc-uclass.o
 obj-$(CONFIG_ALI152X) += ali512x.o
 obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
+obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
 obj-$(CONFIG_DS4510)  += ds4510.o
 obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
 ifndef CONFIG_SPL_BUILD
diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
new file mode 100644
index 00..f9fff06072
--- /dev/null
+++ b/drivers/misc/atsha204a-i2c.c
@@ -0,0 +1,307 @@
+/*
+ * I2C Driver for Atmel ATSHA204 over I2C
+ *
+ * Copyright (C) 2014 Josh Datko, Cryptotronix, j...@cryptotronix.com
+ *  2016 Tomas Hlavacek, CZ.NIC, tmshl...@gmail.com
+ *  2017 Marek Behun, CZ.NIC, marek.be...@nic.cz
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ATSHA204A_TWLO 60
+#define ATSHA204A_TRANSACTION_TIMEOUT  10
+#define ATSHA204A_TRANSACTION_RETRY5
+#define ATSHA204A_EXECTIME 5000
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static u16 atsha204a_crc16(const u8 *buf, u8 len)
+{
+   u8 i;
+   u16 crc16 = 0;
+   u8 shift;
+
+   for (i = 0; i < len; i++) {
+   for (shift = 0x01; shift > 0x00; shift <<= 1) {
+   u8 data_bit = (buf[i] & shift) ? 1 : 0;
+   u8 crc_bit = crc16 >> 15;
+
+   crc16 <<= 1;
+
+   if ((data_bit ^ crc_bit) != 0)
+   crc16 ^= 0x8005;
+   }
+   }
+
+   return cpu_to_le16(crc16);
+}
+
+static int atsha204a_send(struct udevice *dev, const u8 *buf, u8 len)
+{
+   fdt_addr_t *priv = dev_get_priv(dev);
+   struct i2c_msg msg;
+
+   msg.addr = *priv;
+   msg.flags = I2C_M_STOP;
+   msg.len = len;
+   msg.buf = (u8 *) buf;
+
+   return dm_i2c_xfer(dev, , 1);
+}
+
+static int atsha204a_recv(struct udevice *dev, u8 *buf, u8 len)
+{
+   fdt_addr_t *priv = dev_get_priv(dev);
+   struct i2c_msg msg;
+
+   msg.addr = *priv;
+   msg.flags = I2C_M_RD | I2C_M_STOP;
+   msg.len = len;
+   msg.buf = (u8 *) buf;
+
+   return dm_i2c_xfer(dev, , 1);
+}
+
+static int atsha204a_recv_resp(struct udevice *dev,
+  struct atsha204a_resp *resp)
+{
+   int res;
+   u16 resp_crc, computed_crc;
+   u8 *p = (u8 *) resp;
+
+   res = atsha204a_recv(dev, p, 4);
+   if (res)
+   return res;
+
+   if (resp->length > 4) {
+   if (resp->length > sizeof(*resp))
+   return -EMSGSIZE;
+
+   res = atsha204a_recv(dev, p + 4, resp->length - 4);
+   if (res)
+   return res;
+   }
+
+   resp_crc = (u16) p[resp->length - 2]
+  | (((u16) p[resp->length - 1]) << 8);
+   computed_crc = atsha204a_crc16(p, resp->length - 2);
+
+   if (resp_crc != computed_crc) {
+   debug("Invalid checksum in ATSHA204A response\n");
+   return -EBADMSG;
+   }
+
+   return 0;
+}
+
+int atsha204a_wakeup(struct udevice *dev)
+{
+   u8 req[4];
+   struct atsha204a_resp resp;
+   int try, 

[U-Boot] [PATCH v2 3/6] arch/arm/dts: Add Turris Omnia device tree

2017-06-02 Thread Marek Behun
From: Marek Behún 

This device tree is taken from mainline Linux kernel commit
7b7db5ab with certain modifications:

  - aliases for I2C devices are added, because u-boot i2cmux
doesn't work otherwise
  - the ATSHA204A node is added in the i2c@5 node
  - "u-boot,dm-pre-reloc"s are added in needed nodes for SPL
build to work correctly

Signed-off-by: Marek Behun 

 create mode 100644 arch/arm/dts/armada-385-turris-omnia.dts

diff --git a/arch/arm/dts/armada-385-turris-omnia.dts 
b/arch/arm/dts/armada-385-turris-omnia.dts
new file mode 100644
index 00..f1937a3d93
--- /dev/null
+++ b/arch/arm/dts/armada-385-turris-omnia.dts
@@ -0,0 +1,410 @@
+/*
+ * Device Tree file for the Turris Omnia
+ *
+ * Copyright (C) 2016 Uwe Kleine-König 
+ * Copyright (C) 2016 Tomas Hlavacek 
+ *
+ * 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 file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without
+ * any warranty of any kind, whether express or implied.
+ *
+ * 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.
+ */
+
+/*
+ * Schematic available at https://www.turris.cz/doc/_media/rtrom01-schema.pdf
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include "armada-385.dtsi"
+
+/ {
+   model = "Turris Omnia";
+   compatible = "cznic,turris-omnia", "marvell,armada385", 
"marvell,armada380";
+
+   aliases {
+   i2c0 = 
+   i2c1 = 
+   };
+
+   chosen {
+   stdout-path = 
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x4000>; /* 1024 MB */
+   };
+
+   soc {
+   ranges = ;
+
+   internal-regs {
+
+   /* USB part of the PCIe2/USB 2.0 port */
+   usb@58000 {
+   status = "okay";
+   };
+
+   sata@a8000 {
+   status = "okay";
+   };
+
+   sdhci@d8000 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   status = "okay";
+
+   bus-width = <8>;
+   no-1-8-v;
+   non-removable;
+   };
+
+   usb3@f {
+   status = "okay";
+   };
+
+   usb3@f8000 {
+   status = "okay";
+   };
+   };
+
+   pcie-controller {
+   status = "okay";
+
+   pcie@1,0 {
+   /* Port 0, Lane 0 */
+   status = "okay";
+   };
+
+   pcie@2,0 {
+   /* Port 1, Lane 0 */
+   status = "okay";
+   };
+
+   pcie@3,0 {
+   /* Port 2, Lane 0 */
+   status = "okay";
+   };
+   };
+   };
+};
+
+/* Connected to 88E6176 switch, port 6 */
+ {
+   pinctrl-names = "default";
+

[U-Boot] [PATCH v2 6/6] marvell: armada385: Add the Turris Omnia board

2017-06-02 Thread Marek Behun
From: Marek Behún 

The Turris Omnia is a open-source router created by CZ.NIC.

The code is based on the Marvell/db-88f6820-gp by Stefan Roese
with modifications from Tomas Hlavacek in the CZ.NIC turris-omnia-uboot
repository, which can be found at
https://gitlab.labs.nic.cz/turris/turris-omnia-uboot

By default, the Turris Omnia uses btrfs as the main and only filesystem,
and also loads kernel and device tree from this filesystem. Since U-Boot
does not yet support btrfs, you should not flash your Turris Omnia board
with this unless you know what you are doing.

Signed-off-by: Tomas Hlavacek 
Signed-off-by: Marek Behun 

 create mode 100644 board/CZ.NIC/turris_omnia/Makefile
 create mode 100644 board/CZ.NIC/turris_omnia/kwbimage.cfg
 create mode 100644 board/CZ.NIC/turris_omnia/turris_omnia.c
 create mode 100644 configs/turris_omnia_defconfig
 create mode 100644 include/configs/turris_omnia.h

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 6ae54ef46a..6b16f57464 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -90,6 +90,10 @@ config TARGET_DB_88F6820_AMC
bool "Support DB-88F6820-AMC"
select 88F6820
 
+config TARGET_TURRIS_OMNIA
+   bool "Support Turris Omnia"
+   select 88F6820
+
 config TARGET_MVEBU_ARMADA_8K
bool "Support Armada 7k/8k platforms"
select ARMADA_8K
@@ -124,6 +128,7 @@ config SYS_BOARD
default "db-88f6720" if TARGET_DB_88F6720
default "db-88f6820-gp" if TARGET_DB_88F6820_GP
default "db-88f6820-amc" if TARGET_DB_88F6820_AMC
+   default "turris_omnia" if TARGET_TURRIS_OMNIA
default "mvebu_armada-8k" if TARGET_MVEBU_ARMADA_8K
default "db-mv784mp-gp" if TARGET_DB_MV784MP_GP
default "ds414" if TARGET_DS414
@@ -141,6 +146,7 @@ config SYS_CONFIG_NAME
default "ds414" if TARGET_DS414
default "maxbcm" if TARGET_MAXBCM
default "theadorable" if TARGET_THEADORABLE
+   default "turris_omnia" if TARGET_TURRIS_OMNIA
 
 config SYS_VENDOR
default "Marvell" if TARGET_DB_MV784MP_GP
@@ -151,10 +157,26 @@ config SYS_VENDOR
default "Marvell" if TARGET_MVEBU_ARMADA_8K
default "solidrun" if TARGET_CLEARFOG
default "Synology" if TARGET_DS414
+   default "CZ.NIC" if TARGET_TURRIS_OMNIA
 
 config SYS_SOC
default "mvebu"
 
+if TARGET_TURRIS_OMNIA
+
+choice
+   prompt "Turris Omnia boot method"
+
+config TURRIS_OMNIA_SPL_BOOT_DEVICE_SPI
+   bool "SPI NOR flash"
+
+config TURRIS_OMNIA_SPL_BOOT_DEVICE_MMC
+   bool "SDIO/MMC card"
+
+endchoice
+
+endif
+
 config MVEBU_EFUSE
bool "Enable eFuse support"
default n
diff --git a/board/CZ.NIC/turris_omnia/Makefile 
b/board/CZ.NIC/turris_omnia/Makefile
new file mode 100644
index 00..f2ae50654f
--- /dev/null
+++ b/board/CZ.NIC/turris_omnia/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2017 Marek Behun 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := turris_omnia.o
diff --git a/board/CZ.NIC/turris_omnia/kwbimage.cfg 
b/board/CZ.NIC/turris_omnia/kwbimage.cfg
new file mode 100644
index 00..cc05792556
--- /dev/null
+++ b/board/CZ.NIC/turris_omnia/kwbimage.cfg
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2014 Stefan Roese 
+#
+
+# Armada XP uses version 1 image format
+VERSION1
+
+# Boot Media configurations
+BOOT_FROM  spi
+
+# Binary Header (bin_hdr) with DDR3 training code
+BINARY spl/u-boot-spl.bin 005b 0068
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c 
b/board/CZ.NIC/turris_omnia/turris_omnia.c
new file mode 100644
index 00..3492e4f398
--- /dev/null
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -0,0 +1,504 @@
+/*
+ * Copyright (C) 2017 Marek Behun 
+ * Copyright (C) 2016 Tomas Hlavacek 
+ *
+ * Derived from the code for
+ *   Marvell/db-88f6820-gp by Stefan Roese 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_ATSHA204A
+# include 
+#endif
+
+#ifdef CONFIG_WDT_ORION
+# include 
+#endif
+
+#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include <../serdes/a38x/high_speed_env_spec.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define OMNIA_I2C_EEPROM_DM_NAME   "i2c@0"
+#define OMNIA_I2C_EEPROM   0x54
+#define OMNIA_I2C_EEPROM_CONFIG_ADDR   0x0
+#define OMNIA_I2C_EEPROM_ADDRLEN   2
+#define OMNIA_I2C_EEPROM_MAGIC 0x0341a034
+
+#define OMNIA_I2C_MCU_DM_NAME  "i2c@1"
+#define OMNIA_I2C_MCU_ADDR_STATUS  0x1
+#define OMNIA_I2C_MCU_SATA 0x20
+#define OMNIA_I2C_MCU_CARDDET  0x10
+#define OMNIA_I2C_MCU  0x2a
+#define OMNIA_I2C_MCU_WDT_ADDR 0x0b
+
+#define OMNIA_ATSHA204_OTP_VERSION 0
+#define OMNIA_ATSHA204_OTP_SERIAL  

[U-Boot] [PATCH v2 4/6] drivers/i2c/muxes/pca954x: Add pca9547 I2C mux support

2017-06-02 Thread Marek Behun
From: Marek Behún 

This I2C mux is found, for example, on the Turris Omnia board.

Signed-off-by: Marek Behun 

diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index 1a6761858c..383f72f552 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -13,11 +13,40 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+enum pca_type {
+   PCA9544,
+   PCA9547,
+   PCA9548
+};
+
+struct chip_desc {
+   u8 enable;
+   enum muxtype {
+   pca954x_ismux = 0,
+   pca954x_isswi,
+   } muxtype;
+};
+
 struct pca954x_priv {
u32 addr; /* I2C mux address */
u32 width; /* I2C mux width - number of busses */
 };
 
+static const struct chip_desc chips[] = {
+   [PCA9544] = {
+   .enable = 0x4,
+   .muxtype = pca954x_ismux,
+   },
+   [PCA9547] = {
+   .enable = 0x8,
+   .muxtype = pca954x_ismux,
+   },
+   [PCA9548] = {
+   .enable = 0x8,
+   .muxtype = pca954x_isswi,
+   },
+};
+
 static int pca954x_deselect(struct udevice *mux, struct udevice *bus,
uint channel)
 {
@@ -31,7 +60,13 @@ static int pca954x_select(struct udevice *mux, struct 
udevice *bus,
  uint channel)
 {
struct pca954x_priv *priv = dev_get_priv(mux);
-   uchar byte = 1 << channel;
+   const struct chip_desc *chip = [dev_get_driver_data(mux)];
+   uchar byte;
+
+   if (chip->muxtype == pca954x_ismux)
+   byte = channel | chip->enable;
+   else
+   byte = 1 << channel;
 
return dm_i2c_write(mux, priv->addr, , 1);
 }
@@ -42,8 +77,9 @@ static const struct i2c_mux_ops pca954x_ops = {
 };
 
 static const struct udevice_id pca954x_ids[] = {
-   { .compatible = "nxp,pca9548", .data = (ulong)8 },
-   { .compatible = "nxp,pca9544", .data = (ulong)4 },
+   { .compatible = "nxp,pca9544", .data = PCA9544 },
+   { .compatible = "nxp,pca9547", .data = PCA9547 },
+   { .compatible = "nxp,pca9548", .data = PCA9548 },
{ }
 };
 
-- 
2.13.0

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


[U-Boot] [PATCH v2 2/6] orion_wdt: Support for the Orion Watchdog

2017-06-02 Thread Marek Behun
From: Marek Behún 

The Orion watchdog can be found on some Marvell Armada chips.

This driver is based on the code by Tomas Hlavacek in the CZ.NIC
turris-omnia-uboot repository, which can be found at
https://gitlab.labs.nic.cz/turris/turris-omnia-uboot, and that
one is based on code by Sylver Bruneau. His code is already in
mainline Linux kernel.

The code uses the new driver model API.

Signed-off-by: Tomas Hlavacek 
Signed-off-by: Marek Behun 

 create mode 100644 drivers/watchdog/orion_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index b911233db3..d360a17d4d 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -62,4 +62,11 @@ config WDT_BCM6345
  The watchdog timer is stopped when initialized.
  It performs full SoC reset.
 
+config WDT_ORION
+   bool "Orion watchdog timer support"
+   depends on WDT
+   help
+  Select this to enable Orion watchdog timer, which can be found on 
some
+  Marvell Armada chips.
+
 endmenu
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 4b19e4ccf6..3230cbb2ad 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_WDT_SANDBOX) += sandbox_wdt.o
 obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o
 obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o
 obj-$(CONFIG_BCM2835_WDT)   += bcm2835_wdt.o
+obj-$(CONFIG_WDT_ORION) += orion_wdt.o
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
new file mode 100644
index 00..a0df02d103
--- /dev/null
+++ b/drivers/watchdog/orion_wdt.c
@@ -0,0 +1,177 @@
+/*
+ * drivers/watchdog/orion_wdt.c
+ *
+ * Watchdog driver for Orion/Kirkwood processors
+ *
+ * Authors:Tomas Hlavacek 
+ * Sylver Bruneau 
+ * Marek Behun 
+ *
+ * This file is licensed under  the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct orion_wdt_priv {
+   void __iomem *reg;
+   int wdt_counter_offset;
+   void __iomem *rstout;
+   void __iomem *rstout_mask;
+   u32 timeout;
+};
+
+#define RSTOUT_ENABLE_BIT  BIT(8)
+#define RSTOUT_MASK_BITBIT(10)
+#define WDT_ENABLE_BIT BIT(8)
+
+#define TIMER_CTRL 0x
+#define TIMER_A370_STATUS  0x04
+
+#define WDT_AXP_FIXED_ENABLE_BIT   BIT(10)
+#define WDT_A370_EXPIRED   BIT(31)
+
+static int orion_wdt_reset(struct udevice *dev)
+{
+   struct orion_wdt_priv *priv = dev_get_priv(dev);
+
+   /* Reload watchdog duration */
+   writel(priv->timeout, priv->reg + priv->wdt_counter_offset);
+
+   return 0;
+}
+
+static int orion_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+   struct orion_wdt_priv *priv = dev_get_priv(dev);
+   u32 reg;
+
+   priv->timeout = (u32) timeout;
+
+   /* Enable the fixed watchdog clock input */
+   reg = readl(priv->reg + TIMER_CTRL);
+   reg |= WDT_AXP_FIXED_ENABLE_BIT;
+   writel(reg, priv->reg + TIMER_CTRL);
+
+   /* Set watchdog duration */
+   writel(priv->timeout, priv->reg + priv->wdt_counter_offset);
+
+   /* Clear the watchdog expiration bit */
+   reg = readl(priv->reg + TIMER_A370_STATUS);
+   reg &= ~WDT_A370_EXPIRED;
+   writel(reg, priv->reg + TIMER_A370_STATUS);
+
+   /* Enable watchdog timer */
+   reg = readl(priv->reg + TIMER_CTRL);
+   reg |= WDT_ENABLE_BIT;
+   writel(reg, priv->reg + TIMER_CTRL);
+
+   /* Enable reset on watchdog */
+   reg = readl(priv->rstout);
+   reg |= RSTOUT_ENABLE_BIT;
+   writel(reg, priv->rstout);
+
+   reg = readl(priv->rstout_mask);
+   reg &= ~RSTOUT_MASK_BIT;
+   writel(reg, priv->rstout_mask);
+
+   return 0;
+}
+
+static int orion_wdt_stop(struct udevice *dev)
+{
+   struct orion_wdt_priv *priv = dev_get_priv(dev);
+   u32 reg;
+
+   /* Disable reset on watchdog */
+   reg = readl(priv->rstout_mask);
+   reg |= RSTOUT_MASK_BIT;
+   writel(reg, priv->rstout_mask);
+
+   reg = readl(priv->rstout);
+   reg &= ~RSTOUT_ENABLE_BIT;
+   writel(reg, priv->rstout);
+
+   /* Disable watchdog timer */
+   reg = readl(priv->reg + TIMER_CTRL);
+   reg &= ~WDT_ENABLE_BIT;
+   writel(reg, priv->reg + TIMER_CTRL);
+
+   return 0;
+}
+
+static inline bool save_reg_from_ofdata(struct udevice *dev, int index,
+   void __iomem **reg, int *offset)
+{
+   fdt_addr_t addr;
+   fdt_size_t off;
+
+   addr = fdtdec_get_addr_size_auto_noparent(
+   gd->fdt_blob, dev_of_offset(dev), "reg", 

[U-Boot] [PATCH v2 1/6] driver/ddr: Add support for setting timing in hws_topology_map

2017-06-02 Thread Marek Behun
From: Marek Behún 

The DDR3 training code for Marvell A38X currently computes 1t timing
when given board topology map of the Turris Omnia, but Omnia needs 2t.

This patch adds support for enforcing the 2t timing in struct
hws_topology_map, through a new enum hws_timing, which can assume
following values:
  HWS_TIM_DEFAULT - default behaviour, compute whether to enable 2t
from the number of CSs
  HWS_TIM_1T  - enforce 1t
  HWS_TIM_2T  - enforce 2t

This patch also sets all the board topology maps (db-88f6820-amc,
db-88f6820-gp, controlcenterdc and clearfog) to have timing set to
HWS_TIM_DEFAULT.

Signed-off-by: Marek Behun 

diff --git a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c 
b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
index cade99c8d7..40fa599865 100644
--- a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
+++ b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
@@ -69,7 +69,8 @@ static struct hws_topology_map board_topology_map = {
MEM_4G, /* mem_size */
DDR_FREQ_800,   /* frequency */
0, 0,   /* cas_l cas_wl */
-   HWS_TEMP_LOW} },/* temperature */
+   HWS_TEMP_LOW,   /* temperature */
+   HWS_TIM_DEFAULT} }, /* timing */
5,  /* Num Of Bus Per Interface*/
BUS_MASK_32BIT  /* Busses mask */
 };
diff --git a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c 
b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
index e700781103..a1974cb4bd 100644
--- a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
+++ b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
@@ -90,7 +90,8 @@ static struct hws_topology_map board_topology_map = {
MEM_4G, /* mem_size */
DDR_FREQ_800,   /* frequency */
0, 0,   /* cas_l cas_wl */
-   HWS_TEMP_LOW} },/* temperature */
+   HWS_TEMP_LOW,   /* temperature */
+   HWS_TIM_DEFAULT} }, /* timing */
5,  /* Num Of Bus Per Interface*/
BUS_MASK_32BIT  /* Busses mask */
 };
diff --git a/board/gdsys/a38x/controlcenterdc.c 
b/board/gdsys/a38x/controlcenterdc.c
index f0efb53447..32168d3576 100644
--- a/board/gdsys/a38x/controlcenterdc.c
+++ b/board/gdsys/a38x/controlcenterdc.c
@@ -53,7 +53,8 @@ static struct hws_topology_map ddr_topology_map = {
MEM_4G, /* mem_size */
DDR_FREQ_533,   /* frequency */
0, 0,   /* cas_l cas_wl */
-   HWS_TEMP_LOW} },/* temperature */
+   HWS_TEMP_LOW,   /* temperature */
+   HWS_TIM_DEFAULT} }, /* timing */
5,  /* Num Of Bus Per Interface*/
BUS_MASK_32BIT  /* Busses mask */
 };
diff --git a/board/solidrun/clearfog/clearfog.c 
b/board/solidrun/clearfog/clearfog.c
index 3a8257cac3..8906636f76 100644
--- a/board/solidrun/clearfog/clearfog.c
+++ b/board/solidrun/clearfog/clearfog.c
@@ -83,7 +83,8 @@ static struct hws_topology_map board_topology_map = {
MEM_4G, /* mem_size */
DDR_FREQ_800,   /* frequency */
0, 0,   /* cas_l cas_wl */
-   HWS_TEMP_LOW} },/* temperature */
+   HWS_TEMP_LOW,   /* temperature */
+   HWS_TIM_DEFAULT} }, /* timing */
5,  /* Num Of Bus Per Interface*/
BUS_MASK_32BIT  /* Busses mask */
 };
diff --git a/drivers/ddr/marvell/a38x/ddr3_training.c 
b/drivers/ddr/marvell/a38x/ddr3_training.c
index 7e0749fde3..c79db6af5a 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training.c
@@ -571,6 +571,11 @@ int hws_ddr3_tip_init_controller(u32 dev_num, struct 
init_cntr_param *init_cntr_
 
if (mode2_t != 0xff) {
t2t = mode2_t;
+   } else if (tm->interface_params[if_id].
+  timing != HWS_TIM_DEFAULT) {
+   /* Board topology map is forcing timing */
+   t2t = (tm->interface_params[if_id].
+  timing == HWS_TIM_2T) ? 1 : 0;
} else {
/* calculate number of CS (per interface) */
CHECK_STATUS(calc_cs_num
diff --git a/drivers/ddr/marvell/a38x/ddr_topology_def.h 
b/drivers/ddr/marvell/a38x/ddr_topology_def.h
index f8894e828a..229c3a127a 100644
--- a/drivers/ddr/marvell/a38x/ddr_topology_def.h
+++ b/drivers/ddr/marvell/a38x/ddr_topology_def.h
@@ -37,6 +37,12 @@ enum hws_mem_size {

[U-Boot] [PATCH v2 0/6] Support for the Turris Omnia router

2017-06-02 Thread Marek Behun
This is the second version of patches for adding support for the
Turris Omnia board, a router developed by the CZ.NIC.

The first patch modifies Marvell's DDR3 training code to be more
general, so that board topology map can force 2t timing.

The second patch adds support for the hardware watchdog which
can be found on Omnia. I have modified the driver to use the new
driver model API.

The third patch adds the device tree for Turris Omnia taken from
Linux kernel, wich small additions.

The fourth patch adds support for the I2C multiplexer found on
Turris Omnia.

The fifth patch adds support for the ATSHA204A CryptoAuthentication
chip, on which the Turris Omnia stores serial number and device MAC
address.

The sixth patch adds the proper support for the board. I have
modified config to use distro defaults as requested by Andreas
Faerber and also removed unnecessary comments.

Marek Behun

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


Re: [U-Boot] [PATCH 00/22] mmc: Add support for HS200 and UHS modes

2017-06-02 Thread Jean-Jacques Hiblot



On 25/05/2017 09:41, Jaehoon Chung wrote:

Hi,

On 05/24/2017 12:24 AM, Jean-Jacques Hiblot wrote:

Hi,


On 18/05/2017 06:27, Jaehoon Chung wrote:

Hi,

On 05/13/2017 03:16 AM, Jean-Jacques Hiblot wrote:

This series brings support for HS200 and UHS modes to the mmc core.
It has been tested with the hsmmc driver on several platforms (DRA7,
AM57x, AM437x, beaglebone black). Some modifications are required in
the host driver to take advantage of this (voltage switching, tuning).
The changes to the host driver will be posted a another series as this
one is already long enough.

The series starts with a small refactoring of th sd/mmc startup. The first 4 
commits
are mostly moving code around with little or no functionnal change.

Then the notion of "mode" is introduced. Until now, this information wasn't
kept in struct mmc. Only the clock and a flag for ddr was kept. Later the mode
information will be used to select the clock frequency, the ddr flag and the
tuning procedure. It will be also be check against the host capabilities.

Then comes the big refactoring job in:
"mmc: refactor MMC startup to make it easier to support new modes" and
"mmc: refactor SD startup to make it easier to support new modes"
Since the number of modes is increasing, it makes sense to try them in a more
organized way. those commits use a list of supported modes and iterate through
them to find the best working one. It also allows to switch more easilly from
one mode to another (switching from HS200 to DDR52 to access boot partitions 
for example)

Then there are a couple of new callback added to:
- enable/disable Vdd
- check if the card is busy (used during UHS voltage switching)
- select the IO voltage

Then Power cycle is added. Without power cycle, if a UHS card fails to 
enumerate in
UHS mode, it can't fall back to high speed mode and card enumeration will fail.

And finally the last commits add the support for HS200 and UHS.
I haven't been able to test the UHS SDR104 mode by lack of compatible sdcard.

After testing my targets, some boards don't work fine..So i'm checking this 
problem..

Jaehoon,

what kind of issues are you running into and on what platforms ?
So far, besides the items brought-up by the reviews, there are 2 issues that 
are in the pipe for the next version:
  * signal voltage selection is not done for the MMCs only for SDs.
  * I noticed a timing constraint in voltage selection for SDs that can be a 
problem when trying a UHS mode with some SDs (seen only with Sandisk Ultra  
64Gb micro SD class I) :  the voltage must be switched quickly after the cmd 
SWITCH_UHS18V has been sent, making debug messages in that context a problem. 
With this SD I've been able to check that SDR104 is working.

How about making the "testing-hs200-uhs" branch for this? It needs to test 
more..

Jaehoon,

Have you been able to track down the issue you had with your boards ? 
Next week I can borrow some boards if it can help (at91 and imx6 based), 
have they been part of your tests ?


Also I set up a repository with the code for testing:
g...@github.com:jjhiblot/u-boot.git testing-hs200-uhs_v2

If you have a omap5 based board (dra7 or am57), you can test with this 
branch that also includes the host support for high speed modes:

g...@github.com:jjhiblot/u-boot.git high_speed_hsmmc

Regards,

Jean-jacques




I guess my target doesn't do the voltage change..i'm doing for ufs driver on 
u-boot in my local..
So i didn't see fully..today i have a free time..So i'm doing full review other 
thing..and about pending patches.

Thanks for waiting me.. :)

Best Regards,
Jaehoon Chung


Jean-Jacques

With this in place and the required changes in the HSMMC (including DAM), we 
observe significant
improvements in the performances on a DRA7 evm:
eMMC HS200: 130 MB/s
eMMC DDR52: 80 MB/s
sd   SDR50: 80 MB/s

cheers,

Jean-Jacques


Jean-Jacques Hiblot (18):
mmc: split mmc_startup()
mmc: move the MMC startup for version above v4.0 in a separate
  function
mmc: make ext_csd part of struct mmc
mmc: add a function to read and test the ext csd (mmc >= 4)
mmc: introduces mmc modes.
mmc: Add a fonction to dump the mmc capabilities
mmc: use mmc modes to select the correct bus speed
cmd: mmc: display the mode name and current bus speed in the mmc info
mmc: refactor SD startup to make it easier to support new modes
mmc: refactor MMC startup to make it easier to support new modes
mmc: make mmc_set_ios() return status
mmc: add power cyle support in mmc core
mmc: add a new mmc parameter to disable mmc clock
mmc: Add a execute_tuning() callback to the mmc operations.
mmc: add HS200 support in MMC core
mmc: Add a new callback function to check if the card is busy
mmc: Add support for UHS modes
mmc: Change mode when switching to a boot partition

Kishon Vijay Abraham I (3):
mmc: Enable signal voltage to be selected from mmc core
mmc: Add a new callback function to 

Re: [U-Boot] [PATCH v3] fastboot: Add support for flashing zImage

2017-06-02 Thread Sam Protsenko
On 18 May 2017 at 15:04, Sam Protsenko  wrote:
> This patch adds support for flashing zImage to the Android boot
> partition on eMMC.
>
> Usage:
>
> $ fastboot flash zImage 
>
> It's based on [1].
>
> [1] 
> http://omapzoom.org/?p=repo/u-boot.git;a=commit;h=3393b908c1e848bba3706612cbe50aa8970720b3
>
> Signed-off-by: Sam Protsenko 
> ---
> Changes in v2:
>  - use blk_dread()/blk_dwrite() instead of callbacks from struct blk_desc
>  - fix SPL build warning on DRA7 (check for CONFIG_ANDROID_BOOT_IMAGE)
>
> Changes in v3:
>  - use strncasecmp() to check for "zImage"/"zimage" command
>  - do not add PAGE_ALIGN() macro; use ALIGN() instead
>  - do not include  in android_image.h
>
>  common/fb_mmc.c | 168 
> 
>  1 file changed, 168 insertions(+)
>
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index 866982e41c..2113b6c372 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  /*
>   * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
> @@ -27,6 +29,8 @@
>  #define CONFIG_FASTBOOT_MBR_NAME "mbr"
>  #endif
>
> +#define BOOT_PARTITION_NAME "boot"
> +
>  struct fb_mmc_sparse {
> struct blk_desc *dev_desc;
>  };
> @@ -99,6 +103,163 @@ static void write_raw_image(struct blk_desc *dev_desc, 
> disk_partition_t *info,
> fastboot_okay("");
>  }
>
> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
> +/**
> + * Read Android boot image header from boot partition.
> + *
> + * @param[in] dev_desc MMC device descriptor
> + * @param[in] info Boot partition info
> + * @param[out] hdr Where to store read boot image header
> + *
> + * @return Boot image header sectors count or 0 on error
> + */
> +static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
> +  disk_partition_t *info,
> +  struct andr_img_hdr *hdr)
> +{
> +   ulong sector_size;  /* boot partition sector size */
> +   lbaint_t hdr_sectors;   /* boot image header sectors count */
> +   int res;
> +
> +   /* Calculate boot image sectors count */
> +   sector_size = info->blksz;
> +   hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
> +   if (hdr_sectors == 0) {
> +   error("invalid number of boot sectors: 0");
> +   fastboot_fail("invalid number of boot sectors: 0");
> +   return 0;
> +   }
> +
> +   /* Read the boot image header */
> +   res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
> +   if (res == 0) {
> +   error("cannot read header from boot partition");
> +   fastboot_fail("cannot read header from boot partition");
> +   return 0;
> +   }
> +
> +   /* Check boot header magic string */
> +   res = android_image_check_header(hdr);
> +   if (res != 0) {
> +   error("bad boot image magic");
> +   fastboot_fail("boot partition not initialized");
> +   return 0;
> +   }
> +
> +   return hdr_sectors;
> +}
> +
> +/**
> + * Write downloaded zImage to boot partition and repack it properly.
> + *
> + * @param dev_desc MMC device descriptor
> + * @param download_buffer Address to fastboot buffer with zImage in it
> + * @param download_bytes Size of fastboot buffer, in bytes
> + *
> + * @return 0 on success or -1 on error
> + */
> +static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
> +   void *download_buffer,
> +   unsigned int download_bytes)
> +{
> +   u32 hdr_addr;   /* boot image header address 
> */
> +   struct andr_img_hdr *hdr;   /* boot image header */
> +   lbaint_t hdr_sectors;   /* boot image header sectors 
> */
> +   u8 *ramdisk_buffer;
> +   u32 ramdisk_sector_start;
> +   u32 ramdisk_sectors;
> +   u32 kernel_sector_start;
> +   u32 kernel_sectors;
> +   u32 sectors_per_page;
> +   disk_partition_t info;
> +   int res;
> +
> +   puts("Flashing zImage\n");
> +
> +   /* Get boot partition info */
> +   res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, );
> +   if (res < 0) {
> +   error("cannot find boot partition");
> +   fastboot_fail("cannot find boot partition");
> +   return -1;
> +   }
> +
> +   /* Put boot image header in fastboot buffer after downloaded zImage */
> +   hdr_addr = (u32)download_buffer + ALIGN(download_bytes, PAGE_SIZE);
> +   hdr = (struct andr_img_hdr *)hdr_addr;
> +
> +   /* Read boot image header */
> +   hdr_sectors = fb_mmc_get_boot_header(dev_desc, , hdr);
> +   if (hdr_sectors == 0) {
> +   error("unable to read boot image header");

Re: [U-Boot] [PATCH v3] fastboot: Add support for flashing zImage

2017-06-02 Thread Sam Protsenko
On 18 May 2017 at 15:04, Sam Protsenko  wrote:
> This patch adds support for flashing zImage to the Android boot
> partition on eMMC.
>
> Usage:
>
> $ fastboot flash zImage 
>
> It's based on [1].
>
> [1] 
> http://omapzoom.org/?p=repo/u-boot.git;a=commit;h=3393b908c1e848bba3706612cbe50aa8970720b3
>
> Signed-off-by: Sam Protsenko 
> ---
> Changes in v2:
>  - use blk_dread()/blk_dwrite() instead of callbacks from struct blk_desc
>  - fix SPL build warning on DRA7 (check for CONFIG_ANDROID_BOOT_IMAGE)
>
> Changes in v3:
>  - use strncasecmp() to check for "zImage"/"zimage" command
>  - do not add PAGE_ALIGN() macro; use ALIGN() instead
>  - do not include  in android_image.h
>
>  common/fb_mmc.c | 168 
> 
>  1 file changed, 168 insertions(+)
>
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index 866982e41c..2113b6c372 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  /*
>   * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
> @@ -27,6 +29,8 @@
>  #define CONFIG_FASTBOOT_MBR_NAME "mbr"
>  #endif
>
> +#define BOOT_PARTITION_NAME "boot"
> +
>  struct fb_mmc_sparse {
> struct blk_desc *dev_desc;
>  };
> @@ -99,6 +103,163 @@ static void write_raw_image(struct blk_desc *dev_desc, 
> disk_partition_t *info,
> fastboot_okay("");
>  }
>
> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
> +/**
> + * Read Android boot image header from boot partition.
> + *
> + * @param[in] dev_desc MMC device descriptor
> + * @param[in] info Boot partition info
> + * @param[out] hdr Where to store read boot image header
> + *
> + * @return Boot image header sectors count or 0 on error
> + */
> +static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
> +  disk_partition_t *info,
> +  struct andr_img_hdr *hdr)
> +{
> +   ulong sector_size;  /* boot partition sector size */
> +   lbaint_t hdr_sectors;   /* boot image header sectors count */
> +   int res;
> +
> +   /* Calculate boot image sectors count */
> +   sector_size = info->blksz;
> +   hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
> +   if (hdr_sectors == 0) {
> +   error("invalid number of boot sectors: 0");
> +   fastboot_fail("invalid number of boot sectors: 0");
> +   return 0;
> +   }
> +
> +   /* Read the boot image header */
> +   res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
> +   if (res == 0) {
> +   error("cannot read header from boot partition");
> +   fastboot_fail("cannot read header from boot partition");
> +   return 0;
> +   }
> +
> +   /* Check boot header magic string */
> +   res = android_image_check_header(hdr);
> +   if (res != 0) {
> +   error("bad boot image magic");
> +   fastboot_fail("boot partition not initialized");
> +   return 0;
> +   }
> +
> +   return hdr_sectors;
> +}
> +
> +/**
> + * Write downloaded zImage to boot partition and repack it properly.
> + *
> + * @param dev_desc MMC device descriptor
> + * @param download_buffer Address to fastboot buffer with zImage in it
> + * @param download_bytes Size of fastboot buffer, in bytes
> + *
> + * @return 0 on success or -1 on error
> + */
> +static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
> +   void *download_buffer,
> +   unsigned int download_bytes)
> +{
> +   u32 hdr_addr;   /* boot image header address 
> */
> +   struct andr_img_hdr *hdr;   /* boot image header */
> +   lbaint_t hdr_sectors;   /* boot image header sectors 
> */
> +   u8 *ramdisk_buffer;
> +   u32 ramdisk_sector_start;
> +   u32 ramdisk_sectors;
> +   u32 kernel_sector_start;
> +   u32 kernel_sectors;
> +   u32 sectors_per_page;
> +   disk_partition_t info;
> +   int res;
> +
> +   puts("Flashing zImage\n");
> +
> +   /* Get boot partition info */
> +   res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, );
> +   if (res < 0) {
> +   error("cannot find boot partition");
> +   fastboot_fail("cannot find boot partition");
> +   return -1;
> +   }
> +
> +   /* Put boot image header in fastboot buffer after downloaded zImage */
> +   hdr_addr = (u32)download_buffer + ALIGN(download_bytes, PAGE_SIZE);
> +   hdr = (struct andr_img_hdr *)hdr_addr;
> +
> +   /* Read boot image header */
> +   hdr_sectors = fb_mmc_get_boot_header(dev_desc, , hdr);
> +   if (hdr_sectors == 0) {
> +   error("unable to read boot image header");

Re: [U-Boot] [PATCH v3] fastboot: Add support for flashing zImage

2017-06-02 Thread Sam Protsenko
On 18 May 2017 at 15:04, Sam Protsenko  wrote:
> This patch adds support for flashing zImage to the Android boot
> partition on eMMC.
>
> Usage:
>
> $ fastboot flash zImage 
>
> It's based on [1].
>
> [1] 
> http://omapzoom.org/?p=repo/u-boot.git;a=commit;h=3393b908c1e848bba3706612cbe50aa8970720b3
>
> Signed-off-by: Sam Protsenko 
> ---
> Changes in v2:
>  - use blk_dread()/blk_dwrite() instead of callbacks from struct blk_desc
>  - fix SPL build warning on DRA7 (check for CONFIG_ANDROID_BOOT_IMAGE)
>
> Changes in v3:
>  - use strncasecmp() to check for "zImage"/"zimage" command
>  - do not add PAGE_ALIGN() macro; use ALIGN() instead
>  - do not include  in android_image.h
>
>  common/fb_mmc.c | 168 
> 
>  1 file changed, 168 insertions(+)
>
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index 866982e41c..2113b6c372 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  /*
>   * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
> @@ -27,6 +29,8 @@
>  #define CONFIG_FASTBOOT_MBR_NAME "mbr"
>  #endif
>
> +#define BOOT_PARTITION_NAME "boot"
> +
>  struct fb_mmc_sparse {
> struct blk_desc *dev_desc;
>  };
> @@ -99,6 +103,163 @@ static void write_raw_image(struct blk_desc *dev_desc, 
> disk_partition_t *info,
> fastboot_okay("");
>  }
>
> +#ifdef CONFIG_ANDROID_BOOT_IMAGE
> +/**
> + * Read Android boot image header from boot partition.
> + *
> + * @param[in] dev_desc MMC device descriptor
> + * @param[in] info Boot partition info
> + * @param[out] hdr Where to store read boot image header
> + *
> + * @return Boot image header sectors count or 0 on error
> + */
> +static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
> +  disk_partition_t *info,
> +  struct andr_img_hdr *hdr)
> +{
> +   ulong sector_size;  /* boot partition sector size */
> +   lbaint_t hdr_sectors;   /* boot image header sectors count */
> +   int res;
> +
> +   /* Calculate boot image sectors count */
> +   sector_size = info->blksz;
> +   hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
> +   if (hdr_sectors == 0) {
> +   error("invalid number of boot sectors: 0");
> +   fastboot_fail("invalid number of boot sectors: 0");
> +   return 0;
> +   }
> +
> +   /* Read the boot image header */
> +   res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
> +   if (res == 0) {
> +   error("cannot read header from boot partition");
> +   fastboot_fail("cannot read header from boot partition");
> +   return 0;
> +   }
> +
> +   /* Check boot header magic string */
> +   res = android_image_check_header(hdr);
> +   if (res != 0) {
> +   error("bad boot image magic");
> +   fastboot_fail("boot partition not initialized");
> +   return 0;
> +   }
> +
> +   return hdr_sectors;
> +}
> +
> +/**
> + * Write downloaded zImage to boot partition and repack it properly.
> + *
> + * @param dev_desc MMC device descriptor
> + * @param download_buffer Address to fastboot buffer with zImage in it
> + * @param download_bytes Size of fastboot buffer, in bytes
> + *
> + * @return 0 on success or -1 on error
> + */
> +static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
> +   void *download_buffer,
> +   unsigned int download_bytes)
> +{
> +   u32 hdr_addr;   /* boot image header address 
> */
> +   struct andr_img_hdr *hdr;   /* boot image header */
> +   lbaint_t hdr_sectors;   /* boot image header sectors 
> */
> +   u8 *ramdisk_buffer;
> +   u32 ramdisk_sector_start;
> +   u32 ramdisk_sectors;
> +   u32 kernel_sector_start;
> +   u32 kernel_sectors;
> +   u32 sectors_per_page;
> +   disk_partition_t info;
> +   int res;
> +
> +   puts("Flashing zImage\n");
> +
> +   /* Get boot partition info */
> +   res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, );
> +   if (res < 0) {
> +   error("cannot find boot partition");
> +   fastboot_fail("cannot find boot partition");
> +   return -1;
> +   }
> +
> +   /* Put boot image header in fastboot buffer after downloaded zImage */
> +   hdr_addr = (u32)download_buffer + ALIGN(download_bytes, PAGE_SIZE);
> +   hdr = (struct andr_img_hdr *)hdr_addr;
> +
> +   /* Read boot image header */
> +   hdr_sectors = fb_mmc_get_boot_header(dev_desc, , hdr);
> +   if (hdr_sectors == 0) {
> +   error("unable to read boot image header");

Re: [U-Boot] [PATCH 4/7] config_fallbacks: add additional fallbacks for fat filesystem

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 05:54:02PM +0530, Sekhar Nori wrote:

> Add fallbacks needed to keep all boards building
> while they are migrated to use Kconfig symbols
> instead of defines in _config.h files for
> FAT filesystem.
> 
> These should eventually go away once Kconfig select
> or imply statements are put in place and duplicated
> defines in _config.h removed.
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


[U-Boot] [PATCH v2] arm: omap: Unify get_device_type() function

2017-06-02 Thread Sam Protsenko
Refactor OMAP3/4/5 code so that we have only one get_device_type()
function for all platforms.

Details:
 - Add ctrl variable for AM33xx and OMAP3 platforms (like it's done for
   OMAP4/5), so we can obtain status register in common way
 - For now ctrl structure for AM33xx/OMAP3 contains only status register
   address
 - Run hw_data_init() in order to assign ctrl to proper structure
 - Remove DEVICE_MASK and DEVICE_GP definitions as they are not used
   (DEVICE_TYPE_MASK and GP_DEVICE are used instead)
 - Guard structs in omap_common.h with #ifndefs, because otherwise
   including omap_common.h in am33xx board files breaks compilation

Buildman script was run for all OMAP boards. Result output:
arm: (for 38/616 boards)
all +352.5
bss -1.4
data +3.5
rodata +300.0
spl/u-boot-spl:all +284.7
spl/u-boot-spl:data +2.2
spl/u-boot-spl:rodata +252.0
spl/u-boot-spl:text +30.5
text +50.4
(no errors to report)

Tested on AM57x EVM and BeagleBoard xM.

Signed-off-by: Sam Protsenko 
---
Changes in v2:
 - fixed crash on OMAP3 (move hw_data_init() from arch_cpu_init_dm()
   to s_init())
 - guard structures in omap_common.h with #ifndefs rather than
   extracting common definitions to omap_am_common.h

 arch/arm/include/asm/arch-am33xx/cpu.h  |  6 --
 arch/arm/include/asm/arch-am33xx/omap.h |  3 +++
 arch/arm/include/asm/arch-omap3/omap.h  |  3 +++
 arch/arm/include/asm/arch-omap4/omap.h  |  1 -
 arch/arm/include/asm/arch-omap5/omap.h  |  1 -
 arch/arm/include/asm/omap_common.h  | 11 ++-
 arch/arm/mach-omap2/Makefile|  1 +
 arch/arm/mach-omap2/am33xx/Makefile |  2 ++
 arch/arm/mach-omap2/am33xx/board.c  |  3 +++
 arch/arm/mach-omap2/am33xx/hw_data.c| 19 +++
 arch/arm/mach-omap2/am33xx/prcm-regs.c  | 15 +++
 arch/arm/mach-omap2/am33xx/sys_info.c   | 10 --
 arch/arm/mach-omap2/hwinit-common.c |  9 -
 arch/arm/mach-omap2/omap3/Makefile  |  2 ++
 arch/arm/mach-omap2/omap3/board.c   |  7 +++
 arch/arm/mach-omap2/omap3/hw_data.c | 19 +++
 arch/arm/mach-omap2/omap3/prcm-regs.c   | 15 +++
 arch/arm/mach-omap2/omap3/sys_info.c|  9 +
 arch/arm/mach-omap2/sysinfo-common.c| 21 +
 board/ti/am335x/board.c |  1 +
 20 files changed, 122 insertions(+), 36 deletions(-)
 create mode 100644 arch/arm/mach-omap2/am33xx/hw_data.c
 create mode 100644 arch/arm/mach-omap2/am33xx/prcm-regs.c
 create mode 100644 arch/arm/mach-omap2/omap3/hw_data.c
 create mode 100644 arch/arm/mach-omap2/omap3/prcm-regs.c
 create mode 100644 arch/arm/mach-omap2/sysinfo-common.c

diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h 
b/arch/arm/include/asm/arch-am33xx/cpu.h
index 8cae291ea0..e8d7d549e8 100644
--- a/arch/arm/include/asm/arch-am33xx/cpu.h
+++ b/arch/arm/include/asm/arch-am33xx/cpu.h
@@ -36,12 +36,6 @@
 #define TCFG_RESET BIT(0)  /* software reset */
 #define TCFG_EMUFREE   BIT(1)  /* behaviour of tmr on debug */
 #define TCFG_IDLEMOD_SHIFT (2) /* power management */
-/* device type */
-#define DEVICE_MASK(BIT(8) | BIT(9) | BIT(10))
-#define TST_DEVICE 0x0
-#define EMU_DEVICE 0x1
-#define HS_DEVICE  0x2
-#define GP_DEVICE  0x3
 
 /* cpu-id for AM43XX AM33XX and TI81XX family */
 #define AM437X 0xB98C
diff --git a/arch/arm/include/asm/arch-am33xx/omap.h 
b/arch/arm/include/asm/arch-am33xx/omap.h
index 3293caaca4..5a1b95c2c0 100644
--- a/arch/arm/include/asm/arch-am33xx/omap.h
+++ b/arch/arm/include/asm/arch-am33xx/omap.h
@@ -41,6 +41,9 @@ struct omap_boot_parameters {
unsigned char boot_device;
unsigned char reset_reason;
 };
+
+#define DEVICE_TYPE_SHIFT  0x8
+#define DEVICE_TYPE_MASK   (0x7 << DEVICE_TYPE_SHIFT)
 #endif
 
 #endif
diff --git a/arch/arm/include/asm/arch-omap3/omap.h 
b/arch/arm/include/asm/arch-omap3/omap.h
index db763e49a3..8933f5489f 100644
--- a/arch/arm/include/asm/arch-omap3/omap.h
+++ b/arch/arm/include/asm/arch-omap3/omap.h
@@ -91,6 +91,9 @@ struct s32ktimer {
unsigned int s32k_cr;   /* 0x10 */
 };
 
+#define DEVICE_TYPE_SHIFT  0x8
+#define DEVICE_TYPE_MASK   (0x7 << DEVICE_TYPE_SHIFT)
+
 #endif /* __ASSEMBLY__ */
 
 #ifndef __ASSEMBLY__
diff --git a/arch/arm/include/asm/arch-omap4/omap.h 
b/arch/arm/include/asm/arch-omap4/omap.h
index b86a776840..1a3ff7dc2f 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -100,7 +100,6 @@ struct s32ktimer {
 
 #define DEVICE_TYPE_SHIFT (0x8)
 #define DEVICE_TYPE_MASK (0x7 << DEVICE_TYPE_SHIFT)
-#define DEVICE_GP 0x3
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/arch/arm/include/asm/arch-omap5/omap.h 

Re: [U-Boot] [linux-sunxi] [PATCH v2] sun50i: h5: Add initial Orangepi Prime support

2017-06-02 Thread Maxime Ripard
On Fri, Jun 02, 2017 at 10:31:48PM +0800, icen...@aosc.io wrote:
> 在 2017-06-01 23:25,Jagan Teki 写道:
> > From: Jagan Teki 
> > 
> > Orangepi Prime is an open-source single-board computer
> > using the Allwinner h5 SOC.
> > 
> > H5 Orangepi Prime has
> > - Quad-core Cortex-A53
> > - 2GB DDR3
> > - Debug TTL UART
> > - 1000M/100M Ethernet RJ45
> > - Three USB 2.0
> > - HDMI
> > - Audio and MIC
> > - Wifi + BT
> > - IR receiver
> > - HDMI
> > - Wifi + BT
> > 
> > Boot from MMC:
> > -
> > U-Boot SPL 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14)
> > DRAM: 2048 MiB
> > Trying to boot from MMC1
> > NOTICE:  BL3-1: Running on H5 (1718) in SRAM A2 (@0x44000)
> > NOTICE:  Configuring SPC Controller
> > NOTICE:  BL3-1: v1.0(debug):aa75c8d
> > NOTICE:  BL3-1: Built : 18:28:27, May 24 2017
> > INFO:BL3-1: Initializing runtime services
> > INFO:BL3-1: Preparing for EL3 exit to normal world
> > INFO:BL3-1: Next image address: 0x4a00, SPSR: 0x3c9
> > 
> > U-Boot 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14 +)
> > Allwinner Technology
> > 
> > CPU:   Allwinner H5 (SUN50I)
> > Model: OrangePi Prime
> > DRAM:  2 GiB
> > MMC:   SUNXI SD/MMC: 0
> > *** Warning - bad CRC, using default environment
> > 
> > In:serial
> > Out:   serial
> > Err:   serial
> > Net:   phy interface7
> > eth0: ethernet@1c3
> > starting USB...
> > USB0:   USB EHCI 1.00
> > USB1:   USB OHCI 1.0
> > scanning bus 0 for devices... 1 USB Device(s) found
> >scanning usb for storage devices... 0 Storage Device(s) found
> > Hit any key to stop autoboot:  0
> > 
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v2:
> > - Drop http link from commit message
> > - Drop CONFIG_CONSOLE_MUX
> 
> Why drop this?
> 
> I think now vidconsole is working on H5...

Because it doesn't make any sense to have it in only one or a fraction
of the boards we support.

This is something the user should choose, and opt in.

Maxime

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


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


Re: [U-Boot] [linux-sunxi] [PATCH v2] sun50i: h5: Add initial Orangepi Prime support

2017-06-02 Thread icenowy

在 2017-06-01 23:25,Jagan Teki 写道:

From: Jagan Teki 

Orangepi Prime is an open-source single-board computer
using the Allwinner h5 SOC.

H5 Orangepi Prime has
- Quad-core Cortex-A53
- 2GB DDR3
- Debug TTL UART
- 1000M/100M Ethernet RJ45
- Three USB 2.0
- HDMI
- Audio and MIC
- Wifi + BT
- IR receiver
- HDMI
- Wifi + BT

Boot from MMC:
-
U-Boot SPL 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14)
DRAM: 2048 MiB
Trying to boot from MMC1
NOTICE:  BL3-1: Running on H5 (1718) in SRAM A2 (@0x44000)
NOTICE:  Configuring SPC Controller
NOTICE:  BL3-1: v1.0(debug):aa75c8d
NOTICE:  BL3-1: Built : 18:28:27, May 24 2017
INFO:BL3-1: Initializing runtime services
INFO:BL3-1: Preparing for EL3 exit to normal world
INFO:BL3-1: Next image address: 0x4a00, SPSR: 0x3c9

U-Boot 2017.05-00662-ga3f4c05-dirty (May 25 2017 - 13:30:14 +)
Allwinner Technology

CPU:   Allwinner H5 (SUN50I)
Model: OrangePi Prime
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:serial
Out:   serial
Err:   serial
Net:   phy interface7
eth0: ethernet@1c3
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0

Signed-off-by: Jagan Teki 
---
Changes for v2:
- Drop http link from commit message
- Drop CONFIG_CONSOLE_MUX


Why drop this?

I think now vidconsole is working on H5...



 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/sun50i-h5-orangepi-prime.dts | 104 
++

 board/sunxi/MAINTAINERS   |   5 ++
 configs/orangepi_prime_defconfig  |  16 +
 4 files changed, 127 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/sun50i-h5-orangepi-prime.dts
 create mode 100644 configs/orangepi_prime_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 82671b3..b8ebd6e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -315,7 +315,8 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \
 dtb-$(CONFIG_MACH_SUN8I_V3S) += \
sun8i-v3s-licheepi-zero.dtb
 dtb-$(CONFIG_MACH_SUN50I_H5) += \
-   sun50i-h5-orangepi-pc2.dtb
+   sun50i-h5-orangepi-pc2.dtb \
+   sun50i-h5-orangepi-prime.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-bananapi-m64.dtb \
sun50i-a64-pine64-plus.dtb \
diff --git a/arch/arm/dts/sun50i-h5-orangepi-prime.dts
b/arch/arm/dts/sun50i-h5-orangepi-prime.dts
new file mode 100644
index 000..67eade7
--- /dev/null
+++ b/arch/arm/dts/sun50i-h5-orangepi-prime.dts
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 Jagan Teki 
+ *
+ * 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 "sun50i-h5.dtsi"
+
+#include 
+
+/ {
+   model = "OrangePi Prime";
+   compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+  

[U-Boot] [PATCH 2/2] rockchip: video: document externally visible functions for rk_vop

2017-06-02 Thread Philipp Tomsich
Documents the externally visible functions shared between the VOP
drivers for the RK3288 and RK3399.

Signed-off-by: Philipp Tomsich 
---

 drivers/video/rockchip/rk_vop.h | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/drivers/video/rockchip/rk_vop.h b/drivers/video/rockchip/rk_vop.h
index f65ac17..84d9d0f 100644
--- a/drivers/video/rockchip/rk_vop.h
+++ b/drivers/video/rockchip/rk_vop.h
@@ -24,8 +24,42 @@ struct rkvop_driverdata {
void (*set_pin_polarity)(struct udevice *, enum vop_modes, u32);
 };
 
+/**
+ * rk_vop_probe() - common probe implementation
+ *
+ * Performs the rk_display_init on each port-subnode until finding a
+ * working port (or returning an error if none of the ports could be
+ * successfully initialised).
+ *
+ * @dev:   device
+ * @return 0 if OK, -ve if something went wrong
+ */
 int rk_vop_probe(struct udevice *dev);
+
+/**
+ * rk_vop_bind() - common bind implementation
+ *
+ * Sets the plat->size field to the amount of memory to be reserved for
+ * the framebuffer: this is always
+ * (32 BPP) x VIDEO_ROCKCHIP_MAX_XRES x VIDEO_ROCKCHIP_MAX_YRES
+ *
+ * @dev:   device
+ * @return 0 (always OK)
+ */
 int rk_vop_bind(struct udevice *dev);
+
+/**
+ * rk_vop_probe_regulators() - probe (autoset + enable) regulators
+ *
+ * Probes a list of regulators by performaing autoset and enable
+ * operations on them.  The list of regulators is an array of string
+ * pointers and any indivudal regulator-probe may fail without
+ * counting as an error.
+ *
+ * @dev:   device
+ * @names: array of string-pointers to regulator names to probe
+ * @cnt:number of elements in the 'names' array
+ */
 void rk_vop_probe_regulators(struct udevice *dev,
 const char * const *names, int cnt);
 
-- 
1.9.1

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


[U-Boot] [PATCH 1/2] rockchip: video: document externally visible functions for rk_hdmi

2017-06-02 Thread Philipp Tomsich
Documents the externally visible functions shared between the HDMI
drivers for the RK3288 and RK3399.

Signed-off-by: Philipp Tomsich 
---

 drivers/video/rockchip/rk_hdmi.h | 44 
 1 file changed, 44 insertions(+)

diff --git a/drivers/video/rockchip/rk_hdmi.h b/drivers/video/rockchip/rk_hdmi.h
index 501ed3a..9e165ae 100644
--- a/drivers/video/rockchip/rk_hdmi.h
+++ b/drivers/video/rockchip/rk_hdmi.h
@@ -23,10 +23,54 @@ struct rk_hdmi_priv {
void *grf;
 };
 
+/**
+ * rk_hdmi_read_edid() - read the attached HDMI/DVI monitor's EDID
+ *
+ * N.B.: The buffer should be large enough to hold 2 EDID blocks, as
+ *   this function calls dw_hdmi_read_edid, which ignores buf_size
+ *   argument and assumes that there's always enough space for 2
+ *   EDID blocks.
+ *
+ * @dev:   device
+ * @buf:   output buffer for the EDID
+ * @buf_size:  number of bytes in the buffer
+ * @return number of bytes read if OK, -ve if something went wrong
+ */
 int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size);
+
+/**
+ * rk_hdmi_probe_regulators() - probe (autoset + enable) regulators
+ *
+ * Probes a list of regulators by performaing autoset and enable
+ * operations on them.  The list of regulators is an array of string
+ * pointers and any indivudal regulator-probe may fail without
+ * counting as an error.
+ *
+ * @dev:   device
+ * @names: array of string-pointers to regulator names to probe
+ * @cnt:number of elements in the 'names' array
+ */
 void rk_hdmi_probe_regulators(struct udevice *dev,
  const char * const *names, int cnt);
+/**
+ * rk_hdmi_ofdata_to_platdata() - common ofdata_to_platdata implementation
+ *
+ * @dev:   device
+ * @return 0 if OK, -ve if something went wrong
+ */
 int rk_hdmi_ofdata_to_platdata(struct udevice *dev);
+
+/**
+ * rk_hdmi_probe() - common probe implementation
+ *
+ * Performs the following, common initialisation steps:
+ * 1. checks for HPD (i.e. a HDMI monitor being attached)
+ * 2. initialises the Designware HDMI core
+ * 3. initialises the Designware HDMI PHY
+ *
+ * @dev:   device
+ * @return 0 if OK, -ve if something went wrong
+ */
 int rk_hdmi_probe(struct udevice *dev);
 
 #endif
-- 
1.9.1

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


Re: [U-Boot] [PATCH RESEND 1/7] fs: fat: add kbuild configuration support

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 05:53:59PM +0530, Sekhar Nori wrote:

> Add Kconfig symbols for various configurations
> supported by FAT filesystem support code.
> 
> CONFIG_SUPPORT_VFAT has been left out since its
> force enabled in include/fat.h and probably
> should get removed at some point.
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH] davinci: omapl138_lcdk: fix tXSNR DDR2 timing value

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 06:07:12PM +0530, Sekhar Nori wrote:

> As per the datasheet[1] available for DDR2 part on board
> the OMAP-L138 LCDK, the tXSNR (exit self refresh to a
> non-read command) is 137.5 ns. This corresponds to a
> value of 20 to be written to T_XSNR register field of
> OMAP-L138's DDR configuration. The DDR2 is at 150 MHz.
> 
> Fix this. The correct value also appears on the initialization
> scripts (called CCS GEL files) available on TI's wiki pages[2]
> 
> [1] 
> http://www.samsung.com/global/business/semiconductor/file/product/ds_k4t1gxx4qf_rev12-0.pdf
> [2] 
> http://processors.wiki.ti.com/index.php/L138/C6748_Development_Kit_(LCDK)#CCS_XML_.26_GEL_Files
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 6/7] board: ti: enable support for writing to fat partition

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 05:54:04PM +0530, Sekhar Nori wrote:

> Enable support for writing to FAT partitions on
> TI's boards.
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 3/7] configs: k2g_evm: make sure config fallbacks take effect

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 05:54:01PM +0530, Sekhar Nori wrote:

> Since config fallbacks contained in include/config_fallbacks.h
> come into k2g_evm.h file through ti_armv7_keystone2.h, it should
> be the last file included.
> 
> Without this, #define of FAT_WRITE when environment is in FAT
> does not happen as the environment location is decided later
> in the file.
> 
> Similar issues can come with other config fallbacks implemented.
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 2/7] configs: k2*_evm: let each board decide env location

2017-06-02 Thread Tom Rini
On Fri, Jun 02, 2017 at 05:54:00PM +0530, Sekhar Nori wrote:

> Not all TI Keystone2 EVMs want environment in NAND flash.
> K2G EVM which has an MMC/SD slot, keep environment in a
> FAT partition on SD card.
> 
> Since ti_armv7_keystone2.h defines environment is in NAND,
> boards which do not follow that have to #undef'ine that
> configuration. This leads to ugly ordering issues around
> where exactly the include of ti_armv7_keystone2.h can come
> in within the k2*_evm.h files.
> 
> Move environment location to config file of each board.
> This should make it easy to change it for any one board
> without affecting all other boards.
> 
> Signed-off-by: Sekhar Nori 

Reviewed-by: Tom Rini 

-- 
Tom


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


  1   2   >