Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2016 Rockchip Electronics Co., Ltd |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <syscon.h> |
| 10 | #include <asm/arch/clock.h> |
| 11 | |
| 12 | static const struct udevice_id rk3399_syscon_ids[] = { |
| 13 | { .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF }, |
Kever Yang | e3eba16 | 2016-08-16 17:58:10 +0800 | [diff] [blame] | 14 | { .compatible = "rockchip,rk3399-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF }, |
Kever Yang | 62d01dc | 2017-02-13 17:38:59 +0800 | [diff] [blame^] | 15 | { .compatible = "rockchip,rk3399-pmusgrf", .data = ROCKCHIP_SYSCON_PMUSGRF }, |
| 16 | { .compatible = "rockchip,rk3399-cic", .data = ROCKCHIP_SYSCON_CIC }, |
Kever Yang | ca19eac | 2016-07-29 10:35:25 +0800 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | U_BOOT_DRIVER(syscon_rk3399) = { |
| 20 | .name = "rk3399_syscon", |
| 21 | .id = UCLASS_SYSCON, |
| 22 | .of_match = rk3399_syscon_ids, |
| 23 | }; |
Kever Yang | 62d01dc | 2017-02-13 17:38:59 +0800 | [diff] [blame^] | 24 | |
| 25 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
| 26 | static int rk3399_syscon_bind_of_platdata(struct udevice *dev) |
| 27 | { |
| 28 | dev->driver_data = dev->driver->of_match->data; |
| 29 | debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data); |
| 30 | |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | U_BOOT_DRIVER(rockchip_rk3399_grf) = { |
| 35 | .name = "rockchip_rk3399_grf", |
| 36 | .id = UCLASS_SYSCON, |
| 37 | .of_match = rk3399_syscon_ids, |
| 38 | .bind = rk3399_syscon_bind_of_platdata, |
| 39 | }; |
| 40 | |
| 41 | U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = { |
| 42 | .name = "rockchip_rk3399_pmugrf", |
| 43 | .id = UCLASS_SYSCON, |
| 44 | .of_match = rk3399_syscon_ids + 1, |
| 45 | .bind = rk3399_syscon_bind_of_platdata, |
| 46 | }; |
| 47 | |
| 48 | U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = { |
| 49 | .name = "rockchip_rk3399_pmusgrf", |
| 50 | .id = UCLASS_SYSCON, |
| 51 | .of_match = rk3399_syscon_ids + 2, |
| 52 | .bind = rk3399_syscon_bind_of_platdata, |
| 53 | }; |
| 54 | |
| 55 | U_BOOT_DRIVER(rockchip_rk3399_cic) = { |
| 56 | .name = "rockchip_rk3399_cic", |
| 57 | .id = UCLASS_SYSCON, |
| 58 | .of_match = rk3399_syscon_ids + 3, |
| 59 | .bind = rk3399_syscon_bind_of_platdata, |
| 60 | }; |
| 61 | #endif |