drivers/net/dsa/b53/b53_mmap.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/b53/b53_mmap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/b53/b53_mmap.c- Extension
.c- Size
- 12408 bytes
- Lines
- 511
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/bits.hlinux/kernel.hlinux/module.hlinux/of.hlinux/io.hlinux/mfd/syscon.hlinux/platform_device.hlinux/platform_data/b53.hlinux/regmap.hb53_priv.h
Detected Declarations
struct b53_phy_infostruct b53_mmap_privfunction b53_mmap_read8function b53_mmap_read16function b53_mmap_read32function b53_mmap_read48function b53_mmap_read64function b53_mmap_write8function b53_mmap_write16function b53_mmap_write32function b53_mmap_write48function b53_mmap_write64function b53_mmap_phy_read16function b53_mmap_phy_write16function bcm63xx_ephy_setfunction bcm63268_gphy_setfunction b53_mmap_phy_enablefunction b53_mmap_phy_disablefunction b53_mmap_probe_offunction for_each_available_child_of_nodefunction b53_mmap_probefunction b53_mmap_removefunction b53_mmap_shutdown
Annotated Snippet
struct b53_phy_info {
u32 gphy_port_mask;
u32 ephy_enable_mask;
u32 ephy_port_mask;
u32 ephy_bias_bit;
const u32 *ephy_offset;
};
struct b53_mmap_priv {
void __iomem *regs;
struct regmap *gpio_ctrl;
const struct b53_phy_info *phy_info;
u32 phys_enabled;
};
static const u32 bcm6318_ephy_offsets[] = {4, 5, 6, 7};
static const struct b53_phy_info bcm6318_ephy_info = {
.ephy_enable_mask = BIT(0) | BIT(4) | BIT(8) | BIT(12) | BIT(16),
.ephy_port_mask = GENMASK((ARRAY_SIZE(bcm6318_ephy_offsets) - 1), 0),
.ephy_bias_bit = 24,
.ephy_offset = bcm6318_ephy_offsets,
};
static const u32 bcm6368_ephy_offsets[] = {2, 3, 4, 5};
static const struct b53_phy_info bcm6368_ephy_info = {
.ephy_enable_mask = BIT(0),
.ephy_port_mask = GENMASK((ARRAY_SIZE(bcm6368_ephy_offsets) - 1), 0),
.ephy_bias_bit = 0,
.ephy_offset = bcm6368_ephy_offsets,
};
static const u32 bcm63268_ephy_offsets[] = {4, 9, 14};
static const struct b53_phy_info bcm63268_ephy_info = {
.gphy_port_mask = BIT(3),
.ephy_enable_mask = GENMASK(4, 0),
.ephy_port_mask = GENMASK((ARRAY_SIZE(bcm63268_ephy_offsets) - 1), 0),
.ephy_bias_bit = 24,
.ephy_offset = bcm63268_ephy_offsets,
};
static int b53_mmap_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
{
struct b53_mmap_priv *priv = dev->priv;
void __iomem *regs = priv->regs;
*val = readb(regs + (page << 8) + reg);
return 0;
}
static int b53_mmap_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
{
struct b53_mmap_priv *priv = dev->priv;
void __iomem *regs = priv->regs;
if (WARN_ON(reg % 2))
return -EINVAL;
if (dev->pdata && dev->pdata->big_endian)
*val = ioread16be(regs + (page << 8) + reg);
else
*val = readw(regs + (page << 8) + reg);
return 0;
}
static int b53_mmap_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
{
struct b53_mmap_priv *priv = dev->priv;
void __iomem *regs = priv->regs;
if (WARN_ON(reg % 4))
return -EINVAL;
if (dev->pdata && dev->pdata->big_endian)
*val = ioread32be(regs + (page << 8) + reg);
else
*val = readl(regs + (page << 8) + reg);
return 0;
}
static int b53_mmap_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
{
struct b53_mmap_priv *priv = dev->priv;
void __iomem *regs = priv->regs;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/platform_device.h`, `linux/platform_data/b53.h`.
- Detected declarations: `struct b53_phy_info`, `struct b53_mmap_priv`, `function b53_mmap_read8`, `function b53_mmap_read16`, `function b53_mmap_read32`, `function b53_mmap_read48`, `function b53_mmap_read64`, `function b53_mmap_write8`, `function b53_mmap_write16`, `function b53_mmap_write32`.
- Atlas domain: Driver Families / drivers/net.
- 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.