summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/basic_mmio_gpio.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-06gpio: reorganize driversGrant Likely1-548/+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 <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: split into a gpio library and platform deviceJamie Iles1-148/+169
Allow GPIO_BASIC_MMIO_CORE to be used to provide an accessor library for implementing GPIO drivers whilst abstracting the register access detail. Based on a patch from Anton Vorontsov[1] and adapted to allow bgpio_chip to be embedded in another structure. Changes since v1: - Register the gpio_chip in the platform device probe 1. https://lkml.org/lkml/2011/4/19/401 Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: convert to non-__raw* accessorsJamie Iles1-8/+8
The __raw_* accessors don't include memory barriers and can cause problems when writes get stuck in write buffers. Suggested-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: support direction registersJamie Iles1-2/+112
Most controllers require the direction of a GPIO to be set by writing to a direction register. Add support for either an input direction register or an output direction register. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: support different input/output registersJamie Iles1-5/+33
Some controllers have separate input and output registers. For these controllers, use "set" for the output and "dat" for the input. Changes since v2: reuse "set" for output and "dat" for input rather than adding a new "in" register. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: detect output method at probe timeJamie Iles1-31/+59
Rather than detecting the output method each time in the .set() callback, do it at probe time and set the appropriate callback. Changes since v2: moved the reg_dat initialization into bgpio_setup_io(). Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: request register regionsJamie Iles1-3/+13
Make sure that we get the register regions with request_mem_region() before ioremap() to make sure we have exclusive access. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: allow overriding number of gpioJamie Iles1-6/+12
Some platforms may have a number of GPIO that is less than the register width of the peripheral. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: convert to platform_{get,set}_drvdata()Jamie Iles1-2/+2
Use the platform drvdata helpers rather than working on the struct device itself. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-05-20basic_mmio_gpio: remove runtime width/endianness evaluationJamie Iles1-44/+92
Remove endianness/width calculations at runtime by installing function pointers for bit-to-mask conversion and register accessors. Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-10-27gpio: add driver for basic memory-mapped GPIO controllersAnton Vorontsov1-0/+297
The basic GPIO controllers may be found in various on-board FPGA and ASIC solutions that are used to control board's switches, LEDs, chip-selects, Ethernet/USB PHY power, etc. These controllers may not provide any means of pin setup (in/out/open drain). The driver supports: - 8/16/32/64 bits registers; - GPIO controllers with clear/set registers; - GPIO controllers with a single "data" register; - Big endian bits/GPIOs ordering (mostly used on PowerPC). Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: David Brownell <david-b@pacbell.net> Cc: Samuel Ortiz <sameo@linux.intel.com>, Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>