• zhichao.liu's avatar
    spi: mediatek: Fix package division error · cf82d0ec
    zhichao.liu authored
    Commit 7e963fb2 ("spi: mediatek: add ipm design support
    for MT7986") makes a mistake on package dividing operation
    (one change is missing), need to fix it.
    
    Background:
    Ipm design is expanding the HW capability of dma (adjust package
    length from 1KB to 64KB), and using "dev_comp->ipm_support" flag
    to indicate it.
    
    Issue description:
    Ipm support patch (said above) is missing to handle remainder at
    package dividing operation.
    One case, a transmission length is 65KB, is will divide to 1K
    (package length) * 65(package loop) in non-ipm desgin case, and
    will divide to 64K(package length) * 1(package loop) + 1K(remainder)
    in ipm design case. And the 1K remainder will be lost with the
    current SW flow, and the transmission will be failure.
    So, it should be fixed.
    
    Solution:
    Add "ipm_design" flag in function "mtk_spi_get_mult_delta()" to
    indicate HW capability, and modify the parameters corespondingly.
    
    fixes: 7e963fb2 ("spi: mediatek: add ipm design support for MT7986")
    Signed-off-by: default avatarzhichao.liu <zhichao.liu@mediatek.com>
    Link: https://lore.kernel.org/r/20221021091653.18297-1-zhichao.liu@mediatek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    cf82d0ec
spi-mt65xx.c 37.1 KB