From a85b8c75390ce03f923deabe1992db58e0052239 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:14 +0300 Subject: [PATCH 01/20] board: freescale: t2080rdb: enumerate PCI devices Call pci_init() to force PCI enumeration at probe time. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t208xrdb/t208xrdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 04cb313e8c4..13a2d3dcde6 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2009-2013 Freescale Semiconductor, Inc. - * Copyright 2021 NXP + * Copyright 2021-2023 NXP */ #include @@ -106,6 +106,9 @@ int board_early_init_r(void) */ if (adjust_vdd(0)) printf("Warning: Adjusting core voltage failed.\n"); + + pci_init(); + return 0; } From b14f37c73f4906d659706662627fd3d5c5732f92 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:15 +0300 Subject: [PATCH 02/20] board: freescale: t2080rdb: implement get_serial_clock The serial clock is provided by the get_serial_clock() callback on PPC under DM_SERIAL. Use the same method to compute the clock as for non-DM_SERIAL use cases. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t208xrdb/t208xrdb.c | 8 ++++++++ include/configs/T208xRDB.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 13a2d3dcde6..e33e5d082d8 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "t208xrdb.h" #include "cpld.h" @@ -42,6 +43,13 @@ u8 get_hw_revision(void) } } +#if CONFIG_IS_ENABLED(DM_SERIAL) +int get_serial_clock(void) +{ + return get_bus_freq(0) / 2; +} +#endif + int checkboard(void) { struct cpu_type *cpu = gd->arch.cpu; diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h index f213d2de770..0b9dde3e0e5 100644 --- a/include/configs/T208xRDB.h +++ b/include/configs/T208xRDB.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. - * Copyright 2020-2021 NXP + * Copyright 2020-2023 NXP */ /* @@ -215,7 +215,9 @@ /* * Serial Port */ +#if !CONFIG_IS_ENABLED(DM_SERIAL) #define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) +#endif #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} #define CFG_SYS_NS16550_COM1 (CFG_SYS_CCSRBAR+0x11C500) From 387b89ac986ed51c8e22d7e80427a7853417a230 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:16 +0300 Subject: [PATCH 03/20] powerpc: dts: t2080rdb: add serial nodes Add the serial node descriptions similar to Linux v6.4 for the t2080rdb board and its dependencies. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t2080rdb.dts | 6 +++++- arch/powerpc/dts/t2080si-post.dtsi | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/dts/t2080rdb.dts b/arch/powerpc/dts/t2080rdb.dts index 4de814ea8d9..c0b0bd6f2c7 100644 --- a/arch/powerpc/dts/t2080rdb.dts +++ b/arch/powerpc/dts/t2080rdb.dts @@ -3,7 +3,7 @@ * T2080RDB Device Tree Source * * Copyright 2013 - 2015 Freescale Semiconductor Inc. - * Copyright 2019-2021 NXP + * Copyright 2019-2023 NXP */ /include/ "t2080.dtsi" @@ -17,6 +17,10 @@ aliases { spi0 = &espi0; + serial0 = &serial0; + serial1 = &serial1; + serial2 = &serial2; + serial3 = &serial3; }; }; diff --git a/arch/powerpc/dts/t2080si-post.dtsi b/arch/powerpc/dts/t2080si-post.dtsi index c06526b3dba..46053c6b872 100644 --- a/arch/powerpc/dts/t2080si-post.dtsi +++ b/arch/powerpc/dts/t2080si-post.dtsi @@ -3,12 +3,14 @@ * T2080 Silicon/SoC Device Tree Source (post include) * * Copyright 2013 Freescale Semiconductor Inc. - * Copyright 2021 NXP + * Copyright 2021-2023 NXP * */ &soc { /include/ "qoriq-clockgen2.dtsi" +/include/ "qoriq-duart-0.dtsi" +/include/ "qoriq-duart-1.dtsi" /include/ "qoriq-gpio-0.dtsi" /include/ "qoriq-gpio-1.dtsi" /include/ "qoriq-gpio-2.dtsi" From 9e977553871d99774851d19d0915592c7e0b6955 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:17 +0300 Subject: [PATCH 04/20] powerpc: dts: t2080rdb: tag serial nodes with bootph-all Make sure the serial driver is initialized before relocation by tagging the serial nodes with "bootph-all". Add these u-boot specific properties to an *-u-boot.dtsi file. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t2080rdb-u-boot.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arch/powerpc/dts/t2080rdb-u-boot.dtsi diff --git a/arch/powerpc/dts/t2080rdb-u-boot.dtsi b/arch/powerpc/dts/t2080rdb-u-boot.dtsi new file mode 100644 index 00000000000..b50b922aeb2 --- /dev/null +++ b/arch/powerpc/dts/t2080rdb-u-boot.dtsi @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright 2023 NXP */ + +&serial0 { + bootph-all; +}; + +&serial1 { + bootph-all; +}; + +#include "u-boot.dtsi" From 2a72af59c0a2679ec6df16cf6e74cd0ec5a826ae Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:18 +0300 Subject: [PATCH 05/20] configs: T2080RDB: enable DM_SERIAL As the serial devices are configured in the device tree, enable DM_SERIAL in the non-SPL T2080RDB defconfigs. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- configs/T2080RDB_defconfig | 4 +++- configs/T2080RDB_revD_defconfig | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configs/T2080RDB_defconfig b/configs/T2080RDB_defconfig index 8a85d4999d5..e1e963037db 100644 --- a/configs/T2080RDB_defconfig +++ b/configs/T2080RDB_defconfig @@ -106,7 +106,9 @@ CONFIG_PCIE_FSL=y CONFIG_SYS_QE_FMAN_FW_IN_NOR=y CONFIG_DM_RTC=y CONFIG_RTC_DS1307=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_ESPI=y diff --git a/configs/T2080RDB_revD_defconfig b/configs/T2080RDB_revD_defconfig index f5383cc6cba..d9116df6242 100644 --- a/configs/T2080RDB_revD_defconfig +++ b/configs/T2080RDB_revD_defconfig @@ -108,7 +108,9 @@ CONFIG_PCIE_FSL=y CONFIG_SYS_QE_FMAN_FW_IN_NOR=y CONFIG_DM_RTC=y CONFIG_RTC_DS1307=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_ESPI=y From baa807f815236de21a7cdb18c3f1bf76653b51cc Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:19 +0300 Subject: [PATCH 06/20] board: freescale: t4240rdb: enumerate PCI devices Call pci_init() to force PCI enumeration at probe time. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t4rdb/t4240rdb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index 0bd0ba93962..0035bd796e1 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -86,6 +86,8 @@ int board_early_init_r(void) if (adjust_vdd(0)) printf("Warning: Adjusting core voltage failed.\n"); + pci_init(); + return 0; } From a325e7e8bd4e1715e2b701ba1fe534840391dfbf Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:20 +0300 Subject: [PATCH 07/20] board: freescale: t4240rdb: implement get_serial_clock The serial clock is provided by the get_serial_clock() callback on PPC under DM_SERIAL. Use the same method to compute the clock as for non-DM_SERIAL use cases. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t4rdb/t4240rdb.c | 9 +++++++++ include/configs/T4240RDB.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index 0035bd796e1..ab717769ed5 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2014 Freescale Semiconductor, Inc. + * Copyright 2023 NXP */ #include @@ -20,6 +21,7 @@ #include #include #include +#include #include #include "t4rdb.h" @@ -28,6 +30,13 @@ DECLARE_GLOBAL_DATA_PTR; +#if CONFIG_IS_ENABLED(DM_SERIAL) +int get_serial_clock(void) +{ + return get_bus_freq(0) / 2; +} +#endif + int checkboard(void) { struct cpu_type *cpu = gd->arch.cpu; diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h index 506f1b7e268..78e136224ec 100644 --- a/include/configs/T4240RDB.h +++ b/include/configs/T4240RDB.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. - * Copyright 2020-2021 NXP + * Copyright 2020-2023 NXP */ /* @@ -77,7 +77,9 @@ * open - index 2 * shorted - index 1 */ +#if !CONFIG_IS_ENABLED(DM_SERIAL) #define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) +#endif #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} From 7da20e78890bac9c3c97f8df1fe9935784af9453 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:21 +0300 Subject: [PATCH 08/20] powerpc: dts: t4240rdb: add serial nodes Add the serial node descriptions similar to Linux v6.4 for the t4240rdb board and its dependencies. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t4240rdb.dts | 6 +++++- arch/powerpc/dts/t4240si-post.dtsi | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/dts/t4240rdb.dts b/arch/powerpc/dts/t4240rdb.dts index b3251e330de..c33b4982ba3 100644 --- a/arch/powerpc/dts/t4240rdb.dts +++ b/arch/powerpc/dts/t4240rdb.dts @@ -3,7 +3,7 @@ * T4240RDB Device Tree Source * * Copyright 2013 - 2015 Freescale Semiconductor Inc. - * Copyright 2019-2021 NXP + * Copyright 2019-2023 NXP */ /include/ "t4240.dtsi" @@ -17,6 +17,10 @@ aliases { spi0 = &espi0; + serial0 = &serial0; + serial1 = &serial1; + serial2 = &serial2; + serial3 = &serial3; }; }; diff --git a/arch/powerpc/dts/t4240si-post.dtsi b/arch/powerpc/dts/t4240si-post.dtsi index 9fa99ae771b..bd93345d388 100644 --- a/arch/powerpc/dts/t4240si-post.dtsi +++ b/arch/powerpc/dts/t4240si-post.dtsi @@ -3,11 +3,13 @@ * T4240 Silicon/SoC Device Tree Source (post include) * * Copyright 2012 - 2015 Freescale Semiconductor Inc. - * Copyright 2021 NXP + * Copyright 2021-2023 NXP * */ &soc { /include/ "qoriq-clockgen2.dtsi" +/include/ "qoriq-duart-0.dtsi" +/include/ "qoriq-duart-1.dtsi" /include/ "qoriq-gpio-0.dtsi" /include/ "qoriq-gpio-1.dtsi" /include/ "qoriq-gpio-2.dtsi" From cd944300872f17b36471a2b6100626eb6d484bcf Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:22 +0300 Subject: [PATCH 09/20] powerpc: dts: t4240rdb: tag serial nodes with bootph-all Make sure the serial driver is initialized before relocation by tagging the serial nodes with "bootph-all". Add these u-boot specific properties to an *-u-boot.dtsi file. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t4240rdb-u-boot.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arch/powerpc/dts/t4240rdb-u-boot.dtsi diff --git a/arch/powerpc/dts/t4240rdb-u-boot.dtsi b/arch/powerpc/dts/t4240rdb-u-boot.dtsi new file mode 100644 index 00000000000..b50b922aeb2 --- /dev/null +++ b/arch/powerpc/dts/t4240rdb-u-boot.dtsi @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright 2023 NXP */ + +&serial0 { + bootph-all; +}; + +&serial1 { + bootph-all; +}; + +#include "u-boot.dtsi" From 8cdf82a3e733e03d250cfbfc0f5f9341f60ccaaa Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:23 +0300 Subject: [PATCH 10/20] configs: T4240RDB: enable DM_SERIAL As the serial devices are configured in the device tree, enable DM_SERIAL in the non-SPL T4240RDB defconfig. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- configs/T4240RDB_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/T4240RDB_defconfig b/configs/T4240RDB_defconfig index eddd6fb6ffa..4b63ef413a6 100644 --- a/configs/T4240RDB_defconfig +++ b/configs/T4240RDB_defconfig @@ -96,7 +96,9 @@ CONFIG_MII=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_FSL=y CONFIG_SYS_QE_FMAN_FW_IN_NOR=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_ESPI=y From 4e69a447fab3eace7a092f5695d397ffa9170177 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:24 +0300 Subject: [PATCH 11/20] board: freescale: t104xrdb: enumerate PCI devices Call pci_init() to force PCI enumeration at probe time. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t104xrdb/t104xrdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index 8cec71217a7..562360de529 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -88,6 +88,9 @@ int board_early_init_r(void) MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 0, flash_esel, BOOKE_PAGESZ_256M, 1); #endif + + pci_init(); + return 0; } From 3a359c50002d18ab14ca750e8113cc5e63e2badd Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:25 +0300 Subject: [PATCH 12/20] board: freescale: t104xrdb: implement get_serial_clock The serial clock is provided by the get_serial_clock() callback on PPC under DM_SERIAL. Use the same method to compute the clock as for non-DM_SERIAL use cases. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t104xrdb/t104xrdb.c | 9 +++++++++ include/configs/T104xRDB.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index 562360de529..b3080492716 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2013 Freescale Semiconductor, Inc. + * Copyright 2023 NXP */ #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include "../common/sleep.h" #include "t104xrdb.h" @@ -29,6 +31,13 @@ DECLARE_GLOBAL_DATA_PTR; +#if CONFIG_IS_ENABLED(DM_SERIAL) +int get_serial_clock(void) +{ + return get_bus_freq(0) / 2; +} +#endif + int checkboard(void) { struct cpu_type *cpu = gd->arch.cpu; diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h index f196bd76e6e..01db298f38e 100644 --- a/include/configs/T104xRDB.h +++ b/include/configs/T104xRDB.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. - * Copyright 2020-2021 NXP + * Copyright 2020-2023 NXP */ #ifndef __CONFIG_H @@ -238,7 +238,9 @@ * open - index 2 * shorted - index 1 */ +#if !CONFIG_IS_ENABLED(DM_SERIAL) #define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) +#endif #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} From 014bad7b6062137eca772c8daabb64b79818ccf2 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:26 +0300 Subject: [PATCH 13/20] powerpc: dts: t1042d4rdb: add serial nodes Add the serial node descriptions similar to Linux v6.4 for the t1042d4rdb board and its dependencies. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t1042d4rdb.dts | 6 +++++- arch/powerpc/dts/t1042si-post.dtsi | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/dts/t1042d4rdb.dts b/arch/powerpc/dts/t1042d4rdb.dts index 5e9fab7a105..0230d3ba675 100644 --- a/arch/powerpc/dts/t1042d4rdb.dts +++ b/arch/powerpc/dts/t1042d4rdb.dts @@ -3,7 +3,7 @@ * T1042D4RDB Device Tree Source * * Copyright 2013 - 2015 Freescale Semiconductor Inc. - * Copyright 2019-2021 NXP + * Copyright 2019-2023 NXP */ /include/ "t104x.dtsi" @@ -17,6 +17,10 @@ aliases { spi0 = &espi0; + serial0 = &serial0; + serial1 = &serial1; + serial2 = &serial2; + serial3 = &serial3; }; }; diff --git a/arch/powerpc/dts/t1042si-post.dtsi b/arch/powerpc/dts/t1042si-post.dtsi index eebbbaf0e19..9f4fd7216a5 100644 --- a/arch/powerpc/dts/t1042si-post.dtsi +++ b/arch/powerpc/dts/t1042si-post.dtsi @@ -3,11 +3,13 @@ * T1042 Silicon/SoC Device Tree Source (post include) * * Copyright 2013 - 2014 Freescale Semiconductor Inc. - * Copyright 2021 NXP + * Copyright 2021-2023 NXP * */ &soc { /include/ "qoriq-clockgen2.dtsi" +/include/ "qoriq-duart-0.dtsi" +/include/ "qoriq-duart-1.dtsi" /include/ "qoriq-gpio-0.dtsi" /include/ "qoriq-gpio-1.dtsi" /include/ "qoriq-gpio-2.dtsi" From 8cfb187681a2ea8cafe6995d94b1c45563b3ce51 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:27 +0300 Subject: [PATCH 14/20] powerpc: dts: t1042d4rdb: tag serial nodes with bootph-all Make sure the serial driver is initialized before relocation by tagging the serial nodes with "bootph-all". Add these u-boot specific properties to an *-u-boot.dtsi file. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t1042d4rdb-u-boot.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arch/powerpc/dts/t1042d4rdb-u-boot.dtsi diff --git a/arch/powerpc/dts/t1042d4rdb-u-boot.dtsi b/arch/powerpc/dts/t1042d4rdb-u-boot.dtsi new file mode 100644 index 00000000000..b50b922aeb2 --- /dev/null +++ b/arch/powerpc/dts/t1042d4rdb-u-boot.dtsi @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright 2023 NXP */ + +&serial0 { + bootph-all; +}; + +&serial1 { + bootph-all; +}; + +#include "u-boot.dtsi" From e5dd02cb30ec7ff8c32367e77042e19a193ed2da Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:28 +0300 Subject: [PATCH 15/20] configs: T1042D4RDB: enable DM_SERIAL As the serial devices are configured in the device tree, enable DM_SERIAL in the non-SPL T1042D4RDB defconfigs. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- configs/T1042D4RDB_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/T1042D4RDB_defconfig b/configs/T1042D4RDB_defconfig index 06eb06dfa8b..fe84f36acea 100644 --- a/configs/T1042D4RDB_defconfig +++ b/configs/T1042D4RDB_defconfig @@ -101,7 +101,9 @@ CONFIG_SYS_QE_FW_ADDR=0xEFF10000 CONFIG_SYS_QE_FMAN_FW_IN_NOR=y CONFIG_DM_RTC=y CONFIG_RTC_DS1337=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_ESPI=y From f416f33ece8b090e95f358e4ed2e2fdf2d6fb24d Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:29 +0300 Subject: [PATCH 16/20] board: freescale: t102xrdb: enumerate PCI devices Call pci_init() to force PCI enumeration at probe time. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t102xrdb/t102xrdb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index baa59615b3e..ffc4c1122d8 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -159,6 +159,8 @@ int board_early_init_r(void) board_mux_lane(); #endif + pci_init(); + return 0; } From 23b60eb7a24d7c8d622215f72509f516009892fa Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:30 +0300 Subject: [PATCH 17/20] board: freescale: t102xrdb: implement get_serial_clock The serial clock is provided by the get_serial_clock() callback on PPC under DM_SERIAL. Use the same method to compute the clock as for non-DM_SERIAL use cases. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- board/freescale/t102xrdb/t102xrdb.c | 10 +++++++++- include/configs/T102xRDB.h | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index ffc4c1122d8..73f9d3ac72e 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2014 Freescale Semiconductor, Inc. - * Copyright 2020 NXP + * Copyright 2020-2023 NXP */ #include @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "t102xrdb.h" #ifdef CONFIG_TARGET_T1024RDB @@ -45,6 +46,13 @@ enum { }; #endif +#if CONFIG_IS_ENABLED(DM_SERIAL) +int get_serial_clock(void) +{ + return get_bus_freq(0) / 2; +} +#endif + int checkboard(void) { struct cpu_type *cpu = gd->arch.cpu; diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h index 7ee46abffdb..284291af2fa 100644 --- a/include/configs/T102xRDB.h +++ b/include/configs/T102xRDB.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. - * Copyright 2020-2021 NXP + * Copyright 2020-2023 NXP */ /* @@ -283,7 +283,9 @@ #define CFG_SYS_INIT_SP_OFFSET (CFG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) /* Serial Port */ +#if !CONFIG_IS_ENABLED(DM_SERIAL) #define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) +#endif #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} From 51f976d40d6acbbb54caac3d6f63ebff5b205303 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:31 +0300 Subject: [PATCH 18/20] powerpc: dts: t1024rdb: add serial nodes Add the serial node descriptions similar to Linux v6.4 for the t1024rdb board and its dependencies. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t1023si-post.dtsi | 4 +++- arch/powerpc/dts/t1024rdb.dts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/dts/t1023si-post.dtsi b/arch/powerpc/dts/t1023si-post.dtsi index 6f666a15547..0cd34fe4887 100644 --- a/arch/powerpc/dts/t1023si-post.dtsi +++ b/arch/powerpc/dts/t1023si-post.dtsi @@ -3,13 +3,15 @@ * T1023 Silicon/SoC Device Tree Source (post include) * * Copyright 2014 Freescale Semiconductor Inc. - * Copyright 2019-2020 NXP + * Copyright 2019-2023 NXP * */ &soc { /include/ "qoriq-clockgen2.dtsi" +/include/ "qoriq-duart-0.dtsi" +/include/ "qoriq-duart-1.dtsi" /include/ "qoriq-gpio-0.dtsi" /include/ "qoriq-gpio-1.dtsi" /include/ "qoriq-gpio-2.dtsi" diff --git a/arch/powerpc/dts/t1024rdb.dts b/arch/powerpc/dts/t1024rdb.dts index eeba99f84de..afaf90cb599 100644 --- a/arch/powerpc/dts/t1024rdb.dts +++ b/arch/powerpc/dts/t1024rdb.dts @@ -3,7 +3,7 @@ * T1024RDB Device Tree Source * * Copyright 2013 - 2015 Freescale Semiconductor Inc. - * Copyright 2019-2020 NXP + * Copyright 2019-2023 NXP */ /include/ "t102x.dtsi" @@ -17,6 +17,10 @@ aliases { sg_2500_aqr105_phy4 = &sg_2500_aqr105_phy4; + serial0 = &serial0; + serial1 = &serial1; + serial2 = &serial2; + serial3 = &serial3; spi0 = &espi0; }; From eab4cf5d64d3eec659ce26a153c07a79e9f77794 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:32 +0300 Subject: [PATCH 19/20] powerpc: dts: t1024rdb: tag serial nodes with bootph-all Make sure the serial driver is initialized before relocation by tagging the serial nodes with "bootph-all". Add these u-boot specific properties to an *-u-boot.dtsi file. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- arch/powerpc/dts/t1024rdb-u-boot.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arch/powerpc/dts/t1024rdb-u-boot.dtsi diff --git a/arch/powerpc/dts/t1024rdb-u-boot.dtsi b/arch/powerpc/dts/t1024rdb-u-boot.dtsi new file mode 100644 index 00000000000..b50b922aeb2 --- /dev/null +++ b/arch/powerpc/dts/t1024rdb-u-boot.dtsi @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright 2023 NXP */ + +&serial0 { + bootph-all; +}; + +&serial1 { + bootph-all; +}; + +#include "u-boot.dtsi" From 6d249769c5249774ea0e6b218279d9415108da35 Mon Sep 17 00:00:00 2001 From: Camelia Groza Date: Tue, 11 Jul 2023 15:49:33 +0300 Subject: [PATCH 20/20] configs: T1024RDB: enable DM_SERIAL As the serial devices are configured in the device tree, enable DM_SERIAL in the non-SPL T1024RDB defconfigs. Signed-off-by: Camelia Groza Signed-off-by: Peng Fan --- configs/T1024RDB_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/T1024RDB_defconfig b/configs/T1024RDB_defconfig index 5e8dfbfcdd9..0d0707e0262 100644 --- a/configs/T1024RDB_defconfig +++ b/configs/T1024RDB_defconfig @@ -101,7 +101,9 @@ CONFIG_SYS_QE_FW_ADDR=0xEFE00000 CONFIG_SYS_QE_FMAN_FW_IN_NOR=y CONFIG_DM_RTC=y CONFIG_RTC_DS1337=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_ESPI=y