diff mbox

[U-Boot,01/69] dm: timer: Correct timer init ordering after relocation

Message ID 1457317732-18406-2-git-send-email-sjg@chromium.org
State Accepted
Commit d74d6b444c9f1596c24d492e57af9423efbd113b
Delegated to: Bin Meng
Headers show

Commit Message

Simon Glass March 7, 2016, 2:27 a.m. UTC
Commit 1057e6c broke use of the timer with driver model. If the timer is used
before relocation, then it becomes broken after relocation. This prevents
some x86 boards from booting. Fix it.

Fixes: 1057e6c (timer: Set up the real timer after driver model is available)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/board_r.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bin Meng March 11, 2016, 3:25 a.m. UTC | #1
Hi Simon,

On Mon, Mar 7, 2016 at 10:27 AM, Simon Glass <sjg@chromium.org> wrote:
> Commit 1057e6c broke use of the timer with driver model. If the timer is used
> before relocation, then it becomes broken after relocation. This prevents
> some x86 boards from booting. Fix it.

Isn't the broken due to gd not initialized to zero?

>
> Fixes: 1057e6c (timer: Set up the real timer after driver model is available)
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/board_r.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index 52a9b26..0f068bf 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -318,11 +318,13 @@ static int initr_dm(void)
>         /* Save the pre-reloc driver model and start a new one */
>         gd->dm_root_f = gd->dm_root;
>         gd->dm_root = NULL;
> +#ifdef CONFIG_TIMER
> +       gd->timer = NULL;
> +#endif
>         ret = dm_init_and_scan(false);
>         if (ret)
>                 return ret;
>  #ifdef CONFIG_TIMER_EARLY
> -       gd->timer = NULL;
>         ret = dm_timer_init();
>         if (ret)
>                 return ret;
> --

Regards,
Bin
Simon Glass March 12, 2016, 5:04 a.m. UTC | #2
Hi Bin,

On 10 March 2016 at 20:25, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Simon,
>
> On Mon, Mar 7, 2016 at 10:27 AM, Simon Glass <sjg@chromium.org> wrote:
>> Commit 1057e6c broke use of the timer with driver model. If the timer is used
>> before relocation, then it becomes broken after relocation. This prevents
>> some x86 boards from booting. Fix it.
>
> Isn't the broken due to gd not initialized to zero?

No, gd is not set to 0. It is jtus that the timer must be recreated
after relocation. By setting gd->timer to NULL we ensure this.

>
>>
>> Fixes: 1057e6c (timer: Set up the real timer after driver model is available)
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  common/board_r.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/board_r.c b/common/board_r.c
>> index 52a9b26..0f068bf 100644
>> --- a/common/board_r.c
>> +++ b/common/board_r.c
>> @@ -318,11 +318,13 @@ static int initr_dm(void)
>>         /* Save the pre-reloc driver model and start a new one */
>>         gd->dm_root_f = gd->dm_root;
>>         gd->dm_root = NULL;
>> +#ifdef CONFIG_TIMER
>> +       gd->timer = NULL;
>> +#endif
>>         ret = dm_init_and_scan(false);
>>         if (ret)
>>                 return ret;
>>  #ifdef CONFIG_TIMER_EARLY
>> -       gd->timer = NULL;
>>         ret = dm_timer_init();
>>         if (ret)
>>                 return ret;
>> --
>
> Regards,
> Bin

Regards,
Simon
diff mbox

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 52a9b26..0f068bf 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -318,11 +318,13 @@  static int initr_dm(void)
 	/* Save the pre-reloc driver model and start a new one */
 	gd->dm_root_f = gd->dm_root;
 	gd->dm_root = NULL;
+#ifdef CONFIG_TIMER
+	gd->timer = NULL;
+#endif
 	ret = dm_init_and_scan(false);
 	if (ret)
 		return ret;
 #ifdef CONFIG_TIMER_EARLY
-	gd->timer = NULL;
 	ret = dm_timer_init();
 	if (ret)
 		return ret;