Re: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata

2020-05-04 Thread Faiz Abbas
Hi,

On 04/05/20 6:44 pm, Simon Glass wrote:
> Hi Bart,
> 
> On Mon, 4 May 2020 at 01:10, Bartosz Golaszewski  wrote:
>>
>> pt., 1 maj 2020 o 20:32 Tom Rini  napisał(a):
>>>
>>> On Thu, Apr 30, 2020 at 01:43:30PM +0200, Bartosz Golaszewski wrote:
 wt., 28 kwi 2020 o 09:01 Faiz Abbas  napisał(a):
>
> +Bartosz
>
> On 28/04/20 9:47 am, Lokesh Vutla wrote:
>> +Faiz,
>>
>> On 28/04/20 12:29 AM, Tom Rini wrote:
>>> On Mon, Apr 27, 2020 at 05:33:41AM +, Peng Fan wrote:
> Subject: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata
>
> At present this driver is enabled in SPL on omapl138_lcdk, which uses
> of-platdata. The driver needs to be ported to use of-platdata 
> properly.
> For now, avoid a build error by returning an error.
>
> Signed-off-by: Simon Glass 
>>
>> Does this break the boot on omap l138?
>>
>
> I don't have a board at hand to test this out. Bartosz can you help test 
> this with
> omapl138?
>
> Thanks,
> Faiz

 Hi Faiz,

 I can confirm - this *does* break the mmc boot on da850-lcdk.
>>>
>>> So who is going to fix the driver to unblock Simon's series?
>>>
>>
>> Is this something that will take a lot of work? What exactly needs
>> doing? I'm not sure what "use of-platdata properly" means.
> 
> This board is defining CONFIG_SPL_OF_PLATDATA which means that device
> tree is not available in SPL. Instead you need to use a C structure
> created by dtoc. It basically involves creating that struct and
> getting the data from that instead of calling the DT functions. I
> expect it will take 2-4 hours to figure out, code and test.
> 
> See of-plat.rst for full documentation. There are quite a few examples for 
> mmc:
> 
> grep PLATDATA drivers/mmc/*.c
> drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/ftsdc010_mci.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/mxsmmc.c: debug("OF_PLATDATA: regs: 0x%p bw: %d clkid: %d
> non_removable: %d\n",
> drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_dw_mmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_dw_mmc.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_dw_mmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_sdhci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_sdhci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> drivers/mmc/rockchip_sdhci.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> 

I was able to get a setup to work on. Will post a fix for this soon.

Thanks,
Faiz


Re: [PATCH 1/2] arm: mvebu: armada-370-xp.dtsi: add u-boot,dm-pre-reloc to spi0

2020-05-04 Thread Stefan Roese

Hi Ezra,

On 04.05.20 20:12, Ezra Buehler wrote:

Hi Chris,


On 4 May 2020, at 10:04, Chris Packham  wrote:

I think this would be better in the specific board dts files. Not every 
platform will want this in spl.


Thanks for the input, I can do that. However, please note that before,
the "spi0" node was under "internal-regs" which had the
"u-boot,dm-pre-reloc" property. Commit c265bbe4d (rm: sync armada-xp dts
files from Linux 5.0) moved the node out and removed the U-Boot-specific
property. The property was then added again to "internal-regs" with
commit "1718a9f3b7 (arm: mvebu: armada-370-xp.dtsi: Add "u-boot,
dm-pre-reloc" to "internal-regs") but not to the spi0 node. So basically
this patch restores the previous behavior. What is better?


U-Boot specific DT properties, like "u-boot,dm-pre-reloc" should be
added in U-Boot specific DT dtsi files, e.g.

armada-xp-synology-ds414-u-boot.dtsi

in this case. Such files are included seamlessly by the build system.
Take a look at this file as an example:

arch/arm/dts/armada-3720-uDPU-u-boot.dtsi

This makes it possible to sync the DT files with Linux and still
integrate U-Boot specifics.

Thanks,
Stefan


Re: [PATCH v5 1/2] drivers: gpio: add broadcom iproc gpio driver support

2020-05-04 Thread Rayagonda Kokatanur
Hi Simon,

On Tue, May 5, 2020 at 12:57 AM Simon Glass  wrote:
>
> Hi Rayagonda,
>
> On Mon, 4 May 2020 at 10:00, Rayagonda Kokatanur
>  wrote:
> >
> > Add gpio driver support for Broadcom iproc-based socs.
> >
>
> This seems to be missing a change log. Can I suggest using patman to
> make this automatic?

All change logs are present in the cover letter.
Please let me know if I still need to have a change log for individual patch.

>
> > Signed-off-by: Rayagonda Kokatanur 
> > Signed-off-by: Sheetal Tigadoli 
> > ---
> >  drivers/gpio/Kconfig  |  11 ++
> >  drivers/gpio/Makefile |   1 +
> >  drivers/gpio/iproc_gpio.c | 275 ++
> >  3 files changed, 287 insertions(+)
> >  create mode 100644 drivers/gpio/iproc_gpio.c
> >
> Regards,
> Simon


[PATCH 00/36] Tidy up the 'bd' command.

2020-05-04 Thread Simon Glass
The code for the 'bd' command never got the 'generic board' treatment many
years ago when global_data and bd_info were converted. As a result it
still has a lot of arch-specific duplication of generic code.

This series aims to make as much code in this file generic as possible, so
that it is easy to add new info on all architectures.

For the three architectures that actually need additional code (ARM, PPC
and m68k) this is moved into arch-specific files.

With this series, bdinfo.c drops from nearly 500 lines to just over 100.

It also makes x86 report the frame buffer address properly (the original
goal of my effort).


Simon Glass (36):
  bdinfo: nds32: Use generic bd_info
  bdinfo: riscv: Use generic bd_info
  bdinfo: m68k: Drop bd_info->bi_ipbfreq
  bdinfo: xtensa: Create a generic do_bdinfo for xtensa
  bdinfo: mips: Use the generic bd command
  bdinfo: nios2: Use the generic bd command
  bdinfo: microblaze: Use the generic bd command
  bdinfo: sh: Use the generic bd command
  bdinfo: x86: Use the generic bd command
  bdinfo: sandbox: Use the generic bd command
  bdinfo: nds32: Use the generic bd command
  bdinfo: riscv: Use the generic bd command
  bdinfo: arm: Use the generic bd command
  bdinfo: Drop the option to not use the generic 'bd' command
  bdinfo: Drop unused __maybe_unused
  bdinfo: microblaze: sh: nios2: Drop arch-specific flash info
  bdinfo: Drop unnecessary inline on functions
  bdinfo: Drop print_std_bdinfo()
  bdinfo: ppc: Drop arch-specific print_baudrate()
  bdinfo: sh: arc: Drop arch-specific print_bi_mem()
  bdinfo: Drop print_bi_boot_params()
  bdinfo: Drop print_bi_flash()
  bdinfo: Drop print_cpu_word_size()
  bdinfo: net: ppc: Drop bi_enet1addr and other similar info
  bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn
  bdinfo: net: Drop legacy ethernet bdinfo
  bdinfo: net: Inline print_eths()
  bdinfo: net: Inline print_eth_ip_addr()
  bdinfo: Export some basic printing functions
  bdinfo: arm: Move ARM-specific info into its own file
  bdinfo: ppc: Move PPC-specific info into its own file
  bdinfo: m68k: Move m68k-specific info into its own file
  bdinfo: m68k: ppc: Move arch-specific code from bdinfo
  bdinfo: Update the file comments
  bdinfo: dm: Update fb_base when using driver model
  bdinfo: x86: vesa: Update fb_base to the correct value

 arch/arm/lib/Makefile   |   1 +
 arch/arm/lib/bdinfo.c   |  51 
 arch/m68k/lib/Makefile  |   1 +
 arch/m68k/lib/bdinfo.c  |  34 +++
 arch/nds32/include/asm/u-boot.h |  20 +-
 arch/powerpc/lib/Makefile   |   2 +
 arch/powerpc/lib/bdinfo.c   |  46 
 arch/riscv/include/asm/u-boot.h |  19 +-
 arch/x86/lib/fsp/fsp_graphics.c |   5 +-
 cmd/bdinfo.c| 451 +++-
 common/board_r.c|  16 +-
 drivers/video/video-uclass.c|   1 +
 include/asm-generic/u-boot.h|  18 --
 include/init.h  |   9 +
 14 files changed, 185 insertions(+), 489 deletions(-)
 create mode 100644 arch/arm/lib/bdinfo.c
 create mode 100644 arch/m68k/lib/bdinfo.c
 create mode 100644 arch/powerpc/lib/bdinfo.c

-- 
2.26.2.526.g744177e7f7-goog



RE: [PATCH 10/13] imx: load calibration parameters from fuse for i.MX8MP

2020-05-04 Thread Peng Fan
> Subject: Re: [PATCH 10/13] imx: load calibration parameters from fuse for
> i.MX8MP
> 
> Hi Peng,
> 
> On Sun, May 3, 2020 at 8:39 PM Peng Fan  wrote:
> 
> > 5.4.3 upstream kernel + latest upstream boot?
> 
> No, I meant imx_5.4.3_2.0.0 NXP kernel + latest upstream U-Boot.
> 
> > Disable busfreq, try clk_ignore_unused?
> 
> There is no way to disable busfreq from the NXP kernel. Passing
> clk_ignore_unused does not help either.

Busfreq could be disabled by set the device tree node to disabled.

> 
> I have also tried to boot NXP 5.4.3 on a i.MX8MM EVK with the latest U-Boot
> and I also observe a hang.

I'll give a try tomorrow when I back to office. There is a ARM clock issue that
could cause all i.MX8M kernel hang, but that should be a bit late, should not
be that early just after console enabled.

Regards,
Peng.



Re: [PATCH v10 14/21] riscv: Clean up IPI initialization code

2020-05-04 Thread Rick Chen
Hi Sean

> The previous IPI code initialized the device whenever the first call was
> made to a riscv_*_ipi function. This made it difficult to determine when
> the IPI device was initialized. This patch introduces a new function
> riscv_init_ipi. It is called once during arch_cpu_init_dm. Before this
> point, no riscv_*_ipi functions should be called.
>
> Signed-off-by: Sean Anderson 
> Reviewed-by: Rick Chen 
> ---
>
> Changes in v9:
> - Fix type of ret variable in riscv_ipi_init
> Changes in v7:
> - Split IPI clearing off into its own patch
>
> Changes in v6:
> - Fix some formatting
> - Clear IPIs before enabling interrupts instead of using a ipi_ready flag
> - Only print messages on error in smp code
>
> Changes in v5:
> - New
>
>  arch/riscv/cpu/cpu.c  |  6 
>  arch/riscv/include/asm/smp.h  | 43 +++
>  arch/riscv/lib/andes_plic.c   | 34 -
>  arch/riscv/lib/sbi_ipi.c  |  5 
>  arch/riscv/lib/sifive_clint.c | 33 +++--
>  arch/riscv/lib/smp.c  | 56 ---
>  6 files changed, 90 insertions(+), 87 deletions(-)
>
> diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> index e457f6acbf..f851374255 100644
> --- a/arch/riscv/cpu/cpu.c
> +++ b/arch/riscv/cpu/cpu.c
> @@ -96,6 +96,12 @@ int arch_cpu_init_dm(void)
> csr_write(CSR_SATP, 0);
> }
>
> +#ifdef CONFIG_SMP
> +   ret = riscv_init_ipi();
> +   if (ret)
> +   return ret;
> +#endif
> +
> return 0;
>  }
>
> diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h
> index 74de92ed13..1b428856b2 100644
> --- a/arch/riscv/include/asm/smp.h
> +++ b/arch/riscv/include/asm/smp.h
> @@ -51,4 +51,47 @@ void handle_ipi(ulong hart);
>   */
>  int smp_call_function(ulong addr, ulong arg0, ulong arg1, int wait);
>
> +/**
> + * riscv_init_ipi() - Initialize inter-process interrupt (IPI) driver
> + *
> + * Platform code must provide this function. This function is called once 
> after
> + * the cpu driver is initialized. No other riscv_*_ipi() calls will be made
> + * before this function is called.
> + *
> + * @return 0 if OK, -ve on error
> + */
> +int riscv_init_ipi(void);
> +
> +/**
> + * riscv_send_ipi() - Send inter-processor interrupt (IPI)
> + *
> + * Platform code must provide this function.
> + *
> + * @hart: Hart ID of receiving hart
> + * @return 0 if OK, -ve on error
> + */
> +int riscv_send_ipi(int hart);
> +
> +/**
> + * riscv_clear_ipi() - Clear inter-processor interrupt (IPI)
> + *
> + * Platform code must provide this function.
> + *
> + * @hart: Hart ID of hart to be cleared
> + * @return 0 if OK, -ve on error
> + */
> +int riscv_clear_ipi(int hart);
> +
> +/**
> + * riscv_get_ipi() - Get status of inter-processor interrupt (IPI)
> + *
> + * Platform code must provide this function.
> + *
> + * @hart: Hart ID of hart to be checked
> + * @pending: Pointer to variable with result of the check,
> + *   1 if IPI is pending, 0 otherwise
> + * @return 0 if OK, -ve on error
> + */
> +int riscv_get_ipi(int hart, int *pending);
> +
>  #endif
> diff --git a/arch/riscv/lib/andes_plic.c b/arch/riscv/lib/andes_plic.c
> index 20529ab3eb..5cf29df670 100644
> --- a/arch/riscv/lib/andes_plic.c
> +++ b/arch/riscv/lib/andes_plic.c
> @@ -30,20 +30,6 @@
>  #define SEND_IPI_TO_HART(hart)  (0x80 >> (hart))
>
>  DECLARE_GLOBAL_DATA_PTR;
> -static int init_plic(void);
> -
> -#define PLIC_BASE_GET(void)\
> -   do {\
> -   long *ret;  \
> -   \
> -   if (!gd->arch.plic) {   \
> -   ret = syscon_get_first_range(RISCV_SYSCON_PLIC); \
> -   if (IS_ERR(ret))\
> -   return PTR_ERR(ret);\
> -   gd->arch.plic = ret;\
> -   init_plic();\
> -   }   \
> -   } while (0)
>
>  static int enable_ipi(int hart)
>  {
> @@ -93,13 +79,21 @@ static int init_plic(void)
> return -ENODEV;
>  }
>
> +int riscv_init_ipi(void)
> +{
> +   long *ret = syscon_get_first_range(RISCV_SYSCON_PLIC);
> +
> +   if (IS_ERR(ret))
> +   return PTR_ERR(ret);
> +   gd->arch.plic = ret;
> +
> +   return init_plic();
> +}
> +
>  int riscv_send_ipi(int hart)
>  {
> -   unsigned int ipi;
> +   unsigned int ipi = (SEND_IPI_TO_HART(hart) << (8 * 
> gd->arch.boot_hart));
>
> -   PLIC_BASE_GET();
> -
> -   ipi = (SEND_IPI_TO_HART(hart) << (8 * gd->arch.boot_hart));
> writel(ipi, (void __iomem *)PENDING_REG(gd->ar

Re: [PATCH 12/36] bdinfo: riscv: Use the generic bd command

2020-05-04 Thread Rick Chen
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Simon Glass
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Bin Meng; Heiko Schocher
> Subject: [PATCH 12/36] bdinfo: riscv: Use the generic bd command
>
> This arch has none of its own info to show. Move it over to use the generic 
> do_bdinfo().
>
> Signed-off-by: Simon Glass 
> ---
>

Reviewed-by: Rick Chen 

>  cmd/bdinfo.c | 15 +--
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 6a2bbfb348..0e96dd619c 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -341,20 +341,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int 
> argc,
>
>  #elif defined(CONFIG_RISCV)
>
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
> -   bd_t *bd = gd->bd;
> -
> -   print_bi_boot_params(bd);
> -   print_bi_dram(bd);
> -   print_num("relocaddr", gd->relocaddr);
> -   print_num("reloc off", gd->reloc_off);
> -   print_eth_ip_addr();
> -   print_baudrate();
> -   print_cpu_word_size();
> -
> -   return 0;
> -}
> +#define USE_GENERIC
>
>  #elif defined(CONFIG_ARC)
>
> --
> 2.26.2.526.g744177e7f7-goog


Re: [PATCH 11/36] bdinfo: nds32: Use the generic bd command

2020-05-04 Thread Rick Chen
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Simon Glass
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Bin Meng; Heiko Schocher; Macpaul Lin
> Subject: [PATCH 11/36] bdinfo: nds32: Use the generic bd command
>
> This arch has none of its own info to show. Move it over to use the generic 
> do_bdinfo().
>
> Signed-off-by: Simon Glass 
> ---
>

Reviewed-by: Rick Chen 

>  cmd/bdinfo.c | 14 +-
>  1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index dce24b43fa..6a2bbfb348 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -337,19 +337,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int 
> argc,
>
>  #elif defined(CONFIG_NDS32)
>
> -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{
> -   bd_t *bd = gd->bd;
> -
> -   print_num("arch_number",bd->bi_arch_number);
> -   print_bi_boot_params(bd);
> -   print_bi_dram(bd);
> -   print_eth_ip_addr();
> -   print_baudrate();
> -   print_cpu_word_size();
> -
> -   return 0;
> -}
> +#define USE_GENERIC
>
>  #elif defined(CONFIG_RISCV)
>
> --
> 2.26.2.526.g744177e7f7-goog


Re: [PATCH 02/36] bdinfo: riscv: Use generic bd_info

2020-05-04 Thread Rick Chen
> From: Simon Glass [mailto:s...@chromium.org]
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Joe Hershberger; Rick Jian-Zhi Chen(陳建志)
> Subject: [PATCH 02/36] bdinfo: riscv: Use generic bd_info
>
> At present riscv still uses its own private bd_info struct. Move it over to 
> use the generic one like other archs.
>
> Signed-off-by: Simon Glass 
> ---
>

Reviewed-by: Rick Chen 

>  arch/riscv/include/asm/u-boot.h | 19 ++-
>  1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/include/asm/u-boot.h 
> b/arch/riscv/include/asm/u-boot.h index 5ba8e77812..d5e1d5f323 100644
> --- a/arch/riscv/include/asm/u-boot.h
> +++ b/arch/riscv/include/asm/u-boot.h
> @@ -18,25 +18,10 @@
>  #ifndef _U_BOOT_H_
>  #define _U_BOOT_H_ 1
>
> +/* Use the generic board which requires a unified bd_info */ #include
> +
>  #include 
>
> -
> -typedef struct bd_info {
> -   unsigned long   bi_boot_params; /* where this board expects params */
> -   unsigned long   bi_memstart;/* start of DRAM memory */
> -   unsigned long   bi_memsize; /* size  of DRAM memory in bytes */
> -   unsigned long   bi_flashstart;  /* start of FLASH memory */
> -   unsigned long   bi_flashsize;   /* size  of FLASH memory */
> -   unsigned long   bi_flashoffset; /* reserved area for startup monitor 
> */
> -   unsigned char   bi_enetaddr[6];
> -
> -   struct  /* RAM configuration */
> -   {
> -   unsigned long start;
> -   unsigned long size;
> -   } bi_dram[CONFIG_NR_DRAM_BANKS];
> -} bd_t;
> -
>  /* For image.h:image_check_target_arch() */  #define IH_ARCH_DEFAULT 
> IH_ARCH_RISCV
>
> --


Re: [PATCH 01/36] bdinfo: nds32: Use generic bd_info

2020-05-04 Thread Rick Chen
> From: Simon Glass [mailto:s...@chromium.org]
> Sent: Tuesday, May 05, 2020 7:17 AM
> To: U-Boot Mailing List
> Cc: Tom Rini; Simon Glass; Joe Hershberger; Macpaul Lin; Rick Jian-Zhi 
> Chen(陳建志)
> Subject: [PATCH 01/36] bdinfo: nds32: Use generic bd_info
>
> At present nds32 still uses its own private bd_info struct. Move it over to 
> use the generic one like other archs.
>
> Signed-off-by: Simon Glass 
> ---
>

Reviewed-by: Rick Chen 

>  arch/nds32/include/asm/u-boot.h | 20 ++--
>  1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/arch/nds32/include/asm/u-boot.h 
> b/arch/nds32/include/asm/u-boot.h index 8c949e7fb7..7b6e905f2a 100644
> --- a/arch/nds32/include/asm/u-boot.h
> +++ b/arch/nds32/include/asm/u-boot.h
> @@ -19,26 +19,10 @@
>  #ifndef _U_BOOT_H_
>  #define _U_BOOT_H_ 1
>
> +/* Use the generic board which requires a unified bd_info */ #include
> +
>  #include 
>
> -
> -typedef struct bd_info {
> -   unsigned long   bi_arch_number; /* unique id for this board */
> -   unsigned long   bi_boot_params; /* where this board expects params */
> -   unsigned long   bi_memstart;/* start of DRAM memory */
> -   unsigned long   bi_memsize; /* size  of DRAM memory in bytes */
> -   unsigned long   bi_flashstart;  /* start of FLASH memory */
> -   unsigned long   bi_flashsize;   /* size  of FLASH memory */
> -   unsigned long   bi_flashoffset; /* reserved area for startup monitor 
> */
> -   unsigned char   bi_enetaddr[6];
> -
> -   struct  /* RAM configuration */
> -   {
> -   unsigned long start;
> -   unsigned long size;
> -   } bi_dram[CONFIG_NR_DRAM_BANKS];
> -} bd_t;
> -
>  /* For image.h:image_check_target_arch() */  #define IH_ARCH_DEFAULT 
> IH_ARCH_NDS32
>
> --
> 2.26.2.526.g744177e7f7-goog


[PATCH 36/36] bdinfo: x86: vesa: Update fb_base to the correct value

2020-05-04 Thread Simon Glass
Set this value in global_data so that it is reported correctly on x86
boards.

In fact, space is allocated for the frame buffer even though it is not
used. The FSP picks the address itself, which is why the current value
is wrong.

Signed-off-by: Simon Glass 
---

 arch/x86/lib/fsp/fsp_graphics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index 98b762209f..46fb907dc3 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -96,6 +96,7 @@ static int fsp_video_probe(struct udevice *dev)
 * For IGD, it seems to be always on BAR2.
 */
vesa->phys_base_ptr = dm_pci_read_bar32(dev, 2);
+   gd->fb_base = vesa->phys_base_ptr;
 
ret = vbe_setup_video_priv(vesa, uc_priv, plat);
if (ret)
@@ -104,8 +105,8 @@ static int fsp_video_probe(struct udevice *dev)
mtrr_add_request(MTRR_TYPE_WRCOMB, vesa->phys_base_ptr, 256 << 20);
mtrr_commit(true);
 
-   printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
-  vesa->bits_per_pixel);
+   printf("%dx%dx%d @ %x\n", uc_priv->xsize, uc_priv->ysize,
+  vesa->bits_per_pixel, vesa->phys_base_ptr);
 
return 0;
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 35/36] bdinfo: dm: Update fb_base when using driver model

2020-05-04 Thread Simon Glass
Update this value with the address of a video device so that it shows with
the 'bd' command.

It would be better to obtain the address from the uclass by looking in
struct video_uc_platdata for each device. We can move over to that once
DM_VIDEO migration is complete.

Signed-off-by: Simon Glass 
---

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

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 3d658e61d7..e7229cefaf 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -82,6 +82,7 @@ int video_reserve(ulong *addrp)
  __func__, size, *addrp, dev->name);
}
gd->video_bottom = *addrp;
+   gd->fb_base = *addrp;
debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
  gd->video_top);
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 31/36] bdinfo: ppc: Move PPC-specific info into its own file

2020-05-04 Thread Simon Glass
We don't really want to have PPC-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

Signed-off-by: Simon Glass 
---

 arch/powerpc/lib/Makefile |  2 ++
 arch/powerpc/lib/bdinfo.c | 41 +++
 cmd/bdinfo.c  | 27 --
 3 files changed, 43 insertions(+), 27 deletions(-)
 create mode 100644 arch/powerpc/lib/bdinfo.c

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 01c9dd51be..f61809ab05 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -15,6 +15,8 @@ MINIMAL=y
 endif
 endif
 
+obj-y  += bdinfo.o
+
 ifdef MINIMAL
 obj-y += cache.o time.o
 ifndef CONFIG_TIMER
diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
new file mode 100644
index 00..da09bb276f
--- /dev/null
+++ b/arch/powerpc/lib/bdinfo.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PPC-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void __weak board_detail(void)
+{
+   /* Please define board_detail() for your PPC platform */
+}
+
+void arch_print_bdinfo(void)
+{
+   bd_t *bd = gd->bd;
+
+#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
+   bdinfo_print_num("immr_base", bd->bi_immr_base);
+#endif
+   bdinfo_print_num("bootflags", bd->bi_bootflags);
+   bdinfo_print_mhz("intfreq", bd->bi_intfreq);
+#ifdef CONFIG_ENABLE_36BIT_PHYS
+   if (IS_ENABLED(CONFIG_PHYS_64BIT))
+   puts("addressing  = 36-bit\n");
+   else
+   puts("addressing  = 32-bit\n");
+#endif
+   board_detail();
+#if defined(CONFIG_CPM2)
+   bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
+   bdinfo_print_mhz("vco", bd->bi_vco);
+   bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
+   bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 55a9244aef..570022052c 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -60,11 +60,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-void __weak board_detail(void)
-{
-   /* Please define board_detail() for your PPC platform */
-}
-
 __weak void arch_print_bdinfo(void)
 {
 }
@@ -103,28 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
arch_print_bdinfo();
 
-   /* This section is used only by ppc */
-#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
-   bdinfo_print_num("immr_base", bd->bi_immr_base);
-#endif
-   if (IS_ENABLED(CONFIG_PPC)) {
-   bdinfo_print_num("bootflags", bd->bi_bootflags);
-   bdinfo_print_mhz("intfreq", bd->bi_intfreq);
-#ifdef CONFIG_ENABLE_36BIT_PHYS
-   if (IS_ENABLED(CONFIG_PHYS_64BIT))
-   puts("addressing  = 36-bit\n");
-   else
-   puts("addressing  = 32-bit\n");
-#endif
-   board_detail();
-   }
-#if defined(CONFIG_CPM2)
-   bdinfo_print_mhz("cpmfreq", bd->bi_cpmfreq);
-   bdinfo_print_mhz("vco", bd->bi_vco);
-   bdinfo_print_mhz("sccfreq", bd->bi_sccfreq);
-   bdinfo_print_mhz("brgfreq", bd->bi_brgfreq);
-#endif
-
/* This is used by m68k and ppc */
 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 33/36] bdinfo: m68k: ppc: Move arch-specific code from bdinfo

2020-05-04 Thread Simon Glass
We don't have an easy way to share these three lines of code with two
architectures. We also want to make it clear that this code is actually
arch-specific.

So just duplicate it in each arch-specific file.

Signed-off-by: Simon Glass 
---

 arch/m68k/lib/bdinfo.c| 5 +
 arch/powerpc/lib/bdinfo.c | 5 +
 cmd/bdinfo.c  | 8 
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
index 09a1abfc21..971c47c306 100644
--- a/arch/m68k/lib/bdinfo.c
+++ b/arch/m68k/lib/bdinfo.c
@@ -15,6 +15,11 @@ void arch_print_bdinfo(void)
 {
bd_t *bd = gd->bd;
 
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+   bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+   bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+   bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_SYS_MBAR)
bdinfo_print_num("mbar", bd->bi_mbar_base);
 #endif
diff --git a/arch/powerpc/lib/bdinfo.c b/arch/powerpc/lib/bdinfo.c
index da09bb276f..d8c64155f0 100644
--- a/arch/powerpc/lib/bdinfo.c
+++ b/arch/powerpc/lib/bdinfo.c
@@ -20,6 +20,11 @@ void arch_print_bdinfo(void)
 {
bd_t *bd = gd->bd;
 
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
+   bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
+   bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
+#endif
+   bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
bdinfo_print_num("immr_base", bd->bi_immr_base);
 #endif
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f0afdb153f..aea7cf904a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -98,14 +98,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
arch_print_bdinfo();
 
-   /* This is used by m68k and ppc */
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-   bdinfo_print_num("sramstart", (ulong)bd->bi_sramstart);
-   bdinfo_print_num("sramsize", (ulong)bd->bi_sramsize);
-#endif
-   if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
-   bdinfo_print_mhz("busfreq", bd->bi_busfreq);
-
return 0;
 }
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 32/36] bdinfo: m68k: Move m68k-specific info into its own file

2020-05-04 Thread Simon Glass
We don't really want to have m68k-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

Signed-off-by: Simon Glass 
---

 arch/m68k/lib/Makefile |  1 +
 arch/m68k/lib/bdinfo.c | 29 +
 cmd/bdinfo.c   | 15 ---
 3 files changed, 30 insertions(+), 15 deletions(-)
 create mode 100644 arch/m68k/lib/bdinfo.c

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index a040f40eb8..b66d66afd2 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -7,6 +7,7 @@
 ## if the user asked for it
 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o
 
+obj-y  += bdinfo.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y  += cache.o
 obj-y  += interrupts.o
diff --git a/arch/m68k/lib/bdinfo.c b/arch/m68k/lib/bdinfo.c
new file mode 100644
index 00..09a1abfc21
--- /dev/null
+++ b/arch/m68k/lib/bdinfo.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PPC-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+   bd_t *bd = gd->bd;
+
+#if defined(CONFIG_SYS_MBAR)
+   bdinfo_print_num("mbar", bd->bi_mbar_base);
+#endif
+   bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
+   if (IS_ENABLED(CONFIG_PCI))
+   bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
+#ifdef CONFIG_EXTRA_CLOCK
+   bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
+   bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
+   bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 570022052c..f0afdb153f 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -106,21 +106,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_M68K))
bdinfo_print_mhz("busfreq", bd->bi_busfreq);
 
-   /* The rest are used only by m68k */
-#ifdef CONFIG_M68K
-#if defined(CONFIG_SYS_MBAR)
-   bdinfo_print_num("mbar", bd->bi_mbar_base);
-#endif
-   bdinfo_print_mhz("cpufreq", bd->bi_intfreq);
-   if (IS_ENABLED(CONFIG_PCI))
-   bdinfo_print_mhz("pcifreq", bd->bi_pcifreq);
-#ifdef CONFIG_EXTRA_CLOCK
-   bdinfo_print_mhz("flbfreq", bd->bi_flbfreq);
-   bdinfo_print_mhz("inpfreq", bd->bi_inpfreq);
-   bdinfo_print_mhz("vcofreq", bd->bi_vcofreq);
-#endif
-#endif
-
return 0;
 }
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 30/36] bdinfo: arm: Move ARM-specific info into its own file

2020-05-04 Thread Simon Glass
We don't really want to have ARM-specific code in a generic file. Create
a new arch-specific function to hold it, and move it into that.

Make the function weak so that any arch can implement it.

Signed-off-by: Simon Glass 
---

 arch/arm/lib/Makefile |  1 +
 arch/arm/lib/bdinfo.c | 51 +++
 cmd/bdinfo.c  | 44 +
 include/init.h|  3 +++
 4 files changed, 61 insertions(+), 38 deletions(-)
 create mode 100644 arch/arm/lib/bdinfo.c

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index b839aa7a50..27b12e7f2b 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
 obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
 obj-$(CONFIG_SEMIHOSTING) += semihosting.o
 
+obj-y  += bdinfo.o
 obj-y  += sections.o
 obj-y  += stack.o
 ifdef CONFIG_CPU_V7M
diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
new file mode 100644
index 00..ce8edd0313
--- /dev/null
+++ b/arch/arm/lib/bdinfo.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * ARM-specific information for the 'bd' command
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+   if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
+   bdinfo_print_num("Secure ram",
+gd->arch.secure_ram &
+MEM_RESERVE_SECURE_ADDR_MASK);
+   }
+#endif
+#ifdef CONFIG_RESV_RAM
+   if (gd->arch.resv_ram)
+   bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
+#endif
+#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+   bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
+#endif
+   bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
+   bdinfo_print_num("sp start ", gd->start_addr_sp);
+   /*
+* TODO: Currently only support for davinci SOC's is added.
+* Remove this check once all the board implement this.
+*/
+#ifdef CONFIG_CLOCKS
+   printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
+   printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
+   printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
+#endif
+#ifdef CONFIG_BOARD_TYPES
+   printf("Board Type  = %ld\n", gd->board_type);
+#endif
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+   printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
+  CONFIG_VAL(SYS_MALLOC_F_LEN));
+#endif
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+   bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
+#endif
+}
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index c6096a5fd3..55a9244aef 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -65,6 +65,10 @@ void __weak board_detail(void)
/* Please define board_detail() for your PPC platform */
 }
 
+__weak void arch_print_bdinfo(void)
+{
+}
+
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
bd_t *bd = gd->bd;
@@ -97,43 +101,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
bdinfo_print_num("FB base  ", gd->fb_base);
 #endif
 
-   /* This section is used only by ARM */
-#ifdef CONFIG_ARM
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-   if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-   bdinfo_print_num("Secure ram",
- gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
-   }
-#endif
-#ifdef CONFIG_RESV_RAM
-   if (gd->arch.resv_ram)
-   bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
-#endif
-#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-   bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
-#endif
-   bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
-   bdinfo_print_num("sp start ", gd->start_addr_sp);
-   /*
-* TODO: Currently only support for davinci SOC's is added.
-* Remove this check once all the board implement this.
-*/
-#ifdef CONFIG_CLOCKS
-   printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
-   printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
-   printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
-#endif
-#ifdef CONFIG_BOARD_TYPES
-   printf("Board Type  = %ld\n", gd->board_type);
-#endif
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
-   printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
-  CONFIG_VAL(SYS_MALLOC_F_LEN));
-#endif
-#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
-   bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
-#endif
-#endif /* CONFIG_ARM */
+   arch_print_bdinfo();
 
/* This section is used only by ppc */
 #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500)
@@ -168,7 +136,7 @@ int do_bdinfo(cmd_tbl_

[PATCH 29/36] bdinfo: Export some basic printing functions

2020-05-04 Thread Simon Glass
At present the functions to print a number and a frequency are static. We
want to move some of the code in here to an arch-specific file. For
consistency that code should use these same functions. So export them with
an appropriate name.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c   | 78 +-
 include/init.h |  6 
 2 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index e30d530411..c6096a5fd3 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,7 +15,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static void print_num(const char *name, ulong value)
+void bdinfo_print_num(const char *name, ulong value)
 {
printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
 }
@@ -38,7 +38,7 @@ static void print_lnum(const char *name, unsigned long long 
value)
printf("%-12s= 0x%.8llX\n", name, value);
 }
 
-static void print_mhz(const char *name, unsigned long hz)
+void bdinfo_print_mhz(const char *name, unsigned long hz)
 {
char buf[32];
 
@@ -52,9 +52,9 @@ static void print_bi_dram(const bd_t *bd)
 
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
if (bd->bi_dram[i].size) {
-   print_num("DRAM bank",  i);
-   print_num("-> start",   bd->bi_dram[i].start);
-   print_num("-> size",bd->bi_dram[i].size);
+   bdinfo_print_num("DRAM bank",   i);
+   bdinfo_print_num("-> start",bd->bi_dram[i].start);
+   bdinfo_print_num("-> size", bd->bi_dram[i].size);
}
}
 #endif
@@ -70,50 +70,50 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
bd_t *bd = gd->bd;
 
 #ifdef DEBUG
-   print_num("bd address", (ulong)bd);
+   bdinfo_print_num("bd address", (ulong)bd);
 #endif
if (IS_ENABLED(CONFIG_ARM))
-   print_num("arch_number", bd->bi_arch_number);
-   print_num("boot_params", (ulong)bd->bi_boot_params);
+   bdinfo_print_num("arch_number", bd->bi_arch_number);
+   bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params);
print_bi_dram(bd);
-   print_num("memstart", (ulong)bd->bi_memstart);
+   bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
print_lnum("memsize", (u64)bd->bi_memsize);
-   print_num("flashstart", (ulong)bd->bi_flashstart);
-   print_num("flashsize", (ulong)bd->bi_flashsize);
-   print_num("flashoffset", (ulong)bd->bi_flashoffset);
+   bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart);
+   bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize);
+   bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset);
printf("baudrate= %u bps\n", gd->baudrate);
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
+   bdinfo_print_num("relocaddr", gd->relocaddr);
+   bdinfo_print_num("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
if (IS_ENABLED(CONFIG_CMD_NET)) {
printf("current eth = %s\n", eth_get_name());
print_eth(0);
printf("IP addr = %s\n", env_get("ipaddr"));
}
-   print_num("fdt_blob", (ulong)gd->fdt_blob);
-   print_num("new_fdt", (ulong)gd->new_fdt);
-   print_num("fdt_size", (ulong)gd->fdt_size);
+   bdinfo_print_num("fdt_blob", (ulong)gd->fdt_blob);
+   bdinfo_print_num("new_fdt", (ulong)gd->new_fdt);
+   bdinfo_print_num("fdt_size", (ulong)gd->fdt_size);
 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
-   print_num("FB base  ", gd->fb_base);
+   bdinfo_print_num("FB base  ", gd->fb_base);
 #endif
 
/* This section is used only by ARM */
 #ifdef CONFIG_ARM
 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-   print_num("Secure ram",
+   bdinfo_print_num("Secure ram",
  gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
}
 #endif
 #ifdef CONFIG_RESV_RAM
if (gd->arch.resv_ram)
-   print_num("Reserved ram", gd->arch.resv_ram);
+   bdinfo_print_num("Reserved ram", gd->arch.resv_ram);
 #endif
 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-   print_num("TLB addr", gd->arch.tlb_addr);
+   bdinfo_print_num("TLB addr", gd->arch.tlb_addr);
 #endif
-   print_num("irq_sp", gd->irq_sp);/* irq stack pointer */
-   print_num("sp start ", gd->start_addr_sp);
+   bdinfo_print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
+   bdinfo_print_num("sp start ", gd->start_addr_sp);
/*
 * TODO: Currently only support for davinci SOC's is added.
 * Remove this check once all the board implement this.
@@ -131,17 +131,17 @@ int do_bdinfo(cmd_tbl

[PATCH 34/36] bdinfo: Update the file comments

2020-05-04 Thread Simon Glass
Update the comment at the top of the file to indicate what this file does.
Also drop the line at the bottom and an unnecessary header include.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index aea7cf904a..8c498d4290 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -1,17 +1,15 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Implements the 'bd' command to show board information
+ *
  * (C) Copyright 2003
  * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
  */
 
-/*
- * Boot support
- */
 #include 
 #include 
 #include 
 #include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -101,8 +99,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return 0;
 }
 
-/*  */
-
 U_BOOT_CMD(
bdinfo, 1,  1,  do_bdinfo,
"print Board Info structure",
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 25/36] bdinfo: net: ppc: Drop prints for CONFIG_HAS_ETHn

2020-05-04 Thread Simon Glass
These config options have not been migrated to Kconfig. This should be
handled using driver model, iterating over the available Ethernet devices.
For now, remove the code.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index d0afef5b5e..6fa8b32389 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -86,21 +86,6 @@ static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-   print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-   print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-   print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
-   print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
-   print_eth(5);
-#endif
printf("IP addr = %s\n", env_get("ipaddr"));
 #endif
 }
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 24/36] bdinfo: net: ppc: Drop bi_enet1addr and other similar info

2020-05-04 Thread Simon Glass
These values were 'old' in 2013 so it should be safe to remove them. They
are never set in U-Boot anyway, so the values will always be zero.

Signed-off-by: Simon Glass 
---

 common/board_r.c | 16 +---
 include/asm-generic/u-boot.h | 17 -
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index d9015cd057..4876afba6b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -525,21 +525,7 @@ static int initr_ethaddr(void)
 
/* kept around for legacy kernels only ... ignore the next section */
eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
-#ifdef CONFIG_HAS_ETH1
-   eth_env_get_enetaddr("eth1addr", bd->bi_enet1addr);
-#endif
-#ifdef CONFIG_HAS_ETH2
-   eth_env_get_enetaddr("eth2addr", bd->bi_enet2addr);
-#endif
-#ifdef CONFIG_HAS_ETH3
-   eth_env_get_enetaddr("eth3addr", bd->bi_enet3addr);
-#endif
-#ifdef CONFIG_HAS_ETH4
-   eth_env_get_enetaddr("eth4addr", bd->bi_enet4addr);
-#endif
-#ifdef CONFIG_HAS_ETH5
-   eth_env_get_enetaddr("eth5addr", bd->bi_enet5addr);
-#endif
+
return 0;
 }
 #endif /* CONFIG_CMD_NET */
diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index be0014c3b3..0ec4522653 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -67,23 +67,6 @@ typedef struct bd_info {
unsigned long bi_vcofreq;   /* vco Freq in MHz */
unsigned long bi_flbfreq;   /* Flexbus Freq in MHz */
 #endif
-
-#ifdef CONFIG_HAS_ETH1
-   unsigned char   bi_enet1addr[6];/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH2
-   unsigned char   bi_enet2addr[6];/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH3
-   unsigned char   bi_enet3addr[6];/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH4
-   unsigned char   bi_enet4addr[6];/* OLD: see README.enetaddr */
-#endif
-#ifdef CONFIG_HAS_ETH5
-   unsigned char   bi_enet5addr[6];/* OLD: see README.enetaddr */
-#endif
-
ulong   bi_arch_number; /* unique id for this board */
ulong   bi_boot_params; /* where this board expects params */
 #ifdef CONFIG_NR_DRAM_BANKS
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 28/36] bdinfo: net: Inline print_eth_ip_addr()

2020-05-04 Thread Simon Glass
This function only has two lines of code now, so inline it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index e6237daf93..e30d530411 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -20,7 +20,6 @@ static void print_num(const char *name, ulong value)
printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
 }
 
-__maybe_unused
 static void print_eth(int idx)
 {
char name[10], *val;
@@ -61,14 +60,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static void print_eth_ip_addr(void)
-{
-#if defined(CONFIG_CMD_NET)
-   print_eth(0);
-   printf("IP addr = %s\n", env_get("ipaddr"));
-#endif
-}
-
 void __weak board_detail(void)
 {
/* Please define board_detail() for your PPC platform */
@@ -90,13 +81,15 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_num("flashstart", (ulong)bd->bi_flashstart);
print_num("flashsize", (ulong)bd->bi_flashsize);
print_num("flashoffset", (ulong)bd->bi_flashoffset);
-   print_eth_ip_addr();
printf("baudrate= %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-   if (IS_ENABLED(CONFIG_CMD_NET))
+   if (IS_ENABLED(CONFIG_CMD_NET)) {
printf("current eth = %s\n", eth_get_name());
+   print_eth(0);
+   printf("IP addr = %s\n", env_get("ipaddr"));
+   }
print_num("fdt_blob", (ulong)gd->fdt_blob);
print_num("new_fdt", (ulong)gd->new_fdt);
print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 26/36] bdinfo: net: Drop legacy ethernet bdinfo

2020-05-04 Thread Simon Glass
This code pre-dates driver model and the migration date is nearly upon us.
Pare the print_eths() function down and enable it for driver model, since
it works correctly.

The IP address is already printed in print_eth_ip_addr() so we can remove
that.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 21 ++---
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6fa8b32389..ba69575fc2 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -34,26 +34,10 @@ static void print_eth(int idx)
printf("%-12s= %s\n", name, val);
 }
 
-#ifndef CONFIG_DM_ETH
-__maybe_unused
 static void print_eths(void)
 {
-   struct eth_device *dev;
-   int i = 0;
-
-   do {
-   dev = eth_get_dev_by_index(i);
-   if (dev) {
-   printf("eth%dname= %s\n", i, dev->name);
-   print_eth(i);
-   i++;
-   }
-   } while (dev);
-
printf("current eth = %s\n", eth_get_name());
-   printf("ip_addr = %s\n", env_get("ipaddr"));
 }
-#endif
 
 static void print_lnum(const char *name, unsigned long long value)
 {
@@ -116,9 +100,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-   print_eths();
-#endif
+   if (IS_ENABLED(CONFIG_CMD_NET))
+   print_eths();
print_num("fdt_blob", (ulong)gd->fdt_blob);
print_num("new_fdt", (ulong)gd->new_fdt);
print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 27/36] bdinfo: net: Inline print_eths()

2020-05-04 Thread Simon Glass
This function has only one line of code so inline it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index ba69575fc2..e6237daf93 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -34,11 +34,6 @@ static void print_eth(int idx)
printf("%-12s= %s\n", name, val);
 }
 
-static void print_eths(void)
-{
-   printf("current eth = %s\n", eth_get_name());
-}
-
 static void print_lnum(const char *name, unsigned long long value)
 {
printf("%-12s= 0x%.8llX\n", name, value);
@@ -101,7 +96,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_num("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
if (IS_ENABLED(CONFIG_CMD_NET))
-   print_eths();
+   printf("current eth = %s\n", eth_get_name());
print_num("fdt_blob", (ulong)gd->fdt_blob);
print_num("new_fdt", (ulong)gd->new_fdt);
print_num("fdt_size", (ulong)gd->fdt_size);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 23/36] bdinfo: Drop print_cpu_word_size()

2020-05-04 Thread Simon Glass
This function only has one line of code in it so inline it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f22dc7a129..d0afef5b5e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,11 +15,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void print_cpu_word_size(void)
-{
-   printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
-}
-
 static void print_num(const char *name, ulong value)
 {
printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
@@ -135,7 +130,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
printf("baudrate= %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
-   print_cpu_word_size();
+   printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
print_eths();
 #endif
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 22/36] bdinfo: Drop print_bi_flash()

2020-05-04 Thread Simon Glass
This function only has three lines of code in it so inline it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index b65eec332d..f22dc7a129 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -87,13 +87,6 @@ static void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static void print_bi_flash(const bd_t *bd)
-{
-   print_num("flashstart", (ulong)bd->bi_flashstart);
-   print_num("flashsize", (ulong)bd->bi_flashsize);
-   print_num("flashoffset", (ulong)bd->bi_flashoffset);
-}
-
 static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
@@ -135,7 +128,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_bi_dram(bd);
print_num("memstart", (ulong)bd->bi_memstart);
print_lnum("memsize", (u64)bd->bi_memsize);
-   print_bi_flash(bd);
+   print_num("flashstart", (ulong)bd->bi_flashstart);
+   print_num("flashsize", (ulong)bd->bi_flashsize);
+   print_num("flashoffset", (ulong)bd->bi_flashoffset);
print_eth_ip_addr();
printf("baudrate= %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 18/36] bdinfo: Drop print_std_bdinfo()

2020-05-04 Thread Simon Glass
Everything in this function is standard now so it serves no purpose. Move
it into the generic do_bdinfo() function.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6e5b3d997d..4e08d9e40a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -146,15 +146,6 @@ static void print_baudrate(void)
 #endif
 }
 
-static void print_std_bdinfo(const bd_t *bd)
-{
-   print_bi_boot_params(bd);
-   print_bi_mem(bd);
-   print_bi_flash(bd);
-   print_eth_ip_addr();
-   print_baudrate();
-}
-
 void __weak board_detail(void)
 {
/* Please define board_detail() for your PPC platform */
@@ -169,7 +160,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 #endif
if (IS_ENABLED(CONFIG_ARM))
print_num("arch_number", bd->bi_arch_number);
+   print_bi_boot_params(bd);
print_bi_dram(bd);
+   print_bi_mem(bd);
+   print_bi_flash(bd);
+   print_eth_ip_addr();
+   print_baudrate();
print_std_bdinfo(bd);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 21/36] bdinfo: Drop print_bi_boot_params()

2020-05-04 Thread Simon Glass
This function only has one line of code in it so inline it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 5ffd86e508..b65eec332d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -72,12 +72,6 @@ static void print_mhz(const char *name, unsigned long hz)
printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
 }
 
-
-static void print_bi_boot_params(const bd_t *bd)
-{
-   print_num("boot_params",(ulong)bd->bi_boot_params);
-}
-
 static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
@@ -137,7 +131,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 #endif
if (IS_ENABLED(CONFIG_ARM))
print_num("arch_number", bd->bi_arch_number);
-   print_bi_boot_params(bd);
+   print_num("boot_params", (ulong)bd->bi_boot_params);
print_bi_dram(bd);
print_num("memstart", (ulong)bd->bi_memstart);
print_lnum("memsize", (u64)bd->bi_memsize);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 20/36] bdinfo: sh: arc: Drop arch-specific print_bi_mem()

2020-05-04 Thread Simon Glass
It isn't worth having arch-specific code for such minor output
differences. In fact it is better if all archs are consistent.

Drop the arch-specific code in print_bi_mem() and inline it to avoid a
two-line function.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 62eea010c5..5ffd86e508 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -78,20 +78,6 @@ static void print_bi_boot_params(const bd_t *bd)
print_num("boot_params",(ulong)bd->bi_boot_params);
 }
 
-static void print_bi_mem(const bd_t *bd)
-{
-#if defined(CONFIG_SH)
-   print_num("mem start  ",(ulong)bd->bi_memstart);
-   print_lnum("mem size   ",   (u64)bd->bi_memsize);
-#elif defined(CONFIG_ARC)
-   print_num("mem start",  (ulong)bd->bi_memstart);
-   print_lnum("mem size",  (u64)bd->bi_memsize);
-#else
-   print_num("memstart",   (ulong)bd->bi_memstart);
-   print_lnum("memsize",   (u64)bd->bi_memsize);
-#endif
-}
-
 static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
@@ -153,7 +139,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_num("arch_number", bd->bi_arch_number);
print_bi_boot_params(bd);
print_bi_dram(bd);
-   print_bi_mem(bd);
+   print_num("memstart", (ulong)bd->bi_memstart);
+   print_lnum("memsize", (u64)bd->bi_memsize);
print_bi_flash(bd);
print_eth_ip_addr();
printf("baudrate= %u bps\n", gd->baudrate);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 19/36] bdinfo: ppc: Drop arch-specific print_baudrate()

2020-05-04 Thread Simon Glass
This function outputs the same basic info. Since the baud rate is commonly
115200 these is often no difference. Drop the arch-specific code and
inline it to avoid a one-line function.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 4e08d9e40a..62eea010c5 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -137,15 +137,6 @@ static void print_eth_ip_addr(void)
 #endif
 }
 
