All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
@ 2013-08-07  5:52 Simon Glass
  2013-08-07 16:20 ` Stephen Warren
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Glass @ 2013-08-07  5:52 UTC (permalink / raw)
  To: u-boot

Tegra recently moved to the new I2C framework, which sets up I2C prior to
relocation, and prior to calling i2c_init_board(). This causes a crash on
Tegra boards.

note:

There are many ways to fix this. I believe this is one. It disables i2c_init()
until relocation is complete. I have been unable to test it so far due to
problems getting my Seaboard to work. I will try another Tegra board, but
send this for comment in the meantime.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 drivers/i2c/tegra_i2c.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 9ac3969..9847cf1 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -453,6 +453,10 @@ void i2c_init_board(void)
 
 static void tegra_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
 {
+	/* No i2c support prior to relocation */
+	if (!(gd->flags & GD_FLG_RELOC))
+		return;
+
 	/* This will override the speed selected in the fdt for that port */
 	debug("i2c_init(speed=%u, slaveaddr=0x%x)\n", speed, slaveaddr);
 	i2c_set_bus_speed(speed);
-- 
1.8.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-07  5:52 [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation Simon Glass
@ 2013-08-07 16:20 ` Stephen Warren
  2013-08-07 21:03   ` Simon Glass
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Stephen Warren @ 2013-08-07 16:20 UTC (permalink / raw)
  To: u-boot

On 08/06/2013 11:52 PM, Simon Glass wrote:
> Tegra recently moved to the new I2C framework, which sets up I2C prior to
> relocation, and prior to calling i2c_init_board(). This causes a crash on
> Tegra boards.
> 
> note:
> 
> There are many ways to fix this. I believe this is one. It disables i2c_init()
> until relocation is complete. I have been unable to test it so far due to
> problems getting my Seaboard to work. I will try another Tegra board, but
> send this for comment in the meantime.

Tested-by: Stephen Warren <swarren@nvidia.com>

(On Beaver and Dalmore, tested booting to U-Boot command prompt followed
by "i2c dev 0; i2c probe")

Note: I believe this is an enormous hack that hacks around the problem
of dynamic device initialization just not being well thought out
relative to the restrictions of U-Boot's various boot stages. I'd still
prefer an outright revert of the broken code.

In other words, tegra_i2c_init() simply shouldn't be called at the wrong
time; it shouldn't have to handle being called at the wrong time and
null itself out when that happens.

However, if this is what it takes to get U-Boot working again, then
let's apply it ASAP.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-07 16:20 ` Stephen Warren
@ 2013-08-07 21:03   ` Simon Glass
  2013-08-09 23:17   ` Stephen Warren
  2013-08-13 21:12   ` Tom Rini
  2 siblings, 0 replies; 11+ messages in thread
From: Simon Glass @ 2013-08-07 21:03 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On Wed, Aug 7, 2013 at 10:20 AM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> On 08/06/2013 11:52 PM, Simon Glass wrote:
> > Tegra recently moved to the new I2C framework, which sets up I2C prior to
> > relocation, and prior to calling i2c_init_board(). This causes a crash on
> > Tegra boards.
> >
> > note:
> >
> > There are many ways to fix this. I believe this is one. It disables
> i2c_init()
> > until relocation is complete. I have been unable to test it so far due to
> > problems getting my Seaboard to work. I will try another Tegra board, but
> > send this for comment in the meantime.
>
> Tested-by: Stephen Warren <swarren@nvidia.com>
>
> (On Beaver and Dalmore, tested booting to U-Boot command prompt followed
> by "i2c dev 0; i2c probe")
>
> Note: I believe this is an enormous hack that hacks around the problem
> of dynamic device initialization just not being well thought out
> relative to the restrictions of U-Boot's various boot stages. I'd still
> prefer an outright revert of the broken code.
>
> In other words, tegra_i2c_init() simply shouldn't be called at the wrong
> time; it shouldn't have to handle being called at the wrong time and
> null itself out when that happens.
>
> However, if this is what it takes to get U-Boot working again, then
> let's apply it ASAP.
>

Fair enough.

Restricting my comments to I2C only, I think that we could have (at least
until driver model happens) an I2C init for each driver (in this case it is
i2c_init_board() that is called by the I2C subsystem twice during init
(once from board_init_f() and once from board_init_r()). The i2c_init()
call is odd because it does an init of a single I2C bus, which isn't really
necessary for most hardware. But I'm not sure it is worth worrying about
this until we have driver model.

Regards,
Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-07 16:20 ` Stephen Warren
  2013-08-07 21:03   ` Simon Glass
@ 2013-08-09 23:17   ` Stephen Warren
  2013-08-10  4:03     ` Simon Glass
  2013-08-13 21:12   ` Tom Rini
  2 siblings, 1 reply; 11+ messages in thread
