[PATCH 2/5] arch/arm/Makefile: sort machine names

2020-04-05 Thread Trevor Woerner
The comment hoped that people would keep the CONFIG_* macro names sorted, but
this drifted over time. Put the list back in alphanumerical order.

Signed-off-by: Trevor Woerner 
---
 arch/arm/Makefile | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 33bb8923bf..5d32dec29c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -66,25 +66,25 @@ machine-$(CONFIG_ARCH_LPC32XX)  += lpc32xx
 machine-$(CONFIG_ARCH_MEDIATEK)+= mediatek
 machine-$(CONFIG_ARCH_MESON)   += meson
 machine-$(CONFIG_ARCH_MVEBU)   += mvebu
-# TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA
+machine-$(CONFIG_ARCH_OMAP2PLUS)   += omap2
 # TODO: rename CONFIG_ORION5X -> CONFIG_ARCH_ORION5X
 machine-$(CONFIG_ORION5X)  += orion5x
-machine-$(CONFIG_ARCH_OMAP2PLUS)   += omap2
 machine-$(CONFIG_ARCH_OWL) += owl
+machine-$(CONFIG_ARCH_RMOBILE) += rmobile
+machine-$(CONFIG_ARCH_ROCKCHIP)+= rockchip
 machine-$(CONFIG_ARCH_S5PC1XX) += s5pc1xx
-machine-$(CONFIG_ARCH_SUNXI)   += sunxi
 machine-$(CONFIG_ARCH_SNAPDRAGON)  += snapdragon
 machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
-machine-$(CONFIG_ARCH_RMOBILE) += rmobile
-machine-$(CONFIG_ARCH_ROCKCHIP)+= rockchip
 machine-$(CONFIG_STM32)+= stm32
 machine-$(CONFIG_ARCH_STM32MP) += stm32mp
+machine-$(CONFIG_ARCH_SUNXI)   += sunxi
+# TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA
 machine-$(CONFIG_TEGRA)+= tegra
 machine-$(CONFIG_ARCH_U8500)   += u8500
 machine-$(CONFIG_ARCH_UNIPHIER)+= uniphier
+machine-$(CONFIG_ARCH_VERSAL)  += versal
 machine-$(CONFIG_ARCH_ZYNQ)+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)  += zynqmp
-machine-$(CONFIG_ARCH_VERSAL)  += versal
 machine-$(CONFIG_ARCH_ZYNQMP_R5)   += zynqmp-r5
 
 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
-- 
2.25.0.114.g5b0ca878e0



[PATCH 1/5] arm: lpc32xx: move SoC to mach-lpc32xx

2020-04-05 Thread Trevor Woerner
Following the example of most other SoCs in arch/$(ARCH)/cpu/$(CPU)/$(SOC)
move the lpc32xx code from arch/arm/cpu/arm926ejs/lpc32xx to
arch/arm/mach-lpc32xx.

Following the checklist from commit 01f14456306c84f9bcd3945a10c98ae50e30542a:
[1] move files from arch/arm/cpu/arm926ejs/lpc32xx to arch/arm/mach-lpx32xx
[2] add machine entry to arch/arm/Makefile
[3] remove "obj-y += ..." from arch/arm/cpu/arm926ejs/Makefile
[4] fix the Kconfig file path in arch/arm/Kconfig
[5] (no MAINTAINERS update)

