• Serge Semin's avatar
    spi: dw: Introduce Synopsys IP-core versions interface · 2cc8d922
    Serge Semin authored
    The driver currently supports two IP-core versions. It's DW APB SSI which
    is older version of the controller with APB system bus interface, and DW
    SSI controller with AHB bus interface. The later one is supposed to be a
    new generation high-speed SSI. Even though both of these IP-cores have got
    an almost identical registers space there are some differences. The driver
    differentiates these distinctions by the DW_SPI_CAP_DWC_HSSI capability
    flag. In addition to that each DW SSI IP-core is equipped with a Synopsys
    Component version register, which encodes the IP-core release ID the has
    been synthesized from. Seeing we are going to need the later one to
    differentiate some controller peculiarities it would be better to have a
    unified interface for both IP-core line and release versions instead of
    using each of them separately.
    
    Introduced here IP-core versioning interface consists of two parts:
    1) IDs of the IP-core (virtual) and component versions.
    2) a set of macro helpers to identify current IP-core and component
    versions.
    
    So the platform code is supposed to assign a proper IP-core version based
    on it's platform -knowledge. The main driver initialization method reads
    the IP-core release ID from the SSI component version register. That data
    is used by the helpers to distinguish one IP-core release from another.
    Thus the rest of the driver can use these macros to implement the
    conditional code execution based on the specified IP-core and version IDs.
    
    Collect the IP-core versions interface and the defined capabilities at the
    top of the header file since they represent a common device description
    data and so to immediately available for the driver hackers.
    Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
    Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Link: https://lore.kernel.org/r/20211115181917.7521-6-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    2cc8d922
spi-dw-core.c 26.9 KB