Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i3c: mipi-i3c-hci: Round IBI data chunk size to HW supported value

The dma.c: hci_dma_init() sets the CHUNK_SIZE field in the IBI_SETUP
register incorrectly if the calculated ibi_chunk_sz is not exactly
2^(n+2) bytes, where n is 0..6.

Fix this by rounding the chunk size up to nearest 2^(n+2) bytes.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20240628131559.502822-4-jarkko.nikula@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Jarkko Nikula and committed by
Alexandre Belloni
4642f7ed 8a2be2f1

+7
+7
drivers/i3c/master/mipi-i3c-hci/dma.c
··· 279 279 280 280 rh->ibi_chunk_sz = dma_get_cache_alignment(); 281 281 rh->ibi_chunk_sz *= IBI_CHUNK_CACHELINES; 282 + /* 283 + * Round IBI data chunk size to number of bytes supported by 284 + * the HW. Chunk size can be 2^n number of DWORDs which is the 285 + * same as 2^(n+2) bytes, where n is 0..6. 286 + */ 287 + rh->ibi_chunk_sz = umax(4, rh->ibi_chunk_sz); 288 + rh->ibi_chunk_sz = roundup_pow_of_two(rh->ibi_chunk_sz); 282 289 if (rh->ibi_chunk_sz > 256) { 283 290 ret = -EINVAL; 284 291 goto err_out;