04 Sep, 2019

1 commit

  • We need to convert all old gpio irqchips to pass the irqchip
    setup along when adding the gpio_chip. For more info see
    drivers/gpio/TODO.

    For chained irqchips this is a pretty straight-forward
    conversion.

    Cc: Alexander Sverdlin
    Cc: H Hartley Sweeten
    Cc: Thierry Reding
    Tested-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij
    Link: https://lore.kernel.org/r/20190812130000.22252-1-linus.walleij@linaro.org

    Linus Walleij
     

27 Jun, 2019

1 commit


10 Sep, 2018

2 commits

  • The problem is that if port == ARRAY_SIZE() and "gc == &epg->gc[port]"
    then that should be treated as invalid.

    Fixes: fd935fc421e7 ("gpio: ep93xx: Do not pingpong irq numbers")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Linus Walleij

    Dan Carpenter
     
  • Currently the while loop checks for the end of the array using
    the size of egp->gc rather that the number of elements in the array,
    so fix this. Also, perform the array size check first as stylistically
    it is always good to bounds check on an array first before referencing
    the array (in this case, we're just computing the address of an
    element in an array so this is a moot point).

    Fixes: fd935fc421e7 ("gpio: ep93xx: Do not pingpong irq numbers")
    Signed-off-by: Colin Ian King
    Signed-off-by: Linus Walleij

    Colin Ian King
     

29 Aug, 2018

11 commits

  • We can quite easily switch banks/ports A and B to use
    GPIOLIB_IRQCHIP which is code that will be more careful
    about handling interrupt descriptors and use a proper
    irqdomain for translating the IRQs. This cuts down some
    code in favor of using the implementation inside
    gpiolib.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This removes the callback into the gpiolib creating a
    circular call to convert between GPIO numbers and IRQs
    and pushes the whole business into the driver, just
    using an array of IRQ bases for the three IRQ capable
    ports.

    This way we get rid of including that
    no driver should include.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This simplifies and standardizes the AB IRQ handler by using
    the for_each_set_bit() library function.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • In the IRQ-related functions, switch to using the hwirq
    and port number found from the current struct gpio_chip *

    As the lower 3 bits of the IRQ number is identical to the
    lower 3 bits of the GPIO number we can cut some corners.

    Call directly into the gpiochip to set up the direction
    and read the input instead of using the consumer API.

    This enabled us to cut the confusing irq_to_gpio() macro
    that is a remnant of the old generic GPIO API as well.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • For setting debounce config we want to write an offset in
    a per-gpiochip register, and we know which gpiochip we are
    on. Instead of a roundtrip over the IRQ number, figure out
    what port we are on for this GPIO chip, then index to the
    right register and write the value.

    This adds the ep93xx_gpio_port() that finds the port index
    from a struct gpio_chip * that we can later exploit to
    simplify more code.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • The chained irq handler should call chained_irq_enter()
    and chained_irq_exit() before/after handling the chained
    IRQ.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This is closer to what the variable (per bank) actually
    means. We have the .gpio_to_irq() hook registered only
    when this is true.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Instead of using a global variable, pass around the
    struct gpio_chip * pointer and dereference to the state
    container struct ep93xx_gpio as needed, like all other
    drivers do.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • The subject says it all. Cut down on boilerplate.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • In order to clean up the driver I need to cut a few trees,
    sorry, variable names, so I can see the forest, sorry driver
    properly.

    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • As a preparation for multiplatform support, this ensures
    that the ep93xx gpio driver can be built without any of
    the platform specific header files. We pass the IRQ numbers
    as a resource now, and use the virtual mmio base from the
    already existing resource, rather than relying on the
    hardwired virtual address from the header file.

    Some numbers are now hardcoded that came from macros
    in the past, but for all I can tell, the driver already
    relied on the specific values.

    Cc: arm@kernel.org
    Signed-off-by: Arnd Bergmann
    Acked-by: Olof Johansson
    Acked-by: Alexander Sverdlin
    Signed-off-by: Linus Walleij

    Arnd Bergmann
     

26 Jan, 2017

1 commit

  • Currently we already have two pin configuration related callbacks
    available for GPIO chips .set_single_ended() and .set_debounce(). In
    future we expect to have even more, which does not scale well if we need
    to add yet another callback to the GPIO chip structure for each possible
    configuration parameter.

    Better solution is to reuse what we already have available in the
    generic pinconf.

    To support this, we introduce a new .set_config() callback for GPIO
    chips. The callback takes a single packed pin configuration value as
    parameter. This can then be extended easily beyond what is currently
    supported by just adding new types to the generic pinconf enum.

    If the GPIO driver is backed up by a pinctrl driver the GPIO driver can
    just assign gpiochip_generic_config() (introduced in this patch) to
    .set_config and that will take care configuration requests are directed
    to the pinctrl driver.

    We then convert the existing drivers over .set_config() and finally
    remove the .set_single_ended() and .set_debounce() callbacks.

    Suggested-by: Linus Walleij
    Signed-off-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Mika Westerberg
     

