[PATCH v3 1/4] i3c: master: Add helpers for DMA mapping and bounce buffer handling
Frank Li
Frank.li at nxp.com
Wed Aug 20 09:03:10 PDT 2025
On Wed, Aug 20, 2025 at 02:34:44PM +0300, Jarkko Nikula wrote:
> Some I3C controllers such as MIPI I3C HCI may pad the last DWORD (32-bit)
> with stale data from the RX FIFO in DMA transfers if the receive length
> is not DWORD aligned and when the device DMA is IOMMU mapped.
>
> In such a case, a properly sized bounce buffer is required in order to
> avoid possible data corruption. In a review discussion, proposal was to
> have a common helpers in I3C core for DMA mapping and bounce buffer
> handling.
>
> Drivers may use the helper i3c_master_dma_map_single() to map a buffer
> for a DMA transfer. It internally allocates a bounce buffer if buffer is
> not DMA'able or when the driver requires it for a transfer.
>
> Helper i3c_master_dma_unmap_single() does the needed cleanups and
> data copying from the bounce buffer.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula at linux.intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> drivers/i3c/master.c | 73 ++++++++++++++++++++++++++++++++++++++
> include/linux/i3c/master.h | 26 ++++++++++++++
> 2 files changed, 99 insertions(+)
>
...
> + if (_T) i3c_master_dma_unmap_single(_T))
>
> int i3c_master_set_info(struct i3c_master_controller *master,
> const struct i3c_device_info *info);
> --
> 2.47.2
>
>
> --
> linux-i3c mailing list
> linux-i3c at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
More information about the linux-i3c
mailing list