Signed-off-by: Trevor Woerner 
---
 arch/arm/Kconfig| 2 +-
 arch/arm/Makefile   | 1 +
 arch/arm/cpu/arm926ejs/Makefile | 1 -
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/Kconfig| 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/Makefile   | 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/clk.c  | 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/cpu.c  | 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/devices.c  | 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/dram.c | 0
 .../arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/lowlevel_init.S | 0
 arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/timer.c| 0
 11 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/Kconfig (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/Makefile (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/clk.c (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/cpu.c (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/devices.c (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/dram.c (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/lowlevel_init.S (100%)
 rename arch/arm/{cpu/arm926ejs/lpc32xx => mach-lpc32xx}/timer.c (100%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bbb1e2738b..3096b97c6f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1732,7 +1732,7 @@ source "arch/arm/mach-keystone/Kconfig"
 
 source "arch/arm/mach-kirkwood/Kconfig"
 
-source "arch/arm/cpu/arm926ejs/lpc32xx/Kconfig"
+source "arch/arm/mach-lpc32xx/Kconfig"
 
 source "arch/arm/mach-mvebu/Kconfig"
 
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e25bb0e594..33bb8923bf 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -62,6 +62,7 @@ machine-$(CONFIG_ARCH_K3) += k3
 machine-$(CONFIG_ARCH_KEYSTONE)+= keystone
 # TODO: rename CONFIG_KIRKWOOD -> CONFIG_ARCH_KIRKWOOD
 machine-$(CONFIG_KIRKWOOD) += kirkwood
+machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
 machine-$(CONFIG_ARCH_MEDIATEK)+= mediatek
 machine-$(CONFIG_ARCH_MESON)   += meson
 machine-$(CONFIG_ARCH_MVEBU)   += mvebu
diff --git a/arch/arm/cpu/arm926ejs/Makefile b/arch/arm/cpu/arm926ejs/Makefile
index b051025bb0..af63d5cc5e 100644
--- a/arch/arm/cpu/arm926ejs/Makefile
+++ b/arch/arm/cpu/arm926ejs/Makefile
@@ -13,7 +13,6 @@ endif
 endif
 
 obj-$(CONFIG_ARMADA100) += armada100/
-obj-$(if $(filter lpc32xx,$(SOC)),y) += lpc32xx/
 obj-$(CONFIG_MX25) += mx25/
 obj-$(CONFIG_MX27) += mx27/
 obj-$(if $(filter mxs,$(SOC)),y) += mxs/
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/Kconfig 
b/arch/arm/mach-lpc32xx/Kconfig
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/Kconfig
rename to arch/arm/mach-lpc32xx/Kconfig
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/Makefile 
b/arch/arm/mach-lpc32xx/Makefile
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/Makefile
rename to arch/arm/mach-lpc32xx/Makefile
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/clk.c b/arch/arm/mach-lpc32xx/clk.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/clk.c
rename to arch/arm/mach-lpc32xx/clk.c
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/cpu.c b/arch/arm/mach-lpc32xx/cpu.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/cpu.c
rename to arch/arm/mach-lpc32xx/cpu.c
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/devices.c 
b/arch/arm/mach-lpc32xx/devices.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/devices.c
rename to arch/arm/mach-lpc32xx/devices.c
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/dram.c 
b/arch/arm/mach-lpc32xx/dram.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/dram.c
rename to arch/arm/mach-lpc32xx/dram.c
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S 
b/arch/arm/mach-lpc32xx/lowlevel_init.S
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S
rename to arch/arm/mach-lpc32xx/lowlevel_init.S
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/timer.c 
b/arch/arm/mach-lpc32xx/timer.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/lpc32xx/timer.c
rename to arch/arm/mach-lpc32xx/timer.c
-- 
2.25.0.114.g5b0ca878e0



Re: [PATCH v2 2/2] efi_loader: identify EFI system partition

2020-04-05 Thread AKASHI Takahiro
On Mon, Apr 06, 2020 at 07:12:56AM +0200, Heinrich Schuchardt wrote:
> On 4/6/20 6:21 AM, AKASHI Takahiro wrote:
> > Heinrich,
> >
> > On Sun, Apr 05, 2020 at 11:28:18AM +0200, Heinrich Schuchardt wrote:
> >> For capsule updates we need to identify the EFI system partition.
> >
> > Right, but
> >
> >> Signed-off-by: Heinrich Schuchardt 
> >> ---
> >> v2:
> >>no change
> >> ---
> >>  include/efi_loader.h  |  7 +++
> >>  lib/efi_loader/efi_disk.c | 20 
> >>  2 files changed, 27 insertions(+)
> >>
> >> diff --git a/include/efi_loader.h b/include/efi_loader.h
> >> index 3f2792892f..4a45033476 100644
> >> --- a/include/efi_loader.h
> >> +++ b/include/efi_loader.h
> >> @@ -45,6 +45,13 @@ static inline void *guidcpy(void *dst, const void *src)
> >>  /* Root node */
> >>  extern efi_handle_t efi_root;
> >>
> >> +/* EFI system partition */
> >> +extern struct efi_system_partition {
> >> +  enum if_type if_type;
> >> +  int devnum;
> >> +  u8 part;
> >> +} efi_system_partition;
> >> +
> >>  int __efi_entry_check(void);
> >>  int __efi_exit_check(void);
> >>  const char *__efi_nesting(void);
> >> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> >> index fc0682bc48..2f752a5e99 100644
> >> --- a/lib/efi_loader/efi_disk.c
> >> +++ b/lib/efi_loader/efi_disk.c
> >> @@ -13,6 +13,8 @@
> >>  #include 
> >>  #include 
> >>
> >> +struct efi_system_partition efi_system_partition;
> >> +
> >>  const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
> >>
> >>  /**
> >> @@ -372,6 +374,24 @@ static efi_status_t efi_disk_add_dev(
> >>diskobj->ops.media = >media;
> >>if (disk)
> >>*disk = diskobj;
> >> +
> >> +  /* Store first EFI system partition */
> >
> > I don't think that the policy, first comes first serves as system
> > partition, is a right decision as
> > - the order of device probe on U-Boot is indeterministic, and
> 
> Indeterministic would mean that on two runs with the same media provided
> you will get different results. I cannot see any source for such
> randomness in the U-Boot code. In dm_init_and_scan() the device tree is
> scanned and drivers and bound in the sequence of occurrence in the
> device tree.
> 
> > - there can be several partitions that hold a system partition bit.
> >   You may have OS installed on eMMC, but also may have bootable DVD
> >   on the system.
> 
> This is a similar logic like finding the relevant boot.scr script to run.
> 
> What would be the alternative?

I think that most UEFI systems have ability for user to specify
"boot order."

-Takahiro Akashi
> 
> Definition via Kconfig would mean that a Linux distribution like Debian
> would have to provide a separate U-Boot build for each boot medium that
> a user might possibly use (eMMC, SD-card, USB, NVME, SCSI).
> 
> Best regards
> 
> Heinrich
> 
> >
> > -Takahiro Akashi
> >
> >> +  if (part && !efi_system_partition.if_type) {
> >> +  int r;
> >> +  disk_partition_t info;
> >> +
> >> +  r = part_get_info(desc, part, );
> >> +  if (r)
> >> +  return EFI_DEVICE_ERROR;
> >> +  if (info.bootable & PART_EFI_SYSTEM_PARTITION) {
> >> +  efi_system_partition.if_type = desc->if_type;
> >> +  efi_system_partition.devnum = desc->devnum;
> >> +  efi_system_partition.part = part;
> >> +  EFI_PRINT("EFI system partition: %s %d:%d\n",
> >> +blk_get_if_type_name(desc->if_type),
> >> +desc->devnum, part);
> >> +  }
> >> +  }
> >>return EFI_SUCCESS;
> >>  }
> >>
> >> --
> >> 2.25.1
> >>
> 


Re: [PATCH 0/6] x86: efi: Add a 64-bit coreboot payload

2020-04-05 Thread Heinrich Schuchardt
On 4/6/20 1:22 AM, Simon Glass wrote:
> This series creates a new 64-bit 'coreboot64' build which can be launched
> from coreboot. It uses SPL to effect the jump to 64-bit mode.
>
> This was done in an attempt to get the Ubuntu FirmwareTestSuite[1]
> working. Unfortunately the latest version shows a splash screen and hangs,
> perhaps due to some missing EFI support.

fwts exists as a snap package that can be run from the operating system.
I had not problem with running it on ARM64 systems. Cf.
https://snapcraft.io/fwts.

Do you relate to to the live image that gave you problems?

Best regards

Heinrich

>
> [1] https://wiki.ubuntu.com/FirmwareTestSuite
>
>
> Simon Glass (6):
>   x86: Allow building an SPL image for coreboot
>   x86: Move work-around out of cpu_jump_to_64bit_uboot()
>   x86: Update SPL for coreboot
>   x86: cbfs: Drop unwanted declaration
>   x86: coreboot: Allow building an SPL image
>   x86: Add a 64-bit coreboot build
>
>  Makefile |  6 
>  arch/x86/cpu/Makefile|  4 ++-
>  arch/x86/cpu/coreboot/Kconfig|  1 +
>  arch/x86/cpu/coreboot/Makefile   |  8 -
>  arch/x86/cpu/coreboot/coreboot.c |  3 +-
>  arch/x86/cpu/coreboot/coreboot_spl.c | 12 +++
>  arch/x86/cpu/i386/cpu.c  | 10 --
>  arch/x86/cpu/intel_common/Makefile   |  2 ++
>  arch/x86/cpu/x86_64/cpu.c|  2 ++
>  arch/x86/dts/coreboot-u-boot.dtsi| 18 +++
>  arch/x86/lib/spl.c   | 23 ++---
>  board/coreboot/coreboot/MAINTAINERS  |  7 
>  configs/coreboot64_defconfig | 48 
>  doc/board/coreboot/coreboot.rst  | 10 ++
>  include/cbfs.h   |  2 +-
>  15 files changed, 138 insertions(+), 18 deletions(-)
>  create mode 100644 arch/x86/cpu/coreboot/coreboot_spl.c
>  create mode 100644 arch/x86/dts/coreboot-u-boot.dtsi
>  create mode 100644 configs/coreboot64_defconfig
>



Re: [PATCH v2 2/2] efi_loader: identify EFI system partition

2020-04-05 Thread Heinrich Schuchardt
On 4/6/20 6:21 AM, AKASHI Takahiro wrote:
> Heinrich,
>
> On Sun, Apr 05, 2020 at 11:28:18AM +0200, Heinrich Schuchardt wrote:
>> For capsule updates we need to identify the EFI system partition.
>
> Right, but
>
>> Signed-off-by: Heinrich Schuchardt 
>> ---
>> v2:
>>  no change
>> ---
>>  include/efi_loader.h  |  7 +++
>>  lib/efi_loader/efi_disk.c | 20 
>>  2 files changed, 27 insertions(+)
>>
>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>> index 3f2792892f..4a45033476 100644
>> --- a/include/efi_loader.h
>> +++ b/include/efi_loader.h
>> @@ -45,6 +45,13 @@ static inline void *guidcpy(void *dst, const void *src)
>>  /* Root node */
>>  extern efi_handle_t efi_root;
>>
>> +/* EFI system partition */
>> +extern struct efi_system_partition {
>> +enum if_type if_type;
>> +int devnum;
>> +u8 part;
>> +} efi_system_partition;
>> +
>>  int __efi_entry_check(void);
>>  int __efi_exit_check(void);
>>  const char *__efi_nesting(void);
>> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
>> index fc0682bc48..2f752a5e99 100644
>> --- a/lib/efi_loader/efi_disk.c
>> +++ b/lib/efi_loader/efi_disk.c
>> @@ -13,6 +13,8 @@
>>  #include 
>>  #include 
>>
>> +struct efi_system_partition efi_system_partition;
>> +
>>  const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
>>
>>  /**
>> @@ -372,6 +374,24 @@ static efi_status_t efi_disk_add_dev(
>>  diskobj->ops.media = >media;
>>  if (disk)
>>  *disk = diskobj;
>> +
>> +/* Store first EFI system partition */
>
> I don't think that the policy, first comes first serves as system
> partition, is a right decision as
> - the order of device probe on U-Boot is indeterministic, and

Indeterministic would mean that on two runs with the same media provided
you will get different results. I cannot see any source for such
randomness in the U-Boot code. In dm_init_and_scan() the device tree is
scanned and drivers and bound in the sequence of occurrence in the
device tree.

> - there can be several partitions that hold a system partition bit.
>   You may have OS installed on eMMC, but also may have bootable DVD
>   on the system.

This is a similar logic like finding the relevant boot.scr script to run.

What would be the alternative?

Definition via Kconfig would mean that a Linux distribution like Debian
would have to provide a separate U-Boot build for each boot medium that
a user might possibly use (eMMC, SD-card, USB, NVME, SCSI).

Best regards

Heinrich

>
> -Takahiro Akashi
>
>> +if (part && !efi_system_partition.if_type) {
>> +int r;
>> +disk_partition_t info;
>> +
>> +r = part_get_info(desc, part, );
>> +if (r)
>> +return EFI_DEVICE_ERROR;
>> +if (info.bootable & PART_EFI_SYSTEM_PARTITION) {
>> +efi_system_partition.if_type = desc->if_type;
>> +efi_system_partition.devnum = desc->devnum;
>> +efi_system_partition.part = part;
>> +EFI_PRINT("EFI system partition: %s %d:%d\n",
>> +  blk_get_if_type_name(desc->if_type),
>> +  desc->devnum, part);
>> +}
>> +}
>>  return EFI_SUCCESS;
>>  }
>>
>> --
>> 2.25.1
>>



Re: [PATCH v2 2/2] efi_loader: identify EFI system partition

2020-04-05 Thread AKASHI Takahiro
Heinrich,

On Sun, Apr 05, 2020 at 11:28:18AM +0200, Heinrich Schuchardt wrote:
> For capsule updates we need to identify the EFI system partition.

Right, but

> Signed-off-by: Heinrich Schuchardt 
> ---
> v2:
>   no change
> ---
>  include/efi_loader.h  |  7 +++
>  lib/efi_loader/efi_disk.c | 20 
>  2 files changed, 27 insertions(+)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 3f2792892f..4a45033476 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -45,6 +45,13 @@ static inline void *guidcpy(void *dst, const void *src)
>  /* Root node */
>  extern efi_handle_t efi_root;
> 
> +/* EFI system partition */
> +extern struct efi_system_partition {
> + enum if_type if_type;
> + int devnum;
> + u8 part;
> +} efi_system_partition;
> +
>  int __efi_entry_check(void);
>  int __efi_exit_check(void);
>  const char *__efi_nesting(void);
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index fc0682bc48..2f752a5e99 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
> 
> +struct efi_system_partition efi_system_partition;
> +
>  const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
> 
>  /**
> @@ -372,6 +374,24 @@ static efi_status_t efi_disk_add_dev(
>   diskobj->ops.media = >media;
>   if (disk)
>   *disk = diskobj;
> +
> + /* Store first EFI system partition */

I don't think that the policy, first comes first serves as system
partition, is a right decision as
- the order of device probe on U-Boot is indeterministic, and
- there can be several partitions that hold a system partition bit.
  You may have OS installed on eMMC, but also may have bootable DVD
  on the system.

-Takahiro Akashi

> + if (part && !efi_system_partition.if_type) {
> + int r;
> + disk_partition_t info;
> +
> + r = part_get_info(desc, part, );
> + if (r)
> + return EFI_DEVICE_ERROR;
> + if (info.bootable & PART_EFI_SYSTEM_PARTITION) {
> + efi_system_partition.if_type = desc->if_type;
> + efi_system_partition.devnum = desc->devnum;
> + efi_system_partition.part = part;
> + EFI_PRINT("EFI system partition: %s %d:%d\n",
> +   blk_get_if_type_name(desc->if_type),
> +   desc->devnum, part);
> + }
> + }
>   return EFI_SUCCESS;
>  }
> 
> --
> 2.25.1
> 


Re: Re: [PATCH v2 1/2] serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

2020-04-05 Thread Bin Meng
Hi Simon,

On Mon, Apr 6, 2020 at 11:43 AM Simon Glass  wrote:
>
> Hi Bin,
>
> On Fri, 3 Apr 2020 at 02:35, Bin Meng  wrote:
> >
> > Hi Wolfgang,
> >
> > On Fri, Apr 3, 2020 at 4:26 PM Wolfgang Wallner
> >  wrote:
> > >
> > >
> > > Hi Andy, Bin,
> > >
> > > > -"Andy Shevchenko"  schrieb: -
> > > > On Thu, Apr 2, 2020 at 7:55 AM Bin Meng  wrote:
> > > > > On Thu, Apr 2, 2020 at 1:55 AM Simon Glass  wrote:
> > > > > > On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko 
> > > > > >  wrote:
> > > > > > > On Wed, Apr 01, 2020 at 10:56:26AM -0600, Simon Glass wrote:
> > > > > > > > On Wed, 1 Apr 2020 at 08:45, Andy Shevchenko 
> > > > > > > >  wrote:
> > > > > > > > > On Wed, Apr 1, 2020 at 5:32 PM Bin Meng  
> > > > > > > > > wrote:
> > > > > > > > > > On Wed, Apr 1, 2020 at 9:58 PM Andy Shevchenko
> > > > > > > > > >  wrote:
> > > > > > > > > > >
> > > > > > > > > > > The commit breaks serial console on the Intel Edison.
> > > > > > > > > > >
> > > > > > > > > > > This reverts commit 
> > > > > > > > > > > 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.
> > > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Andy Shevchenko 
> > > > > > > > > > > 
> > > > > > > > > > > ---
> > > > > > > > > > >  drivers/serial/ns16550.c | 40 
> > > > > > > > > > > 
> > > > > > > > > > >  1 file changed, 12 insertions(+), 28 deletions(-)
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Could you please spend some time to investigate why this 
> > > > > > > > > > breaks Intel Edison?
> > > > > > > > > >
> > > > > > > > > > Reverting this patch would mean we break other boards too as
> > > > > > > > > > Wolfgang's patch wanted to fix the breakage in the first 
> > > > > > > > > > place. Much
> > > > > > > > > > appreciated!
> > > > > > > > >
> > > > > > > > > I guess I'm wrong person here. The DM code is a complete 
> > > > > > > > > black box to me.
> > > > > > > > > Nevertheless, I may test any provided fix / debug / etc patch 
> > > > > > > > > by request.
> > > > > > > > >
> > > > > > > > > And I think it's fair to investigate by the one who made a 
> > > > > > > > > regression
> > > > > > > > > in the first place.
> > > > > > > >
> > > > > > > > Given that we have conflicting breakages, we need to debug 
> > > > > > > > Edison.
> > > > > > >
> > > > > > > I would glad to test any suggested change or debug patch!
> > > > > > >
> > > > > > > > Does it enable the debug UART?
> > > > > > >
> > > > > > > If I am not mistaken, it does not.
> > > > > >
> > > > > > Looks like you are right. If you know the address you could do that 
> > > > > > -
> > > > > > see minnowmax for an example.
> > > > >
> > > > > Please suggest what's the best approach to proceed.
> > > >
> > > > I think I understand what happened, and Wolfgang's patch *is* a culprit.
> > > >
> > > > In serial_intel_mid.c we setup a divisor before probing the actual
> > > > device. Now, since the address retrieving has been moved further in
> > > > the initialization, we are writing to unknown registers and thus don't
> > > > properly initialize hardware.
> > >
> > > Yes, you are right, mid_serial_probe() relies on plat->base being set by
> > > ns16550_serial_ofdata_to_platdata().
> > >
> > > I was not aware that other drivers rely on ns16550 in this way.
> > > And now that I know I see that there are few more:
> > >
> > >   $ grep -r -l --include='*.c' -e ns16550_serial_probe -e 
> > > ns16550_serial_ofdata_to_platdata
> > >   drivers/serial/serial_intel_mid.c
> > >   drivers/serial/serial_rockchip.c
> > >   drivers/serial/serial_omap.c
> > >   drivers/serial/ns16550.c
> > >   arch/x86/cpu/apollolake/uart.c
> > >   arch/x86/cpu/slimbootloader/serial.c
> > >
> > > This means my patch has a wider impact than what I have taken care of.
> > >
> > > @Bin: I'm fine with reverting 720f9e1 for now. I will come back with a
> > > new revision of this patch when I had the time to look at the other 
> > > impacted
> > > drivers.
> > >
> > > But reverting 720f9e1 is IMHO only a temporary workaround, as the 
> > > underlying
> > > problem (possible PCI access in ofdata_to_platdata()) should be fixed 
> > > anyway,
> > > at least my interpretation of the comment in drivers/pci/pci-uclass.c is 
> > > that
> > > this PCI access should not be there:
> > >
> > > "A common cause of this problem is that this function is called in the
> > > ofdata_to_platdata() method of @dev. Accessing the PCI bus in that
> > > method is not allowed, since it has not yet been probed. To fix this,
> > > move that access to the probe() method of @dev instead."
> > >
> >
> > Yes, when I looked at this, I wonder why the first commit was
> > introduced. Simon, could you please explain more about the DM changes
> > below?
>
> Yes, please see the cover letter for the series:
>
> https://www.mail-archive.com/u-boot@lists.denx.de/msg352249.html
>

Thanks. But still, as I described in my fix commit [1], there are
chances that any PCI based ns16550 

Re: [RFC] dm: uclass: add functions to get device by platdata

2020-04-05 Thread Simon Glass
Hi Walter,

On Mon, 9 Mar 2020 at 12:27, Walter Lozano  wrote:
>
> Hi Simon
>
> On 6/3/20 17:32, Simon Glass wrote:
> > Hi Walter,
> >
> > On Fri, 6 Mar 2020 at 09:10, Walter Lozano  
> > wrote:
> >> Hi Simon,
> >>
> >> Thanks again for taking the time to check my comments.
> >>
> >> On 6/3/20 10:17, Simon Glass wrote:
> >>> Hi Walter,
> >>>
> >>> On Thu, 5 Mar 2020 at 06:54, Walter Lozano  
> >>> wrote:
>  Hi Simon,
> 
>  Thanks for taking the time to check for my comments
> 
>  On 4/3/20 20:11, Simon Glass wrote:
> 
> > Hi Walter,
> >
> > On Wed, 4 Mar 2020 at 12:40, Walter Lozano 
> >  wrote:
> >> When OF_PLATDATA is enabled DT information is parsed and platdata
> >> structures are populated. In this context the links between DT nodes 
> >> are
> >> represented as pointers to platdata structures, and there is no clear 
> >> way
> >> to access to the device which owns the structure.
> >>
> >> This patch implements a set of functions:
> >>
> >> - device_find_by_platdata
> >> - uclass_find_device_by_platdata
> >>
> >> to access to the device.
> >>
> >> Signed-off-by: Walter Lozano 
> >> ---
> >> drivers/core/device.c| 19 +++
> >> drivers/core/uclass.c| 34 
> >> ++
> >> include/dm/device.h  |  2 ++
> >> include/dm/uclass-internal.h |  3 +++
> >> include/dm/uclass.h  |  2 ++
> >> 5 files changed, 60 insertions(+)
> > This is interesting. Could you also add the motivation for this? It's
> > not clear to me who would call this function.
>  I have been reviewing the OF_PLATDATA support as an R project, in this 
>  context, in order to have
>  a better understanding on the possibilities and limitations I decided to 
>  add its support to iMX6,
>  more particularly to the MMC drivers. The link issue arises when I tried 
>  to setup the GPIO for
>  Card Detection, which is trivial when DT is available. However, when 
>  OF_PLATDATA is enabled
>  this seems, at least for me, not straightforward.
> 
>  In order to overcome this limitation I think that having a set of 
>  functions to find/get devices
>  based on platdata could be useful. Of course, there might be a better 
>  approach/idea, so that is
>  the motivation for this RFC.
> 
>  An example of the usage could be
> 
>  #if CONFIG_IS_ENABLED(DM_GPIO)
> 
> struct udevice *gpiodev;
> 
> ret = uclass_get_device_by_platdata(UCLASS_GPIO, (void 
>  *)dtplat->cd_gpios->node, );
> 
> if (ret)
> return ret;
> 
> ret = gpio_dev_request_index(gpiodev, gpiodev->name, 
>  "cd-gpios",
>  dtplat->cd_gpios->arg[0], 
>  GPIOD_IS_IN,
>  dtplat->cd_gpios->arg[1], 
>  >cd_gpio);
> 
> if (ret)
> return ret;
> 
>  #endif
> 
>  This is part of my current work, a series of patches to add OF_PLATDATA 
>  support as explained.
> 
>  Does this make sense to you?
> >>> Not yet :-)
> >>>
> >>> What is the context of this call? Typically dtplat is only available
> >>> in the driver that includes it.
> >> Sorry for not being clear enough. I'm working in a patchset that needs
> >> some clean up, that is the reason I didn't send it yet. I'll try to
> >> clarify, but if you think it could be useful to share it, please let me
> >> know.
> >>
> >>> What driver is the above code in? Is it for MMC that needs a GPIO to
> >>> function? I'll assume it is for now.
> >> The driver on which I'm working in is drivers/mmc/fsl_esdhc_imx.c, I'm
> >> adding support for OF_PLATDATA to it, and in this sense trying to get
> >> the GPIOs used for CD to be requested.
> >>
> >>> Then the weird thing is that we are accessing the dtplat of another
> >>> device. It's a clever technique but I wonder if we can find another
> >>> way.
> >>>
> >>> If you see drivers/mmc/rockchip_sdhci.c it has:
> >>>
> >>> ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks, );
> >>>
> >>> So I wonder if we need gpio_dev_request_by_platdata()?
> >> Thanks for pointing to this example, as I saw it before starting to work
> >> on these functions and had some doubts. I'll use it in the next
> >> paragraph to share my thoughts and the motivation of my work.
> >>
> >>   From my understanding, clk_get_by_index_platdata in this context can
> >> only get a UCLASS_CLK device with id == 0. Is this correct?
> >>
> >> If it is so, this will only allow us to use this function if we know in
> >> advance that the UCLASS_CLK device has index 0.
> >>
> >> How can we get the correct UCLASS_CLK device in case of multiple instances?
> > We actually can't support 

Re: Re: [PATCH v2 1/2] serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

2020-04-05 Thread Simon Glass
Hi Bin,

On Fri, 3 Apr 2020 at 02:35, Bin Meng  wrote:
>
> Hi Wolfgang,
>
> On Fri, Apr 3, 2020 at 4:26 PM Wolfgang Wallner
>  wrote:
> >
> >
> > Hi Andy, Bin,
> >
> > > -"Andy Shevchenko"  schrieb: -
> > > On Thu, Apr 2, 2020 at 7:55 AM Bin Meng  wrote:
> > > > On Thu, Apr 2, 2020 at 1:55 AM Simon Glass  wrote:
> > > > > On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko 
> > > > >  wrote:
> > > > > > On Wed, Apr 01, 2020 at 10:56:26AM -0600, Simon Glass wrote:
> > > > > > > On Wed, 1 Apr 2020 at 08:45, Andy Shevchenko 
> > > > > > >  wrote:
> > > > > > > > On Wed, Apr 1, 2020 at 5:32 PM Bin Meng  
> > > > > > > > wrote:
> > > > > > > > > On Wed, Apr 1, 2020 at 9:58 PM Andy Shevchenko
> > > > > > > > >  wrote:
> > > > > > > > > >
> > > > > > > > > > The commit breaks serial console on the Intel Edison.
> > > > > > > > > >
> > > > > > > > > > This reverts commit 
> > > > > > > > > > 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Andy Shevchenko 
> > > > > > > > > > 
> > > > > > > > > > ---
> > > > > > > > > >  drivers/serial/ns16550.c | 40 
> > > > > > > > > > 
> > > > > > > > > >  1 file changed, 12 insertions(+), 28 deletions(-)
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Could you please spend some time to investigate why this 
> > > > > > > > > breaks Intel Edison?
> > > > > > > > >
> > > > > > > > > Reverting this patch would mean we break other boards too as
> > > > > > > > > Wolfgang's patch wanted to fix the breakage in the first 
> > > > > > > > > place. Much
> > > > > > > > > appreciated!
> > > > > > > >
> > > > > > > > I guess I'm wrong person here. The DM code is a complete black 
> > > > > > > > box to me.
> > > > > > > > Nevertheless, I may test any provided fix / debug / etc patch 
> > > > > > > > by request.
> > > > > > > >
> > > > > > > > And I think it's fair to investigate by the one who made a 
> > > > > > > > regression
> > > > > > > > in the first place.
> > > > > > >
> > > > > > > Given that we have conflicting breakages, we need to debug Edison.
> > > > > >
> > > > > > I would glad to test any suggested change or debug patch!
> > > > > >
> > > > > > > Does it enable the debug UART?
> > > > > >
> > > > > > If I am not mistaken, it does not.
> > > > >
> > > > > Looks like you are right. If you know the address you could do that -
> > > > > see minnowmax for an example.
> > > >
> > > > Please suggest what's the best approach to proceed.
> > >
> > > I think I understand what happened, and Wolfgang's patch *is* a culprit.
> > >
> > > In serial_intel_mid.c we setup a divisor before probing the actual
> > > device. Now, since the address retrieving has been moved further in
> > > the initialization, we are writing to unknown registers and thus don't
> > > properly initialize hardware.
> >
> > Yes, you are right, mid_serial_probe() relies on plat->base being set by
> > ns16550_serial_ofdata_to_platdata().
> >
> > I was not aware that other drivers rely on ns16550 in this way.
> > And now that I know I see that there are few more:
> >
> >   $ grep -r -l --include='*.c' -e ns16550_serial_probe -e 
> > ns16550_serial_ofdata_to_platdata
> >   drivers/serial/serial_intel_mid.c
> >   drivers/serial/serial_rockchip.c
> >   drivers/serial/serial_omap.c
> >   drivers/serial/ns16550.c
> >   arch/x86/cpu/apollolake/uart.c
> >   arch/x86/cpu/slimbootloader/serial.c
> >
> > This means my patch has a wider impact than what I have taken care of.
> >
> > @Bin: I'm fine with reverting 720f9e1 for now. I will come back with a
> > new revision of this patch when I had the time to look at the other impacted
> > drivers.
> >
> > But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying
> > problem (possible PCI access in ofdata_to_platdata()) should be fixed 
> > anyway,
> > at least my interpretation of the comment in drivers/pci/pci-uclass.c is 
> > that
> > this PCI access should not be there:
> >
> > "A common cause of this problem is that this function is called in the
> > ofdata_to_platdata() method of @dev. Accessing the PCI bus in that
> > method is not allowed, since it has not yet been probed. To fix this,
> > move that access to the probe() method of @dev instead."
> >
>
> Yes, when I looked at this, I wonder why the first commit was
> introduced. Simon, could you please explain more about the DM changes
> below?

Yes, please see the cover letter for the series:

https://www.mail-archive.com/u-boot@lists.denx.de/msg352249.html


>
> commit 82de42fa14682d408da935adfb0f935354c5008f
> Author: Simon Glass 
> Date:   Sun Dec 29 21:19:18 2019 -0700
>
> dm: core: Allocate parent data separate from probing parent
>
> At present the parent is probed before the child's ofdata_to_platdata()
> method is called. Adjust the logic slightly so that probing parents is
> not done until afterwards.
>
> Signed-off-by: Simon Glass 
>
> > @Andy: Regarding 

Re: [RFC 7/7] mx6cuboxi: enable OF_PLATDATA

2020-04-05 Thread Simon Glass
On Sun, 29 Mar 2020 at 21:32, Walter Lozano  wrote:
>
> Signed-off-by: Walter Lozano 
> ---
>  configs/mx6cuboxi_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: SImon Glass 

(with commit msg)


Re: [RFC 1/7] mmc: fsl_esdhc_imx: add OF_PLATDATA support

2020-04-05 Thread Simon Glass
Hi Walter,

On Sun, 29 Mar 2020 at 21:32, Walter Lozano  wrote:
>
> Signed-off-by: Walter Lozano 
> ---
>  drivers/mmc/fsl_esdhc_imx.c | 46 +
>  1 file changed, 42 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 4900498e9b..761a4b46e9 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -29,6 +29,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  #if !CONFIG_IS_ENABLED(BLK)
>  #include "mmc_private.h"
> @@ -98,6 +100,11 @@ struct fsl_esdhc {
>  };
>
>  struct fsl_esdhc_plat {
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +   /* Put this first since driver model will copy the data here */
> +   struct dtd_fsl_imx6q_usdhc dtplat;
> +#endif
> +
> struct mmc_config cfg;
> struct mmc mmc;
>  };
> @@ -1377,14 +1384,18 @@ static int fsl_esdhc_probe(struct udevice *dev)
> struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> struct fsl_esdhc_plat *plat = dev_get_platdata(dev);
> struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> +#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> const void *fdt = gd->fdt_blob;
> int node = dev_of_offset(dev);
> +   fdt_addr_t addr;
> +#else
> +   struct dtd_fsl_imx6q_usdhc *dtplat = >dtplat;
> +#endif
> struct esdhc_soc_data *data =
> (struct esdhc_soc_data *)dev_get_driver_data(dev);
>  #if CONFIG_IS_ENABLED(DM_REGULATOR)
> struct udevice *vqmmc_dev;
>  #endif
> -   fdt_addr_t addr;
> unsigned int val;
> struct mmc *mmc;
>  #if !CONFIG_IS_ENABLED(BLK)
> @@ -1392,14 +1403,23 @@ static int fsl_esdhc_probe(struct udevice *dev)
>  #endif
> int ret;
>
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +   priv->esdhc_regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
> +   val = plat->dtplat.bus_width;
> +   if (val == 8)
> +   priv->bus_width = 8;
> +   else if (val == 4)
> +   priv->bus_width = 4;
> +   else
> +   priv->bus_width = 1;
> +   priv->non_removable = 1;
> +#else
> addr = dev_read_addr(dev);
> if (addr == FDT_ADDR_T_NONE)
> return -EINVAL;
> priv->esdhc_regs = (struct fsl_esdhc *)addr;
> priv->dev = dev;
> priv->mode = -1;
> -   if (data)
> -   priv->flags = data->flags;
>
> val = dev_read_u32_default(dev, "bus-width", -1);
> if (val == 8)
> @@ -1462,7 +1482,9 @@ static int fsl_esdhc_probe(struct udevice *dev)
> priv->vs18_enable = 1;
> }
>  #endif
> -
> +#endif
> +   if (data)
> +   priv->flags = data->flags;
> /*
>  * TODO:
>  * Because lack of clk driver, if SDHC clk is not enabled,
> @@ -1513,9 +1535,11 @@ static int fsl_esdhc_probe(struct udevice *dev)
> return ret;
> }
>
> +#if !CONFIG_IS_ENABLED(OF_PLATDATA)

Maybe can use if() for this one?

> ret = mmc_of_parse(dev, >cfg);
> if (ret)
> return ret;
> +#endif
>
> mmc = >mmc;
> mmc->cfg = >cfg;
> @@ -1648,4 +1672,18 @@ U_BOOT_DRIVER(fsl_esdhc) = {
> .platdata_auto_alloc_size = sizeof(struct fsl_esdhc_plat),
> .priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv),
>  };
> +
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)

Don't you already have a U_BOOT_DRIVER declaration?

You may need to change the name of your existing driver though (see
of-platdata docs).

So if it is because of that, please add a comment.

> +U_BOOT_DRIVER(fsl_usdhc) = {
> +   .name   = "fsl_imx6q_usdhc",
> +   .id = UCLASS_MMC,
> +   .ops= _esdhc_ops,
> +#if CONFIG_IS_ENABLED(BLK)
> +   .bind   = fsl_esdhc_bind,
> +#endif
> +   .probe  = fsl_esdhc_probe,
> +   .platdata_auto_alloc_size = sizeof(struct fsl_esdhc_plat),
> +   .priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv),
> +};
> +#endif
>  #endif
> --
> 2.20.1
>

Regards,
Simon


Re: [RFC 3/7] dtoc: update dtb_platdata to support cd-gpio

2020-04-05 Thread Simon Glass
On Sun, 29 Mar 2020 at 21:32, Walter Lozano  wrote:
>
> Signed-off-by: Walter Lozano 
> ---
>  tools/dtoc/dtb_platdata.py | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

This looks OK, but please add a test.


>
> diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
> index 037e82c8bb..c52da7925e 100644
> --- a/tools/dtoc/dtb_platdata.py
> +++ b/tools/dtoc/dtb_platdata.py
> @@ -211,7 +211,7 @@ class DtbPlatdata(object):
>  Return:
>  Number of argument cells is this is a phandle, else None
>  """
> -if prop.name in ['clocks']:
> +if prop.name in ['clocks', 'cd-gpios']:
>  if not isinstance(prop.value, list):
>  prop.value = [prop.value]
>  val = prop.value
> @@ -231,8 +231,11 @@ class DtbPlatdata(object):
>  if not target:
>  raise ValueError("Cannot parse '%s' in node '%s'" %
>   (prop.name, node_name))
> -prop_name = '#clock-cells'
> -cells = target.props.get(prop_name)
> +cells = None
> +for prop_name in ['#clock-cells', '#gpio-cells']:
> +cells = target.props.get(prop_name)
> +if cells:
> +break
>  if not cells:
>  raise ValueError("Node '%s' has no '%s' property" %
>  (target.name, prop_name))
> --
> 2.20.1
>


Re: [RFC 5/7] gpio: mxc_gpio: add OF_PLATDATA support

2020-04-05 Thread Simon Glass
Hi Walter,

On Sun, 29 Mar 2020 at 21:32, Walter Lozano  wrote:
>
> Signed-off-by: Walter Lozano 
> ---
>  drivers/gpio/mxc_gpio.c | 27 ++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
> index c924e52f07..ba63c0b76a 100644
> --- a/drivers/gpio/mxc_gpio.c
> +++ b/drivers/gpio/mxc_gpio.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  enum mxc_gpio_direction {
> MXC_GPIO_DIRECTION_IN,
> @@ -22,6 +24,10 @@ enum mxc_gpio_direction {
>  #define GPIO_PER_BANK  32
>
>  struct mxc_gpio_plat {
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +   /* Put this first since driver model will copy the data here */
> +   struct dtd_fsl_imx6q_gpio dtplat;
> +#endif
> int bank_index;
> struct gpio_regs *regs;
>  };
> @@ -303,8 +309,16 @@ static int mxc_gpio_bind(struct udevice *dev)
>  * is statically initialized in U_BOOT_DEVICES.Here
>  * will return.
>  */
> -   if (plat)
> +
> +   if (plat) {
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +   struct dtd_fsl_imx6q_gpio *dtplat = >dtplat;
> +
> +   plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
> +   plat->bank_index = dev->req_seq;
> +#endif
> return 0;
> +   }
>
> addr = devfdt_get_addr(dev);
> if (addr == FDT_ADDR_T_NONE)
> @@ -347,6 +361,17 @@ U_BOOT_DRIVER(gpio_mxc) = {
> .bind   = mxc_gpio_bind,
>  };
>
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +U_BOOT_DRIVER(fsl_imx6q_gpio) = {

Please drop this and find a way to use the existing U_BOOT_DRIVER() declaration.

> +   .name   = "fsl_imx6q_gpio",
> +   .id = UCLASS_GPIO,
> +   .ops= _mxc_ops,
> +   .probe  = mxc_gpio_probe,
> +   .priv_auto_alloc_size = sizeof(struct mxc_bank_info),
> +   .bind   = mxc_gpio_bind,
> +};
> +#endif
> +
>  #if !CONFIG_IS_ENABLED(OF_CONTROL)
>  static const struct mxc_gpio_plat mxc_plat[] = {
> { 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
> --
> 2.20.1
>

Regards,
Simon


Re: [PATCH 2/2] dm: dump.c: Refactor dm_dump_drivers prints

2020-04-05 Thread Simon Glass
On Sun, 5 Apr 2020 at 10:47, Ovidiu Panait  wrote:
>
> Refactor the printing sequence in dm_dump_drivers to make it more clear.
>
> Signed-off-by: Ovidiu Panait 
> Cc: Sean Anderson 
> Cc: Simon Glass 
> ---
>  drivers/core/dump.c | 18 +++---
>  1 file changed, 11 insertions(+), 7 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 3/3] dm: core: refactor functions reading an u32 from dt

2020-04-05 Thread Simon Glass
Hi Dario,

On Sat, 4 Apr 2020 at 06:49,  wrote:
>
> > Il 2 aprile 2020 alle 20.54 Simon Glass  ha scritto:
> >
> >
> > Hi Dario,
> >
> > On Wed, 1 Apr 2020 at 13:34,  wrote:
> > >
> > >
> > > > Il 31 marzo 2020 alle 1.57 Simon Glass  ha scritto:
> > > >
> > > >
> > > > On Sun, 29 Mar 2020 at 10:05, Dario Binacchi  wrote:
> > > > >
> > > > > Now reading a 32 bit value from a device-tree property can be 
> > > > > expressed
> > > > > as reading the first element of an array with a single value.
> > > > >
> > > > > Signed-off-by: Dario Binacchi 
> > > > >
> > > > > ---
> > > > >
> > > > >  drivers/core/of_access.c | 16 +---
> > > > >  drivers/core/ofnode.c| 23 ++-
> > > > >  2 files changed, 3 insertions(+), 36 deletions(-)
> > > >
> > > > Reviewed-by: Simon Glass 
> > > >
> > > > Can you please check the code-size delta in SPL on a suitable board?
> > >
> > > I have a black beaglebone available (am335x_evm_defconfig).
> > >
> > > u-boot-spl.map generated without applying the refactoring patch
> > > 
> > >  .text.ofnode_read_u32
> > > 0x   0x2e drivers/built-in.o
> > >  .text.ofnode_read_u32_index
> > > 0x   0x38 drivers/built-in.o
> > >  .text.ofnode_read_u32_default
> > > 0x   0x12 drivers/built-in.o
> > >
> > > u-boot-spl.map genarated with the refactoring patch applied
> > > 
> > >  .text.ofnode_read_u32_index
> > > 0x   0x38 drivers/built-in.o
> > >  .text.ofnode_read_u32
> > > 0x0x8 drivers/built-in.o
> > >  .text.ofnode_read_u32_default
> > > 0x   0x14 drivers/built-in.o
> >
> > Possibly, but a better test is to build your branch with the patch in:
> >
> > buildman -b  
> >
> > Then check the size:
> >
> > buildman -b  -sS
> >
> > or function detail:
> >
> > buildman -b  -sSB
> >
> > That will give us a true picture for SPL. It will show incremental
> > size increase with your patch.
>
> Hi Simon,
> this is the buildman response:
> ...
> 03: dm: core: support reading a single indexed u32 value
> 04: dm: core: refactor functions reading an u32 from dt
>arm: (for 4/708 boards) all +11.5 bss -10.0 text +21.5
> am335x_hs_evm  : all +24 text +24
>u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
>  function   old new   
> delta
>  ofnode_read_u32_index-  62 
> +62
>  ofnode_read_u32_default 18  20  
> +2
>  ofnode_read_u32 46   8 
> -38
> am335x_hs_evm_uart: all +24 text +24
>u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
>  function   old new   
> delta
>  ofnode_read_u32_index-  62 
> +62
>  ofnode_read_u32_default 18  20  
> +2
>  ofnode_read_u32 46   8 
> -38
> am335x_evm : bss -24 text +24
>u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
>  function   old new   
> delta
>  ofnode_read_u32_index-  62 
> +62
>  ofnode_read_u32_default 18  20  
> +2
>  ofnode_read_u32 46   8 
> -38
> am335x_boneblack_vboot: all -2 bss -16 text +14
>u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
>  function   old new   
> delta
>  ofnode_read_u32_index-  62 
> +62
>  ofnode_read_u32_default 18  20  
> +2
>  ofnode_read_u32 46   8 
> -38

This does not actually look like SPL though, only U-Boot. I hope that
means that SPL doesn't increase in size.

Anyway for U-Boot proper it looks like it adds about 24 bytes of code.
I think it is worth it.

Regards,
Simon


Re: [RFC 2/7] mmc: fsl_esdhc_imx: add ofdata_to_platdata support

2020-04-05 Thread Simon Glass
Hi Walter

On Sun, 29 Mar 2020 at 21:32, Walter Lozano  wrote:
>

All of these commits need a commit message please.

> Signed-off-by: Walter Lozano 
> ---
>  drivers/mmc/fsl_esdhc_imx.c | 71 ++---
>  1 file changed, 42 insertions(+), 29 deletions(-)
>

Reviewed-by: SImon Glass 

> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 761a4b46e9..049a1b6ea8 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -1379,41 +1379,20 @@ __weak void init_clk_usdhc(u32 index)
>  {
>  }
>
> -static int fsl_esdhc_probe(struct udevice *dev)
> -{
> -   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> -   struct fsl_esdhc_plat *plat = dev_get_platdata(dev);
> -   struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> +static int fsl_esdhc_ofdata_to_platdata(struct udevice *dev){
> +
>  #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -   const void *fdt = gd->fdt_blob;
> -   int node = dev_of_offset(dev);
> -   fdt_addr_t addr;
> -#else
> -   struct dtd_fsl_imx6q_usdhc *dtplat = >dtplat;
> -#endif
> -   struct esdhc_soc_data *data =
> -   (struct esdhc_soc_data *)dev_get_driver_data(dev);
> +   struct fsl_esdhc_priv *priv = dev_get_priv(dev);
>  #if CONFIG_IS_ENABLED(DM_REGULATOR)
> struct udevice *vqmmc_dev;
> +   int ret;
>  #endif
> +   const void *fdt = gd->fdt_blob;
> +   int node = dev_of_offset(dev);
> +
> +   fdt_addr_t addr;
> unsigned int val;
> -   struct mmc *mmc;
> -#if !CONFIG_IS_ENABLED(BLK)
> -   struct blk_desc *bdesc;
> -#endif
> -   int ret;
>
> -#if CONFIG_IS_ENABLED(OF_PLATDATA)
> -   priv->esdhc_regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
> -   val = plat->dtplat.bus_width;
> -   if (val == 8)
> -   priv->bus_width = 8;
> -   else if (val == 4)
> -   priv->bus_width = 4;
> -   else
> -   priv->bus_width = 1;
> -   priv->non_removable = 1;
> -#else
> addr = dev_read_addr(dev);
> if (addr == FDT_ADDR_T_NONE)
> return -EINVAL;
> @@ -1483,8 +1462,40 @@ static int fsl_esdhc_probe(struct udevice *dev)
> }
>  #endif
>  #endif
> +   return 0;
> +}
> +
> +static int fsl_esdhc_probe(struct udevice *dev)
> +{
> +   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> +   struct fsl_esdhc_plat *plat = dev_get_platdata(dev);
> +   struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> +   struct esdhc_soc_data *data =
> +   (struct esdhc_soc_data *)dev_get_driver_data(dev);
> +   struct mmc *mmc;
> +#if !CONFIG_IS_ENABLED(BLK)

Should not need to support !BLK now. The migration date has passed.

> +   struct blk_desc *bdesc;
> +#endif
> +   int ret;
> +
> +#if CONFIG_IS_ENABLED(OF_PLATDATA)
> +   struct dtd_fsl_imx6q_usdhc *dtplat = >dtplat;
> +   unsigned int val;
> +
> +   priv->esdhc_regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
> +   val = plat->dtplat.bus_width;
> +   if (val == 8)
> +   priv->bus_width = 8;
> +   else if (val == 4)
> +   priv->bus_width = 4;
> +   else
> +   priv->bus_width = 1;
> +   priv->non_removable = 1;
> +#endif
> +
> if (data)
> priv->flags = data->flags;
> +
> /*
>  * TODO:
>  * Because lack of clk driver, if SDHC clk is not enabled,
> @@ -1664,6 +1675,7 @@ U_BOOT_DRIVER(fsl_esdhc) = {
> .name   = "fsl-esdhc-mmc",
> .id = UCLASS_MMC,
> .of_match = fsl_esdhc_ids,
> +   .ofdata_to_platdata = fsl_esdhc_ofdata_to_platdata,
> .ops= _esdhc_ops,
>  #if CONFIG_IS_ENABLED(BLK)
> .bind   = fsl_esdhc_bind,
> @@ -1677,6 +1689,7 @@ U_BOOT_DRIVER(fsl_esdhc) = {
>  U_BOOT_DRIVER(fsl_usdhc) = {
> .name   = "fsl_imx6q_usdhc",
> .id = UCLASS_MMC,
> +   .ofdata_to_platdata = fsl_esdhc_ofdata_to_platdata,
> .ops= _esdhc_ops,
>  #if CONFIG_IS_ENABLED(BLK)
> .bind   = fsl_esdhc_bind,
> --
> 2.20.1
>

Regards,
Simon


Re: [PATCH 1/2] dm: dump.c: Fix segfault when entry->of_match is NULL

2020-04-05 Thread Simon Glass
Hi,

On Sun, 5 Apr 2020 at 11:08, Ovidiu Panait  wrote:
>
> On 05.04.2020 19:53, Sean Anderson wrote:
>
> > On 4/5/20 12:47 PM, Ovidiu Panait wrote:
> >> Currently, dm drivers command produces a segfault:
> >> => dm drivers
> >> DriverCompatible
> >> 
> >> Segmentation fault (core dumped)
> >>
> >> This is caused by a NULL pointer dereference of entry->of_match.
> >> Add a check to prevent this.
> > This should have been fixed in version 3 of the original patch [1]. Did
> > it not get merged properly? This is the second time I've been CC'd by
> > someone who wants to fix this.
> >
> > [1] https://patchwork.ozlabs.org/patch/1234460/
>
> Yes, it seems that an older version of the patch was merged:
>
> https://github.com/u-boot/u-boot/commit/7b9d60fc1ff67b3959a7db394084b27268a7686d

OK, so can someone do a fixup patch for this?

Regards,
Simon


Re: [PATCH V2 1/5] common: bouncebuf: Permit passing custom alignment check function

2020-04-05 Thread Jaehoon Chung
On 4/4/20 7:45 PM, Marek Vasut wrote:
> Add extended version of the bounce_buffer_start(), which permits passing in
> a custom alignment checker function for the buffer. This is useful e.g. on
> systems with various DMA restrictions and where the checker function might
> be more complex than a simple CPU cache alignment check.
> 
> Signed-off-by: Marek Vasut 
> Cc: Daniel Schwierzeck 
> Cc: Masahiro Yamada 
> Cc: Peng Fan 
> Cc: Simon Glass 
> Cc: Tom Rini 
> ---
> V2: No change
> ---
>  common/bouncebuf.c  | 20 +++-
>  include/bouncebuf.h | 15 +++
>  2 files changed, 30 insertions(+), 5 deletions(-)
> 
> diff --git a/common/bouncebuf.c b/common/bouncebuf.c
> index 614eb36c78..0ace152b98 100644
> --- a/common/bouncebuf.c
> +++ b/common/bouncebuf.c
> @@ -31,17 +31,19 @@ static int addr_aligned(struct bounce_buffer *state)
>   return 1;
>  }
>  
> -int bounce_buffer_start(struct bounce_buffer *state, void *data,
> - size_t len, unsigned int flags)
> +int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data,
> +  size_t len, unsigned int flags,
> +  size_t alignment,
> +  int (*addr_is_aligned)(struct bounce_buffer 
> *state))
>  {
>   state->user_buffer = data;
>   state->bounce_buffer = data;
>   state->len = len;
> - state->len_aligned = roundup(len, ARCH_DMA_MINALIGN);
> + state->len_aligned = roundup(len, alignment);
>   state->flags = flags;
>  
> - if (!addr_aligned(state)) {
> - state->bounce_buffer = memalign(ARCH_DMA_MINALIGN,
> + if (!addr_is_aligned(state)) {

how about checking condition whether addr_is_aligned function is present or not 
at here?

Best Regards,
Jaehoon Chung

> + state->bounce_buffer = memalign(alignment,
>   state->len_aligned);
>   if (!state->bounce_buffer)
>   return -ENOMEM;
> @@ -62,6 +64,14 @@ int bounce_buffer_start(struct bounce_buffer *state, void 
> *data,
>   return 0;
>  }
>  
> +int bounce_buffer_start(struct bounce_buffer *state, void *data,
> + size_t len, unsigned int flags)
> +{
> + return bounce_buffer_start_extalign(state, data, len, flags,
> + ARCH_DMA_MINALIGN,
> + addr_aligned);
> +}
> +
>  int bounce_buffer_stop(struct bounce_buffer *state)
>  {
>   if (state->flags & GEN_BB_WRITE) {
> diff --git a/include/bouncebuf.h b/include/bouncebuf.h
> index fd9b0f3b28..7427bd12e2 100644
> --- a/include/bouncebuf.h
> +++ b/include/bouncebuf.h
> @@ -62,6 +62,21 @@ struct bounce_buffer {
>   */
>  int bounce_buffer_start(struct bounce_buffer *state, void *data,
>   size_t len, unsigned int flags);
> +
> +/**
> + * bounce_buffer_start() -- Start the bounce buffer session with external 
> align check function
> + * state:stores state passed between bounce_buffer_{start,stop}
> + * data: pointer to buffer to be aligned
> + * len:  length of the buffer
> + * flags:flags describing the transaction, see above.
> + * alignment:alignment of the newly allocated bounce buffer
> + * addr_is_aligned: function for checking the alignment instead of the 
> default one
> + */
> +int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data,
> +  size_t len, unsigned int flags,
> +  size_t alignment,
> +  int (*addr_is_aligned)(struct bounce_buffer 
> *state));
> +
>  /**
>   * bounce_buffer_stop() -- Finish the bounce buffer session
>   * state:stores state passed between bounce_buffer_{start,stop}
> 



[PATCH 3/6] x86: Update SPL for coreboot

2020-04-05 Thread Simon Glass
At present SPL only works on bare-metal builds. With a few tweaks it can
be used for coreboot also.

Signed-off-by: Simon Glass 
---

 arch/x86/lib/spl.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index 95a89c072d5..212b4d596d2 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -63,7 +63,7 @@ static int x86_spl_init(void)
 * is not needed. We could make this a CONFIG option or perhaps
 * place it immediately below CONFIG_SYS_TEXT_BASE.
 */
-   char *ptr = (char *)0x11;
+   __maybe_unused char *ptr = (char *)0x11;
 #else
struct udevice *punit;
 #endif
@@ -111,7 +111,8 @@ static int x86_spl_init(void)
  __func__, ret);
}
 
-#ifndef CONFIG_TPL
+#ifndef CONFIG_SYS_COREBOOT
+# ifndef CONFIG_TPL
memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start);
 
/* TODO(s...@chromium.org): Consider calling cpu_init_r() here */
@@ -140,7 +141,7 @@ static int x86_spl_init(void)
return ret;
}
mtrr_commit(true);
-#else
+# else
ret = syscon_get_by_driver_data(X86_SYSCON_PUNIT, );
if (ret)
debug("Could not find PUNIT (err=%d)\n", ret);
@@ -148,6 +149,7 @@ static int x86_spl_init(void)
ret = set_max_freq();
if (ret)
debug("Failed to set CPU frequency (err=%d)\n", ret);
+# endif
 #endif
 
return 0;
@@ -162,7 +164,7 @@ void board_init_f(ulong flags)
debug("Error %d\n", ret);
panic("x86_spl_init fail");
}
-#ifdef CONFIG_TPL
+#if IS_ENABLED(CONFIG_TPL) || IS_ENABLED(CONFIG_SYS_COREBOOT)
gd->bd = malloc(sizeof(*gd->bd));
if (!gd->bd) {
printf("Out of memory for bd_info size %x\n", sizeof(*gd->bd));
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 5/6] x86: coreboot: Allow building an SPL image

2020-04-05 Thread Simon Glass
Make a few adjustments to allow us to build an SPL image for coreboot.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/Makefile|  4 +++-
 arch/x86/cpu/coreboot/Makefile   |  8 +++-
 arch/x86/cpu/coreboot/coreboot.c |  3 ++-
 arch/x86/cpu/coreboot/coreboot_spl.c | 12 
 arch/x86/cpu/intel_common/Makefile   |  2 ++
 arch/x86/cpu/x86_64/cpu.c|  2 ++
 6 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 arch/x86/cpu/coreboot/coreboot_spl.c

diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 307267a8fb3..ee0499f5d79 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -54,9 +54,11 @@ obj-$(CONFIG_INTEL_QUARK) += quark/
 obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
 obj-$(CONFIG_INTEL_TANGIER) += tangier/
 obj-$(CONFIG_APIC) += lapic.o ioapic.o
-obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o
 obj-$(CONFIG_$(SPL_TPL_)ACPI_GPE) += acpi_gpe.o
 obj-$(CONFIG_QFW) += qfw_cpu.o
+ifndef CONFIG_SYS_COREBOOT
+obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o
+endif
 ifndef CONFIG_$(SPL_)X86_64
 obj-$(CONFIG_SMP) += mp_init.o
 endif
diff --git a/arch/x86/cpu/coreboot/Makefile b/arch/x86/cpu/coreboot/Makefile
index 35b15bb1da8..605f90304e3 100644
--- a/arch/x86/cpu/coreboot/Makefile
+++ b/arch/x86/cpu/coreboot/Makefile
@@ -11,8 +11,14 @@
 # (C) Copyright 2002
 # Daniel Engström, Omicron Ceti AB, dan...@omicron.se.
 
+ifndef CONFIG_SPL
 obj-y += car.o
+endif
+ifdef CONFIG_SPL_BUILD
+obj-y += coreboot_spl.o
+else
+obj-y += sdram.o
+endif
 obj-y += coreboot.o
 obj-y += tables.o
-obj-y += sdram.o
 obj-y += timestamp.o
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 0c4c6348d1d..624caf67a6a 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -27,7 +27,8 @@ int arch_cpu_init(void)
 
timestamp_init();
 
-   return x86_cpu_init_f();
+   return IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() :
+x86_cpu_init_f();
 }
 
 int checkcpu(void)
diff --git a/arch/x86/cpu/coreboot/coreboot_spl.c 
b/arch/x86/cpu/coreboot/coreboot_spl.c
new file mode 100644
index 000..36661871e92
--- /dev/null
+++ b/arch/x86/cpu/coreboot/coreboot_spl.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Google LLC
+ */
+
+#include 
+#include 
+
+int dram_init(void)
+{
+   return 0;
+}
diff --git a/arch/x86/cpu/intel_common/Makefile 
b/arch/x86/cpu/intel_common/Makefile
index 1736bd2b530..374803b8760 100644
--- a/arch/x86/cpu/intel_common/Makefile
+++ b/arch/x86/cpu/intel_common/Makefile
@@ -32,6 +32,8 @@ obj-$(CONFIG_HAVE_P2SB) += p2sb.o
 
 ifdef CONFIG_SPL
 ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_SYS_COREBOOT
 obj-y += cpu_from_spl.o
 endif
 endif
+endif
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index 90925e46ea2..4b64339f259 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -53,6 +53,7 @@ int misc_init_r(void)
return 0;
 }
 
+#ifndef CONFIG_SYS_COREBOOT
 int checkcpu(void)
 {
return 0;
@@ -62,6 +63,7 @@ int print_cpuinfo(void)
 {
return 0;
 }
+#endif
 
 int x86_cpu_reinit_f(void)
 {
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 4/6] x86: cbfs: Drop unwanted declaration

2020-04-05 Thread Simon Glass
The intention here is add a forward declaration, not actually declare a
variable. Fix it.

Signed-off-by: Simon Glass 
---

 include/cbfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/cbfs.h b/include/cbfs.h
index f3bc8ca24af..d915f9426d8 100644
--- a/include/cbfs.h
+++ b/include/cbfs.h
@@ -135,7 +135,7 @@ void file_cbfs_get_next(const struct cbfs_cachenode **file);
  */
 const struct cbfs_cachenode *file_cbfs_find(const char *name);
 
-struct cbfs_priv *priv;
+struct cbfs_priv;
 
 /**
  * cbfs_find_file() - Find a file in a given CBFS
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 2/6] x86: Move work-around out of cpu_jump_to_64bit_uboot()

2020-04-05 Thread Simon Glass
At present this function copies U-Boot from the last 1MB of ROM. This is
not the right way to do it. Instead, the binman symbol should provide the
location.

But in any case the code should live in the caller,
spl_board_load_image(), so that the 64-bit jump function can be used
elsewhere. Move it.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/i386/cpu.c | 10 --
 arch/x86/lib/spl.c  | 13 +
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index c8da7f10e9b..45416a9be5b 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -611,16 +611,6 @@ int cpu_jump_to_64bit_uboot(ulong target)
 
func = (func_t)ptr;
 
-   /*
-* Copy U-Boot from ROM
-* TODO(s...@chromium.org): Figure out a way to get the text base
-* correctly here, and in the device-tree binman definition.
-*
-* Also consider using FIT so we get the correct image length and
-* parameters.
-*/
-   memcpy((char *)target, (char *)0xfff0, 0x10);
-
/* Jump to U-Boot */
func((ulong)pgtable, 0, (ulong)target);
 
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index 90baec2a175..95a89c072d5 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -207,6 +207,19 @@ static int spl_board_load_image(struct spl_image_info 
*spl_image,
spl_image->os = IH_OS_U_BOOT;
spl_image->name = "U-Boot";
 
+   if (!IS_ENABLED(CONFIG_SYS_COREBOOT)) {
+   /*
+* Copy U-Boot from ROM
+* TODO(s...@chromium.org): Figure out a way to get the text 
base
+* correctly here, and in the device-tree binman definition.
+*
+* Also consider using FIT so we get the correct image length
+* and parameters.
+*/
+   memcpy((char *)spl_image->load_addr, (char *)0xfff0,
+  0x10);
+   }
+
debug("Loading to %lx\n", spl_image->load_addr);
 
return 0;
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 6/6] x86: Add a 64-bit coreboot build

2020-04-05 Thread Simon Glass
Add a build for running 64-bit U-Boot from coreboot (which is 32-bit).
This uses binman to create an image with a 32-bit SPL and a 64-bit U-Boot.

Coreboot boots into SPL and then SPL boots into U-Boot.

This allows running 64-bit EFI images on x86.
Signed-off-by: Simon Glass 
---

 board/coreboot/coreboot/MAINTAINERS |  7 +
 configs/coreboot64_defconfig| 48 +
 doc/board/coreboot/coreboot.rst | 10 ++
 3 files changed, 65 insertions(+)
 create mode 100644 configs/coreboot64_defconfig

diff --git a/board/coreboot/coreboot/MAINTAINERS 
b/board/coreboot/coreboot/MAINTAINERS
index 188906b0803..a05673bb0be 100644
--- a/board/coreboot/coreboot/MAINTAINERS
+++ b/board/coreboot/coreboot/MAINTAINERS
@@ -4,3 +4,10 @@ S: Maintained
 F: board/coreboot/coreboot/
 F: include/configs/chromebook_link.h
 F: configs/coreboot_defconfig
+
+COREBOOT64 BOARD
+M: Simon Glass 
+S: Maintained
+F: board/coreboot/coreboot/
+F: include/configs/chromebook_link.h
+F: configs/coreboot64_defconfig
diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
new file mode 100644
index 000..80353b8eb36
--- /dev/null
+++ b/configs/coreboot64_defconfig
@@ -0,0 +1,48 @@
+CONFIG_X86=y
+CONFIG_SYS_TEXT_BASE=0x112
+CONFIG_ENV_SIZE=0x1000
+CONFIG_NR_DRAM_BANKS=8
+CONFIG_PRE_CON_BUF_ADDR=0x10
+CONFIG_X86_RUN_64BIT=y
+CONFIG_VENDOR_COREBOOT=y
+CONFIG_TARGET_COREBOOT=y
+CONFIG_SPL_TEXT_BASE=0x111
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
+CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_IDE=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_SOUND=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MAC_PARTITION=y
+# CONFIG_SPL_MAC_PARTITION is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="coreboot"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+# CONFIG_PCI_PNP is not set
+CONFIG_SOUND=y
+CONFIG_SOUND_I8254=y
+CONFIG_CONSOLE_SCROLL_LINES=5
diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst
index fd974229eb4..9c44c025a48 100644
--- a/doc/board/coreboot/coreboot.rst
+++ b/doc/board/coreboot/coreboot.rst
@@ -40,3 +40,13 @@ To enable video you must enable these options in coreboot:
 At present it seems that for Minnowboard Max, coreboot does not pass through
 the video information correctly (it always says the resolution is 0x0). This
 works correctly for link though.
+
+64-bit U-Boot
+-
+
+In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This
+produces an image which can be booted from coreboot (32-bit). Internally it
+works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It
+can be useful for running UEFI applications, for example.
+
+This has only been lightly tested.
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 0/6] x86: efi: Add a 64-bit coreboot payload

2020-04-05 Thread Simon Glass
This series creates a new 64-bit 'coreboot64' build which can be launched
from coreboot. It uses SPL to effect the jump to 64-bit mode.

This was done in an attempt to get the Ubuntu FirmwareTestSuite[1]
working. Unfortunately the latest version shows a splash screen and hangs,
perhaps due to some missing EFI support.

[1] https://wiki.ubuntu.com/FirmwareTestSuite


Simon Glass (6):
  x86: Allow building an SPL image for coreboot
  x86: Move work-around out of cpu_jump_to_64bit_uboot()
  x86: Update SPL for coreboot
  x86: cbfs: Drop unwanted declaration
  x86: coreboot: Allow building an SPL image
  x86: Add a 64-bit coreboot build

 Makefile |  6 
 arch/x86/cpu/Makefile|  4 ++-
 arch/x86/cpu/coreboot/Kconfig|  1 +
 arch/x86/cpu/coreboot/Makefile   |  8 -
 arch/x86/cpu/coreboot/coreboot.c |  3 +-
 arch/x86/cpu/coreboot/coreboot_spl.c | 12 +++
 arch/x86/cpu/i386/cpu.c  | 10 --
 arch/x86/cpu/intel_common/Makefile   |  2 ++
 arch/x86/cpu/x86_64/cpu.c|  2 ++
 arch/x86/dts/coreboot-u-boot.dtsi| 18 +++
 arch/x86/lib/spl.c   | 23 ++---
 board/coreboot/coreboot/MAINTAINERS  |  7 
 configs/coreboot64_defconfig | 48 
 doc/board/coreboot/coreboot.rst  | 10 ++
 include/cbfs.h   |  2 +-
 15 files changed, 138 insertions(+), 18 deletions(-)
 create mode 100644 arch/x86/cpu/coreboot/coreboot_spl.c
 create mode 100644 arch/x86/dts/coreboot-u-boot.dtsi
 create mode 100644 configs/coreboot64_defconfig

-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 1/6] x86: Allow building an SPL image for coreboot

2020-04-05 Thread Simon Glass
Coreboot runs in 32-bit mode and cannot run a 64-bit U-Boot. To get around
this we can build a combined image with 32-bit SPL and 64-bit U-Boot. Add
a build rule and binman definition for this.

Signed-off-by: Simon Glass 
---

 Makefile  |  6 ++
 arch/x86/cpu/coreboot/Kconfig |  1 +
 arch/x86/dts/coreboot-u-boot.dtsi | 18 ++
 3 files changed, 25 insertions(+)
 create mode 100644 arch/x86/dts/coreboot-u-boot.dtsi

diff --git a/Makefile b/Makefile
index 0db44d42494..5249f1e9610 100644
--- a/Makefile
+++ b/Makefile
@@ -884,6 +884,9 @@ ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
 ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),)
 ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
 endif
+ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy)
+ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin
+endif
 
 # Build a combined spl + u-boot image for sunxi
 ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
@@ -1563,6 +1566,9 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb 
FORCE
 endif
 endif
 
+u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE
+   $(call if_changed,binman)
+
 ifneq ($(CONFIG_TEGRA),)
 ifneq ($(CONFIG_BINMAN),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
diff --git a/arch/x86/cpu/coreboot/Kconfig b/arch/x86/cpu/coreboot/Kconfig
index c8e6a889d02..497d6284ac1 100644
--- a/arch/x86/cpu/coreboot/Kconfig
+++ b/arch/x86/cpu/coreboot/Kconfig
@@ -25,5 +25,6 @@ config SYS_COREBOOT
imply FS_CBFS
imply CBMEM_CONSOLE
imply X86_TSC_READ_BASE
+   select BINMAN if X86_64
 
 endif
diff --git a/arch/x86/dts/coreboot-u-boot.dtsi 
b/arch/x86/dts/coreboot-u-boot.dtsi
new file mode 100644
index 000..38efc48d836
--- /dev/null
+++ b/arch/x86/dts/coreboot-u-boot.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Google LLC
+ * Written by Simon Glass 
+ */
+
+#include 
+
+/ {
+   binman {
+   filename = "u-boot-x86-with-spl.bin";
+   u-boot-spl {
+   };
+   u-boot {
+   offset = <0x1>;
+   };
+   };
+};
-- 
2.26.0.292.g33ef6b2f38-goog



Re: [PULL] u-boot-sh/master

2020-04-05 Thread Tom Rini
On Sat, Apr 04, 2020 at 10:14:06PM +0200, Marek Vasut wrote:

> This is a small fix for current release (2020.04)
> 
> The following changes since commit e0718b3ab754860bd47677e6b4fc5b70da42c4ab:
> 
>   Merge tag 'dm-pull-1apr20' of git://git.denx.de/u-boot-dm (2020-04-01
> 14:29:21 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sh.git master
> 
> for you to fetch changes up to b13da11255a01475d41bdc5d367d55ed3656bae8:
> 
>   net: sh_eth: Init the hardware before PHY access (2020-04-04 15:06:37
> +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] arch: Add explicit linker script for u-boot-elf

2020-04-05 Thread Tom Rini
On Mon, Mar 30, 2020 at 01:58:59PM +0200, Michal Simek wrote:

> Commit f4dc714aaa2d ("arm64: Turn u-boot.bin back into an ELF file after
> relocate-rela")
> introduce REMAKE_ELF option to recreate u-boot.elf from u-boot ->
> u-boot.bin + DT -> u-boot.elf.
> 
> The best is to ilustrate it from make V=1 output
>   cat u-boot-nodtb.bin dts/dt.dtb > u-boot-dtb.bin
>   cp u-boot-dtb.bin u-boot.bin
> aarch64-linux-gnu-objcopy -I binary -B aarch64 -O elf64-littleaarch64  
> u-boot.bin u-boot-elf.o
>   aarch64-linux-gnu-ld.bfd u-boot-elf.o -o u-boot.elf 
> --defsym="_start"=0x800 -Ttext=0x800
> 
> Last command has no explicit linker script passed that's why toolchain
> internal linker script is used.
> In Binutils 2.32 case it contains SIZEOF_HEADERS symbol which has changed
> behavior by commit
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=64029e93683a266c38d19789e780f3748bd6a188
> which result in situation that program headers has changed from
> (xilinx_zynqmp_mini_defconfig)
> 
> Program Headers:
>   Type   Offset VirtAddr   PhysAddr
>  FileSizMemSiz  Flags  Align
>   LOAD   0x0001 0xfffc 0xfffc
>  0x00018918 0x00018918  RW 0x1
> 
> to
> 
> Program Headers:
>   Type   Offset VirtAddr   PhysAddr
>  FileSizMemSiz  Flags  Align
>   LOAD   0x 0xfffb 0xfffb
>  0x00028918 0x00028918  RW 0x1
> 
> Xilinx tools like XSDB or Bootgen are using program headers for loading ELF
> to the right location and by above binutils change ELF is loaded to
> incorrect location.
> 
> The patch is explicitly use u-boot-elf.lds (just cat now) for u-boot.elf
> recreation which is called when REMAKE_ELF is setup.
> By purpose u-boot-elf.lds doesn't contain OUTPUT_FORMAT/OUTPUT_ARCH to be
> able to use by all archs.
> 
> Signed-off-by: Michal Simek 
> Reviewed-by: Tom Rini 
> Reviewed-by: Daniel Schwierzeck 
> Tested-By: Álvaro Fernández Rojas 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request, u-boot-tegra/master

2020-04-05 Thread Tom Rini
On Fri, Apr 03, 2020 at 10:23:03AM -0700, Tom Warren wrote:

>  Tom,
> 
> Please pull u-boot-tegra/master into U-Boot/master. Thanks.
> 
> All Tegra builds are OK on my system, and Stephen's test frame reports that
> all tests pass.
> This adds support for Jetson Nano, plus miscellaneous other fixes found
> during Nano bringup.
> It also adds Igor's update_uboot wrapper patches.
> 
> The following changes since commit e0718b3ab754860bd47677e6b4fc5b70da42c4ab:
> 
>   Merge tag 'dm-pull-1apr20' of git://git.denx.de/u-boot-dm (2020-04-01
> 14:29:21 -0400)
> 
> are available in the git repository at:
> 
>   ssh://twarren@git-mirror-santaclara:12001/m/denx.de/u-boot-tegra.git
> master
> 
> for you to fetch changes up to 7c02bc9649f6d3afd272ac4a94b280495473834c:
> 
>   ARM: tegra: Add NVIDIA Jetson Nano Developer Kit support (2020-04-02
> 14:30:02 -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-video

2020-04-05 Thread Tom Rini
On Thu, Apr 02, 2020 at 06:13:50PM +0200, Anatolij Gustschin wrote:

> Hi Tom,
> 
> The following changes since commit e0718b3ab754860bd47677e6b4fc5b70da42c4ab:
> 
>   Merge tag 'dm-pull-1apr20' of git://git.denx.de/u-boot-dm (2020-04-01 
> 14:29:21 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-video.git 
> tags/video-fixes-2apr20
> 
> for you to fetch changes up to 05c65a82c3c1a1f5aced30babde51f934e066717:
> 
>   video: rockchip: Support 4K resolution for rk3399, HDMI (2020-04-02 
> 15:52:01 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-x86

2020-04-05 Thread Tom Rini
On Sun, Apr 05, 2020 at 07:12:50AM +0800, Bin Meng wrote:

> Hi Tom,
> 
> This PR includes the following changes for v2020.04 release:
> 
> - verdin-imx8mm board reST documentation update
> - Intel Edison board ACPI table I2C/USB minor updates
> - Fix a regression of ns16550 serial driver that breaks Intel Edison
> 
> The following changes since commit e0718b3ab754860bd47677e6b4fc5b70da42c4ab:
> 
>   Merge tag 'dm-pull-1apr20' of git://git.denx.de/u-boot-dm
> (2020-04-01 14:29:21 -0400)
> 
> are available in the git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-x86
> 
> for you to fetch changes up to 9e6ce62190b7cd874d2bf727c7681292551ba6b9:
> 
>   serial: ns16550: Fix ordering of getting base address (2020-04-04
> 22:08:44 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] mach-snapdragon: Fix overwriting last digit of serial number

2020-04-05 Thread Tom Rini
On Mon, Mar 16, 2020 at 05:51:51PM +0100, Jan-Christoph Tebbe wrote:

> When generating the MAC address based on the boards serial number
> the last digit was overwritten with the null termination. That way
> boards with serial numbers close to each other would use the same
> MAC address.
> 
> Signed-off-by: Jan-Christoph Tebbe 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] Revert "common: spl_fit: Default to IH_OS_U_BOOT if FIT_IMAGE_TINY enabled"

2020-04-05 Thread Tom Rini
On Wed, Apr 01, 2020 at 07:42:04AM -0700, Ye Li wrote:

> Commit cf8dcc5d02c3 ("common: spl_fit: Default to IH_OS_U_BOOT if
> FIT_IMAGE_TINY enabled") is not correct, it will append fdt to each loadable
> image. Actually when using TINY FIT, the first loadable image is thought as
> u-boot and already have fdt appended.
> 
> Signed-off-by: Ye Li 
> Tested-by: Fabio Estevam 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Pull request: u-boot-spi/master

2020-04-05 Thread Tom Rini
On Fri, Apr 03, 2020 at 08:00:24PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR for the release.
> 
> Summary:
> - fix for MMIO window size (Tudor Ambarus)
> 
> thanks,
> Jagan.
> 
> The following changes since commit e0718b3ab754860bd47677e6b4fc5b70da42c4ab:
> 
>   Merge tag 'dm-pull-1apr20' of git://git.denx.de/u-boot-dm (2020-04-01 
> 14:29:21 -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-spi master
> 
> for you to fetch changes up to 52e2565bfb5d332e53021c6ec437cdb95eaf9dde:
> 
>   spi: atmel-quadspi: Add verbose debug facilities to monitor register 
> accesses (2020-04-02 17:17:09 +0530)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] dm: core: Read parent ofdata before children

2020-04-05 Thread Simon Glass
At present a device can read its ofdata before its parent has done the
same. This can cause problems in the case where the parent has a 'ranges'
property, thus affecting the operation of dev_read_addr(), for example.

We already probe parent devices before children so it does not seem to be
a large step to do the same with ofdata.

Make the change and update the documentation in this area.

Signed-off-by: Simon Glass 
---

 doc/driver-model/design.rst | 94 +++--
 drivers/core/device.c   | 16 +++
 test/dm/test-fdt.c  | 25 ++
 3 files changed, 111 insertions(+), 24 deletions(-)

diff --git a/doc/driver-model/design.rst b/doc/driver-model/design.rst
index 5247ecc2768..f8319ba62b9 100644
--- a/doc/driver-model/design.rst
+++ b/doc/driver-model/design.rst
@@ -683,11 +683,17 @@ probe/remove which is independent of bind/unbind. This is 
partly because in
 U-Boot it may be expensive to probe devices and we don't want to do it until
 they are needed, or perhaps until after relocation.
 
-Activation/probe
-
+Reading ofdata
+^^
+
+Most devices have data in the device tree which they can read to find out the
+base address of hardware registers and parameters relating to driver
+operation. This is called 'ofdata' (Open-Firmware data).
 
-When a device needs to be used, U-Boot activates it, by following these
-steps (see device_probe()):
+The device's_ofdata_to_platdata() implemnents allocation and reading of
+platdata. A parent's ofdata is always read before a child.
+
+The steps are:
 
1. If priv_auto_alloc_size is non-zero, then the device-private space
is allocated for the device and zeroed. It will be accessible as
@@ -713,32 +719,72 @@ steps (see device_probe()):
space. The controller can hold information about the USB state of each
of its children.
 
-   5. All parent devices are probed. It is not possible to activate a device
+   5. If the driver provides an ofdata_to_platdata() method, then this is
+   called to convert the device tree data into platform data. This should
+   do various calls like dev_read_u32(dev, ...) to access the node and store
+   the resulting information into dev->platdata. After this point, the device
+   works the same way whether it was bound using a device tree node or
+   U_BOOT_DEVICE() structure. In either case, the platform data is now stored
+   in the platdata structure. Typically you will use the
+   platdata_auto_alloc_size feature to specify the size of the platform data
+   structure, and U-Boot will automatically allocate and zero it for you before
+   entry to ofdata_to_platdata(). But if not, you can allocate it yourself in
+   ofdata_to_platdata(). Note that it is preferable to do all the device tree
+   decoding in ofdata_to_platdata() rather than in probe(). (Apart from the
+   ugliness of mixing configuration and run-time data, one day it is possible
+   that U-Boot will cache platform data for devices which are regularly
+   de/activated).
+
+   5. The device is marked 'platdata valid'.
+
+Note that ofdata reading is always done (for a child and all its parents)
+before probing starts. Thus devices go through two distinct states when
+probing: reading platform data and actually touching the hardware to bring
+the device up.
+
+Having probing separate from ofdata-reading helps deal with of-platdata, where
+the probe() method is common to both DT/of-platdata operation, but the
+ofdata_to_platdata() method is implemented differently.
+
+Another case has come up where this separate is useful. Generation of ACPI
+tables uses the of-platdata but does not want to probe the device. Probing
+would cause U-Boot to violate one of its design principles, viz that it
+should only probe devices that are used. For ACPI we want to generate a
+table for each device, even if U-Boot does not use it. In fact it may not
+even be possible to probe the device - e.g. an SD card which is not
+present will cause an error on probe, yet we still must tell Linux about
+the SD card connector in case it is used while Linux is running.
+
+It is important that the ofdata_to_platdata() method does not actually probe
+the device itself. However there are cases where other devices must be probed
+in the ofdata_to_platdata() method. An example is where a device requires a
+GPIO for it to operate. To select a GPIO obviously requires that the GPIO
+device is probed. This is OK when used by common, core devices such as GPIO,
+clock, interrupts, reset and the like.
+
+If your device relies on its parent setting up a suitable address space, so
+that dev_read_addr() works correctly, then make sure that the parent device
+has its setup code in ofdata_to_platdata(). If it has it in the probe method,
+then you cannot call dev_read_addr() from the child device's
+ofdata_to_platdata() method. Move it to probe() instead. Buses like PCI can
+fall afoul of this rule.
+
+Activation/probe
+
+
+When a 

[PATCH] travis/gitlab/azure: Run cppcheck in parallel

2020-04-05 Thread Simon Glass
This takes ages to run single-threaded. Adjust it to use all available
processors.

Signed-off-by: Simon Glass 
---

 .azure-pipelines.yml | 2 +-
 .gitlab-ci.yml   | 2 +-
 .travis.yml  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 27bc2496297..c9770b9f842 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -52,7 +52,7 @@ jobs:
   image: $(ci_runner_image)
   options: $(container_option)
 steps:
-  - script: cppcheck --force --quiet --inline-suppr .
+  - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
 
   - job: htmldocs
 displayName: 'Build HTML documentation'
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d171641576b..0d886efcadc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -94,7 +94,7 @@ cppcheck:
   tags: [ 'all' ]
   stage: testsuites
   script:
-- cppcheck --force --quiet --inline-suppr .
+- cppcheck -j$(nproc) --force --quiet --inline-suppr .
 
 # search for TODO within source tree
 grep TODO/FIXME/HACK:
diff --git a/.travis.yml b/.travis.yml
index 37fd8e483ac..85540b94586 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -349,7 +349,7 @@ matrix:
 # static code analysis with cppcheck (we can add --enable=all later)
 - name: "cppcheck"
   script:
-- cppcheck --force --quiet --inline-suppr .
+- cppcheck -j$(nproc) --force --quiet --inline-suppr .
 # build HTML documentation
 - name: "htmldocs"
   script:
-- 
2.26.0.292.g33ef6b2f38-goog



Re: [PATCH 1/2] dm: dump.c: Fix segfault when entry->of_match is NULL

2020-04-05 Thread Ovidiu Panait

On 05.04.2020 19:53, Sean Anderson wrote:


On 4/5/20 12:47 PM, Ovidiu Panait wrote:

Currently, dm drivers command produces a segfault:
=> dm drivers
DriverCompatible

Segmentation fault (core dumped)

This is caused by a NULL pointer dereference of entry->of_match.
Add a check to prevent this.

This should have been fixed in version 3 of the original patch [1]. Did
it not get merged properly? This is the second time I've been CC'd by
someone who wants to fix this.

[1] https://patchwork.ozlabs.org/patch/1234460/


Yes, it seems that an older version of the patch was merged:

https://github.com/u-boot/u-boot/commit/7b9d60fc1ff67b3959a7db394084b27268a7686d


Ovidiu


--Sean


Re: [PATCH 1/2] dm: dump.c: Fix segfault when entry->of_match is NULL

2020-04-05 Thread Sean Anderson
On 4/5/20 12:47 PM, Ovidiu Panait wrote:
> Currently, dm drivers command produces a segfault:
> => dm drivers
> DriverCompatible
> 
> Segmentation fault (core dumped)
> 
> This is caused by a NULL pointer dereference of entry->of_match.
> Add a check to prevent this.

This should have been fixed in version 3 of the original patch [1]. Did
it not get merged properly? This is the second time I've been CC'd by
someone who wants to fix this.

[1] https://patchwork.ozlabs.org/patch/1234460/

--Sean


[PATCH 1/2] dm: dump.c: Fix segfault when entry->of_match is NULL

2020-04-05 Thread Ovidiu Panait
Currently, dm drivers command produces a segfault:
=> dm drivers
DriverCompatible

Segmentation fault (core dumped)

This is caused by a NULL pointer dereference of entry->of_match.
Add a check to prevent this.

Signed-off-by: Ovidiu Panait 
Cc: Sean Anderson 
Cc: Simon Glass 
---
 drivers/core/dump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index e73ebeabcc..b5046398d4 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -107,7 +107,8 @@ void dm_dump_drivers(void)
puts("DriverCompatible\n");
puts("\n");
for (entry = d; entry < d + n_ents; entry++) {
-   for (match = entry->of_match; match->compatible; match++)
+   for (match = entry->of_match;
+match && match->compatible; match++)
printf("%-20.20s  %s\n",
   match == entry->of_match ? entry->name : "",
   match->compatible);
-- 
2.17.1



[PATCH 2/2] dm: dump.c: Refactor dm_dump_drivers prints

2020-04-05 Thread Ovidiu Panait
Refactor the printing sequence in dm_dump_drivers to make it more clear.

Signed-off-by: Ovidiu Panait 
Cc: Sean Anderson 
Cc: Simon Glass 
---
 drivers/core/dump.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index b5046398d4..cb8a25b9ad 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -107,12 +107,16 @@ void dm_dump_drivers(void)
puts("DriverCompatible\n");
puts("\n");
for (entry = d; entry < d + n_ents; entry++) {
-   for (match = entry->of_match;
-match && match->compatible; match++)
-   printf("%-20.20s  %s\n",
-  match == entry->of_match ? entry->name : "",
-  match->compatible);
-   if (match == entry->of_match)
-   printf("%-20.20s\n", entry->name);
+   match = entry->of_match;
+
+   printf("%-20.20s", entry->name);
+   if (match) {
+   printf("  %s", match->compatible);
+   match++;
+   }
+   printf("\n");
+
+   for (; match && match->compatible; match++)
+   printf("%-20.20s  %s\n", "", match->compatible);
}
 }
-- 
2.17.1



[PATCH] ARM: rmobile: Unify Gen3 Salvator-X(S) and ULCB defconfigs

2020-04-05 Thread Marek Vasut
The r8a779{5,6,65}_salvator-x and r8a779{5,6,65}_ulcb_defconfig were
building the same target, except for the default DT. The default DT is
however only a detail, as the actual DT to be used to configure U-Boot
is detected automatically based on the CPU ID, hence the default DT is
not meaningful. Unify each three defconfigs per board to reduce the
duplication.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 configs/r8a77965_salvator-x_defconfig | 71 ---
 configs/r8a77965_ulcb_defconfig   | 68 --
 configs/r8a7796_salvator-x_defconfig  | 71 ---
 configs/r8a7796_ulcb_defconfig| 68 --
 ...x_defconfig => rcar3_salvator-x_defconfig} |  0
 ...95_ulcb_defconfig => rcar3_ulcb_defconfig} |  0
 6 files changed, 278 deletions(-)
 delete mode 100644 configs/r8a77965_salvator-x_defconfig
 delete mode 100644 configs/r8a77965_ulcb_defconfig
 delete mode 100644 configs/r8a7796_salvator-x_defconfig
 delete mode 100644 configs/r8a7796_ulcb_defconfig
 rename configs/{r8a7795_salvator-x_defconfig => rcar3_salvator-x_defconfig} 
