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.
10 #include <stm32_rcc.h>
11 #include <dm/device-internal.h>
12 #include <dm/device_compat.h>
15 struct stm32_rcc_clk stm32_rcc_clk_f42x = {
16 .drv_name = "stm32fx_rcc_clock",
20 struct stm32_rcc_clk stm32_rcc_clk_f469 = {
21 .drv_name = "stm32fx_rcc_clock",
25 struct stm32_rcc_clk stm32_rcc_clk_f7 = {
26 .drv_name = "stm32fx_rcc_clock",
30 struct stm32_rcc_clk stm32_rcc_clk_h7 = {
31 .drv_name = "stm32h7_rcc_clock",
34 struct stm32_rcc_clk stm32_rcc_clk_mp1 = {
35 .drv_name = "stm32mp1_clk",
39 static int stm32_rcc_bind(struct udevice *dev)
41 struct udevice *child;
43 struct stm32_rcc_clk *rcc_clk =
44 (struct stm32_rcc_clk *)dev_get_driver_data(dev);
47 debug("%s(dev=%p)\n", __func__, dev);
48 drv = lists_driver_lookup_name(rcc_clk->drv_name);
50 debug("Cannot find driver '%s'\n", rcc_clk->drv_name);
54 ret = device_bind_with_driver_data(dev, drv, rcc_clk->drv_name,
56 dev_ofnode(dev), &child);
61 drv = lists_driver_lookup_name("stm32_rcc_reset");
63 dev_err(dev, "Cannot find driver stm32_rcc_reset'\n");
67 return device_bind_with_driver_data(dev, drv, "stm32_rcc_reset",
69 dev_ofnode(dev), &child);
73 static const struct udevice_id stm32_rcc_ids[] = {
74 {.compatible = "st,stm32f42xx-rcc", .data = (ulong)&stm32_rcc_clk_f42x },
75 {.compatible = "st,stm32f469-rcc", .data = (ulong)&stm32_rcc_clk_f469 },
76 {.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
77 {.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
78 {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 },
82 U_BOOT_DRIVER(stm32_rcc) = {
85 .of_match = stm32_rcc_ids,
86 .bind = stm32_rcc_bind,