blob: 893a5234baa94750ea5575e9b8474260dfd6c236 [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
Heiko Stuebnerfc367852019-07-16 22:18:21 +02006#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -06007#include <log.h>
Heiko Stuebnerfc367852019-07-16 22:18:21 +02008#include <syscon.h>
9#include <asm/arch-rockchip/clock.h>
10
11static const struct udevice_id px30_syscon_ids[] = {
12 { .compatible = "rockchip,px30-pmu", .data = ROCKCHIP_SYSCON_PMU },
13 { .compatible = "rockchip,px30-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
14 { .compatible = "rockchip,px30-grf", .data = ROCKCHIP_SYSCON_GRF },
15 { }
16};
17
18U_BOOT_DRIVER(syscon_px30) = {
19 .id = UCLASS_SYSCON,
20 .name = "px30_syscon",
Quentin Schulz97192d02024-06-14 18:54:12 +020021#if CONFIG_IS_ENABLED(OF_REAL)
22 .bind = dm_scan_fdt_dev,
23#endif
Heiko Stuebnerfc367852019-07-16 22:18:21 +020024 .of_match = px30_syscon_ids,
25};
26
27#if CONFIG_IS_ENABLED(OF_PLATDATA)
Simon Glassb75b15b2020-12-03 16:55:23 -070028static int px30_syscon_bind_of_plat(struct udevice *dev)
Heiko Stuebnerfc367852019-07-16 22:18:21 +020029{
30 dev->driver_data = dev->driver->of_match->data;
31 debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
32
33 return 0;
34}
35
36U_BOOT_DRIVER(rockchip_px30_pmu) = {
37 .name = "rockchip_px30_pmu",
38 .id = UCLASS_SYSCON,
39 .of_match = px30_syscon_ids,
Simon Glassb75b15b2020-12-03 16:55:23 -070040 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020041};
42
43U_BOOT_DRIVER(rockchip_px30_pmugrf) = {
44 .name = "rockchip_px30_pmugrf",
45 .id = UCLASS_SYSCON,
46 .of_match = px30_syscon_ids + 1,
Simon Glassb75b15b2020-12-03 16:55:23 -070047 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020048};
49
50U_BOOT_DRIVER(rockchip_px30_grf) = {
51 .name = "rockchip_px30_grf",
52 .id = UCLASS_SYSCON,
53 .of_match = px30_syscon_ids + 2,
Simon Glassb75b15b2020-12-03 16:55:23 -070054 .bind = px30_syscon_bind_of_plat,
Heiko Stuebnerfc367852019-07-16 22:18:21 +020055};
56#endif