[PATCH 0/4] common: Drop remaining includes in common.h (part A)

2020-10-30 Thread Simon Glass
This series continues the removal of include files in the common.h header.


Simon Glass (4):
  common: Drop asm/global_data.h from common header
  common: Drop display_options.h from common header
  common: Drop linux/printk.h from common header
  Fix code style for time functions

 arch/arc/lib/bootm.c  |   1 +
 arch/arc/lib/cache.c  |   1 +
 arch/arc/lib/cpu.c|   1 +
 arch/arc/lib/relocate.c   |   1 +
 arch/arm/cpu/arm1136/mx35/generic.c   |   1 +
 arch/arm/cpu/arm920t/imx/timer.c  |   2 +-
 arch/arm/cpu/arm926ejs/armada100/dram.c   |   1 +
 arch/arm/cpu/arm926ejs/armada100/timer.c  |   1 +
 arch/arm/cpu/arm926ejs/mx25/generic.c |   1 +
 arch/arm/cpu/arm926ejs/mx27/timer.c   |   1 +
 arch/arm/cpu/arm926ejs/mxs/mxs.c  |   1 +
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c |   1 +
 arch/arm/cpu/arm926ejs/mxs/timer.c|   1 +
 arch/arm/cpu/arm926ejs/spear/spr_misc.c   |   1 +
 arch/arm/cpu/arm926ejs/spear/timer.c  |   1 +
 arch/arm/cpu/armv7/arch_timer.c   |   1 +
 arch/arm/cpu/armv7/ls102xa/clock.c|   1 +
 arch/arm/cpu/armv7/ls102xa/cpu.c  |   1 +
 arch/arm/cpu/armv7/ls102xa/fdt.c  |   1 +
 arch/arm/cpu/armv7/ls102xa/timer.c|   1 +
 arch/arm/cpu/armv7/s5p-common/cpu_info.c  |   2 +
 arch/arm/cpu/armv7/s5p-common/timer.c |   1 +
 arch/arm/cpu/armv7/s5p4418/cpu.c  |   1 +
 arch/arm/cpu/armv7/stv0991/timer.c|   1 +
 arch/arm/cpu/armv7/sunxi/timer.c  |   1 +
 arch/arm/cpu/armv7/vf610/generic.c|   1 +
 arch/arm/cpu/armv7/vf610/timer.c  |   1 +
 arch/arm/cpu/armv7m/systick-timer.c   |   1 +
 arch/arm/cpu/armv8/cache_v8.c |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c   |   1 +
 .../armv8/fsl-layerscape/fsl_lsch2_speed.c|   1 +
 .../armv8/fsl-layerscape/fsl_lsch3_speed.c|   1 +
 arch/arm/cpu/armv8/fsl-layerscape/mp.c|   1 +
 arch/arm/cpu/armv8/fsl-layerscape/ppa.c   |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   |   1 +
 arch/arm/cpu/armv8/generic_timer.c|   1 +
 arch/arm/cpu/armv8/s32v234/generic.c  |   1 +
 arch/arm/cpu/armv8/sec_firmware.c |   1 +
 arch/arm/cpu/sa1100/timer.c   |   2 +-
 arch/arm/include/asm/arch-rockchip/clock.h|   2 +
 arch/arm/include/asm/arch-tegra/clock.h   |   2 +
 arch/arm/include/asm/arch-tegra/tegra_i2c.h   |   2 +
 arch/arm/include/asm/global_data.h|   3 +
 arch/arm/include/asm/mach-imx/video.h |   4 +-
 arch/arm/include/asm/secure.h |   1 +
 arch/arm/include/asm/spl.h|   1 +
 arch/arm/include/asm/string.h |   2 -
 arch/arm/include/asm/ti-common/sys_proto.h|   2 +
 arch/arm/lib/bdinfo.c |   1 +
 arch/arm/lib/bootm-fdt.c  |   1 +
 arch/arm/lib/bootm.c  |   1 +
 arch/arm/lib/cache-cp15.c |   1 +
 arch/arm/lib/cache.c  |   1 +
 arch/arm/lib/gic-v3-its.c |   1 +
 arch/arm/lib/image.c  |   1 +
 arch/arm/lib/interrupts.c |   1 +
 arch/arm/lib/interrupts_64.c  |   1 +
 arch/arm/lib/spl.c|   1 +
 arch/arm/lib/stack.c  |   1 +
 arch/arm/mach-aspeed/ast2500/board_common.c   |   1 +
 arch/arm/mach-at91/arm920t/clock.c|   1 +
 arch/arm/mach-at91/arm920t/timer.c|   1 +
 arch/arm/mach-at91/arm926ejs/clock.c  |   1 +
 arch/arm/mach-at91/arm926ejs/eflash.c |   1 +
 arch/arm/mach-at91/arm926ejs/timer.c  |   1 +
 arch/arm/mach-at91/armv7/clock.c  |   1 +
 arch/arm/mach-at91/armv7/timer.c  |   1 +
 arch/arm/mach-at91/spl_at91.c |   1 +
 arch/arm/mach-bcm283x/init.c  |   1 +
 arch/arm/mach-davinci/cpu.c   |   1 +
 arch/arm/mach-davinci/misc.c  |   1 +
 arch/arm/mach-davinci/timer.c |   1 +
 arch/arm/mach-exynos/spl_boot.c   |   1 +
 arch/arm/mach-imx/hab.c   |   1 +
 arch/arm/mach-imx/imx8/ahab.c |   1 +
 arch/arm/mach-imx/imx8/clock.c|   1 +
 arch/arm/mach-imx/imx8/cpu.c  |   1 +
 arch/arm/mach-imx/imx8/fdt.c  |   2 +
 arch/arm/mach-imx/imx8/iomux.c|   1 +
 arch/arm/mach-imx/imx8/snvs_security_sc.c |   1 +
 arch/arm/mach-imx/imx8m/clock_imx8mm.c|   1 +
 arch/arm/mach-imx/imx8m/soc.c |   1 +
 arch/arm/mach-imx/misc.c  |   1 +
 arch/arm/mach-imx/mx5/mx53_dram.c |   1 +
 arch/arm/mach-imx/mx6/litesom.c   |   1 +
 arch/arm/mach-imx/mx6/opos6ul.c 

[PATCH 2/4] common: Drop display_options.h from common header

2020-10-30 Thread Simon Glass
Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/armv7/s5p-common/cpu_info.c  | 1 +
 arch/arm/mach-at91/arm926ejs/eflash.c | 1 +
 arch/arm/mach-imx/hab.c   | 1 +
 arch/powerpc/cpu/mpc85xx/cpu.c| 1 +
 arch/powerpc/cpu/mpc85xx/cpu_init.c   | 1 +
 arch/powerpc/cpu/mpc85xx/tlb.c| 1 +
 arch/powerpc/cpu/mpc86xx/cpu.c| 1 +
 arch/powerpc/cpu/mpc8xx/cpu.c | 1 +
 arch/powerpc/cpu/mpc8xxx/law.c| 1 +
 arch/x86/cpu/broadwell/refcode.c  | 1 +
 board/corscience/tricorder/tricorder-eeprom.c | 1 +
 board/freescale/ls1028a/ls1028a.c | 1 +
 board/freescale/ls1088a/ls1088a.c | 1 +
 board/freescale/ls2080a/ls2080a.c | 1 +
 board/freescale/ls2080aqds/ls2080aqds.c   | 1 +
 board/freescale/ls2080ardb/ls2080ardb.c   | 1 +
 board/freescale/lx2160a/lx2160a.c | 1 +
 board/freescale/mpc8541cds/mpc8541cds.c   | 1 +
 board/freescale/mpc8548cds/mpc8548cds.c   | 1 +
 board/freescale/mpc8555cds/mpc8555cds.c   | 1 +
 board/freescale/mpc8568mds/mpc8568mds.c   | 1 +
 board/gdsys/p1022/controlcenterd-id.c | 1 +
 board/kontron/sl28/sl28.c | 1 +
 board/kosagi/novena/novena.c  | 1 +
 board/sbc8548/sbc8548.c   | 1 +
 cmd/acpi.c| 1 +
 cmd/axi.c | 1 +
 cmd/bcb.c | 1 +
 cmd/cpu.c | 1 +
 cmd/fpgad.c   | 1 +
 cmd/io.c  | 1 +
 cmd/mem.c | 1 +
 cmd/mmc.c | 1 +
 cmd/rtc.c | 1 +
 cmd/sf.c  | 1 +
 cmd/version.c | 1 +
 common/bloblist.c | 1 +
 common/board_f.c  | 1 +
 common/board_r.c  | 1 +
 common/console.c  | 1 +
 common/image.c| 1 +
 common/splash.c   | 1 +
 drivers/core/acpi.c   | 1 +
 drivers/cpu/bmips_cpu.c   | 1 +
 drivers/ddr/fsl/main.c| 1 +
 drivers/mmc/gen_atmel_mci.c   | 1 +
 drivers/mtd/onenand/onenand_uboot.c   | 1 +
 drivers/mtd/spi/sf_dataflash.c| 1 +
 drivers/mtd/spi/spi-nor-core.c| 1 +
 drivers/net/xilinx_axi_emac.c | 1 +
 drivers/tpm/tpm_atmel_twi.c   | 1 +
 drivers/tpm/tpm_tis_sandbox.c | 1 +
 drivers/usb/gadget/pxa27x_udc.c   | 1 +
 drivers/xen/gnttab.c  | 1 +
 fs/fs.c   | 1 +
 include/common.h  | 1 -
 include/display_options.h | 1 +
 include/fsl_qe.h  | 2 ++
 lib/aes.c | 1 +
 lib/display_options.c | 1 +
 lib/fdtdec.c  | 1 +
 net/nfs.c | 1 +
 net/tftp.c| 1 +
 63 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/s5p-common/cpu_info.c 
b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
index d910282e2b2..fb2920950d4 100644
--- a/arch/arm/cpu/armv7/s5p-common/cpu_info.c
+++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
@@ -4,6 +4,7 @@
  * Minkyu Kang 
  */
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-at91/arm926ejs/eflash.c 
b/arch/arm/mach-at91/arm926ejs/eflash.c
index 23c24936edf..ef579e6089c 100644
--- a/arch/arm/mach-at91/arm926ejs/eflash.c
+++ b/arch/arm/mach-at91/arm926ejs/eflash.c
@@ -43,6 +43,7 @@
  * do a read-modify-write for partially programmed pages
  */
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index d0757d8b66a..7510735bf46 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 5170610f041..d35c9780172 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index e0f0f7ecda6..fcc2c7be31a 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -10,6 +10,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 

[PATCH 4/4] Fix code style for time functions

2020-10-30 Thread Simon Glass
Fix the code style used for some time functions.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm920t/imx/timer.c |  2 +-
 arch/arm/cpu/sa1100/timer.c  |  2 +-
 arch/microblaze/cpu/timer.c  |  2 +-
 arch/powerpc/lib/interrupts.c|  2 +-
 arch/powerpc/lib/time.c  |  5 +++--
 board/armltd/integrator/timer.c  |  2 +-
 drivers/fpga/ACEX1K.c|  4 ++--
 drivers/fpga/spartan2.c  | 24 
 drivers/fpga/spartan3.c  | 24 
 drivers/net/lan91c96.c   |  4 ++--
 drivers/net/ne2000_base.c|  4 ++--
 drivers/net/smc9.c   |  4 ++--
 post/drivers/rtc.c   |  4 ++--
 13 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index e9d55779214..b559db75f12 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -44,7 +44,7 @@ static ulong get_timer_masked (void)
return TCN1;
 }
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
return get_timer_masked() - base;
 }
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index a5cdaf5a66c..5d597dd1ab4 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -19,7 +19,7 @@ static ulong get_timer_masked (void)
return OSCR;
 }
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
return get_timer_masked ();
 }
diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index 647bdcd5ba5..05ab0e1b157 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
 volatile int timestamp = 0;
 microblaze_timer_t *tmr;
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
if (tmr)
return timestamp - base;
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index 73f270002cf..bda0999327d 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -89,7 +89,7 @@ void timer_interrupt(struct pt_regs *regs)
 #endif /* CONFIG_LED_STATUS */
 }
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
return (timestamp - base);
 }
diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c
index 8d6babfb83d..d27432c23af 100644
--- a/arch/powerpc/lib/time.c
+++ b/arch/powerpc/lib/time.c
@@ -39,8 +39,9 @@ unsigned long usec2ticks(unsigned long usec)
  */
 void __udelay(unsigned long usec)
 {
-   ulong ticks = usec2ticks (usec);
-   wait_ticks (ticks);
+   ulong ticks = usec2ticks(usec);
+
+   wait_ticks(ticks);
 }
 
 /* - */
diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c
index d220b877d66..53d1c0ec303 100644
--- a/board/armltd/integrator/timer.c
+++ b/board/armltd/integrator/timer.c
@@ -119,7 +119,7 @@ static ulong get_timer_masked (void)
return timestamp;
 }
 
-ulong get_timer (ulong base_ticks)
+ulong get_timer(ulong base_ticks)
 {
return get_timer_masked () - base_ticks;
 }
diff --git a/drivers/fpga/ACEX1K.c b/drivers/fpga/ACEX1K.c
index aca8049c56a..30a3727433e 100644
--- a/drivers/fpga/ACEX1K.c
+++ b/drivers/fpga/ACEX1K.c
@@ -140,10 +140,10 @@ static int ACEX1K_ps_load(Altera_desc *desc, const void 
*buf, size_t bsize)
udelay(2);  /* T_cf2st1 < 4us   */
 
