[U-Boot] [PATCH v3 1/3] drivers: Add board uclass

Simon Glass sjg at chromium.org
Wed Jun 27 21:03:27 UTC 2018


Hi Mario,

On 27 June 2018 at 00:03, Mario Six <mario.six at gdsys.cc> wrote:
>
> Since there is no canonical "board device" that can be used in board
> files, it is difficult to use DM function for board initialization in
> these cases.
>
> Hence, add a uclass that implements a simple "board device", which can
> hold devices not suitable anywhere else in the device tree, and is also
> able to read encoded information, e.g. hard-wired GPIOs on a GPIO
> expander, read-only memory ICs, etc. that carry information about the
> hardware.
>
> The devices of this uclass expose methods to read generic data types
> (integers, strings, booleans) to encode the information provided by the
> hardware.
>
> Signed-off-by: Mario Six <mario.six at gdsys.cc>
>
> ---
>
> v2 -> v3:
> * Expanded comment on detect()
> * Added error handling in example
> * Renamed get_board() to board_get()
> * Fixed style violations
> * Documented board_get
> * Made comments conform with kernel-doc
> * Fixed SPDC-License-Identifier position
>
> v1 -> v2:
> * Corrected description of dev parameter of devinfo_detect
> * Added size parameter to devinfo_get_str
> * Expanded uclass documentation
> * Added function to get devinfo instance
> * Renamed the uclass from devinfo to board
>
> ---
>  drivers/Kconfig              |   2 +
>  drivers/Makefile             |   1 +
>  drivers/board/Kconfig        |  17 ++++++
>  drivers/board/Makefile       |   6 ++
>  drivers/board/board-uclass.c |  60 +++++++++++++++++++
>  include/board.h              | 139 +++++++++++++++++++++++++++++++++++++++++++
>  include/dm/uclass-id.h       |   1 +
>  7 files changed, 226 insertions(+)
>  create mode 100644 drivers/board/Kconfig
>  create mode 100644 drivers/board/Makefile
>  create mode 100644 drivers/board/board-uclass.c
>  create mode 100644 include/board.h

Reviewed-by: Simon Glass <sjg at chromium.org>

But please see below.

>
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 9e21b28750..48f7302506 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -22,6 +22,8 @@ source "drivers/ddr/Kconfig"
>
>  source "drivers/demo/Kconfig"
>
> +source "drivers/board/Kconfig"
> +
>  source "drivers/ddr/fsl/Kconfig"
>
>  source "drivers/dfu/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index a213ea9671..c2a363a66f 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -68,6 +68,7 @@ obj-y += ata/
>  obj-$(CONFIG_DM_DEMO) += demo/
>  obj-$(CONFIG_BIOSEMU) += bios_emulator/
>  obj-y += block/
> +obj-y += board/
>  obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
>  obj-$(CONFIG_CPU) += cpu/
>  obj-y += crypto/
> diff --git a/drivers/board/Kconfig b/drivers/board/Kconfig
> new file mode 100644
> index 0000000000..cc1cf27205
> --- /dev/null
> +++ b/drivers/board/Kconfig
> @@ -0,0 +1,17 @@
> +menuconfig BOARD
> +       bool "Device Information"
> +       help
> +         Support methods to query hardware configurations from internal
> +         mechanisms (e.g. reading GPIO values, determining the presence of
> +         devices on busses, etc.). This enables the usage of U-Boot with
> +         modular board architectures.
> +
> +if BOARD
> +
> +
> +config BOARD_GAZERBEAM
> +       bool "Enable device information for the Gazerbeam board"
> +       help
> +         Support querying device information for the gdsys Gazerbeam board.
> +

This should go in your board-specific patch, not the uclass.
[..]

Regards,
Simon


More information about the U-Boot mailing list