All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Do not mux and setup SPI if disabled in the config
Date: Wed, 05 Aug 2015 10:05:10 +0200	[thread overview]
Message-ID: <55C1C3B6.6040606@denx.de> (raw)
In-Reply-To: <20150805072822.GA22422@pqgruber.com>

Hi Clemens,

On 05.08.2015 09:28, Clemens Gruber wrote:
>> On 04.08.2015 19:28, Clemens Gruber wrote:
>>> This allows baseboards without SPI to compile.
>>>
>>> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
>>> Cc: Markus Niebel <Markus.Niebel@tq-group.com>
>>> Cc: Tom Rini <trini@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.

I would have expected that all boards using these TQ SoM's include this 
config header.

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

How about this patch:

diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index 29db838..345930f 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -28,6 +28,13 @@

  #include "tqma6_bb.h"

+#ifndef CONFIG_SF_DEFAULT_BUS
+#define CONFIG_SF_DEFAULT_BUS  0
+#endif
+#ifndef CONFIG_SF_DEFAULT_CS
+#define CONFIG_SF_DEFAULT_CS   0
+#endif

Does this work for you?

Thanks,
Stefan

  reply	other threads:[~2015-08-05  8:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 17:28 [U-Boot] [PATCH] Do not mux and setup SPI if disabled in the config Clemens Gruber
2015-08-05  5:19 ` Stefan Roese
2015-08-05  7:28   ` Clemens Gruber
2015-08-05  8:05     ` Stefan Roese [this message]
2015-08-05  8:16       ` Jagan Teki
2015-08-05  8:33         ` Clemens Gruber
2015-08-05  8:37           ` Stefan Roese
2015-08-05  8:17       ` Clemens Gruber
2015-08-05  8:36         ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C1C3B6.6040606@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.