xref: /openbmc/u-boot/drivers/misc/stm32_rcc.c (revision e974b081)
1 /*
2  * Copyright (C) STMicroelectronics SA 2017
3  * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <dm.h>
10 #include <misc.h>
11 #include <dm/lists.h>
12 
13 static int stm32_rcc_bind(struct udevice *dev)
14 {
15 	int ret;
16 	struct udevice *child;
17 
18 	debug("%s(dev=%p)\n", __func__, dev);
19 
20 	ret = device_bind_driver_to_node(dev, "stm32h7_rcc_clock",
21 					 "stm32h7_rcc_clock",
22 					 dev_ofnode(dev), &child);
23 	if (ret)
24 		return ret;
25 
26 	return device_bind_driver_to_node(dev, "stm32_rcc_reset",
27 					  "stm32_rcc_reset",
28 					  dev_ofnode(dev), &child);
29 }
30 
31 static const struct misc_ops stm32_rcc_ops = {
32 };
33 
34 static const struct udevice_id stm32_rcc_ids[] = {
35 	{.compatible = "st,stm32h743-rcc"},
36 	{ }
37 };
38 
39 U_BOOT_DRIVER(stm32_rcc) = {
40 	.name		= "stm32-rcc",
41 	.id		= UCLASS_MISC,
42 	.of_match	= stm32_rcc_ids,
43 	.bind		= stm32_rcc_bind,
44 	.ops		= &stm32_rcc_ops,
45 };
46