All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env
@ 2019-12-03 10:46 Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 1/5] board: fsl: lx2160a: free up arch_misc_init Alex Marginean
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

Exports the serdes configuration as an environment variable for LS gen 3
SoCs, so it can be used in u-boot command line.  It should particularly be
useful for applying Linux DT overlays for the given serdes configuration.
First 4 patches free up arch_misc_init, which is now implemented in
arch/arm/cpu/armv8/fsl-layerscape/cpu.c.  For LS1028A and LX2 the
board_mux_init code is now under misc_init_r.  MISC_INIT_R is now enabled
for the relavant boards.

Alex Marginean (5):
  board: fsl: lx2160a: free up arch_misc_init
  board: fsl: ls2080a/ls2081a: remove empty arch_misc_init
  board: fsl: ls1088a: remove empty arch_misc_init
  board: fsl: ls1028a: free up arch_misc_init
  arch: armv8: fsl-layerscape: export serdes config to environment

 arch/arm/Kconfig                              | 10 -----
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig     |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       | 14 +++++++
 .../armv8/fsl-layerscape/fsl_lsch3_serdes.c   | 42 +++++++++++++++++++
 board/freescale/ls1028a/ls1028a.c             |  4 +-
 board/freescale/ls1088a/ls1088a.c             |  7 ----
 board/freescale/ls2080a/ls2080a.c             |  7 ----
 board/freescale/ls2080aqds/ls2080aqds.c       |  7 ----
 board/freescale/ls2080ardb/ls2080ardb.c       |  7 ----
 board/freescale/lx2160a/lx2160a.c             |  4 +-
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig  |  1 +
 configs/ls1028aqds_tfa_defconfig              |  1 +
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig  |  1 +
 configs/lx2160aqds_tfa_defconfig              |  1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig  |  1 +
 configs/lx2160ardb_tfa_defconfig              |  1 +
 16 files changed, 67 insertions(+), 42 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/5] board: fsl: lx2160a: free up arch_misc_init
  2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
