aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-ep93xx.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-04gpio: ep93xx: Pass irqchip when adding gpiochipLinus Walleij1-67/+73
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 <[email protected]> Cc: H Hartley Sweeten <[email protected]> Cc: Thierry Reding <[email protected]> Tested-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2019-06-27gpio: ep93xx: Use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult1-5/+2
Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-10gpio: ep93xx: fix test for end of loopDan Carpenter1-1/+1
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-10gpio: ep93xx: fix incorrect array element size checkColin Ian King1-1/+1
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Switch A and B to use GPIOLIB_IRQCHIPLinus Walleij1-45/+50
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Cut gpio_to_irq() usageLinus Walleij1-24/+24
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 <linux/gpio.h> that no driver should include. Acked-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Use for_each_set_bit() in IRQ handlerLinus Walleij1-14/+10
This simplifies and standardizes the AB IRQ handler by using the for_each_set_bit() library function. Acked-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Use the hwirq and portLinus Walleij1-19/+14
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Do not pingpong irq numbersLinus Walleij1-12/+23
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Properly call the chained IRQ handlerLinus Walleij1-0/+8
The chained irq handler should call chained_irq_enter() and chained_irq_exit() before/after handling the chained IRQ. Acked-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Rename has_debounce to has_irqLinus Walleij1-7/+7
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Pass around struct gpio_chipLinus Walleij1-38/+73
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Switch to SPDX license tagLinus Walleij1-4/+1
The subject says it all. Cut down on boilerplate. Acked-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29gpio: ep93xx: Cut down variable namesLinus Walleij1-13/+13
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-08-29ARM/gpio: ep93xx: build standaloneArnd Bergmann1-25/+23
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: [email protected] Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Olof Johansson <[email protected]> Acked-by: Alexander Sverdlin <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-01-26pinctrl / gpio: Introduce .set_config() callback for GPIO chipsMika Westerberg1-3/+8
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 <[email protected]> Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-02-23gpio: ep93xx: Use devm_gpiochip_add_data() for gpio registrationLaxman Dewangan1-1/+1
Use devm_gpiochip_add_data() for GPIO registration. Signed-off-by: Laxman Dewangan <[email protected]>
2016-01-05gpio: generic: factor into gpio_chip structLinus Walleij1-12/+13
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: [email protected] Cc: Alexander Shiyan <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Brian Norris <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Sudeep Holla <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Cc: Nicolas Pitre <[email protected]> Cc: Olof Johansson <[email protected]> Cc: Vladimir Zapolskiy <[email protected]> Cc: Rabin Vincent <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Acked-by: Gregory Fong <[email protected]> Acked-by: Liviu Dudau <[email protected]> Acked-by: H Hartley Sweeten <[email protected]> Acked-by: Tony Lindgren <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Acked-by: Lee Jones <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-09-16genirq: Remove irq argument from irq flow handlersThomas Gleixner1-3/+2
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 <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Jiang Liu <[email protected]>
2015-07-28gpio: kill off set_irq_flags usageRob Herring1-1/+1
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 <[email protected]> Cc: Michael Hennerich <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Ray Jui <[email protected]> Cc: Stephen Warren <[email protected]> Cc: Thierry Reding <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
2015-07-14gpio/ep93xx: Prepare ep93xx_gpio_f_irq_handler for irq argument removalThomas Gleixner1-1/+3
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 <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: [email protected]
2015-07-14gpio/ep93xx: Use irq_set_handler_locked()Thomas Gleixner1-1/+1
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 <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: [email protected]
2014-10-20gpio: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
2014-05-27gpio: ep93xx: Use devm_ioremap_resource()Jingoo Han1-1/+1
Use devm_ioremap_resource() because devm_request_and_ioremap() is obsoleted by devm_ioremap_resource(). Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2014-05-16gpio: gpioep93xx: use devm functionsabdoulaye berthe1-27/+7
This uses devm functions for mem allocation Signed-off-by: abdoulaye berthe <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2013-10-16gpio: ep93xx: get rid of bogus __raw* accessorsLinus Walleij1-9/+9
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 <[email protected]> Cc: H Hartley Sweeten <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2012-11-28gpio: remove use of __devinitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: Grant Likely <[email protected]> Cc: Peter Tyser <[email protected]> Cc: Santosh Shilimkar <[email protected]> Cc: Kevin Hilman <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-05-19gpio/generic: initialize basic_mmio_gpio shadow variables properlyShawn Guo1-1/+1
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 <[email protected]> [grant.likely: Fix big-endian usage to explicitly set BBGPIOF_BIG_ENDIAN] Signed-off-by: Grant Likely <[email protected]>
2012-03-28Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds1-8/+0
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 ...
2012-03-25gpio/ep93xx: Remove unused inline function and useless pr_err messageH Hartley Sweeten1-8/+0
Minor removal of an unused inline function and a useless pr_err message. Signed-off-by: H Hartley Sweeten <[email protected]> Signed-off-by: Grant Likely <[email protected]>
2012-03-14ep93xx: Configure GPIO ports in core codeRyan Mallon1-7/+0
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 <[email protected]> Cc: Grant Likely <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Acked-by: Hartley Sweeten <[email protected]>
2011-10-31drivers/gpio: Fix drivers who are implicit users of module.hPaul Gortmaker1-0/+1
A pending cleanup will mean that module.h won't be implicitly everywhere anymore. Make sure the modular drivers in gpio are actually calling out for <module.h> explicitly in advance. Signed-off-by: Paul Gortmaker <[email protected]>
2011-10-01ARM: 7042/3: mach-ep93xx: break out GPIO driver specificsLinus Walleij1-0/+3
The <mach/gpio.h> file is included from upper directories and deal with generic GPIO and gpiolib stuff. Break out the platform and driver specific defines and functions into its own header file. Cc: Ryan Mallon <[email protected]> Acked-by: Hartley Sweeten <[email protected]> Acked-by: Grant Likely <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King <[email protected]>
2011-08-22ARM: 7041/1: gpio-ep93xx: hookup the to_irq callback in the driverLinus Walleij1-1/+18
Remove the ep93xx machine specific dependencies for gpio_to_irq() by hooking up the callback in the driver and using __gpio_to_irq. Signed-off-by: H Hartley Sweeten <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King <[email protected]>
2011-07-25Merge branch 'for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial * '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)
2011-06-09gpio/ep93xx: Remove superfluous debug pr_info statementGrant Likely1-1/+0
Reported-by: H Hartley Sweeten <[email protected]> Signed-off-by: Grant Likely <[email protected]>
2011-06-08gpio/ep93xx: convert to platform_driver and use basic_mmio_gpio libraryH Hartley Sweeten1-121/+119
This converts the gpio-ep93xx driver into a platform_driver and uses the basic_mmio_gpio library. Signed-off-by: H Hartley Sweeten <[email protected]> Signed-off-by: Grant Likely <[email protected]>
2011-06-07gpio/ep93xx: fix pr_fmt outputH Hartley Sweeten1-1/+1
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 <[email protected]> Signed-off-by: Grant Likely <[email protected]>
2011-06-06gpio: reorganize driversGrant Likely1-2/+0
Sort the gpio makefile and enforce the naming convention gpio-*.c for gpio drivers. v2: cleaned up filenames in Kconfig and comment blocks v3: fixup use of BASIC_MMIO to GENERIC_GPIO for mxc Signed-off-by: Grant Likely <[email protected]>
2011-06-06gpio/ep93xx: move driver to drivers/gpioH Hartley Sweeten1-0/+410
The GPIO driver should reside in drivers/gpio. v3: Change Kconfig option to def_bool y v2: Make the Kconfig symbol a silent option, dependent on ARCH_EP93XX Signed-off-by: H Hartley Sweeten <[email protected]> Signed-off-by: Grant Likely <[email protected]>