diff mbox series

[U-Boot,v2,2/9] ARM: rockchip: rk3188: Remove the pinctrl setup and enable uart at SPL

Message ID 20190102125105.25734-3-david.wu@rock-chips.com
State Accepted
Commit c0b163e908f14250ab153b20efe814a5e3311bef
Delegated to: Philipp Tomsich
Headers show
Series Add common pinctrl driver support for rockchip | expand

Commit Message

David Wu Jan. 2, 2019, 12:50 p.m. UTC
When the boot ROM sets up MMC we don't need to do it again. Remove the
MMC setup code entirely, but we also need to enable uart for debug message.

Signed-off-by: David Wu <david.wu@rock-chips.com>
---

Changes in v2: None

 arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
 1 file changed, 2 insertions(+), 39 deletions(-)

Comments

Heiko Stuebner Jan. 5, 2019, 5:17 p.m. UTC | #1
Hi David,

Am Mittwoch, 2. Januar 2019, 13:50:58 CET schrieb David Wu:
> When the boot ROM sets up MMC we don't need to do it again. Remove the
> MMC setup code entirely, but we also need to enable uart for debug message.
> 
> Signed-off-by: David Wu <david.wu@rock-chips.com>
> ---
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
>  1 file changed, 2 insertions(+), 39 deletions(-)
> 
> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
> index 3c6c3d3c09..a5e4d39cb7 100644
> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
> @@ -120,7 +120,7 @@ void board_debug_uart_init(void)
>  
>  void board_init_f(ulong dummy)
>  {
> -	struct udevice *pinctrl, *dev;
> +	struct udevice *dev;
>  	int ret;
>  
>  #define EARLY_UART
> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>  	 * printascii("string");
>  	 */
>  	debug_uart_init();
> -	printch('s');
> -	printch('p');
> -	printch('l');
> -	printch('\n');
> +	printascii("U-Boot SPL board init");

Did you test this change?
I remember rk3188 having issues (aka hanging) when trying to print
strings through the debug uart and only printch working at all.
(Timer issue or so?) ... Not sure if this got fixed in the meantime?

>  #endif
>  
>  #ifdef CONFIG_ROCKCHIP_USB_UART
> @@ -171,12 +168,6 @@ void board_init_f(ulong dummy)
>  		return;
>  	}
>  
> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> -	if (ret) {
> -		debug("Pinctrl init failed: %d\n", ret);
> -		return;
> -	}
> -
>  	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>  	if (ret) {
>  		debug("DRAM init failed: %d\n", ret);
> @@ -214,7 +205,6 @@ static int setup_led(void)
>  
>  void spl_board_init(void)
>  {
> -	struct udevice *pinctrl;
>  	int ret;
>  
>  	ret = setup_led();
> @@ -223,36 +213,9 @@ void spl_board_init(void)
>  		hang();
>  	}
>  
> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> -	if (ret) {
> -		debug("%s: Cannot find pinctrl device\n", __func__);
> -		goto err;
> -	}
> -
> -#ifdef CONFIG_SPL_MMC_SUPPORT
> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
> -	if (ret) {
> -		debug("%s: Failed to set up SD card\n", __func__);
> -		goto err;
> -	}
> -#endif
> -
> -	/* Enable debug UART */
> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
> -	if (ret) {
> -		debug("%s: Failed to set up console UART\n", __func__);
> -		goto err;
> -	}
> -

Hmm, I see that you're removing the uarts setup in the spl-stage,
but where do you expect it to get setup now, in the case that
only the regular uart but no debug uart gets setup in spl?

Thanks
Heiko
Heiko Stuebner Jan. 5, 2019, 5:19 p.m. UTC | #2
Am Samstag, 5. Januar 2019, 18:17:34 CET schrieb Heiko Stuebner:
> Hi David,
> 
> Am Mittwoch, 2. Januar 2019, 13:50:58 CET schrieb David Wu:
> > When the boot ROM sets up MMC we don't need to do it again. Remove the
> > MMC setup code entirely, but we also need to enable uart for debug message.
> > 
> > Signed-off-by: David Wu <david.wu@rock-chips.com>
> > ---
> > 
> > Changes in v2: None
> > 
> >  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
> >  1 file changed, 2 insertions(+), 39 deletions(-)
> > 
> > diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
> > index 3c6c3d3c09..a5e4d39cb7 100644
> > --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
> > +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
> > @@ -120,7 +120,7 @@ void board_debug_uart_init(void)
> >  
> >  void board_init_f(ulong dummy)
> >  {
> > -	struct udevice *pinctrl, *dev;
> > +	struct udevice *dev;
> >  	int ret;
> >  
> >  #define EARLY_UART
> > @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
> >  	 * printascii("string");
> >  	 */
> >  	debug_uart_init();
> > -	printch('s');
> > -	printch('p');
> > -	printch('l');
> > -	printch('\n');
> > +	printascii("U-Boot SPL board init");
> 
> Did you test this change?
> I remember rk3188 having issues (aka hanging) when trying to print
> strings through the debug uart and only printch working at all.
> (Timer issue or so?) ... Not sure if this got fixed in the meantime?
> 
> >  #endif
> >  
> >  #ifdef CONFIG_ROCKCHIP_USB_UART
> > @@ -171,12 +168,6 @@ void board_init_f(ulong dummy)
> >  		return;
> >  	}
> >  
> > -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> > -	if (ret) {
> > -		debug("Pinctrl init failed: %d\n", ret);
> > -		return;
> > -	}
> > -
> >  	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
> >  	if (ret) {
> >  		debug("DRAM init failed: %d\n", ret);
> > @@ -214,7 +205,6 @@ static int setup_led(void)
> >  
> >  void spl_board_init(void)
> >  {
> > -	struct udevice *pinctrl;
> >  	int ret;
> >  
> >  	ret = setup_led();
> > @@ -223,36 +213,9 @@ void spl_board_init(void)
> >  		hang();
> >  	}
> >  
> > -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> > -	if (ret) {
> > -		debug("%s: Cannot find pinctrl device\n", __func__);
> > -		goto err;
> > -	}
> > -
> > -#ifdef CONFIG_SPL_MMC_SUPPORT
> > -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
> > -	if (ret) {
> > -		debug("%s: Failed to set up SD card\n", __func__);
> > -		goto err;
> > -	}
> > -#endif
> > -
> > -	/* Enable debug UART */
> > -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
> > -	if (ret) {
> > -		debug("%s: Failed to set up console UART\n", __func__);
> > -		goto err;
> > -	}
> > -
> 
> Hmm, I see that you're removing the uarts setup in the spl-stage,
> but where do you expect it to get setup now, in the case that
> only the regular uart but no debug uart gets setup in spl?

Ah, looking at the following patch, I guess you expect the new
pinctrl driver to set this up, right? The this looks good.

Heiko
David Wu Jan. 14, 2019, 12:01 p.m. UTC | #3
Hi Heiko,

在 2019/1/6 上午1:17, Heiko Stuebner 写道:
>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
>> index 3c6c3d3c09..a5e4d39cb7 100644
>> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
>> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
>> @@ -120,7 +120,7 @@ void board_debug_uart_init(void)
>>   
>>   void board_init_f(ulong dummy)
>>   {
>> -	struct udevice *pinctrl, *dev;
>> +	struct udevice *dev;
>>   	int ret;
>>   
>>   #define EARLY_UART
>> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>>   	 * printascii("string");
>>   	 */
>>   	debug_uart_init();
>> -	printch('s');
>> -	printch('p');
>> -	printch('l');
>> -	printch('\n');
>> +	printascii("U-Boot SPL board init");
> Did you test this change?
> I remember rk3188 having issues (aka hanging) when trying to print
> strings through the debug uart and only printch working at all.
> (Timer issue or so?) ... Not sure if this got fixed in the meantime?
> 

I don't know there was a issue, but i test it on the Radxa board today, 
it looks okay.

U-Boot SPL board init
U-Boot SPL 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)
Returning to boot ROM...


U-Boot 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)

Model: Radxa Rock
DRAM:  2 GiB
MMC:   dwmmc@10214000: 0
Loading Environment from MMC... Card did not respond to voltage select!
*** Warning - No block device, using default environment

In:    serial@20064000
Out:   serial@20064000
Err:   serial@20064000
Model: Radxa Rock
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0
=>
Lukasz Majewski Jan. 18, 2019, 11:34 p.m. UTC | #4
Hi David,

> Hi Heiko,
> 
> 在 2019/1/6 上午1:17, Heiko Stuebner 写道:
> >> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c
> >> b/arch/arm/mach-rockchip/rk3188-board-spl.c index
> >> 3c6c3d3c09..a5e4d39cb7 100644 ---
> >> a/arch/arm/mach-rockchip/rk3188-board-spl.c +++
> >> b/arch/arm/mach-rockchip/rk3188-board-spl.c @@ -120,7 +120,7 @@
> >> void board_debug_uart_init(void) 
> >>   void board_init_f(ulong dummy)
> >>   {
> >> -	struct udevice *pinctrl, *dev;
> >> +	struct udevice *dev;
> >>   	int ret;
> >>   
> >>   #define EARLY_UART
> >> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
> >>   	 * printascii("string");
> >>   	 */
> >>   	debug_uart_init();
> >> -	printch('s');
> >> -	printch('p');
> >> -	printch('l');
> >> -	printch('\n');
> >> +	printascii("U-Boot SPL board init");  
> > Did you test this change?
> > I remember rk3188 having issues (aka hanging) when trying to print
> > strings through the debug uart and only printch working at all.
> > (Timer issue or so?) ... Not sure if this got fixed in the meantime?
> >   

But you are using the debug uart for "production". Please use the
proper driver.

You may either properly setup normal uart or buffer the console output
until the uart is configured by device model (DM).


> 
> I don't know there was a issue, but i test it on the Radxa board
> today, it looks okay.
> 
> U-Boot SPL board init
> U-Boot SPL 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50
> +0800) Returning to boot ROM...
> 
> 
> U-Boot 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)
> 
> Model: Radxa Rock
> DRAM:  2 GiB
> MMC:   dwmmc@10214000: 0
> Loading Environment from MMC... Card did not respond to voltage
> select! *** Warning - No block device, using default environment
> 
> In:    serial@20064000
> Out:   serial@20064000
> Err:   serial@20064000
> Model: Radxa Rock
> rockchip_dnl_key_pressed: adc_channel_single_shot fail!
> Net:   Net Initialization Skipped
> No ethernet found.
> Hit any key to stop autoboot:  0
> =>  
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Kever Yang Jan. 22, 2019, 8:57 a.m. UTC | #5
Heiko,


