drivers: dma: dma_lpc: fix bug with transfer size/width
Fix for bug: https://github.com/zephyrproject-rtos/zephyr/issues/59802 The DMA controller only supports one transfer size, but the Zephyr DMA driver api allows specifying a source_data_size and dest_data_size which might be different. An old version was always using dest_data_size for the transfer size (variable is called "width"), but a recent change made the driver use the MIN for the source and dest data sizes. The MIN choice breaks the I2S driver because it always set source_data_size to 1, but dest_data_size was typically 4 for like two-channel 16-bit PCM data. So the old driver worked using dest_data_size, but the new driver broke I2S using MIN since source_data_size was 1. To prevent confusion, change the DMA driver to assert that source_data_size and dest_data_size are the same. Also assert that the source_address and dest_address for each block_config are properly aligned for the transfer size, since that is a documentated requirement for the DMA controller. Also rename max_xfer to max_xfer-bytes to be more clear what the units are, and use this value in many places that are comparing block_size in bytes rather than converting block_size to words by dividing by width and then comparing to NXP_LPC_DMA_MAX_XFER. Signed-off-by:Mike J. Chen <mjchen@google.com>
Loading
Please sign in to comment