RE: [EXT] Re: [PATCH v5 13/16] Layerscape: Enable Job ring driver model in U-Boot.

2021-11-30 Thread Gaurav Jain
Hello Michael

> -Original Message-
> From: Michael Walle 
> Sent: Tuesday, November 16, 2021 4:51 PM
> To: Gaurav Jain 
> Cc: Shengzhou Liu ; Varun Sethi
> ; Adrian Alonso ; Alison Wang
> ; Andy Tang ;
> feste...@gmail.com; Franck Lenormand ;
> Horia Geanta ; Ji Luo ;
> Meenakshi Aggarwal ; Mingkai Hu
> ; olte...@gmail.com; Pankaj Gupta
> ; Peng Fan ; Pramod Kumar
> ; Priyanka Jain ;
> Rajesh Bhagat ; Sahil Malhotra
> ; sba...@denx.de; Silvano Di Ninno
> ; s...@chromium.org; u-boot@lists.denx.de; dl-
> uboot-imx ; Wasim Khan ;
> Ye Li ; Michael Walle 
> Subject: [EXT] Re: [PATCH v5 13/16] Layerscape: Enable Job ring driver model
> in U-Boot.
> 
> Caution: EXT Email
> 
> > LS(1021/1012/1028/1043/1046/1088/2088), LX2160, LX2162 platforms are
> > enabled with JR driver model.
> >
> > removed sec_init() call from board files.
> > removed CONFIG_FSL_CAAM from defconfig files.
> > sec is initialized based on job ring information processed from device
> > tree.
> >
> > Signed-off-by: Gaurav Jain 
> > Reviewed-by: Priyanka Jain 
> > ---
> >  arch/arm/cpu/armv7/ls102xa/Kconfig|  4 +++
> >  arch/arm/cpu/armv7/ls102xa/cpu.c  | 16 +++
> >  arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 27 +++
> >  arch/arm/cpu/armv8/fsl-layerscape/cpu.c   | 10 ++-
> >  board/freescale/ls1012afrdm/ls1012afrdm.c |  7 +
> >  board/freescale/ls1012aqds/ls1012aqds.c   |  6 +
> >  board/freescale/ls1012ardb/ls1012ardb.c   |  6 +
> >  board/freescale/ls1021aiot/ls1021aiot.c   |  6 ++---
> >  board/freescale/ls1021aqds/ls1021aqds.c   |  6 +
> >  board/freescale/ls1021atsn/ls1021atsn.c   |  7 ++---
> >  board/freescale/ls1021atwr/ls1021atwr.c   |  8 ++
> >  board/freescale/ls1028a/ls1028a.c |  6 +
> >  board/freescale/ls1043ardb/ls1043ardb.c   |  6 +
> >  board/freescale/ls1046afrwy/ls1046afrwy.c |  7 +
> >  board/freescale/ls1046aqds/ls1046aqds.c   |  7 +
> >  board/freescale/ls1046ardb/ls1046ardb.c   |  6 +
> >  board/freescale/ls1088a/ls1088a.c |  6 +
> >  board/freescale/ls2080aqds/ls2080aqds.c   |  6 +
> >  board/freescale/ls2080ardb/ls2080ardb.c   |  9 +--
> >  board/freescale/lx2160a/lx2160a.c |  5 
> >  configs/ls1021aiot_qspi_defconfig |  1 -
> >  configs/ls1021aqds_nor_defconfig  |  1 -
> >  configs/ls1021aqds_qspi_defconfig |  1 -
> >  configs/ls1021atsn_qspi_defconfig |  1 -
> >  configs/ls1021atwr_nor_defconfig  |  1 -
> >  ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
> >  configs/ls1028ardb_tfa_defconfig  |  1 -
> >  configs/ls1043ardb_tfa_defconfig  |  1 -
> >  configs/ls1046afrwy_tfa_defconfig |  1 -
> >  configs/ls1046aqds_tfa_defconfig  |  1 -
> >  configs/ls1046ardb_tfa_defconfig  |  1 -
> >  configs/ls2088aqds_tfa_defconfig  |  1 -
> >  configs/ls2088ardb_tfa_defconfig  |  1 -
> >  configs/lx2160aqds_tfa_defconfig  |  1 -
> >  configs/lx2160ardb_tfa_defconfig  |  1 -
> >  configs/lx2162aqds_tfa_defconfig  |  1 -
> >  36 files changed, 75 insertions(+), 102 deletions(-)
> 
> board/kontron/sl28/sl28.c fixes are missing here. With this patch applied I'll
> get the following error during boot:
> 
> U-Boot 2022.01-rc2-00026-gf82ded5126-dirty (Nov 16 2021 - 11:16:40 +0100)
> 
> SoC:  LS1028A Rev1.0 (0x870b0110)
> Clock Configuration:
>CPU0(A72):1300 MHz  CPU1(A72):1300 MHz
>Bus:  400  MHz  DDR:  1600 MT/s
> Reset Configuration Word (RCW):
>: 34004010 0030  
>0010:  008f 0030c000 
>0020: 0620 2580  00019016
>0030:  0048  
>0040:    
>0050:    
>0060: 0304  000e7000 
>0070: bb58 0002
> Model: Kontron SMARC-sAL28 (Dual PHY)
> EL:3
> CPLD:  v64
> DRAM:  4 GiB (DDR3, 32-bit, CL=11, ECC on)
> caam_jr: caam not found
> 
> ^^ this error.
> 
> please add the following hunk to this patch:
> 
> diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c index
> 9572502499..555e831f2a 100644
> --- a/board/kontron/sl28/sl28.c
> +++ b/board/kontron/sl28/sl28.c
> @@ -31,9 +31,6 @@ int boar