On 01/06/2019 01:19 AM, Heiko Stuebner wrote:
> Am Samstag, 5. Januar 2019, 18:17:34 CET schrieb Heiko Stuebner:
>> Hi David,
>>
>> Am Mittwoch, 2. Januar 2019, 13:50:58 CET schrieb David Wu:
>>> When the boot ROM sets up MMC we don't need to do it again. Remove the
>>> MMC setup code entirely, but we also need to enable uart for debug message.
>>>
>>> Signed-off-by: David Wu <david.wu@rock-chips.com>
>>> ---
>>>
>>> Changes in v2: None
>>>
>>>  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
>>>  1 file changed, 2 insertions(+), 39 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
>>> index 3c6c3d3c09..a5e4d39cb7 100644
>>> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
>>> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
>>> @@ -120,7 +120,7 @@ void board_debug_uart_init(void)
>>>  
>>>  void board_init_f(ulong dummy)
>>>  {
>>> -	struct udevice *pinctrl, *dev;
>>> +	struct udevice *dev;
>>>  	int ret;
>>>  
>>>  #define EARLY_UART
>>> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>>>  	 * printascii("string");
>>>  	 */
>>>  	debug_uart_init();
>>> -	printch('s');
>>> -	printch('p');
>>> -	printch('l');
>>> -	printch('\n');
>>> +	printascii("U-Boot SPL board init");
>> Did you test this change?
>> I remember rk3188 having issues (aka hanging) when trying to print
>> strings through the debug uart and only printch working at all.
>> (Timer issue or so?) ... Not sure if this got fixed in the meantime?

When did you met this issue? I don't think printascii could not work
and I never met this kind of issue. here is the difference between the
two API:
136         void printch(int ch)
\                                                 
137         {
\                                                                    
138                 _printch(ch);
\                                                
139         }
\                                                                    
140
\                                                                              

141         void printascii(const char *str)
\                                                                                               

142         {
\                                                                    
143                 while (*str)
\                                                 
144                         _printch(*str++);
\                                    
145         }
\                                                                    
146 \        

Thanks,
- Kever   
>>
>>>  #endif
>>>  
>>>  #ifdef CONFIG_ROCKCHIP_USB_UART
>>> @@ -171,12 +168,6 @@ void board_init_f(ulong dummy)
>>>  		return;
>>>  	}
>>>  
>>> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
>>> -	if (ret) {
>>> -		debug("Pinctrl init failed: %d\n", ret);
>>> -		return;
>>> -	}
>>> -
>>>  	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>>>  	if (ret) {
>>>  		debug("DRAM init failed: %d\n", ret);
>>> @@ -214,7 +205,6 @@ static int setup_led(void)
>>>  
>>>  void spl_board_init(void)
>>>  {
>>> -	struct udevice *pinctrl;
>>>  	int ret;
>>>  
>>>  	ret = setup_led();
>>> @@ -223,36 +213,9 @@ void spl_board_init(void)
>>>  		hang();
>>>  	}
>>>  
>>> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
>>> -	if (ret) {
>>> -		debug("%s: Cannot find pinctrl device\n", __func__);
>>> -		goto err;
>>> -	}
>>> -
>>> -#ifdef CONFIG_SPL_MMC_SUPPORT
>>> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
>>> -	if (ret) {
>>> -		debug("%s: Failed to set up SD card\n", __func__);
>>> -		goto err;
>>> -	}
>>> -#endif
>>> -
>>> -	/* Enable debug UART */
>>> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
>>> -	if (ret) {
>>> -		debug("%s: Failed to set up console UART\n", __func__);
>>> -		goto err;
>>> -	}
>>> -
>> Hmm, I see that you're removing the uarts setup in the spl-stage,
>> but where do you expect it to get setup now, in the case that
>> only the regular uart but no debug uart gets setup in spl?
> Ah, looking at the following patch, I guess you expect the new
> pinctrl driver to set this up, right? The this looks good.
>
> Heiko
>
>
>
>
>
>
Kever Yang Jan. 22, 2019, 9:04 a.m. UTC | #6
Lukasz,


On 01/19/2019 07:34 AM, Lukasz Majewski wrote:
> Hi David,
>
>> Hi Heiko,
>>
>> 在 2019/1/6 上午1:17, Heiko Stuebner 写道:
>>>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c
>>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c index
>>>> 3c6c3d3c09..a5e4d39cb7 100644 ---
>>>> a/arch/arm/mach-rockchip/rk3188-board-spl.c +++
>>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c @@ -120,7 +120,7 @@
>>>> void board_debug_uart_init(void) 
>>>>   void board_init_f(ulong dummy)
>>>>   {
>>>> -	struct udevice *pinctrl, *dev;
>>>> +	struct udevice *dev;
>>>>   	int ret;
>>>>   
>>>>   #define EARLY_UART
>>>> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>>>>   	 * printascii("string");
>>>>   	 */
>>>>   	debug_uart_init();
>>>> -	printch('s');
>>>> -	printch('p');
>>>> -	printch('l');
>>>> -	printch('\n');
>>>> +	printascii("U-Boot SPL board init");  
>>> Did you test this change?
>>> I remember rk3188 having issues (aka hanging) when trying to print
>>> strings through the debug uart and only printch working at all.
>>> (Timer issue or so?) ... Not sure if this got fixed in the meantime?
>>>   
> But you are using the debug uart for "production". Please use the
> proper driver.
>
> You may either properly setup normal uart or buffer the console output
> until the uart is configured by device model (DM).

If this is U-Boot proper, I would agree with you, but I don't agree this
opinion for using in TPL, because TPL is running in limited SRAM, and
we may not enable DM/console for it, DEBUG_UART is pretty good enough
and small enough for U-Boot TPL.
If everything works fine, you can just turn off the DEBUG_UART and get
a TPL without any debug message in production, this is acceptable just
like we
may add silent mode for both U-Boot and Kernel in production which do not
have any debug output.

Thanks,
- Kever
>
>
>> I don't know there was a issue, but i test it on the Radxa board
>> today, it looks okay.
>>
>> U-Boot SPL board init
>> U-Boot SPL 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50
>> +0800) Returning to boot ROM...
>>
>>
>> U-Boot 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)
>>
>> Model: Radxa Rock
>> DRAM:  2 GiB
>> MMC:   dwmmc@10214000: 0
>> Loading Environment from MMC... Card did not respond to voltage
>> select! *** Warning - No block device, using default environment
>>
>> In:    serial@20064000
>> Out:   serial@20064000
>> Err:   serial@20064000
>> Model: Radxa Rock
>> rockchip_dnl_key_pressed: adc_channel_single_shot fail!
>> Net:   Net Initialization Skipped
>> No ethernet found.
>> Hit any key to stop autoboot:  0
>> =>  
>>
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>
>
>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
David Wu Jan. 22, 2019, 9:10 a.m. UTC | #7
Hi Lukasz,

