drivers/soc/aspeed/aspeed-uart-routing.c
Source file repositories/reference/linux-study-clean/drivers/soc/aspeed/aspeed-uart-routing.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/aspeed/aspeed-uart-routing.c- Extension
.c- Size
- 14320 bytes
- Lines
- 601
- 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/device.hlinux/module.hlinux/of.hlinux/mfd/syscon.hlinux/regmap.hlinux/platform_device.h
Detected Declarations
struct aspeed_uart_routingstruct aspeed_uart_routing_selectorfunction aspeed_uart_routing_showfunction aspeed_uart_routing_storefunction aspeed_uart_routing_probefunction aspeed_uart_routing_remove
Annotated Snippet
struct aspeed_uart_routing {
struct regmap *map;
struct attribute_group const *attr_grp;
};
struct aspeed_uart_routing_selector {
struct device_attribute dev_attr;
uint8_t reg;
uint8_t mask;
uint8_t shift;
const char *const options[];
};
#define to_routing_selector(_dev_attr) \
container_of(_dev_attr, struct aspeed_uart_routing_selector, dev_attr)
static ssize_t aspeed_uart_routing_show(struct device *dev,
struct device_attribute *attr,
char *buf);
static ssize_t aspeed_uart_routing_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count);
#define ROUTING_ATTR(_name) { \
.attr = {.name = _name, \
.mode = VERIFY_OCTAL_PERMISSIONS(0644) }, \
.show = aspeed_uart_routing_show, \
.store = aspeed_uart_routing_store, \
}
/* routing selector for AST25xx */
static struct aspeed_uart_routing_selector ast2500_io6_sel = {
.dev_attr = ROUTING_ATTR(UART_ROUTING_IO6),
.reg = HICR9,
.shift = 8,
.mask = 0xf,
.options = {
UART_ROUTING_UART1,
UART_ROUTING_UART2,
UART_ROUTING_UART3,
UART_ROUTING_UART4,
UART_ROUTING_UART5,
UART_ROUTING_IO1,
UART_ROUTING_IO2,
UART_ROUTING_IO3,
UART_ROUTING_IO4,
UART_ROUTING_IO5,
NULL,
},
};
static struct aspeed_uart_routing_selector ast2500_uart5_sel = {
.dev_attr = ROUTING_ATTR(UART_ROUTING_UART5),
.reg = HICRA,
.shift = 28,
.mask = 0xf,
.options = {
UART_ROUTING_IO5,
UART_ROUTING_IO1,
UART_ROUTING_IO2,
UART_ROUTING_IO3,
UART_ROUTING_IO4,
UART_ROUTING_UART1,
UART_ROUTING_UART2,
UART_ROUTING_UART3,
UART_ROUTING_UART4,
UART_ROUTING_IO6,
NULL,
},
};
static struct aspeed_uart_routing_selector ast2500_uart4_sel = {
.dev_attr = ROUTING_ATTR(UART_ROUTING_UART4),
.reg = HICRA,
.shift = 25,
.mask = 0x7,
.options = {
UART_ROUTING_IO4,
UART_ROUTING_IO1,
UART_ROUTING_IO2,
UART_ROUTING_IO3,
UART_ROUTING_UART1,
UART_ROUTING_UART2,
UART_ROUTING_UART3,
UART_ROUTING_IO6,
NULL,
},
};
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/of.h`, `linux/mfd/syscon.h`, `linux/regmap.h`, `linux/platform_device.h`.
- Detected declarations: `struct aspeed_uart_routing`, `struct aspeed_uart_routing_selector`, `function aspeed_uart_routing_show`, `function aspeed_uart_routing_store`, `function aspeed_uart_routing_probe`, `function aspeed_uart_routing_remove`.
- 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.