RE: Pull request: socfpga-next

2019-12-11 Thread Tan, Ley Foon


> -Original Message-
> From: Simon Goldschmidt 
> Sent: Thursday, December 12, 2019 3:38 PM
> To: Marek Vasut 
> Cc: Tan, Ley Foon ; U-Boot Mailing List  b...@lists.denx.de>
> Subject: Re: Pull request: socfpga-next
> 
> On Thu, Dec 12, 2019 at 2:04 AM Marek Vasut  wrote:
> >
> > On 12/10/19 11:01 AM, Simon Goldschmidt wrote:
> > > Hi Marek,
> > >
> > > after fixing Stratix10 build warnings, please pull this updated
> > > Agilex series for next.
> > >
> > > Travis ran successfully this time:
> > > https://travis-ci.org/goldsimon/u-boot/builds/622657322
> > >
> > > Regards,
> > > Simon
> > >
> > > The following changes since commit
> b38c3a641fc01fcd4eda5fa107ae3c247baa0196:
> > >
> > >   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
> > > (2019-12-08 10:51:00 -0500)
> > >
> > > are available in the git repository at:
> > >
> > >   https://github.com/goldsimon/u-boot.git socfpga-next
> > >
> >
> > Rebase this on socfpga/next please, so the fix is visible and I don't
> > have to rewrite the branch.
> 
> The thing is, I did something wrong in the 2nd newest commit
> ("configs: socfpga: Move Stratix10 and Agilex common CONFIGs").
> 
> So we can either fix this commit and rewrite the 'next' branch or live with
> bisect being broken for Stratix10.
> 
> Just tell me which way I should proceed.
> 
I just sync latest from 
https://gitlab.denx.de/u-boot/custodians/u-boot-socfpga/tree/next and there is 
compilation for S10/Agilex.
Found Simon's latest fix for "configs: socfpga: Move Stratix10 and Agilex 
common CONFIGs" is not merged.

Regards
Ley Foon



Re: Pull request: socfpga-next

2019-12-11 Thread Simon Goldschmidt
On Thu, Dec 12, 2019 at 2:04 AM Marek Vasut  wrote:
>
> On 12/10/19 11:01 AM, Simon Goldschmidt wrote:
> > Hi Marek,
> >
> > after fixing Stratix10 build warnings, please pull this updated Agilex
> > series for next.
> >
> > Travis ran successfully this time:
> > https://travis-ci.org/goldsimon/u-boot/builds/622657322
> >
> > Regards,
> > Simon
> >
> > The following changes since commit b38c3a641fc01fcd4eda5fa107ae3c247baa0196:
> >
> >   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
> > (2019-12-08 10:51:00 -0500)
> >
> > are available in the git repository at:
> >
> >   https://github.com/goldsimon/u-boot.git socfpga-next
> >
>
> Rebase this on socfpga/next please, so the fix is visible and I don't
> have to rewrite the branch.

The thing is, I did something wrong in the 2nd newest commit
("configs: socfpga: Move Stratix10 and Agilex common CONFIGs").

So we can either fix this commit and rewrite the 'next' branch or
live with bisect being broken for Stratix10.

Just tell me which way I should proceed.

Regards,
Simon


Re: [U-Boot] [PATCH V3 2/2] core: device: use dev_power_domain_on

2019-12-11 Thread Oliver Graute
On 11/12/19, Fabio Estevam wrote:
> Hi Oliver,
> 
> On Tue, Dec 10, 2019 at 11:50 PM Peng Fan  wrote:
> 
> > Update your scfw/atf and they try again.
> 
> Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?

Unfortunately, not. I checked out imx-atf in that branch. Build it with:

make PLAT=imx8qm bl31

copied the resulting bl31.bin into my u-boot folder and rebuild that.

But the imx8qm board is not booting with the resulting u-boot.

do I need a new scfw from my vendor?

Best Regards,

Oliver


RE: [PATCHv2 0/2] Intel Stratix10/Agilex Additions

2019-12-11 Thread Tan, Ley Foon


> -Original Message-
> From: Marek Vasut 
> Sent: Saturday, December 7, 2019 8:24 AM
> To: thor.tha...@linux.intel.com; simon.k.r.goldschm...@gmail.com; Tan,
> Ley Foon 
> Cc: albert.u.b...@aribaud.net; Ang, Chee Hong
> ; Chee, Tien Fong ;
> u-boot@lists.denx.de
> Subject: Re: [PATCHv2 0/2] Intel Stratix10/Agilex Additions
> 
> On 12/6/19 8:47 PM, thor.tha...@linux.intel.com wrote:
> > From: Thor Thayer 
> >
> > This patchset is rebased on top of [1] and adds SMMU support for
> > Stratix10 and fixes an ECC access issue with Stratix10 and Agilex.
> >
> > [1] [U-Boot,v8,00/19] Add Intel Agilex SoC support
> > https://patchwork.ozlabs.org/cover/1201373/
> 
> OK, I will let Ley handle this and prepare a PR for -next.

I will send PR for these 2 patches from Thor.

Regards
Ley Foon


RE: [PATCHv2 2/2] ddr: socfpga: Enable ARM64 Non-Secure SDRAM ECC Access

2019-12-11 Thread Tan, Ley Foon



> -Original Message-
> From: thor.tha...@linux.intel.com 
> Sent: Saturday, December 7, 2019 3:48 AM
> To: ma...@denx.de; simon.k.r.goldschm...@gmail.com; Tan, Ley Foon
> 
> Cc: albert.u.b...@aribaud.net; Ang, Chee Hong
> ; Chee, Tien Fong ;
> u-boot@lists.denx.de; Thor Thayer 
> Subject: [PATCHv2 2/2] ddr: socfpga: Enable ARM64 Non-Secure SDRAM ECC
> Access
> 
> From: Thor Thayer 
> 
> The ECC registers in the SDRAM HMC Adapter should always be accessible
> (both when ECC is enabled and disabled).
> Currently, the registers are accessible only when ECC is enabled.
> 
> The ECC Enabled bit is used to determine the status of ECC by later OSes so
> always allow access.
> 
> Signed-off-by: Thor Thayer 


Reviewed-by: Ley Foon Tan 

> ---
> v2 New Patch. Rebase patch on top of pending patchset
>[PATCH v8 00/19] Add Intel Agilex SoC support
>https://patchwork.ozlabs.org/cover/1201373/
> ---
>  drivers/ddr/altera/sdram_agilex.c | 6 +++---
>  drivers/ddr/altera/sdram_s10.c| 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ddr/altera/sdram_agilex.c
> b/drivers/ddr/altera/sdram_agilex.c
> index cc7679a6e4c1..0cbcd1405607 100644
> --- a/drivers/ddr/altera/sdram_agilex.c
> +++ b/drivers/ddr/altera/sdram_agilex.c
> @@ -143,9 +143,6 @@ int sdram_mmr_init_full(struct udevice *dev)
>   setbits_le32(plat->hmc + ERRINTEN,
>DDR_HMC_ERRINTEN_DERRINTEN_EN_SET_MSK);
> 
> - /* Enable non-secure writes to HMC Adapter for SDRAM ECC
> */
> - writel(FW_HMC_ADAPTOR_MPU_MASK,
> FW_HMC_ADAPTOR_REG_ADDR);
> -
>   if (!cpu_has_been_warmreset())
>   sdram_init_ecc_bits();
>   } else {
> @@ -158,6 +155,9 @@ int sdram_mmr_init_full(struct udevice *dev)
> DDR_HMC_ECCCTL2_AWB_EN_SET_MSK));
>   }
> 
> + /* Enable non-secure reads/writes to HMC Adapter for SDRAM ECC
> */
> + writel(FW_HMC_ADAPTOR_MPU_MASK,
> FW_HMC_ADAPTOR_REG_ADDR);
> +
>   sdram_size_check();
> 
>   priv->info.base = bd.bi_dram[0].start; diff --git
> a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c index
> a7bf82e4e5ce..2b8889260f9f 100644
> --- a/drivers/ddr/altera/sdram_s10.c
> +++ b/drivers/ddr/altera/sdram_s10.c
> @@ -306,9 +306,6 @@ int sdram_mmr_init_full(struct udevice *dev)
> DDR_HMC_ECCCTL2_AWB_EN_SET_MSK));
>   hmc_ecc_writel(plat, DDR_HMC_ERRINTEN_INTMASK,
> ERRINTENS);
> 
> - /* Enable non-secure writes to HMC Adapter for SDRAM ECC
> */
> - writel(FW_HMC_ADAPTOR_MPU_MASK,
> FW_HMC_ADAPTOR_REG_ADDR);
> -
>   /* Initialize memory content if not from warm reset */
>   if (!cpu_has_been_warmreset())
>   sdram_init_ecc_bits();
> @@ -322,6 +319,9 @@ int sdram_mmr_init_full(struct udevice *dev)
> DDR_HMC_ECCCTL2_AWB_EN_SET_MSK));
>   }
> 
> + /* Enable non-secure reads/writes to HMC Adapter for SDRAM ECC
> */
> + writel(FW_HMC_ADAPTOR_MPU_MASK,
> FW_HMC_ADAPTOR_REG_ADDR);
> +
>   sdram_size_check();
> 
>   priv->info.base = bd.bi_dram[0].start;
> --
> 2.7.4



RE: [PATCHv2 1/2] arm: socfpga: stratix10: Enable SMMU access

2019-12-11 Thread Tan, Ley Foon



> -Original Message-
> From: thor.tha...@linux.intel.com 
> Sent: Saturday, December 7, 2019 3:48 AM
> To: ma...@denx.de; simon.k.r.goldschm...@gmail.com; Tan, Ley Foon
> 
> Cc: albert.u.b...@aribaud.net; Ang, Chee Hong
> ; Chee, Tien Fong ;
> u-boot@lists.denx.de; Thor Thayer 
> Subject: [PATCHv2 1/2] arm: socfpga: stratix10: Enable SMMU access
> 
> From: Thor Thayer 
> 
> Enable TCU access through the Stratix10 CCU so that the SMMU can access
> the SDRAM.
> 
> Signed-off-by: Thor Thayer 

Reviewed-by: Ley Foon Tan 

> ---
> v2 Rebase patch on top of pending patchset
>[PATCH v8 00/19] Add Intel Agilex SoC support
>https://patchwork.ozlabs.org/cover/1201373/
> ---
>  arch/arm/mach-socfpga/include/mach/firewall.h |  7 +++
>  drivers/ddr/altera/sdram_s10.c| 14 ++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/firewall.h
> b/arch/arm/mach-socfpga/include/mach/firewall.h
> index 516bd1c0e1ec..430341bea14c 100644
> --- a/arch/arm/mach-socfpga/include/mach/firewall.h
> +++ b/arch/arm/mach-socfpga/include/mach/firewall.h
> @@ -95,6 +95,13 @@ struct socfpga_firwall_l4_sys {
> 
>  #define CCU_IOM_MPRT_ADMASK_MEM_RAM0 0x18628
> 
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE00x2c520
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE1A   0x2c540
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE1B   0x2c560
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE1C   0x2c580
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE1D   0x2c5a0
> +#define CCU_TCU_MPRT_ADBASE_MEMSPACE1E   0x2c5c0
> +
>  #define CCU_ADMASK_P_MASKBIT(0)
>  #define CCU_ADMASK_NS_MASK   BIT(1)
> 
> diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c
> index fcab3ae3e4ba..a7bf82e4e5ce 100644
> --- a/drivers/ddr/altera/sdram_s10.c
> +++ b/drivers/ddr/altera/sdram_s10.c
> @@ -104,6 +104,20 @@ int sdram_mmr_init_full(struct udevice *dev)
> 
>   clrbits_le32(CCU_REG_ADDR(CCU_IOM_MPRT_ADBASE_MEMSPACE
> 1E),
>CCU_ADBASE_DI_MASK);
> 
> + /* Enable access to DDR from TCU */
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 0),
> +  CCU_ADBASE_DI_MASK);
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 1A),
> +  CCU_ADBASE_DI_MASK);
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 1B),
> +  CCU_ADBASE_DI_MASK);
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 1C),
> +  CCU_ADBASE_DI_MASK);
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 1D),
> +  CCU_ADBASE_DI_MASK);
> +
>   clrbits_le32(CCU_REG_ADDR(CCU_TCU_MPRT_ADBASE_MEMSPACE
> 1E),
> +  CCU_ADBASE_DI_MASK);
> +
>   /* this enables nonsecure access to DDR */
>   /* mpuregion0addr_limit */
>   FW_MPU_DDR_SCR_WRITEL(0x,
> FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMIT);
> --
> 2.7.4



Re: [PATCH 08/35] common: Move relocate_code() to init.h

2019-12-11 Thread Timur Tabi (ti...@kernel.org)

On 12/11/19 6:47 PM, Simon Glass wrote:

- * void relocate_code (addr_moni)
+ * void relocate_code(addr_moni)


Is this really necessary?  I think you're bloating your patch with these 
comment changes.  Your patch would be half the size without these 
changes, so I don't think this really qualifies as "while we are here".


[PATCH 30/35] common: Move hang() to the same header as panic()

2019-12-11 Thread Simon Glass
At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm926ejs/mxs/mxs.c  |  1 +
 arch/arm/cpu/arm926ejs/mxs/spl_power_init.c   |  1 +
 arch/arm/cpu/armv8/cache_v8.c |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c   |  1 +
 arch/arm/include/asm/armv8/mmu.h  |  1 +
 arch/arm/lib/bootm.c  |  1 +
 arch/arm/lib/div0.c   |  4 ++--
 arch/arm/mach-at91/spl.c  |  1 +
 arch/arm/mach-at91/spl_at91.c |  1 +
 arch/arm/mach-at91/spl_atmel.c|  1 +
 arch/arm/mach-davinci/spl.c   |  1 +
 arch/arm/mach-imx/mx6/ddr.c   |  1 +
 arch/arm/mach-imx/spl.c   |  1 +
 arch/arm/mach-k3/security.c   |  1 +
 arch/arm/mach-keystone/mon.c  |  1 +
 arch/arm/mach-mediatek/spl.c  |  1 +
 arch/arm/mach-mvebu/spl.c |  1 +
 arch/arm/mach-omap2/am33xx/clock.c|  1 +
 arch/arm/mach-omap2/am33xx/fdt.c  |  1 +
 arch/arm/mach-omap2/clocks-common.c   |  1 +
 arch/arm/mach-omap2/emif-common.c |  1 +
 arch/arm/mach-omap2/omap5/dra7xx_iodelay.c|  1 +
 arch/arm/mach-omap2/omap5/fdt.c   |  1 +
 arch/arm/mach-omap2/sec-common.c  |  1 +
 arch/arm/mach-rockchip/bootrom.c  |  1 +
 arch/arm/mach-rockchip/rk3188/rk3188.c|  1 +
 arch/arm/mach-rockchip/spl.c  |  1 +
 arch/arm/mach-rockchip/tpl.c  |  1 +
 arch/arm/mach-socfpga/mailbox_s10.c   |  1 +
 arch/arm/mach-socfpga/spl_a10.c   |  1 +
 arch/arm/mach-socfpga/spl_gen5.c  |  1 +
 arch/arm/mach-socfpga/spl_s10.c   |  1 +
 arch/arm/mach-stm32mp/spl.c   |  1 +
 arch/arm/mach-tegra/cboot.c   |  1 +
 arch/arm/mach-uniphier/spl_board_init.c   |  1 +
 arch/arm/mach-zynq/spl.c  |  1 +
 arch/microblaze/cpu/exception.c   |  1 +
 arch/microblaze/lib/bootm.c   |  1 +
 arch/mips/lib/traps.c |  1 +
 arch/mips/mach-ath79/ar934x/clk.c |  1 +
 arch/mips/mach-jz47xx/jz4780/jz4780.c |  1 +
 arch/mips/mach-jz47xx/jz4780/sdram.c  |  1 +
 arch/nds32/lib/bootm.c|  1 +
 arch/nios2/cpu/traps.c|  5 +++--
 arch/powerpc/cpu/mpc8xxx/fsl_lbc.c|  1 +
 arch/riscv/lib/bootm.c|  1 +
 arch/riscv/lib/interrupts.c   |  1 +
 arch/riscv/lib/reset.c|  1 +
 arch/riscv/lib/spl.c  |  1 +
 arch/sandbox/cpu/spl.c|  1 +
 arch/x86/cpu/i386/interrupt.c |  1 +
 arch/x86/cpu/quark/mrc_util.c |  1 +
 arch/x86/lib/bootm.c  |  1 +
 arch/x86/lib/spl.c|  1 +
 arch/x86/lib/tpl.c|  1 +
 board/BuR/brppt2/board.c  |  1 +
 board/armadeus/apf27/apf27.c  |  1 +
 board/bosch/shc/mux.c |  1 +
 board/compulab/cl-som-imx7/spl.c  |  1 +
 board/compulab/cm_fx6/spl.c   |  1 +
 board/compulab/cm_t43/spl.c   |  1 +
 board/firefly/firefly-rk3288/firefly-rk3288.c |  1 +
 board/freescale/imx8mm_evk/spl.c  |  1 +
 board/freescale/imx8mn_evk/spl.c  |  1 +
 board/freescale/imx8mq_evk/spl.c  |  1 +
 board/freescale/ls1012ardb/ls1012ardb.c   |  1 +
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |  1 +
 board/gateworks/gw_ventana/gw_ventana_spl.c   |  1 +
 board/gdsys/p1022/controlcenterd-id.c |  1 +
 board/renesas/alt/alt.c   |  1 +
 board/renesas/condor/condor.c |  1 +
 board/renesas/draak/draak.c   |  1 +
 board/renesas/eagle/eagle.c   |  1 +
 board/renesas/ebisu/ebisu.c   |  1 +
 board/renesas/gose/gose.c |  1 +
 board/renesas/koelsch/koelsch.c   |  1 +
 board/renesas/lager/lager.c   |  1 +
 board/renesas/porter/porter.c |  1 +
 board/renesas/silk/silk.c |  1 +
 board/samsung/common/board.c  |  1 +
 board/st/stm32mp1/stm32mp1.c  |  1 +
 board/sunxi/board.c   |  1 +
 board/technexion/pico-imx6ul/spl.c|  1 +
 board/ti/ks2_evm/board.c  |  1 +
 board/ti/ks2_evm/board_k2g.c  |  1 +
 common/board_f.c  |  1 +
 common/board_r.c  |  1 +
 common/bootstage.c|  1 +
 common/cli.c

[PATCH 2/2] boards: amlogic: add Khadas VIM3L support

2019-12-11 Thread Christian Hewitt
Khadas VIM3L uses the same board layout as VIM3, but with an S905D3 chip
instead of A311D. Board config is derived from khadas-vim3_defconfig and
sei610_defconfig. README is based on README.khadas-vim3; the difference
is that VIM3L uses FIP files from the g12a folder in vendor sources not
the g12b folder.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/README.khadas-vim3l | 132 +
 configs/khadas-vim3l_defconfig |  62 
 2 files changed, 194 insertions(+)
 create mode 100644 board/amlogic/w400/README.khadas-vim3l
 create mode 100644 configs/khadas-vim3l_defconfig

diff --git a/board/amlogic/w400/README.khadas-vim3l 
b/board/amlogic/w400/README.khadas-vim3l
new file mode 100644
index 000..b53a67c
--- /dev/null
+++ b/board/amlogic/w400/README.khadas-vim3l
@@ -0,0 +1,132 @@
+U-Boot for Khadas VIM3L
+===
+
+Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion
+Technology Co., Ltd. with the following specifications:
+
+ - Amlogic S905D3 Arm Cortex-A55 quad-core SoC
+ - 2GB LPDDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 1 x USB 3.0 Host, 1 x USB 2.0 Host
+ - eMMC, microSD
+ - M.2
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the U-Boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make khadas-vim3l_defconfig
+ > make
+
+Image creation
+==
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=vim3l-u-boot
+ > git clone --depth 1 \
+   https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
+   $DIR
+
+ > cd vim3l-u-boot
+ > make kvim3l_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/khadas/kvim3l/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
+
+ > sh fip/blx_fix.sh \
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
+
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin 
--compress lz4 \
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
+   --output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.enc \
+   --bl31 fip/bl31.img.enc \
+   --bl33 fip/bl33.bin.enc \
+   --ddrfw1 

[PATCH 25/35] image: Rename load_addr, save_addr, save_size

