board: sl28: enable DM_SERIAL and lpuart support
cover board: sl28: enable DM_SERIAL and lpuart support
Enable DM_SERIAL for this board. For this to work, we first need to make DM_SERIAL work on LS1028A SoCs, which just means we have to properly call spl_early_init(). After this, clean up the board config by moving the CONFIG_DM_* macros to Kconfig. Now we can switch to DM_SERIAL. As the last patch, provide a configuration option to switch the output to the first serial line on this board, which is not possible because we can enable LPUART support (which needs DM_SERIAL).
Please note, the first patch is not really required but helps a lot in debugging early startup on Layerscape SoCs.
Michael Walle (5):
armv8: fsl-layerscape: spl: add debug UART support
armv8: fsl-layerscape: spl: call spl_early_init()
board: sl28: move DM_* configs to Kconfig
board: sl28: enable DM_SERIAL
board: sl28: add config to enable console output on SER0
arch/arm/Kconfig | 20 +++++++++++++++++++ arch/arm/cpu/armv8/fsl-layerscape/spl.c | 11 ++++++++++ .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 12 +++++++++++ board/kontron/sl28/Kconfig | 10 ++++++++++ board/kontron/sl28/Makefile | 2 +- board/kontron/sl28/common.c | 11 ++++++++++ configs/kontron_sl28_defconfig | 17 ---------------- include/configs/kontron_sl28.h | 2 -- 8 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 board/kontron/sl28/common.c
Signature · 1 line
2.20.1
PATCH 1/5 armv8: fsl-layerscape: spl: add debug UART support
To use the debug UART we have to call debug_uart_init() in the SPL. Do so as soon as possible.
As an example, here is how you can use it on a LS1028A SoC:CONFIG_DEBUG_UART=y CONFIG_DEBUG_UART_BASE=0x21c0500 CONFIG_DEBUG_UART_CLOCK=200000000
--- arch/arm/cpu/armv8/fsl-layerscape/spl.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/spl.c +3 -0
@@ -6,6 +6,7 @@#include <common.h> #include <clock_legacy.h> #include <cpu_func.h> +#include <debug_uart.h> #include <env.h> #include <image.h> #include <init.h>
@@ -70,6 +71,8 @@ void board_init_f(ulong dummy)icache_enable ();/* Clear global data */ memset ((void *)gd,0 ,sizeof (gd_t)); +if (IS_ENABLED (CONFIG_DEBUG_UART )) +debug_uart_init ();board_early_init_f ();timer_init ();#ifdef CONFIG_ARCH_LS2080A
Signature · 1 line
2.20.1
PATCH 2/5 armv8: fsl-layerscape: spl: call spl_early_init()
In reply to Michael WalleDM_SERIAL needs both the device tree as well as an early heap. Thus, we have to call spl_early_init() to initialize the memory allocator and the setup the device tree.
--- arch/arm/cpu/armv8/fsl-layerscape/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/spl.c +8 -0
@@ -8,6 +8,7 @@#include <cpu_func.h> #include <debug_uart.h> #include <env.h> +#include <hang.h> #include <image.h> #include <init.h> #include <log.h>
@@ -68,12 +69,19 @@ void spl_board_init(void)void board_init_f (ulong dummy) { +int ret; +icache_enable ();/* Clear global data */ memset ((void *)gd,0 ,sizeof (gd_t));if (IS_ENABLED (CONFIG_DEBUG_UART ))debug_uart_init ();board_early_init_f (); + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + }timer_init ();#ifdef CONFIG_ARCH_LS2080A env_init ();
Signature · 1 line
2.20.1
PATCH 3/5 board: sl28: move DM_* configs to Kconfig
In reply to Michael WalleMove the CONFIG_DM_* from the defconfig to the TARGET_SL28 config.
--- arch/arm/Kconfig | 19 +++++++++++++++++++ configs/kontron_sl28_defconfig | 17 ----------------- 2 files changed, 19 insertions(+), 17 deletions(-)
arch/arm/Kconfig +19 -0
@@ -1624,6 +1624,25 @@ config TARGET_SL28 select ARMV8_MULTIENTRY select SUPPORT_SPL select BINMAN + select DM + select DM_GPIO + select DM_I2C + select DM_MMC + select DM_SPI_FLASH + select DM_ETH + select DM_MDIO + select DM_PCI + select DM_RNG + select DM_RTC + select DM_SCSI + select DM_SPI + select DM_USB + select SPL_DM if SPL + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL + select SPL_DM_I2C if SPL + select SPL_DM_MMC if SPL + select SPL_DM_SERIAL if SPL help Support for Kontron SMARC-sAL28 board.
configs/kontron_sl28_defconfig +0 -17
@@ -8,8 +8,6 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_ENV_OFFSET=0x3e0000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_SYS_SPI_U_BOOT_OFFS=0x230000 -CONFIG_DM_GPIO=y -CONFIG_SPL_DM_SPI=y CONFIG_SPL_TEXT_BASE=0x18010000 CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_SPL_SERIAL_SUPPORT=y
@@ -35,7 +33,6 @@ CONFIG_PCI_INIT_R=y CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y -CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_SPI_LOAD=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y
@@ -58,52 +55,38 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y -CONFIG_DM=y -CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SCSI_AHCI=y CONFIG_SATA_CEVA=y CONFIG_FSL_CAAM=y CONFIG_SYS_FSL_DDR3=y -CONFIG_DM_I2C=y CONFIG_I2C_SET_DEFAULT_BUS_NUM=y CONFIG_I2C_DEFAULT_BUS_NUMBER=0 CONFIG_I2C_MUX=y -CONFIG_DM_MMC=y CONFIG_MMC_HS400_SUPPORT=y CONFIG_FSL_ESDHC=y CONFIG_FSL_ESDHC_SUPPORT_ADMA2=y -CONFIG_DM_SPI_FLASH=y # CONFIG_SPI_FLASH_UNLOCK_ALL is not set CONFIG_SPI_FLASH_WINBOND=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y CONFIG_PHY_FIXED=y -CONFIG_DM_ETH=y -CONFIG_DM_MDIO=y CONFIG_DM_DSA=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MSCC_FELIX_SWITCH=y CONFIG_NVME=y CONFIG_PCI=y -CONFIG_DM_PCI=y -CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_ECAM_GENERIC=y CONFIG_PCIE_LAYERSCAPE_RC=y -CONFIG_DM_RNG=y -CONFIG_DM_RTC=y CONFIG_RTC_RV8803=y CONFIG_SCSI=y -CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y -CONFIG_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_NXP_FSPI=y CONFIG_USB=y -CONFIG_DM_USB=y # CONFIG_SPL_DM_USB is not set CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y
Signature · 1 line
2.20.1
PATCH 4/5 board: sl28: enable DM_SERIAL
In reply to Michael WalleWith all preparations in place, switch over to DM_SERIAL.
--- arch/arm/Kconfig | 1 + include/configs/kontron_sl28.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/Kconfig +1 -0
@@ -1635,6 +1635,7 @@ config TARGET_SL28 select DM_RNG select DM_RTC select DM_SCSI + select DM_SERIAL select DM_SPI select DM_USB select SPL_DM if SPL
include/configs/kontron_sl28.h +0 -2
@@ -49,8 +49,6 @@#define CONFIG_MALLOC_F_ADDR CONFIG_SYS_FSL_OCRAM_BASE/* serial port */ -#define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE 1#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0) / 2)#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
Signature · 1 line
2.20.1
PATCH 5/5 board: sl28: add config to enable console output on SER0
In reply to Michael WalleSometimes it is desireable to have the console output on the first serial line. Introduce a configuration option for it (in the board scope).
--- arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 12 ++++++++++++ board/kontron/sl28/Kconfig | 10 ++++++++++ board/kontron/sl28/Makefile | 2 +- board/kontron/sl28/common.c | 11 +++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 board/kontron/sl28/common.c
arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi +12 -0
@@ -133,6 +133,14 @@ }; }; +#ifdef CONFIG_SL28_ENABLE_SER0_CONSOLE +/ { + chosen { + stdout-path = "serial2:115200n8"; + }; +}; +#endif + #ifdef CONFIG_SL28_SPL_LOADS_ATF_BL31 &binman { fit {
@@ -250,6 +258,10 @@ u-boot,dm-pre-reloc; }; +&lpuart1 { + u-boot,dm-pre-reloc; +}; + &serial0 { u-boot,dm-pre-reloc; };
board/kontron/sl28/Kconfig +10 -0
@@ -48,4 +48,14 @@ config SL28_BL32_ENTRY_ADDR endif +config SL28_ENABLE_SER0_CONSOLE + bool "Enable console output on SER0" + select DM_SERIAL + select SPL_DM_SERIAL + select FSL_LPUART + help + By default the console output of this board is on the second serial + line (SER1). Sometimes it is desirable to enable output on the first + serial line (SER0). For example, if you have a carrier which only + supports the first serial port. endif
board/kontron/sl28/Makefile +1 -1
@@ -4,7 +4,7 @@ ifndef CONFIG_SPL_BUILD obj-y += sl28.o cmds.o endif -obj-y += ddr.o +obj-y += common.o ddr.o ifdef CONFIG_SPL_BUILD obj-y += spl.o
board/kontron/sl28/common.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <common.h> +#include <asm/global_data.h> + +DECLARE_GLOBAL_DATA_PTR ; + +u32 get_lpuart_clk (void ) +{ +return gd->bus_clk /CONFIG_SYS_FSL_LPUART_CLK_DIV ; +}
Signature · 1 line
2.20.1