Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 Rockchip Electronics Co., Ltd |
Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <syscon.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 9 | #include <asm/arch-rockchip/clock.h> |
Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 10 | |
| 11 | static const struct udevice_id rk3399_syscon_ids[] = { |
| 12 | { .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF }, |
Kever Yang | e3eba16 | 2016-08-16 17:58:10 +0800 | [diff] [blame] | 13 | { .compatible = "rockchip,rk3399-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF }, |
Kever Yang | 62d01dc | 2017-02-13 17:38:59 +0800 | [diff] [blame] | 14 | { .compatible = "rockchip,rk3399-pmusgrf", .data = ROCKCHIP_SYSCON_PMUSGRF }, |
| 15 | { .compatible = "rockchip,rk3399-cic", .data = ROCKCHIP_SYSCON_CIC }, |
Jagan Teki | ee1e44f | 2019-07-16 17:27:33 +0530 | [diff] [blame] | 16 | { .compatible = "rockchip,rk3399-pmu", .data = ROCKCHIP_SYSCON_PMU }, |
eric.gao@rock-chips.com | c4d4f54 | 2017-04-10 09:53:31 +0800 | [diff] [blame] | 17 | { } |
Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | U_BOOT_DRIVER(syscon_rk3399) = { |
| 21 | .name = "rk3399_syscon", |
| 22 | .id = UCLASS_SYSCON, |
| 23 | .of_match = rk3399_syscon_ids, |
| 24 | }; |
Kever Yang | 62d01dc | 2017-02-13 17:38:59 +0800 | [diff] [blame] | 25 | |
| 26 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
| 27 | static int rk3399_syscon_bind_of_platdata(struct udevice *dev) |
| 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_rk3399_grf) = { |
| 36 | .name = "rockchip_rk3399_grf", |
| 37 | .id = UCLASS_SYSCON, |
| 38 | .of_match = rk3399_syscon_ids, |
| 39 | .bind = rk3399_syscon_bind_of_platdata, |
| 40 | }; |
| 41 | |
| 42 | U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = { |
| 43 | .name = "rockchip_rk3399_pmugrf", |
| 44 | .id = UCLASS_SYSCON, |
| 45 | .of_match = rk3399_syscon_ids + 1, |
| 46 | .bind = rk3399_syscon_bind_of_platdata, |
| 47 | }; |
| 48 | |
| 49 | U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = { |
| 50 | .name = "rockchip_rk3399_pmusgrf", |
| 51 | .id = UCLASS_SYSCON, |
| 52 | .of_match = rk3399_syscon_ids + 2, |
| 53 | .bind = rk3399_syscon_bind_of_platdata, |
| 54 | }; |
| 55 | |
| 56 | U_BOOT_DRIVER(rockchip_rk3399_cic) = { |
| 57 | .name = "rockchip_rk3399_cic", |
| 58 | .id = UCLASS_SYSCON, |
| 59 | .of_match = rk3399_syscon_ids + 3, |
| 60 | .bind = rk3399_syscon_bind_of_platdata, |
| 61 | }; |
Jagan Teki | ee1e44f | 2019-07-16 17:27:33 +0530 | [diff] [blame] | 62 | |
| 63 | U_BOOT_DRIVER(rockchip_rk3399_pmu) = { |
| 64 | .name = "rockchip_rk3399_pmu", |
| 65 | .id = UCLASS_SYSCON, |
| 66 | .of_match = rk3399_syscon_ids + 4, |
| 67 | .bind = rk3399_syscon_bind_of_platdata, |
| 68 | }; |
Kever Yang | 62d01dc | 2017-02-13 17:38:59 +0800 | [diff] [blame] | 69 | #endif |