Skip to content
Snippets Groups Projects
Commit fd03b83a authored by Vikas Manocha's avatar Vikas Manocha Committed by Tom Rini
Browse files

stm32f7: serial: use clock driver to enable clock

parent 712f99a5
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <common.h> #include <common.h>
#include <clk.h>
#include <dm.h> #include <dm.h>
#include <asm/io.h> #include <asm/io.h>
#include <serial.h> #include <serial.h>
...@@ -76,6 +77,22 @@ static int stm32_serial_probe(struct udevice *dev) ...@@ -76,6 +77,22 @@ static int stm32_serial_probe(struct udevice *dev)
{ {
struct stm32x7_serial_platdata *plat = dev->platdata; struct stm32x7_serial_platdata *plat = dev->platdata;
struct stm32_usart *const usart = plat->base; struct stm32_usart *const usart = plat->base;
#ifdef CONFIG_CLK
int ret;
struct clk clk;
ret = clk_get_by_index(dev, 0, &clk);
if (ret < 0)
return ret;
ret = clk_enable(&clk);
if (ret) {
dev_err(dev, "failed to enable clock\n");
return ret;
}
#endif
setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE); setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
return 0; return 0;
...@@ -98,6 +115,7 @@ static int stm32_serial_ofdata_to_platdata(struct udevice *dev) ...@@ -98,6 +115,7 @@ static int stm32_serial_ofdata_to_platdata(struct udevice *dev)
return -EINVAL; return -EINVAL;
plat->base = (struct stm32_usart *)addr; plat->base = (struct stm32_usart *)addr;
return 0; return 0;
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment