Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44851 )
Change subject: soc/mediatek/mt8192: Add SPI flash controller DMA read function ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44851/1/src/soc/mediatek/mt8192/fla... File src/soc/mediatek/mt8192/flash_controller.c:
https://review.coreboot.org/c/coreboot/+/44851/1/src/soc/mediatek/mt8192/fla... PS1, Line 142: size_t done = 0; : uintptr_t dma_buf = (uintptr_t)_dma_coherent; : size_t dma_buf_len = REGION_SIZE(dma_coherent); : u32 next; : : if (!IS_ALIGNED((uintptr_t)addr, SFLASH_DMA_ALIGN)) { : next = MIN(ALIGN_UP((uintptr_t)addr, SFLASH_DMA_ALIGN) - : (uintptr_t)addr, len); : if (pio_read(addr, buf, next)) : return -1; : done += next; : } : : while (len - done >= SFLASH_DMA_ALIGN) { : next = MIN(dma_buf_len, ALIGN_DOWN(len - done, : SFLASH_DMA_ALIGN)); : if (dma_read(addr + done, buf + done, next, dma_buf, : dma_buf_len)) : return -1; : done += next; : } : next = len - done; : if (next > 0 && pio_read(addr + done, buf + done, next)) : return -1;
I tested and this works well: […]
Ack