Re: [U-Boot] [UBOOT PATCH 2/2] dm: core: Scan "/firmware" node by default

2018-08-20 Thread Michal Simek
On 17.8.2018 20:03, Simon Glass wrote:
> Hi Michael,
> 
> On 17 August 2018 at 07:22, Michal Simek  wrote:
>> On 17.8.2018 14:49, Simon Glass wrote:
>>> On 10 August 2018 at 02:45, Rajan Vaja  wrote:
 All Linux firmware drivers are put under "/firmware" node
 and it has support to populate "/firmware" node by default.

 u-boot and Linux can share same DTB. In this case, driver
 probe for devices under "/firmware" will not be invoked
 as "/firmware" does not have its own "compatible" property.

 This patch scans "/firmware" node by default like "/clocks".

 Signed-off-by: Rajan Vaja 
 ---
  drivers/core/root.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> Reviewed-by: Simon Glass 
>>>
>>> We should add a firmware device for sandbox.
>>>
>>
>> what to add there?
> 
> It can be any device, but I suggest something simple like a
> demo-shape? Then you can check that it is accessible in a test in
> test/dm/core.c, perhaps.

Rajan: please take a look at it.

Thanks,
Michal

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


[U-Boot] [PATCH] arm64: zynqmp: Handle CONFIG_BOARD_LATE_INIT via Kconfig

2018-08-20 Thread Michal Simek
Disable BOARD_LATE_INIT via Kconfig.

Signed-off-by: Michal Simek 
---

This is correct resolution of BOARD_LATE_INIT for xilinx boards where we
want to disable late init for mini u-boot configurations.

I have took Kconfig fragment description from Ramon.

---
 arch/arm/Kconfig   | 4 ++--
 common/Kconfig | 2 +-
 configs/xilinx_zynqmp_mini_emmc0_defconfig | 1 +
 configs/xilinx_zynqmp_mini_emmc1_defconfig | 1 +
 configs/xilinx_zynqmp_mini_nand_defconfig  | 1 +
 configs/xilinx_zynqmp_mini_qspi_defconfig  | 1 +
 configs/zynq_cse_nand_defconfig| 1 +
 configs/zynq_cse_nor_defconfig | 1 +
 configs/zynq_cse_qspi_defconfig| 1 +
 include/configs/xilinx_zynqmp_mini.h   | 1 -
 include/configs/zynq_cse.h | 1 -
 11 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9f5eaf8591b6..b369a496f5dd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -854,7 +854,6 @@ config ARCH_VF610
 config ARCH_ZYNQ
bool "Xilinx Zynq based platform"
select BOARD_EARLY_INIT_F if WDT
-   select BOARD_LATE_INIT
select CLK
select CLK_ZYNQ
select CPU_V7A
@@ -874,6 +873,7 @@ config ARCH_ZYNQ
select SPL_SEPARATE_BSS if SPL
select SUPPORT_SPL
imply ARCH_EARLY_INIT_R
+   imply BOARD_LATE_INIT
imply CMD_CLK
imply CMD_DM
imply CMD_SPL
@@ -891,7 +891,6 @@ config ARCH_ZYNQMP_R5
 config ARCH_ZYNQMP
bool "Xilinx ZynqMP based platform"
select ARM64
-   select BOARD_LATE_INIT
select CLK
select DM
select DM_SERIAL
@@ -900,6 +899,7 @@ config ARCH_ZYNQMP
select SPL_BOARD_INIT if SPL
select SPL_CLK if SPL
select SUPPORT_SPL
+   imply BOARD_LATE_INIT
imply CMD_DM
imply FAT_WRITE
 
diff --git a/common/Kconfig b/common/Kconfig
index b3d9b3746356..e86bf9dc63ef 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -557,7 +557,7 @@ config VERSION_VARIABLE
  next reset.
 
 config BOARD_LATE_INIT
-   bool
+   bool "Execute Board late init"
help
  Sometimes board require some initialization code that might
  require once the actual init done, example saving board specific env,
diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig 
b/configs/xilinx_zynqmp_mini_emmc0_defconfig
index 5edbba1a4966..1203438ad195 100644
--- a/configs/xilinx_zynqmp_mini_emmc0_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=-1
 CONFIG_SUPPORT_RAW_INITRD=y
+# CONFIG_BOARD_LATE_INIT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_R=y
 # CONFIG_CMDLINE_EDITING is not set
diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig 
b/configs/xilinx_zynqmp_mini_emmc1_defconfig
index 8cb47ce4ccc5..23af0f436e29 100644
--- a/configs/xilinx_zynqmp_mini_emmc1_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc1_defconfig
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=-1
 CONFIG_SUPPORT_RAW_INITRD=y
+# CONFIG_BOARD_LATE_INIT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_R=y
 # CONFIG_CMDLINE_EDITING is not set
diff --git a/configs/xilinx_zynqmp_mini_nand_defconfig 
b/configs/xilinx_zynqmp_mini_nand_defconfig
index afdfcd5d7701..db20a24f562d 100644
--- a/configs/xilinx_zynqmp_mini_nand_defconfig
+++ b/configs/xilinx_zynqmp_mini_nand_defconfig
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=-1
 CONFIG_SUPPORT_RAW_INITRD=y
+# CONFIG_BOARD_LATE_INIT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_R=y
 # CONFIG_CMDLINE_EDITING is not set
diff --git a/configs/xilinx_zynqmp_mini_qspi_defconfig 
b/configs/xilinx_zynqmp_mini_qspi_defconfig
index 9e404bd5f967..9a299e7eafbe 100644
--- a/configs/xilinx_zynqmp_mini_qspi_defconfig
+++ b/configs/xilinx_zynqmp_mini_qspi_defconfig
@@ -10,6 +10,7 @@ CONFIG_DEFAULT_DEVICE_TREE="zynqmp-mini-qspi"
 CONFIG_NR_DRAM_BANKS=1
 # CONFIG_IMAGE_FORMAT_LEGACY is not set
 CONFIG_BOOTDELAY=-1
+# CONFIG_BOARD_LATE_INIT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_AUTO_COMPLETE is not set
diff --git a/configs/zynq_cse_nand_defconfig b/configs/zynq_cse_nand_defconfig
index 32027c491f3e..abd1db7994c0 100644
--- a/configs/zynq_cse_nand_defconfig
+++ b/configs/zynq_cse_nand_defconfig
@@ -7,6 +7,7 @@ CONFIG_SPL=y
 CONFIG_SPL_STACK_R_ADDR=0x20
 CONFIG_SYS_MALLOC_LEN=0x1000
 CONFIG_DEFAULT_DEVICE_TREE="zynq-cse-nand"
+# CONFIG_BOARD_LATE_INIT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_PROMPT="Zynq> "
diff --git a/configs/zynq_cse_nor_defconfig b/configs/zynq_cse_nor_defconfig
index 3052c5b22a2e..51ee193f0005 100644
--- a/configs/zynq_cse_nor_defconfig
+++ b/configs/zynq_cse_nor_defconfig
@@ -8,6 +8,7 @@ CONFIG_SPL_STACK_R_

Re: [U-Boot] [PATCH] pci: Support parsing PCI controller DT subnodes

2018-08-20 Thread Bin Meng
Hi Marek,

On Fri, Aug 17, 2018 at 6:27 PM, Marek Vasut  wrote:
> On 08/17/2018 03:51 AM, Bin Meng wrote:
>> Hi Marek,
>>
>> On Thu, Aug 16, 2018 at 7:47 PM, Marek Vasut  wrote:
>>> On 08/15/2018 01:25 PM, Tom Rini wrote:
 On Wed, Aug 15, 2018 at 06:19:25PM +0800, Bin Meng wrote:
> Hi Marek,
>
> On Wed, Aug 15, 2018 at 5:22 PM, Marek Vasut  
> wrote:
>> On 08/14/2018 11:40 AM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Tue, Aug 14, 2018 at 4:55 PM, Marek Vasut  
>>> wrote:
 On 08/14/2018 03:46 AM, Bin Meng wrote:
> Hi Marek,
>
> On Mon, Aug 13, 2018 at 9:46 PM, Marek Vasut  
> wrote:
>> On 08/13/2018 04:24 AM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Fri, Aug 10, 2018 at 8:38 PM, Marek Vasut 
>>>  wrote:
 On 08/10/2018 02:01 PM, Tom Rini wrote:
> On Wed, Aug 08, 2018 at 09:37:25PM +0200, Marek Vasut wrote:
>> On 08/08/2018 05:32 PM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Wed, Aug 8, 2018 at 10:33 PM, Marek Vasut 
>>>  wrote:
 On 08/08/2018 03:39 PM, Bin Meng wrote:
> Hi Marek,
>
> On Wed, Aug 8, 2018 at 9:24 PM, Marek Vasut 
>  wrote:
>> On 08/08/2018 03:14 PM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Wed, Aug 8, 2018 at 9:03 PM, Marek Vasut 
>>>  wrote:
 The PCI controller can have DT subnodes describing extra 
 properties
 of particular PCI devices, ie. a PHY attached to an EHCI 
 controller
 on a PCI bus. This patch parses those DT subnodes and 
 assigns a node
 to the PCI device instance, so that the driver can extract 
 details
 from that node and ie. configure the PHY using the PHY 
 subsystem.

 Signed-off-by: Marek Vasut 
 Cc: Simon Glass 
 ---
  drivers/pci/pci-uclass.c | 14 ++
  1 file changed, 14 insertions(+)

 diff --git a/drivers/pci/pci-uclass.c 
 b/drivers/pci/pci-uclass.c
 index 46e9c71bdf..306bea0dbf 100644
 --- a/drivers/pci/pci-uclass.c
 +++ b/drivers/pci/pci-uclass.c
 @@ -662,6 +662,8 @@ static int 
 pci_find_and_bind_driver(struct udevice *parent,
 for (id = entry->match;
  id->vendor || id->subvendor || 
 id->class_mask;
  id++) {
 +   ofnode node;
 +
 if (!pci_match_one_id(id, find_id))
 continue;

 @@ -691,6 +693,18 @@ static int 
 pci_find_and_bind_driver(struct udevice *parent,
 goto error;
 debug("%s: Match found: %s\n", 
 __func__, drv->name);
 dev->driver_data = 
 find_id->driver_data;
 +
 +   dev_for_each_subnode(node, parent) 
 {
 +   phys_addr_t df, size;
 +   df = 
 ofnode_get_addr_size(node, "reg", &size);
 +
 +   if (PCI_FUNC(df) == 
 PCI_FUNC(bdf) &&
 +   PCI_DEV(df) == 
 PCI_DEV(bdf)) {
 +   dev->node = node;
 +   break;
 +   }
>>>
>>> The function pci_find_and_bind_driver() is supposed to bind 
>>> devices
>>> that are NOT in the device tree. Adding device tree access 
>>> in this
>>> routine is quite odd. You can add the EHCI controller that 
>>> need such
>>> PHY subnodes in the device tree and there is no need to 
>>> modify
>>> anything I believe. If you are looking for an example, 
>>> please check
>>> pciua

Re: [U-Boot] [U-Boot,v2] Convert CONFIG_BOARD_LATE_INIT to Kconfig

2018-08-20 Thread Marek Vasut
On 08/20/2018 04:42 AM, Tom Rini wrote:
> On Sat, Aug 18, 2018 at 08:18:25PM +0300, Ramon Fried wrote:
> 
>> This converts the remaining board defined
>> CONFIG_BOARD_LATE_INIT to Kconfig.
>>
>> Signed-off-by: Ramon Fried 
>> ---
>> Changes in v2:
>> * Removed config from Kconfig as it already exists on
>>   common/Kconfig.
>> * Changed the commit message.
> 
> OK, I went to apply this and I see where I sent you in the wrong
> direction, sorry.  BOARD_LATE_INIT is something that the boards (or
> SoCs) in question should be select'ing, which is what everything else
> that uses it is doing.  Thanks!

Again, wouldn't it rather make sense to convert the board_late_init to
__weak symbol instead and drop the Kconfig option ?

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


Re: [U-Boot] [PATCH] pci: Support parsing PCI controller DT subnodes

2018-08-20 Thread Marek Vasut
On 08/20/2018 09:18 AM, Bin Meng wrote:
> Hi Marek,
> 
> On Fri, Aug 17, 2018 at 6:27 PM, Marek Vasut  wrote:
>> On 08/17/2018 03:51 AM, Bin Meng wrote:
>>> Hi Marek,
>>>
>>> On Thu, Aug 16, 2018 at 7:47 PM, Marek Vasut  wrote:
 On 08/15/2018 01:25 PM, Tom Rini wrote:
> On Wed, Aug 15, 2018 at 06:19:25PM +0800, Bin Meng wrote:
>> Hi Marek,
>>
>> On Wed, Aug 15, 2018 at 5:22 PM, Marek Vasut  
>> wrote:
>>> On 08/14/2018 11:40 AM, Bin Meng wrote:
 Hi Marek,

 On Tue, Aug 14, 2018 at 4:55 PM, Marek Vasut  
 wrote:
> On 08/14/2018 03:46 AM, Bin Meng wrote:
>> Hi Marek,
>>
>> On Mon, Aug 13, 2018 at 9:46 PM, Marek Vasut  
>> wrote:
>>> On 08/13/2018 04:24 AM, Bin Meng wrote:
 Hi Marek,

 On Fri, Aug 10, 2018 at 8:38 PM, Marek Vasut 
  wrote:
> On 08/10/2018 02:01 PM, Tom Rini wrote:
>> On Wed, Aug 08, 2018 at 09:37:25PM +0200, Marek Vasut wrote:
>>> On 08/08/2018 05:32 PM, Bin Meng wrote:
 Hi Marek,

 On Wed, Aug 8, 2018 at 10:33 PM, Marek Vasut 
  wrote:
> On 08/08/2018 03:39 PM, Bin Meng wrote:
>> Hi Marek,
>>
>> On Wed, Aug 8, 2018 at 9:24 PM, Marek Vasut 
>>  wrote:
>>> On 08/08/2018 03:14 PM, Bin Meng wrote:
 Hi Marek,

 On Wed, Aug 8, 2018 at 9:03 PM, Marek Vasut 
  wrote:
> The PCI controller can have DT subnodes describing extra 
> properties
> of particular PCI devices, ie. a PHY attached to an EHCI 
> controller
> on a PCI bus. This patch parses those DT subnodes and 
> assigns a node
> to the PCI device instance, so that the driver can 
> extract details
> from that node and ie. configure the PHY using the PHY 
> subsystem.
>
> Signed-off-by: Marek Vasut 
> Cc: Simon Glass 
> ---
>  drivers/pci/pci-uclass.c | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/pci/pci-uclass.c 
> b/drivers/pci/pci-uclass.c
> index 46e9c71bdf..306bea0dbf 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -662,6 +662,8 @@ static int 
> pci_find_and_bind_driver(struct udevice *parent,
> for (id = entry->match;
>  id->vendor || id->subvendor || 
> id->class_mask;
>  id++) {
> +   ofnode node;
> +
> if (!pci_match_one_id(id, 
> find_id))
> continue;
>
> @@ -691,6 +693,18 @@ static int 
> pci_find_and_bind_driver(struct udevice *parent,
> goto error;
> debug("%s: Match found: %s\n", 
> __func__, drv->name);
> dev->driver_data = 
> find_id->driver_data;
> +
> +   dev_for_each_subnode(node, 
> parent) {
> +   phys_addr_t df, size;
> +   df = 
> ofnode_get_addr_size(node, "reg", &size);
> +
> +   if (PCI_FUNC(df) == 
> PCI_FUNC(bdf) &&
> +   PCI_DEV(df) == 
> PCI_DEV(bdf)) {
> +   dev->node = node;
> +   break;
> +   }

 The function pci_find_and_bind_driver() is supposed to 
 bind devices
 that are NOT in the device tree. Adding device tree access 
 in this
 routine is quite odd. You can add the EHCI controller that 
 need such
 PHY subnodes in the device tree and there is 

Re: [U-Boot] [U-Boot,v2] Convert CONFIG_BOARD_LATE_INIT to Kconfig

2018-08-20 Thread Michal Simek
On 20.8.2018 10:02, Marek Vasut wrote:
> On 08/20/2018 04:42 AM, Tom Rini wrote:
>> On Sat, Aug 18, 2018 at 08:18:25PM +0300, Ramon Fried wrote:
>>
>>> This converts the remaining board defined
>>> CONFIG_BOARD_LATE_INIT to Kconfig.
>>>
>>> Signed-off-by: Ramon Fried 
>>> ---
>>> Changes in v2:
>>> * Removed config from Kconfig as it already exists on
>>>   common/Kconfig.
>>> * Changed the commit message.
>>
>> OK, I went to apply this and I see where I sent you in the wrong
>> direction, sorry.  BOARD_LATE_INIT is something that the boards (or
>> SoCs) in question should be select'ing, which is what everything else
>> that uses it is doing.  Thanks!
> 
> Again, wouldn't it rather make sense to convert the board_late_init to
> __weak symbol instead and drop the Kconfig option ?
> 

That's not an option for us because we need to enable this functionality
for full targets but not use them for mini configurations which don't
require it and it just wasting our limited space.

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


Re: [U-Boot] [PATCH v2 u-boot 1/2] power: domain: Add the VPU Power Domain driver

2018-08-20 Thread Neil Armstrong
On 16/08/2018 10:15, Beniamino Galvani wrote:
> On Mon, Aug 06, 2018 at 02:49:19PM +0200, Neil Armstrong wrote:
>> The Amlogic Meson SoCs embeds a specific Power Domain dedicated to the
>> Video Processing Unit.
>> This patch implements support for this power domain in preparation of the
>> future support for the Video display support in U-Boot.
>>
>> This driver will depend on changes in the clock driver to handle the setup
>> of the VPU and VAPB clocks configured from DT using assigned-clocks entries.
>>
>> Reviewed-by: Simon Glass 
>> Signed-off-by: Neil Armstrong 
>> ---
>>  drivers/power/domain/Kconfig |   7 ++
>>  drivers/power/domain/Makefile|   1 +
>>  drivers/power/domain/meson-gx-pwrc-vpu.c | 198 
>> +++
>>  3 files changed, 206 insertions(+)
>>  create mode 100644 drivers/power/domain/meson-gx-pwrc-vpu.c
>>
>> diff --git a/drivers/power/domain/Kconfig b/drivers/power/domain/Kconfig
>> index 7cfa761..4618847 100644
>> --- a/drivers/power/domain/Kconfig
>> +++ b/drivers/power/domain/Kconfig
>> @@ -16,6 +16,13 @@ config BCM6328_POWER_DOMAIN
>>Enable support for manipulating BCM6345 power domains via MMIO
>>mapped registers.
>>  
>> +config MESON_GX_VPU_POWER_DOMAIN
>> +bool "Enable Amlogic Meson GX VPU power domain driver"
>> +depends on ARCH_MESON
> 
> Hi,
> 
> since the driver uses syscon_node_to_regmap() I think the Kconfig
> entry should also 'select SYSCON'.

Exact

> 
> Beniamino
> 

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


Re: [U-Boot] [PATCH u-boot 1/3] boards: amlogic: remove ethernet gpio reset code from boards

2018-08-20 Thread Neil Armstrong
On 14/08/2018 15:07, Beniamino Galvani wrote:
> The reset is already handled by the designware driver using
> information from device tree.
> 
> Signed-off-by: Beniamino Galvani 
> ---
>  board/amlogic/nanopi-k2/nanopi-k2.c | 6 --
>  board/amlogic/odroid-c2/odroid-c2.c | 6 --
>  2 files changed, 12 deletions(-)
> 
> diff --git a/board/amlogic/nanopi-k2/nanopi-k2.c 
> b/board/amlogic/nanopi-k2/nanopi-k2.c
> index 339dbb81db..ae29dd6fa4 100644
> --- a/board/amlogic/nanopi-k2/nanopi-k2.c
> +++ b/board/amlogic/nanopi-k2/nanopi-k2.c
> @@ -30,12 +30,6 @@ int misc_init_r(void)
>  
>   meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
>  
> - /* Reset PHY on GPIOZ_14 */
> - clrbits_le32(GX_GPIO_EN(3), BIT(14));
> - clrbits_le32(GX_GPIO_OUT(3), BIT(14));
> - mdelay(10);
> - setbits_le32(GX_GPIO_OUT(3), BIT(14));
> -
>   if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
>   len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
> mac_addr, EFUSE_MAC_SIZE);
> diff --git a/board/amlogic/odroid-c2/odroid-c2.c 
> b/board/amlogic/odroid-c2/odroid-c2.c
> index c47b9ce9cb..2a2755c387 100644
> --- a/board/amlogic/odroid-c2/odroid-c2.c
> +++ b/board/amlogic/odroid-c2/odroid-c2.c
> @@ -30,12 +30,6 @@ int misc_init_r(void)
>  
>   meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
>  
> - /* Reset PHY on GPIOZ_14 */
> - clrbits_le32(GX_GPIO_EN(3), BIT(14));
> - clrbits_le32(GX_GPIO_OUT(3), BIT(14));
> - mdelay(10);
> - setbits_le32(GX_GPIO_OUT(3), BIT(14));
> -
>   if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
>   len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
> mac_addr, EFUSE_MAC_SIZE);
> 


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


Re: [U-Boot] [PATCH u-boot 2/3] boards: amlogic: use common function for environment initialization

2018-08-20 Thread Neil Armstrong
Hi Beniamino,

On 14/08/2018 15:07, Beniamino Galvani wrote:
> Clean up board files by moving the duplicate environment
> initialization to arch code.
> 
> Signed-off-by: Beniamino Galvani 
> ---
>  arch/arm/include/asm/arch-meson/sm.h  |  1 +
>  arch/arm/mach-meson/sm.c  | 27 +++
>  board/amlogic/khadas-vim/khadas-vim.c | 25 +
>  board/amlogic/libretech-cc/libretech-cc.c | 25 +
>  board/amlogic/nanopi-k2/nanopi-k2.c   | 25 +
>  board/amlogic/odroid-c2/odroid-c2.c   | 25 +
>  board/amlogic/p212/p212.c | 25 +
>  7 files changed, 33 insertions(+), 120 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-meson/sm.h 
> b/arch/arm/include/asm/arch-meson/sm.h
> index 83d6441803..db2be38fc5 100644
> --- a/arch/arm/include/asm/arch-meson/sm.h
> +++ b/arch/arm/include/asm/arch-meson/sm.h
> @@ -7,5 +7,6 @@
>  #define __MESON_SM_H__
>  
>  ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size);
> +void meson_init_env_from_efuse(void);
>  
>  #endif /* __MESON_SM_H__ */
> diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
> index 0bba5e4a07..2628591fe6 100644
> --- a/arch/arm/mach-meson/sm.c
> +++ b/arch/arm/mach-meson/sm.c
> @@ -6,6 +6,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -14,6 +15,11 @@
>  #define FN_EFUSE_READ0x8230
>  #define FN_EFUSE_WRITE   0x8231
>  
> +#define EFUSE_SN_OFFSET  20
> +#define EFUSE_SN_SIZE16
> +#define EFUSE_MAC_OFFSET 52
> +#define EFUSE_MAC_SIZE   6
> +
>  static void *shmem_input;
>  static void *shmem_output;
>  
> @@ -54,3 +60,24 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void 
> *buffer, size_t size)
>  
>   return regs.regs[0];
>  }
> +
> +void meson_init_env_from_efuse(void)
> +{
> + static u8 mac[EFUSE_MAC_SIZE];
> + char serial[EFUSE_SN_SIZE];
> + ssize_t len;
> +
> + if (!eth_env_get_enetaddr("ethaddr", mac)) {
> + len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
> +   mac, EFUSE_MAC_SIZE);
> + if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac))
> + eth_env_set_enetaddr("ethaddr", mac);
> + }
> +
> + if (!env_get("serial#")) {
> + len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
> +   EFUSE_SN_SIZE);
> + if (len == EFUSE_SN_SIZE)
> + env_set("serial#", serial);
> + }
> +}
> diff --git a/board/amlogic/khadas-vim/khadas-vim.c 
> b/board/amlogic/khadas-vim/khadas-vim.c
> index 692bf2add3..4483a96761 100644
> --- a/board/amlogic/khadas-vim/khadas-vim.c
> +++ b/board/amlogic/khadas-vim/khadas-vim.c
> @@ -6,18 +6,12 @@
>  
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  
> -#define EFUSE_SN_OFFSET  20
> -#define EFUSE_SN_SIZE16
> -#define EFUSE_MAC_OFFSET 52
> -#define EFUSE_MAC_SIZE   6
> -
>  int board_init(void)
>  {
>   return 0;
> @@ -25,26 +19,9 @@ int board_init(void)
>  
>  int misc_init_r(void)
>  {
> - u8 mac_addr[EFUSE_MAC_SIZE];
> - char serial[EFUSE_SN_SIZE];
> - ssize_t len;
> -
>   meson_gx_eth_init(PHY_INTERFACE_MODE_RMII,
> MESON_GXL_USE_INTERNAL_RMII_PHY);
> -
> - if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
> - len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
> -   mac_addr, EFUSE_MAC_SIZE);
> - if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
> - eth_env_set_enetaddr("ethaddr", mac_addr);
> - }
> -
> - if (!env_get("serial#")) {
> - len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
> -   EFUSE_SN_SIZE);
> - if (len == EFUSE_SN_SIZE)
> - env_set("serial#", serial);
> - }
> + meson_init_env_from_efuse();
>  
>   return 0;
>  }
> diff --git a/board/amlogic/libretech-cc/libretech-cc.c 
> b/board/amlogic/libretech-cc/libretech-cc.c
> index ccab1272c5..86b1d213ff 100644
> --- a/board/amlogic/libretech-cc/libretech-cc.c
> +++ b/board/amlogic/libretech-cc/libretech-cc.c
> @@ -6,18 +6,12 @@
>  
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  
> -#define EFUSE_SN_OFFSET  20
> -#define EFUSE_SN_SIZE16
> -#define EFUSE_MAC_OFFSET 52
> -#define EFUSE_MAC_SIZE   6
> -
>  int board_init(void)
>  {
>   return 0;
> @@ -25,26 +19,9 @@ int board_init(void)
>  
>  int misc_init_r(void)
>  {
> - u8 mac_addr[EFUSE_MAC_SIZE];
> - char serial[EFUSE_SN_SIZE];
> - ssize_t len;
> -
>   meson_gx_eth_init(PHY_INTERFACE_M

Re: [U-Boot] [PATCH v6 27/31] mtd: move mtdparts_init() declaration

2018-08-20 Thread Miquel Raynal
Hi Boris,

Boris Brezillon  wrote on Thu, 16 Aug 2018
18:05:26 +0200:

> On Thu, 16 Aug 2018 17:30:25 +0200
> Miquel Raynal  wrote:
> 
> > mtdparts_init() is called from various source files. It is declared in
> > include/jffs2/load_kernel.h while it has nothing to do with jffs2
> > anymore.
> > 
> > Move its declaration to include/linux/mtd/partitions.h which has way
> > more meaning.  
> 
> Looks like that's not the only change you're doing in this patch.

Wow, my mistake, during rebase it seems I squashed three different
commits. Will fix this in next submission.

Thanks,
Miquèl
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 0/3] Convert fdtdec_setup_memory_banksize() to use livetree

2018-08-20 Thread Jens Wiklander
Hi,

As requested while reviewing
452bc121027d ("fdt: fix fdtdec_setup_memory_banksize()")
heres a patch set converting fdtdec_setup_memory_banksize() to use livetree.

v2:
* Added test code for the new function ofnode_by_prop_value()
* The patch "fdt: fdtdec_setup_memory_banksize() use livetree":
  Reviewed-by: Simon Glass 

Thanks,
Jens

Jens Wiklander (3):
  ofnode: add ofnode_by_prop_value()
  fdt: fdtdec_setup_memory_banksize() use livetree
  test: ofnode: test ofnode_by_prop_value()

 drivers/core/of_access.c | 27 +++
 drivers/core/ofnode.c| 14 
 include/dm/of_access.h   | 16 ++
 include/dm/ofnode.h  | 14 
 lib/fdtdec.c | 46 ++--
 test/dm/ofnode.c | 27 +++
 6 files changed, 119 insertions(+), 25 deletions(-)

-- 
2.17.1

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


[U-Boot] [PATCH v2 1/3] ofnode: add ofnode_by_prop_value()

2018-08-20 Thread Jens Wiklander
Adds ofnode_by_prop_value() to search for nodes with a given property
and value, an ofnode version of fdt_node_offset_by_prop_value().

Signed-off-by: Jens Wiklander 
---
 drivers/core/of_access.c | 27 +++
 drivers/core/ofnode.c| 14 ++
 include/dm/of_access.h   | 16 
 include/dm/ofnode.h  | 14 ++
 4 files changed, 71 insertions(+)

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 0729dfcdb3b8..14c020a687b7 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -376,6 +376,33 @@ struct device_node *of_find_compatible_node(struct 
device_node *from,
return np;
 }
 
+static int of_device_has_prop_value(const struct device_node *device,
+   const char *propname, const void *propval,
+   int proplen)
+{
+   struct property *prop = of_find_property(device, propname, NULL);
+
+   if (!prop || !prop->value || prop->length != proplen)
+   return 0;
+   return !memcmp(prop->value, propval, proplen);
+}
+
+struct device_node *of_find_node_by_prop_value(struct device_node *from,
+  const char *propname,
+  const void *propval, int proplen)
+{
+   struct device_node *np;
+
+   for_each_of_allnodes_from(from, np) {
+   if (of_device_has_prop_value(np, propname, propval, proplen) &&
+   of_node_get(np))
+   break;
+   }
+   of_node_put(from);
+
+   return np;
+}
+
 struct device_node *of_find_node_by_phandle(phandle handle)
 {
struct device_node *np;
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0cfb0fbabb00..a7e192772324 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -777,3 +777,17 @@ ofnode ofnode_by_compatible(ofnode from, const char 
*compat)
gd->fdt_blob, ofnode_to_offset(from), compat));
}
 }
