[U-Boot] [PATCH v2 08/11] dm: imx: Use gpio_request() to request GPIOs

Igor Grinberg grinberg at compulab.co.il
Wed Sep 17 16:31:29 CEST 2014


On 09/17/14 17:00, Simon Glass wrote:
> Hi Igor,
> 
> On 17 September 2014 06:13, Igor Grinberg <grinberg at compulab.co.il <mailto:grinberg at compulab.co.il>> wrote:
> 
>     Hi Simon,
> 
>     On 09/17/14 06:51, Simon Glass wrote:
>     > GPIOs should be requested before use. Without this, driver model will not
>     > permit the GPIO to be used.
>     >
>     > Signed-off-by: Simon Glass <sjg at chromium.org <mailto:sjg at chromium.org>>
>     > ---
>     >
>     > Changes in v2:
>     > - Check return values of gpio_request()
>     >
>     >  arch/arm/imx-common/i2c-mxv7.c | 24 ++++++++++++++++++++++++
>     >  board/compulab/cm_fx6/cm_fx6.c | 15 +++++++++++++++
>     >  board/compulab/cm_fx6/common.c |  7 +++++++
>     >  3 files changed, 46 insertions(+)
>     >

[...]

>     > diff --git a/board/compulab/cm_fx6/common.c b/board/compulab/cm_fx6/common.c
>     > index 1f39679..e4d7e2e 100644
>     > --- a/board/compulab/cm_fx6/common.c
>     > +++ b/board/compulab/cm_fx6/common.c
>     > @@ -79,6 +79,13 @@ void cm_fx6_set_ecspi_iomux(void)
>     >
>     >  int board_spi_cs_gpio(unsigned bus, unsigned cs)
>     >  {
>     > +#ifndef CONFIG_SPL_BUILD
>     > +     int ret;
>     > +
>     > +     ret = gpio_request(CM_FX6_ECSPI_BUS0_CS0, "ecspi_bus0_cs0");
>     > +     if (ret)
>     > +             return ret;
>     > +#endif
> 
>     Is there a reason for excluding this request from spl builds?
>     We do build with CONFIG_SPL_GPIO_SUPPORT and we don't have a
>     problem with spl size.
>     So, if there is no strong reason to exclude it from spl build,
>     I'd like to remove the #ifndef.
> 
> 
> It isn't supported by DM yet.

AFAICS, gpio_request() is available for SPL.
So in such case the non-DM version will be used and
I can't see any problem with this (unless it does not work for some reason).

>  
> 
> 
>     >       return (bus == 0 && cs == 0) ? (CM_FX6_ECSPI_BUS0_CS0) : -1;
>     >  }
>     >  #endif
>     >
> 
>     --
>     Regards,
>     Igor.
> 
> 
> Regards,
> Simon
> 

-- 
Regards,
Igor.


More information about the U-Boot mailing list