drivers/spi/spi-uniphier.c
Source file repositories/reference/linux-study-clean/drivers/spi/spi-uniphier.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spi/spi-uniphier.c- Extension
.c- Size
- 19592 bytes
- Lines
- 792
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/bitfield.hlinux/bitops.hlinux/clk.hlinux/delay.hlinux/dmaengine.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/platform_device.hlinux/spi/spi.hlinux/unaligned.h
Detected Declarations
struct uniphier_spi_privfunction bytes_per_wordfunction uniphier_spi_irq_enablefunction uniphier_spi_irq_disablefunction uniphier_spi_set_modefunction uniphier_spi_set_transfer_sizefunction uniphier_spi_set_baudratefunction uniphier_spi_setup_transferfunction uniphier_spi_sendfunction uniphier_spi_recvfunction uniphier_spi_set_fifo_thresholdfunction uniphier_spi_fill_tx_fifofunction uniphier_spi_set_csfunction uniphier_spi_can_dmafunction uniphier_spi_dma_rxcbfunction uniphier_spi_dma_txcbfunction uniphier_spi_transfer_one_dmafunction uniphier_spi_transfer_one_irqfunction uniphier_spi_transfer_one_pollfunction uniphier_spi_transfer_onefunction uniphier_spi_prepare_transfer_hardwarefunction uniphier_spi_unprepare_transfer_hardwarefunction uniphier_spi_handle_errfunction uniphier_spi_handlerfunction uniphier_spi_probefunction uniphier_spi_remove
Annotated Snippet
struct uniphier_spi_priv {
void __iomem *base;
dma_addr_t base_dma_addr;
struct clk *clk;
struct spi_controller *host;
struct completion xfer_done;
int error;
unsigned int tx_bytes;
unsigned int rx_bytes;
const u8 *tx_buf;
u8 *rx_buf;
atomic_t dma_busy;
bool is_save_param;
u8 bits_per_word;
u16 mode;
u32 speed_hz;
};
#define SSI_CTL 0x00
#define SSI_CTL_EN BIT(0)
#define SSI_CKS 0x04
#define SSI_CKS_CKRAT_MASK GENMASK(7, 0)
#define SSI_CKS_CKPHS BIT(14)
#define SSI_CKS_CKINIT BIT(13)
#define SSI_CKS_CKDLY BIT(12)
#define SSI_TXWDS 0x08
#define SSI_TXWDS_WDLEN_MASK GENMASK(13, 8)
#define SSI_TXWDS_TDTF_MASK GENMASK(7, 6)
#define SSI_TXWDS_DTLEN_MASK GENMASK(5, 0)
#define SSI_RXWDS 0x0c
#define SSI_RXWDS_DTLEN_MASK GENMASK(5, 0)
#define SSI_FPS 0x10
#define SSI_FPS_FSPOL BIT(15)
#define SSI_FPS_FSTRT BIT(14)
#define SSI_SR 0x14
#define SSI_SR_BUSY BIT(7)
#define SSI_SR_RNE BIT(0)
#define SSI_IE 0x18
#define SSI_IE_TCIE BIT(4)
#define SSI_IE_RCIE BIT(3)
#define SSI_IE_TXRE BIT(2)
#define SSI_IE_RXRE BIT(1)
#define SSI_IE_RORIE BIT(0)
#define SSI_IE_ALL_MASK GENMASK(4, 0)
#define SSI_IS 0x1c
#define SSI_IS_RXRS BIT(9)
#define SSI_IS_RCID BIT(3)
#define SSI_IS_RORID BIT(0)
#define SSI_IC 0x1c
#define SSI_IC_TCIC BIT(4)
#define SSI_IC_RCIC BIT(3)
#define SSI_IC_RORIC BIT(0)
#define SSI_FC 0x20
#define SSI_FC_TXFFL BIT(12)
#define SSI_FC_TXFTH_MASK GENMASK(11, 8)
#define SSI_FC_RXFFL BIT(4)
#define SSI_FC_RXFTH_MASK GENMASK(3, 0)
#define SSI_TXDR 0x24
#define SSI_RXDR 0x24
#define SSI_FIFO_DEPTH 8U
#define SSI_FIFO_BURST_NUM 1
#define SSI_DMA_RX_BUSY BIT(1)
#define SSI_DMA_TX_BUSY BIT(0)
static inline unsigned int bytes_per_word(unsigned int bits)
{
return bits <= 8 ? 1 : (bits <= 16 ? 2 : 4);
}
static inline void uniphier_spi_irq_enable(struct uniphier_spi_priv *priv,
u32 mask)
{
u32 val;
val = readl(priv->base + SSI_IE);
val |= mask;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/dmaengine.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct uniphier_spi_priv`, `function bytes_per_word`, `function uniphier_spi_irq_enable`, `function uniphier_spi_irq_disable`, `function uniphier_spi_set_mode`, `function uniphier_spi_set_transfer_size`, `function uniphier_spi_set_baudrate`, `function uniphier_spi_setup_transfer`, `function uniphier_spi_send`, `function uniphier_spi_recv`.
- 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.