summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaohui Xie <Shaohui.Xie@nxp.com>2016-10-28 14:23:30 +0800
committerYork Sun <york.sun@nxp.com>2016-11-21 09:20:32 -0800
commit9b46213b4f63578be2fbcf6b0532a0a8d4b5edb0 (patch)
tree0cbe53a4bb7fbb1534dde0c951ff75b88bbd798f
parent20c700f8daee0b3995c5a6d2c5f69eef1c7acd4e (diff)
downloadu-boot-imx-9b46213b4f63578be2fbcf6b0532a0a8d4b5edb0.zip
u-boot-imx-9b46213b4f63578be2fbcf6b0532a0a8d4b5edb0.tar.gz
u-boot-imx-9b46213b4f63578be2fbcf6b0532a0a8d4b5edb0.tar.bz2
lpuart: add a get_lpuart_clk function
It's not always true that LPUART clock is CONFIG_SYS_CLK_FREQ. This patch provides a weak function get_lpuart_clk(), so that the clock can be ovreridden on a specific board which uses different clock for LPUART. Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com> [YS: Reformat commit message] Reviewed-by: York Sun <york.sun@nxp.com>
-rw-r--r--drivers/serial/serial_lpuart.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 042e9a2..beb4243 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -170,9 +170,14 @@ static int lpuart_serial_probe(struct udevice *dev)
}
#else
+u32 __weak get_lpuart_clk(void)
+{
+ return CONFIG_SYS_CLK_FREQ;
+}
+
static void _lpuart32_serial_setbrg(struct lpuart_fsl *base, int baudrate)
{
- u32 clk = CONFIG_SYS_CLK_FREQ;
+ u32 clk = get_lpuart_clk();
u32 sbr;
sbr = (clk / (16 * baudrate));