/* Wait for nSTATUS to be released (i.e. deasserted) */
-   ts = get_timer (0); /* get current time */
+   ts = get_timer(0);  /* get current time */
do {
CONFIG_FPGA_DELAY ();
-   if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {/* 
check the time */
+   if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { /* 
check the time */
puts ("** Timeout waiting for STATUS to go 
high.\n");
(*fn->abort) (cookie);
return FPGA_FAIL;
diff --git a/drivers/fpga/spartan2.c b/drivers/fpga/spartan2.c
index 3435400e58b..fae94f9663a 100644
--- a/drivers/fpga/spartan2.c
+++ b/drivers/fpga/spartan2.c
@@ -151,11 +151,11 @@ static int spartan2_sp_load(xilinx_desc *desc, const void 
*buf, size_t bsize)
CONFIG_FPGA_DELAY ();
(*fn->pgm) (false, true, cookie);   /* Deassert the 
program, commit */
 
-   ts = get_timer (0); /* get current time */
+   ts = get_timer(0);  /* get current time */
/* Now wait for INIT and BUSY to go high */
do {
CONFIG_FPGA_DELAY ();
-   if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {/* 
check the time */
+   if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { /* 
check the time */

Re: Please pull u-boot-dm

2020-10-30 Thread Tom Rini
On Fri, Oct 30, 2020 at 01:13:04PM -0600, Simon Glass wrote:

> Hi Tom,
> 
> https://gitlab.denx.de/u-boot/custodians/u-boot-dm/-/commits/master
> https://travis-ci.com/github/sjg20/u-boot/builds/196409920
> https://dev.azure.com/simon0972/u-boot/_build?definitionId=1
> 
> 
> The following changes since commit cdeb7b8f984e6d9bcdc5a6fdda6107af156d47bf:
> 
>   configs: Resync with savedefconfig (2020-10-29 10:48:01 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-dm.git tags/dm-pull-30oct20
> 
> for you to fetch changes up to 2424057b2ad0eacdd2d81e35e7bea5df97802b8f:
> 
>   binman: Avoid calculated section data repeatedly (2020-10-29 14:42:59 -0600)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Pull request: u-boot-rockchip-20201031

2020-10-30 Thread Kever Yang
Hi Tom,

Please pull the rockchip updates/fixes:
- New PX30 board: Engicam PX30.Core;
- Fix USB HID support for rock960;
- Remove host endianness dependency for rockchip mkimage;
- dts update for rk3288-tinker;
- Enable console MUX for some ROCKPi boards;
- Add config-based ddr selection for px30;

Gitlab ci:
https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip/pipelines/5202

Thanks,
- Kever

The following changes since commit a58d86db46456c4e14d4d140e419c4c5999fb2f8:

  Merge https://gitlab.denx.de/u-boot/custodians/u-boot-cfi-flash (2020-10-08 
10:20:53 -0400)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip.git 
tags/u-boot-rockchip-20201031

for you to fetch changes up to 43ed7a098d62e700ac024ab913f3be17a6974bb2:

  doc: rockchip: Document Rockchip miniloader flashing (2020-10-30 23:31:26 
+0800)


Alper Nebi Yasak (1):
  video: rockchip: Add missing dpcd_write() call to link_train_ce()

Heiko Stuebner (1):
  ram: rockchip: px30: add a config-based ddr selection

Jack Mitchell (1):
  clk: rockchip: rk3399: implement getting wdt/alive clocks

Jagan Teki (11):
  rockchip: Enable Console MUX in ROCKPi N10
  arm64: dts: rockchip: Add chosen node for ROCK-Pi N8
  video: rockchip: Support 4K resolution for rk3288, HDMI
  rockchip: Enable Console MUX in ROCKPi N8
  arm64: dts: rockchip: px30: Add Engicam EDIMM2.2 Starter Kit
  rockchip: px30: Add EVB_PX30 Kconfig help
  board: engicam: Attach i.MX6 common code
  rockchip: Add Engicam PX30.Core EDIMM2.2 Starter Kit
  arm64: dts: rockchip: px30: Add Engicam C.TOUCH 2.0
  rockchip: Add Engicam PX30.Core C.TOUCH 2.0
  doc: rockchip: Document Rockchip miniloader flashing

Michael Trimarchi (1):
  arm64: dts: rockchip: Add Engicam PX30.Core SOM

Peter Robinson (1):
  rockchip: Rock960: fix up USB support

Samuel Holland (1):
  rockchip: mkimage: Remove host endianness dependency

Stefan Agner (2):
  rockchip: dts: tinker: move i2c node to shared device tree
  rockchip: dts: tinker: remove unnecessary node

 arch/arm/dts/Makefile  |   2 +
 arch/arm/dts/px30-engicam-common.dtsi  |  39 +
 arch/arm/dts/px30-engicam-ctouch2.dtsi |   8 +
 arch/arm/dts/px30-engicam-edimm2.2.dtsi|   7 +
 arch/arm/dts/px30-px30-core-ctouch2.dts|  22 +++
 arch/arm/dts/px30-px30-core-edimm2.2.dts   |  21 +++
 arch/arm/dts/px30-px30-core.dtsi   | 232 +
 arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi |   6 +
 arch/arm/dts/rk3288-tinker-u-boot.dtsi |   7 +
 arch/arm/dts/rk3288-tinker.dts |  11 --
 arch/arm/mach-rockchip/px30/Kconfig|  22 +++
 board/engicam/common/Kconfig   |   8 +
 board/engicam/common/Makefile  |   7 +-
 board/engicam/imx6q/Kconfig|   2 +
 board/engicam/imx6ul/Kconfig   |   2 +
 board/engicam/px30_core/Kconfig|  16 ++
 board/engicam/px30_core/MAINTAINERS|  13 ++
 board/engicam/px30_core/Makefile   |   7 +
 board/engicam/px30_core/px30_core.c|   4 +
 configs/px30-core-ctouch2-px30_defconfig   | 108 ++
 configs/px30-core-edimm2.2-px30_defconfig  | 108 ++
 configs/rock-pi-n10-rk3399pro_defconfig|   1 -
 configs/rock-pi-n8-rk3288_defconfig|   1 -
 configs/rock960-rk3399_defconfig   |   9 +-
 doc/board/rockchip/rockchip.rst|  40 -
 drivers/clk/rockchip/clk_rk3399.c  |  20 +++
 drivers/ram/rockchip/Kconfig   |  21 +++
 drivers/ram/rockchip/sdram_px30.c  |   8 +
 drivers/video/rockchip/Kconfig |   4 +-
 drivers/video/rockchip/rk_edp.c|   6 +
 include/configs/px30_core.h|  15 ++
 include/configs/rock960_rk3399.h   |   2 +
 tools/rkcommon.c   |  29 ++--
 33 files changed, 773 insertions(+), 35 deletions(-)
 create mode 100644 arch/arm/dts/px30-engicam-common.dtsi
 create mode 100644 arch/arm/dts/px30-engicam-ctouch2.dtsi
 create mode 100644 arch/arm/dts/px30-engicam-edimm2.2.dtsi
 create mode 100644 arch/arm/dts/px30-px30-core-ctouch2.dts
 create mode 100644 arch/arm/dts/px30-px30-core-edimm2.2.dts
 create mode 100644 arch/arm/dts/px30-px30-core.dtsi
 create mode 100644 board/engicam/common/Kconfig
 create mode 100644 board/engicam/px30_core/Kconfig
 create mode 100644 board/engicam/px30_core/MAINTAINERS
 create mode 100644 board/engicam/px30_core/Makefile
 create mode 100644 board/engicam/px30_core/px30_core.c
 create mode 100644 configs/px30-core-ctouch2-px30_defconfig
 create mode 100644 configs/px30-core-edimm2.2-px30_defconfig
 create mode 100644 include/configs/px30_core.h




[PATCH 3/4] fs: btrfs: initialize @ret to 0 to prevent uninitialized return value

2020-10-30 Thread Qu Wenruo
In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo 
---
 fs/btrfs/btrfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index e48972ffa21a..346b2c4341c2 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -36,7 +36,7 @@ static int show_dir(struct btrfs_root *root, struct 
extent_buffer *eb,
char *target = NULL;
char filetime[32];
time_t mtime;
-   int ret;
+   int ret = 0;
 
btrfs_dir_item_key_to_cpu(eb, di, );
 
-- 
2.29.1



[PATCH 4/4] fs: btrfs: initialize @ii in show_dir() to make coverity happy

2020-10-30 Thread Qu Wenruo
In show_dir() if we hit file type FT_CHRDEV or FT_BLKDEV, we expect an
BTRFS_INODE_ITEM_KEY, and for that case, we should have @ii filled with
data read from disk.

We even have ASSERT() for this purpose, but unfortunately coverity can't
understand the ASSERT() nor if we get key type BTRFS_INODE_ITEM_KEY,
previous if() branch must go to the read_extent_buffer() branch to fill
the @ii.

So to make coverity happy, just initialize the variable @ii to all zero.

Reported-by: Coverity CID 312950
Signed-off-by: Qu Wenruo 
---
 fs/btrfs/btrfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index 346b2c4341c2..1abd2c291177 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -19,7 +19,7 @@ static int show_dir(struct btrfs_root *root, struct 
extent_buffer *eb,
struct btrfs_dir_item *di)
 {
struct btrfs_fs_info *fs_info = root->fs_info;
-   struct btrfs_inode_item ii;
+   struct btrfs_inode_item ii = { 0 };
struct btrfs_key key;
static const char* dir_item_str[] = {
[BTRFS_FT_REG_FILE] = "FILE",
-- 
2.29.1



[PATCH 2/4] fs: btrfs: volumes: prevent overflow for multiplying

2020-10-30 Thread Qu Wenruo
In __btrfs_map_block() we do a int * int and assign it to u64.
This is not safe as the result (int * int) is still evaluated as (int)
thus it can overflow.

Convert one of the multiplier to u64 to prevent such problem.

In real world, this should not cause problem as we have device number
limit thus it won't go beyond 4G for a single stripe.

But it's harder to teach coverity about all these hidden limits, so just
fix the possible overflow.

Reported-by: Coverity CID 312957
Reported-by: Coverity CID 312948
Signed-off-by: Qu Wenruo 
---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index fcf52d4b0ff3..4aaaeab663f5 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1030,7 +1030,7 @@ again:
 */
stripe_nr = stripe_nr / map->stripe_len;
 
-   stripe_offset = stripe_nr * map->stripe_len;
+   stripe_offset = stripe_nr * (u64)map->stripe_len;
BUG_ON(offset < stripe_offset);
 
/* stripe_offset is the offset of this block in its stripe*/
@@ -1103,7 +1103,7 @@ again:
rot = stripe_nr % map->num_stripes;
 
/* Fill in the logical address of each stripe */
-   tmp = stripe_nr * nr_data_stripes(map);
+   tmp = (u64)stripe_nr * nr_data_stripes(map);
 
for (i = 0; i < nr_data_stripes(map); i++)
raid_map[(i+rot) % map->num_stripes] =
-- 
2.29.1



[PATCH 0/4] fs: btrfs: coverity fixes

2020-10-30 Thread Qu Wenruo
Most of the coverity reports are at least a good hint to us to improve
the code style.
Although there are some false alerts, but it's really hard to teach
coverity to be a real human (yet), thus fix the warning even it's just
false alerts.

Qu Wenruo (4):
  fs: btrfs: inode: handle uninitialized type before returning it
  fs: btrfs: volumes: prevent overflow for multiplying
  fs: btrfs: initialize @ret to 0 to prevent uninitialized return value
  fs: btrfs: initialize @ii in show_dir() to make coverity happy

 fs/btrfs/btrfs.c   | 4 ++--
 fs/btrfs/inode.c   | 6 +-
 fs/btrfs/volumes.c | 4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.29.1



[PATCH 1/4] fs: btrfs: inode: handle uninitialized type before returning it

2020-10-30 Thread Qu Wenruo
In btrfs_lookup_path() the local variable @type should always be updated
after we hit any file/dir.

But if @filename is NULL from the very beginning, then we don't
initialize it and return it directly.

To prevent such problem from happening, we initialize @type to
BTRFS_FT_UNKNOWN.
For normal execution route, it will get updated for each filename we
resolved.
Buf if we didn't find any path, we check if the type is still FT_UNKNOWN
and ret == 0. If true we know there is something wrong, just return
-EUCLEAN to inform the caller.

Reported-by: Coverity CID 312958
Signed-off-by: Qu Wenruo 
---
 fs/btrfs/inode.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ff330280e025..019d532a1a4b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -251,7 +251,7 @@ int btrfs_lookup_path(struct btrfs_root *root, u64 ino, 
const char *filename,
const char *cur = filename;
u64 next_ino;
u8 next_type;
-   u8 type;
+   u8 type = BTRFS_FT_UNKNOWN;
int len;
int ret = 0;
 
@@ -335,6 +335,10 @@ next:
cur += len;
}
 
+   /* We haven't found anything, but still get no error? */
+   if (type == BTRFS_FT_UNKNOWN && !ret)
+   ret = -EUCLEAN;
+
if (!ret) {
*root_ret = root;
*ino_ret = ino;
-- 
2.29.1



Re: [PATCH v4 2/3] env: Access Environment in SPI flashes before relocation

2020-10-30 Thread Michael Walle

Hi,

Am 2020-10-31 01:07, schrieb Tom Rini:
[..]

> +static int env_sf_init(void)
> +{
> +#if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
> +  return env_sf_init_addr();
> +#elif defined(CONFIG_ENV_SPI_EARLY)
> +  return env_sf_init_early();
> +#endif
> +  /*
> +   * we must return with 0 if there is nothing done,
> +   * else env_set_inited() get not called in env_init()
> +   */
> +  return 0;
> +}
> +
>  U_BOOT_ENV_LOCATION(sf) = {
>.location   = ENVL_SPI_FLASH,
>ENV_NAME("SPIFlash")
>.load   = env_sf_load,
>.save   = CONFIG_IS_ENABLED(SAVEENV) ? ENV_SAVE_PTR(env_sf_save) :
> NULL,
> -#if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
>.init   = env_sf_init,
> -#endif

This will break my board (the new kontron sl28). Before the
change, the environment is loaded from SPI, after this patch
the environment won't be loaded anymore. If I delete the
.init callback, the behavior is the same as before.

The problem here is that returning 0 in env_sf_init() is not
enough because if the .init callback is not set, env_init() will
have ret defaulting to -ENOENT and in this case will load the
default environment and setting env_valid to ENV_VALID. I didn't
follow the whole call chain then. But this will then eventually
lead to loading the actual environment in a later stage.


Ugh.  The games we play in the env area really just need to be
rewritten.  So at this point I've merged the series, should I revert or
do you see an easy fix for your platform?  Thanks!


Mh, my board cannot be the only one with a late environment
from SPI flash, can it?

Returning 0 will call env_set_inited() and returning -ENOENT
will call the second part. I can't tell why it was done that
way. So I don't have a simple fix.

But I guess the following ugly ifdeffery could do it:

#if (defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)) || 
defined(CONFIG_ENV_SPI_EARLY)

.init   = env_sf_init,
#endif

I can try that tomorrow. Also the comment about the return
value should be removed (?).

-michael


Re: [PATCH v4 2/3] env: Access Environment in SPI flashes before relocation

2020-10-30 Thread Tom Rini
On Sat, Oct 31, 2020 at 12:51:27AM +0100, Michael Walle wrote:
> Hi Heiko, Hi Tom,
> 
> Am 2020-10-10 10:28, schrieb Heiko Schocher:
> > Enable the new Kconfig option ENV_SPI_EARLY if you want
> > to use Environment in SPI flash before relocation.
> > Call env_init() and than you can use env_get_f() for
> > accessing Environment variables.
> > 
> > Signed-off-by: Heiko Schocher 
> > ---
> > 
> > Changes in v4:
> > - rebased to current master 5dcf7cc590
> > 
> > Changes in v3:
> > - env_sf_init_early() always return 0 now. If we do not return
> >   0 in this function, env_set_inited() never get called,
> >   which has the consequence that env_load/save/erase never
> >   work, because they check if the init bit is set.
> > - add comment from Simon Glass
> >   - add missing function comments
> >   - use if(IS_ENABLED...)
> >   - drop extra brackets
> >   - let env_sf_init() decide, which function to call
> > add comment that it is necessary to return env_sf_init()
> > with 0.
> > 
> >  env/Kconfig |   8 +
> >  env/sf.c| 100 ++--
> >  2 files changed, 105 insertions(+), 3 deletions(-)
> > 
> > diff --git a/env/Kconfig b/env/Kconfig
> > index c6ba08878d..393b191a30 100644
> > --- a/env/Kconfig
> > +++ b/env/Kconfig
> > @@ -376,6 +376,14 @@ config ENV_SPI_MODE
> >   Value of the SPI work mode for environment.
> >   See include/spi.h for value.
> > 
> > +config ENV_SPI_EARLY
> > +   bool "Access Environment in SPI flashes before relocation"
> > +   depends on ENV_IS_IN_SPI_FLASH
> > +   help
> > + Enable this if you want to use Environment in SPI flash
> > + before relocation. Call env_init() and than you can use
> > + env_get_f() for accessing Environment variables.
> > +
> >  config ENV_IS_IN_UBI
> > bool "Environment in a UBI volume"
> > depends on !CHAIN_OF_TRUST
> > diff --git a/env/sf.c b/env/sf.c
> > index 937778aa37..2eb2de1a4e 100644
> > --- a/env/sf.c
> > +++ b/env/sf.c
> > @@ -287,7 +287,10 @@ __weak void *env_sf_get_env_addr(void)
> >  #endif
> > 
> >  #if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
> > -static int env_sf_init(void)
> > +/*
> > + * check if Environment on CONFIG_ENV_ADDR is valid.
> > + */
> > +static int env_sf_init_addr(void)
> >  {
> > env_t *env_ptr = (env_t *)env_sf_get_env_addr();
> > 
> > @@ -303,12 +306,103 @@ static int env_sf_init(void)
> >  }
> >  #endif
> > 
> > +#if defined(CONFIG_ENV_SPI_EARLY)
> > +/*
> > + * early load environment from SPI flash (before relocation)
> > + * and check if it is valid.
> > + */
> > +static int env_sf_init_early(void)
> > +{
> > +   int ret;
> > +   int read1_fail;
> > +   int read2_fail;
> > +   int crc1_ok;
> > +   env_t *tmp_env2 = NULL;
> > +   env_t *tmp_env1;
> > +
> > +   /*
> > +* if malloc is not ready yet, we cannot use
> > +* this part yet.
> > +*/
> > +   if (!gd->malloc_limit)
> > +   return -ENOENT;
> > +
> > +   tmp_env1 = (env_t *)memalign(ARCH_DMA_MINALIGN,
> > +   CONFIG_ENV_SIZE);
> > +   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT))
> > +   tmp_env2 = (env_t *)memalign(ARCH_DMA_MINALIGN,
> > +CONFIG_ENV_SIZE);
> > +
> > +   if (!tmp_env1 || !tmp_env2)
> > +   goto out;
> > +
> > +   ret = setup_flash_device();
> > +   if (ret)
> > +   goto out;
> > +
> > +   read1_fail = spi_flash_read(env_flash, CONFIG_ENV_OFFSET,
> > +   CONFIG_ENV_SIZE, tmp_env1);
> > +
> > +   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT)) {
> > +   read2_fail = spi_flash_read(env_flash,
> > +   CONFIG_ENV_OFFSET_REDUND,
> > +   CONFIG_ENV_SIZE, tmp_env2);
> > +   ret = env_check_redund((char *)tmp_env1, read1_fail,
> > +  (char *)tmp_env2, read2_fail);
> > +
> > +   if (ret == -EIO || ret == -ENOMSG)
> > +   goto err_read;
> > +
> > +   if (gd->env_valid == ENV_VALID)
> > +   gd->env_addr = (unsigned long)_env1->data;
> > +   else
> > +   gd->env_addr = (unsigned long)_env2->data;
> > +   } else {
> > +   if (read1_fail)
> > +   goto err_read;
> > +
> > +   crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) ==
> > +   tmp_env1->crc;
> > +   if (!crc1_ok)
> > +   goto err_read;
> > +
> > +   /* if valid -> this is our env */
> > +   gd->env_valid = ENV_VALID;
> > +   gd->env_addr = (unsigned long)_env1->data;
> > +   }
> > +
> > +   return 0;
> > +err_read:
> > +   spi_flash_free(env_flash);
> > +   env_flash = NULL;
> > +   free(tmp_env1);
> > +   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT))
> > +   free(tmp_env2);
> > +out:
> > +   /* env is not valid. always return 0 */
> > +   gd->env_valid = ENV_INVALID;
> > +   return 

Re: [PATCH v4 2/3] env: Access Environment in SPI flashes before relocation

2020-10-30 Thread Michael Walle

Hi Heiko, Hi Tom,

Am 2020-10-10 10:28, schrieb Heiko Schocher:

Enable the new Kconfig option ENV_SPI_EARLY if you want
to use Environment in SPI flash before relocation.
Call env_init() and than you can use env_get_f() for
accessing Environment variables.

Signed-off-by: Heiko Schocher 
---

Changes in v4:
- rebased to current master 5dcf7cc590

Changes in v3:
- env_sf_init_early() always return 0 now. If we do not return
  0 in this function, env_set_inited() never get called,
  which has the consequence that env_load/save/erase never
  work, because they check if the init bit is set.
- add comment from Simon Glass
  - add missing function comments
  - use if(IS_ENABLED...)
  - drop extra brackets
  - let env_sf_init() decide, which function to call
add comment that it is necessary to return env_sf_init()
with 0.

 env/Kconfig |   8 +
 env/sf.c| 100 ++--
 2 files changed, 105 insertions(+), 3 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index c6ba08878d..393b191a30 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -376,6 +376,14 @@ config ENV_SPI_MODE
  Value of the SPI work mode for environment.
  See include/spi.h for value.

+config ENV_SPI_EARLY
+   bool "Access Environment in SPI flashes before relocation"
+   depends on ENV_IS_IN_SPI_FLASH
+   help
+ Enable this if you want to use Environment in SPI flash
+ before relocation. Call env_init() and than you can use
+ env_get_f() for accessing Environment variables.
+
 config ENV_IS_IN_UBI
bool "Environment in a UBI volume"
depends on !CHAIN_OF_TRUST
diff --git a/env/sf.c b/env/sf.c
index 937778aa37..2eb2de1a4e 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -287,7 +287,10 @@ __weak void *env_sf_get_env_addr(void)
 #endif

 #if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
-static int env_sf_init(void)
+/*
+ * check if Environment on CONFIG_ENV_ADDR is valid.
+ */
+static int env_sf_init_addr(void)
 {
env_t *env_ptr = (env_t *)env_sf_get_env_addr();

@@ -303,12 +306,103 @@ static int env_sf_init(void)
 }
 #endif

+#if defined(CONFIG_ENV_SPI_EARLY)
+/*
+ * early load environment from SPI flash (before relocation)
+ * and check if it is valid.
+ */
+static int env_sf_init_early(void)
+{
+   int ret;
+   int read1_fail;
+   int read2_fail;
+   int crc1_ok;
+   env_t *tmp_env2 = NULL;
+   env_t *tmp_env1;
+
+   /*
+* if malloc is not ready yet, we cannot use
+* this part yet.
+*/
+   if (!gd->malloc_limit)
+   return -ENOENT;
+
+   tmp_env1 = (env_t *)memalign(ARCH_DMA_MINALIGN,
+   CONFIG_ENV_SIZE);
+   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT))
+   tmp_env2 = (env_t *)memalign(ARCH_DMA_MINALIGN,
+CONFIG_ENV_SIZE);
+
+   if (!tmp_env1 || !tmp_env2)
+   goto out;
+
+   ret = setup_flash_device();
+   if (ret)
+   goto out;
+
+   read1_fail = spi_flash_read(env_flash, CONFIG_ENV_OFFSET,
+   CONFIG_ENV_SIZE, tmp_env1);
+
+   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT)) {
+   read2_fail = spi_flash_read(env_flash,
+   CONFIG_ENV_OFFSET_REDUND,
+   CONFIG_ENV_SIZE, tmp_env2);
+   ret = env_check_redund((char *)tmp_env1, read1_fail,
+  (char *)tmp_env2, read2_fail);
+
+   if (ret == -EIO || ret == -ENOMSG)
+   goto err_read;
+
+   if (gd->env_valid == ENV_VALID)
+   gd->env_addr = (unsigned long)_env1->data;
+   else
+   gd->env_addr = (unsigned long)_env2->data;
+   } else {
+   if (read1_fail)
+   goto err_read;
+
+   crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) ==
+   tmp_env1->crc;
+   if (!crc1_ok)
+   goto err_read;
+
+   /* if valid -> this is our env */
+   gd->env_valid = ENV_VALID;
+   gd->env_addr = (unsigned long)_env1->data;
+   }
+
+   return 0;
+err_read:
+   spi_flash_free(env_flash);
+   env_flash = NULL;
+   free(tmp_env1);
+   if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT))
+   free(tmp_env2);
+out:
+   /* env is not valid. always return 0 */
+   gd->env_valid = ENV_INVALID;
+   return 0;
+}
+#endif
+
+static int env_sf_init(void)
+{
+#if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
+   return env_sf_init_addr();
+#elif defined(CONFIG_ENV_SPI_EARLY)
+   return env_sf_init_early();
+#endif
+   /*
+* we must return with 0 if there is nothing done,
+* else env_set_inited() get not called in env_init()
+*/
+   

[scan-ad...@coverity.com: New Defects reported by Coverity Scan for Das U-Boot]

2020-10-30 Thread Tom Rini
Here's the latest report from Coverity scan.  I think it's more helpful
to send these to the list so that anyone can help advise on solutions
than to send it only to people that may have introduced the problem, as
I have previously been forwarding to.  I don't recall why I got in the
habit to start with, so, breaking that habit now.

- Forwarded message from scan-ad...@coverity.com -

Date: Wed, 28 Oct 2020 20:41:49 + (UTC)
From: scan-ad...@coverity.com
To: tom.r...@gmail.com
Subject: New Defects reported by Coverity Scan for Das U-Boot

Hi,

Please find the latest report on new defect(s) introduced to Das U-Boot found 
with Coverity Scan.

37 new defect(s) introduced to Das U-Boot found with Coverity Scan.
5 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 37 defect(s)


** CID 312960:  Integer handling issues  (BAD_SHIFT)
/drivers/mux/mmio.c: 107 in mmio_mux_probe()



*** CID 312960:  Integer handling issues  (BAD_SHIFT)
/drivers/mux/mmio.c: 107 in mmio_mux_probe()
101 mask = mux_reg_masks[2 * i + 1];
102 
103 field.reg = reg;
104 field.msb = fls(mask) - 1;
105 field.lsb = ffs(mask) - 1;
106 
>>> CID 312960:  Integer handling issues  (BAD_SHIFT)
>>> In expression "0xUL << field.lsb", left shifting by 
>>> more than 63 bits has undefined behavior.  The shift amount, "field.lsb", 
>>> is 4294967295.
107 if (mask != GENMASK(field.msb, field.lsb))
108 return log_msg_ret("invalid mask", -EINVAL);
109 
110 fields[i] = devm_regmap_field_alloc(dev, regmap, field);
111 if (IS_ERR(fields[i])) {
112 ret = PTR_ERR(fields[i]);

** CID 312959:(RESOURCE_LEAK)
/drivers/mux/mmio.c: 113 in mmio_mux_probe()
/drivers/mux/mmio.c: 108 in mmio_mux_probe()



*** CID 312959:(RESOURCE_LEAK)
/drivers/mux/mmio.c: 113 in mmio_mux_probe()
107 if (mask != GENMASK(field.msb, field.lsb))
108 return log_msg_ret("invalid mask", -EINVAL);
109 
110 fields[i] = devm_regmap_field_alloc(dev, regmap, field);
111 if (IS_ERR(fields[i])) {
112 ret = PTR_ERR(fields[i]);
>>> CID 312959:(RESOURCE_LEAK)
>>> Variable "idle_states" going out of scope leaks the storage it points 
>>> to.
113 return log_msg_ret("regmap_field_alloc", ret);
114 }
115 
116 bits = 1 + field.msb - field.lsb;
117 mux->states = 1 << bits;
118 
/drivers/mux/mmio.c: 108 in mmio_mux_probe()
102 
103 field.reg = reg;
104 field.msb = fls(mask) - 1;
105 field.lsb = ffs(mask) - 1;
106 
107 if (mask != GENMASK(field.msb, field.lsb))
>>> CID 312959:(RESOURCE_LEAK)
>>> Variable "idle_states" going out of scope leaks the storage it points 
>>> to.
108 return log_msg_ret("invalid mask", -EINVAL);
109 
110 fields[i] = devm_regmap_field_alloc(dev, regmap, field);
111 if (IS_ERR(fields[i])) {
112 ret = PTR_ERR(fields[i]);
113 return log_msg_ret("regmap_field_alloc", ret);

** CID 312958:  Uninitialized variables  (UNINIT)
/fs/btrfs/inode.c: 341 in btrfs_lookup_path()



*** CID 312958:  Uninitialized variables  (UNINIT)
/fs/btrfs/inode.c: 341 in btrfs_lookup_path()
335 cur += len;
336 }
337 
338 if (!ret) {
339 *root_ret = root;
340 *ino_ret = ino;
>>> CID 312958:  Uninitialized variables  (UNINIT)
>>> Using uninitialized value "type".
341 *type_ret = type;
342 }
343 
344 return ret;
345 }
346 

** CID 312957:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/fs/btrfs/volumes.c: 1106 in __btrfs_map_block()



*** CID 312957:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/fs/btrfs/volumes.c: 1106 in __btrfs_map_block()
1100stripe_nr = stripe_nr / nr_data_stripes(map);
1101 
1102/* Work out the disk rotation on this 
stripe-set */
1103   

Please pull u-boot-dm

2020-10-30 Thread Simon Glass
Hi Tom,

https://gitlab.denx.de/u-boot/custodians/u-boot-dm/-/commits/master
https://travis-ci.com/github/sjg20/u-boot/builds/196409920
https://dev.azure.com/simon0972/u-boot/_build?definitionId=1


The following changes since commit cdeb7b8f984e6d9bcdc5a6fdda6107af156d47bf:

  configs: Resync with savedefconfig (2020-10-29 10:48:01 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-dm.git tags/dm-pull-30oct20

for you to fetch changes up to 2424057b2ad0eacdd2d81e35e7bea5df97802b8f:

  binman: Avoid calculated section data repeatedly (2020-10-29 14:42:59 -0600)


of-platdata and dtoc improvements
sandbox SPL tests
binman support for compressed sections


Dario Binacchi (1):
  dm: core: fix typo in device.h

Heinrich Schuchardt (1):
  sandbox: make SDL window resizable

Simon Glass (69):
  binman: Add a way to read the ROM offset
  binman: Support multiple images in the library
  dtoc: Extract inner loop from output_node()
  dtoc: Use a namedtuple for _links
  dm: core: Expand the comment for DM_GET_DEVICE()
  dm: core: Avoid void * in the of-platdata structs
  dm: Avoid using #ifdef for CONFIG_OF_LIVE
  dm: test: Sort the Makefile
  dm: test: Update Makefile conditions
  dm: test: Make use of CONFIG_UNIT_TEST
  dm: test: Disable some tests that should not run in SPL
  sandbox: Drop ad-hoc device declarations in SPL
  dtoc: Document the return value of scan_structs()
  dtoc: Order the structures internally by name
  dm: core: Allow dm_warn() to be used in SPL
  dtoc: Fix widening of int to bytes
  dm: test: Build tests for SPL
  dm: test: Update the test runner to support of-platdata
  dm: test: Add a way to run SPL tests
  dm: test: Add a very simple of-platadata test
  Makefile: Generate a symbol file for u-boot-spl
  pytest: Collect SPL unit tests
  test: Run SPL unit tests
  sandbox: Allow selection of SPL unit tests
  test: Run only the selected SPL test
  dm: test: Drop of-platdata pytest
  Azure/GitLab/Travis: Add SPL unit tests
  dm: Add a C test for of-platdata properties
  dm: test: Add a check that all devices have a dev value
  dm: test: Add a test for of-platdata phandles
  dm: Use an allocated array for run-time device info
  sandbox: Fix up building for of-platdata
  dm: Support parent devices with of-platdata
  dm: Add a test for of-platdata parent information
  dm: core: Convert #ifdef to if() in root.c
  x86: apl: Enable SPI flash in TPL with APL_SPI_FLASH_BOOT
  x86: apl: Take advantage of the of-platdata parent support
  dm: Use driver_info index instead of pointer
  imx: mx6cuboxi: Disable thermal driver in SPL
  dm: Don't allow U_BOOT_DEVICE() when of-platdata is used
  dm: doc: Update the of-platadata documentation
  binman: Update the entry docs
  binman: Drop unused return variable for _DoTestFile()
  binman: Add tests for skip-at-start sections
  binman: Give a sensible error if no command is given
  binman: Fix return from u-boot-ucode if there is no DT
  binman: Remove references to 'image' in entry_Section
  binman: Expand the error message for breaching a section
  binman: Move CompressData() into Entry base class
  binman: Use 'files-compress' to set compression for files
  binman: Update testPackExtra with more checks
  binman: Expand docs and test for padding
  binman: Expand docs and test for alignment
  binman: Move section-building code into a function
  binman: Refactor _BuildSectionData()
  binman: Move section padding to the parent
  binman: Make section padding consistent with other entries
  binman: Store the original data before compression
  binman: Set section contents in GetData()
  binman: Avoid reporting image-pos with compression
  binman: Drop Entry.CheckOffset()
  binman: Move sort and expand to the main Pack() function
  binman: Drop the Entry.CheckSize() method
  binman: Call CheckSize() from the section's Pack() method
  binman: Drop CheckEntries()
  binman: Update CheckEntries() for compressed sections
  binman: Use the actual contents in CheckSize()
  binman: Support compression of sections
  binman: Avoid calculated section data repeatedly

 .azure-pipelines.yml|   2 +-
 .gitlab-ci.yml  |   2 +-
 .travis.yml |   2 +-
 Makefile|   2 +-
 arch/arm/mach-imx/mx6/soc.c |   2 +-
 arch/sandbox/cpu/sdl.c  |   3 +-
 arch/sandbox/cpu/spl.c  |  18 +-
 arch/sandbox/cpu/start.c|  

Re: [maemo-leste] [PATCH] nokia_rx51: disable obsolete VIDEO config

2020-10-30 Thread Pali Rohár
On Thursday 29 October 2020 14:06:30 Lokesh Vutla wrote:
> On 24/10/20 5:49 pm, Tom Rini wrote:
> > On Sat, Oct 24, 2020 at 12:46:45PM +0200, Merlijn Wajer wrote:
> >> Hi,
> >>
> >> On 24/10/2020 12:06, Pali Rohár wrote:
> >>> On Wednesday 21 October 2020 08:47:02 Tom Rini wrote:
>  On Wed, Oct 21, 2020 at 11:08:37AM +0200, Pali Rohár wrote:
> > On Tuesday 20 October 2020 10:17:07 Tom Rini wrote:
> >> On Tue, Oct 20, 2020 at 11:30:51AM +0200, Pali Rohár wrote:
> >> 
> > Yes, there is mmc issue, I have found which commit caused it and
> > because nobody was able to debug / understand what is happening I have
> > sent revert patch, which fixes that issue, until somebody solve issue in
> > original patch.
> >
> > But I do not see any progress on either applying revert patch or fixing
> > original patch.
> >
> > And I do not like to have custom patch in my local branch (and
> > periodically rebasing it) as it just another layer of complication.
> >
> > Could we move somehow in this issue?
> 
>  No, it's probably stuck until you can fix the problem or otherwise add a
>  "quirk" for your platform.  What does Linux do in this case?
> >>>
> >>> Well, I provided all requested information, just I'm lacking any new
> >>> response from developers / maintainers of particular code.
> >>>
> >>> I have already identified problematic place / commit and I have already
> >>> sent revert patch which fixing this issue.
> >>>
> >>> Tom, what else do you need?
> >>>
> >>> I see the main issue now that nobody reviewed / merged patch and nobody
> >>> responded to emails which I have sent more then 2 months ago.
> >>
> >> I would like to add my voice for reverting the patches that break the
> >> support, and work from that point to improve support and eventually
> >> migrate to DT.
> >>
> >> Maemo Leste has a lot of Nokia N900 users, and this is blocking us from
> >> moving to mainline u-boot. Is it possible to get the opinion of the
> >> original patch authors on this?
> >>
> >> I am set up with a serial module on the Nokia N900, so I can help
> >> provide specific debug info.
> > 
> > Let me add in the TI folks that might be able to look in to any of this
> > today.  But the next problem is that the rx51 needs to be converted to
> > use DM in U-Boot.  It's throwing up a ton of "you need to convert to X
> > by  or this board may be removed" warnings at
> > build.  I really really want to see some of this start to be addressed.
> 
> 
> IIUC, the breakage is happening in non-DM code.

No, this code is not non-DM specific. It is used also for DM builds.


Re: [PATCH] log: typo logl_pref in documentation

2020-10-30 Thread Tom Rini
On Fri, Oct 30, 2020 at 06:50:31PM +0100, Heinrich Schuchardt wrote:

> The name of structure element logl_prev is not matched by the
> documentation.
> 
> %s/logl_pref/logl_prev/
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 21/22] doc: Add log kerneldocs to documentation

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:40PM -0400, Sean Anderson wrote:

> The functions in log.h are already mostly documented, so add them to the
> generated documentation.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 20/22] test: Add a test for log filter-*

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:39PM -0400, Sean Anderson wrote:

