drivers/pcmcia/db1xxx_ss.c
Source file repositories/reference/linux-study-clean/drivers/pcmcia/db1xxx_ss.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pcmcia/db1xxx_ss.c- Extension
.c- Size
- 15822 bytes
- Lines
- 603
- 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.
- 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/delay.hlinux/gpio.hlinux/interrupt.hlinux/pm.hlinux/module.hlinux/platform_device.hlinux/resource.hlinux/slab.hlinux/spinlock.hpcmcia/ss.hasm/mach-au1x00/au1000.hasm/mach-db1x00/bcsr.h
Detected Declarations
struct db1x_pcmcia_sockfunction db1300_card_insertedfunction db1200_card_insertedfunction db1000_card_insertedfunction db1x_card_insertedfunction set_stschgfunction db1000_pcmcia_cdirqfunction db1000_pcmcia_stschgirqfunction db1200_pcmcia_cdirqfunction db1200_pcmcia_cdirq_fnfunction db1x_pcmcia_setup_irqsfunction db1x_pcmcia_free_irqsfunction boardsfunction db1x_pcmcia_get_statusfunction db1x_pcmcia_sock_initfunction db1x_pcmcia_sock_suspendfunction au1x00_pcmcia_set_io_mapfunction au1x00_pcmcia_set_mem_mapfunction db1x_pcmcia_socket_probefunction db1x_pcmcia_socket_remove
Annotated Snippet
struct db1x_pcmcia_sock {
struct pcmcia_socket socket;
int nr; /* socket number */
void *virt_io;
phys_addr_t phys_io;
phys_addr_t phys_attr;
phys_addr_t phys_mem;
/* previous flags for set_socket() */
unsigned int old_flags;
/* interrupt sources: linux irq numbers! */
int insert_irq; /* default carddetect irq */
int stschg_irq; /* card-status-change irq */
int card_irq; /* card irq */
int eject_irq; /* db1200/pb1200 have these */
int insert_gpio; /* db1000 carddetect gpio */
#define BOARD_TYPE_DEFAULT 0 /* most boards */
#define BOARD_TYPE_DB1200 1 /* IRQs aren't gpios */
#define BOARD_TYPE_PB1100 2 /* VS bits slightly different */
#define BOARD_TYPE_DB1300 3 /* no power control */
int board_type;
};
#define to_db1x_socket(x) container_of(x, struct db1x_pcmcia_sock, socket)
static int db1300_card_inserted(struct db1x_pcmcia_sock *sock)
{
return bcsr_read(BCSR_SIGSTAT) & (1 << 8);
}
/* DB/PB1200: check CPLD SIGSTATUS register bit 10/12 */
static int db1200_card_inserted(struct db1x_pcmcia_sock *sock)
{
unsigned short sigstat;
sigstat = bcsr_read(BCSR_SIGSTAT);
return sigstat & 1 << (8 + 2 * sock->nr);
}
/* carddetect gpio: low-active */
static int db1000_card_inserted(struct db1x_pcmcia_sock *sock)
{
return !gpio_get_value(sock->insert_gpio);
}
static int db1x_card_inserted(struct db1x_pcmcia_sock *sock)
{
switch (sock->board_type) {
case BOARD_TYPE_DB1200:
return db1200_card_inserted(sock);
case BOARD_TYPE_DB1300:
return db1300_card_inserted(sock);
default:
return db1000_card_inserted(sock);
}
}
/* STSCHG tends to bounce heavily when cards are inserted/ejected.
* To avoid this, the interrupt is normally disabled and only enabled
* after reset to a card has been de-asserted.
*/
static inline void set_stschg(struct db1x_pcmcia_sock *sock, int en)
{
if (sock->stschg_irq != -1) {
if (en)
enable_irq(sock->stschg_irq);
else
disable_irq(sock->stschg_irq);
}
}
static irqreturn_t db1000_pcmcia_cdirq(int irq, void *data)
{
struct db1x_pcmcia_sock *sock = data;
pcmcia_parse_events(&sock->socket, SS_DETECT);
return IRQ_HANDLED;
}
static irqreturn_t db1000_pcmcia_stschgirq(int irq, void *data)
{
struct db1x_pcmcia_sock *sock = data;
pcmcia_parse_events(&sock->socket, SS_STSCHG);
return IRQ_HANDLED;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio.h`, `linux/interrupt.h`, `linux/pm.h`, `linux/module.h`, `linux/platform_device.h`, `linux/resource.h`, `linux/slab.h`.
- Detected declarations: `struct db1x_pcmcia_sock`, `function db1300_card_inserted`, `function db1200_card_inserted`, `function db1000_card_inserted`, `function db1x_card_inserted`, `function set_stschg`, `function db1000_pcmcia_cdirq`, `function db1000_pcmcia_stschgirq`, `function db1200_pcmcia_cdirq`, `function db1200_pcmcia_cdirq_fn`.
- Atlas domain: Driver Families / drivers/pcmcia.
- 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.