blob: 7389c02836412074072c4026a35c55dec8fde1c6 [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
Andreas Färber9e3ad682017-05-15 17:51:18 +08008#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.h>
Andreas Färber9e3ad682017-05-15 17:51:18 +080010#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)
Simon Glassb75b15b2020-12-03 16:55:23 -070032static int rk3368_syscon_bind_of_plat(struct udevice *dev)
Philipp Tomsich036a8502017-06-22 23:25:57 +020033{
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,
Simon Glassb75b15b2020-12-03 16:55:23 -070044 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020045};
46
47U_BOOT_DRIVER(rockchip_rk3368_pmugrf) = {
48 .name = "rockchip_rk3368_pmugrf",
49 .id = UCLASS_SYSCON,
50 .of_match = rk3368_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070051 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020052};
53
54U_BOOT_DRIVER(rockchip_rk3368_msch) = {
55 .name = "rockchip_rk3368_msch",
56 .id = UCLASS_SYSCON,
57 .of_match = rk3368_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070058 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich036a8502017-06-22 23:25:57 +020059};
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,
Simon Glassb75b15b2020-12-03 16:55:23 -070065 .bind = rk3368_syscon_bind_of_plat,
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020066};
Philipp Tomsich036a8502017-06-22 23:25:57 +020067#endif