drivers/soc/fsl/qe/qe_ports_ic.c
Source file repositories/reference/linux-study-clean/drivers/soc/fsl/qe/qe_ports_ic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/fsl/qe/qe_ports_ic.c- Extension
.c- Size
- 3363 bytes
- Lines
- 151
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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/irq.hlinux/irqdomain.hlinux/platform_device.h
Detected Declarations
struct qepic_datafunction qepic_maskfunction qepic_unmaskfunction qepic_endfunction qepic_set_typefunction qepic_get_irqfunction qepic_cascadefunction qepic_host_mapfunction qepic_removefunction qepic_probefunction qepic_init
Annotated Snippet
struct qepic_data {
void __iomem *reg;
struct irq_domain *host;
int irq;
};
static void qepic_mask(struct irq_data *d)
{
struct qepic_data *data = irq_data_get_irq_chip_data(d);
clrbits32(data->reg + CEPIMR, 1 << (31 - irqd_to_hwirq(d)));
}
static void qepic_unmask(struct irq_data *d)
{
struct qepic_data *data = irq_data_get_irq_chip_data(d);
setbits32(data->reg + CEPIMR, 1 << (31 - irqd_to_hwirq(d)));
}
static void qepic_end(struct irq_data *d)
{
struct qepic_data *data = irq_data_get_irq_chip_data(d);
out_be32(data->reg + CEPIER, 1 << (31 - irqd_to_hwirq(d)));
}
static int qepic_set_type(struct irq_data *d, unsigned int flow_type)
{
struct qepic_data *data = irq_data_get_irq_chip_data(d);
unsigned int vec = (unsigned int)irqd_to_hwirq(d);
switch (flow_type & IRQ_TYPE_SENSE_MASK) {
case IRQ_TYPE_EDGE_FALLING:
setbits32(data->reg + CEPICR, 1 << (31 - vec));
return 0;
case IRQ_TYPE_EDGE_BOTH:
case IRQ_TYPE_NONE:
clrbits32(data->reg + CEPICR, 1 << (31 - vec));
return 0;
}
return -EINVAL;
}
static struct irq_chip qepic = {
.name = "QEPIC",
.irq_mask = qepic_mask,
.irq_unmask = qepic_unmask,
.irq_eoi = qepic_end,
.irq_set_type = qepic_set_type,
};
static int qepic_get_irq(struct irq_desc *desc)
{
struct qepic_data *data = irq_desc_get_handler_data(desc);
u32 event = in_be32(data->reg + CEPIER);
if (!event)
return -1;
return irq_find_mapping(data->host, 32 - ffs(event));
}
static void qepic_cascade(struct irq_desc *desc)
{
generic_handle_irq(qepic_get_irq(desc));
}
static int qepic_host_map(struct irq_domain *h, unsigned int virq, irq_hw_number_t hw)
{
irq_set_chip_data(virq, h->host_data);
irq_set_chip_and_handler(virq, &qepic, handle_fasteoi_irq);
return 0;
}
static const struct irq_domain_ops qepic_host_ops = {
.map = qepic_host_map,
};
static void qepic_remove(void *res)
{
struct qepic_data *data = res;
irq_set_chained_handler_and_data(data->irq, NULL, NULL);
irq_domain_remove(data->host);
}
static int qepic_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Annotation
- Immediate include surface: `linux/irq.h`, `linux/irqdomain.h`, `linux/platform_device.h`.
- Detected declarations: `struct qepic_data`, `function qepic_mask`, `function qepic_unmask`, `function qepic_end`, `function qepic_set_type`, `function qepic_get_irq`, `function qepic_cascade`, `function qepic_host_map`, `function qepic_remove`, `function qepic_probe`.
- Atlas domain: Driver Families / drivers/soc.
- 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.