sunxi: use CONFIG_SYS_CLK_FREQ to set cpu clock
authorIain Paton <ipaton0@gmail.com>
Sat, 28 Mar 2015 10:26:38 +0000 (10:26 +0000)
committerHans de Goede <hdegoede@redhat.com>
Sun, 29 Mar 2015 11:36:03 +0000 (13:36 +0200)
make the CPU clock selectable via Kconfig

this removes the sunxi specific CONFIG_CLK_FULL_SPEED defined in each
soc header and replaces it's use in board/sunxi/board.c with
CONFIG_SYS_CLK_FREQ from Kconfig which allows us to configure board
specific frequency on boot

Signed-off-by: Iain Paton <ipaton0@gmail.com>
[hdegoede@redhat.com s/CONFIG_SYS_CLK_FREQ/CONFIG_TIMER_CLK_FREQ/ for the
 arch-timer clk speed on sun7i to fix mis-compile on sun7i]
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Kconfig
arch/arm/cpu/armv7/sunxi/psci.S
board/sunxi/Kconfig
board/sunxi/board.c
include/configs/sun4i.h
include/configs/sun5i.h
include/configs/sun6i.h
include/configs/sun7i.h
include/configs/sun8i.h

diff --git a/Kconfig b/Kconfig
index b5968d74a179a3e37085a86eb0888a1e6ef07271..41d4784f890c2477a00fb453d91255311a1b963e 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -184,7 +184,7 @@ config SYS_TEXT_BASE
          TODO: Move CONFIG_SYS_TEXT_BASE for all the architecture
 
 config SYS_CLK_FREQ
-       depends on ARC
+       depends on ARC || ARCH_SUNXI
        int "CPU clock frequency"
        help
          TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture
index 5be497b7be09658be0b5aa062c8e195e0c886268..e0a524e10caf958a3c5ec8c689e3428a25cb9581 100644 (file)
@@ -37,7 +37,7 @@
 
        .arch_extension sec
 
-#define        ONE_MS                  (CONFIG_SYS_CLK_FREQ / 1000)
+#define        ONE_MS                  (CONFIG_TIMER_CLK_FREQ / 1000)
 #define        TEN_MS                  (10 * ONE_MS)
 #define        GICD_BASE               0x1c81000
 #define        GICC_BASE               0x1c82000
index 9d0eb919776dba314986ed08e8548080a279f48d..2fcab602db07c2037d5865260393e84eb509ffe1 100644 (file)
@@ -132,6 +132,10 @@ endchoice
 
 endif
 
+config SYS_CLK_FREQ
+       default 912000000 if MACH_SUN7I
+       default 1008000000 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I
+
 config SYS_CONFIG_NAME
        default "sun4i" if MACH_SUN4I
        default "sun5i" if MACH_SUN5I
index e1891d198e4ae37635e2e8f970cbe77e460ca91a..808bf82b65fe3465105286baa52764152d474816 100644 (file)
@@ -215,7 +215,7 @@ void sunxi_board_init(void)
         * assured it's being powered with suitable core voltage
         */
        if (!power_failed)
-               clock_set_pll1(CONFIG_CLK_FULL_SPEED);
+               clock_set_pll1(CONFIG_SYS_CLK_FREQ);
        else
                printf("Failed to set core voltage! Can't set CPU frequency\n");
 }
index 1537e536f9253c6dc9a58c42af26a118b36a43db..7cd5c69d3a8f9801043b6fd98aba781de4f472e6 100644 (file)
@@ -11,7 +11,6 @@
 /*
  * A10 specific configuration
  */
-#define CONFIG_CLK_FULL_SPEED          1008000000
 
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
index e7555313dbe543632bd2fd4632c5219c470244cc..e0470d4282c9cf086631f606419d005917afee07 100644 (file)
@@ -11,7 +11,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_CLK_FULL_SPEED          1008000000
 
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
index f5e11ddb691f113c32943033592133e01653a72a..617c1cdfdecb734c9558c0610bf0584ebef278ef 100644 (file)
@@ -14,7 +14,6 @@
 /*
  * A31 specific configuration
  */
-#define CONFIG_CLK_FULL_SPEED          1008000000
 
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
index f817f73076ec7746ee90e4505ce9ffbc87402214..7fa7cec2441a4add5c3c27a857e99557ae834cc3 100644 (file)
@@ -12,7 +12,6 @@
 /*
  * A20 specific configuration
  */
-#define CONFIG_CLK_FULL_SPEED          912000000
 
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
@@ -21,8 +20,7 @@
 
 #define CONFIG_ARMV7_PSCI              1
 #define CONFIG_ARMV7_SECURE_BASE       SUNXI_SRAM_B_BASE
-#define CONFIG_SYS_CLK_FREQ            24000000
-#define CONFIG_TIMER_CLK_FREQ          CONFIG_SYS_CLK_FREQ
+#define CONFIG_TIMER_CLK_FREQ          24000000
 
 /*
  * Include common sunxi configuration where most the settings are
index 3bdedb390c119f6cc515e6342990fbfb258c77a9..79796d75d3439a4288ccc36afeb37afc20b91a33 100644 (file)
@@ -12,7 +12,6 @@
 /*
  * A23 specific configuration
  */
-#define CONFIG_CLK_FULL_SPEED  1008000000
 
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI