[U-Boot] [RFC PATCH] sunxi: support board-specific configuration options

Hans de Goede hdegoede at redhat.com
Sat Aug 22 16:02:13 CEST 2015


Hi Bernhard,

On 22-08-15 13:52, Bernhard Nortmann wrote:
> Extend sunxi-common.h to include sunxi-boards.h - which in turn
> can support multiple configurations/options/includes, based on
> board-specific symbols (preprocessor definitions). These might
> be supplied by the respective *_defconfig files.
>
> Signed-off-by: Bernhard Nortmann <bernhard.nortmann at web.de>
> ---
>
>   configs/Bananapi_defconfig     |  2 +-
>   include/configs/bananapi.h     | 23 +++++++++++++++++++++++
>   include/configs/sunxi-boards.h |  5 +++++
>   include/configs/sunxi-common.h |  1 +
>   4 files changed, 30 insertions(+), 1 deletion(-)
>   create mode 100644 include/configs/bananapi.h
>   create mode 100644 include/configs/sunxi-boards.h
>
> diff --git a/configs/Bananapi_defconfig b/configs/Bananapi_defconfig
> index 560295f..6bd0f3e 100644
> --- a/configs/Bananapi_defconfig
> +++ b/configs/Bananapi_defconfig
> @@ -7,7 +7,7 @@ CONFIG_VIDEO_COMPOSITE=y
>   CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-bananapi"
>   # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>   CONFIG_SPL=y
> -CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
> +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,BOARD_BANANAPI"
>   # CONFIG_CMD_IMLS is not set
>   # CONFIG_CMD_FLASH is not set
>   # CONFIG_CMD_FPGA is not set

We want to move away from using CONFIG_SYS_EXTRA_OPTIONS, not start using
more of them.

The proper way to deal with this would be to allow defining one or more
LED gpio pins in Kconfig, like e.g. the USB?_VBUS_PIN config options
in board/sunxi/Kconfig, and then modify the generic code paths so that
these will be used when set.

This way we get led support for all boards in one go (once all the
defconfig-s are updated to set the gpio pins), and we do not end up
with board specific code.

Regards,

Hans



> diff --git a/include/configs/bananapi.h b/include/configs/bananapi.h
> new file mode 100644
> index 0000000..f14a6b4
> --- /dev/null
> +++ b/include/configs/bananapi.h
> @@ -0,0 +1,23 @@
> +/*
> + * bananapi.h
> + * board-specific options for Banana Pi
> + */
> +
> +/* Note that this example currently (v2015.10-rc2) requires
> + * patching U-Boot support of GPIO LEDs.
> + * see http://lists.denx.de/pipermail/u-boot/2015-August/224713.html
> + */
> +
> +#define CONFIG_STATUS_LED
> +#define CONFIG_BOARD_SPECIFIC_LED
> +#define CONFIG_GPIO_LED
> +#define CONFIG_GPIO_LED_STUBS
> +#define CONFIG_CMD_LED
> +
> +#define GREEN_LED_GPIO		248 /* = PH24 */
> +
> +#define STATUS_LED_BIT		GREEN_LED_GPIO
> +#define STATUS_LED_STATE	STATUS_LED_ON
> +#define STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
> +
> +#define STATUS_LED_GREEN	GREEN_LED_GPIO
> diff --git a/include/configs/sunxi-boards.h b/include/configs/sunxi-boards.h
> new file mode 100644
> index 0000000..b2b7c59
> --- /dev/null
> +++ b/include/configs/sunxi-boards.h
> @@ -0,0 +1,5 @@
> +/* support specific (sunxi) board configurations */
> +
> +#ifdef CONFIG_BOARD_BANANAPI
> +#include <configs/bananapi.h>
> +#endif
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 1abf73c..424c2d4 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -40,6 +40,7 @@
>   #endif
>
>   #include <asm/arch/cpu.h>	/* get chip and board defs */
> +#include <configs/sunxi-boards.h>	/* board-specific config */
>
>   #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL)
>   # define CONFIG_DW_SERIAL
>


More information about the U-Boot mailing list