-static void print_baudrate(void)
-{
-#if defined(CONFIG_PPC)
-   printf("baudrate= %6u bps\n", gd->baudrate);
-#else
-   printf("baudrate= %u bps\n", gd->baudrate);
-#endif
-}
-
 void __weak board_detail(void)
 {
/* Please define board_detail() for your PPC platform */
@@ -165,8 +156,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_bi_mem(bd);
print_bi_flash(bd);
print_eth_ip_addr();
-   print_baudrate();
-   print_std_bdinfo(bd);
+   printf("baudrate= %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
print_cpu_word_size();
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 17/36] bdinfo: Drop unnecessary inline on functions

2020-05-04 Thread Simon Glass
This serves no purpose since the compiler will inline the functions
automatically. Drop use of inline in this file.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 3d16f4cc1a..6e5b3d997d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -60,7 +60,6 @@ static void print_eths(void)
 }
 #endif
 
-__maybe_unused
 static void print_lnum(const char *name, unsigned long long value)
 {
printf("%-12s= 0x%.8llX\n", name, value);
@@ -74,12 +73,12 @@ static void print_mhz(const char *name, unsigned long hz)
 }
 
 
-static inline void print_bi_boot_params(const bd_t *bd)
+static void print_bi_boot_params(const bd_t *bd)
 {
print_num("boot_params",(ulong)bd->bi_boot_params);
 }
 
-static inline void print_bi_mem(const bd_t *bd)
+static void print_bi_mem(const bd_t *bd)
 {
 #if defined(CONFIG_SH)
print_num("mem start  ",(ulong)bd->bi_memstart);
@@ -93,7 +92,7 @@ static inline void print_bi_mem(const bd_t *bd)
 #endif
 }
 
-static inline void print_bi_dram(const bd_t *bd)
+static void print_bi_dram(const bd_t *bd)
 {
 #ifdef CONFIG_NR_DRAM_BANKS
int i;
@@ -108,14 +107,14 @@ static inline void print_bi_dram(const bd_t *bd)
 #endif
 }
 
-static inline void print_bi_flash(const bd_t *bd)
+static void print_bi_flash(const bd_t *bd)
 {
print_num("flashstart", (ulong)bd->bi_flashstart);
print_num("flashsize", (ulong)bd->bi_flashsize);
print_num("flashoffset", (ulong)bd->bi_flashoffset);
 }
 
-static inline void print_eth_ip_addr(void)
+static void print_eth_ip_addr(void)
 {
 #if defined(CONFIG_CMD_NET)
print_eth(0);
@@ -138,7 +137,7 @@ static inline void print_eth_ip_addr(void)
 #endif
 }
 
-static inline void print_baudrate(void)
+static void print_baudrate(void)
 {
 #if defined(CONFIG_PPC)
printf("baudrate= %6u bps\n", gd->baudrate);
@@ -147,7 +146,7 @@ static inline void print_baudrate(void)
 #endif
 }
 
-static inline void print_std_bdinfo(const bd_t *bd)
+static void print_std_bdinfo(const bd_t *bd)
 {
print_bi_boot_params(bd);
print_bi_mem(bd);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 16/36] bdinfo: microblaze: sh: nios2: Drop arch-specific flash info

2020-05-04 Thread Simon Glass
The differences these architectures have are minor and not worth the extra
code. Use the generic version always.

Tidy up the code style by removing unnecessary tabs.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 204d4c5db1..3d16f4cc1a 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -110,20 +110,9 @@ static inline void print_bi_dram(const bd_t *bd)
 
 static inline void print_bi_flash(const bd_t *bd)
 {
-#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_SH)
-   print_num("flash start",(ulong)bd->bi_flashstart);
-   print_num("flash size ",(ulong)bd->bi_flashsize);
-   print_num("flash offset   ",(ulong)bd->bi_flashoffset);
-
-#elif defined(CONFIG_NIOS2)
-   print_num("flash start",(ulong)bd->bi_flashstart);
-   print_num("flash size", (ulong)bd->bi_flashsize);
-   print_num("flash offset",   (ulong)bd->bi_flashoffset);
-#else
-   print_num("flashstart", (ulong)bd->bi_flashstart);
-   print_num("flashsize",  (ulong)bd->bi_flashsize);
-   print_num("flashoffset",(ulong)bd->bi_flashoffset);
-#endif
+   print_num("flashstart", (ulong)bd->bi_flashstart);
+   print_num("flashsize", (ulong)bd->bi_flashsize);
+   print_num("flashoffset", (ulong)bd->bi_flashoffset);
 }
 
 static inline void print_eth_ip_addr(void)
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 14/36] bdinfo: Drop the option to not use the generic 'bd' command

2020-05-04 Thread Simon Glass
Now that all architectures are using the generic do_bdinfo(), drop the
option to not use it. When new architectures are added, they will get at
least some useful information from the generic implementation.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 59 
 1 file changed, 59 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f07f92463c..13b4f2ebba 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -169,64 +169,6 @@ static inline void __maybe_unused print_std_bdinfo(const 
bd_t *bd)
print_baudrate();
 }
 
-#if defined(CONFIG_PPC)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_NIOS2)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_MICROBLAZE)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_M68K)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_MIPS)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_ARM)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_SH)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_X86)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_SANDBOX)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_NDS32)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_RISCV)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_ARC)
-
-#define USE_GENERIC
-
-#elif defined(CONFIG_XTENSA)
-
-#define USE_GENERIC
-
-#else
- #error "a case for this architecture does not exist!"
-#endif
-
-/* Temporary check for archs that use generic bdinfo. Eventually all will */
-#ifdef USE_GENERIC
 void __weak board_detail(void)
 {
/* Please define board_detail() for your PPC platform */
@@ -341,7 +283,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
return 0;
 }
-#endif
 
 /*  */
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 15/36] bdinfo: Drop unused __maybe_unused

2020-05-04 Thread Simon Glass
Some of these are not needed now. Drop them to avoid cluttering the code.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 13b4f2ebba..204d4c5db1 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,12 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__maybe_unused void print_cpu_word_size(void)
+void print_cpu_word_size(void)
 {
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
 }
 
-__maybe_unused
 static void print_num(const char *name, ulong value)
 {
printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
@@ -67,7 +66,6 @@ static void print_lnum(const char *name, unsigned long long 
value)
printf("%-12s= 0x%.8llX\n", name, value);
 }
 
-__maybe_unused
 static void print_mhz(const char *name, unsigned long hz)
 {
char buf[32];
@@ -160,7 +158,7 @@ static inline void print_baudrate(void)
 #endif
 }
 
-static inline void __maybe_unused print_std_bdinfo(const bd_t *bd)
+static inline void print_std_bdinfo(const bd_t *bd)
 {
print_bi_boot_params(bd);
print_bi_mem(bd);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 12/36] bdinfo: riscv: Use the generic bd command

2020-05-04 Thread Simon Glass
This arch has none of its own info to show. Move it over to use the
generic do_bdinfo().

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6a2bbfb348..0e96dd619c 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -341,20 +341,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_RISCV)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_boot_params(bd);
-   print_bi_dram(bd);
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
-   print_eth_ip_addr();
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_ARC)
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 11/36] bdinfo: nds32: Use the generic bd command

2020-05-04 Thread Simon Glass
This arch has none of its own info to show. Move it over to use the
generic do_bdinfo().

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dce24b43fa..6a2bbfb348 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -337,19 +337,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_NDS32)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_num("arch_number",bd->bi_arch_number);
-   print_bi_boot_params(bd);
-   print_bi_dram(bd);
-   print_eth_ip_addr();
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_RISCV)
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 13/36] bdinfo: arm: Use the generic bd command

2020-05-04 Thread Simon Glass
Unfortunately ARM has a lot of special stuff. Move it into the generic
function for now, so we can have it all in one place.

Add in the frame-buffer printout, since it supports driver model too.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 250 +--
 1 file changed, 104 insertions(+), 146 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0e96dd619c..f07f92463c 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -170,53 +170,8 @@ static inline void __maybe_unused print_std_bdinfo(const 
bd_t *bd)
 }
 
 #if defined(CONFIG_PPC)
-void __weak board_detail(void)
-{
-   /* Please define board_detail() for your platform */
-}
-
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-#ifdef DEBUG
-   print_num("bd address", (ulong)bd);
-#endif
-   print_bi_mem(bd);
-   print_bi_flash(bd);
-   print_num("sramstart",  bd->bi_sramstart);
-   print_num("sramsize",   bd->bi_sramsize);
-#ifdefined(CONFIG_MPC8xx) || defined(CONFIG_E500)
-   print_num("immr_base",  bd->bi_immr_base);
-#endif
-   print_num("bootflags",  bd->bi_bootflags);
-#if defined(CONFIG_CPM2)
-   print_mhz("vco",bd->bi_vco);
-   print_mhz("sccfreq",bd->bi_sccfreq);
-   print_mhz("brgfreq",bd->bi_brgfreq);
-#endif
-   print_mhz("intfreq",bd->bi_intfreq);
-#if defined(CONFIG_CPM2)
-   print_mhz("cpmfreq",bd->bi_cpmfreq);
-#endif
-   print_mhz("busfreq",bd->bi_busfreq);
-
-#ifdef CONFIG_ENABLE_36BIT_PHYS
-#ifdef CONFIG_PHYS_64BIT
-   puts("addressing  = 36-bit\n");
-#else
-   puts("addressing  = 32-bit\n");
-#endif
-#endif
-
-   print_eth_ip_addr();
-   print_baudrate();
-   print_num("relocaddr", gd->relocaddr);
-   board_detail();
-   print_cpu_word_size();
 
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_NIOS2)
 
@@ -228,35 +183,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
 #elif defined(CONFIG_M68K)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_mem(bd);
-   print_bi_flash(bd);
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-   print_num("sramstart",  (ulong)bd->bi_sramstart);
-   print_num("sramsize",   (ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_SYS_MBAR)
-   print_num("mbar",   bd->bi_mbar_base);
-#endif
-   print_mhz("cpufreq",bd->bi_intfreq);
-   print_mhz("busfreq",bd->bi_busfreq);
-#ifdef CONFIG_PCI
-   print_mhz("pcifreq",bd->bi_pcifreq);
-#endif
-#ifdef CONFIG_EXTRA_CLOCK
-   print_mhz("flbfreq",bd->bi_flbfreq);
-   print_mhz("inpfreq",bd->bi_inpfreq);
-   print_mhz("vcofreq",bd->bi_vcofreq);
-#endif
-   print_eth_ip_addr();
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_MIPS)
 
@@ -264,64 +191,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
 #elif defined(CONFIG_ARM)
 
-static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
-   char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_num("arch_number",bd->bi_arch_number);
-   print_bi_boot_params(bd);
-   print_bi_dram(bd);
-
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-   if (gd->arch.secure_ram & MEM_RESERVE_SECURE_SECURED) {
-   print_num("Secure ram",
- gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
-   }
-#endif
-#ifdef CONFIG_RESV_RAM
-   if (gd->arch.resv_ram)
-   print_num("Reserved ram", gd->arch.resv_ram);
-#endif
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-   print_eths();
-#endif
-   print_baudrate();
-#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
-   print_num("TLB addr", gd->arch.tlb_addr);
-#endif
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
-   print_num("irq_sp", gd->irq_sp);/* irq stack pointer */
-   print_num("sp start ", gd->start_addr_sp);
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
-   print_num("FB base  ", gd->fb_base);
-#endif
-   /*
-* TODO: Currently only support for davinci SOC's is added.
-* Remove this check once all the board implement this.
-*/
-#ifdef CONFIG_CLOCKS
-   printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
-   printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
-   printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
-#endif
-#ifdef CONFIG_BOARD_TYPES
-   printf("Board Type  = %ld\n", gd->board_type);
-#endif
-#if CONFIG_VAL(SYS_M

[PATCH 09/36] bdinfo: x86: Use the generic bd command

2020-05-04 Thread Simon Glass
This arch shows 'ethspeed' info but only the freescale drivers use it, so
it can be dropped.

It also calls print_bi_dram() which is safe to call from any arch since it
has an #ifdef inside it. Add this to the generic do_bdinfo() and move x86
over to use it. Put it first since pytests rely on seeing it before
memstart in find_ram_base().

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 21 ++---
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0b9ac21848..0b903d234e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -329,25 +329,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_X86)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_boot_params(bd);
-
-   print_bi_dram(bd);
-
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
-#if defined(CONFIG_CMD_NET)
-   print_eth_ip_addr();
-   print_mhz("ethspeed",   bd->bi_ethspeed);
-#endif
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_SANDBOX)
 
@@ -426,6 +408,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 #ifdef USE_GENERIC
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
+   print_bi_dram(gd->bd);
print_std_bdinfo(gd->bd);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 03/36] bdinfo: m68k: Drop bd_info->bi_ipbfreq

2020-05-04 Thread Simon Glass
This field is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 include/asm-generic/u-boot.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index cc94d39069..be0014c3b3 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -60,7 +60,6 @@ typedef struct bd_info {
unsigned long   bi_vco; /* VCO Out from PLL, in MHz */
 #endif
 #if defined(CONFIG_M68K)
-   unsigned long   bi_ipbfreq; /* IPB Bus Freq, in MHz */
unsigned long   bi_pcifreq; /* PCI Bus Freq, in MHz */
 #endif
 #if defined(CONFIG_EXTRA_CLOCK)
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 10/36] bdinfo: sandbox: Use the generic bd command

2020-05-04 Thread Simon Glass
Sandbox has a printout of 'FB base' but this code is not used since
sandbox uses driver model for everything.

Move sandbox over to use the generic do_bdinfo().

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 0b903d234e..dce24b43fa 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -333,21 +333,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_SANDBOX)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_boot_params(bd);
-   print_bi_dram(bd);
-   print_eth_ip_addr();
-
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
-   print_num("FB base  ", gd->fb_base);
-#endif
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_NDS32)
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 07/36] bdinfo: microblaze: Use the generic bd command

2020-05-04 Thread Simon Glass
Microblaze prints out ethernet and FDT information. This is useful to
most archs, so move it into the generic code and move microblaze over to
use it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 405a915861..dc5a09f8ce 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -224,29 +224,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
 #elif defined(CONFIG_MICROBLAZE)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_dram(bd);
-   print_bi_flash(bd);
-#if defined(CONFIG_SYS_SRAM_BASE)
-   print_num("sram start ",(ulong)bd->bi_sramstart);
-   print_num("sram size  ",(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
-   print_eths();
-#endif
-   print_baudrate();
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
-   print_num("fdt_blob", (ulong)gd->fdt_blob);
-   print_num("new_fdt", (ulong)gd->new_fdt);
-   print_num("fdt_size", (ulong)gd->fdt_size);
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_M68K)
 
@@ -463,6 +441,12 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
print_cpu_word_size();
+#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
+   print_eths();
+#endif
+   print_num("fdt_blob", (ulong)gd->fdt_blob);
+   print_num("new_fdt", (ulong)gd->new_fdt);
+   print_num("fdt_size", (ulong)gd->fdt_size);
 
return 0;
 }
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 06/36] bdinfo: nios2: Use the generic bd command

2020-05-04 Thread Simon Glass
Nios2 currently has some code to output SRAM information which is behind
an #ifdef. No nios2 boards define this option, so the code can be removed.

Move Nios2 over to use the generic function.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 19 +--
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 6ccbd2f50f..405a915861 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -220,24 +220,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
 #elif defined(CONFIG_NIOS2)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_dram(bd);
-   print_bi_flash(bd);
-
-#if defined(CONFIG_SYS_SRAM_BASE)
-   print_num ("sram start",(ulong)bd->bi_sramstart);
-   print_num ("sram size", (ulong)bd->bi_sramsize);
-#endif
-
-   print_eth_ip_addr();
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_MICROBLAZE)
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 08/36] bdinfo: sh: Use the generic bd command

2020-05-04 Thread Simon Glass
This arch has no code that is not already in the generic function. Drop
the arch-specific function and change sh over to use the generic one.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dc5a09f8ce..0b9ac21848 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -325,18 +325,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_SH)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   bd_t *bd = gd->bd;
-
-   print_bi_mem(bd);
-   print_bi_flash(bd);
-   print_eth_ip_addr();
-   print_baudrate();
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_X86)
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 05/36] bdinfo: mips: Use the generic bd command

2020-05-04 Thread Simon Glass
MIPS currently has a few extra things which are generally useful. Add them
to the generic function and move MIPS over to use it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 9247180a29..6ccbd2f50f 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -299,15 +299,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
 #elif defined(CONFIG_MIPS)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   print_std_bdinfo(gd->bd);
-   print_num("relocaddr", gd->relocaddr);
-   print_num("reloc off", gd->reloc_off);
-   print_cpu_word_size();
-
-   return 0;
-}
+#define USE_GENERIC
 
 #elif defined(CONFIG_ARM)
 
@@ -485,6 +477,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
print_std_bdinfo(gd->bd);
+   print_num("relocaddr", gd->relocaddr);
+   print_num("reloc off", gd->reloc_off);
+   print_cpu_word_size();
 
return 0;
 }
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 04/36] bdinfo: xtensa: Create a generic do_bdinfo for xtensa

2020-05-04 Thread Simon Glass
This arch uses only the generic function. It would be nice if all the
archs did the same. As a first step, create a new generic function for the
'bd' command and make xtensa use it.

Signed-off-by: Simon Glass 
---

 cmd/bdinfo.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 9edcf8d74e..9247180a29 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -474,14 +474,20 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 
 #elif defined(CONFIG_XTENSA)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+#define USE_GENERIC
+
+#else
+ #error "a case for this architecture does not exist!"
+#endif
+
+/* Temporary check for archs that use generic bdinfo. Eventually all will */
+#ifdef USE_GENERIC
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
print_std_bdinfo(gd->bd);
+
return 0;
 }
-
-#else
- #error "a case for this architecture does not exist!"
 #endif
 
 /*  */
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 02/36] bdinfo: riscv: Use generic bd_info

2020-05-04 Thread Simon Glass
At present riscv still uses its own private bd_info struct. Move it over
to use the generic one like other archs.

Signed-off-by: Simon Glass 
---

 arch/riscv/include/asm/u-boot.h | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h
index 5ba8e77812..d5e1d5f323 100644
--- a/arch/riscv/include/asm/u-boot.h
+++ b/arch/riscv/include/asm/u-boot.h
@@ -18,25 +18,10 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_ 1
 
+/* Use the generic board which requires a unified bd_info */
+#include 
 #include 
 
-
-typedef struct bd_info {
-   unsigned long   bi_boot_params; /* where this board expects params */
-   unsigned long   bi_memstart;/* start of DRAM memory */
-   unsigned long   bi_memsize; /* size  of DRAM memory in bytes */
-   unsigned long   bi_flashstart;  /* start of FLASH memory */
-   unsigned long   bi_flashsize;   /* size  of FLASH memory */
-   unsigned long   bi_flashoffset; /* reserved area for startup monitor */
-   unsigned char   bi_enetaddr[6];
-
-   struct  /* RAM configuration */
-   {
-   unsigned long start;
-   unsigned long size;
-   } bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
-
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_RISCV
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH 01/36] bdinfo: nds32: Use generic bd_info

2020-05-04 Thread Simon Glass
At present nds32 still uses its own private bd_info struct. Move it over
to use the generic one like other archs.

Signed-off-by: Simon Glass 
---

 arch/nds32/include/asm/u-boot.h | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/nds32/include/asm/u-boot.h b/arch/nds32/include/asm/u-boot.h
index 8c949e7fb7..7b6e905f2a 100644
--- a/arch/nds32/include/asm/u-boot.h
+++ b/arch/nds32/include/asm/u-boot.h
@@ -19,26 +19,10 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_ 1
 
+/* Use the generic board which requires a unified bd_info */
+#include 
 #include 
 
-
-typedef struct bd_info {
-   unsigned long   bi_arch_number; /* unique id for this board */
-   unsigned long   bi_boot_params; /* where this board expects params */
-   unsigned long   bi_memstart;/* start of DRAM memory */
-   unsigned long   bi_memsize; /* size  of DRAM memory in bytes */
-   unsigned long   bi_flashstart;  /* start of FLASH memory */
-   unsigned long   bi_flashsize;   /* size  of FLASH memory */
-   unsigned long   bi_flashoffset; /* reserved area for startup monitor */
-   unsigned char   bi_enetaddr[6];
-
-   struct  /* RAM configuration */
-   {
-   unsigned long start;
-   unsigned long size;
-   } bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
-
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_NDS32
 
-- 
2.26.2.526.g744177e7f7-goog



[PATCH] mpc83xx: remove redundant MPC83xx_RESET #define

2020-05-04 Thread Rasmus Villemoes
This macro is only used (tested for existence) in mpc83xx.c, which
unconditionally includes mpc83xx.h where it is unconditionally
defined. Removing it makes the remaining code easier to read.

Signed-off-by: Rasmus Villemoes 
---
 arch/powerpc/cpu/mpc83xx/cpu.c | 24 
 include/mpc83xx.h  |  5 -
 2 files changed, 29 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index 1ecc5ab7ce..118c79c4a3 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -126,16 +126,10 @@ int
 do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
ulong msr;
-#ifndef MPC83xx_RESET
-   ulong addr;
-#endif
-
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
puts("Resetting the board.\n");
 
-#ifdef MPC83xx_RESET
-
/* Interrupts and MMU off */
msr = mfmsr();
msr &= ~(MSR_EE | MSR_IR | MSR_DR);
@@ -155,24 +149,6 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * 
const argv[])
/* perform reset, only one bit */
immap->reset.rcr = RCR_SWHR;
 
-#else  /* ! MPC83xx_RESET */
-
-   immap->reset.rmr = RMR_CSRE;/* Checkstop Reset enable */
-
-   /* Interrupts and MMU off */
-   msr = mfmsr();
-   msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
-   mtmsr(msr);
-
-   /*
-* Trying to execute the next instruction at a non-existing address
-* should cause a machine check, resulting in reset
-*/
-   addr = CONFIG_SYS_RESET_ADDRESS;
-
-   ((void (*)(void)) addr) ();
-#endif /* MPC83xx_RESET */
-
return 1;
 }
 #endif
diff --git a/include/mpc83xx.h b/include/mpc83xx.h
index c2a185321a..ea67868ea0 100644
--- a/include/mpc83xx.h
+++ b/include/mpc83xx.h
@@ -12,11 +12,6 @@
 #include 
 #endif
 
-/*
- * MPC83xx cpu provide RCR register to do reset thing specially
- */
-#define MPC83xx_RESET
-
 /*
  * System reset offset (PowerPC standard)
  */
-- 
2.23.0



Re: [U-Boot] [PATCH v2 13/18] autoboot: Tidy up use of menukey

2020-05-04 Thread Da Xue
Hi Simon,

I think there's something funny going on with this line: #define
AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
Did you mean: #define AUTOBOOT_MENUKEY CONFIG_AUTOBOOT_MENUKEY?

Best,
Da

On Mon, May 4, 2020 at 5:26 PM Da Xue  wrote:

> Hi Simon,
>
> The Kconfig doesn't match the common/autoboot.c. Kconfig is using
> AUTOBOOT_USE_MENUKEY and common/autoboot.c is CONFIG_USE_AUTOBOOT_MENUKEY.
>
> Best,
> Da
>
> On Sat, Jul 20, 2019 at 11:56 PM Simon Glass  wrote:
>
>> Move the variable to the top of the file and adjust the code which uses it
>> to use if() rather than #ifdef, to make it easier to read.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v2: None
>>
>>  common/autoboot.c | 26 ++
>>  1 file changed, 14 insertions(+), 12 deletions(-)
>>
>> diff --git a/common/autoboot.c b/common/autoboot.c
>> index ad189a8ba2..9752470873 100644
>> --- a/common/autoboot.c
>> +++ b/common/autoboot.c
>> @@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
>>
>>  /* Stored value of bootdelay, used by autoboot_command() */
>>  static int stored_bootdelay;
>> +static int menukey;
>>
>>  #ifdef CONFIG_AUTOBOOT_ENCRYPTION
>>  #define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
>> @@ -35,6 +36,12 @@ static int stored_bootdelay;
>>  #define AUTOBOOT_STOP_STR_SHA256 ""
>>  #endif
>>
>> +#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
>> +#define AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
>> +#else
>> +#define AUTOBOOT_MENUKEY 0
>> +#endif
>> +
>>  /*
>>   * Use a "constant-length" time compare function for this
>>   * hash compare:
>> @@ -224,10 +231,6 @@ static int abortboot_key_sequence(int bootdelay)
>> return abort;
>>  }
>>
>> -#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
>> -static int menukey;
>> -#endif
>> -
>>  static int abortboot_single_key(int bootdelay)
>>  {
>> int abort = 0;
>> @@ -250,13 +253,13 @@ static int abortboot_single_key(int bootdelay)
>> ts = get_timer(0);
>> do {
>> if (tstc()) {   /* we got a key press   */
>> +   int key;
>> +
>> abort  = 1; /* don't auto boot  */
>> bootdelay = 0;  /* no more delay*/
>> -# ifdef CONFIG_USE_AUTOBOOT_MENUKEY
>> -   menukey = getc();
>> -# else
>> -   (void) getc();  /* consume input*/
>> -# endif
>> +   key = getc(); /* consume input  */
>> +   if
>> (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
>> +   menukey = key;
>> break;
>> }
>> udelay(1);
>> @@ -358,11 +361,10 @@ void autoboot_command(const char *s)
>>  #endif
>> }
>>
>> -#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
>> -   if (menukey == CONFIG_AUTOBOOT_MENUKEY) {
>> +   if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
>> +   menukey == AUTOBOOT_MENUKEY) {
>> s = env_get("menucmd");
>> if (s)
>> run_command_list(s, -1, 0);
>> }
>> -#endif /* CONFIG_USE_AUTOBOOT_MENUKEY */
>>  }
>> --
>> 2.22.0.657.g960e92d24f-goog
>>
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>>
>