+
+ofnode ofnode_by_prop_value(ofnode from, const char *propname,
+   const void *propval, int proplen)
+{
+   if (of_live_active()) {
+   return np_to_ofnode(of_find_node_by_prop_value(
+   (struct device_node *)ofnode_to_np(from), propname,
+   propval, proplen));
+   } else {
+   return offset_to_ofnode(fdt_node_offset_by_prop_value(
+   gd->fdt_blob, ofnode_to_offset(from),
+   propname, propval, proplen));
+   }
+}
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index dd1abb8e97b4..5ed1a0cdb427 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -193,6 +193,22 @@ static inline struct device_node 
*of_find_node_by_path(const char *path)
 struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compatible);
 
+/**
+ * of_find_node_by_prop_value() - find a node with a given property value
+ *
+ * Find a node based on a property value.
+ * @from: Node to start searching from or NULL. the node you pass will not be
+ * searched, only the next one will; typically, you pass what the previous
+ * call returned.
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ * @return node pointer or NULL if not found
+ */
+struct device_node *of_find_node_by_prop_value(struct device_node *from,
+  const char *propname,
+  const void *propval,
+  int proplen);
 /**
  * of_find_node_by_phandle() - Find a node given a phandle
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index ab36b74c4ca4..c06d77849c73 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -702,6 +702,20 @@ int ofnode_read_resource_byname(ofnode node, const char 
*name,
  */
 ofnode ofnode_by_compatible(ofnode from, const char *compat);
 
+/**
+ * ofnode_by_prop_value() - Find the next node with given property value
+ *
+ * Find the next node after @from that has a @propname with a value
+ * @propval and a length @proplen.
+ *
+ * @from: ofnode to start from (use ofnode_null() to start at the
+ * beginning) @propname: property name to check @propval: property value to
+ * search for @proplen: length of the value in propval @return ofnode
+ * found, or ofnode_null() if none
+ */
+ofnode ofnode_by_prop_value(ofnode from, const char *propname,
+   const void *propval, int proplen);
+
 /**
  * ofnode_for_each_subnode() - iterate over all subnodes of a parent
  *
-- 
2.17.1

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


[U-Boot] [PATCH v2 3/3] test: ofnode: test ofnode_by_prop_value()

2018-08-20 Thread Jens Wiklander
Test ofnode_by_prop_value()

Signed-off-by: Jens Wiklander 
---
 test/dm/ofnode.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 8db1f9857f7d..907d1ddbdb6f 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -15,3 +15,30 @@ static int dm_test_ofnode_compatible(struct unit_test_state 
*uts)
return 0;
 }
 DM_TEST(dm_test_ofnode_compatible, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts)
+{
+   const char propname[] = "compatible";
+   const char propval[] = "denx,u-boot-fdt-test";
+   const char *str;
+   ofnode node = ofnode_null();
+
+   /* Find first matching node, there should be at least one */
+   node = ofnode_by_prop_value(node, propname, propval, sizeof(propval));
+   ut_assert(ofnode_valid(node));
+   str = ofnode_read_string(node, propname);
+   ut_assert(str && !strcmp(str, propval));
+
+   /* Find the rest of the matching nodes */
+   while (true) {
+   node = ofnode_by_prop_value(node, propname, propval,
+   sizeof(propval));
+   if (!ofnode_valid(node))
+   break;
+   str = ofnode_read_string(node, propname);
+   ut_assert(str && !strcmp(str, propval));
+   }
+
+   return 0;
+}
+DM_TEST(dm_test_ofnode_by_prop_value, DM_TESTF_SCAN_FDT);
-- 
2.17.1

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


[U-Boot] [PATCH v2 2/3] fdt: fdtdec_setup_memory_banksize() use livetree

2018-08-20 Thread Jens Wiklander
Converts fdtdec_setup_memory_banksize() to use ofnode functions instead.

Reviewed-by: Simon Glass 
Signed-off-by: Jens Wiklander 
---
 lib/fdtdec.c | 46 +-
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index a208589c48ae..fef2f88f9d10 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -1182,43 +1183,34 @@ int fdtdec_setup_mem_size_base(void)
 
 #if defined(CONFIG_NR_DRAM_BANKS)
 
-static int get_next_memory_node(const void *blob, int startoffset)
+static ofnode get_next_memory_node(ofnode mem)
 {
-   int mem = -1;
-
do {
-   mem = fdt_node_offset_by_prop_value(gd->fdt_blob, mem,
-   "device_type", "memory", 7);
-   } while (!fdtdec_get_is_enabled(blob, mem));
+   mem = ofnode_by_prop_value(mem, "device_type", "memory", 7);
+   } while (ofnode_valid(mem) && !ofnode_is_available(mem));
 
return mem;
 }
 
 int fdtdec_setup_memory_banksize(void)
 {
-   int bank, ret, mem, reg = 0;
-   struct fdt_resource res;
+   int bank, reg = 0;
+   struct resource res;
+   ofnode mem;
 
-   mem = get_next_memory_node(gd->fdt_blob, -1);
-   if (mem < 0) {
-   debug("%s: Missing /memory node\n", __func__);
-   return -EINVAL;
-   }
+   mem = get_next_memory_node(ofnode_null());
+   if (!ofnode_valid(mem))
+   goto missing_node;
 
for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-   ret = fdt_get_resource(gd->fdt_blob, mem, "reg", reg++, &res);
-   if (ret == -FDT_ERR_NOTFOUND) {
+   while (ofnode_read_resource(mem, reg++, &res)) {
reg = 0;
-   mem = get_next_memory_node(gd->fdt_blob, mem);
-   if (mem == -FDT_ERR_NOTFOUND)
-   break;
-
-   ret = fdt_get_resource(gd->fdt_blob, mem, "reg", reg++, 
&res);
-   if (ret == -FDT_ERR_NOTFOUND)
-   break;
-   }
-   if (ret != 0) {
-   return -EINVAL;
+   mem = get_next_memory_node(mem);
+   if (!ofnode_valid(mem)) {
+   if (bank)
+   return 0;
+   goto missing_node;
+   }
}
 
gd->bd->bi_dram[bank].start = (phys_addr_t)res.start;
@@ -1232,6 +1224,10 @@ int fdtdec_setup_memory_banksize(void)
}
 
return 0;
+
+missing_node:
+   debug("%s: Missing /memory node\n", __func__);
+   return -EINVAL;
 }
 #endif
 
-- 
2.17.1

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


Re: [U-Boot] [PATCH] configs: sun7i: Fix to use emmc dts for OLinuXino_MICRO-eMMC

2018-08-20 Thread Maxime Ripard
On Mon, Aug 13, 2018 at 11:04:15PM +0530, Jagan Teki wrote:
> A20 OLinuXino Micro eMMC board has emmc with mmc2 slot
> so use proper dts, sun7i-a20-olinuxino-micro-emmc.dts
> 
> Cc: Stefan Mavrodiev 
> Cc: Hans de Goede 
> Signed-off-by: Jagan Teki 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 45/58] spi: Add Allwinner A31 SPI driver

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:27:02PM +0530, Jagan Teki wrote:
> Add Allwinner sun6i SPI driver for A31, H3/H5 an A64.
> 
> Tested-by: Fahad Sadah 
> Signed-off-by: Jagan Teki 

This has nothing to do in this serie.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [U-Boot, 1/4] env: fat: drop not needed #ifdef CMD_SAVEENV

2018-08-20 Thread Tom Rini
On Tue, Aug 14, 2018 at 11:21:16AM +0200, Christian Gmeiner wrote:

> env_save_ptr(..) macro handles CMD_SAVEENV already.
> 
> Signed-off-by: Christian Gmeiner 
> Reviewed-by: Simon Glass 
> ---
>  env/fat.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/env/fat.c b/env/fat.c
> index 7f74c64dfe..165a11345f 100644
> --- a/env/fat.c
> +++ b/env/fat.c
> @@ -134,7 +134,5 @@ U_BOOT_ENV_LOCATION(fat) = {
>  #ifdef LOADENV
>   .load   = env_fat_load,
>  #endif
> -#ifdef CMD_SAVEENV
>   .save   = env_save_ptr(env_fat_save),
> -#endif

This series breaks a number of platforms (P1022DS_36BIT_NAND,
am43xx_hs_evm, mccmon6_nor to name just 3 out of many).  Please put v2
of this series through a world build (travis-ci is probably easiest).
Thanks!

-- 
Tom


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


Re: [U-Boot] arm: omap: configs: various: Remove references to OMAP34XX_UARTx

2018-08-20 Thread Tom Rini
On Tue, Aug 07, 2018 at 07:28:11AM -0500, Adam Ford wrote:

> Two boards include a reference to ti_omap3_common.h which
> points the UART driver to OMAP34XX_UARTx so the extra define
> should be unnecessary.
> 
> Signed-off-by: Adam Ford 
> ---
>  include/configs/omap3_evm.h | 1 -
>  include/configs/omap3_pandora.h | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
> index 34418309cb..779087a949 100644
> --- a/include/configs/omap3_evm.h
> +++ b/include/configs/omap3_evm.h
> @@ -34,7 +34,6 @@
>  #define CONFIG_REVISION_TAG
>  
>  /* Override OMAP3 serial console configuration */
> -#define CONFIG_SYS_NS16550_COM1 OMAP34XX_UART1
>  
>  /* NAND */
>  #if defined(CONFIG_NAND)
> diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h
> index 68e1d6f82d..1fc40e05ff 100644
> --- a/include/configs/omap3_pandora.h
> +++ b/include/configs/omap3_pandora.h
> @@ -36,7 +36,6 @@
>  #define CONFIG_SYS_NS16550_SERIAL
>  #define CONFIG_SYS_NS16550_REG_SIZE  (-4)
>  #define CONFIG_SYS_NS16550_CLK   V_NS16550_CLK
> -#define CONFIG_SYS_NS16550_COM3  OMAP34XX_UART3
>  
>  /* commands to include */

This results in:
+(omap3_pandora) ../drivers/serial/serial_ns16550.c:31:2: error: #error 
"Console port 3 defined but not configured."
+(omap3_pandora)  #error "Console port 3 defined but not configured."
+(omap3_pandora)   ^
+(omap3_pandora) make[2]: *** [../scripts/Makefile.build:279: 
drivers/serial/serial_ns16550.o] Error 1
+(omap3_pandora) make[1]: *** [Makefile:1373: drivers/serial] Error 2
 
-- 
Tom


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


Re: [U-Boot] [PATCH v3 02/58] reset: Add default request ops

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:19PM +0530, Jagan Teki wrote:
> Missing request ops from respective uclass driver
> generating "synchronous abort" in Allwinner platform,
> may be in arm. So add default request ops and give a
> chance to uclass driver to think whether they really
> need request or not.

I'm not sure why anyone would not want a request operation for a reset
line.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 14/58] musb-new: sunxi: Use CLK and RESET support

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:31PM +0530, Jagan Teki wrote:
> Now clock and reset drivers are available for respective
> SoC's so use clk and reset ops on musb driver.
> 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/usb/musb-new/sunxi.c | 82 +++-
>  1 file changed, 53 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index 9f71b84fd1..440be83f4e 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -16,9 +16,11 @@
>   * This file is part of the Inventra Controller Driver for Linux.
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -78,16 +80,15 @@
>  
>  struct sunxi_musb_config {
>   struct musb_hdrc_config *config;
> - u8 rst_bit;
> - u8 clkgate_bit;
>  };
>  
>  struct sunxi_glue {
>   struct musb_host_data mdata;
> - struct sunxi_ccm_reg *ccm;
>   struct sunxi_musb_config *cfg;
>   struct device dev;
>   struct phy phy;
> + struct clk clocks;
> + struct reset_ctl resets;
>  };
>  #define to_sunxi_glue(d) container_of(d, struct sunxi_glue, dev)
>  
> @@ -291,6 +292,18 @@ static int sunxi_musb_init(struct musb *musb)
>  
>   pr_debug("%s():\n", __func__);
>  
> + ret = clk_enable(&glue->clocks);
> + if (ret) {
> + dev_err(dev, "failed to enable clock\n");
> + return ret;
> + }
> +
> + ret = reset_deassert(&glue->resets);
> + if (ret) {
> + dev_err(dev, "failed to deassert reset\n");
> + return ret;
> + }
> +
>   ret = generic_phy_init(&glue->phy);
>   if (ret) {
>   pr_err("failed to init USB PHY\n");
> @@ -299,17 +312,6 @@ static int sunxi_musb_init(struct musb *musb)
>  
>   musb->isr = sunxi_musb_interrupt;
>  
> - setbits_le32(&glue->ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_USB0));
> - if (glue->cfg->clkgate_bit)
> - setbits_le32(&glue->ccm->ahb_gate0,
> -  BIT(glue->cfg->clkgate_bit));
> -#ifdef CONFIG_SUNXI_GEN_SUN6I
> - setbits_le32(&glue->ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_USB0));
> - if (glue->cfg->rst_bit)
> - setbits_le32(&glue->ccm->ahb_reset0_cfg,
> -  BIT(glue->cfg->rst_bit));
> -#endif
> -
>   USBC_ConfigFIFO_Base();
>   USBC_EnableDpDmPullUp(musb->mregs);
>   USBC_EnableIdPullUp(musb->mregs);
> @@ -339,16 +341,17 @@ static int sunxi_musb_exit(struct musb *musb)
>   }
>   }
>  
> -#ifdef CONFIG_SUNXI_GEN_SUN6I
> - clrbits_le32(&glue->ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_USB0));
> - if (glue->cfg->rst_bit)
> - clrbits_le32(&glue->ccm->ahb_reset0_cfg,
> -  BIT(glue->cfg->rst_bit));
> -#endif
> - clrbits_le32(&glue->ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_USB0));
> - if (glue->cfg->clkgate_bit)
> - clrbits_le32(&glue->ccm->ahb_gate0,
> -  BIT(glue->cfg->clkgate_bit));
> + ret = reset_assert(&glue->resets);
> + if (ret) {
> + dev_err(dev, "failed to deassert reset\n");
> + return ret;
> + }
> +
> + ret = clk_disable(&glue->clocks);
> + if (ret) {
> + dev_err(dev, "failed to enable clock\n");
> + return ret;
> + }
>  
>   return 0;
>  }
> @@ -433,6 +436,7 @@ static int musb_usb_probe(struct udevice *dev)
>   struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
>   struct musb_hdrc_platform_data pdata;
>   void *base = dev_read_addr_ptr(dev);
> + int clock_nb, reset_nb;
>   int ret;
>  
>   if (!base)
> @@ -442,9 +446,31 @@ static int musb_usb_probe(struct udevice *dev)
>   if (!glue->cfg)
>   return -EINVAL;
>  
> - glue->ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
> - if (IS_ERR(glue->ccm))
> - return PTR_ERR(glue->ccm);
> + clock_nb = ofnode_count_phandle_with_args(dev_ofnode(dev), "clocks",
> +   "#clock-cells");
> + if (clock_nb < 0) {
> + dev_err(dev, "failed to get clock phandle(%d)\n", clock_nb);
> + return clock_nb;
> + }

What are you using that variable for?

> + ret = clk_get_by_index(dev, 0, &glue->clocks);
> + if (ret) {
> + dev_err(dev, "failed to get clock 0\n");
> + clk_free(&glue->clocks);
> + }
> +
> + reset_nb = ofnode_count_phandle_with_args(dev_ofnode(dev), "resets",
> +   "#reset-cells");
> + if (reset_nb < 0) {
> + dev_err(dev, "failed to get reset phandle(%d)\n", clock_nb);
> + return reset_nb;
> + }

Ditto.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___

Re: [U-Boot] [PATCH v3 18/58] clk: sunxi: Implement AHB bus MMC clocks

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:35PM +0530, Jagan Teki wrote:
> Implement AHB bus MMC clocks for all Allwinner SoC
> clock drivers via clock map descriptor table.
> 
> Cc: Jaehoon Chung 
> Signed-off-by: Jagan Teki 