From: Stephen Warren @ 2013-08-09 23:17 UTC (permalink / raw)
  To: u-boot

On 08/07/2013 10:20 AM, Stephen Warren wrote:
> On 08/06/2013 11:52 PM, Simon Glass wrote:
>> Tegra recently moved to the new I2C framework, which sets up I2C prior to
>> relocation, and prior to calling i2c_init_board(). This causes a crash on
>> Tegra boards.
>>
>> note:
>>
>> There are many ways to fix this. I believe this is one. It disables i2c_init()
>> until relocation is complete. I have been unable to test it so far due to
>> problems getting my Seaboard to work. I will try another Tegra board, but
>> send this for comment in the meantime.
> 
> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> (On Beaver and Dalmore, tested booting to U-Boot command prompt followed
> by "i2c dev 0; i2c probe")
> 
> Note: I believe this is an enormous hack that hacks around the problem
> of dynamic device initialization just not being well thought out
> relative to the restrictions of U-Boot's various boot stages. I'd still
> prefer an outright revert of the broken code.
> 
> In other words, tegra_i2c_init() simply shouldn't be called at the wrong
> time; it shouldn't have to handle being called at the wrong time and
> null itself out when that happens.
> 
> However, if this is what it takes to get U-Boot working again, then
> let's apply it ASAP.

This doesn't seem to have been applied yet. Are you expecting this to go
through the main U-boot Tree, I2C tree, or Tegra tree? I just noticed
that you only CC'd the Tegra maintainer...

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-09 23:17   ` Stephen Warren
@ 2013-08-10  4:03     ` Simon Glass
  2013-08-11  1:21       ` Tom Warren
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Glass @ 2013-08-10  4:03 UTC (permalink / raw)
  To: u-boot

+Tom Rini

Hi Stephen,

On Fri, Aug 9, 2013 at 5:17 PM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> On 08/07/2013 10:20 AM, Stephen Warren wrote:
> > On 08/06/2013 11:52 PM, Simon Glass wrote:
> >> Tegra recently moved to the new I2C framework, which sets up I2C prior
> to
> >> relocation, and prior to calling i2c_init_board(). This causes a crash
> on
> >> Tegra boards.
> >>
> >> note:
> >>
> >> There are many ways to fix this. I believe this is one. It disables
> i2c_init()
> >> until relocation is complete. I have been unable to test it so far due
> to
> >> problems getting my Seaboard to work. I will try another Tegra board,
> but
> >> send this for comment in the meantime.
> >
> > Tested-by: Stephen Warren <swarren@nvidia.com>
> >
> > (On Beaver and Dalmore, tested booting to U-Boot command prompt followed
> > by "i2c dev 0; i2c probe")
> >
> > Note: I believe this is an enormous hack that hacks around the problem
> > of dynamic device initialization just not being well thought out
> > relative to the restrictions of U-Boot's various boot stages. I'd still
> > prefer an outright revert of the broken code.
> >
> > In other words, tegra_i2c_init() simply shouldn't be called at the wrong
> > time; it shouldn't have to handle being called at the wrong time and
> > null itself out when that happens.
> >
> > However, if this is what it takes to get U-Boot working again, then
> > let's apply it ASAP.
>
> This doesn't seem to have been applied yet. Are you expecting this to go
> through the main U-boot Tree, I2C tree, or Tegra tree? I just noticed
> that you only CC'd the Tegra maintainer...
>
>
I put tegra: on the front expecting it to go that way, but it doesn't
matter. Also your comments did not exactly represent a glowing
recommendation.

Tom (Rini) are you willing to pick this up as a bug fix please?

Regards,
Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-10  4:03     ` Simon Glass
@ 2013-08-11  1:21       ` Tom Warren
  2013-08-13 19:34         ` Simon Glass
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Warren @ 2013-08-11  1:21 UTC (permalink / raw)
  To: u-boot

Simon,

From: sjg@google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, August 09, 2013 9:04 PM
To: Stephen Warren
Cc: U-Boot Mailing List; Tom Warren; Stephen Warren; trini at ti.com
Subject: Re: [PATCH] RFC: tegra: Avoid using I2C prior to relocation

+Tom Rini

Hi Stephen,