在 2019/1/19 上午7:34, Lukasz Majewski 写道:
> Hi David,
> 
>> Hi Heiko,
>>
>> 在 2019/1/6 上午1:17, Heiko Stuebner 写道:
>>>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c
>>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c index
>>>> 3c6c3d3c09..a5e4d39cb7 100644 ---
>>>> a/arch/arm/mach-rockchip/rk3188-board-spl.c +++
>>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c @@ -120,7 +120,7 @@
>>>> void board_debug_uart_init(void)
>>>>    void board_init_f(ulong dummy)
>>>>    {
>>>> -	struct udevice *pinctrl, *dev;
>>>> +	struct udevice *dev;
>>>>    	int ret;
>>>>    
>>>>    #define EARLY_UART
>>>> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>>>>    	 * printascii("string");
>>>>    	 */
>>>>    	debug_uart_init();
>>>> -	printch('s');
>>>> -	printch('p');
>>>> -	printch('l');
>>>> -	printch('\n');
>>>> +	printascii("U-Boot SPL board init");
>>> Did you test this change?
>>> I remember rk3188 having issues (aka hanging) when trying to print
>>> strings through the debug uart and only printch working at all.
>>> (Timer issue or so?) ... Not sure if this got fixed in the meantime?
>>>    
> 
> But you are using the debug uart for "production". Please use the
> proper driver.
> 
> You may either properly setup normal uart or buffer the console output
> until the uart is configured by device model (DM).
> 

Here, we just use it for debug print, and the sram size is limited to 
use more complex driver at spl stage.

> 
>>
>> I don't know there was a issue, but i test it on the Radxa board
>> today, it looks okay.
>>
>> U-Boot SPL board init
>> U-Boot SPL 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50
>> +0800) Returning to boot ROM...
>>
>>
>> U-Boot 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)
>>
>> Model: Radxa Rock
>> DRAM:  2 GiB
>> MMC:   dwmmc@10214000: 0
>> Loading Environment from MMC... Card did not respond to voltage
>> select! *** Warning - No block device, using default environment
>>
>> In:    serial@20064000
>> Out:   serial@20064000
>> Err:   serial@20064000
>> Model: Radxa Rock
>> rockchip_dnl_key_pressed: adc_channel_single_shot fail!
>> Net:   Net Initialization Skipped
>> No ethernet found.
>> Hit any key to stop autoboot:  0
>> =>
>>
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
>
Kever Yang Jan. 22, 2019, 9:11 a.m. UTC | #8
On 01/02/2019 08:50 PM, David Wu wrote:
> When the boot ROM sets up MMC we don't need to do it again. Remove the
> MMC setup code entirely, but we also need to enable uart for debug message.
>
> Signed-off-by: David Wu <david.wu@rock-chips.com>


Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>
> Changes in v2: None
>
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
>  1 file changed, 2 insertions(+), 39 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
> index 3c6c3d3c09..a5e4d39cb7 100644
> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
> @@ -120,7 +120,7 @@ void board_debug_uart_init(void)
>  
>  void board_init_f(ulong dummy)
>  {
> -	struct udevice *pinctrl, *dev;
> +	struct udevice *dev;
>  	int ret;
>  
>  #define EARLY_UART
> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
>  	 * printascii("string");
>  	 */
>  	debug_uart_init();
> -	printch('s');
> -	printch('p');
> -	printch('l');
> -	printch('\n');
> +	printascii("U-Boot SPL board init");
>  #endif
>  
>  #ifdef CONFIG_ROCKCHIP_USB_UART
> @@ -171,12 +168,6 @@ void board_init_f(ulong dummy)
>  		return;
>  	}
>  
> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> -	if (ret) {
> -		debug("Pinctrl init failed: %d\n", ret);
> -		return;
> -	}
> -
>  	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>  	if (ret) {
>  		debug("DRAM init failed: %d\n", ret);
> @@ -214,7 +205,6 @@ static int setup_led(void)
>  
>  void spl_board_init(void)
>  {
> -	struct udevice *pinctrl;
>  	int ret;
>  
>  	ret = setup_led();
> @@ -223,36 +213,9 @@ void spl_board_init(void)
>  		hang();
>  	}
>  
> -	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> -	if (ret) {
> -		debug("%s: Cannot find pinctrl device\n", __func__);
> -		goto err;
> -	}
> -
> -#ifdef CONFIG_SPL_MMC_SUPPORT
> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
> -	if (ret) {
> -		debug("%s: Failed to set up SD card\n", __func__);
> -		goto err;
> -	}
> -#endif
> -
> -	/* Enable debug UART */
> -	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
> -	if (ret) {
> -		debug("%s: Failed to set up console UART\n", __func__);
> -		goto err;
> -	}
> -
>  	preloader_console_init();
>  #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
>  	back_to_bootrom(BROM_BOOT_NEXTSTAGE);
>  #endif
>  	return;
> -
> -err:
> -	printf("spl_board_init: Error %d\n", ret);
> -
> -	/* No way to report error here */
> -	hang();
>  }
Lukasz Majewski Jan. 22, 2019, 10:27 a.m. UTC | #9
Hi Kever,

