[PATCH v6 05/13] arm: mach-k3: common: Add CANUART wakeup check helpers

Kumar, Udit u-kumar1 at ti.com
Mon Nov 24 05:02:59 CET 2025


On 11/20/2025 9:33 PM, Markus Schneider-Pargmann (TI.com) wrote:
> Add dedicated helper functions to check CANUART wake registers and magic
> word. This helps determining if we are in a wakeup or if CAN IO
> isolation has to be removed.
>
> Also add a helper to detect a low power mode exit/resume.
>
> Tested-by: Anshul Dalal <anshuld at ti.com>
> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp at baylibre.com>
> ---
>   arch/arm/mach-k3/common.c                | 22 ++++++++++++++++++++--
>   arch/arm/mach-k3/common.h                |  1 +
>   arch/arm/mach-k3/include/mach/hardware.h |  3 +++
>   3 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index 3cc4e7cba0d1e834280fcce3d1140ca32247d807..7780c7740d5ea2a5dcbb442210ce46e25c5bb61c 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -165,13 +165,31 @@ static void wkup_ctrl_remove_can_io_isolation(void)
>   	writel(0, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_GLB);
>   }
>   
> +static bool wkup_ctrl_canuart_wakeup_active(void)
> +{
> +	return !!(readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_STAT1) &
> +		WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE);
> +}
> +
> +static bool wkup_ctrl_canuart_magic_word_set(void)
> +{
> +	return readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT) ==
> +		WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW;



> +}
> +
>   void wkup_ctrl_remove_can_io_isolation_if_set(void)
>   {
> -	if (readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_STAT1) &
> -	    WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE)
> +	if (wkup_ctrl_canuart_wakeup_active() && !wkup_ctrl_canuart_magic_word_set())
>   		wkup_ctrl_remove_can_io_isolation();

can this be merged with patch 1/13


>   }
>   
> +bool wkup_ctrl_is_lpm_exit(void)
> +{
> +	return IS_ENABLED(CONFIG_K3_IODDR) &&
> +		wkup_ctrl_canuart_wakeup_active() &&
> +		wkup_ctrl_canuart_magic_word_set();
> +}
> +
>   bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data)
>   {
>   	if (strncmp(data->header, K3_ROM_BOOT_HEADER_MAGIC, 7))
> diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
> index 49417679e2ec7210d5c95540f476a5d8ee548617..b7dd52fd1792cb6e3eab5c9f3863f983a8ac08df 100644
> --- a/arch/arm/mach-k3/common.h
> +++ b/arch/arm/mach-k3/common.h
> @@ -52,6 +52,7 @@ void do_board_detect(void);
>   void ti_secure_image_check_binary(void **p_image, size_t *p_size);
>   int shutdown_mcu_r5_core1(void);
>   void wkup_ctrl_remove_can_io_isolation_if_set(void);
> +bool wkup_ctrl_is_lpm_exit(void);
>   
>   #if (IS_ENABLED(CONFIG_K3_QOS))
>   void setup_qos(void);
> diff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h
> index d7c759420524faf48ea26c66607c6a899d1321b3..e4e7dd61c0689db11083b81f2e74ba8bea74577e 100644
> --- a/arch/arm/mach-k3/include/mach/hardware.h
> +++ b/arch/arm/mach-k3/include/mach/hardware.h
> @@ -128,6 +128,9 @@ K3_SOC_ID(j722s, J722S)
>   #define WKUP_CTRL_MMR_CANUART_WAKE_STAT1			0x1830c
>   #define WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE	BIT(0)
>   
> +#define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT		0x18318
> +#define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW		0x555555
> +
>   #define WKUP_CTRL_MMR_PMCTRL_IO_0				0x18084
>   #define WKUP_CTRL_MMR_PMCTRL_IO_0_ISOCLK_OVRD_0			BIT(0)
>   #define WKUP_CTRL_MMR_PMCTRL_IO_0_ISOOVR_EXTEND_0		BIT(4)
>


More information about the U-Boot mailing list