Re: [PATCH 3/3] arm: mach-imx: tzasc: convert to cpu_is_mx8xyz macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.02.24 15:40, Stefan Kerkmann wrote:
> Instead of passing in configuration parameters at runtime we can utilize
> the `cpu_is_mx8xyz` macro family to determine which bits should be set.
> 
> As the tzasc driver is imx specific, all functions are prefixed with
> `imx8m_` as well.
> 
> Signed-off-by: Stefan Kerkmann <s.kerkmann@xxxxxxxxxxxxxx>

Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

> ---
>  arch/arm/mach-imx/atf.c   |  8 ++++----
>  arch/arm/mach-imx/imx8m.c |  2 +-
>  arch/arm/mach-imx/tzasc.c | 25 +++++--------------------
>  include/mach/imx/tzasc.h  |  8 ++------
>  4 files changed, 12 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
> index e8060ebd95..9cbc38ef11 100644
> --- a/arch/arm/mach-imx/atf.c
> +++ b/arch/arm/mach-imx/atf.c
> @@ -158,7 +158,7 @@ __noreturn void __imx8mm_load_and_start_image_via_tfa(void *bl33)
>  		size_t bl32_size;
>  		void *bl32_image;
>  
> -		imx8mm_tzc380_init();
> +		imx8m_tzc380_init();
>  		get_builtin_firmware_ext(imx8mm_bl32_bin,
>  				bl33, &bl32_image,
>  				&bl32_size);
> @@ -229,7 +229,7 @@ __noreturn void __imx8mp_load_and_start_image_via_tfa(void *bl33)
>  		size_t bl32_size;
>  		void *bl32_image;
>  
> -		imx8mp_tzc380_init();
> +		imx8m_tzc380_init();
>  		get_builtin_firmware_ext(imx8mp_bl32_bin,
>  				bl33, &bl32_image,
>  				&bl32_size);
> @@ -301,7 +301,7 @@ __noreturn void __imx8mn_load_and_start_image_via_tfa(void *bl33)
>  		size_t bl32_size;
>  		void *bl32_image;
>  
> -		imx8mn_tzc380_init();
> +		imx8m_tzc380_init();
>  		get_builtin_firmware_ext(imx8mn_bl32_bin,
>  				bl33, &bl32_image,
>  				&bl32_size);
> @@ -366,7 +366,7 @@ __noreturn void __imx8mq_load_and_start_image_via_tfa(void *bl33)
>  		size_t bl32_size;
>  		void *bl32_image;
>  
> -		imx8mq_tzc380_init();
> +		imx8m_tzc380_init();
>  		get_builtin_firmware_ext(imx8mq_bl32_bin,
>  				bl33, &bl32_image,
>  				&bl32_size);
> diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
> index ed0fe38a3b..ab9e8edb5b 100644
> --- a/arch/arm/mach-imx/imx8m.c
> +++ b/arch/arm/mach-imx/imx8m.c
> @@ -68,7 +68,7 @@ static int imx8m_init(const char *cputypestr)
>  	imx_set_reset_reason(src + IMX7_SRC_SRSR, imx7_reset_reasons);
>  	pr_info("%s unique ID: %llx\n", cputypestr, imx8m_uid());
>  
> -	if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled()) {
> +	if (IS_ENABLED(CONFIG_PBL_OPTEE) && imx8m_tzc380_is_enabled()) {
>  		static struct of_optee_fixup_data optee_fixup_data = {
>  			.shm_size = OPTEE_SHM_SIZE,
>  			.method = "smc",
> diff --git a/arch/arm/mach-imx/tzasc.c b/arch/arm/mach-imx/tzasc.c
> index 1f8d7426c1..4cb4d7c5cf 100644
> --- a/arch/arm/mach-imx/tzasc.c
> +++ b/arch/arm/mach-imx/tzasc.c
> @@ -1,5 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  
> +#include <mach/imx/generic.h>
>  #include <mach/imx/tzasc.h>
>  #include <linux/bitops.h>
>  #include <mach/imx/imx8m-regs.h>
> @@ -13,7 +14,7 @@
>  #define MX8M_TZASC_REGION_ATTRIBUTES_0		(MX8M_TZASC_BASE_ADDR + 0x108)
>  #define MX8M_TZASC_REGION_ATTRIBUTES_0_SP	GENMASK(31, 28)
>  
> -static void enable_tzc380(bool bypass_id_swap, bool bypass_id_swap_lock)
> +void imx8m_tzc380_init(void)
>  {
>  	u32 __iomem *gpr = IOMEM(MX8M_IOMUXC_GPR_BASE_ADDR);
>  
> @@ -25,14 +26,14 @@ static void enable_tzc380(bool bypass_id_swap, bool bypass_id_swap_lock)
>  	 * According to TRM, TZASC_ID_SWAP_BYPASS should be set in
>  	 * order to avoid AXI Bus errors when GPU is in use
>  	 */
> -	if (bypass_id_swap)
> +	if (cpu_is_mx8mm() || cpu_is_mx8mn() || cpu_is_mx8mp())
>  		setbits_le32(&gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
>  
>  	/*
>  	 * imx8mn and imx8mp implements the lock bit for
>  	 * TZASC_ID_SWAP_BYPASS, enable it to lock settings
>  	 */
> -	if (bypass_id_swap_lock)
> +	if (cpu_is_mx8mn() || cpu_is_mx8mp())
>  		setbits_le32(&gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);
>  
>  	/*
> @@ -44,23 +45,7 @@ static void enable_tzc380(bool bypass_id_swap, bool bypass_id_swap_lock)
>  		   MX8M_TZASC_REGION_ATTRIBUTES_0);
>  }
>  
> -void imx8mq_tzc380_init(void)
> -{
> -	enable_tzc380(false, false);
> -}
> -
> -void imx8mm_tzc380_init(void)
> -{
> -	enable_tzc380(true, false);
> -}
> -
> -void imx8mn_tzc380_init(void) __alias(imx8mp_tzc380_init);
> -void imx8mp_tzc380_init(void)
> -{
> -	enable_tzc380(true, true);
> -}
> -
> -bool tzc380_is_enabled(void)
> +bool imx8m_tzc380_is_enabled(void)
>  {
>  	u32 __iomem *gpr = IOMEM(MX8M_IOMUXC_GPR_BASE_ADDR);
>  
> diff --git a/include/mach/imx/tzasc.h b/include/mach/imx/tzasc.h
> index 724ba50ead..51c86f168e 100644
> --- a/include/mach/imx/tzasc.h
> +++ b/include/mach/imx/tzasc.h
> @@ -6,11 +6,7 @@
>  #include <linux/types.h>
>  #include <asm/system.h>
>  
> -void imx8mq_tzc380_init(void);
> -void imx8mm_tzc380_init(void);
> -void imx8mn_tzc380_init(void);
> -void imx8mp_tzc380_init(void);
> -
> -bool tzc380_is_enabled(void);
> +void imx8m_tzc380_init(void);
> +bool imx8m_tzc380_is_enabled(void);
>  
>  #endif
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux