Re: [PATCH v9 09/38] dma: cirrus: Convert to DT for Cirrus EP93xx

From: Nikita Shubin
Date: Thu Mar 28 2024 - 03:30:38 EST


Hello Vinod!

Thank you for looking into this.

On Thu, 2024-03-28 at 10:01 +0530, Vinod Koul wrote:
> On 26-03-24, 12:18, Nikita Shubin via B4 Relay wrote:
> > From: Nikita Shubin <nikita.shubin@xxxxxxxxxxx>
> >
> > +enum ep93xx_dma_type {
> > +       M2P_DMA,
>
> Is this missing P2M?
>
> > +       M2M_DMA,
> > +};
> > +

These are internal types used only to distinguish M2P/P2M and M2M
capable controllers in "of_device_id ep93xx_dma_of_ids[]".

So M2P_DMA is M2P/P2M, a can rename M2P_DMA to M2P_P2M_DMA to avoid
confusion.


> >  struct ep93xx_dma_engine;
> >  static int ep93xx_dma_slave_config_write(struct dma_chan *chan,
> >                                          enum
> > dma_transfer_direction dir,
> > @@ -129,11 +136,17 @@ struct ep93xx_dma_desc {
> >         struct list_head                node;
> >  };
> >  
> > +struct ep93xx_dma_chan_cfg {
> > +       u8                              port;
> > +       enum dma_transfer_direction     dir;
>
> Why is direction stored here, it should be derived from the prep_xxx
> call, that has direction as an argument
>
>

M2P/P2M channels aren't unidirectional.

Citing "EP9xx User Guide":

"Ten fully independent, programmable DMA controller internal M2P/P2M
channels (5 Tx and 5 Rx)."

We need to return correct channel based on Device Tree provided data,
because we need direction in device_alloc_chan_resources() for hardware
setup before prepping.

May be i am mistaking somewhere.