blob: 6b02dc8beb20a4024161d257bec4f8b68519c6d7 [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
6#include <common.h>
7#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Kever Yangca19eac2016-07-29 10:35:25 +08009#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080010#include <asm/arch-rockchip/clock.h>
Kever Yangca19eac2016-07-29 10:35:25 +080011
12static const struct udevice_id rk3399_syscon_ids[] = {
13 { .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF },
Kever Yange3eba162016-08-16 17:58:10 +080014 { .compatible = "rockchip,rk3399-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
Kever Yang62d01dc2017-02-13 17:38:59 +080015 { .compatible = "rockchip,rk3399-pmusgrf", .data = ROCKCHIP_SYSCON_PMUSGRF },
16 { .compatible = "rockchip,rk3399-cic", .data = ROCKCHIP_SYSCON_CIC },
Jagan Tekiee1e44f2019-07-16 17:27:33 +053017 { .compatible = "rockchip,rk3399-pmu", .data = ROCKCHIP_SYSCON_PMU },
eric.gao@rock-chips.comc4d4f542017-04-10 09:53:31 +080018 { }
Kever Yangca19eac2016-07-29 10:35:25 +080019};
20
21U_BOOT_DRIVER(syscon_rk3399) = {
22 .name = "rk3399_syscon",
23 .id = UCLASS_SYSCON,
24 .of_match = rk3399_syscon_ids,
25};
Kever Yang62d01dc2017-02-13 17:38:59 +080026
27#if CONFIG_IS_ENABLED(OF_PLATDATA)
28static int rk3399_syscon_bind_of_platdata(struct udevice *dev)
29{
30 dev->driver_data = dev->driver->of_match->data;
31 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
32
33 return 0;
34}
35
36U_BOOT_DRIVER(rockchip_rk3399_grf) = {
37 .name = "rockchip_rk3399_grf",
38 .id = UCLASS_SYSCON,
39 .of_match = rk3399_syscon_ids,
40 .bind = rk3399_syscon_bind_of_platdata,
41};
42
43U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = {
44 .name = "rockchip_rk3399_pmugrf",
45 .id = UCLASS_SYSCON,
46 .of_match = rk3399_syscon_ids + 1,
47 .bind = rk3399_syscon_bind_of_platdata,
48};
49
50U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = {
51 .name = "rockchip_rk3399_pmusgrf",
52 .id = UCLASS_SYSCON,
53 .of_match = rk3399_syscon_ids + 2,
54 .bind = rk3399_syscon_bind_of_platdata,
55};
56
57U_BOOT_DRIVER(rockchip_rk3399_cic) = {
58 .name = "rockchip_rk3399_cic",
59 .id = UCLASS_SYSCON,
60 .of_match = rk3399_syscon_ids + 3,
61 .bind = rk3399_syscon_bind_of_platdata,
62};
Jagan Tekiee1e44f2019-07-16 17:27:33 +053063
64U_BOOT_DRIVER(rockchip_rk3399_pmu) = {
65 .name = "rockchip_rk3399_pmu",
66 .id = UCLASS_SYSCON,
67 .of_match = rk3399_syscon_ids + 4,
68 .bind = rk3399_syscon_bind_of_platdata,
69};
Kever Yang62d01dc2017-02-13 17:38:59 +080070#endif