That should be merged in the clock driver patches.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 20/58] clk: sunxi: Implement AHB bus MMC resets

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:37PM +0530, Jagan Teki wrote:
> Implement AHB bus MMC resets for all Allwinner SoC
> clock drivers via reset map descriptor table.
> 
> Cc: Jaehoon Chung 
> Signed-off-by: Jagan Teki 

That should be merged in the reset driver patches.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [U-Boot,v2] Convert CONFIG_BOARD_LATE_INIT to Kconfig

2018-08-20 Thread Marek Vasut
On 08/20/2018 10:11 AM, Michal Simek wrote:
> On 20.8.2018 10:02, Marek Vasut wrote:
>> On 08/20/2018 04:42 AM, Tom Rini wrote:
>>> On Sat, Aug 18, 2018 at 08:18:25PM +0300, Ramon Fried wrote:
>>>
 This converts the remaining board defined
 CONFIG_BOARD_LATE_INIT to Kconfig.

 Signed-off-by: Ramon Fried 
 ---
 Changes in v2:
 * Removed config from Kconfig as it already exists on
   common/Kconfig.
 * Changed the commit message.
>>>
>>> OK, I went to apply this and I see where I sent you in the wrong
>>> direction, sorry.  BOARD_LATE_INIT is something that the boards (or
>>> SoCs) in question should be select'ing, which is what everything else
>>> that uses it is doing.  Thanks!
>>
>> Again, wouldn't it rather make sense to convert the board_late_init to
>> __weak symbol instead and drop the Kconfig option ?
>>
> 
> That's not an option for us because we need to enable this functionality
> for full targets but not use them for mini configurations which don't
> require it and it just wasting our limited space.

Then maybe you need a different ifdef for those machines ?

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


Re: [U-Boot] [PATCH v3 19/58] clk: sunxi: Implement direct MMC clocks

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:36PM +0530, Jagan Teki wrote:
> Implement direct MMC clocks for all Allwinner SoC
> clock drivers via clock map descriptor table.
> 
> This includes adding ccu_clk_set_rate function pointer,
> which indeed support CLK set_rate API, so update clock
> handling in sunxi_mmc driver to support both no-dm and dm code.
> 
> Cc: Jaehoon Chung 
> Signed-off-by: Jagan Teki 
> ---
>  arch/arm/include/asm/arch-sunxi/ccu.h | 10 +
>  drivers/clk/sunxi/clk_a10.c   |  5 +++
>  drivers/clk/sunxi/clk_a10s.c  |  6 +++
>  drivers/clk/sunxi/clk_a23.c   |  6 +++
>  drivers/clk/sunxi/clk_a31.c   |  5 +++
>  drivers/clk/sunxi/clk_a64.c   |  4 ++
>  drivers/clk/sunxi/clk_a83t.c  |  4 ++
>  drivers/clk/sunxi/clk_h3.c|  4 ++
>  drivers/clk/sunxi/clk_r40.c   |  4 ++
>  drivers/clk/sunxi/clk_sunxi.c | 19 +
>  drivers/clk/sunxi/clk_v3s.c   |  4 ++
>  drivers/mmc/sunxi_mmc.c   | 58 +--
>  12 files changed, 107 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-sunxi/ccu.h 
> b/arch/arm/include/asm/arch-sunxi/ccu.h
> index bacd052ef3..4e30ab330c 100644
> --- a/arch/arm/include/asm/arch-sunxi/ccu.h
> +++ b/arch/arm/include/asm/arch-sunxi/ccu.h
> @@ -60,6 +60,16 @@ struct sunxi_clk_priv {
>  
>  extern struct clk_ops sunxi_clk_ops;
>  
> +/**
> + * mmc_clk_set_rate - mmc clock set rate
> + *
> + * @base:clock register base address
> + * @bit: clock bit value
> + * @rate:clock input rate in Hz
> + * @return 0, or -ve error code.
> + */
> +int mmc_clk_set_rate(void *base, u32 bit, ulong rate);
> +
>  /**
>   * sunxi_reset_bind() - reset binding
>   *
> diff --git a/drivers/clk/sunxi/clk_a10.c b/drivers/clk/sunxi/clk_a10.c
> index fb11231dd1..55176bc174 100644
> --- a/drivers/clk/sunxi/clk_a10.c
> +++ b/drivers/clk/sunxi/clk_a10.c
> @@ -23,6 +23,11 @@ static struct ccu_clk_map a10_clks[] = {
>   [CLK_AHB_MMC2]  = { 0x060, BIT(10), NULL },
>   [CLK_AHB_MMC3]  = { 0x060, BIT(11), NULL },
>  
> + [CLK_MMC0]  = { 0x088, BIT(31), &mmc_clk_set_rate },
> + [CLK_MMC1]  = { 0x08c, BIT(31), &mmc_clk_set_rate },
> + [CLK_MMC2]  = { 0x090, BIT(31), &mmc_clk_set_rate },
> + [CLK_MMC3]  = { 0x094, BIT(31), &mmc_clk_set_rate },
> +
>   [CLK_USB_OHCI0] = { 0x0cc, BIT(6), NULL },
>   [CLK_USB_OHCI1] = { 0x0cc, BIT(7), NULL },
>   [CLK_USB_PHY]   = { 0x0cc, BIT(8), NULL },
> diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
> index bc4ae7352b..fbac0ad751 100644
> --- a/drivers/clk/sunxi/clk_a10s.c
> +++ b/drivers/clk/sunxi/clk_a10s.c
> @@ -20,6 +20,12 @@ static struct ccu_clk_map a10s_clks[] = {
>   [CLK_AHB_MMC1]  = { 0x060, BIT(9), NULL },
>   [CLK_AHB_MMC2]  = { 0x060, BIT(10), NULL },
>  
> +#ifdef CONFIG_MMC
> + [CLK_MMC0]  = { 0x088, BIT(31), &mmc_clk_set_rate },
> + [CLK_MMC1]  = { 0x08c, BIT(31), &mmc_clk_set_rate },
> + [CLK_MMC2]  = { 0x090, BIT(31), &mmc_clk_set_rate },
> +#endif
> +

I'm not too sure about the ifdef here. Or at least, we should be
consistent, and if we do it for the MMC, we should do it for all the
SoCs (including the A10), and for all the controllers (including USB,
for example).

> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index 39f15eb423..bf82014a64 100644
> --- a/drivers/mmc/sunxi_mmc.c
> +++ b/drivers/mmc/sunxi_mmc.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -34,6 +35,8 @@ struct sunxi_mmc_priv {
>   struct mmc_config cfg;
>  };
>  
> +bool new_mode;
> +
>  #if !CONFIG_IS_ENABLED(DM_MMC)
>  /* support 4 mmc hosts */
>  struct sunxi_mmc_priv mmc_host[4];
> @@ -95,23 +98,19 @@ static int mmc_resource_init(int sdc_no)
>  }
>  #endif
>  
> -static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
> +int mmc_clk_set_rate(void *base, u32 bit, ulong rate)
>  {
>   unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly;
> - bool new_mode = false;
>   u32 val = 0;
>  
> - if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
> - new_mode = true;
> -

[..]

> +static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
> +{
> +#if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(CLK)
> +#else
> + if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
> + new_mode = true;
> +

I'm not sure why you need the global variable.

The A83t emmc case you have below is caught in this condition, and
therefore, the scope doesn't need to be global.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
__

Re: [U-Boot] [PATCH v3 21/58] reset: Add get reset by name optionally

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:38PM +0530, Jagan Teki wrote:
> Reset is an optional for some controllers with some families
> of CPU's with same SoC where the common IP driver can handle
> to drive the entire SoC families. optional reset get by name
> is useful for those drivers to make common way of reset handling.
> 
> Example, In Allwinner SoC with MMC controllers has no reset
> for Sun4i, 5i, 7i but reset have reset.

So, in other words, it's not needed for the A10, A20 and A13, but
needed for all the others. It's not optional then, it's useless in one
case, and mandatory in the other.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 24/58] arm64: allwinner: dts: h6: fix Pine H64 MMC bus width

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:41PM +0530, Jagan Teki wrote:
> Currently the enabled MMC controllers on Pine H64 do not have bus-width
> set, which make them fall back to 1-bit mode and become quite slow.
> 
> Fix this by add the corresponding bus-width properties.
> 
> Same commit is there in mailing-list, but yet to merge,
> commit fb8971bea0910a3172cd8ce75ccc01b50104ebf7
> Author: Icenowy Zheng 
> Date:   Thu Jul 26 12:41:27 2018 +0800
> 
> arm64: allwinner: dts: h6: fix Pine H64 MMC bus width
> 
> Cc: Icenowy Zheng 
> Signed-off-by: Jagan Teki 

That also has nothing to do with this serie. Please send independant
patches independantly.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 26/58] dm: mmc: sunxi: Add CLK and RESET support

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:43PM +0530, Jagan Teki wrote:
> - debug("mmc %d, cmd %d(0x%08x), arg 0x%08x\n", priv->mmc_no,
> + debug("mmc cmd %d(0x%08x), arg 0x%08x\n",
> cmd->cmdidx, cmdval | cmd->cmdidx, cmd->cmdarg);

Why is priv->mmc_no removed?

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 24/58] arm64: allwinner: dts: h6: fix Pine H64 MMC bus width

2018-08-20 Thread Jagan Teki
On Mon, Aug 20, 2018 at 5:05 PM, Maxime Ripard
 wrote:
> On Sun, Aug 19, 2018 at 07:26:41PM +0530, Jagan Teki wrote:
>> Currently the enabled MMC controllers on Pine H64 do not have bus-width
>> set, which make them fall back to 1-bit mode and become quite slow.
>>
>> Fix this by add the corresponding bus-width properties.
>>
>> Same commit is there in mailing-list, but yet to merge,
>> commit fb8971bea0910a3172cd8ce75ccc01b50104ebf7
>> Author: Icenowy Zheng 
>> Date:   Thu Jul 26 12:41:27 2018 +0800
>>
>> arm64: allwinner: dts: h6: fix Pine H64 MMC bus width
>>
>> Cc: Icenowy Zheng 
>> Signed-off-by: Jagan Teki 
>
> That also has nothing to do with this serie. Please send independant
> patches independantly.

This change required for U-Boot proper to detect mmc0, mmc2 with new
CLK, RESET and DM_MMC
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 45/58] spi: Add Allwinner A31 SPI driver

2018-08-20 Thread Jagan Teki
On Mon, Aug 20, 2018 at 4:48 PM, Maxime Ripard
 wrote:
> On Sun, Aug 19, 2018 at 07:27:02PM +0530, Jagan Teki wrote:
>> Add Allwinner sun6i SPI driver for A31, H3/H5 an A64.
>>
>> Tested-by: Fahad Sadah 
>> Signed-off-by: Jagan Teki 
>
> This has nothing to do in this serie.

Driver require CLK, RESET changes, so added on top of it.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] configs: sun7i: Fix to use emmc dts for OLinuXino_MICRO-eMMC

2018-08-20 Thread Jagan Teki
On Mon, Aug 20, 2018 at 4:40 PM, Maxime Ripard
 wrote:
> On Mon, Aug 13, 2018 at 11:04:15PM +0530, Jagan Teki wrote:
>> A20 OLinuXino Micro eMMC board has emmc with mmc2 slot
>> so use proper dts, sun7i-a20-olinuxino-micro-emmc.dts
>>
>> Cc: Stefan Mavrodiev 
>> Cc: Hans de Goede 
>> Signed-off-by: Jagan Teki 
>
> Acked-by: Maxime Ripard 

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


Re: [U-Boot] [PATCH v3 27/58] fastboot: sunxi: Update fastboot mmc default device

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:44PM +0530, Jagan Teki wrote:
> Usually eMMC is default mmc device for fastboot.
> 
> By enabling DM_MMC, the mmc devices are probed as per
> DT status not with respect to MMC_SUNXI_SLOT_EXTRA in
> U-Boot proper.
> 
> Allwinner SoC has maximum of 4 mmc controllers start from
> mmc0...mmc3 on which mmc2 can be used an eMMC controller
> eventhough mmc3 some boards used as eMMC.
> 
> So, update the default fastboot device as 2 to make the
> standard usage irrespective of DT node status.
> 
> Other corner cases like different device usage, or specific
> mmc node status is not enabled in order in DTS must explicitly
> add config on the specific defconfig file.
> 
> Cc: Olliver Schinagl 
> Cc: Chen-Yu Tsai 
> Signed-off-by: Jagan Teki 

This breaks all existing users, since if DM_MMC isn't set (and it
isn't at the moment), the MMC IDs won't change, and you're changing it
from either 0 or 1 to 2.

Can't we have a DT property instead? It looks much better than having
to deal with a non stable ID in Kconfig.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 29/58] sunxi: Get fat device wrt boot device, 'auto' partition

2018-08-20 Thread Maxime Ripard
On Sun, Aug 19, 2018 at 07:26:46PM +0530, Jagan Teki wrote:
> Setting fat device, partition using CONFIG_ENV_FAT_DEVICE_AND_PART
> via Kconfig option is difficult to maintain since Allwinner
> support more than one mmc controllers with SD and eMMC.
> 
> So, add dynamic function to get the device based on the
> boot device source with 'auto' partition.
> 
> Signed-off-by: Jagan Teki 
> ---
>  arch/arm/mach-sunxi/board.c | 50 +
>  1 file changed, 50 insertions(+)
> 
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index d22a84ea6b..cf174bd0a3 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -10,6 +10,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -253,6 +254,55 @@ uint32_t sunxi_get_boot_device(void)
>   return -1;  /* Never reached */
>  }
>  
> +#if CONFIG_IS_ENABLED(ENV_IS_IN_FAT)
> +static int find_first_sd_device(void)
> +{
> + struct mmc *mmc;
> + int i;
> +
> + for (i = 0; (mmc = find_mmc_device(i)); i++) {
> + if (!mmc_init(mmc) && IS_SD(mmc))
> + return i;
> + }
> +
> + return -ENODEV;
> +}
> +
> +static int find_first_mmc_device(void)
> +{
> + struct mmc *mmc;
> + int i;
> +
> + for (i = 0; (mmc = find_mmc_device(i)); i++) {
> + if (!mmc_init(mmc) && IS_MMC(mmc))
> + return i;
> + }
> +
> + return -ENODEV;
> +}
> +
> +char *get_env_fat_dev_part(void)
> +{
> + int devno, boot_source;
> + static char dev_part[10];
> +
> + boot_source = readb(SPL_ADDR + 0x28);
> + switch (boot_source) {
> + case SUNXI_BOOTED_FROM_MMC0:
> + devno = find_first_sd_device();
> + break;
> + case SUNXI_BOOTED_FROM_MMC2:
> + devno = find_first_mmc_device();
> + break;

You're changing the behaviour from having the environment fixed in a
particular device to detecting that device at runtime.

Again, can't we use a DT property for this instead?

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] sunxi: USB gadget does not work on H2+ after 92a30692b2b18f45aae6fdaae38d67ed03dd2d11

2018-08-20 Thread Nuno Gonçalves
On Sat, Aug 18, 2018 at 8:08 PM Jagan Teki  wrote:
>
> On Sat, Aug 18, 2018 at 11:35 PM, Nuno Gonçalves  wrote:
> > With the basic defconfig + CMD_USB_MASS_STORAGE, I don't get the driver to 
> > load:
> >
> > Controller uninitialized
> > g_dnl_register: failed!, error: -6
> > g_dnl_register failed

This error appears when CONFIG_USB_ETHER is not set. For some reason I
can't enable UMS without USB_ETHER (probably because UMS is not DM
aware).

Regarding the bug reported, it happens because after your commit
USB_EHCI_HCD and USB_KEYBOARD are required to be set.

So, with USB_ETHER, USB_KEYBOARD and USB_EHCI_HCD, it works. Except
for the last not sure if this is as expected.

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


Re: [U-Boot] [PATCH 4/8] pinctrl: renesas: Fix "left shift in type int" undefined behavior

2018-08-20 Thread Marek Vasut
On 08/20/2018 02:00 AM, Eugeniu Rosca wrote:
> Booting R-Car H3-Salvator-X (CONFIG_UBSAN=y) consistently results in:
> 
> =
> UBSAN: Undefined behaviour in drivers/pinctrl/renesas/pfc.c:402:40
> left shift of 1 by 31 places cannot be represented in type 'int'
> =
> =
> UBSAN: Undefined behaviour in drivers/pinctrl/renesas/pfc.c:410:39
> left shift of 1 by 31 places cannot be represented in type 'int'
> =
> 
> While fixing these warnings, convert *all* SH_PFC_PIN_CFG_* definitions
> to use the recommended BIT() macro.
> 
> Fixes: 910df4d07e37 ("pinctrl: rmobile: Add Renesas RCar pincontrol driver")
> Signed-off-by: Eugeniu Rosca 
> ---
>  drivers/pinctrl/renesas/sh_pfc.h | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pinctrl/renesas/sh_pfc.h 
> b/drivers/pinctrl/renesas/sh_pfc.h
> index b98c2f185d26..b58e52bbfbb9 100644
> --- a/drivers/pinctrl/renesas/sh_pfc.h
> +++ b/drivers/pinctrl/renesas/sh_pfc.h
> @@ -21,13 +21,13 @@ enum {
>   PINMUX_TYPE_INPUT,
>  };
>  
> -#define SH_PFC_PIN_CFG_INPUT (1 << 0)
> -#define SH_PFC_PIN_CFG_OUTPUT(1 << 1)
> -#define SH_PFC_PIN_CFG_PULL_UP   (1 << 2)
> -#define SH_PFC_PIN_CFG_PULL_DOWN (1 << 3)
> -#define SH_PFC_PIN_CFG_IO_VOLTAGE(1 << 4)
> -#define SH_PFC_PIN_CFG_DRIVE_STRENGTH(1 << 5)
> -#define SH_PFC_PIN_CFG_NO_GPIO   (1 << 31)
> +#define SH_PFC_PIN_CFG_INPUT BIT(0)
> +#define SH_PFC_PIN_CFG_OUTPUTBIT(1)
> +#define SH_PFC_PIN_CFG_PULL_UP   BIT(2)
> +#define SH_PFC_PIN_CFG_PULL_DOWN BIT(3)
> +#define SH_PFC_PIN_CFG_IO_VOLTAGEBIT(4)
> +#define SH_PFC_PIN_CFG_DRIVE_STRENGTHBIT(5)
> +#define SH_PFC_PIN_CFG_NO_GPIO   BIT(31)

Might make sense to apply the same fix for Linux ?

Acked-by: Marek Vasut 

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


Re: [U-Boot] [PATCH 6/8] net: ravb: Fix "left shift in type int" undefined behavior

2018-08-20 Thread Marek Vasut
On 08/20/2018 02:00 AM, Eugeniu Rosca wrote:
> Running "tftp" on R-Car H3 Salvator-X with CONFIG_UBSAN=y results in:
> 
[...]
>
> =
> UBSAN: Undefined behaviour in drivers/net/ravb.c:205:20
> left shift of 12 by 28 places cannot be represented in type 'int'
> =
> host 192.168.2.11 is alive
> 
> There are two issues behind:
>  - calculating RAVB_DESC_DT_* bitfields
>  - assembling MAC address from its char components
> 
> Fix both.

Nice

Acked-by: Marek Vasut 

btw sh_eth.c might have similar issue .

> Fixes: 8ae51b6f324e ("net: ravb: Add Renesas Ethernet RAVB driver")
> Signed-off-by: Eugeniu Rosca 
[...]
-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 3/3] ARMv8: SError exception handling in PSCI exception vectors

2018-08-20 Thread chee . hong . ang
From: Chee Hong Ang 

Allow platform vendors to handle SError interrupt exceptions from
ARMv8 PSCI exception vectors by overriding this weak function
'plat_error_handler'.

Signed-off-by: Chee Hong Ang 
---
 arch/arm/cpu/armv8/psci.S | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm/cpu/armv8/psci.S b/arch/arm/cpu/armv8/psci.S
index 097f91b..358df8f 100644
--- a/arch/arm/cpu/armv8/psci.S
+++ b/arch/arm/cpu/armv8/psci.S
@@ -236,6 +236,28 @@ handle_sync:
 
b   unhandled_exception
 
+#ifdef CONFIG_ARMV8_EA_EL3_FIRST
+/*
+ * Override this function if custom error handling is
+ * needed for asynchronous aborts
+ */
+ENTRY(plat_error_handler)
+   ret
+ENDPROC(plat_error_handler)
+.weak plat_error_handler
+
+handle_error:
+   bl  psci_get_cpu_id
+   bl  psci_get_cpu_stack_top
+   mov x9, #1
+   msr spsel, x9
+   mov sp, x0
+
+   bl  plat_error_handler  /* Platform specific error handling */
+deadloop:
+   b   deadloop/* Never return */
+#endif
+
.align  11
.globl  el3_exception_vectors
 el3_exception_vectors:
@@ -261,7 +283,11 @@ el3_exception_vectors:
.align  7
b   unhandled_exception /* FIQ, Lower EL using AArch64 */
.align  7
+#ifdef CONFIG_ARMV8_EA_EL3_FIRST
+   b   handle_error/* SError, Lower EL using AArch64 */
+#else
b   unhandled_exception /* SError, Lower EL using AArch64 */
+#endif
.align  7
b   unhandled_exception /* Sync, Lower EL using AArch32 */
.align  7
-- 
2.7.4

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


[U-Boot] [PATCH v1 0/3] Enable all asynchronous abort exceptions taken to EL3

2018-08-20 Thread chee . hong . ang
From: "Ang, Chee Hong" 

This patchset allow PSCI exception vectors to handle all external abort and
SError exception from all exception levels. This will allow EL3 to handle
asynchronous abort exceptions such as ECC DBE (Double Bit Error) taken from
OS running at lower exception level.

Chee Hong Ang (3):
  ARMv8: Enable all asynchronous abort exceptions taken to EL3
  ARMv8: Add EL3 exception handling for ARMv8's Kconfig
  ARMv8: SError exception handling in PSCI exception vectors

 arch/arm/cpu/armv8/Kconfig|  7 +++
 arch/arm/cpu/armv8/psci.S | 26 ++
 arch/arm/include/asm/macro.h  |  4 
 arch/arm/include/asm/system.h |  1 +
 4 files changed, 38 insertions(+)

-- 
2.7.4

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


Re: [U-Boot] Chain loading U-Boot on ARM v7, data abort

2018-08-20 Thread Neil Stainton
On Fri, Aug 17, 2018 at 10:57 AM, Neil Stainton  wrote:

>   New Stack Pointer is: 9ef92ea0
>   Relocation Offset is: 18795000
>   Relocating to 9ff95000, new gd at 9ef92ec0, sp at 9ef92ea0
>   data abort
>   pc : [<87800c5c>]  lr : [<9ff9570c>]
>   sp : 9ef92ea0  ip : 0030 fp : 0017
>   r10: 878538dc  r9 : 9ef92ec0 r8 : 9ffe8e98
>   r7 : 9ef95460  r6 : 8780 r5 : 87800320  r4 : 18795000
>   r3 : 8785c648  r2 : 8785acd0 r1 : 0017  r0 : 18795000
>   Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
>   Code: e20110ff e3510017 1a03 e084 (e5901000) 
>   Resetting CPU ...

