1. 10 Aug, 2018 7 commits
    • Biju Das's avatar
      gpiolib: Avoid calling chip->request() for unused gpios · 3789f5ac
      Biju Das authored
      Add a check for unused gpios to avoid chip->request() call to client
      driver for unused gpios.
      Signed-off-by: default avatarBiju Das <biju.das@bp.renesas.com>
      Reviewed-by: default avatarFabrizio Castro <fabrizio.castro@bp.renesas.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      3789f5ac
    • Linus Walleij's avatar
      gpio: tegra: Include the right header · 21041dab
      Linus Walleij authored
      This is a GPIO driver so include only <linux/gpio/driver.h>.
      Drop the use of GPIOF_* flags: these are for consumers, not
      drivers. Just return 0/1.
      
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Thierry Reding <treding@nvidia.com>
      Reviewed-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      21041dab
    • Linus Walleij's avatar
      gpio: mmio: Fix up inverted direction registers · d799a4de
      Linus Walleij authored
      The bgpio_init() takes one of two arguments to specify a register
      to set the direction of the GPIO line: either dirout that
      indicates that a 1 in the bit in that register sets the
      corresponding line to output, or dirin which indicates that
      a 1 in the bit in that register sets the corresponding line to
      input. Conversely setting the bit to 0 on these will turn the
      line into input and output respectively. One of these can
      be defined but not both.
      
      This means that a platform that sets a bit to 1 for output
      only defines dirout and a platform that sets a bit to 0 for
      output only defines dirin. In short this defines the polarity
      of the direction register.
      
      Both can also be left as NULL meaning the GPIO chip is either
      input only or output only.
      
      Tomer Maimon discovered that for get/set chips (those where the
      get and set registers are defined but no separate clear register,
      and specifying BGPIOF_READ_OUTPUT_REG_SET so that we say we
      want to read the output value from the SET register)
      we are unconditionally reading the value from the SET register
      when the direction bit is 1 and from the DAT register when the
      direction bit is 0, not taking the direction bit polarity into
      account.
      
      It would be expected that when the direction bit is inverted
      (dirin is defined but not dirout) we read the current value from
      the DAT register when the bit is 1 and from the SET register
      when the bit is 0.
      
      Currently only some versions of ATH79, brcmstb, some versions of
      CLP711x, GE, IOP and Loongson use the dirin mode (a 1 in the
      register means input). They are unaffected because
      BGPIOF_READ_OUTPUT_REG_SET is not set on any of them. (They
      do not read back the SET register to figure out the output
      value.) So this is no regression with current drivers.
      
      However the behaviour is wrong and does not work with Tomer's
      new driver where he needs to use the BGIOF_READ_OUTPUT_REG_SET.
      This fixes the above issue by:
      
      - Instead of defining separate functions for the inverted case,
        set up a flag in the gpio_chip that indicates that the
        direction is inverted.
      - Remove the special inverted functions for setting
        input/output and getting the direction, rely on the flag
        instead.
      - Respect this flag in bgpio_get_set() and
        bgpio_get_set_multiple()
      Reported-by: default avatarTomer Maimon <tmaimon77@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      d799a4de
    • Linus Walleij's avatar
      gpio: xilinx: Use the right include · 516df4eb
      Linus Walleij authored
      This is a GPIO driver so use only <linux/gpio/driver.h>.
      Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      516df4eb
    • Linus Walleij's avatar
      gpio: timberdale: Include the right header · 50fe83a3
      Linus Walleij authored
      This is a GPIO driver so include only <linux/gpio/driver.h>.
      
      Cc: Richard Röjfors <richard.rojfors@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      50fe83a3
    • Linus Walleij's avatar
      gpio: tb10x: Use the right include · 32e49b9a
      Linus Walleij authored
      This driver includes the legacy <linux/gpio.h> and
      <linux/of_gpio.h> but all it needs is really <linux/gpio/driver.h>.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      32e49b9a
    • Biju Das's avatar
      gpiolib: Fix of_node inconsistency · 6ff04974
      Biju Das authored
      Some platforms are not setting of_node in the driver. On these platforms
      defining gpio-reserved-ranges on device tree leads to kernel crash.
      
      It is due to some parts of the gpio core relying on the driver to set up
      of_node,while other parts do themselves.This inconsistent behaviour leads
      to a crash.
      
      gpiochip_add_data_with_key() calls gpiochip_init_valid_mask() with of_node
      as NULL. of_gpiochip_add() fills "of_node" and calls
      of_gpiochip_init_valid_mask().
      
      The fix is to move the assignment to chip->of_node from of_gpiochip_add()
      to gpiochip_add_data_with_key().
      Signed-off-by: default avatarBiju Das <biju.das@bp.renesas.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      6ff04974
  2. 06 Aug, 2018 9 commits
  3. 02 Aug, 2018 1 commit
  4. 30 Jul, 2018 1 commit
  5. 29 Jul, 2018 10 commits
  6. 16 Jul, 2018 2 commits
  7. 13 Jul, 2018 7 commits
  8. 09 Jul, 2018 3 commits