arm: mvebu: a37x: Detect CONFIG_SYS_TCLK from SAR register
authorPali Rohár <pali@kernel.org>
Sat, 31 Jul 2021 12:22:53 +0000 (14:22 +0200)
committerStefan Roese <sr@denx.de>
Wed, 11 Aug 2021 06:42:26 +0000 (08:42 +0200)
Bit 20 in SAR register specifies if TCLK is running at 200 MHz or 166 MHz.
Use this information instead of manual configuration in every board file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/mach-mvebu/include/mach/soc.h
include/configs/db-88f6720.h

index cb323aa..eb6906a 100644 (file)
 
 #define BOOT_FROM_UART         0x30
 #define BOOT_FROM_SPI          0x38
+
+#define CONFIG_SYS_TCLK                ((readl(CONFIG_SAR_REG) & BIT(20)) ? \
+                                200000000 : 166000000)
 #elif defined(CONFIG_ARMADA_38X)
 /* SAR values for Armada 38x */
 #define CONFIG_SAR_REG         (MVEBU_REGISTER(0x18600))
index 410a40a..18f4707 100644 (file)
@@ -15,7 +15,6 @@
  * for DDR ECC byte filling in the SPL before loading the main
  * U-Boot into it.
  */
-#define CONFIG_SYS_TCLK                200000000       /* 200MHz */
 
 /* I2C */
 #define CONFIG_SYS_I2C_LEGACY