drivers/soc/versatile/soc-realview.c
Source file repositories/reference/linux-study-clean/drivers/soc/versatile/soc-realview.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/versatile/soc-realview.c- Extension
.c- Size
- 3438 bytes
- Lines
- 145
- 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/init.hlinux/io.hlinux/slab.hlinux/sys_soc.hlinux/platform_device.hlinux/mfd/syscon.hlinux/regmap.hlinux/of.h
Detected Declarations
function manufacturer_showfunction board_showfunction fpga_showfunction build_showfunction realview_soc_socdev_releasefunction realview_soc_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2014 Linaro Ltd.
*
* Author: Linus Walleij <linus.walleij@linaro.org>
*/
#include <linux/device.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/sys_soc.h>
#include <linux/platform_device.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/of.h>
/* System ID in syscon */
#define REALVIEW_SYS_ID_OFFSET 0x00
static const struct of_device_id realview_soc_of_match[] = {
{ .compatible = "arm,realview-eb-soc", },
{ .compatible = "arm,realview-pb1176-soc", },
{ .compatible = "arm,realview-pb11mp-soc", },
{ .compatible = "arm,realview-pba8-soc", },
{ .compatible = "arm,realview-pbx-soc", },
{ }
};
static u32 realview_coreid;
static const char *realview_arch_str(u32 id)
{
switch ((id >> 8) & 0xf) {
case 0x04:
return "AHB";
case 0x05:
return "Multi-layer AXI";
default:
return "Unknown";
}
}
static ssize_t
manufacturer_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%02x\n", realview_coreid >> 24);
}
static DEVICE_ATTR_RO(manufacturer);
static ssize_t
board_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "HBI-%03x\n", ((realview_coreid >> 16) & 0xfff));
}
static DEVICE_ATTR_RO(board);
static ssize_t
fpga_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", realview_arch_str(realview_coreid));
}
static DEVICE_ATTR_RO(fpga);
static ssize_t
build_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%02x\n", (realview_coreid & 0xFF));
}
static DEVICE_ATTR_RO(build);
static struct attribute *realview_attrs[] = {
&dev_attr_manufacturer.attr,
&dev_attr_board.attr,
&dev_attr_fpga.attr,
&dev_attr_build.attr,
NULL
};
ATTRIBUTE_GROUPS(realview);
static void realview_soc_socdev_release(void *data)
{
struct soc_device *soc_dev = data;
soc_device_unregister(soc_dev);
}
Annotation
- Immediate include surface: `linux/device.h`, `linux/init.h`, `linux/io.h`, `linux/slab.h`, `linux/sys_soc.h`, `linux/platform_device.h`, `linux/mfd/syscon.h`, `linux/regmap.h`.
- Detected declarations: `function manufacturer_show`, `function board_show`, `function fpga_show`, `function build_show`, `function realview_soc_socdev_release`, `function realview_soc_probe`.
- 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.