Message ID | 20170715234120.177264-2-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Hi Simon, On Sun, Jul 16, 2017 at 7:41 AM, Simon Glass <sjg@chromium.org> wrote: > Once U-Boot relocates itself the existing driver-model timer (if any) is > no-longer valid until the device is reinitialised. Any use of the device > may cause a crash. To handle this, set the timer to NULL after relocation. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > common/board_f.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/common/board_f.c b/common/board_f.c > index ffa84e3566..d675dc38ac 100644 > --- a/common/board_f.c > +++ b/common/board_f.c > @@ -979,6 +979,7 @@ void board_init_f_r(void) > * UART if available. > */ > gd->flags &= ~GD_FLG_SERIAL_READY; > + gd->timer = NULL; This needs to be wrapped with #ifdef CONFIG_TIMER. But there is already a config option CONFIG_TIMER_EARLY, and gd->timer is zeroed in initr_dm(). We should fix problems with existing CONFIG_TIMER_EARLY. > > /* > * U-Boot has been copied into SDRAM, the BSS has been cleared etc. > -- Regards, Bin
Hi Bin, On 22 July 2017 at 22:36, Bin Meng <bmeng.cn@gmail.com> wrote: > Hi Simon, > > On Sun, Jul 16, 2017 at 7:41 AM, Simon Glass <sjg@chromium.org> wrote: >> Once U-Boot relocates itself the existing driver-model timer (if any) is >> no-longer valid until the device is reinitialised. Any use of the device >> may cause a crash. To handle this, set the timer to NULL after relocation. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> >> common/board_f.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/common/board_f.c b/common/board_f.c >> index ffa84e3566..d675dc38ac 100644 >> --- a/common/board_f.c >> +++ b/common/board_f.c >> @@ -979,6 +979,7 @@ void board_init_f_r(void) >> * UART if available. >> */ >> gd->flags &= ~GD_FLG_SERIAL_READY; >> + gd->timer = NULL; > > This needs to be wrapped with #ifdef CONFIG_TIMER. Fixed in v2. > > But there is already a config option CONFIG_TIMER_EARLY, and gd->timer > is zeroed in initr_dm(). We should fix problems with existing > CONFIG_TIMER_EARLY. Yes I agree, although this patch is needed regardless, I think. We should not have invalid timers hanging around. > >> >> /* >> * U-Boot has been copied into SDRAM, the BSS has been cleared etc. >> -- > > Regards, > Bin Regards, Simon
diff --git a/common/board_f.c b/common/board_f.c index ffa84e3566..d675dc38ac 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -979,6 +979,7 @@ void board_init_f_r(void) * UART if available. */ gd->flags &= ~GD_FLG_SERIAL_READY; + gd->timer = NULL; /* * U-Boot has been copied into SDRAM, the BSS has been cleared etc.
Once U-Boot relocates itself the existing driver-model timer (if any) is no-longer valid until the device is reinitialised. Any use of the device may cause a crash. To handle this, set the timer to NULL after relocation. Signed-off-by: Simon Glass <sjg@chromium.org> --- common/board_f.c | 1 + 1 file changed, 1 insertion(+)