2019-12-11 Thread Simon Glass
These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass 
---

 cmd/bmp.c  |  8 
 cmd/booti.c|  4 ++--
 cmd/bootm.c|  5 +++--
 cmd/bootz.c|  4 ++--
 cmd/cramfs.c   |  4 ++--
 cmd/disk.c |  2 +-
 cmd/elf.c  |  4 ++--
 cmd/jffs2.c|  4 ++--
 cmd/load.c |  6 +++---
 cmd/mvebu/bubt.c   |  6 --
 cmd/nand.c |  2 +-
 cmd/net.c  | 12 ++--
 cmd/pxe_utils.c|  4 ++--
 cmd/reiser.c   |  2 +-
 cmd/source.c   |  3 ++-
 cmd/ximg.c |  2 +-
 cmd/zfs.c  |  2 +-
 common/board_r.c   |  2 +-
 common/image-fdt.c |  5 +++--
 common/image.c | 18 +-
 common/spl/spl_net.c   |  4 ++--
 common/update.c|  3 +--
 .../ddr/marvell/a38x/ddr3_training_ip_engine.c |  6 +++---
 include/common.h   |  6 +++---
 net/net.c  |  2 +-
 net/nfs.c  |  9 +
 net/tftp.c | 14 +++---
 27 files changed, 74 insertions(+), 69 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index d2a39f677f..1e4c9720fe 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -95,8 +95,8 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[
ulong addr;
 
switch (argc) {
-   case 1: /* use load_addr as default address */
-   addr = load_addr;
+   case 1: /* use image_load_addr as default address */
+   addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
@@ -116,8 +116,8 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int 
argc, char * const ar
splash_get_pos(, );
 
switch (argc) {
-   case 1: /* use load_addr as default address */
-   addr = load_addr;
+   case 1: /* use image_load_addr as default address */
+   addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/booti.c b/cmd/booti.c
index d0671deb75..de5058236e 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -30,9 +30,9 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
 
/* Setup Linux kernel Image entry point */
if (!argc) {
-   ld = load_addr;
+   ld = image_load_addr;
debug("*  kernel: default image load address = 0x%08lx\n",
-   load_addr);
+   image_load_addr);
} else {
ld = simple_strtoul(argv[0], NULL, 16);
debug("*  kernel: cmdline image address = 0x%08lx\n", ld);
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 62ee7c4b8a..931d53f0c7 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -144,7 +144,8 @@ int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
char *local_args[2];
local_args[0] = (char *)cmd;
local_args[1] = NULL;
-   printf("Automatic boot of image at addr 0x%08lX ...\n", 
load_addr);
+   printf("Automatic boot of image at addr 0x%08lX ...\n",
+  image_load_addr);
return do_bootm(cmdtp, 0, 1, local_args);
}
 
@@ -232,7 +233,7 @@ static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
int rcode = 0;
 
if (argc < 2) {
-   return image_info(load_addr);
+   return image_info(image_load_addr);
}
 
for (arg = 1; arg < argc; ++arg) {
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 74be62c2c5..7bfc491221 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -33,9 +33,9 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
 
/* Setup Linux kernel zImage entry point */
if (!argc) {
-   images->ep = load_addr;
+   images->ep = image_load_addr;
debug("*  kernel: default image load address = 0x%08lx\n",
-   load_addr);
+   

[PATCH 26/35] common: Move the image globals into image.h

2019-12-11 Thread Simon Glass
These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass 
---

 cmd/bmp.c  | 1 +
 cmd/bootz.c| 1 +
 cmd/cramfs.c   | 1 +
 cmd/disk.c | 1 +
 cmd/elf.c  | 1 +
 cmd/jffs2.c| 1 +
 cmd/load.c | 1 +
 cmd/mvebu/bubt.c   | 1 +
 cmd/nand.c | 1 +
 cmd/net.c  | 1 +
 cmd/pxe_utils.c| 1 +
 common/board_r.c   | 1 +
 common/update.c| 1 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 1 +
 include/common.h   | 4 
 include/image.h| 4 
 lib/optee/optee.c  | 1 +
 net/net.c  | 1 +
 net/nfs.c  | 1 +
 net/tftp.c | 1 +
 20 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index 1e4c9720fe..edf4f56426 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 7bfc491221..f14a5fefbf 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 1bc987528f..ad232deae0 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/disk.c b/cmd/disk.c
index c57561b3cb..15973b7d13 100644
--- a/cmd/disk.c
+++ b/cmd/disk.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
diff --git a/cmd/elf.c b/cmd/elf.c
index 57736f997b..ba06df06cf 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef CONFIG_X86
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index 672ed43b3f..da2580d85d 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -73,6 +73,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/load.c b/cmd/load.c
index bed973ede9..fab30fe894 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 6c68620d14..2041a7a29a 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/nand.c b/cmd/nand.c
index 92089a73c1..4de6892a01 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -20,6 +20,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/net.c b/cmd/net.c
index 6bce214e45..1b724cc570 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index ff8b0dcd7b..8b830212ce 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/common/board_r.c b/common/board_r.c
index 703b7a90f3..b13d310774 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/common/update.c b/common/update.c
index bfb760e52a..c8dd346a09 100644
--- a/common/update.c
+++ b/common/update.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 
 #if !(defined(CONFIG_FIT) && defined(CONFIG_OF_LIBFDT))
 #error "CONFIG_FIT and CONFIG_OF_LIBFDT are required for auto-update feature"
diff --git a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c 
b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
index 27610d48cf..9293d54e5a 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
@@ -6,6 +6,7 @@
 #include "ddr3_init.h"
 #include "mv_ddr_regs.h"
 #include "ddr_training_ip_db.h"
+#include 
 
 #define PATTERN_1  0x
 #define PATTERN_2  0x
diff --git a/include/common.h b/include/common.h
index 09b5f62ae3..5e38c5fc58 100644
--- a/include/common.h
+++ b/include/common.h
@@ -62,10 +62,6 @@ void hang(void) __attribute__ ((noreturn));
 /* common/cmd_source.c */
 intsource (ulong addr, const char *fit_uname);
 
-extern ulong image_load_addr; 

[PATCH 28/35] common: Move RAM-sizing functions to init.h

2019-12-11 Thread Simon Glass
These functions relate to memory init so move them into the init
header.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c   | 1 +
 arch/arm/cpu/arm926ejs/spear/spr_misc.c | 1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 1 +
 arch/arm/mach-davinci/misc.c| 1 +
 arch/arm/mach-imx/imx8/cpu.c| 1 +
 arch/arm/mach-imx/mx5/mx53_dram.c   | 1 +
 arch/arm/mach-imx/mx6/litesom.c | 1 +
 arch/arm/mach-mediatek/mt7623/init.c| 1 +
 arch/arm/mach-meson/board-axg.c | 1 +
 arch/arm/mach-meson/board-g12a.c| 1 +
 arch/arm/mach-meson/board-gx.c  | 1 +
 arch/arm/mach-mvebu/dram.c  | 1 +
 arch/arm/mach-omap2/am33xx/board.c  | 1 +
 arch/arm/mach-omap2/emif-common.c   | 1 +
 arch/arm/mach-omap2/sec-common.c| 1 +
 arch/arm/mach-orion5x/dram.c| 1 +
 arch/arm/mach-sunxi/dram_sun4i.c| 1 +
 arch/arm/mach-tegra/board.c | 1 +
 arch/mips/mach-ath79/dram.c | 1 +
 arch/mips/mach-mtmips/cpu.c | 1 +
 arch/powerpc/cpu/mpc85xx/traps.c| 1 +
 arch/powerpc/cpu/mpc86xx/traps.c| 1 +
 arch/powerpc/lib/bootm.c| 1 +
 arch/x86/cpu/tangier/sdram.c| 1 +
 board/AndesTech/adp-ae3xx/adp-ae3xx.c   | 1 +
 board/AndesTech/adp-ag101p/adp-ag101p.c | 1 +
 board/AndesTech/ax25-ae350/ax25-ae350.c | 1 +
 board/CarMediaLab/flea3/flea3.c | 1 +
 board/armltd/integrator/integrator.c| 1 +
 board/armltd/vexpress/vexpress_common.c | 1 +
 board/astro/mcf5373l/mcf5373l.c | 1 +
 board/atmel/at91rm9200ek/at91rm9200ek.c | 1 +
 board/atmel/at91sam9260ek/at91sam9260ek.c   | 1 +
 board/atmel/at91sam9261ek/at91sam9261ek.c   | 1 +
 board/atmel/at91sam9263ek/at91sam9263ek.c   | 1 +
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 1 +
 board/atmel/at91sam9n12ek/at91sam9n12ek.c   | 1 +
 board/atmel/at91sam9rlek/at91sam9rlek.c | 1 +
 board/atmel/sam9x60ek/sam9x60ek.c   | 1 +
 board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 1 +
 board/barco/platinum/platinum.c | 1 +
 board/barco/titanium/titanium.c | 1 +
 board/bluewater/snapper9260/snapper9260.c   | 1 +
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c  | 1 +
 board/broadcom/bcm28155_ap/bcm28155_ap.c| 1 +
 board/broadcom/bcm_ep/board.c   | 1 +
 board/broadcom/bcmns2/northstar2.c  | 1 +
 board/calao/usb_a9263/usb_a9263.c   | 1 +
 board/compulab/cl-som-imx7/spl.c| 1 +
 board/compulab/cm_fx6/spl.c | 1 +
 board/compulab/cm_t335/spl.c| 1 +
 board/compulab/cm_t43/spl.c | 1 +
 board/egnite/ethernut5/ethernut5.c  | 1 +
 board/esd/meesc/meesc.c | 1 +
 board/esd/vme8349/vme8349.c | 1 +
 board/freescale/bsc9131rdb/ddr.c| 1 +
 board/freescale/mpc8308rdb/sdram.c  | 1 +
 board/freescale/mx53ard/mx53ard.c   | 1 +
 board/freescale/mx53smd/mx53smd.c   | 1 +
 board/freescale/s32v234evb/s32v234evb.c | 1 +
 board/freescale/vf610twr/vf610twr.c | 1 +
 board/gdsys/mpc8308/sdram.c | 1 +
 board/hisilicon/poplar/poplar.c | 1 +
 board/ids/ids8313/ids8313.c | 1 +
 board/inversepath/usbarmory/usbarmory.c | 1 +
 board/l+g/vinco/vinco.c | 1 +
 board/laird/wb45n/wb45n.c   | 1 +
 board/mini-box/picosam9g45/picosam9g45.c| 1 +
 board/mpc8308_p1m/sdram.c   | 1 +
 board/phytec/pcl063/pcl063.c| 1 +
 board/phytec/phycore_am335x_r2/board.c  | 1 +
 board/ronetix/pm9261/pm9261.c   | 1 +
 board/ronetix/pm9263/pm9263.c   | 1 +
 board/ronetix/pm9g45/pm9g45.c   | 1 +
 board/samsung/arndale/arndale.c | 1 +
 board/samsung/smdkc100/smdkc100.c   | 1 +
 board/samsung/smdkv310/smdkv310.c   | 1 +
 board/seco/mx6quq7/mx6quq7.c| 1 +
 board/siemens/corvus/board.c| 1 +
 board/siemens/smartweb/smartweb.c   | 1 +
 board/siemens/taurus/taurus.c   | 1 +
 board/socrates/sdram.c  | 1 +
 board/sunxi/board.c 

[PATCH 1/2] ARM: dts: Import Khadas VIM3L DT from Linux 5.5-rc1

2019-12-11 Thread Christian Hewitt
Import the Khadas VIM3L device-tree from [1]

[1] e42617b825f8 ("Linux 5.5-rc1")

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile   |  1 +
 arch/arm/dts/meson-sm1-khadas-vim3l.dts | 95 +
 2 files changed, 96 insertions(+)
 create mode 100644 arch/arm/dts/meson-sm1-khadas-vim3l.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3dc9c4d..b6c9f82 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -152,6 +152,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-sei510.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
+   meson-sm1-khadas-vim3l.dtb \
meson-sm1-sei610.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
diff --git a/arch/arm/dts/meson-sm1-khadas-vim3l.dts 
b/arch/arm/dts/meson-sm1-khadas-vim3l.dts
new file mode 100644
index 000..1001b37
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-khadas-vim3l.dts
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1.dtsi"
+#include "meson-khadas-vim3.dtsi"
+
+/ {
+   compatible = "khadas,vim3l", "amlogic,sm1";
+   model = "Khadas VIM3L";
+
+   vddcpu: regulator-vddcpu {
+   /*
+* Silergy SY8030DEC Regulator.
+*/
+   compatible = "pwm-regulator";
+
+   regulator-name = "VDDCPU";
+   regulator-min-microvolt = <69>;
+   regulator-max-microvolt = <105>;
+
+   vin-supply = <_3v3>;
+
+   pwms = <_AO_cd 1 1250 0>;
+   pwm-dutycycle-range = <100 0>;
+
+   regulator-boot-on;
+   regulator-always-on;
+   };
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU1_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU2_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU3_CLK>;
+   clock-latency = <5>;
+};
+
+_AO_cd {
+   pinctrl-0 = <_ao_d_e_pins>;
+   pinctrl-names = "default";
+   clocks = <>;
+   clock-names = "clkin1";
+   status = "okay";
+};
+
+/*
+ * The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
+ * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
+ * an USB3.0 Type A connector and a M.2 Key M slot. The PHY driving
+ * these differential lines is shared between the USB3.0 controller
+ * and the PCIe Controller, thus only a single controller can use it.
+ * If the MCU is configured to mux the PCIe/USB3.0 differential lines
+ * to the M.2 Key M slot, uncomment the following block to disable
+ * USB3.0 from the USB Complex and enable the PCIe controller.
+ * The End User is not expected to uncomment the following except for
+ * testing purposes, but instead rely on the firmware/bootloader to
+ * update these nodes accordingly if PCIe mode is selected by the MCU.
+ */
+
+/*
+ {
+   status = "okay";
+};
+
+ {
+   phys = <_phy0>, <_phy1>;
+   phy-names = "usb2-phy0", "usb2-phy1";
+};
+ */
-- 
2.7.4



[PATCH 0/2] amlogic: add Khadas VIM3L support

2019-12-11 Thread Christian Hewitt
Khadas VIM3L is a new revision of the VIM3 board that swaps the premium
A311D chip for Amlogic's mid-range S905D3 chip.

Christian Hewitt (2):
  ARM: dts: Import Khadas VIM3L DT from Linux 5.5-rc1
  boards: amlogic: add Khadas VIM3L support

 arch/arm/dts/Makefile   |   1 +
 arch/arm/dts/meson-sm1-khadas-vim3l.dts |  95 +++
 board/amlogic/w400/README.khadas-vim3l  | 132 
 configs/khadas-vim3l_defconfig  |  62 +++
 4 files changed, 290 insertions(+)
 create mode 100644 arch/arm/dts/meson-sm1-khadas-vim3l.dts
 create mode 100644 board/amlogic/w400/README.khadas-vim3l
 create mode 100644 configs/khadas-vim3l_defconfig

-- 
2.7.4



[PATCH 21/35] common: Move clock functions into a new file

2019-12-11 Thread Simon Glass
These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm1136/mx35/generic.c|  1 +
 arch/arm/cpu/arm926ejs/lpc32xx/clk.c   |  1 +
 arch/arm/cpu/arm926ejs/mx25/generic.c  |  1 +
 arch/arm/cpu/armv7/ls102xa/clock.c |  1 +
 arch/arm/cpu/armv7/ls102xa/fdt.c   |  1 +
 arch/arm/cpu/armv7/vf610/generic.c |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c|  1 +
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c |  1 +
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/soc.c|  1 +
 arch/arm/cpu/armv8/fsl-layerscape/spl.c|  1 +
 arch/arm/cpu/armv8/s32v234/generic.c   |  1 +
 arch/arm/mach-imx/mx7/clock.c  |  1 +
 arch/arm/mach-imx/mx7ulp/clock.c   |  1 +
 arch/arm/mach-imx/speed.c  |  1 +
 arch/m68k/cpu/mcf5227x/speed.c |  1 +
 arch/m68k/cpu/mcf523x/speed.c  |  1 +
 arch/m68k/cpu/mcf52x2/speed.c  |  3 ++-
 arch/m68k/cpu/mcf530x/speed.c  |  1 +
 arch/m68k/cpu/mcf532x/speed.c  |  1 +
 arch/m68k/cpu/mcf5445x/speed.c |  1 +
 arch/m68k/cpu/mcf547x_8x/speed.c   |  1 +
 arch/mips/mach-ath79/ar933x/clk.c  |  1 +
 arch/mips/mach-ath79/ar934x/clk.c  |  1 +
 arch/mips/mach-ath79/qca953x/clk.c |  1 +
 arch/mips/mach-ath79/qca956x/clk.c |  1 +
 arch/powerpc/cpu/mpc83xx/fdt.c |  1 +
 arch/powerpc/cpu/mpc83xx/speed.c   |  1 +
 arch/powerpc/cpu/mpc83xx/spl_minimal.c |  1 +
 arch/powerpc/cpu/mpc85xx/fdt.c |  1 +
 arch/powerpc/cpu/mpc85xx/speed.c   |  5 ++---
 arch/powerpc/cpu/mpc86xx/speed.c   |  1 +
 arch/powerpc/cpu/mpc8xx/speed.c|  1 +
 board/Arcturus/ucp1020/spl.c   |  1 +
 board/compulab/cm_fx6/spl.c|  1 +
 board/freescale/b4860qds/spl.c |  1 +
 board/freescale/c29xpcie/spl.c |  1 +
 board/freescale/ls1021aiot/ls1021aiot.c|  1 +
 board/freescale/ls1021aqds/ls1021aqds.c|  1 +
 board/freescale/ls1021atsn/ls1021atsn.c|  1 +
 board/freescale/ls1021atwr/ls1021atwr.c|  1 +
 board/freescale/lx2160a/lx2160a.c  |  1 +
 board/freescale/mpc8313erdb/mpc8313erdb.c  |  1 +
 board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c  |  1 +
 board/freescale/p1010rdb/spl.c |  1 +
 board/freescale/p1022ds/diu.c  |  1 +
 board/freescale/p1022ds/spl.c  |  1 +
 board/freescale/p1_p2_rdb_pc/spl.c |  1 +
 board/freescale/qemu-ppce500/qemu-ppce500.c|  4 ++--
 board/freescale/t102xqds/spl.c |  1 +
 board/freescale/t102xrdb/spl.c |  1 +
 board/freescale/t1040qds/diu.c |  1 +
 board/freescale/t104xrdb/diu.c |  1 +
 board/freescale/t104xrdb/spl.c |  1 +
 board/freescale/t208xqds/spl.c |  1 +
 board/freescale/t208xrdb/spl.c |  1 +
 board/freescale/t4qds/spl.c|  1 +
 board/freescale/t4rdb/spl.c|  1 +
 board/gdsys/p1022/diu.c|  1 +
 board/kosagi/novena/novena_spl.c   |  1 +
 board/socrates/socrates.c  |  1 +
 common/board_f.c   |  1 +
 drivers/clk/mpc83xx_clk.c  |  1 +
 drivers/net/ag7xxx.c   |  1 +
 drivers/serial/lpc32xx_hsuart.c|  1 +
 drivers/serial/ns16550.c   |  1 +
 drivers/serial/serial_ar933x.c |  1 +
 drivers/serial/serial_ns16550.c|  1 +
 drivers/spi/ath79_spi.c|  1 +
 include/clock_legacy.h | 14 ++
 include/common.h   |  5 -
 71 files changed, 86 insertions(+), 11 deletions(-)
 create mode 100644 include/clock_legacy.h

diff --git a/arch/arm/cpu/arm1136/mx35/generic.c 
b/arch/arm/cpu/arm1136/mx35/generic.c
index a651b8c341..45bf49b5ac 100644
--- a/arch/arm/cpu/arm1136/mx35/generic.c
+++ b/arch/arm/cpu/arm1136/mx35/generic.c
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/clk.c 
b/arch/arm/cpu/arm926ejs/lpc32xx/clk.c
index 5eb630dabe..cb2344d79f 100644
--- a/arch/arm/cpu/arm926ejs/lpc32xx/clk.c
+++ b/arch/arm/cpu/arm926ejs/lpc32xx/clk.c
@@ -4,6 +4,7 @@
  */
 
 

[PATCH 24/35] common: Move reset_cpu() to the CPU header

2019-12-11 Thread Simon Glass
Move this function out of common.h and into a relevant header file.

Signed-off-by: Simon Glass 
---

 arch/arc/lib/reset.c| 1 +
 arch/arm/cpu/arm920t/ep93xx/cpu.c   | 1 +
 arch/arm/cpu/arm920t/imx/timer.c| 3 ++-
 arch/arm/cpu/arm926ejs/armada100/timer.c| 3 ++-
 arch/arm/cpu/arm926ejs/mx25/reset.c | 1 +
 arch/arm/cpu/arm926ejs/mx27/reset.c | 1 +
 arch/arm/cpu/arm926ejs/mxs/mxs.c| 1 +
 arch/arm/cpu/arm926ejs/spear/reset.c| 1 +
 arch/arm/cpu/armv7/bcm281xx/reset.c | 1 +
 arch/arm/cpu/armv7/bcmcygnus/reset.c| 1 +
 arch/arm/cpu/armv7/bcmnsp/reset.c   | 1 +
 arch/arm/cpu/armv7/stv0991/reset.c  | 1 +
 arch/arm/cpu/armv8/s32v234/generic.c| 1 +
 arch/arm/lib/interrupts.c   | 3 ++-
 arch/arm/lib/interrupts_m.c | 1 +
 arch/arm/lib/reset.c| 1 +
 arch/arm/mach-at91/arm920t/reset.c  | 1 +
 arch/arm/mach-at91/arm926ejs/reset.c| 1 +
 arch/arm/mach-at91/armv7/reset.c| 1 +
 arch/arm/mach-bcm283x/reset.c   | 1 +
 arch/arm/mach-davinci/reset.c   | 1 +
 arch/arm/mach-imx/mx7ulp/soc.c  | 1 +
 arch/arm/mach-k3/common.c   | 1 +
 arch/arm/mach-keystone/ddr3.c   | 1 +
 arch/arm/mach-kirkwood/cpu.c| 1 +
 arch/arm/mach-mediatek/mt8516/init.c| 1 +
 arch/arm/mach-mediatek/mt8518/init.c| 1 +
 arch/arm/mach-meson/board-common.c  | 1 +
 arch/arm/mach-mvebu/armada3700/cpu.c| 1 +
 arch/arm/mach-omap2/omap5/hwinit.c  | 1 +
 arch/arm/mach-omap2/reset.c | 1 +
 arch/arm/mach-socfpga/misc_gen5.c   | 1 +
 arch/arm/mach-tegra/cmd_enterrcm.c  | 1 +
 arch/arm/mach-tegra/pmc.c   | 1 +
 arch/arm/mach-uniphier/reset.c  | 1 +
 arch/arm/mach-zynqmp-r5/cpu.c   | 1 +
 arch/nds32/lib/interrupts.c | 1 +
 arch/sh/cpu/sh4/cpu.c   | 2 +-
 arch/sh/cpu/sh4/watchdog.c  | 1 +
 board/BuR/brppt2/board.c| 1 +
 board/abilis/tb100/tb100.c  | 1 +
 board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c   | 1 +
 board/armltd/vexpress64/vexpress64.c| 1 +
 board/atmark-techno/armadillo-800eva/armadillo-800eva.c | 1 +
 board/bosch/shc/board.c | 1 +
 board/broadcom/bcmns2/northstar2.c  | 1 +
 board/cavium/thunderx/thunderx.c| 1 +
 board/compulab/cm_t335/spl.c| 1 +
 board/freescale/imx8mm_evk/spl.c| 1 +
 board/freescale/imx8mn_evk/spl.c| 1 +
 board/freescale/imx8qm_mek/imx8qm_mek.c | 1 +
 board/freescale/imx8qxp_mek/imx8qxp_mek.c   | 1 +
 board/freescale/mx6memcal/spl.c | 1 +
 board/hisilicon/hikey/hikey.c   | 1 +
 board/hisilicon/hikey960/hikey960.c | 1 +
 board/hisilicon/poplar/poplar.c | 1 +
 board/kmc/kzm9g/kzm9g.c | 1 +
 board/liebherr/display5/spl.c   | 1 +
 board/phytium/durian/durian.c   | 1 +
 board/qualcomm/dragonboard410c/dragonboard410c.c| 1 +
 board/qualcomm/dragonboard820c/dragonboard820c.c| 1 +
 board/renesas/alt/alt.c | 1 +
 board/renesas/alt/alt_spl.c | 1 +
 board/renesas/blanche/blanche.c | 1 +
 board/renesas/condor/condor.c   | 1 +
 board/renesas/draak/draak.c | 1 +
 board/renesas/eagle/eagle.c | 1 +
 board/renesas/ebisu/ebisu.c | 1 +
 board/renesas/gose/gose.c   | 1 +
 board/renesas/gose/gose_spl.c   | 1 +
 board/renesas/grpeach/grpeach.c | 1 +
 board/renesas/koelsch/koelsch.c | 1 +
 board/renesas/koelsch/koelsch_spl.c | 1 +
 board/renesas/lager/lager.c | 1 +
 board/renesas/lager/lager_spl.c | 1 +
 board/renesas/porter/porter.c   | 1 +
 board/renesas/porter/porter_spl.c   | 1 +
 board/renesas/rcar-common/gen3-spl.c  

[PATCH 11/35] common: Move reset_phy() to net.h

2019-12-11 Thread Simon Glass
This is a network function so let's move it into that header.

Signed-off-by: Simon Glass 
---

 arch/arm/mach-omap2/emif-common.c   | 1 +
 board/LaCie/edminiv2/edminiv2.c | 1 +
 board/LaCie/net2big_v2/net2big_v2.c | 1 +
 board/LaCie/netspace_v2/netspace_v2.c   | 1 +
 board/Marvell/db-88f6281-bp/db-88f6281-bp.c | 1 +
 board/Marvell/dreamplug/dreamplug.c | 1 +
 board/Marvell/guruplug/guruplug.c   | 1 +
 board/Marvell/openrd/openrd.c   | 1 +
 board/Marvell/sheevaplug/sheevaplug.c   | 1 +
 board/Seagate/dockstar/dockstar.c   | 1 +
 board/Seagate/goflexhome/goflexhome.c   | 1 +
 board/Seagate/nas220/nas220.c   | 1 +
 board/Synology/ds109/ds109.c| 1 +
 board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c | 1 +
 board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c | 1 +
 board/atmel/at91sam9260ek/at91sam9260ek.c   | 1 +
 board/atmel/at91sam9263ek/at91sam9263ek.c   | 1 +
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 1 +
 board/cloudengines/pogo_e02/pogo_e02.c  | 1 +
 board/d-link/dns325/dns325.c| 1 +
 board/freescale/ls1012afrdm/eth.c   | 1 +
 board/freescale/ls1012ardb/eth.c| 1 +
 board/freescale/ls1088a/eth_ls1088aqds.c| 1 +
 board/freescale/ls1088a/eth_ls1088ardb.c| 1 +
 board/freescale/ls2080a/ls2080a.c   | 1 +
 board/freescale/ls2080aqds/eth.c| 1 +
 board/freescale/ls2080ardb/eth_ls2080rdb.c  | 1 +
 board/freescale/lx2160a/eth_lx2160aqds.c| 1 +
 board/freescale/lx2160a/eth_lx2160ardb.c| 1 +
 board/keymile/km_arm/km_arm.c   | 1 +
 board/zyxel/nsa310s/nsa310s.c   | 1 +
 common/board_r.c| 1 +
 include/common.h| 3 ---
 include/net.h   | 8 
 34 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/emif-common.c 
b/arch/arm/mach-omap2/emif-common.c
index 290f9dcdb0..c900f28af2 100644
--- a/arch/arm/mach-omap2/emif-common.c
+++ b/arch/arm/mach-omap2/emif-common.c
@@ -9,6 +9,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/LaCie/edminiv2/edminiv2.c b/board/LaCie/edminiv2/edminiv2.c
index b68e18e034..b5ffe8162f 100644
--- a/board/LaCie/edminiv2/edminiv2.c
+++ b/board/LaCie/edminiv2/edminiv2.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include "../common/common.h"
 #include 
diff --git a/board/LaCie/net2big_v2/net2big_v2.c 
b/board/LaCie/net2big_v2/net2big_v2.c
index 686608d25a..50305656e8 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/LaCie/netspace_v2/netspace_v2.c 
b/board/LaCie/netspace_v2/netspace_v2.c
index bd7ab22948..b7ae58c645 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Marvell/db-88f6281-bp/db-88f6281-bp.c 
b/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
index b68f2f3c89..729516d9e1 100644
--- a/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
+++ b/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Marvell/dreamplug/dreamplug.c 
b/board/Marvell/dreamplug/dreamplug.c
index ede168c9ec..887dd1ed74 100644
--- a/board/Marvell/dreamplug/dreamplug.c
+++ b/board/Marvell/dreamplug/dreamplug.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Marvell/guruplug/guruplug.c 
b/board/Marvell/guruplug/guruplug.c
index 466f85eb08..71bee76bdc 100644
--- a/board/Marvell/guruplug/guruplug.c
+++ b/board/Marvell/guruplug/guruplug.c
@@ -7,6 +7,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index a4923ce971..ae9202895d 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Marvell/sheevaplug/sheevaplug.c 
b/board/Marvell/sheevaplug/sheevaplug.c
index 7c7d30..6c6106c23c 100644
--- a/board/Marvell/sheevaplug/sheevaplug.c
+++ b/board/Marvell/sheevaplug/sheevaplug.c
@@ -7,6 +7,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/Seagate/dockstar/dockstar.c 
b/board/Seagate/dockstar/dockstar.c
index 40e5dc7034..5a8c6e282b 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

[PATCH 10/35] common: Drop floppy disk support

2019-12-11 Thread Simon Glass
This seems pretty old now. It has not been converted to driver model and
is not used by any boards.

Drop it.

Signed-off-by: Simon Glass 
---

 README  |  26 --
 cmd/Kconfig |   5 -
 cmd/Makefile|   1 -
 cmd/fdc.c   | 752 
 drivers/misc/Makefile   |   1 -
 drivers/misc/ns87308.c  | 100 -
 drivers/serial/serial_ns16550.c |   7 +-
 include/common.h|   1 -
 include/ns87308.h   | 233 --
 scripts/config_whitelist.txt|  34 --
 10 files changed, 1 insertion(+), 1159 deletions(-)
 delete mode 100644 cmd/fdc.c
 delete mode 100644 drivers/misc/ns87308.c
 delete mode 100644 include/ns87308.h

diff --git a/README b/README
index 91dfb24776..78f59c391a 100644
--- a/README
+++ b/README
@@ -2870,32 +2870,6 @@ Low Level (hardware related) configuration options:
If this macro is defined, then CONFIG_SYS_CCSRBAR_PHYS will be
forced to a value that ensures that CCSR is not relocated.
 
-- Floppy Disk Support:
-   CONFIG_SYS_FDC_DRIVE_NUMBER
-
-   the default drive number (default value 0)
-
-   CONFIG_SYS_ISA_IO_STRIDE
-
-   defines the spacing between FDC chipset registers
-   (default value 1)
-
-   CONFIG_SYS_ISA_IO_OFFSET
-
-   defines the offset of register from address. It
-   depends on which part of the data bus is connected to
-   the FDC chipset. (default value 0)
-
-   If CONFIG_SYS_ISA_IO_STRIDE CONFIG_SYS_ISA_IO_OFFSET and
-   CONFIG_SYS_FDC_DRIVE_NUMBER are undefined, they take their
-   default value.
-
-   if CONFIG_SYS_FDC_HW_INIT is defined, then the function
-   fdc_hw_init() is called at the beginning of the FDC
-   setup. fdc_hw_init() must be provided by the board
-   source code. It is used to make hardware-dependent
-   initializations.
-
 - CONFIG_IDE_AHB:
Most IDE controllers were designed to be connected with PCI
interface. Only few of them were designed for AHB interface.
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 1e4cf146c5..5f5f10b917 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -842,11 +842,6 @@ config CMD_FASTBOOT
 
  See doc/android/fastboot.txt for more information.
 
-config CMD_FDC
-   bool "fdcboot - Boot from floppy device"
-   help
- The 'fdtboot' command allows booting an image from a floppy disk.
-
 config CMD_FLASH
bool "flinfo, erase, protect"
default y
diff --git a/cmd/Makefile b/cmd/Makefile
index 3ac7104546..59997cb5b9 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -58,7 +58,6 @@ obj-$(CONFIG_HUSH_PARSER) += exit.o
 obj-$(CONFIG_CMD_EXT4) += ext4.o
 obj-$(CONFIG_CMD_EXT2) += ext2.o
 obj-$(CONFIG_CMD_FAT) += fat.o
-obj-$(CONFIG_CMD_FDC) += fdc.o
 obj-$(CONFIG_CMD_FDT) += fdt.o
 obj-$(CONFIG_CMD_FITUPD) += fitupd.o
 obj-$(CONFIG_CMD_FLASH) += flash.o
diff --git a/cmd/fdc.c b/cmd/fdc.c
deleted file mode 100644
index 7d4b829637..00
--- a/cmd/fdc.c
+++ /dev/null
@@ -1,752 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2001
- * Denis Peter, MPL AG, d.pe...@mpl.ch.
- */
-/*
- * Floppy Disk support
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-
-#undef FDC_DEBUG
-
-#ifdef FDC_DEBUG
-#definePRINTF(fmt,args...) printf (fmt ,##args)
-#else
-#define PRINTF(fmt,args...)
-#endif
-
-/*#if defined(CONFIG_CMD_DATE) */
-/*#include  */
-/*#endif */
-
-typedef struct {
-   int flags;  /* connected drives ect */
-   unsigned long   blnr;   /* Logical block nr */
-   uchar   drive;  /* drive no */
-   uchar   cmdlen; /* cmd length */
-   uchar   cmd[16];/* cmd desc */
-   uchar   dma;/* if > 0 dma enabled */
-   uchar   result[11]; /* status information */
-   uchar   resultlen;  /* lenght of result */
-} FDC_COMMAND_STRUCT;
-
-/* flags: only the lower 8bit used:
- * bit 0 if set drive 0 is present
- * bit 1 if set drive 1 is present
- * bit 2 if set drive 2 is present
- * bit 3 if set drive 3 is present
- * bit 4 if set disk in drive 0 is inserted
- * bit 5 if set disk in drive 1 is inserted
- * bit 6 if set disk in drive 2 is inserted
- * bit 7 if set disk in drive 4 is inserted
- */
-
-/* cmd indexes */
-#define COMMAND0
-#define DRIVE  1
-#define CONFIG01
-#define SPEC_HUTSRT1
-#define TRACK  2
-#define CONFIG12
-#define SPEC_HLT   2
-#define HEAD   3
-#define CONFIG23
-#define SECTOR 4
-#define SECTOR_SIZE5
-#define 

[PATCH 08/35] common: Move relocate_code() to init.h

2019-12-11 Thread Simon Glass
This is an init function so move it out of the common header. Avoid using
the typedef so that we don't have to include the global_data header file.

Also tidy up the function style in comments while we are here.

Signed-off-by: Simon Glass 
---

 arch/arm/lib/relocate_64.S |  2 +-
 arch/m68k/cpu/mcf5227x/start.S |  2 +-
 arch/m68k/cpu/mcf523x/start.S  |  2 +-
 arch/m68k/cpu/mcf52x2/start.S  |  2 +-
 arch/m68k/cpu/mcf530x/start.S  |  2 +-
 arch/m68k/cpu/mcf532x/start.S  |  2 +-
 arch/m68k/cpu/mcf5445x/start.S |  2 +-
 arch/m68k/cpu/mcf547x_8x/start.S   |  2 +-
 arch/mips/lib/reloc.c  |  1 +
 arch/nds32/cpu/n1213/start.S   |  2 +-
 arch/nios2/cpu/start.S |  2 +-
 arch/powerpc/cpu/mpc83xx/start.S   |  2 +-
 arch/powerpc/cpu/mpc85xx/start.S   |  2 +-
 arch/powerpc/cpu/mpc86xx/start.S   |  2 +-
 arch/powerpc/cpu/mpc8xx/start.S|  2 +-
 arch/riscv/cpu/start.S |  2 +-
 arch/sh/lib/board.c|  1 +
 arch/xtensa/cpu/start.S|  2 +-
 board/Arcturus/ucp1020/spl.c   |  1 +
 board/Arcturus/ucp1020/spl_minimal.c   |  1 +
 board/freescale/b4860qds/spl.c |  1 +
 board/freescale/bsc9131rdb/spl_minimal.c   |  1 +
 board/freescale/bsc9132qds/spl_minimal.c   |  1 +
 board/freescale/c29xpcie/spl.c |  1 +
 board/freescale/c29xpcie/spl_minimal.c |  1 +
 board/freescale/p1010rdb/spl.c |  1 +
 board/freescale/p1010rdb/spl_minimal.c |  1 +
 board/freescale/p1022ds/spl.c  |  1 +
 board/freescale/p1022ds/spl_minimal.c  |  1 +
 board/freescale/p1_p2_rdb_pc/spl.c |  1 +
 board/freescale/p1_p2_rdb_pc/spl_minimal.c |  1 +
 board/freescale/t102xqds/spl.c |  1 +
 board/freescale/t102xrdb/spl.c |  1 +
 board/freescale/t104xrdb/spl.c |  1 +
 board/freescale/t208xqds/spl.c |  1 +
 board/freescale/t208xrdb/spl.c |  1 +
 board/freescale/t4qds/spl.c|  1 +
 board/freescale/t4rdb/spl.c|  1 +
 include/common.h   |  6 --
 include/init.h | 10 ++
 40 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/arch/arm/lib/relocate_64.S b/arch/arm/lib/relocate_64.S
index 26d29c5324..72e91f2704 100644
--- a/arch/arm/lib/relocate_64.S
+++ b/arch/arm/lib/relocate_64.S
@@ -14,7 +14,7 @@
 #include 
 
 /*
- * void relocate_code (addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  * x0 holds the destination address.
diff --git a/arch/m68k/cpu/mcf5227x/start.S b/arch/m68k/cpu/mcf5227x/start.S
index 61f9c6859c..86c93ba3fa 100644
--- a/arch/m68k/cpu/mcf5227x/start.S
+++ b/arch/m68k/cpu/mcf5227x/start.S
@@ -386,7 +386,7 @@ _start:
 
/**/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S
index f57baa58f5..8c5a164955 100644
--- a/arch/m68k/cpu/mcf523x/start.S
+++ b/arch/m68k/cpu/mcf523x/start.S
@@ -150,7 +150,7 @@ _start:
 
/**/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S
index f7f124dd2f..747a518f6c 100644
--- a/arch/m68k/cpu/mcf52x2/start.S
+++ b/arch/m68k/cpu/mcf52x2/start.S
@@ -229,7 +229,7 @@ _after_flashbar_copy:
 
/**/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S
index eb4b33899f..32356d875e 100644
--- a/arch/m68k/cpu/mcf530x/start.S
+++ b/arch/m68k/cpu/mcf530x/start.S
@@ -155,7 +155,7 @@ _start:
 
/**/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S
index 4411e5fe28..e2d7c72cee 100644
--- a/arch/m68k/cpu/mcf532x/start.S
+++ b/arch/m68k/cpu/mcf532x/start.S
@@ -165,7 +165,7 @@ _start:
 

Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
On Wed, Dec 11, 2019 at 10:57 PM Fabio Estevam  wrote:

> Just did a quick boot test on a imx8mq-evk with v2.2 upstream ATF and
> it booted fine.

Actually I do see some power domain issues when using upstream ATF and
booting mainline kernel:

[1.573227] imx-pgc imx-pgc-domain.3: failed to command PGC

[1.813816] imx-pgc imx-pgc-domain.3: failed to command PGC

[1.931568] imx-pgc imx-pgc-domain.3: failed to command PGC

So it seems there are some more work to do on the i.MX8M ATF upstream front.


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
On Wed, Dec 11, 2019 at 10:20 PM Fabio Estevam  wrote:
>
> Hi Peter,
>
> On Wed, Dec 11, 2019 at 10:09 PM Peter Robinson  wrote:
>
> > It would be useful to test against the upstream releases and document
> > against those rather than random vendor forks, upstream has fairly
> > consistent 6 monthly releases around March/October with the last one
> > being 2.2.
>
> I agree.
>
> I plan to test the NXP i.MX8 boards with upstream ATF.
>
> As we are at rc4 at the moment, I prefer we go with the updated vendor
> ATF version as proposed in this patch and then after 2020.01 I plan to
> test and switch to mainline ATF, so that we can have more time for
> testing.

Just did a quick boot test on a imx8mq-evk with v2.2 upstream ATF and
it booted fine.


RE: [PATCH] imx8m: ddr_init: Move ddr_init() messages to debug level

2019-12-11 Thread Peng Fan
> Subject: [PATCH] imx8m: ddr_init: Move ddr_init() messages to debug level
> 
> Currently inside ddr_init() there is a mix of printf() and debug() level 
> messages.
> 
> Since this type of information is useful for debug purposes, convert all of 
> them
> to debug level for consistency.
> 
> Signed-off-by: Fabio Estevam 

Reviewed-by: Peng Fan 

> ---
>  drivers/ddr/imx/imx8m/ddr_init.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ddr/imx/imx8m/ddr_init.c
> b/drivers/ddr/imx/imx8m/ddr_init.c
> index d6e915c9b9..21af66e4e7 100644
> --- a/drivers/ddr/imx/imx8m/ddr_init.c
> +++ b/drivers/ddr/imx/imx8m/ddr_init.c
> @@ -24,7 +24,7 @@ void ddr_init(struct dram_timing_info *dram_timing)  {
>   unsigned int tmp, initial_drate, target_freq;
> 
> - printf("DDRINFO: start DRAM init\n");
> + debug("DDRINFO: start DRAM init\n");
> 
>   /* Step1: Follow the power up procedure */
>   if (is_imx8mq()) {
> @@ -109,7 +109,7 @@ void ddr_init(struct dram_timing_info *dram_timing)
>   tmp = reg32_read(DDRPHY_CalBusy(0));
>   } while ((tmp & 0x1));
> 
> - printf("DDRINFO:ddrphy calibration done\n");
> + debug("DDRINFO:ddrphy calibration done\n");
> 
>   /* Step15: Set SWCTL.sw_done to 0 */
>   reg32_write(DDRC_SWCTL(0), 0x); @@ -161,7 +161,7 @@
> void ddr_init(struct dram_timing_info *dram_timing)
> 
>   /* enable port 0 */
>   reg32_write(DDRC_PCTRL_0(0), 0x0001);
> - printf("DDRINFO: ddrmix config done\n");
> + debug("DDRINFO: ddrmix config done\n");
> 
>   /* save the dram timing config into memory */
>   dram_config_save(dram_timing,
> CONFIG_SAVED_DRAM_TIMING_BASE);
> --
> 2.17.1



Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
Hi Peter,

On Wed, Dec 11, 2019 at 10:09 PM Peter Robinson  wrote:

> It would be useful to test against the upstream releases and document
> against those rather than random vendor forks, upstream has fairly
> consistent 6 monthly releases around March/October with the last one
> being 2.2.

I agree.

I plan to test the NXP i.MX8 boards with upstream ATF.

As we are at rc4 at the moment, I prefer we go with the updated vendor
ATF version as proposed in this patch and then after 2020.01 I plan to
test and switch to mainline ATF, so that we can have more time for
testing.


RE: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Peng Fan
> Subject: [PATCH] imx8mq_evk: Update the required ATF branch
> 
> Following the README instructions leads to a non-booting
> U-Boot:
> 
> U-Boot SPL 2020.01-rc3-00070-g9a0cbae22a (Nov 25 2019 - 13:08:24 -0300)
> PMIC:  PFUZE100 ID=0x10
> DDRINFO: start DRAM init
> DDRINFO:ddrphy calibration done
> DDRINFO: ddrmix config done
> Normal Boot
> Trying to boot from MMC2
> 
> (It hangs here)
> 
> Use the "imx_4.19.35_1.0.0" ATF branch instead, which fixes such problem
> and allow the boot to complete again.
> 
> Suggested-by: Adam Ford 
> Signed-off-by: Fabio Estevam 

Acked-by: Peng Fan 

> ---
>  board/freescale/imx8mq_evk/README | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/freescale/imx8mq_evk/README
> b/board/freescale/imx8mq_evk/README
> index c1d400bcf9..4f671b069c 100644
> --- a/board/freescale/imx8mq_evk/README
> +++ b/board/freescale/imx8mq_evk/README
> @@ -11,7 +11,7 @@ Get and Build the ARM Trusted firmware
> ==
>  Note: srctree is U-Boot source directory  Get ATF from:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource
> .codeaurora.org%2Fexternal%2Fimx%2Fimx-atfdata=02%7C01%7Cpen
> g.fan%40nxp.com%7C15caa498b49343fabede08d77e40facf%7C686ea1d3bc
> 2b4c6fa92cd99c5c301635%7C0%7C0%7C637116689861712196sdata
> =GNw4g1oDo9ceM1VIEB9A11716fQQF1GNzpJ4L3n8FTM%3Dreserved
> =0
> -branch: imx_4.14.62_1.0.0_beta
> +branch: imx_4.19.35_1.0.0
>  $ make PLAT=imx8mq bl31
>  $ cp build/imx8mq/release/bl31.bin $(srctree)
> 
> --
> 2.17.1



Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Peter Robinson
On Wed, Dec 11, 2019 at 4:02 PM Fabio Estevam  wrote:
>
> On Wed, Dec 11, 2019 at 11:14 AM Schrempf Frieder
>  wrote:
>
> > Just for the record: I am using upstream ATF for my custom i.MX8MM board
> > with mainline U-Boot and it just works fine. I didn't run into any
> > issues so far and I'm still on ATF revision 3441952f61a6 and haven't
> > updated for quite a while.
>
> Thanks for the feedback.
>
> Perhaps we can consider moving to mainline ATF after 2020.01 is released.

It would be useful to test against the upstream releases and document
against those rather than random vendor forks, upstream has fairly
consistent 6 monthly releases around March/October with the last one
being 2.2.

Peter


Re: Pull request: socfpga-next

2019-12-11 Thread Marek Vasut
On 12/10/19 11:01 AM, Simon Goldschmidt wrote:
> Hi Marek,
> 
> after fixing Stratix10 build warnings, please pull this updated Agilex
> series for next.
> 
> Travis ran successfully this time:
> https://travis-ci.org/goldsimon/u-boot/builds/622657322
> 
> Regards,
> Simon
> 
> The following changes since commit b38c3a641fc01fcd4eda5fa107ae3c247baa0196:
> 
>   Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
> (2019-12-08 10:51:00 -0500)
> 
> are available in the git repository at:
> 
>   https://github.com/goldsimon/u-boot.git socfpga-next
> 

Rebase this on socfpga/next please, so the fix is visible and I don't
have to rewrite the branch.


[PATCH 35/35] common: Update comment to show progress

2019-12-11 Thread Simon Glass
This file doesn't include any declarations anymore but it does include
other headers. Update the header comment to mention this.

Signed-off-by: Simon Glass 
---

 include/common.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/common.h b/include/common.h
index 388d98a1db..0ef8505fc7 100644
--- a/include/common.h
+++ b/include/common.h
@@ -2,9 +2,8 @@
 /*
  * Common header file for U-Boot
  *
- * This file still includes quite a bit of stuff that should be in separate
- * headers. Please think before adding more things.
- * Patches to remove things are welcome.
+ * This file still includes quite a few headers that should be included
+ * individually as needed. Patches to remove things are welcome.
  *
  * (C) Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 32/35] common: Move ROUND() into kernel.h

2019-12-11 Thread Simon Glass
Move this macro in with all the other rounding macros.

Signed-off-by: Simon Glass 
---

 include/common.h   | 2 --
 include/linux/kernel.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/common.h b/include/common.h
index 4110f75a93..997828311e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -71,8 +71,6 @@
 
 /* Put only stuff here that the assembler can digest */
 
-#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
-
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
 # include 
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index fefbc07375..b88c210065 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -69,6 +69,8 @@
 
 #define DIV_ROUND_UP_ULL(ll, d)DIV_ROUND_DOWN_ULL((ll) + (d) - 
1, (d))
 
+#define ROUND(a, b)(((a) + (b) - 1) & ~((b) - 1))
+
 #if BITS_PER_LONG == 32
 # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
 #else
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 29/35] common: Move testdram() into init.h

2019-12-11 Thread Simon Glass
This function is called during init so move it to the init header file.

Signed-off-by: Simon Glass 
---

 board/BuS/eb_cpu5282/eb_cpu5282.c | 3 ++-
 board/cobra5272/cobra5272.c   | 3 ++-
 board/freescale/m5208evbe/m5208evbe.c | 1 +
 board/freescale/m52277evb/m52277evb.c | 1 +
 board/freescale/m5235evb/m5235evb.c   | 1 +
 board/freescale/m5249evb/m5249evb.c   | 4 +++-
 board/freescale/m5253demo/m5253demo.c | 1 +
 board/freescale/m5272c3/m5272c3.c | 4 +++-
 board/freescale/m5275evb/m5275evb.c   | 1 +
 board/freescale/m53017evb/m53017evb.c | 1 +
 board/freescale/m5329evb/m5329evb.c   | 1 +
 board/freescale/m5373evb/m5373evb.c   | 1 +
 board/freescale/m54418twr/m54418twr.c | 1 +
 board/freescale/m54451evb/m54451evb.c | 1 +
 board/freescale/mpc837xerdb/mpc837xerdb.c | 1 +
 board/sbc8641d/sbc8641d.c | 2 +-
 board/socrates/sdram.c| 2 +-
 board/sysam/stmark2/stmark2.c | 1 +
 include/common.h  | 4 
 include/init.h| 2 ++
 20 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c 
b/board/BuS/eb_cpu5282/eb_cpu5282.c
index 0b916d2482..a667413bfc 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -12,6 +12,7 @@
 #include "asm/m5282.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -98,7 +99,7 @@ int dram_init(void)
 }
 
 #if defined(CONFIG_SYS_DRAM_TEST)
-int testdram (void)
+int testdram(void)
 {
uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
diff --git a/board/cobra5272/cobra5272.c b/board/cobra5272/cobra5272.c
index a0a416b50c..a79884cb50 100644
--- a/board/cobra5272/cobra5272.c
+++ b/board/cobra5272/cobra5272.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -31,7 +32,7 @@ int dram_init(void)
return 0;
 };
 
-int testdram (void)
+int testdram(void)
 {
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
diff --git a/board/freescale/m5208evbe/m5208evbe.c 
b/board/freescale/m5208evbe/m5208evbe.c
index 82cadb2c33..e448a64abc 100644
--- a/board/freescale/m5208evbe/m5208evbe.c
+++ b/board/freescale/m5208evbe/m5208evbe.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/board/freescale/m52277evb/m52277evb.c 
b/board/freescale/m52277evb/m52277evb.c
index 13ce4886e5..a4b795fc39 100644
--- a/board/freescale/m52277evb/m52277evb.c
+++ b/board/freescale/m52277evb/m52277evb.c
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/board/freescale/m5235evb/m5235evb.c 
b/board/freescale/m5235evb/m5235evb.c
index fbd2e61604..5d40393755 100644
--- a/board/freescale/m5235evb/m5235evb.c
+++ b/board/freescale/m5235evb/m5235evb.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/board/freescale/m5249evb/m5249evb.c 
b/board/freescale/m5249evb/m5249evb.c
index 9969f71da1..da3adc5954 100644
--- a/board/freescale/m5249evb/m5249evb.c
+++ b/board/freescale/m5249evb/m5249evb.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -89,7 +90,8 @@ int dram_init(void)
 };
 
 
-int testdram (void) {
+int testdram(void)
+{
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
 
diff --git a/board/freescale/m5253demo/m5253demo.c 
b/board/freescale/m5253demo/m5253demo.c
index dcf6d7f1db..76c18b8504 100644
--- a/board/freescale/m5253demo/m5253demo.c
+++ b/board/freescale/m5253demo/m5253demo.c
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/m5272c3/m5272c3.c 
b/board/freescale/m5272c3/m5272c3.c
index d4457abfbd..1017ef0c2a 100644
--- a/board/freescale/m5272c3/m5272c3.c
+++ b/board/freescale/m5272c3/m5272c3.c
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -33,7 +34,8 @@ int dram_init(void)
return 0;
};
 
-int testdram (void) {
+int testdram(void)
+{
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
 
diff --git a/board/freescale/m5275evb/m5275evb.c 
b/board/freescale/m5275evb/m5275evb.c
index a01133612c..e65e6d0af5 100644
--- a/board/freescale/m5275evb/m5275evb.c
+++ b/board/freescale/m5275evb/m5275evb.c
@@ -9,6 +9,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/board/freescale/m53017evb/m53017evb.c 
b/board/freescale/m53017evb/m53017evb.c
index 01f51b7c95..8bdb4ad127 100644
--- a/board/freescale/m53017evb/m53017evb.c
+++ b/board/freescale/m53017evb/m53017evb.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/board/freescale/m5329evb/m5329evb.c 
b/board/freescale/m5329evb/m5329evb.c
index 88cdba719c..d93800b364 100644
--- a/board/freescale/m5329evb/m5329evb.c
+++ b/board/freescale/m5329evb/m5329evb.c
@@ -9,6 

[PATCH 34/35] common: Collect all the header files together

2019-12-11 Thread Simon Glass
There are many header files included here. Put them all together since the
blank lines are not useful.

Signed-off-by: Simon Glass 
---

 include/common.h | 24 
 1 file changed, 24 deletions(-)

diff --git a/include/common.h b/include/common.h
index 32999f9cbf..388d98a1db 100644
--- a/include/common.h
+++ b/include/common.h
@@ -14,7 +14,6 @@
 #define __COMMON_H_1
 
 #ifndef __ASSEMBLY__   /* put C only stuff in this section */
-
 #include 
 #include 
 #include 
@@ -30,43 +29,20 @@
 #include 
 #include 
 #include 
-
 #include 
 #include 
 #include 
-
 #include 
-
 #include  /* boot information for Linux kernel */
 #include/* global data used for startup functions */
-
-/* startup functions, used in:
- * common/board_f.c
- * common/init/board_init.c
- * common/board_r.c
- * common/board_info.c
- */
 #include 
-
 #include 
-
-/* lib/uuid.c */
 #include 
-
-/* lib/vsprintf.c */
 #include 
-
-/* lib/net_utils.c */
 #include 
-
 #include 
-
-#else  /* __ASSEMBLY__ */
-
 #endif /* __ASSEMBLY__ */
 
-/* Put only stuff here that the assembler can digest */
-
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
 # include 
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 31/35] common: Move check_member() to kernel.h

2019-12-11 Thread Simon Glass
The kernel.h file has a number of useful macros including a few related
to structures. Move check_member() there too.

Signed-off-by: Simon Glass 
---

 include/common.h   | 11 ---
 include/linux/kernel.h | 11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/common.h b/include/common.h
index ca08db0467..4110f75a93 100644
--- a/include/common.h
+++ b/include/common.h
@@ -73,17 +73,6 @@
 
 #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
 
-/*
- * check_member() - Check the offset of a structure member
- *
- * @structure: Name of structure (e.g. global_data)
- * @member:Name of member (e.g. baudrate)
- * @offset:Expected offset in bytes
- */
-#define check_member(structure, member, offset) _Static_assert( \
-   offsetof(struct structure, member) == offset, \
-   "`struct " #structure "` offset for `" #member "` is not " #offset)
-
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
 # include 
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 564819a1c0..fefbc07375 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -268,4 +268,15 @@
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - offsetof(type,member) );})
 
+/*
+ * check_member() - Check the offset of a structure member
+ *
+ * @structure: Name of structure (e.g. global_data)
+ * @member:Name of member (e.g. baudrate)
+ * @offset:Expected offset in bytes
+ */
+#define check_member(structure, member, offset) _Static_assert( \
+   offsetof(struct structure, member) == (offset), \
+   "`struct " #structure "` offset for `" #member "` is not " #offset)
+
 #endif
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 33/35] common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