I traced this issue to the Arm linker script: The bss and __rel_dyn sections 
intersect. This causes 'load_elf_image_shdr' to clear a portion of the 
__rel_dyn table which in turn causes the 'fixloop' in relocate.S of the chained 
image to fail as it reads zeros instead of valid addresses.

Here's some debug output from load_elf_image_shdr which shows the order the elf 
sections are loaded:

  => bootelf ${loadaddr}
  Loading .text @ 0x8780 (237976 bytes)
  Loading .rodata @ 0x8783a198 (59258 bytes)
  Loading .hash @ 0x87848914 (24 bytes)
  Loading .dtb.init.rodata @ 0x87848930 (31600 bytes)
  Loading .data @ 0x878504a0 (8620 bytes)
  Loading .got.plt @ 0x8785264c (12 bytes)
  Loading .u_boot_list @ 0x87852658 (4040 bytes)
  Loading .efi_runtime @ 0x87853620 (560 bytes)
  Loading .dynsym @ 0x8785c598 (48 bytes)
  Loading .efi_runtime_rel @ 0x87853850 (168 bytes)
  Loading .rel.dyn @ 0x878538f8 (36000 bytes)
  Clearing .bss @ 0x878538f8 (29508 bytes)
  Loading .dynstr @ 0x8785c5c8 (1 bytes)
  Loading .dynamic @ 0x8785c5cc (136 bytes)
  ## Starting application at 0x8780 ...

.bss is being cleared after .rel.dyn is loaded, clobbering it. This can be 
simply fixed by removing the .bss section header from the chained elf file.

To chain a U-Boot generated Arm elf file, I prepare it by removing the .bss 
section and stripping the remaining debug cruft:
  ${CC}objcopy --remove-section .bss u-boot
  ${CC}strip u-boot

then once copied to the target device's memory space (at $loadaddr), I can boot 
it from the U-boot command prompt by entering:
  bootelf ${loadaddr}

This appears to work fine on iMX6ULL at least.

Neil

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


[U-Boot] [PATCH] u-boot: fixup the iommu-map property of fsl-mc node

2018-08-20 Thread Nipun Gupta
The iommu-map property in the fsl-mc node is updated by
valid stream-ids by u-boot. This patch is to fixup this
property for LS208x and LS1088.

Signed-off-by: Nipun Gupta 
---

This patch fixes iommu-map property added for fsl-mc in kernel patch series:
https://patchwork.codeaurora.org/patch/569431/
The kernel series adds iommu-map property for fsl-mc devices and this patch
fixes that property. The patch only prints a debug log if the property is
not found in the kernel.

 .../asm/arch-fsl-layerscape/stream_id_lsch3.h  |  3 ++
 board/freescale/ls1088a/ls1088a.c  |  2 ++
 board/freescale/ls2080a/ls2080a.c  |  2 ++
 board/freescale/ls2080aqds/ls2080aqds.c|  2 ++
 board/freescale/ls2080ardb/ls2080ardb.c|  2 ++
 drivers/net/fsl-mc/mc.c| 34 ++
 include/fsl-mc/fsl_mc.h|  1 +
 7 files changed, 46 insertions(+)

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h 
b/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
index afea9b8..8d002da 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
@@ -35,6 +35,9 @@
  *  -DPAA2
  * -u-boot will allocate a range of stream IDs to be used by the Management
  *  Complex for containers and will set these values in the MC DPC image.
+ * -u-boot will fixup the iommu-map property in the fsl-mc node in the
+ *  device tree (see 
Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+ *  for more info on the msi-map definition)
  * -the MC is responsible for allocating and setting up 'isolation context
  *  IDs (ICIDs) based on the allocated stream IDs for all DPAA2 devices.
  *
diff --git a/board/freescale/ls1088a/ls1088a.c 
b/board/freescale/ls1088a/ls1088a.c
index a0dab6f..517a8ce 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -575,6 +575,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
fdt_fixup_memory_banks(blob, base, size, CONFIG_NR_DRAM_BANKS);
 
+   fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
fsl_fdt_fixup_flash(blob);
 
 #ifdef CONFIG_FSL_MC_ENET
diff --git a/board/freescale/ls2080a/ls2080a.c 
b/board/freescale/ls2080a/ls2080a.c
index 75014fd..698ae1f 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -127,6 +127,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
fdt_fixup_memory_banks(blob, base, size, 2);
 
+   fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
fdt_fixup_board_enet(blob);
 #endif
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c 
b/board/freescale/ls2080aqds/ls2080aqds.c
index c811e99..d336ef8 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -332,6 +332,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
fdt_fixup_memory_banks(blob, base, size, 2);
 
+   fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
fsl_fdt_fixup_dr_usb(blob, bd);
 
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 46b18cf..cf91bc3 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -394,6 +394,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
fdt_fixup_memory_banks(blob, base, size, 2);
 
+   fdt_fsl_mc_fixup_iommu_map_entry(blob);
+
fsl_fdt_fixup_dr_usb(blob, bd);
 
fsl_fdt_fixup_flash(blob);
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 940025a..cb2fbe9 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -278,6 +278,40 @@ static int mc_fixup_dpl_mac_addr(void *blob, int dpmac_id,
 MC_FIXUP_DPL);
 }
 
+void fdt_fsl_mc_fixup_iommu_map_entry(void *blob)
+{
+   u32 *prop;
+   u32 iommu_map[4];
+   int offset;
+   int lenp;
+
+   /* find fsl-mc node */
+   offset = fdt_path_offset(blob, "/soc/fsl-mc");
+   if (offset < 0)
+   offset = fdt_path_offset(blob, "/fsl-mc");
+   if (offset < 0) {
+   printf("%s: fsl-mc: ERR: fsl-mc node not found in DT, err %d\n",
+  __func__, offset);
+   return;
+   }
+
+   prop = fdt_getprop_w(blob, offset, "iommu-map", &lenp);
+   if (!prop) {
+   debug("%s: fsl-mc: ERR: missing iommu-map in fsl-mc bus node\n",
+ __func__);
+   return;
+   }
+
+   iommu_map[0] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_START);
+   iommu_map[1] = *++prop;
+   iommu_map[2] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_START);
+   iommu_map[3] = cpu_to_fdt32(FSL_DPAA2_STREAM_ID_END -
+   FSL_DPAA2_STREAM_ID_START + 1);
+
+   fdt_setprop_inplace(blob, off

[U-Boot] [PATCH v1 2/3] ARMv8: Add EL3 exception handling for ARMv8's Kconfig

2018-08-20 Thread chee . hong . ang
From: Chee Hong Ang 

Kconfig option to allow all External Abort and SError exception
taken to EL3.

Signed-off-by: Chee Hong Ang 
---
 arch/arm/cpu/armv8/Kconfig | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig
index c8bebab..ff42791 100644
--- a/arch/arm/cpu/armv8/Kconfig
+++ b/arch/arm/cpu/armv8/Kconfig
@@ -144,6 +144,13 @@ config ARMV8_PSCI_CPUS_PER_CLUSTER
  A value 0 or no definition of it works for single cluster system.
  System with multi-cluster should difine their own exact value.
 
+config ARMV8_EA_EL3_FIRST
+   bool "External aborts and SError interrupt exception are taken in EL3"
+   default n
+   help
+ Exception handling at all exception levels for External Abort and
+ SError interrupt exception are taken in EL3.
+
 if SYS_HAS_ARMV8_SECURE_BASE
 
 config ARMV8_SECURE_BASE
-- 
2.7.4

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


[U-Boot] [PATCH v1 1/3] ARMv8: Enable all asynchronous abort exceptions taken to EL3

2018-08-20 Thread chee . hong . ang
From: Chee Hong Ang 

Allow EL3 to handle all the External Abort and SError interrupt
exception occur in all exception levels.

Signed-off-by: Chee Hong Ang 
---
 arch/arm/include/asm/macro.h  | 4 
 arch/arm/include/asm/system.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h
index d5a7a8b..bb33b4b 100644
--- a/arch/arm/include/asm/macro.h
+++ b/arch/arm/include/asm/macro.h
@@ -193,6 +193,10 @@ lr .reqx30
SCR_EL3_SMD_DIS | SCR_EL3_RES1 |\
SCR_EL3_NS_EN)
 #endif
+
+#ifdef CONFIG_ARMV8_EA_EL3_FIRST
+   orr \tmp, \tmp, #SCR_EL3_EA_EN
+#endif
msr scr_el3, \tmp
 
/* Return to the EL2_SP2 mode from EL3 */
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index c1f87f9..aed2e3c 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -29,6 +29,7 @@
 #define SCR_EL3_HCE_EN (1 << 8)  /* Hypervisor Call enable  */
 #define SCR_EL3_SMD_DIS(1 << 7)  /* Secure Monitor Call 
disable */
 #define SCR_EL3_RES1   (3 << 4)  /* Reserved, RES1  */
+#define SCR_EL3_EA_EN  (1 << 3)  /* External aborts taken to EL3*/
 #define SCR_EL3_NS_EN  (1 << 0)  /* EL0 and EL1 in Non-scure state  */
 
 /*
-- 
2.7.4

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


Re: [U-Boot] env: Merge Rockchip, Sunxi, Zynq and ZynqMP

2018-08-20 Thread Tom Rini
On Mon, Aug 20, 2018 at 08:42:07AM +0200, Michal Simek wrote:

> On 19.8.2018 21:14, Tom Rini wrote:
> > On Thu, Jul 19, 2018 at 08:45:45AM +0200, Michal Simek wrote:
> > 
> >> There is no reason to have the same Kconfig options for different SoCs
> >> separately. The patch is merging them together.
> >>
> >> Signed-off-by: Michal Simek 
> >> Acked-by: Maxime Ripard 
> > 
> > After doing a little work around the ENV_IS_NOWHERE parts and
> > size-testing, applied to u-boot/master, thanks!
> 
> I expect you forget to push.

Sadly the sync out to the public side of git.denx.de is lagging behind again.

-- 
Tom


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


Re: [U-Boot] [U-Boot,v2] Convert CONFIG_BOARD_LATE_INIT to Kconfig

2018-08-20 Thread Tom Rini
On Mon, Aug 20, 2018 at 10:02:29AM +0200, Marek Vasut wrote:
> On 08/20/2018 04:42 AM, Tom Rini wrote:
> > On Sat, Aug 18, 2018 at 08:18:25PM +0300, Ramon Fried wrote:
> > 
> >> This converts the remaining board defined
> >> CONFIG_BOARD_LATE_INIT to Kconfig.
> >>
> >> Signed-off-by: Ramon Fried 
> >> ---
> >> Changes in v2:
> >> * Removed config from Kconfig as it already exists on
> >>   common/Kconfig.
> >> * Changed the commit message.
> > 
> > OK, I went to apply this and I see where I sent you in the wrong
> > direction, sorry.  BOARD_LATE_INIT is something that the boards (or
> > SoCs) in question should be select'ing, which is what everything else
> > that uses it is doing.  Thanks!
> 
> Again, wouldn't it rather make sense to convert the board_late_init to
> __weak symbol instead and drop the Kconfig option ?

Despite being what I thought was the only fan of weak functions left,
no, this hook isn't nearly widely used enough to justify being used that
way.

-- 
Tom


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


[U-Boot] [PATCH] board: sunxi: Remove unused local variables

2018-08-20 Thread Jagan Teki
variables buf from board_mmc_init, and ret from misc_init_r
were unused on the functions, so remove it.

Signed-off-by: Jagan Teki 
---
 board/sunxi/board.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 857d5ff010..d1d7f9f400 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -503,7 +503,6 @@ static void mmc_pinmux_setup(int sdc)
 int board_mmc_init(bd_t *bis)
 {
__maybe_unused struct mmc *mmc0, *mmc1;
-   __maybe_unused char buf[512];
 
mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
@@ -759,7 +758,6 @@ static void setup_environment(const void *fdt)
 
 int misc_init_r(void)
 {
-   __maybe_unused int ret;
uint boot;
 
env_set("fel_booted", NULL);
-- 
2.18.0.321.gffc6fa0e3

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


[U-Boot] [PATCH] dts: mvebu: mcbin: drop redundant SD slot node

2018-08-20 Thread Baruch Siach
Commit 61dccf73d302 (dts: mvebu: a80x0: Enable SD/eMMC interfaces) added
a redundant DT node for SD card slot. Drop it.

Cc: Konstantin Porotchkin 
Signed-off-by: Baruch Siach 
---
 arch/arm/dts/armada-8040-mcbin.dts | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/dts/armada-8040-mcbin.dts 
b/arch/arm/dts/armada-8040-mcbin.dts
index 08f1d7df69aa..f912596c2cde 100644
--- a/arch/arm/dts/armada-8040-mcbin.dts
+++ b/arch/arm/dts/armada-8040-mcbin.dts
@@ -154,14 +154,6 @@
status = "okay";
 };
 
-/* uSD slot */
-&cpm_sdhci0 {
-   pinctrl-names = "default";
-   pinctrl-0 = <&cpm_sdhci_pins>;
-   bus-width = <4>;
-   status = "okay";
-};
-
 &cpm_comphy {
/*
 * CP0 Serdes Configuration:
-- 
2.18.0

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


Re: [U-Boot] [PATCH] efi_loader: Rename sections to allow for implicit data

2018-08-20 Thread Alexander Graf

On 08/20/2018 03:43 AM, Bin Meng wrote:

On Fri, Aug 17, 2018 at 8:49 PM, Simon Glass  wrote:

Hi,

On 9 August 2018 at 23:45, Bin Meng  wrote:

Hi Alex,

On Wed, Aug 8, 2018 at 1:16 AM, Alexander Graf  wrote:



Am 07.08.2018 um 18:12 schrieb Simon Glass :

Hi Alex,


On 11 June 2018 at 23:48, Alexander Graf  wrote:
Some times gcc may generate data that is then used within code that may
be part of an efi runtime section. That data could be jump tables,
constants or strings.

In order to make sure we catch these, we need to ensure that gcc emits
them into a section that we can relocate together with all the other
efi runtime bits. This only works if the -ffunction-sections and
-fdata-sections flags are passed and the efi runtime functions are
in a section that starts with ".text".

Up to now we had all efi runtime bits in sections that did not
interfere with the normal section naming scheme, but this forces
us to do so. Hence we need to move the efi_loader text/data/rodata
sections before the global *(.text*) catch-all section.

With this patch in place, we should hopefully have an easier time
to extend the efi runtime functionality in the future.

Signed-off-by: Alexander Graf 
---
arch/arm/config.mk|  4 ++--
arch/arm/cpu/armv8/u-boot.lds | 24 +
arch/arm/cpu/u-boot.lds   | 36 ++-
arch/arm/mach-zynq/u-boot.lds | 36 ++-
arch/riscv/cpu/ax25/u-boot.lds| 26 +-
arch/sandbox/config.mk|  3 +++
arch/sandbox/cpu/u-boot.lds   |  9 
arch/x86/config.mk|  2 +-
arch/x86/cpu/u-boot.lds   | 32 ++-
board/qualcomm/dragonboard410c/u-boot.lds | 17 +--
board/qualcomm/dragonboard820c/u-boot.lds | 24 +
board/ti/am335x/u-boot.lds| 36 ++-
include/efi_loader.h  |  4 ++--
13 files changed, 154 insertions(+), 99 deletions(-)


I missed this at the time, probably thinking the subject made it sound
innocuous. There is no 'sandbox:' tag.

This seems to break sandbox in a pretty strange way:

gdb --args /tmp/crosfw/sandbox/u-boot -D
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/crosfw/sandbox/u-boot...done.
(gdb) r
Starting program: /tmp/crosfw/sandbox/u-boot -D
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x55571520 in open@plt ()
(gdb) up
#1  0x55571e9a in sandbox_read_fdt_from_file ()
at /home/sjg/c/src/third_party/u-boot/files/arch/sandbox/cpu/cpu.c:264
264 fd = os_open(fname, OS_O_RDONLY);
(gdb) print fname
$1 = 0x77ff "/tmp/crosfw/sandbox/u-boot.dtb"
(gdb) q


Also the commit message suggests that this patch changes sandbox to
use --gc-sections, which is not obvious from the subject. I think that
should be a separate commit and in fact it should really be separate
commits for each arch, I think. That might help people notice it...

I only noticed now since the EFI pull request has landed.

Can you try my bss patch really quick? Maybe we're just overwriting gd.

Alex


This patch breaks efi-x86_app_defconfig. The EFI application no longer
boots. I was testing on top of u-boot/master.

If I do:

diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 586e11a..fc119ec 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -24,7 +24,6 @@ endif
  ifeq ($(IS_32BIT),y)
  PLATFORM_CPPFLAGS += -march=i386 -m32
  # TODO: These break on x86_64; need to debug further
-PLATFORM_RELFLAGS += -fdata-sections
  else
  PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
  endif

Then it boots again. Can you please take a look?

Regards,
Bin

Please can we revert the offending patch quickly for the release? I am
not comfortable with the sandbox changes either (data-sections, etc.).


I agree since it's getting close to the release date.


I have a fix ready for you. Will send it out soon. Basically the linker 
scripts only included .bss, not .bss*.



Alex

__

Re: [U-Boot] [PATCH] efi_loader: Rename sections to allow for implicit data

2018-08-20 Thread Alexander Graf

On 08/17/2018 02:49 PM, Simon Glass wrote:

Hi,

On 9 August 2018 at 23:45, Bin Meng  wrote:

Hi Alex,

On Wed, Aug 8, 2018 at 1:16 AM, Alexander Graf  wrote:



Am 07.08.2018 um 18:12 schrieb Simon Glass :

Hi Alex,


On 11 June 2018 at 23:48, Alexander Graf  wrote:
Some times gcc may generate data that is then used within code that may
be part of an efi runtime section. That data could be jump tables,
constants or strings.

In order to make sure we catch these, we need to ensure that gcc emits
them into a section that we can relocate together with all the other
efi runtime bits. This only works if the -ffunction-sections and
-fdata-sections flags are passed and the efi runtime functions are
in a section that starts with ".text".

Up to now we had all efi runtime bits in sections that did not
interfere with the normal section naming scheme, but this forces
us to do so. Hence we need to move the efi_loader text/data/rodata
sections before the global *(.text*) catch-all section.

With this patch in place, we should hopefully have an easier time
to extend the efi runtime functionality in the future.

Signed-off-by: Alexander Graf 
---
arch/arm/config.mk|  4 ++--
arch/arm/cpu/armv8/u-boot.lds | 24 +
arch/arm/cpu/u-boot.lds   | 36 ++-
arch/arm/mach-zynq/u-boot.lds | 36 ++-
arch/riscv/cpu/ax25/u-boot.lds| 26 +-
arch/sandbox/config.mk|  3 +++
arch/sandbox/cpu/u-boot.lds   |  9 
arch/x86/config.mk|  2 +-
arch/x86/cpu/u-boot.lds   | 32 ++-
board/qualcomm/dragonboard410c/u-boot.lds | 17 +--
board/qualcomm/dragonboard820c/u-boot.lds | 24 +
board/ti/am335x/u-boot.lds| 36 ++-
include/efi_loader.h  |  4 ++--
13 files changed, 154 insertions(+), 99 deletions(-)


I missed this at the time, probably thinking the subject made it sound
innocuous. There is no 'sandbox:' tag.

This seems to break sandbox in a pretty strange way:

gdb --args /tmp/crosfw/sandbox/u-boot -D
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/crosfw/sandbox/u-boot...done.
(gdb) r
Starting program: /tmp/crosfw/sandbox/u-boot -D
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x55571520 in open@plt ()
(gdb) up
#1  0x55571e9a in sandbox_read_fdt_from_file ()
at /home/sjg/c/src/third_party/u-boot/files/arch/sandbox/cpu/cpu.c:264
264 fd = os_open(fname, OS_O_RDONLY);
(gdb) print fname
$1 = 0x77ff "/tmp/crosfw/sandbox/u-boot.dtb"
(gdb) q


Also the commit message suggests that this patch changes sandbox to
use --gc-sections, which is not obvious from the subject. I think that
should be a separate commit and in fact it should really be separate
commits for each arch, I think. That might help people notice it...

I only noticed now since the EFI pull request has landed.

Can you try my bss patch really quick? Maybe we're just overwriting gd.

Alex


This patch breaks efi-x86_app_defconfig. The EFI application no longer
boots. I was testing on top of u-boot/master.

If I do:

diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 586e11a..fc119ec 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -24,7 +24,6 @@ endif
  ifeq ($(IS_32BIT),y)
  PLATFORM_CPPFLAGS += -march=i386 -m32
  # TODO: These break on x86_64; need to debug further
-PLATFORM_RELFLAGS += -fdata-sections
  else
  PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
  endif

Then it boots again. Can you please take a look?

Regards,
Bin

Please can we revert the offending patch quickly for the release? I am
not comfortable with the sandbox changes either (data-sections, etc.).
I can not reproduce the sandbox breakage (and travis doesn't seem to 
either, otherwise it would be broken for everyone, no?). Can you give me 
some guidelines on how to reproduce the failures for you and I'll just 
fix it?



Alex

___

Re: [U-Boot] [PATCH] board: sunxi: Remove unused local variables

2018-08-20 Thread Maxime Ripard
On Mon, Aug 20, 2018 at 05:45:47PM +0530, Jagan Teki wrote:
> variables buf from board_mmc_init, and ret from misc_init_r
> were unused on the functions, so remove it.
> 
> Signed-off-by: Jagan Teki 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH] sunxi: disable Pine A64 model detection code on non-A64 SoCs

2018-08-20 Thread Maxime Ripard
Hi!

On Sun, Aug 05, 2018 at 02:55:35AM +0800, Icenowy Zheng wrote:
> The Pine A64 Plus/non-Plus model detection code is now built on all
> 64-bit ARM SoCs, even if the code cannot be triggered when H5/H6 is in
> use.
> 
> Disable them when the SoC is not A64 by use #ifdef to wrap them.
> 
> On GCC 7.3.1 this makes the size of the function reduces 184 bytes, and
> saves a 104 byte strstr() function, then makes SPL on H6 succeed to
> build.
> 
> Signed-off-by: Icenowy Zheng 
> ---
>  board/sunxi/board.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 857d5ff010..4fb0ff2529 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -823,13 +823,14 @@ int board_fit_config_name_match(const char *name)
>   };
>  
>  /* Differentiate the two Pine64 board DTs by their DRAM size. */
> +#ifdef CONFIG_MACH_SUN50I
>   if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) {
>   if ((gd->ram_size > 512 * 1024 * 1024))
>   return !strstr(name, "plus");
>   else
>   return !!strstr(name, "plus");
> - } else {
> - return strcmp(name, cmp_str);
>   }
> +#endif
> + return strcmp(name, cmp_str);