Re: [U-Boot] [PATCH v2 13/18] autoboot: Tidy up use of menukey

2020-05-04 Thread Da Xue
Hi Simon,

The Kconfig doesn't match the common/autoboot.c. Kconfig is using
AUTOBOOT_USE_MENUKEY and common/autoboot.c is CONFIG_USE_AUTOBOOT_MENUKEY.

Best,
Da

On Sat, Jul 20, 2019 at 11:56 PM Simon Glass  wrote:

> Move the variable to the top of the file and adjust the code which uses it
> to use if() rather than #ifdef, to make it easier to read.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2: None
>
>  common/autoboot.c | 26 ++
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/common/autoboot.c b/common/autoboot.c
> index ad189a8ba2..9752470873 100644
> --- a/common/autoboot.c
> +++ b/common/autoboot.c
> @@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  /* Stored value of bootdelay, used by autoboot_command() */
>  static int stored_bootdelay;
> +static int menukey;
>
>  #ifdef CONFIG_AUTOBOOT_ENCRYPTION
>  #define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
> @@ -35,6 +36,12 @@ static int stored_bootdelay;
>  #define AUTOBOOT_STOP_STR_SHA256 ""
>  #endif
>
> +#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
> +#define AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
> +#else
> +#define AUTOBOOT_MENUKEY 0
> +#endif
> +
>  /*
>   * Use a "constant-length" time compare function for this
>   * hash compare:
> @@ -224,10 +231,6 @@ static int abortboot_key_sequence(int bootdelay)
> return abort;
>  }
>
> -#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
> -static int menukey;
> -#endif
> -
>  static int abortboot_single_key(int bootdelay)
>  {
> int abort = 0;
> @@ -250,13 +253,13 @@ static int abortboot_single_key(int bootdelay)
> ts = get_timer(0);
> do {
> if (tstc()) {   /* we got a key press   */
> +   int key;
> +
> abort  = 1; /* don't auto boot  */
> bootdelay = 0;  /* no more delay*/
> -# ifdef CONFIG_USE_AUTOBOOT_MENUKEY
> -   menukey = getc();
> -# else
> -   (void) getc();  /* consume input*/
> -# endif
> +   key = getc(); /* consume input  */
> +   if
> (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
> +   menukey = key;
> break;
> }
> udelay(1);
> @@ -358,11 +361,10 @@ void autoboot_command(const char *s)
>  #endif
> }
>
> -#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
> -   if (menukey == CONFIG_AUTOBOOT_MENUKEY) {
> +   if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
> +   menukey == AUTOBOOT_MENUKEY) {
> s = env_get("menucmd");
> if (s)
> run_command_list(s, -1, 0);
> }
> -#endif /* CONFIG_USE_AUTOBOOT_MENUKEY */
>  }
> --
> 2.22.0.657.g960e92d24f-goog
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>


[PATCH v4 0/5] TI Ethernet PHY changes

2020-05-04 Thread Dan Murphy
Hello

The addition of the DP83867 driver to uboot was done in a generic way that
made it a bit difficult to bring in new PHY drivers.  The difficulty came in the
config flags and the phy_init function.  The change is to make the flags and
init for the DP83867 more specific to the DP83867 device to make way to add
more TI PHYs to uBoot.

In addition the DP8382X PHY is a generic PHY driver that does not need any
special handling to establish a link.  Customers have requested that at the very
least there be a way to know if the PHY attached is the PHY that is connected
as "Generic PHY" is not really descriptive.  These patches adds the
registrations for TI Generic PHYs to associcate a TI PHY ID with a PHY name.

Porting PHY helper routines to set and clear bits to facilitate easier side
porting of ethernet kernel drivers to uBoot.

Also fixed and added missing or kernel doc documentation in the phy.h file.

Dan

Dan Murphy (5):
  net: phy: Add missing kernel doc to phy functions
  net: phy: Fix kernel doc issues in phy.h
  net: phy: Add helper routines to set and clear bits
  net: phy: Add support for TI PHY init
  net: phy: Add DP8382x phy registration to TI PHY init

 configs/am65x_evm_a53_defconfig  |   2 +-
 configs/am65x_hs_evm_a53_defconfig   |   2 +-
 configs/dra7xx_evm_defconfig |   2 +-
 configs/dra7xx_hs_evm_defconfig  |   2 +-
 configs/dra7xx_hs_evm_usb_defconfig  |   2 +-
 configs/j721e_evm_a72_defconfig  |   2 +-
 configs/j721e_hs_evm_a72_defconfig   |   2 +-
 configs/k2g_evm_defconfig|   2 +-
 configs/xilinx_versal_virt_defconfig |   2 +-
 configs/xilinx_zynqmp_virt_defconfig |   2 +-
 drivers/net/phy/Kconfig  |  15 
 drivers/net/phy/Makefile |   3 +-
 drivers/net/phy/dp83867.c|   3 +-
 drivers/net/phy/ti_phy_init.c| 101 
 drivers/net/phy/ti_phy_init.h|  15 
 include/phy.h| 112 ---
 16 files changed, 246 insertions(+), 23 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h

-- 
2.25.1



[PATCH v4 5/5] net: phy: Add DP8382x phy registration to TI PHY init

2020-05-04 Thread Dan Murphy
Add the DP8382X generic PHY registration to the TI PHY init file.

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
 drivers/net/phy/Kconfig   |  7 +++
 drivers/net/phy/ti_phy_init.c | 83 +++
 2 files changed, 90 insertions(+)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index a5a1ff257f9f..b0bd762ac397 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -252,6 +252,13 @@ config PHY_TI_DP83867
---help---
  Adds support for the TI DP83867 1Gbit PHY.
 
+config PHY_TI_GENERIC
+   select PHY_TI
+   bool "Texas Instruments Generic Ethernet PHYs support"
+   ---help---
+ Adds support for Generic TI PHYs that don't need special handling but
+ the PHY name is associated with a PHY ID.
+
 config PHY_VITESSE
bool "Vitesse Ethernet PHYs support"
 
diff --git a/drivers/net/phy/ti_phy_init.c b/drivers/net/phy/ti_phy_init.c
index 277b29a26342..50eff77692f1 100644
--- a/drivers/net/phy/ti_phy_init.c
+++ b/drivers/net/phy/ti_phy_init.c
@@ -7,12 +7,95 @@
  * Copyright (C) 2019-20 Texas Instruments Inc.
  */
 
+#include 
 #include "ti_phy_init.h"
 
