blob: 74d4552017036e02b08c57427e3df394277a9b6f [file] [log] [blame]
Kever Yangca19eac2016-07-29 10:35:25 +08001/*
2 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <syscon.h>
10#include <asm/arch/clock.h>
11
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 },
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,
23 .of_match = rk3399_syscon_ids,
24};
Kever Yang62d01dc2017-02-13 17:38:59 +080025
26#if CONFIG_IS_ENABLED(OF_PLATDATA)
27static int rk3399_syscon_bind_of_platdata(struct udevice *dev)
28{
29 dev->driver_data = dev->driver->of_match->data;
30 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
31
32 return 0;
33}
34
35U_BOOT_DRIVER(rockchip_rk3399_grf) = {
36 .name = "rockchip_rk3399_grf",
37 .id = UCLASS_SYSCON,
38 .of_match = rk3399_syscon_ids,
39 .bind = rk3399_syscon_bind_of_platdata,
40};
41
42U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = {
43 .name = "rockchip_rk3399_pmugrf",
44 .id = UCLASS_SYSCON,
45 .of_match = rk3399_syscon_ids + 1,
46 .bind = rk3399_syscon_bind_of_platdata,
47};
48
49U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = {
50 .name = "rockchip_rk3399_pmusgrf",
51 .id = UCLASS_SYSCON,
52 .of_match = rk3399_syscon_ids + 2,
53 .bind = rk3399_syscon_bind_of_platdata,
54};
55
56U_BOOT_DRIVER(rockchip_rk3399_cic) = {
57 .name = "rockchip_rk3399_cic",
58 .id = UCLASS_SYSCON,
59 .of_match = rk3399_syscon_ids + 3,
60 .bind = rk3399_syscon_bind_of_platdata,
61};
62#endif