blob: 99d51f0edc0ff431c65860fe6616f30b3f79ea4b [file] [log] [blame]
Andreas Färber9e3ad682017-05-15 17:51:18 +08001/*
2 * (C) Copyright 2017 Rockchip Electronics Co., Ltd
3 * Author: Andy Yan <andy.yan@rock-chips.com>
Philipp Tomsich036a8502017-06-22 23:25:57 +02004 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
5 *
Andreas Färber9e3ad682017-05-15 17:51:18 +08006 * 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
14static 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 Tomsich036a8502017-06-22 23:25:57 +020019 { .compatible = "rockchip,rk3368-msch",
20 .data = ROCKCHIP_SYSCON_MSCH },
Philipp Tomsich4d1fe262017-07-28 11:37:57 +020021 { .compatible = "rockchip,rk3368-sgrf",
22 .data = ROCKCHIP_SYSCON_SGRF },
Andreas Färber9e3ad682017-05-15 17:51:18 +080023 { }
24};
25
26U_BOOT_DRIVER(syscon_rk3368) = {
27 .name = "rk3368_syscon",
28 .id = UCLASS_SYSCON,
29 .of_match = rk3368_syscon_ids,
30};
Philipp Tomsich036a8502017-06-22 23:25:57 +020031
32#if CONFIG_IS_ENABLED(OF_PLATDATA)
33static 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
41U_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
48U_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
55U_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 Tomsich4d1fe262017-07-28 11:37:57 +020061
62U_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 Tomsich036a8502017-06-22 23:25:57 +020068#endif