drivers/clk/mmp/clk-pxa1908-apmu.c
Source file repositories/reference/linux-study-clean/drivers/clk/mmp/clk-pxa1908-apmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/mmp/clk-pxa1908-apmu.c- Extension
.c- Size
- 4364 bytes
- Lines
- 129
- 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.
- 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.
- 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/auxiliary_bus.hlinux/clk-provider.hlinux/module.hlinux/platform_device.hlinux/spinlock.hdt-bindings/clock/marvell,pxa1908.hclk.h
Detected Declarations
struct pxa1908_clk_unitfunction pxa1908_axi_periph_clk_initfunction pxa1908_apmu_probe
Annotated Snippet
struct pxa1908_clk_unit {
struct mmp_clk_unit unit;
void __iomem *base;
};
static DEFINE_SPINLOCK(pll1_lock);
static struct mmp_param_general_gate_clk pll1_gate_clks[] = {
{PXA1908_CLK_PLL1_D2_GATE, "pll1_d2_gate", "pll1_d2", 0, APMU_CLK_GATE_CTRL, 29, 0, &pll1_lock},
{PXA1908_CLK_PLL1_416_GATE, "pll1_416_gate", "pll1_416", 0, APMU_CLK_GATE_CTRL, 27, 0, &pll1_lock},
{PXA1908_CLK_PLL1_624_GATE, "pll1_624_gate", "pll1_624", 0, APMU_CLK_GATE_CTRL, 26, 0, &pll1_lock},
{PXA1908_CLK_PLL1_832_GATE, "pll1_832_gate", "pll1_832", 0, APMU_CLK_GATE_CTRL, 30, 0, &pll1_lock},
{PXA1908_CLK_PLL1_1248_GATE, "pll1_1248_gate", "pll1_1248", 0, APMU_CLK_GATE_CTRL, 28, 0, &pll1_lock},
};
static DEFINE_SPINLOCK(sdh0_lock);
static DEFINE_SPINLOCK(sdh1_lock);
static DEFINE_SPINLOCK(sdh2_lock);
static const char * const sdh_parent_names[] = {"pll1_416", "pll1_624"};
static struct mmp_clk_mix_config sdh_mix_config = {
.reg_info = DEFINE_MIX_REG_INFO(3, 8, 2, 6, 11),
};
static struct mmp_param_gate_clk apmu_gate_clks[] = {
{PXA1908_CLK_USB, "usb_clk", NULL, 0, APMU_USB, 0x9, 0x9, 0x1, 0, NULL},
{PXA1908_CLK_SDH0, "sdh0_clk", "sdh0_mix_clk", CLK_SET_RATE_PARENT | CLK_SET_RATE_UNGATE, APMU_SDH0, 0x12, 0x12, 0x0, 0, &sdh0_lock},
{PXA1908_CLK_SDH1, "sdh1_clk", "sdh1_mix_clk", CLK_SET_RATE_PARENT | CLK_SET_RATE_UNGATE, APMU_SDH1, 0x12, 0x12, 0x0, 0, &sdh1_lock},
{PXA1908_CLK_SDH2, "sdh2_clk", "sdh2_mix_clk", CLK_SET_RATE_PARENT | CLK_SET_RATE_UNGATE, APMU_SDH2, 0x12, 0x12, 0x0, 0, &sdh2_lock}
};
static void pxa1908_axi_periph_clk_init(struct pxa1908_clk_unit *pxa_unit)
{
struct mmp_clk_unit *unit = &pxa_unit->unit;
mmp_register_general_gate_clks(unit, pll1_gate_clks,
pxa_unit->base, ARRAY_SIZE(pll1_gate_clks));
sdh_mix_config.reg_info.reg_clk_ctrl = pxa_unit->base + APMU_SDH0;
mmp_clk_register_mix(NULL, "sdh0_mix_clk", sdh_parent_names,
ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT,
&sdh_mix_config, &sdh0_lock);
sdh_mix_config.reg_info.reg_clk_ctrl = pxa_unit->base + APMU_SDH1;
mmp_clk_register_mix(NULL, "sdh1_mix_clk", sdh_parent_names,
ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT,
&sdh_mix_config, &sdh1_lock);
sdh_mix_config.reg_info.reg_clk_ctrl = pxa_unit->base + APMU_SDH2;
mmp_clk_register_mix(NULL, "sdh2_mix_clk", sdh_parent_names,
ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT,
&sdh_mix_config, &sdh2_lock);
mmp_register_gate_clks(unit, apmu_gate_clks, pxa_unit->base,
ARRAY_SIZE(apmu_gate_clks));
}
static int pxa1908_apmu_probe(struct platform_device *pdev)
{
struct pxa1908_clk_unit *pxa_unit;
struct auxiliary_device *adev;
pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL);
if (!pxa_unit)
return -ENOMEM;
pxa_unit->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pxa_unit->base))
return PTR_ERR(pxa_unit->base);
adev = devm_auxiliary_device_create(&pdev->dev, "power", NULL);
if (IS_ERR(adev))
return dev_err_probe(&pdev->dev, PTR_ERR(adev),
"Failed to register power controller\n");
mmp_clk_init(pdev->dev.of_node, &pxa_unit->unit, APMU_NR_CLKS);
pxa1908_axi_periph_clk_init(pxa_unit);
return 0;
}
static const struct of_device_id pxa1908_apmu_match_table[] = {
{ .compatible = "marvell,pxa1908-apmu" },
{ }
};
MODULE_DEVICE_TABLE(of, pxa1908_apmu_match_table);
static struct platform_driver pxa1908_apmu_driver = {
.probe = pxa1908_apmu_probe,
.driver = {
.name = "pxa1908-apmu",
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/clk-provider.h`, `linux/module.h`, `linux/platform_device.h`, `linux/spinlock.h`, `dt-bindings/clock/marvell,pxa1908.h`, `clk.h`.
- Detected declarations: `struct pxa1908_clk_unit`, `function pxa1908_axi_periph_clk_init`, `function pxa1908_apmu_probe`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source 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.