imx8: Correct the SCU API return value check
Subsystems (3)
PATCH 1/1 imx8: Correct the SCU API return value check
From: Peng Fan <[email protected]>
The SCU API alrdeay has been converted to return Linux error code, using SCU error code is not correct here, although SC_ERR_NONE is value as 0.
--- arch/arm/mach-imx/imx8/ahab.c | 8 ++++---- arch/arm/mach-imx/imx8/cpu.c | 34 +++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 17 deletions(-)
arch/arm/mach-imx/imx8/ahab.c +4 -4
@@ -345,9 +345,9 @@ int ahab_close(void)u16 lc; err =sc_seco_chip_info (-1 , &lc,NULL ,NULL ,NULL ); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("Error in get lifecycle\n" ); -return -EIO ; +return err; }if (lc !=0x20 ) {
@@ -357,9 +357,9 @@ int ahab_close(void) } err =sc_seco_forward_lifecycle (-1 ,16 ); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("Error in forward lifecycle to OEM closed\n" ); -return -EIO ; +return err; }return 0 ;
arch/arm/mach-imx/imx8/cpu.c +21 -13
@@ -48,7 +48,7 @@ static char *get_reset_cause(void) {sc_pm_reset_reason_t reason; -if (sc_pm_reset_reason (-1 , &reason) !=SC_ERR_NONE ) +if (sc_pm_reset_reason (-1 , &reason))return "Unknown reset" ;switch (reason) {
@@ -160,6 +160,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)sc_faddr_t tcml_addr;u32 tcml_size =SZ_128K ;ulong addr; +int ret;switch (core_id) {case 0 :
@@ -187,10 +188,12 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)printf ("Power on M4 and MU\n" ); -if (sc_pm_set_resource_power_mode (-1 , core_rsrc,SC_PM_PW_MODE_ON ) !=SC_ERR_NONE ) -return -EIO ; + ret =sc_pm_set_resource_power_mode (-1 , core_rsrc,SC_PM_PW_MODE_ON ); +if (ret) +return ret; -if (sc_pm_set_resource_power_mode (-1 , mu_rsrc,SC_PM_PW_MODE_ON ) !=SC_ERR_NONE ) + ret =sc_pm_set_resource_power_mode (-1 , mu_rsrc,SC_PM_PW_MODE_ON ); +if (ret)return -EIO ;printf ("Copy M4 image from 0x%lx to TCML 0x%lx\n" , addr, (ulong )tcml_addr);
@@ -199,7 +202,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)memcpy ((void *)tcml_addr, (void *)addr, tcml_size);printf ("Start M4 %u\n" , core_id); -if (sc_pm_cpu_start (-1 , core_rsrc, true, tcml_addr) !=SC_ERR_NONE ) + ret =sc_pm_cpu_start (-1 , core_rsrc, true, tcml_addr); +if (ret)return -EIO ;printf ("bootaux complete\n" );
@@ -242,20 +246,23 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)printf ("Power on aux core %d\n" , core_id); -if (sc_pm_set_resource_power_mode (-1 , core_rsrc,SC_PM_PW_MODE_ON ) !=SC_ERR_NONE ) -return -EIO ; + ret =sc_pm_set_resource_power_mode (-1 , core_rsrc,SC_PM_PW_MODE_ON ); +if (ret) +return ret;if (mu_rsrc !=SC_R_NONE ) { -if (sc_pm_set_resource_power_mode (-1 , mu_rsrc,SC_PM_PW_MODE_ON ) !=SC_ERR_NONE ) + ret =sc_pm_set_resource_power_mode (-1 , mu_rsrc,SC_PM_PW_MODE_ON ); +if (ret)return -EIO ; }if (core_id ==1 ) {struct power_domain pd; -if (sc_pm_clock_enable (-1 , core_rsrc,SC_PM_CLK_PER , true, false) !=SC_ERR_NONE ) { + ret = sc_pm_clock_enable(-1, core_rsrc, SC_PM_CLK_PER, true, false) +if (ret) {printf ("Error enable clock\n" ); -return -EIO ; +return ret; }if (!imx8_power_domain_lookup_name ("audio_sai0" , &pd)) {
@@ -286,8 +293,9 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)printf ("Start %s\n" , core_id ==0 ?"M4" :"HIFI" ); -if (sc_pm_cpu_start (-1 , core_rsrc, true, aux_core_ram) !=SC_ERR_NONE ) -return -EIO ; + ret =sc_pm_cpu_start (-1 , core_rsrc, true, aux_core_ram); +if (ret) +return ret;printf ("bootaux complete\n" );return 0 ;
@@ -313,7 +321,7 @@ int arch_auxiliary_core_check_up(u32 core_id)return 0 ; } -if (sc_pm_get_resource_power_mode (-1 , core_rsrc, &power_mode) !=SC_ERR_NONE ) +if (sc_pm_get_resource_power_mode (-1 , core_rsrc, &power_mode))return 0 ;if (power_mode !=SC_PM_PW_MODE_OFF )
Signature · 1 line
2.35.3
Fabio Estevam
reviewerQuoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The SCU API alrdeay has been converted to return Linux error code, using SCU error code is not correct here, although
SC_ERR_NONEis value as 0.Signed-off-by Peng Fan <[email protected]>
This causes the following build failure:
aarch64: + colibri-imx8x
304+WARNING 'mx8qx-ahab-container.img' not found, resulting binary is not-functional305+arch/arm/mach-imx/imx8/cpu.c: In function 'arch_auxiliary_core_up':306+arch/arm/mach-imx/imx8/cpu.c:249:9: error: 'ret' undeclared (first use in this function)
307+ 249 | ret = sc_pm_set_resource_power_mode(-1, core_rsrc, SC_PM_PW_MODE_ON); 308+ | ^~~309+arch/arm/mach-imx/imx8/cpu.c:249:9: note: each undeclared identifier is reported only once for each function it appears in 310+arch/arm/mach-imx/imx8/cpu.c:262:84: error: expected ';' before 'if' 311+ 262 | ret = sc_pm_clock_enable(-1, core_rsrc, SC_PM_CLK_PER, true, false) 312+ | ^
313+ | ;
314+ 263 | if (ret) {
315+ | ~~316+arch/arm/mach-imx/imx8/cpu.c:260:37: error: unused variable 'pd' [-Werror=unused-variable]
317+ 260 | struct power_domain pd;
318+ | ^~
319+cc1: all warnings being treated as errors
320+make[3]: *** [scripts/Makefile.build:257:arch/arm/mach-imx/imx8/cpu.o] Error 1
321+make[2]: *** [scripts/Makefile.build:398: arch/arm/mach-imx/imx8] Error 2 322+make[1]: *** [Makefile:1907: arch/arm/mach-imx] Error 2 323+make: *** [Makefile:177: sub-make] Error 2
Please make sure to run the patches through CI.
Quoted 52 lines
Subject: Re: [PATCH] imx8: Correct the SCU API return value check
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The SCU API alrdeay has been converted to return Linux error code, using SCU error code is not correct here, although
SC_ERR_NONEis value as 0.Signed-off-by Peng Fan <[email protected]>This causes the following build failure:
aarch64: + colibri-imx8x
304+WARNING 'mx8qx-ahab-container.img' not found, resulting binary is
not-functional305+arch/arm/mach-imx/imx8/cpu.c: In function 'arch_auxiliary_core_up':306+arch/arm/mach-imx/imx8/cpu.c:249:9: error: 'ret' undeclared (first
use in this function)
307+ 249 | ret =sc_pm_set_resource_power_mode(-1, core_rsrc, 307+ SC_PM_PW_MODE_ON);
308+ | ^~~309+arch/arm/mach-imx/imx8/cpu.c:249:9: note: each undeclared identifier is reported only once for each function it appears in310+arch/arm/mach-imx/imx8/cpu.c:262:84: error: expected ';' before 'if'
311+ 262 | ret = sc_pm_clock_enable(-1,core_rsrc,SC_PM_CLK_PER, true,
311+ false)
312+ | ^
313+ | ;
314+ 263 | if (ret) {
315+ | ~~316+arch/arm/mach-imx/imx8/cpu.c:260:37: error: unused variable 'pd'
[-Werror=unused-variable]
317+ 260 | structpower_domainpd;
318+ | ^~
319+cc1: all warnings being treated as errors 320+make[3]: *** [scripts/Makefile.build:257:arch/arm/mach-imx/imx8/cpu.o] Error 1
321+make[2]: *** [scripts/Makefile.build:398:arch/arm/mach-imx/imx8]
321+Error 2
322+make[1]: *** [Makefile:1907:arch/arm/mach-imx] Error 2 323+make: *** [Makefile:177: sub-make] Error 2
Quoted 1 line
Please make sure to run the patches through CI.
Ah. I built imx8qm_mek, no issue, but seems indeed issue for 8qxp. I will do more test.
Thanks,
Peng.
Quoted 52 lines · Peng Fan
Quoted 52 lines
Subject: Re: [PATCH] imx8: Correct the SCU API return value check
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The SCU API alrdeay has been converted to return Linux error code, using SCU error code is not correct here, although
SC_ERR_NONEis value as 0.Signed-off-by Peng Fan <[email protected]>This causes the following build failure:
aarch64: + colibri-imx8x
304+WARNING 'mx8qx-ahab-container.img' not found, resulting binary is
not-functional305+arch/arm/mach-imx/imx8/cpu.c: In function 'arch_auxiliary_core_up':306+arch/arm/mach-imx/imx8/cpu.c:249:9: error: 'ret' undeclared (first
use in this function)
307+ 249 | ret =sc_pm_set_resource_power_mode(-1, core_rsrc, 307+ SC_PM_PW_MODE_ON);
308+ | ^~~309+arch/arm/mach-imx/imx8/cpu.c:249:9: note: each undeclared identifier is reported only once for each function it appears in310+arch/arm/mach-imx/imx8/cpu.c:262:84: error: expected ';' before 'if'
311+ 262 | ret = sc_pm_clock_enable(-1,core_rsrc,SC_PM_CLK_PER, true,
311+ false)
312+ | ^
313+ | ;
314+ 263 | if (ret) {
315+ | ~~316+arch/arm/mach-imx/imx8/cpu.c:260:37: error: unused variable 'pd'
[-Werror=unused-variable]
317+ 260 | structpower_domainpd;
318+ | ^~
319+cc1: all warnings being treated as errors 320+make[3]: *** [scripts/Makefile.build:257:arch/arm/mach-imx/imx8/cpu.o] Error 1
321+make[2]: *** [scripts/Makefile.build:398:arch/arm/mach-imx/imx8]
321+Error 2
322+make[1]: *** [Makefile:1907:arch/arm/mach-imx] Error 2 323+make: *** [Makefile:177: sub-make] Error 2
Quoted 4 lines
Quoted 1 line
Please make sure to run the patches through CI.
Ah. I built
imx8qm_mek, no issue, but seems indeed issue for 8qxp. I will do more test.
Before reposting all of the i.MX95 related code please at least locally build all of the imx families, and pushing a branch through Azure CI would be better still, thanks.
Signature · 1 line
Tom
Quoted 71 lines
-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Tuesday, October 8, 2024 11:09 PM
To: Peng Fan <[email protected]>
Cc: Fabio Estevam <[email protected]>; Peng Fan (OSS) <[email protected]>; [email protected]; [email protected]; dl- uboot-imx <[email protected]>
Subject: Re: [PATCH] imx8: Correct the SCU API return value checkQuoted 3 lines · Peng Fan
Quoted 3 lines
Subject: Re: [PATCH] imx8: Correct the SCU API return value check
On Sat, Oct 5, 2024 at 9:01 PM Peng Fan (OSS)
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines · wrote:
From: Peng Fan <[email protected]>
The SCU API alrdeay has been converted to return Linux error
code,
Quoted 1 line
Quoted 1 line
Quoted 1 line
using SCU error code is not correct here, although
SC_ERR_NONEis
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
value as 0.
Signed-off-by Peng Fan <[email protected]>This causes the following build failure:
aarch64: + colibri-imx8x
304+WARNING 'mx8qx-ahab-container.img' not found, resultingbinary
Quoted 5 lines
Quoted 5 lines
is
not-functional305+arch/arm/mach-imx/imx8/cpu.c: In function 'arch_auxiliary_core_up':306+arch/arm/mach-imx/imx8/cpu.c:249:9: error: 'ret' undeclaredQuoted 8 lines
Quoted 8 lines
(first
use in this function)
307+ 249 | ret =sc_pm_set_resource_power_mode(-1, core_rsrc, 307+ SC_PM_PW_MODE_ON);
308+ | ^~~309+arch/arm/mach-imx/imx8/cpu.c:249:9: note: each undeclared identifier is reported only once for each function it appears in310+arch/arm/mach-imx/imx8/cpu.c:262:84: error: expected ';'before
Quoted 2 lines
Quoted 2 lines
'if'
311+ 262 | ret = sc_pm_clock_enable(-1,core_rsrc,
SC_PM_CLK_PER,Quoted 7 lines
Quoted 7 lines
true,
311+ false)
312+ | ^
313+ | ;
314+ 263 | if (ret) {
315+ | ~~316+arch/arm/mach-imx/imx8/cpu.c:260:37: error: unusedvariable
Quoted 13 lines
Quoted 13 lines
'pd'
[-Werror=unused-variable]
317+ 260 | structpower_domainpd;
318+ | ^~
319+cc1: all warnings being treated as errors 320+make[3]: *** [scripts/Makefile.build:257:arch/arm/mach-imx/imx8/cpu.o] Error 1
321+make[2]: *** [scripts/Makefile.build:398:arch/arm/mach-imx/imx8]
321+Error 2
322+make[1]: *** [Makefile:1907:arch/arm/mach-imx] Error 2 323+make: *** [Makefile:177: sub-make] Error 2
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Please make sure to run the patches through CI.
Ah. I built
imx8qm_mek, no issue, but seems indeed issue for 8qxp. I will do more test.Before reposting all of the i.MX95 related code please at least locally build all of the imx families, and pushing a branch through Azure CI would be better still, thanks.
This patch is not for i.MX95, but sure we will do more CI in future patches.
Thanks,
Peng.
Quoted 3 lines
--
Tom