> This exercises a few success and failure modes of the log filter-*
> commands. log filter-list is not tested because it's purely informational.
> I don't think there's a good way to test it except by testing if the output
> of the command exactly matches a sample run.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 17/22] lib: Add getopt

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:36PM -0400, Sean Anderson wrote:

> Some commands can get very unweildy if they have too many positional
> arguments. Adding options makes them easier to read, remember, and
> understand.
> 
> This implementation of getopt has been taken from barebox, which has had
> option support for quite a while. I have made a few modifications to their
> version, such as the removal of opterr in favor of a separate getopt_silent
> function. In addition, I have moved all global variables into struct
> getopt_context.
> 
> The getopt from barebox also re-orders the arguments passed to it so that
> non-options are placed last. This allows users to specify options anywhere.
> For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
> getopt parsed the options. However, this feature conflicts with the const
> argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
> that argv[] argument pointers are not modified."). The reason stated in
> that commit is that hush requires argv to stay unmodified. Has this
> situation changed? Barebox also uses hush, and does not have this problem.
> Perhaps we could use their fix?
> 
> I have assigned maintenance of getopt to Simon Glass, as it is currently
> only used by the log command. I would also be fine maintaining it.
> 
> Signed-off-by: Sean Anderson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 22/22] doc: Update logging documentation

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:41PM -0400, Sean Anderson wrote:

> This updates logging documentation with some examples of the new commands
> added in the previous commits. It also removes some items from the to-do
> list which have been implemented.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Please note I accepted the newer wording to include describing the log
continuation support.  If this should be called out specifically again,
please do a follow-up.

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 19/22] cmd: log: Add commands to manipulate filters

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:38PM -0400, Sean Anderson wrote:

> This adds several commands to add, list, and remove log filters. Due to the
> complexity of adding a filter, `log filter-list` uses options instead of
> positional arguments.
> 
> These commands have been added as subcommands to log by using a dash to
> join the subcommand and subsubcommand. This is stylistic, and they could be
> converted to proper subsubcommands if it is wished.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 14/22] cmd: log: Split off log level parsing

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:33PM -0400, Sean Anderson wrote:

> Move parsing of log level into its own function so it can be re-used. This
> also adds support for using log level names instead of just the integer
> equivalent.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 16/22] cmd: log: Make "log level" print all log levels

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:35PM -0400, Sean Anderson wrote:

> This makes the log level command print all valid log levels. The default
> log level is annotated. This provides an easy way to see which log levels
> are compiled-in.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 18/22] test: Add a test for getopt

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:37PM -0400, Sean Anderson wrote:

> A few of these tests were inspired by those in glibc. The syntax for
> invoking test_getopt is a bit funky, but it's necessary so that the CPP can
> parse the arguments correctly.
> 
> Signed-off-by: Sean Anderson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 15/22] cmd: log: Add commands to list categories and drivers

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:34PM -0400, Sean Anderson wrote:

> This allows users to query which categories and drivers are available on
> their system. This allows them to construct filter-add commands without
> (e.g.) adjusting the log format to show categories and drivers.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 10/22] test: Add tests for LOGFF_DENY

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:29PM -0400, Sean Anderson wrote:

> This adds some tests for log filters which deny if they match.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 13/22] cmd: log: Use sub-commands for log

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:32PM -0400, Sean Anderson wrote:

> This reduces duplicate code, and makes adding new sub-commands easier.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 12/22] test: Add test for LOGFF_MIN

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:31PM -0400, Sean Anderson wrote:

> This tests log filters matching on a minimum level.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 09/22] test: log: Give tests names instead of numbers

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:28PM -0400, Sean Anderson wrote:

> Now that the log test command is no more, we can give the log tests proper
> names.
> 
> Signed-off-by: Sean Anderson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 11/22] log: Add filter flag to match greater than a log level

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:30PM -0400, Sean Anderson wrote:

> This is the complement of the existing behavior to match only messages with
> a log level less than a threshold. This is primarily useful in conjunction
> with LOGFF_DENY.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 07/22] log: Add filter flag to deny on match

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:26PM -0400, Sean Anderson wrote:

> Without this flag, log filters can only explicitly accept messages.
> Allowing denial makes it easier to filter certain subsystems. Unlike
> allow-ing filters, deny-ing filters are added to the beginning of the
> filter list. This should do the Right Thing most of the time, but it's
> less-universal than allowing filters to be inserted anywhere. If this
> becomes a problem, then perhaps log_filter_add* should take a filter number
> to insert before/after.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 08/22] test: log: Convert log_test from python to C

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:27PM -0400, Sean Anderson wrote:

> When rebasing this series I had to renumber all my log tests because
> someone made another log test in the meantime. This involved updaing a
> number in several places (C and python), and it wasn't checked by the
> compiler. So I though "how hard could it be to just rewrite in C?" And
> though it wasn't hard, it *was* tedious. Tests are numbered the same as
> before to allow for easier review.
> 
> A note that if a test fails, everything after it will probably also fail.
> This is because that test won't clean up its filters.  There's no easy way
> to do the cleanup, except perhaps removing all filters in a wrapper
> function.
> 
> Signed-off-by: Sean Anderson 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 02/22] log: Fix incorrect documentation of log_filter.cat_list

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:21PM -0400, Sean Anderson wrote:

> Logging category lists are terminated by LOGC_END, not LOGC_NONE.
> 
> Fixes: e9c8d49d54 ("log: Add an implementation of logging")
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 06/22] log: Add function to create a filter with flags

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:25PM -0400, Sean Anderson wrote:

> This function exposes a way to specify flags when creating a filter.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 05/22] log: Expose some helper functions

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:24PM -0400, Sean Anderson wrote:

> These functions are required by "cmd: log: Add commands to manipulate
> filters" and "test: Add a test for log filter-*".
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 04/22] log: Use CONFIG_IS_ENABLED() for LOG_TEST

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:23PM -0400, Sean Anderson wrote:

> Checkpatch complains about using #ifdef for CONFIG variables.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 01/22] log: Fix missing negation of ENOMEM

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:20PM -0400, Sean Anderson wrote:

> Errors returned should be negative.
> 
> Fixes: 45fac9fc18 ("log: Correct missing free() on error in log_add_filter()")
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 03/22] log: Add additional const qualifier to arrays

2020-10-30 Thread Tom Rini
On Tue, Oct 27, 2020 at 07:55:22PM -0400, Sean Anderson wrote:

> Both these arrays and their members are const. Fixes checkpatch complaint.
> 
> Signed-off-by: Sean Anderson 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 3/3] imx6: enable early spi environment access on aristainetos boards

2020-10-30 Thread Tom Rini
On Sat, Oct 10, 2020 at 10:28:06AM +0200, Heiko Schocher wrote:

> On aristianetos boards the display type is detected
> through "panel" environment variable. Dependend on the
> display type we detect the board type and this decides which
> DTB we have to use for the board.
> 
> So we need early spi environment access.
> 
> Signed-off-by: Heiko Schocher 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 2/3] env: Access Environment in SPI flashes before relocation

2020-10-30 Thread Tom Rini
On Sat, Oct 10, 2020 at 10:28:05AM +0200, Heiko Schocher wrote:

> Enable the new Kconfig option ENV_SPI_EARLY if you want
> to use Environment in SPI flash before relocation.
> Call env_init() and than you can use env_get_f() for
> accessing Environment variables.
> 
> Signed-off-by: Heiko Schocher 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] xilinx patches for v2021.01-v2

2020-10-30 Thread Tom Rini
On Thu, Oct 29, 2020 at 03:23:03PM +0100, Michal Simek wrote:

> Hi Tom,
> 
> please pull these patches to your tree.
> Gitlab CI looks good
> https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze/-/pipelines/5170
> Travis is still running and it is quite slow but I have been running
> full build some days ago without any issue there too.
> 
> Buildman run over all patches for xilinx platforms also not showing any
> issue.
> 
> There are some patches out of Xilinx area but related to do.
> The first adds support for 64bit loadables from SPL to U-Boot. All of
> them were reviewed by Simon.
> 
> There are also changes for zynq-sdhci which were reviewed by Peng and
> Jaehoon.
> 
> Feel free to take a look below for more information.
> 
> Thanks,
> Michal
> 
> 
> The following changes since commit c99e87f82803500f9811b1e98926d9d25df35b38:
> 
>   Merge branch '2020-10-23-misc-changes' (2020-10-24 10:49:28 -0400)
> 
> are available in the Git repository at:
> 
>   g...@gitlab.denx.de:u-boot/custodians/u-boot-microblaze.git
> tags/xilinx-for-v2021.01-v2
> 
> for you to fetch changes up to 908daf86f96a44176ecd1e04f1ec71e143aa45f5:
> 
>   xilinx: Enable SPI driver for Versal (2020-10-29 08:55:43 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-marvell/master

2020-10-30 Thread Tom Rini
On Thu, Oct 29, 2020 at 03:31:27PM +0100, Stefan Roese wrote:

> Hi Tom,
> 
> please pull an update of Marvell Armada & Octeon TX/TX2 related
> patches. Here the summary log:
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 1/3] env: split env_import_redund() into 2 functions

2020-10-30 Thread Tom Rini
On Sat, Oct 10, 2020 at 10:28:04AM +0200, Heiko Schocher wrote:

> split from env_import_redund() the part which checks
> which Environment is valid into a separate function
> called env_check_redund() and call it from env_import_redund().
> 
> So env_check_redund() can be used from places which also
> need to do this checks.
> 
> Signed-off-by: Heiko Schocher 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] configs: meson64_android: don't show logo on ROM USB boot

2020-10-30 Thread Mattijs Korpershoek
From: Guillaume La Roque 

When booting from rom usb, skip the boot logo logic as it's possible
that the partition containing the logo does not exist yet.

Signed-off-by: Neil Armstrong 
Signed-off-by: Guillaume La Roque 
Signed-off-by: Mattijs Korpershoek 
---
 include/configs/meson64_android.h | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/configs/meson64_android.h 
b/include/configs/meson64_android.h
index 8fff915b50a4..c47d51c85368 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -98,11 +98,14 @@
func(SYSTEM, system, na) \
 
 #define PREBOOT_LOAD_LOGO \
-   "mmc dev ${mmcdev};" \
-   "part start mmc ${mmcdev} ${logopart} boot_start;" \
-   "part size mmc ${mmcdev} ${logopart} boot_size;" \
-   "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
+   "if test \"${boot_source}\" != \"usb\" && " \
+   "gpt verify mmc ${mmcdev} ${partitions}; then; " \
+   "mmc dev ${mmcdev};" \
+   "part start mmc ${mmcdev} ${logopart} boot_start;" \
+   "part size mmc ${mmcdev} ${logopart} boot_size;" \
+   "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
"bmp display ${loadaddr} m m;" \
+   "fi;" \
"fi;"
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-- 
2.25.1



Re: [patch v2 01/10] drivers/video/rockchip/rk_vop.c: Use endpoint compatible string to find VOP mode

2020-10-30 Thread Rtp
Kever Yang  writes:

> Hi Arnaud,
>
>     Thanks for your patch.
>
>     Please use module name as subject prefix instead of a file name,
> eg. "rockchip: video: vop".
>
ok. will fix.

> On 2020/10/27 下午9:21, Arnaud Patard (Rtp) wrote:
>> The current code is using an hard coded enum and the of node reg value of
>> endpoint to find out if the endpoint is mipi/hdmi/lvds/edp/dp. The order
>> is different between rk3288, rk3399 vop little, rk3399 vop big.
>>
>> A possible solution would be to make sure that the rk3288.dtsi and
>> rk3399.dtsi files have "expected" reg value or an other solution is
>> to find the kind of endpoint by comparing the endpoint compatible value.
>>
>> This patch is implementing the more flexible second solution.
>>
>> Signed-off-by: Arnaud Patard 
>>
>> Index: u-boot/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
>> ===
>> --- u-boot.orig/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
>> +++ u-boot/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
>
> For the patch format, please make sure the u-boot is the root directory.
>

Can you please explain this point ? It's a valid patch which can be
applied with patch -p1. I've been generating patches with quilt for ages
and patches got merged in various projects including in the kernel even
before git, so I fail to get what's wrong with it.
Or are you telling me that uboot is accepting only patches generated with git ?

Arnaud


Re: [PATCH 00/33] stm32: enable logging features

2020-10-30 Thread Simon Glass
Hi Patrick,

On Wed, 28 Oct 2020 at 05:52, Patrick DELAUNAY  wrote:
>
> Hi Simon,
>
> > From: Simon Glass 
> > Sent: lundi 26 octobre 2020 20:23
> >
> > Hi Patrick,
> >
> > On Thu, 15 Oct 2020 at 09:59, Patrick DELAUNAY 
> > wrote:
> > >
> > > Hi Simon,
> > >
> > > > From: Simon Glass 
> > > > Sent: jeudi 15 octobre 2020 17:06
> > > >
> > > > Hi Patrick,
> > > >
> > > > On Wed, 14 Oct 2020 at 03:16, Patrick Delaunay
> > > > 
> > > > wrote:
> > > > >
> > > > >
> > > > > This patch-set migrates several stm32 drivers to API compatible
> > > > > with logging features (use dev_...() or log_...() function) and
> > > > > activate the logging features in STM32MP15 boards.
> > > > >
> > > > > The size of U-Boot increased by 19kB (933026 to 952830 on
> > > > > STM32MP157C-EV1 board for basic defconfig) but the boot time don't
> > > > > change
> > > > drastically.
> > > >
> > > > >
>
> (...)
>
> > > > > For information even with all trace embbeded in U-Boot but not
> > > > > activated, MAX_LOG_LEVEL=8 and LOG_DEFAULT_LEVEL=6
> > > > >
> > > > > Size increase by 190KB (952830 to 1147918) but boot time is stable
> > > > > (1,748s vs 1,696s).
> > > >
> > > > This seems pretty bad. Is this because of console output, or
> > > > something else? I understand the size increase, but not the boot time
> > increase.
> > >
> > > For this last point I just execute STM32MP157C-EV1 boot with a patch
> > > in configs/stm32mp15_basic_defconfig
> > >
> > > +CONFIG_LOGLEVEL=8
> > > +CONFIG_LOG_MAX_LEVEL=8
> > > +CONFIG_LOG_DEFAULT_LEVEL=6
> > > +CONFIG_LOGF_FILE=y
> > > +CONFIG_LOGF_LINE=y
> > > +CONFIG_LOGF_FUNC=y
> > >
> > > And execute "bootstage report" after the second boot (the first boot
> > > is pertubated by env save)
> > >
> > > I think the delta is linked to
> > > 1/ size of U-Boot (SPL spent more time to load U-Boot)
> > > end of SPL 987,579  => 996,117
> >
> > OK.
> >
> > >
> > > 2/ time to check for each debug trace: because I increase the log level
> > >(gd->default_log_level = 6 < MAX_LOG_LEVEL=8)
> >
> > This might be the biggest part. If you look at _log() it always does the 
> > vsprintf()
> > even if in fact log_dispatch() does not dispatch it to anything.
>
> Yes, log_dispatch / log_passes_filter are called after vsnprintf
>
> > I suspect that could be refactored to move the checking to a separate 
> > function,
> > and then call it before doing the expensive vsprintf().
>
> Or save va_list, fmt in log_rec and call vsnprintf allow when needed in 
> log_dispatch, just before emit

Yes that sounds better to me.

>
> > >
> > > 3/ treatment added in log_console_emit (some printf) and
> > > log_dispatch (processing_msg / gd->loghead)
> >
> > Likely this is fast.
> >
> > >
> > > 4/ lower cache performancy as trace code are pesent in memory even
> > > they are not used
> > >
> > > Can I do some check/experimentation on my side ?
> >
> > Yes, if you can use the bootstage_start() and bootstage_accum() within the 
> > _log()
> > function to measure the total time take in the run.
>
> Ok, I add it in my TODO list

OK. We really should make logging add the least overhead possible.

Regards,
SImon


Re: [PATCH] Makefile: Correctly propagate failure when removing target

2020-10-30 Thread Simon Glass
Hi Paul,

On Tue, 27 Oct 2020 at 20:25, Pali Rohár  wrote:
>
> On Tuesday 27 October 2020 20:10:37 Simon Glass wrote:
> > Hi Paul,
> >
> > On Mon, 26 Oct 2020 at 07:11, Pali Rohár  wrote:
> > >
> > > On more places is used pattern 'command > $@ || rm -f $@'. But it does not
> > > propagate failure from 'command' as 'rm -f' returns success.
> > >
> > > Fix it by calling 'false' to correctly propagate failure after 'rm -f'.
> > >
> > > Signed-off-by: Pali Rohár 
> > > ---
> > >  Makefile | 12 ++--
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > Reviewed-by: Simon Glass 
> >
> > But I'm not sure about the use of {}. I would normally use ()
>
> ( ... ) spawns new shell and run commands in that new shell
> { ... ; } groups command together and runs them in the current shell
>
> So { ... ; } should be more efficient as it spawns less processes. But
> result should be same, return value from 'false', which returns 1.
>
> I'm using { ... ; } when it is not needed to spawns new processes and
> running commands in current shell is fine. I think that writing ( ... )
> should be equivalent to sh -c '...' (with correctly exported variables).

OK thank you.

Regards,
Simon


Re: [PATCH 16/25] binman: Avoid reporting image-pos with compression

2020-10-30 Thread Simon Glass
Hi Alper,

On Mon, 26 Oct 2020 at 17:20, Alper Nebi Yasak  wrote:
>
> On 26/10/2020 22:22, Simon Glass wrote:
> > Hi Alper,
> >
> > On Mon, 19 Oct 2020 at 15:29, Alper Nebi Yasak  
> > wrote:
> >>
> >> On 19/10/2020 05:41, Simon Glass wrote:
> >>> When a section is compressed, all entries within it are grouped together
> >>> into a compressed block of data. This obscures the start of each
> >>> individual child entry.
> >>>
> >>> Avoid reporting bogus 'image-pos' properties in this case, since it is
> >>> not possible to access the entry at the location provided. The entire
> >>> section must be decompressed first.
> >>>
> >>> CBFS does not support compressing whole sections, only individual files,
> >>> so needs no special handling here.
> >>>
> >>> Signed-off-by: Simon Glass 
> >>> ---
> >>
> >> Maybe instead of this, 'image-pos' could be overloaded to a list of
> >> recursive relative positions within compressed archives? Something like:
> >>
> >> section {
> >> offset = <1000>;
> >> compress = "lz4";
> >> /* image-pos = <1000>; */
> >>
> >> blob {
> >> filename = "foo";
> >> offset = <100>;
> >> /* image-pos = <1000>, <100>; */
> >> };
> >> };
> >>
> >> cbfs {
> >> offset = <2000>;
> >> /* image-pos = <2000>; */
> >>
> >> blob {
> >> filename = "bar";
> >> cbfs-compress = "lz4";
> >> cbfs-offset = <200>;
> >> /* image-pos = <2200>, <0>; */
> >> };
> >>
> >> blob2 {
> >> filename = "baz";
> >> cbfs-offset = <800>;
> >> /* image-pos = <2800>; */
> >> };
> >> };
> >>
> >
> > What do these values actually mean though? What would we use them for?
>
> What I meant is using pairs of ,
>  to avoid losing position information of
> compressed entries, but honestly I'm not sure if any of this will be
> necessary. I think the single use would be to avoid parsing uncompressed
> data containing multiple entries to identify what is where.
>
> To get to an entry in a compressed section we could get "size" bytes of
> data starting from "image-pos[0]", decompress that to somewhere, then
> get "uncomp-size" bytes of data starting from decompression address +
> "image-pos[1]".  I think it can even be extended to multiple layers of
> compression (, , , ...).
>
> > Note that CBFS compresses its data on a per-entry basis so the
> > image-pos is actually supported.
>
> On the compressed cbfs example, I assume the data we currently get at
> image-pos = <2200> is compressed data and still needs to be decompressed
> for it to be useable (technically bogus?). If so, I'd go a level deeper
> by adding a <0> indicating the start of the uncompressed data is the
> actual position of the entry contents.

For the CBFS case there isn't anything needed I think.

We already have an offset field which tells you where something is in
the compressed data. For the case where a compressed section has just
other entries in it, the offset is enough.

For the case where the compressed section has other uncompressed
sections, we need to add together the offsets (uncompressed section +
its entry) to get to the compressed location. It certainly has some
benefits.

But I wonder if instead we should have a properly like comp-pos that
tells you the absolute offset within the compressed section? I'm not a
big fan of making image-pos a multi-cell value.

Regards,
Simon


Re: [PATCH 08/18] serial: add uart driver for MediaTek MT7620 SoC

2020-10-30 Thread Simon Glass
Hi Weijie,

On Thu, 29 Oct 2020 at 21:21, Weijie Gao  wrote:
>
> On Thu, 2020-10-29 at 08:30 -0600, Simon Glass wrote:
> > Hi Weijie,
> >
> > On Thu, 29 Oct 2020 at 03:47, Weijie Gao  wrote:
> > >
> > > On Mon, 2020-10-26 at 22:51 -0600, Simon Glass wrote:
> > > > Hi Weijie,
> > > >
> > > > On Fri, 16 Oct 2020 at 01:36, Weijie Gao  
> > > > wrote:
> > > > >
> > > > > This patch adds uart support for MediaTek MT7620 and earlier SoCs.
> > > > >
> > > > > The UART used by MT7620 is incompatible with the ns16550a driver.
> > > > > All registers of this UART have different addresses. A special 16-bit
> > > > > register for Divisor Latch is used to set the baudrate instead of the
> > > > > original two 8-bit registers (DLL and DLM).
> > > > >
> > > > > The driver can be built without DM which is useful for tiny SPL.
> > > > >
> > > > > Signed-off-by: Weijie Gao 
> > > > > ---
> > > > >  drivers/serial/Kconfig |  20 ++
> > > > >  drivers/serial/Makefile|   1 +
> > > > >  drivers/serial/serial.c|   2 +
> > > > >  drivers/serial/serial_mt7620.c | 350 
> > > > > +
> > > > >  4 files changed, 373 insertions(+)
> > > > >  create mode 100644 drivers/serial/serial_mt7620.c
> > > >
> > > > Why do you need to build without DM? We have of-platdata which
> > > > provides for smaller images. What is the SRAM size available?
> > > >
> > >
> > > Actually it's the total size (spl+u-boot-lzma.img) that matters.
> > > mt7620_rfb_defconfig is configured to be compatible with the original
> > > u-boot from MTK SDK, and the maximum size is 192KiB.
> >
> > What is lzma.img ?
>
> The u-boot.bin is compressed to reduce it's size (395KiB -> 150KiB), and
> the SPL is responsible to decompress it.
>
> >
> > >
> > > Currently without SPL_DM, the final image u-boot-with-spl.bin is about
> > > 170KiB, the u-boot-spl.bin is only 20KiB.
> >
> > That is definitely huge.
>
> Without the decompression code, the size of SPL will be reduced to 9KiB.

OK...so is it possible to have SPL load U-Boot, instead of including
it in SRAM? That is normally what is done.