(100%)
 rename configs/{r8a7795_ulcb_defconfig => rcar3_ulcb_defconfig} (100%)

diff --git a/configs/r8a77965_salvator-x_defconfig 
b/configs/r8a77965_salvator-x_defconfig
deleted file mode 100644
index 8da542c728..00
--- a/configs/r8a77965_salvator-x_defconfig
+++ /dev/null
@@ -1,71 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_CPU_INIT=y
-CONFIG_ARCH_RMOBILE=y
-CONFIG_SYS_TEXT_BASE=0x5000
-CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_ENV_SIZE=0x2
-CONFIG_ENV_OFFSET=0xFFFE
-CONFIG_DM_GPIO=y
-CONFIG_RCAR_GEN3=y
-CONFIG_TARGET_SALVATOR_X=y
-CONFIG_SMBIOS_PRODUCT_NAME=""
-CONFIG_SPL_TEXT_BASE=0xe6338000
-CONFIG_FIT=y
-CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=192.168.0.1:/export/rfs 
ip=192.168.0.20"
-CONFIG_SUPPORT_RAW_INITRD=y
-CONFIG_DEFAULT_FDT_FILE="r8a77965-salvator-x.dtb"
-CONFIG_VERSION_VARIABLE=y
-CONFIG_HUSH_PARSER=y
-CONFIG_CMD_BOOTZ=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_OF_CONTROL=y
-CONFIG_DEFAULT_DEVICE_TREE="r8a77965-salvator-x-u-boot"
-CONFIG_OF_LIST="r8a7795-salvator-x-u-boot r8a7796-salvator-x-u-boot 
r8a77965-salvator-x-u-boot"
-CONFIG_MULTI_DTB_FIT_LZO=y
-CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_REGMAP=y
-CONFIG_SYSCON=y
-CONFIG_CLK=y
-CONFIG_CLK_RENESAS=y
-CONFIG_RCAR_GPIO=y
-CONFIG_DM_I2C=y
-CONFIG_SYS_I2C_RCAR_IIC=y
-CONFIG_DM_MMC=y
-CONFIG_MMC_IO_VOLTAGE=y
-CONFIG_MMC_UHS_SUPPORT=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_RENESAS_SDHI=y
-CONFIG_PHY_MICREL=y
-CONFIG_PHY_MICREL_KSZ90X1=y
-CONFIG_DM_ETH=y
-CONFIG_RENESAS_RAVB=y
-CONFIG_PCI=y
-CONFIG_DM_PCI=y
-CONFIG_PCI_RCAR_GEN3=y
-CONFIG_DM_REGULATOR=y
-CONFIG_DM_REGULATOR_FIXED=y
-CONFIG_DM_REGULATOR_GPIO=y
-CONFIG_SCIF_CONSOLE=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
-CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_GENERIC=y
-CONFIG_USB_STORAGE=y
-CONFIG_OF_LIBFDT_OVERLAY=y
-CONFIG_SMBIOS_MANUFACTURER=""
diff --git a/configs/r8a77965_ulcb_defconfig b/configs/r8a77965_ulcb_defconfig
deleted file mode 100644
index 117939bac7..00
--- a/configs/r8a77965_ulcb_defconfig
+++ /dev/null
@@ -1,68 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_CPU_INIT=y
-CONFIG_ARCH_RMOBILE=y
-CONFIG_SYS_TEXT_BASE=0x5000
-CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_ENV_SIZE=0x2
-CONFIG_ENV_OFFSET=0xFFFE
-CONFIG_DM_GPIO=y
-CONFIG_RCAR_GEN3=y
-CONFIG_TARGET_ULCB=y
-CONFIG_SMBIOS_PRODUCT_NAME=""
-CONFIG_SPL_TEXT_BASE=0xe6338000
-CONFIG_FIT=y
-CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=192.168.0.1:/export/rfs 
ip=192.168.0.20"
-CONFIG_SUPPORT_RAW_INITRD=y
-CONFIG_DEFAULT_FDT_FILE="r8a77965-m3nulcb.dtb"
-CONFIG_VERSION_VARIABLE=y
-CONFIG_HUSH_PARSER=y
-CONFIG_CMD_BOOTZ=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_USB=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_OF_CONTROL=y
-CONFIG_DEFAULT_DEVICE_TREE="r8a77965-m3nulcb-u-boot"
-CONFIG_OF_LIST="r8a7795-h3ulcb-u-boot r8a7796-m3ulcb-u-boot 
r8a77965-m3nulcb-u-boot"
-CONFIG_MULTI_DTB_FIT_LZO=y
-CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_REGMAP=y
-CONFIG_SYSCON=y
-CONFIG_CLK=y
-CONFIG_CLK_RENESAS=y
-CONFIG_RCAR_GPIO=y
-CONFIG_DM_I2C=y
-CONFIG_SYS_I2C_RCAR_IIC=y
-CONFIG_DM_MMC=y
-CONFIG_MMC_IO_VOLTAGE=y
-CONFIG_MMC_UHS_SUPPORT=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_RENESAS_SDHI=y
-CONFIG_PHY_MICREL=y
-CONFIG_PHY_MICREL_KSZ90X1=y
-CONFIG_DM_ETH=y
-CONFIG_RENESAS_RAVB=y
-CONFIG_DM_REGULATOR=y
-CONFIG_DM_REGULATOR_FIXED=y
-CONFIG_DM_REGULATOR_GPIO=y

[PATCH] ARM: dts: rmobile: Scrub unused DT nodes

2020-04-05 Thread Marek Vasut
Remove DT nodes which are not used by U-Boot, like audio and video in/out
nodes. This saves about 35 kiB on the resulting U-Boot binary without any
impact on functionality.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 arch/arm/dts/r8a77950-u-boot.dtsi | 77 +++
 arch/arm/dts/r8a77960-u-boot.dtsi | 66 ++
 arch/arm/dts/r8a77965-u-boot.dtsi | 56 ++
 3 files changed, 199 insertions(+)

diff --git a/arch/arm/dts/r8a77950-u-boot.dtsi 
b/arch/arm/dts/r8a77950-u-boot.dtsi
index 3f4b1f5acc..0317f47f0f 100644
--- a/arch/arm/dts/r8a77950-u-boot.dtsi
+++ b/arch/arm/dts/r8a77950-u-boot.dtsi
@@ -22,3 +22,80 @@
};
};
 };
+
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ _sound;
+/delete-node/ _card;
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+
+/ {
+   /delete-node/ cvbs-in;
+   /delete-node/ hdmi-in;
+   /delete-node/ hdmi0-out;
+   /delete-node/ hdmi1-out;
+   /delete-node/ vga-encoder;
+   /delete-node/ vga;
+};
+
+ {
+   /delete-node/ video-receiver@70;
+};
+
+ {
+   /delete-node/ fdp1@fe94;
+   /delete-node/ fdp1@fe944000;
+   /delete-node/ fdp1@fe948000;
+   /delete-node/ imr-lx4@fe86;
+   /delete-node/ imr-lx4@fe87;
+   /delete-node/ imr-lx4@fe88;
+   /delete-node/ imr-lx4@fe89;
+};
diff --git a/arch/arm/dts/r8a77960-u-boot.dtsi 
b/arch/arm/dts/r8a77960-u-boot.dtsi
index 622105486b..826c2384bc 100644
--- a/arch/arm/dts/r8a77960-u-boot.dtsi
+++ b/arch/arm/dts/r8a77960-u-boot.dtsi
@@ -22,3 +22,69 @@
};
};
 };
+
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ _sound;
+/delete-node/ _card;
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+
+/ {
+   /delete-node/ cvbs-in;
+   /delete-node/ hdmi-in;
+   /delete-node/ hdmi0-out;
+   /delete-node/ hdmi1-out;
+   /delete-node/ vga-encoder;
+   /delete-node/ vga;
+};
+
+ {
+   /delete-node/ video-receiver@70;
+};
+
+/ {
+   soc {
+   /delete-node/ fdp1@fe94;
+   /delete-node/ fdp1@fe944000;
+   /delete-node/ fdp1@fe948000;
+   /delete-node/ imr-lx4@fe86;
+   /delete-node/ imr-lx4@fe87;
+   /delete-node/ imr-lx4@fe88;
+   /delete-node/ imr-lx4@fe89;
+   };
+};
diff --git a/arch/arm/dts/r8a77965-u-boot.dtsi 
b/arch/arm/dts/r8a77965-u-boot.dtsi
index 81ee0961e2..33ff5b148b 100644
--- a/arch/arm/dts/r8a77965-u-boot.dtsi
+++ b/arch/arm/dts/r8a77965-u-boot.dtsi
@@ -22,3 +22,59 @@
};
};
 };
+
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ _sound;
+/delete-node/ _card;
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+/delete-node/ 
+
+/ {
+   /delete-node/ cvbs-in;
+   /delete-node/ hdmi-in;
+   /delete-node/ hdmi0-out;
+   /delete-node/ hdmi1-out;
+   /delete-node/ vga-encoder;
+   /delete-node/ vga;
+};
+
+ {
+   /delete-node/ video-receiver@70;
+};
+
+/ {
+   soc {
+   /delete-node/ fdp1@fe94;
+   /delete-node/ fdp1@fe944000;
+   /delete-node/ fdp1@fe948000;
+   /delete-node/ imr-lx4@fe86;
+   /delete-node/ imr-lx4@fe87;
+   /delete-node/ imr-lx4@fe88;
+   /delete-node/ imr-lx4@fe89;
+   };

[PATCH] mtd: nand: pxa3xx: fix raw read when last_chunk_size == 0

2020-04-05 Thread Baruch Siach
Commit 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support") added the
local data_len variable in handle_data_pio() to track read size, but
forgot to update the condition of drain_fifo() call. That happens to
work when the layout last_chunk_size != 0. But when last_chunk_size ==
0, drain_fifo() is not called to read the last chunk, which leads to
"Wait timeout!!!" error. Fix this.

Fixes: 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support")
Cc: Miquel Raynal 
Signed-off-by: Baruch Siach 
---
 drivers/mtd/nand/raw/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c 
b/drivers/mtd/nand/raw/pxa3xx_nand.c
index 03f210bdb0b3..7e3346dfcc2d 100644
--- a/drivers/mtd/nand/raw/pxa3xx_nand.c
+++ b/drivers/mtd/nand/raw/pxa3xx_nand.c
@@ -639,7 +639,7 @@ static void handle_data_pio(struct pxa3xx_nand_info *info)
DIV_ROUND_UP(info->step_spare_size, 4));
break;
case STATE_PIO_READING:
-   if (info->step_chunk_size)
+   if (data_len)
drain_fifo(info,
   info->data_buff + info->data_buff_pos,
   DIV_ROUND_UP(data_len, 4));
-- 
2.25.1



[PATCH 20/22] buildman: Update workflow documentation with more detail

2020-04-05 Thread Simon Glass
Make a few additions and change some wording in the workflow
documentation.

Signed-off-by: Simon Glass 
---

 tools/buildman/README | 53 +--
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 9bf4383f9f7..ca0d1f64460 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -501,6 +501,8 @@ If it can't detect the upstream branch, try checking out 
the branch, and
 doing something like 'git branch --set-upstream-to upstream/master'
 or something similar. Buildman will try to guess a suitable upstream branch
 if it can't find one (you will see a message like" Guessing upstream as ...).
+You can also use the -c option to manually specify the number of commits to
+build.
 
 As an example:
 
@@ -551,12 +553,13 @@ Buildman will set up some working directories, and get 
started. After a
 minute or so it will settle down to a steady pace, with a display like this:
 
 Building 18 commits for 1059 boards (4 threads, 1 job per thread)
-  528   36  124 /19062  1:13:30  : SIMPC8313_SP
+  528   36  124 /19062-18374  1:13:30  : SIMPC8313_SP
 
 This means that it is building 19062 board/commit combinations. So far it
 has managed to successfully build 528. Another 36 have built with warnings,
-and 124 more didn't build at all. Buildman expects to complete the process
-in around an hour and a quarter. Use this time to buy a faster computer.
+and 124 more didn't build at all. It has 18374 builds left to complete.
+Buildman expects to complete the process in around an hour and a quarter.
+Use this time to buy a faster computer.
 
 
 To find out how the build went, ask for a summary with -s. You can do this
@@ -588,32 +591,32 @@ $ ./tools/buildman/buildman -b lcd9b -s
 
 This shows which commits have succeeded and which have failed. In this case
 the build is still in progress so many boards are not built yet (use -u to
-see which ones). But still we can see a few failures. The galaxy5200_LOWBOOT
+see which ones). But already we can see a few failures. The galaxy5200_LOWBOOT
 never builds correctly. This could be a problem with our toolchain, or it
 could be a bug in the upstream. The good news is that we probably don't need
 to blame our commits. The bad news is that our commits are not tested on that
 board.
 
-Commit 12 broke lubbock. That's what the '+ lubbock' means. The failure
-is never fixed by a later commit, or you would see lubbock again, in green,
-without the +.
+Commit 12 broke lubbock. That's what the '+ lubbock', in red, means. The
+failure is never fixed by a later commit, or you would see lubbock again, in
+green, without the +.
 
 To see the actual error:
 
-$ ./tools/buildman/buildman -b  -se lubbock
+$ ./tools/buildman/buildman -b  -se
 ...
 12: lcd: Add support for flushing LCD fb from dcache after update
