drivers/i2c/busses/i2c-brcmstb.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-brcmstb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-brcmstb.c- Extension
.c- Size
- 19483 bytes
- Lines
- 753
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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.
- 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/clk.hlinux/delay.hlinux/device.hlinux/i2c.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/platform_device.hlinux/sched.hlinux/slab.h
Detected Declarations
struct bsc_regsstruct bsc_clk_paramstruct brcmstb_i2c_devenum bsc_xfer_cmdenum bus_speedsfunction brcmstb_i2c_get_xferszfunction brcmstb_i2c_get_data_regszfunction brcmstb_i2c_enable_disable_irqfunction brcmstb_i2c_isrfunction brcmstb_i2c_wait_if_busyfunction brcmstb_i2c_wait_for_completionfunction brcmstb_set_i2c_start_stopfunction brcmstb_send_i2c_cmdfunction brcmstb_i2c_xfer_bsc_datafunction brcmstb_i2c_write_data_bytefunction brcmstb_i2c_do_addrfunction brcmstb_i2c_xferfunction brcmstb_i2c_xfer_atomicfunction brcmstb_i2c_functionalityfunction brcmstb_i2c_set_bus_speedfunction brcmstb_i2c_set_bsc_reg_defaultsfunction bcm2711_release_bscfunction brcmstb_i2c_probefunction brcmstb_i2c_removefunction brcmstb_i2c_suspendfunction brcmstb_i2c_resume
Annotated Snippet
struct bsc_regs {
u32 chip_address; /* target address */
u32 data_in[N_DATA_REGS]; /* tx data buffer*/
u32 cnt_reg; /* rx/tx data length */
u32 ctl_reg; /* control register */
u32 iic_enable; /* xfer enable and status */
u32 data_out[N_DATA_REGS]; /* rx data buffer */
u32 ctlhi_reg; /* more control fields */
u32 scl_param; /* reserved */
};
struct bsc_clk_param {
u32 hz;
u32 scl_mask;
u32 div_mask;
};
enum bsc_xfer_cmd {
CMD_WR,
CMD_RD,
CMD_WR_NOACK,
CMD_RD_NOACK,
};
static char const *cmd_string[] = {
[CMD_WR] = "WR",
[CMD_RD] = "RD",
[CMD_WR_NOACK] = "WR NOACK",
[CMD_RD_NOACK] = "RD NOACK",
};
enum bus_speeds {
SPD_375K,
SPD_390K,
SPD_187K,
SPD_200K,
SPD_93K,
SPD_97K,
SPD_46K,
SPD_50K
};
static const struct bsc_clk_param bsc_clk[] = {
[SPD_375K] = {
.hz = 375000,
.scl_mask = SPD_375K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = 0
},
[SPD_390K] = {
.hz = 390000,
.scl_mask = SPD_390K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = 0
},
[SPD_187K] = {
.hz = 187500,
.scl_mask = SPD_187K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = 0
},
[SPD_200K] = {
.hz = 200000,
.scl_mask = SPD_200K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = 0
},
[SPD_93K] = {
.hz = 93750,
.scl_mask = SPD_375K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = BSC_CTL_REG_DIV_CLK_MASK
},
[SPD_97K] = {
.hz = 97500,
.scl_mask = SPD_390K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = BSC_CTL_REG_DIV_CLK_MASK
},
[SPD_46K] = {
.hz = 46875,
.scl_mask = SPD_187K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = BSC_CTL_REG_DIV_CLK_MASK
},
[SPD_50K] = {
.hz = 50000,
.scl_mask = SPD_200K << BSC_CTL_REG_SCL_SEL_SHIFT,
.div_mask = BSC_CTL_REG_DIV_CLK_MASK
}
};
struct brcmstb_i2c_dev {
struct device *device;
void __iomem *base;
int irq;
struct bsc_regs *bsc_regmap;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct bsc_regs`, `struct bsc_clk_param`, `struct brcmstb_i2c_dev`, `enum bsc_xfer_cmd`, `enum bus_speeds`, `function brcmstb_i2c_get_xfersz`, `function brcmstb_i2c_get_data_regsz`, `function brcmstb_i2c_enable_disable_irq`, `function brcmstb_i2c_isr`, `function brcmstb_i2c_wait_if_busy`.
- Atlas domain: Driver Families / drivers/i2c.
- Implementation status: source implementation candidate.
- 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.