1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
4 * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
7 #define LOG_CATEGORY UCLASS_NOP
13 #include <stm32_rcc.h>
14 #include <dm/device-internal.h>
15 #include <dm/device_compat.h>
18 struct stm32_rcc_clk stm32_rcc_clk_f42x = {
19 .drv_name = "stm32fx_rcc_clock",
23 struct stm32_rcc_clk stm32_rcc_clk_f469 = {
24 .drv_name = "stm32fx_rcc_clock",
28 struct stm32_rcc_clk stm32_rcc_clk_f7 = {
29 .drv_name = "stm32fx_rcc_clock",
33 struct stm32_rcc_clk stm32_rcc_clk_h7 = {
34 .drv_name = "stm32h7_rcc_clock",
37 struct stm32_rcc_clk stm32_rcc_clk_mp1 = {
38 .drv_name = "stm32mp1_clk",
42 static int stm32_rcc_bind(struct udevice *dev)
44 struct udevice *child;
46 struct stm32_rcc_clk *rcc_clk =
47 (struct stm32_rcc_clk *)dev_get_driver_data(dev);
50 dev_dbg(dev, "RCC bind\n");
51 drv = lists_driver_lookup_name(rcc_clk->drv_name);
53 dev_err(dev, "Cannot find driver '%s'\n", rcc_clk->drv_name);
57 ret = device_bind_with_driver_data(dev, drv, dev->name,
59 dev_ofnode(dev), &child);
64 drv = lists_driver_lookup_name("stm32_rcc_reset");
66 dev_err(dev, "Cannot find driver stm32_rcc_reset'\n");
70 return device_bind_with_driver_data(dev, drv, dev->name,
72 dev_ofnode(dev), &child);
76 static const struct udevice_id stm32_rcc_ids[] = {
77 {.compatible = "st,stm32f42xx-rcc", .data = (ulong)&stm32_rcc_clk_f42x },
78 {.compatible = "st,stm32f469-rcc", .data = (ulong)&stm32_rcc_clk_f469 },
79 {.compatible = "st,stm32f746-rcc", .data = (ulong)&stm32_rcc_clk_f7 },
80 {.compatible = "st,stm32h743-rcc", .data = (ulong)&stm32_rcc_clk_h7 },
81 {.compatible = "st,stm32mp1-rcc", .data = (ulong)&stm32_rcc_clk_mp1 },
85 U_BOOT_DRIVER(stm32_rcc) = {
88 .of_match = stm32_rcc_ids,
89 .bind = stm32_rcc_bind,