• Chuanhong Guo's avatar
    spi: add support for mediatek spi-nor controller · 881d1ee9
    Chuanhong Guo authored
    This is a driver for mtk spi-nor controller using spi-mem interface.
    The same controller already has limited support provided by mtk-quadspi
    driver under spi-nor framework and this new driver is a replacement
    for the old one.
    
    Comparing to the old driver, this driver has following advantages:
    1. It can handle any full-duplex spi transfer up to 6 bytes, and
       this is implemented using generic spi interface.
    2. It take account into command opcode properly. The reading routine
       in this controller can only use 0x03 or 0x0b as opcode on 1-1-1
       transfers, but old driver doesn't implement this properly. This
       driver checks supported opcode explicitly and use (1) to perform
       unmatched operations.
    3. It properly handles SFDP reading. Old driver can't read SFDP
       due to the bug mentioned in (2).
    4. It can do 1-2-2 and 1-4-4 fast reading on spi-nor. These two ops
       requires parsing SFDP, which isn't possible in old driver. And
       the old driver is only flagged to support 1-1-2 mode.
    5. It takes advantage of the DMA feature in this controller for
       long reads and supports IRQ on DMA requests to free cpu cycles
       from polling status registers on long DMA reading. It achieves
       up to 17.5MB/s reading speed (1-4-4 mode) which is way faster
       than the old one. IRQ is implemented as optional to maintain
       backward compatibility.
    Signed-off-by: default avatarChuanhong Guo <gch981213@gmail.com>
    Link: https://lore.kernel.org/r/20200306085052.28258-3-gch981213@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    881d1ee9
spi-mtk-nor.c 16.8 KB