diff mbox series

[6/7] arm: mach-k3: j721e_init: initialize ESM support

Message ID 20200213093403.25037-7-t-kristo@ti.com
State New
Headers show
Series ESM support for TI K3 SoCs | expand

Commit Message

Tero Kristo Feb. 13, 2020, 9:34 a.m. UTC
Initialize both ESM and ESM_PMIC support if available for the board.
If support is not available for either, a warning is printed out.

ESM signals are only properly routed on PM2 version of the J721E SOM,
so only probe the drivers on this device.

Signed-off-by: Tero Kristo <t-kristo at ti.com>
---
 arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Lokesh Vutla Feb. 13, 2020, 10:47 a.m. UTC | #1
On 13/02/20 3:04 PM, Tero Kristo wrote:
> Initialize both ESM and ESM_PMIC support if available for the board.
> If support is not available for either, a warning is printed out.
> 
> ESM signals are only properly routed on PM2 version of the J721E SOM,
> so only probe the drivers on this device.
> 
> Signed-off-by: Tero Kristo <t-kristo at ti.com>
> ---
>  arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
> index f7f7398081..2de9583937 100644
> --- a/arch/arm/mach-k3/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e_init.c
> @@ -18,6 +18,7 @@
>  #include <dm.h>
>  #include <dm/uclass-internal.h>
>  #include <dm/pinctrl.h>
> +#include "../../../board/ti/common/board_detect.h"
>  
>  #ifdef CONFIG_SPL_BUILD
>  #ifdef CONFIG_K3_LOAD_SYSFW
> @@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
>  
>  void board_init_f(ulong dummy)
>  {
> -#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
> +#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
> +	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
>  	struct udevice *dev;
>  	int ret;
>  #endif
> @@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
>  		printf("AVS init failed: %d\n", ret);
>  #endif
>  
> +#ifdef CONFIG_ESM_K3
> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
> +						  DM_GET_DRIVER(k3_esm), &dev);
> +		if (ret)
> +			printf("MISC init failed: %d\n", ret);
> +	}
> +#endif
> +
> +#ifdef CONFIG_ESM_PMIC
> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
> +						  DM_GET_DRIVER(pmic_esm),
> +						  &dev);
> +		if (ret)
> +			printf("ESM PMIC init failed: %d\n", ret);
> +	}
> +#endif

Since this is board specific, can you call this under spl_board_init() and add
it in board/ti/j721e ?

Thanks and regards,
Lokesh
Tero Kristo Feb. 13, 2020, 12:02 p.m. UTC | #2
On 13/02/2020 12:47, Lokesh Vutla wrote:
> 
> 
> On 13/02/20 3:04 PM, Tero Kristo wrote:
>> Initialize both ESM and ESM_PMIC support if available for the board.
>> If support is not available for either, a warning is printed out.
>>
>> ESM signals are only properly routed on PM2 version of the J721E SOM,
>> so only probe the drivers on this device.
>>
>> Signed-off-by: Tero Kristo <t-kristo at ti.com>
>> ---
>>   arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
>>   1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
>> index f7f7398081..2de9583937 100644
>> --- a/arch/arm/mach-k3/j721e_init.c
>> +++ b/arch/arm/mach-k3/j721e_init.c
>> @@ -18,6 +18,7 @@
>>   #include <dm.h>
>>   #include <dm/uclass-internal.h>
>>   #include <dm/pinctrl.h>
>> +#include "../../../board/ti/common/board_detect.h"
>>   
>>   #ifdef CONFIG_SPL_BUILD
>>   #ifdef CONFIG_K3_LOAD_SYSFW
>> @@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
>>   
>>   void board_init_f(ulong dummy)
>>   {
>> -#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
>> +#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
>> +	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
>>   	struct udevice *dev;
>>   	int ret;
>>   #endif
>> @@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
>>   		printf("AVS init failed: %d\n", ret);
>>   #endif
>>   
>> +#ifdef CONFIG_ESM_K3
>> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
>> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
>> +						  DM_GET_DRIVER(k3_esm), &dev);
>> +		if (ret)
>> +			printf("MISC init failed: %d\n", ret);
>> +	}
>> +#endif
>> +
>> +#ifdef CONFIG_ESM_PMIC
>> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
>> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
>> +						  DM_GET_DRIVER(pmic_esm),
>> +						  &dev);
>> +		if (ret)
>> +			printf("ESM PMIC init failed: %d\n", ret);
>> +	}
>> +#endif
> 
> Since this is board specific, can you call this under spl_board_init() and add
> it in board/ti/j721e ?

Right, let me try that out.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index f7f7398081..2de9583937 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -18,6 +18,7 @@ 
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/pinctrl.h>
+#include "../../../board/ti/common/board_detect.h"
 
 #ifdef CONFIG_SPL_BUILD
 #ifdef CONFIG_K3_LOAD_SYSFW
@@ -114,7 +115,8 @@  static void store_boot_index_from_rom(void)
 
 void board_init_f(ulong dummy)
 {
-#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
+#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
+	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
 	struct udevice *dev;
 	int ret;
 #endif
@@ -181,6 +183,25 @@  void board_init_f(ulong dummy)
 		printf("AVS init failed: %d\n", ret);
 #endif
 
+#ifdef CONFIG_ESM_K3
+	if (board_ti_k3_is("J721EX-PM2-SOM")) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
+						  DM_GET_DRIVER(k3_esm), &dev);
+		if (ret)
+			printf("MISC init failed: %d\n", ret);
+	}
+#endif
+
+#ifdef CONFIG_ESM_PMIC
+	if (board_ti_k3_is("J721EX-PM2-SOM")) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
+						  DM_GET_DRIVER(pmic_esm),
+						  &dev);
+		if (ret)
+			printf("ESM PMIC init failed: %d\n", ret);
+	}
+#endif
+
 #if defined(CONFIG_K3_J721E_DDRSS)
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret)