[PATCH v3 2/3] usb: dwc3: fix dcache flush range calculation
Marek Vasut
marex at denx.de
Thu Oct 3 15:19:58 CEST 2024
On 10/3/24 2:49 PM, Neil Armstrong wrote:
> On 02/10/2024 16:55, Marek Vasut wrote:
>> On 10/2/24 4:39 PM, Neil Armstrong wrote:
>>> The current flush operation will omit doing a flush/invalidate on
>>> the first and last bytes if the base address and size are not aligned
>>> with DMA_MINALIGN.
>>>
>>> This causes operation failures Qualcomm platforms.
>>>
>>> Take in account the alignment and size of the buffer and also
>>> flush the previous and last cacheline.
>>>
>>> Remove CACHELINE_SIZE which was the same as DMA_MINALIGN.
>>
>> It isn't the same, CACHELINE_SIZE was set to CONFIG_SYS_CACHELINE_SIZE
>> (CPU L1 cache cacheline length) while ARCH_DMA_MINALIGN is DMA engine
>> alignment requirement (from times where there used to be one DMA
>> engine on most devices). You likely want a
>> max(CONFIG_SYS_CACHELINE_SIZE, dwc3-buffer-alignment-requirement) to
>> really correctly align the buffer.
>
> It is definitely true for platforms declaring dma_alloc_coherent() (arm,
> riscv, x86)
> except nios2 but there's 0 chance dwc3 appears on a nios2 platform.
There is real chance of that, because on modern SoCFPGA platforms
(Agilex) you can have the FPGA content access the SoC peripherals, and
one of the SoC peripherals is DWC3 controller. If anyone would actually
synthesize it is another question ... but it is an FPGA, so that option
exists.
More information about the U-Boot
mailing list