2019-12-11 Thread Simon Glass
This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass 
---

 README   |  2 +-
 cmd/mem.c| 54 ++--
 common/command.c |  2 +-
 include/common.h |  4 ---
 include/compiler.h   |  4 +++
 lib/display_options.c|  8 +++---
 scripts/config_whitelist.txt |  1 -
 7 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/README b/README
index 78f59c391a..c1324c1296 100644
--- a/README
+++ b/README
@@ -2460,7 +2460,7 @@ typically in board_init_f() and board_init_r().
 Configuration Settings:
 ---
 
-- CONFIG_SYS_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit.
+- MEM_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit.
Optionally it can be defined to support 64-bit memory commands.
 
 - CONFIG_SYS_LONGHELP: Defined when you want long help messages included;
diff --git a/cmd/mem.c b/cmd/mem.c
index 4de5ab01fd..f32985ca7d 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -107,7 +107,7 @@ static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 writeval;
 #else
ulong writeval;
@@ -132,7 +132,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
/* Get the value to write.
*/
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
writeval = simple_strtoull(argv[2], NULL, 16);
 #else
writeval = simple_strtoul(argv[2], NULL, 16);
@@ -151,7 +151,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
while (count-- > 0) {
if (size == 4)
*((u32 *)buf) = (u32)writeval;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
*((u64 *)buf) = (u64)writeval;
 #endif
@@ -228,7 +228,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
int rcode = 0;
const char *type;
const void *buf1, *buf2, *base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 word1, word2;
 #else
ulong word1, word2;
@@ -260,7 +260,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (size == 4) {
word1 = *(u32 *)buf1;
word2 = *(u32 *)buf2;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
} else if (size == 8) {
word1 = *(u64 *)buf1;
word2 = *(u64 *)buf2;
@@ -274,7 +274,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
}
if (word1 != word2) {
ulong offset = buf1 - base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
   type, (void *)(addr1 + offset), size, word1,
   type, (void *)(addr2 + offset), size, word2);
@@ -378,7 +378,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
 {
ulong   addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
 #endif
volatile u32 *longp;
@@ -411,7 +411,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
 * If we have only one object, just run infinite loops.
 */
if (length == 1) {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
llp = (u64 *)buf;
for (;;)
@@ -433,7 +433,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
i = *cp;
}
 
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
for (;;) {
llp = (u64 *)buf;
@@ -476,7 +476,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int 
argc,
 {
ulong   addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
u64 data;
 #else
@@ -506,7 +506,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int 
argc,
length = simple_strtoul(argv[2], NULL, 16);
 
/* data to write */
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
data = simple_strtoull(argv[3], NULL, 16);
 #else
data = simple_strtoul(argv[3], NULL, 

[PATCH 27/35] common: Rename and move source()

2019-12-11 Thread Simon Glass
This function has a very generic name which does not adequately describe
its purpose. Rename it and move it to image.h, since it relates to reading
a script from an image.

Signed-off-by: Simon Glass 
---

 cmd/source.c   |  5 ++---
 drivers/usb/gadget/f_sdp.c |  2 +-
 include/common.h   |  3 ---
 include/image.h| 12 
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/cmd/source.c b/cmd/source.c
index be1135014f..92f8f77ee6 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -41,8 +41,7 @@ static const char *get_default_image(const void *fit)
 }
 #endif
 
-int
-source (ulong addr, const char *fit_uname)
+int image_source_script(ulong addr, const char *fit_uname)
 {
ulong   len;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
@@ -183,7 +182,7 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
}
 
printf ("## Executing script at %08lx\n", addr);
-   rcode = source (addr, fit_uname);
+   rcode = image_source_script(addr, fit_uname);
return rcode;
 }
 
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index bcd1c5d47c..50836db4a0 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -726,7 +726,7 @@ static void sdp_handle_in_ep(struct spl_image_info 
*spl_image)
jump_to_image_no_args(_image);
 #else
/* In U-Boot, allow jumps to scripts */
-   source(sdp_func->jmp_address, "script@1");
+   image_source_script(sdp_func->jmp_address, "script@1");
 #endif
}
 
diff --git a/include/common.h b/include/common.h
index 5e38c5fc58..c69bad9771 100644
--- a/include/common.h
+++ b/include/common.h
@@ -59,9 +59,6 @@ void  hang(void) __attribute__ ((noreturn));
 
 #include 
 
-/* common/cmd_source.c */
-intsource (ulong addr, const char *fit_uname);
-
 /* common/memsize.c */
 long   get_ram_size  (long *, long);
 phys_size_t get_effective_memsize(void);
diff --git a/include/image.h b/include/image.h
index cc52de567b..80c0737463 100644
--- a/include/image.h
+++ b/include/image.h
@@ -673,6 +673,18 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
   int arch, int image_type, int bootstage_id,
   enum fit_load_op load_op, ulong *datap, ulong *lenp);
 
+/**
+ * image_source_script() - Execute a script
+ *
+ * Executes a U-Boot script at a particular address in memory. The script 
should
+ * have a header (FIT or legacy) with the script type (IH_TYPE_SCRIPT).
+ *
+ * @addr: Address of script
+ * @fit_uname: FIT subimage name
+ * @return result code (enum command_ret_t)
+ */
+int image_source_script(ulong addr, const char *fit_uname);
+
 #ifndef USE_HOSTCC
 /**
  * fit_get_node_from_config() - Look up an image a FIT by type
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 22/35] common: Move get_tbclk() to time.h

2019-12-11 Thread Simon Glass
This function related to timer and most of the timer functions are in
time.h, so move this function there.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm920t/imx/timer.c| 2 +-
 arch/arm/cpu/arm926ejs/armada100/timer.c| 2 +-
 arch/arm/cpu/sa1100/timer.c | 2 +-
 arch/arm/mach-at91/arm926ejs/timer.c| 1 +
 arch/arm/mach-at91/armv7/timer.c| 1 +
 arch/arm/mach-orion5x/timer.c   | 2 +-
 arch/arm/mach-versal/clk.c  | 1 +
 arch/arm/mach-zynq/timer.c  | 1 +
 arch/arm/mach-zynqmp/clk.c  | 1 +
 arch/arm/mach-zynqmp/cpu.c  | 1 +
 arch/mips/cpu/time.c| 1 +
 arch/powerpc/cpu/mpc83xx/cpu.c  | 1 +
 arch/powerpc/cpu/mpc83xx/spd_sdram.c| 1 +
 arch/powerpc/cpu/mpc83xx/spl_minimal.c  | 1 +
 arch/powerpc/cpu/mpc85xx/cpu.c  | 3 ++-
 arch/powerpc/cpu/mpc85xx/fdt.c  | 1 +
 arch/powerpc/cpu/mpc85xx/interrupts.c   | 1 +
 arch/powerpc/cpu/mpc86xx/cpu.c  | 1 +
 arch/powerpc/cpu/mpc86xx/interrupts.c   | 1 +
 arch/powerpc/cpu/mpc8xx/cpu.c   | 1 +
 arch/powerpc/cpu/mpc8xx/fdt.c   | 1 +
 arch/powerpc/cpu/mpc8xx/interrupts.c| 1 +
 board/armltd/integrator/timer.c | 2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c | 3 ++-
 drivers/clk/clk_pic32.c | 1 +
 include/common.h| 1 -
 include/time.h  | 2 ++
 27 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index 17081ddb6d..403cd8ae57 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -71,7 +71,7 @@ unsigned long long get_ticks(void)
  * This function is derived from PowerPC code (timebase clock frequency).
  * On ARM it returns the number of timer ticks per second.
  */
-ulong get_tbclk (void)
+ulong get_tbclk(void)
 {
return CONFIG_SYS_HZ;
 }
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c 
b/arch/arm/cpu/arm926ejs/armada100/timer.c
index 6c6948a8ef..a11a4f3a5b 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -188,7 +188,7 @@ unsigned long long get_ticks(void)
  * This function is derived from PowerPC code (timebase clock frequency).
  * On ARM it returns the number of timer ticks per second.
  */
-ulong get_tbclk (void)
+ulong get_tbclk(void)
 {
return (ulong)CONFIG_SYS_HZ;
 }
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index c6b1b2c177..8e20c96bcd 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -59,7 +59,7 @@ unsigned long long get_ticks(void)
  * This function is derived from PowerPC code (timebase clock frequency).
  * On ARM it returns the number of timer ticks per second.
  */
-ulong get_tbclk (void)
+ulong get_tbclk(void)
 {
return CONFIG_SYS_HZ;
 }
diff --git a/arch/arm/mach-at91/arm926ejs/timer.c 
b/arch/arm/mach-at91/arm926ejs/timer.c
index f81e845593..31ad0bf702 100644
--- a/arch/arm/mach-at91/arm926ejs/timer.c
+++ b/arch/arm/mach-at91/arm926ejs/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-at91/armv7/timer.c b/arch/arm/mach-at91/armv7/timer.c
index 9f08806fb1..15c036cc27 100644
--- a/arch/arm/mach-at91/armv7/timer.c
+++ b/arch/arm/mach-at91/armv7/timer.c
@@ -9,6 +9,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-orion5x/timer.c b/arch/arm/mach-orion5x/timer.c
index 9da9783822..077eb63e74 100644
--- a/arch/arm/mach-orion5x/timer.c
+++ b/arch/arm/mach-orion5x/timer.c
@@ -165,7 +165,7 @@ unsigned long long get_ticks(void)
  * This function is derived from PowerPC code (timebase clock frequency).
  * On ARM it returns the number of timer ticks per second.
  */
-ulong get_tbclk (void)
+ulong get_tbclk(void)
 {
return (ulong)CONFIG_SYS_HZ;
 }
diff --git a/arch/arm/mach-versal/clk.c b/arch/arm/mach-versal/clk.c
index b82cea4ccb..9184714e47 100644
--- a/arch/arm/mach-versal/clk.c
+++ b/arch/arm/mach-versal/clk.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
index 8658abb457..211ea15884 100644
--- a/arch/arm/mach-zynq/timer.c
+++ b/arch/arm/mach-zynq/timer.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-zynqmp/clk.c b/arch/arm/mach-zynqmp/clk.c
index 0593b6310f..db2b4a8be2 100644
--- a/arch/arm/mach-zynqmp/clk.c
+++ b/arch/arm/mach-zynqmp/clk.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c
index b90d08bbdd..442427bc11 100644
--- a/arch/arm/mach-zynqmp/cpu.c
+++ b/arch/arm/mach-zynqmp/cpu.c
@@ -5,6 +5,7 @@
  

[PATCH 23/35] common: Move reset_misc() function to arch header

2019-12-11 Thread Simon Glass
This function is only used on ARM devices. Move it out of the common file
and to a arch-specific header.

Signed-off-by: Simon Glass 
---

 arch/arm/include/asm/u-boot-arm.h | 2 ++
 include/common.h  | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index 62cb5b4a98..0b93cc48c5 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -54,6 +54,8 @@ void do_fiq(struct pt_regs *pt_regs);
 void do_irq(struct pt_regs *pt_regswq);
 #endif
 
+void reset_misc(void);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _U_BOOT_ARM_H_ */
diff --git a/include/common.h b/include/common.h
index 1d85e5a68c..cf33b31499 100644
--- a/include/common.h
+++ b/include/common.h
@@ -74,7 +74,6 @@ phys_size_t get_effective_memsize(void);
 int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
 
-void   reset_misc(void);
 void   reset_cpu (ulong addr);
 
 /* lib/uuid.c */
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 18/35] common: arm: Move s_init() to an ARM-specific header

