[U-Boot] [RFC PATCH v2 0/14] Driver model implementation, tests, demo and GPIO

Simon Glass sjg at chromium.org
Fri May 17 06:17:19 CEST 2013


Hi,

On Tue, May 7, 2013 at 12:41 PM, Simon Glass <sjg at chromium.org> wrote:
>
> Note: If you are reviewing this code, but don't have a lot of time, please
> consider starting with the 'demo' driver (patch 'dm: Add a
> demonstration/example driver') since it clearly shows how devices and
> uclasses work. Much of this series consists of test code and plumbing, so
> is of less interest to driver authors.
>
> This patch adds a driver model implementation. It is taken from
> the driver model code developed by:
>
>    Marek Vasut <marex at denx.de>
>    Pavel Herrmann <morpheus.ibis at gmail.com>
>    Viktor Křivák <viktor.krivak at gmail.com>
>    Tomas Hlavacek <tmshlvck at gmail.com>
>
> Please see doc/driver-model/README.txt for details of how to run this and
> what to look for. So far the documentation in doc/driver-model has not
> been updated.
>
> You can find a test version of the code used here in branch dm2 at:
>
>    http://git.denx.de/u-boot-x86.git
>
> (Branch dm contains the original implementation)

Does anyone have any comments on this series please?

Regards,
Simon


>
> Changes in v2:
> - Removed pointer return values in favour of integer
> - Use driver_bind() in dm_init() instead of writing new code
> - Allow driver_bind() to support a NULL parent
> - Add dm_warn() to warn about impending doom
> - Standardise variable names (e.g. uclass instead of class)
> - Remove relocation functions
> - Add new header file for lists
> - Add new util file to hold utility functions
> - Allow a driver to bind to only one uclass
> - Remove unneeded arguments to uclass_bind(), uclass_unbind()
> - Rename struct device's 'bus' to 'parent'
> - Rename data structures to hopefully be clearer
> - Put platform_data definitions in their own header file
> - Add U_BOOT_DEVICE to declare platform_data
> - Add auto-probing feature for platform_data to avoid driver_bind() calls
> - Add simple unit test functions
> - Add test infrastructure for driver model
> - Add integration tests for driver model
> - Add device tree support in driver model
> - Add automatic allocation of platform_data for FDT
> - Add automatic allocation of priv data for devices
> - Add automatic allocation of device-specific priv data for uclasses
> - Add GPIO uclass and tests
> - Add sandbox GPIO driver
> - Update gpio command to use driver model
> - Add tests for core code
> - Add script to run tests
> - Add a single include/dm.h to bring in driver model code
>
> Pavel Herrmann (1):
>   dm: Add README for driver model
>
> Simon Glass (13):
>   sandbox: Make map_to_sysmem() use a constant pointer
>   sandbox: Correct data sizes and printf() strings in fdtdec.c
>   sandbox: config: Don't use 64-bit physical memory
>   Add cmd_process_error() to report and process errors
>   sandbox: config: Enable driver model
>   dm: Add base driver model support
>   dm: Set up driver model after relocation
>   dm: Add basic tests
>   dm: Add a 'dm' command for testing
>   dm: Add a demonstration/example driver
>   dm: Add GPIO support and tests
>   sandbox: Convert GPIOs to use driver model
>   dm: Enable gpio command to support driver model
>
>  Makefile                          |   4 +
>  arch/sandbox/include/asm/gpio.h   |  14 +-
>  arch/sandbox/include/asm/io.h     |   2 +-
>  arch/sandbox/include/asm/types.h  |   4 +-
>  board/sandbox/sandbox/sandbox.c   |   7 +-
>  common/Makefile                   |   1 +
>  common/board_r.c                  |  33 +++
>  common/cmd_demo.c                 | 118 ++++++++
>  common/cmd_gpio.c                 | 127 ++++++++-
>  common/command.c                  |  10 +
>  common/dm/Makefile                |  40 +++
>  common/dm/device.c                | 370 +++++++++++++++++++++++++
>  common/dm/lists.c                 | 183 +++++++++++++
>  common/dm/root.c                  | 126 +++++++++
>  common/dm/uclass.c                | 362 +++++++++++++++++++++++++
>  common/dm/util.c                  |  50 ++++
>  doc/driver-model/README.txt       | 329 ++++++++++++++++++++++
>  drivers/demo/Makefile             |  44 +++
>  drivers/demo/demo-pdata.c         |  60 ++++
>  drivers/demo/demo-shape.c         | 107 ++++++++
>  drivers/demo/demo-simple.c        |  46 ++++
>  drivers/demo/demo-uclass.c        |  54 ++++
>  drivers/gpio/Makefile             |   2 +
>  drivers/gpio/gpio-uclass.c        | 281 +++++++++++++++++++
>  drivers/gpio/sandbox.c            | 216 +++++++++------
>  include/asm-generic/global_data.h |   9 +
>  include/asm-generic/gpio.h        |  50 ++++
>  include/command.h                 |   9 +
>  include/common.h                  |   2 +-
>  include/configs/sandbox.h         |  10 +-
>  include/dm-demo.h                 |  47 ++++
>  include/dm.h                      |  27 ++
>  include/dm/device-internal.h      |  38 +++
>  include/dm/device.h               |  72 +++++
>  include/dm/lists.h                |  37 +++
>  include/dm/platform_data.h        |  38 +++
>  include/dm/root.h                 |  38 +++
>  include/dm/test.h                 | 132 +++++++++
>  include/dm/uclass-id.h            |  42 +++
>  include/dm/uclass-internal.h      |  36 +++
>  include/dm/uclass.h               |  74 +++++
>  include/dm/ut.h                   |  83 ++++++
>  include/dm/util.h                 |  42 +++
>  lib/fdtdec.c                      |   8 +-
>  test/dm/Makefile                  |  53 ++++
>  test/dm/cmd_dm.c                  | 147 ++++++++++
>  test/dm/core.c                    | 557 ++++++++++++++++++++++++++++++++++++++
>  test/dm/gpio.c                    | 124 +++++++++
>  test/dm/test-driver.c             | 159 +++++++++++
>  test/dm/test-fdt.c                | 148 ++++++++++
>  test/dm/test-main.c               | 120 ++++++++
>  test/dm/test-uclass.c             | 118 ++++++++
>  test/dm/test.dts                  |  59 ++++
>  test/dm/ut.c                      |  46 ++++
>  54 files changed, 4805 insertions(+), 110 deletions(-)
>  create mode 100644 common/cmd_demo.c
>  create mode 100644 common/dm/Makefile
>  create mode 100644 common/dm/device.c
>  create mode 100644 common/dm/lists.c
>  create mode 100644 common/dm/root.c
>  create mode 100644 common/dm/uclass.c
>  create mode 100644 common/dm/util.c
>  create mode 100644 doc/driver-model/README.txt
>  create mode 100644 drivers/demo/Makefile
>  create mode 100644 drivers/demo/demo-pdata.c
>  create mode 100644 drivers/demo/demo-shape.c
>  create mode 100644 drivers/demo/demo-simple.c
>  create mode 100644 drivers/demo/demo-uclass.c
>  create mode 100644 drivers/gpio/gpio-uclass.c
>  create mode 100644 include/dm-demo.h
>  create mode 100644 include/dm.h
>  create mode 100644 include/dm/device-internal.h
>  create mode 100644 include/dm/device.h
>  create mode 100644 include/dm/lists.h
>  create mode 100644 include/dm/platform_data.h
>  create mode 100644 include/dm/root.h
>  create mode 100644 include/dm/test.h
>  create mode 100644 include/dm/uclass-id.h
>  create mode 100644 include/dm/uclass-internal.h
>  create mode 100644 include/dm/uclass.h
>  create mode 100644 include/dm/ut.h
>  create mode 100644 include/dm/util.h
>  create mode 100644 test/dm/Makefile
>  create mode 100644 test/dm/cmd_dm.c
>  create mode 100644 test/dm/core.c
>  create mode 100644 test/dm/gpio.c
>  create mode 100644 test/dm/test-driver.c
>  create mode 100644 test/dm/test-fdt.c
>  create mode 100644 test/dm/test-main.c
>  create mode 100644 test/dm/test-uclass.c
>  create mode 100644 test/dm/test.dts
>  create mode 100644 test/dm/ut.c
>
> --
> 1.8.2.1
>


More information about the U-Boot mailing list