arch/powerpc/platforms/8xx/cpm1.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/8xx/cpm1.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/8xx/cpm1.c- Extension
.c- Size
- 16070 bytes
- Lines
- 669
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/errno.hlinux/sched.hlinux/kernel.hlinux/dma-mapping.hlinux/param.hlinux/string.hlinux/mm.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/spinlock.hlinux/slab.hlinux/of_irq.hasm/page.hasm/8xx_immap.hasm/cpm1.hasm/io.hasm/rheap.hasm/cpm.hasm/fixmap.hsysdev/fsl_soc.hlinux/gpio/driver.h
Detected Declarations
struct cpm_ioport16struct cpm_ioport32bstruct cpm_ioport32estruct cpm1_gpio16_chipstruct cpm1_gpio32_chipfunction cpm_resetfunction cpm_commandfunction cpm_setbrgfunction cpm1_set_pin32function cpm1_set_pin16function cpm1_set_pinfunction cpm1_clk_setupfunction cpm1_gpio16_save_regsfunction cpm1_gpio16_getfunction __cpm1_gpio16_setfunction cpm1_gpio16_setfunction cpm1_gpio16_to_irqfunction cpm1_gpio16_dir_outfunction cpm1_gpio16_dir_infunction cpm1_gpio16_get_directionfunction cpm1_gpiochip_add16function cpm1_gpio32_save_regsfunction cpm1_gpio32_getfunction __cpm1_gpio32_setfunction cpm1_gpio32_setfunction cpm1_gpio32_dir_outfunction cpm1_gpio32_dir_infunction cpm1_gpio32_get_directionfunction cpm1_gpiochip_add32export cpm_commandexport cpm_setbrg
Annotated Snippet
struct cpm_ioport16 {
__be16 dir, par, odr_sor, dat, intr;
__be16 res[3];
};
struct cpm_ioport32b {
__be32 dir, par, odr, dat;
};
struct cpm_ioport32e {
__be32 dir, par, sor, odr, dat;
};
static void __init cpm1_set_pin32(int port, int pin, int flags)
{
struct cpm_ioport32e __iomem *iop;
pin = 1 << (31 - pin);
if (port == CPM_PORTB)
iop = (struct cpm_ioport32e __iomem *)
&mpc8xx_immr->im_cpm.cp_pbdir;
else
iop = (struct cpm_ioport32e __iomem *)
&mpc8xx_immr->im_cpm.cp_pedir;
if (flags & CPM_PIN_OUTPUT)
setbits32(&iop->dir, pin);
else
clrbits32(&iop->dir, pin);
if (!(flags & CPM_PIN_GPIO))
setbits32(&iop->par, pin);
else
clrbits32(&iop->par, pin);
if (port == CPM_PORTB) {
if (flags & CPM_PIN_OPENDRAIN)
setbits16(&mpc8xx_immr->im_cpm.cp_pbodr, pin);
else
clrbits16(&mpc8xx_immr->im_cpm.cp_pbodr, pin);
}
if (port == CPM_PORTE) {
if (flags & CPM_PIN_SECONDARY)
setbits32(&iop->sor, pin);
else
clrbits32(&iop->sor, pin);
if (flags & CPM_PIN_OPENDRAIN)
setbits32(&mpc8xx_immr->im_cpm.cp_peodr, pin);
else
clrbits32(&mpc8xx_immr->im_cpm.cp_peodr, pin);
}
}
static void __init cpm1_set_pin16(int port, int pin, int flags)
{
struct cpm_ioport16 __iomem *iop =
(struct cpm_ioport16 __iomem *)&mpc8xx_immr->im_ioport;
pin = 1 << (15 - pin);
if (port != 0)
iop += port - 1;
if (flags & CPM_PIN_OUTPUT)
setbits16(&iop->dir, pin);
else
clrbits16(&iop->dir, pin);
if (!(flags & CPM_PIN_GPIO))
setbits16(&iop->par, pin);
else
clrbits16(&iop->par, pin);
if (port == CPM_PORTA) {
if (flags & CPM_PIN_OPENDRAIN)
setbits16(&iop->odr_sor, pin);
else
clrbits16(&iop->odr_sor, pin);
}
if (port == CPM_PORTC) {
if (flags & CPM_PIN_SECONDARY)
setbits16(&iop->odr_sor, pin);
else
clrbits16(&iop->odr_sor, pin);
if (flags & CPM_PIN_FALLEDGE)
setbits16(&iop->intr, pin);
else
clrbits16(&iop->intr, pin);
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/kernel.h`, `linux/dma-mapping.h`, `linux/param.h`, `linux/string.h`, `linux/mm.h`, `linux/interrupt.h`.
- Detected declarations: `struct cpm_ioport16`, `struct cpm_ioport32b`, `struct cpm_ioport32e`, `struct cpm1_gpio16_chip`, `struct cpm1_gpio32_chip`, `function cpm_reset`, `function cpm_command`, `function cpm_setbrg`, `function cpm1_set_pin32`, `function cpm1_set_pin16`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.