2019-12-11 Thread Simon Glass
This function is only used on ARM devices so does not belong in the global
common header file. Move it to an ARM header.

Signed-off-by: Simon Glass 
---

 arch/arm/include/asm/u-boot-arm.h | 2 ++
 include/common.h  | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index 2e8c8e53d7..62cb5b4a98 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -23,6 +23,8 @@ extern ulong _datarellocal_start_ofs;
 extern ulong _datarelro_start_ofs;
 extern ulong IRQ_STACK_START_IN;   /* 8 bytes in IRQ stack */
 
+void s_init(void);
+
 /* cpu/.../cpu.c */
 intcleanup_before_linux(void);
 
diff --git a/include/common.h b/include/common.h
index 463eeb5d43..f38dc2ef3f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -74,8 +74,6 @@ phys_size_t get_effective_memsize(void);
 int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
 
-void s_init(void);
-
 void   upmconfig (unsigned int, unsigned int *, unsigned int);
 ulong  get_tbclk (void);
 void   reset_misc(void);
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 20/35] common: Move upmconfig() to ppc.h

2019-12-11 Thread Simon Glass
This file is only used by PowerPC so move it to an arch-specific header
file.

Signed-off-by: Simon Glass 
---

 arch/powerpc/include/asm/ppc.h | 1 +
 board/socrates/socrates.c  | 4 ++--
 include/common.h   | 1 -
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index 5765f6b522..055364c58f 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -121,6 +121,7 @@ void print_reginfo(void);
 void interrupt_init_cpu(unsigned *);
 void timer_interrupt_cpu(struct pt_regs *);
 unsigned long search_exception_table(unsigned long addr);
+void upmconfig(uint upm, uint *table, uint size);
 
 #endif /* !__ASSEMBLY__ */
 
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 5f58b4c21b..f1dec6c6fa 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -165,11 +165,11 @@ void local_bus_init (void)
 
/* Init UPMA for FPGA access */
out_be32 (>mamr, 0x0); /* Use a customer-supplied value */
-   upmconfig (UPMA, (uint *)UPMTableA, sizeof(UPMTableA)/sizeof(int));
+   upmconfig(UPMA, (uint *)UPMTableA, sizeof(UPMTableA) / sizeof(int));
 
/* Init UPMB for Lime controller access */
out_be32 (>mbmr, 0x40); /* Use a customer-supplied value */
-   upmconfig (UPMB, (uint *)UPMTableB, sizeof(UPMTableB)/sizeof(int));
+   upmconfig(UPMB, (uint *)UPMTableB, sizeof(UPMTableB) / sizeof(int));
 }
 
 #ifdef CONFIG_BOARD_EARLY_INIT_R
diff --git a/include/common.h b/include/common.h
index a971f75f8b..1f87070d49 100644
--- a/include/common.h
+++ b/include/common.h
@@ -74,7 +74,6 @@ phys_size_t get_effective_memsize(void);
 int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
 
-void   upmconfig (unsigned int, unsigned int *, unsigned int);
 ulong  get_tbclk (void);
 void   reset_misc(void);
 void   reset_cpu (ulong addr);
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 19/35] common: Move ll_boot_init() to init.h

2019-12-11 Thread Simon Glass
This is an init-related function so belongs in that file. Move it.

Signed-off-by: Simon Glass 
---

 arch/x86/cpu/baytrail/cpu.c| 1 +
 arch/x86/cpu/baytrail/valleyview.c | 1 +
 arch/x86/cpu/cpu.c | 1 +
 arch/x86/cpu/i386/cpu.c| 1 +
 arch/x86/cpu/i386/interrupt.c  | 1 +
 drivers/pci/pci_rom.c  | 1 +
 drivers/video/broadwell_igd.c  | 1 +
 include/common.h   | 7 ---
 include/init.h | 7 +++
 9 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c
index 9394eab956..a9cfcedd81 100644
--- a/arch/x86/cpu/baytrail/cpu.c
+++ b/arch/x86/cpu/baytrail/cpu.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/cpu/baytrail/valleyview.c 
b/arch/x86/cpu/baytrail/valleyview.c
index 8882a76eae..f2e48f401f 100644
--- a/arch/x86/cpu/baytrail/valleyview.c
+++ b/arch/x86/cpu/baytrail/valleyview.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 4e59476fc9..068213865b 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index c66382bdd2..0a6cc11c6b 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index 78aa51a3ea..991cf5c56b 100644
--- a/arch/x86/cpu/i386/interrupt.c
+++ b/arch/x86/cpu/i386/interrupt.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 1d4064e376..90f224b045 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c
index e6df037cb9..c23421d25b 100644
--- a/drivers/video/broadwell_igd.c
+++ b/drivers/video/broadwell_igd.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/common.h b/include/common.h
index f38dc2ef3f..a971f75f8b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -114,13 +114,6 @@ int get_serial_clock(void);
offsetof(struct structure, member) == offset, \
"`struct " #structure "` offset for `" #member "` is not " #offset)
 
-/* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */
-#ifdef CONFIG_EFI_STUB
-#define ll_boot_init() false
-#else
-#define ll_boot_init() true
-#endif
-
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
 # include 
diff --git a/include/init.h b/include/init.h
index 3adc382376..ba0d4bc973 100644
--- a/include/init.h
+++ b/include/init.h
@@ -16,6 +16,13 @@ struct global_data;
 
 #ifndef __ASSEMBLY__   /* put C only stuff in this section */
 
+/* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */
+#ifdef CONFIG_EFI_STUB
+#define ll_boot_init() false
+#else
+#define ll_boot_init() true
+#endif
+
 /*
  * Function Prototypes
  */
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 16/35] common: Move type declarations to linux/types.h

2019-12-11 Thread Simon Glass
This file already has lots of type declarations so it seems better to put
all of them there.

Move them.

Signed-off-by: Simon Glass 
---

 include/common.h  | 5 -
 include/linux/types.h | 5 +
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/common.h b/include/common.h
index 7bb18c572e..4ee14f78d0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -15,11 +15,6 @@
 
 #ifndef __ASSEMBLY__   /* put C only stuff in this section */
 
-typedef unsigned char  uchar;
-typedef volatile unsigned long vu_long;
-typedef volatile unsigned short vu_short;
-typedef volatile unsigned char vu_char;
-
 #include 
 #include 
 #include 
diff --git a/include/linux/types.h b/include/linux/types.h
index bd912bcb42..78dfa14ae8 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -163,4 +163,9 @@ struct ustat {
 #define DECLARE_BITMAP(name, bits) \
unsigned long name[BITS_TO_LONGS(bits)]
 
+typedef unsigned char uchar;
+typedef volatile unsigned long vu_long;
+typedef volatile unsigned short vu_short;
+typedef volatile unsigned char vu_char;
+
 #endif /* _LINUX_TYPES_H */
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 17/35] common: Move device-tree setup functions to fdt_support.h

2019-12-11 Thread Simon Glass
These functions relate to setting up the device tree for booting the OS.
The fdt_support.h header file supports similar functions, so move these
there.

Signed-off-by: Simon Glass 
---

 arch/riscv/lib/bootm.c|  1 +
 board/esd/vme8349/vme8349.c   |  1 +
 board/freescale/b4860qds/b4860qds.c   |  1 +
 board/freescale/corenet_ds/corenet_ds.c   |  1 +
 board/freescale/ls1012afrdm/ls1012afrdm.c |  1 +
 board/freescale/ls1012ardb/ls1012ardb.c   |  1 +
 board/freescale/ls1021aiot/ls1021aiot.c   |  1 +
 board/freescale/ls1021aqds/ls1021aqds.c   |  1 +
 board/freescale/ls1021atsn/ls1021atsn.c   |  1 +
 board/freescale/ls1021atwr/ls1021atwr.c   |  1 +
 board/freescale/mpc8313erdb/mpc8313erdb.c |  1 +
 board/freescale/mpc8323erdb/mpc8323erdb.c |  1 +
 board/freescale/mpc832xemds/mpc832xemds.c |  1 +
 board/freescale/mpc8349emds/mpc8349emds.c |  1 +
 board/freescale/mpc8349itx/mpc8349itx.c   |  1 +
 board/freescale/p2041rdb/p2041rdb.c   |  1 +
 board/freescale/t102xqds/t102xqds.c   |  1 +
 board/freescale/t102xrdb/t102xrdb.c   |  1 +
 board/freescale/t1040qds/t1040qds.c   |  1 +
 board/freescale/t104xrdb/t104xrdb.c   |  1 +
 board/freescale/t208xqds/t208xqds.c   |  1 +
 board/freescale/t208xrdb/t208xrdb.c   |  1 +
 board/freescale/t4qds/t4240emu.c  |  1 +
 board/freescale/t4qds/t4240qds.c  |  1 +
 board/freescale/t4rdb/t4240rdb.c  |  1 +
 board/hisilicon/hikey/hikey.c |  1 +
 board/ids/ids8313/ids8313.c   |  1 +
 board/keymile/km83xx/km83xx.c |  1 +
 board/keymile/kmp204x/kmp204x.c   |  1 +
 board/sbc8349/sbc8349.c   |  1 +
 board/ti/am43xx/board.c   |  1 +
 board/ti/am57xx/board.c   |  1 +
 board/ti/dra7xx/evm.c |  1 +
 board/tqc/tqm834x/tqm834x.c   |  1 +
 board/varisys/cyrus/cyrus.c   |  1 +
 board/ve8313/ve8313.c |  1 +
 include/common.h  | 12 
 include/fdt_support.h | 14 ++
 38 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index e96137a50c..d1d1573c62 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c
index 4c220fa8e1..49d085acf9 100644
--- a/board/esd/vme8349/vme8349.c
+++ b/board/esd/vme8349/vme8349.c
@@ -12,6 +12,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/b4860qds/b4860qds.c 
b/board/freescale/b4860qds/b4860qds.c
index 45650b4f08..e7f684bfb3 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/corenet_ds/corenet_ds.c 
b/board/freescale/corenet_ds/corenet_ds.c
index c2fa60e321..66eea32e07 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c 
b/board/freescale/ls1012afrdm/ls1012afrdm.c
index 31e41ce169..d138c9384e 100644
--- a/board/freescale/ls1012afrdm/ls1012afrdm.c
+++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c 
b/board/freescale/ls1012ardb/ls1012ardb.c
index e4527c19b8..90c1824e46 100644
--- a/board/freescale/ls1012ardb/ls1012ardb.c
+++ b/board/freescale/ls1012ardb/ls1012ardb.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1021aiot/ls1021aiot.c 
b/board/freescale/ls1021aiot/ls1021aiot.c
index eda5cc7a9e..8de13c88f6 100644
--- a/board/freescale/ls1021aiot/ls1021aiot.c
+++ b/board/freescale/ls1021aiot/ls1021aiot.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1021aqds/ls1021aqds.c 
b/board/freescale/ls1021aqds/ls1021aqds.c
index 3efdbe9a69..377f4b7bce 100644
--- a/board/freescale/ls1021aqds/ls1021aqds.c
+++ b/board/freescale/ls1021aqds/ls1021aqds.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1021atsn/ls1021atsn.c 
b/board/freescale/ls1021atsn/ls1021atsn.c
index 8039fd55f4..532ca89d94 100644
--- a/board/freescale/ls1021atsn/ls1021atsn.c
+++ b/board/freescale/ls1021atsn/ls1021atsn.c
@@ -2,6 +2,7 @@
 /* Copyright 2016-2019 NXP Semiconductors
  */
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/ls1021atwr/ls1021atwr.c 
b/board/freescale/ls1021atwr/ls1021atwr.c
index c4ff6775c3..3f09c5150c 100644
--- 

[PATCH 15/35] common: Drop the symbol_lookup() declaration

2019-12-11 Thread Simon Glass
This function is not called anywhere so we can drop the declaration. If
it is needed one day, it should be added in its own header file.

Signed-off-by: Simon Glass 
---

 include/common.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/common.h b/include/common.h
index a102f9deff..7bb18c572e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -81,9 +81,6 @@ extern ulong load_addr;   /* Default Load Address 
*/
 extern ulong save_addr;/* Default Save Address */
 extern ulong save_size;/* Default Save Size */
 
-/* common/kallsysm.c */
-const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
-
 /* common/memsize.c */
 long   get_ram_size  (long *, long);
 phys_size_t get_effective_memsize(void);
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 13/35] common: Drop CONFIG_POST_STD/ALT_LIST

2019-12-11 Thread Simon Glass
These CONFIG options are not used anymore. CONFIG_POST_ALT_LIST just
causes CONFIG_POST_STD_LIST to be set and it causes tests.c to be
compiled. So just make compiling tests.c unconditional.

Signed-off-by: Simon Glass 
---

 include/common.h | 3 ---
 post/Makefile| 2 +-
 scripts/config_whitelist.txt | 2 --
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/include/common.h b/include/common.h
index 454e88323c..1fba17b0f7 100644
--- a/include/common.h
+++ b/include/common.h
@@ -125,9 +125,6 @@ int get_serial_clock(void);
 
 #ifdef CONFIG_POST
 #define CONFIG_HAS_POST
-#ifndef CONFIG_POST_ALT_LIST
-#define CONFIG_POST_STD_LIST
-#endif
 #endif
 
 #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
diff --git a/post/Makefile b/post/Makefile
index 5f72708214..afd49403c2 100644
--- a/post/Makefile
+++ b/post/Makefile
@@ -4,7 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 
 obj-y  += post.o
-obj-$(CONFIG_POST_STD_LIST)+= tests.o
+obj-y  += tests.o
 
 obj-y += drivers/
 obj-$(CONFIG_PPC) += lib_powerpc/
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 4449eea2e5..7b3c73745a 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1354,7 +1354,6 @@ CONFIG_PMW_BASE
 CONFIG_PM_SLEEP
 CONFIG_POST
 CONFIG_POSTBOOTMENU
-CONFIG_POST_ALT_LIST
 CONFIG_POST_BSPEC1
 CONFIG_POST_BSPEC2
 CONFIG_POST_BSPEC3
@@ -1362,7 +1361,6 @@ CONFIG_POST_BSPEC4
 CONFIG_POST_BSPEC5
 CONFIG_POST_EXTERNAL_WORD_FUNCS
 CONFIG_POST_SKIP_ENV_FLAGS
-CONFIG_POST_STD_LIST
 CONFIG_POST_UART
 CONFIG_POST_WATCHDOG
 CONFIG_POWER
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 12/35] common: Move CONFIG_SYS_DEF_EEPROM_ADDR out of common.h

2019-12-11 Thread Simon Glass
This define seems better suited to the eeprom header file, particularly
as it is only used in the eeprom.c file.

Move it.

Signed-off-by: Simon Glass 
---

 include/common.h | 4 
 include/eeprom.h | 4 
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/common.h b/include/common.h
index f3adf06a37..454e88323c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -88,10 +88,6 @@ const char *symbol_lookup(unsigned long addr, unsigned long 
*caddr);
 long   get_ram_size  (long *, long);
 phys_size_t get_effective_memsize(void);
 
-#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) && 
defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
-#endif
-
 #if defined(CONFIG_SYS_DRAM_TEST)
 int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
diff --git a/include/eeprom.h b/include/eeprom.h
index 61eb826a73..79118eb83d 100644
--- a/include/eeprom.h
+++ b/include/eeprom.h
@@ -21,4 +21,8 @@ int eeprom_write(uint dev_addr, uint offset, uchar *buffer, 
uint cnt);
 #define eeprom_write(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
 #endif
 
+#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) && 
defined(CONFIG_SYS_I2C_EEPROM_ADDR)
+# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
+#endif
+
 #endif
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 09/35] common: Move jumptable_init() out of common.h

2019-12-11 Thread Simon Glass
This function is defined in exports.c so move it to its header file.

Signed-off-by: Simon Glass 
---

 common/board_r.c  | 1 +
 include/common.h  | 3 ---
 include/exports.h | 3 +++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index cda90bd385..4910a5da34 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 /* TODO: can we just include all these headers whether needed or not? */
diff --git a/include/common.h b/include/common.h
index 90391d262e..71bf39180c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -81,9 +81,6 @@ extern ulong load_addr;   /* Default Load Address 
*/
 extern ulong save_addr;/* Default Save Address */
 extern ulong save_size;/* Default Save Size */
 
-/* common/exports.c */
-void   jumptable_init(void);
-
 /* common/kallsysm.c */
 const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
 
diff --git a/include/exports.h b/include/exports.h
index 35f463287f..cbd16fc518 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -13,6 +13,9 @@
 
 struct spi_slave;
 
+/* Set up the jump table for use by the API */
+void jumptable_init(void);
+
 /* These are declarations of exported functions available in C code */
 unsigned long get_version(void);
 int  getc(void);
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 05/35] common: Move embedded fdt location to fdtdec.h

2019-12-11 Thread Simon Glass
These declarations are only used in fdtdec.c so move them to its header
file.

Signed-off-by: Simon Glass 
---

 include/common.h | 3 ---
 include/fdtdec.h | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/common.h b/include/common.h
index 4f3536f299..fe10f06819 100644
--- a/include/common.h
+++ b/include/common.h
@@ -64,9 +64,6 @@ void  hang(void) __attribute__ ((noreturn));
 
 #include 
 
-extern u8 __dtb_dt_begin[];/* embedded device tree blob */
-extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for 
SPL/TPL */
-
 /**
  * arch_fixup_fdt() - Write arch-specific information to fdt
  *
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 696e0fd024..c8a143db5f 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -111,6 +111,9 @@ struct fdt_pci_addr {
u32 phys_lo;
 };
 
+extern u8 __dtb_dt_begin[];/* embedded device tree blob */
+extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for 
SPL/TPL */
+
 /**
  * Compute the size of a resource.
  *
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 06/35] common: Move do_tftpb() to net.h

2019-12-11 Thread Simon Glass
This function belongs in the network header file. Move it.

Signed-off-by: Simon Glass 
---

 cmd/pxe.c|  1 +
 include/common.h |  3 ---
 include/net.h| 11 +++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/cmd/pxe.c b/cmd/pxe.c
index 73f1b4fbd3..194a366aa1 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 
 #include "pxe_utils.h"
 
diff --git a/include/common.h b/include/common.h
index fe10f06819..dbd7845a63 100644
--- a/include/common.h
+++ b/include/common.h
@@ -81,9 +81,6 @@ extern ulong load_addr;   /* Default Load Address 
*/
 extern ulong save_addr;/* Default Save Address */
 extern ulong save_size;/* Default Save Size */
 
-/* common/cmd_net.c */
-int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-
 /* common/cmd_fat.c */
 int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
 
diff --git a/include/net.h b/include/net.h
index 834f244982..a8ee08150f 100644
--- a/include/net.h
+++ b/include/net.h
@@ -50,6 +50,17 @@ struct in_addr {
__be32 s_addr;
 };
 
+/**
+ * do_tftpb - Run the tftpboot command
+ *
+ * @cmdtp: Command information for tftpboot
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
 /**
  * An incoming packet handler.
  * @param pktpointer to the application packet
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 14/35] common: Drop CONFIG_HAS_POST

2019-12-11 Thread Simon Glass
This only exists to control whether the post/ directory is build. It is
just as easy to check this in the Makefile. Remove CONFIG_HAS_POST and use
an ifdef in the Makefile instead.

Signed-off-by: Simon Glass 
---

 Makefile | 4 +++-
 include/common.h | 4 
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 0766f78dcb..6b7d80139e 100644
--- a/Makefile
+++ b/Makefile
@@ -762,7 +762,9 @@ libs-y += cmd/
 libs-y += common/
 libs-y += env/
 libs-$(CONFIG_API) += api/
-libs-$(CONFIG_HAS_POST) += post/
+ifdef CONFIG_POST
+libs-y += post/
+endif
 libs-$(CONFIG_UNIT_TEST) += test/ test/dm/
 libs-$(CONFIG_UT_ENV) += test/env/
 libs-$(CONFIG_UT_OPTEE) += test/optee/
diff --git a/include/common.h b/include/common.h
index 1fba17b0f7..a102f9deff 100644
--- a/include/common.h
+++ b/include/common.h
@@ -123,10 +123,6 @@ int get_serial_clock(void);
 
 /* Put only stuff here that the assembler can digest */
 
-#ifdef CONFIG_POST
-#define CONFIG_HAS_POST
-#endif
-
 #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
 
 /*
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 03/35] common: Move flash_perror() to flash.h

2019-12-11 Thread Simon Glass
This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass 
---

 cmd/load.c   | 3 ++-
 cmd/mem.c| 3 ++-
 common/flash.c   | 2 +-
 env/flash.c  | 1 +
 include/common.h | 3 ---
 include/flash.h  | 7 +++
 net/nfs.c| 1 +
 7 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/cmd/load.c b/cmd/load.c
index 3bfc1b41ec..68ff3010b4 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -980,7 +981,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
rc = flash_write((char *) ymodemBuf,
  store_addr, res);
if (rc != 0) {
-   flash_perror (rc);
+   flash_perror(rc);
return (~0);
}
} else
diff --git a/cmd/mem.c b/cmd/mem.c
index 4ec450b050..4de5ab01fd 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -339,7 +340,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
rc = flash_write((char *)src, (ulong)dst, count * size);
if (rc != 0) {
-   flash_perror (rc);
+   flash_perror(rc);
unmap_sysmem(src);
unmap_sysmem(dst);
return (1);
diff --git a/common/flash.c b/common/flash.c
index efe8f53de6..5f155aefd1 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -179,7 +179,7 @@ flash_write (char *src, ulong addr, ulong cnt)
 /*---
  */
 
-void flash_perror (int err)
+void flash_perror(int err)
 {
switch (err) {
case ERR_OK:
diff --git a/env/flash.c b/env/flash.c
index b487e6701e..e05f7ef74b 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/common.h b/include/common.h
index f1a3d32547..b5fccdbcff 100644
--- a/include/common.h
+++ b/include/common.h
@@ -79,9 +79,6 @@ extern u8 __dtb_dt_spl_begin[];   /* embedded device tree 
blob for SPL/TPL */
  */
 int arch_fixup_fdt(void *blob);
 
-/* common/flash.c */
-void flash_perror (int);
-
 /* common/cmd_source.c */
 intsource (ulong addr, const char *fit_uname);
 
diff --git a/include/flash.h b/include/flash.h
index 807800b524..2655c72087 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -117,6 +117,13 @@ extern int jedec_flash_match(flash_info_t *info, ulong 
base);
 #define CFI_CMDSET_AMD_LEGACY  0xFFF0
 #endif
 
+/**
+ * flash_perror() - Print a flash error
+ *
+ * @err: Error number of message to print (ERR_... as below)
+ */
+void flash_perror(int err);
+
 /*---
  * return codes from flash_write():
  */
diff --git a/net/nfs.c b/net/nfs.c
index 97e62f1dce..f4101eb17c 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 04/35] common: Drop checkflash() and checkdram()

2019-12-11 Thread Simon Glass
These functions are not used in U-Boot. Drop them.

Signed-off-by: Simon Glass 
---

 include/common.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/common.h b/include/common.h
index b5fccdbcff..4f3536f299 100644
--- a/include/common.h
+++ b/include/common.h
@@ -64,8 +64,6 @@ void  hang(void) __attribute__ ((noreturn));
 
 #include 
 
-int checkflash(void);
-int checkdram(void);
 extern u8 __dtb_dt_begin[];/* embedded device tree blob */
 extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for 
SPL/TPL */
 
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 07/35] common: Move functions for loading from fat/ext2 to fs.h

2019-12-11 Thread Simon Glass
These are filesystem functions and belong in the filesystem header file.
Move them.

Signed-off-by: Simon Glass 
---

 board/inversepath/usbarmory/usbarmory.c |  1 +
 cmd/fat.c   |  2 +-
 cmd/pxe.c   |  1 +
 include/common.h|  6 --
 include/fs.h| 22 ++
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/board/inversepath/usbarmory/usbarmory.c 
b/board/inversepath/usbarmory/usbarmory.c
index 19510184d8..e9eea40e45 100644
--- a/board/inversepath/usbarmory/usbarmory.c
+++ b/board/inversepath/usbarmory/usbarmory.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cmd/fat.c b/cmd/fat.c
index 4b9a7eaab0..50df127f6d 100644
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -31,7 +31,7 @@ U_BOOT_CMD(
"  and determine its size."
 );
 
-int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 194a366aa1..bce6728875 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "pxe_utils.h"
diff --git a/include/common.h b/include/common.h
index dbd7845a63..e5de74af33 100644
--- a/include/common.h
+++ b/include/common.h
@@ -81,12 +81,6 @@ extern ulong load_addr;  /* Default Load Address 
*/
 extern ulong save_addr;/* Default Save Address */
 extern ulong save_size;/* Default Save Size */
 
-/* common/cmd_fat.c */
-int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
-
-/* common/cmd_ext2.c */
-int do_ext2load(cmd_tbl_t *, int, int, char * const []);
-
 /* common/exports.c */
 void   jumptable_init(void);
 
diff --git a/include/fs.h b/include/fs.h
index 742a535b5f..37e35c2120 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -14,6 +14,28 @@
 #define FS_TYPE_UBIFS  4
 #define FS_TYPE_BTRFS  5
 
+/**
+ * do_fat_fsload - Run the fatload command
+ *
+ * @cmdtp: Command information for fatload
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
+/**
+ * do_ext2load - Run the ext2load command
+ *
+ * @cmdtp: Command information for ext2load
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
 /*
  * Tell the fs layer which block device an partition to use for future
  * commands. This also internally identifies the filesystem that is present
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 02/35] common: Move main_loop() to init.h

2019-12-11 Thread Simon Glass
Move this function out of common.h and into a better place.

Signed-off-by: Simon Glass 
---

 common/board_r.c | 1 +
 common/main.c| 1 +
 include/common.h | 3 ---
 include/init.h   | 7 +++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 5464172259..cda90bd385 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #if defined(CONFIG_CMD_KGDB)
 #include 
diff --git a/common/main.c b/common/main.c
index a94df7ae04..ec8994ad45 100644
--- a/common/main.c
+++ b/common/main.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/include/common.h b/include/common.h
index fecfa27747..f1a3d32547 100644
--- a/include/common.h
+++ b/include/common.h
@@ -64,9 +64,6 @@ void  hang(void) __attribute__ ((noreturn));
 
 #include 
 
-/* common/main.c */
-void   main_loop   (void);
-
 int checkflash(void);
 int checkdram(void);
 extern u8 __dtb_dt_begin[];/* embedded device tree blob */
diff --git a/include/init.h b/include/init.h
index 8b65b2afe4..105afc6c3c 100644
--- a/include/init.h
+++ b/include/init.h
@@ -210,6 +210,13 @@ void pci_init_board(void);
 
 void trap_init(unsigned long reloc_addr);
 
+/**
+ * main_loop() - Enter the main loop of U-Boot
+ *
+ * This normally runs the command line.
+ */
+void main_loop(void);
+
 #endif /* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 01/35] common: Drop mdm_init()

2019-12-11 Thread Simon Glass
This is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass 
---

 include/common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/common.h b/include/common.h
index 8b37b58747..fecfa27747 100644
--- a/include/common.h
+++ b/include/common.h
@@ -71,7 +71,6 @@ int checkflash(void);
 int checkdram(void);
 extern u8 __dtb_dt_begin[];/* embedded device tree blob */
 extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for 
