[U-Boot] [PATCH 0/21] dm: Support GPIO device tree bindings in the uclass

Simon Glass sjg at chromium.org
Tue Jan 6 04:05:22 CET 2015


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.

Also, this support can now be built into the uclass, rather than parked in
a separate file.

Add support for requesting GPIOs based on a list in a device tree node, by
looking up the phandles. Convert existing boards and remove the old code.

As a side-effect, we now no-longer need to include <asm/gpio.h> in fdtdec.h,
a problem reported by Masahiro and others.

This series is tested on boards as follows, with the objective being to cover
each code path:

seaboard
--------
LCD comes up, USB host shows partitions, NAND can read/write. Both internal
MMC and external SD card partition can be read. Ejecting external SD card is
detected

Tegra20 (SeaBoard) # gpio status
Bank B:
B2: output: 1 [x] panel.nvidia,lvds-shutdown-gpios

Bank C:
C6: output: 1 [x] panel.nvidia,panel-vdd-gpios

Bank D:
D0: output: 0 [x] usb at c5000000.nvidia,vbus-gpio
D4: output: 1 [x] panel.nvidia,backlight-enable-gpios

Bank H:
H1: input: 0 [x] sdhci at c8000400.wp-gpios
H3: output: 1 [x] nand-controller at 70008000.nvidia,wp-gpios

Bank I:
I5: input: 0 [x] sdhci at c8000400.cd-gpios
I6: output: 1 [x] sdhci at c8000400.power-gpios

Bank W:
W0: output: 1 [x] panel.nvidia,backlight-vdd-gpios

pit
---
LCD comes up, internal MMC and external uSD cards can show a partition list.
EC works and the interrupt line behaves as expected. USB stick can display
a partition list.

pi
--
EC works correctly.


