diff mbox series

[v6,1/6] rockchip: px30: fix possibly unused grf and cru variables

Message ID 20221017-upstream-ringneck-v6-1-f4081f49eb2b@theobroma-systems.com
State Accepted
Commit e53856aaf430b1a854a4ca3d68173db3c6e8043b
Delegated to: Kever Yang
Headers show
Series add support for Theobroma Systems PX30-µQ7 (Ringneck) with Haikou devkit | expand

Commit Message

Quentin Schulz Jan. 9, 2023, 10:36 a.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

The grf and cru are only used when no UART base is provided by the user
(defaults to UART2) or for UART1, UART3 and UART5 to be used for the
debug UART. Therefore, let's surround those variable definitions with
the proper checks.

This wasn't an issue before support for UART0 was added, because all
cases were using cru and grf. UART0 only uses pmucru so there's a need
to not define those variables anymore.

Fixes: d0af506625ff ("rockchip: px30: support debug uart on UART0")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/px30/px30.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Kever Yang Jan. 15, 2023, 9:04 a.m. UTC | #1
On 2023/1/9 18:36, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> The grf and cru are only used when no UART base is provided by the user
> (defaults to UART2) or for UART1, UART3 and UART5 to be used for the
> debug UART. Therefore, let's surround those variable definitions with
> the proper checks.
>
> This wasn't an issue before support for UART0 was added, because all
> cases were using cru and grf. UART0 only uses pmucru so there's a need
> to not define those variables anymore.
>
> Fixes: d0af506625ff ("rockchip: px30: support debug uart on UART0")
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/px30/px30.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
> index 0641e6af0f..35a36700df 100644
> --- a/arch/arm/mach-rockchip/px30/px30.c
> +++ b/arch/arm/mach-rockchip/px30/px30.c
> @@ -297,8 +297,18 @@ void board_debug_uart_init(void)
>   	CONFIG_DEBUG_UART_BASE == 0xff030000)
>   	static struct px30_pmugrf * const pmugrf = (void *)PMUGRF_BASE;
>   #endif
> +#if !defined(CONFIG_DEBUG_UART_BASE) || \
> +	(CONFIG_DEBUG_UART_BASE != 0xff158000 && \
> +	 CONFIG_DEBUG_UART_BASE != 0xff168000 && \
> +	 CONFIG_DEBUG_UART_BASE != 0xff178000 && \
> +	 CONFIG_DEBUG_UART_BASE != 0xff030000) || \
> +	(defined(CONFIG_DEBUG_UART_BASE) && \
> +	 (CONFIG_DEBUG_UART_BASE == 0xff158000 || \
> +	  CONFIG_DEBUG_UART_BASE == 0xff168000 || \
> +	  CONFIG_DEBUG_UART_BASE == 0xff178000))
>   	static struct px30_grf * const grf = (void *)GRF_BASE;
>   	static struct px30_cru * const cru = (void *)CRU_BASE;
> +#endif
>   #if defined(CONFIG_DEBUG_UART_BASE) && CONFIG_DEBUG_UART_BASE == 0xff030000
>   	static struct px30_pmucru * const pmucru = (void *)PMUCRU_BASE;
>   #endif
>
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
index 0641e6af0f..35a36700df 100644
--- a/arch/arm/mach-rockchip/px30/px30.c
+++ b/arch/arm/mach-rockchip/px30/px30.c
@@ -297,8 +297,18 @@  void board_debug_uart_init(void)
 	CONFIG_DEBUG_UART_BASE == 0xff030000)
 	static struct px30_pmugrf * const pmugrf = (void *)PMUGRF_BASE;
 #endif
+#if !defined(CONFIG_DEBUG_UART_BASE) || \
+	(CONFIG_DEBUG_UART_BASE != 0xff158000 && \
+	 CONFIG_DEBUG_UART_BASE != 0xff168000 && \
+	 CONFIG_DEBUG_UART_BASE != 0xff178000 && \
+	 CONFIG_DEBUG_UART_BASE != 0xff030000) || \
+	(defined(CONFIG_DEBUG_UART_BASE) && \
+	 (CONFIG_DEBUG_UART_BASE == 0xff158000 || \
+	  CONFIG_DEBUG_UART_BASE == 0xff168000 || \
+	  CONFIG_DEBUG_UART_BASE == 0xff178000))
 	static struct px30_grf * const grf = (void *)GRF_BASE;
 	static struct px30_cru * const cru = (void *)CRU_BASE;
+#endif
 #if defined(CONFIG_DEBUG_UART_BASE) && CONFIG_DEBUG_UART_BASE == 0xff030000
 	static struct px30_pmucru * const pmucru = (void *)PMUCRU_BASE;
 #endif