blob: 4ba94f2e805091c3d6bd5c12b87ff08bb966231e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Andreas Färber9e3ad682017-05-15 17:51:18 +08002/*
3 * (C) Copyright 2017 Rockchip Electronics Co., Ltd
4 * Author: Andy Yan <andy.yan@rock-chips.com>
Philipp Tomsich036a8502017-06-22 23:25:57 +02005 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
Andreas Färber9e3ad682017-05-15 17:51:18 +08006 */
7
8#include <common.h>
9#include <dm.h>
10#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080011#include <asm/arch-rockchip/clock.h>
Andreas Färber9e3ad682017-05-15 17:51:18 +080012
13static const struct udevice_id rk3368_syscon_ids[] = {
14 { .compatible = "rockchip,rk3368-grf",
15 .data = ROCKCHIP_SYSCON_GRF },
16 { .compatible = "rockchip,rk3368-pmugrf",
17 .data = ROCKCHIP_SYSCON_PMUGRF },
Philipp Tomsich036a8502017-06-22 23:25:57 +020018 { .compatible = "rockchip,rk3368-msch",
19 .data = ROCKCHIP_SYSCON_MSCH },
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020020 { .compatible = "rockchip,rk3368-sgrf",
21 .data = ROCKCHIP_SYSCON_SGRF },
Andreas Färber9e3ad682017-05-15 17:51:18 +080022 { }
23};
24
25U_BOOT_DRIVER(syscon_rk3368) = {
26 .name = "rk3368_syscon",
27 .id = UCLASS_SYSCON,
28 .of_match = rk3368_syscon_ids,
29};
Philipp Tomsich036a8502017-06-22 23:25:57 +020030
31#if CONFIG_IS_ENABLED(OF_PLATDATA)
32static int rk3368_syscon_bind_of_platdata(struct udevice *dev)
33{
34 dev->driver_data = dev->driver->of_match->data;
35 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
36
37 return 0;
38}
39
40U_BOOT_DRIVER(rockchip_rk3368_grf) = {
41 .name = "rockchip_rk3368_grf",
42 .id = UCLASS_SYSCON,
43 .of_match = rk3368_syscon_ids,
44 .bind = rk3368_syscon_bind_of_platdata,
45};
46
47U_BOOT_DRIVER(rockchip_rk3368_pmugrf) = {
48 .name = "rockchip_rk3368_pmugrf",
49 .id = UCLASS_SYSCON,
50 .of_match = rk3368_syscon_ids + 1,
51 .bind = rk3368_syscon_bind_of_platdata,
52};
53
54U_BOOT_DRIVER(rockchip_rk3368_msch) = {
55 .name = "rockchip_rk3368_msch",
56 .id = UCLASS_SYSCON,
57 .of_match = rk3368_syscon_ids + 2,
58 .bind = rk3368_syscon_bind_of_platdata,
59};
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020060
61U_BOOT_DRIVER(rockchip_rk3368_sgrf) = {
62 .name = "rockchip_rk3368_sgrf",
63 .id = UCLASS_SYSCON,
64 .of_match = rk3368_syscon_ids + 3,
65 .bind = rk3368_syscon_bind_of_platdata,
66};
Philipp Tomsich036a8502017-06-22 23:25:57 +020067#endif