Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 9 | #include <log.h> |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 10 | #include <syscon.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 11 | #include <asm/arch-rockchip/clock.h> |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 12 | |
| 13 | static const struct udevice_id rk3188_syscon_ids[] = { |
| 14 | { .compatible = "rockchip,rk3188-noc", .data = ROCKCHIP_SYSCON_NOC }, |
| 15 | { .compatible = "rockchip,rk3188-grf", .data = ROCKCHIP_SYSCON_GRF }, |
| 16 | { .compatible = "rockchip,rk3188-pmu", .data = ROCKCHIP_SYSCON_PMU }, |
| 17 | { } |
| 18 | }; |
| 19 | |
| 20 | U_BOOT_DRIVER(syscon_rk3188) = { |
| 21 | .name = "rk3188_syscon", |
| 22 | .id = UCLASS_SYSCON, |
| 23 | .of_match = rk3188_syscon_ids, |
| 24 | }; |
| 25 | |
| 26 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 27 | static int rk3188_syscon_bind_of_plat(struct udevice *dev) |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 28 | { |
| 29 | dev->driver_data = dev->driver->of_match->data; |
| 30 | debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data); |
| 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | U_BOOT_DRIVER(rockchip_rk3188_noc) = { |
| 36 | .name = "rockchip_rk3188_noc", |
| 37 | .id = UCLASS_SYSCON, |
| 38 | .of_match = rk3188_syscon_ids, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 39 | .bind = rk3188_syscon_bind_of_plat, |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | U_BOOT_DRIVER(rockchip_rk3188_grf) = { |
| 43 | .name = "rockchip_rk3188_grf", |
| 44 | .id = UCLASS_SYSCON, |
| 45 | .of_match = rk3188_syscon_ids + 1, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 46 | .bind = rk3188_syscon_bind_of_plat, |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | U_BOOT_DRIVER(rockchip_rk3188_pmu) = { |
| 50 | .name = "rockchip_rk3188_pmu", |
| 51 | .id = UCLASS_SYSCON, |
| 52 | .of_match = rk3188_syscon_ids + 2, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 53 | .bind = rk3188_syscon_bind_of_plat, |
Heiko Stübner | ef6db5e | 2017-02-18 19:46:36 +0100 | [diff] [blame] | 54 | }; |
| 55 | #endif |