@ 2019-12-03 10:46 ` Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init Alex Marginean
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

Currently LX2 board code uses arch_misc_init to set up the board mux on
RDB and QDS.  Move this code to misc_init_r.  This is consistent with LS
gen 2 and T series SoCs/boards.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 arch/arm/Kconfig                             | 2 --
 board/freescale/lx2160a/lx2160a.c            | 4 ++--
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160aqds_tfa_defconfig             | 1 +
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160ardb_tfa_defconfig             | 1 +
 6 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f96841c777..3a3d77b04f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1190,7 +1190,6 @@ config TARGET_LS2081ARDB
 config TARGET_LX2160ARDB
 	bool "Support lx2160ardb"
 	select ARCH_LX2160A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
@@ -1204,7 +1203,6 @@ config TARGET_LX2160ARDB
 config TARGET_LX2160AQDS
 	bool "Support lx2160aqds"
 	select ARCH_LX2160A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c
index eff12747b4..413aaa6baf 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -579,8 +579,8 @@ void detail_board_ddr_info(void)
 	print_ddr_info(0);
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
 {
 	config_board_mux();
 
diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
index 4ab7582fc7..43a2b8328d 100644
--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
@@ -15,6 +15,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPT=y
diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig
index a35f1cc38d..06ed9ba83d 100644
--- a/configs/lx2160aqds_tfa_defconfig
+++ b/configs/lx2160aqds_tfa_defconfig
@@ -16,6 +16,7 @@ CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPT=y
diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index 87c54b00f6..40ccc1f569 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -16,6 +16,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPT=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 18057b20b1..8478404dd6 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -17,6 +17,7 @@ CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPT=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init
  2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 1/5] board: fsl: lx2160a: free up arch_misc_init Alex Marginean
@ 2019-12-03 10:46 ` Alex Marginean
  2019-12-03 10:53   ` Alexandru Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 3/5] board: fsl: ls1088a: " Alex Marginean
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

The arch_misc_init function is emtpy on LS2 SoCs/boards, remove it.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 arch/arm/Kconfig                        | 5 -----
 board/freescale/ls2080a/ls2080a.c       | 7 -------
 board/freescale/ls2080aqds/ls2080aqds.c | 7 -------
 board/freescale/ls2080ardb/ls2080ardb.c | 7 -------
 4 files changed, 26 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3a3d77b04f..459876b543 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1096,7 +1096,6 @@ config TARGET_VEXPRESS64_JUNO
 config TARGET_LS2080A_EMU
 	bool "Support ls2080a_emu"
 	select ARCH_LS2080A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select FSL_DDR_SYNC_REFRESH
@@ -1109,7 +1108,6 @@ config TARGET_LS2080A_EMU
 config TARGET_LS2080A_SIMU
 	bool "Support ls2080a_simu"
 	select ARCH_LS2080A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select BOARD_LATE_INIT
@@ -1138,7 +1136,6 @@ config TARGET_LS1088AQDS
 config TARGET_LS2080AQDS
 	bool "Support ls2080aqds"
 	select ARCH_LS2080A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
@@ -1157,7 +1154,6 @@ config TARGET_LS2080AQDS
 config TARGET_LS2080ARDB
 	bool "Support ls2080ardb"
 	select ARCH_LS2080A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
@@ -1176,7 +1172,6 @@ config TARGET_LS2080ARDB
 config TARGET_LS2081ARDB
 	bool "Support ls2081ardb"
 	select ARCH_LS2080A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select BOARD_LATE_INIT
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index 413a698511..bc68f99625 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -48,13 +48,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	return 0;
-}
-#endif
-
 int board_eth_init(bd_t *bis)
 {
 	int error = 0;
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 25e80c8ac6..fce433461a 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -289,13 +289,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	return 0;
-}
-#endif
-
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 void fdt_fixup_board_enet(void *fdt)
 {
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 6a1b8e3f53..282aaf47fb 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -318,13 +318,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_FSL_MC_ENET
 void fdt_fixup_board_enet(void *fdt)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 3/5] board: fsl: ls1088a: remove empty arch_misc_init
  2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 1/5] board: fsl: lx2160a: free up arch_misc_init Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init Alex Marginean
@ 2019-12-03 10:46 ` Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 4/5] board: fsl: ls1028a: free up arch_misc_init Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment Alex Marginean
  4 siblings, 0 replies; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

The arch_misc_init function is emtpy on LS108x SoCs/boards, remove it.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 arch/arm/Kconfig                  | 2 --
 board/freescale/ls1088a/ls1088a.c | 7 -------
 2 files changed, 9 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 459876b543..8a190bab8c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1120,7 +1120,6 @@ config TARGET_LS2080A_SIMU
 config TARGET_LS1088AQDS
 	bool "Support ls1088aqds"
 	select ARCH_LS1088A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
@@ -1342,7 +1341,6 @@ config TARGET_LS1028ARDB
 config TARGET_LS1088ARDB
 	bool "Support ls1088ardb"
 	select ARCH_LS1088A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index 4ecf6dce68..0bd397a0be 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -811,13 +811,6 @@ void detail_board_ddr_info(void)
 	print_ddr_info(0);
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_FSL_MC_ENET
 void board_quiesce_devices(void)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 4/5] board: fsl: ls1028a: free up arch_misc_init
  2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
                   ` (2 preceding siblings ...)
  2019-12-03 10:46 ` [U-Boot] [PATCH 3/5] board: fsl: ls1088a: " Alex Marginean
