Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 19c58cf | 2015-08-30 16:55:34 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 19c58cf | 2015-08-30 16:55:34 -0600 | [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> |
Simon Glass | 19c58cf | 2015-08-30 16:55:34 -0600 | [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> |
Simon Glass | 19c58cf | 2015-08-30 16:55:34 -0600 | [diff] [blame] | 12 | |
| 13 | static const struct udevice_id rk3288_syscon_ids[] = { |
| 14 | { .compatible = "rockchip,rk3288-noc", .data = ROCKCHIP_SYSCON_NOC }, |
| 15 | { .compatible = "rockchip,rk3288-grf", .data = ROCKCHIP_SYSCON_GRF }, |
| 16 | { .compatible = "rockchip,rk3288-sgrf", .data = ROCKCHIP_SYSCON_SGRF }, |
| 17 | { .compatible = "rockchip,rk3288-pmu", .data = ROCKCHIP_SYSCON_PMU }, |
| 18 | { } |
| 19 | }; |
| 20 | |
| 21 | U_BOOT_DRIVER(syscon_rk3288) = { |
| 22 | .name = "rk3288_syscon", |
| 23 | .id = UCLASS_SYSCON, |
| 24 | .of_match = rk3288_syscon_ids, |
| 25 | }; |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 26 | |
| 27 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 28 | static int rk3288_syscon_bind_of_plat(struct udevice *dev) |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 29 | { |
| 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 | |
| 36 | U_BOOT_DRIVER(rockchip_rk3288_noc) = { |
| 37 | .name = "rockchip_rk3288_noc", |
| 38 | .id = UCLASS_SYSCON, |
| 39 | .of_match = rk3288_syscon_ids, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 40 | .bind = rk3288_syscon_bind_of_plat, |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | U_BOOT_DRIVER(rockchip_rk3288_grf) = { |
| 44 | .name = "rockchip_rk3288_grf", |
| 45 | .id = UCLASS_SYSCON, |
| 46 | .of_match = rk3288_syscon_ids + 1, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 47 | .bind = rk3288_syscon_bind_of_plat, |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | U_BOOT_DRIVER(rockchip_rk3288_sgrf) = { |
| 51 | .name = "rockchip_rk3288_sgrf", |
| 52 | .id = UCLASS_SYSCON, |
| 53 | .of_match = rk3288_syscon_ids + 2, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 54 | .bind = rk3288_syscon_bind_of_plat, |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | U_BOOT_DRIVER(rockchip_rk3288_pmu) = { |
| 58 | .name = "rockchip_rk3288_pmu", |
| 59 | .id = UCLASS_SYSCON, |
| 60 | .of_match = rk3288_syscon_ids + 3, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 61 | .bind = rk3288_syscon_bind_of_plat, |
Simon Glass | d63ea43 | 2016-07-04 11:58:33 -0600 | [diff] [blame] | 62 | }; |
| 63 | #endif |