imx: timer: don't clear the GPT control register multiple times
Subsystems (3)
PATCH 1/2 imx: timer: don't clear the GPT control register multiple times
There is no need to clear the control register 100 times in a loop, a single zero write clears the register. I didn't find any justification why clearing this register in a loop is needed (no info in i.MX6 errata or GPT timer linux driver, linux driver uses single write to clear this control register).
--- arch/arm/mach-imx/timer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-imx/timer.c +1 -2
@@ -74,8 +74,7 @@ int timer_init(void)__raw_writel (GPTCR_SWR , &cur_gpt->control);/* We have no udelay by now */ -for (i =0 ; i <100 ; i++) -__raw_writel (0 , &cur_gpt->control); +__raw_writel (0 , &cur_gpt->control); i =__raw_readl (&cur_gpt->control); i &= ~GPTCR_CLKSOURCE_MASK ;
Signature · 1 line
2.7.4
PATCH 2/2 spl: do not repeat timer init on i.MX6
The GPT timer was already initialised in board_init_f() as it is needed in dram init. Do not repeat timer init in board_init_r().
--- common/spl/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -1
@@ -379,7 +379,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)if (spl_init ())hang (); } -#ifndef CONFIG_PPC +#if !defined(CONFIG_PPC ) && !defined(CONFIG_ARCH_MX6 )/* * timer_init() does not exist on PPC systems. The timer is initialized * and enabled (decrementer) in interrupt_init() here.
Signature · 1 line
2.7.4
PATCH 1/2 imx: timer: don't clear the GPT control register multiple times
In reply to Anatolij GustschinQuoted 6 lines · Anatolij Gustschin
There is no need to clear the control register 100 times in a loop, a single zero write clears the register. I didn't find any justification why clearing this register in a loop is needed (no info in i.MX6 errata or GPT timer linux driver, linux driver uses single write to clear this control register).
Agree, no idea why.
Quoted 11 lines
Signed-off-by Anatolij Gustschin <[email protected]>--- arch/arm/mach-imx/timer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arm/mach-imx/timer.c +0
-0
arch/arm/mach-imx/timer.c int timer_init(void) · line 80
Quoted 9 lines
arch/arm/mach-imx/timer.c +1
-2@@ -74,8 +74,7 @@ int timer_init(void)__raw_writel (GPTCR_SWR , &cur_gpt->control);/* We have no udelay by now */ -for (i =0 ; i <100 ; i++) -__raw_writel (0 , &cur_gpt->control); +__raw_writel (0 , &cur_gpt->control); i =__raw_readl (&cur_gpt->control); i &= ~GPTCR_CLKSOURCE_MASK ;
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/2 spl: do not repeat timer init on i.MX6
In reply to Anatolij GustschinQuoted 15 lines · Anatolij Gustschin
The GPT timer was already initialised in
board_init_f()as it is needed in dram init. Do not repeat timer init inboard_init_r().Signed-off-by Anatolij Gustschin <[email protected]>--- common/spl/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/spl.c +0
-0
common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 385
Quoted 8 lines
common/spl/spl.c +1
-1@@ -379,7 +379,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)if (spl_init ())hang (); } -#ifndef CONFIG_PPC +#if !defined(CONFIG_PPC ) && !defined(CONFIG_ARCH_MX6 )/* * timer_init() does not exist on PPC systems. The timer is initialized * and enabled (decrementer) in interrupt_init() here.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/2 imx: timer: don't clear the GPT control register multiple times
In reply to Anatolij GustschinQuoted 17 lines · Anatolij Gustschin
There is no need to clear the control register 100 times in a loop, a single zero write clears the register. I didn't find any justification why clearing this register in a loop is needed (no info in i.MX6 errata or GPT timer linux driver, linux driver uses single write to clear this control register).
Signed-off-by Anatolij Gustschin <[email protected]>--- arch/arm/mach-imx/timer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arm/mach-imx/timer.c +0
-0
arch/arm/mach-imx/timer.c int timer_init(void) · line 80
Quoted 9 lines
arch/arm/mach-imx/timer.c +1
-2@@ -74,8 +74,7 @@ int timer_init(void)__raw_writel (GPTCR_SWR , &cur_gpt->control);/* We have no udelay by now */ -for (i =0 ; i <100 ; i++) -__raw_writel (0 , &cur_gpt->control); +__raw_writel (0 , &cur_gpt->control); i =__raw_readl (&cur_gpt->control); i &= ~GPTCR_CLKSOURCE_MASK ;
Applied to u-boot-imx, -master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/2 spl: do not repeat timer init on i.MX6
In reply to Anatolij GustschinQuoted 15 lines · Anatolij Gustschin
The GPT timer was already initialised in
board_init_f()as it is needed in dram init. Do not repeat timer init inboard_init_r().Signed-off-by Anatolij Gustschin <[email protected]>--- common/spl/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/spl/spl.c +0
-0
common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 385
Quoted 8 lines
common/spl/spl.c +1
-1@@ -379,7 +379,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)if (spl_init ())hang (); } -#ifndef CONFIG_PPC +#if !defined(CONFIG_PPC ) && !defined(CONFIG_ARCH_MX6 )/* * timer_init() does not exist on PPC systems. The timer is initialized * and enabled (decrementer) in interrupt_init() here.
Applied to u-boot-imx, -master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================