SPL/TPL */
-int mdm_init(void);
 
 /**
  * arch_fixup_fdt() - Write arch-specific information to fdt
-- 
2.24.0.525.g8f36a354ae-goog



[PATCH 00/35] common: Further reduce size of common.h even more

2019-12-11 Thread Simon Glass
This series removes the remaining function declarations from common.h
so that it only includes #include lines.

A final series will be needed to remove most of those #includes.


Simon Glass (35):
  common: Drop mdm_init()
  common: Move main_loop() to init.h
  common: Move flash_perror() to flash.h
  common: Drop checkflash() and checkdram()
  common: Move embedded fdt location to fdtdec.h
  common: Move do_tftpb() to net.h
  common: Move functions for loading from fat/ext2 to fs.h
  common: Move relocate_code() to init.h
  common: Move jumptable_init() out of common.h
  common: Drop floppy disk support
  common: Move reset_phy() to net.h
  common: Move CONFIG_SYS_DEF_EEPROM_ADDR out of common.h
  common: Drop CONFIG_POST_STD/ALT_LIST
  common: Drop CONFIG_HAS_POST
  common: Drop the symbol_lookup() declaration
  common: Move type declarations to linux/types.h
  common: Move device-tree setup functions to fdt_support.h
  common: arm: Move s_init() to an ARM-specific header
  common: Move ll_boot_init() to init.h
  common: Move upmconfig() to ppc.h
  common: Move clock functions into a new file
  common: Move get_tbclk() to time.h
  common: Move reset_misc() function to arch header
  common: Move reset_cpu() to the CPU header
  image: Rename load_addr, save_addr, save_size
  common: Move the image globals into image.h
  common: Rename and move source()
  common: Move RAM-sizing functions to init.h
  common: Move testdram() into init.h
  common: Move hang() to the same header as panic()
  common: Move check_member() to kernel.h
  common: Move ROUND() into kernel.h
  common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA
  common: Collect all the header files together
  common: Update comment to show progress

 Makefile  |   4 +-
 README|  28 +-
 arch/arc/lib/reset.c  |   1 +
 arch/arm/cpu/arm1136/mx35/generic.c   |   1 +
 arch/arm/cpu/arm920t/ep93xx/cpu.c |   1 +
 arch/arm/cpu/arm920t/imx/timer.c  |   5 +-
 arch/arm/cpu/arm926ejs/armada100/timer.c  |   5 +-
 arch/arm/cpu/arm926ejs/lpc32xx/clk.c  |   1 +
 arch/arm/cpu/arm926ejs/mx25/generic.c |   1 +
 arch/arm/cpu/arm926ejs/mx25/reset.c   |   1 +
 arch/arm/cpu/arm926ejs/mx27/reset.c   |   1 +
 arch/arm/cpu/arm926ejs/mxs/mxs.c  |   2 +
 arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c |   1 +
 arch/arm/cpu/arm926ejs/mxs/spl_power_init.c   |   1 +
 arch/arm/cpu/arm926ejs/spear/reset.c  |   1 +
 arch/arm/cpu/arm926ejs/spear/spr_misc.c   |   1 +
 arch/arm/cpu/armv7/bcm281xx/reset.c   |   1 +
 arch/arm/cpu/armv7/bcmcygnus/reset.c  |   1 +
 arch/arm/cpu/armv7/bcmnsp/reset.c |   1 +
 arch/arm/cpu/armv7/ls102xa/clock.c|   1 +
 arch/arm/cpu/armv7/ls102xa/fdt.c  |   1 +
 arch/arm/cpu/armv7/stv0991/reset.c|   1 +
 arch/arm/cpu/armv7/vf610/generic.c|   1 +
 arch/arm/cpu/armv8/cache_v8.c |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c   |   2 +
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c   |   1 +
 .../armv8/fsl-layerscape/fsl_lsch2_speed.c|   1 +
 .../armv8/fsl-layerscape/fsl_lsch3_speed.c|   1 +
 arch/arm/cpu/armv8/fsl-layerscape/soc.c   |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   |   1 +
 arch/arm/cpu/armv8/s32v234/generic.c  |   2 +
 arch/arm/cpu/sa1100/timer.c   |   2 +-
 arch/arm/include/asm/armv8/mmu.h  |   1 +
 arch/arm/include/asm/u-boot-arm.h |   4 +
 arch/arm/lib/bootm.c  |   1 +
 arch/arm/lib/div0.c   |   4 +-
 arch/arm/lib/interrupts.c |   3 +-
 arch/arm/lib/interrupts_m.c   |   1 +
 arch/arm/lib/relocate_64.S|   2 +-
 arch/arm/lib/reset.c  |   1 +
 arch/arm/mach-at91/arm920t/reset.c|   1 +
 arch/arm/mach-at91/arm926ejs/reset.c  |   1 +
 arch/arm/mach-at91/arm926ejs/timer.c  |   1 +
 arch/arm/mach-at91/armv7/reset.c  |   1 +
 arch/arm/mach-at91/armv7/timer.c  |   1 +
 arch/arm/mach-at91/spl.c  |   1 +
 arch/arm/mach-at91/spl_at91.c |   1 +
 arch/arm/mach-at91/spl_atmel.c|   1 +
 arch/arm/mach-bcm283x/reset.c |   1 +
 arch/arm/mach-davinci/misc.c  |   1 +
 arch/arm/mach-davinci/reset.c |   1 +
 arch/arm/mach-davinci/spl.c   |   1 +
 arch/arm/mach-imx/imx8/cpu.c  |   1 +
 arch/arm/mach-imx/mx5/mx53_dram.c |   1 +
 arch/arm/mach-imx/mx6/ddr.c   |   1 +
 arch/arm/mach-imx/mx6/litesom.c   |   1 +
 arch/arm/mach-imx/mx7/clock.c |   1 +
 arch/arm/mach-imx/mx7ulp/clock.c  |   1 +
 arch/arm/mach-imx/mx7ulp/soc.c|   1 +
 

Re: [PATCH 12/20] pinctrl: add i.MXRT driver

2019-12-11 Thread Lukasz Majewski
On Wed, 11 Dec 2019 13:40:01 +0100
Giulio Benetti  wrote:

> Hi Lukasz,
> 
> On 12/10/19 12:46 AM, Lukasz Majewski wrote:
> > On Mon, 9 Dec 2019 12:54:33 +0100
> > Giulio Benetti  wrote:
> >   
> >> Hi Lukasz, Stefano, Fabio, all,
> >>
> >> On 12/8/19 3:45 PM, Lukasz Majewski wrote:  
> >>> On Wed,  4 Dec 2019 18:44:31 +0100
> >>> Giulio Benetti  wrote:
> >>>  
>  Add i.MXRT pinctrl driver.
> 
>  Signed-off-by: Giulio Benetti
>   ---
> drivers/pinctrl/nxp/Kconfig | 14 ++
> drivers/pinctrl/nxp/Makefile|  1 +
> drivers/pinctrl/nxp/pinctrl-imxrt.c | 40
>  + 3 files changed, 55 insertions(+)
> create mode 100644 drivers/pinctrl/nxp/pinctrl-imxrt.c
> 
>  diff --git a/drivers/pinctrl/nxp/Kconfig
>  b/drivers/pinctrl/nxp/Kconfig index f2e67ca231..ec55351e61 100644
>  --- a/drivers/pinctrl/nxp/Kconfig
>  +++ b/drivers/pinctrl/nxp/Kconfig
>  @@ -99,6 +99,20 @@ config PINCTRL_MXS
> familiy, e.g. i.MX28. This feature depends on device
>  tree configuration.
> 
>  +config PINCTRL_IMXRT
>  +bool "IMXRT pinctrl driver"
>  +depends on ARCH_IMXRT && PINCTRL_FULL
>  +select DEVRES
>  +select PINCTRL_IMX
>  +help
>  +  Say Y here to enable the imxrt pinctrl driver
>  +
>  +  This provides a simple pinctrl driver for i.MXRT SoC
>  familiy.
>  +  This feature depends on device tree configuration.
>  This driver
>  +  is different from the linux one, this is a simple
>  implementation,  
> >>>
> >>> Could you add proper documentation entry (in ./doc/*) in which you
> >>> would point out the differences between the full blown Linux
> >>> driver and this U-Boot driver (I do guess that "only parsing
> >>> 'fsl,pins'" is not the only difference - more details are
> >>> welcome).  
> >>
> >> Sure, but isn't maybe something to be done in the document
> >> below?...  
> > 
> > +1
> >   
> >>  
> >>> And a bit more generic request - it is also nice to add some kind
> >>> of ./doc/README.* documentation in which one can put some hints
> >>> (or usage patterns) for in-uboot boards (like during development
> >>> discovered HW issues, etc.). Such information is priceless when
> >>> other community member wants to use this code/board (and NXP is
> >>> very often silence about them :-) ).  
> >>
> >> Sure, I'm going to provide a
> >> ./doc/device-tree-bindings/pinctrl/fsl,imx-pinctrl.txt unique for
> >> every imx at this point, ok?  
> > 
> > I think that it would be ok, to first focus on iMXRT.  
> 
> Ok
> 
> >>
> >> And what do you think to provide defines in
> >> ./include/dt-bindings/pinctrl/pinctrl-imxrt1050.h for every setting
> >> in PAD? Or better, in a pinctrl-imxrt.h to be included in
> >> pinctrl-imxrt1050.h(since they are the same)
> >> I mean for pull-up/down, drive strength etc.  
> > 
> > I would prefer to have the same files as are (or would be) in the
> > Linux kernel.
> > 
> > Moreover, there are already added
> > ./include/dt-bindings/pinctrl/pads-imx8q* files in this directory.
> > Maybe you could provide similar structure ?  
> 
> They are already exactly the same structure.

Ok.

> 
> >>
> >> Because, even for me that I'm developing, I see it very difficult
> >> to recognize every setting from hexadecimal in dts file, and I
> >> loose the overview. I've already used IMX_PAD_SION to set pad as
> >> input.  
> > 
> > User readable defines DO HELP a lot.
> > 
> > IMX6Q uses for example:
> > 
> >  fsl,pins = <
> >  MX6QDL_PAD_CSI0_DAT10__ECSPI2_MISO
> > 0x100b1 MX6QDL_PAD_CSI0_DAT9__ECSPI2_MOSI   0x100b1
> >  MX6QDL_PAD_CSI0_DAT8__ECSPI2_SCLK
> > 0x100b1  
> >  >;  
> > 
> > which is in sync with Linux kernel.  
> 
> Yes, but what I was asking is about those 0x100b1 that is a bitmask.
> I would like to introduce or'ed short macros to compose that value.
> But if the first goal is to keep in sync with Linux kernel then I
> leave as is and later I will try to introduce this on Linux first and
> later sync here.

Ok.

> 
> >>
> >> Then I would be happy, to add all definitions for every imx and
> >> modify every dts file, but I'd need everyone to re-test its board.
> >> What about this?  
> > 
> > Let's keep things in sync with Linux kernel as much as possible.
> > This is one of U-Boot's recent goals to:
> > 
> > 1. Reduce maintenance effort
> > 
> > 2. Ease porting of Linux drivers.
> > 
> > What we do need to focus on (in U-Boot) to trim those drivers to
> > keep U-Boot's footprint _really_ small or at least as small as it
> > was before DTS was introduced (in SPL for e.g. i.MX).  
> 
> Ok
> 
> Thank you
> 
> Best regards




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: 

Re: [GIT PULL] Please pull fixes for RPi targeted for v2020.01 release

2019-12-11 Thread Tom Rini
On Wed, Dec 11, 2019 at 03:13:35PM +0100, Matthias Brugger wrote:

> Hi Tom,
> 
> Please have a look at the fixes below. Basically we fix the 
> rpi_arm64_defconfig
> which only showed us 1GiB of RAM if we booted using EFI stub. Apart the 32bit
> config of RPi4 was broken, as it missed the second DRAM bank (and therefore 
> saw
> only 1 GiB of RAM, even if there was more available).
> 
> I run the branch through the gitlab CI, which gave me green light :)
> 
> https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi/pipelines/1611
> 
> Regards,
> Matthias
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-atmel-fixes-2020.01-a

2019-12-11 Thread Tom Rini
On Wed, Dec 11, 2019 at 08:21:07AM +, eugen.hris...@microchip.com wrote:

> Hi Tom,
> 
> Please pull tag u-boot-atmel-fixes-2020.01-a , the first (and hopefully 
> last) set of fixes for the 2020.01 cycle.
> 
> This set includes a small fix for gpio bank names, one for removing 
> unused headers (also touches some other boards), and a fix for the QSPI 
> env read on one of the boards.
> 
> Travis : https://travis-ci.org/ehristev/u-boot/builds/623231110
> 
> Thanks !
> Eugen
> 
> The following changes since commit 1297989804d66c8db92efbf9fa2e6cc76965a943:
> 
>Prepare v2020.01-rc4 (2019-12-02 22:09:27 -0500)
> 
> are available in the git repository at:
> 
>https://gitlab.denx.de/u-boot/custodians/u-boot-atmel.git 
> tags/u-boot-atmel-fixes-2020.01-a
> 
> for you to fetch changes up to e50d238a1ce856d3e16bbc279a6e92a0c2b5fb4f:
> 
>configs: sama5d27_som1_ek: Add default config to read ENV from QSPI 
> (2019-12-10 12:43:50 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [U-Boot] Please pull from u-boot-i2c

2019-12-11 Thread Tom Rini
On Wed, Dec 11, 2019 at 11:44:56AM +0100, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull an i2c fix for 2020.01 from u-boot-i2c.git master
> 
> The following changes since commit 520f9559020894950d4e962aba52220c8a1d6bfe:
> 
>   Merge branch 'master' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-riscv (2019-12-09 21:53:23
> -0500)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-i2c.git tags/fix-for-2020.01
> 
> for you to fetch changes up to 3104162a8b967919d2b65211650299018e10c61e:
> 
>   i2c: i2c_cdns: fix write timeout on fifo boundary (2019-12-11 06:25:13 
> +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2] drivers: net: fsl_enetc: Pass on primary MAC address to Linux

2019-12-11 Thread Alexandru Marginean

Hi Michael,

On 12/11/2019 6:03 PM, Michael Walle wrote:

Hi Alex,

Am 2019-12-11 16:37, schrieb Alexandru Marginean:

On 12/11/2019 2:16 PM, Michael Walle wrote:

Hi Vladimir,

Am 2019-12-11 13:46, schrieb Vladimir Oltean:

Hi Michael,

On Wed, 11 Dec 2019 at 00:48, Michael Walle  wrote:


Am 2019-12-10 15:55, schrieb Alex Marginean:
> Passes on the primary address used by u-boot to Linux.  The code 
does a

> DT
> fix-up for ENETC PFs and sets the primary MAC address in IERB.  The
> address
> in IERB is restored on ENETC PCI functions at FLR.


I don't get the reason why this is done in a proprietary way. What is
the
difference between any other network interface whose hardware 
address is

set up in the generic u-boot code.

Also, shouldn't write_hwaddr callback be implemented instead of the
enetc_set_ierb_primary_mac()?



At the moment, the Linux driver ignored the device tree and only reads
the POR values of the SIPMAR registers. The reset value of those comes
from the IERB space, which U-Boot is configuring. So it would be good
if that behavior keeps working.

It would also be good if the Linux driver called of_get_mac_address,
so it needs the device tree binding for that. That's why both fixups
are performed, and why the generic function is not used.


yes, but u-boot already sets the mac-address/local-mac-address property
in the device tree already in a generic way, see fdt_fixup_ethernet().


I think fdt_fixup_ethernet is not a good choice for us.
The issue is that it ties Linux DT to device indexes in U-Boot.
That's a problem if we plug an Eth PCI card in, we would need to
change Linux DT, which is definitely not desirable.
We actually do use PCI Eth cards with some of our boards and U-Boot
does pick those up and indexes shift.


are you sure? afaik it works by reading the /alias/ethernetN phandles
which gets ethNaddr assigned if you set the FDT_SEQ_MACADDR_FROM_ENV
config option. I've just tried it, here is my linux dts diff

--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
@@ -17,6 +17,11 @@
     #address-cells = <2>;
     #size-cells = <2>;

+   aliases {
+   ethernet0 = _port0;
+   ethernet1 = _port1;
+   };
+
     cpus {
     #address-cells = <1>;
     #size-cells = <0>;
@@ -761,10 +766,12 @@
     enetc_port0: ethernet@0,0 {
     compatible = "fsl,enetc";
     reg = <0x00 0 0 0 0>;
+   local-mac-address = [ 00 00 00 00 00 00 ];
     };
     enetc_port1: ethernet@0,1 {
     compatible = "fsl,enetc";
     reg = <0x000100 0 0 0 0>;
+   local-mac-address = [ 00 00 00 00 00 00 ];
     };
     enetc_mdio_pf3: mdio@0,3 {
     compatible = "fsl,enetc-mdio";

That way the mapping between ethNaddr and the network device can also
be changed by the user by changing the linux device tree.

also, uboot should respect the /aliases/ethernetN, too.


I don't disagree with any of that, but that's not the issue I mentioned. 
 I meant actual PCI cards being plugged in, I didn't mean having 
disabled ECAM functions.


In your example DT  enetc port 0 is tied to /aliases/ethernet0 and to 
ethaddr, enetc port 1 is tied to /aliases/ethernet1 and to eth1addr.


A LS1028 board with a PCI Eth card plugged in shows this:

Net:   e1000: 68:05:ca:66:bf:bd
   eth0: e1000#0 [PRIME], eth1: enetc-0, eth2: enetc-2, eth3: swp0, 
eth4: swp1, eth5: swp2, eth6: swp3


In this case eth0 is the e1000 card and it uses ethaddr, enetc port 0 is 
eth1 and uses eth1addr.  The fix-up to /aliases/ethernet0 in your 
example makes enetc port 0 get the MAC address of the PCI card.  If the 
PCI card is removed then enetc port 0 ends up being eth0 in U-Boot and 
and actually use ethaddr, not eth1addr.
To make this work with a PCI card plugged in one would need to change 
the aliases in Linux DT, which is not a fun thing to do.



BTW what will be the source of the network addresses, the u-boot
environment variables? (which might be set either by the user or some
kind of board specific code).


Yes, the environment variables.  As far as I know these come preset from 
the factory.  The reference boards usually come with stickers too, 
listing the preset MAC addresses.



Also U-Boot and Linux DTs have to be in sync all the time, if we
disable one port in U-Boot but not in Linux we would mix up MAC
addresses.


I see. But that shouldn't happen with the code above. But are you sure
that this


+   uclass_get(UCLASS_ETH, );
+   uclass_foreach_dev(dev, uc) {


will work then? in my config (just enetc-0) there is only one eth device

# dm tree
[snip]
  pci   2  [ + ]   pci_generic_ecam  |-- pcie@1f000
  

[PATCH] imx8m: ddr_init: Move ddr_init() messages to debug level

2019-12-11 Thread Fabio Estevam
Currently inside ddr_init() there is a mix of printf() and debug()
level messages.

Since this type of information is useful for debug purposes,
convert all of them to debug level for consistency.

Signed-off-by: Fabio Estevam 
---
 drivers/ddr/imx/imx8m/ddr_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c
index d6e915c9b9..21af66e4e7 100644
--- a/drivers/ddr/imx/imx8m/ddr_init.c
+++ b/drivers/ddr/imx/imx8m/ddr_init.c
@@ -24,7 +24,7 @@ void ddr_init(struct dram_timing_info *dram_timing)
 {
unsigned int tmp, initial_drate, target_freq;
 
-   printf("DDRINFO: start DRAM init\n");
+   debug("DDRINFO: start DRAM init\n");
 
/* Step1: Follow the power up procedure */
if (is_imx8mq()) {
@@ -109,7 +109,7 @@ void ddr_init(struct dram_timing_info *dram_timing)
tmp = reg32_read(DDRPHY_CalBusy(0));
} while ((tmp & 0x1));
 
-   printf("DDRINFO:ddrphy calibration done\n");
+   debug("DDRINFO:ddrphy calibration done\n");
 
/* Step15: Set SWCTL.sw_done to 0 */
reg32_write(DDRC_SWCTL(0), 0x);
@@ -161,7 +161,7 @@ void ddr_init(struct dram_timing_info *dram_timing)
 
/* enable port 0 */
reg32_write(DDRC_PCTRL_0(0), 0x0001);
-   printf("DDRINFO: ddrmix config done\n");
+   debug("DDRINFO: ddrmix config done\n");
 
/* save the dram timing config into memory */
dram_config_save(dram_timing, CONFIG_SAVED_DRAM_TIMING_BASE);
-- 
2.17.1



Re: [PATCH v2 00/16] efi_loader: add secure boot support

2019-12-11 Thread Tom Rini
On Wed, Dec 11, 2019 at 11:10:42AM +0900, AKASHI Takahiro wrote:
> On Tue, Dec 10, 2019 at 08:54:12PM -0500, Tom Rini wrote:
> > On Wed, Dec 11, 2019 at 09:41:56AM +0900, AKASHI Takahiro wrote:
> > > Simon,
> > > 
> > > On Wed, Dec 04, 2019 at 05:28:59PM +0900, AKASHI Takahiro wrote:
> > > > On Wed, Dec 04, 2019 at 08:31:26AM +0100, Heinrich Schuchardt wrote:
> > > > > On 12/4/19 3:43 AM, AKASHI Takahiro wrote:
> > > > > >Tom, Simon, Heinrich,
> > > > > >
> > > > > >I have submitted three major patch sets for UEFI secure boot:
> > > > > >* x509/pkcs7 parser
> > > > > >* RSA library extension
> > > > > >* UEFI secure boot
> > > > > >
> > > > > >I have no technical issues to fix now and have seen only a few minor
> > > > > >comments on them (if I confirm that you have no more comments,
> > > > > >I can submit new version almost immediately).
> > > > > >Considering those, can I expect that those patches be merged
> > > > > >in v2020.01?
> > > > > >
> > > > > >If not, do you need to have more time for your reviewing?
> > > > > >What else do you expect from my side to accelerate the upstream?
> > > > > 
> > > > > We are reaching the end of the release cycle. So do not expect any of
> > > > > these patch series to be merged in v2020.01.
> > > > > cf. https://www.denx.de/wiki/U-Boot/ReleaseCycle
> > > > 
> > > > I have often seen several patches (not bug fix) merged
> > > > even after "merge window".
> > > > Anyway,
> > > > 
> > > > > To my understanding the UEFI secure boot series depends on the other 
> > > > > two
> > > > > so it must be merged last.
> > > > 
> > > > So once the first two patch set are accepted by the maintainers,
> > > > do you agree to merging the third one (i.e. secure boot patch itself)
> > > > promptly?
> > > > -> Heinrich
> > > > 
> > > > As I said, I have had no technical issues on the first two patches
> > > > and haven't heard any comments/objections from the maintainers so far.
> > > > Are you willing to accept them for the next release?
> > > > -> Tom, Simon
> > > 
> > > Can you confirm that you have queued my "RSA library extension" patch
> > > in your -next(?) branch, please?
> > 
> > Please note that I raised a concern with the RSA patch series that needs
> > to be addressed.  There's unexplained / unexpected size growth on
> > platforms that aren't otherwise enabling new features.  Thanks!
> 
> I misunderstood your statement there.
> Questions:
> 1) How did you measure the size growth?
>Please specify the exact command(s).
> 2) Did you use T1042RDB_PI_NAND_SECURE_BOOT_defconfig without any change?

So, I have the following script for doing size tests:
#!/bin/bash

# Initial and constant buildman args
ARGS="-devl"
ALL=0
KEEP=0

# Find our arguments
while test $# -ne 0; do
if [ "$1" == "--all" ]; then
ALL=1
shift 1
elif [ "$1" == "--branch" ]; then
BRANCH=$2
shift 2
elif [ "$1" == "--keep" ]; then
KEEP=1
ARGS="$ARGS -k"
shift 1
else
MACHINE=$1
shift
fi
done

if [ -z $MACHINE ]; then
echo Usage: $0 MACHINE [--all] [--keep] [--branch BRANCH]
exit 1
fi

# If not all, then only first/last
if [ $ALL -ne 1 ]; then
ARGS="$ARGS --step 0"
fi

if [ ! -z $BRANCH ]; then
ARGS="$ARGS -b $BRANCH"
else
ARGS="$ARGS -b `git rev-parse --abbrev-ref HEAD`"
fi

mkdir -p /tmp/$MACHINE

export SOURCE_DATE_EPOCH=`date +%s`
./tools/buildman/buildman -o /tmp/$MACHINE $ARGS -SBC $MACHINE
./tools/buildman/buildman -o /tmp/$MACHINE $ARGS -SsB $MACHINE

[ $KEEP -eq 0 ] && rm -rf /tmp/$MACHINE

And yes, I applied just the series and built the world.  The
T1042RDB_PI_NAND_SECURE_BOOT_defconfig config along with a handful of
other PowerPC platforms (also of the _SECURE_BOOT variety) had the same
size growth.  I didn't bisect down to the specific commit in question at
the time.

-- 
Tom


signature.asc
Description: PGP signature


Please pull u-boot-dm/next to next branch

2019-12-11 Thread Simon Glass
Hi Tom,

This is my first attempt at sending a -next pull request.

https://gitlab.denx.de/u-boot/custodians/u-boot-dm/pipelines/1608



The following changes since commit 520f9559020894950d4e962aba52220c8a1d6bfe:

  Merge branch 'master' of
https://gitlab.denx.de/u-boot/custodians/u-boot-riscv (2019-12-09
21:53:23 -0500)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-dm.git tags/dm-next-13dec19

for you to fetch changes up to b4f98b3b16ec513f7fa6b97ec49792a5e99ec165:

  cros_ec: use uint instead of uint8_t for cmd param (2019-12-10 21:11:31 -0700)


buildman improvements including toolchain environment feature
sandbox unicode support in serial


Cristian Ciocaltea (1):
  buildman: Improve [make-flags] section parser to allow quoted strings

Heinrich Schuchardt (2):
  sandbox: add missing compatible property in device tree
  serial: sandbox: support Unicode

Michael Auchter (1):
  cros_ec: use uint instead of uint8_t for cmd param

Simon Glass (5):
  test.py: Make search for autoconf.mk more permissive
  genboardcfg: Support a quiet mode
  buildman: Ask genboardscfg to be quiet
  buildman: Figure out boards before commits
  buildman: Add options to get the arch and toolchain info

Tom Rini (1):
  buildman: Ignore blank lines during size checks

 arch/sandbox/dts/sandbox.dts   |  1 +
 arch/sandbox/dts/sandbox64.dts |  1 +
 drivers/misc/cros_ec.c |  2 +-
 drivers/serial/sandbox.c   |  2 +-
 test/py/conftest.py| 39 ++---
 tools/buildman/README  |  3 +++
 tools/buildman/builder.py  |  3 ++-
 tools/buildman/cmdline.py  |  4 
 tools/buildman/control.py  | 96
+++---
 tools/buildman/test.py | 18 
 tools/buildman/toolchain.py| 29 -
 tools/genboardscfg.py  | 10 ++---
 12 files changed, 158 insertions(+), 50 deletions(-)

Regards,
SImon


[PATCH v3 2/4] efi_loader: use hardware device tree by default

2019-12-11 Thread Heinrich Schuchardt
If the bootefi command is called without passing the address of a device
tree, the internal device tree is used. For devices with a hardware device
tree it is preferable to used the hardware device tree in this case.

Signed-off-by: Heinrich Schuchardt 
---
v3:
no change
---
 cmd/bootefi.c | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 2b190a3edd..a3e2a05126 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -200,14 +200,16 @@ static void *get_config_table(const efi_guid_t *guid)
  *
  * If fdt_addr is available, the device tree located at that memory address 
will
  * will be installed as configuration table, otherwise the device tree located
- * at the address indicated by environment variable fdtcontroladdr will be 
used.
+ * at the address indicated by environment variable fdt_addr or as fallback
+ * fdtcontroladdr will be used.
  *
  * On architectures using ACPI tables device trees shall not be installed as
  * configuration table.
  *
  * @fdt_addr:  address of device tree or EFI_FDT_USE_INTERNAL to use the
- * internal device tree as indicated by environment variable
- * fdtcontroladdr
+ * the hardware device tree as indicated by environment variable
+ * fdt_addr or as fallback the internal device tree as indicated by
+ * the environment variable fdtcontroladdr
  * Return: status code
  */
 static efi_status_t efi_install_fdt(uintptr_t fdt_addr)
@@ -232,15 +234,19 @@ static efi_status_t efi_install_fdt(uintptr_t fdt_addr)
/* Look for device tree that is already installed */
if (get_config_table(_guid_fdt))
return EFI_SUCCESS;
-   /* Use our own device tree as default */
-   fdt_opt = env_get("fdtcontroladdr");
+   /* Check if there is a hardware device tree */
+   fdt_opt = env_get("fdt_addr");
+   /* Use our own device tree as fallback */
if (!fdt_opt) {
-   printf("ERROR: need device tree\n");
-   return EFI_NOT_FOUND;
+   fdt_opt = env_get("fdtcontroladdr");
+   if (!fdt_opt) {
+   printf("ERROR: need device tree\n");
+   return EFI_NOT_FOUND;
+   }
}
fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
if (!fdt_addr) {
-   printf("ERROR: invalid $fdtcontroladdr\n");
+   printf("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
return EFI_LOAD_ERROR;
}
}
--
2.24.0



[PATCH v3 4/4] efi_loader: export efi_install_fdt()

2019-12-11 Thread Heinrich Schuchardt
Use a pointer to addressable memory instead of a "physical" address in the
virtual address space of the sandbox to efi_install_fdt().

Export the efi_install_fdt() function.

Signed-off-by: Heinrich Schuchardt 
---
v3:
use void * as parameter for efi_install_fdt()
---
 cmd/bootefi.c| 24 ++--
 include/efi_loader.h |  4 +++-
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 15b4ff9515..78c8b8dbd1 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -212,24 +212,24 @@ static void *get_config_table(const efi_guid_t *guid)
  * the environment variable fdtcontroladdr
  * Return: status code
  */
