drivers/soc/sunxi/sunxi_sram.c
Source file repositories/reference/linux-study-clean/drivers/soc/sunxi/sunxi_sram.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/sunxi/sunxi_sram.c- Extension
.c- Size
- 11649 bytes
- Lines
- 503
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/io.hlinux/limits.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/soc/sunxi/sunxi_sram.h
Detected Declarations
struct sunxi_sram_funcstruct sunxi_sram_datastruct sunxi_sram_descstruct sunxi_sramc_variantfunction sunxi_sram_showfunction for_each_child_of_nodefunction for_each_child_of_nodefunction sunxi_sram_claim_onefunction sunxi_sram_release_onefunction sunxi_sram_claimfunction of_for_each_phandlefunction sunxi_sram_releasefunction of_for_each_phandlefunction sunxi_sram_regmap_accessible_regfunction sunxi_sram_lockfunction sunxi_sram_unlockfunction sunxi_sram_probeexport sunxi_sram_claimexport sunxi_sram_release
Annotated Snippet
struct sunxi_sram_func {
char *func;
u8 val;
u32 reg_val;
};
struct sunxi_sram_data {
char *name;
u8 reg;
u8 offset;
u8 width;
const struct sunxi_sram_func *func;
};
struct sunxi_sram_desc {
struct sunxi_sram_data data;
u8 claim_cnt;
};
#define SUNXI_SRAM_MAP(_reg_val, _val, _func) \
{ \
.func = _func, \
.val = _val, \
.reg_val = _reg_val, \
}
#define SUNXI_SRAM_DATA(_name, _reg, _off, _width, ...) \
{ \
.name = _name, \
.reg = _reg, \
.offset = _off, \
.width = _width, \
.func = (const struct sunxi_sram_func[]){ \
__VA_ARGS__, { } }, \
}
static struct sunxi_sram_desc sun4i_a10_sram_a3_a4 = {
.data = SUNXI_SRAM_DATA("A3-A4", 0x4, 0x4, 2,
SUNXI_SRAM_MAP(0, 0, "cpu"),
SUNXI_SRAM_MAP(1, 1, "emac")),
};
static struct sunxi_sram_desc sun4i_a10_sram_c1 = {
.data = SUNXI_SRAM_DATA("C1", 0x0, 0x0, 31,
SUNXI_SRAM_MAP(0, 0, "cpu"),
SUNXI_SRAM_MAP(0x7fffffff, 1, "ve")),
};
static struct sunxi_sram_desc sun4i_a10_sram_d = {
.data = SUNXI_SRAM_DATA("D", 0x4, 0x0, 1,
SUNXI_SRAM_MAP(0, 0, "cpu"),
SUNXI_SRAM_MAP(1, 1, "usb-otg")),
};
static struct sunxi_sram_desc sun50i_a64_sram_c = {
.data = SUNXI_SRAM_DATA("C", 0x4, 24, 1,
SUNXI_SRAM_MAP(1, 0, "cpu"),
SUNXI_SRAM_MAP(0, 1, "de2")),
};
static struct sunxi_sram_desc sun50i_h616_ve_sram = {
.data = SUNXI_SRAM_DATA("VE", 0x0, 0, 1,
SUNXI_SRAM_MAP(1, 0, "cpu"),
SUNXI_SRAM_MAP(0, 1, "ve")),
};
static const struct of_device_id sunxi_sram_dt_ids[] = {
{
.compatible = "allwinner,sun4i-a10-sram-a3-a4",
.data = &sun4i_a10_sram_a3_a4.data,
},
{
.compatible = "allwinner,sun4i-a10-sram-c1",
.data = &sun4i_a10_sram_c1.data,
},
{
.compatible = "allwinner,sun4i-a10-sram-d",
.data = &sun4i_a10_sram_d.data,
},
{
.compatible = "allwinner,sun50i-a64-sram-c",
.data = &sun50i_a64_sram_c.data,
},
{
.compatible = "allwinner,sun50i-h616-ve-sram",
.data = &sun50i_h616_ve_sram.data,
},
{}
};
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/io.h`, `linux/limits.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_platform.h`.
- Detected declarations: `struct sunxi_sram_func`, `struct sunxi_sram_data`, `struct sunxi_sram_desc`, `struct sunxi_sramc_variant`, `function sunxi_sram_show`, `function for_each_child_of_node`, `function for_each_child_of_node`, `function sunxi_sram_claim_one`, `function sunxi_sram_release_one`, `function sunxi_sram_claim`.
- Atlas domain: Driver Families / drivers/soc.
- 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.