
On 5 January 2015 at 20:05, Simon Glass sjg@chromium.org wrote:
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 | 166 ++++++++++++++++++++++++++++++++++++- drivers/gpio/sandbox.c | 20 +++++ include/asm-generic/gpio.h | 199 +++++++++++++++++++++++++++++++++++++++++++++ test/dm/gpio.c | 69 +++++++++++++++- test/dm/test.dts | 11 ++- 5 files changed, 461 insertions(+), 4 deletions(-)
Applied to u-boot-dm.