@@ -190,3 +190,45 @@ gpiochip_free_own_desc().
These functions must be used with care since they do not affect module use
count. Do not use the functions to request gpio descriptors not owned by the
calling driver.
+
+
+Generic driver for memory-mapped GPIO controllers
+-------------------------------------------------
+The GPIO generic library provides support for basic platform_device
+memory-mapped GPIO controllers, which can be accessed by selecting Kconfig
+symbol GPIO_GENERIC and using library functions provided by GPIO generic
+driver (see drivers/gpio/gpio-generic.c).
+
+The driver supports registers of the sizes of 8/16/32/64 bits and the number
+of GPIOs are determined by the width of the registers. A set of named memory
+resources should be defined in the drivers (e.g "dat", "set", "clr", "dirout"
+and "dirin"), where "dat" is a mandatory resource.
+
+Each GPIO controller using GPIO generic library needs to include the following
+header.
+ #include <linux/basic_mmio_gpio.h>
+
+There are two ways to use this driver:
+1. Using basic GPIO MMIO Generic driver directly:
+ Name your platform device "basic-mmio-gpio" or "basic-mmio-gpio-be", set the
+ right named memory resources to specify the desired configuration, and let
+ bgpio_pdev_probe do all the work.
+
+2. Using basic GPIO MMIO Generic library in your driver:
+ Allocate a bgpio_chip yourself in your GPIO driver, call bgpio_init() on it
+ and its resources, and finally invoke gpiochip_add yourself. It is possible
+ to use only parts of the driver, you can overwrite functions and variables
+ in your driver, if necessary.
+ You can call bgpio_remove() to unregister a gpio_chip.
+
+For setting up GPIO's there are three supported configurations:
+- single input/output register resource (named "dat").
+- set/clear pair (named "set" and "clr").
+- single output register resource and single input resource ("set" and "dat").
+
+For setting the GPIO direction, there are three supported configurations:
+- simple bidirectional GPIO that requires no configuration.
+- an output direction register (named "dirout") where a 1 bit indicates the
+ GPIO is an output.
+- an input direction register (named "dirin") where a 1 bit indicates the GPIO
+ is an input.