diff mbox series

[v2,u-boot-mvebu] arm: mvebu: Cleanup get_boot_device() code

Message ID 20230327211150.11305-1-pali@kernel.org
State Accepted
Commit 785f5379e03e7bd18836d7ab5755d62387dd8369
Delegated to: Stefan Roese
Headers show
Series [v2,u-boot-mvebu] arm: mvebu: Cleanup get_boot_device() code | expand

Commit Message

Pali Rohár March 27, 2023, 9:11 p.m. UTC
Show correct information in debug() output and use correct names for variables.

No functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/arm/mach-mvebu/cpu.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Stefan Roese March 30, 2023, 4:59 a.m. UTC | #1
On 3/27/23 23:11, Pali Rohár wrote:
> Show correct information in debug() output and use correct names for variables.
> 
> No functional change.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   arch/arm/mach-mvebu/cpu.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
> index 56999f608a38..8b91e174c4c1 100644
> --- a/arch/arm/mach-mvebu/cpu.c
> +++ b/arch/arm/mach-mvebu/cpu.c
> @@ -67,6 +67,10 @@ u32 get_boot_device(void)
>   {
>   	u32 val;
>   	u32 boot_device;
> +	u32 boot_err_mode;
> +#ifdef CONFIG_ARMADA_38X
> +	u32 boot_err_code;
> +#endif
>   
>   	/*
>   	 * First check, if UART boot-mode is active. This can only
> @@ -74,9 +78,9 @@ u32 get_boot_device(void)
>   	 * MSB marks if the UART mode is active.
>   	 */
>   	val = readl(BOOTROM_ERR_REG);
> -	boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
> -	debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
> -	if (boot_device == BOOTROM_ERR_MODE_UART)
> +	boot_err_mode = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
> +	debug("BOOTROM_ERR_REG=0x%08x boot_err_mode=0x%x\n", val, boot_err_mode);
> +	if (boot_err_mode == BOOTROM_ERR_MODE_UART)
>   		return BOOT_DEVICE_UART;
>   
>   #ifdef CONFIG_ARMADA_38X
> @@ -84,8 +88,9 @@ u32 get_boot_device(void)
>   	 * If the bootrom error code contains any other than zeros it's an
>   	 * error condition and the bootROM has fallen back to UART boot
>   	 */
> -	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
> -	if (boot_device)
> +	boot_err_code = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
> +	debug("boot_err_code=0x%x\n", boot_err_code);
> +	if (boot_err_code)
>   		return BOOT_DEVICE_UART;
>   #endif
>   

Viele Grüße,
Stefan Roese
Stefan Roese March 30, 2023, 8:26 a.m. UTC | #2
On 3/27/23 23:11, Pali Rohár wrote:
> Show correct information in debug() output and use correct names for variables.
> 
> No functional change.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot-marvell/next

Thanks,
Stefan

> ---
>   arch/arm/mach-mvebu/cpu.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
> index 56999f608a38..8b91e174c4c1 100644
> --- a/arch/arm/mach-mvebu/cpu.c
> +++ b/arch/arm/mach-mvebu/cpu.c
> @@ -67,6 +67,10 @@ u32 get_boot_device(void)
>   {
>   	u32 val;
>   	u32 boot_device;
> +	u32 boot_err_mode;
> +#ifdef CONFIG_ARMADA_38X
> +	u32 boot_err_code;
> +#endif
>   
>   	/*
>   	 * First check, if UART boot-mode is active. This can only
> @@ -74,9 +78,9 @@ u32 get_boot_device(void)
>   	 * MSB marks if the UART mode is active.
>   	 */
>   	val = readl(BOOTROM_ERR_REG);
> -	boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
> -	debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
> -	if (boot_device == BOOTROM_ERR_MODE_UART)
> +	boot_err_mode = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
> +	debug("BOOTROM_ERR_REG=0x%08x boot_err_mode=0x%x\n", val, boot_err_mode);
> +	if (boot_err_mode == BOOTROM_ERR_MODE_UART)
>   		return BOOT_DEVICE_UART;
>   
>   #ifdef CONFIG_ARMADA_38X
> @@ -84,8 +88,9 @@ u32 get_boot_device(void)
>   	 * If the bootrom error code contains any other than zeros it's an
>   	 * error condition and the bootROM has fallen back to UART boot
>   	 */
> -	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
> -	if (boot_device)
> +	boot_err_code = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
> +	debug("boot_err_code=0x%x\n", boot_err_code);
> +	if (boot_err_code)
>   		return BOOT_DEVICE_UART;
>   #endif
>   

Viele Grüße,
Stefan Roese
diff mbox series

Patch

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 56999f608a38..8b91e174c4c1 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -67,6 +67,10 @@  u32 get_boot_device(void)
 {
 	u32 val;
 	u32 boot_device;
+	u32 boot_err_mode;
+#ifdef CONFIG_ARMADA_38X
+	u32 boot_err_code;
+#endif
 
 	/*
 	 * First check, if UART boot-mode is active. This can only
@@ -74,9 +78,9 @@  u32 get_boot_device(void)
 	 * MSB marks if the UART mode is active.
 	 */
 	val = readl(BOOTROM_ERR_REG);
-	boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
-	debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device);
-	if (boot_device == BOOTROM_ERR_MODE_UART)
+	boot_err_mode = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS;
+	debug("BOOTROM_ERR_REG=0x%08x boot_err_mode=0x%x\n", val, boot_err_mode);
+	if (boot_err_mode == BOOTROM_ERR_MODE_UART)
 		return BOOT_DEVICE_UART;
 
 #ifdef CONFIG_ARMADA_38X
@@ -84,8 +88,9 @@  u32 get_boot_device(void)
 	 * If the bootrom error code contains any other than zeros it's an
 	 * error condition and the bootROM has fallen back to UART boot
 	 */
-	boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
-	if (boot_device)
+	boot_err_code = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS;
+	debug("boot_err_code=0x%x\n", boot_err_code);
+	if (boot_err_code)
 		return BOOT_DEVICE_UART;
 #endif