blob: 6df054e5b27dd656f568b5298ddb12322f58874e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Heiko Stübneref6db5e2017-02-18 19:46:36 +01002/*
3 * Copyright (C) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Heiko Stübneref6db5e2017-02-18 19:46:36 +01005 */
6
Heiko Stübneref6db5e2017-02-18 19:46:36 +01007#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Heiko Stübneref6db5e2017-02-18 19:46:36 +01009#include <syscon.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080010#include <asm/arch-rockchip/clock.h>
Heiko Stübneref6db5e2017-02-18 19:46:36 +010011
12static const struct udevice_id rk3188_syscon_ids[] = {
13 { .compatible = "rockchip,rk3188-noc", .data = ROCKCHIP_SYSCON_NOC },
14 { .compatible = "rockchip,rk3188-grf", .data = ROCKCHIP_SYSCON_GRF },
15 { .compatible = "rockchip,rk3188-pmu", .data = ROCKCHIP_SYSCON_PMU },
16 { }
17};
18
19U_BOOT_DRIVER(syscon_rk3188) = {
20 .name = "rk3188_syscon",
21 .id = UCLASS_SYSCON,
22 .of_match = rk3188_syscon_ids,
23};
24
25#if CONFIG_IS_ENABLED(OF_PLATDATA)
Simon Glassb75b15b2020-12-03 16:55:23 -070026static int rk3188_syscon_bind_of_plat(struct udevice *dev)
Heiko Stübneref6db5e2017-02-18 19:46:36 +010027{
28 dev->driver_data = dev->driver->of_match->data;
29 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
30
31 return 0;
32}
33
34U_BOOT_DRIVER(rockchip_rk3188_noc) = {
35 .name = "rockchip_rk3188_noc",
36 .id = UCLASS_SYSCON,
37 .of_match = rk3188_syscon_ids,
Simon Glassb75b15b2020-12-03 16:55:23 -070038 .bind = rk3188_syscon_bind_of_plat,
Heiko Stübneref6db5e2017-02-18 19:46:36 +010039};
40
41U_BOOT_DRIVER(rockchip_rk3188_grf) = {
42 .name = "rockchip_rk3188_grf",
43 .id = UCLASS_SYSCON,
44 .of_match = rk3188_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070045 .bind = rk3188_syscon_bind_of_plat,
Heiko Stübneref6db5e2017-02-18 19:46:36 +010046};
47
48U_BOOT_DRIVER(rockchip_rk3188_pmu) = {
49 .name = "rockchip_rk3188_pmu",
50 .id = UCLASS_SYSCON,
51 .of_match = rk3188_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070052 .bind = rk3188_syscon_bind_of_plat,
Heiko Stübneref6db5e2017-02-18 19:46:36 +010053};
54#endif