• Alexander Monakov's avatar
    i2c: designware: refactor low-level enable/disable · 9f4659ba
    Alexander Monakov authored
    Low-level controller enable function __i2c_dw_enable is overloaded to
    also handle disabling. What's worse, even though the documentation
    requires polling the IC_ENABLE_STATUS register when disabling, this
    is not done: polling needs to be requested specifically by calling
    __i2c_dw_enable_and_wait, which can also poll on enabling, but that
    doesn't work if the IC_ENABLE_STATUS register is not implemented.
    This is quite confusing if not in fact backwards.
    Especially since the documentation says that disabling should be
    followed by polling, the driver should be using a separate function
    where it does one-shot disables to make the optimization stand out.
    This refactors the two functions so that requested status is given
    in the name rather than in a boolean argument. Specifically:
     - __i2c_dw_enable: enable without polling (in accordance with docs)
     - __i2c_dw_disable: disable and do poll (also as suggested by docs)
     - __i2c_dw_disable_nowait: disable without polling (Linux-specific)
    No functional change.
    Signed-off-by: default avatarAlexander Monakov <amonakov@ispras.ru>
    Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
    [wsa: fixed blank lines in header file]
    Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>