diff mbox series

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

Message ID 1517640695-30221-3-git-send-email-david.wu@rock-chips.com
State Changes Requested
Delegated to: Philipp Tomsich
Headers show
Series Add common pinctrl driver support for rockchip | expand

Commit Message

David Wu Feb. 3, 2018, 6:51 a.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>
---

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

Comments

Philipp Tomsich Feb. 9, 2018, 10:13 a.m. UTC | #1
> 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>
> ---
> 
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 42 +++----------------------------
>  1 file changed, 3 insertions(+), 39 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Philipp Tomsich Feb. 18, 2018, 7 p.m. UTC | #2
On Sat, 3 Feb 2018, 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.

If the MMC always set up correctly for all configurations (e.g. bus-width)
or should some of the setup be duplicated there to ensure that we catch 
all corner cases?

> Signed-off-by: David Wu <david.wu@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> arch/arm/mach-rockchip/rk3188-board-spl.c | 42 +++----------------------------
> 1 file changed, 3 insertions(+), 39 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
> index 8e3b8ae..8371a31 100644
> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
> @@ -100,10 +100,11 @@ static int setup_arm_clock(void)
>
> void board_init_f(ulong dummy)
> {
> -	struct udevice *pinctrl, *dev;
> +	struct udevice *dev;
> 	int ret;
>
> 	/* Example code showing how to enable the debug UART on RK3188 */
> +#define EARLY_UART
> #ifdef EARLY_UART
> #include <asm/arch/grf_rk3188.h>
> 	/* Enable early UART on the RK3188 */
> @@ -124,10 +125,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
>
> 	ret = spl_early_init();
> @@ -144,12 +142,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);
> @@ -187,7 +179,6 @@ static int setup_led(void)
>
> void spl_board_init(void)
> {
> -	struct udevice *pinctrl;
> 	int ret;
>
> 	ret = setup_led();
> @@ -196,36 +187,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();
> }
>
David Wu March 5, 2018, 11:36 a.m. UTC | #3
Hi Philipp,

在 2018年02月19日 03:00, Philipp Tomsich 写道:
> 
> 
> On Sat, 3 Feb 2018, 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.
> 
> If the MMC always set up correctly for all configurations (e.g. bus-width)
> or should some of the setup be duplicated there to ensure that we catch 
> all corner cases?

For this, I will do a check if we need to setup duplicated.

> 
>> Signed-off-by: David Wu <david.wu@rock-chips.com>
>> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> ---
>>
>> arch/arm/mach-rockchip/rk3188-board-spl.c | 42 
>> +++----------------------------
>> 1 file changed, 3 insertions(+), 39 deletions(-)
>>
>> diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c 
>> b/arch/arm/mach-rockchip/rk3188-board-spl.c
>> index 8e3b8ae..8371a31 100644
>> --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
>> +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
>> @@ -100,10 +100,11 @@ static int setup_arm_clock(void)
>>
>> void board_init_f(ulong dummy)
>> {
>> -    struct udevice *pinctrl, *dev;
>> +    struct udevice *dev;
>>     int ret;
>>
>>     /* Example code showing how to enable the debug UART on RK3188 */
>> +#define EARLY_UART
>> #ifdef EARLY_UART
>> #include <asm/arch/grf_rk3188.h>
>>     /* Enable early UART on the RK3188 */
>> @@ -124,10 +125,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
>>
>>     ret = spl_early_init();
>> @@ -144,12 +142,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);
>> @@ -187,7 +179,6 @@ static int setup_led(void)
>>
>> void spl_board_init(void)
>> {
>> -    struct udevice *pinctrl;
>>     int ret;
>>
>>     ret = setup_led();
>> @@ -196,36 +187,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();
>> }
>>
> 
> 
>
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 8e3b8ae..8371a31 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -100,10 +100,11 @@  static int setup_arm_clock(void)
 
 void board_init_f(ulong dummy)
 {
-	struct udevice *pinctrl, *dev;
+	struct udevice *dev;
 	int ret;
 
 	/* Example code showing how to enable the debug UART on RK3188 */
+#define EARLY_UART
 #ifdef EARLY_UART
 #include <asm/arch/grf_rk3188.h>
 	/* Enable early UART on the RK3188 */
@@ -124,10 +125,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
 
 	ret = spl_early_init();
@@ -144,12 +142,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);
@@ -187,7 +179,6 @@  static int setup_led(void)
 
 void spl_board_init(void)
 {
-	struct udevice *pinctrl;
 	int ret;
 
 	ret = setup_led();
@@ -196,36 +187,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();
 }