[U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi

Simon Glass sjg at chromium.org
Sat Oct 4 19:29:34 CEST 2014


This series adds driver model support for serial and GPIO for sunxi. Since
I only have a sun7i board to test with, I have added a new config for the
pcDuino3, which uses device tree and driver model. This should make it
fairly easy to enable for the other boards at some point.

Now that we have about 5 GPIO drivers it is clear that the request()/free()
logic should be in the uclass rather than the driver. So far drivers don't
have to do anything in those methods except adjust pin configuration.
Patches are included to make this change, including removing the redundant
code in the various GPIO drivers. The sunxi driver works the same way.

So far at least GPIO drivers don't tend to have anything special to report
for the 'gpio status' command. Partly this is because we only support a
simple concept of GPIOs so far (no drive strength, function selection,
etc.) but even if this were to be supported it would be better to handle
it generically where possible. So the get_state() call can be replaced with
a generic one in the uclass. This can be implemented with the existing
uclass interface: get_function() to find out if the pin is set as an input,
output or not a GPIO, and get_value() to find its value.

As a result, it is safe to remove the get_state() method, and this series
does that also.

This series is available at u-boot-dm/sunix-working.


Simon Glass (23):
  dm: sunxi: dts: Add sun7i device tree files
  dm: sunxi: Add a new config for an FDT-based pcDuino3
  dm: core: Add support for simple-bus
  dm: sunxi: Add pinmux functions which take a bank parameter
  dm: sunxi: Make sure that GPIOs are requested
  dm: sunxi: Modify the GPIO driver to support driver model
  dm: sunxi: Add support for serial using driver model
  dm: gpio: Implement GPIO reservation in the uclass
  dm: gpio: Add gpio_get_function() and friends
  dm: Move the function for getting GPIO status into the uclass
  dm: gpio: sandbox: Implement the get_function() method
  dm: gpio: sandbox: Implement the remove() method
  dm: gpio: sandbox: Drop request()/free() in the driver
  test: dm: Update GPIO tests for new gpio_request() method
  dm: gpio: Add gpio_requestf() helper for printf() strings
  test: dm: Support memory leak checking as a core feature
  test: dm: Add additional GPIO tests
  dm: gpio: tegra: Drop request()/free() in the driver
  dm: gpio: omap3: Drop request()/free() in the driver
  dm: gpio: rpi_b: Drop request()/free() in the driver
  dm: gpio: exynos: Drop request()/free() in the driver
  dm: gpio: imx: Drop request()/free() in the driver
  dm: gpio: Remove unused get_state() uclass method

 Makefile                                  |   3 +-
 arch/arm/cpu/armv7/sunxi/pinmux.c         |  32 +-
 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/sun7i-a20-pcduino3.dts       | 177 ++++++
 arch/arm/dts/sun7i-a20.dtsi               | 988 ++++++++++++++++++++++++++++++
 arch/arm/dts/sunxi-common-regulators.dtsi |  89 +++
 arch/arm/include/asm/arch-sunxi/gpio.h    |   4 +-
 board/sunxi/MAINTAINERS                   |   1 +
 board/sunxi/ahci.c                        |   1 +
 common/cmd_gpio.c                         |  57 +-
 configs/Linksprite_pcDuino3_fdt_defconfig |   8 +
 doc/driver-model/README.txt               |  29 +-
 drivers/core/Makefile                     |   1 +
 drivers/core/simple-bus.c                 |  33 +
 drivers/gpio/bcm2835_gpio.c               |  89 ---
 drivers/gpio/gpio-uclass.c                | 199 +++++-
 drivers/gpio/mxc_gpio.c                   | 116 ----
 drivers/gpio/omap_gpio.c                  | 116 +---
 drivers/gpio/s5p_gpio.c                   | 101 ---
 drivers/gpio/sandbox.c                    |  93 +--
 drivers/gpio/sunxi_gpio.c                 | 170 +++++
 drivers/gpio/tegra_gpio.c                 | 110 ----
 drivers/serial/Makefile                   |   1 +
 drivers/serial/serial_dw.c                |  39 ++
 include/asm-generic/gpio.h                |  70 ++-
 include/configs/sun7i.h                   |   8 +
 include/configs/sunxi-common.h            |  12 +-
 include/dm/test.h                         |  23 +
 include/dm/uclass-id.h                    |   1 +
 include/dt-bindings/input/input.h         | 525 ++++++++++++++++
 test/dm/core.c                            |  46 +-
 test/dm/gpio.c                            | 111 +++-
 test/dm/test-main.c                       |   2 +
 33 files changed, 2534 insertions(+), 722 deletions(-)
 create mode 100644 arch/arm/dts/sun7i-a20-pcduino3.dts
 create mode 100644 arch/arm/dts/sun7i-a20.dtsi
 create mode 100644 arch/arm/dts/sunxi-common-regulators.dtsi
 create mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig
 create mode 100644 drivers/core/simple-bus.c
 create mode 100644 drivers/serial/serial_dw.c
 create mode 100644 include/dt-bindings/input/input.h

-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list