>
> >
> > > If SPL_DM is enabled, the total size is 189KiB, which is very close to
> > > the limit 192KiB, and the size of spl is almost doubled, 39KiB.
> > > (Without DM, only serial_mt7620 is needed. However with DM, both
> > > serial_mt7620, clk-mt7620 and misc are needed)
> > >
> > > Considering that we may still add some feature to mt7620_rfb_defconfig
> > > in the future, only 3KiB left is not enough. Building without DM is
> > > apparently better.
> > >
> > > I believe using of-platdata can only reduce few KiBs of SPL, because the
> > > DM itself is the largest overhead.
> >
> > That's not my experience. The core DM overhead is fairly small,
> > perhaps 3-4KB. The device tree itself is typically at least another
> > 3KB, depending on how many nodes you mark for inclusion in SPL.
> >
> > With of-platdata the overhead of DM is not that terrible. You can see
> > some stats here:
>
> I have tried to optimize drivers and configs used in SPL, and managed to
> reduce the size of SPL to 22KiB with of-platdata (without DM, the size
> is 17KiB. So it's only 5KiB used by DM).
>
> I'll switch this driver to of-platdata in the next series.

Gosh that was quick, nice work!

>
> >
> > http://u-boot.10912.n7.nabble.com/RFC-PATCH-v2-0-3-RFC-tiny-dm-Proposal-for-using-driver-model-in-SPL-td418552.html

Regards,
Simon


[PATCH] log: typo logl_pref in documentation

2020-10-30 Thread Heinrich Schuchardt
The name of structure element logl_prev is not matched by the
documentation.

%s/logl_pref/logl_prev/

Signed-off-by: Heinrich Schuchardt 
---
 include/asm-generic/global_data.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 0157af1aa4..0e8843b478 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -378,7 +378,7 @@ struct global_data {
 */
int logc_prev;
/**
-* @logl_pref: logging level of the previous message
+* @logl_prev: logging level of the previous message
 *
 * This value is used as logging level for continuation messages.
 */
--
2.28.0



Re: [PATCH] fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE

2020-10-30 Thread João Marcos Costa
Tested-by Joao Marcos Costa 

Em sex., 30 de out. de 2020 às 10:42, Gerard Koskamp <
gerard.kosk...@nedap.com> escreveu:

> I've created a squashfs file system with Yocto (it use squashfs-tools)
> and u-boot command sqfsls give the error:'Error while searching inode:
> unknown type.'
> After some digging in the code I found that the index is off by 1.
> This patch fix this issue and I can successful use the sqfsls command.
> After search for the squashfs format I found a link talk about a
> similar issue but this time in the documentation. The link is:
> https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529
>
> Signed-off-by: Gerard Koskamp 
> CC: Joao Marcos Costa 
> ---
>
>  fs/squashfs/sqfs_inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
> index 14d70cf..0983974 100644
> --- a/fs/squashfs/sqfs_inode.c
> +++ b/fs/squashfs/sqfs_inode.c
> @@ -49,7 +49,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode,
> u32 blk_size)
> return sizeof(*ldir);
>
> di = ldir->index;
> -   while (l < i_count + 1) {
> +   while (l < i_count) {
> sz = get_unaligned_le32(>size) + 1;
> index_list_size += sz;
> di = (void *)di + sizeof(*di) + sz;
> @@ -57,7 +57,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode,
> u32 blk_size)
> }
>
> return sizeof(*ldir) + index_list_size +
> -   (i_count + 1) * SQFS_DIR_INDEX_BASE_LENGTH;
> +   i_count * SQFS_DIR_INDEX_BASE_LENGTH;
> }
>
> case SQFS_LREG_TYPE: {
> --
> 2.7.4



-- 
Atenciosamente,
João Marcos Costa

www.linkedin.com/in/jmarcoscosta/
https://github.com/jmarcoscosta


[PATCH] test: unit test for efi_create_indexed_name()

2020-10-30 Thread Heinrich Schuchardt
Provide a unit test for function efi_create_indexed_name().

Signed-off-by: Heinrich Schuchardt 
---
 test/unicode_ut.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 26d96336f3..33fc8b0ee1 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -594,6 +595,24 @@ static int unicode_test_u16_strsize(struct unit_test_state 
*uts)
 }
 UNICODE_TEST(unicode_test_u16_strsize);

+#ifdef CONFIG_EFI_LOADER
+static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
+{
+   u16 buf[16];
+   u16 const expected[] = L"Capsule0AF9";
+   u16 *pos;
+
+   memset(buf, 0xeb, sizeof(buf));
+   pos = efi_create_indexed_name(buf, "Capsule", 0x0af9);
+
+   ut_asserteq_mem(expected, buf, sizeof(expected));
+   ut_asserteq(pos - buf, u16_strnlen(buf, SIZE_MAX));
+
+   return 0;
+}
+UNICODE_TEST(unicode_test_efi_create_indexed_name);
+#endif
+
 int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc, char *const 
argv[])
 {
struct unit_test *tests = ll_entry_start(struct unit_test, 
unicode_test);
--
2.28.0



[PATCH] test: unit test for efi_create_indexed_name()

2020-10-30 Thread Heinrich Schuchardt
Provide a unit test for function efi_create_indexed_name().

Signed-off-by: Heinrich Schuchardt 
---
 test/unicode_ut.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 26d96336f3..33fc8b0ee1 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -594,6 +595,24 @@ static int unicode_test_u16_strsize(struct unit_test_state 
*uts)
 }
 UNICODE_TEST(unicode_test_u16_strsize);

+#ifdef CONFIG_EFI_LOADER
+static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
+{
+   u16 buf[16];
+   u16 const expected[] = L"Capsule0AF9";
+   u16 *pos;
+
+   memset(buf, 0xeb, sizeof(buf));
+   pos = efi_create_indexed_name(buf, "Capsule", 0x0af9);
+
+   ut_asserteq_mem(expected, buf, sizeof(expected));
+   ut_asserteq(pos - buf, u16_strnlen(buf, SIZE_MAX));
+
+   return 0;
+}
+UNICODE_TEST(unicode_test_efi_create_indexed_name);
+#endif
+
 int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc, char *const 
argv[])
 {
struct unit_test *tests = ll_entry_start(struct unit_test, 
unicode_test);
--
2.28.0



[PATCH] cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT

2020-10-30 Thread Alper Nebi Yasak
The cros_ec_keyb driver currently uses EC_CMD_MKBP_STATE to scan the
keyboard, but this host command was superseded by EC_CMD_GET_NEXT_EVENT
and unavailable on more recent devices (including gru-kevin), as it was
removed in cros-ec commit 87a071941b89 ("mkbp: Add support for buttons
and switches.") dated 2016-07-06.

The EC_CMD_GET_NEXT_EVENT has been available since cros-ec commit
d1ed75815efe ("MKBP event signalling implementation") dated 2014-10-20,
but it looks like it isn't included in firmware-* branches for at least
link, nyan-big, samus, snow, spring, panther and peach-pit which have
defconfigs in U-Boot. So this patch falls back to the old method if the
EC doesn't recognize the newer command.

The implementation is mostly adapted from Depthcharge commit
f88af26b44fc ("cros_ec: Change keyboard scanning method.").

On a gru-kevin, the current driver before this patch fails to read the
pressed keys with:

out: cmd=0x60: 03 9d 60 00 00 00 00 00
in-header: 03 fc 01 00 00 00 00 00
in-data:
ec_command_inptr: len=-1, din=
check_for_keys: keyboard scan failed

However the keyboard works fine with the newer command:

out: cmd=0x67: 03 96 67 00 00 00 00 00
in-header: 03 ef 00 00 0e 00 00 00
in-data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ec_command_inptr: len=14, din=f412df30
key_matrix_decode: num_keys = 0
  0 valid keycodes found
out: cmd=0x67: 03 96 67 00 00 00 00 00
in-header: 03 df 00 00 0e 00 00 00
in-data: 00 00 00 00 00 00 00 00 00 00 00 00 10 00
ec_command_inptr: len=14, din=f412df30
key_matrix_decode: num_keys = 1
  valid=1, row=4, col=11
keycode=28
  1 valid keycodes found
 {0d}

Signed-off-by: Alper Nebi Yasak 
---

 drivers/input/cros_ec_keyb.c | 32 ++--
 drivers/misc/cros_ec.c   | 15 +++
 include/cros_ec.h| 11 +++
 3 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
index 00bf58f2b5d2..0c0f52205b28 100644
--- a/drivers/input/cros_ec_keyb.c
+++ b/drivers/input/cros_ec_keyb.c
@@ -47,15 +47,35 @@ static int check_for_keys(struct udevice *dev, struct 
key_matrix_key *keys,
struct key_matrix_key *key;
static struct mbkp_keyscan last_scan;
static bool last_scan_valid;
-   struct mbkp_keyscan scan;
+   struct ec_response_get_next_event event;
+   struct mbkp_keyscan *scan = (struct mbkp_keyscan *)
+   _matrix;
unsigned int row, col, bit, data;
int num_keys;
+   int ret;
 
-   if (cros_ec_scan_keyboard(dev->parent, )) {
-   debug("%s: keyboard scan failed\n", __func__);
+   /* Get pending MKBP event. It may not be a key matrix event. */
+   do {
+   ret = cros_ec_get_next_event(dev->parent, );
+   /* The EC has no events for us at this time. */
+   if (ret == -EC_RES_UNAVAILABLE)
+   return -EIO;
+   else if (ret)
+   break;
+   } while (event.event_type != EC_MKBP_EVENT_KEY_MATRIX);
+
+   /* Try the old command if the EC doesn't support the above. */
+   if (ret == -EC_RES_INVALID_COMMAND) {
+   if (cros_ec_scan_keyboard(dev->parent, scan)) {
+   debug("%s: keyboard scan failed\n", __func__);
+   return -EIO;
+   }
+   } else if (ret) {
+   debug("%s: Error getting next MKBP event. (%d)\n",
+ __func__, ret);
return -EIO;
}
-   *samep = last_scan_valid && !memcmp(_scan, , sizeof(scan));
+   *samep = last_scan_valid && !memcmp(_scan, scan, sizeof(*scan));
 
/*
 * This is a bit odd. The EC has no way to tell us that it has run
@@ -64,14 +84,14 @@ static int check_for_keys(struct udevice *dev, struct 
key_matrix_key *keys,
 * that this scan is the same as the last.
 */
last_scan_valid = true;
-   memcpy(_scan, , sizeof(last_scan));
+   memcpy(_scan, scan, sizeof(last_scan));
 
for (col = num_keys = bit = 0; col < priv->matrix.num_cols;
col++) {
for (row = 0; row < priv->matrix.num_rows; row++) {
unsigned int mask = 1 << (bit & 7);
 
-   data = scan.data[bit / 8];
+   data = scan->data[bit / 8];
if ((data & mask) && num_keys < max_count) {
key = keys + num_keys++;
key->row = row;
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index a5534b16673b..c3674908ee82 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -415,6 +415,21 @@ int cros_ec_scan_keyboard(struct udevice *dev, struct 
mbkp_keyscan *scan)
return 0;
 }
 
+int 

Re: [PATCH 1/1] env: typo enougth

2020-10-30 Thread Joe Hershberger
On Fri, Oct 30, 2020 at 12:11 AM Heinrich Schuchardt  wrote:
>
> %s/enougth/enough/
>
> Signed-off-by: Heinrich Schuchardt 

Acked-by: Joe Hershberger 


Re: [PATCH v4 8/8] doc: rockchip: Document Rockchip miniloader flashing

2020-10-30 Thread Kever Yang



On 2020/10/28 下午9:33, Jagan Teki wrote:

This would be useful and recommended boot flow for new boards
which has doesn't have the DDR support yet in mainline.

Sometimes it is very useful for debugging mainline DDR support.

Documen it for px30 boot flow.

Signed-off-by: Jagan Teki 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
Changes for v4:
- none

  doc/board/rockchip/rockchip.rst | 40 -
  1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst
index 8c92de0c92..955e6858f2 100644
--- a/doc/board/rockchip/rockchip.rst
+++ b/doc/board/rockchip/rockchip.rst
@@ -123,6 +123,9 @@ To build rk3399 boards::
  Flashing
  
  
+1. Package the image with U-Boot TPL/SPL

+-
+
  SD Card
  ^^^
  
@@ -187,6 +190,39 @@ Copy SPI boot images into SD card and boot from SD::

  sf erase 0x6 +$filesize
  sf write $kernel_addr_r 0x6 ${filesize}
  
+2. Package the image with Rockchip miniloader

+-
+
+Image package with Rockchip miniloader requires robin [1].
+
+Create idbloader.img
+
+.. code-block:: none
+
+  cd u-boot
+  ./tools/mkimage -n px30 -T rksd -d rkbin/bin/rk33/px30_ddr_333MHz_v1.15.bin 
idbloader.img
+  cat rkbin/bin/rk33/px30_miniloader_v1.22.bin >> idbloader.img
+  sudo dd if=idbloader.img of=/dev/sda seek=64
+
+Create trust.img
+
+.. code-block:: none
+
+  cd rkbin
+  ./tools/trust_merger RKTRUST/PX30TRUST.ini
+  sudo dd if=trust.img of=/dev/sda seek=24576
+
+Create uboot.img
+
+.. code-block:: none
+
+  rbink/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img 0x20
+  sudo dd if=uboot.img of=/dev/sda seek=16384
+
+Note:
+1. 0x20 is load address and it's an optional in some platforms.
+2. rkbin binaries are kept on updating, so would recommend to use the latest 
versions.
+
  TODO
  
  
@@ -195,5 +231,7 @@ TODO

  - Document SPI flash boot
  - Add missing SoC's with it boards list
  
+[1] https://github.com/rockchip-linux/rkbin

+
  .. Jagan Teki 
-.. Tuesday 02 June 2020 12:18:57 AM IST
+.. Wednesday 28 October 2020 06:47:26 PM IST





Re: [PATCH v4 7/8] rockchip: Add Engicam PX30.Core C.TOUCH 2.0

2020-10-30 Thread Kever Yang



On 2020/10/28 下午9:33, Jagan Teki wrote:

PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.

C.TOUCH 2.0 is a general purpose carrier board with capacitive
touch interface support.

PX30.Core needs to mount on top of this Carrier board for creating
complete PX30.Core C.TOUCH 2.0 board.

Add support for it.

Signed-off-by: Jagan Teki 
Signed-off-by: Suniel Mahesh 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
Changes for v4:
- none

  arch/arm/dts/Makefile|   1 +
  arch/arm/dts/px30-px30-core-ctouch2.dts  |  22 +
  arch/arm/mach-rockchip/px30/Kconfig  |   7 ++
  board/engicam/px30_core/MAINTAINERS  |   6 ++
  configs/px30-core-ctouch2-px30_defconfig | 108 +++
  5 files changed, 144 insertions(+)
  create mode 100644 arch/arm/dts/px30-px30-core-ctouch2.dts
  create mode 100644 configs/px30-core-ctouch2-px30_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b87f4334a5..658617d4dc 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -72,6 +72,7 @@ dtb-$(CONFIG_MACH_S700) += \
  dtb-$(CONFIG_ROCKCHIP_PX30) += \
px30-evb.dtb \
px30-firefly.dtb \
+   px30-px30-core-ctouch2.dtb \
px30-px30-core-edimm2.2.dtb \
rk3326-odroid-go2.dtb
  
diff --git a/arch/arm/dts/px30-px30-core-ctouch2.dts b/arch/arm/dts/px30-px30-core-ctouch2.dts

new file mode 100644
index 00..2da0128188
--- /dev/null
+++ b/arch/arm/dts/px30-px30-core-ctouch2.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd
+ * Copyright (c) 2020 Engicam srl
+ * Copyright (c) 2020 Amarula Solutions
+ * Copyright (c) 2020 Amarula Solutions(India)
+ */
+
+/dts-v1/;
+#include "px30.dtsi"
+#include "px30-engicam-ctouch2.dtsi"
+#include "px30-px30-core.dtsi"
+
+/ {
+   model = "Engicam PX30.Core C.TOUCH 2.0";
+   compatible = "engicam,px30-core-ctouch2", "engicam,px30-px30-core",
+"rockchip,px30";
+
+   chosen {
+   stdout-path = "serial2:115200n8";
+   };
+};
diff --git a/arch/arm/mach-rockchip/px30/Kconfig 
b/arch/arm/mach-rockchip/px30/Kconfig
index 5d014f6561..16090f5b08 100644
--- a/arch/arm/mach-rockchip/px30/Kconfig
+++ b/arch/arm/mach-rockchip/px30/Kconfig
@@ -20,6 +20,13 @@ config TARGET_PX30_CORE
  * PX30.Core needs to mount on top of EDIMM2.2 for creating complete
PX30.Core EDIMM2.2 Starter Kit.
  
+	  PX30.Core CTOUCH2:

+ * PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.
+ * CTOUCH2.0 is a general purpose Carrier board with capacitive
+   touch interface support.
+ * PX30.Core needs to mount on top of CTOUCH2.0 for creating complete
+   PX30.Core C.TOUCH Carrier board.
+
  config ROCKCHIP_BOOT_MODE_REG
default 0xff010200
  
diff --git a/board/engicam/px30_core/MAINTAINERS b/board/engicam/px30_core/MAINTAINERS

index f98a84450a..b87ca22207 100644
--- a/board/engicam/px30_core/MAINTAINERS
+++ b/board/engicam/px30_core/MAINTAINERS
@@ -1,3 +1,9 @@
+PX30-Core-CTOUCH2.0
+M: Jagan Teki 
+M: Suniel Mahesh 
+S: Maintained
+F: configs/px30-core-ctouch2-px30_defconfig
+
  PX30-Core-EDIMM2.2
  M:Jagan Teki 
  M:Suniel Mahesh 
diff --git a/configs/px30-core-ctouch2-px30_defconfig 
b/configs/px30-core-ctouch2-px30_defconfig
new file mode 100644
index 00..d64f05d8c0
--- /dev/null
+++ b/configs/px30-core-ctouch2-px30_defconfig
@@ -0,0 +1,108 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x0020
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SPL_TEXT_BASE=0x
+CONFIG_ROCKCHIP_PX30=y
+CONFIG_TARGET_PX30_CORE=y
+CONFIG_DEBUG_UART_CHANNEL=1
+CONFIG_TPL_LIBGENERIC_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL_STACK_R_ADDR=0x60
+CONFIG_DEBUG_UART_BASE=0xFF16
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_DEFAULT_DEVICE_TREE="px30-px30-core-ctouch2"
+CONFIG_DEBUG_UART=y
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x600
+# CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_CONSOLE_MUX is not set
+CONFIG_DEFAULT_FDT_FILE="rockchip/px30-px30-core-ctouch2.dtb"
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_SPL_BOOTROM_SUPPORT=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_STACK_R=y
+# CONFIG_TPL_BANNER_PRINT is not set
+CONFIG_SPL_CRC32_SUPPORT=y
+CONFIG_SPL_ATF=y
+# CONFIG_TPL_FRAMEWORK is not set
+# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_LZMADEC is not set
+# CONFIG_CMD_UNZIP is not set
+CONFIG_CMD_GPT=y
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_ITEST is not set
+# 

Re: [PATCH v4 6/8] arm64: dts: rockchip: px30: Add Engicam C.TOUCH 2.0

2020-10-30 Thread Kever Yang



On 2020/10/28 下午9:33, Jagan Teki wrote:

Engicam C.TOUCH 2.0 is an EDIMM compliant general purpose
carrier board with capacitive touch interface.

Genaral features:
- TFT 10.1" industrial, 1280x800 LVDS display
- Ethernet 10/100
- Wifi/BT
- USB Type A/OTG
- Audio Out
- CAN
- LVDS panel connector

SOM's like PX30.Core needs to mount on top of this Carrier board
for creating complete PX30.Core C.TOUCH 2.0 board.

Add support for it.

Signed-off-by: Jagan Teki 
Signed-off-by: Michael Trimarchi 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
Changes for v4:
- none

  arch/arm/dts/px30-engicam-ctouch2.dtsi | 8 
  1 file changed, 8 insertions(+)
  create mode 100644 arch/arm/dts/px30-engicam-ctouch2.dtsi

diff --git a/arch/arm/dts/px30-engicam-ctouch2.dtsi 
b/arch/arm/dts/px30-engicam-ctouch2.dtsi
new file mode 100644
index 00..58425b1e55
--- /dev/null
+++ b/arch/arm/dts/px30-engicam-ctouch2.dtsi
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Engicam srl
+ * Copyright (c) 2020 Amarula Solutions
+ * Copyright (c) 2020 Amarula Solutions(India)
+ */
+
+#include "px30-engicam-common.dtsi"





Re: [PATCH v4 4/8] board: engicam: Attach i.MX6 common code

2020-10-30 Thread Kever Yang



On 2020/10/28 下午9:33, Jagan Teki wrote:

The existing common code for Engicam boards uses i.MX6,
so attach that into i.MX6 Engicam boards so-that adding
new SoC variants of Engicam boards become meaningful.

Add support for it.

Cc: Stefano Babic 
Signed-off-by: Jagan Teki 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
Changes for v4:
- none

  board/engicam/common/Kconfig  | 8 
  board/engicam/common/Makefile | 7 +--
  board/engicam/imx6q/Kconfig   | 2 ++
  board/engicam/imx6ul/Kconfig  | 2 ++
  4 files changed, 17 insertions(+), 2 deletions(-)
  create mode 100644 board/engicam/common/Kconfig

diff --git a/board/engicam/common/Kconfig b/board/engicam/common/Kconfig
new file mode 100644
index 00..38328fd5ea
--- /dev/null
+++ b/board/engicam/common/Kconfig
@@ -0,0 +1,8 @@
+config IMX6_ENGICAM_COMMON
+   bool "Engicam i.MX6 Common code"
+   depends on SPL && MX6
+   default y if TARGET_MX6Q_ENGICAM || TARGET_MX6UL_ENGICAM
+   help
+ Common SPL and U-Boot proper code for Engicam i.MX6 targets.
+
+ Enable it in board Kconfig if it uses i.MX6 variant Engicam boards.
diff --git a/board/engicam/common/Makefile b/board/engicam/common/Makefile
index b392bf6cb1..15f0eaa1ec 100644
--- a/board/engicam/common/Makefile
+++ b/board/engicam/common/Makefile
@@ -1,5 +1,8 @@
  # SPDX-License-Identifier: GPL-2.0+
  # Copyright (C) 2016 Amarula Solutions B.V.
  
-obj-y := board.o

-obj-$(CONFIG_SPL_BUILD) += spl.o
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_IMX6_ENGICAM_COMMON) += spl.o
+else
+obj-$(CONFIG_IMX6_ENGICAM_COMMON) += board.o
+endif
diff --git a/board/engicam/imx6q/Kconfig b/board/engicam/imx6q/Kconfig
index 48eb60c09a..fab8da0e73 100644
--- a/board/engicam/imx6q/Kconfig
+++ b/board/engicam/imx6q/Kconfig
@@ -9,4 +9,6 @@ config SYS_VENDOR
  config SYS_CONFIG_NAME
default "imx6-engicam"
  
+source "board/engicam/common/Kconfig"

+
  endif
diff --git a/board/engicam/imx6ul/Kconfig b/board/engicam/imx6ul/Kconfig
index e91dd15970..58f25d0623 100644
--- a/board/engicam/imx6ul/Kconfig
+++ b/board/engicam/imx6ul/Kconfig
@@ -9,4 +9,6 @@ config SYS_VENDOR
  config SYS_CONFIG_NAME
default "imx6-engicam"
  
+source "board/engicam/common/Kconfig"

+
  endif





Re: [PATCH v4 5/8] rockchip: Add Engicam PX30.Core EDIMM2.2 Starter Kit

2020-10-30 Thread Kever Yang



On 2020/10/28 下午9:33, Jagan Teki wrote:

PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.

EDIMM2.2 Starter Kit is an EDIMM 2.2 Form Factor Capacitive
Evaluation Board from Engicam.

PX30.Core needs to mount on top of this Evaluation board for
creating complete PX30.Core EDIMM2.2 Starter Kit.

Add support for it.

Signed-off-by: Jagan Teki 
Signed-off-by: Suniel Mahesh 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
Changes for v4:
- drop ram change
- on top of 
https://patchwork.ozlabs.org/project/uboot/patch/20201001184003.3704604-1-he...@sntech.de/

  arch/arm/dts/Makefile |   1 +
  arch/arm/dts/px30-px30-core-edimm2.2.dts  |  21 +
  arch/arm/mach-rockchip/px30/Kconfig   |  10 ++
  board/engicam/px30_core/Kconfig   |  16 
  board/engicam/px30_core/MAINTAINERS   |   7 ++
  board/engicam/px30_core/Makefile  |   7 ++
  board/engicam/px30_core/px30_core.c   |   4 +
  configs/px30-core-edimm2.2-px30_defconfig | 108 ++
  include/configs/px30_core.h   |  15 +++
  9 files changed, 189 insertions(+)
  create mode 100644 arch/arm/dts/px30-px30-core-edimm2.2.dts
  create mode 100644 board/engicam/px30_core/Kconfig
  create mode 100644 board/engicam/px30_core/MAINTAINERS
  create mode 100644 board/engicam/px30_core/Makefile
  create mode 100644 board/engicam/px30_core/px30_core.c
  create mode 100644 configs/px30-core-edimm2.2-px30_defconfig
  create mode 100644 include/configs/px30_core.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b195723f16..b87f4334a5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -72,6 +72,7 @@ dtb-$(CONFIG_MACH_S700) += \
  dtb-$(CONFIG_ROCKCHIP_PX30) += \
px30-evb.dtb \
px30-firefly.dtb \
+   px30-px30-core-edimm2.2.dtb \
rk3326-odroid-go2.dtb
  
  dtb-$(CONFIG_ROCKCHIP_RK3036) += \

diff --git a/arch/arm/dts/px30-px30-core-edimm2.2.dts 
b/arch/arm/dts/px30-px30-core-edimm2.2.dts
new file mode 100644
index 00..c36280ce7f
--- /dev/null
+++ b/arch/arm/dts/px30-px30-core-edimm2.2.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd
+ * Copyright (c) 2020 Engicam srl
+ * Copyright (c) 2020 Amarula Solutions(India)
+ */
+
+/dts-v1/;
+#include "px30.dtsi"
+#include "px30-engicam-edimm2.2.dtsi"
+#include "px30-px30-core.dtsi"
+
+/ {
+   model = "Engicam PX30.Core EDIMM2.2 Starter Kit";
+   compatible = "engicam,px30-core-edimm2.2", "engicam,px30-px30-core",
+"rockchip,px30";
+
+   chosen {
+   stdout-path = "serial2:115200n8";
+   };
+};
diff --git a/arch/arm/mach-rockchip/px30/Kconfig 
b/arch/arm/mach-rockchip/px30/Kconfig
index 6cd65dfa97..5d014f6561 100644
--- a/arch/arm/mach-rockchip/px30/Kconfig
+++ b/arch/arm/mach-rockchip/px30/Kconfig
@@ -11,6 +11,15 @@ config TARGET_EVB_PX30
  config TARGET_ODROID_GO2
bool "ODROID_GO2"
  
+config TARGET_PX30_CORE

+   bool "Engicam PX30.Core"
+   help
+ PX30.Core EDIMM2.2:
+ * PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.
+ * EDIMM2.2 is a Form Factor Capacitive Evaluation Board from Engicam.
+ * PX30.Core needs to mount on top of EDIMM2.2 for creating complete
+   PX30.Core EDIMM2.2 Starter Kit.
+
  config ROCKCHIP_BOOT_MODE_REG
default 0xff010200
  
@@ -44,6 +53,7 @@ config DEBUG_UART_CHANNEL

  For using the UART for early debugging the route to use needs
  to be declared (0 or 1).
  
+source "board/engicam/px30_core/Kconfig"

  source "board/hardkernel/odroid_go2/Kconfig"
  source "board/rockchip/evb_px30/Kconfig"
  
diff --git a/board/engicam/px30_core/Kconfig b/board/engicam/px30_core/Kconfig

new file mode 100644
index 00..a03be78369
--- /dev/null
+++ b/board/engicam/px30_core/Kconfig
@@ -0,0 +1,16 @@
+if TARGET_PX30_CORE
+
+config SYS_BOARD
+   default "px30_core"
+
+config SYS_VENDOR
+   default "engicam"
+
+config SYS_CONFIG_NAME
+   default "px30_core"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+   def_bool y
+   select RAM_PX30_DDR4
+
+endif
diff --git a/board/engicam/px30_core/MAINTAINERS 
b/board/engicam/px30_core/MAINTAINERS
new file mode 100644
index 00..f98a84450a
--- /dev/null
+++ b/board/engicam/px30_core/MAINTAINERS
@@ -0,0 +1,7 @@
+PX30-Core-EDIMM2.2
+M: Jagan Teki 
+M: Suniel Mahesh 
+S: Maintained
+F: board/engicam/px30_core
+F: include/configs/px30_core.h
+F: configs/px30-core-edimm2.2-px30_defconfig
diff --git a/board/engicam/px30_core/Makefile b/board/engicam/px30_core/Makefile
new file mode 100644
index 00..321fdb0173
--- /dev/null
+++ b/board/engicam/px30_core/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2020 Amarula Solutions(India)
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += px30_core.o
diff --git a/board/engicam/px30_core/px30_core.c 

Re: [PATCH] configs: meson64_android: don't show logo on ROM USB boot

2020-10-30 Thread Neil Armstrong
On 30/10/2020 16:03, Mattijs Korpershoek wrote:
> From: Guillaume La Roque 
> 
> When booting from rom usb, skip the boot logo logic as it's possible
> that the partition containing the logo does not exist yet.
> 
> Signed-off-by: Neil Armstrong 
> Signed-off-by: Guillaume La Roque 
> Signed-off-by: Mattijs Korpershoek 
> ---
>  include/configs/meson64_android.h | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/configs/meson64_android.h 
> b/include/configs/meson64_android.h
> index 8fff915b50a4..c47d51c85368 100644
> --- a/include/configs/meson64_android.h
> +++ b/include/configs/meson64_android.h
> @@ -98,11 +98,14 @@
>   func(SYSTEM, system, na) \
>  
>  #define PREBOOT_LOAD_LOGO \
> - "mmc dev ${mmcdev};" \
> - "part start mmc ${mmcdev} ${logopart} boot_start;" \
> - "part size mmc ${mmcdev} ${logopart} boot_size;" \
> - "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
> + "if test \"${boot_source}\" != \"usb\" && " \
> + "gpt verify mmc ${mmcdev} ${partitions}; then; " \
> + "mmc dev ${mmcdev};" \
> + "part start mmc ${mmcdev} ${logopart} boot_start;" \
> + "part size mmc ${mmcdev} ${logopart} boot_size;" \
> + "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
>   "bmp display ${loadaddr} m m;" \
> + "fi;" \
>   "fi;"
>  
>  #define CONFIG_EXTRA_ENV_SETTINGS \
> 

Applied to u-boot-amlogic


Re: [PATCH v1 5/7] apalis-imx8: add implementation for board_mem_get_layout

2020-10-30 Thread Oleksandr Suvorov
On Thu, Oct 22, 2020 at 11:22 AM Igor Opaniuk  wrote:
>
> From: Igor Opaniuk 
>
> Add implementation of board_mem_get_layout for overriding the memory
> layout.
>
> Signed-off-by: Igor Opaniuk 

Acked-by: Oleksandr Suvorov 

> ---
>
>  board/toradex/apalis-imx8/apalis-imx8.c | 23 +++
>  1 file changed, 23 insertions(+)
>
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c 
> b/board/toradex/apalis-imx8/apalis-imx8.c
> index 9263b0f51f..2ed66261d2 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -37,6 +37,29 @@ static void setup_iomux_uart(void)
> imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
>  }
>
> +void board_mem_get_layout(u64 *phys_sdram_1_start,
> + u64 *phys_sdram_1_size,
> + u64 *phys_sdram_2_start,
> + u64 *phys_sdram_2_size)
> +{
> +   u32 is_quadplus = 0, val = 0;
> +   sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, );
> +
> +   if (scierr == SC_ERR_NONE) {
> +   /* QP has one A72 core disabled */
> +   is_quadplus = ((val >> 4) & 0x3) != 0x0;
> +   }
> +
> +   *phys_sdram_1_start = PHYS_SDRAM_1;
> +   *phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
> +   *phys_sdram_2_start = PHYS_SDRAM_2;
> +   if (is_quadplus)
> +   /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +   *phys_sdram_2_size = 0x0UL;
> +   else
> +   *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +}
> +
>  int board_early_init_f(void)
>  {
> sc_pm_clock_rate_t rate = SC_80MHZ;
> --
> 2.17.1
>


-- 
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00


Re: [PATCH v1] verdinx-imx8mm: enable fdt overlays and env importing

2020-10-30 Thread Oleksandr Suvorov
On Fri, Oct 30, 2020 at 5:15 PM Oleksandr Suvorov
 wrote:
>
> On Fri, Oct 30, 2020 at 4:53 PM Igor Opaniuk  wrote:
> >
> > From: Igor Opaniuk 
> >
> > Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
> > for booting regular Toradex BSP images.
> >
> > Signed-off-by: Igor Opaniuk 
>
> NOT :) Reviewed-by: Oleksandr Suvorov 

A wrong patch answered.

>
> > ---
> >
> >  configs/verdin-imx8mm_defconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configs/verdin-imx8mm_defconfig 
> > b/configs/verdin-imx8mm_defconfig
> > index d856e3a318..60e5b03290 100644
> > --- a/configs/verdin-imx8mm_defconfig
> > +++ b/configs/verdin-imx8mm_defconfig
> > @@ -41,7 +41,6 @@ CONFIG_SYS_PROMPT="Verdin iMX8MM # "
> >  # CONFIG_BOOTM_NETBSD is not set
> >  CONFIG_CMD_ASKENV=y
> >  # CONFIG_CMD_EXPORTENV is not set
> > -# CONFIG_CMD_IMPORTENV is not set
> >  # CONFIG_CMD_CRC32 is not set
> >  CONFIG_CMD_MEMTEST=y
> >  CONFIG_SYS_MEMTEST_START=0x4000
> > @@ -103,3 +102,4 @@ CONFIG_SYSRESET_PSCI=y
> >  CONFIG_SYSRESET_WATCHDOG=y
> >  CONFIG_DM_THERMAL=y
> >  CONFIG_IMX_WATCHDOG=y
> > +CONFIG_OF_LIBFDT_OVERLAY=y
> > --
> > 2.17.1
> >
>
>
> --
> Best regards
> Oleksandr Suvorov
>
> Toradex AG
> Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00



-- 
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00


Re: [RESEND PATCH v1] verdin-imx8mm: enable fdt overlays and env importing

2020-10-30 Thread Oleksandr Suvorov
On Fri, Oct 30, 2020 at 4:55 PM Igor Opaniuk  wrote:
>
> From: Igor Opaniuk 
>
> Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
> for booting regular Toradex BSP images.
>
> Signed-off-by: Igor Opaniuk 

Reviewed-by: Oleksandr Suvorov 

> ---
>
>  configs/verdin-imx8mm_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
> index d856e3a318..60e5b03290 100644
> --- a/configs/verdin-imx8mm_defconfig
> +++ b/configs/verdin-imx8mm_defconfig
> @@ -41,7 +41,6 @@ CONFIG_SYS_PROMPT="Verdin iMX8MM # "
>  # CONFIG_BOOTM_NETBSD is not set
>  CONFIG_CMD_ASKENV=y
>  # CONFIG_CMD_EXPORTENV is not set
> -# CONFIG_CMD_IMPORTENV is not set
>  # CONFIG_CMD_CRC32 is not set
>  CONFIG_CMD_MEMTEST=y
>  CONFIG_SYS_MEMTEST_START=0x4000
> @@ -103,3 +102,4 @@ CONFIG_SYSRESET_PSCI=y
>  CONFIG_SYSRESET_WATCHDOG=y
>  CONFIG_DM_THERMAL=y
>  CONFIG_IMX_WATCHDOG=y
> +CONFIG_OF_LIBFDT_OVERLAY=y
> --
> 2.17.1
>


-- 
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00


Re: [patch v2 01/10] drivers/video/rockchip/rk_vop.c: Use endpoint compatible string to find VOP mode

2020-10-30 Thread Kever Yang

Hi Arnaud,

    Thanks for your patch.

    Please use module name as subject prefix instead of a file name, 
eg. "rockchip: video: vop".


On 2020/10/27 下午9:21, Arnaud Patard (Rtp) wrote:

The current code is using an hard coded enum and the of node reg value of
endpoint to find out if the endpoint is mipi/hdmi/lvds/edp/dp. The order
is different between rk3288, rk3399 vop little, rk3399 vop big.

A possible solution would be to make sure that the rk3288.dtsi and
rk3399.dtsi files have "expected" reg value or an other solution is
to find the kind of endpoint by comparing the endpoint compatible value.

This patch is implementing the more flexible second solution.

Signed-off-by: Arnaud Patard 

Index: u-boot/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
===
--- u-boot.orig/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
+++ u-boot/arch/arm/include/asm/arch-rockchip/vop_rk3288.h


For the patch format, please make sure the u-boot is the root directory.

Thanks,

- Kever


@@ -85,26 +85,13 @@ enum {
LB_RGB_1280X8 = 0x5
  };
  
-#if defined(CONFIG_ROCKCHIP_RK3399)

  enum vop_modes {
VOP_MODE_EDP = 0,
VOP_MODE_MIPI,
VOP_MODE_HDMI,
-   VOP_MODE_MIPI1,
-   VOP_MODE_DP,
-   VOP_MODE_NONE,
-};
-#else
-enum vop_modes {
-   VOP_MODE_EDP = 0,
-   VOP_MODE_HDMI,
VOP_MODE_LVDS,
-   VOP_MODE_MIPI,
-   VOP_MODE_NONE,
-   VOP_MODE_AUTO_DETECT,
-   VOP_MODE_UNKNOWN,
+   VOP_MODE_DP,
  };
-#endif
  
  /* VOP_VERSION_INFO */

  #define M_FPGA_VERSION (0x << 16)
Index: u-boot/drivers/video/rockchip/rk_vop.c
===
--- u-boot.orig/drivers/video/rockchip/rk_vop.c
+++ u-boot/drivers/video/rockchip/rk_vop.c
@@ -235,12 +235,11 @@ static int rk_display_init(struct udevic
struct clk clk;
enum video_log2_bpp l2bpp;
ofnode remote;
+   const char *compat;
  
  	debug("%s(%s, %lu, %s)\n", __func__,

  dev_read_name(dev), fbbase, ofnode_get_name(ep_node));
  
-	vop_id = ofnode_read_s32_default(ep_node, "reg", -1);

-   debug("vop_id=%d\n", vop_id);
ret = ofnode_read_u32(ep_node, "remote-endpoint", _phandle);
if (ret)
return ret;
@@ -282,6 +281,28 @@ static int rk_display_init(struct udevic
if (disp)
break;
};
+   compat = ofnode_get_property(remote, "compatible", NULL);
+   if (!compat) {
+   debug("%s(%s): Failed to find compatible property\n",
+ __func__, dev_read_name(dev));
+   return -EINVAL;
+   }
+   if (strstr(compat, "edp")) {
+   vop_id = VOP_MODE_EDP;
+   } else if (strstr(compat, "mipi")) {
+   vop_id = VOP_MODE_MIPI;
+   } else if (strstr(compat, "hdmi")) {
+   vop_id = VOP_MODE_HDMI;
+   } else if (strstr(compat, "cdn-dp")) {
+   vop_id = VOP_MODE_DP;
+   } else if (strstr(compat, "lvds")) {
+   vop_id = VOP_MODE_LVDS;
+   } else {
+   debug("%s(%s): Failed to find vop mode for %s\n",
+ __func__, dev_read_name(dev), compat);
+   return -EINVAL;
+   }
+   debug("vop_id=%d\n", vop_id);
  
  	disp_uc_plat = dev_get_uclass_platdata(disp);

debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat);









Re: [PATCH v1] verdinx-imx8mm: enable fdt overlays and env importing

2020-10-30 Thread Oleksandr Suvorov
On Fri, Oct 30, 2020 at 4:53 PM Igor Opaniuk  wrote:
>
> From: Igor Opaniuk 
>
> Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
> for booting regular Toradex BSP images.
>
> Signed-off-by: Igor Opaniuk 

Reviewed-by: Oleksandr Suvorov 

> ---
>
>  configs/verdin-imx8mm_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
> index d856e3a318..60e5b03290 100644
> --- a/configs/verdin-imx8mm_defconfig
> +++ b/configs/verdin-imx8mm_defconfig
> @@ -41,7 +41,6 @@ CONFIG_SYS_PROMPT="Verdin iMX8MM # "
>  # CONFIG_BOOTM_NETBSD is not set
>  CONFIG_CMD_ASKENV=y
>  # CONFIG_CMD_EXPORTENV is not set
> -# CONFIG_CMD_IMPORTENV is not set
>  # CONFIG_CMD_CRC32 is not set
>  CONFIG_CMD_MEMTEST=y
>  CONFIG_SYS_MEMTEST_START=0x4000
> @@ -103,3 +102,4 @@ CONFIG_SYSRESET_PSCI=y
>  CONFIG_SYSRESET_WATCHDOG=y
>  CONFIG_DM_THERMAL=y
>  CONFIG_IMX_WATCHDOG=y
> +CONFIG_OF_LIBFDT_OVERLAY=y
> --
> 2.17.1
>


-- 
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00


Re: [PATCH] km/arm: coding style clean up

2020-10-30 Thread Stefan Roese

On 30.10.20 12:45, Holger Brunck wrote:

Address most of the checkpatch issues we found in km_arm and common km
code.

CC: Stefan Roese 
CC: Valentin Longchamp 
Signed-off-by: Holger Brunck 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  board/keymile/common/common.c   | 44 ---
  board/keymile/common/ivm.c  | 84 ++---
  board/keymile/km_arm/fpga_config.c  | 16 +++---
  board/keymile/km_arm/km_arm.c   | 41 +++---
  include/configs/km/keymile-common.h |  4 +-
  include/configs/km/km_arm.h |  2 +-
  6 files changed, 96 insertions(+), 95 deletions(-)

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 03c7ce9da7..df507e2790 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -56,7 +56,7 @@ int set_km_env(void)
  
  	/* try to read rootfssize (ram image) from environment */

p = env_get("rootfssize");
-   if (p != NULL)
+   if (p)
strict_strtoul(p, 16, );
pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
CONFIG_KM_PNVRAM) / 0x400;
@@ -165,7 +165,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
char *p;
  
  	p = get_local_var("IVM_BoardId");

-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_Boardid\n");
return 1;
}
@@ -174,7 +174,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
printf("set boardid=%s\n", buf);
  
  	p = get_local_var("IVM_HWKey");

-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_HWKey\n");
return 1;
}
@@ -186,8 +186,8 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
return 0;
  }
  
