1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
4 * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
11 #include <stm32_rcc.h>
12 #include <dm/device-internal.h>
13 #include <dm/device_compat.h>
16 struct stm32_rcc_clk stm32_rcc_clk_f42x = {
17 .drv_name = "stm32fx_rcc_clock",
21 struct stm32_rcc_clk stm32_rcc_clk_f469 = {
22 .drv_name = "stm32fx_rcc_clock",
26 struct stm32_rcc_clk stm32_rcc_clk_f7 = {
27 .drv_name = "stm32fx_rcc_clock",
31 struct stm32_rcc_clk stm32_rcc_clk_h7 = {
32 .drv_name = "stm32h7_rcc_clock",
35 struct stm32_rcc_clk stm32_rcc_clk_mp1 = {
36 .drv_name = "stm32mp1_clk",
40 static int stm32_rcc_bind(struct udevice *dev)
42 struct udevice *child;
44 struct stm32_rcc_clk *rcc_clk =
45 (struct stm32_rcc_clk *)dev_get_driver_data(dev);
48 debug("%s(dev=%p)\n", __func__, dev);
49 drv = lists_driver_lookup_name(rcc_clk->drv_name);
51 debug("Cannot find driver '%s'\n", rcc_clk->drv_name);
55 ret = device_bind_with_driver_data(dev, drv, rcc_clk->drv_name,
57 dev_ofnode(dev), &child);
62 drv = lists_driver_lookup_name("stm32_rcc_reset");
64 dev_err(dev, "Cannot find driver stm32_rcc_reset'\n");
68 return device_bind_with_driver_data(dev, drv, "stm32_rcc_reset",
70 dev_ofnode(dev), &child);
74 static const struct udevice_id stm32_rcc_ids[] = {
75 {.compatible = "st,stm32f42xx-rcc", .data = (ulong)&stm32_rcc_clk_f42x },
76 {.compatible = "st,stm32f469-rcc", .data = (ulong)&stm32_rcc_clk_f469 },
77 {.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
78 {.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
79 {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 },
83 U_BOOT_DRIVER(stm32_rcc) = {
86 .of_match = stm32_rcc_ids,
87 .bind = stm32_rcc_bind,