[U-Boot] [PATCH v2 03/38] dm: gpio: Allow control of GPIO uclass in SPL

Bin Meng bmeng.cn at gmail.com
Wed Oct 2 13:56:12 UTC 2019


On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg at chromium.org> wrote:
>
> At present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass
> is included in SPL/TPL without any control for boards. Some boards may
> want to disable this to reduce code size where GPIOs are not needed in
> SPL or TPL.
>
> Add a new Kconfig option to permit this. Default it to 'y' so that
> existing boards work correctly. This allows us to remove the hack in
> config_uncmd_spl.h (eventually that file should be removed).
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2:
> - Fix the Kconfig condition to avoid build errors on snow
>
>  drivers/gpio/Kconfig       | 22 ++++++++++++++++++++++
>  drivers/gpio/Makefile      |  2 +-
>  include/config_uncmd_spl.h |  1 -
>  3 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index f2dabb554fa..11a242d7aa8 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -14,6 +14,28 @@ config DM_GPIO
>           particular GPIOs that they provide. The uclass interface
>           is defined in include/asm-generic/gpio.h.
>
> +config SPL_DM_GPIO
> +       bool "Enable Driver Model for GPIO drivers in SPL"
> +       depends on DM_GPIO && SPL_DM && SPL_GPIO_SUPPORT
> +       default y
> +       help
> +         Enable driver model for GPIO access. The standard GPIO

nits: Enable driver model for GPIO access in SPL.

> +         interface (gpio_get_value(), etc.) is then implemented by
> +         the GPIO uclass. Drivers provide methods to query the
> +         particular GPIOs that they provide. The uclass interface
> +         is defined in include/asm-generic/gpio.h.
> +
> +config TPL_DM_GPIO
> +       bool "Enable Driver Model for GPIO drivers in TPL"
> +       depends on DM_GPIO && TPL_DM && TPL_GPIO_SUPPORT
> +       default y
> +       help
> +         Enable driver model for GPIO access. The standard GPIO

nits: Enable driver model for GPIO access in TPL.

> +         interface (gpio_get_value(), etc.) is then implemented by
> +         the GPIO uclass. Drivers provide methods to query the
> +         particular GPIOs that they provide. The uclass interface
> +         is defined in include/asm-generic/gpio.h.
> +
>  config GPIO_HOG
>         bool "Enable GPIO hog support"
>         depends on DM_GPIO
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index 4a8aa0ff6fe..56e9374e308 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -7,7 +7,7 @@ ifndef CONFIG_SPL_BUILD
>  obj-$(CONFIG_DWAPB_GPIO)       += dwapb_gpio.o
>  obj-$(CONFIG_AXP_GPIO)         += axp_gpio.o
>  endif
> -obj-$(CONFIG_DM_GPIO)          += gpio-uclass.o
> +obj-$(CONFIG_$(SPL_TPL_)DM_GPIO) += gpio-uclass.o
>
>  obj-$(CONFIG_$(SPL_)DM_PCA953X)        += pca953x_gpio.o
>  obj-$(CONFIG_DM_74X164)                += 74x164_gpio.o
> diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h
> index c2f9735ce79..31da6215b3a 100644
> --- a/include/config_uncmd_spl.h
> +++ b/include/config_uncmd_spl.h
> @@ -12,7 +12,6 @@
>
>  #ifndef CONFIG_SPL_DM
>  #undef CONFIG_DM_SERIAL
> -#undef CONFIG_DM_GPIO
>  #undef CONFIG_DM_I2C
>  #undef CONFIG_DM_SPI
>  #endif
> --

Other than that,
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list