Simon Glass (21):
  dm: gpio: Bring in GPIO device tree binding
  dm: exynos: Bring in GPIO device tree binding
  dm: tegra: Bring in GPIO device tree binding
  dm: fdt: Add a function to decode phandles with arguments
  dm: gpio: Add a native driver model API
  dm: gpio: Add a driver GPIO translation method
  dm: gpio: Add better functions to request GPIOs
  dm: gpio: Mark the old GPIO API deprecated
  dm: demo: Add a simple GPIO demonstration
  dm: cros_ec: Remove use of fdtdec GPIO support
  dm: tegra: Add a GPIO translation function
  dm: exynos: Add a GPIO translation function
  dm: tegra: video: Remove use of fdtdec GPIO support
  dm: tegra: nand: Remove use of fdtdec GPIO support
  dm: zynq: Remove inline gpio functions
  dm: mmc: Remove use of fdtdec GPIO support
  dm: usb: Remove use of fdtdec GPIO support
  dm: spi: Remove use of fdtdec GPIO support
  dm: tegra: dts: Use TEGRA_GPIO() macro for all GPIOs
  dm: exynos: dts: Use GPIO bank phandles for GPIOs
  dm: fdt: Remove the old GPIO functions

 arch/arm/dts/exynos4.dtsi                          |   7 -
 arch/arm/dts/exynos4210-origen.dts                 |   2 +-
 arch/arm/dts/exynos4210-trats.dts                  |   4 +-
 arch/arm/dts/exynos4210-universal_c210.dts         |  12 +-
 arch/arm/dts/exynos4412-odroid.dts                 |   2 +-
 arch/arm/dts/exynos4412-trats2.dts                 |   6 +-
 arch/arm/dts/exynos5.dtsi                          |   4 +-
 arch/arm/dts/exynos5250-smdk5250.dts               |   2 +-
 arch/arm/dts/exynos5250-snow.dts                   |  10 +-
 arch/arm/dts/exynos5420-peach-pit.dts              |   8 +-
 arch/arm/dts/exynos5422-odroidxu3.dts              |   2 +-
 arch/arm/dts/exynos5800-peach-pi.dts               |  10 +-
 arch/arm/dts/tegra114-dalmore.dts                  |   5 +-
 arch/arm/dts/tegra124-jetson-tk1.dts               |   9 +-
 arch/arm/dts/tegra124-venice2.dts                  |   9 +-
 arch/arm/dts/tegra20-colibri_t20_iris.dts          |  10 +-
 arch/arm/dts/tegra20-harmony.dts                   |  28 +-
 arch/arm/dts/tegra20-medcom-wide.dts               |   9 +-
 arch/arm/dts/tegra20-paz00.dts                     |  18 +-
 arch/arm/dts/tegra20-seaboard.dts                  |  22 +-
 arch/arm/dts/tegra20-tamonten.dtsi                 |   9 +-
 arch/arm/dts/tegra20-tec.dts                       |   9 +-
 arch/arm/dts/tegra20-trimslice.dts                 |   8 +-
 arch/arm/dts/tegra20-ventana.dts                   |  18 +-
 arch/arm/dts/tegra20-whistler.dts                  |   2 +-
 arch/arm/dts/tegra30-apalis.dts                    |  10 +-
 arch/arm/dts/tegra30-beaver.dts                    |  10 +-
 arch/arm/dts/tegra30-cardhu.dts                    |   8 +-
 arch/arm/dts/tegra30-colibri.dts                   |   6 +-
 arch/arm/dts/tegra30-tamonten.dtsi                 |   4 +-
 arch/arm/include/asm/arch-pantheon/gpio.h          |   0
 arch/arm/include/asm/arch-tegra/tegra_mmc.h        |   7 +-
 arch/arm/include/asm/arch-tegra20/display.h        |   9 +-
 arch/arm/include/asm/arch-zynq/gpio.h              |  15 -
 arch/sandbox/dts/sandbox.dts                       |  11 +-
 common/cmd_demo.c                                  |  29 +-
 doc/device-tree-bindings/gpio/gpio-samsung.txt     |  41 +++
 doc/device-tree-bindings/gpio/gpio.txt             | 211 +++++++++++
 .../gpio/nvidia,tegra20-gpio.txt                   |  40 +++
 drivers/demo/demo-shape.c                          |  71 ++++
 drivers/demo/demo-uclass.c                         |  20 ++
 drivers/gpio/gpio-uclass.c                         | 396 +++++++++++++++++----
 drivers/gpio/s5p_gpio.c                            |  13 +-
 drivers/gpio/sandbox.c                             |  20 ++
 drivers/gpio/tegra_gpio.c                          |  18 +
 drivers/misc/cros_ec.c                             |  24 +-
 drivers/mmc/s5p_sdhci.c                            |  20 +-
 drivers/mmc/tegra_mmc.c                            |  36 +-
 drivers/mtd/nand/tegra_nand.c                      |   9 +-
 drivers/spi/soft_spi.c                             |  62 ++--
 drivers/usb/host/ehci-exynos.c                     |  10 +-
 drivers/usb/host/ehci-tegra.c                      |  38 +-
 drivers/usb/host/xhci-exynos5.c                    |  10 +-
 drivers/video/tegra.c                              |  54 ++-
 include/asm-generic/gpio.h                         | 265 ++++++++++++++
 include/cros_ec.h                                  |   3 +-
 include/dm-demo.h                                  |   4 +
 include/fdtdec.h                                   | 116 +++---
 include/sdhci.h                                    |   6 +-
 lib/fdtdec.c                                       | 195 +++++-----
 test/dm/gpio.c                                     |  69 +++-
 test/dm/test.dts                                   |  11 +-
 62 files changed, 1561 insertions(+), 535 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-pantheon/gpio.h
 create mode 100644 doc/device-tree-bindings/gpio/gpio-samsung.txt
 create mode 100644 doc/device-tree-bindings/gpio/gpio.txt
 create mode 100644 doc/device-tree-bindings/gpio/nvidia,tegra20-gpio.txt

-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list