]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid
authorPeng Fan <peng.fan@nxp.com>
Wed, 13 Apr 2022 09:47:22 +0000 (17:47 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 21 Apr 2022 19:27:18 +0000 (15:27 -0400)
Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
CONFIG_COUNTER_FREQUENCY is valid

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
arch/arm/cpu/armv7/ls102xa/psci.S
arch/arm/cpu/armv7/ls102xa/timer.c
arch/arm/cpu/armv7/nonsec_virt.S
arch/arm/cpu/armv7/sunxi/psci.c
arch/arm/cpu/armv8/start.S
arch/arm/mach-rockchip/rk3036-board-spl.c
arch/arm/mach-rockchip/spl.c
arch/arm/mach-rockchip/tpl.c
board/sunxi/board.c

index 531cfb033bc30493872c640719102860e7d35845..3956178369f33aa43c3668aaf811325eb45506eb 100644 (file)
@@ -36,7 +36,7 @@
 
        .align  5
 
-#define        ONE_MS          (COUNTER_FREQUENCY / 1000)
+#define        ONE_MS          (CONFIG_COUNTER_FREQUENCY / 1000)
 #define        RESET_WAIT      (30 * ONE_MS)
 
 .globl psci_version
index d79bf105f13a79ed59e25c9c4acc2503a3ec926d..c6126b10c355bca21ab7f92a979499110886a4e9 100644 (file)
@@ -65,7 +65,7 @@ int timer_init(void)
        /* Enable System Counter */
        writel(SYS_COUNTER_CTRL_ENABLE, &sctr->cntcr);
 
-       freq = COUNTER_FREQUENCY;
+       freq = CONFIG_COUNTER_FREQUENCY;
        asm("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
 
        /* Set PL1 Physical Timer Ctrl */
index 1773fae205c9e1f92269bf1ff39ce5045639552e..39aeeb423f084aa63d4a0b228f8c1e78c72226df 100644 (file)
@@ -189,11 +189,11 @@ ENTRY(_nonsec_init)
  * we do this here instead.
  * But first check if we have the generic timer.
  */
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
        mrc     p15, 0, r0, c0, c1, 1           @ read ID_PFR1
        and     r0, r0, #CPUID_ARM_GENTIMER_MASK        @ mask arch timer bits
        cmp     r0, #(1 << CPUID_ARM_GENTIMER_SHIFT)
-       ldreq   r1, =COUNTER_FREQUENCY
+       ldreq   r1, =CONFIG_COUNTER_FREQUENCY
        mcreq   p15, 0, r1, c14, c0, 0          @ write CNTFRQ
 #endif
 
index 1ac50f558a40956eff6e33be4413bbfedc3cabfe..d1bd6b9be41c0b6b3ac5805a24025a4994b461e9 100644 (file)
@@ -57,7 +57,7 @@ static u32 __secure cp15_read_cntp_ctl(void)
        return val;
 }
 
-#define ONE_MS (COUNTER_FREQUENCY / 1000)
+#define ONE_MS (CONFIG_COUNTER_FREQUENCY / 1000)
 
 static void __secure __mdelay(u32 ms)
 {
index 6a6a4f86502bb83522f2e1d8bed8c48b56d51dcb..d328e8c08a184f3d904b54b3aca953fd8987b208 100644 (file)
@@ -138,9 +138,9 @@ pie_fixup_done:
 0:
        msr     daifclr, #0x4                   /* Unmask SError interrupts */
 
-#ifdef COUNTER_FREQUENCY
+#if CONFIG_COUNTER_FREQUENCY
        branch_if_not_highest_el x0, 4f
-       ldr     x0, =COUNTER_FREQUENCY
+       ldr     x0, =CONFIG_COUNTER_FREQUENCY
        msr     cntfrq_el0, x0                  /* Initialize CNTFRQ */
 #endif
 
index 6eb89e15b818f1c99d4926c7e98ec4e32b1ab23c..73f6d241a1cef1068f001ba7cdd00a5592aaed63 100644 (file)
@@ -20,7 +20,7 @@
 void rockchip_stimer_init(void)
 {
        asm volatile("mcr p15, 0, %0, c14, c0, 0"
-                    : : "r"(COUNTER_FREQUENCY));
+                    : : "r"(CONFIG_COUNTER_FREQUENCY));
 
        writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
        writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
index eda2248029d7f2a45227bebceed6a70e245c492e..30be64042521df5a78024bf285260a943569c627 100644 (file)
@@ -88,7 +88,7 @@ __weak void rockchip_stimer_init(void)
                return;
 #ifndef CONFIG_ARM64
        asm volatile("mcr p15, 0, %0, c14, c0, 0"
-                    : : "r"(COUNTER_FREQUENCY));
+                    : : "r"(CONFIG_COUNTER_FREQUENCY));
 #endif
        writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
        writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
index 8126587060f6efe482dbaf2b6c2c333c2bf7093e..ed46a9ad286c03a223adca505b8a672f676edeaa 100644 (file)
@@ -39,7 +39,7 @@ __weak void rockchip_stimer_init(void)
 
 #ifndef CONFIG_ARM64
        asm volatile("mcr p15, 0, %0, c14, c0, 0"
-                    : : "r"(COUNTER_FREQUENCY));
+                    : : "r"(CONFIG_COUNTER_FREQUENCY));
 #endif
 
        writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
index 89324159d5597d0d863c3c1f601ebdd4327f11d0..371ed9eebaf3d3504a0acadef6cf4784af4d9266 100644 (file)
@@ -202,14 +202,14 @@ int board_init(void)
                 * we avoid the risk of writing to it.
                 */
                asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r"(freq));
-               if (freq != COUNTER_FREQUENCY) {
+               if (freq != CONFIG_COUNTER_FREQUENCY) {
                        debug("arch timer frequency is %d Hz, should be %d, fixing ...\n",
-                             freq, COUNTER_FREQUENCY);
+                             freq, CONFIG_COUNTER_FREQUENCY);
 #ifdef CONFIG_NON_SECURE
                        printf("arch timer frequency is wrong, but cannot adjust it\n");
 #else
                        asm volatile("mcr p15, 0, %0, c14, c0, 0"
-                                    : : "r"(COUNTER_FREQUENCY));
+                                    : : "r"(CONFIG_COUNTER_FREQUENCY));
 #endif
                }
        }