drivers/memory/omap-gpmc.c
Source file repositories/reference/linux-study-clean/drivers/memory/omap-gpmc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/memory/omap-gpmc.c- Extension
.c- Size
- 74776 bytes
- Lines
- 2700
- Domain
- Driver Families
- Bucket
- drivers/memory
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- 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/cleanup.hlinux/cpu_pm.hlinux/irq.hlinux/kernel.hlinux/module.hlinux/init.hlinux/err.hlinux/clk.hlinux/ioport.hlinux/spinlock.hlinux/io.hlinux/gpio/driver.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/interrupt.hlinux/irqdomain.hlinux/platform_device.hlinux/of.hlinux/of_address.hlinux/of_device.hlinux/of_platform.hlinux/omap-gpmc.hlinux/pm_runtime.hlinux/sizes.hlinux/platform_data/mtd-nand-omap2.h
Detected Declarations
struct gpmc_cs_datastruct gpmc_cs_configstruct omap3_gpmc_regsstruct gpmc_waitpinstruct gpmc_deviceenum gpmc_clk_domainfunction gpmc_write_regfunction gpmc_read_regfunction gpmc_cs_write_regfunction gpmc_cs_read_regfunction gpmc_get_fclk_periodfunction gpmc_get_clk_periodfunction gpmc_ns_to_clk_ticksfunction gpmc_ns_to_ticksfunction gpmc_ps_to_ticksfunction gpmc_ticks_to_psfunction gpmc_round_ps_to_ticksfunction gpmc_cs_modify_regfunction gpmc_cs_bool_timingsfunction gpmc_clk_ticks_to_nsfunction get_gpmc_timing_regfunction gpmc_cs_read_regfunction gpmc_cs_show_timingsfunction gpmc_cs_show_timingsfunction gpmc_calc_waitmonitoring_dividerfunction gpmc_calc_dividerfunction gpmc_cs_set_timingsfunction gpmc_cs_set_memconffunction gpmc_cs_enable_memfunction gpmc_cs_disable_memfunction gpmc_cs_get_memconffunction gpmc_cs_mem_enabledfunction gpmc_cs_set_reservedfunction gpmc_cs_reservedfunction gpmc_mem_alignfunction gpmc_cs_insert_memfunction gpmc_cs_delete_memfunction gpmc_cs_requestfunction gpmc_cs_freefunction gpmc_is_valid_waitpinfunction gpmc_alloc_waitpinfunction gpmc_free_waitpinfunction gpmc_configurefunction gpmc_nand_writebuffer_emptyfunction gpmc_omap_onenand_calc_sync_timingsfunction gpmc_omap_onenand_set_timingsfunction gpmc_irq_endisfunction gpmc_irq_disable
Annotated Snippet
struct gpmc_cs_data {
const char *name;
#define GPMC_CS_RESERVED (1 << 0)
u32 flags;
struct resource mem;
};
/* Structure to save gpmc cs context */
struct gpmc_cs_config {
u32 config1;
u32 config2;
u32 config3;
u32 config4;
u32 config5;
u32 config6;
u32 config7;
int is_valid;
};
/*
* Structure to save/restore gpmc context
* to support core off on OMAP3
*/
struct omap3_gpmc_regs {
u32 sysconfig;
u32 irqenable;
u32 timeout_ctrl;
u32 config;
u32 prefetch_config1;
u32 prefetch_config2;
u32 prefetch_control;
struct gpmc_cs_config cs_context[GPMC_CS_NUM];
};
struct gpmc_waitpin {
u32 pin;
u32 polarity;
struct gpio_desc *desc;
};
struct gpmc_device {
struct device *dev;
int irq;
struct irq_chip irq_chip;
struct gpio_chip gpio_chip;
struct notifier_block nb;
struct omap3_gpmc_regs context;
struct gpmc_waitpin *waitpins;
int nirqs;
unsigned int is_suspended:1;
struct resource *data;
};
static struct irq_domain *gpmc_irq_domain;
static struct resource gpmc_mem_root;
static struct gpmc_cs_data gpmc_cs[GPMC_CS_NUM];
static DEFINE_SPINLOCK(gpmc_mem_lock);
/* Define chip-selects as reserved by default until probe completes */
static unsigned int gpmc_cs_num = GPMC_CS_NUM;
static unsigned int gpmc_nr_waitpins;
static unsigned int gpmc_capability;
static void __iomem *gpmc_base;
static struct clk *gpmc_l3_clk;
static irqreturn_t gpmc_handle_irq(int irq, void *dev);
static void gpmc_write_reg(int idx, u32 val)
{
writel_relaxed(val, gpmc_base + idx);
}
static u32 gpmc_read_reg(int idx)
{
return readl_relaxed(gpmc_base + idx);
}
void gpmc_cs_write_reg(int cs, int idx, u32 val)
{
void __iomem *reg_addr;
reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
writel_relaxed(val, reg_addr);
}
static u32 gpmc_cs_read_reg(int cs, int idx)
{
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/cpu_pm.h`, `linux/irq.h`, `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/err.h`, `linux/clk.h`.
- Detected declarations: `struct gpmc_cs_data`, `struct gpmc_cs_config`, `struct omap3_gpmc_regs`, `struct gpmc_waitpin`, `struct gpmc_device`, `enum gpmc_clk_domain`, `function gpmc_write_reg`, `function gpmc_read_reg`, `function gpmc_cs_write_reg`, `function gpmc_cs_read_reg`.
- Atlas domain: Driver Families / drivers/memory.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.