2018-12-22 16:02:49 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Amarula Solutions.
|
|
|
|
* Author: Jagan Teki <jagan@amarulasolutions.com>
|
|
|
|
*/
|
|
|
|
|
2021-09-12 16:48:43 +00:00
|
|
|
#ifndef _CLK_SUNXI_H
|
|
|
|
#define _CLK_SUNXI_H
|
2018-12-22 16:02:49 +00:00
|
|
|
|
2020-05-10 17:40:13 +00:00
|
|
|
#include <linux/bitops.h>
|
|
|
|
|
2018-12-22 16:02:49 +00:00
|
|
|
/**
|
2019-01-18 16:48:13 +00:00
|
|
|
* enum ccu_flags - ccu clock/reset flags
|
2018-12-22 16:02:49 +00:00
|
|
|
*
|
|
|
|
* @CCU_CLK_F_IS_VALID: is given clock gate is valid?
|
2019-01-18 16:48:13 +00:00
|
|
|
* @CCU_RST_F_IS_VALID: is given reset control is valid?
|
2018-12-22 16:02:49 +00:00
|
|
|
*/
|
|
|
|
enum ccu_flags {
|
|
|
|
CCU_CLK_F_IS_VALID = BIT(0),
|
2019-01-18 16:48:13 +00:00
|
|
|
CCU_RST_F_IS_VALID = BIT(1),
|
2022-05-05 00:25:43 +00:00
|
|
|
CCU_CLK_F_DUMMY_GATE = BIT(2),
|
2018-12-22 16:02:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct ccu_clk_gate - ccu clock gate
|
|
|
|
* @off: gate offset
|
|
|
|
* @bit: gate bit
|
|
|
|
* @flags: ccu clock gate flags
|
|
|
|
*/
|
|
|
|
struct ccu_clk_gate {
|
|
|
|
u16 off;
|
|
|
|
u32 bit;
|
|
|
|
enum ccu_flags flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GATE(_off, _bit) { \
|
|
|
|
.off = _off, \
|
|
|
|
.bit = _bit, \
|
|
|
|
.flags = CCU_CLK_F_IS_VALID, \
|
|
|
|
}
|
|
|
|
|
2022-05-05 00:25:43 +00:00
|
|
|
#define GATE_DUMMY { \
|
|
|
|
.flags = CCU_CLK_F_DUMMY_GATE, \
|
|
|
|
}
|
|
|
|
|
2019-01-18 16:48:13 +00:00
|
|
|
/**
|
|
|
|
* struct ccu_reset - ccu reset
|
|
|
|
* @off: reset offset
|
|
|
|
* @bit: reset bit
|
|
|
|
* @flags: ccu reset control flags
|
|
|
|
*/
|
|
|
|
struct ccu_reset {
|
|
|
|
u16 off;
|
|
|
|
u32 bit;
|
|
|
|
enum ccu_flags flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RESET(_off, _bit) { \
|
|
|
|
.off = _off, \
|
|
|
|
.bit = _bit, \
|
|
|
|
.flags = CCU_RST_F_IS_VALID, \
|
|
|
|
}
|
|
|
|
|
2018-12-22 16:02:49 +00:00
|
|
|
/**
|
|
|
|
* struct ccu_desc - clock control unit descriptor
|
|
|
|
*
|
|
|
|
* @gates: clock gates
|
2019-01-18 16:48:13 +00:00
|
|
|
* @resets: reset unit
|
2018-12-22 16:02:49 +00:00
|
|
|
*/
|
|
|
|
struct ccu_desc {
|
|
|
|
const struct ccu_clk_gate *gates;
|
2019-01-18 16:48:13 +00:00
|
|
|
const struct ccu_reset *resets;
|
2022-05-09 05:29:31 +00:00
|
|
|
u8 num_gates;
|
|
|
|
u8 num_resets;
|
2018-12-22 16:02:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2022-05-09 05:29:35 +00:00
|
|
|
* struct ccu_plat - sunxi clock control unit platform data
|
2018-12-22 16:02:49 +00:00
|
|
|
*
|
|
|
|
* @base: base address
|
|
|
|
* @desc: ccu descriptor
|
|
|
|
*/
|
2022-05-09 05:29:35 +00:00
|
|
|
struct ccu_plat {
|
2018-12-22 16:02:49 +00:00
|
|
|
void *base;
|
|
|
|
const struct ccu_desc *desc;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct clk_ops sunxi_clk_ops;
|
|
|
|
|
2021-09-12 16:48:43 +00:00
|
|
|
#endif /* _CLK_SUNXI_H */
|