arm: mvebu: a38x: Detect CONFIG_SYS_TCLK from SAR register
authorPali Rohár <pali@kernel.org>
Sat, 31 Jul 2021 12:22:52 +0000 (14:22 +0200)
committerStefan Roese <sr@denx.de>
Wed, 11 Aug 2021 06:42:26 +0000 (08:42 +0200)
Bit 15 in SAR register specifies if TCLK is running at 200 MHz or 250 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/clearfog.h
include/configs/controlcenterdc.h
include/configs/db-88f6820-amc.h
include/configs/db-88f6820-gp.h
include/configs/helios4.h
include/configs/turris_omnia.h
include/configs/x530.h

index 3f3b15a..cb323aa 100644 (file)
 #define MV_88F68XX_A0_ID       0x4
 #define MV_88F68XX_B0_ID       0xa
 
-/* TCLK Core Clock definition */
-#ifndef CONFIG_SYS_TCLK
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
-#endif
-
 /* SOC specific definations */
 #define INTREG_BASE            0xd0000000
 #define INTREG_BASE_ADDR_REG   (INTREG_BASE + 0x20080)
 #define BOOT_FROM_SPI          0x32
 #define BOOT_FROM_MMC          0x30
 #define BOOT_FROM_MMC_ALT      0x31
+
+#define CONFIG_SYS_TCLK                ((readl(CONFIG_SAR_REG) & BIT(15)) ? \
+                                200000000 : 250000000)
 #elif defined(CONFIG_ARMADA_MSYS)
 /* SAR values for MSYS */
 #define CONFIG_SAR_REG         (MBUS_DFX_BASE  + 0xf8200)
 #define BOOT_FROM_SPI          0x3
 #endif
 
+/* TCLK Core Clock definition */
+#ifndef CONFIG_SYS_TCLK
+#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
+#endif
+
 #endif /* _MVEBU_SOC_H */
index fbdd2f0..7052170 100644 (file)
@@ -17,7 +17,6 @@
  * for DDR ECC byte filling in the SPL before loading the main
  * U-Boot into it.
  */
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
 
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
index 171bd18..3b17f75 100644 (file)
@@ -20,8 +20,6 @@
  * U-Boot into it.
  */
 
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
-
 #define CONFIG_LOADADDR                1000000
 
 /*
index 757fbc0..83f5b71 100644 (file)
@@ -10,8 +10,6 @@
  * High Level Configuration Options (easy to change)
  */
 
-#define CONFIG_SYS_TCLK                200000000       /* 200MHz */
-
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
 
index 9a34fa6..1ab4232 100644 (file)
@@ -10,8 +10,6 @@
  * High Level Configuration Options (easy to change)
  */
 
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
-
 /* I2C */
 #define CONFIG_SYS_I2C_LEGACY
 #define CONFIG_SYS_I2C_MVTWSI
index 1368080..b5814ed 100644 (file)
@@ -17,7 +17,6 @@
  * for DDR ECC byte filling in the SPL before loading the main
  * U-Boot into it.
  */
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
 
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
index 2553da1..8646633 100644 (file)
@@ -16,7 +16,6 @@
  * for DDR ECC byte filling in the SPL before loading the main
  * U-Boot into it.
  */
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
 
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
index 515c6e7..64d6827 100644 (file)
@@ -12,8 +12,6 @@
 
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
-#define CONFIG_SYS_TCLK                250000000       /* 250MHz */
-
 /*
  * NS16550 Configuration
  */