• Linus Walleij's avatar
    gpio: mmio: Support two direction registers · f69e00bd
    Linus Walleij authored
    It turns out that one specific hardware has two direction
    registers: one to set a GPIO line as input and another one
    to set a GPIO line as output. So in theory a line can be
    configured as input and output at the same time.
    
    Make the MMIO GPIO helper deal with this: store both
    registers in the state container, use both in the generic
    code if present. Synchronize the input register to the
    output register when we register a GPIO chip, with the
    output settings taking precedence.
    
    Keep the helper variable to detect inverted direction
    semantics (only direction in register) but augment the
    code to be more straight-forward for the generic case
    when setting the registers.
    
    Fix some flunky with unreadable direction registers at
    the same time as we're touching this code.
    
    Cc: David Woods <dwoods@mellanox.com>
    Cc: Shravan Kumar Ramani <sramani@mellanox.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    f69e00bd
gpio-mmio.c 21.3 KB