Re: Issues with i.MX SPI DMA transfers

Marc Gonzalez
2019-04-18T10:35:29Z

[ Trimming recipients list ]

On 03/04/2019 17:51, Igor Plyatov wrote:

> 2) I want to improve description and replace magic numbers by constants
> in Device Tree for SDMA. I mean strings like "dmas = <&sdma 11 7 1>,
> <&sdma 12 7 2>;"?
>
> So, finally Device Tree will have strings like
>
> dmas = <&sdma SOME_DEF_A IMX_DMATYPE_.. DMA_PRIO_..>, <&sdma SOME_DEF_B
> IMX_DMATYPE_.. DMA_PRIO_..>;
>
> I think, this will stop black magic manipulations for SDMA in Device
> Tree, by various developers.
>
> Does first digit means "DMA request/event ID"? Where to find more info
> about this?
>
> Does second digit means "enum sdma_peripheral_type"?
>
> Does third digit means "enum imx_dma_prio"?

Start at Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt

https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt

- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
Documentation/devicetree/bindings/dma/dma.txt.
- dma-names: DMA request names, if present, should include "tx" and "rx".

Client drivers should specify the DMA property using a phandle to the controller
followed by DMA controller specific data.

Required property:
- dmas: List of one or more DMA specifiers, each consisting of
- A phandle pointing to DMA controller node
- A number of integer cells, as determined by the
#dma-cells property in the node referenced by phandle
containing DMA controller specific information. This
typically contains a DMA request line number or a
channel number, but can contain any data that is
required for configuring a channel.
- dma-names: Contains one identifier string for each DMA specifier in
the dmas property. The specific strings that can be used
are defined in the binding of the DMA client device.
Multiple DMA specifiers can be used to represent
alternatives and in this case the dma-names for those
DMA specifiers must be identical (see examples).

Turning our attention to Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt

- #dma-cells : Must be <3>.
The first cell specifies the DMA request/event ID. See details below
about the second and third cell.

The second cell of dma phandle specifies the peripheral type of DMA transfer.
The full ID of peripheral types can be found below.

ID transfer type
---------------------
0 MCU domain SSI
1 Shared SSI
2 MMC
3 SDHC
4 MCU domain UART
5 Shared UART
6 FIRI
7 MCU domain CSPI
8 Shared CSPI
9 SIM
10 ATA
11 CCM
12 External peripheral
13 Memory Stick Host Controller
14 Shared Memory Stick Host Controller
15 DSP
16 Memory
17 FIFO type Memory
18 SPDIF
19 IPU Memory
20 ASRC
21 ESAI
22 SSI Dual FIFO (needs firmware ver >= 2)
23 Shared ASRC
24 SAI

The third cell specifies the transfer priority as below.

ID transfer priority
-------------------------
0 High
1 Medium
2 Low