drivers/soc/fsl/qe/qmc.c
Source file repositories/reference/linux-study-clean/drivers/soc/fsl/qe/qmc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/fsl/qe/qmc.c- Extension
.c- Size
- 58644 bytes
- Lines
- 2261
- Domain
- Driver Families
- Bucket
- drivers/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
soc/fsl/qe/qmc.hlinux/bitfield.hlinux/dma-mapping.hlinux/firmware.hlinux/hdlc.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/slab.hsoc/fsl/cpm.hsoc/fsl/qe/ucc_slow.hsoc/fsl/qe/qe.hsysdev/fsl_soc.htsa.h
Detected Declarations
struct qmc_xfer_descstruct qmc_chanstruct qmc_datastruct qmcenum qmc_versionfunction qmc_write8function qmc_write16function qmc_read16function qmc_setbits16function qmc_clrbits16function qmc_clrsetbits16function qmc_write32function qmc_read32function qmc_setbits32function qmc_is_qefunction qmc_chan_get_infofunction qmc_chan_get_ts_infofunction qmc_chan_set_ts_infofunction qmc_chan_set_paramfunction qmc_chan_write_submitfunction qmc_chan_write_donefunction qmc_chan_read_submitfunction qmc_chan_read_donefunction qmc_chan_setup_tsa_64rxtxfunction qmc_chan_setup_tsa_32rxfunction qmc_chan_setup_tsa_32txfunction qmc_chan_setup_tsa_txfunction qmc_chan_setup_tsa_rxfunction qmc_chan_cpm1_commandfunction qmc_chan_qe_commandfunction qmc_chan_stop_rxfunction qmc_chan_stop_txfunction qmc_chan_stopfunction qmc_setup_chan_trnsyncfunction qmc_chan_start_rxfunction qmc_chan_start_txfunction qmc_chan_startfunction qmc_chan_reset_rxfunction qmc_chan_reset_txfunction qmc_chan_resetfunction qmc_check_chansfunction list_for_each_entryfunction qmc_nb_chansfunction qmc_of_parse_chansfunction for_each_available_child_of_node_scopedfunction qmc_init_tsa_64rxtxfunction qmc_init_tsa_32rx_32txfunction qmc_init_tsa
Annotated Snippet
struct qmc_xfer_desc {
union {
void (*tx_complete)(void *context);
void (*rx_complete)(void *context, size_t length, unsigned int flags);
};
void *context;
};
struct qmc_chan {
struct list_head list;
unsigned int id;
struct qmc *qmc;
void __iomem *s_param;
enum qmc_mode mode;
spinlock_t ts_lock; /* Protect timeslots */
u64 tx_ts_mask_avail;
u64 tx_ts_mask;
u64 rx_ts_mask_avail;
u64 rx_ts_mask;
bool is_reverse_data;
spinlock_t tx_lock; /* Protect Tx related data */
cbd_t __iomem *txbds;
cbd_t __iomem *txbd_free;
cbd_t __iomem *txbd_done;
struct qmc_xfer_desc tx_desc[QMC_NB_TXBDS];
u64 nb_tx_underrun;
bool is_tx_stopped;
spinlock_t rx_lock; /* Protect Rx related data */
cbd_t __iomem *rxbds;
cbd_t __iomem *rxbd_free;
cbd_t __iomem *rxbd_done;
struct qmc_xfer_desc rx_desc[QMC_NB_RXBDS];
u64 nb_rx_busy;
int rx_pending;
bool is_rx_halted;
bool is_rx_stopped;
};
enum qmc_version {
QMC_CPM1,
QMC_QE,
};
struct qmc_data {
enum qmc_version version;
u32 tstate; /* Initial TSTATE value */
u32 rstate; /* Initial RSTATE value */
u32 zistate; /* Initial ZISTATE value */
u32 zdstate_hdlc; /* Initial ZDSTATE value (HDLC mode) */
u32 zdstate_transp; /* Initial ZDSTATE value (Transparent mode) */
u32 rpack; /* Initial RPACK value */
};
struct qmc {
struct device *dev;
const struct qmc_data *data;
struct tsa_serial *tsa_serial;
void __iomem *scc_regs;
void __iomem *scc_pram;
void __iomem *dpram;
u16 scc_pram_offset;
u32 dpram_offset;
u32 qe_subblock;
cbd_t __iomem *bd_table;
dma_addr_t bd_dma_addr;
size_t bd_size;
u16 __iomem *int_table;
u16 __iomem *int_curr;
dma_addr_t int_dma_addr;
size_t int_size;
bool is_tsa_64rxtx;
struct list_head chan_head;
struct qmc_chan *chans[64];
};
static void qmc_write8(void __iomem *addr, u8 val)
{
iowrite8(val, addr);
}
static void qmc_write16(void __iomem *addr, u16 val)
{
iowrite16be(val, addr);
}
static u16 qmc_read16(void __iomem *addr)
{
return ioread16be(addr);
Annotation
- Immediate include surface: `soc/fsl/qe/qmc.h`, `linux/bitfield.h`, `linux/dma-mapping.h`, `linux/firmware.h`, `linux/hdlc.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`.
- Detected declarations: `struct qmc_xfer_desc`, `struct qmc_chan`, `struct qmc_data`, `struct qmc`, `enum qmc_version`, `function qmc_write8`, `function qmc_write16`, `function qmc_read16`, `function qmc_setbits16`, `function qmc_clrbits16`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: integration 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.