-U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and "

-"hwkey from IVM and set in environment");
+U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid",
+  "read out bid and hwkey from IVM and set in environment");
  
  /*

   * command km_checkbidhwk
@@ -218,14 +218,14 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 * already stored in the local hush variables
 */
p = get_local_var("IVM_BoardId");
-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_Boardid\n");
return 1;
}
rc = strict_strtoul(p, 16, );
  
  	p = get_local_var("IVM_HWKey");

-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_HWKey\n");
return 1;
}
@@ -238,10 +238,10 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
  
  	/* now try to read values from environment if available */

p = env_get("boardid");
-   if (p != NULL)
+   if (p)
rc = strict_strtoul(p, 16, );
p = env_get("hwkey");
-   if (p != NULL)
+   if (p)
rc = strict_strtoul(p, 16, );
  
  	if (rc != 0) {

@@ -263,9 +263,8 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
  
  			if (verbose) {

printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n",
-   ivmbid, ivmhwkey);
-   printf("boardIdHwKeyList: %s\n",
-   bidhwklist);
+  ivmbid, ivmhwkey);
+   printf("boardIdHwKeyList: %s\n", bidhwklist);
}
while (!found) {
/* loop over each bid/hwkey pair in the list */
@@ -291,13 +290,13 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
while (*rest && !isxdigit(*rest))
rest++;
}
-   if ((!bid) || (!hwkey)) {
+   if (!bid || !hwkey) {
/* end of list */
break;
}
if (verbose) {
printf("trying bid=0x%lX, hwkey=%ld\n",
-   bid, hwkey);
+  bid, hwkey);
}
/*
 * Compare the values of the found entry in the
@@ -305,7 +304,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 * in the inventory eeprom. If they are equal
 * set the values in environment variables.
 */
-  

Re: [PATCH] rockchip: mkimage: Remove host endianness dependency

2020-10-30 Thread Kever Yang



On 2020/10/25 上午12:43, Samuel Holland wrote:

The Rockchip boot ROM expects little-endian values in the image header.
When running mkimage on a big-endian machine, these values need to be
byteswapped before writing or verifying the header.

This change fixes cross-compiling U-Boot SPL for the RK3399 SoC from a
big-endian ppc64 host machine.

Signed-off-by: Samuel Holland 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  tools/rkcommon.c | 29 +++--
  1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 61c392e27d5..d55cd2c2d5a 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -221,12 +221,13 @@ bool rkcommon_need_rc4_spl(struct image_tool_params 
*params)
  static void rkcommon_set_header0(void *buf, struct image_tool_params *params)
  {
struct header0_info *hdr = buf;
+   uint32_t init_boot_size;
  
  	memset(buf, '\0', RK_INIT_OFFSET * RK_BLK_SIZE);

-   hdr->signature = RK_SIGNATURE;
-   hdr->disable_rc4 = !rkcommon_need_rc4_spl(params);
-   hdr->init_offset = RK_INIT_OFFSET;
-   hdr->init_size = spl_params.init_size / RK_BLK_SIZE;
+   hdr->signature   = cpu_to_le32(RK_SIGNATURE);
+   hdr->disable_rc4 = cpu_to_le32(!rkcommon_need_rc4_spl(params));
+   hdr->init_offset = cpu_to_le16(RK_INIT_OFFSET);
+   hdr->init_size   = cpu_to_le16(spl_params.init_size / RK_BLK_SIZE);
  
  	/*

 * init_boot_size needs to be set, as it is read by the BootROM
@@ -237,11 +238,10 @@ static void rkcommon_set_header0(void *buf, struct 
image_tool_params *params)
 * for a more detailed explanation by Andy Yan
 */
if (spl_params.boot_file)
-   hdr->init_boot_size =
-   hdr->init_size + spl_params.boot_size / RK_BLK_SIZE;
+   init_boot_size = spl_params.init_size + spl_params.boot_size;
else
-   hdr->init_boot_size =
-   hdr->init_size + RK_MAX_BOOT_SIZE / RK_BLK_SIZE;
+   init_boot_size = spl_params.init_size + RK_MAX_BOOT_SIZE;
+   hdr->init_boot_size = cpu_to_le16(init_boot_size / RK_BLK_SIZE);
  
  	rc4_encode(buf, RK_BLK_SIZE, rc4_key);

  }
@@ -294,14 +294,14 @@ static int rkcommon_parse_header(const void *buf, struct 
header0_info *header0,
memcpy((void *)header0, buf, sizeof(struct header0_info));
rc4_encode((void *)header0, sizeof(struct header0_info), rc4_key);
  
-	if (header0->signature != RK_SIGNATURE)

+   if (le32_to_cpu(header0->signature) != RK_SIGNATURE)
return -EPROTO;
  
  	/* We don't support RC4 encoded image payloads here, yet... */

-   if (header0->disable_rc4 == 0)
+   if (le32_to_cpu(header0->disable_rc4) == 0)
return -ENOSYS;
  
-	hdr1_offset = header0->init_offset * RK_BLK_SIZE;

+   hdr1_offset = le16_to_cpu(header0->init_offset) * RK_BLK_SIZE;
hdr1_sdmmc = (struct header1_info *)(buf + hdr1_offset);
hdr1_spi = (struct header1_info *)(buf +
   rkcommon_offset_to_spi(hdr1_offset));
@@ -359,7 +359,7 @@ void rkcommon_print_header(const void *buf)
struct header0_info header0;
struct spl_info *spl_info;
uint8_t image_type;
-   int ret, boot_size;
+   int ret, boot_size, init_size;
  
  	ret = rkcommon_parse_header(buf, , _info);
  
@@ -377,9 +377,10 @@ void rkcommon_print_header(const void *buf)

printf("Image Type:   Rockchip %s (%s) boot image\n",
   spl_info->spl_hdr,
   (image_type == IH_TYPE_RKSD) ? "SD/MMC" : "SPI");
-   printf("Init Data Size: %d bytes\n", header0.init_size * RK_BLK_SIZE);
+   init_size = le16_to_cpu(header0.init_size) * RK_BLK_SIZE;
+   printf("Init Data Size: %d bytes\n", init_size);
  
-	boot_size = (header0.init_boot_size - header0.init_size) * RK_BLK_SIZE;

+   boot_size = le16_to_cpu(header0.init_boot_size) * RK_BLK_SIZE - 
init_size;
if (boot_size != RK_MAX_BOOT_SIZE)
printf("Boot Data Size: %d bytes\n", boot_size);
  }





Re: [PATCH 3/4] video: rockchip: Support 4K resolution for rk3288, HDMI

2020-10-30 Thread Kever Yang



On 2020/10/24 上午3:57, Jagan Teki wrote:

Like, rk3399 the rk3288 also supports 4K resolution.

So, enable it for rk3288 with HDMI platforms.

Right now, rockchip video drivers are supporting for rk3288,
rk3399 SoC families, so mark the 4K resolution by default
if it's an HDMI video out.

Signed-off-by: Jagan Teki 
Cc: Anatolij Gustschin 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  drivers/video/rockchip/Kconfig | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/rockchip/Kconfig b/drivers/video/rockchip/Kconfig
index 5215a71f99..0ade631bd5 100644
--- a/drivers/video/rockchip/Kconfig
+++ b/drivers/video/rockchip/Kconfig
@@ -22,7 +22,7 @@ menuconfig VIDEO_ROCKCHIP
  config VIDEO_ROCKCHIP_MAX_XRES
  int "Maximum horizontal resolution (for memory allocation purposes)"
depends on VIDEO_ROCKCHIP
-   default 3840 if ROCKCHIP_RK3399 && DISPLAY_ROCKCHIP_HDMI
+   default 3840 if DISPLAY_ROCKCHIP_HDMI
default 1920
help
  The maximum horizontal resolution to support for the framebuffer.
@@ -32,7 +32,7 @@ config VIDEO_ROCKCHIP_MAX_XRES
  config VIDEO_ROCKCHIP_MAX_YRES
  int "Maximum vertical resolution (for memory allocation purposes)"
depends on VIDEO_ROCKCHIP
-   default 2160 if ROCKCHIP_RK3399 && DISPLAY_ROCKCHIP_HDMI
+   default 2160 if DISPLAY_ROCKCHIP_HDMI
default 1080
help
  The maximum vertical resolution to support for the framebuffer.





Re: [PATCH 4/4] rockchip: Enable Console MUX in ROCKPi N8

2020-10-30 Thread Kever Yang



On 2020/10/24 上午3:57, Jagan Teki wrote:

Enable Console multiplexing in ROCKPi N8 which would is
required to video out the console buffer.

Enable it.

Signed-off-by: Jagan Teki 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  configs/rock-pi-n8-rk3288_defconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/configs/rock-pi-n8-rk3288_defconfig 
b/configs/rock-pi-n8-rk3288_defconfig
index e5bc035926..380a58c5c4 100644
--- a/configs/rock-pi-n8-rk3288_defconfig
+++ b/configs/rock-pi-n8-rk3288_defconfig
@@ -16,7 +16,6 @@ CONFIG_DEBUG_UART=y
  CONFIG_USE_PREBOOT=y
  CONFIG_DEFAULT_FDT_FILE="rk3288-rock-pi-n8.dtb"
  CONFIG_SILENT_CONSOLE=y
