1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) Samuel Holland <samuel@sholland.org>
4 */
5
6#include <clk-uclass.h>
7#include <dm.h>
8#include <clk/sunxi.h>
9#include <dt-bindings/clock/sun8i-r-ccu.h>
10#include <dt-bindings/reset/sun8i-r-ccu.h>
11#include <linux/bitops.h>
12
13static struct ccu_clk_gate a31_r_gates[] = {
14	[CLK_APB0_PIO]		= GATE(0x028, BIT(0)),
15	[CLK_APB0_IR]		= GATE(0x028, BIT(1)),
16	[CLK_APB0_TIMER]	= GATE(0x028, BIT(2)),
17	[CLK_APB0_RSB]		= GATE(0x028, BIT(3)),
18	[CLK_APB0_UART]		= GATE(0x028, BIT(4)),
19	[CLK_APB0_I2C]		= GATE(0x028, BIT(6)),
20	[CLK_APB0_TWD]		= GATE(0x028, BIT(7)),
21};
22
23static struct ccu_reset a31_r_resets[] = {
24	[RST_APB0_IR]		= RESET(0x0b0, BIT(1)),
25	[RST_APB0_TIMER]	= RESET(0x0b0, BIT(2)),
26	[RST_APB0_RSB]		= RESET(0x0b0, BIT(3)),
27	[RST_APB0_UART]		= RESET(0x0b0, BIT(4)),
28	[RST_APB0_I2C]		= RESET(0x0b0, BIT(6)),
29};
30
31const struct ccu_desc a31_r_ccu_desc = {
32	.gates = a31_r_gates,
33	.resets = a31_r_resets,
34	.num_gates = ARRAY_SIZE(a31_r_gates),
35	.num_resets = ARRAY_SIZE(a31_r_resets),
36};
37