From: Duje Mihanović Date: Wed, 18 Dec 2024 20:54:11 +0000 (+0100) Subject: debug uart working somewhat X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=37835b46607967ca1f2ce0309baf653f9f6909e3;p=u-boot.git debug uart working somewhat --- diff --git a/arch/arm/dts/pxa1908.dtsi b/arch/arm/dts/pxa1908.dtsi index 8db4978646..bb19cae30d 100644 --- a/arch/arm/dts/pxa1908.dtsi +++ b/arch/arm/dts/pxa1908.dtsi @@ -83,17 +83,15 @@ ranges = <0 0 0xd4000000 0x200000>; uart0: serial@17000 { - compatible = "mrvl,mmp-uart", "intel,xscale-uart", "ns16550"; + compatible = "ns16550"; reg = <0x17000 0x1000>; - interrupts = ; clock-frequency = <14745600>; reg-shift = <2>; }; uart1: serial@18000 { - compatible = "mrvl,mmp-uart", "intel,xscale-uart", "ns16550"; + compatible = "ns16550"; reg = <0x18000 0x1000>; - interrupts = ; clock-frequency = <14745600>; reg-shift = <2>; }; @@ -116,9 +114,8 @@ }; uart2: serial@36000 { - compatible = "mrvl,mmp-uart", "intel,xscale-uart", "ns16550"; + compatible = "ns16550"; reg = <0x36000 0x1000>; - interrupts = ; clock-frequency = <117000000>; reg-shift = <2>; }; diff --git a/board/samsung/coreprimevelte/coreprimevelte.c b/board/samsung/coreprimevelte/coreprimevelte.c index 7c970e606c..b095dd0986 100644 --- a/board/samsung/coreprimevelte/coreprimevelte.c +++ b/board/samsung/coreprimevelte/coreprimevelte.c @@ -2,25 +2,30 @@ #include #include -int board_init(void) +void lowlevel_init(void) { +#ifdef CONFIG_DEBUG_UART debug_uart_init(); - printascii("Reached board_init()\n"); + printascii("Reached lowlevel_init()\n"); +#endif /* CONFIG_DEBUG_UART */ u32 tmp = readl(0xd4015064); if ((tmp >> 16) != 0x319) - return -1; + return; writel(tmp | 1, 0xd4015064); writel(3, 0xd4101000); +} - return 0; +int board_init(void) +{ + puts("Reached board_init()\n"); } int dram_init(void) { if (fdtdec_setup_mem_size_base() != 0) - printascii("fdtdec_setup_mem_size_base() has failed\n"); + puts("fdtdec_setup_mem_size_base() has failed\n"); return 0; } diff --git a/common/board_f.c b/common/board_f.c index 1245467716..0fbb8c4f73 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -930,11 +930,11 @@ static const init_fnc_t init_sequence_f[] = { #endif env_init, /* initialize environment */ init_baud_rate, /* initialze baudrate settings */ - green, serial_init, /* serial communications setup */ - blue, + green, console_init_f, /* stage 1 init of console */ display_options, /* say that we are here */ + blue, display_text_info, /* show debugging info if required */ checkcpu, #if defined(CONFIG_SYSRESET) diff --git a/configs/coreprimevelte_defconfig b/configs/coreprimevelte_defconfig index 798f459fa4..fc3e9264a7 100644 --- a/configs/coreprimevelte_defconfig +++ b/configs/coreprimevelte_defconfig @@ -15,13 +15,14 @@ CONFIG_ARMV8_PSCI=y CONFIG_DEBUG_UART=y CONFIG_LOCALVERSION="pxa1908" CONFIG_FIT=y +CONFIG_LOGLEVEL=8 CONFIG_LOG=y CONFIG_OF_CONTROL=y +CONFIG_OF_EMBED=y CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CPU=y CONFIG_CPU_ARMV8=y -CONFIG_SERIAL_SEARCH_ALL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_DEBUG_UART_SKIP_INIT=y diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 7772c2e9f1..46f0931931 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -321,19 +321,21 @@ int ns16550_tstc(struct ns16550 *com_port) static inline void _debug_uart_init(void) { - struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE); - int baud_divisor; + //struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE); + //int baud_divisor; /* Wait until tx buffer is empty */ + /* while (!(serial_din(&com_port->lsr) & UART_LSR_TEMT)) ; - + */ /* * We copy the code from above because it is already horribly messy. * Trying to refactor to nicely remove the duplication doesn't seem * feasible. The better fix is to move all users of this driver to * driver model. */ + /* baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE); serial_dout(&com_port->ier, CFG_SYS_NS16550_IER); @@ -344,6 +346,7 @@ static inline void _debug_uart_init(void) serial_dout(&com_port->dll, baud_divisor & 0xff); serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff); serial_dout(&com_port->lcr, UART_LCRVAL); + */ } static inline int NS16550_read_baud_divisor(struct ns16550 *com_port) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 6d27b53085..69b29dee84 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -195,8 +195,6 @@ int serial_init(void) #if CONFIG_IS_ENABLED(SERIAL_PRESENT) serial_find_console_or_panic(); gd->flags |= GD_FLG_SERIAL_READY; - for (int *i = (int *) 0x17200000; i < 0x17177000 + 0x177000; i++) - *i = 0xffffff00; if (IS_ENABLED(CONFIG_OF_SERIAL_BAUD)) { int ret = 0; @@ -217,6 +215,8 @@ int serial_init(void) } } serial_setbrg(); + + serial_puts("serial_init done\n"); #endif return 0;