@ 2019-12-03 10:46 ` Alex Marginean
  2019-12-03 10:46 ` [U-Boot] [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment Alex Marginean
  4 siblings, 0 replies; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

Currently LS1028A board code uses arch_misc_init to set up the board mux
on QDS.  Move this code to misc_init_r.  This is consistent with LS gen 2
and T series SoCs/boards.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 arch/arm/Kconfig                             | 1 -
 board/freescale/ls1028a/ls1028a.c            | 4 ++--
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/ls1028aqds_tfa_defconfig             | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8a190bab8c..77a5ed5a40 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1319,7 +1319,6 @@ config TARGET_LS1028AQDS
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
-	select ARCH_MISC_INIT
 	help
 	  Support for Freescale LS1028AQDS platform
 	  The LS1028A Development System (QDS) is a high-performance
diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c
index a9606b8865..3977ecf896 100644
--- a/board/freescale/ls1028a/ls1028a.c
+++ b/board/freescale/ls1028a/ls1028a.c
@@ -96,8 +96,8 @@ int board_eth_init(bd_t *bis)
 	return pci_eth_init(bis);
 }
 
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
 {
 	config_board_mux();
 
diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index b5dceb4471..77860a568b 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -16,6 +16,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ramdisk_size=0x2000000 default_hugepagesz=2m hugepagesz=2m hugepages=256 video=1920x1080-32 at 60 cma=256M"
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index e75d140e94..75871e5569 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -17,6 +17,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ramdisk_size=0x2000000 default_hugepagesz=2m hugepagesz=2m hugepages=256 video=1920x1080-32 at 60 cma=256M"
+CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_DM=y
 CONFIG_CMD_GPT=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment
  2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
                   ` (3 preceding siblings ...)
  2019-12-03 10:46 ` [U-Boot] [PATCH 4/5] board: fsl: ls1028a: free up arch_misc_init Alex Marginean
@ 2019-12-03 10:46 ` Alex Marginean
  2019-12-04  4:08   ` Priyanka Jain
  4 siblings, 1 reply; 8+ messages in thread
From: Alex Marginean @ 2019-12-03 10:46 UTC (permalink / raw)
  To: u-boot

Exports the serdes configuration as an environment variable for LS gen 3
SoCs, so it can be used in u-boot command line.  It should particularly
be useful for applying Linux DT overlays for the given serdes
configuration.
This code is called from arch_misc_init and not from the existing
serdes_init function because it depends on U-Boot environment being set
up.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig     |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       | 14 ++++++
 .../armv8/fsl-layerscape/fsl_lsch3_serdes.c   | 43 +++++++++++++++++++
 3 files changed, 58 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index f1578b10bc..40cbea0e12 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -241,6 +241,7 @@ config FSL_LSCH2
 	select SYS_FSL_SEC_BE
 
 config FSL_LSCH3
+	select ARCH_MISC_INIT
 	bool
 
 config NXP_LSCH3_2
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index c6490556e6..ddbc07037f 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -1627,3 +1627,17 @@ __weak int dram_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_ARCH_MISC_INIT
+__weak int serdes_misc_init(void)
+{
+	return 0;
+}
+
+int arch_misc_init(void)
+{
+	serdes_misc_init();
+
+	return 0;
+}
+#endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
index 1a747a9e3d..8b9f5a4e29 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
@@ -600,3 +600,46 @@ void fsl_serdes_init(void)
 		    serdes3_prtcl_map);
 #endif
 }
