diff mbox series

[PATCHv3,19/26] arm: mach-k3: do board config for PM and RM only if supported

Message ID 20210505175540.15006-20-kristo@kernel.org
State Superseded
Delegated to: Lokesh Vutla
Headers show
Series J72xx: HSM rearch support series | expand

Commit Message

Tero Kristo May 5, 2021, 5:55 p.m. UTC
From: Tero Kristo <t-kristo@ti.com>

If the raw PM support is built in, we are operating in the split
firmware approach mode where RM and PM support is not available. In this
case, skip the board config for these two.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>
---
 arch/arm/mach-k3/sysfw-loader.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Raghavendra, Vignesh May 9, 2021, 5:54 a.m. UTC | #1
On 5/5/21 11:25 PM, Tero Kristo wrote:
> From: Tero Kristo <t-kristo@ti.com>
> 
> If the raw PM support is built in, we are operating in the split
> firmware approach mode where RM and PM support is not available. In this
> case, skip the board config for these two.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tero Kristo <kristo@kernel.org>
> ---
>  arch/arm/mach-k3/sysfw-loader.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
> index 0bacfc4d07..64472353c4 100644
> --- a/arch/arm/mach-k3/sysfw-loader.c
> +++ b/arch/arm/mach-k3/sysfw-loader.c
> @@ -159,11 +159,13 @@ static void k3_sysfw_configure_using_fit(void *fit,
>  		      ret);
>  
>  	/* Apply power/clock (PM) specific configuration to SYSFW */
> +#ifndef CONFIG_K3_DM_FW
>  	ret = board_ops->board_config_pm(ti_sci,
>  					 (u64)(u32)cfg_fragment_addr,
>  					 (u32)cfg_fragment_size);
>  	if (ret)
>  		panic("Failed to set board PM configuration (%d)\n", ret);
> +#endif
>  
>  	/* Extract resource management (RM) specific configuration from FIT */
>  	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_RM,
> @@ -172,12 +174,14 @@ static void k3_sysfw_configure_using_fit(void *fit,
>  		panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
>  		      ret);
>  
> +#ifndef CONFIG_K3_DM_FW
>  	/* Apply resource management (RM) configuration to SYSFW */
>  	ret = board_ops->board_config_rm(ti_sci,
>  					 (u64)(u32)cfg_fragment_addr,
>  					 (u32)cfg_fragment_size);
>  	if (ret)
>  		panic("Failed to set board RM configuration (%d)\n", ret);
> +#endif
>  
>  	/* Extract security specific configuration from FIT */
>  	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,
> 


We still need to send RM CFG to TIFS in case of J721e in order for DMA 
to work at R5 SPL. TIFS needs RM CFG to disable firewalls when R5 SPL 
sends  DMA channel cfg requests.

Could you squash the following diff for next version:

diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index b95137fbdd..ac719cd46f 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -263,14 +263,7 @@ static void k3_sysfw_configure_using_fit(void *fit,
                panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
                      ret);
 
-#ifndef CONFIG_K3_DM_FW
-       /* Apply resource management (RM) configuration to SYSFW */
-       ret = board_ops->board_config_rm(ti_sci,
-                                        (u64)(u32)cfg_fragment_addr,
-                                        (u32)cfg_fragment_size);
-       if (ret)
-               panic("Failed to set board RM configuration (%d)\n", ret);
-#else
+#ifdef CONFIG_K3_DM_FW
        if (copy_bcfg) {
                desc = &bcfg_header->descs[1];
 
@@ -284,6 +277,13 @@ static void k3_sysfw_configure_using_fit(void *fit,
        }
 #endif
 
+       /* Apply resource management (RM) configuration to SYSFW */
+       ret = board_ops->board_config_rm(ti_sci,
+                                        (u64)(u32)cfg_fragment_addr,
+                                        (u32)cfg_fragment_size);
+       if (ret)
+               panic("Failed to set board RM configuration (%d)\n", ret);
+
        /* Extract security specific configuration from FIT */
        ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,
                                   &cfg_fragment_addr, &cfg_fragment_size);


