• S
    spi: tegra114: fix for unpacked mode transfers · 45e5f39e
    Sowjanya Komatineni 提交于
    [ Upstream commit 1a89ac5b91895127f7c586ec5075c3753ca25501 ]
    
    Fixes: computation of actual bytes to fill/receive in/from FIFO in unpacked
    mode when transfer length is not a multiple of requested bits per word.
    
    unpacked mode transfers fails when the transfer includes partial bytes in
    the last word.
    
    Total words to be written/read to/from FIFO is computed based on transfer
    length and bits per word. Unpacked mode includes 0 padding bytes for partial
    words to align with bits per word and these extra bytes are also accounted
    for calculating bytes left to transfer in the current driver.
    
    This causes extra bytes access of tx/rx buffers along with buffer index
    position crossing actual length where remain_len becomes negative and due to
    unsigned type, negative value is a 32 bit representation of signed value
    and transferred bytes never meets the actual transfer length resulting in
    transfer timeout and a hang.
    
    This patch fixes this with proper computation of the actual bytes to fill in
    FIFO during transmit and the actual bytes to read from FIFO during receive
    ignoring 0 padded bytes.
    Signed-off-by: NSowjanya Komatineni <skomatineni@nvidia.com>
    Signed-off-by: NMark Brown <broonie@kernel.org>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    45e5f39e
spi-tegra114.c 34.0 KB