> Lukasz,
> 
> 
> On 01/19/2019 07:34 AM, Lukasz Majewski wrote:
> > Hi David,
> >  
> >> Hi Heiko,
> >>
> >> 在 2019/1/6 上午1:17, Heiko Stuebner 写道:  
> >>>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c
> >>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c index
> >>>> 3c6c3d3c09..a5e4d39cb7 100644 ---
> >>>> a/arch/arm/mach-rockchip/rk3188-board-spl.c +++
> >>>> b/arch/arm/mach-rockchip/rk3188-board-spl.c @@ -120,7 +120,7 @@
> >>>> void board_debug_uart_init(void) 
> >>>>   void board_init_f(ulong dummy)
> >>>>   {
> >>>> -	struct udevice *pinctrl, *dev;
> >>>> +	struct udevice *dev;
> >>>>   	int ret;
> >>>>   
> >>>>   #define EARLY_UART
> >>>> @@ -134,10 +134,7 @@ void board_init_f(ulong dummy)
> >>>>   	 * printascii("string");
> >>>>   	 */
> >>>>   	debug_uart_init();
> >>>> -	printch('s');
> >>>> -	printch('p');
> >>>> -	printch('l');
> >>>> -	printch('\n');
> >>>> +	printascii("U-Boot SPL board init");    
> >>> Did you test this change?
> >>> I remember rk3188 having issues (aka hanging) when trying to print
> >>> strings through the debug uart and only printch working at all.
> >>> (Timer issue or so?) ... Not sure if this got fixed in the
> >>> meantime? 
> > But you are using the debug uart for "production". Please use the
> > proper driver.
> >
> > You may either properly setup normal uart or buffer the console
> > output until the uart is configured by device model (DM).  
> 
> If this is U-Boot proper, I would agree with you, but I don't agree
> this opinion for using in TPL, because TPL is running in limited
> SRAM, and we may not enable DM/console for it,

If I may ask - what is the limit for TPL size?

Have you considered using OF_PLATDATA with some DTS converted to C
structs?

> DEBUG_UART is pretty
> good enough and small enough for U-Boot TPL.

Do you have U-boot TPL -> SPL -> U-boot proper ?

> If everything works fine, you can just turn off the DEBUG_UART and get
> a TPL without any debug message in production, this is acceptable just
> like we
> may add silent mode for both U-Boot and Kernel in production which do
> not have any debug output.

I see your point. 

> 
> Thanks,
> - Kever
> >
> >  
> >> I don't know there was a issue, but i test it on the Radxa board
> >> today, it looks okay.
> >>
> >> U-Boot SPL board init
> >> U-Boot SPL 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50
> >> +0800) Returning to boot ROM...
> >>
> >>
> >> U-Boot 2019.01-rc1-00009-gdd7b9156fe (Jan 14 2019 - 19:53:50 +0800)
> >>
> >> Model: Radxa Rock
> >> DRAM:  2 GiB
> >> MMC:   dwmmc@10214000: 0
> >> Loading Environment from MMC... Card did not respond to voltage
> >> select! *** Warning - No block device, using default environment
> >>
> >> In:    serial@20064000
> >> Out:   serial@20064000
> >> Err:   serial@20064000
> >> Model: Radxa Rock
> >> rockchip_dnl_key_pressed: adc_channel_single_shot fail!
> >> Net:   Net Initialization Skipped
> >> No ethernet found.
> >> Hit any key to stop autoboot:  0  
> >> =>    
> >>
> >>
> >> _______________________________________________
> >> U-Boot mailing list
> >> U-Boot@lists.denx.de
> >> https://lists.denx.de/listinfo/u-boot  
> >
> >
> >
> > Best regards,
> >
> > Lukasz Majewski
> >
> > --
> >
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de
> >
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot  
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Philipp Tomsich Jan. 31, 2019, 10:15 a.m. UTC | #10
> When the boot ROM sets up MMC we don't need to do it again. Remove the
> MMC setup code entirely, but we also need to enable uart for debug message.
> 
> Signed-off-by: David Wu <david.wu@rock-chips.com>
> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
> ---
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
>  1 file changed, 2 insertions(+), 39 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Philipp Tomsich Jan. 31, 2019, 9:12 p.m. UTC | #11
> When the boot ROM sets up MMC we don't need to do it again. Remove the
> MMC setup code entirely, but we also need to enable uart for debug message.
> 
> Signed-off-by: David Wu <david.wu@rock-chips.com>
> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
> ---
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 41 ++---------------------
>  1 file changed, 2 insertions(+), 39 deletions(-)
> 