-static efi_status_t efi_install_fdt(uintptr_t fdt_addr)
+efi_status_t efi_install_fdt(void *fdt)
 {
/*
 * The EBBR spec requires that we have either an FDT or an ACPI table
 * but not both.
 */
 #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
-   if (fdt_addr) {
+   if (fdt) {
printf("ERROR: can't have ACPI table and device tree.\n");
return EFI_LOAD_ERROR;
}
 #else
-   void *fdt;
bootm_headers_t img = { 0 };
efi_status_t ret;

-   if (fdt_addr == EFI_FDT_USE_INTERNAL) {
+   if (fdt == EFI_FDT_USE_INTERNAL) {
const char *fdt_opt;
+   uintptr_t fdt_addr;

/* Look for device tree that is already installed */
if (get_config_table(_guid_fdt))
@@ -249,10 +249,10 @@ static efi_status_t efi_install_fdt(uintptr_t fdt_addr)
printf("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
return EFI_LOAD_ERROR;
}
+   fdt = map_sysmem(fdt_addr, 0);
}

/* Install device tree */
-   fdt = map_sysmem(fdt_addr, 0);
if (fdt_check_header(fdt)) {
printf("ERROR: invalid device tree\n");
return EFI_LOAD_ERROR;
@@ -574,7 +574,7 @@ static int do_efi_selftest(void)
 static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
efi_status_t ret;
-   uintptr_t fdt_addr;
+   void *fdt;

if (argc < 2)
return CMD_RET_USAGE;
@@ -587,11 +587,15 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
return CMD_RET_FAILURE;
}

-   if (argc > 2)
+   if (argc > 2) {
+   uintptr_t fdt_addr;
+
fdt_addr = simple_strtoul(argv[2], NULL, 16);
-   else
-   fdt_addr = EFI_FDT_USE_INTERNAL;
-   ret = efi_install_fdt(fdt_addr);
+   fdt = map_sysmem(fdt_addr, 0);
+   } else {
+   fdt = EFI_FDT_USE_INTERNAL;
+   }
+   ret = efi_install_fdt(fdt);
if (ret == EFI_INVALID_PARAMETER)
return CMD_RET_USAGE;
else if (ret != EFI_SUCCESS)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 1e1fe52bc0..4d401f69d7 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -35,7 +35,7 @@ static inline int guidcmp(const void *g1, const void *g2)
 0x9a, 0xab, 0x3a, 0x7d, 0xbf, 0x40, 0xc4, 0x82)

 /* Use internal device tree when starting UEFI application */
-#define EFI_FDT_USE_INTERNAL 0UL
+#define EFI_FDT_USE_INTERNAL NULL

 /* Root node */
 extern efi_handle_t efi_root;
@@ -341,6 +341,8 @@ extern struct list_head efi_register_notify_events;

 /* Initialize efi execution environment */
 efi_status_t efi_init_obj_list(void);
+/* Install device tree */
+efi_status_t efi_install_fdt(void *fdt);
 /* Run loaded UEFI image */
 efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size);
 /* Initialize variable services */
--
2.24.0



[PATCH v3 3/4] efi_loader: carve out efi_run_image()

2019-12-11 Thread Heinrich Schuchardt
Provide public function efi_run_imager() which can be used to run an UEFI
image from memory.

Signed-off-by: Heinrich Schuchardt 
---
v3:
no change
---
 cmd/bootefi.c| 51 +++-
 include/efi_loader.h |  2 ++
 2 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index a3e2a05126..15b4ff9515 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -360,11 +360,8 @@ static int do_efibootmgr(void)
 static int do_bootefi_image(const char *image_opt)
 {
void *image_buf;
-   struct efi_device_path *device_path, *image_path;
-   struct efi_device_path *file_path = NULL;
unsigned long addr, size;
const char *size_str;
-   efi_handle_t mem_handle = NULL, handle;
efi_status_t ret;

 #ifdef CONFIG_CMD_BOOTEFI_HELLO
@@ -382,8 +379,10 @@ static int do_bootefi_image(const char *image_opt)
image_buf = map_sysmem(addr, size);
memcpy(image_buf, __efi_helloworld_begin, size);

-   device_path = NULL;
-   image_path = NULL;
+   efi_free_pool(bootefi_device_path);
+   efi_free_pool(bootefi_image_path);
+   bootefi_device_path = NULL;
+   bootefi_image_path = NULL;
} else
 #endif
{
@@ -399,19 +398,37 @@ static int do_bootefi_image(const char *image_opt)
return CMD_RET_USAGE;

image_buf = map_sysmem(addr, size);
-
-   device_path = bootefi_device_path;
-   image_path = bootefi_image_path;
}
+   ret = efi_run_image(image_buf, size);
+
+   if (ret != EFI_SUCCESS)
+   return CMD_RET_FAILURE;
+
+   return CMD_RET_SUCCESS;
+}
+
+/**
+ * efi_run_image() - run loaded UEFI image
+ *
+ * @source_buffer: memory address of the UEFI image
+ * @source_size:   size of the UEFI image
+ * Return: status code
+ */
+efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
+{
+   efi_handle_t mem_handle = NULL, handle;
+   struct efi_device_path *file_path = NULL;
+   efi_status_t ret;

-   if (!device_path && !image_path) {
+   if (!bootefi_device_path || !bootefi_image_path) {
/*
 * Special case for efi payload not loaded from disk,
 * such as 'bootefi hello' or for example payload
 * loaded directly into memory via JTAG, etc:
 */
file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
-   (uintptr_t)image_buf, size);
+   (uintptr_t)source_buffer,
+   source_size);
/*
 * Make sure that device for device_path exist
 * in load_image(). Otherwise, shell and grub will fail.
@@ -425,12 +442,12 @@ static int do_bootefi_image(const char *image_opt)
if (ret != EFI_SUCCESS)
goto out;
} else {
-   assert(device_path && image_path);
-   file_path = efi_dp_append(device_path, image_path);
+   file_path = efi_dp_append(bootefi_device_path,
+ bootefi_image_path);
}

-   ret = EFI_CALL(efi_load_image(false, efi_root,
- file_path, image_buf, size, ));
+   ret = EFI_CALL(efi_load_image(false, efi_root, file_path, source_buffer,
+ source_size, ));
if (ret != EFI_SUCCESS)
goto out;

@@ -441,11 +458,7 @@ out:
efi_delete_handle(mem_handle);
if (file_path)
efi_free_pool(file_path);
-
-   if (ret != EFI_SUCCESS)
-   return CMD_RET_FAILURE;
-
-   return CMD_RET_SUCCESS;
+   return ret;
 }

 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 3a22089329..1e1fe52bc0 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -341,6 +341,8 @@ extern struct list_head efi_register_notify_events;

 /* Initialize efi execution environment */
 efi_status_t efi_init_obj_list(void);
+/* Run loaded UEFI image */
+efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size);
 /* Initialize variable services */
 efi_status_t efi_init_variables(void);
 /* Notify ExitBootServices() is called */
--
2.24.0



[PATCH v3 1/4] efi_loader: pass address to efi_install_fdt()

2019-12-11 Thread Heinrich Schuchardt
As part of moving the parsing of command line arguments to do_bootefi()
call efi_install_fdt() with the address of the device tree instead of a
string.

If the address is EFI_FDT_USE_INTERNAL (= 0), the internal device tree
is used.

Signed-off-by: Heinrich Schuchardt 
---
v3:
no change
---
 cmd/bootefi.c| 32 ++--
 include/efi_loader.h |  3 +++
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index f613cce7e2..2b190a3edd 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -196,40 +196,39 @@ static void *get_config_table(const efi_guid_t *guid)
 #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */

 /**
- * efi_install_fdt() - install fdt passed by a command argument
+ * efi_install_fdt() - install device tree
  *
- * If fdt_opt is available, the device tree located at that memory address will
+ * If fdt_addr is available, the device tree located at that memory address 
will
  * will be installed as configuration table, otherwise the device tree located
  * at the address indicated by environment variable fdtcontroladdr will be 
used.
  *
- * On architectures (x86) using ACPI tables device trees shall not be installed
- * as configuration table.
+ * On architectures using ACPI tables device trees shall not be installed as
+ * configuration table.
  *
- * @fdt_opt:   pointer to argument
+ * @fdt_addr:  address of device tree or EFI_FDT_USE_INTERNAL to use the
+ * internal device tree as indicated by environment variable
+ * fdtcontroladdr
  * Return: status code
  */
