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>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_ARCH_CCU_H
|
|
|
|
#define _ASM_ARCH_CCU_H
|
|
|
|
|
2020-05-10 17:40:13 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#endif
|
|
|
|
|
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),
|
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, \
|
|
|
|
}
|
|
|
|
|
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;
|
2018-12-22 16:02:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct ccu_priv - sunxi clock control unit
|
|
|
|
*
|
|
|
|
* @base: base address
|
|
|
|
* @desc: ccu descriptor
|
|
|
|
*/
|
|
|
|
struct ccu_priv {
|
|
|
|
void *base;
|
|
|
|
const struct ccu_desc *desc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sunxi_clk_probe - common sunxi clock probe
|
|
|
|
* @dev: clock device
|
|
|
|
*/
|
|
|
|
int sunxi_clk_probe(struct udevice *dev);
|
|
|
|
|
|
|
|
extern struct clk_ops sunxi_clk_ops;
|
|
|
|
|
2019-01-18 16:48:13 +00:00
|
|
|
/**
|
|
|
|
* sunxi_reset_bind() - reset binding
|
|
|
|
*
|
|
|
|
* @dev: reset device
|
|
|
|
* @count: reset count
|
|
|
|
* @return 0 success, or error value
|
|
|
|
*/
|
|
|
|
int sunxi_reset_bind(struct udevice *dev, ulong count);
|
|
|
|
|
2018-12-22 16:02:49 +00:00
|
|
|
#endif /* _ASM_ARCH_CCU_H */
|