On Fri, Aug 9, 2013 at 5:17 PM, Stephen Warren <swarren at wwwdotorg.org<mailto:swarren@wwwdotorg.org>> wrote:
On 08/07/2013 10:20 AM, Stephen Warren wrote:
> On 08/06/2013 11:52 PM, Simon Glass wrote:
>> Tegra recently moved to the new I2C framework, which sets up I2C prior to
>> relocation, and prior to calling i2c_init_board(). This causes a crash on
>> Tegra boards.
>>
>> note:
>>
>> There are many ways to fix this. I believe this is one. It disables i2c_init()
>> until relocation is complete. I have been unable to test it so far due to
>> problems getting my Seaboard to work. I will try another Tegra board, but
>> send this for comment in the meantime.
>
> Tested-by: Stephen Warren <swarren at nvidia.com<mailto:swarren@nvidia.com>>
>
> (On Beaver and Dalmore, tested booting to U-Boot command prompt followed
> by "i2c dev 0; i2c probe")
>
> Note: I believe this is an enormous hack that hacks around the problem
> of dynamic device initialization just not being well thought out
> relative to the restrictions of U-Boot's various boot stages. I'd still
> prefer an outright revert of the broken code.
>
> In other words, tegra_i2c_init() simply shouldn't be called at the wrong
> time; it shouldn't have to handle being called at the wrong time and
> null itself out when that happens.
>
> However, if this is what it takes to get U-Boot working again, then
> let's apply it ASAP.
This doesn't seem to have been applied yet. Are you expecting this to go
through the main U-boot Tree, I2C tree, or Tegra tree? I just noticed
that you only CC'd the Tegra maintainer...

I put tegra: on the front expecting it to go that way, but it doesn't matter. Also your comments did not exactly represent a glowing recommendation.
[Tom] It's still marked RFC - doesn't that have to go away before anyone can pick it up / apply it?

Tom (Rini) are you willing to pick this up as a bug fix please?

Regards,
Simon

--
nvpublic

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-11  1:21       ` Tom Warren
@ 2013-08-13 19:34         ` Simon Glass
  2013-08-13 19:42           ` Stephen Warren
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Glass @ 2013-08-13 19:34 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Sat, Aug 10, 2013 at 7:21 PM, Tom Warren <TWarren@nvidia.com> wrote:
>
> Simon,
>
>
>
> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
> Sent: Friday, August 09, 2013 9:04 PM
> To: Stephen Warren
> Cc: U-Boot Mailing List; Tom Warren; Stephen Warren; trini at ti.com
> Subject: Re: [PATCH] RFC: tegra: Avoid using I2C prior to relocation
>
>
>
> +Tom Rini
>
>
>
> Hi Stephen,
>
>
>
> On Fri, Aug 9, 2013 at 5:17 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> On 08/07/2013 10:20 AM, Stephen Warren wrote:
> > On 08/06/2013 11:52 PM, Simon Glass wrote:
> >> Tegra recently moved to the new I2C framework, which sets up I2C prior to
> >> relocation, and prior to calling i2c_init_board(). This causes a crash on
> >> Tegra boards.
> >>
> >> note:
> >>
> >> There are many ways to fix this. I believe this is one. It disables i2c_init()
> >> until relocation is complete. I have been unable to test it so far due to
> >> problems getting my Seaboard to work. I will try another Tegra board, but
> >> send this for comment in the meantime.
> >
> > Tested-by: Stephen Warren <swarren@nvidia.com>
> >
> > (On Beaver and Dalmore, tested booting to U-Boot command prompt followed
> > by "i2c dev 0; i2c probe")
> >
> > Note: I believe this is an enormous hack that hacks around the problem
> > of dynamic device initialization just not being well thought out
> > relative to the restrictions of U-Boot's various boot stages. I'd still
> > prefer an outright revert of the broken code.
> >
> > In other words, tegra_i2c_init() simply shouldn't be called at the wrong
> > time; it shouldn't have to handle being called at the wrong time and
> > null itself out when that happens.
> >
> > However, if this is what it takes to get U-Boot working again, then
> > let's apply it ASAP.
>
> This doesn't seem to have been applied yet. Are you expecting this to go
> through the main U-boot Tree, I2C tree, or Tegra tree? I just noticed
> that you only CC'd the Tegra maintainer...
>
>
>
> I put tegra: on the front expecting it to go that way, but it doesn't matter. Also your comments did not exactly represent a glowing recommendation.
>
> [Tom] It?s still marked RFC ? doesn?t that have to go away before anyone can pick it up / apply it?

Sorry, I missed this in first reading due to the quoting. I will
re-issue without RFC.

Regards,
Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-13 19:34         ` Simon Glass
@ 2013-08-13 19:42           ` Stephen Warren
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Warren @ 2013-08-13 19:42 UTC (permalink / raw)
  To: u-boot

On 08/13/2013 01:34 PM, Simon Glass wrote:
> Hi Tom,
> 
> On Sat, Aug 10, 2013 at 7:21 PM, Tom Warren <TWarren@nvidia.com> wrote:
>>
>> Simon,
>>
>> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
...
>> I put tegra: on the front expecting it to go that way, but it doesn't matter. Also your comments did not exactly represent a glowing recommendation.
>>
>> [Tom] It?s still marked RFC ? doesn?t that have to go away before anyone can pick it up / apply it?
> 
> Sorry, I missed this in first reading due to the quoting. I will
> re-issue without RFC.

If that's the only change, you hardly need to repost it to edit the
patch subject; there are many ways of fixing that when applying the patch...

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-07 16:20 ` Stephen Warren
  2013-08-07 21:03   ` Simon Glass
  2013-08-09 23:17   ` Stephen Warren
