diff options
author | Simon Glass <sjg@chromium.org> | 2015-01-05 20:05:29 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-01-29 17:09:51 -0700 |
commit | 3669e0e759118fed3d371e2427b4b47d3969bfd0 (patch) | |
tree | 2f9831f33ac579dda2719ce5cc8bcbcd75c96f24 /test/dm/test.dts | |
parent | 0dac4d51f50e9252dbc00075cf65eeba57017926 (diff) | |
download | u-boot-3669e0e759118fed3d371e2427b4b47d3969bfd0.tar.gz |
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>
Diffstat (limited to 'test/dm/test.dts')
-rw-r--r-- | test/dm/test.dts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/dm/test.dts b/test/dm/test.dts index fb0272a59c..33f2c00747 100644 --- a/test/dm/test.dts +++ b/test/dm/test.dts @@ -22,6 +22,11 @@ ping-expect = <0>; ping-add = <0>; u-boot,dm-pre-reloc; + test-gpios = <&gpio_a 1>, <&gpio_a 4>, <&gpio_b 5 0 3 2 1>, + <0>, <&gpio_a 12>; + test2-gpios = <&gpio_a 1>, <&gpio_a 4>, <&gpio_b 6 1 3 2 1>, + <&gpio_b 7 2 3 2 1>, <&gpio_b 8 4 3 2 1>, + <&gpio_b 9 0xc 3 2 1>; }; junk { @@ -83,12 +88,16 @@ gpio_a: base-gpios { compatible = "sandbox,gpio"; + gpio-controller; + #gpio-cells = <1>; gpio-bank-name = "a"; num-gpios = <20>; }; - extra-gpios { + gpio_b: extra-gpios { compatible = "sandbox,gpio"; + gpio-controller; + #gpio-cells = <5>; gpio-bank-name = "b"; num-gpios = <10>; }; |