Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * (C) Copyright 2017 Rockchip Electronics Co., Ltd |
| 4 | */ |
| 5 | |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 6 | #include <dm.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 7 | #include <log.h> |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 8 | #include <syscon.h> |
| 9 | #include <asm/arch-rockchip/clock.h> |
| 10 | |
| 11 | static 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 | |
| 18 | U_BOOT_DRIVER(syscon_px30) = { |
| 19 | .id = UCLASS_SYSCON, |
| 20 | .name = "px30_syscon", |
| 21 | .of_match = px30_syscon_ids, |
| 22 | }; |
| 23 | |
| 24 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 25 | static int px30_syscon_bind_of_plat(struct udevice *dev) |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 26 | { |
| 27 | dev->driver_data = dev->driver->of_match->data; |
| 28 | debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | U_BOOT_DRIVER(rockchip_px30_pmu) = { |
| 34 | .name = "rockchip_px30_pmu", |
| 35 | .id = UCLASS_SYSCON, |
| 36 | .of_match = px30_syscon_ids, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 37 | .bind = px30_syscon_bind_of_plat, |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | U_BOOT_DRIVER(rockchip_px30_pmugrf) = { |
| 41 | .name = "rockchip_px30_pmugrf", |
| 42 | .id = UCLASS_SYSCON, |
| 43 | .of_match = px30_syscon_ids + 1, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 44 | .bind = px30_syscon_bind_of_plat, |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | U_BOOT_DRIVER(rockchip_px30_grf) = { |
| 48 | .name = "rockchip_px30_grf", |
| 49 | .id = UCLASS_SYSCON, |
| 50 | .of_match = px30_syscon_ids + 2, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 51 | .bind = px30_syscon_bind_of_plat, |
Heiko Stuebner | fc36785 | 2019-07-16 22:18:21 +0200 | [diff] [blame] | 52 | }; |
| 53 | #endif |