From 235daa4bf6b6467b5df675dcfe5041b7f62eeae3 Mon Sep 17 00:00:00 2001 From: Julien Viard de Galbert Date: Tue, 20 Feb 2018 11:45:48 +0100 Subject: driver/uart: Introduce a way for mainboard to override the baudrate The rationale is to allow the mainboard to override the default baudrate for instance by sampling GPIOs at boot. A new configuration option is available for mainboards to select this behaviour. It will then have to define the function get_uart_baudrate to return the computed baudrate. Change-Id: I970ee788bf90b9e1a8c6ccdc5eee8029d9af0ecc Signed-off-by: Julien Viard de Galbert Reviewed-on: https://review.coreboot.org/23713 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/include/console/uart.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/include') diff --git a/src/include/console/uart.h b/src/include/console/uart.h index 0dccd00d43..3bd390e75b 100644 --- a/src/include/console/uart.h +++ b/src/include/console/uart.h @@ -23,6 +23,17 @@ * baudrate generator. */ unsigned int uart_platform_refclk(void); +#if IS_ENABLED(CONFIG_UART_OVERRIDE_BAUDRATE) +/* Return the baudrate, define this in your platform when using the above + configuration. */ +unsigned int get_uart_baudrate(void); +#else +static inline unsigned int get_uart_baudrate(void) +{ + return CONFIG_TTYS0_BAUD; +} +#endif + /* Returns the divisor value for a given baudrate. * The formula to satisfy is: * refclk / divisor = baudrate * oversample -- cgit v1.2.3