]> git.sur5r.net Git - u-boot/commitdiff
lpuart: add a get_lpuart_clk function
authorShaohui Xie <Shaohui.Xie@nxp.com>
Fri, 28 Oct 2016 06:23:30 +0000 (14:23 +0800)
committerYork Sun <york.sun@nxp.com>
Mon, 21 Nov 2016 17:20:32 +0000 (09:20 -0800)
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>
drivers/serial/serial_lpuart.c

index 042e9a26d1cb52114085a29685337a8891bb9cc3..beb42431245a9338f13edc7e3d80362d9c14930c 100644 (file)
@@ -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));