RE: [PATCH v2] i2c: tegra: Share same DMA channel for Rx and Tx

From: Akhil R
Date: Thu Feb 23 2023 - 05:04:56 EST


> > Allocate only one DMA channel for I2C and share it for both Tx and Rx.
> > Since I2C supports only half duplex, there is no impact on perf with
> > this.
> >
> > Signed-off-by: Akhil R <akhilrajeev@xxxxxxxxxx>
> > ---
> > v1->v2: Remove WARN_ON for DMA channel mismatch. There is only one
> > channel in use with this change.
> >
> > drivers/i2c/busses/i2c-tegra.c | 54 ++++++++++------------------------
> > 1 file changed, 15 insertions(+), 39 deletions(-)
>
> I'm a little confused by this. All device trees already list the very
> same reference for both TX and RX DMA channels in the I2C nodes, so
> these channels are already effectively shared, aren't they?
The value given in DT refers to the slave-id of an I2C instance and not the
channel number. Each I2C instance was in-effect using two different DMA
channels with the same slave-id.
This change is to free up the extra DMA channel since both will not be
used simultaneously.

>
> So all this does is to get rid of the duplicated pointer? In practice,
> is the DMA channel pointer going to point to the exact same memory or
> are these separate objects that happen to point to the same hardware
> resource?
They are indeed separate hardware resource itself. As I described above,
two separate DMA channels were in use for each I2C instance.

>
> In either case, I think the commit message should clarify that. Also, a
> few minor nits below...

Agreed with the other comments.

Regards,
Akhil