summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorVikas Manocha <vikas.manocha@st.com>2017-02-12 10:25:46 -0800
committerTom Rini <trini@konsulko.com>2017-03-17 14:15:13 -0400
commitfd03b83a9912f265d9ca08a0dd542af3f9b52216 (patch)
tree5d090287ea2d393c480e741909516805e9f3c0b5 /drivers/serial
parent712f99a5ddc404f8c6eac481cfe19f82ca2ecb4f (diff)
downloadu-boot-fd03b83a9912f265d9ca08a0dd542af3f9b52216.tar.gz
u-boot-fd03b83a9912f265d9ca08a0dd542af3f9b52216.tar.xz
u-boot-fd03b83a9912f265d9ca08a0dd542af3f9b52216.zip
stm32f7: serial: use clock driver to enable clock
Signed-off-by: Vikas Manocha <vikas.manocha@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_stm32x7.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/serial/serial_stm32x7.c b/drivers/serial/serial_stm32x7.c
index 2e6c67688c..1907cef5b3 100644
--- a/drivers/serial/serial_stm32x7.c
+++ b/drivers/serial/serial_stm32x7.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <clk.h>
#include <dm.h>
#include <asm/io.h>
#include <serial.h>
@@ -76,6 +77,22 @@ static int stm32_serial_probe(struct udevice *dev)
{
struct stm32x7_serial_platdata *plat = dev->platdata;
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);
return 0;
@@ -98,6 +115,7 @@ static int stm32_serial_ofdata_to_platdata(struct udevice *dev)
return -EINVAL;
plat->base = (struct stm32_usart *)addr;
+
return 0;
}
#endif