I'd really prefer to have an opt-in option, selected only by the
Pine64, rather than enabling it for all the A64 boards that don't have
any use for that code.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


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


[U-Boot] [PATCH 2/3] x86: Enable -fdata-sections always

2018-08-20 Thread Alexander Graf
We left -fdata-sections disabled for x86_64 before because we encountered
random bugs that were at that time inexplicable.

Turns out this really was just side effects of missing .bss* statements
in the linker scripts. With those fixed, we can enable data sections for all
targets.

Signed-off-by: Alexander Graf 
---
 arch/x86/config.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 586e11a0dd..5b04febd68 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -23,13 +23,11 @@ endif
 
 ifeq ($(IS_32BIT),y)
 PLATFORM_CPPFLAGS += -march=i386 -m32
-# TODO: These break on x86_64; need to debug further
-PLATFORM_RELFLAGS += -fdata-sections
 else
 PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
 endif
 
-PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
+PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
 
 PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions
 PLATFORM_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
-- 
2.12.3

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


[U-Boot] [PATCH 0/3] efi_loader: Fix -fdata-section fallout with bss

2018-08-20 Thread Alexander Graf
While trying to fix efi_loader problems that could only be resolved by enabling
individual function and data sections (commit 7e21fbca26d18 "efi_loader: Rename
sections to allow for implicit data") some cases where .bss was included in
the linker scripts slipped through.

This lead to random breakage when .bss contents were accessed, because the
respective regions were not initialized properly.

With this patch set, all those should be resolved now.


Alex

Alexander Graf (3):
  x86: Include bss subsections in linker script
  x86: Enable -fdata-sections always
  riscv: Include bss subsections in linker script

 arch/riscv/cpu/ax25/u-boot.lds  | 2 +-
 arch/x86/config.mk  | 4 +---
 arch/x86/cpu/u-boot-64.lds  | 2 +-
 arch/x86/cpu/u-boot.lds | 2 +-
 arch/x86/lib/elf_ia32_efi.lds   | 2 +-
 arch/x86/lib/elf_x86_64_efi.lds | 2 +-
 6 files changed, 6 insertions(+), 8 deletions(-)

-- 
2.12.3

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


[U-Boot] [PATCH 1/3] x86: Include bss subsections in linker script

2018-08-20 Thread Alexander Graf
When we build with -fdata-sections we may end up with bss subsections. Our
linker script explicitly lists only a single consecutive bss section though.

Adapt the statement to also include subsections.

This fixes booting efi-x86_app_defconfig.

Signed-off-by: Alexander Graf 
---
 arch/x86/cpu/u-boot-64.lds  | 2 +-
 arch/x86/cpu/u-boot.lds | 2 +-
 arch/x86/lib/elf_ia32_efi.lds   | 2 +-
 arch/x86/lib/elf_x86_64_efi.lds | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds
index 862aa2d35e..98c7f8e9c5 100644
--- a/arch/x86/cpu/u-boot-64.lds
+++ b/arch/x86/cpu/u-boot-64.lds
@@ -95,7 +95,7 @@ SECTIONS
 
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
-   *(.bss)
+   *(.bss*)
*(COM*)
. = ALIGN(4);
__bss_end = .;
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index a1cc19ce4c..a283c290ee 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -94,7 +94,7 @@ SECTIONS
 
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
-   *(.bss)
+   *(.bss*)
*(COM*)
. = ALIGN(4);
__bss_end = .;
diff --git a/arch/x86/lib/elf_ia32_efi.lds b/arch/x86/lib/elf_ia32_efi.lds
index 983fabbc4d..aad61e7f81 100644
--- a/arch/x86/lib/elf_ia32_efi.lds
+++ b/arch/x86/lib/elf_ia32_efi.lds
@@ -46,7 +46,7 @@ SECTIONS
*(.sbss)
*(.scommon)
*(.dynbss)
-   *(.bss)
+   *(.bss*)
*(COMMON)
 
/* U-Boot lists and device tree */
diff --git a/arch/x86/lib/elf_x86_64_efi.lds b/arch/x86/lib/elf_x86_64_efi.lds
index 7cad70a2e4..b436429b33 100644
--- a/arch/x86/lib/elf_x86_64_efi.lds
+++ b/arch/x86/lib/elf_x86_64_efi.lds
@@ -44,7 +44,7 @@ SECTIONS
*(.sbss)
*(.scommon)
*(.dynbss)
-   *(.bss)
+   *(.bss*)
*(COMMON)
*(.rel.local)
 
-- 
2.12.3

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


[U-Boot] [PATCH 3/3] riscv: Include bss subsections in linker script

2018-08-20 Thread Alexander Graf
When we build with -fdata-sections we may end up with bss subsections. Our
linker script explicitly lists only a single consecutive bss section though.

Adapt the statement to also include subsections.

Signed-off-by: Alexander Graf 
---
 arch/riscv/cpu/ax25/u-boot.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/cpu/ax25/u-boot.lds b/arch/riscv/cpu/ax25/u-boot.lds
index 3cc89746b1..c50b9642f1 100644
--- a/arch/riscv/cpu/ax25/u-boot.lds
+++ b/arch/riscv/cpu/ax25/u-boot.lds
@@ -82,7 +82,7 @@ SECTIONS
 
.bss : {
 __bss_start = .;
-*(.bss)
+*(.bss*)
. = ALIGN(4);
__bss_end = .;
}
-- 
2.12.3

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


Re: [U-Boot] [PATCH] board: sunxi: Remove unused local variables

2018-08-20 Thread Jagan Teki
On Mon, Aug 20, 2018 at 5:54 PM, Maxime Ripard
 wrote:
> On Mon, Aug 20, 2018 at 05:45:47PM +0530, Jagan Teki wrote:
>> variables buf from board_mmc_init, and ret from misc_init_r
>> were unused on the functions, so remove it.
>>
>> Signed-off-by: Jagan Teki 
>
> Acked-by: Maxime Ripard 

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


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

2018-08-20 Thread Jagan Teki
Hi Tom, 

Please pull this PR.

thanks,
Jagan.

The following changes since commit f05ebbf47a9dc863ff4bb084649ecb34d728b5f2:

  bcm968380gerg: Add MAINTAINERS file (2018-08-09 11:48:39 -0400)

are available in the Git repository at:

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

for you to fetch changes up to d8024074e43c2a99ecf93d919544d82f69025521:

  board: sunxi: Remove unused local variables (2018-08-20 18:10:43 +0530)


Andre Przywara (1):
  sunxi: A64: fix default DRAM_ODT_EN symbol

Icenowy Zheng (1):
  sunxi: fix sid base address macro name for H6

Jagan Teki (5):
  clk: Kconfig: Ascending order to sub directiory kconfigs
  ARM: dts: sun8i: Update A83T dts(i) files from Linux-v4.18-rc3
  ARM: dts: sun8i: Update R40/V40 dts(i) files from Linux-v4.18-rc3
  configs: sun7i: Fix to use emmc dts for OLinuXino_MICRO-eMMC
  board: sunxi: Remove unused local variables

 arch/arm/dts/axp81x.dtsi  | 169 +
 arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts | 195 -
 arch/arm/dts/sun8i-a83t-bananapi-m3.dts   | 298 +++-
 arch/arm/dts/sun8i-a83t-cubietruck-plus.dts   | 322 +++-
 arch/arm/dts/sun8i-a83t-tbs-a711.dts  | 355 -
 arch/arm/dts/sun8i-a83t.dtsi  | 885 --
 arch/arm/dts/sun8i-r40-bananapi-m2-ultra.dts  | 168 +++-
 arch/arm/dts/sun8i-r40.dtsi   | 303 +++-
 arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts  |  50 ++
 arch/arm/include/asm/arch-sunxi/cpu_sun50i_h6.h   |   2 +-
 arch/arm/mach-sunxi/Kconfig   |   1 -
 board/sunxi/board.c   |   2 -
 configs/A20-OLinuXino_MICRO-eMMC_defconfig|   2 +-
 configs/Bananapi_M2_Ultra_defconfig   |   1 -
 configs/amarula_a64_relic_defconfig   |   1 -
 configs/bananapi_m2_berry_defconfig   |   1 -
 configs/sopine_baseboard_defconfig|   1 -
 drivers/clk/Kconfig   |   8 +-
 include/dt-bindings/clock/sun8i-a83t-ccu.h| 140 
 include/dt-bindings/reset/sun8i-a83t-ccu.h|  98 +++
 20 files changed, 2874 insertions(+), 128 deletions(-)
 create mode 100644 arch/arm/dts/axp81x.dtsi
 create mode 100644 include/dt-bindings/clock/sun8i-a83t-ccu.h
 create mode 100644 include/dt-bindings/reset/sun8i-a83t-ccu.h
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] arm: omap: configs: various: Remove references to OMAP34XX_UARTx

2018-08-20 Thread Adam Ford
On Mon, Aug 20, 2018 at 6:21 AM Tom Rini  wrote:
>
> On Tue, Aug 07, 2018 at 07:28:11AM -0500, Adam Ford wrote:
>
> > Two boards include a reference to ti_omap3_common.h which
> > points the UART driver to OMAP34XX_UARTx so the extra define
> > should be unnecessary.
> >
> > Signed-off-by: Adam Ford 
> > ---
> >  include/configs/omap3_evm.h | 1 -
> >  include/configs/omap3_pandora.h | 1 -
> >  2 files changed, 2 deletions(-)
> >
> > diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
> > index 34418309cb..779087a949 100644
> > --- a/include/configs/omap3_evm.h
> > +++ b/include/configs/omap3_evm.h
> > @@ -34,7 +34,6 @@
> >  #define CONFIG_REVISION_TAG
> >
> >  /* Override OMAP3 serial console configuration */
> > -#define CONFIG_SYS_NS16550_COM1 OMAP34XX_UART1
> >
> >  /* NAND */
> >  #if defined(CONFIG_NAND)
> > diff --git a/include/configs/omap3_pandora.h 
> > b/include/configs/omap3_pandora.h
> > index 68e1d6f82d..1fc40e05ff 100644
> > --- a/include/configs/omap3_pandora.h
> > +++ b/include/configs/omap3_pandora.h
> > @@ -36,7 +36,6 @@
> >  #define CONFIG_SYS_NS16550_SERIAL
> >  #define CONFIG_SYS_NS16550_REG_SIZE  (-4)
> >  #define CONFIG_SYS_NS16550_CLK   V_NS16550_CLK
> > -#define CONFIG_SYS_NS16550_COM3  OMAP34XX_UART3
> >
> >  /* commands to include */
>
> This results in:
> +(omap3_pandora) ../drivers/serial/serial_ns16550.c:31:2: error: #error 
> "Console port 3 defined but not configured."
> +(omap3_pandora)  #error "Console port 3 defined but not configured."
> +(omap3_pandora)   ^
> +(omap3_pandora) make[2]: *** [../scripts/Makefile.build:279: 
> drivers/serial/serial_ns16550.o] Error 1
> +(omap3_pandora) make[1]: *** [Makefile:1373: drivers/serial] Error 2

argh.  I made the assumption that people who include ti_omap3_common.h
migrated to DM.
 I could go back and modify ti_omap3_common.h to wrap
the  CONFIG_SYS_NS16550_COMx entries under #if !defined(DM_SERIAL)
instead of CONFIG_SPL_BUILD

Do you have an opinion?  I may not get back to this before I leave on
my trip, but I can take a look again in 2 weeks when I return.

Wasn't there a requirement that we need to move all boards to support
CONFIG_DM at one point?

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


Re: [U-Boot] [PATCH 1/8] UBSAN: run-time undefined behavior sanity checker

2018-08-20 Thread Eugeniu Rosca
Hi Tom,

On Sun, Aug 19, 2018 at 09:51:32PM -0400, Tom Rini wrote:
> On Mon, Aug 20, 2018 at 02:00:25AM +0200, Eugeniu Rosca wrote:
[..]
> > To enable UBSAN, two prerequisites must be met from Kconfig perspective:
> >  - ARCH has to select CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL
> >  - defconfig has to enable CONFIG_UBSAN
> > 
> > This commit selects CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL for SANDBOX and
> > ARM64 (r8a7795_salvator-x_defconfig is the only tested ARM64 platform).
> > No defconfig changes are expected, since UBSAN is a development (not
> > production) option. With CONFIG_UBSAN disabled, no functional change
> > is expected from this commit.
> > 
> > The size increase of sanbox U-Boot (gcc 8.1.0):
> > $ size u-boot.sandbox.*
> >textdata bss dec hex filename
> > 1234958   80048  291472 1606478  18834e u-boot.sandbox.default
> > 1422710  272240  291472 1986422  1e4f76 u-boot.sandbox.ubsan
> > +187752 +192192   0 +379944
> > 
> > The size increase of H3 Salvator-X U-Boot (aarch64-linux-gnu-gcc 7.2.1):
> > $ size u-boot.r8a7795-salvator-x.*
> >textdata bss dec hex filename
> >  589954   23504  263984  877442   d6382 
> > u-boot.r8a7795-salvator-x.default
> >  810968  103304  263984 1178256  11fa90 u-boot.r8a7795-salvator-x.ubsan
> > +221014  +79800   0 +300814
> 
> Can we re-work this so that there isn't a size increase unless UBSAN is
> enabled?  I ask since I think for a v2 we should be able to say more
> broadly that just about everyone can enable this, but only out of the
> box sandbox should.

Sorry for the confusion. This commit alone does not contribute with any
U-Boot binary size increase. The numbers provided above assume enabling
and disabling CONFIG_UBSAN by hand via menuconfig/defconfig. I could
relocate the numbers to a separate patch updating the sandbox_defconfig,
if UBSAN is wanted there by default. That said, I think the contents of
this commit already complies with your particular request stated above.

> 
> -- 
> Tom

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


Re: [U-Boot] [PATCH 3/8] armv8: mmu: Fix "left shift in type int" undefined behavior

2018-08-20 Thread Eugeniu Rosca
Hi Tom,

On Sun, Aug 19, 2018 at 09:51:42PM -0400, Tom Rini wrote:
> On Mon, Aug 20, 2018 at 02:00:27AM +0200, Eugeniu Rosca wrote:
[..]
> > diff --git a/arch/arm/include/asm/armv8/mmu.h 
> > b/arch/arm/include/asm/armv8/mmu.h
> > index 62d00d15c26d..b2ce13db0d2b 100644
> > --- a/arch/arm/include/asm/armv8/mmu.h
> > +++ b/arch/arm/include/asm/armv8/mmu.h
> > @@ -94,11 +94,11 @@
> >  #define TCR_TG0_4K (0 << 14)
> >  #define TCR_TG0_64K(1 << 14)
> >  #define TCR_TG0_16K(2 << 14)
> > -#define TCR_EPD1_DISABLE   (1 << 23)
> > +#define TCR_EPD1_DISABLE   BIT(23)
> >  
> > -#define TCR_EL1_RSVD   (1 << 31)
> > -#define TCR_EL2_RSVD   (1 << 31 | 1 << 23)
> > -#define TCR_EL3_RSVD   (1 << 31 | 1 << 23)
> > +#define TCR_EL1_RSVD   BIT(31)
> > +#define TCR_EL2_RSVD   (BIT(31) | BIT(23))
> > +#define TCR_EL3_RSVD   (BIT(31) | BIT(23))
> >  
> >  #ifndef __ASSEMBLY__
> >  static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
> 
> For consistency within the file, spell it out as 1UL ?  I don't like
> mixing shifts and BITS in a file, and I really don't like being
> inconsistent, so I'd also be OK with BIT() in all of the bits.

I will use (1UL << i) in v2, unless there is some strong preference
to use BIT() macro. In the latter case, a simple definition like
(7 << N) will require conversion to (BIT(N+2) | BIT(N+1) | BIT(N)),
which looks more complicated to me.

> -- 
> Tom

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


[U-Boot] [PATCH 0/2] socfpga: cleanup files generated for spl

2018-08-20 Thread Dalon Westergreen
These patches add a hex output of the spl image for Stratix10
devices, and remove the sfp mkimage output for Stratix10 devices.
In Stratix10, the spl image is added to the initial FPGA configuration
bitstream.  A hex file is needed to do this. 

Dalon Westergreen (2):
  spl: socfpga: only gen5 devices and arria10 require sfp image
  spl: socfpga: stratix10: add hex file output for spl image

 scripts/Makefile.spl | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

-- 
2.17.1

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


[U-Boot] [PATCH 2/2] spl: socfpga: stratix10: add hex file output for spl image

2018-08-20 Thread Dalon Westergreen
Stratix10 requires a hex image of the spl for boot.  The hex
image is added to the FPGA configuration image and loaded to
the processor memory by the configuration engine.

Signed-off-by: Dalon Westergreen 
---
 scripts/Makefile.spl | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 76d08fd92b..c424f87e6e 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)  += $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)   += $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
 endif
 
 ifdef CONFIG_ARCH_SUNXI
@@ -299,6 +300,15 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j 
.start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
$(call if_changed,objcopy)
 
+ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
+OBJCOPYFLAGS_$(SPL_BIN).hex = -I binary -O ihex --change-addresses 0xffe0
+else
+OBJCOPYFLAGS_$(SPL_BIN).hex = -I binary -O ihex
+endif
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN).bin FORCE
+   $(call if_changed,objcopy)
+
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
-- 
2.17.1

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


[U-Boot] [PATCH 1/2] spl: socfpga: only gen5 devices and arria10 require sfp image

2018-08-20 Thread Dalon Westergreen
Only the Cyclone5/Arria5 and Arria10 devices require the sfp
formated image for booting. This path ensures that the file is
only generated for those devices.

Signed-off-by: Dalon Westergreen 
---
 scripts/Makefile.spl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 252f13826d..76d08fd92b 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -188,7 +188,8 @@ ALL-y   += $(obj)/$(BOARD)-spl.bin
 endif
 
 ifdef CONFIG_ARCH_SOCFPGA
-ALL-y  += $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)  += $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)   += $(obj)/$(SPL_BIN).sfp
 endif
 
 ifdef CONFIG_ARCH_SUNXI
-- 
2.17.1

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


Re: [U-Boot] [PATCH v3 01/10] video: stm32: stm32_ltdc: add bridge to display controller

2018-08-20 Thread Simon Glass
On 17 August 2018 at 08:38, Yannick Fertré  wrote:
>
> Manage a bridge insert between the display controller & a panel.
>
> Signed-off-by: Yannick Fertré 
> ---
>  drivers/video/stm32/stm32_ltdc.c | 143 
> ++-
>  1 file changed, 82 insertions(+), 61 deletions(-)

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


Re: [U-Boot] [PATCH v3 02/10] include: Add new DCS commands in the enum list

2018-08-20 Thread Simon Glass
On 17 August 2018 at 08:38, Yannick Fertré  wrote:
> Adding new DCS commands which are specified in the
> DCS 1.3 spec related to CABC.
>
> Signed-off-by: Yannick Fertré 
> ---
>  include/mipi_display.h | 8 
>  1 file changed, 8 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 v3 24/58] arm64: allwinner: dts: h6: fix Pine H64 MMC bus width

2018-08-20 Thread Maxime Ripard
On Mon, Aug 20, 2018 at 05:09:54PM +0530, Jagan Teki wrote:
> On Mon, Aug 20, 2018 at 5:05 PM, Maxime Ripard
>  wrote:
> > On Sun, Aug 19, 2018 at 07:26:41PM +0530, Jagan Teki wrote:
> >> Currently the enabled MMC controllers on Pine H64 do not have bus-width
> >> set, which make them fall back to 1-bit mode and become quite slow.
> >>
> >> Fix this by add the corresponding bus-width properties.
> >>
> >> Same commit is there in mailing-list, but yet to merge,
> >> commit fb8971bea0910a3172cd8ce75ccc01b50104ebf7
> >> Author: Icenowy Zheng 
> >> Date:   Thu Jul 26 12:41:27 2018 +0800
> >>
> >> arm64: allwinner: dts: h6: fix Pine H64 MMC bus width
> >>
> >> Cc: Icenowy Zheng 
> >> Signed-off-by: Jagan Teki 
> >
> > That also has nothing to do with this serie. Please send independant
> > patches independantly.
> 
> This change required for U-Boot proper to detect mmc0, mmc2 with new
> CLK, RESET and DM_MMC

No, it will work just fine without that patch, no matter if we're
having DM_MMC, RESET or CLK. What we won't have is optimal data rates,
but this doesn't really have anything to do with it.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.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] [PATCH v3 45/58] spi: Add Allwinner A31 SPI driver

2018-08-20 Thread Maxime Ripard
1;5202;0c
On Mon, Aug 20, 2018 at 05:12:20PM +0530, Jagan Teki wrote:
> On Mon, Aug 20, 2018 at 4:48 PM, Maxime Ripard
>  wrote:
> > On Sun, Aug 19, 2018 at 07:27:02PM +0530, Jagan Teki wrote:
> >> Add Allwinner sun6i SPI driver for A31, H3/H5 an A64.
> >>
> >> Tested-by: Fahad Sadah 
> >> Signed-off-by: Jagan Teki 
> >
> > This has nothing to do in this serie.
> 
> Driver require CLK, RESET changes, so added on top of it.

I understand why it has a dependency on this serie, but it doesn't
belong in it. It's far too big to review already to not have an
unrelated patch in the middle of the serie.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


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


[U-Boot] [PATCH] ARM: display5: Remove "factory procedure" from display5 board config

2018-08-20 Thread Lukasz Majewski
This code now is regarded as dead one and hence shall be removed.

Signed-off-by: Lukasz Majewski 

---

 configs/display5_factory_defconfig |  2 +-
 include/configs/display5.h | 22 --
 2 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/configs/display5_factory_defconfig 
b/configs/display5_factory_defconfig
index edb37c3b2f..5962b642b2 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -15,7 +15,7 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run factory"
+CONFIG_BOOTCOMMAND="echo SDP Display5 recovery"
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
diff --git a/include/configs/display5.h b/include/configs/display5.h
index 60777da061..aba4b01d21 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -115,27 +115,6 @@
"name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \
"name=data,size=-,uuid=${uuid_gpt_data}\0"
 
-#define FACTORY_PROCEDURE \
-   "echo '###';" \
-   "echo '# Factory Boot#';" \
-   "echo '###';" \
-   "env default -a;" \
-   "saveenv;" \
-   "gpt write mmc ${mmcdev} ${partitions};" \
-   "run tftp_sf_SPL;" \
-   "run tftp_sf_uboot;" \
-   TFTP_UPDATE_KERNEL \
-   "run tftp_sf_fitImg_SWU;" \
-   "run tftp_sf_initramfs_SWU;" \
-   TFTP_UPDATE_ROOTFS \
-   "echo '###';" \
-   "echo '# END - OK#';" \
-   "echo '###';" \
-   "setenv bootcmd 'env default -a; saveenv; run falcon_setup; reset';" \
-   "setenv boot_os 'n';" \
-   "saveenv;" \
-   "reset;"
-
 #define SWUPDATE_RECOVERY_PROCEDURE \