-# CONFIG_CONSOLE_MUX is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_STACK_R=y
  CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000





Re: [PATCH 2/4] arm64: dts: rockchip: Add chosen node for ROCK-Pi N8

2020-10-30 Thread Kever Yang



On 2020/10/24 上午3:57, Jagan Teki wrote:

Add chosen node in -u-boot.dtsi for ROCK-Pi N8 board.

This will help to get serial out messages.

Signed-off-by: Jagan Teki 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi 
b/arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi
index e9d7404ed9..538607dd73 100644
--- a/arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi
+++ b/arch/arm/dts/rk3288-rock-pi-n8-u-boot.dtsi
@@ -5,6 +5,12 @@
  
  #include "rk3288-u-boot.dtsi"
  
+/{

+   chosen {
+   stdout-path = 
+   };
+};
+
   {
rockchip,pctl-timing = <0x215 0xc8 0x0 0x35 0x26 0x2 0x70 0x2000d
0x6 0x0 0x8 0x4 0x17 0x24 0xd 0x6





Re: [PATCH 1/4] rockchip: Enable Console MUX in ROCKPi N10

2020-10-30 Thread Kever Yang



On 2020/10/24 上午3:57, Jagan Teki wrote:

Enable Console multiplexing in ROCKPi N10 which would is
required to video out the console buffer.

Enable it.

Signed-off-by: Jagan Teki 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  configs/rock-pi-n10-rk3399pro_defconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/configs/rock-pi-n10-rk3399pro_defconfig 
b/configs/rock-pi-n10-rk3399pro_defconfig
index 3255e01512..b1c7b9abe6 100644
--- a/configs/rock-pi-n10-rk3399pro_defconfig
+++ b/configs/rock-pi-n10-rk3399pro_defconfig
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399pro-rock-pi-n10"
  CONFIG_DEBUG_UART=y
  # CONFIG_ANDROID_BOOT_IMAGE is not set
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb"
-# CONFIG_CONSOLE_MUX is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_MISC_INIT_R=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set





[RESEND PATCH v1] verdin-imx8mm: enable fdt overlays and env importing

2020-10-30 Thread Igor Opaniuk
From: Igor Opaniuk 

Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
for booting regular Toradex BSP images.

Signed-off-by: Igor Opaniuk 
---

 configs/verdin-imx8mm_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index d856e3a318..60e5b03290 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -41,7 +41,6 @@ CONFIG_SYS_PROMPT="Verdin iMX8MM # "
 # CONFIG_BOOTM_NETBSD is not set
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_EXPORTENV is not set
-# CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_CRC32 is not set
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_MEMTEST_START=0x4000
@@ -103,3 +102,4 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_WATCHDOG=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



RE: [PATCH] dm: soc: Add SoC id for attribute matching

2020-10-30 Thread Biju Das
Hi Dave,

Thanks for the feedback.

> Subject: Re: [PATCH] dm: soc: Add SoC id for attribute matching
> 
> Hi,
> 
> On 10/30/20 9:07 AM, Biju Das wrote:
> > Add SoC identification string for attribute matching.
> > Also changed the comments from "an SOC" to "a SoC".
> 
> This is not a correct change, "an" should be used if the word that follows
> starts with a vowel sound, which "SoC" does.

Agreed. Will change back to an SoC on V2.

The below one still uses "a SOC". Will change to "an SoC" as well.
-* get_revision() - Get revision name of a SOC
+* get_revision() - Get revision name of a SoC

> "SOC" could be changed to "SoC", no strong feelings there.

OK.
> >
> > Signed-off-by: Biju Das 
> > Reviewed-by: Lad Prabhakar  lad...@bp.renesas.com>
> > ---
> >   drivers/soc/soc-uclass.c  | 19 ++-
> >   drivers/soc/soc_sandbox.c |  8 
> >   include/soc.h | 39 +--
> >   test/dm/soc.c |  8 
> >   4 files changed, 67 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/soc/soc-uclass.c b/drivers/soc/soc-uclass.c index
> > c32d647864..a3f8be841b 100644
> > --- a/drivers/soc/soc-uclass.c
> > +++ b/drivers/soc/soc-uclass.c
> > @@ -46,6 +46,16 @@ int soc_get_revision(struct udevice *dev, char *buf,
> int size)
> > return ops->get_revision(dev, buf, size);
> >   }
> >
> > +int soc_get_soc_id(struct udevice *dev, char *buf, int size)
> Is there any additional background here? Why is soc_id needed? Can
> "machine" not meet the same purpose?

Renesas SoC and other SoC vendors use SoC_ID for SoC identification.See the 
details here [1]

[1]  
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/renesas/renesas-soc.c?h=v5.10-rc1

Please see other SoC vendors as well [2] which uses SoC_ID for identification.
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/samsung/exynos-chipid.c?h=v5.10-rc1


> My thought was "family" would cover a range of parts and "machine" was to
> be a specific SoC. Is a more specific ID needed?

Yes, Please see above. 

Family in over case is:  RCar Gen3 SoC family or RZ/G2 SoC family
Machine is  Name of machine for eg;- "HopeRun HiHope RZ/G2M with sub board"
SoC_ID is some thing SoC specific for eg:- r8a774a1
Revision is : ES x.y.

I think in your case, it is different??

> 
> > +{
> > +   struct soc_ops *ops = soc_get_ops(dev);
> > +
> > +   if (!ops->get_soc_id)
> > +   return -ENOSYS;
> > +
> > +   return ops->get_soc_id(dev, buf, size); }
> > +
> >   const struct soc_attr *
> >   soc_device_match(const struct soc_attr *matches)
> >   {
> > @@ -61,7 +71,7 @@ soc_device_match(const struct soc_attr *matches)
> >
> > while (1) {
> > if (!(matches->machine || matches->family ||
> > - matches->revision))
> > + matches->revision || matches->soc_id))
> > break;
> >
> > match = true;
> > @@ -87,6 +97,13 @@ soc_device_match(const struct soc_attr *matches)
> > }
> > }
> >
> > +   if (matches->soc_id) {
> > +   if (!soc_get_soc_id(soc, str, SOC_MAX_STR_SIZE)) {
> > +   if (strcmp(matches->soc_id, str))
> > +   match = false;
> > +   }
> > +   }
> > +
> > if (match)
> > return matches;
> >
> > diff --git a/drivers/soc/soc_sandbox.c b/drivers/soc/soc_sandbox.c
> > index 5c82ad84fc..1a81d3562a 100644
> > --- a/drivers/soc/soc_sandbox.c
> > +++ b/drivers/soc/soc_sandbox.c
> > @@ -31,10 +31,18 @@ int soc_sandbox_get_revision(struct udevice *dev,
> char *buf, int size)
> > return 0;
> >   }
> >
> > +int soc_sandbox_get_soc_id(struct udevice *dev, char *buf, int size)
> > +{
> > +   snprintf(buf, size, "r8a774a1");
> > +
> > +   return 0;
> > +}
> > +
> >   static const struct soc_ops soc_sandbox_ops = {
> > .get_family = soc_sandbox_get_family,
> > .get_revision = soc_sandbox_get_revision,
> > .get_machine = soc_sandbox_get_machine,
> > +   .get_soc_id = soc_sandbox_get_soc_id,
> >   };
> >
> >   int soc_sandbox_probe(struct udevice *dev) diff --git
> > a/include/soc.h b/include/soc.h index a55eb1b572..ae7b36846f 100644
> > --- a/include/soc.h
> > +++ b/include/soc.h
> > @@ -20,18 +20,20 @@
> >*   variants. Example: am33
> >* @machine  - Name of a specific SoC. Example: am3352
> >* @revision - Name of a specific SoC revision. Example: SR1.1
> > + * @soc_id   - SoC identification String. Example: r8a774a1
> >* @data - A pointer to user data for the SoC variant
> >*/
> >   struct soc_attr {
> > const char *family;
> > const char *machine;
> > const char *revision;
> > +   const char *soc_id;
> > const void *data;
> >   };
> >
> >   struct soc_ops {
> > /**
> > -* get_machine() - Get machine name of an SOC

Re: [PATCH 0/3] mmc support for QEMU

2020-10-30 Thread Harm Berntsen
Hi,

I didn't include changes in the defconfig because you need to manually
add the device to the QEMU virt machine via the command line. On the
other hand the u-boot binary size does not really matter for QEMU
environments. For CI it will also be nice to ensure this set-up will
build.

I'll send in a patch for the config when this series has been merged!

Kind regards,
Harm

-Original Message-
From: Bin Meng 
To: Harm Berntsen 
Cc: u-boot@lists.denx.de 
Subject: Re: [PATCH 0/3] mmc support for QEMU
Date: Fri, 30 Oct 2020 22:34:10 +0800

On Fri, Oct 30, 2020 at 6:56 PM Harm Berntsen 
wrote:
> 
> Hi,
> 
> This patch series allows you to use a mmc drive from within QEMU:
> 
> 1. make qemu_arm_defconfig
> 2. Enable the CONFIG_DM_MMC, CONFIG_MMC_PCI, CONFIG_MMC_SDHCI options
> 3. Run quemu as follows:
> 
>    qemu-system-arm
>    -machine virt,highmem=off \
>    -device sdhci-pci \
>    -device sd-card,drive=mydrive \
>    -drive id=mydrive,if=none,format=raw,file=mmcblk0.bin \
>    -bios u-boot.bin

I don't see changes made to qemu_arm_defconfig. Is that a future patch?

> 
> The MMC image can now be used to boot :)
> 

Regards,
Bin



[PATCH v1] verdinx-imx8mm: enable fdt overlays and env importing

2020-10-30 Thread Igor Opaniuk
From: Igor Opaniuk 

Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
for booting regular Toradex BSP images.

Signed-off-by: Igor Opaniuk 
---

 configs/verdin-imx8mm_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index d856e3a318..60e5b03290 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -41,7 +41,6 @@ CONFIG_SYS_PROMPT="Verdin iMX8MM # "
 # CONFIG_BOOTM_NETBSD is not set
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_EXPORTENV is not set
-# CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_CRC32 is not set
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_MEMTEST_START=0x4000
@@ -103,3 +102,4 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_WATCHDOG=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



Re: [PATCH 0/3] mmc support for QEMU

2020-10-30 Thread Bin Meng
On Fri, Oct 30, 2020 at 6:56 PM Harm Berntsen  wrote:
>
> Hi,
>
> This patch series allows you to use a mmc drive from within QEMU:
>
> 1. make qemu_arm_defconfig
> 2. Enable the CONFIG_DM_MMC, CONFIG_MMC_PCI, CONFIG_MMC_SDHCI options
> 3. Run quemu as follows:
>
>qemu-system-arm
>-machine virt,highmem=off \
>-device sdhci-pci \
>-device sd-card,drive=mydrive \
>-drive id=mydrive,if=none,format=raw,file=mmcblk0.bin \
>-bios u-boot.bin

I don't see changes made to qemu_arm_defconfig. Is that a future patch?

>
> The MMC image can now be used to boot :)
>

Regards,
Bin


Re: [PATCH] dm: soc: Add SoC id for attribute matching

2020-10-30 Thread Dave Gerlach

Hi,

On 10/30/20 9:07 AM, Biju Das wrote:

Add SoC identification string for attribute matching.
Also changed the comments from "an SOC" to "a SoC".


This is not a correct change, "an" should be used if the word that 
follows starts with a vowel sound, which "SoC" does.


"SOC" could be changed to "SoC", no strong feelings there.



Signed-off-by: Biju Das 
Reviewed-by: Lad Prabhakar 
---
  drivers/soc/soc-uclass.c  | 19 ++-
  drivers/soc/soc_sandbox.c |  8 
  include/soc.h | 39 +--
  test/dm/soc.c |  8 
  4 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/drivers/soc/soc-uclass.c b/drivers/soc/soc-uclass.c
index c32d647864..a3f8be841b 100644
--- a/drivers/soc/soc-uclass.c
+++ b/drivers/soc/soc-uclass.c
@@ -46,6 +46,16 @@ int soc_get_revision(struct udevice *dev, char *buf, int 
size)
return ops->get_revision(dev, buf, size);
  }
  
+int soc_get_soc_id(struct udevice *dev, char *buf, int size)
Is there any additional background here? Why is soc_id needed? Can 
"machine" not meet the same purpose?


My thought was "family" would cover a range of parts and "machine" was 
to be a specific SoC. Is a more specific ID needed?



+{
+   struct soc_ops *ops = soc_get_ops(dev);
+
+   if (!ops->get_soc_id)
+   return -ENOSYS;
+
+   return ops->get_soc_id(dev, buf, size);
+}
+
  const struct soc_attr *
  soc_device_match(const struct soc_attr *matches)
  {
@@ -61,7 +71,7 @@ soc_device_match(const struct soc_attr *matches)
  
  	while (1) {

if (!(matches->machine || matches->family ||
- matches->revision))
+ matches->revision || matches->soc_id))
break;
  
  		match = true;

@@ -87,6 +97,13 @@ soc_device_match(const struct soc_attr *matches)
}
}
  
+		if (matches->soc_id) {

+   if (!soc_get_soc_id(soc, str, SOC_MAX_STR_SIZE)) {
+   if (strcmp(matches->soc_id, str))
+   match = false;
+   }
+   }
+
if (match)
return matches;
  
diff --git a/drivers/soc/soc_sandbox.c b/drivers/soc/soc_sandbox.c

index 5c82ad84fc..1a81d3562a 100644
--- a/drivers/soc/soc_sandbox.c
+++ b/drivers/soc/soc_sandbox.c
@@ -31,10 +31,18 @@ int soc_sandbox_get_revision(struct udevice *dev, char 
*buf, int size)
return 0;
  }
  
+int soc_sandbox_get_soc_id(struct udevice *dev, char *buf, int size)

+{
+   snprintf(buf, size, "r8a774a1");
+
+   return 0;
+}
+
  static const struct soc_ops soc_sandbox_ops = {
.get_family = soc_sandbox_get_family,
.get_revision = soc_sandbox_get_revision,
.get_machine = soc_sandbox_get_machine,
+   .get_soc_id = soc_sandbox_get_soc_id,
  };
  
  int soc_sandbox_probe(struct udevice *dev)

diff --git a/include/soc.h b/include/soc.h
index a55eb1b572..ae7b36846f 100644
--- a/include/soc.h
+++ b/include/soc.h
@@ -20,18 +20,20 @@
   *   variants. Example: am33
   * @machine  - Name of a specific SoC. Example: am3352
   * @revision - Name of a specific SoC revision. Example: SR1.1
+ * @soc_id   - SoC identification String. Example: r8a774a1
   * @data - A pointer to user data for the SoC variant
   */
  struct soc_attr {
const char *family;
const char *machine;
const char *revision;
+   const char *soc_id;
const void *data;
  };
  
  struct soc_ops {

/**
-* get_machine() - Get machine name of an SOC
+* get_machine() - Get machine name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -41,7 +43,7 @@ struct soc_ops {
int (*get_machine)(struct udevice *dev, char *buf, int size);
  
  	/**

-* get_revision() - Get revision name of a SOC
+* get_revision() - Get revision name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -51,7 +53,7 @@ struct soc_ops {
int (*get_revision)(struct udevice *dev, char *buf, int size);
  
  	/**

-* get_family() - Get family name of an SOC
+* get_family() - Get family name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -59,6 +61,16 @@ struct soc_ops {
 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
 */
int (*get_family)(struct udevice *dev, char *buf, int size);
+
+   /**
+* get_soc_id() - Get SoC identification name of a SoC
+*
+* @dev:Device to check (UCLASS_SOC)
+* @buf:Buffer to place string
+* @size:   Size of string space
+* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on 

[PATCH] dm: soc: Add SoC id for attribute matching

2020-10-30 Thread Biju Das
Add SoC identification string for attribute matching.
Also changed the comments from "an SOC" to "a SoC".

Signed-off-by: Biju Das 
Reviewed-by: Lad Prabhakar 
---
 drivers/soc/soc-uclass.c  | 19 ++-
 drivers/soc/soc_sandbox.c |  8 
 include/soc.h | 39 +--
 test/dm/soc.c |  8 
 4 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/drivers/soc/soc-uclass.c b/drivers/soc/soc-uclass.c
index c32d647864..a3f8be841b 100644
--- a/drivers/soc/soc-uclass.c
+++ b/drivers/soc/soc-uclass.c
@@ -46,6 +46,16 @@ int soc_get_revision(struct udevice *dev, char *buf, int 
size)
return ops->get_revision(dev, buf, size);
 }
 
+int soc_get_soc_id(struct udevice *dev, char *buf, int size)
+{
+   struct soc_ops *ops = soc_get_ops(dev);
+
+   if (!ops->get_soc_id)
+   return -ENOSYS;
+
+   return ops->get_soc_id(dev, buf, size);
+}
+
 const struct soc_attr *
 soc_device_match(const struct soc_attr *matches)
 {
@@ -61,7 +71,7 @@ soc_device_match(const struct soc_attr *matches)
 
while (1) {
if (!(matches->machine || matches->family ||
- matches->revision))
+ matches->revision || matches->soc_id))
break;
 
match = true;
@@ -87,6 +97,13 @@ soc_device_match(const struct soc_attr *matches)
}
}
 
+   if (matches->soc_id) {
+   if (!soc_get_soc_id(soc, str, SOC_MAX_STR_SIZE)) {
+   if (strcmp(matches->soc_id, str))
+   match = false;
+   }
+   }
+
if (match)
return matches;
 
diff --git a/drivers/soc/soc_sandbox.c b/drivers/soc/soc_sandbox.c
index 5c82ad84fc..1a81d3562a 100644
--- a/drivers/soc/soc_sandbox.c
+++ b/drivers/soc/soc_sandbox.c
@@ -31,10 +31,18 @@ int soc_sandbox_get_revision(struct udevice *dev, char 
*buf, int size)
return 0;
 }
 
+int soc_sandbox_get_soc_id(struct udevice *dev, char *buf, int size)
+{
+   snprintf(buf, size, "r8a774a1");
+
+   return 0;
+}
+
 static const struct soc_ops soc_sandbox_ops = {
.get_family = soc_sandbox_get_family,
.get_revision = soc_sandbox_get_revision,
.get_machine = soc_sandbox_get_machine,
+   .get_soc_id = soc_sandbox_get_soc_id,
 };
 
 int soc_sandbox_probe(struct udevice *dev)
diff --git a/include/soc.h b/include/soc.h
index a55eb1b572..ae7b36846f 100644
--- a/include/soc.h
+++ b/include/soc.h
@@ -20,18 +20,20 @@
  *variants. Example: am33
  * @machine  - Name of a specific SoC. Example: am3352
  * @revision - Name of a specific SoC revision. Example: SR1.1
+ * @soc_id   - SoC identification String. Example: r8a774a1
  * @data - A pointer to user data for the SoC variant
  */
 struct soc_attr {
const char *family;
const char *machine;
const char *revision;
+   const char *soc_id;
const void *data;
 };
 
 struct soc_ops {
/**
-* get_machine() - Get machine name of an SOC
+* get_machine() - Get machine name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -41,7 +43,7 @@ struct soc_ops {
int (*get_machine)(struct udevice *dev, char *buf, int size);
 
/**
-* get_revision() - Get revision name of a SOC
+* get_revision() - Get revision name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -51,7 +53,7 @@ struct soc_ops {
int (*get_revision)(struct udevice *dev, char *buf, int size);
 
/**
-* get_family() - Get family name of an SOC
+* get_family() - Get family name of a SoC
 *
 * @dev:Device to check (UCLASS_SOC)
 * @buf:Buffer to place string
@@ -59,6 +61,16 @@ struct soc_ops {
 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
 */
int (*get_family)(struct udevice *dev, char *buf, int size);
+
+   /**
+* get_soc_id() - Get SoC identification name of a SoC
+*
+* @dev:Device to check (UCLASS_SOC)
+* @buf:Buffer to place string
+* @size:   Size of string space
+* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
+*/
+   int (*get_soc_id)(struct udevice *dev, char *buf, int size);
 };
 
 #define soc_get_ops(dev)((struct soc_ops *)(dev)->driver->ops)
@@ -76,7 +88,7 @@ struct soc_ops {
 int soc_get(struct udevice **devp);
 
 /**
- * soc_get_machine() - Get machine name of an SOC
+ * soc_get_machine() - Get machine name of a SoC
  * @dev:   Device to check (UCLASS_SOC)
  * @buf:   Buffer to place string
  * @size:  Size of string 

[PATCH] fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE

2020-10-30 Thread Gerard Koskamp
I've created a squashfs file system with Yocto (it use squashfs-tools)
and u-boot command sqfsls give the error:'Error while searching inode:
unknown type.'
After some digging in the code I found that the index is off by 1.
This patch fix this issue and I can successful use the sqfsls command.
After search for the squashfs format I found a link talk about a
similar issue but this time in the documentation. The link is:
https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529

Signed-off-by: Gerard Koskamp 
CC: Joao Marcos Costa 
---

 fs/squashfs/sqfs_inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
index 14d70cf..0983974 100644
--- a/fs/squashfs/sqfs_inode.c
+++ b/fs/squashfs/sqfs_inode.c
@@ -49,7 +49,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode, u32 
blk_size)
    return sizeof(*ldir);
 
    di = ldir->index;
-   while (l < i_count + 1) {
+   while (l < i_count) {
    sz = get_unaligned_le32(>size) + 1;
    index_list_size += sz;
    di = (void *)di + sizeof(*di) + sz;
@@ -57,7 +57,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode, u32 
blk_size)
    }
 
    return sizeof(*ldir) + index_list_size +
-   (i_count + 1) * SQFS_DIR_INDEX_BASE_LENGTH;
+   i_count * SQFS_DIR_INDEX_BASE_LENGTH;
    }
 
    case SQFS_LREG_TYPE: {
-- 
2.7.4

[PATCH] dm: core: Add of_match_node helper function

2020-10-30 Thread Biju Das
Add of_match_node() helper function to iterate over the device tree
and tell if a device_node has a matching of_match structure.

Signed-off-by: Biju Das 
Reviewed-by: Lad Prabhakar 
---
 drivers/core/device.c | 21 +
 include/dm/device.h   | 13 +
 2 files changed, 34 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index e90d70101c..79076d9c78 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -997,6 +997,27 @@ bool of_machine_is_compatible(const char *compat)
return !fdt_node_check_compatible(fdt, 0, compat);
 }
 
+static
+const struct udevice_id *__of_match_node(const struct udevice_id *matches,
+const ofnode node)
+{
+   if (!matches)
+   return NULL;
+
+   for (; matches && matches->compatible; matches++) {
+   if (ofnode_device_is_compatible(node, matches->compatible))
+   return matches;
+   }
+
+   return NULL;
+}
+
+const struct udevice_id *of_match_node(const struct udevice_id *matches,
+  const ofnode node)
+{
+   return __of_match_node(matches, node);
+}
+
 int dev_disable_by_path(const char *path)
 {
struct uclass *uc;
diff --git a/include/dm/device.h b/include/dm/device.h
index ac3b6c1b8a..0e9c37e64e 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -740,6 +740,19 @@ bool device_is_compatible(const struct udevice *dev, const 
char *compat);
  */
 bool of_machine_is_compatible(const char *compat);
 
+/**
+ * of_match_node() - Tell if a device_node has a matching of_match structure
+ *
+ *
+ * Low level utility function used by device matching.
+ *
+ * @matches:   array of of device match structures to search in
+ * @node:  the of device structure to match against
+ * @return matching structure on success, NULL if the match is not found
+ */
+const struct udevice_id *of_match_node(const struct udevice_id *matches,
+  const ofnode node);
+
 /**
  * dev_disable_by_path() - Disable a device given its device tree path
  *
-- 
2.17.1



[u-boot PATCH] configs: am65/j72x: Set CONFIG_LOGLEVEL to 7

2020-10-30 Thread Roger Quadros
By default CONFIG_LOGLEVEL seems to be set to 4 which is
too low and doesn't show dev_info/dev_notice/dev_warn
messages on console. This has been deliberately set low
globally to be conservative setting across the board due to
primary bootloader size limitations. It is best to tune
per board config as per user needs.

On K3 we have separate SPL and u-boot configs so we
can afford to set u-boot CONFIG_LOGLEVEL to 7.

On AM65 this patch causes u-boot.img size to change from
932KB to 940KB with 1 line additional print during
MMC boot. i.e. details of Net subsystem

"Net: K3 CPSW: nuss_ver: 0x6BA00102 cpsw_ver: 0x6BA80102 ale_ver: 0x00293904 
Ports:1 mdio_freq:100"

Similar 8KB difference was seen on J721E.

Signed-off-by: Roger Quadros 
Reviewed-by: Nishanth Menon 
---
 configs/am65x_evm_a53_defconfig| 1 +
 configs/am65x_hs_evm_a53_defconfig | 1 +
 configs/j7200_evm_a72_defconfig| 1 +
 configs/j721e_evm_a72_defconfig| 1 +
 configs/j721e_hs_evm_a72_defconfig | 1 +
 5 files changed, 5 insertions(+)

diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 8a94ad1530..941073ce7f 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -30,6 +30,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run 
boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run 
get_overlay_${boot}; run run_kern"
+CONFIG_LOGLEVEL=7
 CONFIG_CONSOLE_MUX=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
diff --git a/configs/am65x_hs_evm_a53_defconfig 
b/configs/am65x_hs_evm_a53_defconfig
index 2c7217afb6..7d467c167e 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -32,6 +32,7 @@ CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run 
get_fit_${boot}; run get_overlaystring; run run_fit"
+CONFIG_LOGLEVEL=7
 CONFIG_CONSOLE_MUX=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig
index 7c900b1d2e..1d2526b5f1 100644
--- a/configs/j7200_evm_a72_defconfig
+++ b/configs/j7200_evm_a72_defconfig
@@ -31,6 +31,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run 
boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run 
get_overlay_${boot}; run run_kern"
+CONFIG_LOGLEVEL=7
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index 6de8666956..982e3df2f2 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -30,6 +30,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run 
boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run 
get_overlay_${boot}; run run_kern"
+CONFIG_LOGLEVEL=7
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
diff --git a/configs/j721e_hs_evm_a72_defconfig 
b/configs/j721e_hs_evm_a72_defconfig
index acbc04359c..28bf56e7e1 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -31,6 +31,7 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run 
boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
+CONFIG_LOGLEVEL=7
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



[PATCH] km/arm: coding style clean up

2020-10-30 Thread Holger Brunck
Address most of the checkpatch issues we found in km_arm and common km
code.

CC: Stefan Roese 
CC: Valentin Longchamp 
Signed-off-by: Holger Brunck 
---
 board/keymile/common/common.c   | 44 ---
 board/keymile/common/ivm.c  | 84 ++---
 board/keymile/km_arm/fpga_config.c  | 16 +++---
 board/keymile/km_arm/km_arm.c   | 41 +++---
 include/configs/km/keymile-common.h |  4 +-
 include/configs/km/km_arm.h |  2 +-
 6 files changed, 96 insertions(+), 95 deletions(-)

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 03c7ce9da7..df507e2790 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -56,7 +56,7 @@ int set_km_env(void)
 
/* try to read rootfssize (ram image) from environment */
p = env_get("rootfssize");
-   if (p != NULL)
+   if (p)
strict_strtoul(p, 16, );
pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
CONFIG_KM_PNVRAM) / 0x400;
@@ -165,7 +165,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
char *p;
 
p = get_local_var("IVM_BoardId");
-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_Boardid\n");
return 1;
}
@@ -174,7 +174,7 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
printf("set boardid=%s\n", buf);
 
p = get_local_var("IVM_HWKey");
-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_HWKey\n");
return 1;
}
@@ -186,8 +186,8 @@ static int do_setboardid(struct cmd_tbl *cmdtp, int flag, 
int argc,
return 0;
 }
 
