arch/powerpc/platforms/512x/clock-commonclk.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/512x/clock-commonclk.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/512x/clock-commonclk.c- Extension
.c- Size
- 36649 bytes
- Lines
- 1225
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/clk.hlinux/clk-provider.hlinux/clkdev.hlinux/device.hlinux/errno.hlinux/io.hlinux/of.hlinux/of_address.hasm/mpc5121.hdt-bindings/clock/mpc512x-clock.hmpc512x.h
Detected Declarations
struct mclk_setup_dataenum mclk_typeenum did_reg_flagsfunction mpc512x_clk_determine_socfunction soc_has_mbxfunction soc_has_axefunction soc_has_viufunction soc_has_spdiffunction soc_has_patafunction soc_has_satafunction soc_has_pcifunction soc_has_fec2function soc_max_pscnumfunction soc_has_sdhc2function soc_has_nfc_5125function soc_has_outclkfunction soc_has_cpmf_0_bypassfunction soc_has_mclk_mux0_caninfunction get_bit_fieldfunction get_spmf_multfunction get_sys_div_x2function get_cpmf_mult_x2function get_freq_from_dtfunction mpc512x_clk_preset_datafunction clockfunction REFfunction mpc512x_clk_setup_mclkfunction mpc512x_clk_setup_clock_treefunction clocksfunction mpc5121_clk_provide_migration_supportfunction failsfunction FOR_NODESfunction FOR_NODESfunction FOR_NODESfunction FOR_NODESfunction conflictfunction FOR_NODESfunction FOR_NODESfunction FOR_NODESfunction FOR_NODESfunction FOR_NODESfunction time_init
Annotated Snippet
struct mclk_setup_data {
enum mclk_type type;
bool has_mclk1;
const char *name_mux0;
const char *name_en0;
const char *name_div0;
const char *parent_names_mux1[2];
const char *name_mclk;
};
#define MCLK_SETUP_DATA_PSC(id) { \
MCLK_TYPE_PSC, 0, \
"psc" #id "-mux0", \
"psc" #id "-en0", \
"psc" #id "_mclk_div", \
{ "psc" #id "_mclk_div", "dummy", }, \
"psc" #id "_mclk", \
}
#define MCLK_SETUP_DATA_MSCAN(id) { \
MCLK_TYPE_MSCAN, 0, \
"mscan" #id "-mux0", \
"mscan" #id "-en0", \
"mscan" #id "_mclk_div", \
{ "mscan" #id "_mclk_div", "dummy", }, \
"mscan" #id "_mclk", \
}
#define MCLK_SETUP_DATA_SPDIF { \
MCLK_TYPE_SPDIF, 1, \
"spdif-mux0", \
"spdif-en0", \
"spdif_mclk_div", \
{ "spdif_mclk_div", "spdif-rx", }, \
"spdif_mclk", \
}
#define MCLK_SETUP_DATA_OUTCLK(id) { \
MCLK_TYPE_OUTCLK, 0, \
"out" #id "-mux0", \
"out" #id "-en0", \
"out" #id "_mclk_div", \
{ "out" #id "_mclk_div", "dummy", }, \
"out" #id "_clk", \
}
static struct mclk_setup_data mclk_psc_data[] = {
MCLK_SETUP_DATA_PSC(0),
MCLK_SETUP_DATA_PSC(1),
MCLK_SETUP_DATA_PSC(2),
MCLK_SETUP_DATA_PSC(3),
MCLK_SETUP_DATA_PSC(4),
MCLK_SETUP_DATA_PSC(5),
MCLK_SETUP_DATA_PSC(6),
MCLK_SETUP_DATA_PSC(7),
MCLK_SETUP_DATA_PSC(8),
MCLK_SETUP_DATA_PSC(9),
MCLK_SETUP_DATA_PSC(10),
MCLK_SETUP_DATA_PSC(11),
};
static struct mclk_setup_data mclk_mscan_data[] = {
MCLK_SETUP_DATA_MSCAN(0),
MCLK_SETUP_DATA_MSCAN(1),
MCLK_SETUP_DATA_MSCAN(2),
MCLK_SETUP_DATA_MSCAN(3),
};
static struct mclk_setup_data mclk_spdif_data[] = {
MCLK_SETUP_DATA_SPDIF,
};
static struct mclk_setup_data mclk_outclk_data[] = {
MCLK_SETUP_DATA_OUTCLK(0),
MCLK_SETUP_DATA_OUTCLK(1),
MCLK_SETUP_DATA_OUTCLK(2),
MCLK_SETUP_DATA_OUTCLK(3),
};
/* setup the MCLK clock subtree of an individual PSC/MSCAN/SPDIF */
static void __init mpc512x_clk_setup_mclk(struct mclk_setup_data *entry, size_t idx)
{
size_t clks_idx_pub, clks_idx_int;
u32 __iomem *mccr_reg; /* MCLK control register (mux, en, div) */
int div;
/* derive a few parameters from the component type and index */
switch (entry->type) {
case MCLK_TYPE_PSC:
clks_idx_pub = MPC512x_CLK_PSC0_MCLK + idx;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/clkdev.h`, `linux/device.h`, `linux/errno.h`, `linux/io.h`, `linux/of.h`.
- Detected declarations: `struct mclk_setup_data`, `enum mclk_type`, `enum did_reg_flags`, `function mpc512x_clk_determine_soc`, `function soc_has_mbx`, `function soc_has_axe`, `function soc_has_viu`, `function soc_has_spdif`, `function soc_has_pata`, `function soc_has_sata`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.