drivers/ata/pata_ep93xx.c
Source file repositories/reference/linux-study-clean/drivers/ata/pata_ep93xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ata/pata_ep93xx.c- Extension
.c- Size
- 29351 bytes
- Lines
- 1034
- 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.
- 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/err.hlinux/kernel.hlinux/module.hlinux/blkdev.hscsi/scsi_host.hlinux/ata.hlinux/libata.hlinux/platform_device.hlinux/sys_soc.hlinux/delay.hlinux/dmaengine.hlinux/ktime.hlinux/mod_devicetable.hlinux/soc/cirrus/ep93xx.h
Detected Declarations
struct ep93xx_pata_datafunction ep93xx_pata_clear_regsfunction ep93xx_pata_check_iordyfunction ep93xx_pata_get_wstfunction ep93xx_pata_enable_piofunction speedfunction ep93xx_pata_wait_for_iordyfunction ep93xx_pata_rw_beginfunction ep93xx_pata_rw_endfunction ep93xx_pata_readfunction ep93xx_pata_read_regfunction ep93xx_pata_read_datafunction ep93xx_pata_writefunction ep93xx_pata_write_regfunction ep93xx_pata_write_datafunction ep93xx_pata_set_piomodefunction ep93xx_pata_check_statusfunction ep93xx_pata_check_altstatusfunction ep93xx_pata_tf_loadfunction ep93xx_pata_tf_readfunction ep93xx_pata_exec_commandfunction ep93xx_pata_dev_selectfunction ep93xx_pata_set_devctlfunction ep93xx_pata_data_xferfunction ep93xx_pata_device_is_presentfunction ep93xx_pata_wait_after_resetfunction ep93xx_pata_bus_softresetfunction ep93xx_pata_release_dmafunction ep93xx_pata_dma_initfunction ep93xx_pata_dma_startfunction ep93xx_pata_dma_stopfunction ep93xx_pata_dma_setupfunction ep93xx_pata_dma_statusfunction ep93xx_pata_softresetfunction ep93xx_pata_drain_fifofunction ep93xx_pata_port_startfunction ep93xx_pata_probefunction ep93xx_pata_remove
Annotated Snippet
struct ep93xx_pata_data {
struct platform_device *pdev;
void __iomem *ide_base;
struct ata_timing t;
bool iordy;
unsigned long udma_in_phys;
unsigned long udma_out_phys;
struct dma_chan *dma_rx_channel;
struct dma_chan *dma_tx_channel;
};
static void ep93xx_pata_clear_regs(void __iomem *base)
{
writel(IDECTRL_CS0N | IDECTRL_CS1N | IDECTRL_DIORN |
IDECTRL_DIOWN, base + IDECTRL);
writel(0, base + IDECFG);
writel(0, base + IDEMDMAOP);
writel(0, base + IDEUDMAOP);
writel(0, base + IDEDATAOUT);
writel(0, base + IDEDATAIN);
writel(0, base + IDEMDMADATAOUT);
writel(0, base + IDEMDMADATAIN);
writel(0, base + IDEUDMADATAOUT);
writel(0, base + IDEUDMADATAIN);
writel(0, base + IDEUDMADEBUG);
}
static bool ep93xx_pata_check_iordy(void __iomem *base)
{
return !!(readl(base + IDECTRL) & IDECTRL_IORDY);
}
/*
* According to EP93xx User's Guide, WST field of IDECFG specifies number
* of HCLK cycles to hold the data bus after a PIO write operation.
* It should be programmed to guarantee following delays:
*
* PIO Mode [ns]
* 0 30
* 1 20
* 2 15
* 3 10
* 4 5
*
* Maximum possible value for HCLK is 100MHz.
*/
static int ep93xx_pata_get_wst(int pio_mode)
{
int val;
if (pio_mode == 0)
val = 3;
else if (pio_mode < 3)
val = 2;
else
val = 1;
return val << IDECFG_WST_SHIFT;
}
static void ep93xx_pata_enable_pio(void __iomem *base, int pio_mode)
{
writel(IDECFG_IDEEN | IDECFG_PIO |
ep93xx_pata_get_wst(pio_mode) |
(pio_mode << IDECFG_MODE_SHIFT), base + IDECFG);
}
/*
* Based on delay loop found in mach-pxa/mp900.c.
*
* Single iteration should take 5 cpu cycles. This is 25ns assuming the
* fastest ep93xx cpu speed (200MHz) and is better optimized for PIO4 timings
* than eg. 20ns.
*/
static void ep93xx_pata_delay(unsigned long count)
{
#ifdef CONFIG_ARM
__asm__ volatile (
"0:\n"
"mov r0, r0\n"
"subs %0, %1, #1\n"
"bge 0b\n"
: "=r" (count)
: "0" (count)
);
#else
while (count--)
Annotation
- Immediate include surface: `linux/err.h`, `linux/kernel.h`, `linux/module.h`, `linux/blkdev.h`, `scsi/scsi_host.h`, `linux/ata.h`, `linux/libata.h`, `linux/platform_device.h`.
- Detected declarations: `struct ep93xx_pata_data`, `function ep93xx_pata_clear_regs`, `function ep93xx_pata_check_iordy`, `function ep93xx_pata_get_wst`, `function ep93xx_pata_enable_pio`, `function speed`, `function ep93xx_pata_wait_for_iordy`, `function ep93xx_pata_rw_begin`, `function ep93xx_pata_rw_end`, `function ep93xx_pata_read`.
- Atlas domain: Driver Families / drivers/ata.
- 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.