Message ID | 1375854747-3621-1-git-send-email-sjg@chromium.org |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
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.
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
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...
+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
Hi Tom, On Sat, Aug 10, 2013 at 7:21 PM, Tom Warren <TWarren@nvidia.com> wrote: > > Simon, > > > > From: sjg@google.com [mailto:sjg@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@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
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@google.com [mailto:sjg@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...
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!
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:-)
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
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);
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(+)