dma: add channels support
Get series with b4
b4 am 20181126231517.GF11247@bill-the-catVersions newest first
- v8 Latest0 of 31 patches 0 repliesNew
Patches in v8 No applies recorded yet
None of the 31 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.
Cover letter [U-Boot] [PATCH v8 00/31] dma: add channels support
Quoted 90 lines · Álvaro Fernández Rojas
In order to add bcm6348-enet support, dma-uclass must be extended to support dma channels and reworked to operate like the other dm uclass (clk, reset...).
===
A DMA is a feature of computer systems that allows certain hardware subsystems to access main system memory, independent of the CPU. DMA channels are typically generated externally to the HW module consuming them, by an entity this API calls a DMA provider. This API provides a standard means for drivers to enable and disable DMAs, and to copy, send and receive data using DMA.
DMA channel API:
dma_get_by_index()
dma_get_by_name()
dma_request()
dma_free()
dma_enable()
dma_disable()
dma_prepare_rcv_buf()
dma_receive()
dma_send()A driver that implements
UCLASS_DMAis a DMA provider. A provider will often implement multiple separate DMAs channels, since the hardware it manages often has this capability.dma_uclass.hdescribes the interface which DMA providers must implement.DMA consumers/clients are the HW modules driven by the DMA channels.
DMA consumer
DMA_MEM_TO_DEV(transmit) usage example (based on networking). Note. In u-bootdma_send()is sync operation always - it'll start transfer and will poll for it to complete:
- get/request dma channelstruct dma dma_tx; ret = dma_get_by_name(common->dev, "tx0", &dma_tx); if (ret) ...- enable dma channel
ret = dma_enable(&dma_tx); if (ret) ...- dma transmit
DMA_MEM_TO_DEV.struct ti_drv_packet_data packet_data; packet_data.opt1 = val1; packet_data.opt2 = val2; ret = dma_send(&dma_tx, packet, length, &packet_data); if (ret) ..DMA consumer
DMA_DEV_TO_MEM(receive) usage example (based on networking). Note.dma_receive()is sync operation always - it'll start transfer (if required) and will poll for it to complete (or for any previously configured dev2mem transfer to complete):
- get/request dma channelstruct dma dma_rx; ret = dma_get_by_name(common->dev, "rx0", &dma_rx); if (ret) ...- enable dma channel
ret = dma_enable(&dma_rx); if (ret) ...- dma receive
DMA_DEV_TO_MEM.struct ti_drv_packet_data packet_data; len = dma_receive(&dma_rx, (void **)packet, &packet_data); if (ret < 0) ...DMA consumer
DMA_DEV_TO_MEM(receive) zero-copy usage example (based on networking). Networking subsystem allows to configure and use few receive buffers (dev2mem), as Networking RX DMA channels usually implemented as streaming interface
- get/request dma channelstruct dma dma_rx; ret = dma_get_by_name(common->dev, "rx0", &dma_rx); if (ret) ... for (i = 0; i < RX_DESC_NUM; i++) { ret = dma_prepare_rcv_buf(&dma_rx, net_rx_packets[i], RX_BUF_SIZE); if (ret) ... }- enable dma channel
ret = dma_enable(&dma_rx); if (ret) ...- dma receive
DMA_DEV_TO_MEM.
Quoted 14 lines
struct ti_drv_packet_data packet_data; void *packet; len = dma_receive(&dma_rx, &packet, &packet_data); if (ret < 0) .. /* packet - points on buffer prepared by dma_prepare_rcv_buf(). process packet*/ - return buffer back to DAM channel ret = dma_prepare_rcv_buf(&dma_rx, net_rx_packets[rx_next], RX_BUF_SIZE);
Can you please split this into 2 parts, the generic DMA portion, and the bcm6368-enet/etc part? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181126/ad0bf55c/attachment.sig>