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> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 10 | #include <log.h> |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 11 | #include <syscon.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 12 | #include <asm/arch-rockchip/clock.h> |
Andreas Färber | 9e3ad68 | 2017-05-15 17:51:18 +0800 | [diff] [blame] | 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) |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 33 | static int rk3368_syscon_bind_of_plat(struct udevice *dev) |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 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, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 45 | .bind = rk3368_syscon_bind_of_plat, |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 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, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 52 | .bind = rk3368_syscon_bind_of_plat, |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 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, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 59 | .bind = rk3368_syscon_bind_of_plat, |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 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, |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 66 | .bind = rk3368_syscon_bind_of_plat, |
Philipp Tomsich | 4d1fe26 | 2017-07-28 11:37:57 +0200 | [diff] [blame] | 67 | }; |
Philipp Tomsich | 036a850 | 2017-06-22 23:25:57 +0200 | [diff] [blame] | 68 | #endif |