[U-Boot] [PATCH] Do not mux and setup SPI if disabled in the config
Clemens Gruber
clemens.gruber at pqgruber.com
Wed Aug 5 09:28:22 CEST 2015
Hi Stefan,
On Wed, Aug 05, 2015 at 07:19:02AM +0200, Stefan Roese wrote:
> (added Stefano as imx custodian)
Thanks.
>
> On 04.08.2015 19:28, Clemens Gruber wrote:
> > This allows baseboards without SPI to compile.
> >
> > Signed-off-by: Clemens Gruber <clemens.gruber at pqgruber.com>
> > Cc: Markus Niebel <Markus.Niebel at tq-group.com>
> > Cc: Tom Rini <trini at konsulko.com>
> > ---
> > board/tqc/tqma6/tqma6.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
> > index 29db838..5c4d104 100644
> > --- a/board/tqc/tqma6/tqma6.c
> > +++ b/board/tqc/tqma6/tqma6.c
> > @@ -131,6 +131,8 @@ int board_mmc_init(bd_t *bis)
> > return 0;
> > }
> >
> > +#if defined(CONFIG_MXC_SPI)
> > +
> > static iomux_v3_cfg_t const tqma6_ecspi1_pads[] = {
> > /* SS1 */
> > NEW_PAD_CTRL(MX6_PAD_EIM_D19__GPIO3_IO19, SPI_PAD_CTRL),
> > @@ -161,6 +163,8 @@ int board_spi_cs_gpio(unsigned bus, unsigned cs)
> > (cs == CONFIG_SF_DEFAULT_CS)) ? TQMA6_SF_CS_GPIO : -1;
> > }
> >
> > +#endif /* defined(CONFIG_MXC_SPI) */
> > +
> > static struct i2c_pads_info tqma6_i2c3_pads = {
> > /* I2C3: on board LM75, M24C64, */
> > .scl = {
> > @@ -201,7 +205,9 @@ int board_init(void)
> > /* address of boot parameters */
> > gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> >
> > +#if defined(CONFIG_MXC_SPI)
> > tqma6_iomuxc_spi();
> > +#endif
> > tqma6_setup_i2c();
>
> Hmmm. This should not be necessary. Please take a look at the wru4
> baseboard addition that is already in mainline. Especially this
> patch:
I noticed your patch but then we would still have to define
CONFIG_SF_DEFAULT_BUS and CONFIG_SF_DEFAULT_CS in our board config or include
the tqma6.h config, which defines too many things we do not need.
The problem is, we have different clocks and more c files, so we use a separate
board directory and a separate board config without SPI defines and just use
obj-y += ../../tqc/tqma6/tqma6.o in front of our object files in the Makefile.
If we don't exclude those SPI parts, we would either have to define those SPI
config options (which does not make sense) or move all of our board code in one
file under tqc/tqma6 which is not an option, we also define additional clocks
via a separate IMX_CONFIG file.
Wouldn't it be better to always exclude this code when not using SPI instead of
weakly defining the tqma6_iomuxc_spi function?
Then small baseboards could be put in tqc/tqma6 and larger projects could still
just link to tqma6.o and put all their stuff in a separate board directory.
>
> commit 34ee786e5b388625e5a0e0891ee69d4bbf34178b
> Author: Stefan Roese <sr at denx.de>
> Date: Thu Mar 12 13:34:30 2015 +0100
>
> arm: mx6: tqma6: Update to optionally configure an alternative SPI setup
>
> By making the tqma6_iomuxc_spi() weak, this patch adds the possibility to
> add a different function for this SPI configuration. This can be used
> by other baseboards, that might have a different SPI setup.
>
> This patch will be used by the upcoming WRU-IV board support which also
> uses the TQMa6 SoM.
>
> Signed-off-by: Stefan Roese <sr at denx.de>
>
>
> This is enough in your baseboard file now:
>
> void tqma6_iomuxc_spi(void)
> {
> /* No SPI on this baseboard */
> }
>
> Thanks,
> Stefan
>
Regards,
Clemens
More information about the U-Boot
mailing list