Applied to u-boot-rockchip, thanks!
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
index 3c6c3d3c09..a5e4d39cb7 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -120,7 +120,7 @@  void board_debug_uart_init(void)
 
 void board_init_f(ulong dummy)
 {
-	struct udevice *pinctrl, *dev;
+	struct udevice *dev;
 	int ret;
 
 #define EARLY_UART
@@ -134,10 +134,7 @@  void board_init_f(ulong dummy)
 	 * printascii("string");
 	 */
 	debug_uart_init();
-	printch('s');
-	printch('p');
-	printch('l');
-	printch('\n');
+	printascii("U-Boot SPL board init");
 #endif
 
 #ifdef CONFIG_ROCKCHIP_USB_UART
@@ -171,12 +168,6 @@  void board_init_f(ulong dummy)
 		return;
 	}
 
-	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
-	if (ret) {
-		debug("Pinctrl init failed: %d\n", ret);
-		return;
-	}
-
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret) {
 		debug("DRAM init failed: %d\n", ret);
@@ -214,7 +205,6 @@  static int setup_led(void)
 
 void spl_board_init(void)
 {
-	struct udevice *pinctrl;
 	int ret;
 
 	ret = setup_led();
@@ -223,36 +213,9 @@  void spl_board_init(void)
 		hang();
 	}
 
-	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
-	if (ret) {
-		debug("%s: Cannot find pinctrl device\n", __func__);
-		goto err;
-	}
-
-#ifdef CONFIG_SPL_MMC_SUPPORT
-	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
-	if (ret) {
-		debug("%s: Failed to set up SD card\n", __func__);
-		goto err;
-	}
-#endif
-
-	/* Enable debug UART */
-	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
-	if (ret) {
-		debug("%s: Failed to set up console UART\n", __func__);
-		goto err;
-	}
-
 	preloader_console_init();
 #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
 	back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
 	return;
-
-err:
-	printf("spl_board_init: Error %d\n", ret);
-
-	/* No way to report error here */
-	hang();
 }