@ 2013-08-13 21:12   ` Tom Rini
  2013-08-14 15:59     ` Stephen Warren
  2 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2013-08-13 21:12 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 07, 2013 at 10:20:01AM -0600, Stephen Warren wrote:
> On 08/06/2013 11:52 PM, Simon Glass wrote:
> > Tegra recently moved to the new I2C framework, which sets up I2C prior to
> > relocation, and prior to calling i2c_init_board(). This causes a crash on
> > Tegra boards.
> > 
> > note:
> > 
> > There are many ways to fix this. I believe this is one. It disables i2c_init()
> > until relocation is complete. I have been unable to test it so far due to
> > problems getting my Seaboard to work. I will try another Tegra board, but
> > send this for comment in the meantime.
> 
> Tested-by: Stephen Warren <swarren@nvidia.com>

With a hand-tweaked commit message, applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130813/b9c19a05/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-13 21:12   ` Tom Rini
@ 2013-08-14 15:59     ` Stephen Warren
  2013-08-14 16:02       ` Simon Glass
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Warren @ 2013-08-14 15:59 UTC (permalink / raw)
  To: u-boot

On 08/13/2013 03:12 PM, Tom Rini wrote:
> On Wed, Aug 07, 2013 at 10:20:01AM -0600, Stephen Warren wrote:
>> On 08/06/2013 11:52 PM, Simon Glass wrote:
>>> Tegra recently moved to the new I2C framework, which sets up
>>> I2C prior to relocation, and prior to calling i2c_init_board().
>>> This causes a crash on Tegra boards.
>>> 
>>> note:
>>> 
>>> There are many ways to fix this. I believe this is one. It
>>> disables i2c_init() until relocation is complete. I have been
>>> unable to test it so far due to problems getting my Seaboard to
>>> work. I will try another Tegra board, but send this for comment
>>> in the meantime.
>> 
>> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> With a hand-tweaked commit message, applied to u-boot/master,
> thanks!

Thanks!

For the record, I tested u-boot.git/master commit:

cdce889 tegra: Avoid using I2C prior to relocation

on Beaver, and booted a kernel both from SD card and over USB
Ethernet, and both cases worked fine. So, we have a known-good commit
for any future bisects:-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation
  2013-08-14 15:59     ` Stephen Warren
@ 2013-08-14 16:02       ` Simon Glass
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Glass @ 2013-08-14 16:02 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On Wed, Aug 14, 2013 at 9:59 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 08/13/2013 03:12 PM, Tom Rini wrote:
>> On Wed, Aug 07, 2013 at 10:20:01AM -0600, Stephen Warren wrote:
>>> On 08/06/2013 11:52 PM, Simon Glass wrote:
>>>> Tegra recently moved to the new I2C framework, which sets up
>>>> I2C prior to relocation, and prior to calling i2c_init_board().
>>>> This causes a crash on Tegra boards.
>>>>
>>>> note:
>>>>
>>>> There are many ways to fix this. I believe this is one. It
>>>> disables i2c_init() until relocation is complete. I have been
>>>> unable to test it so far due to problems getting my Seaboard to
>>>> work. I will try another Tegra board, but send this for comment
>>>> in the meantime.
>>>
>>> Tested-by: Stephen Warren <swarren@nvidia.com>
>>
>> With a hand-tweaked commit message, applied to u-boot/master,
>> thanks!
>
> Thanks!
>
> For the record, I tested u-boot.git/master commit:
>
> cdce889 tegra: Avoid using I2C prior to relocation
>
> on Beaver, and booted a kernel both from SD card and over USB
> Ethernet, and both cases worked fine. So, we have a known-good commit
> for any future bisects:-)

OK that's good, thanks.

Regards,
Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-08-14 16:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07  5:52 [U-Boot] [PATCH] RFC: tegra: Avoid using I2C prior to relocation Simon Glass
2013-08-07 16:20 ` Stephen Warren
2013-08-07 21:03   ` Simon Glass
2013-08-09 23:17   ` Stephen Warren
2013-08-10  4:03     ` Simon Glass
2013-08-11  1:21       ` Tom Warren
2013-08-13 19:34         ` Simon Glass
2013-08-13 19:42           ` Stephen Warren
2013-08-13 21:12   ` Tom Rini
2013-08-14 15:59     ` Stephen Warren
2013-08-14 16:02       ` Simon Glass

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.