blob: b92ad54ede5cf91229f2b5c5ba2bb447b254b2ae [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Kever Yangca19eac2016-07-29 10:35:25 +08002/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
Kever Yangca19eac2016-07-29 10:35:25 +08004 */
5
Kever Yangca19eac2016-07-29 10:35:25 +08006#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06007#include <log.h>
Kever Yangca19eac2016-07-29 10:35:25 +08008#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +08009#include <asm/arch-rockchip/clock.h>
Kever Yangca19eac2016-07-29 10:35:25 +080010
11static const struct udevice_id rk3399_syscon_ids[] = {
12 { .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF },
Kever Yange3eba162016-08-16 17:58:10 +080013 { .compatible = "rockchip,rk3399-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
Kever Yang62d01dc2017-02-13 17:38:59 +080014 { .compatible = "rockchip,rk3399-pmusgrf", .data = ROCKCHIP_SYSCON_PMUSGRF },
15 { .compatible = "rockchip,rk3399-cic", .data = ROCKCHIP_SYSCON_CIC },
Jagan Tekiee1e44f2019-07-16 17:27:33 +053016 { .compatible = "rockchip,rk3399-pmu", .data = ROCKCHIP_SYSCON_PMU },
eric.gao@rock-chips.comc4d4f542017-04-10 09:53:31 +080017 { }
Kever Yangca19eac2016-07-29 10:35:25 +080018};
19
20U_BOOT_DRIVER(syscon_rk3399) = {
21 .name = "rk3399_syscon",
22 .id = UCLASS_SYSCON,
Simon Glass92882652021-08-07 07:24:04 -060023#if CONFIG_IS_ENABLED(OF_REAL)
Frank Wanged59f952020-05-26 11:32:08 +080024 .bind = dm_scan_fdt_dev,
25#endif
Kever Yangca19eac2016-07-29 10:35:25 +080026 .of_match = rk3399_syscon_ids,
27};
Kever Yang62d01dc2017-02-13 17:38:59 +080028
29#if CONFIG_IS_ENABLED(OF_PLATDATA)
Simon Glassb75b15b2020-12-03 16:55:23 -070030static int rk3399_syscon_bind_of_plat(struct udevice *dev)
Kever Yang62d01dc2017-02-13 17:38:59 +080031{
32 dev->driver_data = dev->driver->of_match->data;
33 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
34
35 return 0;
36}
37
38U_BOOT_DRIVER(rockchip_rk3399_grf) = {
39 .name = "rockchip_rk3399_grf",
40 .id = UCLASS_SYSCON,
41 .of_match = rk3399_syscon_ids,
Simon Glassb75b15b2020-12-03 16:55:23 -070042 .bind = rk3399_syscon_bind_of_plat,
Kever Yang62d01dc2017-02-13 17:38:59 +080043};
44
45U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = {
46 .name = "rockchip_rk3399_pmugrf",
47 .id = UCLASS_SYSCON,
48 .of_match = rk3399_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070049 .bind = rk3399_syscon_bind_of_plat,
Kever Yang62d01dc2017-02-13 17:38:59 +080050};
51
52U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = {
53 .name = "rockchip_rk3399_pmusgrf",
54 .id = UCLASS_SYSCON,
55 .of_match = rk3399_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070056 .bind = rk3399_syscon_bind_of_plat,
Kever Yang62d01dc2017-02-13 17:38:59 +080057};
58
59U_BOOT_DRIVER(rockchip_rk3399_cic) = {
60 .name = "rockchip_rk3399_cic",
61 .id = UCLASS_SYSCON,
62 .of_match = rk3399_syscon_ids + 3,
Simon Glassb75b15b2020-12-03 16:55:23 -070063 .bind = rk3399_syscon_bind_of_plat,
Kever Yang62d01dc2017-02-13 17:38:59 +080064};
Jagan Tekiee1e44f2019-07-16 17:27:33 +053065
66U_BOOT_DRIVER(rockchip_rk3399_pmu) = {
67 .name = "rockchip_rk3399_pmu",
68 .id = UCLASS_SYSCON,
69 .of_match = rk3399_syscon_ids + 4,
Simon Glassb75b15b2020-12-03 16:55:23 -070070 .bind = rk3399_syscon_bind_of_plat,
Jagan Tekiee1e44f2019-07-16 17:27:33 +053071};
Kever Yang62d01dc2017-02-13 17:38:59 +080072#endif