From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tegra20: tamonten: Fix the early gpio init
Date: Thu, 02 Oct 2014 12:39:00 -0600 [thread overview]
Message-ID: <542D9BC4.1070603@wwwdotorg.org> (raw)
In-Reply-To: <20141002181203.397560ff@avionic-0020>
On 10/02/2014 10:12 AM, Alban Bedel wrote:
> On Thu, 02 Oct 2014 09:42:18 -0600
> Stephen Warren <swarren@wwwdotorg.org> wrote:
>
>> On 10/02/2014 09:14 AM, Alban Bedel wrote:
>>> To set gpio during the early init we now need to use
>>> tegra_spl_gpio_direction_output(), copied from seaboard.
>>>
>>> Change-Id: Id0aadb17a71b78e75e8c3f8de374102b3eab767b
>>
>> That shouldn't be present on upstream patches.
>
> Sorry about this.
>
>>> Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
>>> ---
>>> board/avionic-design/common/tamonten.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/board/avionic-design/common/tamonten.c b/board/avionic-design/common/tamonten.c
>>> index 9c86779..ea2425a 100644
>>> --- a/board/avionic-design/common/tamonten.c
>>> +++ b/board/avionic-design/common/tamonten.c
>>> @@ -23,8 +23,10 @@
>>> #ifdef CONFIG_BOARD_EARLY_INIT_F
>>> void gpio_early_init(void)
>>> {
>>> +#ifndef CONFIG_SPL_BUILD
>>> gpio_request(GPIO_PI4, NULL);
>>> - gpio_direction_output(GPIO_PI4, 1);
>>> +#endif
>>> + tegra_spl_gpio_direction_output(GPIO_PI4, 1);
>>> }
>>
>> Surely you only want to call tegra_spl_*() from SPL, and not from
>> non-SPL code? In other words, don't you need something more like:
>>
>> #ifdef CONFIG_SPL_BUILD
>> tegra_spl_gpio_direction_output(GPIO_PI4, 1);
>> #else
>> gpio_request(GPIO_PI4, NULL);
>> gpio_direction_output(GPIO_PI4, 1);
>> #endif
>
> Sadly not, at this point the gpio driver isn't available yet, that's
> why one need to use tegra_spl_gpio_direction_output(). As mentioned in
> the commit log I copied this from seaboard, assuming it would be
> correct.
>
> AFAICT the gpio_request() could be removed too, it doesn't work at this
> point anyway.
Hmm. CC Simon to comment on which GPIO drivers are available in
SPL/non-SPL, and why the above ifdef doesn't work.
>> ... although perhaps the SPL and non-SPL code should simply be separated
>> into separate files, so that there's no need for ifdefs, and it's
>> obvious if SPL and non-SPL code are duplicating the same work?
>
> Actually none of the code from tamonten.c is needed for the SPL, a
> build with both function under #ifndef CONFIG_SPL_BUILD works just fine.
Indeed, if manipulating the GPIO in SPL isn't even necessary, then just
wrapping the whole code in #ifndef CONFIG_SPL_BUILD makes sense to me.
> Any pointer on how I can get tamonten.c out of the SPL build?
I'm not sure now that the Makefile structure has changed to Kbuild. It
might be as simple as:
obj-$(CONFIG_SPL_BUILD) += foo.o
(but using whatever the opposite of CONFIG_SPL_BUILD is.
next prev parent reply other threads:[~2014-10-02 18:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 15:14 [U-Boot] [PATCH] tegra20: tamonten: Fix the early gpio init Alban Bedel
2014-10-02 15:42 ` Stephen Warren
2014-10-02 16:12 ` Alban Bedel
2014-10-02 18:39 ` Stephen Warren [this message]
2014-10-02 19:09 ` Simon Glass
2014-10-02 19:05 ` Simon Glass
2014-10-02 19:08 ` Stephen Warren
2014-10-02 19:11 ` Simon Glass
-- strict thread matches above, loose matches on Subject: below --
2015-02-24 16:58 Alban Bedel
2015-02-24 17:02 ` Stephen Warren
2015-02-24 17:18 ` Alban Bedel
2015-02-24 17:22 ` Stephen Warren
2015-02-24 17:35 ` Alban Bedel
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=542D9BC4.1070603@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox