• Linus Walleij's avatar
    mtd: physmap_of_gemini: Handle pin control · 9d3b5086
    Linus Walleij authored
    This enables the complex mapping for the Gemini and kicks in
    custom read/write functions that will wrap the existing
    simple functions in calls to enable/disable the parallel
    flash pins using pin controls.
    
    This is necessary on some hardware such as the D-Link
    DIR-685 where all flash pins are patched in/out at the same
    time, but some of the flash pins are in practice unused by
    the flash and have anyway been reused as GPIO.
    
    This concerns specifically CE1 on the Gemini. There is only
    one flash chip, so only CE0 is used, and the line for CE1
    has been reused as chip select for the emulated SPI port
    connected to the display. If we try to use the same lines
    for flash and GPIO at the same time, one of them will loose:
    the GPIO line will disappear because it gets disconnected
    from the pin when the flash group is muxed out.
    
    Fix this by introducing two pin control states named simply
    "enabled" and "disabled" and only enable the flash lines
    when absolutely necessary (during read/write/copy). This
    way, they are available for GPIO at all other times and
    the display works.
    
    Collect all the state variables in a struct named
    struct gemini_flash and allocate this struct at probe
    time.
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
    9d3b5086
Kconfig 13.1 KB