aboutsummaryrefslogtreecommitdiff
path: root/src/soc/nvidia
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-10-24 14:37:40 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-11-04 19:17:13 +0000
commit9948c521a63148e49d850d2ac760f245007908a3 (patch)
tree8046085886fee553689ea56a2f1551ae031d7707 /src/soc/nvidia
parent5c38b234ef7d3620c357714abaca393b332d8dca (diff)
lib/coreboot_table: Simplify API to set up lb_serial
Instead of having callbacks into serial console code to set up the coreboot table have the coreboot table code call IP specific code to get serial information. This makes it easier to reuse the information as the return value can be used in a different context (e.g. when filling in a FDT). This also removes boilerplate code to set up lb_console entries by setting entry based on the type in struct lb_uart. Change-Id: I6c08a88fb5fc035eb28d0becf19471c709c8043d Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68768 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/soc/nvidia')
-rw-r--r--src/soc/nvidia/tegra124/uart.c18
-rw-r--r--src/soc/nvidia/tegra210/uart.c18
2 files changed, 16 insertions, 20 deletions
diff --git a/src/soc/nvidia/tegra124/uart.c b/src/soc/nvidia/tegra124/uart.c
index 77d6de2c9d..557f0e82fe 100644
--- a/src/soc/nvidia/tegra124/uart.c
+++ b/src/soc/nvidia/tegra124/uart.c
@@ -114,15 +114,13 @@ void uart_tx_flush(unsigned int idx)
tegra124_uart_tx_flush(uart_ptr);
}
-void uart_fill_lb(void *data)
+enum cb_err fill_lb_serial(struct lb_serial *serial)
{
- struct lb_serial serial;
- serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
- serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
- serial.baud = get_uart_baudrate();
- serial.regwidth = 4;
- serial.input_hertz = uart_platform_refclk();
- lb_add_serial(&serial, data);
-
- lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+ serial->type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial->baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
+ serial->baud = get_uart_baudrate();
+ serial->regwidth = 4;
+ serial->input_hertz = uart_platform_refclk();
+
+ return CB_SUCCESS;
}
diff --git a/src/soc/nvidia/tegra210/uart.c b/src/soc/nvidia/tegra210/uart.c
index b2cdf67aa2..33660659f8 100644
--- a/src/soc/nvidia/tegra210/uart.c
+++ b/src/soc/nvidia/tegra210/uart.c
@@ -101,15 +101,13 @@ unsigned char uart_rx_byte(unsigned int idx)
return tegra210_uart_rx_byte();
}
-void uart_fill_lb(void *data)
+enum cb_err fill_lb_serial(struct lb_serial *serial)
{
- struct lb_serial serial;
- serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
- serial.baseaddr = CONFIG_CONSOLE_SERIAL_TEGRA210_UART_ADDRESS;
- serial.baud = get_uart_baudrate();
- serial.regwidth = 4;
- serial.input_hertz = uart_platform_refclk();
- lb_add_serial(&serial, data);
-
- lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+ serial->type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial->baseaddr = CONFIG_CONSOLE_SERIAL_TEGRA210_UART_ADDRESS;
+ serial->baud = get_uart_baudrate();
+ serial->regwidth = 4;
+ serial->input_hertz = uart_platform_refclk();
+
+ return CB_SUCCESS;
}