+
+int serdes_set_env(int sd, int rcwsr, int sd_prctl_mask, int sd_prctl_shift)
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	char scfg[16], snum[16];
+	int i, cfgr = 0;
+	u32 cfg;
+
+	cfg = gur_in32(&gur->rcwsr[rcwsr - 1]) & sd_prctl_mask;
+	cfg >>= sd_prctl_shift;
+	cfg = serdes_get_number(sd, cfg);
+
+	/* reverse lanes, lane 0 should be printed first */
+	for (i = 0; i < SRDS_MAX_LANES; i++)
+		cfgr |= (cfg >> (i * 4) & 0xf) << (SRDS_MAX_LANES - i - 1) * 4;
+
+	snprintf(snum, 16, "serdes%d", sd);
+	snprintf(scfg, 16, "%x", cfgr);
+	env_set(snum, scfg);
+
+	return 0;
+}
+
+int serdes_misc_init(void)
+{
+#ifdef CONFIG_SYS_FSL_SRDS_1
+	serdes_set_env(FSL_SRDS_1, FSL_CHASSIS3_SRDS1_REGSR,
+		       FSL_CHASSIS3_SRDS1_PRTCL_MASK,
+		       FSL_CHASSIS3_SRDS1_PRTCL_SHIFT);
+#endif
+#ifdef CONFIG_SYS_FSL_SRDS_2
+	serdes_set_env(FSL_SRDS_2, FSL_CHASSIS3_SRDS2_REGSR,
+		       FSL_CHASSIS3_SRDS2_PRTCL_MASK,
+		       FSL_CHASSIS3_SRDS2_PRTCL_SHIFT);
+#endif
+#ifdef CONFIG_SYS_NXP_SRDS_3
+	serdes_set_env(NXP_SRDS_3, FSL_CHASSIS3_SRDS3_REGSR,
+		       FSL_CHASSIS3_SRDS3_PRTCL_MASK,
+		       FSL_CHASSIS3_SRDS3_PRTCL_SHIFT);
+#endif
+
+	return 0;
+}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init
  2019-12-03 10:46 ` [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init Alex Marginean
@ 2019-12-03 10:53   ` Alexandru Marginean
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandru Marginean @ 2019-12-03 10:53 UTC (permalink / raw)
  To: u-boot

On 12/3/2019 11:46 AM, Alex Marginean wrote:
> The arch_misc_init function is emtpy on LS2 SoCs/boards, remove it.

s/emtpy/empty/