Re: [PATCH v5 13/16] Layerscape: Enable Job ring driver model in U-Boot.

2021-11-16 Thread Michael Walle
> LS(1021/1012/1028/1043/1046/1088/2088), LX2160, LX2162
> platforms are enabled with JR driver model.
> 
> removed sec_init() call from board files.
> removed CONFIG_FSL_CAAM from defconfig files.
> sec is initialized based on job ring information processed
> from device tree.
> 
> Signed-off-by: Gaurav Jain 
> Reviewed-by: Priyanka Jain 
> ---
>  arch/arm/cpu/armv7/ls102xa/Kconfig|  4 +++
>  arch/arm/cpu/armv7/ls102xa/cpu.c  | 16 +++
>  arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 27 +++
>  arch/arm/cpu/armv8/fsl-layerscape/cpu.c   | 10 ++-
>  board/freescale/ls1012afrdm/ls1012afrdm.c |  7 +
>  board/freescale/ls1012aqds/ls1012aqds.c   |  6 +
>  board/freescale/ls1012ardb/ls1012ardb.c   |  6 +
>  board/freescale/ls1021aiot/ls1021aiot.c   |  6 ++---
>  board/freescale/ls1021aqds/ls1021aqds.c   |  6 +
>  board/freescale/ls1021atsn/ls1021atsn.c   |  7 ++---
>  board/freescale/ls1021atwr/ls1021atwr.c   |  8 ++
>  board/freescale/ls1028a/ls1028a.c |  6 +
>  board/freescale/ls1043ardb/ls1043ardb.c   |  6 +
>  board/freescale/ls1046afrwy/ls1046afrwy.c |  7 +
>  board/freescale/ls1046aqds/ls1046aqds.c   |  7 +
>  board/freescale/ls1046ardb/ls1046ardb.c   |  6 +
>  board/freescale/ls1088a/ls1088a.c |  6 +
>  board/freescale/ls2080aqds/ls2080aqds.c   |  6 +
>  board/freescale/ls2080ardb/ls2080ardb.c   |  9 +--
>  board/freescale/lx2160a/lx2160a.c |  5 
>  configs/ls1021aiot_qspi_defconfig |  1 -
>  configs/ls1021aqds_nor_defconfig  |  1 -
>  configs/ls1021aqds_qspi_defconfig |  1 -
>  configs/ls1021atsn_qspi_defconfig |  1 -
>  configs/ls1021atwr_nor_defconfig  |  1 -
>  ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
>  configs/ls1028ardb_tfa_defconfig  |  1 -
>  configs/ls1043ardb_tfa_defconfig  |  1 -
>  configs/ls1046afrwy_tfa_defconfig |  1 -
>  configs/ls1046aqds_tfa_defconfig  |  1 -
>  configs/ls1046ardb_tfa_defconfig  |  1 -
>  configs/ls2088aqds_tfa_defconfig  |  1 -
>  configs/ls2088ardb_tfa_defconfig  |  1 -
>  configs/lx2160aqds_tfa_defconfig  |  1 -
>  configs/lx2160ardb_tfa_defconfig  |  1 -
>  configs/lx2162aqds_tfa_defconfig  |  1 -
>  36 files changed, 75 insertions(+), 102 deletions(-)

