drivers/clk/davinci/da8xx-cfgchip.c
Source file repositories/reference/linux-study-clean/drivers/clk/davinci/da8xx-cfgchip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/davinci/da8xx-cfgchip.c- Extension
.c- Size
- 19717 bytes
- Lines
- 788
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk-provider.hlinux/clk.hlinux/clkdev.hlinux/init.hlinux/mfd/da8xx-cfgchip.hlinux/mfd/syscon.hlinux/of.hlinux/platform_data/clk-da8xx-cfgchip.hlinux/platform_device.hlinux/property.hlinux/regmap.hlinux/slab.h
Detected Declarations
struct da8xx_cfgchip_gate_clk_infostruct da8xx_cfgchip_gate_clkstruct da8xx_cfgchip_mux_clk_infostruct da8xx_cfgchip_mux_clkstruct da8xx_usb0_clk48struct da8xx_usb1_clk48function da8xx_cfgchip_gate_clk_enablefunction da8xx_cfgchip_gate_clk_disablefunction da8xx_cfgchip_gate_clk_is_enabledfunction da8xx_cfgchip_div4p5_recalc_ratefunction da8xx_cfgchip_gate_clk_registerfunction da8xx_cfgchip_register_tbclkfunction da8xx_cfgchip_register_div4p5function of_da8xx_cfgchip_gate_clk_initfunction of_da8xx_tbclksync_initfunction of_da8xx_div4p5ena_initfunction da8xx_cfgchip_mux_clk_set_parentfunction da8xx_cfgchip_mux_clk_get_parentfunction da8xx_cfgchip_mux_clk_registerfunction da8xx_cfgchip_register_async1function da850_cfgchip_register_async3function of_da8xx_cfgchip_init_mux_clockfunction of_da850_async1_initfunction of_da850_async3_initfunction da8xx_usb0_clk48_preparefunction da8xx_usb0_clk48_unpreparefunction da8xx_usb0_clk48_enablefunction da8xx_usb0_clk48_disablefunction da8xx_usb0_clk48_is_enabledfunction da8xx_usb0_clk48_recalc_ratefunction da8xx_usb0_clk48_determine_ratefunction da8xx_usb0_clk48_set_parentfunction da8xx_usb0_clk48_get_parentfunction da8xx_cfgchip_register_usb0_clk48function da8xx_usb1_clk48_set_parentfunction da8xx_usb1_clk48_get_parentfunction da8xx_cfgchip_register_usb1_clk48function da8xx_cfgchip_register_usb_phy_clkfunction of_da8xx_usb_phy_clk_initfunction da8xx_cfgchip_probefunction da8xx_cfgchip_driver_init
Annotated Snippet
struct da8xx_cfgchip_gate_clk_info {
const char *name;
u32 cfgchip;
u32 bit;
u32 flags;
};
struct da8xx_cfgchip_gate_clk {
struct clk_hw hw;
struct regmap *regmap;
u32 reg;
u32 mask;
};
#define to_da8xx_cfgchip_gate_clk(_hw) \
container_of((_hw), struct da8xx_cfgchip_gate_clk, hw)
static int da8xx_cfgchip_gate_clk_enable(struct clk_hw *hw)
{
struct da8xx_cfgchip_gate_clk *clk = to_da8xx_cfgchip_gate_clk(hw);
return regmap_write_bits(clk->regmap, clk->reg, clk->mask, clk->mask);
}
static void da8xx_cfgchip_gate_clk_disable(struct clk_hw *hw)
{
struct da8xx_cfgchip_gate_clk *clk = to_da8xx_cfgchip_gate_clk(hw);
regmap_write_bits(clk->regmap, clk->reg, clk->mask, 0);
}
static int da8xx_cfgchip_gate_clk_is_enabled(struct clk_hw *hw)
{
struct da8xx_cfgchip_gate_clk *clk = to_da8xx_cfgchip_gate_clk(hw);
unsigned int val;
regmap_read(clk->regmap, clk->reg, &val);
return !!(val & clk->mask);
}
static unsigned long da8xx_cfgchip_div4p5_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
/* this clock divides by 4.5 */
return parent_rate * 2 / 9;
}
static const struct clk_ops da8xx_cfgchip_gate_clk_ops = {
.enable = da8xx_cfgchip_gate_clk_enable,
.disable = da8xx_cfgchip_gate_clk_disable,
.is_enabled = da8xx_cfgchip_gate_clk_is_enabled,
};
static const struct clk_ops da8xx_cfgchip_div4p5_clk_ops = {
.enable = da8xx_cfgchip_gate_clk_enable,
.disable = da8xx_cfgchip_gate_clk_disable,
.is_enabled = da8xx_cfgchip_gate_clk_is_enabled,
.recalc_rate = da8xx_cfgchip_div4p5_recalc_rate,
};
static struct da8xx_cfgchip_gate_clk * __init
da8xx_cfgchip_gate_clk_register(struct device *dev,
const struct da8xx_cfgchip_gate_clk_info *info,
struct regmap *regmap)
{
struct clk *parent;
const char *parent_name;
struct da8xx_cfgchip_gate_clk *gate;
struct clk_init_data init;
int ret;
parent = devm_clk_get(dev, NULL);
if (IS_ERR(parent))
return ERR_CAST(parent);
parent_name = __clk_get_name(parent);
gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL);
if (!gate)
return ERR_PTR(-ENOMEM);
init.name = info->name;
if (info->flags & DA8XX_GATE_CLOCK_IS_DIV4P5)
init.ops = &da8xx_cfgchip_div4p5_clk_ops;
else
init.ops = &da8xx_cfgchip_gate_clk_ops;
init.parent_names = &parent_name;
init.num_parents = 1;
init.flags = 0;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/clk.h`, `linux/clkdev.h`, `linux/init.h`, `linux/mfd/da8xx-cfgchip.h`, `linux/mfd/syscon.h`, `linux/of.h`, `linux/platform_data/clk-da8xx-cfgchip.h`.
- Detected declarations: `struct da8xx_cfgchip_gate_clk_info`, `struct da8xx_cfgchip_gate_clk`, `struct da8xx_cfgchip_mux_clk_info`, `struct da8xx_cfgchip_mux_clk`, `struct da8xx_usb0_clk48`, `struct da8xx_usb1_clk48`, `function da8xx_cfgchip_gate_clk_enable`, `function da8xx_cfgchip_gate_clk_disable`, `function da8xx_cfgchip_gate_clk_is_enabled`, `function da8xx_cfgchip_div4p5_recalc_rate`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.