Re: [U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-24 Thread Simon Glass
Hi York,

On 20 September 2017 at 09:20, York Sun  wrote:
> On 09/18/2017 08:47 AM, York Sun wrote:
>> On 09/17/2017 10:55 AM, Simon Glass wrote:
>>> Hi York,
>>>
>>> On 14 September 2017 at 13:01, York Sun  wrote:
 This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
 which intended to move assignment of board info earlier, into
 board_init_r(). However, function preload_console_init() is called
 either from spl_board_init() or from board_init_f(). For the latter
 case, the board info assignment is much earlier than board_init_r().
 Moving such assignment to board_init_r() would be moving it later.

 Signed-off-by: York Sun 
 CC: Lokesh Vutla 
 CC: Ravi Babu 
 CC: Lukasz Majewski 
 CC: Tom Rini 

 ---

 Changes in v2:
 New patch to fix spl after rebasing to latest master.

common/spl/spl.c | 8 +++-
1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/common/spl/spl.c b/common/spl/spl.c
 index ce9819e..98b0ca0 100644
 --- a/common/spl/spl.c
 +++ b/common/spl/spl.c
 @@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
   struct spl_image_info spl_image;

   debug(">>spl:board_init_r()\n");
 -   gd->bd = 
 +
 +   if (!gd->bd)
 +   gd->bd = 
 +
#ifdef CONFIG_SPL_OS_BOOT
   dram_init_banksize();
#endif
 @@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 */
void preloader_console_init(void)
{
 +   if (!gd->bd)
 +   gd->bd = 
 +
>>>
>>> It seems odd that enabling the console sets this data.
>>>
>
> I don't know the history of this line. But it seems this the common
> function called by board_init_f from various board level spl file.
>
>>> What was the impact of moving it later for your board?
>>>
>>
>> gd->bd is used to track the dram bank information. With this moved
>> later, I cannot track the secure memory reserved. I need this available
>> before memory is initialized.
>
> The intention of 15eb1d43b was to move it earlier. But it turns out
> function preloader_console_init() is called from different places. Some
> are very early in board_init_f(). I guess we can add a new function just
> to set gd->bd if it is empty, and call this function when needed. What's
> your suggestion here?

Yes I think an explicit function is best.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-20 Thread York Sun
On 09/18/2017 08:47 AM, York Sun wrote:
> On 09/17/2017 10:55 AM, Simon Glass wrote:
>> Hi York,
>>
>> On 14 September 2017 at 13:01, York Sun  wrote:
>>> This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
>>> which intended to move assignment of board info earlier, into
>>> board_init_r(). However, function preload_console_init() is called
>>> either from spl_board_init() or from board_init_f(). For the latter
>>> case, the board info assignment is much earlier than board_init_r().
>>> Moving such assignment to board_init_r() would be moving it later.
>>>
>>> Signed-off-by: York Sun 
>>> CC: Lokesh Vutla 
>>> CC: Ravi Babu 
>>> CC: Lukasz Majewski 
>>> CC: Tom Rini 
>>>
>>> ---
>>>
>>> Changes in v2:
>>> New patch to fix spl after rebasing to latest master.
>>>
>>>common/spl/spl.c | 8 +++-
>>>1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>>> index ce9819e..98b0ca0 100644
>>> --- a/common/spl/spl.c
>>> +++ b/common/spl/spl.c
>>> @@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>>   struct spl_image_info spl_image;
>>>
>>>   debug(">>spl:board_init_r()\n");
>>> -   gd->bd = 
>>> +
>>> +   if (!gd->bd)
>>> +   gd->bd = 
>>> +
>>>#ifdef CONFIG_SPL_OS_BOOT
>>>   dram_init_banksize();
>>>#endif
>>> @@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>> */
>>>void preloader_console_init(void)
>>>{
>>> +   if (!gd->bd)
>>> +   gd->bd = 
>>> +
>>
>> It seems odd that enabling the console sets this data.
>>

I don't know the history of this line. But it seems this the common 
function called by board_init_f from various board level spl file.

>> What was the impact of moving it later for your board?
>>
> 
> gd->bd is used to track the dram bank information. With this moved
> later, I cannot track the secure memory reserved. I need this available
> before memory is initialized.

The intention of 15eb1d43b was to move it earlier. But it turns out 
function preloader_console_init() is called from different places. Some 
are very early in board_init_f(). I guess we can add a new function just 
to set gd->bd if it is empty, and call this function when needed. What's 
your suggestion here?

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-18 Thread York Sun
On 09/17/2017 10:55 AM, Simon Glass wrote:
> Hi York,
> 
> On 14 September 2017 at 13:01, York Sun  wrote:
>> This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
>> which intended to move assignment of board info earlier, into
>> board_init_r(). However, function preload_console_init() is called
>> either from spl_board_init() or from board_init_f(). For the latter
>> case, the board info assignment is much earlier than board_init_r().
>> Moving such assignment to board_init_r() would be moving it later.
>>
>> Signed-off-by: York Sun 
>> CC: Lokesh Vutla 
>> CC: Ravi Babu 
>> CC: Lukasz Majewski 
>> CC: Tom Rini 
>>
>> ---
>>
>> Changes in v2:
>> New patch to fix spl after rebasing to latest master.
>>
>>   common/spl/spl.c | 8 +++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index ce9819e..98b0ca0 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>  struct spl_image_info spl_image;
>>
>>  debug(">>spl:board_init_r()\n");
>> -   gd->bd = 
>> +
>> +   if (!gd->bd)
>> +   gd->bd = 
>> +
>>   #ifdef CONFIG_SPL_OS_BOOT
>>  dram_init_banksize();
>>   #endif
>> @@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>*/
>>   void preloader_console_init(void)
>>   {
>> +   if (!gd->bd)
>> +   gd->bd = 
>> +
> 
> It seems odd that enabling the console sets this data.
> 
> What was the impact of moving it later for your board?
> 

gd->bd is used to track the dram bank information. With this moved 
later, I cannot track the secure memory reserved. I need this available 
before memory is initialized.

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-17 Thread Simon Glass
Hi York,

On 14 September 2017 at 13:01, York Sun  wrote:
> This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
> which intended to move assignment of board info earlier, into
> board_init_r(). However, function preload_console_init() is called
> either from spl_board_init() or from board_init_f(). For the latter
> case, the board info assignment is much earlier than board_init_r().
> Moving such assignment to board_init_r() would be moving it later.
>
> Signed-off-by: York Sun 
> CC: Lokesh Vutla 
> CC: Ravi Babu 
> CC: Lukasz Majewski 
> CC: Tom Rini 
>
> ---
>
> Changes in v2:
> New patch to fix spl after rebasing to latest master.
>
>  common/spl/spl.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index ce9819e..98b0ca0 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> struct spl_image_info spl_image;
>
> debug(">>spl:board_init_r()\n");
> -   gd->bd = 
> +
> +   if (!gd->bd)
> +   gd->bd = 
> +
>  #ifdef CONFIG_SPL_OS_BOOT
> dram_init_banksize();
>  #endif
> @@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   */
>  void preloader_console_init(void)
>  {
> +   if (!gd->bd)
> +   gd->bd = 
> +

It seems odd that enabling the console sets this data.

What was the impact of moving it later for your board?


> gd->baudrate = CONFIG_BAUDRATE;
>
> serial_init();  /* serial communications setup */
> --
> 2.7.4
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-14 Thread York Sun
This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
which intended to move assignment of board info earlier, into
board_init_r(). However, function preload_console_init() is called
either from spl_board_init() or from board_init_f(). For the latter
case, the board info assignment is much earlier than board_init_r().
Moving such assignment to board_init_r() would be moving it later.

Signed-off-by: York Sun 
CC: Lokesh Vutla 
CC: Ravi Babu 
CC: Lukasz Majewski 
CC: Tom Rini 

---

Changes in v2:
New patch to fix spl after rebasing to latest master.

 common/spl/spl.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index ce9819e..98b0ca0 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
struct spl_image_info spl_image;
 
debug(">>spl:board_init_r()\n");
-   gd->bd = 
+
+   if (!gd->bd)
+   gd->bd = 
+
 #ifdef CONFIG_SPL_OS_BOOT
dram_init_banksize();
 #endif
@@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
  */
 void preloader_console_init(void)
 {
+   if (!gd->bd)
+   gd->bd = 
+
gd->baudrate = CONFIG_BAUDRATE;
 
serial_init();  /* serial communications setup */
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot