diff mbox series

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

Message ID 20190925141147.191166-4-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Various modifications to prepare for FSP2 | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:11 p.m. UTC
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@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(-)

Comments

Bin Meng Oct. 2, 2019, 1:56 p.m. UTC | #1
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg@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@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@gmail.com>
Bin Meng Oct. 3, 2019, 2:02 a.m. UTC | #2
On Wed, Oct 2, 2019 at 9:56 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg@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@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@gmail.com>

Fixed the nits, and
applied to u-boot-x86/next, thanks!
Bin Meng Oct. 4, 2019, 2:58 a.m. UTC | #3
Hi Simon,

On Thu, Oct 3, 2019 at 10:02 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Oct 2, 2019 at 9:56 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg@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@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@gmail.com>
>
> Fixed the nits, and
> applied to u-boot-x86/next, thanks!

Unfortunately this patch breaks a number of ARM boards. See
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/15885
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/16012

I will have to drop this patch from the queue.

Regards,
Bin
diff mbox series

Patch

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
+	  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
+	  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