> 
> Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
> ---
>   arch/arm/Kconfig                        | 5 -----
>   board/freescale/ls2080a/ls2080a.c       | 7 -------
>   board/freescale/ls2080aqds/ls2080aqds.c | 7 -------
>   board/freescale/ls2080ardb/ls2080ardb.c | 7 -------
>   4 files changed, 26 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3a3d77b04f..459876b543 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1096,7 +1096,6 @@ config TARGET_VEXPRESS64_JUNO
>   config TARGET_LS2080A_EMU
>   	bool "Support ls2080a_emu"
>   	select ARCH_LS2080A
> -	select ARCH_MISC_INIT
>   	select ARM64
>   	select ARMV8_MULTIENTRY
>   	select FSL_DDR_SYNC_REFRESH
> @@ -1109,7 +1108,6 @@ config TARGET_LS2080A_EMU
>   config TARGET_LS2080A_SIMU
>   	bool "Support ls2080a_simu"
>   	select ARCH_LS2080A
> -	select ARCH_MISC_INIT
>   	select ARM64
>   	select ARMV8_MULTIENTRY
>   	select BOARD_LATE_INIT
> @@ -1138,7 +1136,6 @@ config TARGET_LS1088AQDS
>   config TARGET_LS2080AQDS
>   	bool "Support ls2080aqds"
>   	select ARCH_LS2080A
> -	select ARCH_MISC_INIT
>   	select ARM64
>   	select ARMV8_MULTIENTRY
>   	select ARCH_SUPPORT_TFABOOT
> @@ -1157,7 +1154,6 @@ config TARGET_LS2080AQDS
>   config TARGET_LS2080ARDB
>   	bool "Support ls2080ardb"
>   	select ARCH_LS2080A
> -	select ARCH_MISC_INIT
>   	select ARM64
>   	select ARMV8_MULTIENTRY
>   	select ARCH_SUPPORT_TFABOOT
> @@ -1176,7 +1172,6 @@ config TARGET_LS2080ARDB
>   config TARGET_LS2081ARDB
>   	bool "Support ls2081ardb"
>   	select ARCH_LS2080A
> -	select ARCH_MISC_INIT
>   	select ARM64
>   	select ARMV8_MULTIENTRY
>   	select BOARD_LATE_INIT
> diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
> index 413a698511..bc68f99625 100644
> --- a/board/freescale/ls2080a/ls2080a.c
> +++ b/board/freescale/ls2080a/ls2080a.c
> @@ -48,13 +48,6 @@ void detail_board_ddr_info(void)
>   #endif
>   }
>   
> -#if defined(CONFIG_ARCH_MISC_INIT)
> -int arch_misc_init(void)
> -{
> -	return 0;
> -}
> -#endif
> -
>   int board_eth_init(bd_t *bis)
>   {
>   	int error = 0;
> diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
> index 25e80c8ac6..fce433461a 100644
> --- a/board/freescale/ls2080aqds/ls2080aqds.c
> +++ b/board/freescale/ls2080aqds/ls2080aqds.c
> @@ -289,13 +289,6 @@ void detail_board_ddr_info(void)
>   #endif
>   }
>   
> -#if defined(CONFIG_ARCH_MISC_INIT)
> -int arch_misc_init(void)
> -{
> -	return 0;
> -}
> -#endif
> -
>   #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
>   void fdt_fixup_board_enet(void *fdt)
>   {
> diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
> index 6a1b8e3f53..282aaf47fb 100644
> --- a/board/freescale/ls2080ardb/ls2080ardb.c
> +++ b/board/freescale/ls2080ardb/ls2080ardb.c
> @@ -318,13 +318,6 @@ void detail_board_ddr_info(void)
>   #endif
>   }
>   
> -#if defined(CONFIG_ARCH_MISC_INIT)
> -int arch_misc_init(void)
> -{
> -	return 0;
> -}
> -#endif
> -
>   #ifdef CONFIG_FSL_MC_ENET
>   void fdt_fixup_board_enet(void *fdt)
>   {
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment
  2019-12-03 10:46 ` [U-Boot] [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment Alex Marginean
@ 2019-12-04  4:08   ` Priyanka Jain
  0 siblings, 0 replies; 8+ messages in thread
From: Priyanka Jain @ 2019-12-04  4:08 UTC (permalink / raw)
  To: u-boot



>-----Original Message-----
>From: Alex Marginean <alexandru.marginean@nxp.com>
>Sent: Tuesday, December 3, 2019 4:16 PM
>To: u-boot at lists.denx.de
>Cc: Priyanka Jain <priyanka.jain@nxp.com>; Pankaj Bansal
><pankaj.bansal@nxp.com>; Andy Tang <andy.tang@nxp.com>; Vladimir
>Oltean <vladimir.oltean@nxp.com>; Claudiu Manoil
><claudiu.manoil@nxp.com>; Florin Laurentiu Chiculita
><florinlaurentiu.chiculita@nxp.com>; Razvan Ionut Cirjan
><razvanionut.cirjan@nxp.com>; Madalin Bucur <madalin.bucur@nxp.com>;
>Alexandru Marginean <alexandru.marginean@nxp.com>
>Subject: [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to
>environment
>
>Exports the serdes configuration as an environment variable for LS gen 3
>SoCs, so it can be used in u-boot command line.  It should particularly be
>useful for applying Linux DT overlays for the given serdes configuration.
>This code is called from arch_misc_init and not from the existing serdes_init
>function because it depends on U-Boot environment being set up.
>
>Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
>---
> arch/arm/cpu/armv8/fsl-layerscape/Kconfig     |  1 +
> arch/arm/cpu/armv8/fsl-layerscape/cpu.c       | 14 ++++++
> .../armv8/fsl-layerscape/fsl_lsch3_serdes.c   | 43 +++++++++++++++++++
> 3 files changed, 58 insertions(+)
>
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>index f1578b10bc..40cbea0e12 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
>@@ -241,6 +241,7 @@ config FSL_LSCH2
> 	select SYS_FSL_SEC_BE
>
> config FSL_LSCH3
>+	select ARCH_MISC_INIT
> 	bool
>
> config NXP_LSCH3_2
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>index c6490556e6..ddbc07037f 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>@@ -1627,3 +1627,17 @@ __weak int dram_init(void)
>
> 	return 0;
> }
>+
>+#ifdef CONFIG_ARCH_MISC_INIT
>+__weak int serdes_misc_init(void)
>+{
>+	return 0;
>+}
>+
>+int arch_misc_init(void)
>+{
>+	serdes_misc_init();
>+
>+	return 0;
>+}
>+#endif
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
>b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
>index 1a747a9e3d..8b9f5a4e29 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
>@@ -600,3 +600,46 @@ void fsl_serdes_init(void)
> 		    serdes3_prtcl_map);
> #endif
> }
>+
>+int serdes_set_env(int sd, int rcwsr, int sd_prctl_mask, int
>+sd_prctl_shift) {
>+	struct ccsr_gur __iomem *gur = (void
>*)(CONFIG_SYS_FSL_GUTS_ADDR);
>+	char scfg[16], snum[16];
>+	int i, cfgr = 0;
>+	u32 cfg;
>+
>+	cfg = gur_in32(&gur->rcwsr[rcwsr - 1]) & sd_prctl_mask;
>+	cfg >>= sd_prctl_shift;
>+	cfg = serdes_get_number(sd, cfg);
>+
>+	/* reverse lanes, lane 0 should be printed first */
>+	for (i = 0; i < SRDS_MAX_LANES; i++)
>+		cfgr |= (cfg >> (i * 4) & 0xf) << (SRDS_MAX_LANES - i - 1) * 4;
>+
>+	snprintf(snum, 16, "serdes%d", sd);
>+	snprintf(scfg, 16, "%x", cfgr);
>+	env_set(snum, scfg);
>+
>+	return 0;
>+}
>+
>+int serdes_misc_init(void)
>+{
>+#ifdef CONFIG_SYS_FSL_SRDS_1
>+	serdes_set_env(FSL_SRDS_1, FSL_CHASSIS3_SRDS1_REGSR,
>+		       FSL_CHASSIS3_SRDS1_PRTCL_MASK,
>+		       FSL_CHASSIS3_SRDS1_PRTCL_SHIFT); #endif #ifdef
Need new lines in between
>+CONFIG_SYS_FSL_SRDS_2
>+	serdes_set_env(FSL_SRDS_2, FSL_CHASSIS3_SRDS2_REGSR,
>+		       FSL_CHASSIS3_SRDS2_PRTCL_MASK,
>+		       FSL_CHASSIS3_SRDS2_PRTCL_SHIFT); #endif #ifdef
Same as above
>+CONFIG_SYS_NXP_SRDS_3
>+	serdes_set_env(NXP_SRDS_3, FSL_CHASSIS3_SRDS3_REGSR,
>+		       FSL_CHASSIS3_SRDS3_PRTCL_MASK,
>+		       FSL_CHASSIS3_SRDS3_PRTCL_SHIFT); #endif
Same as above
>+
>+	return 0;
>+}
>--
>2.17.1
Priyanka

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-04  4:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 10:46 [U-Boot] [PATCH 0/5] FSL/Layerscape gen 3: export serdes cfg to env Alex Marginean
2019-12-03 10:46 ` [U-Boot] [PATCH 1/5] board: fsl: lx2160a: free up arch_misc_init Alex Marginean
2019-12-03 10:46 ` [U-Boot] [PATCH 2/5] board: fsl: ls2080a/ls2081a: remove empty arch_misc_init Alex Marginean
2019-12-03 10:53   ` Alexandru Marginean
2019-12-03 10:46 ` [U-Boot] [PATCH 3/5] board: fsl: ls1088a: " Alex Marginean
2019-12-03 10:46 ` [U-Boot] [PATCH 4/5] board: fsl: ls1028a: free up arch_misc_init Alex Marginean
2019-12-03 10:46 ` [U-Boot] [PATCH 5/5] arch: armv8: fsl-layerscape: export serdes config to environment Alex Marginean
2019-12-04  4:08   ` Priyanka Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.