"echo '###';" \
"echo '# RECOVERY SWUupdate  #';" \
@@ -261,7 +240,6 @@
"bootdelay=1\0" \
"baudrate=115200\0" \
"bootcmd=" CONFIG_BOOTCOMMAND "\0" \
-   "factory=" FACTORY_PROCEDURE "\0" \
"ethact=FEC\0" \
"ethaddr=00:11:B8:01:30:dc\0" \
"ipaddr=192.168.2.130\0" \
-- 
2.11.0

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


[U-Boot] [PATCH v3 00/34] Add support for 1wire protocol and 1wire eeproms

2018-08-20 Thread Eugen Hristev
This is a patch series originally written by Maxime Ripard,
https://lists.denx.de/pipermail/u-boot/2016-November/272138.html

titled:

[U-Boot] [PATCH RESEND 0/9] sunxi: chip: Enable the DIP auto-detection

and reworked to include support for the EEPROMs on the PDAs connected
to the sama xplained boards.

This is the version 3 of the rework, version 1 was titled:
[PATCH 00/20] Add support for 1wire protocol and 1wire eeproms
and version 2 was titled:
[PATCH v2 00/30] Add support for 1wire protocol and 1wire eeproms

It addresses feedback received in the first version and fixes a few bugs
found in the second version.

The patch series adds first a driver for onewire uclass, and onewire over
gpio bitbanging driver. Then it adds a uclass for onewire EEPROMS, and
specific driver for Maxim EEPROMs. I have added some sandbox support,
configuration and device tree for it and for boards sama5d2_xplained,
sama5d3_xplained, sama5d4_xplained, sama5d2_ptc_ek and sama5d27_som1_ek.
Also added common code for PDA detection, as the memory
on the PDAs is connected to the SoC on the onewire bus.

Thanks to everyone for the review and feedback.

Below is a short summary of the commits:

The series adds a w1-uclass driver for the onewire interface u-class.
This is done in patch:
[PATCH v3 01/34] w1: Add 1-Wire uclass

Also, we add a driver for the w1-uclass specific to the onewire over
bitbanged gpio, this is done in patch:
[PATCH v3 02/34] w1: Add 1-Wire gpio driver

Add the bindings documentation in:
[PATCH v3 03/34] dt-bindings: W1: w1-gpio: added bindings for w1-gpio

A uclass driver is added for one wire eeproms, in patch :
[PATCH v3 04/34] W1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs

Connection between memories and the bus is done in the patch:
[PATCH v3 05/34] w1: identify devices with w1-eeprom uclas

Specific driver for the DS24 Maxim EEPROMs is added in the patch:
[PATCH v3 06/34] W1-EEPROM: add support for Maxim DS24 eeprom families

Bindings for the DS24xxx driver added in the patch:
[PATCH v3 07/34] dt-bindings: w1-eeprom: ds24xxx: create bindings

A sandbox driver for a onewire EEPROM is added in patch:
[PATCH v3 08/34] W1-EEPROM: add sandbox driver

Bindings for the sandbox eeprom driver added in patch:
[PATCH v3 09/34] dt-bindings: w1-eeprom: eep_sandbox: create bindings

A command is added for the onewire protocol in patch:
[PATCH v3 10/34] w1: add command for onewire protocol

Pinctrl driver for sandbox was updated to add a new group and function for w1:
[PATCH v3 11/34] pinctrl: sandbox: add gpio onewire w1 group

Add a node in sandbox DT to have a test node for sandbox.
[PATCH v3 12/34] sandbox: DTS: w1: add node for one wire interface on
 GPIO

The defconfig for sandbox is updated to include the drivers:
[PATCH v3 13/34] configs: sandbox: add onewire w1 and sandbox
 eeprom

Configuration for sama5d2 xplained is updated in patch:
[PATCH v3 14/34] configs: sama5d2_xplained: add onewire and eeprom

Configuration for sama5d3 xplained is updated in patch:
[PATCH v3 15/34] configs: sama5d3_xplained: add onewire and eeprom

Configuration for sama5d27_som1_ek is updated in patch:
[PATCH v3 16/34] configs: sama5d27_som1_ek: add onewire and eeprom
 drivers

Configuration for sama5d2 ptc is updated in patch:
[PATCH v3 17/34] configs: sama5d2_ptc_ek: add onewire and eeprom
 drivers

Configuration for sama5d4 xplained is updated in patch:
[PATCH v3 18/34] configs: sama5d4_xplained: add onewire and eeprom
 drivers

Pda detection is added in the common part for atmel boards:
[PATCH v3 19/34] board: atmel: add support for pda detection

Specifically add it for Sama5d2 xplained board in patch:
[PATCH v3 20/34] board: sama5d2_xplained: add pda detect call at init
 time

Specifically add it for Sama5d3 xplained board in patch:
[PATCH v3 21/34] board: sama5d3_xplained: add pda detect call at init
 time

Specifically add it for Sama5d27 som1 ek board in patch:
[PATCH v3 22/34] board: sama5d27_som1_ek: add pda detect call at init
 time

Specifically add it for Sama5d27 ptc ek board in patch:
[PATCH v3 23/34] board: sama5d2_ptc_ek: add pda detect call at init
 time

Specifically add it for Sama5d4 xplained board in patch:
[PATCH v3 24/34] board: sama5d4_xplained: add pda detect call at init
 time

Add support for overlays for sama5d2 xplained config in patch:
[PATCH v3 25/34] configs: sama5d2_xplained: add fdt overlay support

Add support for overlays for sama5d3 xplained config in patch:
[PATCH v3 26/34] configs: sama5d3_xplained: add fdt overlay support

Add support for overlays for sama5d2 ptc ek config in patch:
[PATCH v3 27/34] configs: sama5d2_ptc_ek: add fdt overlay support

Add support for overlays for sama5d2 som1 ek config in patch:
[PATCH v3 28/34] configs: sama5d27_som1_ek: add fdt overlay support

Add support for overlays for sama5d4 xplained config in patch:
[PATCH v3 29/34] configs: sama5d4_xplained: add fdt overlay support

The DT for the SAMA5D2 Soc and xplained is updated to include a onewire node.
T

[U-Boot] [PATCH v3 02/34] w1: Add 1-Wire gpio driver

2018-08-20 Thread Eugen Hristev
From: Maxime Ripard 

Add a bus driver for bitbanging a 1-Wire bus over a GPIO.

Signed-off-by: Maxime Ripard 
[eugen.hris...@microchip.com: fixed some issues]
Signed-off-by: Eugen Hristev 
---
 drivers/w1/Kconfig   |   7 ++
 drivers/w1/Makefile  |   2 +
 drivers/w1/w1-gpio.c | 176 +++
 3 files changed, 185 insertions(+)
 create mode 100644 drivers/w1/w1-gpio.c

diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 64b27c6..d6e0457 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -13,6 +13,13 @@ config W1
 
 if W1
 
+config W1_GPIO
+   bool "Enable 1-wire GPIO bitbanging"
+   default no
+   depends on DM_GPIO
+   help
+ Emulate a 1-wire bus using a GPIO.
+
 endif
 
 endmenu
diff --git a/drivers/w1/Makefile b/drivers/w1/Makefile
index f81693b..7fd8697 100644
--- a/drivers/w1/Makefile
+++ b/drivers/w1/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_W1) += w1-uclass.o
+
+obj-$(CONFIG_W1_GPIO) += w1-gpio.o
diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
new file mode 100644
index 000..5e5d6b3
--- /dev/null
+++ b/drivers/w1/w1-gpio.c
@@ -0,0 +1,176 @@
+/* SPDX-License-Identifier:GPL-2.0+
+ *
+ * Copyright (c) 2015 Free Electrons
+ * Copyright (c) 2015 NextThing Co
+ *
+ * Maxime Ripard 
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#define W1_TIMING_A6
+#define W1_TIMING_B64
+#define W1_TIMING_C60
+#define W1_TIMING_D10
+#define W1_TIMING_E9
+#define W1_TIMING_F55
+#define W1_TIMING_G0
+#define W1_TIMING_H480
+#define W1_TIMING_I70
+#define W1_TIMING_J410
+
+struct w1_gpio_pdata {
+   struct gpio_descgpio;
+   u64 search_id;
+};
+
+static bool w1_gpio_read_bit(struct udevice *dev)
+{
+   struct w1_gpio_pdata *pdata = dev_get_platdata(dev);
+   int val;
+
+   dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_OUT);
+   udelay(W1_TIMING_A);
+
+   dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_IN);
+   udelay(W1_TIMING_E);
+
+   val = dm_gpio_get_value(&pdata->gpio);
+   if (val < 0)
+   debug("error in retrieving GPIO value");
+   udelay(W1_TIMING_F);
+
+   return val;
+}
+
+static u8 w1_gpio_read_byte(struct udevice *dev)
+{
+   int i;
+   u8 ret = 0;
+
+   for (i = 0; i < 8; ++i)
+   ret |= (w1_gpio_read_bit(dev) ? 1 : 0) << i;
+
+   return ret;
+}
+
+static void w1_gpio_write_bit(struct udevice *dev, bool bit)
+{
+   struct w1_gpio_pdata *pdata = dev_get_platdata(dev);
+
+   dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_OUT);
+
+   bit ? udelay(W1_TIMING_A) : udelay(W1_TIMING_C);
+
+   dm_gpio_set_value(&pdata->gpio, 1);
+
+   bit ? udelay(W1_TIMING_B) : udelay(W1_TIMING_D);
+}
+
+static void w1_gpio_write_byte(struct udevice *dev, u8 byte)
+{
+   int i;
+
+   for (i = 0; i < 8; ++i)
+   w1_gpio_write_bit(dev, (byte >> i) & 0x1);
+}
+
+static bool w1_gpio_reset(struct udevice *dev)
+{
+   struct w1_gpio_pdata *pdata = dev_get_platdata(dev);
+   int val;
+
+   /* initiate the reset pulse. first we must pull the bus to low */
+   dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+   udelay(W1_TIMING_G);
+
+   dm_gpio_set_value(&pdata->gpio, 0);
+   /* wait for the specified time with the bus kept low */
+   udelay(W1_TIMING_H);
+
+   /* now we must read the presence pulse */
+   dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_IN);
+   udelay(W1_TIMING_I);
+
+   val = dm_gpio_get_value(&pdata->gpio);
+   if (val < 0)
+   debug("error in retrieving GPIO value");
+
+   /* if nobody pulled the bus down , it means nobody is on the bus */
+   if (val != 0)
+   return 1;
+   /* we have the bus pulled down, let's wait for the specified presence 
time */
+   udelay(W1_TIMING_J);
+
+   /* read again, the other end should leave the bus free */
+   val = dm_gpio_get_value(&pdata->gpio);
+   if (val < 0)
+   debug("error in retrieving GPIO value");
+
+   /* bus is not going up again, so we have an error */
+   if (val != 1)
+   return 1;
+
+   /* all good, presence detected */
+   return 0;
+}
+
+static u8 w1_gpio_triplet(struct udevice *dev, bool bdir)
+{
+   u8 id_bit   = w1_gpio_read_bit(dev);
+   u8 comp_bit = w1_gpio_read_bit(dev);
+   u8 retval;
+
+   if (id_bit && comp_bit)
+   return 0x03;  /* error */
+
+   if (!id_bit && !comp_bit) {
+   /* Both bits are valid, take the direction given */
+   retval = bdir ? 0x04 : 0;
+   } else {
+   /* Only one bit is valid, take that direction */
+   bdir = id_bit;
+   retval = id_bit ? 0x05 : 0x02;
+   }
+
+   w1_gpio_write_bit(dev, bdir);
+   return retval;
+}
+
+static const struct w1_ops w1_gpio_ops = {
+   .read_b

[U-Boot] [PATCH v3 01/34] w1: Add 1-Wire uclass

2018-08-20 Thread Eugen Hristev
From: Maxime Ripard 

We might want to use 1-Wire devices connected on boards such as EEPROMs in
U-Boot.

Provide a framework to be able to do that.

Signed-off-by: Maxime Ripard 
[eugen.hris...@microchip.com: reworked]
Signed-off-by: Eugen Hristev 
---
 drivers/Kconfig|   2 +
 drivers/Makefile   |   1 +
 drivers/w1/Kconfig |  18 
 drivers/w1/Makefile|   1 +
 drivers/w1/w1-uclass.c | 236 +
 include/dm/uclass-id.h |   1 +
 include/w1.h   |  36 
 7 files changed, 295 insertions(+)
 create mode 04 drivers/w1
 create mode 100644 drivers/w1/Kconfig
 create mode 100644 drivers/w1/Makefile
 create mode 100644 drivers/w1/w1-uclass.c
 create mode 100644 include/w1.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 9e21b28..2cae829 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -102,6 +102,8 @@ source "drivers/usb/Kconfig"
 
 source "drivers/video/Kconfig"
 
+source "drivers/w1/Kconfig"
+
 source "drivers/watchdog/Kconfig"
 
 config PHYS_TO_BUS
diff --git a/drivers/Makefile b/drivers/Makefile
index a213ea9..728380b 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -101,6 +101,7 @@ obj-y += input/
 obj-y += soc/
 obj-$(CONFIG_REMOTEPROC) += remoteproc/
 obj-y += thermal/
+obj-$(CONFIG_W1) += w1/
 
 obj-$(CONFIG_MACH_PIC32) += ddr/microchip/
 endif
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
new file mode 100644
index 000..64b27c6
--- /dev/null
+++ b/drivers/w1/Kconfig
@@ -0,0 +1,18 @@
+#
+# W1 subsystem configuration
+#
+
+menu "1-Wire support"
+
+config W1
+   bool "Enable 1-wire controllers support"
+   default no
+   depends on DM
+   help
+ Support for the Dallas 1-Wire bus.
+
+if W1
+
+endif
+
+endmenu
diff --git a/drivers/w1/Makefile b/drivers/w1/Makefile
new file mode 100644
index 000..f81693b
--- /dev/null
+++ b/drivers/w1/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_W1) += w1-uclass.o
diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
new file mode 100644
index 000..44759fe
--- /dev/null
+++ b/drivers/w1/w1-uclass.c
@@ -0,0 +1,236 @@
+// SPDX-License-Identifier:GPL-2.0+
+/*
+ *
+ * Copyright (c) 2015 Free Electrons
+ * Copyright (c) 2015 NextThing Co.
+ * Copyright (c) 2018 Microchip Technology, Inc.
+ *
+ * Maxime Ripard 
+ * Eugen Hristev 
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#define W1_MATCH_ROM   0x55
+#define W1_SKIP_ROM0xcc
+#define W1_SEARCH  0xf0
+
+struct w1_bus {
+   u64 search_id;
+};
+
+static int w1_enumerate(struct udevice *bus)
+{
+   const struct w1_ops *ops = device_get_ops(bus);
+   struct w1_bus *w1 = dev_get_uclass_priv(bus);
+   u64 last_rn, rn = w1->search_id, tmp64;
+   bool last_device = false;
+   int search_bit, desc_bit = 64;
+   int last_zero = -1;
+   u8 triplet_ret = 0;
+   int i;
+
+   if (!ops->reset || !ops->write_byte || !ops->triplet)
+   return -ENOSYS;
+
+   while (!last_device) {
+   last_rn = rn;
+   rn = 0;
+
+   /*
+* Reset bus and all 1-wire device state machines
+* so they can respond to our requests.
+*
+* Return 0 - device(s) present, 1 - no devices present.
+*/
+   if (ops->reset(bus)) {
+   debug("%s: No devices present on the wire.\n",
+ __func__);
+   break;
+   }
+
+   /* Start the search */
+   ops->write_byte(bus, W1_SEARCH);
+   for (i = 0; i < 64; ++i) {
+   /* Determine the direction/search bit */
+   if (i == desc_bit)
+   /* took the 0 path last time, so take the 1 
path */
+   search_bit = 1;
+   else if (i > desc_bit)
+   /* take the 0 path on the next branch */
+   search_bit = 0;
+   else
+   search_bit = ((last_rn >> i) & 0x1);
+
+   /* Read two bits and write one bit */
+   triplet_ret = ops->triplet(bus, search_bit);
+
+   /* quit if no device responded */
+   if ((triplet_ret & 0x03) == 0x03)
+   break;
+
+   /* If both directions were valid, and we took the 0 
path... */
+   if (triplet_ret == 0)
+   last_zero = i;
+
+   /* extract the direction taken & update the device 
number */
+   tmp64 = (triplet_ret >> 2);
+   rn |= (tmp64 << i);
+   }
+
+   /* last device or error, aborting here */
+   if ((triplet_ret & 0x03) == 0x03)
+   last_device = true;
+
+ 

[U-Boot] [PATCH v3 06/34] W1-EEPROM: add support for Maxim DS24 eeprom families

2018-08-20 Thread Eugen Hristev
From: Maxime Ripard 

Add a driver that supports Maxim 1 wire EEPROMs families
DS24B33 and DS2431.
Can be extended for other families as well.

Signed-off-by: Maxime Ripard 
[eugen.hris...@microchip.com: reworked driver]
Signed-off-by: Eugen Hristev 
---
 drivers/w1-eeprom/Kconfig   |  6 +
 drivers/w1-eeprom/Makefile  |  2 ++
 drivers/w1-eeprom/ds24xxx.c | 55 +
 3 files changed, 63 insertions(+)
 create mode 100644 drivers/w1-eeprom/ds24xxx.c

diff --git a/drivers/w1-eeprom/Kconfig b/drivers/w1-eeprom/Kconfig
index d5ddc80..20ec549 100644
--- a/drivers/w1-eeprom/Kconfig
+++ b/drivers/w1-eeprom/Kconfig
@@ -12,6 +12,12 @@ config W1_EEPROM
 
 if W1_EEPROM
 
+config W1_EEPROM_DS24XXX
+   bool "Enable Maxim DS24 families EEPROM support"
+   depends on W1
+   help
+ Maxim DS24 EEPROMs 1-Wire EEPROM support
+
 endif
 
 endmenu
diff --git a/drivers/w1-eeprom/Makefile b/drivers/w1-eeprom/Makefile
index b72950e..3f4aa13 100644
--- a/drivers/w1-eeprom/Makefile
+++ b/drivers/w1-eeprom/Makefile
@@ -1,2 +1,4 @@
 obj-$(CONFIG_W1_EEPROM) += w1-eeprom-uclass.o
 
+obj-$(CONFIG_W1_EEPROM_DS24XXX) += ds24xxx.o
+
diff --git a/drivers/w1-eeprom/ds24xxx.c b/drivers/w1-eeprom/ds24xxx.c
new file mode 100644
index 000..56186e5
--- /dev/null
+++ b/drivers/w1-eeprom/ds24xxx.c
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier:GPL-2.0+
+/*
+ *
+ * Copyright (c) 2015 Free Electrons
+ * Copyright (c) 2015 NextThing Co
+ * Copyright (c) 2018 Microchip Technology, Inc.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define W1_F2D_READ_EEPROM 0xf0
+
+static int ds24xxx_read_buf(struct udevice *dev, unsigned int offset,
+   u8 *buf, unsigned int count)
+{
+   w1_reset_select(dev);
+
+   w1_write_byte(dev, W1_F2D_READ_EEPROM);
+   w1_write_byte(dev, offset & 0xff);
+   w1_write_byte(dev, offset >> 8);
+
+   return w1_read_buf(dev, buf, count);
+}
+
+static int ds24xxx_probe(struct udevice *dev)
+{
+   struct w1_device *w1;
+
+   w1 = dev_get_platdata(dev);
+   w1->id = 0;
+   return 0;
+}
+
+static const struct w1_eeprom_ops ds24xxx_ops = {
+   .read_buf   = ds24xxx_read_buf,
+};
+
+static const struct udevice_id ds24xxx_id[] = {
+   { .compatible = "maxim,ds24b33", .data = W1_FAMILY_DS24B33 },
+   { .compatible = "maxim,ds2431", .data = W1_FAMILY_DS2431 },
+   { },
+};
+
+U_BOOT_DRIVER(ds24xxx) = {
+   .name   = "ds24xxx",
+   .id = UCLASS_W1_EEPROM,
+   .of_match   = ds24xxx_id,
+   .ops= &ds24xxx_ops,
+   .probe  = ds24xxx_probe,
+};
-- 
2.7.4

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


[U-Boot] [PATCH v3 08/34] W1-EEPROM: add sandbox driver

2018-08-20 Thread Eugen Hristev
Add a sandbox driver for a one wire EEPROM memory

Signed-off-by: Eugen Hristev 
---
 drivers/w1-eeprom/Kconfig   |  6 
 drivers/w1-eeprom/Makefile  |  1 +
 drivers/w1-eeprom/eep_sandbox.c | 61 +
 include/w1.h|  1 +
 4 files changed, 69 insertions(+)
 create mode 100644 drivers/w1-eeprom/eep_sandbox.c

diff --git a/drivers/w1-eeprom/Kconfig b/drivers/w1-eeprom/Kconfig
index 20ec549..4b7f3c4 100644
--- a/drivers/w1-eeprom/Kconfig
+++ b/drivers/w1-eeprom/Kconfig
@@ -18,6 +18,12 @@ config W1_EEPROM_DS24XXX
help
  Maxim DS24 EEPROMs 1-Wire EEPROM support
 
+config W1_EEPROM_SANDBOX
+   bool "Enable sandbox onewire EEPROM driver"
+   depends on W1
+   help
+ Sandbox driver for a onewire EEPROM memory
+
 endif
 
 endmenu
diff --git a/drivers/w1-eeprom/Makefile b/drivers/w1-eeprom/Makefile
index 3f4aa13..03cc4c8 100644
--- a/drivers/w1-eeprom/Makefile
+++ b/drivers/w1-eeprom/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_W1_EEPROM) += w1-eeprom-uclass.o
 
 obj-$(CONFIG_W1_EEPROM_DS24XXX) += ds24xxx.o
 
+obj-$(CONFIG_W1_EEPROM_SANDBOX) += eep_sandbox.o
diff --git a/drivers/w1-eeprom/eep_sandbox.c b/drivers/w1-eeprom/eep_sandbox.c
new file mode 100644
index 000..27c7f9f
--- /dev/null
+++ b/drivers/w1-eeprom/eep_sandbox.c
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier:GPL-2.0+
+ *
+ * Copyright (c) 2018 Microchip Technology, Inc.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define W1_F2D_READ_EEPROM  0xf0
+
+#define EEP_SANDBOX_SAMPLE_MEM "this is a sample EEPROM memory string."
+
+static int eep_sandbox_read_buf(struct udevice *dev, unsigned int offset,
+   u8 *buf, unsigned int count)
+{
+   /* do not allow to copy more than our maximum sample string */
+   if (offset + count < strlen(EEP_SANDBOX_SAMPLE_MEM)) {
+   offset = 0;
+   count = strlen(EEP_SANDBOX_SAMPLE_MEM);
+   }
+   strncpy((char *)buf, EEP_SANDBOX_SAMPLE_MEM, count);
+
+   /*
+* in case the w1 subsystem uses some different kind of sandbox testing,
+* like randomized gpio values , we take the buffer from there
+*/
+
+   w1_reset_select(dev);
+
+   w1_write_byte(dev, W1_F2D_READ_EEPROM);
+   w1_write_byte(dev, offset & 0xff);
+   w1_write_byte(dev, offset >> 8);
+
+   w1_read_buf(dev, buf, count);
+
+   /*
+* even if read buf from w1 fails, return success as we hardcoded
+* the buffer.
+*/
+   return 0;
+}
+
+static const struct w1_eeprom_ops eep_sandbox_ops = {
+   .read_buf   = eep_sandbox_read_buf,
+};
+
+static const struct udevice_id eep_sandbox_id[] = {
+   { .compatible = "sandbox,w1-eeprom", .data = W1_FAMILY_EEP_SANDBOX },
+   { },
+};
+
+U_BOOT_DRIVER(eep_sandbox) = {
+   .name   = "eep_sandbox",
+   .id = UCLASS_W1_EEPROM,
+   .of_match   = eep_sandbox_id,
+   .ops= &eep_sandbox_ops,
+};
diff --git a/include/w1.h b/include/w1.h
index b36e0f8..399177a 100644
--- a/include/w1.h
+++ b/include/w1.h
@@ -12,6 +12,7 @@
 
 #define W1_FAMILY_DS24B33  0x23
 #define W1_FAMILY_DS2431   0x2d
