drivers/clk/thead/clk-th1520-ap.c

Source file repositories/reference/linux-study-clean/drivers/clk/thead/clk-th1520-ap.c

File Facts

System
Linux kernel
Corpus path
drivers/clk/thead/clk-th1520-ap.c
Extension
.c
Size
43304 bytes
Lines
1645
Domain
Driver Families
Bucket
drivers/clk
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ccu_internal {
	u8	shift;
	u8	width;
};

struct ccu_div_internal {
	u8	shift;
	u8	width;
	u32	flags;
};

struct ccu_common {
	int		clkid;
	struct regmap	*map;
	u16		cfg0;
	u16		cfg1;
	struct clk_hw	hw;
};

struct ccu_mux {
	int			clkid;
	u32			reg;
	struct clk_mux		mux;
};

struct ccu_gate {
	int			clkid;
	u32			reg;
	struct clk_gate		gate;
};

struct ccu_div {
	u32			enable;
	u32			div_en;
	struct ccu_div_internal	div;
	struct ccu_internal	mux;
	struct ccu_common	common;
};

struct ccu_pll_cfg {
	unsigned long		freq;
	u32			fbdiv;
	u32			frac;
	u32			postdiv1;
	u32			postdiv2;
};

struct ccu_pll {
	struct ccu_common	common;
	u32			lock_sts_mask;
	int			cfgnum;
	const struct ccu_pll_cfg *cfgs;
};

#define TH_CCU_ARG(_shift, _width)					\
	{								\
		.shift	= _shift,					\
		.width	= _width,					\
	}

#define TH_CCU_DIV_FLAGS(_shift, _width, _flags)			\
	{								\
		.shift	= _shift,					\
		.width	= _width,					\
		.flags	= _flags,					\
	}

#define TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, _flags,	\
			 _mux_flags)					\
	{								\
		.mask		= GENMASK(_width - 1, 0),		\
		.shift		= _shift,				\
		.flags		= _mux_flags,				\
		.hw.init	= CLK_HW_INIT_PARENTS_DATA(		\
					_name,				\
					_parents,			\
					&clk_mux_ops,			\
					_flags),			\
	}

#define TH_CCU_MUX(_name, _parents, _shift, _width)			\
	TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, 0, 0)

#define CCU_GATE(_clkid, _struct, _name, _parent, _reg, _bit, _flags)	\
	struct ccu_gate _struct = {					\
		.clkid	= _clkid,					\
		.reg	= _reg,						\
		.gate	= {						\
			.bit_idx	= _bit,				\
			.hw.init	= CLK_HW_INIT_PARENTS_DATA(	\

Annotation

Implementation Notes