Regards
Vignesh
Tero Kristo May 10, 2021, 8:18 a.m. UTC | #2
On 09/05/2021 08:54, Vignesh Raghavendra wrote:
> 
> 
> On 5/5/21 11:25 PM, Tero Kristo wrote:
>> From: Tero Kristo <t-kristo@ti.com>
>>
>> If the raw PM support is built in, we are operating in the split
>> firmware approach mode where RM and PM support is not available. In this
>> case, skip the board config for these two.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> Signed-off-by: Tero Kristo <kristo@kernel.org>
>> ---
>>   arch/arm/mach-k3/sysfw-loader.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
>> index 0bacfc4d07..64472353c4 100644
>> --- a/arch/arm/mach-k3/sysfw-loader.c
>> +++ b/arch/arm/mach-k3/sysfw-loader.c
>> @@ -159,11 +159,13 @@ static void k3_sysfw_configure_using_fit(void *fit,
>>   		      ret);
>>   
>>   	/* Apply power/clock (PM) specific configuration to SYSFW */
>> +#ifndef CONFIG_K3_DM_FW
>>   	ret = board_ops->board_config_pm(ti_sci,
>>   					 (u64)(u32)cfg_fragment_addr,
>>   					 (u32)cfg_fragment_size);
>>   	if (ret)
>>   		panic("Failed to set board PM configuration (%d)\n", ret);
>> +#endif
>>   
>>   	/* Extract resource management (RM) specific configuration from FIT */
>>   	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_RM,
>> @@ -172,12 +174,14 @@ static void k3_sysfw_configure_using_fit(void *fit,
>>   		panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
>>   		      ret);
>>   
>> +#ifndef CONFIG_K3_DM_FW
>>   	/* Apply resource management (RM) configuration to SYSFW */
>>   	ret = board_ops->board_config_rm(ti_sci,
>>   					 (u64)(u32)cfg_fragment_addr,
>>   					 (u32)cfg_fragment_size);
>>   	if (ret)
>>   		panic("Failed to set board RM configuration (%d)\n", ret);
>> +#endif
>>   
>>   	/* Extract security specific configuration from FIT */
>>   	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,
>>
> 
> 
> We still need to send RM CFG to TIFS in case of J721e in order for DMA
> to work at R5 SPL. TIFS needs RM CFG to disable firewalls when R5 SPL
> sends  DMA channel cfg requests.
> 
> Could you squash the following diff for next version:

Yes, I can squash that in. I believe you have tested this change and it 
works? (I will obviously double check at my end though.)

-Tero

