arch/arm/plat-orion/gpio.c
Source file repositories/reference/linux-study-clean/arch/arm/plat-orion/gpio.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/plat-orion/gpio.c- Extension
.c- Size
- 15557 bytes
- Lines
- 617
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/irq.hlinux/irqdomain.hlinux/module.hlinux/spinlock.hlinux/bitops.hlinux/io.hlinux/gpio/driver.hlinux/gpio/consumer.hlinux/leds.hlinux/of.hlinux/of_irq.hlinux/of_address.hplat/orion-gpio.hlinux/seq_file.h
Detected Declarations
struct orion_gpio_chipfunction __set_directionfunction __set_levelfunction __set_blinkingfunction orion_gpio_is_validfunction orion_gpio_requestfunction orion_gpio_direction_inputfunction orion_gpio_getfunction orion_gpio_direction_outputfunction orion_gpio_setfunction orion_gpio_to_irqfunction orion_gpio_set_unusedfunction orion_gpio_set_validfunction orion_gpio_set_blinkfunction orion_gpio_led_blink_setfunction groupedfunction gpio_irq_handlerfunction orion_gpio_dbg_showfunction for_each_requested_gpiofunction orion_gpio_unmask_irqfunction orion_gpio_mask_irqfunction orion_gpio_initexport orion_gpio_set_blinkexport orion_gpio_led_blink_set
Annotated Snippet
struct orion_gpio_chip {
struct gpio_chip chip;
spinlock_t lock;
void __iomem *base;
unsigned long valid_input;
unsigned long valid_output;
int mask_offset;
int secondary_irq_base;
struct irq_domain *domain;
};
static void __iomem *GPIO_OUT(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_OUT_OFF;
}
static void __iomem *GPIO_IO_CONF(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_IO_CONF_OFF;
}
static void __iomem *GPIO_BLINK_EN(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_BLINK_EN_OFF;
}
static void __iomem *GPIO_IN_POL(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_IN_POL_OFF;
}
static void __iomem *GPIO_DATA_IN(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_DATA_IN_OFF;
}
static void __iomem *GPIO_EDGE_CAUSE(struct orion_gpio_chip *ochip)
{
return ochip->base + GPIO_EDGE_CAUSE_OFF;
}
static void __iomem *GPIO_EDGE_MASK(struct orion_gpio_chip *ochip)
{
return ochip->base + ochip->mask_offset + GPIO_EDGE_MASK_OFF;
}
static void __iomem *GPIO_LEVEL_MASK(struct orion_gpio_chip *ochip)
{
return ochip->base + ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
}
static struct orion_gpio_chip orion_gpio_chips[2];
static int orion_gpio_chip_count;
static inline void
__set_direction(struct orion_gpio_chip *ochip, unsigned pin, int input)
{
u32 u;
u = readl(GPIO_IO_CONF(ochip));
if (input)
u |= 1 << pin;
else
u &= ~(1 << pin);
writel(u, GPIO_IO_CONF(ochip));
}
static void __set_level(struct orion_gpio_chip *ochip, unsigned pin, int high)
{
u32 u;
u = readl(GPIO_OUT(ochip));
if (high)
u |= 1 << pin;
else
u &= ~(1 << pin);
writel(u, GPIO_OUT(ochip));
}
static inline void
__set_blinking(struct orion_gpio_chip *ochip, unsigned pin, int blink)
{
u32 u;
u = readl(GPIO_BLINK_EN(ochip));
if (blink)
u |= 1 << pin;
else
u &= ~(1 << pin);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/module.h`, `linux/spinlock.h`, `linux/bitops.h`, `linux/io.h`.
- Detected declarations: `struct orion_gpio_chip`, `function __set_direction`, `function __set_level`, `function __set_blinking`, `function orion_gpio_is_valid`, `function orion_gpio_request`, `function orion_gpio_direction_input`, `function orion_gpio_get`, `function orion_gpio_direction_output`, `function orion_gpio_set`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.