-U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and 
"
-"hwkey from IVM and set in environment");
+U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid",
+  "read out bid and hwkey from IVM and set in environment");
 
 /*
  * command km_checkbidhwk
@@ -218,14 +218,14 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 * already stored in the local hush variables
 */
p = get_local_var("IVM_BoardId");
-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_Boardid\n");
return 1;
}
rc = strict_strtoul(p, 16, );
 
p = get_local_var("IVM_HWKey");
-   if (p == NULL) {
+   if (!p) {
printf("can't get the IVM_HWKey\n");
return 1;
}
@@ -238,10 +238,10 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 
/* now try to read values from environment if available */
p = env_get("boardid");
-   if (p != NULL)
+   if (p)
rc = strict_strtoul(p, 16, );
p = env_get("hwkey");
-   if (p != NULL)
+   if (p)
rc = strict_strtoul(p, 16, );
 
if (rc != 0) {
@@ -263,9 +263,8 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 
if (verbose) {
printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n",
-   ivmbid, ivmhwkey);
-   printf("boardIdHwKeyList: %s\n",
-   bidhwklist);
+  ivmbid, ivmhwkey);
+   printf("boardIdHwKeyList: %s\n", bidhwklist);
}
while (!found) {
/* loop over each bid/hwkey pair in the list */
@@ -291,13 +290,13 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
while (*rest && !isxdigit(*rest))
rest++;
}
-   if ((!bid) || (!hwkey)) {
+   if (!bid || !hwkey) {
/* end of list */
break;
}
if (verbose) {
printf("trying bid=0x%lX, hwkey=%ld\n",
-   bid, hwkey);
+  bid, hwkey);
}
/*
 * Compare the values of the found entry in the
@@ -305,7 +304,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int 
flag, int argc,
 * in the inventory eeprom. If they are equal
 * set the values in environment variables.
 */