board/kontron/sl28/sl28.c fixes are missing here. With this patch
applied I'll get the following error during boot:

U-Boot 2022.01-rc2-00026-gf82ded5126-dirty (Nov 16 2021 - 11:16:40 +0100)

SoC:  LS1028A Rev1.0 (0x870b0110)
Clock Configuration:
   CPU0(A72):1300 MHz  CPU1(A72):1300 MHz  
   Bus:  400  MHz  DDR:  1600 MT/s
Reset Configuration Word (RCW):
   : 34004010 0030  
   0010:  008f 0030c000 
   0020: 0620 2580  00019016
   0030:  0048  
   0040:    
   0050:    
   0060: 0304  000e7000 
   0070: bb58 0002
Model: Kontron SMARC-sAL28 (Dual PHY)
EL:3
CPLD:  v64
DRAM:  4 GiB (DDR3, 32-bit, CL=11, ECC on)
caam_jr: caam not found

^^ this error.

please add the following hunk to this patch:

diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
index 9572502499..555e831f2a 100644
--- a/board/kontron/sl28/sl28.c
+++ b/board/kontron/sl28/sl28.c
@@ -31,9 +31,6 @@ int board_early_init_f(void)
 
 int board_init(void)
 {
-   if (CONFIG_IS_ENABLED(FSL_CAAM))
-   sec_init();
-
return 0;
 }

>  config ARCH_LS1028A
> @@ -53,6 +57,9 @@ config ARCH_LS1028A
>   select SYS_FSL_ERRATUM_A011334
>   select SYS_FSL_ESDHC_UNRELIABLE_PULSE_DETECTION_WORKAROUND
>   select RESV_RAM if GIC_V3_ITS
> + select FSL_CAAM
> + select FSL_BLOB
> + select MISC

There are boards like the sl28 which also have ARCH_LS1028A set and
doesn't depend on neither FSL_CAAM nor FSL_BLOB. Please don't set
this per architecture. Both should be set by the individual boards
instead as they are optional and having this here will just increase
binary size.

Of course this is like to be true for all ARCH_LSxxx Kconfig options.

>   imply PANIC_HANG 

-michael


[PATCH v5 13/16] Layerscape: Enable Job ring driver model in U-Boot.

2021-11-14 Thread Gaurav Jain
LS(1021/1012/1028/1043/1046/1088/2088), LX2160, LX2162
platforms are enabled with JR driver model.

