arch/mips/cavium-octeon/octeon-platform.c
Source file repositories/reference/linux-study-clean/arch/mips/cavium-octeon/octeon-platform.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/cavium-octeon/octeon-platform.c- Extension
.c- Size
- 29381 bytes
- Lines
- 1143
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/etherdevice.hlinux/of.hlinux/of_platform.hlinux/of_fdt.hlinux/platform_device.hlinux/libfdt.hlinux/string.hasm/octeon/octeon.hasm/octeon/cvmx-helper-board.hlinux/usb/ehci_def.hlinux/usb/ehci_pdriver.hlinux/usb/ohci_pdriver.hasm/octeon/cvmx-uctlx-defs.h
Detected Declarations
function octeon2_usb_resetfunction octeon2_usb_clocks_startfunction octeon2_usb_clocks_stopfunction octeon_ehci_power_onfunction octeon_ehci_power_offfunction octeon_ehci_hw_startfunction octeon_ehci_device_initfunction octeon_ohci_power_onfunction octeon_ohci_power_offfunction octeon_ohci_hw_startfunction octeon_ohci_device_initfunction octeon_rng_device_initfunction octeon_has_88e1145function octeon_has_fixed_linkfunction octeon_fdt_set_phyfunction octeon_fdt_set_mac_addrfunction octeon_fdt_rm_ethernetfunction _octeon_rx_tx_delayfunction octeon_rx_tx_delayfunction octeon_fdt_pip_portfunction octeon_fdt_pip_ifacefunction octeon_fill_mac_addressesfunction octeon_prune_device_treefunction octeon_publish_devicesmodule init octeon_ehci_device_initmodule init octeon_ohci_device_initmodule init octeon_rng_device_init
Annotated Snippet
device_initcall(octeon_ehci_device_init);
static int octeon_ohci_power_on(struct platform_device *pdev)
{
octeon2_usb_clocks_start(&pdev->dev);
return 0;
}
static void octeon_ohci_power_off(struct platform_device *pdev)
{
octeon2_usb_clocks_stop();
}
static struct usb_ohci_pdata octeon_ohci_pdata = {
/* Octeon OHCI matches CPU endianness. */
#ifdef __BIG_ENDIAN
.big_endian_mmio = 1,
#endif
.power_on = octeon_ohci_power_on,
.power_off = octeon_ohci_power_off,
};
static void __init octeon_ohci_hw_start(struct device *dev)
{
union cvmx_uctlx_ohci_ctl ohci_ctl;
octeon2_usb_clocks_start(dev);
ohci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_OHCI_CTL(0));
ohci_ctl.s.l2c_addr_msb = 0;
#ifdef __BIG_ENDIAN
ohci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */
ohci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */
#else
ohci_ctl.s.l2c_buff_emod = 0; /* not swapped. */
ohci_ctl.s.l2c_desc_emod = 0; /* not swapped. */
ohci_ctl.s.inv_reg_a2 = 1;
#endif
cvmx_write_csr(CVMX_UCTLX_OHCI_CTL(0), ohci_ctl.u64);
octeon2_usb_clocks_stop();
}
static int __init octeon_ohci_device_init(void)
{
struct platform_device *pd;
struct device_node *ohci_node;
int ret = 0;
ohci_node = of_find_node_by_name(NULL, "ohci");
if (!ohci_node)
return 0;
pd = of_find_device_by_node(ohci_node);
of_node_put(ohci_node);
if (!pd)
return 0;
pd->dev.platform_data = &octeon_ohci_pdata;
octeon_ohci_hw_start(&pd->dev);
put_device(&pd->dev);
return ret;
}
device_initcall(octeon_ohci_device_init);
#endif /* CONFIG_USB */
/* Octeon Random Number Generator. */
static int __init octeon_rng_device_init(void)
{
struct platform_device *pd;
int ret = 0;
struct resource rng_resources[] = {
{
.flags = IORESOURCE_MEM,
.start = XKPHYS_TO_PHYS(CVMX_RNM_CTL_STATUS),
.end = XKPHYS_TO_PHYS(CVMX_RNM_CTL_STATUS) + 0xf
}, {
.flags = IORESOURCE_MEM,
.start = cvmx_build_io_address(8, 0),
.end = cvmx_build_io_address(8, 0) + 0x7
}
};
pd = platform_device_alloc("octeon_rng", -1);
if (!pd) {
ret = -ENOMEM;
goto out;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/of.h`, `linux/of_platform.h`, `linux/of_fdt.h`, `linux/platform_device.h`, `linux/libfdt.h`, `linux/string.h`, `asm/octeon/octeon.h`.
- Detected declarations: `function octeon2_usb_reset`, `function octeon2_usb_clocks_start`, `function octeon2_usb_clocks_stop`, `function octeon_ehci_power_on`, `function octeon_ehci_power_off`, `function octeon_ehci_hw_start`, `function octeon_ehci_device_init`, `function octeon_ohci_power_on`, `function octeon_ohci_power_off`, `function octeon_ohci_hw_start`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.