arch/mips/txx9/generic/setup_tx4938.c
Source file repositories/reference/linux-study-clean/arch/mips/txx9/generic/setup_tx4938.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/txx9/generic/setup_tx4938.c- Extension
.c- Size
- 13868 bytes
- Lines
- 486
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/init.hlinux/ioport.hlinux/delay.hlinux/param.hlinux/ptrace.hlinux/mtd/physmap.hlinux/platform_device.hlinux/platform_data/txx9/ndfmc.hasm/reboot.hasm/traps.hasm/txx9irq.hasm/txx9tmr.hasm/txx9pio.hasm/txx9/generic.hasm/txx9/dmac.hasm/txx9/tx4938.h
Detected Declarations
function tx4938_wdr_initfunction tx4938_wdt_initfunction tx4938_machine_restartfunction tx4938_be_handlerfunction tx4938_be_initfunction tx4938_setupfunction tx4938_time_initfunction tx4938_sio_initfunction tx4938_spi_initfunction tx4938_ethaddr_initfunction tx4938_mtd_initfunction tx4938_ata_initfunction tx4938_ndfmc_initfunction tx4938_dmac_initfunction tx4938_aclc_initfunction tx4938_sramc_initfunction tx4938_stop_unused_modulesfunction tx4938_late_init
Annotated Snippet
switch (divmode) {
case TX4938_CCFG_DIVMODE_8:
case TX4938_CCFG_DIVMODE_10:
case TX4938_CCFG_DIVMODE_12:
case TX4938_CCFG_DIVMODE_16:
case TX4938_CCFG_DIVMODE_18:
txx9_gbus_clock = txx9_master_clock * 4; break;
default:
txx9_gbus_clock = txx9_master_clock;
}
switch (divmode) {
case TX4938_CCFG_DIVMODE_2:
case TX4938_CCFG_DIVMODE_8:
cpuclk = txx9_gbus_clock * 2; break;
case TX4938_CCFG_DIVMODE_2_5:
case TX4938_CCFG_DIVMODE_10:
cpuclk = txx9_gbus_clock * 5 / 2; break;
case TX4938_CCFG_DIVMODE_3:
case TX4938_CCFG_DIVMODE_12:
cpuclk = txx9_gbus_clock * 3; break;
case TX4938_CCFG_DIVMODE_4:
case TX4938_CCFG_DIVMODE_16:
cpuclk = txx9_gbus_clock * 4; break;
case TX4938_CCFG_DIVMODE_4_5:
case TX4938_CCFG_DIVMODE_18:
cpuclk = txx9_gbus_clock * 9 / 2; break;
}
txx9_cpu_clock = cpuclk;
} else {
if (txx9_cpu_clock == 0)
txx9_cpu_clock = 300000000; /* 300MHz */
/* calculate gbus_clock and master_clock from cpu_clock */
cpuclk = txx9_cpu_clock;
divmode = (__u32)ccfg & TX4938_CCFG_DIVMODE_MASK;
switch (divmode) {
case TX4938_CCFG_DIVMODE_2:
case TX4938_CCFG_DIVMODE_8:
txx9_gbus_clock = cpuclk / 2; break;
case TX4938_CCFG_DIVMODE_2_5:
case TX4938_CCFG_DIVMODE_10:
txx9_gbus_clock = cpuclk * 2 / 5; break;
case TX4938_CCFG_DIVMODE_3:
case TX4938_CCFG_DIVMODE_12:
txx9_gbus_clock = cpuclk / 3; break;
case TX4938_CCFG_DIVMODE_4:
case TX4938_CCFG_DIVMODE_16:
txx9_gbus_clock = cpuclk / 4; break;
case TX4938_CCFG_DIVMODE_4_5:
case TX4938_CCFG_DIVMODE_18:
txx9_gbus_clock = cpuclk * 2 / 9; break;
}
switch (divmode) {
case TX4938_CCFG_DIVMODE_8:
case TX4938_CCFG_DIVMODE_10:
case TX4938_CCFG_DIVMODE_12:
case TX4938_CCFG_DIVMODE_16:
case TX4938_CCFG_DIVMODE_18:
txx9_master_clock = txx9_gbus_clock / 4; break;
default:
txx9_master_clock = txx9_gbus_clock;
}
}
/* change default value to udelay/mdelay take reasonable time */
loops_per_jiffy = txx9_cpu_clock / HZ / 2;
/* CCFG */
tx4938_wdr_init();
/* clear BusErrorOnWrite flag (W1C) */
tx4938_ccfg_set(TX4938_CCFG_BEOW);
/* enable Timeout BusError */
if (txx9_ccfg_toeon)
tx4938_ccfg_set(TX4938_CCFG_TOE);
/* DMA selection */
txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_DMASEL_ALL);
/* Use external clock for external arbiter */
if (!(____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB))
txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_PCICLKEN_ALL);
pr_info("%s -- %dMHz(M%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n",
txx9_pcode_str, (cpuclk + 500000) / 1000000,
(txx9_master_clock + 500000) / 1000000,
(__u32)____raw_readq(&tx4938_ccfgptr->crir),
____raw_readq(&tx4938_ccfgptr->ccfg),
____raw_readq(&tx4938_ccfgptr->pcfg));
pr_info("%s SDRAMC --", txx9_pcode_str);
for (i = 0; i < 4; i++) {
__u64 cr = TX4938_SDRAMC_CR(i);
Annotation
- Immediate include surface: `linux/init.h`, `linux/ioport.h`, `linux/delay.h`, `linux/param.h`, `linux/ptrace.h`, `linux/mtd/physmap.h`, `linux/platform_device.h`, `linux/platform_data/txx9/ndfmc.h`.
- Detected declarations: `function tx4938_wdr_init`, `function tx4938_wdt_init`, `function tx4938_machine_restart`, `function tx4938_be_handler`, `function tx4938_be_init`, `function tx4938_setup`, `function tx4938_time_init`, `function tx4938_sio_init`, `function tx4938_spi_init`, `function tx4938_ethaddr_init`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.