-   if ((bid == ivmbid) && (hwkey == ivmhwkey)) {
+   

Re: [PATCH] ram: rockchip: px30: add a config-based ddr selection

2020-10-30 Thread Philipp Tomsich



> On 01.10.2020, at 20:40, Heiko Stuebner  wrote:
> 
> From: Heiko Stuebner 
> 
> The SRAM on the PX30 is not big enough to hold multiple DDR configs
> so it needs to be selected during build.
> 
> So far simply the DDR3 config was always selected and getting DDR4
> or LPDDR2/3 initialized would require a code modification.
> 
> So add Kconfig options similar to RK3399 to allow selecting the DDR4
> and LPDDR2/3 options instead, while DDR3 stays the default as before.
> 
> Signed-off-by: Heiko Stuebner 

Reviewed-by: Philipp Tomsich 



[PATCH 3/3] mmc: Only retrieve cd pin when GPIO is enabled

2020-10-30 Thread Harm Berntsen
The driver only needs to retrieve the pin for the ACPI info. The driver
itself works without depending on GPIO.

Signed-off-by: Harm Berntsen 
CC: Simon Glass 

---

 drivers/mmc/pci_mmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
index 0c45e1b893..dba6324247 100644
--- a/drivers/mmc/pci_mmc.c
+++ b/drivers/mmc/pci_mmc.c
@@ -52,9 +52,11 @@ static int pci_mmc_probe(struct udevice *dev)
 
 static int pci_mmc_ofdata_to_platdata(struct udevice *dev)
 {
+#if defined(CONFIG_DM_GPIO)
struct pci_mmc_priv *priv = dev_get_priv(dev);
 
gpio_request_by_name(dev, "cd-gpios", 0, >cd_gpio, GPIOD_IS_IN);
+#endif
 
return 0;
 }



[PATCH 1/3] gpio: do not include on ARCH_QEMU

2020-10-30 Thread Harm Berntsen
As no gpio.h is defined for this architecture, to avoid
compilation failure, do not include  for
QEMU.

Signed-off-by: Harm Berntsen 
---

 arch/arm/include/asm/gpio.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 6ecb876eda..7609367884 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -3,7 +3,8 @@
!defined(CONFIG_ARCH_BCM6858) && !defined(CONFIG_ARCH_BCM63158) && \
!defined(CONFIG_ARCH_ROCKCHIP) && !defined(CONFIG_ARCH_ASPEED) && \
!defined(CONFIG_ARCH_U8500) && !defined(CONFIG_CORTINA_PLATFORM) && \
-   !defined(CONFIG_TARGET_BCMNS3) && !defined(CONFIG_TARGET_TOTAL_COMPUTE)
+   !defined(CONFIG_TARGET_BCMNS3) && !defined(CONFIG_TARGET_TOTAL_COMPUTE) 
&& \
+   !defined(CONFIG_ARCH_QEMU)
 #include 
 #endif
 #include 



[PATCH 2/3] acpi: Only include asm header when available

2020-10-30 Thread Harm Berntsen
The only platforms with an asm/acpi_table.h file are X86 and Sandbox.
Some drivers, i.e. pci_mmc.c, can generate ACPI info and therefore
include asm/acpi_table.h by proxy. This commit ensures that the
platforms wishing to use such driver and do not have ACPI support do not
fail on this include. The if defined structure is also used in other
places to conditionally include asm headers, i.e.
arch/arm/include/asm/gpio.h

Signed-off-by: Harm Berntsen 
CC: Simon Glass 
---

 include/acpi/acpi_table.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h
index abbca6530d..8d9d0f8d19 100644
--- a/include/acpi/acpi_table.h
+++ b/include/acpi/acpi_table.h
@@ -690,6 +690,8 @@ void acpi_setup_base_tables(struct acpi_ctx *ctx, void 
*start);
 
 #endif /* !__ACPI__*/
 
+#if defined(CONFIG_X86) || defined(CONFIG_SANDBOX)
 #include 
+#endif
 
 #endif /* __ACPI_TABLE_H__ */



Re: U-Boot i2c bus num 1 is broken on Nokia N900

2020-10-30 Thread Ivaylo Dimitrov

Hi,

On 29.10.20 г. 11:32 ч., Heiko Schocher wrote:

Hello Ivaylo,

Am 29.10.2020 um 08:51 schrieb Ivaylo Dimitrov:

Hi,

On 28.10.20 г. 7:42 ч., Heiko Schocher wrote:

Hello Pali,

sorry for late response ...

Am 26.10.2020 um 22:48 schrieb Pali Rohár:

On Monday 27 April 2020 09:03:13 Heiko Schocher wrote:

Hello Pali,

Am 26.04.2020 um 01:54 schrieb Pali Rohár:

Adding Hannes and Heiko to the loop, please look at this problem.

On Saturday 25 April 2020 14:11:32 Pali Rohár wrote:

On Saturday 25 April 2020 07:00:58 Adam Ford wrote:

On Sat, Apr 25, 2020 at 6:50 AM Pali Rohár  wrote:


On Saturday 25 April 2020 06:36:58 Adam Ford wrote:
On Sat, Apr 25, 2020 at 5:42 AM Pali Rohár  
wrote:


On Thursday 02 April 2020 20:42:31 Pali Rohár wrote:

On Wednesday 01 April 2020 12:32:29 Merlijn Wajer wrote:

Hi,

On 01/04/2020 00:42, Pali Rohár wrote:

On Wednesday 01 April 2020 00:35:07 Pali Rohár wrote:
This patch series contain fixes for Nokia RX-51 board 
(aka N900).
After these changes it is possible to run U-Boot in qemu 
emulator again.
And U-Boot can boot kernel image from RAM, eMMC or 
OneNAND memory without

problem.


But on real Nokia N900 device is U-Boot crashing in reboot 
loop.


I do not have serial console for Nokia N900 to debug this 
issue, but
seems that it is related to OMAP I2C and OMAP HS MMC code. 
Problem is
that there is no crash and even no error in qemu emulator 
so I cannot

debug this issue.

First problem is around /* reset lp5523 led */ code in 
rx51.c. On real

N900 device it generates repeating messages:

    Check if pads/pull-ups of bus are properly configured
    Timed out in wait_for_event: status=

When I commented that few lines all these messages 
disappeared. So

problem is with OMAP I2C.

...
I remember that somebody had serial jig for Nokia N900, 
could somebody

look at this reboot loop problem?

And any idea how should be OMAP I2C configured in U-Boot 
to correctly

work?

Maybe I will try to find some time to git bisect which 
change broke

U-Boot on real N900 hardware.


Took latest u-boot master, applied patches and this is the 
result on
serial (first part is NOLO booting, I think that can be 
ignored) [1].


...

U-Boot 2020.04-rc4-00033-g7dbafe0634-dirty (Apr 01 2020 - 
12:15:47 +0200)


OMAP3530-HS ES3.1, CPU-OPP2, L3-165MHz, Max CPU Clock 600 MHz
Nokia RX-51 + LPDDR/OneNAND
I2C:   ready
DRAM:  256 MiB
NAND:  0 Bytes


Looks like that something with NAND is broken.


The board code in U-Boot is in a very old state... :-(


:-(


MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
In:    vga
Out:   vga
Err:   vga
Timed out in wait_for_event: status=0100
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
Timed out in wait_for_event: status=
Check if pads/pull-ups of bus are properly configured
i2c_read (addr phase): pads on bus probably not configured 
(status=0x10)


How is that trace even possible? I built and tested u-boot here on my 
devices and I see the same message, but unless I am becoming blind, 
i2c_read() is never called from within i2c_write(). This is really 
suspicious.



i2c_write: timed out writig last byte!


These i2c errors are caused by

    /* reset lp5523 led */
    i2c_set_bus_num(1);


deprecated ... the board code needs cleanup ...


Yes, my first thought too!

This board needs a complete cleanup.


I converted code to CONFIG_DM_I2C and nothing was changed, issue is
still there...


Ok.


    state = 0xff;
    i2c_write(0x32, 0x3d, 1, , 1);
    i2c_set_bus_num(0);

Is there anything which needs to be done to initialize 

[PATCH 0/3] mmc support for QEMU

2020-10-30 Thread Harm Berntsen
Hi,

This patch series allows you to use a mmc drive from within QEMU:

1. make qemu_arm_defconfig
2. Enable the CONFIG_DM_MMC, CONFIG_MMC_PCI, CONFIG_MMC_SDHCI options
3. Run quemu as follows:

   qemu-system-arm
   -machine virt,highmem=off \
   -device sdhci-pci \
   -device sd-card,drive=mydrive \
   -drive id=mydrive,if=none,format=raw,file=mmcblk0.bin \
   -bios u-boot.bin

The MMC image can now be used to boot :)

Regards,
Harm


Harm Berntsen (3):
  gpio: do not include  on ARCH_QEMU
  acpi: Only include asm table when available
  mmc: Only retrieve cd pin when GPIO is enabled

 arch/arm/include/asm/gpio.h | 3 ++-
 drivers/mmc/pci_mmc.c   | 2 ++
 include/acpi/acpi_table.h   | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)




Re: [PATCH] video: rockchip: Add missing dpcd_write() call to link_train_ce()

2020-10-30 Thread Kever Yang

Hi,

On 2020/10/16 上午2:29, Tom Rini wrote:

On Wed, Oct 14, 2020 at 11:39:40PM +0300, Alper Nebi Yasak wrote:

On 14/10/2020 22:31, Tom Rini wrote:

On Wed, Oct 14, 2020 at 09:58:28PM +0300, Alper Nebi Yasak wrote:

On 14/10/2020 18:24, Tom Rini wrote:

Ugh.  In so far as anything can be re-licensed, who did it all
originally?  I suspect coreboot isn't interested in 2.0+ but we can do
2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp
driver") introduces the related change to src/soc/rockchip/common/edp.c
renamed from .../rk3288/edp.c, which was introduced at coreboot commit
40f558e8f4f7 ("rockchip: support display").

Right, sorry.  I mean, on the U-Boot side, where did things come from?
I wonder how we got a different license text, and perhaps if we
shouldn't just re-port the coreboot code over as a clean/clear way to
re-license it to GPL-2.0-only.

I'm not sure re-porting is a great idea from the technical perspective.
I've been reading both drivers to compare them, there are also things in
U-Boot that're missing from coreboot. Things like DM integration are
also not there as they're U-Boot specific.

I checked some files with git log and checked the first commit that
showed up for each.

Simon Glass  added:
- drivers/video/rockchip/rk_edp.c
- drivers/video/rockchip/rk_hdmi.c
- drivers/video/rockchip/rk_vop.c
- arch/arm/include/asm/arch-rockchip/vop_rk3288.h
- arch/arm/include/asm/arch-rockchip/edp_rk3288.h
as Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Philipp Tomsich  added:
- drivers/video/rockchip/rk3288_hdmi.c
- drivers/video/rockchip/rk3399_hdmi.c
- drivers/video/rockchip/rk_hdmi.h
- drivers/video/rockchip/rk_vop.h
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
- drivers/video/rockchip/rk3288_vop.c
- drivers/video/rockchip/rk3399_vop.c
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Eric Gao  added:
- drivers/video/rockchip/rk3288_mipi.c
- drivers/video/rockchip/rk3399_mipi.c
- drivers/video/rockchip/rk_mipi.c
- drivers/video/rockchip/rk_mipi.h
- arch/arm/include/asm/arch-rockchip/rockchip_mipi_dsi.h
as Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd

Jacob Chen  added:
- drivers/video/rockchip/rk_lvds.c
- arch/arm/include/asm/arch-rockchip/lvds_rk3288.h
as Copyright 2016 Rockchip Inc.

Probably then the best "I am not a lawyer" answer is to have Philipp
Tomsich, Eric Gao and Jacob Chen all acked-by a patch to mark our driver
as GPL-2.0-only so that it's very clear that we can take improvements
from other GPL-2.0-only sources.


It's OK for Rockchip to make this change update license to GPL-2.0+.


Thanks,
- Kever




Re: [PATCH 1/3] rockchip: efuse: add support for RK3288 non-secure efuse

2020-10-30 Thread Kever Yang

Hi Jonas,

    Could you help to format the coding style as required so that we 
can merge this patch to the mainline?



Thanks,
- Kever
On 2020/10/14 上午4:21, Jonas Karlman wrote:

From: Francis Fan 

Extend rockchip efuse driver with support for RK3288 non-secure efuse.

Signed-off-by: Francis Fan 
Signed-off-by: Cody Xie 
Signed-off-by: Jonas Karlman 
---
  drivers/misc/rockchip-efuse.c | 91 +--
  1 file changed, 87 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/rockchip-efuse.c b/drivers/misc/rockchip-efuse.c
index 46ce6305fe..20423544d9 100644
--- a/drivers/misc/rockchip-efuse.c
+++ b/drivers/misc/rockchip-efuse.c
@@ -27,6 +27,17 @@
  #define RK3399_STROBE   BIT(1)
  #define RK3399_CSB  BIT(0)
  
+#define RK3288_A_SHIFT  6

+#define RK3288_A_MASK   0x3ff
+#define RK3288_NFUSES   32
+#define RK3288_BYTES_PER_FUSE   1
+#define RK3288_PGENBBIT(3)
+#define RK3288_LOAD BIT(2)
+#define RK3288_STROBE   BIT(1)
+#define RK3288_CSB  BIT(0)
+
+typedef int (*EFUSE_READ)(struct udevice *dev, int offset, void *buf, int 
size);
+
  struct rockchip_efuse_regs {
u32 ctrl;  /* 0x00  efuse control register */
u32 dout;  /* 0x04  efuse data out register */
@@ -53,7 +64,7 @@ static int dump_efuses(struct cmd_tbl *cmdtp, int flag,
 */
  
  	struct udevice *dev;

-   u8 fuses[128];
+   u8 fuses[128] = {0};
int ret;
  
  	/* retrieve the device */

@@ -77,7 +88,7 @@ static int dump_efuses(struct cmd_tbl *cmdtp, int flag,
  }
  
  U_BOOT_CMD(

-   rk3399_dump_efuses, 1, 1, dump_efuses,
+   rockchip_dump_efuses, 1, 1, dump_efuses,
"Dump the content of the efuses",
""
  );
@@ -127,10 +138,59 @@ static int rockchip_rk3399_efuse_read(struct udevice 
*dev, int offset,
return 0;
  }
  
+static int rockchip_rk3288_efuse_read(struct udevice *dev, int offset,

+ void *buf, int size)
+{
+   struct rockchip_efuse_platdata *plat = dev_get_platdata(dev);
+   struct rockchip_efuse_regs *efuse =
+   (struct rockchip_efuse_regs *)plat->base;
+   u8 *buffer = buf;
+   int max_size = RK3288_NFUSES * RK3288_BYTES_PER_FUSE;
+
+   if (size > (max_size - offset))
+   size = max_size - offset;
+
+   /* Switch to read mode */
+   writel(RK3288_LOAD | RK3288_PGENB, >ctrl);
+   udelay(1);
+
+   while (size--) {
+   writel(readl(>ctrl) &
+   (~(RK3288_A_MASK << RK3288_A_SHIFT)),
+   >ctrl);
+   /* set addr */
+   writel(readl(>ctrl) |
+   ((offset++ & RK3288_A_MASK) << RK3288_A_SHIFT),
+   >ctrl);
+   udelay(1);
+   /* strobe low to high */
+   writel(readl(>ctrl) |
+   RK3288_STROBE, >ctrl);
+   ndelay(60);
+   /* read data */
+   *buffer++ = readl(>dout);
+   /* reset strobe to low */
+   writel(readl(>ctrl) &
+   (~RK3288_STROBE), >ctrl);
+   udelay(1);
+   }
+
+   /* Switch to standby mode */
+   writel(RK3288_PGENB | RK3288_CSB, >ctrl);
+
+   return 0;
+}
+
  static int rockchip_efuse_read(struct udevice *dev, int offset,
   void *buf, int size)
  {
-   return rockchip_rk3399_efuse_read(dev, offset, buf, size);
+   EFUSE_READ efuse_read = NULL;
+
+   efuse_read = (EFUSE_READ)dev_get_driver_data(dev);
+   if (!efuse_read)
+   return -ENOSYS;
+
+   return (*efuse_read)(dev, offset, buf, size);
  }
  
  static const struct misc_ops rockchip_efuse_ops = {

@@ -146,7 +206,30 @@ static int rockchip_efuse_ofdata_to_platdata(struct 
udevice *dev)
  }
  
  static const struct udevice_id rockchip_efuse_ids[] = {

-   { .compatible = "rockchip,rk3399-efuse" },
+   {
+   .compatible = "rockchip,rk3066a-efuse",
+   .data = (ulong)_rk3288_efuse_read,
+   },
+   {
+   .compatible = "rockchip,rk3188-efuse",
+   .data = (ulong)_rk3288_efuse_read,
+   },
+   {
+   .compatible = "rockchip,rk3228-efuse",
+   .data = (ulong)_rk3288_efuse_read,
+   },
+   {
+   .compatible = "rockchip,rk3288-efuse",
+   .data = (ulong)_rk3288_efuse_read,
+   },
+   {
+   .compatible = "rockchip,rk3368-efuse",
+   .data = (ulong)_rk3288_efuse_read,
+   },
+   {
+   .compatible = "rockchip,rk3399-efuse",
+   .data = (ulong)_rk3399_efuse_read,
+   },
{}
  };
  





RE: [PATCH v4 2/3] armv8: lx2162a: Add Soc changes to support LX2162A

2020-10-30 Thread Meenakshi Aggarwal



> -Original Message-
> From: Tom Rini 
> Sent: Thursday, October 29, 2020 8:14 PM
> To: Meenakshi Aggarwal 
> Cc: u-boot@lists.denx.de; Priyanka Jain ; Varun Sethi
> 
> Subject: Re: [PATCH v4 2/3] armv8: lx2162a: Add Soc changes to support
> LX2162A
> 
> On Thu, Oct 29, 2020 at 07:16:16PM +0530, meenakshi.aggar...@nxp.com
> wrote:
> 
> > From: Meenakshi Aggarwal 
> >
> > LX2162 is LX2160 based SoC, it has same die as of LX2160 with
> > different packaging.
> >
> > LX2162A support 64-bit 2.9GT/s DDR4 memory, i2c, micro-click module,
> > microSD card, eMMC support, serial console, qspi nor flash, qsgmii,
> > sgmii, 25g, 40g, 50g network interface, one usb 3.0 and serdes
> > interface to support three PCIe gen3 interface.
> >
> > Signed-off-by: Meenakshi Aggarwal 
> > ---
> >  arch/arm/cpu/armv8/Kconfig |  2 +-
> >  arch/arm/cpu/armv8/fsl-layerscape/Kconfig  | 39 +--
> >  arch/arm/cpu/armv8/fsl-layerscape/Makefile |  5 ++
> >  arch/arm/cpu/armv8/fsl-layerscape/cpu.c|  7 ++-
> >  arch/arm/cpu/armv8/fsl-layerscape/doc/README.soc   | 58
> ++
> 
> A follow up to convert README.soc to rST and move it with the rest of our rST
> documentation would be appreciated, thanks.
[Meenakshi Aggarwal] We are planning this, but will be in a separate patch.
> 
> --
> Tom


Re: [PATCH] video: rockchip: Add missing dpcd_write() call to link_train_ce()

2020-10-30 Thread Kever Yang



On 2020/10/7 上午4:39, Alper Nebi Yasak wrote:

Found this by comparing it to the coreboot driver, a form of this call
was introduced there in their commit b9a7877568cf ("rockchip/*: refactor
edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly
above it.

Without this on a gru-kevin chromebook, I have:

 clock recovery at voltage 0 pre-emphasis 0
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 channel eq failed, ret=-5
 link train failed!
 rk_vop_probe() Device failed: ret=-5

With this, it looks like training succeeds:

 clock recovery at voltage 0 pre-emphasis 0
 requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
 using signal parameters: voltage 0.4V pre_emph 3.5dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 6dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 6dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 6dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 6dB
 using signal parameters: voltage 0.4V pre_emph 6dB
 requested signal parameters: lane 0 voltage 0.4V pre_emph 0dB
 requested signal parameters: lane 1 voltage 0.4V pre_emph 0dB
 requested signal parameters: lane 2 voltage 0.4V pre_emph 0dB
 requested signal parameters: lane 3 voltage 0.4V pre_emph 0dB
 using signal parameters: voltage 0.4V pre_emph 0dB
 channel eq at voltage 0 pre-emphasis 0
 config video failed
 rk_vop_probe() Device failed: ret=-110

The "config video failed" error also goes away when I disable higher
log levels, and it claims to have successfully probed the device.

Signed-off-by: Alper Nebi Yasak 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
I'm testing this with a lot of other patches to make the board work. The
actual tree I'm using is available here:

 https://github.com/alpernebbi/u-boot/commits/rk3399-gru-kevin/wip
 (currently at commit c0dc4b42afe770671ce7bb0dd519d894a3acdea0)

  drivers/video/rockchip/rk_edp.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 000bd48140..a032eb6889 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -559,6 +559,12 @@ static int rk_edp_link_train_ce(struct rk_edp_priv *edp)
channel_eq = 0;
for (tries = 0; tries < 5; tries++) {
rk_edp_set_link_training(edp, edp->train_set);
+   ret = rk_edp_dpcd_write(regs, DPCD_TRAINING_LANE0_SET,
+   edp->train_set,
+   edp->link_train.lane_count);
+   if (ret)
+   return ret;
+
udelay(400);
  
  		if (rk_edp_dpcd_read_link_status(edp, status) < 0) {





Re: [PATCH] ram: rockchip: px30: add a config-based ddr selection

2020-10-30 Thread Kever Yang



On 2020/10/2 上午2:40, Heiko Stuebner wrote:

From: Heiko Stuebner 

The SRAM on the PX30 is not big enough to hold multiple DDR configs
so it needs to be selected during build.

So far simply the DDR3 config was always selected and getting DDR4
or LPDDR2/3 initialized would require a code modification.

So add Kconfig options similar to RK3399 to allow selecting the DDR4
and LPDDR2/3 options instead, while DDR3 stays the default as before.

Signed-off-by: Heiko Stuebner 

Reviewed-by: Kever Yang

Thanks,
- Kever

---
  drivers/ram/rockchip/Kconfig  | 21 +
  drivers/ram/rockchip/sdram_px30.c |  8 
  2 files changed, 29 insertions(+)

diff --git a/drivers/ram/rockchip/Kconfig b/drivers/ram/rockchip/Kconfig
index 8e97c2f49e..c459bbf5e2 100644
--- a/drivers/ram/rockchip/Kconfig
+++ b/drivers/ram/rockchip/Kconfig
@@ -22,6 +22,27 @@ config RAM_ROCKCHIP_DEBUG
  This is an option for developers to understand the ram drivers
  initialization, configurations and etc.
  
+config RAM_PX30_DDR4

+   bool "DDR3 support for Rockchip PX30"
+   depends on RAM_ROCKCHIP && ROCKCHIP_PX30
+   help
+ This enables DDR4 sdram support instead of the default DDR3 support
+ on Rockchip PC30 SoCs.
+
+config RAM_PX30_LPDDR2
+   bool "LPDDR2 support for Rockchip PX30"
+   depends on RAM_ROCKCHIP && ROCKCHIP_PX30
+   help
+ This enables LPDDR2 sdram support instead of the default DDR3 support
+ on Rockchip PC30 SoCs.
+
+config RAM_PX30_LPDDR3
+   bool "LPDDR3 support for Rockchip PX30"
+   depends on RAM_ROCKCHIP && ROCKCHIP_PX30
+   help
+ This enables LPDDR3 sdram support instead of the default DDR3 support
+ on Rockchip PC30 SoCs.
+
  config RAM_RK3399_LPDDR4
bool "LPDDR4 support for Rockchip RK3399"
depends on RAM_ROCKCHIP && ROCKCHIP_RK3399
diff --git a/drivers/ram/rockchip/sdram_px30.c 
b/drivers/ram/rockchip/sdram_px30.c
index fd5763d0a0..2f1f6e9c0c 100644
--- a/drivers/ram/rockchip/sdram_px30.c
+++ b/drivers/ram/rockchip/sdram_px30.c
@@ -125,7 +125,15 @@ u32 addrmap[][8] = {
  struct dram_info dram_info;
  
  struct px30_sdram_params sdram_configs[] = {

+#if defined(CONFIG_RAM_PX30_DDR4)
+#include   "sdram-px30-ddr4-detect-333.inc"
+#elif defined(CONFIG_RAM_PX30_LPDDR2)
+#include   "sdram-px30-lpddr2-detect-333.inc"
+#elif defined(CONFIG_RAM_PX30_LPDDR3)
+#include   "sdram-px30-lpddr3-detect-333.inc"
+#else
  #include  "sdram-px30-ddr3-detect-333.inc"
+#endif
  };
  
  struct ddr_phy_skew skew = {





Re: [PATCH] rockchip: Rock960: fix up USB support

2020-10-30 Thread Kever Yang

Hi Peter,


    Could you add you signature for this patch?


Thanks,

- Kever

On 2020/9/29 下午9:06, Peter Robinson wrote:

Fix up USB config options so keyboards and other USB devices work.
---
  configs/rock960-rk3399_defconfig | 9 ++---
  include/configs/rock960_rk3399.h | 2 ++
  2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 1d997847c2..a5a50785c5 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -3,12 +3,12 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_SYS_TEXT_BASE=0x0020
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_ROCKCHIP_RK3399=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
  CONFIG_TARGET_ROCK960_RK3399=y
  CONFIG_DEBUG_UART_BASE=0xFF1A
  CONFIG_DEBUG_UART_CLOCK=2400
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock960"
  CONFIG_DEBUG_UART=y
+CONFIG_USE_PREBOOT=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb"
  CONFIG_MISC_INIT_R=y
  CONFIG_DISPLAY_BOARDINFO_LATE=y
@@ -41,6 +41,8 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
  CONFIG_DM_ETH=y
  CONFIG_NVME=y
  CONFIG_PCI=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
@@ -54,10 +56,11 @@ CONFIG_USB_XHCI_HCD=y
  CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC3=y
-CONFIG_ROCKCHIP_USB2_PHY=y
+CONFIG_DM_KEYBOARD=y
  CONFIG_USB_KEYBOARD=y
-CONFIG_USB_GADGET=y
  CONFIG_USB_HOST_ETHER=y
  CONFIG_USB_ETHER_ASIX=y
  CONFIG_USB_ETHER_ASIX88179=y
diff --git a/include/configs/rock960_rk3399.h b/include/configs/rock960_rk3399.h
index c6f9122154..2edad71028 100644
--- a/include/configs/rock960_rk3399.h
+++ b/include/configs/rock960_rk3399.h
@@ -15,4 +15,6 @@
  
  #define SDRAM_BANK_SIZE			(2UL << 30)
  
+#define CONFIG_USB_OHCI_NEW

+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
  #endif





[PATCH v2 20/21] reset: reset-mtmips: add DM_FLAG_PRE_RELOC flag

2020-10-30 Thread Weijie Gao
Add DM_FLAG_PRE_RELOC flag for reset-mtmips to make sure this driver can
be probed before relocation even if u-boot,dm-pre-reloc is not present
in the dts.

Signed-off-by: Weijie Gao 
---
v2 changes: new
---
 drivers/reset/reset-mtmips.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/reset/reset-mtmips.c b/drivers/reset/reset-mtmips.c
index bc20e3335c..0d6a446465 100644
--- a/drivers/reset/reset-mtmips.c
+++ b/drivers/reset/reset-mtmips.c
@@ -82,4 +82,5 @@ U_BOOT_DRIVER(mtmips_reset) = {
.probe = mtmips_reset_probe,
.priv_auto_alloc_size = sizeof(struct mtmips_reset_priv),
.ops = _reset_ops,
+   .flags = DM_FLAG_PRE_RELOC,
 };
-- 
2.17.1


[PATCH v2 19/21] mmc: mtk-sd: add pad control settings for MediaTek MT7620/MT76x8 SoCs

2020-10-30 Thread Weijie Gao
The driver is missing pad control settings (pad delay and pad conf) for
the mt7620 and mt76x8. Although mt76x8 still works well, mt7620 will
encounter CRC error on data transfers.

This patch adds default pad control settings for mt7620_compat.

Also a missing field .sclk_cycle_shift = 20 for mt7622 is added.

Signed-off-by: Weijie Gao 
---
v2 changes: none
---
 drivers/mmc/mtk-sd.c | 122 +--
 1 file changed, 119 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
index 4f9fa7d0ec..e30b16d56b 100644
--- a/drivers/mmc/mtk-sd.c
+++ b/drivers/mmc/mtk-sd.c
@@ -113,7 +113,51 @@
 #define MSDC_PB2_RESPWAIT_M0x0c
 #define MSDC_PB2_RESPWAIT_S2
 
+/* MSDC_PAD_CTRL0 */
+#define MSDC_PAD_CTRL0_CLKRDSEL_M  0xff00
+#define MSDC_PAD_CTRL0_CLKRDSEL_S  24
+#define MSDC_PAD_CTRL0_CLKTDSELBIT(20)
+#define MSDC_PAD_CTRL0_CLKIES  BIT(19)
+#define MSDC_PAD_CTRL0_CLKSMT  BIT(18)
+#define MSDC_PAD_CTRL0_CLKPU   BIT(17)
+#define MSDC_PAD_CTRL0_CLKPD   BIT(16)
+#define MSDC_PAD_CTRL0_CLKSR   BIT(8)
+#define MSDC_PAD_CTRL0_CLKDRVP_M   0x70
+#define MSDC_PAD_CTRL0_CLKDRVP_S   4
+#define MSDC_PAD_CTRL0_CLKDRVN_M   0x7
+#define MSDC_PAD_CTRL0_CLKDRVN_S   0
+
+/* MSDC_PAD_CTRL1 */
+#define MSDC_PAD_CTRL1_CMDRDSEL_M  0xff00
+#define MSDC_PAD_CTRL1_CMDRDSEL_S  24
+#define MSDC_PAD_CTRL1_CMDTDSELBIT(20)
+#define MSDC_PAD_CTRL1_CMDIES  BIT(19)
+#define MSDC_PAD_CTRL1_CMDSMT  BIT(18)
+#define MSDC_PAD_CTRL1_CMDPU   BIT(17)
+#define MSDC_PAD_CTRL1_CMDPD   BIT(16)
+#define MSDC_PAD_CTRL1_CMDSR   BIT(8)
+#define MSDC_PAD_CTRL1_CMDDRVP_M   0x70
+#define MSDC_PAD_CTRL1_CMDDRVP_S   4
+#define MSDC_PAD_CTRL1_CMDDRVN_M   0x7
+#define MSDC_PAD_CTRL1_CMDDRVN_S   0
+
+/* MSDC_PAD_CTRL2 */
+#define MSDC_PAD_CTRL2_DATRDSEL_M  0xff00
+#define MSDC_PAD_CTRL2_DATRDSEL_S  24
+#define MSDC_PAD_CTRL2_DATTDSELBIT(20)
+#define MSDC_PAD_CTRL2_DATIES  BIT(19)
+#define MSDC_PAD_CTRL2_DATSMT  BIT(18)
+#define MSDC_PAD_CTRL2_DATPU   BIT(17)
+#define MSDC_PAD_CTRL2_DATPD   BIT(16)
+#define MSDC_PAD_CTRL2_DATSR   BIT(8)
+#define MSDC_PAD_CTRL2_DATDRVP_M   0x70
+#define MSDC_PAD_CTRL2_DATDRVP_S   4
+#define MSDC_PAD_CTRL2_DATDRVN_M   0x7
+#define MSDC_PAD_CTRL2_DATDRVN_S   0
+
 /* PAD_TUNE */
+#define MSDC_PAD_TUNE_CLKTDLY_M0xf800
+#define MSDC_PAD_TUNE_CLKTDLY_S27
 #define MSDC_PAD_TUNE_CMDRRDLY_M   0x7c0
 #define MSDC_PAD_TUNE_CMDRRDLY_S   22
 #define MSDC_PAD_TUNE_CMD_SEL  BIT(21)
@@ -129,6 +173,26 @@
 #define PAD_CMD_TUNE_RX_DLY3   0x3E
 #define PAD_CMD_TUNE_RX_DLY3_S 1
 
+/* PAD_TUNE0 */
+#define MSDC_PAD_TUNE0_DAT0RDDLY_M 0x1f00
+#define MSDC_PAD_TUNE0_DAT0RDDLY_S 24
+#define MSDC_PAD_TUNE0_DAT1RDDLY_M 0x1f
+#define MSDC_PAD_TUNE0_DAT1RDDLY_S 16
+#define MSDC_PAD_TUNE0_DAT2RDDLY_M 0x1f00
+#define MSDC_PAD_TUNE0_DAT2RDDLY_S 8
+#define MSDC_PAD_TUNE0_DAT3RDDLY_M 0x1f
+#define MSDC_PAD_TUNE0_DAT3RDDLY_S 0
+
+/* PAD_TUNE1 */
+#define MSDC_PAD_TUNE1_DAT4RDDLY_M 0x1f00
+#define MSDC_PAD_TUNE1_DAT4RDDLY_S 24
+#define MSDC_PAD_TUNE1_DAT5RDDLY_M 0x1f
+#define MSDC_PAD_TUNE1_DAT5RDDLY_S 16
+#define MSDC_PAD_TUNE1_DAT6RDDLY_M 0x1f00
+#define MSDC_PAD_TUNE1_DAT6RDDLY_S 8
+#define MSDC_PAD_TUNE1_DAT7RDDLY_M 0x1f
+#define MSDC_PAD_TUNE1_DAT7RDDLY_S 0
+
 /* EMMC50_CFG0 */
 #define EMMC50_CFG_CFCSTS_SEL  BIT(4)
 
@@ -221,7 +285,10 @@ struct mtk_sd_regs {
u32 dat3_tune_crc;
u32 cmd_tune_crc;
u32 sdio_tune_wind;
-   u32 reserved4[5];
+   u32 reserved4[2];
+   u32 pad_ctrl0;
+   u32 pad_ctrl1;
+   u32 pad_ctrl2;
u32 pad_tune;
u32 pad_tune0;
u32 pad_tune1;
@@ -263,6 +330,8 @@ struct msdc_compatible {
bool busy_check;
bool stop_clk_fix;
bool enhance_rx;
+   bool builtin_pad_ctrl;
+   bool default_pad_dly;
 };
 
 struct msdc_delay_phase {
@@ -1391,9 +1460,14 @@ static void msdc_init_hw(struct msdc_host *host)
 {
u32 val;
void __iomem *tune_reg = >base->pad_tune;
+   void __iomem *rd_dly0_reg = >base->pad_tune0;
+   void __iomem *rd_dly1_reg = >base->pad_tune1;
 
-   if (host->dev_comp->pad_tune0)
+   if (host->dev_comp->pad_tune0) {
tune_reg = >base->pad_tune0;
+   rd_dly0_reg = >base->dat_rd_dly[0];
+   rd_dly1_reg = >base->dat_rd_dly[1];
+   }
 
/* Configure to MMC/SD mode, clock free running */
setbits_le32(>base->msdc_cfg, MSDC_CFG_MODE);
@@ -1479,6 +1553,45 @@ static void msdc_init_hw(struct msdc_host *host)
setbits_le32(tune_reg, MSDC_PAD_TUNE_RXDLYSEL);
}
 
+  

[PATCH v2 16/21] spi: add spi controller support for MediaTek MT7620 SoC

2020-10-30 Thread Weijie Gao
This patch adds spi controller support for MediaTek MT7620 SoC.

The SPI controller supports two chip selects. These two chip selects are
implemented as two separate register groups, but they share the same bus
(DI/DO/CLK), only CS pins are dedicated for each register group.
Appearently these two register groups cannot operates simulataneously so
they are implemented as one controller.

Signed-off-by: Weijie Gao 
---
v2 changes: none
---
 drivers/spi/Kconfig  |   7 +
 drivers/spi/Makefile |   1 +
 drivers/spi/mt7620_spi.c | 277 +++
 3 files changed, 285 insertions(+)
 create mode 100644 drivers/spi/mt7620_spi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index f7a9852565..ec50d843ef 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -202,6 +202,13 @@ config MSCC_BB_SPI
  Enable MSCC bitbang SPI driver. This driver can be used on
  MSCC SOCs.
 
+config MT7620_SPI
+   bool "MediaTek MT7620 SPI driver"
+   depends on SOC_MT7620
+   help
+ Enable the MT7620 SPI driver. This driver can be used to access
+ generic SPI devices on MediaTek MT7620 SoC.
+
 config MT7621_SPI
bool "MediaTek MT7621 SPI driver"
depends on SOC_MT7628
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index d9b5bd9b79..bfd142d153 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_MESON_SPIFC) += meson_spifc.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MTK_SNFI_SPI) += mtk_snfi_spi.o
+obj-$(CONFIG_MT7620_SPI) += mt7620_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
diff --git a/drivers/spi/mt7620_spi.c b/drivers/spi/mt7620_spi.c
new file mode 100644
index 00..c0b3d1d8eb
--- /dev/null
+++ b/drivers/spi/mt7620_spi.c
@@ -0,0 +1,277 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Weijie Gao 
+ *
+ * Generic SPI driver for MediaTek MT7620 SoC
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MT7620_SPI_NUM_CS  2
+#define MT7620_SPI_MASTER1_OFF 0x00
+#define MT7620_SPI_MASTER2_OFF 0x40
+
+/* SPI_STAT */
+#define   SPI_BUSY BIT(0)
+
+/* SPI_CFG */
+#define   MSB_FIRSTBIT(8)
+#define   SPI_CLK_POL  BIT(6)
+#define   RX_CLK_EDGE  BIT(5)
+#define   TX_CLK_EDGE  BIT(4)
+#define   SPI_CLK_S0
+#define   SPI_CLK_MGENMASK(2, 0)
+
+/* SPI_CTL */
+#define   START_WR BIT(2)
+#define   START_RD BIT(1)
+#define   SPI_HIGH BIT(0)
+
+#define SPI_ARB0xf0
+#define   ARB_EN   BIT(31)
+
+struct mt7620_spi_master_regs {
+   u32 stat;
+   u32 reserved0[3];
+   u32 cfg;
+   u32 ctl;
+   u32 reserved1[2];
+   u32 data;
+};
+
+struct mt7620_spi {
+   void __iomem *regs;
+   struct mt7620_spi_master_regs *m[MT7620_SPI_NUM_CS];
+   unsigned int sys_freq;
+   u32 wait_us;
+   uint mode;
+   uint speed;
+};
+
+static void mt7620_spi_master_setup(struct mt7620_spi *ms, int cs)
+{
+   u32 rate, prescale, freq, tmo, cfg;
+
+   /* Calculate the clock divsior */
+   rate = DIV_ROUND_UP(ms->sys_freq, ms->speed);
+   rate = roundup_pow_of_two(rate);
+
+   prescale = ilog2(rate / 2);
+   if (prescale > 6)
+   prescale = 6;
+
+   /* Calculate the real clock, and usecs for one byte transaction */
+   freq = ms->sys_freq >> (prescale + 1);
+   tmo = DIV_ROUND_UP(8 * 100, freq);
+
+   /* 10 times tolerance plus 100us */
+   ms->wait_us = 10 * tmo + 100;
+
+   /* set SPI_CFG */
+   cfg = prescale << SPI_CLK_S;
+
+   switch (ms->mode & (SPI_CPOL | SPI_CPHA)) {
+   case SPI_MODE_0:
+   cfg |= TX_CLK_EDGE;
+   break;
+   case SPI_MODE_1:
+   cfg |= RX_CLK_EDGE;
+   break;
+   case SPI_MODE_2:
+   cfg |= SPI_CLK_POL | RX_CLK_EDGE;
+   break;
+   case SPI_MODE_3:
+   cfg |= SPI_CLK_POL | TX_CLK_EDGE;
+   break;
+   }
+
+   if (!(ms->mode & SPI_LSB_FIRST))
+   cfg |= MSB_FIRST;
+
+   writel(cfg, >m[cs]->cfg);
+
+   writel(SPI_HIGH, >m[cs]->ctl);
+}
+
+static void mt7620_spi_set_cs(struct mt7620_spi *ms, int cs, int enable)
+{
+   if (enable)
+   mt7620_spi_master_setup(ms, cs);
+
+   if (ms->mode & SPI_CS_HIGH)
+   enable = !enable;
+
+   if (enable)
+   clrbits_32(>m[cs]->ctl, SPI_HIGH);
+   else
+   setbits_32(>m[cs]->ctl, SPI_HIGH);
+}
+
+static int mt7620_spi_set_mode(struct udevice *bus, uint mode)
+{
+   struct mt7620_spi *ms = dev_get_priv(bus);
+
+   ms->mode = mode;
+
+   /* Mode 0 is 

[PATCH v2 18/21] net: add ethernet driver for MediaTek MT7620 SoC

2020-10-30 Thread Weijie Gao
This patch adds  ethernet driver for MediaTek MT7620 SoC.

The MT7620 SoC has a built-in ethernet (Frame Engine) and a built-in
7-port switch and two xMII interfaces (can be MII/RMII/RGMII).

The port 0-3 of the switch connects to intergrited FE PHYs. Port 4 can be
configured to connect to either the intergrited FE PHY, or the xMII.
Port 5 always connects to the xMII. Port 6 is the CPU port.

This driver supports MT7530 giga switch connects to port 5.

Signed-off-by: Weijie Gao 
---
v2 changes: none
---
 drivers/net/Kconfig  |   12 +
 drivers/net/Makefile |1 +
 drivers/net/mt7620-eth.c | 1222 ++
 3 files changed, 1235 insertions(+)
 create mode 100644 drivers/net/mt7620-eth.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3a5e036880..d1a52c7264 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -399,6 +399,18 @@ config MACB_ZYNQ
  The Cadence MACB ethernet interface was used on Zynq platform.
  Say Y to enable support for the MACB/GEM in Zynq chip.
 
+config MT7620_ETH
+   bool "MediaTek MT7620 Ethernet Interface"
+   depends on SOC_MT7620
+   select PHYLIB
+   select DM_RESET
+   select DM_GPIO
+   select CLK
+   help
+ The MediaTek MT7620 ethernet interface is used on MT7620 based
+ boards. It has a built-in switch with two configurable ports which
+ can connect to external PHY/MACs.
+
 config MT7628_ETH
bool "MediaTek MT7628 Ethernet Interface"
depends on SOC_MT7628
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index e3bdda359d..f2a0df509d 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_MDIO_IPQ4019) += mdio-ipq4019.o
 obj-$(CONFIG_MDIO_MUX_I2CREG) += mdio_mux_i2creg.o
 obj-$(CONFIG_MDIO_MUX_SANDBOX) += mdio_mux_sandbox.o
 obj-$(CONFIG_MPC8XX_FEC) += mpc8xx_fec.o
+obj-$(CONFIG_MT7620_ETH) += mt7620-eth.o
 obj-$(CONFIG_MT7628_ETH) += mt7628-eth.o
 obj-$(CONFIG_MVGBE) += mvgbe.o
 obj-$(CONFIG_MVMDIO) += mvmdio.o
diff --git a/drivers/net/mt7620-eth.c b/drivers/net/mt7620-eth.c
new file mode 100644
index 00..2c148a3b35
--- /dev/null
+++ b/drivers/net/mt7620-eth.c
@@ -0,0 +1,1222 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Weijie Gao 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Frame Engine block */
+#define GDMA_BASE  0x600
+#define PDMA_BASE  0x800
+
+/* GDMA registers */
+#define GDMA_FWD_CFG   0x00
+#define GDMA_DST_PORT  GENMASK(2, 0)
+#define   GDMA_DST_PORT_CPU0
+
+#define GDMA_MAC_ADRL  0x08
+#define GDMA_MAC_ADRH  0x0c
+
+/* PDMA registers */
+#define TX_BASE_PTR0   0x000
+#define TX_MAX_CNT00x004
+#define TX_CTX_IDX00x008
+#define TX_DTX_IDX00x00c
+#define RX_BASE_PTR0   0x100
+#define RX_MAX_CNT00x104
+#define RX_CALC_IDX0   0x108
+#define RX_DRX_IDX00x10c
+
+#define PDMA_GLO_CFG   0x204
+#define TX_WB_DDONEBIT(6)
+#define PDMA_BT_SIZE   GENMASK(5, 4)
+#define   PDMA_BT_SIZE_32B 1
+#define RX_DMA_BUSYBIT(3)
+#define RX_DMA_EN  BIT(2)
+#define TX_DMA_BUSYBIT(1)
+#define TX_DMA_EN  BIT(0)
+
+#define PDMA_RST_IDX   0x208
+#define RST_DRX_IDX0   BIT(16)
+#define RST_DTX_IDX0   BIT(0)
+
+/* Built-in giga ethernet switch block */
+
+/* ARL registers */
+#define GSW_MFC0x0010
+#define BC_FFP GENMASK(31, 24)
+#define UNM_FFPGENMASK(23, 16)
+#define UNU_FFPGENMASK(15, 8)
+#define CPU_EN BIT(7)
+#define CPU_PORT   GENMASK(6, 4)
+
+/* Port registers */
+#define GSW_PCR(p) (0x2004 + (p) * 0x100)
+#define PORT_MATRIXGENMASK(23, 16)
+
+#define GSW_PVC(p) (0x2010 + (p) * 0x100)
+#define STAG_VPID  GENMASK(31, 16)
+#define VLAN_ATTR  GENMASK(7, 6)
+#define   VLAN_ATTR_USER   0
+
+/* MAC registers */
+#define GSW_PMCR(p)(0x3000 + (p) * 0x100)
+#define IPG_CFGGENMASK(19, 18)
+#define IPG_96BIT_WITH_SHORT_IPG   1
+#define MAC_MODE   BIT(16)
+#define FORCE_MODE BIT(15)
+#define MAC_TX_EN  BIT(14)
+#define 

  1   2   >