+#define W1_FAMILY_EEP_SANDBOX  0xfe
 
 struct w1_device {
u64 id;
-- 
2.7.4

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


[U-Boot] [PATCH v3 09/34] dt-bindings: w1-eeprom: eep_sandbox: create bindings

2018-08-20 Thread Eugen Hristev
Bindings for sandbox onewire eeprom driver

Signed-off-by: Eugen Hristev 
---
 doc/device-tree-bindings/w1-eeprom/eep_sandbox.txt | 34 ++
 1 file changed, 34 insertions(+)
 create mode 100644 doc/device-tree-bindings/w1-eeprom/eep_sandbox.txt

diff --git a/doc/device-tree-bindings/w1-eeprom/eep_sandbox.txt 
b/doc/device-tree-bindings/w1-eeprom/eep_sandbox.txt
new file mode 100644
index 000..82bb589
--- /dev/null
+++ b/doc/device-tree-bindings/w1-eeprom/eep_sandbox.txt
@@ -0,0 +1,34 @@
+Onewire EEPROM sandbox driver device binding - one wire protocol sandbox EEPROM
+===
+
+This memory needs to be connected to a onewire bus, as a child node.
+The bus will read the device serial number and match this node with a found
+device on the bus
+Also check doc/device-tree-bindings/w1 for onewire bus drivers
+
+Driver:
+- drivers/w1-eeprom/eep_sandbox.c
+
+Software ds24xxx device-tree node properties:
+Required:
+* compatible = "sandbox,w1-eeprom"
+
+Optional:
+* none
+
+Example:
+   eeprom1: eeprom@0 {
+   compatible = "sandbox,w1-eeprom";
+   }
+
+Example with parent bus:
+
+onewire_tm: onewire {
+   compatible = "w1-gpio";
+   gpios = <&gpio_a 8>;
+
+   eeprom1: eeprom@0 {
+   compatible = "sandbox,w1-eeprom";
+   }
+};
+
-- 
2.7.4

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


[U-Boot] [PATCH v3 11/34] pinctrl: sandbox: add gpio onewire w1 group

2018-08-20 Thread Eugen Hristev
Add onewire "w1" groups and pin function for onewire GPIOs in sandbox.

Signed-off-by: Eugen Hristev 
---
 drivers/pinctrl/pinctrl-sandbox.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-sandbox.c 
b/drivers/pinctrl/pinctrl-sandbox.c
index 468fa2a..755ac08 100644
--- a/drivers/pinctrl/pinctrl-sandbox.c
+++ b/drivers/pinctrl/pinctrl-sandbox.c
@@ -14,6 +14,7 @@ static const char * const sandbox_pins[] = {
"SDA",
"TX",
"RX",
+   "W1"
 };
 
 static const char * const sandbox_groups[] = {
@@ -21,12 +22,14 @@ static const char * const sandbox_groups[] = {
"serial_a",
"serial_b",
"spi",
+   "w1",
 };
 
 static const char * const sandbox_functions[] = {
"i2c",
"serial",
"spi",
+   "w1",
 };
 
 static const struct pinconf_param sandbox_conf_params[] = {
-- 
2.7.4

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


[U-Boot] [PATCH v3 04/34] W1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs

2018-08-20 Thread Eugen Hristev
From: Maxime Ripard 

We might want to access data stored onto one wire EEPROMs.
Create a framework to provide a consistent API.

Signed-off-by: Maxime Ripard 
[eugen.hris...@microchip.com: reworked patch]
Signed-off-by: Eugen Hristev 
---
 drivers/Kconfig  |   2 +
 drivers/Makefile |   1 +
 drivers/w1-eeprom/Kconfig|  17 +
 drivers/w1-eeprom/Makefile   |   2 +
 drivers/w1-eeprom/w1-eeprom-uclass.c | 116 +++
 include/dm/uclass-id.h   |   1 +
 include/w1-eeprom.h  |  33 ++
 7 files changed, 172 insertions(+)
 create mode 04 drivers/w1-eeprom
 create mode 100644 drivers/w1-eeprom/Kconfig
 create mode 100644 drivers/w1-eeprom/Makefile
 create mode 100644 drivers/w1-eeprom/w1-eeprom-uclass.c
 create mode 100644 include/w1-eeprom.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 2cae829..386af75 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -104,6 +104,8 @@ source "drivers/video/Kconfig"
 
 source "drivers/w1/Kconfig"
 
+source "drivers/w1-eeprom/Kconfig"
+
 source "drivers/watchdog/Kconfig"
 
 config PHYS_TO_BUS
diff --git a/drivers/Makefile b/drivers/Makefile
index 728380b..de67a17 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -102,6 +102,7 @@ obj-y += soc/
 obj-$(CONFIG_REMOTEPROC) += remoteproc/
 obj-y += thermal/
 obj-$(CONFIG_W1) += w1/
+obj-$(CONFIG_W1_EEPROM) += w1-eeprom/
 
 obj-$(CONFIG_MACH_PIC32) += ddr/microchip/
 endif
diff --git a/drivers/w1-eeprom/Kconfig b/drivers/w1-eeprom/Kconfig
new file mode 100644
index 000..d5ddc80
--- /dev/null
+++ b/drivers/w1-eeprom/Kconfig
@@ -0,0 +1,17 @@
+#
+# EEPROM subsystem configuration
+#
+
+menu "1-wire EEPROM support"
+
+config W1_EEPROM
+   bool "Enable support for EEPROMs on 1wire interface"
+   depends on DM
+   help
+ Support for the EEPROMs connected on 1-wire Dallas protocol interface
+
+if W1_EEPROM
+
+endif
+
+endmenu
diff --git a/drivers/w1-eeprom/Makefile b/drivers/w1-eeprom/Makefile
new file mode 100644
index 000..b72950e
--- /dev/null
+++ b/drivers/w1-eeprom/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_W1_EEPROM) += w1-eeprom-uclass.o
+
diff --git a/drivers/w1-eeprom/w1-eeprom-uclass.c 
b/drivers/w1-eeprom/w1-eeprom-uclass.c
new file mode 100644
index 000..1e5c1b1
--- /dev/null
+++ b/drivers/w1-eeprom/w1-eeprom-uclass.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier:GPL-2.0+
+/*
+ *
+ * Copyright (c) 2015 Free Electrons
+ * Copyright (c) 2015 NextThing Co.
+ * Copyright (c) 2018 Microchip Technology, Inc.
+ *
+ * Maxime Ripard 
+ * Eugen Hristev 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+int w1_eeprom_read_buf(struct udevice *dev, unsigned int offset,
+  u8 *buf, unsigned int count)
+{
+   const struct w1_eeprom_ops *ops = device_get_ops(dev);
+   u64 id = 0;
+   int ret;
+
+   if (!ops->read_buf)
+   return -ENOSYS;
+
+   ret = w1_eeprom_get_id(dev, &id);
+   if (ret)
+   return ret;
+   if (!id)
+   return -ENODEV;
+
+   return ops->read_buf(dev, offset, buf, count);
+}
+
+int w1_eeprom_register_new_device(u64 id)
+{
+   u8 family = id & 0xff;
+   int ret;
+   struct udevice *dev;
+
+   for (ret = uclass_first_device(UCLASS_W1_EEPROM, &dev);
+!ret && dev;
+uclass_next_device(&dev)) {
+   if (ret || !dev) {
+   debug("cannot find w1 eeprom dev\n");
+   return ret;
+   }
+   if (dev_get_driver_data(dev) == family) {
+   struct w1_device *w1;
+
+   w1 = dev_get_parent_platdata(dev);
+   if (w1->id) /* device already in use */
+   continue;
+   w1->id = id;
+   debug("%s: Match found: %s:%s %llx\n", __func__,
+ dev->name, dev->driver->name, id);
+   return 0;
+   }
+   }
+
+   debug("%s: No matches found: error %d\n", __func__, ret);
+
+   return ret;
+}
+
+int w1_eeprom_get_id(struct udevice *dev, u64 *id)
+{
+   struct w1_device *w1 = dev_get_parent_platdata(dev);
+
+   if (!w1)
+   return -ENODEV;
+   *id = w1->id;
+
+   return 0;
+}
+
+UCLASS_DRIVER(w1_eeprom) = {
+   .name   = "w1_eeprom",
+   .id = UCLASS_W1_EEPROM,
+   .flags  = DM_UC_FLAG_SEQ_ALIAS,
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+   .post_bind  = dm_scan_fdt_dev,
+#endif
+};
+
+int w1_eeprom_dm_init(void)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   ret = uclass_get(UCLASS_W1_EEPROM, &uc);
+   if (ret) {
+   debug ("W1_EEPROM uclass not available\n");
+   return ret;
+   }
+
+   uclass_foreach_dev(dev, uc) {
+   re

[U-Boot] [PATCH v3 16/34] configs: sama5d27_som1_ek: add onewire and eeprom drivers

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

Signed-off-by: Eugen Hristev 
---
 configs/sama5d27_som1_ek_mmc_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/sama5d27_som1_ek_mmc_defconfig 
b/configs/sama5d27_som1_ek_mmc_defconfig
index 53d4b7c..3df7e5c 100644
--- a/configs/sama5d27_som1_ek_mmc_defconfig
+++ b/configs/sama5d27_som1_ek_mmc_defconfig
@@ -86,3 +86,7 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_DM_VIDEO=y
 CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 07/34] dt-bindings: w1-eeprom: ds24xxx: create bindings

2018-08-20 Thread Eugen Hristev
Bindings for Maxim's ds24 onewire EEPROM families driver

Signed-off-by: Eugen Hristev 
---
 doc/device-tree-bindings/w1-eeprom/ds24xxx.txt | 37 ++
 1 file changed, 37 insertions(+)
 create mode 04 doc/device-tree-bindings/w1-eeprom
 create mode 100644 doc/device-tree-bindings/w1-eeprom/ds24xxx.txt

diff --git a/doc/device-tree-bindings/w1-eeprom/ds24xxx.txt 
b/doc/device-tree-bindings/w1-eeprom/ds24xxx.txt
new file mode 100644
index 000..2e91be9
--- /dev/null
+++ b/doc/device-tree-bindings/w1-eeprom/ds24xxx.txt
@@ -0,0 +1,37 @@
+Maxim DS24 families driver device binding - one wire protocol EEPROMS from 
Maxim
+===
+
+This memory needs to be connected to a onewire bus, as a child node.
+The bus will read the device serial number and match this node with a found
+device on the bus
+Also check doc/device-tree-bindings/w1 for onewire bus drivers
+
+Driver:
+- drivers/w1-eeprom/ds24xxx.c
+
+Software ds24xxx device-tree node properties:
+Required:
+* compatible = "maxim,ds24b33"
+or
+* compatible = "maxim,ds2431"
+Further memories can be added.
+
+Optional:
+* none
+
+Example:
+   eeprom1: eeprom@0 {
+   compatible = "maxim,ds24xxx";
+   }
+
+Example with parent bus:
+
+onewire_tm: onewire {
+   compatible = "w1-gpio";
+   gpios = <&pioA 32 0>;
+
+   eeprom1: eeprom@0 {
+   compatible = "maxim,ds24xxx";
+   }
+};
+
-- 
2.7.4

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


[U-Boot] [PATCH v3 03/34] dt-bindings: W1: w1-gpio: added bindings for w1-gpio

2018-08-20 Thread Eugen Hristev
Added bindings specification for bitbanged gpio driver for Dallas
one wire protocol

Signed-off-by: Eugen Hristev 
---
 doc/device-tree-bindings/w1/w1-gpio.txt | 40 +
 1 file changed, 40 insertions(+)
 create mode 04 doc/device-tree-bindings/w1
 create mode 100644 doc/device-tree-bindings/w1/w1-gpio.txt

diff --git a/doc/device-tree-bindings/w1/w1-gpio.txt 
b/doc/device-tree-bindings/w1/w1-gpio.txt
new file mode 100644
index 000..5a58244
--- /dev/null
+++ b/doc/device-tree-bindings/w1/w1-gpio.txt
@@ -0,0 +1,40 @@
+W1 gpio device binding - one wire protocol over bitbanged gpio
+===
+
+
+Child nodes are required in device tree. The driver will detect
+the devices serial number and then search in the child nodes in the device tree
+for the proper node and try to match it with the device.
+
+Also check doc/device-tree-bindings/w1-eeprom for possible child nodes drivers
+
+Driver:
+- drivers/w1/w1-gpio.c
+
+Software w1 device-tree node properties:
+Required:
+* compatible = "w1-gpio";
+* gpios = <...>;
+   This is the gpio used for one wire protocol, using bitbanging
+
+Optional:
+* none
+
+Example:
+
+onewire_tm: onewire {
+   compatible = "w1-gpio";
+   gpios = <&pioA 32 0>;
+};
+
+Example with child:
+
+onewire_tm: onewire {
+   compatible = "w1-gpio";
+   gpios = <&pioA 32 0>;
+
+   eeprom1: eeprom@0 {
+   compatible = "maxim,ds24xxx";
+   }
+};
+
-- 
2.7.4

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


[U-Boot] [PATCH v3 10/34] w1: add command for onewire protocol

2018-08-20 Thread Eugen Hristev
Add basic command for bus information and read for onewire
bus using Dallas 1-Wire protocol.

Signed-off-by: Eugen Hristev 
---
 cmd/Kconfig  |   7 
 cmd/Makefile |   1 +
 cmd/w1.c | 126 +++
 3 files changed, 134 insertions(+)
 create mode 100644 cmd/w1.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index aec2090..1a68b1f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -816,6 +816,13 @@ config CMD_I2C
help
  I2C support.
 
+config CMD_W1
+   depends on W1
+   default y if W1
+   bool "w1 - Support for Dallas 1-Wire protocol"
+   help
+ Dallas 1-wire protocol support
+
 config CMD_LOADB
bool "loadb"
default y
diff --git a/cmd/Makefile b/cmd/Makefile
index 323f1fd..51ad1d8 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -143,6 +143,7 @@ obj-$(CONFIG_CMD_THOR_DOWNLOAD) += thordown.o
 obj-$(CONFIG_CMD_XIMG) += ximg.o
 obj-$(CONFIG_CMD_YAFFS2) += yaffs2.o
 obj-$(CONFIG_CMD_SPL) += spl.o
+obj-$(CONFIG_CMD_W1) += w1.o
 obj-$(CONFIG_CMD_ZIP) += zip.o
 obj-$(CONFIG_CMD_ZFS) += zfs.o
 
diff --git a/cmd/w1.c b/cmd/w1.c
new file mode 100644
index 000..9c95fcf
--- /dev/null
+++ b/cmd/w1.c
@@ -0,0 +1,126 @@
+/* SPDX-License-Identifier: GPL-2.0+
+ *
+ * (C) Copyright 2018
+ * Microchip Technology, Inc.
+ * Eugen Hristev 
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int w1_bus(void)
+{
+   struct udevice *bus, *dev;
+   int ret;
+
+   ret = w1_get_bus(0, &bus);
+   if (ret) {
+   printf("one wire interface not found\n");
+   return CMD_RET_FAILURE;
+   }
+   printf("Bus %d:\t%s", bus->seq, bus->name);
+   if (device_active(bus))
+   printf("  (active)");
+   printf("\n");
+
+   for (device_find_first_child(bus, &dev);
+dev;
+device_find_next_child(&dev)) {
+   ret = device_probe(dev);
+
+   printf("\t%s (%d) uclass %s : ", dev->name, dev->seq,
+  dev->uclass->uc_drv->name);
+
+   if (ret)
+   printf("device error\n");
+   else
+   printf("family 0x%x\n", w1_get_device_family(dev));
+   }
+   return CMD_RET_SUCCESS;
+}
+
+static int w1_read(int argc, char *const argv[])
+{
+   int bus_n = 0, dev_n = 0, offset = 0, len = 512;
+   int i;
+   struct udevice *bus, *dev;
+   int ret;
+   u8 buf[512];
+
+   if (argc > 2)
+   bus_n = simple_strtoul(argv[2], NULL, 10);
+
+   if (argc > 3)
+   dev_n = simple_strtoul(argv[3], NULL, 10);
+
+   if (argc > 4)
+   offset = simple_strtoul(argv[4], NULL, 10);
+
+   if (argc > 5)
+   len = simple_strtoul(argv[5], NULL, 10);
+
+   if (len > 512) {
+   printf("len needs to be <= 512\n");
+   return CMD_RET_FAILURE;
+   }
+
+   ret = w1_get_bus(bus_n, &bus);
+   if (ret) {
+   printf("one wire interface not found\n");
+   return CMD_RET_FAILURE;
+   }
+
+   for (device_find_first_child(bus, &dev), i = 0;
+  dev && i <= dev_n;
+  device_find_next_child(&dev), i++) {
+   ret = device_probe(dev);
+   if (!ret && i == dev_n)
+   break;
+   }
+
+   if (i != dev_n || ret || !dev) {
+   printf("invalid dev\n");
+   return CMD_RET_FAILURE;
+   }
+
+   if (strcmp(dev->uclass->uc_drv->name, "w1_eeprom")) {
+   printf("the device present on the interface is of unknown 
device class\n");
+   return CMD_RET_FAILURE;
+   }
+
+   ret = w1_eeprom_read_buf(dev, offset, (u8 *)buf, len);
+   if (ret) {
+   printf("error reading device %s\n", dev->name);
+   return CMD_RET_FAILURE;
+   }
+
+   for (i = 0; i < len; i++)
+   printf("%x", buf[i]);
+   printf("\n");
+
+   return CMD_RET_SUCCESS;
+}
+
+int do_w1(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   if (!strcmp(argv[1], "bus"))
+   return w1_bus();
+
+   if (!strcmp(argv[1], "read"))
+   return w1_read(argc, argv);
+
+   return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(w1, 6, 0, do_w1,
+  "onewire interface utility commands",
+  "bus - show onewire bus info (all)\n"
+  "w1 read [ [ [offset [length"
+  "- read from onewire device 'dev' on onewire bus 'bus'"
+  " starting from offset 'offset' and length 'length'\n"
+  "  defaults: bus 0, dev 0, offset 0, length 512 bytes.");
-- 
2.7.4

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


[U-Boot] [PATCH v3 26/34] configs: sama5d3_xplained: add fdt overlay support

2018-08-20 Thread Eugen Hristev
Add commands for fdt overlay merging. This is required for the boot scripts
that detect PDAs and apply specific overlays to the DTB passed on to kernel.

Signed-off-by: Eugen Hristev 
---
 configs/sama5d3_xplained_mmc_defconfig   | 1 +
 configs/sama5d3_xplained_nandflash_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/sama5d3_xplained_mmc_defconfig 
b/configs/sama5d3_xplained_mmc_defconfig
index 771264e..c6dddbf 100644
--- a/configs/sama5d3_xplained_mmc_defconfig
+++ b/configs/sama5d3_xplained_mmc_defconfig
@@ -77,3 +77,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sama5d3_xplained_nandflash_defconfig 
b/configs/sama5d3_xplained_nandflash_defconfig
index a35beff..6fbbde0 100644
--- a/configs/sama5d3_xplained_nandflash_defconfig
+++ b/configs/sama5d3_xplained_nandflash_defconfig
@@ -75,3 +75,4 @@ CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
 CONFIG_FAT_WRITE=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 19/34] board: atmel: add support for pda detection

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

Signed-off-by: Eugen Hristev 
---
 board/atmel/common/board.c | 55 ++
 1 file changed, 55 insertions(+)

diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index 650eb22..b9cf54c 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -5,7 +5,62 @@
  */
 
 #include 
+#include 
+#include 
+#include 
+
+#define AT91_PDA_EEPROM_ID_OFFSET  15
+#define AT91_PDA_EEPROM_ID_LENGTH  5
+#define AT91_PDA_EEPROM_DEFAULT_BUS0
 
 void dummy(void)
 {
 }
+
+#if defined CONFIG_W1
+void at91_pda_detect(void)
+{
+   struct udevice *bus, *dev;
+   u8 buf[AT91_PDA_EEPROM_ID_LENGTH + 1] = {0};
+   int ret;
+   int pda = 0;
+
+   ret = w1_get_bus(AT91_PDA_EEPROM_DEFAULT_BUS, &bus);
+   if (ret)
+   return;
+
+   for (device_find_first_child(bus, &dev);
+dev;
+device_find_next_child(&dev)) {
+   ret = device_probe(dev);
+   if (ret) {
+   continue;
+   } else {
+   w1_eeprom_read_buf(dev, AT91_PDA_EEPROM_ID_OFFSET,
+  (u8 *)buf, 
AT91_PDA_EEPROM_ID_LENGTH);
+   break;
+   }
+   }
+   pda = simple_strtoul((const char *)buf, NULL, 10);
+
+   switch (pda) {
+   case 7000:
+   if (buf[4] == 'B')
+   printf("PDA TM7000B detected\n");
+   else
+   printf("PDA TM7000 detected\n");
+   break;
+   case 4300:
+   printf("PDA TM4300 detected\n");
+   break;
+   case 5000:
+   printf("PDA TM5000 detected\n");
+   break;
+   }
+   env_set("pda", (const char *)buf);
+}
+#else
+void at91_pda_detect(void)
+{
+}
+#endif
-- 
2.7.4

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


[U-Boot] [PATCH v3 23/34] board: sama5d2_ptc_ek: add pda detect call at init time

2018-08-20 Thread Eugen Hristev
Call the PDA detection mechanism at boot time so we can have
the pda environment variable ready for use.

Signed-off-by: Eugen Hristev 
---
 arch/arm/mach-at91/Kconfig  |  1 +
 board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 6fe701a..983d9b9 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -149,6 +149,7 @@ config TARGET_SAMA5D2_PTC_EK
