Skip to contentSkip to conversation

lpuart: add a get_lpuart_clk function

PATCH New shh.xie at gmail.com 2 participants 2 messages Oct 28, 2016 – Nov 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 lpuart: add a get_lpuart_clk function

From: Shaohui Xie <[email protected]>

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 ovreride on a specific board which uses different clock for LPUART.

---
changes in v2:
none.

 drivers/serial/serial_lpuart.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/serial/serial_lpuart.c +6 -1
index 042e9a2..beb4243 100644
@@ -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));
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH v2 1/2 lpuart: add a get_lpuart_clk function

Quoted 8 lines · shh.xie at gmail.com

From: Shaohui Xie <[email protected]>

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 ovreride on a specific board which uses different clock for LPUART.

---

Reformat commit message. Applied to fsl-qoriq, awaiting upstream. Thanks.

York