drivers/pcmcia/sa1111_generic.c
Source file repositories/reference/linux-study-clean/drivers/pcmcia/sa1111_generic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pcmcia/sa1111_generic.c- Extension
.c- Size
- 6682 bytes
- Lines
- 272
- Domain
- Driver Families
- Bucket
- drivers/pcmcia
- 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/module.hlinux/kernel.hlinux/ioport.hlinux/device.hlinux/interrupt.hlinux/init.hlinux/io.hlinux/slab.hpcmcia/ss.hasm/hardware/sa1111.hasm/mach-types.hasm/irq.hsa1111_generic.h
Detected Declarations
function sa1111_pcmcia_socket_statefunction sa1111_pcmcia_configure_socketfunction sa1111_pcmcia_addfunction pcmcia_probefunction pcmcia_removefunction sa1111_drv_pcmcia_initfunction sa1111_drv_pcmcia_exitmodule init sa1111_drv_pcmcia_init
Annotated Snippet
if (s->soc.nr) {
s->soc.socket.pci_irq = irqs[IDX_IRQ_S1_READY_NINT];
s->soc.stat[SOC_STAT_CD].irq = irqs[IDX_IRQ_S1_CD_VALID];
s->soc.stat[SOC_STAT_CD].name = "SA1111 CF card detect";
s->soc.stat[SOC_STAT_BVD1].irq = irqs[IDX_IRQ_S1_BVD1_STSCHG];
s->soc.stat[SOC_STAT_BVD1].name = "SA1111 CF BVD1";
} else {
s->soc.socket.pci_irq = irqs[IDX_IRQ_S0_READY_NINT];
s->soc.stat[SOC_STAT_CD].irq = irqs[IDX_IRQ_S0_CD_VALID];
s->soc.stat[SOC_STAT_CD].name = "SA1111 PCMCIA card detect";
s->soc.stat[SOC_STAT_BVD1].irq = irqs[IDX_IRQ_S0_BVD1_STSCHG];
s->soc.stat[SOC_STAT_BVD1].name = "SA1111 PCMCIA BVD1";
}
ret = add(&s->soc);
if (ret == 0) {
s->next = dev_get_drvdata(&dev->dev);
dev_set_drvdata(&dev->dev, s);
} else
kfree(s);
}
return ret;
}
static int pcmcia_probe(struct sa1111_dev *dev)
{
void __iomem *base;
int ret;
ret = sa1111_enable_device(dev);
if (ret)
return ret;
dev_set_drvdata(&dev->dev, NULL);
if (!request_mem_region(dev->res.start, 512, SA1111_DRIVER_NAME(dev))) {
sa1111_disable_device(dev);
return -EBUSY;
}
base = dev->mapbase;
/*
* Initialise the suspend state.
*/
writel_relaxed(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR);
writel_relaxed(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR);
ret = -ENODEV;
#ifdef CONFIG_SA1100_JORNADA720
if (machine_is_jornada720())
ret = pcmcia_jornada720_init(dev);
#endif
#ifdef CONFIG_ASSABET_NEPONSET
if (machine_is_assabet())
ret = pcmcia_neponset_init(dev);
#endif
if (ret) {
release_mem_region(dev->res.start, 512);
sa1111_disable_device(dev);
}
return ret;
}
static void pcmcia_remove(struct sa1111_dev *dev)
{
struct sa1111_pcmcia_socket *next, *s = dev_get_drvdata(&dev->dev);
dev_set_drvdata(&dev->dev, NULL);
for (; s; s = next) {
next = s->next;
soc_pcmcia_remove_one(&s->soc);
kfree(s);
}
release_mem_region(dev->res.start, 512);
sa1111_disable_device(dev);
}
static struct sa1111_driver pcmcia_driver = {
.drv = {
.name = "sa1111-pcmcia",
},
.devid = SA1111_DEVID_PCMCIA,
.probe = pcmcia_probe,
.remove = pcmcia_remove,
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/ioport.h`, `linux/device.h`, `linux/interrupt.h`, `linux/init.h`, `linux/io.h`, `linux/slab.h`.
- Detected declarations: `function sa1111_pcmcia_socket_state`, `function sa1111_pcmcia_configure_socket`, `function sa1111_pcmcia_add`, `function pcmcia_probe`, `function pcmcia_remove`, `function sa1111_drv_pcmcia_init`, `function sa1111_drv_pcmcia_exit`, `module init sa1111_drv_pcmcia_init`.
- Atlas domain: Driver Families / drivers/pcmcia.
- 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.