23 Feb, 2016

1 commit


05 Jan, 2016

1 commit

  • 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
    , #ifdef:ed for CONFIG_GENERIC_GPIO, and
    get rid of the 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
    Cc: Shawn Guo
    Cc: Sascha Hauer
    Cc: Kukjin Kim
    Cc: Alexandre Courbot
    Cc: Brian Norris
    Cc: Florian Fainelli
    Cc: Sudeep Holla
    Cc: Lorenzo Pieralisi
    Cc: Nicolas Pitre
    Cc: Olof Johansson
    Cc: Vladimir Zapolskiy
    Cc: Rabin Vincent
    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: Gregory Fong
    Acked-by: Liviu Dudau
    Acked-by: H Hartley Sweeten
    Acked-by: Tony Lindgren
    Acked-by: Krzysztof Kozlowski
    Acked-by: Lee Jones
    Signed-off-by: Linus Walleij

    Linus Walleij
     

16 Sep, 2015

1 commit

  • Most interrupt flow handlers do not use the irq argument. Those few
    which use it can retrieve the irq number from the irq descriptor.

    Remove the argument.

    Search and replace was done with coccinelle and some extra helper
    scripts around it. Thanks to Julia for her help!

    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Jiang Liu

    Thomas Gleixner
     

28 Jul, 2015

1 commit

  • set_irq_flags is ARM specific with custom flags which have genirq
    equivalents. Convert drivers to use the genirq interfaces directly, so we
    can kill off set_irq_flags. The translation of flags is as follows:

    IRQF_VALID -> !IRQ_NOREQUEST
    IRQF_PROBE -> !IRQ_NOPROBE
    IRQF_NOAUTOEN -> IRQ_NOAUTOEN

    For IRQs managed by an irqdomain, the irqdomain core code handles clearing
    and setting IRQ_NOREQUEST already, so there is no need to do this in
    .map() functions and we can simply remove the set_irq_flags calls. Some
    users also modify IRQ_NOPROBE and this has been maintained although it
    is not clear that is really needed as most platforms don't use probing.
    There appears to be a great deal of blind copy and paste of this code.

    Signed-off-by: Rob Herring
    Cc: Michael Hennerich
    Acked-by: Linus Walleij
    Cc: Alexandre Courbot
    Cc: Ray Jui
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: linux-gpio@vger.kernel.org
    Cc: bcm-kernel-feedback-list@broadcom.com
    Cc: linux-tegra@vger.kernel.org
    Signed-off-by: Linus Walleij

    Rob Herring
     

14 Jul, 2015

2 commits

  • The irq argument of most interrupt flow handlers is unused or merily
    used instead of a local variable. The handlers which need the irq
    argument can retrieve the irq number from the irq descriptor.

    Search and update was done with coccinelle and the invaluable help of
    Julia Lawall.

    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Jiang Liu
    Cc: Linus Walleij
    Cc: Alexandre Courbot
    Cc: linux-gpio@vger.kernel.org

    Thomas Gleixner
     
  • Use irq_set_handler_locked() as it avoids a redundant lookup of the
    irq descriptor.

    Search and replacement was done with coccinelle:

    @@
    struct irq_data *d;
    expression E1;
    @@

    -__irq_set_handler_locked(d->irq, E1);
    +irq_set_handler_locked(d, E1);

    Signed-off-by: Thomas Gleixner
    Cc: Jiang Liu
    Cc: Julia Lawall
    Cc: Linus Walleij
    Cc: Alexandre Courbot
    Cc: linux-gpio@vger.kernel.org

    Thomas Gleixner
     

20 Oct, 2014

1 commit


27 May, 2014

1 commit


16 May, 2014

1 commit


16 Oct, 2013

1 commit

  • I have no idea why this driver is using __raw* accessors for
    reading and writing registers, I suspect it is just force of
    habit or copy/paste. Change all to readb()/writeb() except
    one chain where I used writeb_relaxed() up until the last
    writeb().

    Cc: Ryan Mallon
    Cc: H Hartley Sweeten
    Signed-off-by: Linus Walleij

    Linus Walleij
     

29 Nov, 2012

