blob: 599ea66e3d67d7761188de389a13f3fbd0e518fe [file] [log] [blame]
Jagan Teki249a2382022-12-14 23:21:05 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
4 * Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd.
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <log.h>
10#include <syscon.h>
11#include <asm/arch-rockchip/clock.h>
12
13static const struct udevice_id rv1126_syscon_ids[] = {
14 { .compatible = "rockchip,rv1126-grf", .data = ROCKCHIP_SYSCON_GRF },
15 { .compatible = "rockchip,rv1126-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
16 { }
17};
18
19U_BOOT_DRIVER(syscon_rv1126) = {
20 .name = "rv1126_syscon",
21 .id = UCLASS_SYSCON,
22 .of_match = rv1126_syscon_ids,
23};
24
25#if CONFIG_IS_ENABLED(OF_PLATDATA)
26static int rv1126_syscon_bind_of_plat(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
34U_BOOT_DRIVER(rockchip_rv1126_pmu) = {
35 .name = "rockchip_rv1126_pmu",
36 .id = UCLASS_SYSCON,
37 .of_match = rv1126_syscon_ids,
38 .bind = rv1126_syscon_bind_of_plat,
39};
40
41U_BOOT_DRIVER(rockchip_rv1126_pmugrf) = {
42 .name = "rockchip_rv1126_pmugrf",
43 .id = UCLASS_SYSCON,
44 .of_match = rv1126_syscon_ids + 1,
45 .bind = rv1126_syscon_bind_of_plat,
46};
47#endif