+#ifdef CONFIG_PHY_TI_GENERIC
+static struct phy_driver dp83822_driver = {
+   .name = "TI DP83822",
+   .uid = 0x2000a240,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83826nc_driver = {
+   .name = "TI DP83826NC",
+   .uid = 0x2000a110,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83826c_driver = {
+   .name = "TI DP83826C",
+   .uid = 0x2000a130,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825s_driver = {
+   .name = "TI DP83825S",
+   .uid = 0x2000a140,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825i_driver = {
+   .name = "TI DP83825I",
+   .uid = 0x2000a150,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825m_driver = {
+   .name = "TI DP83825M",
+   .uid = 0x2000a160,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825cs_driver = {
+   .name = "TI DP83825CS",
+   .uid = 0x2000a170,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = &genphy_config_aneg,
+   .startup = &genphy_startup,
+   .shutdown = &genphy_shutdown,
+};
+#endif /* CONFIG_PHY_TI_GENERIC */
+
 int phy_ti_init(void)
 {
 #ifdef CONFIG_PHY_TI_DP83867
phy_dp83867_init();
 #endif
+
+#ifdef CONFIG_PHY_TI_GENERIC
+   phy_register(&dp83822_driver);
+   phy_register(&dp83825s_driver);
+   phy_register(&dp83825i_driver);
+   phy_register(&dp83825m_driver);
+   phy_register(&dp83825cs_driver);
+   phy_register(&dp83826c_driver);
+   phy_register(&dp83826nc_driver);
+#endif
return 0;
 }
-- 
2.25.1



[PATCH v4 4/5] net: phy: Add support for TI PHY init

2020-05-04 Thread Dan Murphy
ti_phy_init function was allocated to the DP83867 PHY.  This function
name is to generic for a specific PHY.  The function can be moved to a
TI specific file that can register all TI PHYs that are defined in the
defconfig.  The ti_phy_init file will contain all TI PHYs initialization
so that only phy_ti_init can be called from the framework.

In addition to the above the config flag for the DP83867 needs to be changed
in the Kconfig and dependent defconfig files. The config flag that was
used for the DP83867 was also generic in nature so a more specific
config flag for the DP83867 was created.

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
 configs/am65x_evm_a53_defconfig  |  2 +-
 configs/am65x_hs_evm_a53_defconfig   |  2 +-
 configs/dra7xx_evm_defconfig |  2 +-
 configs/dra7xx_hs_evm_defconfig  |  2 +-
 configs/dra7xx_hs_evm_usb_defconfig  |  2 +-
 configs/j721e_evm_a72_defconfig  |  2 +-
 configs/j721e_hs_evm_a72_defconfig   |  2 +-
 configs/k2g_evm_defconfig|  2 +-
 configs/xilinx_versal_virt_defconfig |  2 +-
 configs/xilinx_zynqmp_virt_defconfig |  2 +-
 drivers/net/phy/Kconfig  |  8 
 drivers/net/phy/Makefile |  3 ++-
 drivers/net/phy/dp83867.c|  3 ++-
 drivers/net/phy/ti_phy_init.c| 18 ++
 drivers/net/phy/ti_phy_init.h| 15 +++
 15 files changed, 55 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h

diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 542bbd992c53..c8cc9b2f7d8d 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -101,7 +101,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
diff --git a/configs/am65x_hs_evm_a53_defconfig 
b/configs/am65x_hs_evm_a53_defconfig
index 9f43cee39611..738bd01b059f 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -103,7 +103,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 4d765da4e052..9ad462cdc6de 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -86,7 +86,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=7680
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index c25d4ce5c142..9aa452460765 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -89,7 +89,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=7680
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_usb_defconfig 
b/configs/dra7xx_hs_evm_usb_defconfig
index 8e74496b2ccd..d282468212e9 100644
--- a/configs/dra7xx_hs_evm_usb_defconfig
+++ b/configs/dra7xx_hs_evm_usb_defconfig
@@ -87,7 +87,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=7680
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index e9e82bb4309d..29ae8d720753 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -124,7 +124,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/j721e_hs_evm_a72_defconfig 
b/configs/j721e_hs_evm_a72_defconfig
index a723e2718e5e..7174fda72a01 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -114,7 +114,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index 5abf5faa450e..14cf1b997d91 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -58,7 +58,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
diff --git a/configs/x

[PATCH v4 3/5] net: phy: Add helper routines to set and clear bits

2020-05-04 Thread Dan Murphy
Add phy_set/clear_bit helper routines so that ported drivers from the
kernel can use these functions.

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
 include/phy.h | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/include/phy.h b/include/phy.h
index 34c2af719b67..fedd14609192 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -296,6 +296,60 @@ static inline int phy_write_mmd(struct phy_device *phydev, 
int devad,
return phy_write(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA, val);
 }
 
+/**
+ * phy_set_bits_mmd - Convenience function for setting bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to set
+ * @return: 0 for success or negative errno for failure
+ */
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
+  u32 regnum, u16 val)
+{
+   int value, ret;
+
+   value = phy_read_mmd(phydev, devad, regnum);
+   if (value < 0)
+   return value;
+
+   value |= val;
+
+   ret = phy_write_mmd(phydev, devad, regnum, value);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
+/**
+ * phy_clear_bits_mmd - Convenience function for clearing bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to clear
+ * @return: 0 for success or negative errno for failure
+ */
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
+u32 regnum, u16 val)
+{
+   int value, ret;
+
+   value = phy_read_mmd(phydev, devad, regnum);
+   if (value < 0)
+   return value;
+
+   value &= ~val;
+
+   ret = phy_write_mmd(phydev, devad, regnum, value);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
 #ifdef CONFIG_PHYLIB_10G
 extern struct phy_driver gen10g_driver;
 
-- 
2.25.1



[PATCH v4 1/5] net: phy: Add missing kernel doc to phy functions

2020-05-04 Thread Dan Murphy
Add kernel doc to the phy_read/write utility functions in phy.h

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
 include/phy.h | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/include/phy.h b/include/phy.h
index b5de14cbfc29..c1f6509e42fc 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -170,6 +170,13 @@ struct fixed_link {
int asym_pause;
 };
 
+/**
+ * phy_read - Convenience function for reading a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to read
+ * @return: value for success or negative errno for failure
+ */
 static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
 {
struct mii_dev *bus = phydev->bus;
@@ -182,6 +189,14 @@ static inline int phy_read(struct phy_device *phydev, int 
devad, int regnum)
return bus->read(bus, phydev->addr, devad, regnum);
 }
 
+/**
+ * phy_write - Convenience function for writing a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @val: value to write to @regnum
+ * @return: 0 for success or negative errno for failure
+ */
 static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
u16 val)
 {
@@ -195,6 +210,13 @@ static inline int phy_write(struct phy_device *phydev, int 
devad, int regnum,
return bus->write(bus, phydev->addr, devad, regnum, val);
 }
 
+/**
+ * phy_mmd_start_indirect - Convenience function for writing MMD registers
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @return: None
+ */
 static inline void phy_mmd_start_indirect(struct phy_device *phydev, int devad,
  int regnum)
 {
@@ -209,6 +231,14 @@ static inline void phy_mmd_start_indirect(struct 
phy_device *phydev, int devad,
  (devad | MII_MMD_CTRL_NOINCR));
 }
 
+/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @return: Value for success or negative errno for failure
+ */
 static inline int phy_read_mmd(struct phy_device *phydev, int devad,
   int regnum)
 {
@@ -233,6 +263,15 @@ static inline int phy_read_mmd(struct phy_device *phydev, 
int devad,
return phy_read(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA);
 }
 
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ * @return: 0 for success or negative errno for failure
+ */
 static inline int phy_write_mmd(struct phy_device *phydev, int devad,
int regnum, u16 val)
 {
-- 
2.25.1



[PATCH v4 2/5] net: phy: Fix kernel doc issues in phy.h

2020-05-04 Thread Dan Murphy
Fix kernel doc warnings in phy.h.  Mostly the warnings were due to the
return missing the semi-colon.

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
 include/phy.h | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/include/phy.h b/include/phy.h
index c1f6509e42fc..34c2af719b67 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -314,26 +314,23 @@ static inline int is_10g_interface(phy_interface_t 
interface)
 
 /**
  * phy_init() - Initializes the PHY drivers
- *
  * This function registers all available PHY drivers
  *
- * @return 0 if OK, -ve on error
+ * @return: 0 if OK, -ve on error
  */
 int phy_init(void);
 
 /**
  * phy_reset() - Resets the specified PHY
- *
  * Issues a reset of the PHY and waits for it to complete
  *
  * @phydev:PHY to reset
- * @return 0 if OK, -ve on error
+ * @return: 0 if OK, -ve on error
  */
 int phy_reset(struct phy_device *phydev);
 
 /**
  * phy_find_by_mask() - Searches for a PHY on the specified MDIO bus
- *
  * The function checks the PHY addresses flagged in phy_mask and returns a
  * phy_device pointer if it detects a PHY.
  * This function should only be called if just one PHY is expected to be 
present
@@ -343,7 +340,7 @@ int phy_reset(struct phy_device *phydev);
  * @bus:   MII/MDIO bus to scan
  * @phy_mask:  bitmap of PYH addresses to scan
  * @interface: type of MAC-PHY interface
- * @return pointer to phy_device if a PHY is found, or NULL otherwise
+ * @return: pointer to phy_device if a PHY is found, or NULL otherwise
  */
 struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask,
phy_interface_t interface);
@@ -359,7 +356,6 @@ void phy_connect_dev(struct phy_device *phydev, struct 
udevice *dev);
 
 /**
  * phy_connect() - Creates a PHY device for the Ethernet interface
- *
  * Creates a PHY device for the PHY at the given address, if one doesn't exist
  * already, and associates it with the Ethernet device.
  * The function may be called with addr <= 0, in this case addr value is 
ignored
@@ -371,7 +367,7 @@ void phy_connect_dev(struct phy_device *phydev, struct 
udevice *dev);
  * @addr:  PHY address on MDIO bus
  * @dev:   Ethernet device to associate to the PHY
  * @interface: type of MAC-PHY interface
- * @return pointer to phy_device if a PHY is found, or NULL otherwise
+ * @return: pointer to phy_device if a PHY is found, or NULL otherwise
  */
 struct phy_device *phy_connect(struct mii_dev *bus, int addr,
struct udevice *dev,
@@ -395,7 +391,6 @@ void phy_connect_dev(struct phy_device *phydev, struct 
eth_device *dev);
 
 /**
  * phy_connect() - Creates a PHY device for the Ethernet interface
- *
  * Creates a PHY device for the PHY at the given address, if one doesn't exist
  * already, and associates it with the Ethernet device.
  * The function may be called with addr <= 0, in this case addr value is 
ignored
@@ -407,7 +402,7 @@ void phy_connect_dev(struct phy_device *phydev, struct 
eth_device *dev);
  * @addr:  PHY address on MDIO bus
  * @dev:   Ethernet device to associate to the PHY
  * @interface: type of MAC-PHY interface
- * @return pointer to phy_device if a PHY is found, or NULL otherwise
+ * @return: pointer to phy_device if a PHY is found, or NULL otherwise
  */
 struct phy_device *phy_connect(struct mii_dev *bus, int addr,
struct eth_device *dev,
@@ -467,7 +462,7 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, 
u32 *phy_id);
  * phy_get_interface_by_name() - Look up a PHY interface name
  *
  * @str:   PHY interface name, e.g. "mii"
- * @return PHY_INTERFACE_MODE_... value, or -1 if not found
+ * @return: PHY_INTERFACE_MODE_... value, or -1 if not found
  */
 int phy_get_interface_by_name(const char *str);
 
@@ -475,6 +470,7 @@ int phy_get_interface_by_name(const char *str);
  * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
  * is RGMII (all variants)
  * @phydev: the phy_device struct
+ * @return: true if MII bus is RGMII or false if it is not
  */
 static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
 {
@@ -486,6 +482,7 @@ static inline bool phy_interface_is_rgmii(struct phy_device 
*phydev)
  * phy_interface_is_sgmii - Convenience function for testing if a PHY interface
  * is SGMII (all variants)
  * @phydev: the phy_device struct
+ * @return: true if MII bus is SGMII or false if it is not
  */
 static inline bool phy_interface_is_sgmii(struct phy_device *phydev)
 {
-- 
2.25.1



[PATCH 6/6] rtc: add rtc command

2020-05-04 Thread Rasmus Villemoes
Mostly as an aid for debugging RTC drivers, provide a command that can
be used to read/write arbitrary registers (assuming the driver
provides the read8/write8 methods or their _array variants).

Signed-off-by: Rasmus Villemoes 
---
 cmd/Kconfig  |   6 ++
 cmd/Makefile |   1 +
 cmd/rtc.c| 153 +++
 3 files changed, 160 insertions(+)
 create mode 100644 cmd/rtc.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 6403bc45a5..e5d0e7f7c3 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1673,6 +1673,12 @@ config CMD_DATE
  Enable the 'date' command for getting/setting the time/date in RTC
  devices.
 
+config CMD_RTC
+   bool "rtc"
+   depends on DM_RTC
+   help
+ Enable the 'rtc' command for low-level access to RTC devices.
+
 config CMD_TIME
bool "time"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index f1dd513a4b..871b07f7b2 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -119,6 +119,7 @@ obj-$(CONFIG_CMD_REISER) += reiser.o
 obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_CMD_RNG) += rng.o
 obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
+obj-$(CONFIG_CMD_RTC) += rtc.o
 obj-$(CONFIG_SANDBOX) += host.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_CMD_NVME) += nvme.o
diff --git a/cmd/rtc.c b/cmd/rtc.c
new file mode 100644
index 00..d48c0333fa
--- /dev/null
+++ b/cmd/rtc.c
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MAX_RTC_BYTES 32
+
+static int do_rtc_read(struct udevice *dev, int argc, char * const argv[], int 
mem)
+{
+   u8 buf[MAX_RTC_BYTES];
+   int reg, len, ret;
+   u8 *addr;
+
+   if (argc != 2 + mem)
+   return CMD_RET_USAGE;
+
+   if (mem) {
+   addr = (void*)simple_strtoul(argv[0], NULL, 16);
+   argv++;
+   argv--;
+   } else {
+   addr = buf;
+   }
+   reg = simple_strtoul(argv[0], NULL, 0);
+   len = simple_strtoul(argv[1], NULL, 0);
+
+   if (!mem && len > sizeof(buf)) {
+   printf("can read at most %d registers at a time\n", 
MAX_RTC_BYTES);
+   return CMD_RET_FAILURE;
+   }
+   ret = rtc_read8_array(dev, reg, buf, len);
+   if (ret) {
+   printf("rtc_read8_array() failed: %d\n", ret);
+   return CMD_RET_FAILURE;
+   }
+   if (!mem) {
+   while (len--)
+   printf("%d: 0x%02x\n", reg++, *addr++);
+   }
+   return CMD_RET_SUCCESS;
+}
+
+static int do_rtc_write(struct udevice *dev, int argc, char * const argv[], 
int mem)
+{
+   u8 buf[MAX_RTC_BYTES];
+   u8 *addr;
+   int reg, len, ret;
+
+   if (argc != 2 + mem)
+   return CMD_RET_USAGE;
+
+   if (mem) {
+   addr = (void*)simple_strtoul(argv[0], NULL, 16);
+   argv++;
+   argv--;
+   } else {
+   addr = buf;
+   }
+
+   reg = simple_strtoul(argv[0], NULL, 0);
+   if (mem) {
+   len = simple_strtoul(argv[1], NULL, 0);
+   } else {
+   /* Convert hexstring, bail out if too long. */
+   const char *s = argv[1];
+
+   len = strlen(s);
+   if (len > 2*MAX_RTC_BYTES) {
+   printf("hex string too long, can write at most %d 
bytes\n", MAX_RTC_BYTES);
+   return CMD_RET_FAILURE;
+   }
+   len /= 2;
+   if (hex2bin(addr, s, len)) {
+   printf("invalid hex string\n");
+   return CMD_RET_FAILURE;
+   }
+   }
+
+   ret = rtc_write8_array(dev, reg, buf, len);
+   if (ret) {
+   printf("rtc_write8_array() failed: %d\n", ret);
+   return CMD_RET_FAILURE;
+   }
+   return CMD_RET_SUCCESS;
+}
+
+int do_rtc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   static int curr_rtc = 0;
+   struct udevice *dev;
+   int ret, idx;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   argc--;
+   argv++;
+
+   if (!strcmp(argv[0], "list")) {
+   struct uclass *uc;
+   idx = 0;
+
+   uclass_id_foreach_dev(UCLASS_RTC, dev, uc) {
+   printf("RTC #%d - %s\n", idx++, dev->name);
+   }
+   if (!idx) {
+   printf("*** no RTC devices available ***\n");
+   return CMD_RET_FAILURE;
+   }
+   return CMD_RET_SUCCESS;
+   }
+
+   idx = curr_rtc;
+   if (!strcmp(argv[0], "dev") && argc >= 2)
+   idx = simple_strtoul(argv[1], NULL, 10);
+
+   ret = uclass_get_device(UCLASS_RTC, idx, &dev);
+   if (ret) {
+   printf("Cannot find RTC #%d: err=%d\n", idx, ret);
+   return CMD_RET_FAILURE;
+   }
+
+   if 

[PATCH 5/6] rtc: pcf2127: provide ->write8_array method

2020-05-04 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes 
---
 drivers/rtc/pcf2127.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c
index b3f6de8496..227ab09880 100644
--- a/drivers/rtc/pcf2127.c
+++ b/drivers/rtc/pcf2127.c
@@ -43,6 +43,12 @@ static int pcf2127_rtc_read8_array(struct udevice *dev, uint 
offset,
return dm_i2c_xfer(dev, &msg, 1);
 }
 
+static int pcf2127_rtc_write8_array(struct udevice *dev, uint offset,
+  const u8 *buffer, uint len)
+{
+   return dm_i2c_write(dev, offset, buffer, len);
+}
+
 static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm)
 {
uchar buf[7] = {0};
@@ -110,6 +116,7 @@ static const struct rtc_ops pcf2127_rtc_ops = {
.set = pcf2127_rtc_set,
.reset = pcf2127_rtc_reset,
.read8_array = pcf2127_rtc_read8_array,
+   .write8_array = pcf2127_rtc_write8_array,
 };
 
 static const struct udevice_id pcf2127_rtc_ids[] = {
-- 
2.23.0



[PATCH 4/6] rtc: pcf2127: provide ->read8_array method

2020-05-04 Thread Rasmus Villemoes
This simply consists of renaming the existing pcf2127_read_reg()
helper to follow the naming of the other
methods (i.e. pcf2127_rtc_) and changing the type of its
"len" parameter.

Signed-off-by: Rasmus Villemoes 
---
 drivers/rtc/pcf2127.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c
index b34ed63bf0..b3f6de8496 100644
--- a/drivers/rtc/pcf2127.c
+++ b/drivers/rtc/pcf2127.c
@@ -22,8 +22,8 @@
 #define PCF2127_REG_MO 0x08
 #define PCF2127_REG_YR 0x09
 
-static int pcf2127_read_reg(struct udevice *dev, uint offset,
-   u8 *buffer, int len)
+static int pcf2127_rtc_read8_array(struct udevice *dev, uint offset,
+  u8 *buffer, uint len)
 {
struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
struct i2c_msg msg;
@@ -72,7 +72,7 @@ static int pcf2127_rtc_get(struct udevice *dev, struct 
rtc_time *tm)
int ret = 0;
uchar buf[10] = { PCF2127_REG_CTRL1 };
 
-   ret = pcf2127_read_reg(dev, PCF2127_REG_CTRL1, buf, sizeof(buf));
+   ret = pcf2127_rtc_read8_array(dev, PCF2127_REG_CTRL1, buf, sizeof(buf));
if (ret < 0)
return ret;
 
@@ -109,6 +109,7 @@ static const struct rtc_ops pcf2127_rtc_ops = {
.get = pcf2127_rtc_get,
.set = pcf2127_rtc_set,
.reset = pcf2127_rtc_reset,
+   .read8_array = pcf2127_rtc_read8_array,
 };
 
 static const struct udevice_id pcf2127_rtc_ids[] = {
-- 
2.23.0



[PATCH 3/6] rtc: fall back to ->{read, write}8_array if ->{read, write}8 are not provided

2020-05-04 Thread Rasmus Villemoes
Similar to how the rtc_{read,write}8_array functions fall back to
using the {read,write}8 methods, do the opposite in the
rtc_{read,write}8 functions.

This way, each driver only needs to provide either ->read8 or
->read8_array to make both rtc_read8() and rtc_read8_array() work -
without this, a driver that provides rtc_read8_array() would most
likely just duplicate the logic here for implementing a ->read8()
method in term of its ->read8_array() method. The same remarks of
course apply to the write case.

Signed-off-by: Rasmus Villemoes 
---
 drivers/rtc/rtc-uclass.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index 56490a876f..6bf964f937 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -44,9 +44,17 @@ int rtc_read8(struct udevice *dev, unsigned int reg)
struct rtc_ops *ops = rtc_get_ops(dev);
 
assert(ops);
-   if (!ops->read8)
-   return -ENOSYS;
-   return ops->read8(dev, reg);
+   if (ops->read8)
+   return ops->read8(dev, reg);
+   if (ops->read8_array) {
+   u8 buf[1];
+   int ret = ops->read8_array(dev, reg, buf, 1);
+
+   if (ret < 0)
+   return ret;
+   return buf[0];
+   }
+   return -ENOSYS;
 }
 
 int rtc_read8_array(struct udevice *dev, unsigned int reg,
@@ -73,9 +81,13 @@ int rtc_write8(struct udevice *dev, unsigned int reg, int 
val)
struct rtc_ops *ops = rtc_get_ops(dev);
 
assert(ops);
-   if (!ops->write8)
-   return -ENOSYS;
-   return ops->write8(dev, reg, val);
+   if (ops->write8)
+   return ops->write8(dev, reg, val);
+   if (ops->write8_array) {
+   u8 buf[1] = { val };
+   return ops->write8_array(dev, reg, buf, 1);
+   }
+   return -ENOSYS;
 }
 
 int rtc_write8_array(struct udevice *dev, unsigned int reg,
-- 
2.23.0



[PATCH 1/6] rtc: add rtc_read8_array helper and ->read8_array method

2020-05-04 Thread Rasmus Villemoes
Some users may want to read multiple consecutive 8-bit
registers. Instead of each caller having to implement the loop,
provide a rtc_read8_array() helper. Also, allow a driver to provide a
read8_array method, which can be more efficient than reading one
register at a time.

Signed-off-by: Rasmus Villemoes 
---
 drivers/rtc/rtc-uclass.c | 19 +++
 include/rtc.h| 24 
 2 files changed, 43 insertions(+)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index a0a238aedd..5070fb416d 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -49,6 +49,25 @@ int rtc_read8(struct udevice *dev, unsigned int reg)
return ops->read8(dev, reg);
 }
 
+int rtc_read8_array(struct udevice *dev, unsigned int reg,
+   u8 *buf, unsigned int len)
+{
+   struct rtc_ops *ops = rtc_get_ops(dev);
+
+   assert(ops);
+   if (ops->read8_array)
+   return ops->read8_array(dev, reg, buf, len);
+   if (!ops->read8)
+   return -ENOSYS;
+   while (len--) {
+   int ret = ops->read8(dev, reg++);
+   if (ret < 0)
+   return ret;
+   *buf++ = ret;
+   }
+   return 0;
+}
+
 int rtc_write8(struct udevice *dev, unsigned int reg, int val)
 {
struct rtc_ops *ops = rtc_get_ops(dev);
diff --git a/include/rtc.h b/include/rtc.h
index 8aabfc1162..f7f622c1db 100644
--- a/include/rtc.h
+++ b/include/rtc.h
@@ -64,6 +64,18 @@ struct rtc_ops {
 */
int (*read8)(struct udevice *dev, unsigned int reg);
 
+   /**
+* read8_array() - Read multiple 8-bit registers
+*
+* @dev:Device to read from
+* @reg:First register to read
+* @buf:Output buffer
+* @len:Number of registers to read
+* @return 0 if OK, -ve on error
+*/
+   int (*read8_array)(struct udevice *dev, unsigned int reg,
+  u8 *buf, unsigned int len);
+
/**
* write8() - Write an 8-bit register
*
@@ -118,6 +130,18 @@ int dm_rtc_reset(struct udevice *dev);
  */
 int rtc_read8(struct udevice *dev, unsigned int reg);
 
+/**
+ * rtc_read8_array() - Read multiple 8-bit registers
+ *
+ * @dev:   Device to read from
+ * @reg:   First register to read
+ * @buf:   Output buffer
+ * @len:   Number of registers to read
+ * @return 0 if OK, -ve on error
+ */
+int rtc_read8_array(struct udevice *dev, unsigned int reg,
+   u8 *buf, unsigned int len);
+
 /**
  * rtc_write8() - Write an 8-bit register
  *
-- 
2.23.0



[PATCH 2/6] rtc: add rtc_write8_array() helper

2020-05-04 Thread Rasmus Villemoes
Similar to the rtc_read8_array(), introduce a helper that allows the
caller to write multiple consecutive 8-bit registers with one call. If
the driver provides the ->write8_array method, use that, otherwise
loop using ->write8.

Signed-off-by: Rasmus Villemoes 
---
 drivers/rtc/rtc-uclass.c | 18 ++
 include/rtc.h| 24 
 2 files changed, 42 insertions(+)

diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index 5070fb416d..56490a876f 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -78,6 +78,24 @@ int rtc_write8(struct udevice *dev, unsigned int reg, int 
val)
return ops->write8(dev, reg, val);
 }
 
+int rtc_write8_array(struct udevice *dev, unsigned int reg,
+const u8 *buf, unsigned int len)
+{
+   struct rtc_ops *ops = rtc_get_ops(dev);
+
+   assert(ops);
+   if (ops->write8_array)
+   return ops->write8_array(dev, reg, buf, len);
+   if (!ops->write8)
+   return -ENOSYS;
+   while (len--) {
+   int ret = ops->write8(dev, reg++, *buf++);
+   if (ret < 0)
+   return ret;
+   }
+   return 0;
+}
+
 int rtc_read16(struct udevice *dev, unsigned int reg, u16 *valuep)
 {
u16 value = 0;
diff --git a/include/rtc.h b/include/rtc.h
index f7f622c1db..08b2a00567 100644
--- a/include/rtc.h
+++ b/include/rtc.h
@@ -85,6 +85,18 @@ struct rtc_ops {
* @return 0 if OK, -ve on error
*/
int (*write8)(struct udevice *dev, unsigned int reg, int val);
+
+   /**
+* write8_array() - Write multiple 8-bit registers
+*
+* @dev:Device to write to
+* @reg:First register to write
+* @buf:Input buffer
+* @len:Number of registers to write
+* @return 0 if OK, -ve on error
+*/
+   int (*write8_array)(struct udevice *dev, unsigned int reg,
+   const u8 *buf, unsigned int len);
 };
 
 /* Access the operations for an RTC device */
@@ -152,6 +164,18 @@ int rtc_read8_array(struct udevice *dev, unsigned int reg,
  */
 int rtc_write8(struct udevice *dev, unsigned int reg, int val);
 
+/**
+ * rtc_write8_array() - Write multiple 8-bit registers
+ *
+ * @dev:   Device to write to
+ * @reg:   First register to write
+ * @buf:   Input buffer
+ * @len:   Number of registers to write
+ * @return 0 if OK, -ve on error
+ */
+int rtc_write8_array(struct udevice *dev, unsigned int reg,
+const u8 *buf, unsigned int len);
+
 /**
  * rtc_read16() - Read a 16-bit value from the RTC
  *
-- 
2.23.0



[PATCH 0/6] rtc: add rtc_{read,write}8_array and rtc command

2020-05-04 Thread Rasmus Villemoes
I need access to registers other than just the timekeeping ones of the
pcf2127, so I wanted to implement ->read8 and ->write8. But for
testing these it appeared there was no convenient way to invoke those
from the shell, so I also ended up adding such a command.

Also, it seemed more natural to provide array variants that can read
or write several registers at once, so rtc_ops is expanded a bit.

There are a few things one could do on top, but for now I just want
some feedback, especially on the new _array methods. "rtc set", "rtc
get" and "rtc reset" are rather obvious subsommands to add at some
point. Also, rtc_{read,write}{16,32} can be simplified a bit, along
the lines of

__le16 v;
int ret = rtc_read8_array(dev, reg, &v, 2);
if (ret)
  return ret;
*valuep = __le16_to_cpu(v);
return 0;

Rasmus Villemoes (6):
  rtc: add rtc_read8_array helper and ->read8_array method
  rtc: add rtc_write8_array() helper
  rtc: fall back to ->{read,write}8_array if ->{read,write}8 are not
provided
  rtc: pcf2127: provide ->read8_array method
  rtc: pcf2127: provide ->write8_array method
  rtc: add rtc command

 cmd/Kconfig  |   6 ++
 cmd/Makefile |   1 +
 cmd/rtc.c| 153 +++
 drivers/rtc/pcf2127.c|  14 +++-
 drivers/rtc/rtc-uclass.c |  53 +-
 include/rtc.h|  48 
 6 files changed, 270 insertions(+), 5 deletions(-)
 create mode 100644 cmd/rtc.c

-- 
2.23.0



[PATCH v4 4/4] patman: Modify functional tests for new behavior

2020-05-04 Thread Sean Anderson
This patch adds or modifies functional tests for the Cover-changes,
Commit-changes, and Series-process-log tags in order to account for new
behavior added in the previous few patches. The '(no changes since v1)'
case is not tested for, since that would need an additional commit to test
in addition to testing the existing code paths.

Signed-off-by: Sean Anderson 
---

(no changes since v3)

Changes in v3:
- New

 tools/patman/func_test.py | 58 ---
 .../0001-pci-Correct-cast-for-sandbox.patch   |  3 +
 ...-for-sandbox-in-fdtdec_setup_mem_siz.patch | 12 +++-
 tools/patman/test/test01.txt  | 15 -
 4 files changed, 79 insertions(+), 9 deletions(-)

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index b7e2825de8..dc30078cce 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -82,19 +82,33 @@ class TestFunctional(unittest.TestCase):
 Series-prefix: RFC
 Series-cc: Stefan Brüns 
 Cover-letter-cc: Lord Mëlchett 
-Series-version: 2
+Series-version: 3
+Patch-cc: fred
+Series-process-log: sort, uniq
 Series-changes: 4
 - Some changes
+- Multi
+  line
+  change
+
+Commit-changes: 2
+- Changes only for this commit
+
+Cover-changes: 4
+- Some notes for the cover letter
 
 Cover-letter:
 test: A test patch series
 This is a test of how the cover
-leter
+letter
 works
 END
 
 and this in the first commit:
 
+Commit-changes: 2
+- second revision change
+
 Series-notes:
 some notes
 about some things
@@ -202,7 +216,7 @@ class TestFunctional(unittest.TestCase):
 
 expected = '''
 This is a test of how the cover
-leter
+letter
 works
 
 some notes
@@ -210,7 +224,11 @@ about some things
 from the first commit
 
 Changes in v4:
+- Multi
+  line
+  change
 - Some changes
+- Some notes for the cover letter
 
 Simon Glass (2):
   pci: Correct cast for sandbox
@@ -237,8 +255,34 @@ Simon Glass (2):
 subject = [line for line in lines if line.startswith('Subject')]
 self.assertEqual('Subject: [RFC %d/%d]' % (i + 1, count),
  subject[0][:18])
+
+# Check that we got our commit notes
+start = 0
+expected = ''
+
 if i == 0:
-# Check that we got our commit notes
-self.assertEqual('---', lines[17])
-self.assertEqual('Some notes about', lines[18])
-self.assertEqual('the first commit', lines[19])
+start = 17
+expected = '''---
+Some notes about
+the first commit
+
+(no changes since v2)
+
+Changes in v2:
+- second revision change'''
+elif i == 1:
+start = 17
+expected = '''---
+
+Changes in v4:
+- Multi
+  line
+  change
+- Some changes
+
+Changes in v2:
+- Changes only for this commit'''
+
+if expected:
+expected = expected.splitlines()
+self.assertEqual(expected, lines[start:(start+len(expected))])
diff --git a/tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch 
b/tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch
index 7191176f75..038943c2c9 100644
--- a/tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch
+++ b/tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch
@@ -15,6 +15,9 @@ cmd/pci.c:152:11: warning: format ‘%llx’ expects argument of 
type
 Fix it with a cast.
 
 Signed-off-by: Simon Glass 
+Commit-changes: 2
+- Changes only for this commit
+
 Series-notes:
 some notes
 about some things
diff --git 
a/tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
 
b/tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
index 702c0306ff..56278a6ce9 100644
--- 
a/tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
+++ 
b/tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
@@ -21,13 +21,23 @@ Series-cc: Stefan Brüns 
 Cover-letter-cc: Lord Mëlchett 
 Series-version: 3
 Patch-cc: fred
+Series-process-log: sort, uniq
 Series-changes: 4
 - Some changes
+- Multi
+  line
+  change
+
+Commit-changes: 2
+- Changes only for this commit
+
+Cover-changes: 4
+- Some notes for the cover letter
 
 Cover-letter:
 test: A test patch series
 This is a test of how the cover
-leter
+letter
 works
 END
 ---
diff --git a/tools/patman/test/test01.txt b/tools/patman/test/test01.txt
index 478ea93674..b238a8b4ba 100644
--- a/tools/patman/test/test01.txt
+++ b/tools/patman/test/test01.txt
@@ -13,6 +13,9 @@ Date:   Sat Apr 15 15:39:08 2017 -0600
 Fix it with a cast.
 
 Signed-off-by: Simon Glass 
+ 

[PATCH v4 1/4] patman: Suppress empty changelog entries

2020-05-04 Thread Sean Anderson
Patman outputs a line for every edition of the series in every patch,
regardless of whether any changes were made. This can result in many
redundant lines in patch changelogs, especially when a patch did not exist
before a certain revision. For example, the existing behaviour could result
in a changelog of

Changes in v7: None
Changes in v6: None
Changes in v5:
- Make a change

Changes in v4: None

Changes in v3:
- New

Changes in v2: None

With this patch applied and with --no-empty-changes, the same patch would
look like

(no changes since v5)

Changes in v5:
- Make a change

Changes in v3:
- New

This is entirely aesthetic, but I think it reduces clutter, especially for
patches added later on in a series.

Signed-off-by: Sean Anderson 
Reviewed-by: Simon Glass 
---

Changes in v4:
- Fix need_blank not always reflecting the need for a blank
- Refactor newest_version logic

Changes in v3:
- Document empty changelog suppression in README
- Fix KeyError when running tests
- Fix no changes message being output for revision 1
- Fix no changes message sometimes being output before every
  non-newest-revision change
- Make the newest_version logic more robust (and ugly)
- Update commit subject

Changes in v2:
- Add a note when there are no changes in the current revision
- Make this the default behaviour, and remove the option

 tools/patman/README| 21 +
 tools/patman/series.py | 43 ++
 2 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 02d5829744..d1d9891c4c 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -474,6 +474,27 @@ print out the command line patman would have used.
 not later when you can't remember which patch you changed. You can always
 go back and change or remove logs from commits.
 
+7. Patches will have no changelog entries for revisions where they did not
+change. For clarity, if there are no changes for this patch in the most
+recent revision of the series, a note will be added. For example, a patch
+with the following tags in the commit
+
+Series-version: 5
+Series-changes: 2
+- Some change
+
+Series-changes: 4
+- Another change
+
+would have a changelog of
+
+(no changes since v4)
+
+Changes in v4:
+- Another change
+
+Changes in v2:
+- Some change
 
 Other thoughts
 ==
diff --git a/tools/patman/series.py b/tools/patman/series.py
index e5e28cebdf..be6f061122 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -144,38 +144,57 @@ class Series(dict):
 Changes in v4:
 - Jog the dial back closer to the widget
 
-Changes in v3: None
 Changes in v2:
 - Fix the widget
 - Jog the dial
 
-etc.
+If there are no new changes in a patch, a note will be added
+
+(no changes since v2)
+
+Changes in v2:
+- Fix the widget
+- Jog the dial
 """
+versions = sorted(self.changes, reverse=True)
+newest_version = 1
+if 'version' in self:
+newest_version = max(newest_version, int(self.version))
+if versions:
+newest_version = max(newest_version, versions[0])
+
 final = []
 process_it = self.get('process_log', '').split(',')
 process_it = [item.strip() for item in process_it]
 need_blank = False
-for change in sorted(self.changes, reverse=True):
+for version in versions:
 out = []
-for this_commit, text in self.changes[change]:
+for this_commit, text in self.changes[version]:
 if commit and this_commit != commit:
 continue
 if 'uniq' not in process_it or text not in out:
 out.append(text)
-line = 'Changes in v%d:' % change
-have_changes = len(out) > 0
 if 'sort' in process_it:
 out = sorted(out)
+have_changes = len(out) > 0
+line = 'Changes in v%d:' % version
 if have_changes:
 out.insert(0, line)
-else:
-out = [line + ' None']
-if need_blank:
-out.insert(0, '')
+if version < newest_version and len(final) == 0:
+out.insert(0, '')
+out.insert(0, '(no changes since v%d)' % version)
+newest_version = 0
+# Only add a new line if we output something
+if need_blank:
+out.insert(0, '')
+need_blank = False
 final += out
-need_blank = have_changes
-if self.changes:
+need_blank = need_blank or have_changes
+
+if len(final) > 0:
 final.append('')
+elif newest_version != 1:
+final = [

[PATCH v4 2/4] patman: Add new tags for finer-grained changelog control

2020-05-04 Thread Sean Anderson
By default patman generates a combined changelog for the cover letter. This
may not always be desirable.

Many patches may have the same changes. These can be coalesced with
"Series-process-log: uniq", but this is imperfect. Similar changes like
"Move foo to patch 7" will not be merged with the similar "Move foo to this
patch from patch 6".

Changes may not make sense outside of the patch they are written for. For
example, a change line of "Add check for bar" does not make sense outside
of the context in which bar might be checked for. Some changes like "New"
or "Lint" may be repeated many times throughout different change logs, but
carry no useful information in a summary.

Lastly, I like to summarize the broad strokes of the changes I have made in
the cover letter, while documenting all the details in the appropriate
patches. I think this makes it easier to get a good feel for what has
changed, without making it difficult to wade through every change in the
whole series.

This patch adds two new tags to add changelog entries which only appear in
the cover letter, or only appear in the commit. Changes documented with
"Commit-changes" will only appear in the commit, and will not appear in the
cover letter. Changes documented with "Cover-changes" will not appear in
any commit, and will only appear in the cover letter.

Signed-off-by: Sean Anderson 
Reviewed-by: Simon Glass 
---

Changes in v4:
- Document ParseVersion
- Fix typos in commit message

Changes in v2:
- Add documentation for new tags
- Switch to using commit tags for changelog control, instead of
  command-line options

 tools/patman/README | 17 
 tools/patman/main.py|  2 +-
 tools/patman/patchstream.py | 81 -
 tools/patman/series.py  | 15 ++-
 4 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index d1d9891c4c..5a67a49e88 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -247,6 +247,23 @@ Series-changes: n
to update the log there and then, knowing that the script will
do the rest.
 
+Commit-changes: n
+- This line will not appear in the cover-letter changelog
+
+   This tag is like Series-changes, except changes in this changelog will
+   only appear in the changelog of the commit this tag is in. This is
+   useful when you want to add notes which may not make sense in the cover
+   letter. For example, you can have short changes such as "New" or
+   "Lint".
+
+Cover-changes: n
+- This line will only appear in the cover letter
+
+   This tag is like Series-changes, except changes in this changelog will
+   only appear in the cover-letter changelog. This is useful to summarize
+   changes made with Commit-changes, or to add additional context to
+   changes.
+
 Patch-cc: Their Name 
This copies a single patch to another email address. Note that the
Cc: used by git send-email is ignored by patman, but will be
diff --git a/tools/patman/main.py b/tools/patman/main.py
index f3d9c0c434..2c21a3130e 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -62,7 +62,7 @@ parser.add_option('--no-check', action='store_false', 
dest='check_patch',
   default=True,
   help="Don't check for patch compliance")
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
-  default=True, help="Don't process subject tags as aliaes")
+  default=True, help="Don't process subject tags as aliases")
 parser.add_option('--smtp-server', type='str',
   help="Specify the SMTP server to 'git send-email'")
 parser.add_option('-T', '--thread', action='store_true', dest='thread',
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 405297505c..871c66aeb1 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -24,11 +24,8 @@ re_allowed_after_test = re.compile('^Signed-off-by:')
 # Signoffs
 re_signoff = re.compile('^Signed-off-by: *(.*)')
 
-# The start of the cover letter
-re_cover = re.compile('^Cover-letter:')
-
-# A cover letter Cc
-re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
+# Cover letter tag
+re_cover = re.compile('^Cover-([a-z-]*): *(.*)')
 
 # Patch series tag
 re_series_tag = re.compile('^Series-([a-z-]*): *(.*)')
@@ -65,7 +62,7 @@ class PatchStream:
 def __init__(self, series, name=None, is_log=False):
 self.skip_blank = False  # True to skip a single blank line
 self.found_test = False  # Found a TEST= line
-self.lines_after_test = 0# MNumber of lines found after TEST=
+self.lines_after_test = 0# Number of lines found after TEST=
 self.warn = []   # List of warnings we have collected
 self.linenum = 1 # Output line number we are up to
 self.in_section = None   # Name of start...EN

[PATCH v4 3/4] patman: Support multi-line changes in changelogs

2020-05-04 Thread Sean Anderson
This patch adds support to multi-line changes. That is, if one has a line
in a changelog like
- Do a thing but
  it spans multiple lines
Using Series-process-log sort would sort as if those lines were unrelated.
With this patch, any change line starting with whitespace will be
considered part of the change before it.

Signed-off-by: Sean Anderson 
Reviewed-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- New

 tools/patman/README | 10 --
 tools/patman/patchstream.py | 35 +++
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 5a67a49e88..155736568c 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -270,8 +270,14 @@ Patch-cc: Their Name 
interpreted by git send-email if you use it.
 
 Series-process-log: sort, uniq
-   This tells patman to sort and/or uniq the change logs. It is
-   assumed that each change log entry is only a single line long.
+   This tells patman to sort and/or uniq the change logs. Changes may be
+   multiple lines long, as long as each subsequent line of a change begins
+   with a whitespace character. For example,
+
+- This change
+  continues onto the next line
+- But this change is separate
+
Use 'sort' to sort the entries, and 'uniq' to include only
unique entries. If omitted, no change log processing is done.
Separate each tag with a comma.
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 871c66aeb1..4fe465e9ab 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -45,6 +45,9 @@ re_commit = re.compile('^commit ([0-9a-f]*)$')
 # We detect these since checkpatch doesn't always do it
 re_space_before_tab = re.compile('^[+].* \t')
 
+# Match indented lines for changes
+re_leading_whitespace = re.compile('^\s')
+
 # States we can be in - can we use range() and still have comments?
 STATE_MSG_HEADER = 0# Still in the message header
 STATE_PATCH_SUBJECT = 1 # In patch subject (first line of log for a commit)
@@ -72,6 +75,7 @@ class PatchStream:
 self.is_log = is_log # True if indent like git log
 self.in_change = None# Name of the change list we are in
 self.change_version = 0  # Non-zero if we are in a change list
+self.change_lines = []   # Lines of the current change
 self.blank_count = 0 # Number of blank lines stored up
 self.state = STATE_MSG_HEADER# What state are we in?
 self.signoff = []# Contents of signoff line
@@ -138,6 +142,20 @@ class PatchStream:
 raise ValueError("%s: Cannot decode version info '%s'" %
 (self.commit.hash, line))
 
+def FinalizeChange(self):
+"""Finalize a (multi-line) change and add it to the series or commit"""
+if not self.change_lines:
+return
+change = '\n'.join(self.change_lines)
+
+if self.in_change == 'Series':
+self.series.AddChange(self.change_version, self.commit, change)
+elif self.in_change == 'Cover':
+self.series.AddChange(self.change_version, None, change)
+elif self.in_change == 'Commit':
+self.commit.AddChange(self.change_version, change)
+self.change_lines = []
+
 def ProcessLine(self, line):
 """Process a single line of a patch file or commit log
 
@@ -178,6 +196,7 @@ class PatchStream:
 commit_tag_match = re_commit_tag.match(line)
 cover_match = re_cover.match(line)
 signoff_match = re_signoff.match(line)
+leading_whitespace_match = re_leading_whitespace.match(line)
 tag_match = None
 if self.state == STATE_PATCH_HEADER:
 tag_match = re_tag.match(line)
@@ -218,6 +237,7 @@ class PatchStream:
 # is missing, fix it up.
 if self.in_change:
 self.warn.append("Missing 'blank line' in section 
'%s-changes'" % self.in_change)
+self.FinalizeChange()
 self.in_change = None
 self.change_version = 0
 
@@ -272,20 +292,18 @@ class PatchStream:
 elif self.in_change:
 if is_blank:
 # Blank line ends this change list
+self.FinalizeChange()
 self.in_change = None
 self.change_version = 0
 elif line == '---':
+self.FinalizeChange()
 self.in_change = None
 self.change_version = 0
 out = self.ProcessLine(line)
-else:
-if self.is_log:
-if self.in_change == 'Series':
-self.series.AddChange(self.change_version, 
self.commit, line)
-elif self.in_change == 'Cover':
-self.series.AddChange(self.change_version, None, line)
-   

[PATCH v4 0/4] patman: Add changelog customization options

2020-05-04 Thread Sean Anderson
This series adds a few changes I have been using locally as new tags for
patman. This series has itself been developed using these patches, and the
unprocessed commits can be viewed at [1].

[1] https://github.com/Forty-Bot/u-boot/tree/patman

Changes in v4:
- Document ParseVersion
- Fix need_blank not always reflecting the need for a blank
- Refactor newest_version logic
- Reorder commits so tests get added last

Changes in v3:
- Document empty changelog suppression in README
- Fix KeyError when running tests
- Fix some corner cases for no changes messages
- Modify tests for new behavior
- Update commit subjects

Changes in v2:
- Add a note when there are no changes in the current revision
- Add documentation for new tags
- Add patch for multi-line changes in changelogs
- Switch to using commit tags for changelog control, instead of
  command-line options

Sean Anderson (4):
  patman: Suppress empty changelog entries
  patman: Add new tags for finer-grained changelog control
  patman: Support multi-line changes in changelogs
  patman: Modify functional tests for new behavior

 tools/patman/README   |  48 +++-
 tools/patman/func_test.py |  58 --
 tools/patman/main.py  |   2 +-
 tools/patman/patchstream.py   | 104 --
 tools/patman/series.py|  54 +++--
 .../0001-pci-Correct-cast-for-sandbox.patch   |   3 +
 ...-for-sandbox-in-fdtdec_setup_mem_siz.patch |  12 +-
 tools/patman/test/test01.txt  |  15 ++-
 8 files changed, 241 insertions(+), 55 deletions(-)

-- 
2.26.2



Re: [PATCH v3 2/4] patman: Suppress empty changelog entries

2020-05-04 Thread Simon Glass
Hi Sean,

On Mon, 4 May 2020 at 10:59, Sean Anderson  wrote:
>
> On 5/4/20 10:39 AM, Simon Glass wrote:
> > Hi Sean,
> >
> > On Sun, 3 May 2020 at 15:55, Sean Anderson  wrote:
> >>
> >> Patman outputs a line for every edition of the series in every patch,
> >> regardless of whether any changes were made. This can result in many
> >> redundant lines in patch changelogs, especially when a patch did not exist
> >> before a certain revision. For example, the existing behaviour could result
> >> in a changelog of
> >>
> >> Changes in v7: None
> >> Changes in v6: None
> >> Changes in v5:
> >> - Make a change
> >>
> >> Changes in v4: None
> >>
> >> Changes in v3:
> >> - New
> >>
> >> Changes in v2: None
> >>
> >> With this patch applied and with --no-empty-changes, the same patch would
> >> look like
> >>
> >> (no changes since v5)
> >>
> >> Changes in v5:
> >> - Make a change
> >>
> >> Changes in v3:
> >> - New
> >>
> >> This is entirely aesthetic, but I think it reduces clutter, especially for
> >> patches added later on in a series.
> >>
> >> Signed-off-by: Sean Anderson 
> >> ---
> >>
> >> Changes in v3:
> >> - Document empty changelog suppression in README
> >> - Fix KeyError when running tests
> >> - Fix no changes message being output for revision 1
> >> - Fix no changes message sometimes being output before every
> >>   non-newest-revision change
> >> - Make the newest_version logic more robust (and ugly)
> >> - Update commit subject
> >>
> >> Changes in v2:
> >> - Add a note when there are no changes in the current revision
> >> - Make this the default behaviour, and remove the option
> >>
> >>  tools/patman/README| 21 
> >>  tools/patman/series.py | 44 +++---
> >>  2 files changed, 54 insertions(+), 11 deletions(-)
> >
> > Reviewed-by: Simon Glass 
> >
> > Please see comment below though.
> >
> > [..]
> >
> >> diff --git a/tools/patman/series.py b/tools/patman/series.py
> >> index 6d9d48b123..4359442174 100644
> >> --- a/tools/patman/series.py
> >> +++ b/tools/patman/series.py
> >> @@ -146,38 +146,60 @@ class Series(dict):
> >>  Changes in v4:
> >>  - Jog the dial back closer to the widget
> >>
> >> -Changes in v3: None
> >>  Changes in v2:
> >>  - Fix the widget
> >>  - Jog the dial
> >>
> >> -etc.
> >> +If there are no new changes in a patch, a note will be added
> >> +
> >> +(no changes since v2)
> >> +
> >> +Changes in v2:
> >> +- Fix the widget
> >> +- Jog the dial
> >>  """
> >> +versions = sorted(self.changes, reverse=True)
> >> +newest_version = 1
> >> +try:
> >> +newest_version = max(newest_version, int(self.version))
> >> +except (ValueError, KeyError):
> >> +pass
> >> +try:
> >> +newest_version = max(newest_version, versions[0])
> >> +except IndexError:
> >> +pass
> >
> > Can we do this without exceptions so it is more deterministic?
> >
> > E.g.
> >
> > if 'version' in self:
> >newest_version = max(newest_version, int(self.version))
> > if versions:
> >newest_version = max(newest_version, versions[0])
>
> Is it fine to not check for ValueError in this instance? I noticed that
> the other area where it's used also doesn't check, however that is in
> DoChecks (and also doesn't check if the key exists either).

If the tests pass then you probably don't need checks. Having said
that the test coverage is not 100%, so do a bit of manual testing too.

I'm fine with raising an error if something is wrong. I just don't
like using exceptions to figure out what to do.

Regards,
Simon


Re: [PATCH v5 1/2] drivers: gpio: add broadcom iproc gpio driver support

2020-05-04 Thread Simon Glass
Hi Rayagonda,

On Mon, 4 May 2020 at 10:00, Rayagonda Kokatanur
 wrote:
>
> Add gpio driver support for Broadcom iproc-based socs.
>

This seems to be missing a change log. Can I suggest using patman to
make this automatic?

> Signed-off-by: Rayagonda Kokatanur 
> Signed-off-by: Sheetal Tigadoli 
> ---
>  drivers/gpio/Kconfig  |  11 ++
>  drivers/gpio/Makefile |   1 +
>  drivers/gpio/iproc_gpio.c | 275 ++
>  3 files changed, 287 insertions(+)
>  create mode 100644 drivers/gpio/iproc_gpio.c
>
Regards,
Simon


Re: [PATCH 1/4] kbuild: efi: Avoid rebuilding efi targets

2020-05-04 Thread Heinrich Schuchardt
On 5/4/20 2:38 PM, Jan Kiszka wrote:
> From: Jan Kiszka 
>
> Add a couple of missing targets so that helloworld and other efi targets
> are not needlessly rebuilt.
>
> CC: Heinrich Schuchardt 
> Signed-off-by: Jan Kiszka 

Tested-by: Heinrich Schuchardt 

> ---
>  lib/efi_loader/Makefile | 1 +
>  scripts/Makefile.lib| 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
> index eff3c25ec3..84d61df55b 100644
> --- a/lib/efi_loader/Makefile
> +++ b/lib/efi_loader/Makefile
> @@ -17,6 +17,7 @@ CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
>
>  ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
>  always += helloworld.efi
> +targets += helloworld.o
>  endif
>
>  obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 63fbadd757..734001c952 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -418,6 +418,8 @@ $(obj)/efi_reloc.o: 
> $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun
>  $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o 
> $(obj)/efi_freestanding.o
>   $(call cmd,efi_ld)
>
> +targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
> +
>  # ACPI
>  # ---
>  #
> --
> 2.26.1
>



Re: [PATCH 1/2] arm: mvebu: armada-370-xp.dtsi: add u-boot,dm-pre-reloc to spi0

2020-05-04 Thread Ezra Buehler
Hi Chris,

> On 4 May 2020, at 10:04, Chris Packham  wrote:
> 
> I think this would be better in the specific board dts files. Not every 
> platform will want this in spl.

Thanks for the input, I can do that. However, please note that before,
the "spi0" node was under "internal-regs" which had the
"u-boot,dm-pre-reloc" property. Commit c265bbe4d (rm: sync armada-xp dts
files from Linux 5.0) moved the node out and removed the U-Boot-specific
property. The property was then added again to "internal-regs" with
commit "1718a9f3b7 (arm: mvebu: armada-370-xp.dtsi: Add "u-boot,
dm-pre-reloc" to "internal-regs") but not to the spi0 node. So basically
this patch restores the previous behavior. What is better?

Cheers,
Ezra.



Re: [PATCH] clk: Fix clk func names in comments

2020-05-04 Thread Jagan Teki
On Fri, May 1, 2020 at 11:45 PM Jagan Teki  wrote:
>
> clk function names in comments should be prefix with
> clk instead of clock.
>
> Fix it.
>
> Cc: Simon Glass 
> Cc: Tom Rini 
> Signed-off-by: Jagan Teki 
> ---

+ Lukasz


Re: Please pull u-boot-marvell/master

2020-05-04 Thread Tom Rini
On Mon, May 04, 2020 at 08:54:26AM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull these 2 MVEBU related fixes.
> 
> Here the Azure build, without any issues:
> 
> https://dev.azure.com/sr0718/u-boot/_build/results?buildId=6&view=results
> 
> Thanks,
> Stefan
> 
> The following changes since commit c693f212c5b0433b3a49a89d87cbff28bf78eb87:
> 
>   Merge branch '2020-05-01-master-imports' (2020-05-01 16:43:15 -0400)
> 
> are available in the Git repository at:
> 
>   g...@gitlab.denx.de:u-boot/custodians/u-boot-marvell.git
> 
> for you to fetch changes up to b40745e5c29a45ebe7efce53a1e3ba751d0ef351:
> 
>   cmd: mvebu: bubt: fix quoted string split across lines (2020-05-04
> 07:04:04 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-x86

2020-05-04 Thread Tom Rini
On Mon, May 04, 2020 at 05:31:53PM +0800, Bin Meng wrote:

> Hi Tom,
> 
> This PR includes the following x86 changes for v2020.07 release:
> 
> - Support 64-bit U-Boot as the payload for coreboot x86
> 
> The following changes since commit c693f212c5b0433b3a49a89d87cbff28bf78eb87:
> 
>   Merge branch '2020-05-01-master-imports' (2020-05-01 16:43:15 -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 538437ed39e01b7ecfa79669982fe7db51fb2e1b:
> 
>   x86: Add a 64-bit 'coreboot64' build (2020-05-04 15:28:28 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom

signature.asc
Description: PGP signature


Re: [GIT PULL] Pull request: u-boot-imx u-boot-imx-20200502

2020-05-04 Thread Tom Rini
On Sat, May 02, 2020 at 11:25:21AM +0200, Stefano Babic wrote:

> Hi Tom,
> 
> please pull form u-boot-imx, thanks !
> 
> The following changes since commit 78021b63373de32335bd204471d6cb7c7e18bc52:
> 
>   Merge tag 'efi-2020-07-rc2' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-efi (2020-04-30 15:11:06
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> tags/u-boot-imx-20200502
> 
> for you to fetch changes up to ea0f768e2c835d2b77bdc1db7d4ab1416e45e432:
> 
>   clk: imx: clk-imxrt1050: fix lcdif clock gate (2020-05-01 19:03:25 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v8 00/14] Add support for MediaTek xHCI host controller

2020-05-04 Thread Tom Rini
On Mon, May 04, 2020 at 06:52:17PM +0200, Frank Wunderlich wrote:
> 
> 
> Am 2. Mai 2020 12:32:56 MESZ schrieb Marek Vasut :
> >Applied, thanks.
> 
> Hi Tom,
> 
> Can you merge it too?

When Marek sends me a PR with it, yes.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v3 4/5] net: phy: Add support for TI PHY init

2020-05-04 Thread Dan Murphy

Michal

On 5/4/20 4:46 AM, Michal Simek wrote:

On 30. 04. 20 18:30, Dan Murphy wrote:

ti_phy_init function was allocated to the DP83867 PHY.  This function
name is to generic for a specific PHY.  The function can be moved to a
TI specific file that can register all TI PHYs that are defined in the
defconfig.  The ti_phy_init file will contain all TI PHYs initialization
so that only phy_ti_init can be called from the framework.

In addition to the above the config flag for the DP83867 needs to be changed
in the Kconfig and dependent defconfig files. The config flag that was
used for the DP83867 was also generic in nature so a more specific
config flag for the DP83867 was created.

Acked-by: Michal Simek 
Signed-off-by: Dan Murphy 
---
  configs/am65x_evm_a53_defconfig  |  2 +-
  configs/am65x_hs_evm_a53_defconfig   |  2 +-
  configs/dra7xx_evm_defconfig |  2 +-
  configs/dra7xx_hs_evm_defconfig  |  2 +-
  configs/dra7xx_hs_evm_usb_defconfig  |  2 +-
  configs/j721e_evm_a72_defconfig  |  2 +-
  configs/j721e_hs_evm_a72_defconfig   |  2 +-
  configs/k2g_evm_defconfig|  2 +-
  configs/xilinx_versal_virt_defconfig |  2 +-
  configs/xilinx_zynqmp_virt_defconfig |  2 +-
  drivers/net/phy/Kconfig  | 15 +++
  drivers/net/phy/Makefile |  3 ++-
  drivers/net/phy/dp83867.c|  3 ++-
  drivers/net/phy/ti_phy_init.c| 18 ++
  drivers/net/phy/ti_phy_init.h| 15 +++
  15 files changed, 62 insertions(+), 12 deletions(-)
  create mode 100644 drivers/net/phy/ti_phy_init.c
  create mode 100644 drivers/net/phy/ti_phy_init.h

diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 542bbd992c53..c8cc9b2f7d8d 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -101,7 +101,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
  CONFIG_SPI_FLASH_STMICRO=y
  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
  CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_PHY_FIXED=y
  CONFIG_DM_ETH=y
  CONFIG_E1000=y
diff --git a/configs/am65x_hs_evm_a53_defconfig 
b/configs/am65x_hs_evm_a53_defconfig
index 9f43cee39611..738bd01b059f 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -103,7 +103,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
  CONFIG_SPI_FLASH_STMICRO=y
  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
  CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_PHY_FIXED=y
  CONFIG_DM_ETH=y
  CONFIG_E1000=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 4d765da4e052..9ad462cdc6de 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -86,7 +86,7 @@ CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_MODE=0
  CONFIG_SF_DEFAULT_SPEED=7680
  CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_DM_ETH=y
  CONFIG_PHY_GIGE=y
  CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index c25d4ce5c142..9aa452460765 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -89,7 +89,7 @@ CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_MODE=0
  CONFIG_SF_DEFAULT_SPEED=7680
  CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_DM_ETH=y
  CONFIG_PHY_GIGE=y
  CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_usb_defconfig 
b/configs/dra7xx_hs_evm_usb_defconfig
index 8e74496b2ccd..d282468212e9 100644
--- a/configs/dra7xx_hs_evm_usb_defconfig
+++ b/configs/dra7xx_hs_evm_usb_defconfig
@@ -87,7 +87,7 @@ CONFIG_SF_DEFAULT_MODE=0
  CONFIG_SF_DEFAULT_SPEED=7680
  CONFIG_SPI_FLASH_BAR=y
  CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_DM_ETH=y
  CONFIG_PHY_GIGE=y
  CONFIG_MII=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index e9e82bb4309d..29ae8d720753 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -124,7 +124,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
  CONFIG_SPI_FLASH_STMICRO=y
  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
  CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_PHY_FIXED=y
  CONFIG_DM_ETH=y
  CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/j721e_hs_evm_a72_defconfig 
b/configs/j721e_hs_evm_a72_defconfig
index a723e2718e5e..7174fda72a01 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -114,7 +114,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
  CONFIG_SPI_FLASH_STMICRO=y
  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
  CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
  CONFIG_PHY_FIXED=y
  CONFIG_DM_ETH=y
  CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index 5abf5faa450e..14cf1b997d91 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -58,7 +58,7 @@ CONFIG_PHYLIB=y
  CONFIG_PHY_MARVELL=y
  CONFIG_PHY_MICREL=y

Re: [PATCH] rsa: fix alignment issue when getting public exponent

2020-05-04 Thread Simon Glass
Hi Heiko,

On Mon, 4 May 2020 at 09:40, Heiko Stübner  wrote:
>
> Am Montag, 4. Mai 2020, 16:17:52 CEST schrieb Simon Glass:
> > +Tom Rini
> >
> > On Sun, 3 May 2020 at 05:26, Heiko Stuebner  wrote:
> > >
> > > From: Heiko Stuebner 
> > >
> > > To fill the exponent field of the rsa_public_key struct, rsa_mod_exp_sw
> > > did a cast to uint64_t of the key_prop->public_exponent field.
> > > But that alignment is not guaranteed in all cases.
> > >
> > > This came to light when in my spl-fit-signature the key-name exceeded
> > > a certain length and with it the verification then started failing.
> > > (naming it "integrity" worked fine, "integrity-uboot" failed)
> > >
> > > key_prop.public_exponent itself is actually a void-pointer, fdt_getprop()
> > > also just returns such a void-pointer and inside the devicetree the 64bit
> > > exponent is represented as 2 32bit numbers, so assuming a 64bit alignment
> > > can lead to false reads.
> > >
> > > So just use the already existing rsa_convert_big_endian() to do the actual
> > > conversion from the dt's big-endian to the needed uint64 value.
> > >
> > > Fixes: fc2f4246b4b3 ("rsa: Split the rsa-verify to separate the modular 
> > > exponentiation")
> > > Signed-off-by: Heiko Stuebner 
> > > ---
> > >  lib/rsa/rsa-mod-exp.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> >
> > Nice find! This probably changed when we updated the DT recently since
> > the unaligned-access thing was reverted I think. Or has this problem
> > been there forever?
>
> To me it looks like it must've been present since the beginning.
> In commit e0f2f1553414 ("Implement generalised RSA public exponents for 
> verified boot")
> which introduced the exponent handling it already did:
>
> const uint64_t *public_exponent;
> public_exponent = fdt_getprop(blob, node, "rsa,exponent", &length);
>
> So if the fdt_getprop internals didn't change since then it would've
> even then cast the void* to an uint64*
>

See this patch:

e8c2d25845 libfdt: Revert 6dcb8ba4 from upstream libfdt

> I really don't understand yet why the longer key-name would trigger it
> though ... names like "dev", "integrity" work fine and seemingly starting
> at a certain length the alignment changed.

My guess is that these lengths work:

1-3 chars (aligns to 4 bytes)
8-11 chars (aligns to 12 bytes)
16-19 chars (aligns to 20 bytes)
etc.

Regards,
Simon


Re: [PATCH v3 2/4] patman: Suppress empty changelog entries

2020-05-04 Thread Sean Anderson
On 5/4/20 10:39 AM, Simon Glass wrote:
> Hi Sean,
> 
> On Sun, 3 May 2020 at 15:55, Sean Anderson  wrote:
>>
>> Patman outputs a line for every edition of the series in every patch,
>> regardless of whether any changes were made. This can result in many
>> redundant lines in patch changelogs, especially when a patch did not exist
>> before a certain revision. For example, the existing behaviour could result
>> in a changelog of
>>
>> Changes in v7: None
>> Changes in v6: None
>> Changes in v5:
>> - Make a change
>>
>> Changes in v4: None
>>
>> Changes in v3:
>> - New
>>
>> Changes in v2: None
>>
>> With this patch applied and with --no-empty-changes, the same patch would
>> look like
>>
>> (no changes since v5)
>>
>> Changes in v5:
>> - Make a change
>>
>> Changes in v3:
>> - New
>>
>> This is entirely aesthetic, but I think it reduces clutter, especially for
>> patches added later on in a series.
>>
>> Signed-off-by: Sean Anderson 
>> ---
>>
>> Changes in v3:
>> - Document empty changelog suppression in README
>> - Fix KeyError when running tests
>> - Fix no changes message being output for revision 1
>> - Fix no changes message sometimes being output before every
>>   non-newest-revision change
>> - Make the newest_version logic more robust (and ugly)
>> - Update commit subject
>>
>> Changes in v2:
>> - Add a note when there are no changes in the current revision
>> - Make this the default behaviour, and remove the option
>>
>>  tools/patman/README| 21 
>>  tools/patman/series.py | 44 +++---
>>  2 files changed, 54 insertions(+), 11 deletions(-)
> 
> Reviewed-by: Simon Glass 
> 
> Please see comment below though.
> 
> [..]
> 
>> diff --git a/tools/patman/series.py b/tools/patman/series.py
>> index 6d9d48b123..4359442174 100644
>> --- a/tools/patman/series.py
>> +++ b/tools/patman/series.py
>> @@ -146,38 +146,60 @@ class Series(dict):
>>  Changes in v4:
>>  - Jog the dial back closer to the widget
>>
>> -Changes in v3: None
>>  Changes in v2:
>>  - Fix the widget
>>  - Jog the dial
>>
>> -etc.
>> +If there are no new changes in a patch, a note will be added
>> +
>> +(no changes since v2)
>> +
>> +Changes in v2:
>> +- Fix the widget
>> +- Jog the dial
>>  """
>> +versions = sorted(self.changes, reverse=True)
>> +newest_version = 1
>> +try:
>> +newest_version = max(newest_version, int(self.version))
>> +except (ValueError, KeyError):
>> +pass
>> +try:
>> +newest_version = max(newest_version, versions[0])
>> +except IndexError:
>> +pass
> 
> Can we do this without exceptions so it is more deterministic?
> 
> E.g.
> 
> if 'version' in self:
>newest_version = max(newest_version, int(self.version))
> if versions:
>newest_version = max(newest_version, versions[0])

Is it fine to not check for ValueError in this instance? I noticed that
the other area where it's used also doesn't check, however that is in
DoChecks (and also doesn't check if the key exists either).

--Sean


Re: [PATCH v8 00/14] Add support for MediaTek xHCI host controller

2020-05-04 Thread Frank Wunderlich



Am 2. Mai 2020 12:32:56 MESZ schrieb Marek Vasut :
>Applied, thanks.

Hi Tom,

Can you merge it too?

Regards Frank
regards Frank


Re: [PATCH] cmd: mem: Remove CONFIG_SYS_MEMTEST_SCRATCH mapping

2020-05-04 Thread Stefan Roese

On 04.05.20 13:54, Michal Simek wrote:

There is no real need to exactly define space for saving patterns for
alternate memory test. It is much easier to allocate space on the stack and
use it instead of trying to find out space where pattern should be saved.

For example if you want to test the whole DDR memory you can't save patter
to DDR and you need to find it out. On Xilinx devices DDR or OCM addresses
were chosen but that means that OCM needs to be mapped and U-Boot has
access permission there.

It is easier to remove this limitation and simply save it on stack because
it is very clear that memory test can't rewrite U-Boot and U-Boot has also
full access to memory where runs from.

Signed-off-by: Michal Simek 
---

  README   | 4 
  cmd/mem.c| 9 ++---
  include/configs/MigoR.h  | 1 -
  include/configs/advantech_dms-ba16.h | 1 -
  include/configs/apalis_imx6.h| 1 -
  include/configs/aristainetos2.h  | 1 -
  include/configs/armadillo-800eva.h   | 1 -
  include/configs/blanche.h| 1 -
  include/configs/cgtqmx6eval.h| 1 -
  include/configs/colibri_imx6.h   | 1 -
  include/configs/dh_imx6.h| 1 -
  include/configs/el6x_common.h| 1 -
  include/configs/embestmx6boards.h| 1 -
  include/configs/ge_bx50v3.h  | 1 -
  include/configs/gw_ventana.h | 1 -
  include/configs/imx6_logic.h | 1 -
  include/configs/kzm9g.h  | 1 -
  include/configs/mx6sabre_common.h| 1 -
  include/configs/nitrogen6x.h | 1 -
  include/configs/presidio_asic.h  | 1 -
  include/configs/sh7752evb.h  | 1 -
  include/configs/sh7753evb.h  | 1 -
  include/configs/sh7757lcr.h  | 1 -
  include/configs/stm32mp1.h   | 1 -
  include/configs/tao3530.h| 1 -
  include/configs/tricorder.h  | 1 -
  include/configs/xilinx_versal.h  | 1 -
  include/configs/xilinx_versal_mini.h | 1 -
  include/configs/xilinx_zynqmp.h  | 4 
  include/configs/xilinx_zynqmp_mini.h | 1 -
  include/configs/xilinx_zynqmp_r5.h   | 1 -
  scripts/config_whitelist.txt | 1 -
  32 files changed, 2 insertions(+), 44 deletions(-)


Reviewed-by: Stefan Roese 

Thanks,
Stefan


Re: [PATCH] cmd: mem: Remove CONFIG_SYS_MEMTEST_SCRATCH mapping

2020-05-04 Thread Simon Glass
On Mon, 4 May 2020 at 05:54, Michal Simek  wrote:
>
> There is no real need to exactly define space for saving patterns for
> alternate memory test. It is much easier to allocate space on the stack and
> use it instead of trying to find out space where pattern should be saved.
>
> For example if you want to test the whole DDR memory you can't save patter
> to DDR and you need to find it out. On Xilinx devices DDR or OCM addresses
> were chosen but that means that OCM needs to be mapped and U-Boot has
> access permission there.
>
> It is easier to remove this limitation and simply save it on stack because
> it is very clear that memory test can't rewrite U-Boot and U-Boot has also
> full access to memory where runs from.
>
> Signed-off-by: Michal Simek 
> ---
>
>  README   | 4 
>  cmd/mem.c| 9 ++---
>  include/configs/MigoR.h  | 1 -
>  include/configs/advantech_dms-ba16.h | 1 -
>  include/configs/apalis_imx6.h| 1 -
>  include/configs/aristainetos2.h  | 1 -
>  include/configs/armadillo-800eva.h   | 1 -
>  include/configs/blanche.h| 1 -
>  include/configs/cgtqmx6eval.h| 1 -
>  include/configs/colibri_imx6.h   | 1 -
>  include/configs/dh_imx6.h| 1 -
>  include/configs/el6x_common.h| 1 -
>  include/configs/embestmx6boards.h| 1 -
>  include/configs/ge_bx50v3.h  | 1 -
>  include/configs/gw_ventana.h | 1 -
>  include/configs/imx6_logic.h | 1 -
>  include/configs/kzm9g.h  | 1 -
>  include/configs/mx6sabre_common.h| 1 -
>  include/configs/nitrogen6x.h | 1 -
>  include/configs/presidio_asic.h  | 1 -
>  include/configs/sh7752evb.h  | 1 -
>  include/configs/sh7753evb.h  | 1 -
>  include/configs/sh7757lcr.h  | 1 -
>  include/configs/stm32mp1.h   | 1 -
>  include/configs/tao3530.h| 1 -
>  include/configs/tricorder.h  | 1 -
>  include/configs/xilinx_versal.h  | 1 -
>  include/configs/xilinx_versal_mini.h | 1 -
>  include/configs/xilinx_zynqmp.h  | 4 
>  include/configs/xilinx_zynqmp_mini.h | 1 -
>  include/configs/xilinx_zynqmp_r5.h   | 1 -
>  scripts/config_whitelist.txt | 1 -
>  32 files changed, 2 insertions(+), 44 deletions(-)

Reviewed-by: Simon Glass 


[PATCH] cmd: mem: Remove CONFIG_SYS_MEMTEST_SCRATCH mapping

2020-05-04 Thread Michal Simek
There is no real need to exactly define space for saving patterns for
alternate memory test. It is much easier to allocate space on the stack and
use it instead of trying to find out space where pattern should be saved.

For example if you want to test the whole DDR memory you can't save patter
to DDR and you need to find it out. On Xilinx devices DDR or OCM addresses
were chosen but that means that OCM needs to be mapped and U-Boot has
access permission there.

It is easier to remove this limitation and simply save it on stack because
it is very clear that memory test can't rewrite U-Boot and U-Boot has also
full access to memory where runs from.

Signed-off-by: Michal Simek 
---

 README   | 4 
 cmd/mem.c| 9 ++---
 include/configs/MigoR.h  | 1 -
 include/configs/advantech_dms-ba16.h | 1 -
 include/configs/apalis_imx6.h| 1 -
 include/configs/aristainetos2.h  | 1 -
 include/configs/armadillo-800eva.h   | 1 -
 include/configs/blanche.h| 1 -
 include/configs/cgtqmx6eval.h| 1 -
 include/configs/colibri_imx6.h   | 1 -
 include/configs/dh_imx6.h| 1 -
 include/configs/el6x_common.h| 1 -
 include/configs/embestmx6boards.h| 1 -
 include/configs/ge_bx50v3.h  | 1 -
 include/configs/gw_ventana.h | 1 -
 include/configs/imx6_logic.h | 1 -
 include/configs/kzm9g.h  | 1 -
 include/configs/mx6sabre_common.h| 1 -
 include/configs/nitrogen6x.h | 1 -
 include/configs/presidio_asic.h  | 1 -
 include/configs/sh7752evb.h  | 1 -
 include/configs/sh7753evb.h  | 1 -
 include/configs/sh7757lcr.h  | 1 -
 include/configs/stm32mp1.h   | 1 -
 include/configs/tao3530.h| 1 -
 include/configs/tricorder.h  | 1 -
 include/configs/xilinx_versal.h  | 1 -
 include/configs/xilinx_versal_mini.h | 1 -
 include/configs/xilinx_zynqmp.h  | 4 
 include/configs/xilinx_zynqmp_mini.h | 1 -
 include/configs/xilinx_zynqmp_r5.h   | 1 -
 scripts/config_whitelist.txt | 1 -
 32 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/README b/README
index 083485067654..4efacf337b74 100644
--- a/README
+++ b/README
@@ -2479,10 +2479,6 @@ Configuration Settings:
Begin and End addresses of the area used by the
simple memory test.
 
-- CONFIG_SYS_MEMTEST_SCRATCH:
-   Scratch address used by the alternate memory test
-   You only need to set this if address zero isn't writeable
-
 - CONFIG_SYS_MEM_RESERVE_SECURE
Only implemented for ARMv8 for now.
If defined, the size of CONFIG_SYS_MEM_RESERVE_SECURE memory
diff --git a/cmd/mem.c b/cmd/mem.c
index 009b7b58f328..18f0510098be 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -25,10 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_SYS_MEMTEST_SCRATCH
-#define CONFIG_SYS_MEMTEST_SCRATCH 0
-#endif
-
 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
 
 /* Display values from last command.
@@ -922,7 +918,8 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int 
argc,
char * const argv[])
 {
ulong start, end;
-   vu_long *buf, *dummy;
+   vu_long scratch_space;
+   vu_long *buf, *dummy = &scratch_space;
ulong iteration_limit = 0;
ulong count = 0;
ulong errs = 0; /* number of errors, or -1 if interrupted */
@@ -958,7 +955,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int 
argc,
  start, end);
 
buf = map_sysmem(start, end - start);
-   dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long));
for (iteration = 0;
!iteration_limit || iteration < iteration_limit;
iteration++) {
@@ -988,7 +984,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int 
argc,
}
 
unmap_sysmem((void *)buf);
-   unmap_sysmem((void *)dummy);
 
if (errs == -1UL) {
/* Memory test was aborted - write a newline to finish off */
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h
index c58b7814ba94..2421300e1e13 100644
--- a/include/configs/MigoR.h
+++ b/include/configs/MigoR.h
@@ -32,7 +32,6 @@
 
 /* Enable alternate, more extensive, memory test */
 /* Scratch address used by the alternate memory test */
-#undef  CONFIG_SYS_MEMTEST_SCRATCH
 
 /* Enable temporary baudrate change while serial download */
 #undef  CONFIG_SYS_LOADS_BAUD_CHANGE
diff --git a/include/configs/advantech_dms-ba16.h 
b/include/configs/advantech_dms-ba16.h
index deb4374d1c4a..b7b1ac2f89b7 100644
--- a/include/configs/advantech_dms-ba16.h
+++ b/include/configs/advantech_dms-ba16.h
@@ -185,7 +185,6 @@
 
 #define CONFIG_SYS_MEMTEST_START   0x1000
 #define CONFIG_SYS_MEMTEST_END 0x1001
-#define CONFIG_SYS_MEMTEST_SCRATCH 0x1080
 
 #define CONFIG_SYS_LOAD_ADDR   CONF

[PATCH v5 1/2] drivers: gpio: add broadcom iproc gpio driver support

2020-05-04 Thread Rayagonda Kokatanur
Add gpio driver support for Broadcom iproc-based socs.

Signed-off-by: Rayagonda Kokatanur 
Signed-off-by: Sheetal Tigadoli 
---
 drivers/gpio/Kconfig  |  11 ++
 drivers/gpio/Makefile |   1 +
 drivers/gpio/iproc_gpio.c | 275 ++
 3 files changed, 287 insertions(+)
 create mode 100644 drivers/gpio/iproc_gpio.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 2081520f42..57d2cd2e75 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -135,6 +135,17 @@ config IMX_RGPIO2P
help
  This driver supports i.MX7ULP Rapid GPIO2P controller.
 
+config IPROC_GPIO
+   bool "Broadcom iProc GPIO driver(without pinconf)"
+   default n
+   help
+ The Broadcom iProc based SoCs- Cygnus, NS2, NS3, NSP and Stingray,
+ use the same GPIO Controller IP hence this driver could be used
+ for all.
+
+ The Broadcom iProc based SoCs have multiple GPIO controllers and only
+ the always-ON GPIO controller (CRMU/AON) is supported by this driver.
+
 config HSDK_CREG_GPIO
bool "HSDK CREG GPIO griver"
depends on DM_GPIO
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 7638259007..5dc5849477 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_CORTINA_GPIO)  += cortina_gpio.o
 obj-$(CONFIG_INTEL_GPIO)   += intel_gpio.o
 obj-$(CONFIG_INTEL_ICH6_GPIO)  += intel_ich6_gpio.o
 obj-$(CONFIG_INTEL_BROADWELL_GPIO) += intel_broadwell_gpio.o
+obj-$(CONFIG_IPROC_GPIO)   += iproc_gpio.o
 obj-$(CONFIG_KIRKWOOD_GPIO)+= kw_gpio.o
 obj-$(CONFIG_KONA_GPIO)+= kona_gpio.o
 obj-$(CONFIG_MARVELL_GPIO) += mvgpio.o
diff --git a/drivers/gpio/iproc_gpio.c b/drivers/gpio/iproc_gpio.c
new file mode 100644
index 00..f75831d6e7
--- /dev/null
+++ b/drivers/gpio/iproc_gpio.c
@@ -0,0 +1,275 @@
+// SPDX-License-Identifier:  GPL-2.0+
+/*
+ * Copyright (C) 2020 Broadcom
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * There are five GPIO bank register. Each bank can configure max of 32 gpios.
+ * BANK0 - gpios 0 to 31
+ * BANK1 - gpios 32 to 63
+ * BANK2 - gpios 64 to 95
+ * BANK3 - gpios 96 to 127
+ * BANK4 - gpios 128 to 150
+ *
+ * Offset difference between consecutive bank register is 0x200
+ */
+#define NGPIO_PER_BANK 32
+#define GPIO_BANK_SIZE 0x200
+#define GPIO_BANK(pin) ((pin) / NGPIO_PER_BANK)
+#define IPROC_GPIO_SHIFT(pin)  ((pin) % NGPIO_PER_BANK)
+#define IPROC_GPIO_REG(pin, reg) (GPIO_BANK_SIZE * GPIO_BANK(pin) + (reg))
+
+/* device register offset */
+#define IPROC_GPIO_DATA_IN_OFFSET   0x00
+#define IPROC_GPIO_DATA_OUT_OFFSET  0x04
+#define IPROC_GPIO_OUT_EN_OFFSET0x08
+
+/**
+ * struct iproc_gpio_pctrl_map - mapping between gpio and pinctrl specfied
+ *  using gpio-ranges parameter in dt.
+ * @gpio_pin:  start of gpio number in gpio-ranges
+ * @pctrl_pin: start of pinctrl number in gpio-ranges
+ * @npins: total number of pins in gpio-ranges
+ * @node:  list node
+ */
+struct iproc_gpio_pctrl_map {
+   u32 gpio_pin;
+   u32 pctrl_pin;
+   u32 npins;
+   struct list_head node;
+};
+
+/**
+ * struct iproc_gpio_pctrl_map - gpio device instance
+ * @pinctrl_dev:pointer to pinctrl device
+ * @gpiomap:   list node having mapping between gpio and pinctrl
+ * @base:  I/O register base address of gpio device
+ * @name:  gpio device name, ex GPIO0, GPIO1
+ * @ngpios:total number of gpios
+ */
+struct iproc_gpio_platdata {
+   struct udevice *pinctrl_dev;
+   struct list_head gpiomap;
+   void __iomem *base;
+   char *name;
+   u32 ngpios;
+};
+
+/**
+ *  iproc_gpio_set_bit - set or clear one bit (corresponding to the GPIO pin)
+ *  in a iproc GPIO register
+ *
+ *  @iproc_gpio: Iproc GPIO device
+ *  @reg: register offset
+ *  @gpio: GPIO pin
+ *  @set: set or clear
+ */
+static inline void iproc_gpio_set_bit(struct iproc_gpio_platdata *plat,
+ u32 reg, u32 gpio, bool set)
+{
+   u32 offset = IPROC_GPIO_REG(gpio, reg);
+   u32 shift = IPROC_GPIO_SHIFT(gpio);
+
+   clrsetbits_le32(plat->base + offset, BIT(shift),
+   (set ? BIT(shift) : 0));
+}
+
+static inline bool iproc_gpio_get_bit(struct iproc_gpio_platdata *plat,
+ u32 reg, u32 gpio)
+{
+   u32 offset = IPROC_GPIO_REG(gpio, reg);
+   u32 shift = IPROC_GPIO_SHIFT(gpio);
+
+   return readl(plat->base + offset) & BIT(shift);
+}
+
+static u32 iproc_get_pctrl_from_gpio(struct iproc_gpio_platdata *plat, u32 
gpio)
+{
+   struct iproc_gpio_pctrl_map *range = NULL;
+   struct list_head *pos, *tmp;
+   u32 ret = 0;
+
+   list_for_each_safe(pos, tmp, &plat->gpiomap) {
+   range = list_entry(pos, struct iproc_gpio_pctrl_map, node);
+   if (gpio == range->gpio_pi

[PATCH v5 0/2] add brcm iproc gpio driver

2020-05-04 Thread Rayagonda Kokatanur
Add support for broadcom iproc gpio driver.

Changes from v4:
 -Address review comments from Simon Glass,
  Check for function return value.

Changes from v3:
 -Address review comments from Simon Glass,
  Rearrange header file,
  Add struct comment taking about members,
  Use clrsetbits_le32(),
  Add new line before return etc.
 
Changes from v2:
 -remove ununsed variable "node" in iproc_get_gpio_pctrl_mapping()
  func to fix compilation warning.

Changes from v1:
 -Address review comments from Simon Glass,
  Use dev_read_...() instead of fdtdec_...().

Rayagonda Kokatanur (2):
  drivers: gpio: add broadcom iproc gpio driver support
  gpio: do not include  on TARGET_BCMNS3

 arch/arm/include/asm/gpio.h |   2 +-
 drivers/gpio/Kconfig|  11 ++
 drivers/gpio/Makefile   |   1 +
 drivers/gpio/iproc_gpio.c   | 275 
 4 files changed, 288 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpio/iproc_gpio.c

-- 
2.17.1



[PATCH v5 2/2] gpio: do not include on TARGET_BCMNS3

2020-05-04 Thread Rayagonda Kokatanur
As no gpio.h is defined for this architecture, to avoid
compilation failure, do not include  for
arch bcmns3.

Signed-off-by: Rayagonda Kokatanur 
Reviewed-by: Simon Glass 
---
 arch/arm/include/asm/gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 333e407b66..c067eeb649 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -6,7 +6,7 @@
!defined(CONFIG_ARCH_LS1088A) && !defined(CONFIG_ARCH_ASPEED) && \
!defined(CONFIG_ARCH_LS1012A) && !defined(CONFIG_ARCH_LS1043A) && \
!defined(CONFIG_ARCH_LS1046A) && !defined(CONFIG_ARCH_U8500) && \
-   !defined(CONFIG_CORTINA_PLATFORM)
+   !defined(CONFIG_CORTINA_PLATFORM) && !defined(CONFIG_TARGET_BCMNS3)
 #include 
 #endif
 #include 
-- 
2.17.1



RE: [PATCH v7 18/22] configs: fu540: Add config options for U-Boot SPL

2020-05-04 Thread Pragnesh Patel
Hi Jagan,

>-Original Message-
>From: Jagan Teki 
>Sent: 02 May 2020 22:22
>To: Pragnesh Patel 
>Cc: U-Boot-Denx ; Atish Patra
>; Palmer Dabbelt ; Bin
>Meng ; Paul Walmsley ;
>Troy Benjegerdes ; Anup Patel
>; Sagar Kadam ; Rick Chen
>; Palmer Dabbelt 
>Subject: Re: [PATCH v7 18/22] configs: fu540: Add config options for U-Boot
>SPL
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>On Sat, May 2, 2020 at 3:38 PM Pragnesh Patel 
>wrote:
>>
>> With sifive_fu540_defconfig:
>>
>> User can use FSBL or u-boot-spl.bin anyone at a time.
>>
>> For FSBL,
>> fsbl->fw_payload.bin (opensbi + U-Boot)
>>
>> For u-boot-spl.bin,
>> u-boot-spl.bin->FIT image (opensbi + U-Boot + dtb)
>>
>> U-Boot SPL will be loaded by ZSBL from SD card (replace fsbl.bin with
>> u-boot-spl.bin) and runs in L2 LIM in machine mode and then load FIT
>> image u-boot.itb from SD card into RAM.
>>
>> U-Boot SPL expects u-boot.itb FIT image at the starting of SD card
>> sector number (0x822) of GUID type "2E54B353-1271-4842-806F-
>E436D6AF6985"
>>
>> Signed-off-by: Pragnesh Patel 
>> ---
>
>squash with 12/22 and 22/22.

IMHO, it's better to squash this patch with 22/22 and squash 12/22 with 17/22.



Re: [PATCH] rsa: fix alignment issue when getting public exponent

2020-05-04 Thread Heiko Stübner
Am Montag, 4. Mai 2020, 16:17:52 CEST schrieb Simon Glass:
> +Tom Rini
> 
> On Sun, 3 May 2020 at 05:26, Heiko Stuebner  wrote:
> >
> > From: Heiko Stuebner 
> >
> > To fill the exponent field of the rsa_public_key struct, rsa_mod_exp_sw
> > did a cast to uint64_t of the key_prop->public_exponent field.
> > But that alignment is not guaranteed in all cases.
> >
> > This came to light when in my spl-fit-signature the key-name exceeded
> > a certain length and with it the verification then started failing.
> > (naming it "integrity" worked fine, "integrity-uboot" failed)
> >
> > key_prop.public_exponent itself is actually a void-pointer, fdt_getprop()
> > also just returns such a void-pointer and inside the devicetree the 64bit
> > exponent is represented as 2 32bit numbers, so assuming a 64bit alignment
> > can lead to false reads.
> >
> > So just use the already existing rsa_convert_big_endian() to do the actual
> > conversion from the dt's big-endian to the needed uint64 value.
> >
> > Fixes: fc2f4246b4b3 ("rsa: Split the rsa-verify to separate the modular 
> > exponentiation")
> > Signed-off-by: Heiko Stuebner 
> > ---
> >  lib/rsa/rsa-mod-exp.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> 
> Nice find! This probably changed when we updated the DT recently since
> the unaligned-access thing was reverted I think. Or has this problem
> been there forever?

To me it looks like it must've been present since the beginning.
In commit e0f2f1553414 ("Implement generalised RSA public exponents for 
verified boot")
which introduced the exponent handling it already did:

const uint64_t *public_exponent;
public_exponent = fdt_getprop(blob, node, "rsa,exponent", &length);

So if the fdt_getprop internals didn't change since then it would've
even then cast the void* to an uint64*


I really don't understand yet why the longer key-name would trigger it
though ... names like "dev", "integrity" work fine and seemingly starting
at a certain length the alignment changed.


Heiko

> Reviewed-by: Simon Glass 
> 






Re: [PATCH 6/8] ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

2020-05-04 Thread Fabio Estevam
On Mon, May 4, 2020 at 12:21 PM Harald Seiler  wrote:

> With or without the revert?

When I change the defconfig like:

--- a/configs/imx8mp_evk_defconfig
+++ b/configs/imx8mp_evk_defconfig
@@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
 CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_SPL_CLK_IMX8MP=y
 CONFIG_CLK_IMX8MP=y
 CONFIG_MXC_GPIO=y
 CONFIG_DM_PCA953X=y

It prints a single SPL line with the revert and also without the revert.


Re: [PATCH 6/8] ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

2020-05-04 Thread Harald Seiler
On Mon, 2020-05-04 at 12:18 -0300, Fabio Estevam wrote:
> On Mon, May 4, 2020 at 12:05 PM Harald Seiler  wrote:
> 
> > "Failed to find clock node. Check device tree" comes from spl_board_init()
> > in board/freescale/imx8mp_evk/spl.c; line 56:
> > 
> > ret = uclass_get_device_by_name(UCLASS_CLK,
> > "clock-controller@3038",
> > &dev);
> > 
> > I see that wdog1 references the same clock here:
> > 
> > arch/arm/dts/imx8mp.dtsi; line 222:
> > 
> > wdog1: watchdog@3028 {
> > compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt";
> > reg = <0x3028 0x1>;
> > interrupts = ;
> > clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>;
> > status = "disabled";
> > };
> > 
> > So the two issues are very likely related.  The relevant clock's node is
> > also enabled for SPL so I think the driver might be missing here.  Maybe
> > you need to add
> > 
> > CONFIG_SPL_CLK_IMX8MP=y
> > 
> > to your defconfig?
> 
> I tried like this:
> 
> --- a/configs/imx8mp_evk_defconfig
> +++ b/configs/imx8mp_evk_defconfig
> @@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
>  CONFIG_SPL_DM=y
> +CONFIG_SPL_CLK_COMPOSITE_CCF=y
>  CONFIG_CLK_COMPOSITE_CCF=y
> +CONFIG_SPL_CLK_IMX8MP=y
>  CONFIG_CLK_IMX8MP=y
>  CONFIG_MXC_GPIO=y
>  CONFIG_DM_PCA953X=y
> 
> but still only prints:
> 
> U-Boot SPL 2020.07-rc1-00014-g8142a97d54-dirty (May 04 2020 - 12:16:25 -0300)

With or without the revert?

-- 
Harald



Re: [PATCH] dm: serial: introduce puts hook

2020-05-04 Thread Simon Glass
Hi Peng,

On Mon, 4 May 2020 at 08:24, Peng Fan  wrote:
>
> Hi Simon,
>
> > Subject: Re: [PATCH] dm: serial: introduce puts hook
> >
> > Hi Peng,
> >
> > On Sun, 3 May 2020 at 06:42, Peng Fan  wrote:
> > >
> > > Introduce puts hook for dm serial driver.
> > >
> > > Signed-off-by: Peng Fan 
> > > ---
> > >  drivers/serial/serial-uclass.c | 13 +++--
> > >  include/serial.h   |  8 
> > >  2 files changed, 19 insertions(+), 2 deletions(-)
> >
> > I'm just wondering why we need this? Isn't serial_putc() enough?
>
> This is to let u-boot could run in a XEN hypervisor DomU virtual machine.
> It is low efficiently if each time, we use putc to let xen dom0 print uboot
> log.

OK that is the sort of thing that should be in the commit message :-)

>
> We could pass a string, not a char to improve performance.

If we are going to do that, I think it would be better to add a
write() call, with a length. It should return the number of bytes
written, since sometimes the port might be full.

The uclass itself needs a serial_write() call which would then fall
back to writing characters if the driver doesn't have the write
method.

Also should have a test.

Regards,
Simon


Re: [PATCH 6/8] ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

2020-05-04 Thread Fabio Estevam
On Mon, May 4, 2020 at 12:05 PM Harald Seiler  wrote:

> "Failed to find clock node. Check device tree" comes from spl_board_init()
> in board/freescale/imx8mp_evk/spl.c; line 56:
>
> ret = uclass_get_device_by_name(UCLASS_CLK,
> "clock-controller@3038",
> &dev);
>
> I see that wdog1 references the same clock here:
>
> arch/arm/dts/imx8mp.dtsi; line 222:
>
> wdog1: watchdog@3028 {
> compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt";
> reg = <0x3028 0x1>;
> interrupts = ;
> clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>;
> status = "disabled";
> };
>
> So the two issues are very likely related.  The relevant clock's node is
> also enabled for SPL so I think the driver might be missing here.  Maybe
> you need to add
>
> CONFIG_SPL_CLK_IMX8MP=y
>
> to your defconfig?

I tried like this:

--- a/configs/imx8mp_evk_defconfig
+++ b/configs/imx8mp_evk_defconfig
@@ -57,7 +57,9 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
 CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_SPL_CLK_IMX8MP=y
 CONFIG_CLK_IMX8MP=y
 CONFIG_MXC_GPIO=y
 CONFIG_DM_PCA953X=y

but still only prints:

U-Boot SPL 2020.07-rc1-00014-g8142a97d54-dirty (May 04 2020 - 12:16:25 -0300)


Re: [PATCH v2 2/2] arm: bcm283x: serial: Move ofdata reading to probe() method

2020-05-04 Thread Matthias Brugger



On 23/03/2020 04:15, Simon Glass wrote:
> We cannot rely on a parent bus that needs to be probed, until we know that
> it is probed. That means that code in the ofdata_to_platdata() method
> cannot rely on the parent bus being probed.
> 
> Move the ofdata code in the two serial drivers into a probe() method.
> 
> This fixes serial output on rpi_3b_32b with the following config.txt
> options:
> 
>enable_uart=1
>gpu_freq=250
> 
> Signed-off-by: Simon Glass 

Pushed not to rpi-next, sorry for the delay and thanks for the patch :)

> ---
> 
> Changes in v2:
> - Add new patch to move ofdata reading to probe() method
> 
>  drivers/serial/serial_bcm283x_mu.c| 21 +
>  drivers/serial/serial_bcm283x_pl011.c | 12 
>  2 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/serial/serial_bcm283x_mu.c 
> b/drivers/serial/serial_bcm283x_mu.c
> index a6ffc84b96..febb5ceea2 100644
> --- a/drivers/serial/serial_bcm283x_mu.c
> +++ b/drivers/serial/serial_bcm283x_mu.c
> @@ -74,16 +74,6 @@ out:
>   return 0;
>  }
>  
> -static int bcm283x_mu_serial_probe(struct udevice *dev)
> -{
> - struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
> - struct bcm283x_mu_priv *priv = dev_get_priv(dev);
> -
> - priv->regs = (struct bcm283x_mu_regs *)plat->base;
> -
> - return 0;
> -}
> -
>  static int bcm283x_mu_serial_getc(struct udevice *dev)
>  {
>   struct bcm283x_mu_priv *priv = dev_get_priv(dev);
> @@ -165,15 +155,21 @@ static bool bcm283x_is_serial_muxed(void)
>   return true;
>  }
>  
> -static int bcm283x_mu_serial_ofdata_to_platdata(struct udevice *dev)
> +static int bcm283x_mu_serial_probe(struct udevice *dev)
>  {
>   struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
> + struct bcm283x_mu_priv *priv = dev_get_priv(dev);
>   fdt_addr_t addr;
>  
>   /* Don't spawn the device if it's not muxed */
>   if (!bcm283x_is_serial_muxed())
>   return -ENODEV;
>  
> + /*
> +  * Read the ofdata here rather than in an ofdata_to_platdata() method
> +  * since we need the soc simple-bus to be probed so that the 'ranges'
> +  * property is used.
> +  */
>   addr = devfdt_get_addr(dev);
>   if (addr == FDT_ADDR_T_NONE)
>   return -EINVAL;
> @@ -187,6 +183,8 @@ static int bcm283x_mu_serial_ofdata_to_platdata(struct 
> udevice *dev)
>*/
>   plat->skip_init = true;
>  
> + priv->regs = (struct bcm283x_mu_regs *)plat->base;
> +
>   return 0;
>  }
>  #endif
> @@ -195,7 +193,6 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = {
>   .name = "serial_bcm283x_mu",
>   .id = UCLASS_SERIAL,
>   .of_match = of_match_ptr(bcm283x_mu_serial_id),
> - .ofdata_to_platdata = 
> of_match_ptr(bcm283x_mu_serial_ofdata_to_platdata),
>   .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata),
>   .probe = bcm283x_mu_serial_probe,
>   .ops = &bcm283x_mu_serial_ops,
> diff --git a/drivers/serial/serial_bcm283x_pl011.c 
> b/drivers/serial/serial_bcm283x_pl011.c
> index 7d8ab7b716..923f402fbe 100644
> --- a/drivers/serial/serial_bcm283x_pl011.c
> +++ b/drivers/serial/serial_bcm283x_pl011.c
> @@ -33,7 +33,7 @@ static bool bcm283x_is_serial_muxed(void)
>   return true;
>  }
>  
> -static int bcm283x_pl011_serial_ofdata_to_platdata(struct udevice *dev)
> +static int bcm283x_pl011_serial_probe(struct udevice *dev)
>  {
>   struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
>   int ret;
> @@ -42,6 +42,11 @@ static int bcm283x_pl011_serial_ofdata_to_platdata(struct 
> udevice *dev)
>   if (!bcm283x_is_serial_muxed())
>   return -ENODEV;
>  
> + /*
> +  * Read the ofdata here rather than in an ofdata_to_platdata() method
> +  * since we need the soc simple-bus to be probed so that the 'ranges'
> +  * property is used.
> +  */
>   ret = pl01x_serial_ofdata_to_platdata(dev);
>   if (ret)
>   return ret;
> @@ -52,7 +57,7 @@ static int bcm283x_pl011_serial_ofdata_to_platdata(struct 
> udevice *dev)
>*/
>   plat->skip_init = true;
>  
> - return 0;
> + return pl01x_serial_probe(dev);
>  }
>  
>  static int bcm283x_pl011_serial_setbrg(struct udevice *dev, int baudrate)
> @@ -86,9 +91,8 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = {
>   .name   = "bcm283x_pl011",
>   .id = UCLASS_SERIAL,
>   .of_match = of_match_ptr(bcm283x_pl011_serial_id),
> - .ofdata_to_platdata = 
> of_match_ptr(bcm283x_pl011_serial_ofdata_to_platdata),
> + .probe  = bcm283x_pl011_serial_probe,
>   .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
> - .probe  = pl01x_serial_probe,
>   .ops= &bcm283x_pl011_serial_ops,
>  #if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD)
>   .flags  = DM_FLAG_PRE_RELOC,
> 


Re: [PATCH v2 1/2] arm: dts: bcm283x: Allow UARTs to work before relocation

2020-05-04 Thread Matthias Brugger



On 23/03/2020 04:15, Simon Glass wrote:
> At present the pinctrl nodes are not enabled in pre-relocation U-Boot so
> the UARTs do not correctly select the pinconfig to enable the UART pins.
> Fix this so that the U-Boot banner is printed.
> 
> This fixes serial output on rpi_3b_32b with the following config.txt
> options:
> 
>enable_uart=1
>gpu_freq=250
> 
> Signed-off-by: Simon Glass 
> Fixes: 9821636b64 (bcm2835_pinctrl: Probe pre-reloc)

Pushed not to rpi-next, sorry for the delay and thanks for the patch :)

> ---
> 
> Changes in v2:
> - Update commit message
> 
>  arch/arm/dts/bcm283x-u-boot.dtsi | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/dts/bcm283x-u-boot.dtsi 
> b/arch/arm/dts/bcm283x-u-boot.dtsi
> index 36548dad62..68d03627f4 100644
> --- a/arch/arm/dts/bcm283x-u-boot.dtsi
> +++ b/arch/arm/dts/bcm283x-u-boot.dtsi
> @@ -19,3 +19,11 @@
>  &gpio {
>   u-boot,dm-pre-reloc;
>  };
> +
> +&uart0_gpio14 {
> + u-boot,dm-pre-reloc;
> +};
> +
> +&uart1_gpio14 {
> + u-boot,dm-pre-reloc;
> +};
> 


Re: [PATCH 6/8] ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

2020-05-04 Thread Harald Seiler
Hello,

On Mon, 2020-05-04 at 16:32 +0200, Marek Vasut wrote:
> On 5/4/20 4:27 PM, Fabio Estevam wrote:
> > Hi,
> > 
> > On Wed, Apr 29, 2020 at 10:05 AM Harald Seiler  wrote:
> > > From: Marek Vasut 
> > > 
> > > Board files should not re-implement do_reset() to work around this
> > > function not being defined in for specific configurations. Rather,
> > > the fix is to compile in drivers which implement this properly.
> > > This patch enables sysreset and watchdog drivers in SPL and ties
> > > them together to implement the same as the do_reset() hack in the
> > > board file, except correctly in the DM/DT framework.
> > > 
> > > Signed-off-by: Marek Vasut 
> > > Cc: Fabio Estevam 
> > > Cc: Flavio Suligoi 
> > > Cc: Harald Seiler 
> > > Cc: Igor Opaniuk 
> > > Cc: Marcel Ziswiler 
> > > Cc: Oleksandr Suvorov 
> > > Cc: Peng Fan 
> > > Cc: Stefano Babic 
> > 
> > I noticed that this patch breaks the boot on i.MX8MP EVK. Only the
> > following line is printed on boot:
> > 
> > U-Boot SPL 2020.07-rc1-00014-g8142a97d54 (May 04 2020 - 11:15:50 -0300)
> > 
> > If I revert this patch I can boot it again:
> > 
> > U-Boot SPL 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
> > Normal Boot
> > Failed to find clock node. Check device tree
> > WDT:   Not found!
> > Trying to boot from BOOTROM
> > image offset 0x8000, pagesize 0x200, ivt offset 0x0
> > 
> > 
> > U-Boot 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
> > 
> > CPU:   Freescale i.MX8MP rev1.0 at 1000 MHz
> > Reset cause: POR
> > Model: NXP i.MX8MPlus EVK board
> > DRAM:  6 GiB
> > MMC:   FSL_SDHC: 1, FSL_SDHC: 2
> > Loading Environment from MMC... OK
> > In:serial
> > Out:   serial
> > Err:   serial
> > Net:   No ethernet found.
> > Hit any key to stop autoboot:  0
> > u-boot=>
> > 
> > The "Failed to find clock node. Check device tree" looks suspicious.
> 
> The "WDT: not found!" is probably the root cause of your problem.
> Maybe the WDT driver fails to probe because it can't resolve it's clock
> phandle ("Failed to find clock node")? So maybe you need to fix your
> clock in SPL.

"Failed to find clock node. Check device tree" comes from spl_board_init()
in board/freescale/imx8mp_evk/spl.c; line 56:

ret = uclass_get_device_by_name(UCLASS_CLK,
"clock-controller@3038",
&dev);

I see that wdog1 references the same clock here:

arch/arm/dts/imx8mp.dtsi; line 222:

wdog1: watchdog@3028 {
compatible = "fsl,imx8mp-wdt", "fsl,imx21-wdt";
reg = <0x3028 0x1>;
interrupts = ;
clocks = <&clk IMX8MP_CLK_WDOG1_ROOT>;
status = "disabled";
};

So the two issues are very likely related.  The relevant clock's node is
also enabled for SPL so I think the driver might be missing here.  Maybe
you need to add 

CONFIG_SPL_CLK_IMX8MP=y

to your defconfig?

-- 
Harald



Re: [PATCH v3 4/4] patman: Support multi-line changes in changelogs

2020-05-04 Thread Simon Glass
On Sun, 3 May 2020 at 15:55, Sean Anderson  wrote:
>
> This patch adds support to multi-line changes. That is, if one has a line
> in a changelog like
> - Do a thing but
>   it spans multiple lines
> Using Series-process-log sort would sort as if those lines were unrelated.
> With this patch, any change line starting with whitespace will be
> considered part of the change before it.
>
> Signed-off-by: Sean Anderson 
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - New
>
>  tools/patman/README | 10 --
>  tools/patman/patchstream.py | 35 +++
>  2 files changed, 35 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v3 2/4] patman: Suppress empty changelog entries

2020-05-04 Thread Simon Glass
Hi Sean,

On Sun, 3 May 2020 at 15:55, Sean Anderson  wrote:
>
> Patman outputs a line for every edition of the series in every patch,
> regardless of whether any changes were made. This can result in many
> redundant lines in patch changelogs, especially when a patch did not exist
> before a certain revision. For example, the existing behaviour could result
> in a changelog of
>
> Changes in v7: None
> Changes in v6: None
> Changes in v5:
> - Make a change
>
> Changes in v4: None
>
> Changes in v3:
> - New
>
> Changes in v2: None
>
> With this patch applied and with --no-empty-changes, the same patch would
> look like
>
> (no changes since v5)
>
> Changes in v5:
> - Make a change
>
> Changes in v3:
> - New
>
> This is entirely aesthetic, but I think it reduces clutter, especially for
> patches added later on in a series.
>
> Signed-off-by: Sean Anderson 
> ---
>
> Changes in v3:
> - Document empty changelog suppression in README
> - Fix KeyError when running tests
> - Fix no changes message being output for revision 1
> - Fix no changes message sometimes being output before every
>   non-newest-revision change
> - Make the newest_version logic more robust (and ugly)
> - Update commit subject
>
> Changes in v2:
> - Add a note when there are no changes in the current revision
> - Make this the default behaviour, and remove the option
>
>  tools/patman/README| 21 
>  tools/patman/series.py | 44 +++---
>  2 files changed, 54 insertions(+), 11 deletions(-)

Reviewed-by: Simon Glass 

Please see comment below though.

[..]

> diff --git a/tools/patman/series.py b/tools/patman/series.py
> index 6d9d48b123..4359442174 100644
> --- a/tools/patman/series.py
> +++ b/tools/patman/series.py
> @@ -146,38 +146,60 @@ class Series(dict):
>  Changes in v4:
>  - Jog the dial back closer to the widget
>
> -Changes in v3: None
>  Changes in v2:
>  - Fix the widget
>  - Jog the dial
>
> -etc.
> +If there are no new changes in a patch, a note will be added
> +
> +(no changes since v2)
> +
> +Changes in v2:
> +- Fix the widget
> +- Jog the dial
>  """
> +versions = sorted(self.changes, reverse=True)
> +newest_version = 1
> +try:
> +newest_version = max(newest_version, int(self.version))
> +except (ValueError, KeyError):
> +pass
> +try:
> +newest_version = max(newest_version, versions[0])
> +except IndexError:
> +pass

Can we do this without exceptions so it is more deterministic?

E.g.

if 'version' in self:
   newest_version = max(newest_version, int(self.version))
if versions:
   newest_version = max(newest_version, versions[0])

> +
>  final = []
>  process_it = self.get('process_log', '').split(',')
>  process_it = [item.strip() for item in process_it]
>  need_blank = False
> -for change in sorted(self.changes, reverse=True):
> +for version in versions:
>  out = []
> -for this_commit, text in self.changes[change]:
> +for this_commit, text in self.changes[version]:
>  if commit and this_commit != commit:
>  continue
>  if 'uniq' not in process_it or text not in out:
>  out.append(text)
> -line = 'Changes in v%d:' % change
> -have_changes = len(out) > 0
>  if 'sort' in process_it:
>  out = sorted(out)
> +have_changes = len(out) > 0
> +line = 'Changes in v%d:' % version
>  if have_changes:
>  out.insert(0, line)
> -else:
> -out = [line + ' None']
> -if need_blank:
> -out.insert(0, '')
> +if version < newest_version and len(final) == 0:
> +out.insert(0, '')
> +out.insert(0, '(no changes since v%d)' % version)
> +newest_version = 0
> +# Only add a new line if we output something
> +if need_blank:
> +out.insert(0, '')
>  final += out
>  need_blank = have_changes
> -if self.changes:
> +
> +if len(final) > 0:
>  final.append('')
> +elif newest_version != 1:
> +final = ['(no changes since v1)', '']
>  return final
>
>  def DoChecks(self):
> --
> 2.26.2
>

Regards,
Simon


Re: [PATCH v3 3/4] patman: Add new tags for finer-grained changelog control

2020-05-04 Thread Simon Glass
HI Sean,

On Sun, 3 May 2020 at 15:55, Sean Anderson  wrote:
>
> By default patman generates a combined changelog for the cover letter. This
> may not always be desireable.

desirable

>
> Many patches may have the same changes. These can be coalesced with
> "Series-process-log: uniq", but this is imperfect. Similar changes like
> "Move foo to patch 7" will not be merged with the similar "Move foo to this
> patch from patch 6".
>
> Changes may not make sense outside of the patch they are written for. For
> example, a change line of "Add check for bar" does not make sense outside
> of the context in which bar might be checked for. Some changes like "New"
> or "Lint" may be repeated many times throughout different change logs, but
> carry no useful information in a summary.
>
> Lastly, I like to summarize the broad strokes of the changes I have made in
> the cover letter, while documenting all the details in the appropriate
> patches. I think this make it easier to get a good feel for what has

makes

> changed, without making it difficult to wade through every change in the
> whole series.
>
> This patch adds two new tags to add changelog entries which only appear in
> the cover letter, or only appear in the commit. Changes documented with
> "Commit-changes" will only appear in the commit, and will not appear in the
> cover letter. Changes documented with "Cover-changes" will not appear in
> any commit, and will only appear in the cover letter.
>
> Signed-off-by: Sean Anderson 
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Add documentation for new tags
> - Switch to using commit tags for changelog control, instead of
>   command-line options
>
>  tools/patman/README | 17 +
>  tools/patman/patchstream.py | 73 ++---
>  tools/patman/patman.py  |  2 +-
>  tools/patman/series.py  | 13 ++-
>  4 files changed, 73 insertions(+), 32 deletions(-)

Reviewed-by: Simon Glass 

(with fixes added)

Also please can you rebase on mainline as there is a minor conflict in series.py

>
> diff --git a/tools/patman/README b/tools/patman/README
> index d1d9891c4c..5a67a49e88 100644
> --- a/tools/patman/README
> +++ b/tools/patman/README
> @@ -247,6 +247,23 @@ Series-changes: n
> to update the log there and then, knowing that the script will
> do the rest.
>
> +Commit-changes: n
> +- This line will not appear in the cover-letter changelog
> +
> +   This tag is like Series-changes, except changes in this changelog will
> +   only appear in the changelog of the commit this tag is in. This is
> +   useful when you want to add notes which may not make sense in the 
> cover
> +   letter. For example, you can have short changes such as "New" or
> +   "Lint".
> +
> +Cover-changes: n
> +- This line will only appear in the cover letter
> +
> +   This tag is like Series-changes, except changes in this changelog will
> +   only appear in the cover-letter changelog. This is useful to summarize
> +   changes made with Commit-changes, or to add additional context to
> +   changes.
> +
>  Patch-cc: Their Name 
> This copies a single patch to another email address. Note that the
> Cc: used by git send-email is ignored by patman, but will be
> diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
> index df3eb7483b..f29ad87e70 100644
> --- a/tools/patman/patchstream.py
> +++ b/tools/patman/patchstream.py
> @@ -24,11 +24,8 @@ re_allowed_after_test = re.compile('^Signed-off-by:')
>  # Signoffs
>  re_signoff = re.compile('^Signed-off-by: *(.*)')
>
> -# The start of the cover letter
> -re_cover = re.compile('^Cover-letter:')
> -
> -# A cover letter Cc
> -re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
> +# Cover letter tag
> +re_cover = re.compile('^Cover-([a-z-]*): *(.*)')
>
>  # Patch series tag
>  re_series_tag = re.compile('^Series-([a-z-]*): *(.*)')
> @@ -65,7 +62,7 @@ class PatchStream:
>  def __init__(self, series, name=None, is_log=False):
>  self.skip_blank = False  # True to skip a single blank line
>  self.found_test = False  # Found a TEST= line
> -self.lines_after_test = 0# MNumber of lines found after TEST=
> +self.lines_after_test = 0# Number of lines found after TEST=
>  self.warn = []   # List of warnings we have collected
>  self.linenum = 1 # Output line number we are up to
>  self.in_section = None   # Name of start...END section we 
> are in
> @@ -73,7 +70,8 @@ class PatchStream:
>  self.section = []# The current section...END section
>  self.series = series # Info about the patch series
>  self.is_log = is_log # True if indent like git log
> -self.in_change = 0   # Non-zero if we are in a change 
> list
> +self.in_change = None# Name of the c

Re: [PATCH 6/8] ARM: imx8m: Fix reset in SPL on NXP iMX8MP EVK

2020-05-04 Thread Marek Vasut
On 5/4/20 4:27 PM, Fabio Estevam wrote:
> Hi,
> 
> On Wed, Apr 29, 2020 at 10:05 AM Harald Seiler  wrote:
>>
>> From: Marek Vasut 
>>
>> Board files should not re-implement do_reset() to work around this
>> function not being defined in for specific configurations. Rather,
>> the fix is to compile in drivers which implement this properly.
>> This patch enables sysreset and watchdog drivers in SPL and ties
>> them together to implement the same as the do_reset() hack in the
>> board file, except correctly in the DM/DT framework.
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Fabio Estevam 
>> Cc: Flavio Suligoi 
>> Cc: Harald Seiler 
>> Cc: Igor Opaniuk 
>> Cc: Marcel Ziswiler 
>> Cc: Oleksandr Suvorov 
>> Cc: Peng Fan 
>> Cc: Stefano Babic 
> 
> I noticed that this patch breaks the boot on i.MX8MP EVK. Only the
> following line is printed on boot:
> 
> U-Boot SPL 2020.07-rc1-00014-g8142a97d54 (May 04 2020 - 11:15:50 -0300)
> 
> If I revert this patch I can boot it again:
> 
> U-Boot SPL 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
> Normal Boot
> Failed to find clock node. Check device tree
> WDT:   Not found!
> Trying to boot from BOOTROM
> image offset 0x8000, pagesize 0x200, ivt offset 0x0
> 
> 
> U-Boot 2020.07-rc1-00015-g02cd8db94f (May 04 2020 - 11:17:25 -0300)
> 
> CPU:   Freescale i.MX8MP rev1.0 at 1000 MHz
> Reset cause: POR
> Model: NXP i.MX8MPlus EVK board
> DRAM:  6 GiB
> MMC:   FSL_SDHC: 1, FSL_SDHC: 2
> Loading Environment from MMC... OK
> In:serial
> Out:   serial
> Err:   serial
> Net:   No ethernet found.
> Hit any key to stop autoboot:  0
> u-boot=>
> 
> The "Failed to find clock node. Check device tree" looks suspicious.

The "WDT: not found!" is probably the root cause of your problem.
Maybe the WDT driver fails to probe because it can't resolve it's clock
phandle ("Failed to find clock node")? So maybe you need to fix your
clock in SPL.


RE: [PATCH 1/4] sata: ahsata: Fix resource leak

2020-05-04 Thread Peng Fan
Hi Simon,

> Subject: Re: [PATCH 1/4] sata: ahsata: Fix resource leak
> 
> On Sun, 3 May 2020 at 08:04, Peng Fan  wrote:
> >
> > From: Ye Li 
> >
> > Fix coverity issue CID 3606684: Resource leak (RESOURCE_LEAK)
> > leaked_storage: Variable uc_priv going out of scope leaks the storage
> > it points to
> >
> > Signed-off-by: Ye Li 
> > Signed-off-by: Peng Fan 
> > ---
> >  drivers/ata/dwc_ahsata.c | 5 +
> >  1 file changed, 5 insertions(+)
> 
> Reviewed-by: Simon Glass 
> 
> >
> > diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index
> > c2e28fe518..a775214792 100644
> > --- a/drivers/ata/dwc_ahsata.c
> > +++ b/drivers/ata/dwc_ahsata.c
> > @@ -847,6 +847,9 @@ static int ahci_init_one(int pdev)
> > struct ahci_uc_priv *uc_priv = NULL;
> >
> > uc_priv = malloc(sizeof(struct ahci_uc_priv));
> > +   if (!uc_priv)
> > +   return -ENOMEM;
> > +
> > memset(uc_priv, 0, sizeof(struct ahci_uc_priv));
> > uc_priv->dev = pdev;
> >
> > @@ -871,6 +874,8 @@ static int ahci_init_one(int pdev)
> > return 0;
> >
> >  err_out:
> > +   if (uc_priv)
> > +   free(uc_priv);
> 
> Seems like you can avoid the if() since it is always allocated at this point?
> 
> The migration date for SATA was over 6 months ago so really this code should
> not be used at this point.

This is to upstream nxp downstream patch. Since this is bug fix, I hope it is 
ok to
be in until the driver is removed.

I'll also try to convert to use DM sata.

Thanks,
Peng.

> 
> Regards,
> Simon


  1   2   3   >