drivers/usb/renesas_usbhs/fifo.c
Source file repositories/reference/linux-study-clean/drivers/usb/renesas_usbhs/fifo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/renesas_usbhs/fifo.c- Extension
.c- Size
- 35285 bytes
- Lines
- 1487
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/io.hlinux/scatterlist.hcommon.hpipe.h
Detected Declarations
function Copyrightfunction usbhsf_null_handlefunction usbhs_pkt_pushfunction __usbhsf_pkt_delfunction usbhsf_pkt_handlerfunction usbhs_pkt_startfunction usbhsf_tx_irq_ctrlfunction usbhsf_rx_irq_ctrlfunction usbhsf_send_terminatorfunction usbhsf_fifo_barrierfunction usbhsf_fifo_clearfunction usbhsf_fifo_rcv_lenfunction usbhsf_fifo_unselectfunction usbhsf_fifo_selectfunction usbhs_dcp_dir_switch_to_writefunction usbhs_dcp_dir_switch_to_readfunction usbhs_dcp_dir_switch_donefunction stagefunction stagefunction usbhsf_pio_try_pushfunction usbhsf_pio_prepare_pushfunction usbhsf_prepare_popfunction usbhsf_pio_try_popfunction usbhsf_ctrl_stage_endfunction usbhs_for_each_dfifofunction __usbhsf_dma_ctrlfunction __usbhsf_dma_map_ctrlfunction usbhsf_dma_xfer_preparingfunction xfer_workfunction usbhsf_dma_prepare_pushfunction usbhsf_dma_push_donefunction usbhsf_dma_prepare_pop_with_rx_irqfunction usbhsf_dma_prepare_pop_with_usb_dmacfunction usbhsf_dma_prepare_popfunction usbhsf_dma_try_pop_with_rx_irqfunction usbhsf_dma_try_popfunction usbhsf_dma_pop_done_with_rx_irqfunction usbhs_dma_calc_received_sizefunction usbhsf_dma_pop_done_with_usb_dmacfunction usbhsf_dma_pop_donefunction usbhsf_dma_filterfunction usbhsf_dma_quitfunction usbhsf_dma_init_pdevfunction usbhsf_dma_init_dtfunction usbhsf_dma_initfunction usbhsf_irq_emptyfunction usbhsf_irq_readyfunction usbhsf_dma_complete
Annotated Snippet
if (chan) {
dmaengine_terminate_sync(chan);
usbhsf_dma_unmap(pkt);
} else {
if (usbhs_pipe_is_dir_in(pipe))
usbhsf_rx_irq_ctrl(pipe, 0);
else
usbhsf_tx_irq_ctrl(pipe, 0);
}
usbhs_pipe_clear_without_sequence(pipe, 0, 0);
usbhs_pipe_running(pipe, 0);
__usbhsf_pkt_del(pkt);
}
if (fifo)
usbhsf_fifo_unselect(pipe, fifo);
usbhs_unlock(priv, flags);
/******************** spin unlock ******************/
return pkt;
}
enum {
USBHSF_PKT_PREPARE,
USBHSF_PKT_TRY_RUN,
USBHSF_PKT_DMA_DONE,
};
static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
struct usbhs_pkt *pkt;
struct device *dev = usbhs_priv_to_dev(priv);
int (*func)(struct usbhs_pkt *pkt, int *is_done);
unsigned long flags;
int ret = 0;
int is_done = 0;
/******************** spin lock ********************/
usbhs_lock(priv, flags);
pkt = __usbhsf_pkt_get(pipe);
if (!pkt) {
ret = -EINVAL;
goto __usbhs_pkt_handler_end;
}
switch (type) {
case USBHSF_PKT_PREPARE:
func = pkt->handler->prepare;
break;
case USBHSF_PKT_TRY_RUN:
func = pkt->handler->try_run;
break;
case USBHSF_PKT_DMA_DONE:
func = pkt->handler->dma_done;
break;
default:
dev_err(dev, "unknown pkt handler\n");
goto __usbhs_pkt_handler_end;
}
if (likely(func))
ret = func(pkt, &is_done);
if (is_done)
__usbhsf_pkt_del(pkt);
__usbhs_pkt_handler_end:
usbhs_unlock(priv, flags);
/******************** spin unlock ******************/
if (is_done) {
pkt->done(priv, pkt);
usbhs_pkt_start(pipe);
}
return ret;
}
void usbhs_pkt_start(struct usbhs_pipe *pipe)
{
usbhsf_pkt_handler(pipe, USBHSF_PKT_PREPARE);
}
/*
* irq enable/disable function
Annotation
- Immediate include surface: `linux/delay.h`, `linux/io.h`, `linux/scatterlist.h`, `common.h`, `pipe.h`.
- Detected declarations: `function Copyright`, `function usbhsf_null_handle`, `function usbhs_pkt_push`, `function __usbhsf_pkt_del`, `function usbhsf_pkt_handler`, `function usbhs_pkt_start`, `function usbhsf_tx_irq_ctrl`, `function usbhsf_rx_irq_ctrl`, `function usbhsf_send_terminator`, `function usbhsf_fifo_barrier`.
- Atlas domain: Driver Families / drivers/usb.
- 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.