bool "SAMA5D2 PTC EK board"
select SAMA5D2
select BOARD_EARLY_INIT_F
+   select BOARD_LATE_INIT
 
 config TARGET_SAMA5D2_XPLAINED
bool "SAMA5D2 Xplained board"
diff --git a/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c 
b/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c
index 789841e..17e08fa 100644
--- a/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c
+++ b/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 
+extern void at91_pda_detect(void);
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_NAND_ATMEL
@@ -65,6 +67,14 @@ static void board_nand_hw_init(void)
 }
 #endif
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+   at91_pda_detect();
+   return 0;
+}
+#endif
+
 static void board_usb_hw_init(void)
 {
atmel_pio4_set_pio_output(AT91_PIO_PORTB, 12, ATMEL_PIO_PUEN_MASK);
-- 
2.7.4

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


[U-Boot] [PATCH v3 27/34] configs: sama5d2_ptc_ek: add fdt overlay support

2018-08-20 Thread Eugen Hristev
Add commands for fdt overlay merging. This is required for the boot scripts
that detect PDAs and apply specific overlays to the DTB passed on to kernel.

Signed-off-by: Eugen Hristev 
---
 configs/sama5d2_ptc_ek_mmc_defconfig   | 1 +
 configs/sama5d2_ptc_ek_nandflash_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/sama5d2_ptc_ek_mmc_defconfig 
b/configs/sama5d2_ptc_ek_mmc_defconfig
index c53ab09..31af019 100644
--- a/configs/sama5d2_ptc_ek_mmc_defconfig
+++ b/configs/sama5d2_ptc_ek_mmc_defconfig
@@ -63,3 +63,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sama5d2_ptc_ek_nandflash_defconfig 
b/configs/sama5d2_ptc_ek_nandflash_defconfig
index e56e19e..46345b4 100644
--- a/configs/sama5d2_ptc_ek_nandflash_defconfig
+++ b/configs/sama5d2_ptc_ek_nandflash_defconfig
@@ -63,3 +63,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 17/34] configs: sama5d2_ptc_ek: add onewire and eeprom drivers

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

Signed-off-by: Eugen Hristev 
---
 configs/sama5d2_ptc_ek_mmc_defconfig   | 4 
 configs/sama5d2_ptc_ek_nandflash_defconfig | 4 
 2 files changed, 8 insertions(+)

diff --git a/configs/sama5d2_ptc_ek_mmc_defconfig 
b/configs/sama5d2_ptc_ek_mmc_defconfig
index 3fc18a1..c53ab09 100644
--- a/configs/sama5d2_ptc_ek_mmc_defconfig
+++ b/configs/sama5d2_ptc_ek_mmc_defconfig
@@ -59,3 +59,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
diff --git a/configs/sama5d2_ptc_ek_nandflash_defconfig 
b/configs/sama5d2_ptc_ek_nandflash_defconfig
index 886f342..e56e19e 100644
--- a/configs/sama5d2_ptc_ek_nandflash_defconfig
+++ b/configs/sama5d2_ptc_ek_nandflash_defconfig
@@ -59,3 +59,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 22/34] board: sama5d27_som1_ek: add pda detect call at init time

2018-08-20 Thread Eugen Hristev
Call the PDA detection mechanism at boot time so we can have
the pda environment variable ready for use.

Signed-off-by: Eugen Hristev 
---
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c 
b/board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
index d5ddf8d..8363434 100644
--- a/board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
+++ b/board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
@@ -15,6 +15,8 @@
 #include 
 #include 
 
+extern void at91_pda_detect(void);
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static void board_usb_hw_init(void)
@@ -28,6 +30,7 @@ int board_late_init(void)
 #ifdef CONFIG_DM_VIDEO
at91_video_show_board_info();
 #endif
+   at91_pda_detect();
return 0;
 }
 #endif
-- 
2.7.4

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


[U-Boot] [PATCH v3 05/34] w1: identify devices with w1-eeprom uclass

2018-08-20 Thread Eugen Hristev
When a new device is discovered, this may be a w1 eeprom device.
Attempt to find the proper node and driver from the w1-eeprom subsystem.

Signed-off-by: Eugen Hristev 
---
 drivers/w1/w1-uclass.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
index 44759fe..aecf7fe 100644
--- a/drivers/w1/w1-uclass.c
+++ b/drivers/w1/w1-uclass.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -98,6 +99,9 @@ static int w1_enumerate(struct udevice *bus)
 
debug("%s: Detected new device 0x%llx (family 0x%x)\n",
  bus->name, rn, (u8)(rn & 0xff));
+
+   /* attempt to register as w1-eeprom device */
+   w1_eeprom_register_new_device(rn);
}
}
 
-- 
2.7.4

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


[U-Boot] [PATCH v3 29/34] configs: sama5d4_xplained: add fdt overlay support

2018-08-20 Thread Eugen Hristev
Add commands for fdt overlay merging. This is required for the boot scripts
that detect PDAs and apply specific overlays to the DTB passed on to kernel.

Signed-off-by: Eugen Hristev 
---
 configs/sama5d4_xplained_mmc_defconfig   | 1 +
 configs/sama5d4_xplained_nandflash_defconfig | 1 +
 configs/sama5d4_xplained_spiflash_defconfig  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/configs/sama5d4_xplained_mmc_defconfig 
b/configs/sama5d4_xplained_mmc_defconfig
index 311743e..2b38ad0 100644
--- a/configs/sama5d4_xplained_mmc_defconfig
+++ b/configs/sama5d4_xplained_mmc_defconfig
@@ -84,3 +84,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sama5d4_xplained_nandflash_defconfig 
b/configs/sama5d4_xplained_nandflash_defconfig
index 234cf24..d503606 100644
--- a/configs/sama5d4_xplained_nandflash_defconfig
+++ b/configs/sama5d4_xplained_nandflash_defconfig
@@ -81,3 +81,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sama5d4_xplained_spiflash_defconfig 
b/configs/sama5d4_xplained_spiflash_defconfig
index b0fcd3b..9a643d9 100644
--- a/configs/sama5d4_xplained_spiflash_defconfig
+++ b/configs/sama5d4_xplained_spiflash_defconfig
@@ -84,3 +84,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 13/34] configs: sandbox: add onewire w1 and sandbox eeprom

2018-08-20 Thread Eugen Hristev
To be able to test Dallas onewire protocol and one wire eeproms driver
and subsystem, add in sandbox defconfig the drivers' config.

Signed-off-by: Eugen Hristev 
---
 configs/sandbox_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 2fc84a1..2a86bf3 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -186,6 +186,10 @@ CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
 CONFIG_VIDEO_SANDBOX_SDL=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_SANDBOX=y
 CONFIG_WDT=y
 CONFIG_WDT_SANDBOX=y
 CONFIG_FS_CBFS=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 14/34] configs: sama5d2_xplained: add onewire and eeprom drivers

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

Signed-off-by: Eugen Hristev 
---
 configs/sama5d2_xplained_mmc_defconfig  | 4 
 configs/sama5d2_xplained_spiflash_defconfig | 4 
 2 files changed, 8 insertions(+)

diff --git a/configs/sama5d2_xplained_mmc_defconfig 
b/configs/sama5d2_xplained_mmc_defconfig
index 4182e84..7e62d9f 100644
--- a/configs/sama5d2_xplained_mmc_defconfig
+++ b/configs/sama5d2_xplained_mmc_defconfig
@@ -86,3 +86,7 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_DM_VIDEO=y
 CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
diff --git a/configs/sama5d2_xplained_spiflash_defconfig 
b/configs/sama5d2_xplained_spiflash_defconfig
index 18d1cb5..b5a95c5 100644
--- a/configs/sama5d2_xplained_spiflash_defconfig
+++ b/configs/sama5d2_xplained_spiflash_defconfig
@@ -83,3 +83,7 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_DM_VIDEO=y
 CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 28/34] configs: sama5d27_som1_ek: add fdt overlay support

2018-08-20 Thread Eugen Hristev
Add commands for fdt overlay merging. This is required for the boot scripts
that detect PDAs and apply specific overlays to the DTB passed on to kernel.

Signed-off-by: Eugen Hristev 
---
 configs/sama5d27_som1_ek_mmc_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/sama5d27_som1_ek_mmc_defconfig 
b/configs/sama5d27_som1_ek_mmc_defconfig
index 3df7e5c..f8250bc 100644
--- a/configs/sama5d27_som1_ek_mmc_defconfig
+++ b/configs/sama5d27_som1_ek_mmc_defconfig
@@ -90,3 +90,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.7.4

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


[U-Boot] [PATCH v3 20/34] board: sama5d2_xplained: add pda detect call at init time

2018-08-20 Thread Eugen Hristev
Call the PDA detection mechanism at boot time so we can have
the pda environment variable ready for use.

Signed-off-by: Eugen Hristev 
---
 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c 
b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 592b4d8..fccd80e 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -15,6 +15,8 @@
 #include 
 #include 
 
+extern void at91_pda_detect(void);
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static void board_usb_hw_init(void)
@@ -28,6 +30,7 @@ int board_late_init(void)
 #ifdef CONFIG_DM_VIDEO
at91_video_show_board_info();
 #endif
+   at91_pda_detect();
return 0;
 }
 #endif
-- 
2.7.4

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


[U-Boot] [PATCH v3 32/34] ARM: dts: at91: sama5d27_som1_ek: add onewire connector for LCD eeprom

2018-08-20 Thread Eugen Hristev
Add onewire node in device tree for TM series LCDs

Signed-off-by: Eugen Hristev 
---
 arch/arm/dts/at91-sama5d27_som1_ek.dts | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d27_som1_ek.dts 
b/arch/arm/dts/at91-sama5d27_som1_ek.dts
index 5e62d4a..4cd6db6 100644
--- a/arch/arm/dts/at91-sama5d27_som1_ek.dts
+++ b/arch/arm/dts/at91-sama5d27_som1_ek.dts
@@ -54,6 +54,18 @@
stdout-path = &uart1;
};
 
+   onewire_tm: onewire {
+   gpios = <&pioA 17 0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire_tm_default>;
+   status = "okay";
+
+   w1_eeprom: w1_eeprom@0 {
+   compatible = "maxim,ds24b33";
+   status = "okay";
+   };
+   };
+
ahb {
usb1: ohci@0040 {
num-ports = <3>;
@@ -208,6 +220,11 @@
pinmux = ;
bias-disable;
};
+
+   pinctrl_onewire_tm_default: 
onewire_tm_default {
+   pinmux = ;
+   bias-pull-up;
+   };
};
};
};
-- 
2.7.4

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


[U-Boot] [PATCH v3 34/34] ARM: dts: at91: sama5d4_xplained: add onewire connector for LCD eeprom

2018-08-20 Thread Eugen Hristev
Add onewire node in device tree for TM series LCDs

Signed-off-by: Eugen Hristev 
---
 arch/arm/dts/at91-sama5d4_xplained.dts | 16 
 arch/arm/dts/sama5d4.dtsi  |  5 +
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d4_xplained.dts 
b/arch/arm/dts/at91-sama5d4_xplained.dts
index ea35dc2..58a0e60 100644
--- a/arch/arm/dts/at91-sama5d4_xplained.dts
+++ b/arch/arm/dts/at91-sama5d4_xplained.dts
@@ -58,6 +58,18 @@
stdout-path = &usart3;
};
 
+   onewire_tm: onewire {
+   gpios = <&pioE 15 GPIO_ACTIVE_LOW>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire_tm_default>;
+   status = "okay";
+
+   w1_eeprom: w1_eeprom@0 {
+   compatible = "maxim,ds24b33";
+   status = "okay";
+   };
+   };
+
memory {
reg = <0x2000 0x2000>;
};
@@ -199,6 +211,10 @@
atmel,pins =
;
};
+   pinctrl_onewire_tm_default: 
onewire_tm_default {
+   atmel,pins =
+   ;
+   };
};
};
};
diff --git a/arch/arm/dts/sama5d4.dtsi b/arch/arm/dts/sama5d4.dtsi
index 8072b8a..8875d7b 100644
--- a/arch/arm/dts/sama5d4.dtsi
+++ b/arch/arm/dts/sama5d4.dtsi
@@ -1913,4 +1913,9 @@
};
};
};
+
+   onewire_tm: onewire {
+   compatible = "w1-gpio";
+   status = "disabled";
+   };
 };
-- 
2.7.4

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


[U-Boot] [PATCH v3 31/34] ARM: dts: at91: sama5d3_xplained: add onewire connector for LCD eeprom

2018-08-20 Thread Eugen Hristev
Add onewire node in device tree for TM series LCDs

Signed-off-by: Eugen Hristev 
---
 arch/arm/dts/at91-sama5d3_xplained.dts | 17 +
 arch/arm/dts/sama5d3.dtsi  |  5 +
 2 files changed, 22 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d3_xplained.dts 
b/arch/arm/dts/at91-sama5d3_xplained.dts
index 6959710..20fba5f 100644
--- a/arch/arm/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/dts/at91-sama5d3_xplained.dts
@@ -36,6 +36,18 @@
};
};
 
+   onewire_tm: onewire {
+   gpios = <&pioE 23 GPIO_ACTIVE_LOW>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire_tm_default>;
+   status = "okay";
+
+   w1_eeprom: w1_eeprom@0 {
+   compatible = "maxim,ds24b33";
+   status = "okay";
+   };
+   };
+
ahb {
apb {
mmc0: mmc@f000 {
@@ -243,6 +255,11 @@
atmel,pins =
;   /* PE9, conflicts with A9 */
};
+
+   pinctrl_onewire_tm_default: 
onewire_tm_default {
+   atmel,pins =
+   ;
+   };
};
};
};
diff --git a/arch/arm/dts/sama5d3.dtsi b/arch/arm/dts/sama5d3.dtsi
index ee0e14e..87ec17a 100644
--- a/arch/arm/dts/sama5d3.dtsi
+++ b/arch/arm/dts/sama5d3.dtsi
@@ -1538,4 +1538,9 @@
};
};
};
+
+   onewire_tm: onewire {
+   compatible = "w1-gpio";
+   status = "disabled";
+   };
 };
-- 
2.7.4

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


[U-Boot] [PATCH v3 33/34] ARM: dts: at91: sama5d2_ptc: add onewire connector for LCD eeprom

2018-08-20 Thread Eugen Hristev
Add onewire node in device tree for TM series LCDs

Signed-off-by: Eugen Hristev 
---
 arch/arm/dts/at91-sama5d2_ptc_ek.dts | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d2_ptc_ek.dts 
b/arch/arm/dts/at91-sama5d2_ptc_ek.dts
index ab5ab21..068a117 100644
--- a/arch/arm/dts/at91-sama5d2_ptc_ek.dts
+++ b/arch/arm/dts/at91-sama5d2_ptc_ek.dts
@@ -56,6 +56,18 @@
stdout-path = &uart0;
};
 
+   onewire_tm: onewire {
+   gpios = <&pioA PIN_PB31 0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire_tm_default>;
+   status = "okay";
+
+   w1_eeprom: w1_eeprom@0 {
+   compatible = "maxim,ds24b33";
+   status = "okay";
+   };
+   };
+
ahb {
usb0: gadget@0030 {
atmel,vbus-gpio = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
@@ -208,6 +220,11 @@
pinmux = ;
bias-disable;
};
+
+   pinctrl_onewire_tm_default: 
onewire_tm_default {
+   pinmux = ;
+   bias-pull-up;
+   };
};
};
};
-- 
2.7.4

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


[U-Boot] [PATCH v3 21/34] board: sama5d3_xplained: add pda detect call at init time

2018-08-20 Thread Eugen Hristev
Call the PDA detection mechanism at boot time so we can have
the pda environment variable ready for use.

Signed-off-by: Eugen Hristev 
---
 arch/arm/mach-at91/Kconfig  |  1 +
 board/atmel/sama5d3_xplained/sama5d3_xplained.c | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index ce6be38..6fe701a 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -175,6 +175,7 @@ config TARGET_SAMA5D3_XPLAINED
select SAMA5D3
select SUPPORT_SPL
select BOARD_EARLY_INIT_F
+   select BOARD_LATE_INIT
 
 config TARGET_SAMA5D3XEK
bool "SAMA5D3X-EK board"
diff --git a/board/atmel/sama5d3_xplained/sama5d3_xplained.c 
b/board/atmel/sama5d3_xplained/sama5d3_xplained.c
index c47f638..289f8d8 100644
--- a/board/atmel/sama5d3_xplained/sama5d3_xplained.c
+++ b/board/atmel/sama5d3_xplained/sama5d3_xplained.c
@@ -18,6 +18,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+extern void at91_pda_detect(void);
+
 #ifdef CONFIG_NAND_ATMEL
 void sama5d3_xplained_nand_hw_init(void)
 {
@@ -72,6 +74,14 @@ void board_debug_uart_init(void)
 }
 #endif
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+   at91_pda_detect();
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int board_early_init_f(void)
 {
-- 
2.7.4

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


[U-Boot] [PATCH v3 30/34] ARM: dts: at91: sama5d2_xplained: add onewire connector for LCD eeprom

2018-08-20 Thread Eugen Hristev
Add onewire node in device tree for TM series LCDs

Signed-off-by: Eugen Hristev 
---
 arch/arm/dts/at91-sama5d2_xplained.dts | 17 +
 arch/arm/dts/sama5d2.dtsi  |  5 +
 2 files changed, 22 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d2_xplained.dts 
b/arch/arm/dts/at91-sama5d2_xplained.dts
index 01326a1..33064b3 100644
--- a/arch/arm/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/dts/at91-sama5d2_xplained.dts
@@ -11,6 +11,18 @@
stdout-path = &uart1;
};
 
+   onewire_tm: onewire {
+   gpios = <&pioA PIN_PB0 0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire_tm_default>;
+   status = "okay";
+
+   w1_eeprom: w1_eeprom@0 {
+   compatible = "maxim,ds24b33";
+   status = "okay";
+   };
+   };
+
ahb {
usb1: ohci@0040 {
num-ports = <3>;
@@ -270,6 +282,11 @@
pinmux = ;
bias-disable;
};
+
+   pinctrl_onewire_tm_default: 
onewire_tm_default {
+   pinmux = ;
+   bias-pull-up;
+   };
};
};
};
diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi
index 6645a55..830251a 100644
--- a/arch/arm/dts/sama5d2.dtsi
+++ b/arch/arm/dts/sama5d2.dtsi
@@ -769,4 +769,9 @@
};
};
};
+
+   onewire_tm: onewire {
+   compatible = "w1-gpio";
+   status = "disabled";
+   };
 };
-- 
2.7.4

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


[U-Boot] [PATCH v3 25/34] configs: sama5d2_xplained: add fdt overlay support

2018-08-20 Thread Eugen Hristev
Add commands for fdt overlay merging. This is required for the boot scripts
that detect PDAs and apply specific overlays to the DTB passed on to kernel.

Signed-off-by: Eugen Hristev 
---
 configs/sama5d2_xplained_mmc_defconfig  | 1 +
 configs/sama5d2_xplained_spiflash_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/sama5d2_xplained_mmc_defconfig 
b/configs/sama5d2_xplained_mmc_defconfig
index 7e62d9f..4b2b5f0 100644
--- a/configs/sama5d2_xplained_mmc_defconfig
+++ b/configs/sama5d2_xplained_mmc_defconfig
@@ -90,3 +90,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/sama5d2_xplained_spiflash_defconfig 
b/configs/sama5d2_xplained_spiflash_defconfig
index b5a95c5..d2c264d 100644
--- a/configs/sama5d2_xplained_spiflash_defconfig
+++ b/configs/sama5d2_xplained_spiflash_defconfig
@@ -87,3 +87,4 @@ CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
 CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.7.4

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


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

2018-08-20 Thread Eugen Hristev
Add a node for the one wire uclass and one wire gpio driver
in sandbox.

Signed-off-by: Eugen Hristev 
---
 arch/sandbox/dts/sandbox.dts | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 0ea2452..2be836d 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -160,6 +160,7 @@
 
pinctrl {
compatible = "sandbox,pinctrl";
+   status = "okay";
 
pinctrl_i2c0: i2c0 {
groups = "i2c";
@@ -171,6 +172,12 @@
groups = "serial_a";
function = "serial";
};
+
+   pinctrl_onewire0: onewire0 {
+   groups = "w1";
+   function = "w1";
+   bias-pull-up;
+   };
};
 
reset@1 {
@@ -319,6 +326,19 @@
};
};
};
+
+   onewire0: onewire {
+   compatible = "w1-gpio";
+   gpios = <&gpio_a 8>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_onewire0>;
+   status = "okay";
+
+   sandbox_eeprom0: sandbox_eeprom@0 {
+   compatible = "sandbox,w1-eeprom";
+   status = "okay";
+   };
+   };
 };
 
 #include "cros-ec-keyboard.dtsi"
-- 
2.7.4

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


[U-Boot] [PATCH v3 24/34] board: sama5d4_xplained: add pda detect call at init time

2018-08-20 Thread Eugen Hristev
Call the PDA detection mechanism at boot time so we can have
the pda environment variable ready for use.

Signed-off-by: Eugen Hristev 
---
 board/atmel/sama5d4_xplained/sama5d4_xplained.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/atmel/sama5d4_xplained/sama5d4_xplained.c 
b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
index 526c6c7..4da6489 100644
--- a/board/atmel/sama5d4_xplained/sama5d4_xplained.c
+++ b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
@@ -17,6 +17,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+extern void at91_pda_detect(void);
+
 #ifdef CONFIG_NAND_ATMEL
 static void sama5d4_xplained_nand_hw_init(void)
 {
@@ -71,6 +73,7 @@ static void sama5d4_xplained_usb_hw_init(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
+   at91_pda_detect();
 #ifdef CONFIG_DM_VIDEO
at91_video_show_board_info();
 #endif
-- 
2.7.4

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


[U-Boot] [PATCH v3 15/34] configs: sama5d3_xplained: add onewire and eeprom drivers

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

Signed-off-by: Eugen Hristev 
---
 configs/sama5d3_xplained_mmc_defconfig   | 4 
 configs/sama5d3_xplained_nandflash_defconfig | 4 
 2 files changed, 8 insertions(+)

diff --git a/configs/sama5d3_xplained_mmc_defconfig 
b/configs/sama5d3_xplained_mmc_defconfig
index 861a851..771264e 100644
--- a/configs/sama5d3_xplained_mmc_defconfig
+++ b/configs/sama5d3_xplained_mmc_defconfig
@@ -73,3 +73,7 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
diff --git a/configs/sama5d3_xplained_nandflash_defconfig 
b/configs/sama5d3_xplained_nandflash_defconfig
index b72462d..a35beff 100644
--- a/configs/sama5d3_xplained_nandflash_defconfig
+++ b/configs/sama5d3_xplained_nandflash_defconfig
@@ -70,4 +70,8 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
 CONFIG_FAT_WRITE=y
-- 
2.7.4

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


  1   2   >