]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
dm: gpio: Add better functions to request GPIOs
authorSimon Glass <sjg@chromium.org>
Tue, 6 Jan 2015 03:05:29 +0000 (20:05 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 30 Jan 2015 00:09:51 +0000 (17:09 -0700)
commit3669e0e759118fed3d371e2427b4b47d3969bfd0
tree2f9831f33ac579dda2719ce5cc8bcbcd75c96f24
parent0dac4d51f50e9252dbc00075cf65eeba57017926
dm: gpio: Add better functions to request GPIOs

At present U-Boot sort-of supports the standard way of reading GPIOs from
device tree nodes, but the support is incomplete, a bit clunky and only
works for GPIO bindings where #gpio-cells is 2.

Add new functions to request GPIOs, taking full account of the device
tree binding. These permit requesting a GPIO with a simple call like:

   gpio_request_by_name(dev, "cd-gpios", 0, &desc, GPIOD_IS_IN);

This will request the GPIO, looking at the device's node which might be
this, for example:

   cd-gpios = <&gpio TEGRA_GPIO(B, 3) GPIO_ACTIVE_LOW>;

The GPIO will be set to input mode in this case and polarity will be
honoured by the GPIO calls.

It is also possible to request and free a list of GPIOs.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/gpio/gpio-uclass.c
drivers/gpio/sandbox.c
include/asm-generic/gpio.h
test/dm/gpio.c
test/dm/test.dts