drivers/spi/spi-bcm63xx-hsspi.c
Source file repositories/reference/linux-study-clean/drivers/spi/spi-bcm63xx-hsspi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spi/spi-bcm63xx-hsspi.c- Extension
.c- Size
- 26660 bytes
- Lines
- 950
- Domain
- Driver Families
- Bucket
- drivers/spi
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/init.hlinux/io.hlinux/clk.hlinux/module.hlinux/platform_device.hlinux/delay.hlinux/dma-mapping.hlinux/err.hlinux/interrupt.hlinux/spi/spi.hlinux/mutex.hlinux/of.hlinux/spi/spi-mem.hlinux/mtd/spi-nor.hlinux/reset.hlinux/pm_runtime.h
Detected Declarations
struct bcm63xx_hsspifunction wait_mode_showfunction wait_mode_storefunction xfer_mode_showfunction xfer_mode_storefunction bcm63xx_hsspi_max_message_sizefunction bcm63xx_hsspi_wait_cmdfunction bcm63xx_prepare_prepend_transferfunction bcm63xx_hsspi_do_prepend_txrxfunction bcm63xx_hsspi_set_csfunction bcm63xx_hsspi_set_clkfunction bcm63xx_hsspi_do_txrxfunction bcm63xx_hsspi_setupfunction bcm63xx_hsspi_do_dummy_cs_txrxfunction list_for_each_entryfunction bcm63xx_hsspi_transfer_onefunction bcm63xx_hsspi_mem_supports_opfunction bcm63xx_hsspi_interruptfunction bcm63xx_hsspi_probefunction bcm63xx_hsspi_removefunction bcm63xx_hsspi_suspendfunction bcm63xx_hsspi_resume
Annotated Snippet
struct bcm63xx_hsspi {
struct completion done;
struct mutex bus_mutex;
struct mutex msg_mutex;
struct platform_device *pdev;
struct clk *clk;
struct clk *pll_clk;
void __iomem *regs;
u8 __iomem *fifo;
u32 speed_hz;
u8 cs_polarity;
u32 wait_mode;
u32 xfer_mode;
u32 prepend_cnt;
u32 md_start;
u8 *prepend_buf;
};
static ssize_t wait_mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct spi_controller *ctrl = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_controller_get_devdata(ctrl);
return sprintf(buf, "%d\n", bs->wait_mode);
}
static ssize_t wait_mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct spi_controller *ctrl = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_controller_get_devdata(ctrl);
u32 val;
if (kstrtou32(buf, 10, &val))
return -EINVAL;
if (val > HSSPI_WAIT_MODE_MAX) {
dev_warn(dev, "invalid wait mode %u\n", val);
return -EINVAL;
}
mutex_lock(&bs->msg_mutex);
bs->wait_mode = val;
/* clear interrupt status to avoid spurious int on next transfer */
if (val == HSSPI_WAIT_MODE_INTR)
__raw_writel(HSSPI_INT_CLEAR_ALL, bs->regs + HSSPI_INT_STATUS_REG);
mutex_unlock(&bs->msg_mutex);
return count;
}
static DEVICE_ATTR_RW(wait_mode);
static ssize_t xfer_mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct spi_controller *ctrl = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_controller_get_devdata(ctrl);
return sprintf(buf, "%d\n", bs->xfer_mode);
}
static ssize_t xfer_mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct spi_controller *ctrl = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_controller_get_devdata(ctrl);
u32 val;
if (kstrtou32(buf, 10, &val))
return -EINVAL;
if (val > HSSPI_XFER_MODE_MAX) {
dev_warn(dev, "invalid xfer mode %u\n", val);
return -EINVAL;
}
mutex_lock(&bs->msg_mutex);
bs->xfer_mode = val;
mutex_unlock(&bs->msg_mutex);
return count;
}
static DEVICE_ATTR_RW(xfer_mode);
static struct attribute *bcm63xx_hsspi_attrs[] = {
&dev_attr_wait_mode.attr,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/io.h`, `linux/clk.h`, `linux/module.h`, `linux/platform_device.h`, `linux/delay.h`, `linux/dma-mapping.h`.
- Detected declarations: `struct bcm63xx_hsspi`, `function wait_mode_show`, `function wait_mode_store`, `function xfer_mode_show`, `function xfer_mode_store`, `function bcm63xx_hsspi_max_message_size`, `function bcm63xx_hsspi_wait_cmd`, `function bcm63xx_prepare_prepend_transfer`, `function bcm63xx_hsspi_do_prepend_txrx`, `function bcm63xx_hsspi_set_cs`.
- Atlas domain: Driver Families / drivers/spi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.