1 commit

  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Grant Likely
    Cc: Peter Tyser
    Cc: Santosh Shilimkar
    Cc: Kevin Hilman
    Acked-by: Linus Walleij
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

20 May, 2012

1 commit

  • It fixes the issue in gpio-generic that commit fb14921 (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: Shawn Guo
    [grant.likely: Fix big-endian usage to explicitly set BBGPIOF_BIG_ENDIAN]
    Signed-off-by: Grant Likely

    Shawn Guo
     

29 Mar, 2012

1 commit

  • Pull GPIO changes for v3.4 from Grant Likely:
    "Primarily gpio device driver changes with some minor side effects
    under arch/arm and arch/x86. Also includes a few core changes such as
    explicitly supporting (electrical) open source and open drain outputs
    and some help for parsing gpio devicetree properties."

    Fix up context conflict due to Laxman Dewangan adding sleep control for
    the tps65910 driver separately for gpio's and regulators.

    * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6: (34 commits)
    gpio/ep93xx: Remove unused inline function and useless pr_err message
    gpio/sodaville: Mark broken due to core irqdomain migration
    gpio/omap: fix redundant decoding of gpio offset
    gpio/omap: fix incorrect update to context.irqenable1
    gpio/omap: fix incorrect context restore logic in omap_gpio_runtime_*
    gpio/omap: fix missing dataout context save in _set_gpio_dataout_reg
    gpio/omap: fix _set_gpio_irqenable implementation
    gpio/omap: fix trigger type to unsigned
    gpio/omap: fix wakeup_en register update in _set_gpio_wakeup()
    gpio: tegra: tegra_gpio_config shouldn't be __init
    gpio/davinci: fix enabling unbanked GPIO IRQs
    gpio/davinci: fix oops on unbanked gpio irq request
    gpio/omap: Fix section warning for omap_mpuio_alloc_gc()
    ARM: tegra: export tegra_gpio_{en,dis}able
    gpio/gpio-stmpe: Fix the value returned by _get_value routine
    Documentation/gpio.txt: Explain expected pinctrl interaction
    GPIO: LPC32xx: Add output reading to GPO P3
    GPIO: LPC32xx: Fix missing bit selection mask
    gpio/omap: fix wakeups on level-triggered GPIOs
    gpio/omap: Fix IRQ handling for SPARSE_IRQ
    ...

    Linus Torvalds
     

26 Mar, 2012

1 commit


14 Mar, 2012

1 commit

  • Move the pinmux setting of the EP93xx GPIOs to the core code. This
    removes the need for the GPIO driver to have access to the system
    controller registers.

    Signed-off-by: Ryan Mallon
    Cc: Grant Likely
    Reviewed-by: Mika Westerberg
    Acked-by: Hartley Sweeten

    Ryan Mallon
     

01 Nov, 2011

1 commit


02 Oct, 2011

1 commit


22 Aug, 2011

1 commit


26 Jul, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    fs: Merge split strings
    treewide: fix potentially dangerous trailing ';' in #defined values/expressions
    uwb: Fix misspelling of neighbourhood in comment
    net, netfilter: Remove redundant goto in ebt_ulog_packet
    trivial: don't touch files that are removed in the staging tree
    lib/vsprintf: replace link to Draft by final RFC number
    doc: Kconfig: `to be' -> `be'
    doc: Kconfig: Typo: square -> squared
    doc: Konfig: Documentation/power/{pm => apm-acpi}.txt
    drivers/net: static should be at beginning of declaration
    drivers/media: static should be at beginning of declaration
    drivers/i2c: static should be at beginning of declaration
    XTENSA: static should be at beginning of declaration
    SH: static should be at beginning of declaration
    MIPS: static should be at beginning of declaration
    ARM: static should be at beginning of declaration
    rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check
    Update my e-mail address
    PCIe ASPM: forcedly -> forcibly
    gma500: push through device driver tree
    ...

    Fix up trivial conflicts:
    - arch/arm/mach-ep93xx/dma-m2p.c (deleted)
    - drivers/gpio/gpio-ep93xx.c (renamed and context nearby)
    - drivers/net/r8169.c (just context changes)

    Linus Torvalds
     

10 Jun, 2011

1 commit


09 Jun, 2011

1 commit


08 Jun, 2011

1 commit

  • With this driver now being moved from arch/arm/mach-ep93xx/gpio.c to
    drivers/gpio/gpio-ep93xx.c the prefix "ep93xx" is now redundant in the
    pr_* output. Using KBUILD_MODNAME is sufficient.

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: Grant Likely

    H Hartley Sweeten
     

07 Jun, 2011

2 commits