drivers/net/ieee802154/mcr20a.c
Source file repositories/reference/linux-study-clean/drivers/net/ieee802154/mcr20a.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ieee802154/mcr20a.c- Extension
.c- Size
- 33240 bytes
- Lines
- 1363
- 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.
- 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/module.hlinux/gpio/consumer.hlinux/spi/spi.hlinux/workqueue.hlinux/interrupt.hlinux/irq.hlinux/skbuff.hlinux/regmap.hlinux/ieee802154.hlinux/debugfs.hnet/mac802154.hnet/cfg802154.hlinux/device.hmcr20a.h
Detected Declarations
struct mcr20a_localfunction mcr20a_dar_writeablefunction mcr20a_dar_readablefunction mcr20a_dar_volatilefunction mcr20a_dar_preciousfunction mcr20a_iar_writeablefunction mcr20a_iar_readablefunction mcr20a_iar_volatilefunction mcr20a_write_tx_buf_completefunction mcr20a_xmitfunction mcr20a_edfunction mcr20a_set_channelfunction mcr20a_startfunction mcr20a_stopfunction mcr20a_set_hw_addr_filtfunction mcr20a_set_txpowerfunction mcr20a_set_cca_modefunction mcr20a_set_cca_ed_levelfunction mcr20a_set_promiscuous_modefunction mcr20a_request_rxfunction mcr20a_handle_rx_read_buf_completefunction mcr20a_handle_rx_read_len_completefunction mcr20a_handle_rxfunction mcr20a_handle_tx_completefunction mcr20a_handle_txfunction mcr20a_irq_clean_completefunction mcr20a_irq_status_completefunction mcr20a_irq_isrfunction mcr20a_hw_setupfunction mcr20a_setup_tx_spi_messagesfunction mcr20a_setup_rx_spi_messagesfunction mcr20a_setup_irq_spi_messagesfunction mcr20a_phy_initfunction mcr20a_probefunction mcr20a_remove
Annotated Snippet
struct mcr20a_local {
struct spi_device *spi;
struct ieee802154_hw *hw;
struct regmap *regmap_dar;
struct regmap *regmap_iar;
u8 *buf;
bool is_tx;
/* for writing tx buffer */
struct spi_message tx_buf_msg;
u8 tx_header[1];
/* burst buffer write command */
struct spi_transfer tx_xfer_header;
u8 tx_len[1];
/* len of tx packet */
struct spi_transfer tx_xfer_len;
/* data of tx packet */
struct spi_transfer tx_xfer_buf;
struct sk_buff *tx_skb;
/* for read length rxfifo */
struct spi_message reg_msg;
u8 reg_cmd[1];
u8 reg_data[MCR20A_IRQSTS_NUM];
struct spi_transfer reg_xfer_cmd;
struct spi_transfer reg_xfer_data;
/* receive handling */
struct spi_message rx_buf_msg;
u8 rx_header[1];
struct spi_transfer rx_xfer_header;
u8 rx_lqi[1];
struct spi_transfer rx_xfer_lqi;
u8 rx_buf[MCR20A_MAX_BUF];
struct spi_transfer rx_xfer_buf;
/* isr handling for reading intstat */
struct spi_message irq_msg;
u8 irq_header[1];
u8 irq_data[MCR20A_IRQSTS_NUM];
struct spi_transfer irq_xfer_data;
struct spi_transfer irq_xfer_header;
};
static void
mcr20a_write_tx_buf_complete(void *context)
{
struct mcr20a_local *lp = context;
int ret;
dev_dbg(printdev(lp), "%s\n", __func__);
lp->reg_msg.complete = NULL;
lp->reg_cmd[0] = MCR20A_WRITE_REG(DAR_PHY_CTRL1);
lp->reg_data[0] = MCR20A_XCVSEQ_TX;
lp->reg_xfer_data.len = 1;
ret = spi_async(lp->spi, &lp->reg_msg);
if (ret)
dev_err(printdev(lp), "failed to set SEQ TX\n");
}
static int
mcr20a_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
{
struct mcr20a_local *lp = hw->priv;
dev_dbg(printdev(lp), "%s\n", __func__);
lp->tx_skb = skb;
print_hex_dump_debug("mcr20a tx: ", DUMP_PREFIX_OFFSET, 16, 1,
skb->data, skb->len, 0);
lp->is_tx = 1;
lp->reg_msg.complete = NULL;
lp->reg_cmd[0] = MCR20A_WRITE_REG(DAR_PHY_CTRL1);
lp->reg_data[0] = MCR20A_XCVSEQ_IDLE;
lp->reg_xfer_data.len = 1;
return spi_async(lp->spi, &lp->reg_msg);
}
static int
mcr20a_ed(struct ieee802154_hw *hw, u8 *level)
{
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/gpio/consumer.h`, `linux/spi/spi.h`, `linux/workqueue.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/skbuff.h`.
- Detected declarations: `struct mcr20a_local`, `function mcr20a_dar_writeable`, `function mcr20a_dar_readable`, `function mcr20a_dar_volatile`, `function mcr20a_dar_precious`, `function mcr20a_iar_writeable`, `function mcr20a_iar_readable`, `function mcr20a_iar_volatile`, `function mcr20a_write_tx_buf_complete`, `function mcr20a_xmit`.
- Atlas domain: Driver Families / drivers/net.
- 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.