arm:   + lubbock
 +common/libcommon.o: In function `lcd_sync':
-+/u-boot/lcd9b/.bm-work/00/common/lcd.c:120: undefined reference to 
`flush_dcache_range'
++common/lcd.c:120: undefined reference to `flush_dcache_range'
 +arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 
2.19.51.20090709 assertion fail 
/scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12572
-+make: *** [/u-boot/lcd9b/.bm-work/00/build/u-boot] Error 139
++make: *** [build/u-boot] Error 139
 13: tegra: Align LCD frame buffer to section boundary
 14: tegra: Support control of cache settings for LCD
 15: tegra: fdt: Add LCD definitions for Seaboard
 16: lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
--/u-boot/lcd9b/.bm-work/00/common/lcd.c:120: undefined reference to 
`flush_dcache_range'
-+/u-boot/lcd9b/.bm-work/00/common/lcd.c:125: undefined reference to 
`flush_dcache_range'
+-common/lcd.c:120: undefined reference to `flush_dcache_range'
++common/lcd.c:125: undefined reference to `flush_dcache_range'
 17: tegra: Enable display/lcd support on Seaboard
 18: wip
 
@@ -621,6 +624,21 @@ So the problem is in lcd.c, due to missing cache 
operations. This information
 should be enough to work out what that commit is doing to break these
 boards. (In this case pxa did not have cache operations defined).
 
+Note that if there were other boards with errors, the above command would
+show their errors also. Each line is shown only once. So if lubbock and snow
+produce the same error, we just see:
+
+12: lcd: Add support for flushing LCD fb from dcache after update
+   arm:   + lubbock snow
++common/libcommon.o: In function `lcd_sync':
++common/lcd.c:120: undefined reference to `flush_dcache_range'
++arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 
2.19.51.20090709 assertion fail 
/scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12572
++make: *** [build/u-boot] Error 139
+
+But if you did want to see just the errors for lubbock, 

[PATCH 18/22] buildman: Update the 'theory of operation' a little

2020-04-05 Thread Simon Glass
Make a few updates to this important section of the documentation, to
make things clearer.

Signed-off-by: Simon Glass 
---

 tools/buildman/README | 69 ---
 1 file changed, 39 insertions(+), 30 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 4cf01141574..86f5dfe501f 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -51,23 +51,25 @@ Theory of Operation
 
 Buildman is a builder. It is not make, although it runs make. It does not
 produce any useful output on the terminal while building, except for
-progress information (except with -v, see below). All the output (errors,
-warnings and binaries if you ask for them) is stored in output
-directories, which you can look at while the build is progressing, or when
-it is finished.
+progress information (but see -v below). All the output (errors, warnings and
+binaries if you ask for them) is stored in output directories, which you can
+look at from a separate 'buildman -s' instance while the build is progressing,
+or when it is finished.
 
 Buildman is designed to build entire git branches, i.e. muliple commits. It
-can be run repeatedly on the same branch. In this case it will automatically
-rebuild commits which have changed (and remove its old results for that
-commit). It is possible to build a branch for one board, then later build it
-for another board. If you want buildman to re-build a commit it has already
-built (e.g. because of a toolchain update), use the -f flag.
+can be run repeatedly on the same branch after making changes to commits on
+that branch. In this case it will automatically rebuild commits which have
+changed (and remove its old results for that commit). It is possible to build
+a branch for one board, then later build it for another board. This adds to
+the output, so now you have results for two boards. If you want buildman to
+re-build a commit it has already built (e.g. because of a toolchain update),
+use the -f flag.
 
 Buildman produces a concise summary of which boards succeeded and failed.
 It shows which commit introduced which board failure using a simple
-red/green colour coding. Full error information can be requested, in which
-case it is de-duped and displayed against the commit that introduced the
-error. An example workflow is below.
+red/green colour coding (with yellow/cyan for warnings). Full error
+information can be requested, in which case it is de-duped and displayed
+against the commit that introduced the error. An example workflow is below.
 
 Buildman stores image size information and can report changes in image size
 from commit to commit. An example of this is below.
@@ -75,16 +77,20 @@ from commit to commit. An example of this is below.
 Buildman starts multiple threads, and each thread builds for one board at
 a time. A thread starts at the first commit, configures the source for your
 board and builds it. Then it checks out the next commit and does an
-incremental build. Eventually the thread reaches the last commit and stops.
-If errors or warnings are found along the way, the thread will reconfigure
-after every commit, and your build will be very slow. This is because a
-file that produces just a warning would not normally be rebuilt in an
-incremental build.
+incremental build (i.e. not using 'make xxx_defconfig' unless you use -C).
+Eventually the thread reaches the last commit and stops. If a commit causes
+an error or warning, buildman will try it again after reconfiguring (but see
+-Q). Thus some commits may be built twice, with the first result silently
+discarded. Lots of errors and warnings will causes lots of reconfigures and 
your
+build will be very slow. This is because a file that produces just a warning
+would not normally be rebuilt in an incremental build. Once a thread finishes
+building all the commits for a board, it starts on the commits for another
+board.
 
 Buildman works in an entirely separate place from your U-Boot repository.
 It creates a separate working directory for each thread, and puts the
 output files in the working directory, organised by commit name and board
-name, in a two-level hierarchy.
+name, in a two-level hierarchy (but see -P).
 
 Buildman is invoked in your U-Boot directory, the one with the .git
 directory. It clones this repository into a copy for each thread, and the
@@ -92,20 +98,23 @@ threads do not affect the state of your git repository. Any 
checkouts done
 by the thread affect only the working directory for that thread.
 
 Buildman automatically selects the correct tool chain for each board. You
-must supply suitable tool chains, but buildman takes care of selecting the
-right one.
+must supply suitable tool chains (see --fetch-arch), but buildman takes care
+of selecting the right one.
 
 Buildman generally builds a branch (with the -b flag), and in this case
-builds the upstream commit as well, for comparison. It cannot build
-individual commits at present, 

[PATCH 22/22] buildman: Add an option to ignore device-tree warnings

2020-04-05 Thread Simon Glass
Unfortunately the plague of device-tree warnings has not lifted. These
warnings infiltrate almost every build, adding noise and confusion.

Add a buildman option to ignore them. This option works only with the
summary option (-s). It does not affect the build process.

Signed-off-by: Simon Glass 
---

 tools/buildman/README |  3 +++
 tools/buildman/builder.py | 27 +--
 tools/buildman/cmdline.py |  3 +++
 tools/buildman/control.py | 11 +--
 tools/buildman/test.py| 35 ++-
 5 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index f299b0c2972..0663ec33a5b 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1124,6 +1124,9 @@ warnings will produce success (since 129 is changed to 0).
 
 If there are both warnings and errors, errors win, so buildman returns 128.
 
+The -y option is provided (for use with -s) to ignore the bountiful device-tree
+warnings.
+
 
 How to change from MAKEALL
 ==
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 43e667c89f9..5b8aaae75bc 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -338,16 +338,19 @@ class Builder:
 def SetDisplayOptions(self, show_errors=False, show_sizes=False,
   show_detail=False, show_bloat=False,
   list_error_boards=False, show_config=False,
-  show_environment=False):
+  show_environment=False, filter_dtb_warnings=False):
 """Setup display options for the builder.
 
-show_errors: True to show summarised error/warning info
-show_sizes: Show size deltas
-show_detail: Show size delta detail for each board if show_sizes
-show_bloat: Show detail for each function
-list_error_boards: Show the boards which caused each error/warning
-show_config: Show config deltas
-show_environment: Show environment deltas
+Args:
+show_errors: True to show summarised error/warning info
+show_sizes: Show size deltas
+show_detail: Show size delta detail for each board if show_sizes
+show_bloat: Show detail for each function
+list_error_boards: Show the boards which caused each error/warning
+show_config: Show config deltas
+show_environment: Show environment deltas
+filter_dtb_warnings: Filter out any warnings from the device-tree
+compiler
 """
 self._show_errors = show_errors
 self._show_sizes = show_sizes
@@ -356,6 +359,7 @@ class Builder:
 self._list_error_boards = list_error_boards
 self._show_config = show_config
 self._show_environment = show_environment
+self._filter_dtb_warnings = filter_dtb_warnings
 
 def _AddTimestamp(self):
 """Add a new timestamp to the list and record the build period.
@@ -556,8 +560,11 @@ class Builder:
 """
 out_lines = []
 for line in lines:
-if not self.re_make_err.search(line):
-out_lines.append(line)
+if self.re_make_err.search(line):
+continue
+if self._filter_dtb_warnings and self._re_dtb_warning.search(line):
+continue
+out_lines.append(line)
 return out_lines
 
 def ReadFuncSizes(self, fname, fd):
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 0178c6e8845..8510c077f74 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -114,6 +114,9 @@ def ParseArgs():
 parser.add_option('-x', '--exclude', dest='exclude',
   type='string', action='append',
   help='Specify a list of boards to exclude, separated by comma')
+parser.add_option('-y', '--filter-dtb-warnings', action='store_true',
+  default=False,
+   help='Filter out device-tree-compiler warnings from output')
 
 parser.usage += """ [list of target/arch/cpu/board/vendor/soc to build]
 
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 384e62dbc56..45d9ab73ceb 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -345,16 +345,15 @@ def DoBuildman(options, args, toolchains=None, 
make_func=None, boards=None,
 commits = None
 
 Print(GetActionSummary(options.summary, commits, board_selected,
-options))
+   options))
 
 # We can't show function sizes without board details at present
 if options.show_bloat:
 options.show_detail = True
-builder.SetDisplayOptions(options.show_errors, options.show_sizes,
-  options.show_detail, options.show_bloat,
-  options.list_error_boards,
- 

[PATCH 21/22] buildman: Make -I the default

2020-04-05 Thread Simon Glass
At present buildman defaults to running 'mrproper' on every thread before
it starts building commits for each board. This can add a delay of about 5
seconds to the start of the process, since the tools and other invariants
must be rebuilt.

In particular, a build without '-b', to build current source, runs much
slower without -I, since any existing build is removed, thus losing the
possibility of an incremental build.

Partly this behaviour was to avoid strange build-system problems caused by
running 'make defconfig' for one board and then one with a different
architecture. But these problems were fixed quite a while ago.

The -I option (which disabled mrproper) was introduced four years ago and
does not seem to cause any problems with builds.

So make -I the default and deprecate the option. To allow use of
'mrproper', add a new -m flag.

Signed-off-by: Simon Glass 
---

 tools/buildman/README   | 13 ++---
 tools/buildman/builder.py   |  7 +++
 tools/buildman/builderthread.py |  6 +++---
 tools/buildman/cmdline.py   |  5 -
 tools/buildman/control.py   |  6 +-
 tools/buildman/func_test.py | 28 
 6 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index ca0d1f64460..f299b0c2972 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -958,12 +958,11 @@ will build commits in us-buildman that are not in 
upstream/master.
 Building Faster
 ===
 
-By default, buildman executes 'make mrproper' prior to building the first
-commit for each board. This causes everything to be built from scratch. If you
-trust the build system's incremental build capabilities, you can pass the -I
-flag to skip the 'make mproper' invocation, which will reduce the amount of
-work 'make' does, and hence speed up the build. This flag will speed up any
-buildman invocation, since it reduces the amount of work done on any build.
+By default, buildman doesn't execute 'make mrproper' prior to building the
+first commit for each board. This reduces the amount of work 'make' does, and
+hence speeds up the build. To force use of 'make mrproper', use -the -m flag.
+This flag will slow down any buildman invocation, since it increases the amount
+of work done on any build.
 
 One possible application of buildman is as part of a continual edit, build,
 edit, build, ... cycle; repeatedly applying buildman to the same change or
@@ -994,7 +993,7 @@ Combining all of these options together yields the 
command-line shown below.
 This will provide the quickest possible feedback regarding the current content
 of the source tree, thus allowing rapid tested evolution of the code.
 
-SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -I -P tegra
+SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -P tegra
 
 
 Checking configuration
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index caa98e0ebbb..43e667c89f9 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -231,7 +231,7 @@ class Builder:
 def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs,
  gnu_make='make', checkout=True, show_unknown=True, step=1,
  no_subdirs=False, full_path=False, verbose_build=False,
- incremental=False, per_board_out_dir=False,
+ mrproper=False, per_board_out_dir=False,
  config_only=False, squash_config_y=False,
  warnings_as_errors=False, work_in_output=False):
 """Create a new Builder object
@@ -252,8 +252,7 @@ class Builder:
 full_path: Return the full path in CROSS_COMPILE and don't set
 PATH
 verbose_build: Run build with V=1 and don't use 'make -s'
-incremental: Always perform incremental builds; don't run make
-mrproper when configuring
+mrproper: Always run 'make mrproper' when configuring
 per_board_out_dir: Build in a separate persistent directory per
 board rather than a thread-specific directory
 config_only: Only configure each build, don't build it
@@ -311,7 +310,7 @@ class Builder:
 self.queue = queue.Queue()
 self.out_queue = queue.Queue()
 for i in range(self.num_threads):
-t = builderthread.BuilderThread(self, i, incremental,
+t = builderthread.BuilderThread(self, i, mrproper,
 per_board_out_dir)
 t.setDaemon(True)
 t.start()
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 7561f399428..fc6e1ab25da 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -90,12 +90,12 @@ class BuilderThread(threading.Thread):
 thread_num: Our thread number (0-n-1), used to decide on a
 temporary directory
 """
-def __init__(self, builder, thread_num, 

[PATCH 19/22] buildman: Add the abbreviation for --boards

2020-04-05 Thread Simon Glass
This option may be frequency used, so mention that it can be abbreviated
to --bo

Signed-off-by: Simon Glass 
---

 tools/buildman/README | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 86f5dfe501f..9bf4383f9f7 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -151,9 +151,9 @@ You can also use -x to specifically exclude some boards. 
For example:
 means to build all arm boards except nvidia, freescale and anything ending
 with 'ball'.
 
-For building specific boards you can use the --boards option, which takes a
-comma-separated list of board target names and be used multiple times on
-the command line:
+For building specific boards you can use the --boards (or --bo) option, which
+takes a comma-separated list of board target names and be used multiple times
+on the command line:
 
   buildman --boards sandbox,snow --boards
 
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 15/22] buildman: Drop unused output code

2020-04-05 Thread Simon Glass
The commit counter is a hangover from when buildman processed each board
for a commit. Now buildman processes each commit for a board, so this
output is never triggered.

Delete it.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 5 -
 1 file changed, 5 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 48bbc0aeeca..70879274f24 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -450,11 +450,6 @@ class Builder:
 self._AddTimestamp()
 if self._complete_delay:
 name += '%s  : ' % self._complete_delay
-# When building all boards for a commit, we can print a commit
-# progress message.
-if result and result.commit_upto is None:
-name += 'commit %2d/%-3d' % (self.commit_upto + 1,
-self.commit_count)
 
 name += target
 terminal.PrintClear()
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 14/22] buildman: Show a message when fetching a repo

2020-04-05 Thread Simon Glass
Fetching updated versions of a repo can take time. At present buildman
gives no indication that it is doing this.

Add a message to explain the delay.

Tidy up a few other messages while we are here.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 7901c92ef32..48bbc0aeeca 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1533,7 +1533,10 @@ class Builder:
 if setup_git and self.git_dir:
 src_dir = os.path.abspath(self.git_dir)
 if os.path.exists(git_dir):
+Print('\rFetching repo for thread %d' % thread_num,
+  newline=False)
 gitutil.Fetch(git_dir, thread_dir)
+terminal.PrintClear()
 else:
 Print('\rCloning repo for thread %d' % thread_num,
   newline=False)
@@ -1591,7 +1594,7 @@ class Builder:
   newline=False)
 for dirname in to_remove:
 shutil.rmtree(dirname)
-Print('done')
+terminal.PrintClear()
 
 def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
 """Build all commits for a list of boards
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 17/22] buildman: Show a summary of the build result

2020-04-05 Thread Simon Glass
When buildman finishes it leaves the last summary line visible, which
shows the number of successful builds, builds with warnings and builds
with errors.

It is useful also to see how many builds were done in total along with
the time taken. Show these on a separate line before buildman finishes.

Signed-off-by: Simon Glass 

---

 tools/buildman/builder.py | 17 +
 tools/buildman/test.py|  6 +++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 9bcfb93428f..caa98e0ebbb 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -192,6 +192,7 @@ class Builder:
 _next_delay_update: Next time we plan to display a progress update
 (datatime)
 _show_unknown: Show unknown boards (those not built) in summary
+_start_time: Start time for the build
 _timestamps: List of timestamps for the completion of the last
 last _timestamp_count builds. Each is a datetime object.
 _timestamp_count: Number of timestamps to keep in our list.
@@ -281,6 +282,7 @@ class Builder:
 self._build_period_us = None
 self._complete_delay = None
 self._next_delay_update = datetime.now()
+self._start_time = datetime.now()
 self.force_config_on_failure = True
 self.force_build_failures = False
 self.force_reconfig = False
@@ -1642,4 +1644,19 @@ class Builder:
 # Wait until we have processed all output
 self.out_queue.join()
 Print()
+
+msg = 'Completed: %d total built' % self.count
+if self.already_done:
+   msg += ' (%d previously' % self.already_done
+   if self.already_done != self.count:
+   msg += ', %d newly' % (self.count - self.already_done)
+   msg += ')'
+duration = datetime.now() - self._start_time
+if duration > timedelta(microseconds=100):
+if duration.microseconds >= 50:
+duration = duration + timedelta(seconds=1)
+duration = duration - timedelta(microseconds=duration.microseconds)
+msg += ', duration %s' % duration
+Print(msg)
+
 return (self.fail, self.warned)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 5f8e37e578b..24df6618852 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -205,9 +205,9 @@ class TestBuild(unittest.TestCase):
 if line.text.strip():
 count += 1
 
-# We should get two starting messages, then an update for every commit
-# built.
-self.assertEqual(count, len(commits) * len(boards) + 2)
+# We should get two starting messages, an update for every commit built
+# and a summary message
+self.assertEqual(count, len(commits) * len(boards) + 3)
 build.SetDisplayOptions(**kwdisplay_args);
 build.ShowSummary(self.commits, board_selected)
 if echo_lines:
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 16/22] buildman: Show the number of builds remaining

2020-04-05 Thread Simon Glass
It is nice to see the actual number of builds remaining to complete. Add
this in the progress message, using a different colour.

Drop the unnecessary 'name' variable while we are here.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 70879274f24..9bcfb93428f 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -444,16 +444,21 @@ class Builder:
 line += self.col.Color(self.col.YELLOW, '%5d' % self.warned)
 line += self.col.Color(self.col.RED, '%5d' % self.fail)
 
-name = ' /%-5d  ' % self.count
+line += ' /%-5d  ' % self.count
+remaining = self.count - self.upto
+if remaining:
+line += self.col.Color(self.col.MAGENTA, ' -%-5d  ' % remaining)
+else:
+line += ' ' * 8
 
 # Add our current completion time estimate
 self._AddTimestamp()
 if self._complete_delay:
-name += '%s  : ' % self._complete_delay
+line += '%s  : ' % self._complete_delay
 
-name += target
+line += target
 terminal.PrintClear()
-Print(line + name, newline=False)
+Print(line, newline=False)
 
 def _GetOutputDir(self, commit_upto):
 """Get the name of the output directory for a commit number
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 12/22] patman: Support erasing a previously unfinished text line

2020-04-05 Thread Simon Glass
When printing progress it is useful to print a message and leave the
cursor at the end of the line until the operation is finished. When it is
finished, the line needs to be erased so a new line can start in its place.

Add a function to handle clearing a line previously written by
terminal.Print()

Signed-off-by: Simon Glass 
---

 tools/patman/patman.py   |  2 +-
 tools/patman/terminal.py | 47 
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index cf53e532ddf..7f4ac9aef48 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -93,7 +93,7 @@ elif options.test:
 suite = unittest.TestLoader().loadTestsFromTestCase(module)
 suite.run(result)
 
-for module in ['gitutil', 'settings']:
+for module in ['gitutil', 'settings', 'terminal']:
 suite = doctest.DocTestSuite(module)
 suite.run(result)
 
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index 6541fa8f410..c7693eb57ad 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -10,6 +10,7 @@ This module handles terminal interaction including ANSI color 
codes.
 from __future__ import print_function
 
 import os
+import re
 import sys
 
 # Selection of when we want our output to be colored
@@ -19,6 +20,13 @@ COLOR_IF_TERMINAL, COLOR_ALWAYS, COLOR_NEVER = range(3)
 print_test_mode = False
 print_test_list = []
 
+# The length of the last line printed without a newline
+last_print_len = None
+
+# credit:
+# 
stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python
+ansi_escape = re.compile(r'\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
+
 class PrintLine:
 """A line of text output
 
@@ -36,6 +44,33 @@ class PrintLine:
 return 'newline=%s, colour=%s, text=%s' % (self.newline, self.colour,
 self.text)
 
+def CalcAsciiLen(text):
+"""Calculate the length of a string, ignoring any ANSI sequences
+
+Args:
+text: Text to check
+
+Returns:
+Length of text, after skipping ANSI sequences
+
+>>> col = Color(COLOR_ALWAYS)
+>>> text = col.Color(Color.RED, 'abc')
+>>> len(text)
+14
+>>> CalcAsciiLen(text)
+3
+>>>
+>>> text += 'def'
+>>> CalcAsciiLen(text)
+6
+>>> text += col.Color(Color.RED, 'abc')
+>>> CalcAsciiLen(text)
+9
+"""
+result = ansi_escape.sub('', text)
+return len(result)
+
+
 def Print(text='', newline=True, colour=None):
 """Handle a line of output to the terminal.
 
@@ -47,6 +82,8 @@ def Print(text='', newline=True, colour=None):
 newline: True to add a new line at the end of the text
 colour: Colour to use for the text
 """
+global last_print_len
+
 if print_test_mode:
 print_test_list.append(PrintLine(text, newline, colour))
 else:
@@ -55,8 +92,18 @@ def Print(text='', newline=True, colour=None):
 text = col.Color(colour, text)
 if newline:
 print(text)
+last_print_len = None
 else:
 print(text, end='', flush=True)
+last_print_len = CalcAsciiLen(text)
+
+def PrintClear():
+"""Clear a previously line that was printed with no newline"""
+global last_print_len
+
+if last_print_len:
+print('\r%s\r' % (' '* last_print_len), end='', flush=True)
+last_print_len = None
 
 def SetPrintTestMode():
 """Go into test mode, where all printing is recorded"""
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 13/22] buildman: Drop the line-clearing code in Builder

2020-04-05 Thread Simon Glass
The new feature in terminal can be used by buildman. Update the Builder
class accordingly.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 28 +++-
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 7cbb1a6f628..7901c92ef32 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -162,8 +162,6 @@ class Builder:
 force_build_failures: If a previously-built build (i.e. built on
 a previous run of buildman) is marked as failed, rebuild it.
 git_dir: Git directory containing source repository
-last_line_len: Length of the last line we printed (used for erasing
-it with new progress information)
 num_jobs: Number of jobs to run at once (passed to make as -j)
 num_threads: Number of builder threads to run
 out_queue: Queue of results to process
@@ -317,7 +315,6 @@ class Builder:
 t.start()
 self.threads.append(t)
 
-self.last_line_len = 0
 t = builderthread.ResultThread(self)
 t.setDaemon(True)
 t.start()
@@ -388,22 +385,6 @@ class Builder:
 self._timestamps.popleft()
 count -= 1
 
-def ClearLine(self, length):
-"""Clear any characters on the current line
-
-Make way for a new line of length 'length', by outputting enough
-spaces to clear out the old line. Then remember the new length for
-next time.
-
-Args:
-length: Length of new line, in characters
-"""
-if length < self.last_line_len:
-Print(' ' * (self.last_line_len - length), newline=False)
-Print('\r', newline=False)
-self.last_line_len = length
-sys.stdout.flush()
-
 def SelectCommit(self, commit, checkout=True):
 """Checkout the selected commit for this build
 """
@@ -449,8 +430,7 @@ class Builder:
 if result.already_done:
 self.already_done += 1
 if self._verbose:
-Print('\r', newline=False)
-self.ClearLine(0)
+terminal.PrintClear()
 boards_selected = {target : result.brd}
 self.ResetResultSummary(boards_selected)
 self.ProduceResultSummary(result.commit_upto, self.commits,
@@ -477,9 +457,8 @@ class Builder:
 self.commit_count)
 
 name += target
+terminal.PrintClear()
 Print(line + name, newline=False)
-length = 16 + len(name)
-self.ClearLine(length)
 
 def _GetOutputDir(self, commit_upto):
 """Get the name of the output directory for a commit number
@@ -1559,7 +1538,7 @@ class Builder:
 Print('\rCloning repo for thread %d' % thread_num,
   newline=False)
 gitutil.Clone(src_dir, thread_dir)
-Print('\r%s\r' % (' ' * 30), newline=False)
+terminal.PrintClear()
 
 def _PrepareWorkingSpace(self, max_threads, setup_git):
 """Prepare the working directory for use.
@@ -1660,5 +1639,4 @@ class Builder:
 # Wait until we have processed all output
 self.out_queue.join()
 Print()
-self.ClearLine(0)
 return (self.fail, self.warned)
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 11/22] patman: Update flushing Print() for Python 3

2020-04-05 Thread Simon Glass
This does not seem to work on Python 3. Update the code to use the
built-in support.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index 7a3b658b00e..6541fa8f410 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -53,11 +53,10 @@ def Print(text='', newline=True, colour=None):
 if colour:
 col = Color()
 text = col.Color(colour, text)
-print(text, end='')
 if newline:
-print()
+print(text)
 else:
-sys.stdout.flush()
+print(text, end='', flush=True)
 
 def SetPrintTestMode():
 """Go into test mode, where all printing is recorded"""
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 10/22] buildman: Show the list of boards in magenta

2020-04-05 Thread Simon Glass
It is quite hard to see the list of board for each error line since the
colour is the same as the actual error line. Show the board list in
magenta so that it is easier to distinguish them.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 15 ---
 tools/buildman/test.py| 57 ++-
 2 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 238b711dec4..7cbb1a6f628 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1249,13 +1249,20 @@ class Builder:
 colour: Colour to use for output
 """
 if err_lines:
-out = []
+out_list = []
 for line in err_lines:
 boards = ''
 names = [board.target for board in line.boards]
-boards = '(%s) ' % ','.join(names) if names else ''
-out.append('%s%s%s' % (line.char, boards, line.errline))
-Print('\n'.join(out), colour=colour)
+board_str = ','.join(names) if names else ''
+if board_str:
+out = self.col.Color(colour, line.char + '(')
+out += self.col.Color(self.col.MAGENTA, board_str,
+  bright=False)
+out += self.col.Color(colour, ') %s' % line.errline)
+else:
+out = self.col.Color(colour, line.char + line.errline)
+out_list.append(out)
+Print('\n'.join(out_list))
 self._error_lines += 1
 
 
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 3ca4da849d4..5f8e37e578b 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -222,7 +222,7 @@ class TestBuild(unittest.TestCase):
 list_error_boards: Adjust the check for output produced with the
--list-error-boards flag
 """
-def add_line_prefix(prefix, boards, error_str):
+def add_line_prefix(prefix, boards, error_str, colour):
 """Add a prefix to each line of a string
 
 The training \n in error_str is removed before processing
@@ -230,14 +230,23 @@ class TestBuild(unittest.TestCase):
 Args:
 prefix: String prefix to add
 error_str: Error string containing the lines
+colour: Expected colour for the line. Note that the board list,
+if present, always appears in magenta
 
 Returns:
 New string where each line has the prefix added
 """
-if boards:
-boards = '(%s) ' % boards
 lines = error_str.strip().splitlines()
-new_lines = [prefix + boards + line for line in lines]
+new_lines = []
+for line in lines:
+if boards:
+expect = self._col.Color(colour, prefix + '(')
+expect += self._col.Color(self._col.MAGENTA, boards,
+  bright=False)
+expect += self._col.Color(colour, ') %s' % line)
+else:
+expect = self._col.Color(colour, prefix + line)
+new_lines.append(expect)
 return '\n'.join(new_lines)
 
 # Upstream commit: no errors
@@ -262,9 +271,9 @@ class TestBuild(unittest.TestCase):
 # Second commit: The warnings should be listed
 line = next(lines)
 
+self.maxDiff = 1000
 self.assertEqual(line.text,
- add_line_prefix('w+', boards1234, errors[0]))
-self.assertEqual(line.colour, col.YELLOW)
+add_line_prefix('w+', boards1234, errors[0], col.YELLOW))
 
 # Third commit: Still fails
 self.assertEqual(next(lines).text, '03: %s' % commits[2][1])
@@ -276,8 +285,8 @@ class TestBuild(unittest.TestCase):
 
 # Expect a compiler error
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('+', boards234, errors[1]))
-self.assertEqual(line.colour, col.RED)
+self.assertEqual(line.text,
+ add_line_prefix('+', boards234, errors[1], col.RED))
 
 # Fourth commit: Compile errors are fixed, just have warning for board3
 self.assertEqual(next(lines).text, '04: %s' % commits[3][1])
@@ -294,12 +303,12 @@ class TestBuild(unittest.TestCase):
 
 # Compile error fixed
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('-', boards234, errors[1]))
-self.assertEqual(line.colour, col.GREEN)
+self.assertEqual(line.text,
+ add_line_prefix('-', boards234, errors[1], col.GREEN))
 
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('w+', 

[PATCH 09/22] buildman: Use an object to hold error lines

2020-04-05 Thread Simon Glass
At present the string for each error line is created in _CalcErrorDelta()
and used to create the summary output. This is inflexible since all the
information (error/warning character, error line, list of boards with that
error line) is munged together in a string.

Create an object to hold this information and only convert it to a string
when printing the actual output.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 69 +--
 1 file changed, 52 insertions(+), 17 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 01d8bf46e45..238b711dec4 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -24,7 +24,6 @@ import terminal
 from terminal import Print
 import toolchain
 
-
 """
 Theory of Operation
 
@@ -91,6 +90,15 @@ u-boot/ source directory
 .git/   repository
 """
 
+"""Holds information about a particular error line we are outputing
+
+   char: Character representation: '+': error, '-': fixed error, 'w+': warning,
+   'w-' = fixed warning
+   boards: List of Board objects which have line in the error/warning output
+   errline: The text of the error line
+"""
+ErrLine = collections.namedtuple('ErrLine', 'char,boards,errline')
+
 # Possible build outcomes
 OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = list(range(4))
 
@@ -1128,32 +1136,52 @@ class Builder:
 
 Args:
 line: Error line to search for
+line_boards: boards to search, each a Board
 Return:
-String containing a list of boards with that error line, or
-'' if the user has not requested such a list
+List of boards with that error line, or [] if the user has not
+requested such a list
 """
+boards = []
+board_set = set()
 if self._list_error_boards:
-names = []
 for board in line_boards[line]:
-if not board.target in names:
-names.append(board.target)
-names_str = '(%s) ' % ','.join(names)
-else:
-names_str = ''
-return names_str
+if not board in board_set:
+boards.append(board)
+board_set.add(board)
+return boards
 
 def _CalcErrorDelta(base_lines, base_line_boards, lines, line_boards,
 char):
+"""Calculate the required output based on changes in errors
+
+Args:
+base_lines: List of errors/warnings for previous commit
+base_line_boards: Dict keyed by error line, containing a list
+of the Board objects with that error in the previous commit
+lines: List of errors/warning for this commit, each a str
+line_boards: Dict keyed by error line, containing a list
+of the Board objects with that error in this commit
+char: Character representing error ('') or warning ('w'). The
+broken ('+') or fixed ('-') characters are added in this
+function
+
+Returns:
+Tuple
+List of ErrLine objects for 'better' lines
+List of ErrLine objects for 'worse' lines
+"""
 better_lines = []
 worse_lines = []
 for line in lines:
 if line not in base_lines:
-worse_lines.append(char + '+' +
-_BoardList(line, line_boards) + line)
+errline = ErrLine(char + '+', _BoardList(line, 
line_boards),
+  line)
+worse_lines.append(errline)
 for line in base_lines:
 if line not in lines:
-better_lines.append(char + '-' +
-_BoardList(line, base_line_boards) + line)
+errline = ErrLine(char + '-',
+  _BoardList(line, base_line_boards), line)
+better_lines.append(errline)
 return better_lines, worse_lines
 
 def _CalcConfig(delta, name, config):
@@ -1215,12 +1243,19 @@ class Builder:
 Also increments self._error_lines if err_lines not empty
 
 Args:
-err_lines: List of strings, each an error or warning line,
-possibly including a list of boards with that error/warning
+err_lines: List of ErrLine objects, each an error or warning
+line, possibly including a list of boards with that
+error/warning
 colour: Colour to use for output
 """
 if err_lines:
-

[PATCH 08/22] buildman: Use yellow consistently for warning lines

2020-04-05 Thread Simon Glass
At present warnings are shown in yellow in the summary (-s) but magenta in
the detail listing (-e). Use yellow in both.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 621147696ed..01d8bf46e45 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1279,7 +1279,7 @@ class Builder:
 _OutputErrLines(better_err, colour=self.col.GREEN)
 _OutputErrLines(worse_err, colour=self.col.RED)
 _OutputErrLines(better_warn, colour=self.col.CYAN)
-_OutputErrLines(worse_warn, colour=self.col.MAGENTA)
+_OutputErrLines(worse_warn, colour=self.col.YELLOW)
 
 if show_sizes:
 self.PrintSizeSummary(board_selected, board_dict, show_detail,
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 763943ca76a..3ca4da849d4 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -264,7 +264,7 @@ class TestBuild(unittest.TestCase):
 
 self.assertEqual(line.text,
  add_line_prefix('w+', boards1234, errors[0]))
-self.assertEqual(line.colour, col.MAGENTA)
+self.assertEqual(line.colour, col.YELLOW)
 
 # Third commit: Still fails
 self.assertEqual(next(lines).text, '03: %s' % commits[2][1])
@@ -299,7 +299,7 @@ class TestBuild(unittest.TestCase):
 
 line = next(lines)
 self.assertEqual(line.text, add_line_prefix('w+', boards34, errors[2]))
-self.assertEqual(line.colour, col.MAGENTA)
+self.assertEqual(line.colour, col.YELLOW)
 
 # Fifth commit
 self.assertEqual(next(lines).text, '05: %s' % commits[4][1])
@@ -353,7 +353,7 @@ class TestBuild(unittest.TestCase):
 expect = '\n'.join(expect)
 line = next(lines)
 self.assertEqual(line.text, add_line_prefix('w+', boards4, expect))
-self.assertEqual(line.colour, col.MAGENTA)
+self.assertEqual(line.colour, col.YELLOW)
 
 def testOutput(self):
 """Test basic builder operation and output
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 06/22] buildman: Add a test helper for creating a line prefix

2020-04-05 Thread Simon Glass
The split/join code is repeated in a lot of places. Add a function to
handle this.

Signed-off-by: Simon Glass 
---

 tools/buildman/test.py | 51 +-
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index c9c7a05ca61..1377035fbb4 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -220,6 +220,22 @@ class TestBuild(unittest.TestCase):
 Args:
 lines: Iterator containing the lines returned from the summary
 """
+def add_line_prefix(prefix, error_str):
+"""Add a prefix to each line of a string
+
+The training \n in error_str is removed before processing
+
+Args:
+prefix: String prefix to add
+error_str: Error string containing the lines
+
+Returns:
+New string where each line has the prefix added
+"""
+lines = error_str.strip().splitlines()
+new_lines = [prefix + line for line in lines]
+return '\n'.join(new_lines)
+
 # Upstream commit: no errors
 self.assertEqual(next(lines).text, '01: %s' % commits[0][1])
 
@@ -236,8 +252,8 @@ class TestBuild(unittest.TestCase):
 
 # Second commit: The warnings should be listed
 line = next(lines)
-self.assertEqual(line.text, 'w+%s' %
-errors[0].rstrip().replace('\n', '\nw+'))
+
+self.assertEqual(line.text, add_line_prefix('w+', errors[0]))
 self.assertEqual(line.colour, col.MAGENTA)
 
 # Third commit: Still fails
@@ -250,8 +266,7 @@ class TestBuild(unittest.TestCase):
 
 # Expect a compiler error
 line = next(lines)
-self.assertEqual(line.text, '+%s' %
-errors[1].rstrip().replace('\n', '\n+'))
+self.assertEqual(line.text, add_line_prefix('+', errors[1]))
 self.assertEqual(line.colour, col.RED)
 
 # Fourth commit: Compile errors are fixed, just have warning for board3
@@ -269,13 +284,11 @@ class TestBuild(unittest.TestCase):
 
 # Compile error fixed
 line = next(lines)
-self.assertEqual(line.text, '-%s' %
-errors[1].rstrip().replace('\n', '\n-'))
+self.assertEqual(line.text, add_line_prefix('-', errors[1]))
 self.assertEqual(line.colour, col.GREEN)
 
 line = next(lines)
-self.assertEqual(line.text, 'w+%s' %
-errors[2].rstrip().replace('\n', '\nw+'))
+self.assertEqual(line.text, add_line_prefix('w+', errors[2]))
 self.assertEqual(line.colour, col.MAGENTA)
 
 # Fifth commit
@@ -287,14 +300,13 @@ class TestBuild(unittest.TestCase):
 # The second line of errors[3] is a duplicate, so buildman will drop it
 expect = errors[3].rstrip().split('\n')
 expect = [expect[0]] + expect[2:]
+expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, '+%s' %
-'\n'.join(expect).replace('\n', '\n+'))
+self.assertEqual(line.text, add_line_prefix('+', expect))
 self.assertEqual(line.colour, col.RED)
 
 line = next(lines)
-self.assertEqual(line.text, 'w-%s' %
-errors[2].rstrip().replace('\n', '\nw-'))
+self.assertEqual(line.text, add_line_prefix('w-', errors[2]))
 self.assertEqual(line.colour, col.CYAN)
 
 # Sixth commit
@@ -305,14 +317,13 @@ class TestBuild(unittest.TestCase):
 # The second line of errors[3] is a duplicate, so buildman will drop it
 expect = errors[3].rstrip().split('\n')
 expect = [expect[0]] + expect[2:]
+expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, '-%s' %
-'\n'.join(expect).replace('\n', '\n-'))
+self.assertEqual(line.text, add_line_prefix('-', expect))
 self.assertEqual(line.colour, col.GREEN)
 
 line = next(lines)
-self.assertEqual(line.text, 'w-%s' %
-errors[0].rstrip().replace('\n', '\nw-'))
+self.assertEqual(line.text, add_line_prefix('w-', errors[0]))
 self.assertEqual(line.colour, col.CYAN)
 
 # Seventh commit
@@ -322,16 +333,16 @@ class TestBuild(unittest.TestCase):
 # Pick out the correct error lines
 expect_str = errors[4].rstrip().replace('%(basedir)s', '').split('\n')
 expect = expect_str[3:8] + [expect_str[-1]]
+expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, '+%s' %
-'\n'.join(expect).replace('\n', '\n+'))
+self.assertEqual(line.text, add_line_prefix('+', expect))
 self.assertEqual(line.colour, col.RED)
 
 # Now the warnings lines
 expect = [expect_str[0]] + expect_str[10:12] + [expect_str[9]]
+expect = '\n'.join(expect)
 line = next(lines)
-

[PATCH 07/22] buildman: Test the output with --list-error-boards

2020-04-05 Thread Simon Glass
Add a test to cover this flag, which adds the name of each board to each
error/warning line.

Signed-off-by: Simon Glass 
---

 tools/buildman/test.py | 46 +-
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 1377035fbb4..763943ca76a 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -214,13 +214,15 @@ class TestBuild(unittest.TestCase):
 terminal.EchoPrintTestLines()
 return iter(terminal.GetPrintTestLines())
 
-def _CheckOutput(self, lines):
+def _CheckOutput(self, lines, list_error_boards):
 """Check for expected output from the build summary
 
 Args:
 lines: Iterator containing the lines returned from the summary
+list_error_boards: Adjust the check for output produced with the
+   --list-error-boards flag
 """
-def add_line_prefix(prefix, error_str):
+def add_line_prefix(prefix, boards, error_str):
 """Add a prefix to each line of a string
 
 The training \n in error_str is removed before processing
@@ -232,13 +234,20 @@ class TestBuild(unittest.TestCase):
 Returns:
 New string where each line has the prefix added
 """
+if boards:
+boards = '(%s) ' % boards
 lines = error_str.strip().splitlines()
-new_lines = [prefix + line for line in lines]
+new_lines = [prefix + boards + line for line in lines]
 return '\n'.join(new_lines)
 
 # Upstream commit: no errors
 self.assertEqual(next(lines).text, '01: %s' % commits[0][1])
 
+boards1234 = 'board1,board2,board3,board4' if list_error_boards else ''
+boards234 = 'board2,board3,board4' if list_error_boards else ''
+boards34 = 'board3,board4' if list_error_boards else ''
+boards4 = 'board4' if list_error_boards else ''
+
 # Second commit: all archs should fail with warnings
 self.assertEqual(next(lines).text, '02: %s' % commits[1][1])
 
@@ -253,7 +262,8 @@ class TestBuild(unittest.TestCase):
 # Second commit: The warnings should be listed
 line = next(lines)
 
-self.assertEqual(line.text, add_line_prefix('w+', errors[0]))
+self.assertEqual(line.text,
+ add_line_prefix('w+', boards1234, errors[0]))
 self.assertEqual(line.colour, col.MAGENTA)
 
 # Third commit: Still fails
@@ -266,7 +276,7 @@ class TestBuild(unittest.TestCase):
 
 # Expect a compiler error
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('+', errors[1]))
+self.assertEqual(line.text, add_line_prefix('+', boards234, errors[1]))
 self.assertEqual(line.colour, col.RED)
 
 # Fourth commit: Compile errors are fixed, just have warning for board3
@@ -284,11 +294,11 @@ class TestBuild(unittest.TestCase):
 
 # Compile error fixed
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('-', errors[1]))
+self.assertEqual(line.text, add_line_prefix('-', boards234, errors[1]))
 self.assertEqual(line.colour, col.GREEN)
 
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('w+', errors[2]))
+self.assertEqual(line.text, add_line_prefix('w+', boards34, errors[2]))
 self.assertEqual(line.colour, col.MAGENTA)
 
 # Fifth commit
@@ -302,11 +312,11 @@ class TestBuild(unittest.TestCase):
 expect = [expect[0]] + expect[2:]
 expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('+', expect))
+self.assertEqual(line.text, add_line_prefix('+', boards4, expect))
 self.assertEqual(line.colour, col.RED)
 
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('w-', errors[2]))
+self.assertEqual(line.text, add_line_prefix('w-', boards34, errors[2]))
 self.assertEqual(line.colour, col.CYAN)
 
 # Sixth commit
@@ -319,11 +329,11 @@ class TestBuild(unittest.TestCase):
 expect = [expect[0]] + expect[2:]
 expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('-', expect))
+self.assertEqual(line.text, add_line_prefix('-', boards4, expect))
 self.assertEqual(line.colour, col.GREEN)
 
 line = next(lines)
-self.assertEqual(line.text, add_line_prefix('w-', errors[0]))
+self.assertEqual(line.text, add_line_prefix('w-', boards4, errors[0]))
 self.assertEqual(line.colour, col.CYAN)
 
 # Seventh commit
@@ -335,14 +345,14 @@ class TestBuild(unittest.TestCase):
 expect = expect_str[3:8] + [expect_str[-1]]
 expect = '\n'.join(expect)
 line = next(lines)
-self.assertEqual(line.text, 

[PATCH 03/22] buildman: Use an iterator to check test output

2020-04-05 Thread Simon Glass
Rather than using the absolute array index, use an interator to work
through the expected output lines. This is easier to follow.

Signed-off-by: Simon Glass 
---

 tools/buildman/test.py | 94 +++---
 1 file changed, 52 insertions(+), 42 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 8e2b07fb438..84dd608127e 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -204,41 +204,44 @@ class TestBuild(unittest.TestCase):
 build.SetDisplayOptions(show_errors=True);
 build.ShowSummary(self.commits, board_selected)
 #terminal.EchoPrintTestLines()
-lines = terminal.GetPrintTestLines()
+lines = iter(terminal.GetPrintTestLines())
 
 # Upstream commit: no errors
-self.assertEqual(lines[0].text, '01: %s' % commits[0][1])
+self.assertEqual(next(lines).text, '01: %s' % commits[0][1])
 
 # Second commit: all archs should fail with warnings
-self.assertEqual(lines[1].text, '02: %s' % commits[1][1])
+self.assertEqual(next(lines).text, '02: %s' % commits[1][1])
 
 col = terminal.Color()
-self.assertSummary(lines[2].text, 'arm', 'w+', ['board1'],
-   outcome=OUTCOME_WARN)
-self.assertSummary(lines[3].text, 'powerpc', 'w+', ['board2', 
'board3'],
+self.assertSummary(next(lines).text, 'arm', 'w+', ['board1'],
outcome=OUTCOME_WARN)
-self.assertSummary(lines[4].text, 'sandbox', 'w+', ['board4'],
+self.assertSummary(next(lines).text, 'powerpc', 'w+',
+   ['board2', 'board3'], outcome=OUTCOME_WARN)
+self.assertSummary(next(lines).text, 'sandbox', 'w+', ['board4'],
outcome=OUTCOME_WARN)
 
 # Second commit: The warnings should be listed
-self.assertEqual(lines[5].text, 'w+%s' %
+line = next(lines)
+self.assertEqual(line.text, 'w+%s' %
 errors[0].rstrip().replace('\n', '\nw+'))
-self.assertEqual(lines[5].colour, col.MAGENTA)
+self.assertEqual(line.colour, col.MAGENTA)
 
 # Third commit: Still fails
-self.assertEqual(lines[6].text, '03: %s' % commits[2][1])
-self.assertSummary(lines[7].text, 'arm', '', ['board1'],
+self.assertEqual(next(lines).text, '03: %s' % commits[2][1])
+self.assertSummary(next(lines).text, 'arm', '', ['board1'],
outcome=OUTCOME_OK)
-self.assertSummary(lines[8].text, 'powerpc', '+', ['board2', 'board3'])
-self.assertSummary(lines[9].text, 'sandbox', '+', ['board4'])
+self.assertSummary(next(lines).text, 'powerpc', '+',
+   ['board2', 'board3'])
+self.assertSummary(next(lines).text, 'sandbox', '+', ['board4'])
 
 # Expect a compiler error
-self.assertEqual(lines[10].text, '+%s' %
+line = next(lines)
+self.assertEqual(line.text, '+%s' %
 errors[1].rstrip().replace('\n', '\n+'))
-self.assertEqual(lines[10].colour, col.RED)
+self.assertEqual(line.colour, col.RED)
 
 # Fourth commit: Compile errors are fixed, just have warning for board3
-self.assertEqual(lines[11].text, '04: %s' % commits[3][1])
+self.assertEqual(next(lines).text, '04: %s' % commits[3][1])
 expect = '%10s: ' % 'powerpc'
 expect += ' ' + col.Color(col.GREEN, '')
 expect += '  '
@@ -246,70 +249,77 @@ class TestBuild(unittest.TestCase):
 expect += ' ' + col.Color(col.YELLOW, 'w+')
 expect += '  '
 expect += col.Color(col.YELLOW, ' %s' % 'board3')
-self.assertEqual(lines[12].text, expect)
-self.assertSummary(lines[13].text, 'sandbox', 'w+', ['board4'],
+self.assertEqual(next(lines).text, expect)
+self.assertSummary(next(lines).text, 'sandbox', 'w+', ['board4'],
outcome=OUTCOME_WARN)
 
 # Compile error fixed
-self.assertEqual(lines[14].text, '-%s' %
+line = next(lines)
+self.assertEqual(line.text, '-%s' %
 errors[1].rstrip().replace('\n', '\n-'))
-self.assertEqual(lines[14].colour, col.GREEN)
+self.assertEqual(line.colour, col.GREEN)
 
-self.assertEqual(lines[15].text, 'w+%s' %
+line = next(lines)
+self.assertEqual(line.text, 'w+%s' %
 errors[2].rstrip().replace('\n', '\nw+'))
-self.assertEqual(lines[15].colour, col.MAGENTA)
+self.assertEqual(line.colour, col.MAGENTA)
 
 # Fifth commit
-self.assertEqual(lines[16].text, '05: %s' % commits[4][1])
-self.assertSummary(lines[17].text, 'powerpc', '', ['board3'],
+self.assertEqual(next(lines).text, '05: %s' % commits[4][1])
+self.assertSummary(next(lines).text, 'powerpc', '', ['board3'],
outcome=OUTCOME_OK)
-

[PATCH 01/22] buildman: Refactor error-line output int a function

2020-04-05 Thread Simon Glass
Reduce the amount of repeated code by creating an _OutputErrLines()
function to hold this code.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 70c55c588a7..621147696ed 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1209,6 +1209,20 @@ class Builder:
 col = self.col.YELLOW
 Print('   ' + line, newline=True, colour=col)
 
+def _OutputErrLines(err_lines, colour):
+"""Output the line of error/warning lines, if not empty
+
+Also increments self._error_lines if err_lines not empty
+
+Args:
+err_lines: List of strings, each an error or warning line,
+possibly including a list of boards with that error/warning
+colour: Colour to use for output
+"""
+if err_lines:
+Print('\n'.join(err_lines), colour=colour)
+self._error_lines += 1
+
 
 ok_boards = []  # List of boards fixed since last commit
 warn_boards = []# List of boards with warnings since last commit
@@ -1239,7 +1253,7 @@ class Builder:
 else:
 new_boards.append(target)
 
-# Get a list of errors that have appeared, and disappeared
+# Get a list of errors and warnings that have appeared, and disappeared
 better_err, worse_err = _CalcErrorDelta(self._base_err_lines,
 self._base_err_line_boards, err_lines, err_line_boards, '')
 better_warn, worse_warn = _CalcErrorDelta(self._base_warn_lines,
@@ -1262,18 +1276,10 @@ class Builder:
 for arch, target_list in arch_list.items():
 Print('%10s: %s' % (arch, target_list))
 self._error_lines += 1
-if better_err:
-Print('\n'.join(better_err), colour=self.col.GREEN)
-self._error_lines += 1
-if worse_err:
-Print('\n'.join(worse_err), colour=self.col.RED)
-self._error_lines += 1
-if better_warn:
-Print('\n'.join(better_warn), colour=self.col.CYAN)
-self._error_lines += 1
-if worse_warn:
-Print('\n'.join(worse_warn), colour=self.col.MAGENTA)
-self._error_lines += 1
+_OutputErrLines(better_err, colour=self.col.GREEN)
+_OutputErrLines(worse_err, colour=self.col.RED)
+_OutputErrLines(better_warn, colour=self.col.CYAN)
+_OutputErrLines(worse_warn, colour=self.col.MAGENTA)
 
 if show_sizes:
 self.PrintSizeSummary(board_selected, board_dict, show_detail,
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 05/22] buildman: Split out testOutput() into separate functions

2020-04-05 Thread Simon Glass
We want to add a few more tests similar to testOutput(). Split its logic
into a function which runs buildman to get the output and another which
checks the output. This will make it easier to reuse the code.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index b2f7e1edf76..c9c7a05ca61 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -178,10 +178,17 @@ class TestBuild(unittest.TestCase):
 expect += col.Color(expected_colour, ' %s' % board)
 self.assertEqual(text, expect)
 
-def testOutput(self):
-"""Test basic builder operation and output
+def _SetupTest(self, echo_lines=False, **kwdisplay_args):
+"""Set up the test by running a build and summary
 
-This does a line-by-line verification of the summary output.
+Args:
+echo_lines: True to echo lines to the terminal to aid test
+development
+kwdisplay_args: Dict of arguemnts to pass to
+Builder.SetDisplayOptions()
+
+Returns:
+Iterator containing the output lines, each a PrintLine() object
 """
 build = builder.Builder(self.toolchains, self.base_dir, None, 1, 2,
 checkout=False, show_unknown=False)
@@ -201,11 +208,18 @@ class TestBuild(unittest.TestCase):
 # We should get two starting messages, then an update for every commit
 # built.
 self.assertEqual(count, len(commits) * len(boards) + 2)
-build.SetDisplayOptions(show_errors=True);
+build.SetDisplayOptions(**kwdisplay_args);
 build.ShowSummary(self.commits, board_selected)
-#terminal.EchoPrintTestLines()
-lines = iter(terminal.GetPrintTestLines())
+if echo_lines:
+terminal.EchoPrintTestLines()
+return iter(terminal.GetPrintTestLines())
+
+def _CheckOutput(self, lines):
+"""Check for expected output from the build summary
 
+Args:
+lines: Iterator containing the lines returned from the summary
+"""
 # Upstream commit: no errors
 self.assertEqual(next(lines).text, '01: %s' % commits[0][1])
 
@@ -320,6 +334,14 @@ class TestBuild(unittest.TestCase):
 '\n'.join(expect).replace('\n', '\nw+'))
 self.assertEqual(line.colour, col.MAGENTA)
 
+def testOutput(self):
+"""Test basic builder operation and output
+
+This does a line-by-line verification of the summary output.
+"""
+lines = self._SetupTest(show_errors=True)
+self._CheckOutput(lines)
+
 def _testGit(self):
 """Test basic builder operation by building a branch"""
 options = Options()
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 02/22] buildman: Add test coverage for error/warning colour

2020-04-05 Thread Simon Glass
Buildman should output the right colours for each error/warning line. Some
of these checks are missing. Add them.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 2aaedf44ac7..8e2b07fb438 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -235,6 +235,7 @@ class TestBuild(unittest.TestCase):
 # Expect a compiler error
 self.assertEqual(lines[10].text, '+%s' %
 errors[1].rstrip().replace('\n', '\n+'))
+self.assertEqual(lines[10].colour, col.RED)
 
 # Fourth commit: Compile errors are fixed, just have warning for board3
 self.assertEqual(lines[11].text, '04: %s' % commits[3][1])
@@ -269,9 +270,11 @@ class TestBuild(unittest.TestCase):
 expect = [expect[0]] + expect[2:]
 self.assertEqual(lines[19].text, '+%s' %
 '\n'.join(expect).replace('\n', '\n+'))
+self.assertEqual(lines[19].colour, col.RED)
 
 self.assertEqual(lines[20].text, 'w-%s' %
 errors[2].rstrip().replace('\n', '\nw-'))
+self.assertEqual(lines[20].colour, col.CYAN)
 
 # Sixth commit
 self.assertEqual(lines[21].text, '06: %s' % commits[5][1])
@@ -283,9 +286,11 @@ class TestBuild(unittest.TestCase):
 expect = [expect[0]] + expect[2:]
 self.assertEqual(lines[23].text, '-%s' %
 '\n'.join(expect).replace('\n', '\n-'))
+self.assertEqual(lines[23].colour, col.GREEN)
 
 self.assertEqual(lines[24].text, 'w-%s' %
 errors[0].rstrip().replace('\n', '\nw-'))
+self.assertEqual(lines[24].colour, col.CYAN)
 
 # Seventh commit
 self.assertEqual(lines[25].text, '07: %s' % commits[6][1])
@@ -296,11 +301,13 @@ class TestBuild(unittest.TestCase):
 expect = expect_str[3:8] + [expect_str[-1]]
 self.assertEqual(lines[27].text, '+%s' %
 '\n'.join(expect).replace('\n', '\n+'))
+self.assertEqual(lines[27].colour, col.RED)
 
 # Now the warnings lines
 expect = [expect_str[0]] + expect_str[10:12] + [expect_str[9]]
 self.assertEqual(lines[28].text, 'w+%s' %
 '\n'.join(expect).replace('\n', '\nw+'))
+self.assertEqual(lines[28].colour, col.MAGENTA)
 
 self.assertEqual(len(lines), 29)
 shutil.rmtree(base_dir)
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 04/22] buildman: Create temp directory in test setup

2020-04-05 Thread Simon Glass
Rather than having a few tests handle this themselves, create the
temporary directory in the setUp() method and remove it in tearDown().
This will make it easier to add more tests.

Only testOutput and testGit() actually need it, but it doesn't add to the
test time noticeably to do this for all tests in this file.

Signed-off-by: Simon Glass 
---

 tools/buildman/test.py | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 84dd608127e..b2f7e1edf76 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -143,9 +143,14 @@ class TestBuild(unittest.TestCase):
 terminal.SetPrintTestMode()
 self._col = terminal.Color()
 
-def Make(self, commit, brd, stage, *args, **kwargs):
-global base_dir
+self.base_dir = tempfile.mkdtemp()
+if not os.path.isdir(self.base_dir):
+os.mkdir(self.base_dir)
+
+def tearDown(self):
+shutil.rmtree(self.base_dir)
 
+def Make(self, commit, brd, stage, *args, **kwargs):
 result = command.CommandResult()
 boardnum = int(brd.target[-1])
 result.return_code = 0
@@ -156,7 +161,7 @@ class TestBuild(unittest.TestCase):
 boardnum == 4 and commit.sequence == 6):
 result.return_code = commit.return_code
 result.stderr = (''.join(commit.error_list)
-% {'basedir' : base_dir + '/.bm-work/00/'})
+% {'basedir' : self.base_dir + '/.bm-work/00/'})
 
 result.combined = result.stdout + result.stderr
 return result
@@ -178,12 +183,7 @@ class TestBuild(unittest.TestCase):
 
 This does a line-by-line verification of the summary output.
 """
-global base_dir
-
-base_dir = tempfile.mkdtemp()
-if not os.path.isdir(base_dir):
-os.mkdir(base_dir)
-build = builder.Builder(self.toolchains, base_dir, None, 1, 2,
+build = builder.Builder(self.toolchains, self.base_dir, None, 1, 2,
 checkout=False, show_unknown=False)
 build.do_make = self.Make
 board_selected = self.boards.GetSelectedDict()
@@ -320,19 +320,14 @@ class TestBuild(unittest.TestCase):
 '\n'.join(expect).replace('\n', '\nw+'))
 self.assertEqual(line.colour, col.MAGENTA)
 
-shutil.rmtree(base_dir)
-
 def _testGit(self):
 """Test basic builder operation by building a branch"""
-base_dir = tempfile.mkdtemp()
-if not os.path.isdir(base_dir):
-os.mkdir(base_dir)
 options = Options()
 options.git = os.getcwd()
 options.summary = False
 options.jobs = None
 options.dry_run = False
-#options.git = os.path.join(base_dir, 'repo')
+#options.git = os.path.join(self.base_dir, 'repo')
 options.branch = 'test-buildman'
 options.force_build = False
 options.list_tool_chains = False
@@ -345,7 +340,6 @@ class TestBuild(unittest.TestCase):
 options.keep_outputs = False
 args = ['tegra20']
 control.DoBuildman(options, args)
-shutil.rmtree(base_dir)
 
 def testBoardSingle(self):
 """Test single board selection"""
-- 
2.26.0.292.g33ef6b2f38-goog



[PATCH 00/22] buildman: Improve summary output

2020-04-05 Thread Simon Glass
This series makes the output produced by buildman a little more useful and
easier to read:

- when using -l to see which errors relate to which board, it shows the
   boards in a different colour so they can be distinguished from the
   errors
- uses yellow consistently for warning lines
- shows the number of remaining builds
- shows a summary when the build completes, including the time taken
- adds a few messages to indicate what is happening while starting up

It also refactors a few tests a little to make them easier to follow,
makes -I the default and improves the documentation a little.


Simon Glass (22):
  buildman: Refactor error-line output int a function
  buildman: Add test coverage for error/warning colour
  buildman: Use an iterator to check test output
  buildman: Create temp directory in test setup
  buildman: Split out testOutput() into separate functions
  buildman: Add a test helper for creating a line prefix
  buildman: Test the output with --list-error-boards
  buildman: Use yellow consistently for warning lines
  buildman: Use an object to hold error lines
  buildman: Show the list of boards in magenta
  patman: Update flushing Print() for Python 3
  patman: Support erasing a previously unfinished text line
  buildman: Drop the line-clearing code in Builder
  buildman: Show a message when fetching a repo
  buildman: Drop unused output code
  buildman: Show the number of builds remaining
  buildman: Show a summary of the build result
  buildman: Update the 'theory of operation' a little
  buildman: Add the abbreviation for --boards
  buildman: Update workflow documentation with more detail
  buildman: Make -I the default
  buildman: Add an option to ignore device-tree warnings

 tools/buildman/README   | 142 
 tools/buildman/builder.py   | 206 ++---
 tools/buildman/builderthread.py |   6 +-
 tools/buildman/cmdline.py   |   8 +-
 tools/buildman/control.py   |  17 ++-
 tools/buildman/func_test.py |  28 ++--
 tools/buildman/test.py  | 224 ++--
 tools/patman/patman.py  |   2 +-
 tools/patman/terminal.py|  52 +++-
 9 files changed, 461 insertions(+), 224 deletions(-)

-- 
2.26.0.292.g33ef6b2f38-goog



Re: [PATCH v3 4/5] rockchip: Enable HDMI output on rk3399 board w/ HDMI

2020-04-05 Thread Manivannan Sadhasivam
On Thu, Apr 02, 2020 at 05:11:24PM +0530, Jagan Teki wrote:
> Enable config options and console setting to respective
> rk3399 board for HDMI output.
> 
> Boards supported and tested on this patch are:
> - NanoPc T4
> - NanoPi M4
> - NanoPi Neo4
> - ROC-RK3399-PC
> - Rock960
> 
> Cc: Manivannan Sadhasivam 
> Signed-off-by: Jagan Teki 

For Rock960,

Acked-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes for v3:
> - add rock960 hdmi out support
> 
>  configs/nanopc-t4-rk3399_defconfig   | 7 +++
>  configs/nanopi-m4-rk3399_defconfig   | 7 +++
>  configs/nanopi-neo4-rk3399_defconfig | 7 +++
>  configs/roc-pc-rk3399_defconfig  | 6 ++
>  configs/rock960-rk3399_defconfig | 7 +++
>  include/configs/evb_rk3399.h | 5 +
>  include/configs/rock960_rk3399.h | 5 +
>  7 files changed, 44 insertions(+)
> 
> diff --git a/configs/nanopc-t4-rk3399_defconfig 
> b/configs/nanopc-t4-rk3399_defconfig
> index 9ea9b11574..607a00dbf7 100644
> --- a/configs/nanopc-t4-rk3399_defconfig
> +++ b/configs/nanopc-t4-rk3399_defconfig
> @@ -52,5 +52,12 @@ CONFIG_USB_ETHER_ASIX88179=y
>  CONFIG_USB_ETHER_MCS7830=y
>  CONFIG_USB_ETHER_RTL8152=y
>  CONFIG_USB_ETHER_SMSC95XX=y
> +CONFIG_USB_KEYBOARD=y
>  CONFIG_SPL_TINY_MEMSET=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_VIDEO_BPP16=y
> +CONFIG_VIDEO_BPP32=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> diff --git a/configs/nanopi-m4-rk3399_defconfig 
> b/configs/nanopi-m4-rk3399_defconfig
> index ad0e808bf6..3fcb7ac2d7 100644
> --- a/configs/nanopi-m4-rk3399_defconfig
> +++ b/configs/nanopi-m4-rk3399_defconfig
> @@ -52,5 +52,12 @@ CONFIG_USB_ETHER_ASIX88179=y
>  CONFIG_USB_ETHER_MCS7830=y
>  CONFIG_USB_ETHER_RTL8152=y
>  CONFIG_USB_ETHER_SMSC95XX=y
> +CONFIG_USB_KEYBOARD=y
>  CONFIG_SPL_TINY_MEMSET=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_VIDEO_BPP16=y
> +CONFIG_VIDEO_BPP32=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> diff --git a/configs/nanopi-neo4-rk3399_defconfig 
> b/configs/nanopi-neo4-rk3399_defconfig
> index d038a8cab9..b9ea535e43 100644
> --- a/configs/nanopi-neo4-rk3399_defconfig
> +++ b/configs/nanopi-neo4-rk3399_defconfig
> @@ -52,5 +52,12 @@ CONFIG_USB_ETHER_ASIX88179=y
>  CONFIG_USB_ETHER_MCS7830=y
>  CONFIG_USB_ETHER_RTL8152=y
>  CONFIG_USB_ETHER_SMSC95XX=y
> +CONFIG_USB_KEYBOARD=y
>  CONFIG_SPL_TINY_MEMSET=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_VIDEO_BPP16=y
> +CONFIG_VIDEO_BPP32=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
> index d540a17aeb..be76524cef 100644
> --- a/configs/roc-pc-rk3399_defconfig
> +++ b/configs/roc-pc-rk3399_defconfig
> @@ -59,3 +59,9 @@ CONFIG_USB_ETHER_SMSC95XX=y
>  CONFIG_USB_KEYBOARD=y
>  CONFIG_SPL_TINY_MEMSET=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_VIDEO_BPP16=y
> +CONFIG_VIDEO_BPP32=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> diff --git a/configs/rock960-rk3399_defconfig 
> b/configs/rock960-rk3399_defconfig
> index ba4226e173..c4e954731a 100644
> --- a/configs/rock960-rk3399_defconfig
> +++ b/configs/rock960-rk3399_defconfig
> @@ -58,5 +58,12 @@ CONFIG_USB_ETHER_ASIX88179=y
>  CONFIG_USB_ETHER_MCS7830=y
>  CONFIG_USB_ETHER_RTL8152=y
>  CONFIG_USB_ETHER_SMSC95XX=y
> +CONFIG_USB_KEYBOARD=y
>  CONFIG_SPL_TINY_MEMSET=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_VIDEO_BPP16=y
> +CONFIG_VIDEO_BPP32=y
> +CONFIG_DISPLAY=y
> +CONFIG_VIDEO_ROCKCHIP=y
> +CONFIG_DISPLAY_ROCKCHIP_HDMI=y
> diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h
> index c0b0358893..2d3db22877 100644
> --- a/include/configs/evb_rk3399.h
> +++ b/include/configs/evb_rk3399.h
> @@ -6,6 +6,11 @@
>  #ifndef __EVB_RK3399_H
>  #define __EVB_RK3399_H
>  
> +#define ROCKCHIP_DEVICE_SETTINGS \
> + "stdin=serial,usbkbd\0" \
> + "stdout=serial,vidconsole\0" \
> + "stderr=serial,vidconsole\0"
> +
>  #include 
>  
>  #if defined(CONFIG_ENV_IS_IN_MMC)
> diff --git a/include/configs/rock960_rk3399.h 
> b/include/configs/rock960_rk3399.h
> index 746d24cbff..304ad2b7aa 100644
> --- a/include/configs/rock960_rk3399.h
> +++ b/include/configs/rock960_rk3399.h
> @@ -6,6 +6,11 @@
>  #ifndef __ROCK960_RK3399_H
>  #define __ROCK960_RK3399_H
>  
> +#define ROCKCHIP_DEVICE_SETTINGS \
> + "stdin=serial,usbkbd\0" \
> + "stdout=serial,vidconsole\0" \
> + "stderr=serial,vidconsole\0"
> +
>  #include 
>  
>  #define CONFIG_SYS_MMC_ENV_DEV   1
> -- 
> 2.17.1
> 


Re: [PATCH] ARM: dts: stm32: Temporarily drop cd-gpios from AV96 DT

2020-04-05 Thread Manivannan Sadhasivam
On Thu, Apr 02, 2020 at 06:53:41PM +0200, Marek Vasut wrote:
> The card-detect GPIO and any other GPIO access currently doesn't work in
> U-Boot SPL on any STM32 platform and crashes the SPL. To work around this
> problem on AV96 right before release, remove the cd-gpios from DT. This
> patch must be reverted right after release, once the proper fix for the
> GPIO driver, "gpio: stm32: support gpio ops in SPL", is applied.
> 
> Signed-off-by: Marek Vasut 

Acked-by: Manivannan Sadhasivam 

Thanks,
Mani

> Cc: Manivannan Sadhasivam 
> Cc: Patrick Delaunay 
> Cc: Patrice Chotard 
> Cc: Tom Rini 
> ---
> NOTE: I think it's OK if Tom picks this one directly to reduce load on
>   the ST people, since this is isolated to a single board.
> ---
>  arch/arm/dts/stm32mp157a-avenger96.dts | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm/dts/stm32mp157a-avenger96.dts 
> b/arch/arm/dts/stm32mp157a-avenger96.dts
> index 1f32395e71..b23fa6dee0 100644
> --- a/arch/arm/dts/stm32mp157a-avenger96.dts
> +++ b/arch/arm/dts/stm32mp157a-avenger96.dts
> @@ -353,7 +353,6 @@
>   pinctrl-0 = <_b4_pins_a _dir_pins_b>;
>   pinctrl-1 = <_b4_od_pins_a _dir_pins_b>;
>   pinctrl-2 = <_b4_sleep_pins_a _dir_sleep_pins_b>;
> - cd-gpios = < 8 GPIO_ACTIVE_LOW>;
>   disable-wp;
>   st,sig-dir;
>   st,neg-edge;
> -- 
> 2.25.1
> 


Re: Gitlab error: execution took longer than 1h

2020-04-05 Thread Tom Rini
On Sun, Apr 05, 2020 at 07:02:44PM +0800, Bin Meng wrote:
> Hi Heinrich,
> 
> On Sun, Apr 5, 2020 at 6:56 PM Heinrich Schuchardt  wrote:
> >
> > Hello Tom,
> >
> > I saw a GitLab error: build all PowerPC platforms: ERROR: Job failed:
> > execution took longer than 1h0m0s seconds. Should this job be split?
> >
> > This output was also strange:
> > No space left on device: '/tmp/current/T1023RDB'
> > No space left on device: '/tmp/current/MPC8349EMDS_SDRAM'
> > ...
> >
> > https://gitlab.denx.de/u-boot/custodians/u-boot-efi/-/jobs/71991
> >
> 
> Yes, I've also seen both 2 errors:
> 
> execution took longer than 1 hour, and no space left on device
> 
> https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/71824

Yes, DENX added a new builder recently to the pool but something
happened it seems.  Harald?

> So far the most stable CI service to me is Azure.

Yes, I've had very few unexpected failed builds in Azure.

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] [PATCH v2 5/5] sifive: fu540: Enable spi-nor flash support

2020-04-05 Thread Bin Meng
Hi Jagan,

On Sun, Apr 5, 2020 at 2:44 AM Jagan Teki  wrote:
>
> Hi Bin,
>
> On Mon, Nov 18, 2019 at 8:19 AM Bin Meng  wrote:
> >
> > Hi Segar Kadam,
> >
> > On Mon, Nov 18, 2019 at 4:59 AM Sagar Kadam  wrote:
> > >
> > >
> > > Hello Jagan/Bin,
> > >
> > > > -Original Message-
> > > > From: U-Boot  On Behalf Of Bin Meng
> > > > Sent: Monday, November 11, 2019 8:02 PM
> > > > To: Jagan Teki 
> > > > Cc: Palmer Dabbelt ( Sifive) ; U-Boot Mailing List 
> > > >  > > > b...@lists.denx.de>; linux-amarula 
> > > > Subject: Re: [U-Boot] [PATCH v2 5/5] sifive: fu540: Enable spi-nor flash
> > > > support
> > > >
> > > > Hi Jagan,
> > > >
> > > > On Sat, Nov 9, 2019 at 7:57 PM Jagan Teki 
> > > > wrote:
> > > > >
> > > > > Hi Bin,
> > > > >
> > > > > On Tue, Oct 29, 2019 at 3:50 PM Bin Meng  wrote:
> > > > > >
> > > > > > Hi Jagan,
> > > > > >
> > > > > > On Tue, Oct 29, 2019 at 5:38 PM Bin Meng 
> > > > wrote:
> > > > > > >
> > > > > > > Hi Jagan,
> > > > > > >
> > > > > > > On Wed, Oct 16, 2019 at 10:58 PM Jagan Teki
> > > >  wrote:
> > > > > > > >
> > > > > > > > HiFive Unleashed A00 support is25wp256 spi-nor flash,
> > > > > > > > So enable the same and add test result log for future
> > > > > > > > reference.
> > > > > > > >
> > > > > > > > Tested on SiFive FU540 board.
> > > > > > > >
> > > > > > > > Signed-off-by: Jagan Teki 
> > > > > > > > Reviewed-by: Bin Meng 
> > > > > > > > Tested-by: Bin Meng 
> > > > > > > > ---
> > > > > > > >  .../dts/hifive-unleashed-a00-u-boot.dtsi  |  1 +
> > > > > > > >  board/sifive/fu540/Kconfig|  3 +++
> > > > > > > >  doc/board/sifive/fu540.rst| 19 
> > > > > > > > +++
> > > > > > > >  3 files changed, 23 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > > > > > index 25ec8265a5..d7a64134db 100644
> > > > > > > > --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > > > > > +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > > > > > @@ -5,6 +5,7 @@
> > > > > > > >
> > > > > > > >  / {
> > > > > > > > aliases {
> > > > > > > > +   spi0 = 
> > > > > > > > spi2 = 
> > > > > > > > };
> > > > > > > >  };
> > > > > > > > diff --git a/board/sifive/fu540/Kconfig 
> > > > > > > > b/board/sifive/fu540/Kconfig
> > > > > > > > index 5d65080429..c5a1bca03c 100644
> > > > > > > > --- a/board/sifive/fu540/Kconfig
> > > > > > > > +++ b/board/sifive/fu540/Kconfig
> > > > > > > > @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
> > > > > > > > imply CMD_FS_GENERIC
> > > > > > > > imply CMD_NET
> > > > > > > > imply CMD_PING
> > > > > > > > +   imply CMD_SF
> > > > > > > > imply CLK_SIFIVE
> > > > > > > > imply CLK_SIFIVE_FU540_PRCI
> > > > > > > > imply DOS_PARTITION
> > > > > > > > @@ -40,6 +41,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy
> > > > > > > > imply SIFIVE_SERIAL
> > > > > > > > imply SPI
> > > > > > > > imply SPI_SIFIVE
> > > > > > > > +   imply SPI_FLASH
> > > > > > > > +   imply SPI_FLASH_ISSI
> > > > > > > > imply MMC
> > > > > > > > imply MMC_SPI
> > > > > > > > imply MMC_BROKEN_CD
> > > > > > > > diff --git a/doc/board/sifive/fu540.rst 
> > > > > > > > b/doc/board/sifive/fu540.rst
> > > > > > > > index 91b94ee06f..2e70cad02e 100644
> > > > > > > > --- a/doc/board/sifive/fu540.rst
> > > > > > > > +++ b/doc/board/sifive/fu540.rst
> > > > > > > > @@ -366,3 +366,22 @@ load uImage.
> > > > > > > >
> > > > > > > > Please press Enter to activate this console.
> > > > > > > > / #
> > > > > > > > +
> > > > > > > > +Sample spi nor flash test
> > > > > > > > +-
> > > > > > > > +
> > > > > > > > +.. code-block:: none
> > > > > > > > +
> > > > > > > > +   => sf probe 0:2
> > > > > > >
> > > > > > > The cs number can't be 2. It should be zero.
> > > > > >
> > > > > > With this patch series, we got crazy duplicated flash devices 
> > > > > > created,
> > > > > > see below:
> > > > > >
> > > > > > => sf probe
> > > > > > unrecognized JEDEC id bytes: ff, ff, ff
> > > > > > Failed to initialize SPI flash at 0:0 (error -2)
> > > > > > => sf probe 0:2
> > > > > > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, 
> > > > > > total 32
> > > > MiB
> > > > > > => sf probe 0:4
> > > > > > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, 
> > > > > > total 32
> > > > MiB
> > > > > > => sf probe 0:6
> > > > > > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, 
> > > > > > total 32
> > > > MiB
> > > > > > => dm tree
> > > > > >  Class Index  Probed  DriverName
> > > > > > ---
> > > > > >  root  0  [ + ]   root_driver   root_driver
> > > > > >  simple_bus0  [ + ]   

Re: Gitlab error: execution took longer than 1h

2020-04-05 Thread Bin Meng
Hi Heinrich,

On Sun, Apr 5, 2020 at 6:56 PM Heinrich Schuchardt  wrote:
>
> Hello Tom,
>
> I saw a GitLab error: build all PowerPC platforms: ERROR: Job failed:
> execution took longer than 1h0m0s seconds. Should this job be split?
>
> This output was also strange:
> No space left on device: '/tmp/current/T1023RDB'
> No space left on device: '/tmp/current/MPC8349EMDS_SDRAM'
> ...
>
> https://gitlab.denx.de/u-boot/custodians/u-boot-efi/-/jobs/71991
>

Yes, I've also seen both 2 errors:

execution took longer than 1 hour, and no space left on device

https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/71824

So far the most stable CI service to me is Azure.

Regards,
Bin


Gitlab error: execution took longer than 1h

2020-04-05 Thread Heinrich Schuchardt
Hello Tom,

I saw a GitLab error: build all PowerPC platforms: ERROR: Job failed:
execution took longer than 1h0m0s seconds. Should this job be split?

This output was also strange:
No space left on device: '/tmp/current/T1023RDB'
No space left on device: '/tmp/current/MPC8349EMDS_SDRAM'
...

https://gitlab.denx.de/u-boot/custodians/u-boot-efi/-/jobs/71991

Best regards

Heinrich


Re: [PATCH v9 03/12] serial: actions: add compatible string

2020-04-05 Thread Manivannan Sadhasivam
On Sun, Apr 05, 2020 at 11:08:21AM +0100, André Przywara wrote:
> On 05/04/2020 07:59, Manivannan Sadhasivam wrote:
> > On Wed, Apr 01, 2020 at 12:49:26PM +0530, Amit Singh Tomar wrote:
> >> This patch adds "actions,owl-uart" string to the owl uart driver. It
> >> is also defined in Linux kernel.
> >>
> >> Reviewed-by: Andre Przywara 
> >> Signed-off-by: Amit Singh Tomar 
> >> ---
> >> Changes since v8:
> >> * No changes.
> >> Changes since v7:
> >> * No changes.
> >> Changes since v6:
> >> * Added Reviewd-by tag.
> >> Changes since v5:
> >> * Moved it to from 06/11 to 03/11.
> >> * Used appropriate commit message.
> >> * Removed the reviwed-by tag.
> >> Changes since v4:
> >> * Moved it to from 09/11 to 06/11.
> >> Changes since v3:
> >> * Used only owl-uart for compatible string.
> >> Changes since v2:
> >> * No changes.
> >> Changes since v1:
> >> * No changes.
> >> ---
> >>  drivers/serial/serial_owl.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
> >> index 7ead73e..539acdc 100644
> >> --- a/drivers/serial/serial_owl.c
> >> +++ b/drivers/serial/serial_owl.c
> >> @@ -121,6 +121,7 @@ static const struct dm_serial_ops owl_serial_ops = {
> >>  
> >>  static const struct udevice_id owl_serial_ids[] = {
> >>{ .compatible = "actions,s900-serial" },
> > 
> > This should've been removed here itself as opposed to in devicetree sync 
> > patch.
> 
> But this would break S900, because the Bubblegum DT still uses that string.
> If you sync the DT before, you have a similar problem, so we have to
> change the DT and the driver string in *one* patch, which is what patch
> 04/12 does.
> 

Hmm... chicken & egg problem :) Let's keep it as it is.

Thanks,
Mani

> Cheers,
> Andre
> 
> > But I don't warrant a new series for this change.
> > 
> > Reviewed-by: Manivannan Sadhasivam 
> > 
> > Thanks,
> > Mani
> > 
> >> +  { .compatible = "actions,owl-uart" },
> >>{ }
> >>  };
> >>  
> >> -- 
> >> 2.7.4
> >>
> 


[PATCH] arm: meson: imply DM_RNG

2020-04-05 Thread Heinrich Schuchardt
All ARCH_MESON boards have a hardware random number generator. So we should
enable building the RNG driver.

Signed-off-by: Heinrich Schuchardt 
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bbb1e2738b..eee4538c7e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -762,6 +762,7 @@ config ARCH_OMAP2PLUS
 config ARCH_MESON
bool "Amlogic Meson"
imply DISTRO_DEFAULTS
+   imply DM_RNG
help
  Support for the Meson SoC family developed by Amlogic Inc.,
  targeted at media players and tablet computers. We currently
--
2.25.1



Re: [PATCH v9 03/12] serial: actions: add compatible string

2020-04-05 Thread André Przywara
On 05/04/2020 07:59, Manivannan Sadhasivam wrote:
> On Wed, Apr 01, 2020 at 12:49:26PM +0530, Amit Singh Tomar wrote:
>> This patch adds "actions,owl-uart" string to the owl uart driver. It
>> is also defined in Linux kernel.
>>
>> Reviewed-by: Andre Przywara 
>> Signed-off-by: Amit Singh Tomar 
>> ---
>> Changes since v8:
>> * No changes.
>> Changes since v7:
>> * No changes.
>> Changes since v6:
>> * Added Reviewd-by tag.
>> Changes since v5:
>> * Moved it to from 06/11 to 03/11.
>> * Used appropriate commit message.
>> * Removed the reviwed-by tag.
>> Changes since v4:
>> * Moved it to from 09/11 to 06/11.
>> Changes since v3:
>> * Used only owl-uart for compatible string.
>> Changes since v2:
>> * No changes.
>> Changes since v1:
>> * No changes.
>> ---
>>  drivers/serial/serial_owl.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
>> index 7ead73e..539acdc 100644
>> --- a/drivers/serial/serial_owl.c
>> +++ b/drivers/serial/serial_owl.c
>> @@ -121,6 +121,7 @@ static const struct dm_serial_ops owl_serial_ops = {
>>  
>>  static const struct udevice_id owl_serial_ids[] = {
>>  { .compatible = "actions,s900-serial" },
> 
> This should've been removed here itself as opposed to in devicetree sync 
> patch.

But this would break S900, because the Bubblegum DT still uses that string.
If you sync the DT before, you have a similar problem, so we have to
change the DT and the driver string in *one* patch, which is what patch
04/12 does.

Cheers,
Andre

> But I don't warrant a new series for this change.
> 
> Reviewed-by: Manivannan Sadhasivam 
> 
> Thanks,
> Mani
> 
>> +{ .compatible = "actions,owl-uart" },
>>  { }
>>  };
>>  
>> -- 
>> 2.7.4
>>



Re: [PATCH] efi_loader: enable RNG if DM_RNG is enabled

2020-04-05 Thread Heinrich Schuchardt
On 4/1/20 12:15 PM, Peter Robinson wrote:
> Enable EFI_RNG_PROTOCOL by default if DM_RNG is set.
>
> Signed-off-by: Peter Robinson 
> ---
>
> I think it makes sense to enable EFI_RNG_PROTOCOL by default if a config
> has enabled both DM_RNG and UEFI.
>
>  lib/efi_loader/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 9890144d41..b9a770281e 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -125,6 +125,7 @@ config EFI_GRUB_ARM32_WORKAROUND
>
>  config EFI_RNG_PROTOCOL
>   bool "EFI_RNG_PROTOCOL support"
> + default y if DM_RNG

Thank you for your patch.

If you have 'depends on DM_RNG', there is not need for 'if DM RNG'.

You can use scripts/get_maintainer.pl to determine all addressees for a
patch (Alex was missing).

Otherwise

Reviewed-by: Heinrich Schuchardt 

>   depends on DM_RNG
>   help
> Provide a EFI_RNG_PROTOCOL implementation using the hardware random
>



[PATCH v2 0/2] efi_loader: identify EFI system partition

2020-04-05 Thread Heinrich Schuchardt
For the implementation of capsule updates we need to know where the EFI
system partition is located.

With the patches the first available EFI system partition is determined
both for MBR and GPT partition tables.

v2:
used BIT() macro to define bit mask

Heinrich Schuchardt (2):
  part: detect EFI system partition
  efi_loader: identify EFI system partition

 disk/part_dos.c   | 10 --
 disk/part_efi.c   | 12 
 include/efi_loader.h  |  7 +++
 include/part.h| 11 ++-
 lib/efi_loader/efi_disk.c | 20 
 5 files changed, 53 insertions(+), 7 deletions(-)

--
2.25.1



[PATCH v2 1/2] part: detect EFI system partition

2020-04-05 Thread Heinrich Schuchardt
Up to now for MBR and GPT partitions the info field 'bootable' was set to 1
if either the partition was an EFI system partition or the bootable flag
was set.

Turn info field 'bootable' into a bit mask with separate bits for bootable
and EFI system partition.

This will allow us to identify the EFI system partition in the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt 
---
v2:
used BIT() macro to define bit mask
---
 disk/part_dos.c | 10 --
 disk/part_efi.c | 12 
 include/part.h  | 11 ++-
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index 83ff40d310..0ec7f1628e 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -45,9 +45,15 @@ static inline int is_extended(int part_type)
part_type == 0x85);
 }

-static inline int is_bootable(dos_partition_t *p)
+static int is_bootable(dos_partition_t *p)
 {
-   return (p->sys_ind == 0xef) || (p->boot_ind == 0x80);
+   int ret = 0;
+
+   if (p->sys_ind == 0xef)
+   ret |= PART_EFI_SYSTEM_PARTITION;
+   if (p->boot_ind == 0x80)
+   ret |= PART_BOOTABLE;
+   return ret;
 }

 static void print_one_part(dos_partition_t *p, lbaint_t ext_part_sector,
diff --git a/disk/part_efi.c b/disk/part_efi.c
index b2e157d9c1..19f1f43f4e 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -71,11 +71,15 @@ static char *print_efiname(gpt_entry *pte)

 static const efi_guid_t system_guid = PARTITION_SYSTEM_GUID;

-static inline int is_bootable(gpt_entry *p)
+static int is_bootable(gpt_entry *p)
 {
-   return p->attributes.fields.legacy_bios_bootable ||
-   !memcmp(&(p->partition_type_guid), _guid,
-   sizeof(efi_guid_t));
+   int ret = 0;
+
+   if (!memcmp(>partition_type_guid, _guid, sizeof(efi_guid_t)))
+   ret |=  PART_EFI_SYSTEM_PARTITION;
+   if (p->attributes.fields.legacy_bios_bootable)
+   ret |=  PART_BOOTABLE;
+   return ret;
 }

 static int validate_gpt_header(gpt_header *gpt_h, lbaint_t lba,
diff --git a/include/part.h b/include/part.h
index 0b5cf3d5e8..f3442ef85d 100644
--- a/include/part.h
+++ b/include/part.h
@@ -51,13 +51,22 @@ struct block_drvr {
 #define PART_TYPE_LEN 32
 #define MAX_SEARCH_PARTITIONS 64

+#define PART_BOOTABLE  BIT(0)
+#define PART_EFI_SYSTEM_PARTITION  BIT(1)
+
 typedef struct disk_partition {
lbaint_tstart;  /* # of first block in partition*/
lbaint_tsize;   /* number of blocks in partition*/
ulong   blksz;  /* block size in bytes  */
uchar   name[PART_NAME_LEN];/* partition name   
*/
uchar   type[PART_TYPE_LEN];/* string type description  
*/
-   int bootable;   /* Active/Bootable flag is set  */
+   /*
+* The bootable is a bitmask with the following fields:
+*
+* PART_BOOTABLEthe MBR bootable flag is set
+* PART_EFI_SYSTEM_PARTITIONthe partition is an EFI system partition
+*/
+   int bootable;
 #if CONFIG_IS_ENABLED(PARTITION_UUIDS)
charuuid[UUID_STR_LEN + 1]; /* filesystem UUID as string, if exists 
*/
 #endif
--
2.25.1



[PATCH v2 2/2] efi_loader: identify EFI system partition

2020-04-05 Thread Heinrich Schuchardt
For capsule updates we need to identify the EFI system partition.

Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 include/efi_loader.h  |  7 +++
 lib/efi_loader/efi_disk.c | 20 
 2 files changed, 27 insertions(+)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 3f2792892f..4a45033476 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -45,6 +45,13 @@ static inline void *guidcpy(void *dst, const void *src)
 /* Root node */
 extern efi_handle_t efi_root;

+/* EFI system partition */
+extern struct efi_system_partition {
+   enum if_type if_type;
+   int devnum;
+   u8 part;
+} efi_system_partition;
+
 int __efi_entry_check(void);
 int __efi_exit_check(void);
 const char *__efi_nesting(void);
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index fc0682bc48..2f752a5e99 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -13,6 +13,8 @@
 #include 
 #include 

+struct efi_system_partition efi_system_partition;
+
 const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;

 /**
@@ -372,6 +374,24 @@ static efi_status_t efi_disk_add_dev(
diskobj->ops.media = >media;
if (disk)
*disk = diskobj;
+
+   /* Store first EFI system partition */
+   if (part && !efi_system_partition.if_type) {
+   int r;
+   disk_partition_t info;
+
+   r = part_get_info(desc, part, );
+   if (r)
+   return EFI_DEVICE_ERROR;
+   if (info.bootable & PART_EFI_SYSTEM_PARTITION) {
+   efi_system_partition.if_type = desc->if_type;
+   efi_system_partition.devnum = desc->devnum;
+   efi_system_partition.part = part;
+   EFI_PRINT("EFI system partition: %s %d:%d\n",
+ blk_get_if_type_name(desc->if_type),
+ desc->devnum, part);
+   }
+   }
return EFI_SUCCESS;
 }

--
2.25.1



Re: [PATCH v9 00/12] Actions S700 SoC support

2020-04-05 Thread Manivannan Sadhasivam
Hi Amit,

On Wed, Apr 01, 2020 at 12:49:23PM +0530, Amit Singh Tomar wrote:
> This adds Cubieboard7[1] support based on Action Semi's S700 SoC[2], It's 
> Quad-core ARMv8 SoC
> with Cortex-A53 cores. Peripheral like UART seems to be compatible with S900 
> SoC(basic support
> for it is alreay present in u-boot).
> 
> This series(v9) fixes a Bug that breaks bubblegum96 board boot(reported by 
> Mani). It was
> due to fact that driver data read is not proper in the clock driver. There 
> are changes in
> patch 06/12 to fix it.
> 
> Previous series(v8) removes the SoC specific include instead just uses 
> owl-common. For this
> patch 01/12 and 09/12 changes a bit.
> 
> Series(v7) fixes a serious Bug that breaks S900, it was there since v5.Thanks 
> to Andre
> for pointing it out. 
> 
> Series(v6)[3] does following changes:
> 
> * [PATCH v5 06/11] becomes [PATCH v6 03/11]
> * [PATCH v5 03/11] becomes [PATCH v6 04/11]
> * Introduce a new patch to move defconfig options to Kconfig which is [PATCH 
> v6 10/12]
> 
> Series(v5)[4] just re-orders the patches so that U-BOOT(with 
> bubblegum96_defconfig) builds
> after every patch of the series(suggested by Andre).
> 
> S700 support is tested[5] on Cubieboard7 board and S900 support is just 
> compiled tested.
> 
> This patch series can be tested using below tree:
> https://github.com/Atomar25/u-boot/commits/s700_v9
> 

Many thanks for your patience and continuous effort! I have now reviewed the
series. Mostly is looks very good now. I just had few nit picks which you can
address in v10.

This series won't make it for v2020.04 but that's not critical IMO.

Andre, thanks to you too for helping with the reviews. Much appreciated!

Thanks,
Mani

> [1]: http://www.cubietech.com/product-detail/cubieboard7/
> [2]: http://www.actions-semi.com/en/productview.aspx?id=225
> [3]: 
> http://u-boot.10912.n7.nabble.com/PATCH-v6-00-12-Actions-S700-SoC-support-td403562.html#a403567
> [4]: 
> http://u-boot.10912.n7.nabble.com/PATCH-v5-00-11-Actions-S700-SoC-support-td402752.html#a402762
> [5]: https://paste.ubuntu.com/p/6HWYM3bwr6/
> 
> Amit Singh Tomar (12):
>   arm: actions: Add common framework for Actions Owl Semi SoCs
>   arm: actions: rename sysmap-s900 to sysmap-owl
>   serial: actions: add compatible string
>   arm: dts: sync dts for Action Semi S900
>   arm: dts: actions: s900: add u-boot specific dtsi file
>   clk: actions: Add common clock driver
>   arm: actions: add S700 SoC device tree
>   arm: dts: actions: s700: add u-boot specific dtsi file
>   arm: add support Actions Semi S700
>   actions: Move defconfig options to Kconfig
>   arm: add Cubieboard7 board support
>   doc: boards: add Cubieboard7 documentation
> 
>  MAINTAINERS|   2 +
>  arch/arm/Kconfig   |   5 +-
>  arch/arm/dts/Makefile  |   6 +-
>  arch/arm/dts/s700-cubieboard7.dts  |  92 +++
>  arch/arm/dts/s700-u-boot.dtsi  |  18 ++
>  arch/arm/dts/s700.dtsi | 248 +++
>  arch/arm/dts/s900-u-boot.dtsi  |  17 ++
>  arch/arm/dts/s900.dtsi | 322 
> +++--
>  arch/arm/include/asm/arch-owl/clk_s900.h   |  57 -
>  arch/arm/include/asm/arch-owl/regs_s700.h  |  56 +
>  arch/arm/mach-owl/Kconfig  |  50 ++--
>  arch/arm/mach-owl/Makefile |   3 +-
>  arch/arm/mach-owl/soc.c|  57 +
>  arch/arm/mach-owl/sysmap-owl.c |  32 +++
>  arch/arm/mach-owl/sysmap-s900.c|  32 ---
>  board/ucRobotics/bubblegum_96/Kconfig  |  15 --
>  board/ucRobotics/bubblegum_96/MAINTAINERS  |   6 -
>  board/ucRobotics/bubblegum_96/Makefile |   3 -
>  board/ucRobotics/bubblegum_96/bubblegum_96.c   |  57 -
>  configs/bubblegum_96_defconfig |  12 +-
>  configs/cubieboard7_defconfig  |   9 +
>  doc/board/actions/cubieboard7.rst  | 115 +
>  doc/board/actions/index.rst|  10 +
>  doc/board/index.rst|   1 +
>  drivers/clk/owl/Kconfig|   8 +-
>  drivers/clk/owl/Makefile   |   2 +-
>  drivers/clk/owl/clk_owl.c  | 153 
>  drivers/clk/owl/clk_owl.h  |  65 +
>  drivers/clk/owl/clk_s900.c | 137 ---
>  drivers/serial/serial_owl.c|   2 +-
>  include/configs/bubblegum_96.h |  40 ---
>  include/configs/owl-common.h   |  40 +++
>  include/configs/s700.h |  13 +
>  include/configs/s900.h |  16 ++
>  include/dt-bindings/clock/actions,s700-cmu.h   | 118 +
>  include/dt-bindings/clock/actions,s900-cmu.h   | 129 ++
>  include/dt-bindings/clock/s900_cmu.h   |  77 --
>  

Re: [PATCH v9 12/12] doc: boards: add Cubieboard7 documentation

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:35PM +0530, Amit Singh Tomar wrote:
> This adds build and flash steps for Actions S700
> based Cubieboard7 board.
> 
> Signed-off-by: Amit Singh Tomar 
> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * No changes.
> Changes since v5:
> * No changes.
> Changes since v4:
> * No changes.
> Changes since v3:
> * Convert plain text documentation to reStructuredText format.
> Changes since v2:
> * No Change.
> Changes since v1:
> * No Change.
> ---
>  doc/board/actions/cubieboard7.rst | 115 
> ++
>  doc/board/actions/index.rst   |  10 
>  doc/board/index.rst   |   1 +
>  3 files changed, 126 insertions(+)
>  create mode 100644 doc/board/actions/cubieboard7.rst
>  create mode 100644 doc/board/actions/index.rst
> 
> diff --git a/doc/board/actions/cubieboard7.rst 
> b/doc/board/actions/cubieboard7.rst
> new file mode 100644
> index 000..ce39e6b
> --- /dev/null
> +++ b/doc/board/actions/cubieboard7.rst
> @@ -0,0 +1,115 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +.. Copyright (C) 2020 Amit Singh Tomar 
> +
> +ACTIONS
> +

I don't think ACTIONS heading is needed here. Change it to Cubieboard7 instead.

> +
> +About this
> +--
> +
> +This document describes build and flash steps for Actions S700 SoC based 
> Cubieboard7
> +board.
> +
> +Cubieboard7 initial configuration
> +-
> +
> +Default Cubieboard7 comes with pre-installed Android where U-Boot is 
> configured with
> +a bootdelay of 0, entering a prompt by pressing keys does not seem to work.
> +
> +Though, one can enter ADFU mode and flash debian image(from host machine) 
> where
> +getting into u-boot prompt is easy.
> +
> +Enter ADFU Mode
> +
> +
> +Before write the firmware, let the development board entering the ADFU mode: 
> insert
> +one end of the USB cable to the PC, press and hold the ADFU button, and then 
> connect
> +the other end of the USB cable to the Mini USB port of the development 
> board, release
> +the ADFU button, after connecting it will enter the ADFU mode.
> +
> +Check whether entered ADFU Mode
> +
> +
> +The user needs to run the following command on the PC side to check if the 
> ADFU
> +device is detected. ID realted to "Actions Semiconductor Co., Ltd"  means 
> that
> +the PC side has been correctly detected ADFU device, the development board
> +also enter into the ADFU mode.
> +
> +.. code-block:: none
> +
> +   $ lsusb
> +   Bus 001 Device 005: ID 04f2:b2eb Chicony Electronics Co., Ltd
> +   Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 
> [ThinkPad]
> +   Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
> +   Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
> +   Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> +   Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> +   Bus 003 Device 013: ID 10d6:10d6 Actions Semiconductor Co., Ltd
> +   Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> +
> +Flashing debian image
> +-
> +
> +.. code-block:: none
> +
> +   $ sudo ./ActionsFWU.py --fw=debian-stretch-desktop-cb7-emmc-v2.0.fw
> +   ActionsFWU.py : 1.0.150828.0830
> +   libScript.so: 2.3.150825.0951
> +   libFileSystem.so: 2.3.150825.0952
> +   libProduction.so: 2.3.150915.1527
> +   =burn all partition
> +   FW_VER: 3.10.37.180608
> +   3% DOWNLOAD ADFUDEC ...
> +   5% DOWNLOAD BOOT PARA ...
> +   7% SWITCH ADFUDEC ...
> +   12% DOWNLOAD BL31 ...
> +   13% DOWNLOAD BL32 ...
> +   15% DOWNLOAD VMLINUX ...
> +   20% DOWNLOAD INITRD ...
> +   24% DOWNLOAD FDT ...
> +   27% DOWNLOAD ADFUS ...
> +   30% SWITCH ADFUS ...
> +   32% DOWNLOAD MBR ...
> +   35% DOWNLOAD PARTITIONS ...
> +   WRITE_MBRC_PARTITION
> +   35% write p0 size = 2048 : ok
> +   WRITE_BOOT_PARTITION
> +   35% write p1 size = 2048 : ok
> +   WRITE_MISC_PARTITION
> +   36% write p2 size = 98304 : ok
> +   WRITE_SYSTEM_PARTITION
> +   94% write p3 size = 4608000 : ok
> +   FORMAT_SWAP_PARTITION
> +   94% write p4 size = 20480 : ok
> +   95% TRANSFER OVER ...
> +   Firmware upgrade successfully!
> +
> +Debian image can be downloaded from here[1].
> +
> +Once debian image is flashed, one can get into u-boot prompt by pressing any 
> key and from
> +there run ums command(make sure, usb cable is connected between host and 
> target):
> +
> +.. code-block:: none
> +
> +   owl> ums 0 mmc 1
> +
> +Above command would mount debian image partition on host machine.
> +
> +Building U-BOOT proper image
> +
> +
> +.. code-block:: none
> +
> +   $ make clean
> +   $ export CROSS_COMPILE=aarch64-linux-gnu-
> +   $ make ARCH=arm cubieboard7_defconfig
> +   $ make -j16
> +   $ mkimage -A arm -T firmware -C none -O u-boot 

Re: [PATCH v9 11/12] arm: add Cubieboard7 board support

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:34PM +0530, Amit Singh Tomar wrote:
> The Cubieboard is a single board computer containing a
> Actions S700 SoC(with 4 ARMv8 Cortex-A53 cores).
> 
> This patch adds respective defconfig alongwith .dts(copied
> from Linux v5.5-rc6 with hash "b3a987b0264d").
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 
> ---

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * Added Reviewed-by tag.
> Changes since v5:
> * Trimmed of the cubieboard7_defconfig.
> Changes since v4:
> * No changes.
> Changes since v3:
> * added reviewed-by: tag.
> Changes since v2:
> * No changes.
> Changes since v1:
> * No changes.
> ---
>  arch/arm/dts/s700-cubieboard7.dts | 92 
> +++
>  configs/cubieboard7_defconfig |  9 
>  2 files changed, 101 insertions(+)
>  create mode 100644 arch/arm/dts/s700-cubieboard7.dts
>  create mode 100644 configs/cubieboard7_defconfig
> 
> diff --git a/arch/arm/dts/s700-cubieboard7.dts 
> b/arch/arm/dts/s700-cubieboard7.dts
> new file mode 100644
> index 000..63e375c
> --- /dev/null
> +++ b/arch/arm/dts/s700-cubieboard7.dts
> @@ -0,0 +1,92 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2017 Andreas Färber
> + */
> +
> +/dts-v1/;
> +
> +#include "s700.dtsi"
> +
> +/ {
> + compatible = "cubietech,cubieboard7", "actions,s700";
> + model = "CubieBoard7";
> +
> + aliases {
> + serial3 = 
> + };
> +
> + chosen {
> + stdout-path = "serial3:115200n8";
> + };
> +
> + memory@0 {
> + device_type = "memory";
> + reg = <0x0 0x0 0x0 0x8000>;
> + };
> +
> + memory@1,e000 {
> + device_type = "memory";
> + reg = <0x1 0xe000 0x0 0x0>;
> + };
> +};
> +
> + {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <_default>;
> +};
> +
> + {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <_default>;
> +};
> +
> + {
> + status = "disabled";
> + pinctrl-names = "default";
> + pinctrl-0 = <_default>;
> +};
> +
> + {
> + i2c0_default: i2c0_default {
> + pinmux {
> + groups = "i2c0_mfp";
> + function = "i2c0";
> + };
> + pinconf {
> + pins = "i2c0_sclk", "i2c0_sdata";
> + bias-pull-up;
> + };
> + };
> +
> + i2c1_default: i2c1_default {
> + pinmux {
> + groups = "i2c1_dummy";
> + function = "i2c1";
> + };
> + pinconf {
> + pins = "i2c1_sclk", "i2c1_sdata";
> + bias-pull-up;
> + };
> + };
> +
> + i2c2_default: i2c2_default {
> + pinmux {
> + groups = "i2c2_dummy";
> + function = "i2c2";
> + };
> + pinconf {
> + pins = "i2c2_sclk", "i2c2_sdata";
> + bias-pull-up;
> + };
> + };
> +};
> +
> + {
> + clocks = <>;
> +};
> +
> + {
> + status = "okay";
> +};
> diff --git a/configs/cubieboard7_defconfig b/configs/cubieboard7_defconfig
> new file mode 100644
> index 000..d12c293
> --- /dev/null
> +++ b/configs/cubieboard7_defconfig
> @@ -0,0 +1,9 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_OWL=y
> +CONFIG_MACH_S700=y
> +CONFIG_IDENT_STRING="\ncubieboard7"
> +CONFIG_BOOTDELAY=5
> +CONFIG_USE_BOOTARGS=y
> +CONFIG_BOOTARGS="console=ttyOWL3,115200n8"
> +# CONFIG_DISPLAY_CPUINFO is not set
> +CONFIG_DEFAULT_DEVICE_TREE="s700-cubieboard7"
> -- 
> 2.7.4
> 


Re: [PATCH v9 10/12] actions: Move defconfig options to Kconfig

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:33PM +0530, Amit Singh Tomar wrote:
> This patch moves some of the config options from bubblegum_96_defconfig
> to platform specific Kconfig file.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * remove unnecessary string from SYS_PROMPT.
> Changes since v5:
> * Newly added patch, was not there in earlier versions.
> ---
>  arch/arm/mach-owl/Kconfig  | 15 +++
>  configs/bubblegum_96_defconfig |  5 -
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
> index cde2ade..2b5d725 100644
> --- a/arch/arm/mach-owl/Kconfig
> +++ b/arch/arm/mach-owl/Kconfig
> @@ -24,4 +24,19 @@ config SYS_SOC
>  default "s900" if MACH_S900
>  default "s700" if MACH_S700
>  
> +config DISTRO_DEFAULTS
> + default y
> +
> +config NR_DRAM_BANKS
> + default 1
> +
> +config SYS_RELOC_GD_ENV_ADDR
> + default y
> +
> +config SYS_PROMPT
> + default "U-Boot => "
> +
> +config DISPLAY_BOARDINFO
> + default n
> +
>  endif
> diff --git a/configs/bubblegum_96_defconfig b/configs/bubblegum_96_defconfig
> index e76e9a2..0883167 100644
> --- a/configs/bubblegum_96_defconfig
> +++ b/configs/bubblegum_96_defconfig
> @@ -1,19 +1,14 @@
>  CONFIG_ARM=y
>  CONFIG_ARCH_OWL=y
>  CONFIG_ENV_SIZE=0x2000
> -CONFIG_NR_DRAM_BANKS=1
>  CONFIG_MACH_S900=y
>  CONFIG_IDENT_STRING="\nBubblegum-96"
> -CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_BOOTDELAY=5
>  CONFIG_USE_BOOTARGS=y
>  CONFIG_BOOTARGS="console=ttyOWL5,115200n8"
>  # CONFIG_DISPLAY_CPUINFO is not set
> -# CONFIG_DISPLAY_BOARDINFO is not set
> -CONFIG_SYS_PROMPT="U-Boot => "
>  CONFIG_CMD_MD5SUM=y
>  CONFIG_CMD_MEMINFO=y
>  CONFIG_CMD_CACHE=y
>  CONFIG_CMD_TIMER=y
>  CONFIG_DEFAULT_DEVICE_TREE="bubblegum_96"
> -CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -- 
> 2.7.4
> 


Re: [PATCH v9 08/12] arm: dts: actions: s700: add u-boot specific dtsi file

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:31PM +0530, Amit Singh Tomar wrote:
> Devices like uart and clk are needed to be enabled before relocation.
> this patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * No changes.
> Changes since v5:
> * Added reviwed-by tag.
> Changes since v4:
> * Moved it to 08/11 to 06/11.
> Changes since v3:
> * Replaced dtsi with dts in subject line along with arm:dts:
>   to the prefix.
> Changes since v2:
> * Added License.
> Changes since v1:
> * This is newly added file that was *not* present in v1 and
>   contains u-boot specific changes.
> ---
>  arch/arm/dts/s700-u-boot.dtsi | 18 ++
>  1 file changed, 18 insertions(+)
>  create mode 100644 arch/arm/dts/s700-u-boot.dtsi
> 
> diff --git a/arch/arm/dts/s700-u-boot.dtsi b/arch/arm/dts/s700-u-boot.dtsi
> new file mode 100644
> index 000..a527ccc
> --- /dev/null
> +++ b/arch/arm/dts/s700-u-boot.dtsi
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2020 Amit Singh Tomar 
> + */
> +
> +/{
> + soc {
> + u-boot,dm-pre-reloc;
> + };
> +};
> +
> + {
> + u-boot,dm-pre-reloc;
> +};
> +
> + {
> + u-boot,dm-pre-reloc;
> +};
> -- 
> 2.7.4
> 


Re: [PATCH v9 09/12] arm: add support Actions Semi S700

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:32PM +0530, Amit Singh Tomar wrote:
> This patch adds basic support for Actions Semi based S700
> SoC, which is driven by common owl framework.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * Added Reviewed-by tag.
> Changes since v7:
> * Removed S700 include file.
> Changes since v6:
> * No changes.
> Changes since v5:
> * Added reviewed-by tag.
> Changes since v4:
> * Moved it to 09/11 to 04/11.
> Changes since v3:
> * Added "SoC" keyword to Actions Semi S700.
> Changes since v2:
> * Fixed the commit message.
> * Checked for the clk->id.
> * Added a .data member with SoC type.
> * Removed #ifdefs from few places.
> Changes since v1:
> * Moved CLK and CLK_OWL symbols from defconfig to arch/arm/Kconfig.
> ---
>  arch/arm/mach-owl/Kconfig | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
> index 28984c1..cde2ade 100644
> --- a/arch/arm/mach-owl/Kconfig
> +++ b/arch/arm/mach-owl/Kconfig
> @@ -8,6 +8,10 @@ config MACH_S900
>  bool "Actions Semi S900 SoC"
>  select ARM64
>  
> +config MACH_S700
> +bool "Actions Semi S700 SoC"
> +select ARM64
> +
>  endchoice
>  
>  config SYS_TEXT_BASE
> @@ -18,5 +22,6 @@ config SYS_CONFIG_NAME
>  
>  config SYS_SOC
>  default "s900" if MACH_S900
> +default "s700" if MACH_S700
>  
>  endif
> -- 
> 2.7.4
> 


Re: [PATCH v9 07/12] arm: actions: add S700 SoC device tree

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:30PM +0530, Amit Singh Tomar wrote:
> This patch adds .dtsi file(sync with Linux 5.5-rc6 with hash "b3a987b0264d")
> and required binding for S700 SoC that is a 64-bit Quad-core ARM
> Cortex-A53 cores.
> 
> It also provisions dts file to be built based on selected
> platform(CONFIG_MACH_S900/S700).
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 
> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * No changes.
> Changes since v5:
> * Added reviwed-by tag.
> Changes since v4:
> * Move it to 07/11 from 05/11.
> Changes since v3:
> * Updated commit message to the Linux tag to
>   which the dtsi file is synced.
> Changes since v2:
> * Synced DTS bindings with Linux 5.5.
> Changes since v1:
> * Moved the u-boot specific changes to s700-u-boot.dtsi, now
>   s700.dtsi is in complete sync with Linux 4.20.
> ---
>  arch/arm/dts/Makefile  |   6 +-
>  arch/arm/dts/s700.dtsi | 248 
> +
>  include/dt-bindings/clock/actions,s700-cmu.h   | 118 
>  include/dt-bindings/reset/actions,s700-reset.h |  34 
>  4 files changed, 404 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm/dts/s700.dtsi
>  create mode 100644 include/dt-bindings/clock/actions,s700-cmu.h
>  create mode 100644 include/dt-bindings/reset/actions,s700-reset.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 9c593b2..308c76b 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -64,8 +64,10 @@ dtb-$(CONFIG_KIRKWOOD) += \
>   kirkwood-pogo_e02.dtb \
>   kirkwood-sheevaplug.dtb
>  
> -dtb-$(CONFIG_ARCH_OWL) += \
> - bubblegum_96.dtb
> +dtb-$(CONFIG_MACH_S900) += \
> +bubblegum_96.dtb

Can you please move above change to S900 dts sync patch? Other than this,

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> +dtb-$(CONFIG_MACH_S700) += \
> +s700-cubieboard7.dtb
>  
>  dtb-$(CONFIG_ROCKCHIP_PX30) += \
>   px30-evb.dtb \
> diff --git a/arch/arm/dts/s700.dtsi b/arch/arm/dts/s700.dtsi
> new file mode 100644
> index 000..2006ad5
> --- /dev/null
> +++ b/arch/arm/dts/s700.dtsi
> @@ -0,0 +1,248 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2017 Andreas Färber
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +/ {
> + compatible = "actions,s700";
> + interrupt-parent = <>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> +
> + cpus {
> + #address-cells = <2>;
> + #size-cells = <0>;
> +
> + cpu0: cpu@0 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x0>;
> + enable-method = "psci";
> + };
> +
> + cpu1: cpu@1 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x1>;
> + enable-method = "psci";
> + };
> +
> + cpu2: cpu@2 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x2>;
> + enable-method = "psci";
> + };
> +
> + cpu3: cpu@3 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x3>;
> + enable-method = "psci";
> + };
> + };
> +
> + reserved-memory {
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + secmon@1f00 {
> + reg = <0x0 0x1f00 0x0 0x100>;
> + no-map;
> + };
> + };
> +
> + psci {
> + compatible = "arm,psci-0.2";
> + method = "smc";
> + };
> +
> + arm-pmu {
> + compatible = "arm,cortex-a53-pmu";
> + interrupts = ,
> +  ,
> +  ,
> +  ;
> + interrupt-affinity = <>, <>, <>, <>;
> + };
> +
> + timer {
> + compatible = "arm,armv8-timer";
> + interrupts =  + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
> + };
> +
> + hosc: hosc {
> + compatible = "fixed-clock";
> + clock-frequency = <2400>;
> + #clock-cells = <0>;
> + };
> +
> + losc: losc {

Re: [PATCH v9 06/12] clk: actions: Add common clock driver

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:29PM +0530, Amit Singh Tomar wrote:
> This patch converts S900 clock driver to something common that can
> be used for other SoCs, for instance S700(few of clk registers are same).
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 
> ---
> Changes since v8:
> * Fixed the bubblegum-96 boot issue by introducing
>   dev_get_driver_data API to read driver data.
> Changes since v7:
> * No changes.
> Changes since v6:
> * Fixed the bug that breaks S900(missing break in switch statement).
> Changes since v5:
> * No changes.
> Changes since v4:
> * This patch is re-ordered, moved from 08/11 to 04/11.
> Changes since v3:
> * Replaced dtsi with dts in subject line along with arm:dts:
>   to the prefix.
> * Added reviewed-by tag.
> Changes since v2:
> * Newly added patch, not there in v2/v1.
> ---
>  arch/arm/Kconfig  |   2 +
>  arch/arm/include/asm/arch-owl/clk_s900.h  |  57 ---
>  arch/arm/include/asm/arch-owl/regs_s700.h |  56 +++
>  configs/bubblegum_96_defconfig|   3 -
>  drivers/clk/owl/Kconfig   |   8 +-
>  drivers/clk/owl/Makefile  |   2 +-
>  drivers/clk/owl/clk_owl.c | 155 
> ++
>  drivers/clk/owl/clk_owl.h |  64 
>  drivers/clk/owl/clk_s900.c| 137 --
>  9 files changed, 280 insertions(+), 204 deletions(-)
>  delete mode 100644 arch/arm/include/asm/arch-owl/clk_s900.h
>  create mode 100644 arch/arm/include/asm/arch-owl/regs_s700.h
>  create mode 100644 drivers/clk/owl/clk_owl.c
>  create mode 100644 drivers/clk/owl/clk_owl.h
>  delete mode 100644 drivers/clk/owl/clk_s900.c
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index de6b7f9..05658cf 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -876,6 +876,8 @@ config ARCH_OWL
>   select DM
>   select DM_SERIAL
>   select OWL_SERIAL
> + select CLK
> + select CLK_OWL
>   select OF_CONTROL
>   imply CMD_DM
>  
> diff --git a/arch/arm/include/asm/arch-owl/clk_s900.h 
> b/arch/arm/include/asm/arch-owl/clk_s900.h
> deleted file mode 100644
> index 88e88f7..000
> --- a/arch/arm/include/asm/arch-owl/clk_s900.h
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0+ */
> -/*
> - * Actions Semi S900 Clock Definitions
> - *
> - * Copyright (C) 2015 Actions Semi Co., Ltd.
> - * Copyright (C) 2018 Manivannan Sadhasivam 
> 
> - *
> - */
> -
> -#ifndef _OWL_CLK_S900_H_
> -#define _OWL_CLK_S900_H_
> -
> -#include 
> -
> -struct owl_clk_priv {
> - phys_addr_t base;
> -};
> -
> -/* BUSCLK register definitions */
> -#define CMU_PDBGDIV_87
> -#define CMU_PDBGDIV_SHIFT26
> -#define CMU_PDBGDIV_DIV  (CMU_PDBGDIV_8 << CMU_PDBGDIV_SHIFT)
> -#define CMU_PERDIV_8 7
> -#define CMU_PERDIV_SHIFT 20
> -#define CMU_PERDIV_DIV   (CMU_PERDIV_8 << CMU_PERDIV_SHIFT)
> -#define CMU_NOCDIV_2 1
> -#define CMU_NOCDIV_SHIFT 19
> -#define CMU_NOCDIV_DIV   (CMU_NOCDIV_2 << CMU_NOCDIV_SHIFT)
> -#define CMU_DMMCLK_SRC_APLL  2
> -#define CMU_DMMCLK_SRC_SHIFT 10
> -#define CMU_DMMCLK_SRC   (CMU_DMMCLK_SRC_APLL << 
> CMU_DMMCLK_SRC_SHIFT)
> -#define CMU_APBCLK_DIV   BIT(8)
> -#define CMU_NOCCLK_SRC   BIT(7)
> -#define CMU_AHBCLK_DIV   BIT(4)
> -#define CMU_CORECLK_MASK 3
> -#define CMU_CORECLK_CPLL BIT(1)
> -#define CMU_CORECLK_HOSC BIT(0)
> -
> -/* COREPLL register definitions */
> -#define CMU_COREPLL_EN   BIT(9)
> -#define CMU_COREPLL_HOSC_EN  BIT(8)
> -#define CMU_COREPLL_OUT  (1104 / 24)
> -
> -/* DEVPLL register definitions */
> -#define CMU_DEVPLL_CLK   BIT(12)
> -#define CMU_DEVPLL_ENBIT(8)
> -#define CMU_DEVPLL_OUT   (660 / 6)
> -
> -/* UARTCLK register definitions */
> -#define CMU_UARTCLK_SRC_DEVPLL   BIT(16)
> -
> -/* DEVCLKEN1 register definitions */
> -#define CMU_DEVCLKEN1_UART5  BIT(21)
> -
> -#define PLL_STABILITY_WAIT_US50
> -
> -#endif
> diff --git a/arch/arm/include/asm/arch-owl/regs_s700.h 
> b/arch/arm/include/asm/arch-owl/regs_s700.h
> new file mode 100644
> index 000..2f21c15
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-owl/regs_s700.h
> @@ -0,0 +1,56 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Actions Semi S700 Register Definitions
> + *
> + */
> +
> +#ifndef _OWL_REGS_S700_H_
> +#define _OWL_REGS_S700_H_
> +
> +#define CMU_COREPLL  0x
> +#define CMU_DEVPLL   0x0004
> +#define CMU_DDRPLL   0x0008
> +#define CMU_NANDPLL  0x000C
> +#define CMU_DISPLAYPLL   0x0010
> +#define CMU_AUDIOPLL 0x0014
> +#define CMU_TVOUTPLL 0x0018
> +#define CMU_BUSCLK   0x001C
> +#define CMU_SENSORCLK

Re: [PATCH v9 02/12] arm: actions: rename sysmap-s900 to sysmap-owl

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:25PM +0530, Amit Singh Tomar wrote:
> Now that memory maps(for both S700 and S900 SoCs) can be managed using
> a common file, rename sysmap-s900 to sysmap-owl to reflect the same.
> 
> Reviewed-by: Manivannan Sadhasivam 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * No changes.
> Changes since v5:
> * No changes.
> Changes since v4:
> * No changes.
> Changes since v3:
> * Added reviewed-by tag.
> Changes since v2:
> * Fixed the commit message and header.
> Changes since v1:
> * compile sysmap-owl.c against CONFIG_ARM64 now.
> ---
>  arch/arm/mach-owl/Makefile  |  2 +-
>  arch/arm/mach-owl/sysmap-owl.c  | 32 
>  arch/arm/mach-owl/sysmap-s900.c | 32 
>  3 files changed, 33 insertions(+), 33 deletions(-)
>  create mode 100644 arch/arm/mach-owl/sysmap-owl.c
>  delete mode 100644 arch/arm/mach-owl/sysmap-s900.c
> 
> diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
> index 0b181c6..f3a69eb 100644
> --- a/arch/arm/mach-owl/Makefile
> +++ b/arch/arm/mach-owl/Makefile
> @@ -1,4 +1,4 @@
>  # SPDX-License-Identifier:   GPL-2.0+
>  
>  obj-y += soc.o
> -obj-y += sysmap-s900.o
> +obj-$(CONFIG_ARM64) += sysmap-owl.o
> diff --git a/arch/arm/mach-owl/sysmap-owl.c b/arch/arm/mach-owl/sysmap-owl.c
> new file mode 100644
> index 000..81f6ca2
> --- /dev/null
> +++ b/arch/arm/mach-owl/sysmap-owl.c
> @@ -0,0 +1,32 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Memory map for Actions Semi Owl series SoCs.
> + *
> + * Copyright (C) 2015 Actions Semi Co., Ltd.
> + * Copyright (C) 2018 Manivannan Sadhasivam 
> 
> + */
> +
> +#include 
> +#include 
> +
> +static struct mm_region owl_mem_map[] = {
> + {
> + .virt = 0x0UL, /* DDR */
> + .phys = 0x0UL, /* DDR */
> + .size = 0x8000UL,
> + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> +  PTE_BLOCK_INNER_SHARE
> + }, {
> + .virt = 0xE000UL, /* Peripheral block */
> + .phys = 0xE000UL, /* Peripheral block */
> + .size = 0x0800UL,
> + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> +  PTE_BLOCK_NON_SHARE |
> +  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> + }, {
> + /* List terminator */
> + 0,
> + }
> +};
> +
> +struct mm_region *mem_map = owl_mem_map;
> diff --git a/arch/arm/mach-owl/sysmap-s900.c b/arch/arm/mach-owl/sysmap-s900.c
> deleted file mode 100644
> index f78b639..000
> --- a/arch/arm/mach-owl/sysmap-s900.c
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * Actions Semi S900 Memory map
> - *
> - * Copyright (C) 2015 Actions Semi Co., Ltd.
> - * Copyright (C) 2018 Manivannan Sadhasivam 
> 
> - */
> -
> -#include 
> -#include 
> -
> -static struct mm_region s900_mem_map[] = {
> - {
> - .virt = 0x0UL, /* DDR */
> - .phys = 0x0UL, /* DDR */
> - .size = 0x8000UL,
> - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> -  PTE_BLOCK_INNER_SHARE
> - }, {
> - .virt = 0xE000UL, /* Peripheral block */
> - .phys = 0xE000UL, /* Peripheral block */
> - .size = 0x0800UL,
> - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> -  PTE_BLOCK_NON_SHARE |
> -  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> - }, {
> - /* List terminator */
> - 0,
> - }
> -};
> -
> -struct mm_region *mem_map = s900_mem_map;
> -- 
> 2.7.4
> 


Re: [PATCH v9 05/12] arm: dts: actions: s900: add u-boot specific dtsi file

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:28PM +0530, Amit Singh Tomar wrote:
> Devices like uart and clk are needed to be enabled before relocation.
> This patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.
> 
> Reviewed-by: Manivannan Sadhasivam 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * No changes.
> Changes since v5:
> * No changes.
> Changes since v4:
> * This patch is re-ordered, moved from 08/11 to 04/11.
> Changes since v3:
> * Replaced dtsi with dts in subject line along with arm:dts:
>   to the prefix.
> * Added reviewed-by tag.
> Changes since v2:
> * Newly added patch, not there in v2/v1.
> ---
>  arch/arm/dts/s900-u-boot.dtsi | 17 +
>  1 file changed, 17 insertions(+)
>  create mode 100644 arch/arm/dts/s900-u-boot.dtsi
> 
> diff --git a/arch/arm/dts/s900-u-boot.dtsi b/arch/arm/dts/s900-u-boot.dtsi
> new file mode 100644
> index 000..a95f2cc
> --- /dev/null
> +++ b/arch/arm/dts/s900-u-boot.dtsi
> @@ -0,0 +1,17 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + */
> +
> +/{
> + soc {
> + u-boot,dm-pre-reloc;
> + };
> +};
> +
> + {
> + u-boot,dm-pre-reloc;
> +};
> +
> + {
> + u-boot,dm-pre-reloc;
> +};
> -- 
> 2.7.4
> 


Re: [PATCH v9 04/12] arm: dts: sync dts for Action Semi S900

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:27PM +0530, Amit Singh Tomar wrote:
> Synchronize device tree bindings with v5.5-rc6 tag with commit id
> "b3a987b0264d".
> 
> Also, it removes older clock binding defined for S900 along with undocumented
> compatible string "actions,s900-serial" from serial driver and adapts clock
> driver to cater to new bindings.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * Added Reviewed-by tag.
> Changes since v5:
> * Moved it 04/11 from 03/11.
> * removed the undocumented compatible string "actions,s900-serial".
> * removed the reviewed-by tag.
> Changes since v4:
> * This patch is re-ordered, moved from 07/11 to 03/11.
> * Used the commit-id(12 chars long) in commit message.
> Changes since v3:
> * Added Reviewed-by: tag.
> Changes since v2:
> * Newly added patch, not there in v2/v1.
> ---
>  arch/arm/dts/s900.dtsi | 322 
> +++--
>  drivers/clk/owl/clk_s900.c |   6 +-
>  drivers/serial/serial_owl.c|   1 -
>  include/dt-bindings/clock/actions,s900-cmu.h   | 129 ++
>  include/dt-bindings/clock/s900_cmu.h   |  77 --
>  include/dt-bindings/reset/actions,s900-reset.h |  65 +
>  6 files changed, 498 insertions(+), 102 deletions(-)
>  create mode 100644 include/dt-bindings/clock/actions,s900-cmu.h
>  delete mode 100644 include/dt-bindings/clock/s900_cmu.h
>  create mode 100644 include/dt-bindings/reset/actions,s900-reset.h
> 
> diff --git a/arch/arm/dts/s900.dtsi b/arch/arm/dts/s900.dtsi
> index 2bbb30a..eb35cf7 100644
> --- a/arch/arm/dts/s900.dtsi
> +++ b/arch/arm/dts/s900.dtsi
> @@ -1,17 +1,94 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -//
> -// Device Tree Source for Actions Semi S900 SoC
> -//
> -// Copyright (C) 2015 Actions Semi Co., Ltd.
> -// Copyright (C) 2018 Manivannan Sadhasivam 
> 
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2017 Andreas Färber
> + */
>  
> -/dts-v1/;
> -#include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  / {
>   compatible = "actions,s900";
> - #address-cells = <0x2>;
> - #size-cells = <0x2>;
> + interrupt-parent = <>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> +
> + cpus {
> + #address-cells = <2>;
> + #size-cells = <0>;
> +
> + cpu0: cpu@0 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x0>;
> + enable-method = "psci";
> + };
> +
> + cpu1: cpu@1 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x1>;
> + enable-method = "psci";
> + };
> +
> + cpu2: cpu@2 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x2>;
> + enable-method = "psci";
> + };
> +
> + cpu3: cpu@3 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a53";
> + reg = <0x0 0x3>;
> + enable-method = "psci";
> + };
> + };
> +
> + reserved-memory {
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + secmon@1f00 {
> + reg = <0x0 0x1f00 0x0 0x100>;
> + no-map;
> + };
> + };
> +
> + psci {
> + compatible = "arm,psci-0.2";
> + method = "smc";
> + };
> +
> + arm-pmu {
> + compatible = "arm,cortex-a53-pmu";
> + interrupts = ,
> +  ,
> +  ,
> +  ;
> + interrupt-affinity = <>, <>, <>, <>;
> + };
> +
> + timer {
> + compatible = "arm,armv8-timer";
> + interrupts =  + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> +   + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
> + };
> +
> + hosc: hosc {
> + compatible = "fixed-clock";
> + clock-frequency = <2400>;
> + #clock-cells = <0>;
> + };
>  
>   losc: losc {
>   compatible = "fixed-clock";
> @@ -26,28 +103,231 @@
>   };
>  
>   soc {
> - 

Re: [PATCH v9 03/12] serial: actions: add compatible string

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:26PM +0530, Amit Singh Tomar wrote:
> This patch adds "actions,owl-uart" string to the owl uart driver. It
> is also defined in Linux kernel.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 
> ---
> Changes since v8:
> * No changes.
> Changes since v7:
> * No changes.
> Changes since v6:
> * Added Reviewd-by tag.
> Changes since v5:
> * Moved it to from 06/11 to 03/11.
> * Used appropriate commit message.
> * Removed the reviwed-by tag.
> Changes since v4:
> * Moved it to from 09/11 to 06/11.
> Changes since v3:
> * Used only owl-uart for compatible string.
> Changes since v2:
> * No changes.
> Changes since v1:
> * No changes.
> ---
>  drivers/serial/serial_owl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
> index 7ead73e..539acdc 100644
> --- a/drivers/serial/serial_owl.c
> +++ b/drivers/serial/serial_owl.c
> @@ -121,6 +121,7 @@ static const struct dm_serial_ops owl_serial_ops = {
>  
>  static const struct udevice_id owl_serial_ids[] = {
>   { .compatible = "actions,s900-serial" },

This should've been removed here itself as opposed to in devicetree sync patch.
But I don't warrant a new series for this change.

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> + { .compatible = "actions,owl-uart" },
>   { }
>  };
>  
> -- 
> 2.7.4
> 


Re: [PATCH v9 01/12] arm: actions: Add common framework for Actions Owl Semi SoCs

2020-04-05 Thread Manivannan Sadhasivam
On Wed, Apr 01, 2020 at 12:49:24PM +0530, Amit Singh Tomar wrote:
> This commit adds common arch support for Actions Semi Owl
> series SoCs and removes the Bubblegum96 board files.
> 
> Reviewed-by: Andre Przywara 
> Signed-off-by: Amit Singh Tomar 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
> Changes since v8:
>   * Added Reviewed-by tag.
> Changes since v7:
>   * Removed S900 specific include file.
>   * Removed the file list entry in MAINTAINERS file.
> Changes since v6:
>   * No change.
> Changes since v5:
>   * No change.
> Changes since v4:
>   * No change.
> Changes since v3:
>   * Corrected the file list entry in MAINTAINERS file.
> Changes since v2:
>   * Moved the file list details to root MAINTAINERS file.
>   * Updated the commit message as suggested by Mani.
>   * Used the "Owl" keyword to describe SoC family.
> Changes since v1:
>   * Moved S700 specific changes to patch 4 of 9.
>   * Moved couple of symbols from defconfig to arch/arm/Kconfig
>   and platform owl Kconfig.
> ---
>  MAINTAINERS  |  3 +-
>  arch/arm/Kconfig |  3 +-
>  arch/arm/mach-owl/Kconfig| 29 ++
>  arch/arm/mach-owl/Makefile   |  1 +
>  arch/arm/mach-owl/soc.c  | 57 
> 
>  board/ucRobotics/bubblegum_96/Kconfig| 15 
>  board/ucRobotics/bubblegum_96/MAINTAINERS|  6 ---
>  board/ucRobotics/bubblegum_96/Makefile   |  3 --
>  board/ucRobotics/bubblegum_96/bubblegum_96.c | 57 
> 
>  configs/bubblegum_96_defconfig   |  4 +-
>  include/configs/bubblegum_96.h   | 40 ---
>  include/configs/owl-common.h | 40 +++
>  12 files changed, 114 insertions(+), 144 deletions(-)
>  create mode 100644 arch/arm/mach-owl/soc.c
>  delete mode 100644 board/ucRobotics/bubblegum_96/Kconfig
>  delete mode 100644 board/ucRobotics/bubblegum_96/MAINTAINERS
>  delete mode 100644 board/ucRobotics/bubblegum_96/Makefile
>  delete mode 100644 board/ucRobotics/bubblegum_96/bubblegum_96.c
>  delete mode 100644 include/configs/bubblegum_96.h
>  create mode 100644 include/configs/owl-common.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b50652b..2eaacb7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -272,9 +272,10 @@ M:   Manivannan Sadhasivam 
> 
>  S:   Maintained
>  F:   arch/arm/include/asm/arch-owl/
>  F:   arch/arm/mach-owl/
> -F:   board/ucRobotics/
>  F:   drivers/clk/owl/
>  F:   drivers/serial/serial_owl.c
> +F:   include/configs/owl-common.h
> +F:   configs/bubblegum_96_defconfig
>  
>  ARM RENESAS RMOBILE/R-CAR
>  M:   Nobuhiro Iwamatsu 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index bbb1e27..de6b7f9 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -873,9 +873,9 @@ config ARCH_MX5
>  
>  config ARCH_OWL
>   bool "Actions Semi OWL SoCs"
> - select ARM64
>   select DM
>   select DM_SERIAL
> + select OWL_SERIAL
>   select OF_CONTROL
>   imply CMD_DM
>  
> @@ -1868,7 +1868,6 @@ source "board/spear/spear600/Kconfig"
>  source "board/spear/x600/Kconfig"
>  source "board/st/stv0991/Kconfig"
>  source "board/tcl/sl50/Kconfig"
> -source "board/ucRobotics/bubblegum_96/Kconfig"
>  source "board/birdland/bav335x/Kconfig"
>  source "board/toradex/colibri_pxa270/Kconfig"
>  source "board/variscite/dart_6ul/Kconfig"
> diff --git a/arch/arm/mach-owl/Kconfig b/arch/arm/mach-owl/Kconfig
> index 199e772..28984c1 100644
> --- a/arch/arm/mach-owl/Kconfig
> +++ b/arch/arm/mach-owl/Kconfig
> @@ -1,27 +1,22 @@
>  if ARCH_OWL
>  
> -config SYS_SOC
> - default "owl"
> -
>  choice
> -prompt "Actions Semi OWL SoCs board select"
> +prompt "Actions Semi Owl SoC Variant"
>  optional
>  
> -config TARGET_BUBBLEGUM_96
> - bool "96Boards Bubblegum-96"
> - help
> -   Support for 96Boards Bubblegum-96. This board complies with
> -   96Board Consumer Edition Specification. Features:
> -   - Actions Semi S900 SoC (4xCortex A53, Power VR G6230 GPU)
> -   - 2GiB RAM
> -   - 8GiB eMMC, uSD slot
> -   - WiFi, Bluetooth and GPS module
> -   - 2x Host, 1x Device USB port
> -   - HDMI
> -   - 20-pin low speed and 40-pin high speed expanders, 6 LED, 3 buttons
> +config MACH_S900
> +bool "Actions Semi S900 SoC"
> +select ARM64
>  
>  endchoice
>  
> -source "board/ucRobotics/bubblegum_96/Kconfig"
> +config SYS_TEXT_BASE
> +default 0x1100
> +
> +config SYS_CONFIG_NAME
> +default "owl-common"
> +
> +config SYS_SOC
> +default "s900" if MACH_S900
>  
>  endif
> diff --git a/arch/arm/mach-owl/Makefile b/arch/arm/mach-owl/Makefile
> index 1b43dc2..0b181c6 100644
> --- a/arch/arm/mach-owl/Makefile
> +++ b/arch/arm/mach-owl/Makefile
> @@ -1,3 +1,4 @@
>  # SPDX-License-Identifier: