1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018 Amarula Solutions.
4 * Author: Jagan Teki <jagan@amarulasolutions.com>
8 #include <clk-uclass.h>
11 #include <asm/arch/ccu.h>
12 #include <dt-bindings/clock/sun9i-a80-ccu.h>
13 #include <dt-bindings/reset/sun9i-a80-ccu.h>
15 static const struct ccu_clk_gate a80_gates[] = {
16 [CLK_BUS_UART0] = GATE(0x594, BIT(16)),
17 [CLK_BUS_UART1] = GATE(0x594, BIT(17)),
18 [CLK_BUS_UART2] = GATE(0x594, BIT(18)),
19 [CLK_BUS_UART3] = GATE(0x594, BIT(19)),
20 [CLK_BUS_UART4] = GATE(0x594, BIT(20)),
21 [CLK_BUS_UART5] = GATE(0x594, BIT(21)),
24 static const struct ccu_reset a80_resets[] = {
25 [RST_BUS_UART0] = RESET(0x5b4, BIT(16)),
26 [RST_BUS_UART1] = RESET(0x5b4, BIT(17)),
27 [RST_BUS_UART2] = RESET(0x5b4, BIT(18)),
28 [RST_BUS_UART3] = RESET(0x5b4, BIT(19)),
29 [RST_BUS_UART4] = RESET(0x5b4, BIT(20)),
30 [RST_BUS_UART5] = RESET(0x5b4, BIT(21)),
33 static const struct ccu_desc a80_ccu_desc = {
38 static int a80_clk_bind(struct udevice *dev)
40 return sunxi_reset_bind(dev, ARRAY_SIZE(a80_resets));
43 static const struct udevice_id a80_ccu_ids[] = {
44 { .compatible = "allwinner,sun9i-a80-ccu",
45 .data = (ulong)&a80_ccu_desc },
49 U_BOOT_DRIVER(clk_sun9i_a80) = {
50 .name = "sun9i_a80_ccu",
52 .of_match = a80_ccu_ids,
53 .priv_auto_alloc_size = sizeof(struct ccu_priv),
54 .ops = &sunxi_clk_ops,
55 .probe = sunxi_clk_probe,