-static efi_status_t efi_install_fdt(const char *fdt_opt)
+static efi_status_t efi_install_fdt(uintptr_t fdt_addr)
 {
/*
 * The EBBR spec requires that we have either an FDT or an ACPI table
 * but not both.
 */
 #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
-   if (fdt_opt) {
+   if (fdt_addr) {
printf("ERROR: can't have ACPI table and device tree.\n");
return EFI_LOAD_ERROR;
}
 #else
-   unsigned long fdt_addr;
void *fdt;
bootm_headers_t img = { 0 };
efi_status_t ret;

-   if (fdt_opt) {
-   fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
-   if (!fdt_addr)
-   return EFI_INVALID_PARAMETER;
-   } else {
+   if (fdt_addr == EFI_FDT_USE_INTERNAL) {
+   const char *fdt_opt;
+
/* Look for device tree that is already installed */
if (get_config_table(_guid_fdt))
return EFI_SUCCESS;
@@ -556,6 +555,7 @@ static int do_efi_selftest(void)
 static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
efi_status_t ret;
+   uintptr_t fdt_addr;

if (argc < 2)
return CMD_RET_USAGE;
@@ -568,7 +568,11 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
return CMD_RET_FAILURE;
}

-   ret = efi_install_fdt(argc > 2 ? argv[2] : NULL);
+   if (argc > 2)
+   fdt_addr = simple_strtoul(argv[2], NULL, 16);
+   else
+   fdt_addr = EFI_FDT_USE_INTERNAL;
+   ret = efi_install_fdt(fdt_addr);
if (ret == EFI_INVALID_PARAMETER)
return CMD_RET_USAGE;
else if (ret != EFI_SUCCESS)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 16a1b258b1..3a22089329 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -34,6 +34,9 @@ static inline int guidcmp(const void *g1, const void *g2)
EFI_GUID(0xbbe4e671, 0x5773, 0x4ea1, \
 0x9a, 0xab, 0x3a, 0x7d, 0xbf, 0x40, 0xc4, 0x82)

+/* Use internal device tree when starting UEFI application */
+#define EFI_FDT_USE_INTERNAL 0UL
+
 /* Root node */
 extern efi_handle_t efi_root;

--
2.24.0



[PATCH v3 0/4] efi_loader: prepare for FIT images

2019-12-11 Thread Heinrich Schuchardt
A patch series has been suggested to provide secure UEFI boot via FIT
images.

This patch series exports the functions needed for the implementation.

v3:
use void * as parameter for efi_install_fdt()
v2:
Resend the efi_install_fdt() rework patches.
Export the efi_run_image() and efi_install_fdt().

Heinrich Schuchardt (4):
  efi_loader: pass address to efi_install_fdt()
  efi_loader: use hardware device tree by default
  efi_loader: carve out efi_run_image()
  efi_loader: export efi_install_fdt()

 cmd/bootefi.c| 109 +++
 include/efi_loader.h |   7 +++
 2 files changed, 75 insertions(+), 41 deletions(-)

--
2.24.0



Re: [PATCH v2 2/4] bootm: Add a bootm command for type IH_OS_EFI

2019-12-11 Thread Heinrich Schuchardt

On 12/11/19 4:10 PM, Cristian Ciocaltea wrote:

On Wed, Dec 11, 2019 at 10:57:48AM +0100, Heinrich Schuchardt wrote:

On 12/11/19 9:54 AM, Cristian Ciocaltea wrote:

On Tue, Dec 10, 2019 at 08:32:17PM +0100, Heinrich Schuchardt wrote:

On 12/10/19 9:56 AM, Cristian Ciocaltea wrote:

Add support for booting EFI binaries contained in FIT images.
A typical usage scenario is chain-loading GRUB2 in a verified
boot environment.

Signed-off-by: Cristian Ciocaltea


Reading through the code it looks good. What I really need to do is
analyze the address usage on the sandbox. To me it is unclear if
images->fdt_addr is a physical address or an address in the address
space of the sandbox.

Did you test this on the sandbox? You can use
lib/efi_loader/helloworld.efi as a binary and the 'host load hostfs'
command for loading the FIT image.


I only tested on qemu, I've never used the sandbox, so it's a good
opportunity to give it a try.


Shouldn't we add booting a UEFI FIT image to the Python test in
test/py/tests/test_fit.py?


Unfortunately I'm not familiar with the testing framework (including
Python scripting), but I'll do my best to add such a test.


doc/uImage.FIT/signature.txt describes that several properties of the
RSA public key should be stored in the control device tree.
Unfortunately no example is supplied in which format they should be
stored. Could you send me an example, please.

I found the following

https://github.com/bn121rajesh/ipython-notebooks/blob/master/BehindTheScene/RSAPublicKeyParamsUBoot/rsa_public_key_params_uboot.ipynb

Is this an accurate description? Or how do you get the parameters from
your RSA public key?


My test scenario involves the following steps:

1. Create a public/private key pair
$ openssl genpkey -algorithm RSA -out ${DEV_KEY} \
  -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537

2. Create a certificate containing the public key
$ openssl req -batch -new -x509 -key ${DEV_KEY} -out ${DEV_CRT}

3. Dump QEMU virt board DTB
$ qemu-system-arm -nographic -M virt,dumpdtb=${BOARD_DTB} \
  -cpu cortex-a15 -smp 1 -m 512 -bios u-boot.bin [...]

4. Create (unsigned) FIT image and put the public key into DTB, with
 the 'required' property set, telling U-Boot that this key MUST be
 verified for the image to be valid
$ mkimage -f ${FIT_ITS} -K ${BOARD_DTB} -k ${KEYS_DIR} -r ${FIT_IMG}

5. Sign the FIT image
$ fit_check_sign -f ${FIT_IMG} -k ${BOARD_DTB}

6. Run QEMU supplying the DTB containing the public key and the
 u-boot binary built with CONFIG_OF_BOARD
$ qemu-system-arm -nographic \
  -M virt -cpu cortex-a15 -smp 1 -m 512 -bios u-boot.bin \
  -dtb ${BOARD_DTB} [...]

This is what I get after booting QEMU with the command above:

=> fdt addr $fdtcontroladdr
=> fdt print
/ {
  [...]
signature {
key-dev {
required = "conf";
algo = "sha256,rsa2048";
rsa,r-squared = * 0x5ef05188 [0x0100];
rsa,modulus = * 0x5ef05294 [0x0100];
rsa,exponent = <0x 0x00010001>;
rsa,n0-inverse = <0x649cd557>;
rsa,num-bits = <0x0800>;
key-name-hint = "dev";
};
};
  [...]


See my patch

doc: fitImage: example of a signature node
https://lists.denx.de/pipermail/u-boot/2019-December/393613.html

---

Booting of the sandbox fails due to an incorrect address passed for the
device tree:

=> host load hostfs - $kernel_addr_r image.fit
26558 bytes read in 0 ms
=> bootm ${kernel_addr_r}#config-grub-fdt
## Loading kernel from FIT Image at 0100 ...
Using 'config-grub-fdt' configuration
Verifying Hash Integrity ... OK
Trying 'helloworld' kernel subimage
  Description:  Hello World
  Created:  2019-12-11   9:19:22 UTC
  Type: Kernel Image (no loading done)
  Compression:  uncompressed
  Data Start:   0x01cc
  Data Size:2733 Bytes = 2.7 KiB
  Hash algo:sha256
  Hash value:
5c3ba35a1cb4abfe8a867ea6ac709574535794a7d7d03ba1ec2273b956d13983
Verifying Hash Integrity ... sha256+ OK
XIP Kernel Image (no loading done)
## Loading fdt from FIT Image at 0100 ...
Using 'config-grub-fdt' configuration
Verifying Hash Integrity ... OK
Trying 'fdt-test' fdt subimage
  Description:  QEMU DTB
  Created:  2019-12-11   9:19:22 UTC
  Type: Flat Device Tree
  Compression:  uncompressed
  Data Start:   0x01000c74
  Data Size:19713 Bytes = 19.3 KiB
  Architecture: ARM
  Hash algo:sha256
  Hash value:
3e4f4e2b512f7a03a7f9ccecfb2b6bf7ceea75882370639460fd61502d903cd1
Verifying Hash Integrity ... sha256+ OK
Booting using the fdt blob at 0x1000c74
Found 0 disks
phys_to_virt: Cannot map sandbox address 11001c74 (SDRAM from 0 to 800)
Aborted


I've checked the internal handling 

[PATCH] imx8m_evk: Remove unneeded earlycon string

2019-12-11 Thread Fabio Estevam
Passing earlycon string in the command line may be
useful during bring up, but not after such phase.

Remove the earlycon string to align with the other i.MX SoCs
command lines.

Signed-off-by: Fabio Estevam 
---
 include/configs/imx8mm_evk.h | 2 +-
 include/configs/imx8mn_evk.h | 2 +-
 include/configs/imx8mq_evk.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index acbab05ae9..991fe0056c 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -39,7 +39,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS  \
"script=boot.scr\0" \
"image=Image.itb\0" \
-   "console=ttymxc1,115200 earlycon=ec_imx6q,0x3089,115200\0" \
+   "console=ttymxc1,115200\0" \
"fdt_addr=0x4300\0" \
"fdt_high=0x\0" \
"boot_fit=try\0" \
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index 62037c7387..ce73ca6b0a 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -42,7 +42,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS  \
"script=boot.scr\0" \
"image=Image.itb\0" \
-   "console=ttymxc1,115200 earlycon=ec_imx6q,0x3089,115200\0" \
+   "console=ttymxc1,115200\0" \
"fdt_addr=0x4300\0" \
"fdt_high=0x\0" \
"boot_fit=try\0" \
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index b29989db8f..5d9ef70830 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -103,7 +103,7 @@
CONFIG_MFG_ENV_SETTINGS \
"script=boot.scr\0" \
"image=Image\0" \
-   "console=ttymxc0,115200 earlycon=ec_imx6q,0x3086,115200\0" \
+   "console=ttymxc0,115200\0" \
"fdt_addr=0x4300\0" \
"fdt_high=0x\0" \
"boot_fdt=try\0" \
-- 
2.17.1



Re: [PATCH 2/2] configs: sandbox: enable CONFIG_CMD_BOOTEFI_SELFTEST

2019-12-11 Thread Simon Glass
Hi Heinrich,

On Wed, 11 Dec 2019 at 09:59, Heinrich Schuchardt  wrote:
>
> On 12/11/19 4:43 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Tue, 10 Dec 2019 at 11:17, Heinrich Schuchardt  
> > wrote:
> >>
> >> On 12/10/19 1:58 PM, Simon Glass wrote:
> >>> Hi Heinrich,
> >>>
> >>> On Sat, 9 Nov 2019 at 01:44, Heinrich Schuchardt  
> >>> wrote:
> 
>  Activate UEFI unit tests on the sandbox.
> 
>  Signed-off-by: Heinrich Schuchardt 
>  ---
> configs/sandbox64_defconfig| 1 +
> configs/sandbox_defconfig  | 1 +
> configs/sandbox_flattree_defconfig | 1 +
> configs/sandbox_spl_defconfig  | 1 +
> 4 files changed, 4 insertions(+)
> >>>
> >>> Unfortunately this slows down the testing too much, nearly doubling
> >>> the time in my tests.
> >>>
> >>> I think the EFI console tests need to be modified to run in C instead
> >>> of all the drain_console() and p.timeout stuff. We need an effort to
> >>> speed up the tests, but certainly cannot make them any slower.
> >>
> >> Hello Simon,
> >>
> >> thanks for pointing at the excessive timeout.
> >>
> >> In test_efi_selftest_text_input() and test_efi_selftest_text_input_ex()
> >> we call drain_console() a lot indeed.
> >>
> >> I am using the Python tests on real hardware. The text input and output
> >> on the test systems uses the serial console. Whether you use C or Python
> >> code to feed the serial adapter will not change the time needed to drain
> >> the console.
> >>
> >> We expect less then 50 characters of output per test step. At 9600 baud
> >> draining 50 characters would require 52 ms.
> >>
> >> So I would suggest that we add a parameter timeout to drain_console()
> >> which defaults to 1000 ms as currently. But in the test we can set it to
> >> 50 ms. p.timeout could be changed likewise.
> >>
> >> What are your thoughts?
> >
> > I think you might be missing my point.
> >
> > I think as a matter of policy we should require that test run mostly
> > on the device, with just the results being output. By using C I mean
> > to write the test in C instead of Python - just do the same steps.
> > E.g. do a lot of run_command() calls and check the results. This
> > should be much faster.
> >
>
> The current test checks if Unicode signs sent over the physical serial
> interface are correctly interpreted in U-Boot. One reason for failure
> could be that the UART driver uses bit 7 as a parity bit.

How is this testing U-Boot? This sounds like a test of the user environment?

Even if the test passes on gitlab, if the user is using some sort of
different serial access then it might fail...?

If you want a test for 8-bit serial, you should add one.

>
> U-Boot's internal function run_command() cannot send electrical signals
> inbound to the device's UART.
>
> You may implement an additional test with a different scope. But that
> should not replace the current test.
>
> Best regards
>
> Heinrich

Regards,
Simon


Re: [PATCH v2] drivers: net: fsl_enetc: Pass on primary MAC address to Linux

2019-12-11 Thread Michael Walle

Hi Alex,

Am 2019-12-11 16:37, schrieb Alexandru Marginean:

On 12/11/2019 2:16 PM, Michael Walle wrote:

Hi Vladimir,

Am 2019-12-11 13:46, schrieb Vladimir Oltean:

Hi Michael,

On Wed, 11 Dec 2019 at 00:48, Michael Walle  wrote:


Am 2019-12-10 15:55, schrieb Alex Marginean:
> Passes on the primary address used by u-boot to Linux.  The code does a
> DT
> fix-up for ENETC PFs and sets the primary MAC address in IERB.  The
> address
> in IERB is restored on ENETC PCI functions at FLR.


I don't get the reason why this is done in a proprietary way. What 
is

the
difference between any other network interface whose hardware 
address is

set up in the generic u-boot code.

Also, shouldn't write_hwaddr callback be implemented instead of the
enetc_set_ierb_primary_mac()?



At the moment, the Linux driver ignored the device tree and only 
reads
the POR values of the SIPMAR registers. The reset value of those 
comes

from the IERB space, which U-Boot is configuring. So it would be good
if that behavior keeps working.

It would also be good if the Linux driver called of_get_mac_address,
so it needs the device tree binding for that. That's why both fixups
are performed, and why the generic function is not used.


yes, but u-boot already sets the mac-address/local-mac-address 
property

in the device tree already in a generic way, see fdt_fixup_ethernet().


I think fdt_fixup_ethernet is not a good choice for us.
The issue is that it ties Linux DT to device indexes in U-Boot.
That's a problem if we plug an Eth PCI card in, we would need to
change Linux DT, which is definitely not desirable.
We actually do use PCI Eth cards with some of our boards and U-Boot
does pick those up and indexes shift.


are you sure? afaik it works by reading the /alias/ethernetN phandles
which gets ethNaddr assigned if you set the FDT_SEQ_MACADDR_FROM_ENV
config option. I've just tried it, here is my linux dts diff

--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
@@ -17,6 +17,11 @@
#address-cells = <2>;
#size-cells = <2>;

+   aliases {
+   ethernet0 = _port0;
+   ethernet1 = _port1;
+   };
+
cpus {
#address-cells = <1>;
#size-cells = <0>;
@@ -761,10 +766,12 @@
enetc_port0: ethernet@0,0 {
compatible = "fsl,enetc";
reg = <0x00 0 0 0 0>;
+   local-mac-address = [ 00 00 00 00 00 00 
];

};
enetc_port1: ethernet@0,1 {
compatible = "fsl,enetc";
reg = <0x000100 0 0 0 0>;
+   local-mac-address = [ 00 00 00 00 00 00 
];

};
enetc_mdio_pf3: mdio@0,3 {
compatible = "fsl,enetc-mdio";

That way the mapping between ethNaddr and the network device can also
be changed by the user by changing the linux device tree.

also, uboot should respect the /aliases/ethernetN, too.

BTW what will be the source of the network addresses, the u-boot
environment variables? (which might be set either by the user or some
kind of board specific code).


Also U-Boot and Linux DTs have to be in sync all the time, if we
disable one port in U-Boot but not in Linux we would mix up MAC
addresses.


I see. But that shouldn't happen with the code above. But are you sure
that this


+   uclass_get(UCLASS_ETH, );
+   uclass_foreach_dev(dev, uc) {


will work then? in my config (just enetc-0) there is only one eth device

# dm tree
[snip]
 pci   2  [ + ]   pci_generic_ecam  |-- pcie@1f000
 eth   0  [ + ]   enetc_eth |   |-- enetc-0
 mdio  0  [ + ]   enetc_mdio|   |-- emdio-3
 pci_generi0  [   ]   pci_generic_drv   |   |-- pci_4:0.4
 dsa   0  [   ]   felix-switch  |   |-- felix-switch
 pci_generi1  [   ]   pci_generic_drv   |   `-- pci_4:1f.0
[snip]



So as far as using generic fix-up code I'm all for it, but in this
case we would need some platform specific rules to match Linux DT
nodes to U-Boot eth addresses.


As for the write_hwaddr callback instead of
enetc_set_primary_mac_addr, that is valid but I suppose it is outside
the scope of this patch. That function is related to the runtime MAC
address and not to the MAC passed to Linux.


according to the comment in eth-uclass.c this is not for (u-boot) 
runtime:


  /*
   * Devices need to write the hwaddr even if not started so that 
Linux

   * will have access to the hwaddr that u-boot stored for the device.
   * This is accomplished by attempting to probe each device and 
calling

   * their write_hwaddr() operation.
   */

and the runtime mac address for u-boot is already set enetc_start().

-michael


This is fine, I'll move the IERB code to 

Re: [PATCH 2/2] configs: sandbox: enable CONFIG_CMD_BOOTEFI_SELFTEST

2019-12-11 Thread Heinrich Schuchardt

On 12/11/19 4:43 PM, Simon Glass wrote:

Hi Heinrich,

On Tue, 10 Dec 2019 at 11:17, Heinrich Schuchardt  wrote:


On 12/10/19 1:58 PM, Simon Glass wrote:

Hi Heinrich,

On Sat, 9 Nov 2019 at 01:44, Heinrich Schuchardt  wrote:


Activate UEFI unit tests on the sandbox.

Signed-off-by: Heinrich Schuchardt 
---
   configs/sandbox64_defconfig| 1 +
   configs/sandbox_defconfig  | 1 +
   configs/sandbox_flattree_defconfig | 1 +
   configs/sandbox_spl_defconfig  | 1 +
   4 files changed, 4 insertions(+)


Unfortunately this slows down the testing too much, nearly doubling
the time in my tests.

I think the EFI console tests need to be modified to run in C instead
of all the drain_console() and p.timeout stuff. We need an effort to
speed up the tests, but certainly cannot make them any slower.


Hello Simon,

thanks for pointing at the excessive timeout.

In test_efi_selftest_text_input() and test_efi_selftest_text_input_ex()
we call drain_console() a lot indeed.

I am using the Python tests on real hardware. The text input and output
on the test systems uses the serial console. Whether you use C or Python
code to feed the serial adapter will not change the time needed to drain
the console.

We expect less then 50 characters of output per test step. At 9600 baud
draining 50 characters would require 52 ms.

So I would suggest that we add a parameter timeout to drain_console()
which defaults to 1000 ms as currently. But in the test we can set it to
50 ms. p.timeout could be changed likewise.

What are your thoughts?


I think you might be missing my point.

I think as a matter of policy we should require that test run mostly
on the device, with just the results being output. By using C I mean
to write the test in C instead of Python - just do the same steps.
E.g. do a lot of run_command() calls and check the results. This
should be much faster.



The current test checks if Unicode signs sent over the physical serial
interface are correctly interpreted in U-Boot. One reason for failure
could be that the UART driver uses bit 7 as a parity bit.

U-Boot's internal function run_command() cannot send electrical signals
inbound to the device's UART.

You may implement an additional test with a different scope. But that
should not replace the current test.

Best regards

Heinrich


Re: [PATCH] tools: imx8m_image: Change source path for DDR firmware to build dir

2019-12-11 Thread Fabio Estevam
Hi Baruch,

On Wed, Dec 11, 2019 at 12:25 PM Baruch Siach  wrote:

> I'm not talking about the selection of firmware package version. It is
> just that the firmware-imx-8.0.bin archive (another typo), extract into
> firmware-imx-8.0/, not firmware-imx-7.9/ as the current text shows.

I agree we should fix this mismatch, but it would be better to do in a
separate patch.

Adam reported that firmware 8.0 does not work, but 7.9 does.


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
On Wed, Dec 11, 2019 at 11:14 AM Schrempf Frieder
 wrote:

> Just for the record: I am using upstream ATF for my custom i.MX8MM board
> with mainline U-Boot and it just works fine. I didn't run into any
> issues so far and I'm still on ATF revision 3441952f61a6 and haven't
> updated for quite a while.

Thanks for the feedback.

Perhaps we can consider moving to mainline ATF after 2020.01 is released.


Re: [PATCH 2/2] configs: sandbox: enable CONFIG_CMD_BOOTEFI_SELFTEST

2019-12-11 Thread Simon Glass
Hi Heinrich,

On Tue, 10 Dec 2019 at 11:17, Heinrich Schuchardt  wrote:
>
> On 12/10/19 1:58 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Sat, 9 Nov 2019 at 01:44, Heinrich Schuchardt  wrote:
> >>
> >> Activate UEFI unit tests on the sandbox.
> >>
> >> Signed-off-by: Heinrich Schuchardt 
> >> ---
> >>   configs/sandbox64_defconfig| 1 +
> >>   configs/sandbox_defconfig  | 1 +
> >>   configs/sandbox_flattree_defconfig | 1 +
> >>   configs/sandbox_spl_defconfig  | 1 +
> >>   4 files changed, 4 insertions(+)
> >
> > Unfortunately this slows down the testing too much, nearly doubling
> > the time in my tests.
> >
> > I think the EFI console tests need to be modified to run in C instead
> > of all the drain_console() and p.timeout stuff. We need an effort to
> > speed up the tests, but certainly cannot make them any slower.
>
> Hello Simon,
>
> thanks for pointing at the excessive timeout.
>
> In test_efi_selftest_text_input() and test_efi_selftest_text_input_ex()
> we call drain_console() a lot indeed.
>
> I am using the Python tests on real hardware. The text input and output
> on the test systems uses the serial console. Whether you use C or Python
> code to feed the serial adapter will not change the time needed to drain
> the console.
>
> We expect less then 50 characters of output per test step. At 9600 baud
> draining 50 characters would require 52 ms.
>
> So I would suggest that we add a parameter timeout to drain_console()
> which defaults to 1000 ms as currently. But in the test we can set it to
> 50 ms. p.timeout could be changed likewise.
>
> What are your thoughts?

I think you might be missing my point.

I think as a matter of policy we should require that test run mostly
on the device, with just the results being output. By using C I mean
to write the test in C instead of Python - just do the same steps.
E.g. do a lot of run_command() calls and check the results. This
should be much faster.

Regards,
Simon


Re: [PATCH v2] drivers: net: fsl_enetc: Pass on primary MAC address to Linux

2019-12-11 Thread Alexandru Marginean

On 12/11/2019 2:16 PM, Michael Walle wrote:

Hi Vladimir,

Am 2019-12-11 13:46, schrieb Vladimir Oltean:

Hi Michael,

On Wed, 11 Dec 2019 at 00:48, Michael Walle  wrote:


Am 2019-12-10 15:55, schrieb Alex Marginean:
> Passes on the primary address used by u-boot to Linux.  The code 
does a

> DT
> fix-up for ENETC PFs and sets the primary MAC address in IERB.  The
> address
> in IERB is restored on ENETC PCI functions at FLR.


I don't get the reason why this is done in a proprietary way. What is
the
difference between any other network interface whose hardware address is
set up in the generic u-boot code.

Also, shouldn't write_hwaddr callback be implemented instead of the
enetc_set_ierb_primary_mac()?



At the moment, the Linux driver ignored the device tree and only reads
the POR values of the SIPMAR registers. The reset value of those comes
from the IERB space, which U-Boot is configuring. So it would be good
if that behavior keeps working.

It would also be good if the Linux driver called of_get_mac_address,
so it needs the device tree binding for that. That's why both fixups
are performed, and why the generic function is not used.


yes, but u-boot already sets the mac-address/local-mac-address property
in the device tree already in a generic way, see fdt_fixup_ethernet().


I think fdt_fixup_ethernet is not a good choice for us.
The issue is that it ties Linux DT to device indexes in U-Boot.  That's 
a problem if we plug an Eth PCI card in, we would need to change Linux 
DT, which is definitely not desirable.
We actually do use PCI Eth cards with some of our boards and U-Boot does 
pick those up and indexes shift.


Also U-Boot and Linux DTs have to be in sync all the time, if we disable 
one port in U-Boot but not in Linux we would mix up MAC addresses.


So as far as using generic fix-up code I'm all for it, but in this case 
we would need some platform specific rules to match Linux DT nodes to 
U-Boot eth addresses.



As for the write_hwaddr callback instead of
enetc_set_primary_mac_addr, that is valid but I suppose it is outside
the scope of this patch. That function is related to the runtime MAC
address and not to the MAC passed to Linux.


according to the comment in eth-uclass.c this is not for (u-boot) runtime:

  /*
   * Devices need to write the hwaddr even if not started so that Linux
   * will have access to the hwaddr that u-boot stored for the device.
   * This is accomplished by attempting to probe each device and calling
   * their write_hwaddr() operation.
   */

and the runtime mac address for u-boot is already set enetc_start().

-michael


This is fine, I'll move the IERB code to write_hwaddr.

Alex


Re: [PATCH] tools: imx8m_image: Change source path for DDR firmware to build dir

2019-12-11 Thread Baruch Siach
Hi Frieder,

On Wed, Dec 11 2019, Schrempf Frieder wrote:
> On 11.12.19 11:49, Baruch Siach wrote:
>> Hi Frieder Schrempf,
>>
>> On Wed, Dec 11 2019, Schrempf Frieder wrote:
>>
>>> From: Frieder Schrempf 
>>>
>>> The DDR firmware binaries are not part of the U-Boot source code, so
>>> we should look for them in the build directory, where they need to be
>>> copied to before building U-Boot.
>>>
>>> The ATF binary is already fetched from the build directory, but the
>>> README files for the i.MX8M EVKs claim that it needs to be copied to
>>> the source directory (which is still true for in-tree builds, but not
>>> in general). Therefore we also fix the READMEs to use the build
>>> directory as the correct location for all additional binary files.
>>>
>>> Sined-off-by: Frieder Schrempf 
>>> ---
>>>   board/freescale/imx8mm_evk/README |  6 +++---
>>>   board/freescale/imx8mq_evk/README |  8 
>>>   tools/imx8m_image.sh  | 28 +++-
>>>   3 files changed, 18 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/board/freescale/imx8mm_evk/README 
>>> b/board/freescale/imx8mm_evk/README
>>> index a885bc5c97..c908c0adc4 100644
>>> --- a/board/freescale/imx8mm_evk/README
>>> +++ b/board/freescale/imx8mm_evk/README
>>> @@ -9,18 +9,18 @@ Quick Start
>>>
>>>   Get and Build the ARM Trusted firmware
>>>   ==
>>> -Note: srctree is U-Boot source directory
>>> +Note: builddir is U-Boot build directory (source directory for in-tree 
>>> builds)
>>>   Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
>>>   branch: imx_4.19.35_1.0.0
>>>   $ make PLAT=imx8mm bl31
>>> -$ cp build/imx8mm/release/bl31.bin $(srctree)
>>> +$ cp build/imx8mm/release/bl31.bin $(builddir)
>>>
>>>   Get the ddr and hdmi firmware
>>>   =
>>>   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.0.bin
>>>   $ chmod +x firmware-imx-8.0.bin
>>>   $ ./firmware-imx-8.0
>>> -$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(srctree)
>>> +$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir)
>>
>> You might want to take the opportunity to fix the firmware directory
>> name as well.
>
> I will leave this to someone who knows more about this and once someone
> has decided which version of the firmware should actually be used.
> Personally I have used 7.8 (from Yocto Warrior release) and 8.1 (from
> Yocto Zeus release) with my custom i.MX8MM board so far.
>
> The discussion about this is currently also going on here:
> https://lists.denx.de/pipermail/u-boot/2019-December/393638.html

I'm not talking about the selection of firmware package version. It is
just that the firmware-imx-8.0.bin archive (another typo), extract into
firmware-imx-8.0/, not firmware-imx-7.9/ as the current text shows.

>>>   Build U-Boot
>>>   
>>> diff --git a/board/freescale/imx8mq_evk/README 
>>> b/board/freescale/imx8mq_evk/README
>>> index c1d400bcf9..bbf69c60d8 100644
>>> --- a/board/freescale/imx8mq_evk/README
>>> +++ b/board/freescale/imx8mq_evk/README
>>> @@ -9,19 +9,19 @@ Quick Start
>>>
>>>   Get and Build the ARM Trusted firmware
>>>   ==
>>> -Note: srctree is U-Boot source directory
>>> +Note: builddir is U-Boot build directory (source directory for in-tree 
>>> builds)
>>>   Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
>>>   branch: imx_4.14.62_1.0.0_beta
>>>   $ make PLAT=imx8mq bl31
>>> -$ cp build/imx8mq/release/bl31.bin $(srctree)
>>> +$ cp build/imx8mq/release/bl31.bin $(builddir)
>>>
>>>   Get the ddr and hdmi firmware
>>>   =
>>>   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.9.bin
>>>   $ chmod +x firmware-imx-7.9.bin
>>>   $ ./firmware-imx-7.9.bin
>>> -$ cp firmware-imx-7.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin 
>>> $(srctree)
>>> -$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(srctree)
>>> +$ cp firmware-imx-7.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin 
>>> $(builddir)
>>> +$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir)
>>
>> Same here.

The text here is correct, by the way.

baruch

>>>   Build U-Boot
>>>   
>>> diff --git a/tools/imx8m_image.sh b/tools/imx8m_image.sh
>>> index 603ba6e8f4..4959f9c835 100755
>>> --- a/tools/imx8m_image.sh
>>> +++ b/tools/imx8m_image.sh
>>> @@ -10,41 +10,35 @@ post_process=$2
>>>
>>>   blobs=`awk '/^SIGNED_HDMI/ {print $2} /^LOADER/ {print $2} 
>>> /^SECOND_LOADER/ {print $2} /^DDR_FW/ {print $2}' $file`
>>>   for f in $blobs; do
>>> -   tmp=$srctree/$f
>>> -
>>> if [ $f = "spl/u-boot-spl-ddr.bin" ] || [ $f = "u-boot.itb" ]; then
>>> continue
>>> fi
>>>
>>> if [ -f $f ]; then
>>> continue
>>> -   fi
>>> -
>>> -   if [ ! -f $tmp ]; then
>>> +   else
>>> echo "WARNING '$tmp' not found, resulting binary is 
>>> not-functional" >&2
>>> exit 1
>>> fi
>>> -
>>> 

Re: [PATCH v2 2/4] bootm: Add a bootm command for type IH_OS_EFI

2019-12-11 Thread Cristian Ciocaltea
On Wed, Dec 11, 2019 at 10:57:48AM +0100, Heinrich Schuchardt wrote:
> On 12/11/19 9:54 AM, Cristian Ciocaltea wrote:
> > On Tue, Dec 10, 2019 at 08:32:17PM +0100, Heinrich Schuchardt wrote:
> > > On 12/10/19 9:56 AM, Cristian Ciocaltea wrote:
> > > > Add support for booting EFI binaries contained in FIT images.
> > > > A typical usage scenario is chain-loading GRUB2 in a verified
> > > > boot environment.
> > > > 
> > > > Signed-off-by: Cristian Ciocaltea
> > > 
> > > Reading through the code it looks good. What I really need to do is
> > > analyze the address usage on the sandbox. To me it is unclear if
> > > images->fdt_addr is a physical address or an address in the address
> > > space of the sandbox.
> > > 
> > > Did you test this on the sandbox? You can use
> > > lib/efi_loader/helloworld.efi as a binary and the 'host load hostfs'
> > > command for loading the FIT image.
> > 
> > I only tested on qemu, I've never used the sandbox, so it's a good
> > opportunity to give it a try.
> > 
> > > Shouldn't we add booting a UEFI FIT image to the Python test in
> > > test/py/tests/test_fit.py?
> > 
> > Unfortunately I'm not familiar with the testing framework (including
> > Python scripting), but I'll do my best to add such a test.
> > 
> > > doc/uImage.FIT/signature.txt describes that several properties of the
> > > RSA public key should be stored in the control device tree.
> > > Unfortunately no example is supplied in which format they should be
> > > stored. Could you send me an example, please.
> > > 
> > > I found the following
> > > 
> > > https://github.com/bn121rajesh/ipython-notebooks/blob/master/BehindTheScene/RSAPublicKeyParamsUBoot/rsa_public_key_params_uboot.ipynb
> > > 
> > > Is this an accurate description? Or how do you get the parameters from
> > > your RSA public key?
> > 
> > My test scenario involves the following steps:
> > 
> > 1. Create a public/private key pair
> > $ openssl genpkey -algorithm RSA -out ${DEV_KEY} \
> >  -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
> > 
> > 2. Create a certificate containing the public key
> > $ openssl req -batch -new -x509 -key ${DEV_KEY} -out ${DEV_CRT}
> > 
> > 3. Dump QEMU virt board DTB
> > $ qemu-system-arm -nographic -M virt,dumpdtb=${BOARD_DTB} \
> >  -cpu cortex-a15 -smp 1 -m 512 -bios u-boot.bin [...]
> > 
> > 4. Create (unsigned) FIT image and put the public key into DTB, with
> > the 'required' property set, telling U-Boot that this key MUST be
> > verified for the image to be valid
> > $ mkimage -f ${FIT_ITS} -K ${BOARD_DTB} -k ${KEYS_DIR} -r ${FIT_IMG}
> > 
> > 5. Sign the FIT image
> > $ fit_check_sign -f ${FIT_IMG} -k ${BOARD_DTB}
> > 
> > 6. Run QEMU supplying the DTB containing the public key and the
> > u-boot binary built with CONFIG_OF_BOARD
> > $ qemu-system-arm -nographic \
> >  -M virt -cpu cortex-a15 -smp 1 -m 512 -bios u-boot.bin \
> >  -dtb ${BOARD_DTB} [...]
> > 
> > This is what I get after booting QEMU with the command above:
> > 
> > => fdt addr $fdtcontroladdr
> > => fdt print
> > / {
> >  [...]
> > signature {
> > key-dev {
> > required = "conf";
> > algo = "sha256,rsa2048";
> > rsa,r-squared = * 0x5ef05188 [0x0100];
> > rsa,modulus = * 0x5ef05294 [0x0100];
> > rsa,exponent = <0x 0x00010001>;
> > rsa,n0-inverse = <0x649cd557>;
> > rsa,num-bits = <0x0800>;
> > key-name-hint = "dev";
> > };
> > };
> >  [...]
> 
> See my patch
> 
> doc: fitImage: example of a signature node
> https://lists.denx.de/pipermail/u-boot/2019-December/393613.html
> 
> ---
> 
> Booting of the sandbox fails due to an incorrect address passed for the
> device tree:
> 
> => host load hostfs - $kernel_addr_r image.fit
> 26558 bytes read in 0 ms
> => bootm ${kernel_addr_r}#config-grub-fdt
> ## Loading kernel from FIT Image at 0100 ...
>Using 'config-grub-fdt' configuration
>Verifying Hash Integrity ... OK
>Trying 'helloworld' kernel subimage
>  Description:  Hello World
>  Created:  2019-12-11   9:19:22 UTC
>  Type: Kernel Image (no loading done)
>  Compression:  uncompressed
>  Data Start:   0x01cc
>  Data Size:2733 Bytes = 2.7 KiB
>  Hash algo:sha256
>  Hash value:
> 5c3ba35a1cb4abfe8a867ea6ac709574535794a7d7d03ba1ec2273b956d13983
>Verifying Hash Integrity ... sha256+ OK
>XIP Kernel Image (no loading done)
> ## Loading fdt from FIT Image at 0100 ...
>Using 'config-grub-fdt' configuration
>Verifying Hash Integrity ... OK
>Trying 'fdt-test' fdt subimage
>  Description:  QEMU DTB
>  Created:  2019-12-11   9:19:22 UTC
>  Type: Flat Device Tree
>  Compression:  uncompressed
>  Data Start:   0x01000c74
>  Data Size:19713 Bytes = 19.3 KiB
>  

Re: [U-Boot] [PATCH V3 2/2] core: device: use dev_power_domain_on

2019-12-11 Thread Fabio Estevam
Hi Oliver,

On Tue, Dec 10, 2019 at 11:50 PM Peng Fan  wrote:

> Update your scfw/atf and they try again.

Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Schrempf Frieder
On 11.12.19 15:05, Fabio Estevam wrote:
> Hi Peng,
> 
> On Wed, Dec 11, 2019 at 11:00 AM Peng Fan  wrote:
> 
>> We might need to switch upstream ATF, or stick to NXP vendor release one?
> 
> I don't have much background about the ATF upstream status on i.MX8 to
> provide an opinion.
> 
> Does upstream ATF allow booting a U-Boot and mainline kernel?
> 
> This patch is the minimum change needed for booting mainline U-Boot.
> If someone thinks that ATF upstream is a good choice, then feel free
> to send a patch updating the README.

Just for the record: I am using upstream ATF for my custom i.MX8MM board 
with mainline U-Boot and it just works fine. I didn't run into any 
issues so far and I'm still on ATF revision 3441952f61a6 and haven't 
updated for quite a while.

> 
>> The version should already be in yocto release. I just use the new one when I
>> upstream code.
> 
> Please keep in mind that not everyone uses Yocto.
> 
> How do we know what is the correct firmware version we need to use?
> 

[GIT PULL] Please pull fixes for RPi targeted for v2020.01 release

2019-12-11 Thread Matthias Brugger
Hi Tom,

Please have a look at the fixes below. Basically we fix the rpi_arm64_defconfig
which only showed us 1GiB of RAM if we booted using EFI stub. Apart the 32bit
config of RPi4 was broken, as it missed the second DRAM bank (and therefore saw
only 1 GiB of RAM, even if there was more available).

I run the branch through the gitlab CI, which gave me green light :)

https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi/pipelines/1611

Regards,
Matthias

---
The following changes since commit 520f9559020894950d4e962aba52220c8a1d6bfe:

  Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
(2019-12-09 21:53:23 -0500)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi.git
tags/rpi-next-2020.01.2

for you to fetch changes up to e5167465a1740f0cac05be44f3e2a4e334eb527a:

  ARM: defconfig: Fix 32bit config for RPi4 (2019-12-11 10:14:13 +0100)


- fix DRAM bank detection for unified binary
- fix 32bit RPi4 config


Matthias Brugger (3):
  rpi: fix dram bank initialization
  rpi: Enable DRAM bank initialization on arm64
  ARM: defconfig: Fix 32bit config for RPi4

 board/raspberrypi/rpi/rpi.c | 11 +++
 configs/rpi_4_32b_defconfig |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
Hi Peng,

On Wed, Dec 11, 2019 at 11:09 AM Peng Fan  wrote:

> Not tried. Keep vendor version is fine for now.

If you are happy with this patch, could you please provide your Acked-by?

I would like to keep the README accurate for the upcoming 2020.01 release.

Thanks


Re: [PATCH 1/2] Revert "rockchip: spi: fix off-by-one in chunk size computation"

2019-12-11 Thread Jagan Teki
On Wed, 11 Dec, 2019, 7:10 PM Philipp Tomsich, <
philipp.toms...@theobroma-systems.com> wrote:

>
>
> > On 11.12.2019, at 14:26, Jagan Teki  wrote:
> >
> > The maximum transfer length (in a single transaction) for the Rockchip
> > SPI controller is 64Kframes (i.e. 0x1 frames) of 8bit or 16bit
> > frames and is encoded as (num_frames - 1) in CTRLR1.
> >
> > So the 0x1 is offset value for 64K but the actual size value would
> > be 'minus 1' from 0x1.
>
> NAK. Please see 2 code lines below your change to see that the “minus 1”
> is applied there… so a todo of 0x1 will write 0x to regs->ctrlr1.
>
> The problem must be somewhere else and this patch will only mask the
> underlying issue.
>
> >
> > With the existing code of 0x1 transfer length leads to read
> > failure when we try to read the flash with > 0x1 size like,
> >
> > 1. sf read failure when with > 0x1
> >
> > 2. Boot from SPI flash failed during spi_flash_read call in
> >   common/spl/spl_spi.c
> >
> > Observed and Tested in
> > - Rockpro64 with Gigadevice flash
> > - ROC-RK3399-PC with Winbond flash
> >
> > This reverts commit e647decdd93c7408741329432f26758fbec04c7a.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > drivers/spi/rk_spi.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
> > index c04535ac44..d9a310ce80 100644
> > --- a/drivers/spi/rk_spi.c
> > +++ b/drivers/spi/rk_spi.c
> > @@ -451,7 +451,7 @@ static int rockchip_spi_xfer(struct udevice *dev,
> unsigned int bitlen,
> >
> >   /* This is the original 8bit reader/writer code */
> >   while (len > 0) {
> > - int todo = min(len, 0x1);
> > + int todo = min(len, 0x);
> >
> >   rkspi_enable_chip(regs, false);
> >   writel(todo - 1, >ctrlr1);
> > --
> > 2.18.0.321.gffc6fa0e3
> >
>

I have looked multiple areas but didn't get it so and i belive offset and
size values aren't same.

 Would you please send me the log of sf read to more than 64K on your
hardware? This would confirm my hardware issue if you succeed.

>


RE: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Peng Fan
> Subject: Re: [PATCH] imx8mq_evk: Update the required ATF branch
> 
> Hi Peng,
> 
> On Wed, Dec 11, 2019 at 11:00 AM Peng Fan  wrote:
> 
> > We might need to switch upstream ATF, or stick to NXP vendor release one?
> 
> I don't have much background about the ATF upstream status on i.MX8 to
> provide an opinion.
> 
> Does upstream ATF allow booting a U-Boot and mainline kernel?

Not tried. Keep vendor version is fine for now.

> 
> This patch is the minimum change needed for booting mainline U-Boot.
> If someone thinks that ATF upstream is a good choice, then feel free to send a
> patch updating the README.
> 
> > The version should already be in yocto release. I just use the new one
> > when I upstream code.
> 
> Please keep in mind that not everyone uses Yocto.
> 
> How do we know what is the correct firmware version we need to use?

I need to check with Yocto team, then back.

Thanks,
Peng.


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
Hi Peng,

On Wed, Dec 11, 2019 at 11:00 AM Peng Fan  wrote:

> We might need to switch upstream ATF, or stick to NXP vendor release one?

I don't have much background about the ATF upstream status on i.MX8 to
provide an opinion.

Does upstream ATF allow booting a U-Boot and mainline kernel?

This patch is the minimum change needed for booting mainline U-Boot.
If someone thinks that ATF upstream is a good choice, then feel free
to send a patch updating the README.

> The version should already be in yocto release. I just use the new one when I
> upstream code.

Please keep in mind that not everyone uses Yocto.

How do we know what is the correct firmware version we need to use?


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Adam Ford
On Wed, Dec 11, 2019 at 8:00 AM Peng Fan  wrote:
>
> > Subject: Re: [PATCH] imx8mq_evk: Update the required ATF branch
> >
> > On Wed, Dec 11, 2019 at 7:49 AM Fabio Estevam 
> > wrote:
> > >
> > > Following the README instructions leads to a non-booting
> > > U-Boot:
> > >
> > > U-Boot SPL 2020.01-rc3-00070-g9a0cbae22a (Nov 25 2019 - 13:08:24
> > > -0300)
> > > PMIC:  PFUZE100 ID=0x10
> > > DDRINFO: start DRAM init
> > > DDRINFO:ddrphy calibration done
> > > DDRINFO: ddrmix config done
> > > Normal Boot
> > > Trying to boot from MMC2
> > >
> > > (It hangs here)
> > >
> > > Use the "imx_4.19.35_1.0.0" ATF branch instead, which fixes such
> > > problem and allow the boot to complete again.
>
> We might need to switch upstream ATF, or stick to NXP vendor release one?
> >
> > Shouldn't we address the mix-match of the firmware-imx  versions as well?
> >
> > I just increasing numbers over and over, and I was able to use firmware 8.5
> > which.
> >
> > The readme lists both 7.9 and 8.0.  There is also a typo on the line that 
> > reads
> > "./firmware-imx-8.0" which should have a .bin appended to it.
> >
> > It would nice to know what the differences are between the versions.
>
> The version should already be in yocto release. I just use the new one when I
> upstream code.

Either way, the README file is currently wrong as it sits because it's
pulling one version of firmware and using a different version.

Is there a way to point to the release notes in a static location that
doesn't change with each release?  I don't use Yocto, so I don't
always notice when newer versions are available.

adam
>
> Thanks,
> Peng.
>
> >
> > adam
> > >
> > > Suggested-by: Adam Ford 
> > > Signed-off-by: Fabio Estevam 
> > > ---
> > >  board/freescale/imx8mq_evk/README | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/board/freescale/imx8mq_evk/README
> > > b/board/freescale/imx8mq_evk/README
> > > index c1d400bcf9..4f671b069c 100644
> > > --- a/board/freescale/imx8mq_evk/README
> > > +++ b/board/freescale/imx8mq_evk/README
> > > @@ -11,7 +11,7 @@ Get and Build the ARM Trusted firmware
> > > ==
> > >  Note: srctree is U-Boot source directory  Get ATF from:
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsour
> > >
> > ce.codeaurora.org%2Fexternal%2Fimx%2Fimx-atfdata=02%7C01%7Cp
> > eng.f
> > >
> > an%40nxp.com%7C56fbd5d0b17c4949cc1708d77e41f5c5%7C686ea1d3bc2b
> > 4c6fa92c
> > >
> > d99c5c301635%7C0%7C0%7C637116694069333717sdata=PxZh7ldsxb
> > %2FxZK7c
> > > J5OpJxblskZJkHZHuXvMqGQC5H4%3Dreserved=0
> > > -branch: imx_4.14.62_1.0.0_beta
> > > +branch: imx_4.19.35_1.0.0
> > >  $ make PLAT=imx8mq bl31
> > >  $ cp build/imx8mq/release/bl31.bin $(srctree)
> > >
> > > --
> > > 2.17.1
> > >


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
Hi Adam,

On Wed, Dec 11, 2019 at 10:56 AM Adam Ford  wrote:

> Shouldn't we address the mix-match of the firmware-imx  versions as well?
>
> I just increasing numbers over and over, and I was able to use
> firmware 8.5 which.
>
> The readme lists both 7.9 and 8.0.  There is also a typo on the line
> that reads "./firmware-imx-8.0" which should have a .bin appended to
> it.

This error comes from the imx8mm-evk README. I am patching imx8mq-evk
README instead.

> It would nice to know what the differences are between the versions.

Yes, it is becoming painful to find the exact combination that works.


RE: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Peng Fan
> Subject: Re: [PATCH] imx8mq_evk: Update the required ATF branch
> 
> On Wed, Dec 11, 2019 at 7:49 AM Fabio Estevam 
> wrote:
> >
> > Following the README instructions leads to a non-booting
> > U-Boot:
> >
> > U-Boot SPL 2020.01-rc3-00070-g9a0cbae22a (Nov 25 2019 - 13:08:24
> > -0300)
> > PMIC:  PFUZE100 ID=0x10
> > DDRINFO: start DRAM init
> > DDRINFO:ddrphy calibration done
> > DDRINFO: ddrmix config done
> > Normal Boot
> > Trying to boot from MMC2
> >
> > (It hangs here)
> >
> > Use the "imx_4.19.35_1.0.0" ATF branch instead, which fixes such
> > problem and allow the boot to complete again.

We might need to switch upstream ATF, or stick to NXP vendor release one?
> 
> Shouldn't we address the mix-match of the firmware-imx  versions as well?
> 
> I just increasing numbers over and over, and I was able to use firmware 8.5
> which.
> 
> The readme lists both 7.9 and 8.0.  There is also a typo on the line that 
> reads
> "./firmware-imx-8.0" which should have a .bin appended to it.
> 
> It would nice to know what the differences are between the versions.

The version should already be in yocto release. I just use the new one when I
upstream code.

Thanks,
Peng.

> 
> adam
> >
> > Suggested-by: Adam Ford 
> > Signed-off-by: Fabio Estevam 
> > ---
> >  board/freescale/imx8mq_evk/README | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/board/freescale/imx8mq_evk/README
> > b/board/freescale/imx8mq_evk/README
> > index c1d400bcf9..4f671b069c 100644
> > --- a/board/freescale/imx8mq_evk/README
> > +++ b/board/freescale/imx8mq_evk/README
> > @@ -11,7 +11,7 @@ Get and Build the ARM Trusted firmware
> > ==
> >  Note: srctree is U-Boot source directory  Get ATF from:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsour
> >
> ce.codeaurora.org%2Fexternal%2Fimx%2Fimx-atfdata=02%7C01%7Cp
> eng.f
> >
> an%40nxp.com%7C56fbd5d0b17c4949cc1708d77e41f5c5%7C686ea1d3bc2b
> 4c6fa92c
> >
> d99c5c301635%7C0%7C0%7C637116694069333717sdata=PxZh7ldsxb
> %2FxZK7c
> > J5OpJxblskZJkHZHuXvMqGQC5H4%3Dreserved=0
> > -branch: imx_4.14.62_1.0.0_beta
> > +branch: imx_4.19.35_1.0.0
> >  $ make PLAT=imx8mq bl31
> >  $ cp build/imx8mq/release/bl31.bin $(srctree)
> >
> > --
> > 2.17.1
> >


Re: [PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Adam Ford
On Wed, Dec 11, 2019 at 7:49 AM Fabio Estevam  wrote:
>
> Following the README instructions leads to a non-booting
> U-Boot:
>
> U-Boot SPL 2020.01-rc3-00070-g9a0cbae22a (Nov 25 2019 - 13:08:24 -0300)
> PMIC:  PFUZE100 ID=0x10
> DDRINFO: start DRAM init
> DDRINFO:ddrphy calibration done
> DDRINFO: ddrmix config done
> Normal Boot
> Trying to boot from MMC2
>
> (It hangs here)
>
> Use the "imx_4.19.35_1.0.0" ATF branch instead, which
> fixes such problem and allow the boot to complete again.

Shouldn't we address the mix-match of the firmware-imx  versions as well?

I just increasing numbers over and over, and I was able to use
firmware 8.5 which.

The readme lists both 7.9 and 8.0.  There is also a typo on the line
that reads "./firmware-imx-8.0" which should have a .bin appended to
it.

It would nice to know what the differences are between the versions.

adam
>
> Suggested-by: Adam Ford 
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/imx8mq_evk/README | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/freescale/imx8mq_evk/README 
> b/board/freescale/imx8mq_evk/README
> index c1d400bcf9..4f671b069c 100644
> --- a/board/freescale/imx8mq_evk/README
> +++ b/board/freescale/imx8mq_evk/README
> @@ -11,7 +11,7 @@ Get and Build the ARM Trusted firmware
>  ==
>  Note: srctree is U-Boot source directory
>  Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
> -branch: imx_4.14.62_1.0.0_beta
> +branch: imx_4.19.35_1.0.0
>  $ make PLAT=imx8mq bl31
>  $ cp build/imx8mq/release/bl31.bin $(srctree)
>
> --
> 2.17.1
>


Re: [PATCH 0/2] arm64: zynqmp: Cleanup defconfigs

2019-12-11 Thread Michal Simek
On 10. 12. 19 16:30, Tom Rini wrote:
> On Tue, Dec 10, 2019 at 04:24:09PM +0100, Michal Simek wrote:
>> On 10. 12. 19 14:56, Tom Rini wrote:
>>> On Tue, Dec 10, 2019 at 01:40:42PM +0100, Michal Simek wrote:
 Hi Tom,

 On 09. 12. 19 16:19, Michal Simek wrote:
> Hi,
>
> over years a lot of new Xilinx ZynqMP board have been added to U-Boot with
> corresponding defconfigs. Also a lot of drivers have been moved to DM that
> we can make one generic configuration with one defconfig.
> Nand still needs to be validated that's why dc2/dc3 are not moved yet.
>
> Boards can be build like this:
> export DEVICE_TREE="avnet-ultra96-rev1"
> make xilinx_zynqmp_virt_defconfig
> make -j
>
> Series depends on patches sent before that's why here is full tree:
> https://github.com/michalsimek/u-boot/tree/20191209-mainline

 This series will require some changes in CI loops because right now
 I didn't setup default device tree (CONFIG_DEFAULT_DEVICE_TREE) to
 "force" everybody to properly pass DEVICE_TREE via command line.
 I can't use OF_BOARD because then SPL is built without DT at all.

 How do you think I should handle it for CI loops?
 1. I can remove this configuration but it will be only one at the end
 that's why not a good solution.
 2. Add generic option to run some commands before tests like export
 DEVICE_TREE above
 3. provide different options for SPL/full u-boot how
 OF_SEPARATE/OF_BOARD is handled.
>>>
>>> So, for CI are you wanting to test most device trees, or just one?
>>
>> All zynqmp dtses are built by default.
> 
> Right, but for what I thought you're saying the real use is, you pass
> just a single device tree, right?  If so, do you think we should loop
> over each, or just build one?
> 
>>>  Are
>>> we able to run one of these device trees via QEMU? 
>>
>> zynqmp is covered just by buildman not by pytest. I have this on my todo
>> list for some time but there will be other issues with mainline qemu to
>> do so.
> 
> OK, so something to improve for the future, and after we handle this
> "today" problem.
> 
>>> If we can run the
>>> virt defconfig via qemu, we should just update/extend that stanza in the
>>> CI files to set DEVICE_TREE and exclude building it from the normal
>>> jobs.
>>
>> Based on next generation Xilinx Versal where we use OF_BOARD qemu is
>> generated DT for model self to ensure that only stuff which are emulated
>> are provided to SW. Logic for dt selection is quite simply.
>> https://github.com/Xilinx/u-boot-xlnx/blob/master/arch/arm/mach-versal/cpu.c#L112
>> But Versal is not using SPL and SPL needs initial DT. Also standard
>> Xilinx boot flow on zynq/zynqmp is not using SPL and SPL is community
>> driven effort.
>>
>> At the end of the day I would like to use the same functionality across
>> boards. It means full u-boot should check one fixed location for DT
>> first with priority. For this OF_SEPARATE can be also used because
>> board_fdt_blob_setup can be overwritten for these cases too.
>> https://gitlab.denx.de/u-boot/u-boot/blob/master/lib/fdtdec.c#L1190
>>
>>>  If we can't run via qemu then yes, something like option #2 and
>>> we set DEVICE_TREE in one job and export it if set in the build job.
>>
>> It means for qemu there is no real need to build dts from source tree at
>> all.
>> Let me look at #2 for CI.
> 
> OK, thanks!
> 

I have look at it again and there are other strange things. When you
select CONFIG_SPL_FIT_GENERATOR then there is no reason to generate
u-boot.img (because you want to replace this by your generator) or
append dtb behind u-boot.bin (because default option is already setup in
fit format).

  CAT u-boot-dtb.bin
  MKIMAGE u-boot.img
  MKIMAGE u-boot-dtb.img
  COPYu-boot.bin
  LD  u-boot.elf
  MKIMAGE u-boot.itb



Regarding travis. just c What about just this?

diff --git a/.travis.yml b/.travis.yml
index 5da046ca7ed5..4cef12e18370 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -118,6 +118,9 @@ script:
  # use clang only do one configuration.
  - if [[ "${BUILDMAN}" != "" ]]; then
  ret=0;
+ if [[ "${ENV}" != "" ]]; then
+export eval `echo ${ENV}`;
+ fi;
  tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
tools/buildman/buildman -sdeP ${BUILDMAN};

And then job like this
- name: "buildman ZynqMP Virt"
  env:
- ENV="DEVICE_TREE=zynqmp-zcu100-revC"
- BUILDMAN="xilinx_zynqmp_virt"

Or do you see any smarter way how this can be done?

Thanks,
Michal




[PATCH] imx8mq_evk: Update the required ATF branch

2019-12-11 Thread Fabio Estevam
Following the README instructions leads to a non-booting
U-Boot:

U-Boot SPL 2020.01-rc3-00070-g9a0cbae22a (Nov 25 2019 - 13:08:24 -0300)
PMIC:  PFUZE100 ID=0x10
DDRINFO: start DRAM init
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from MMC2

(It hangs here)

Use the "imx_4.19.35_1.0.0" ATF branch instead, which
fixes such problem and allow the boot to complete again.

Suggested-by: Adam Ford 
Signed-off-by: Fabio Estevam 
---
 board/freescale/imx8mq_evk/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/freescale/imx8mq_evk/README 
b/board/freescale/imx8mq_evk/README
index c1d400bcf9..4f671b069c 100644
--- a/board/freescale/imx8mq_evk/README
+++ b/board/freescale/imx8mq_evk/README
@@ -11,7 +11,7 @@ Get and Build the ARM Trusted firmware
 ==
 Note: srctree is U-Boot source directory
 Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
-branch: imx_4.14.62_1.0.0_beta
+branch: imx_4.19.35_1.0.0
 $ make PLAT=imx8mq bl31
 $ cp build/imx8mq/release/bl31.bin $(srctree)
 
-- 
2.17.1



Re: i.MX8MM-EVK Boot failure

2019-12-11 Thread Fabio Estevam
Hi Adam,

On Wed, Dec 11, 2019 at 9:58 AM Adam Ford  wrote:

> For what it's worth, I went to use the firmware from 7.9 as stated in
> part of the readme (since the README states both 8.0 and 7.9), and I
> used the ATF from 4.19.35_1.1.0, and it booted once I commented out
> the sdhc2 cd-gpio lines.

Thanks for the suggestion. I can boot imx8mq-evk if I use the
imx_4.19.35_1.0.0 ATF branch.

I will send a patch updating the imx8mq-evk README.

Thanks


Re: [PATCH 1/2] Revert "rockchip: spi: fix off-by-one in chunk size computation"

2019-12-11 Thread Philipp Tomsich



> On 11.12.2019, at 14:26, Jagan Teki  wrote:
> 
> The maximum transfer length (in a single transaction) for the Rockchip
> SPI controller is 64Kframes (i.e. 0x1 frames) of 8bit or 16bit
> frames and is encoded as (num_frames - 1) in CTRLR1.
> 
> So the 0x1 is offset value for 64K but the actual size value would
> be 'minus 1' from 0x1.

NAK. Please see 2 code lines below your change to see that the “minus 1”
is applied there… so a todo of 0x1 will write 0x to regs->ctrlr1.

The problem must be somewhere else and this patch will only mask the
underlying issue.

> 
> With the existing code of 0x1 transfer length leads to read
> failure when we try to read the flash with > 0x1 size like,
> 
> 1. sf read failure when with > 0x1
> 
> 2. Boot from SPI flash failed during spi_flash_read call in
>   common/spl/spl_spi.c
> 
> Observed and Tested in
> - Rockpro64 with Gigadevice flash
> - ROC-RK3399-PC with Winbond flash
> 
> This reverts commit e647decdd93c7408741329432f26758fbec04c7a.
> 
> Signed-off-by: Jagan Teki 
> ---
> drivers/spi/rk_spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
> index c04535ac44..d9a310ce80 100644
> --- a/drivers/spi/rk_spi.c
> +++ b/drivers/spi/rk_spi.c
> @@ -451,7 +451,7 @@ static int rockchip_spi_xfer(struct udevice *dev, 
> unsigned int bitlen,
> 
>   /* This is the original 8bit reader/writer code */
>   while (len > 0) {
> - int todo = min(len, 0x1);
> + int todo = min(len, 0x);
> 
>   rkspi_enable_chip(regs, false);
>   writel(todo - 1, >ctrlr1);
> -- 
> 2.18.0.321.gffc6fa0e3
> 



Re: [PATCH] imx: imx8mq: handle ESDHC in mxc_get_clock

2019-12-11 Thread Fabio Estevam
Hi Peng,

On Wed, Dec 11, 2019 at 3:17 AM Peng Fan  wrote:
>
> fsl_esdhc_imx driver will call "mxc_get_clock(MXC_ESDHC_CLK +
> dev->seq)", however mxc_get_clock wrongly handle MXC_ESDHC_CLK
> as root clk and cause sd card could not be detected in U-Boot proper,
> as below:
> "Loading Environment from MMC... unable to select a mode"
>
> Handle MXC_ESDHC_CLK in mxc_get_clock to fix the issue.
>
> Signed-off-by: Peng Fan 

Thanks for the fix:

Tested-by: Fabio Estevam 

Stefano,

This one is a bug fix for 2020.01

Thanks


Re: [PATCH] tools: imx8m_image: Change source path for DDR firmware to build dir

2019-12-11 Thread Schrempf Frieder
Hi Baruch,

On 11.12.19 11:49, Baruch Siach wrote:
> Hi Frieder Schrempf,
> 
> On Wed, Dec 11 2019, Schrempf Frieder wrote:
> 
>> From: Frieder Schrempf 
>>
>> The DDR firmware binaries are not part of the U-Boot source code, so
>> we should look for them in the build directory, where they need to be
>> copied to before building U-Boot.
>>
>> The ATF binary is already fetched from the build directory, but the
>> README files for the i.MX8M EVKs claim that it needs to be copied to
>> the source directory (which is still true for in-tree builds, but not
>> in general). Therefore we also fix the READMEs to use the build
>> directory as the correct location for all additional binary files.
>>
>> Sined-off-by: Frieder Schrempf 
>> ---
>>   board/freescale/imx8mm_evk/README |  6 +++---
>>   board/freescale/imx8mq_evk/README |  8 
>>   tools/imx8m_image.sh  | 28 +++-
>>   3 files changed, 18 insertions(+), 24 deletions(-)
>>
>> diff --git a/board/freescale/imx8mm_evk/README 
>> b/board/freescale/imx8mm_evk/README
>> index a885bc5c97..c908c0adc4 100644
>> --- a/board/freescale/imx8mm_evk/README
>> +++ b/board/freescale/imx8mm_evk/README
>> @@ -9,18 +9,18 @@ Quick Start
>>   
>>   Get and Build the ARM Trusted firmware
>>   ==
>> -Note: srctree is U-Boot source directory
>> +Note: builddir is U-Boot build directory (source directory for in-tree 
>> builds)
>>   Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
>>   branch: imx_4.19.35_1.0.0
>>   $ make PLAT=imx8mm bl31
>> -$ cp build/imx8mm/release/bl31.bin $(srctree)
>> +$ cp build/imx8mm/release/bl31.bin $(builddir)
>>   
>>   Get the ddr and hdmi firmware
>>   =
>>   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.0.bin
>>   $ chmod +x firmware-imx-8.0.bin
>>   $ ./firmware-imx-8.0
>> -$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(srctree)
>> +$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir)
> 
> You might want to take the opportunity to fix the firmware directory
> name as well.

I will leave this to someone who knows more about this and once someone 
has decided which version of the firmware should actually be used.
Personally I have used 7.8 (from Yocto Warrior release) and 8.1 (from 
Yocto Zeus release) with my custom i.MX8MM board so far.

The discussion about this is currently also going on here: 
https://lists.denx.de/pipermail/u-boot/2019-December/393638.html

Thanks,
Frieder

> 
>>   
>>   Build U-Boot
>>   
>> diff --git a/board/freescale/imx8mq_evk/README 
>> b/board/freescale/imx8mq_evk/README
>> index c1d400bcf9..bbf69c60d8 100644
>> --- a/board/freescale/imx8mq_evk/README
>> +++ b/board/freescale/imx8mq_evk/README
>> @@ -9,19 +9,19 @@ Quick Start
>>   
>>   Get and Build the ARM Trusted firmware
>>   ==
>> -Note: srctree is U-Boot source directory
>> +Note: builddir is U-Boot build directory (source directory for in-tree 
>> builds)
>>   Get ATF from: https://source.codeaurora.org/external/imx/imx-atf
>>   branch: imx_4.14.62_1.0.0_beta
>>   $ make PLAT=imx8mq bl31
>> -$ cp build/imx8mq/release/bl31.bin $(srctree)
>> +$ cp build/imx8mq/release/bl31.bin $(builddir)
>>   
>>   Get the ddr and hdmi firmware
>>   =
>>   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.9.bin
>>   $ chmod +x firmware-imx-7.9.bin
>>   $ ./firmware-imx-7.9.bin
>> -$ cp firmware-imx-7.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $(srctree)
>> -$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(srctree)
>> +$ cp firmware-imx-7.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin 
>> $(builddir)
>> +$ cp firmware-imx-7.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir)
> 
> Same here.
> 
> baruch
> 
>>   Build U-Boot
>>   
>> diff --git a/tools/imx8m_image.sh b/tools/imx8m_image.sh
>> index 603ba6e8f4..4959f9c835 100755
>> --- a/tools/imx8m_image.sh
>> +++ b/tools/imx8m_image.sh
>> @@ -10,41 +10,35 @@ post_process=$2
>>   
>>   blobs=`awk '/^SIGNED_HDMI/ {print $2} /^LOADER/ {print $2} 
>> /^SECOND_LOADER/ {print $2} /^DDR_FW/ {print $2}' $file`
>>   for f in $blobs; do
>> -tmp=$srctree/$f
>> -
>>  if [ $f = "spl/u-boot-spl-ddr.bin" ] || [ $f = "u-boot.itb" ]; then
>>  continue
>>  fi
>>   
>>  if [ -f $f ]; then
>>  continue
>> -fi
>> -
>> -if [ ! -f $tmp ]; then
>> +else
>>  echo "WARNING '$tmp' not found, resulting binary is 
>> not-functional" >&2
>>  exit 1
>>  fi
>> -
>> -sed -in "s;$f;$tmp;" $file
>>   done
>>   
>>   if [ $post_process = 1 ]; then
>> -if [ -f $srctree/lpddr4_pmu_train_1d_imem.bin ]; then
>> -objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 
>> $srctree/lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_imem_pad.bin
>> -objcopy -I binary -O binary --pad-to 0x4000 

[PATCH] spi: ti_qspi: Add support for CS other than CS0

2019-12-11 Thread Vignesh Raghavendra
Make sure corresponding setup registers are updated depending on CS.
This ensures that driver can support QSPI flashes on ChipSelects other
than on CS0

Reported-by: Andreas Dannenberg 
Signed-off-by: Vignesh Raghavendra 
---
 drivers/spi/ti_qspi.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index c3d9e7f2ee0c..664b9cad79d9 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -60,6 +60,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #define QSPI_SETUP0_ADDR_SHIFT (8)
 #define QSPI_SETUP0_DBITS_SHIFT(10)
 
+#define TI_QSPI_SETUP_REG(priv, cs)(&(priv)->base->setup0 + (cs))
+
 /* ti qspi register set */
 struct ti_qspi_regs {
u32 pid;
@@ -275,8 +277,8 @@ static void ti_qspi_copy_mmap(void *data, void *offset, 
size_t len)
*((unsigned int *)offset) += len;
 }
 
-static void ti_qspi_setup_mmap_read(struct ti_qspi_priv *priv, u8 opcode,
-   u8 data_nbits, u8 addr_width,
+static void ti_qspi_setup_mmap_read(struct ti_qspi_priv *priv, int cs,
+   u8 opcode, u8 data_nbits, u8 addr_width,
u8 dummy_bytes)
 {
u32 memval = opcode;
@@ -296,7 +298,7 @@ static void ti_qspi_setup_mmap_read(struct ti_qspi_priv 
*priv, u8 opcode,
memval |= ((addr_width - 1) << QSPI_SETUP0_ADDR_SHIFT |
   dummy_bytes << QSPI_SETUP0_DBITS_SHIFT);
 
-   writel(memval, >base->setup0);
+   writel(memval, TI_QSPI_SETUP_REG(priv, cs));
 }
 
 static int ti_qspi_set_mode(struct udevice *bus, uint mode)
@@ -317,13 +319,15 @@ static int ti_qspi_set_mode(struct udevice *bus, uint 
mode)
 static int ti_qspi_exec_mem_op(struct spi_slave *slave,
   const struct spi_mem_op *op)
 {
+   struct dm_spi_slave_platdata *slave_plat;
struct ti_qspi_priv *priv;
struct udevice *bus;
+   u32 from = 0;
+   int ret = 0;
 
bus = slave->dev->parent;
priv = dev_get_priv(bus);
-   u32 from = 0;
-   int ret = 0;
+   slave_plat = dev_get_parent_platdata(slave->dev);
 
/* Only optimize read path. */
if (!op->data.nbytes || op->data.dir != SPI_MEM_DATA_IN ||
@@ -335,8 +339,9 @@ static int ti_qspi_exec_mem_op(struct spi_slave *slave,
if (from + op->data.nbytes > priv->mmap_size)
return -ENOTSUPP;
 
-   ti_qspi_setup_mmap_read(priv, op->cmd.opcode, op->data.buswidth,
-   op->addr.nbytes, op->dummy.nbytes);
+   ti_qspi_setup_mmap_read(priv, slave_plat->cs, op->cmd.opcode,
+   op->data.buswidth, op->addr.nbytes,
+   op->dummy.nbytes);
 
ti_qspi_copy_mmap((void *)op->data.buf.in,
  (void *)priv->memory_map + from, op->data.nbytes);
@@ -390,7 +395,7 @@ static int ti_qspi_release_bus(struct udevice *dev)
writel(0, >base->dc);
writel(0, >base->cmd);
writel(0, >base->data);
-   writel(0, >base->setup0);
+   writel(0, TI_QSPI_SETUP_REG(priv, slave_plat->cs));
 
return 0;
 }
-- 
2.24.0



[PATCH 2/2] spi: rk_spi: Fix overflow max chunk size

2019-12-11 Thread Jagan Teki
The max chunk size (in a single transaction) for the Rockchip
SPI controller is 64Kframes (i.e. 0x1 frames) of 8bit or 16bit
frames and is encoded as (num_frames - 1) in CTRLR1.

So the 0x1 is offset value for 64K but the actual size value would
be 'minus 1' from 0x1.

With the existing code of 0x1 max chunk size leads to read
failure when we try to read the flash with > 0x1 size like,

1. sf read failure when with > 0x1

2. Boot from SPI flash failed during spi_flash_read call in
   common/spl/spl_spi.c

Observed and Tested in
- Rockpro64 with Gigadevice flash
- ROC-RK3399-PC with Winbond flash

Signed-off-by: Jagan Teki 
---
 drivers/spi/rk_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index d9a310ce80..6059f2415a 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -367,7 +367,7 @@ static inline int rockchip_spi_16bit_reader(struct udevice 
*dev,
 * represented in CTRLR1.
 */
if (data && data->master_manages_fifo)
-   max_chunk_size = 0x1;
+   max_chunk_size = 0x;
 
// rockchip_spi_configure(dev, mode, size)
rkspi_enable_chip(regs, false);
-- 
2.18.0.321.gffc6fa0e3



[PATCH 0/2] spi: rk_spi: Fix transfer size overflow

2019-12-11 Thread Jagan Teki
These two patches are fixing flash read with > 64K size and
spi flash read during SPI boot.

Any inputs?
Jagan.

Jagan Teki (2):
  Revert "rockchip: spi: fix off-by-one in chunk size computation"
  spi: rk_spi: Fix overflow max chunk size

 drivers/spi/rk_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.18.0.321.gffc6fa0e3



[PATCH 1/2] Revert "rockchip: spi: fix off-by-one in chunk size computation"

2019-12-11 Thread Jagan Teki
The maximum transfer length (in a single transaction) for the Rockchip
SPI controller is 64Kframes (i.e. 0x1 frames) of 8bit or 16bit
frames and is encoded as (num_frames - 1) in CTRLR1.

So the 0x1 is offset value for 64K but the actual size value would
be 'minus 1' from 0x1.

With the existing code of 0x1 transfer length leads to read
failure when we try to read the flash with > 0x1 size like,

1. sf read failure when with > 0x1

2. Boot from SPI flash failed during spi_flash_read call in
   common/spl/spl_spi.c

Observed and Tested in
- Rockpro64 with Gigadevice flash
- ROC-RK3399-PC with Winbond flash

This reverts commit e647decdd93c7408741329432f26758fbec04c7a.

Signed-off-by: Jagan Teki 
---
 drivers/spi/rk_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index c04535ac44..d9a310ce80 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -451,7 +451,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
 
/* This is the original 8bit reader/writer code */
while (len > 0) {
-   int todo = min(len, 0x1);
+   int todo = min(len, 0x);
 
rkspi_enable_chip(regs, false);
writel(todo - 1, >ctrlr1);
-- 
2.18.0.321.gffc6fa0e3



Re: [EXT] Re: [PATCH 0/8] Transition of fsl qspi driver to spi-mem framework

2019-12-11 Thread Schrempf Frieder
Hi Kuldeep,

On 11.12.19 13:23, Kuldeep Singh wrote:
> Hi Frieder,
[...]
>>> Patch 2 adds new qspi driver incorporating spi-mem framework which
>>> is ported version of linux qspi driver. Initial port was done by 
>>> Frieder.
>>> Now, no more direct access to spi-nor memory is possible. Few
>>> changes were introduced to prevent uboot crash such as to add
>>> complete flash size to SFA1AD, SFA2AD, SFB1AD, SFB2AD based on
>>> chip select number instead of 1k. Immediate effect was observed on
>>> pfe while using 1k size as it access spi-nor memory directly.
>>> Using complete flash size resolves
>> the crash but data read will not be valid.
>>
>> Can you provide more information about the problem/crash you
>> experience and the platform you are working on?
>
> I observed crash on LS1012. Also, any access to flash direct memory
> above
 1k will crash without this change.

 As I already told Ashish in the conversation referenced in my last mail:
 I can't see any good reason why the direct memory access is something
 that we need or should support. We should always use the APIs
 provided by U-Boot to access the flash and that is mtd.

> By adding this, crash will be resolved but data is invalid as
> mentioned in
 patch-set.

 So what's the purpose of your changes at all, if they do not solve
 the problem you're trying to solve?
>>>
>>> I observed booting crash on all ls1012 platforms. Control does not reach
>> even end of uboot prompt.
>>> I dig in deeper, and found that "pfe (packet forwarding engine)" was using
>> spi-nor memory directly.
>>> With this change, booting crash was resolved. Now, at least other network
>> interfaces can be used.
>>> Without this changes, I have to disable pfe on adhoc basis so as to get 
>>> uboot
>> prompt.
>>> This is to make sure all intended qspi targets are booting.
>>
>> Ok, thanks for pointing out the PFE driver. I didn't know about such a
>> peripheral. So this seems to be the actual problem here.
>>
>> I don't really understand, why Ashish didn't mention this when we were 
>> talking
>> about this issue some weeks ago.
>>
>>>
 Why don't you just use sf/mtd to access the flash?
>>>
>>> Pfe framework have to bring in changes to access flash using sf in uboot.
>>
>> Yes and that's something that should be done first instead of hacking the 
>> QSPI
>> controller driver. It shouldn't be too hard to modify the PFE driver so that 
>> it
>> uses the serial flash API (spi_flash_read()) to access the SPI NOR.
>> Can you try to come up with a patch for the PFE driver?
> 
> I have sent out PFE driver patch upstream[1] and booting crash is now 
> resolved.

Ok, good.

> 
> Moreover, After using 1k size, I faced a random crash in environment which 
> was resolved after enabling SYS_RELOC_GD_ENV_ADDR in defconfig.
> I am not sure why this needed when setting 1k size? Note that, same is not 
> required if I use my previous implementation.

SYS_RELOC_GD_ENV_ADDR was only introduced very recently and it seems 
like it should be enabled for your boards (see [1]) when using something 
more recent than 8d8ee47e03ef.

My guess would be that you're missing the 
"CONFIG_SYS_RELOC_GD_ENV_ADDR=y" because of some mistake while rebasing 
or merging .

> 
> Now, I found a new bug while testing read functionality in LS1012A, LS1046A 
> on commit "4b19b89ca4a8".
> I cannot access memory above 16MB. For example, when I try to access 16M, 
> data read is actually from 0x0 offset.
> Could you please share your views on this behavior.

This is usually a problem if the addressing mode for the SPI NOR is 
incorrect. When using 2-bytes addresses, only the first 16MiB of the 
flash can be accessed. For SPI NOR flashes with sizes bigger than 16MiB, 
3-byte mode is mandatory to access areas above 16MiB.

What's the manufacturer and type of the SPI flash you are using?
Also please try to test on latest master with all the latest changes for 
MTD, etc.

Thanks,
Frieder

[1] 
https://gitlab.denx.de/u-boot/u-boot/commit/8d8ee47e03ef23b0d0e842ea455a30bf0d2023b9

> 
> --Kuldeep
>>
>>>
>>> Thanks
>>> Kuldeep
>>>

>
>> Are you referring to the same issue as Ashish in this discussion here 
>> [1]?
>
> Yes, I had a discussion with him.
>
>> There are two reasons why I'd like to avoid using the whole memory
>> mapped area for AHB access.
>> First, I'd like to keep the U-Boot driver as close as possible to
>> the Linux
 driver.
>> Second, the intention of the spi-mem layer is to abstract the flash
>> layer and therefore this driver should work independently of flash
>> type or
 size.
>
> Boot from QSPI-NAND will still not be possible. Code in bootROM is
> only to
 access QSPI-NOR.

 It will not be possible to use SPI NAND directly from the BootROM,
 but you can just load the bootloader from a different device 

Re: [PATCH v2] drivers: net: fsl_enetc: Pass on primary MAC address to Linux

2019-12-11 Thread Michael Walle

Am 2019-12-11 14:04, schrieb Alexandru Marginean:

On 12/10/2019 11:47 PM, Michael Walle wrote:

Am 2019-12-10 15:55, schrieb Alex Marginean:
Passes on the primary address used by u-boot to Linux.  The code does 
a DT
fix-up for ENETC PFs and sets the primary MAC address in IERB.  The 
address

in IERB is restored on ENETC PCI functions at FLR.



I don't get the reason why this is done in a proprietary way. What is 
the
difference between any other network interface whose hardware address 
is

set up in the generic u-boot code.


By proprietary do you mean IERB?


I meant the fdt fixups for mac-address/local-mac-address which is not
handled in the generic u-boot code, see my previous mail.

Because if it would, then there would be no need for the board specific
code below (just the one function call actually).


Network cards normally have a ROM which comes preset from the factory
with default MAC addresses.  At run-time drivers can use the default
address or replace it.  The MAC address in IERB is the default MAC
address for ENETC interfaces at run-time, this address is available to
the driver/stack after issuing an FLR and in the absence of a DT node
for the PCI function.
We can pass MAC addresses to Linux through DT alone, but that's more
of a hassle if Linux decides to assign the PCI function to a guest or
user-space app.  Using the IERB values doesn't require any fix-up for
guest DTs.


Understood.


IERB is not actually a ROM though and we need U-Boot to set factory
MAC addresses into IERB some time before Linux boots.


Also, shouldn't write_hwaddr callback be implemented instead of the
enetc_set_ierb_primary_mac()?


OK, makes sense, I will move the code there.



-michael


  1   2   >