blob: 37e88f5ccb912c2648da7cc3bb1d829ff87eb237 [file] [log] [blame]
Heiko Stuebnerfc367852019-07-16 22:18:21 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * (C) Copyright 2017 Rockchip Electronics Co., Ltd
4 */
5
6#include <common.h>
7#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Heiko Stuebnerfc367852019-07-16 22:18:21 +02009#include <syscon.h>
10#include <asm/arch-rockchip/clock.h>
11
12static const struct udevice_id px30_syscon_ids[] = {
13 { .compatible = "rockchip,px30-pmu", .data = ROCKCHIP_SYSCON_PMU },
14 { .compatible = "rockchip,px30-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
15 { .compatible = "rockchip,px30-grf", .data = ROCKCHIP_SYSCON_GRF },
16 { }
17};
18
19U_BOOT_DRIVER(syscon_px30) = {
20 .id = UCLASS_SYSCON,
21 .name = "px30_syscon",
22 .of_match = px30_syscon_ids,
23};
24
25#if CONFIG_IS_ENABLED(OF_PLATDATA)
Simon Glassb75b15b2020-12-03 16:55:23 -070026static int px30_syscon_bind_of_plat(struct udevice *dev)
Heiko Stuebnerfc367852019-07-16 22:18:21 +020027{
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_px30_pmu) = {
35 .name = "rockchip_px30_pmu",
36 .id = UCLASS_SYSCON,
37 .of_match = px30_syscon_ids,
Simon Glassb75b15b2020-12-03 16:55:23 -070038 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020039};
40
41U_BOOT_DRIVER(rockchip_px30_pmugrf) = {
42 .name = "rockchip_px30_pmugrf",
43 .id = UCLASS_SYSCON,
44 .of_match = px30_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070045 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020046};
47
48U_BOOT_DRIVER(rockchip_px30_grf) = {
49 .name = "rockchip_px30_grf",
50 .id = UCLASS_SYSCON,
51 .of_match = px30_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070052 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020053};
54#endif