drivers/clk/aspeed/clk-ast2700.c

Source file repositories/reference/linux-study-clean/drivers/clk/aspeed/clk-ast2700.c

File Facts

System
Linux kernel
Corpus path
drivers/clk/aspeed/clk-ast2700.c
Extension
.c
Size
34484 bytes
Lines
1056
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 ast2700_clk_fixed_factor_data {
	unsigned int mult;
	unsigned int div;
	int parent_id;
};

struct ast2700_clk_gate_data {
	int parent_id;
	u32 flags;
	u32 reg;
	u8 bit;
};

struct ast2700_clk_mux_data {
	const struct clk_hw **parent_hws;
	const unsigned int *parent_ids;
	unsigned int num_parents;
	u8 bit_shift;
	u8 bit_width;
	u32 reg;
};

struct ast2700_clk_div_data {
	const struct clk_div_table *div_table;
	unsigned int parent_id;
	u8 bit_shift;
	u8 bit_width;
	u32 reg;
};

struct ast2700_clk_pll_data {
	unsigned int parent_id;
	u32 reg;
};

struct ast2700_clk_fixed_rate_data {
	unsigned long fixed_rate;
};

struct ast2700_clk_display_fixed_data {
	u32 reg;
};

struct ast2700_clk_info {
	const char *name;
	u32 id;
	u32 reg;
	u32 type;
	union {
		struct ast2700_clk_fixed_factor_data factor;
		struct ast2700_clk_fixed_rate_data rate;
		struct ast2700_clk_display_fixed_data display_rate;
		struct ast2700_clk_gate_data gate;
		struct ast2700_clk_div_data div;
		struct ast2700_clk_pll_data pll;
		struct ast2700_clk_mux_data mux;
	} data;
};

struct ast2700_clk_data {
	const struct ast2700_clk_info *clk_info;
	unsigned int nr_clks;
	const int scu;
};

struct ast2700_clk_ctrl {
	const struct ast2700_clk_data *clk_data;
	struct device *dev;
	void __iomem *base;
	spinlock_t lock; /* clk lock */
};

static const struct clk_div_table ast2700_rgmii_div_table[] = {
	{ 0x0, 4 },
	{ 0x1, 4 },
	{ 0x2, 6 },
	{ 0x3, 8 },
	{ 0x4, 10 },
	{ 0x5, 12 },
	{ 0x6, 14 },
	{ 0x7, 16 },
	{ 0 }
};

static const struct clk_div_table ast2700_rmii_div_table[] = {
	{ 0x0, 8 },
	{ 0x1, 8 },
	{ 0x2, 12 },
	{ 0x3, 16 },
	{ 0x4, 20 },

Annotation

Implementation Notes