removed sec_init() call from board files.
removed CONFIG_FSL_CAAM from defconfig files.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain 
Reviewed-by: Priyanka Jain 
---
 arch/arm/cpu/armv7/ls102xa/Kconfig|  4 +++
 arch/arm/cpu/armv7/ls102xa/cpu.c  | 16 +++
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 27 +++
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c   | 10 ++-
 board/freescale/ls1012afrdm/ls1012afrdm.c |  7 +
 board/freescale/ls1012aqds/ls1012aqds.c   |  6 +
 board/freescale/ls1012ardb/ls1012ardb.c   |  6 +
 board/freescale/ls1021aiot/ls1021aiot.c   |  6 ++---
 board/freescale/ls1021aqds/ls1021aqds.c   |  6 +
 board/freescale/ls1021atsn/ls1021atsn.c   |  7 ++---
 board/freescale/ls1021atwr/ls1021atwr.c   |  8 ++
 board/freescale/ls1028a/ls1028a.c |  6 +
 board/freescale/ls1043ardb/ls1043ardb.c   |  6 +
 board/freescale/ls1046afrwy/ls1046afrwy.c |  7 +
 board/freescale/ls1046aqds/ls1046aqds.c   |  7 +
 board/freescale/ls1046ardb/ls1046ardb.c   |  6 +
 board/freescale/ls1088a/ls1088a.c |  6 +
 board/freescale/ls2080aqds/ls2080aqds.c   |  6 +
 board/freescale/ls2080ardb/ls2080ardb.c   |  9 +--
 board/freescale/lx2160a/lx2160a.c |  5 
 configs/ls1021aiot_qspi_defconfig |  1 -
 configs/ls1021aqds_nor_defconfig  |  1 -
 configs/ls1021aqds_qspi_defconfig |  1 -
 configs/ls1021atsn_qspi_defconfig |  1 -
 configs/ls1021atwr_nor_defconfig  |  1 -
 ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
 configs/ls1028ardb_tfa_defconfig  |  1 -
 configs/ls1043ardb_tfa_defconfig  |  1 -
 configs/ls1046afrwy_tfa_defconfig |  1 -
 configs/ls1046aqds_tfa_defconfig  |  1 -
 configs/ls1046ardb_tfa_defconfig  |  1 -
 configs/ls2088aqds_tfa_defconfig  |  1 -
 configs/ls2088ardb_tfa_defconfig  |  1 -
 configs/lx2160aqds_tfa_defconfig  |  1 -
 configs/lx2160ardb_tfa_defconfig  |  1 -
 configs/lx2162aqds_tfa_defconfig  |  1 -
 36 files changed, 75 insertions(+), 102 deletions(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/Kconfig 
b/arch/arm/cpu/armv7/ls102xa/Kconfig
index f919d02db4..8e8fb4e9db 100644
--- a/arch/arm/cpu/armv7/ls102xa/Kconfig
+++ b/arch/arm/cpu/armv7/ls102xa/Kconfig
@@ -21,6 +21,10 @@ config ARCH_LS1021A
select SYS_FSL_SRDS_1
select SYS_HAS_SERDES
select SYS_I2C_MXC
+   select FSL_CAAM
+   select FSL_BLOB
+   select MISC
+   select ARCH_MISC_INIT
imply CMD_PCI
imply SCSI
imply SCSI_AHCI
diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c
index d863c9625a..4904592703 100644
--- a/arch/arm/cpu/armv7/ls102xa/cpu.c
+++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 #include 
@@ -20,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fsl_epu.h"
 
@@ -397,3 +399,17 @@ void arch_preboot_os(void)
ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
asm("mcr p15, 0, %0, c14, c2, 1" : : "r" (ctrl));
 }
+
+#ifdef CONFIG_ARCH_MISC_INIT
+int arch_misc_init(void)
+{
+   struct udevice *dev;
+   int ret;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), 
&dev);
+   if (ret)
+   printf("Failed to initialize %s: %d\n", dev->name, ret);
+
+   return 0;
+}
+#endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index 1a057f7059..f51c390ede 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -20,6 +20,10 @@ config ARCH_LS1012A
select SYS_I2C_MXC
select SYS_I2C_MXC_I2C1 if !DM_I2C
select SYS_I2C_MXC_I2C2 if !DM_I2C
+   select FSL_CAAM
+   select FSL_BLOB
+   select MISC
+   select ARCH_MISC_INIT
imply PANIC_HANG
 
 config ARCH_LS1028A
@@ -53,6 +57,9 @@ config ARCH_LS1028A
select SYS_FSL_ERRATUM_A011334
select SYS_FSL_ESDHC_UNRELIABLE_PULSE_DETECTION_WORKAROUND
select RESV_RAM if GIC_V3_ITS
+   select FSL_CAAM
+   select FSL_BLOB
+   select MISC
imply PANIC_HANG
 
 config ARCH_LS1043A
@@ -88,6 +95,10 @@ config ARCH_LS1043A
select SYS_I2C_MXC_I2C2 if !DM_I2C
select SYS_I2C_MXC_I2C3 if !DM_I2C
select SYS_I2C_MXC_I2C4 if !DM_I2C
+   select FSL_CAAM
+   select FSL_BLOB
+   select MISC
+   select ARCH_MISC_INIT
imply CMD_PCI
imply ID_EEPROM
 
@@ -125,6 +136,10 @@ config ARCH_LS1046