blob: dff2caa5981b058024fe259b898a8cc69b16a20c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass19c58cf2015-08-30 16:55:34 -06002/*
3 * Copyright (C) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glass19c58cf2015-08-30 16:55:34 -06005 */
6
7#include <common.h>
8#include <dm.h>
9#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080010#include <asm/arch-rockchip/clock.h>
Simon Glass19c58cf2015-08-30 16:55:34 -060011
12static const struct udevice_id rk3288_syscon_ids[] = {
13 { .compatible = "rockchip,rk3288-noc", .data = ROCKCHIP_SYSCON_NOC },
14 { .compatible = "rockchip,rk3288-grf", .data = ROCKCHIP_SYSCON_GRF },
15 { .compatible = "rockchip,rk3288-sgrf", .data = ROCKCHIP_SYSCON_SGRF },
16 { .compatible = "rockchip,rk3288-pmu", .data = ROCKCHIP_SYSCON_PMU },
17 { }
18};
19
20U_BOOT_DRIVER(syscon_rk3288) = {
21 .name = "rk3288_syscon",
22 .id = UCLASS_SYSCON,
23 .of_match = rk3288_syscon_ids,
24};
Simon Glassd63ea432016-07-04 11:58:33 -060025
26#if CONFIG_IS_ENABLED(OF_PLATDATA)
27static int rk3288_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_rk3288_noc) = {
36 .name = "rockchip_rk3288_noc",
37 .id = UCLASS_SYSCON,
38 .of_match = rk3288_syscon_ids,
39 .bind = rk3288_syscon_bind_of_platdata,
40};
41
42U_BOOT_DRIVER(rockchip_rk3288_grf) = {
43 .name = "rockchip_rk3288_grf",
44 .id = UCLASS_SYSCON,
45 .of_match = rk3288_syscon_ids + 1,
46 .bind = rk3288_syscon_bind_of_platdata,
47};
48
49U_BOOT_DRIVER(rockchip_rk3288_sgrf) = {
50 .name = "rockchip_rk3288_sgrf",
51 .id = UCLASS_SYSCON,
52 .of_match = rk3288_syscon_ids + 2,
53 .bind = rk3288_syscon_bind_of_platdata,
54};
55
56U_BOOT_DRIVER(rockchip_rk3288_pmu) = {
57 .name = "rockchip_rk3288_pmu",
58 .id = UCLASS_SYSCON,
59 .of_match = rk3288_syscon_ids + 3,
60 .bind = rk3288_syscon_bind_of_platdata,
61};
62#endif