drivers/ata/pata_mpc52xx.c
Source file repositories/reference/linux-study-clean/drivers/ata/pata_mpc52xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ata/pata_mpc52xx.c- Extension
.c- Size
- 25592 bytes
- Lines
- 875
- Domain
- Driver Families
- Bucket
- drivers/ata
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/kernel.hlinux/module.hlinux/gfp.hlinux/delay.hlinux/libata.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/platform_device.hlinux/types.hasm/cacheflush.hasm/mpc52xx.hlinux/fsl/bestcomm/bestcomm.hlinux/fsl/bestcomm/bestcomm_priv.hlinux/fsl/bestcomm/ata.h
Detected Declarations
struct mpc52xx_ata_timingsstruct mpc52xx_ata_privstruct mdmaspecstruct udmaspecstruct mpc52xx_atafunction mpc52xx_ata_compute_pio_timingsfunction mpc52xx_ata_compute_mdma_timingsfunction mpc52xx_ata_compute_udma_timingsfunction mpc52xx_ata_apply_timingsfunction mpc52xx_ata_hw_initfunction mpc52xx_ata_set_piomodefunction mpc52xx_ata_set_dmamodefunction mpc52xx_ata_dev_selectfunction mpc52xx_ata_build_dmatablefunction for_each_sgfunction mpc52xx_bmdma_setupfunction mpc52xx_bmdma_startfunction mpc52xx_bmdma_stopfunction mpc52xx_bmdma_statusfunction mpc52xx_ata_task_irqfunction mpc52xx_ata_init_onefunction mpc52xx_ata_probefunction mpc52xx_ata_removefunction mpc52xx_ata_suspendfunction mpc52xx_ata_resume
Annotated Snippet
struct mpc52xx_ata_timings {
u32 pio1;
u32 pio2;
u32 mdma1;
u32 mdma2;
u32 udma1;
u32 udma2;
u32 udma3;
u32 udma4;
u32 udma5;
int using_udma;
};
struct mpc52xx_ata_priv {
unsigned int ipb_period;
struct mpc52xx_ata __iomem *ata_regs;
phys_addr_t ata_regs_pa;
int ata_irq;
struct mpc52xx_ata_timings timings[2];
int csel;
/* DMA */
struct bcom_task *dmatsk;
const struct udmaspec *udmaspec;
const struct mdmaspec *mdmaspec;
int mpc52xx_ata_dma_last_write;
int waiting_for_dma;
};
/* ATAPI-4 PIO specs (in ns) */
static const u16 ataspec_t0[5] = {600, 383, 240, 180, 120};
static const u16 ataspec_t1[5] = { 70, 50, 30, 30, 25};
static const u16 ataspec_t2_8[5] = {290, 290, 290, 80, 70};
static const u16 ataspec_t2_16[5] = {165, 125, 100, 80, 70};
static const u16 ataspec_t2i[5] = { 0, 0, 0, 70, 25};
static const u16 ataspec_t4[5] = { 30, 20, 15, 10, 10};
static const u16 ataspec_ta[5] = { 35, 35, 35, 35, 35};
#define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c)))
/* ======================================================================== */
/* ATAPI-4 MDMA specs (in clocks) */
struct mdmaspec {
u8 t0M;
u8 td;
u8 th;
u8 tj;
u8 tkw;
u8 tm;
u8 tn;
};
static const struct mdmaspec mdmaspec66[3] = {
{ .t0M = 32, .td = 15, .th = 2, .tj = 2, .tkw = 15, .tm = 4, .tn = 1 },
{ .t0M = 10, .td = 6, .th = 1, .tj = 1, .tkw = 4, .tm = 2, .tn = 1 },
{ .t0M = 8, .td = 5, .th = 1, .tj = 1, .tkw = 2, .tm = 2, .tn = 1 },
};
static const struct mdmaspec mdmaspec132[3] = {
{ .t0M = 64, .td = 29, .th = 3, .tj = 3, .tkw = 29, .tm = 7, .tn = 2 },
{ .t0M = 20, .td = 11, .th = 2, .tj = 1, .tkw = 7, .tm = 4, .tn = 1 },
{ .t0M = 16, .td = 10, .th = 2, .tj = 1, .tkw = 4, .tm = 4, .tn = 1 },
};
/* ATAPI-4 UDMA specs (in clocks) */
struct udmaspec {
u8 tcyc;
u8 t2cyc;
u8 tds;
u8 tdh;
u8 tdvs;
u8 tdvh;
u8 tfs;
u8 tli;
u8 tmli;
u8 taz;
u8 tzah;
u8 tenv;
u8 tsr;
u8 trfs;
u8 trp;
u8 tack;
u8 tss;
};
static const struct udmaspec udmaspec66[6] = {
{ .tcyc = 8, .t2cyc = 16, .tds = 1, .tdh = 1, .tdvs = 5, .tdvh = 1,
.tfs = 16, .tli = 10, .tmli = 2, .taz = 1, .tzah = 2, .tenv = 2,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/gfp.h`, `linux/delay.h`, `linux/libata.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_irq.h`.
- Detected declarations: `struct mpc52xx_ata_timings`, `struct mpc52xx_ata_priv`, `struct mdmaspec`, `struct udmaspec`, `struct mpc52xx_ata`, `function mpc52xx_ata_compute_pio_timings`, `function mpc52xx_ata_compute_mdma_timings`, `function mpc52xx_ata_compute_udma_timings`, `function mpc52xx_ata_apply_timings`, `function mpc52xx_ata_hw_init`.
- Atlas domain: Driver Families / drivers/ata.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.