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