Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2017 Rockchip Electronics Co., Ltd |
| 4 | * Author: Andy Yan <andy.yan@rock-chips.com> |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 5 | * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <dm.h> |
| 10 | #include <syscon.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 11 | #include <asm/arch-rockchip/clock.h> |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 12 | |
| 13 | static const struct udevice_id rk3368_syscon_ids[] = { |
| 14 | { .compatible = "rockchip,rk3368-grf", |
| 15 | .data = ROCKCHIP_SYSCON_GRF }, |
| 16 | { .compatible = "rockchip,rk3368-pmugrf", |
| 17 | .data = ROCKCHIP_SYSCON_PMUGRF }, |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 18 | { .compatible = "rockchip,rk3368-msch", |
| 19 | .data = ROCKCHIP_SYSCON_MSCH }, |
Philipp Tomsich | 4d1fe26 | 2017-07-28 11:37:57 +0200 | [diff] [blame] | 20 | { .compatible = "rockchip,rk3368-sgrf", |
| 21 | .data = ROCKCHIP_SYSCON_SGRF }, |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 22 | { } |
| 23 | }; |
| 24 | |
| 25 | U_BOOT_DRIVER(syscon_rk3368) = { |
| 26 | .name = "rk3368_syscon", |
| 27 | .id = UCLASS_SYSCON, |
| 28 | .of_match = rk3368_syscon_ids, |
| 29 | }; |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 30 | |
| 31 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
| 32 | static int rk3368_syscon_bind_of_platdata(struct udevice *dev) |
| 33 | { |
| 34 | dev->driver_data = dev->driver->of_match->data; |
| 35 | debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data); |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | U_BOOT_DRIVER(rockchip_rk3368_grf) = { |
| 41 | .name = "rockchip_rk3368_grf", |
| 42 | .id = UCLASS_SYSCON, |
| 43 | .of_match = rk3368_syscon_ids, |
| 44 | .bind = rk3368_syscon_bind_of_platdata, |
| 45 | }; |
| 46 | |
| 47 | U_BOOT_DRIVER(rockchip_rk3368_pmugrf) = { |
| 48 | .name = "rockchip_rk3368_pmugrf", |
| 49 | .id = UCLASS_SYSCON, |
| 50 | .of_match = rk3368_syscon_ids + 1, |
| 51 | .bind = rk3368_syscon_bind_of_platdata, |
| 52 | }; |
| 53 | |
| 54 | U_BOOT_DRIVER(rockchip_rk3368_msch) = { |
| 55 | .name = "rockchip_rk3368_msch", |
| 56 | .id = UCLASS_SYSCON, |
| 57 | .of_match = rk3368_syscon_ids + 2, |
| 58 | .bind = rk3368_syscon_bind_of_platdata, |
| 59 | }; |
Philipp Tomsich | 4d1fe26 | 2017-07-28 11:37:57 +0200 | [diff] [blame] | 60 | |
| 61 | U_BOOT_DRIVER(rockchip_rk3368_sgrf) = { |
| 62 | .name = "rockchip_rk3368_sgrf", |
| 63 | .id = UCLASS_SYSCON, |
| 64 | .of_match = rk3368_syscon_ids + 3, |
| 65 | .bind = rk3368_syscon_bind_of_platdata, |
| 66 | }; |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 67 | #endif |