blob: dc2d831dd84fb7a1dab27b3f28eee7e8099f2d28 [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
Tom Riniabb9a042024-05-18 20:20:43 -06008#include <common.h>
Andreas Färber9e3ad682017-05-15 17:51:18 +08009#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -060010#include <log.h>
Andreas Färber9e3ad682017-05-15 17:51:18 +080011#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080012#include <asm/arch-rockchip/clock.h>
Andreas Färber9e3ad682017-05-15 17:51:18 +080013
14static const struct udevice_id rk3368_syscon_ids[] = {
15 { .compatible = "rockchip,rk3368-grf",
16 .data = ROCKCHIP_SYSCON_GRF },
17 { .compatible = "rockchip,rk3368-pmugrf",
18 .data = ROCKCHIP_SYSCON_PMUGRF },
Philipp Tomsich036a8502017-06-22 23:25:57 +020019 { .compatible = "rockchip,rk3368-msch",
20 .data = ROCKCHIP_SYSCON_MSCH },
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020021 { .compatible = "rockchip,rk3368-sgrf",
22 .data = ROCKCHIP_SYSCON_SGRF },
Andreas Färber9e3ad682017-05-15 17:51:18 +080023 { }
24};
25
26U_BOOT_DRIVER(syscon_rk3368) = {
27 .name = "rk3368_syscon",
28 .id = UCLASS_SYSCON,
29 .of_match = rk3368_syscon_ids,
30};
Philipp Tomsich036a8502017-06-22 23:25:57 +020031
32#if CONFIG_IS_ENABLED(OF_PLATDATA)
Simon Glassb75b15b2020-12-03 16:55:23 -070033static int rk3368_syscon_bind_of_plat(struct udevice *dev)
Philipp Tomsich036a8502017-06-22 23:25:57 +020034{
35 dev->driver_data = dev->driver->of_match->data;
36 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
37
38 return 0;
39}
40
41U_BOOT_DRIVER(rockchip_rk3368_grf) = {
42 .name = "rockchip_rk3368_grf",
43 .id = UCLASS_SYSCON,
44 .of_match = rk3368_syscon_ids,
Simon Glassb75b15b2020-12-03 16:55:23 -070045 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020046};
47
48U_BOOT_DRIVER(rockchip_rk3368_pmugrf) = {
49 .name = "rockchip_rk3368_pmugrf",
50 .id = UCLASS_SYSCON,
51 .of_match = rk3368_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070052 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020053};
54
55U_BOOT_DRIVER(rockchip_rk3368_msch) = {
56 .name = "rockchip_rk3368_msch",
57 .id = UCLASS_SYSCON,
58 .of_match = rk3368_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070059 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020060};
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020061
62U_BOOT_DRIVER(rockchip_rk3368_sgrf) = {
63 .name = "rockchip_rk3368_sgrf",
64 .id = UCLASS_SYSCON,
65 .of_match = rk3368_syscon_ids + 3,
Simon Glassb75b15b2020-12-03 16:55:23 -070066 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020067};
Philipp Tomsich036a8502017-06-22 23:25:57 +020068#endif