summaryrefslogtreecommitdiffstats
path: root/drivers/misc/stm32_rcc.c
diff options
context:
space:
mode:
authorChristophe Kerello <christophe.kerello@st.com>2017-09-13 18:00:08 +0200
committerTom Rini <trini@konsulko.com>2017-09-22 07:40:02 -0400
commit4e280b91a188bfe29d34eb1146b4b0a7f00ad31d (patch)
tree4421f4e18ef4e61189975e6a5226c54e0c7d1fae /drivers/misc/stm32_rcc.c
parent23a06416858d839ee62dc00562be956be6d84bd2 (diff)
downloadu-boot-4e280b91a188bfe29d34eb1146b4b0a7f00ad31d.tar.gz
u-boot-4e280b91a188bfe29d34eb1146b4b0a7f00ad31d.tar.xz
u-boot-4e280b91a188bfe29d34eb1146b4b0a7f00ad31d.zip
dm: misc: add stm32 rcc driver
This patch adds the support of reset and clock control block (rcc) found on STM32 SoCs. This driver is similar to a MFD linux driver. This driver supports currently STM32H7 only. STM32F4 and STM32F7 will be migrated to this rcc MFD driver in the future to uniformize all STM32 SoCs already upstreamed. Signed-off-by: Christophe Kerello <christophe.kerello@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Vikas Manocha <vikas.manocha@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc/stm32_rcc.c')
-rw-r--r--drivers/misc/stm32_rcc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/misc/stm32_rcc.c b/drivers/misc/stm32_rcc.c
new file mode 100644
index 0000000000..a6c2a757ec
--- /dev/null
+++ b/drivers/misc/stm32_rcc.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2017
+ * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <misc.h>
+#include <dm/lists.h>
+
+static int stm32_rcc_bind(struct udevice *dev)
+{
+ int ret;
+ struct udevice *child;
+
+ debug("%s(dev=%p)\n", __func__, dev);
+
+ ret = device_bind_driver_to_node(dev, "stm32h7_rcc_clock",
+ "stm32h7_rcc_clock",
+ dev_ofnode(dev), &child);
+ if (ret)
+ return ret;
+
+ return device_bind_driver_to_node(dev, "stm32_rcc_reset",
+ "stm32_rcc_reset",
+ dev_ofnode(dev), &child);
+}
+
+static const struct misc_ops stm32_rcc_ops = {
+};
+
+static const struct udevice_id stm32_rcc_ids[] = {
+ {.compatible = "st,stm32h743-rcc"},
+ { }
+};
+
+U_BOOT_DRIVER(stm32_rcc) = {
+ .name = "stm32-rcc",
+ .id = UCLASS_MISC,
+ .of_match = stm32_rcc_ids,
+ .bind = stm32_rcc_bind,
+ .ops = &stm32_rcc_ops,
+};