drivers/gpio/gpio-vf610.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-vf610.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-vf610.c- Extension
.c- Size
- 8853 bytes
- Lines
- 358
- Domain
- Driver Families
- Bucket
- drivers/gpio
- 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/bitops.hlinux/clk.hlinux/err.hlinux/gpio/driver.hlinux/gpio/generic.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/ioport.hlinux/irq.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/property.h
Detected Declarations
struct fsl_gpio_soc_datastruct vf610_gpio_portfunction vf610_gpio_writelfunction vf610_gpio_readlfunction vf610_gpio_irq_handlerfunction for_each_set_bitfunction vf610_gpio_irq_ackfunction vf610_gpio_irq_set_typefunction vf610_gpio_irq_maskfunction vf610_gpio_irq_unmaskfunction vf610_gpio_irq_set_wakefunction vf610_gpio_disable_clkfunction vf610_gpio_probe
Annotated Snippet
struct fsl_gpio_soc_data {
/* SoCs has a Port Data Direction Register (PDDR) */
bool have_paddr;
bool have_dual_base;
};
struct vf610_gpio_port {
struct gpio_generic_chip chip;
void __iomem *base;
void __iomem *gpio_base;
const struct fsl_gpio_soc_data *sdata;
u8 irqc[VF610_GPIO_PER_PORT];
struct clk *clk_port;
struct clk *clk_gpio;
int irq;
};
#define GPIO_PDOR 0x00
#define GPIO_PSOR 0x04
#define GPIO_PCOR 0x08
#define GPIO_PTOR 0x0c
#define GPIO_PDIR 0x10
#define GPIO_PDDR 0x14
#define PORT_PCR(n) ((n) * 0x4)
#define PORT_PCR_IRQC_OFFSET 16
#define PORT_ISFR 0xa0
#define PORT_DFER 0xc0
#define PORT_DFCR 0xc4
#define PORT_DFWR 0xc8
#define PORT_INT_OFF 0x0
#define PORT_INT_LOGIC_ZERO 0x8
#define PORT_INT_RISING_EDGE 0x9
#define PORT_INT_FALLING_EDGE 0xa
#define PORT_INT_EITHER_EDGE 0xb
#define PORT_INT_LOGIC_ONE 0xc
#define IMX8ULP_GPIO_BASE_OFF 0x40
#define IMX8ULP_BASE_OFF 0x80
static const struct fsl_gpio_soc_data vf610_data = {
.have_dual_base = true,
};
static const struct fsl_gpio_soc_data imx_data = {
.have_paddr = true,
.have_dual_base = true,
};
static const struct fsl_gpio_soc_data imx8ulp_data = {
.have_paddr = true,
};
static const struct of_device_id vf610_gpio_dt_ids[] = {
{ .compatible = "fsl,vf610-gpio", .data = &vf610_data },
{ .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, },
{ .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, },
{ /* sentinel */ }
};
static inline void vf610_gpio_writel(u32 val, void __iomem *reg)
{
writel_relaxed(val, reg);
}
static inline u32 vf610_gpio_readl(void __iomem *reg)
{
return readl_relaxed(reg);
}
static void vf610_gpio_irq_handler(struct irq_desc *desc)
{
struct vf610_gpio_port *port =
gpiochip_get_data(irq_desc_get_handler_data(desc));
struct irq_chip *chip = irq_desc_get_chip(desc);
int pin;
unsigned long irq_isfr;
chained_irq_enter(chip, desc);
irq_isfr = vf610_gpio_readl(port->base + PORT_ISFR);
for_each_set_bit(pin, &irq_isfr, VF610_GPIO_PER_PORT) {
vf610_gpio_writel(BIT(pin), port->base + PORT_ISFR);
generic_handle_domain_irq(port->chip.gc.irq.domain, pin);
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/err.h`, `linux/gpio/driver.h`, `linux/gpio/generic.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct fsl_gpio_soc_data`, `struct vf610_gpio_port`, `function vf610_gpio_writel`, `function vf610_gpio_readl`, `function vf610_gpio_irq_handler`, `function for_each_set_bit`, `function vf610_gpio_irq_ack`, `function vf610_gpio_irq_set_type`, `function vf610_gpio_irq_mask`, `function vf610_gpio_irq_unmask`.
- Atlas domain: Driver Families / drivers/gpio.
- 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.