1. 30 Oct, 2017 1 commit
    • Linus Walleij's avatar
      gpio-mmio: Use the new .get_multiple() callback · 80057cb4
      Linus Walleij authored
      It is possible to read all lines of a generic MMIO GPIO chip
      with a single register read so support this if we are in
      native endianness.
      
      Add an especially quirky callback to read multiple lines for
      the variants that require you to read values from the
      output registers if and only if the line is set as output.
      We managed to do that with a maximum of two register reads,
      and just one read if the requested lines are all input or all
      output.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      80057cb4
  2. 25 Oct, 2017 1 commit
    • Linus Walleij's avatar
      gpio: mmio: Make pin2mask() a private business · 24efd94b
      Linus Walleij authored
      The vtable call pin2mask() was introducing a vtable function call
      in every gpiochip callback for a generic MMIO GPIO chip. This was
      not exactly efficient. (Maybe link-time optimization could get rid of
      it, I don't know.)
      
      After removing all external calls into this API we can make it a
      boolean flag in the struct gpio_chip call and sink the function into
      the gpio-mmio driver yielding encapsulation and potential speedups.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      24efd94b
  3. 23 Mar, 2017 1 commit
  4. 11 Aug, 2016 1 commit
  5. 08 Jun, 2016 2 commits
  6. 29 Apr, 2016 2 commits
  7. 23 Feb, 2016 1 commit
  8. 05 Jan, 2016 2 commits
    • Linus Walleij's avatar
      gpio: generic: factor into gpio_chip struct · 0f4630f3
      Linus Walleij authored
      The separate struct bgpio_chip has been a pain to handle, both
      by being confusingly similar in name to struct gpio_chip and
      for being contained inside a struct so that struct gpio_chip
      is contained in a struct contained in a struct, making several
      steps of dereferencing necessary.
      
      Make things simpler: include the fields directly into
      <linux/gpio/driver.h>, #ifdef:ed for CONFIG_GENERIC_GPIO, and
      get rid of the <linux/basic_mmio_gpio.h> altogether. Prefix
      some of the member variables with bgpio_* and add proper
      kerneldoc while we're at it.
      
      Modify all users to handle the change and use a struct
      gpio_chip directly. And while we're at it: replace all
      container_of() dereferencing by gpiochip_get_data() and
      registering the gpio_chip with gpiochip_add_data().
      
      Cc: arm@kernel.org
      Cc: Alexander Shiyan <shc_work@mail.ru>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <kernel@pengutronix.de>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-omap@vger.kernel.org
      Cc: linux-samsung-soc@vger.kernel.org
      Cc: bcm-kernel-feedback-list@broadcom.com
      Acked-by: default avatarGregory Fong <gregory.0xf0@gmail.com>
      Acked-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
      Acked-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Acked-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      0f4630f3
    • Linus Walleij's avatar
      gpio: generic: fix signedness bug found by cppcheck · 4b63739e
      Linus Walleij authored
      cppcheck reports this:
      
      (style) int result is returned as long value. If the return
      value is long to avoid loss of information, then you have
      loss of information.
      
      This can be fixed with (1UL << pin) but that is the same
      as using <linux/bitops.h> that already use 1UL so take
      this approach.
      Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      4b63739e
  9. 17 Dec, 2015 1 commit
  10. 19 Nov, 2015 1 commit
    • Linus Walleij's avatar
      gpio: change member .dev to .parent · 58383c78
      Linus Walleij authored
      The name .dev in a struct is normally reserved for a struct device
      that is let us say a superclass to the thing described by the struct.
      struct gpio_chip stands out by confusingly using a struct device *dev
      to point to the parent device (such as a platform_device) that
      represents the hardware. As we want to give gpio_chip:s real devices,
      this is not working. We need to rename this member to parent.
      
      This was done by two coccinelle scripts, I guess it is possible to
      combine them into one, but I don't know such stuff. They look like
      this:
      
      @@
      struct gpio_chip *var;
      @@
      -var->dev
      +var->parent
      
      and:
      
      @@
      struct gpio_chip var;
      @@
      -var.dev
      +var.parent
      
      and:
      
      @@
      struct bgpio_chip *var;
      @@
      -var->gc.dev
      +var->gc.parent
      
      Plus a few instances of bgpio that I couldn't figure out how
      to teach Coccinelle to rewrite.
      
      This patch hits all over the place, but I *strongly* prefer this
      solution to any piecemal approaches that just exercise patch
      mechanics all over the place. It mainly hits drivers/gpio and
      drivers/pinctrl which is my own backyard anyway.
      
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Rafał Miłecki <zajec5@gmail.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
      Cc: Alek Du <alek.du@intel.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.com>
      Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Acked-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      58383c78
  11. 27 Oct, 2015 1 commit
    • Guenter Roeck's avatar
      gpio: generic: Revert to old error handling in bgpio_map · b2f68b63
      Guenter Roeck authored
      Returning an error instead of NULL in bgpio_map if
      platform_get_resource_byname does not find a resource was introduced with
      commit cf3f2a2c ("gpio: generic: improve error handling in bgpio_map").
      This results in several qemu runtime failures with default and non-default
      configurations, if attempts are made to boot from mmcblk0. Examples for
      failures with multi_v7_defconfig are
      
      Machine: vexpress-a9	dtb: vexpress-v2p-ca9
      Machine: vexpress-a15	dtb: vexpress-v2p-ca15-tc1
      
      Crash:
      
      VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6
      Please append a correct "root=" boot option; here are the available partitions:
      Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
      
      Looking into the code, always returning an error if bgpio_map fails
      does not appear to make much sense, since the code in bgpio_setup_io
      specifically supports some of the resources to be NULL.
      
      Fixes: cf3f2a2c ("gpio: generic: improve error handling in bgpio_map")
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      b2f68b63
  12. 05 Oct, 2015 3 commits
  13. 27 Jul, 2015 1 commit
  14. 15 Jul, 2015 1 commit
  15. 11 May, 2015 1 commit
  16. 19 Jan, 2015 1 commit
  17. 22 Jul, 2014 1 commit
  18. 23 May, 2014 1 commit
  19. 18 Mar, 2014 1 commit
  20. 06 Feb, 2014 2 commits
  21. 11 Apr, 2013 1 commit
  22. 10 Apr, 2013 1 commit
  23. 28 Nov, 2012 3 commits
  24. 19 May, 2012 1 commit
    • Shawn Guo's avatar
      gpio/generic: initialize basic_mmio_gpio shadow variables properly · 3e11f7b8
      Shawn Guo authored
      It fixes the issue in gpio-generic that commit fb149218 (gpio/mxc: add
      missing initialization of basic_mmio_gpio shadow variables) manged to
      fix in gpio-mxc driver, so that other platform specific drivers do not
      suffer from the same problem over and over again.
      
      Changes since v1:
      * Turn the last parameter of bgpio_init() "bool big_endian" into
        "unsigned long flags" and give those really quirky hardwares a
        chance to tell that reg_set and reg_dir are unreadable.
      Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
      [grant.likely: Fix big-endian usage to explicitly set BBGPIOF_BIG_ENDIAN]
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      3e11f7b8
  25. 02 Jan, 2012 1 commit
  26. 15 Sep, 2011 1 commit
  27. 06 Jun, 2011 1 commit
  28. 20 May, 2011 5 commits