diff mbox series

[U-Boot,3/3] imx: initialize and use generic timer on i.MX 6UL/ULL

Message ID 20180102004328.26325-3-stefan@agner.ch
State Changes Requested
Headers show
Series [U-Boot,1/3] imx: move CONFIG_SYSCOUNTER_TIMER to Kconfig | expand

Commit Message

Stefan Agner Jan. 2, 2018, 12:43 a.m. UTC
The i.MX 6UL/ULL feature a Cortex-A7 CPU which suppor the ARM
generic timer. This change makes use of the ARM generic timer in
U-Boot.

This is crucial to make the ARM generic timers usable in Linux since
timer_init() initalizes the system counter module, which is necessary
to use the generic timers CP15 registers.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---

 arch/arm/include/asm/arch-mx6/imx-regs.h | 1 +
 arch/arm/mach-imx/Makefile               | 2 +-
 arch/arm/mach-imx/mx6/Kconfig            | 4 +++-
 include/configs/mx6_common.h             | 5 ++++-
 4 files changed, 9 insertions(+), 3 deletions(-)

Comments

Fabio Estevam Jan. 5, 2018, 12:40 p.m. UTC | #1
On Mon, Jan 1, 2018 at 10:43 PM, Stefan Agner <stefan@agner.ch> wrote:

> --- a/arch/arm/mach-imx/mx6/Kconfig
> +++ b/arch/arm/mach-imx/mx6/Kconfig
> @@ -9,7 +9,7 @@ config MX6_SMP
>
>  config MX6
>         select ARM_ERRATA_743622 if !MX6UL && !MX6ULL
> -       select GPT_TIMER
> +       select GPT_TIMER if !MX6UL && !MX6ULL
>         bool
>         default y
>         imply CMD_FUSE
> @@ -54,6 +54,7 @@ config MX6UL
>         select HAS_CAAM
>         select SYS_L2CACHE_OFF
>         select ROM_UNIFIED_SECTIONS
> +       select SYSCOUNTER_TIMER
>         bool
>
>  config MX6UL_LITESOM
> @@ -76,6 +77,7 @@ config MX6UL_OPOS6UL
>  config MX6ULL
>         select SYS_L2CACHE_OFF
>         select ROM_UNIFIED_SECTIONS
> +       select SYSCOUNTER_TIMER

This is not needed as MX6UL_LITESOM already selects MX6UL.

Other than that:

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Stefan Agner Jan. 5, 2018, 2:01 p.m. UTC | #2
On 2018-01-05 13:40, Fabio Estevam wrote:
> On Mon, Jan 1, 2018 at 10:43 PM, Stefan Agner <stefan@agner.ch> wrote:
> 
>> --- a/arch/arm/mach-imx/mx6/Kconfig
>> +++ b/arch/arm/mach-imx/mx6/Kconfig
>> @@ -9,7 +9,7 @@ config MX6_SMP
>>
>>  config MX6
>>         select ARM_ERRATA_743622 if !MX6UL && !MX6ULL
>> -       select GPT_TIMER
>> +       select GPT_TIMER if !MX6UL && !MX6ULL
>>         bool
>>         default y
>>         imply CMD_FUSE
>> @@ -54,6 +54,7 @@ config MX6UL
>>         select HAS_CAAM
>>         select SYS_L2CACHE_OFF
>>         select ROM_UNIFIED_SECTIONS
>> +       select SYSCOUNTER_TIMER
>>         bool
>>
>>  config MX6UL_LITESOM
>> @@ -76,6 +77,7 @@ config MX6UL_OPOS6UL
>>  config MX6ULL
>>         select SYS_L2CACHE_OFF
>>         select ROM_UNIFIED_SECTIONS
>> +       select SYSCOUNTER_TIMER
> 
> This is not needed as MX6UL_LITESOM already selects MX6UL.

This does not add it to MX6UL_LITESOM, it adds it to "config MX6ULL".
diff is somewhat confusing here.

--
Stefan

> 
> Other than that:
> 
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Fabio Estevam Jan. 5, 2018, 2:04 p.m. UTC | #3
On Fri, Jan 5, 2018 at 12:01 PM, Stefan Agner <stefan@agner.ch> wrote:

> This does not add it to MX6UL_LITESOM, it adds it to "config MX6ULL".
> diff is somewhat confusing here.

Got it! So all is well here then. Thanks
diff mbox series

Patch

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 4be7aab18a..48ce0edd06 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -291,6 +291,7 @@ 
 #endif
 #define IP2APB_TZASC1_BASE_ADDR     (AIPS2_OFF_BASE_ADDR + 0x50000)
 #if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
+#define SCTR_BASE_ADDR              (AIPS2_OFF_BASE_ADDR + 0x5C000)
 #define QSPI0_BASE_ADDR             (AIPS2_OFF_BASE_ADDR + 0x60000)
 #define UART6_BASE_ADDR             (AIPS2_OFF_BASE_ADDR + 0x7C000)
 #elif defined(CONFIG_MX6SX)
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 9322c1ce83..d7966cfd4a 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -22,7 +22,6 @@  endif
 ifeq ($(SOC),$(filter $(SOC),mx7))
 obj-y 	+= cpu.o
 obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
-obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx6 mx7))
 obj-y 	+= cache.o init.o
@@ -31,6 +30,7 @@  obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
 obj-$(CONFIG_IMX_RDC) += rdc-sema.o
 obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
 obj-$(CONFIG_SECURE_BOOT)    += hab.o
+obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx7ulp))
 obj-y  += cache.o
diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 1af60df8d8..86b80ca576 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -9,7 +9,7 @@  config MX6_SMP
 
 config MX6
 	select ARM_ERRATA_743622 if !MX6UL && !MX6ULL
-	select GPT_TIMER
+	select GPT_TIMER if !MX6UL && !MX6ULL
 	bool
 	default y
 	imply CMD_FUSE
@@ -54,6 +54,7 @@  config MX6UL
 	select HAS_CAAM
 	select SYS_L2CACHE_OFF
 	select ROM_UNIFIED_SECTIONS
+	select SYSCOUNTER_TIMER
 	bool
 
 config MX6UL_LITESOM
@@ -76,6 +77,7 @@  config MX6UL_OPOS6UL
 config MX6ULL
 	select SYS_L2CACHE_OFF
 	select ROM_UNIFIED_SECTIONS
+	select SYSCOUNTER_TIMER
 	bool
 
 config MX6_DDRCAL
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index 59e6daea62..ddc645c136 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -7,7 +7,10 @@ 
 #ifndef __MX6_COMMON_H
 #define __MX6_COMMON_H
 
-#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
+#if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
+#define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */
+#define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK
+#else
 #ifndef CONFIG_SYS_L2CACHE_OFF
 #define CONFIG_SYS_L2_PL310
 #define CONFIG_SYS_PL310_BASE	L2_PL310_BASE