• Sam Protsenko's avatar
    soc: samsung: Add USI driver · b603377e
    Sam Protsenko authored
    USIv2 IP-core is found on modern ARM64 Exynos SoCs (like Exynos850) and
    provides selectable serial protocol (one of: UART, SPI, I2C). USIv2
    registers usually reside in the same register map as a particular
    underlying protocol it implements, but have some particular offset. E.g.
    on Exynos850 the USI_UART has 0x13820000 base address, where UART
    registers have 0x00..0x40 offsets, and USI registers have 0xc0..0xdc
    offsets. Desired protocol can be chosen via SW_CONF register from System
    Register block of the same domain as USI.
    
    Before starting to use a particular protocol, USIv2 must be configured
    properly:
      1. Select protocol to be used via System Register
      2. Clear "reset" flag in USI_CON
      3. Configure HWACG behavior (e.g. for UART Rx the HWACG must be
         disabled, so that the IP clock is not gated automatically); this is
         done using USI_OPTION register
      4. Keep both USI clocks (PCLK and IPCLK) running during USI registers
         modification
    
    This driver implements the above behavior. Of course, USIv2 driver
    should be probed before UART/I2C/SPI drivers. It can be achieved by
    embedding UART/I2C/SPI nodes inside of the USI node (in Device Tree);
    driver then walks underlying nodes and instantiates those. Driver also
    handles USI configuration on PM resume, as register contents can be lost
    during CPU suspend.
    
    This driver is designed with different USI versions in mind. So it
    should be relatively easy to add new USI revisions to it later.
    Signed-off-by: default avatarSam Protsenko <semen.protsenko@linaro.org>
    Link: https://lore.kernel.org/r/20211204195757.8600-3-semen.protsenko@linaro.orgTested-by: default avatarChanho Park <chanho61.park@samsung.com>
    Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    b603377e
exynos-usi.c 7 KB