> 
> diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
> index b95137fbdd..ac719cd46f 100644
> --- a/arch/arm/mach-k3/sysfw-loader.c
> +++ b/arch/arm/mach-k3/sysfw-loader.c
> @@ -263,14 +263,7 @@ static void k3_sysfw_configure_using_fit(void *fit,
>                  panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
>                        ret);
>   
> -#ifndef CONFIG_K3_DM_FW
> -       /* Apply resource management (RM) configuration to SYSFW */
> -       ret = board_ops->board_config_rm(ti_sci,
> -                                        (u64)(u32)cfg_fragment_addr,
> -                                        (u32)cfg_fragment_size);
> -       if (ret)
> -               panic("Failed to set board RM configuration (%d)\n", ret);
> -#else
> +#ifdef CONFIG_K3_DM_FW
>          if (copy_bcfg) {
>                  desc = &bcfg_header->descs[1];
>   
> @@ -284,6 +277,13 @@ static void k3_sysfw_configure_using_fit(void *fit,
>          }
>   #endif
>   
> +       /* Apply resource management (RM) configuration to SYSFW */
> +       ret = board_ops->board_config_rm(ti_sci,
> +                                        (u64)(u32)cfg_fragment_addr,
> +                                        (u32)cfg_fragment_size);
> +       if (ret)
> +               panic("Failed to set board RM configuration (%d)\n", ret);
> +
>          /* Extract security specific configuration from FIT */
>          ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,
>                                     &cfg_fragment_addr, &cfg_fragment_size);
> 
> 
> Regards
> Vignesh
>
Raghavendra, Vignesh May 10, 2021, 8:25 a.m. UTC | #3
On 5/10/21 1:48 PM, Tero Kristo wrote:
> On 09/05/2021 08:54, Vignesh Raghavendra wrote:
>>
>>
>> On 5/5/21 11:25 PM, Tero Kristo wrote:
>>> From: Tero Kristo <t-kristo@ti.com>
>>>
>>> If the raw PM support is built in, we are operating in the split
>>> firmware approach mode where RM and PM support is not available. In this
>>> case, skip the board config for these two.
>>>
>>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>>> Signed-off-by: Tero Kristo <kristo@kernel.org>
>>> ---
>>>   arch/arm/mach-k3/sysfw-loader.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-k3/sysfw-loader.c
>>> b/arch/arm/mach-k3/sysfw-loader.c
>>> index 0bacfc4d07..64472353c4 100644
>>> --- a/arch/arm/mach-k3/sysfw-loader.c
>>> +++ b/arch/arm/mach-k3/sysfw-loader.c
>>> @@ -159,11 +159,13 @@ static void k3_sysfw_configure_using_fit(void
>>> *fit,
>>>                 ret);
>>>         /* Apply power/clock (PM) specific configuration to SYSFW */
>>> +#ifndef CONFIG_K3_DM_FW
>>>       ret = board_ops->board_config_pm(ti_sci,
>>>                        (u64)(u32)cfg_fragment_addr,
>>>                        (u32)cfg_fragment_size);
>>>       if (ret)
>>>           panic("Failed to set board PM configuration (%d)\n", ret);
>>> +#endif
>>>         /* Extract resource management (RM) specific configuration
>>> from FIT */
>>>       ret = fit_get_data_by_name(fit, images, SYSFW_CFG_RM,
>>> @@ -172,12 +174,14 @@ static void k3_sysfw_configure_using_fit(void
>>> *fit,
>>>           panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
>>>                 ret);
>>>   +#ifndef CONFIG_K3_DM_FW
>>>       /* Apply resource management (RM) configuration to SYSFW */
>>>       ret = board_ops->board_config_rm(ti_sci,
>>>                        (u64)(u32)cfg_fragment_addr,
>>>                        (u32)cfg_fragment_size);
>>>       if (ret)
>>>           panic("Failed to set board RM configuration (%d)\n", ret);
>>> +#endif
>>>         /* Extract security specific configuration from FIT */
>>>       ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,
>>>
>>
>>
>> We still need to send RM CFG to TIFS in case of J721e in order for DMA
>> to work at R5 SPL. TIFS needs RM CFG to disable firewalls when R5 SPL
>> sends  DMA channel cfg requests.
>>
>> Could you squash the following diff for next version:
> 
> Yes, I can squash that in. I believe you have tested this change and it
> works? (I will obviously double check at my end though.)
> 

Yes, I discovered this when adding DMA support at R5 SPL level
on top of current series. Diff is essentially this commit by Dave on TI SDK tree:

https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/?h=ti-u-boot-2021.01&id=33f243f7c99f3e07afdc022e268cc65106781561


Regards
Vignesh
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 0bacfc4d07..64472353c4 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -159,11 +159,13 @@  static void k3_sysfw_configure_using_fit(void *fit,
 		      ret);
 
 	/* Apply power/clock (PM) specific configuration to SYSFW */
+#ifndef CONFIG_K3_DM_FW
 	ret = board_ops->board_config_pm(ti_sci,
 					 (u64)(u32)cfg_fragment_addr,
 					 (u32)cfg_fragment_size);
 	if (ret)
 		panic("Failed to set board PM configuration (%d)\n", ret);
+#endif
 
 	/* Extract resource management (RM) specific configuration from FIT */
 	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_RM,
@@ -172,12 +174,14 @@  static void k3_sysfw_configure_using_fit(void *fit,
 		panic("Error accessing %s node in FIT (%d)\n", SYSFW_CFG_RM,
 		      ret);
 
+#ifndef CONFIG_K3_DM_FW
 	/* Apply resource management (RM) configuration to SYSFW */
 	ret = board_ops->board_config_rm(ti_sci,
 					 (u64)(u32)cfg_fragment_addr,
 					 (u32)cfg_fragment_size);
 	if (ret)
 		panic("Failed to set board RM configuration (%d)\n", ret);
+#endif
 
 	/* Extract security specific configuration from FIT */
 	ret = fit_get_data_by_name(fit, images, SYSFW_CFG_SEC,