[U-Boot] [PATCH v2 2/3] sunxi: use CONFIG_SYS_CLK_FREQ to set cpu clock
Iain Paton
ipaton0 at gmail.com
Sat Mar 28 11:26:38 CET 2015
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 at gmail.com>
---
Kconfig | 2 +-
board/sunxi/Kconfig | 4 ++++
board/sunxi/board.c | 2 +-
include/configs/sun4i.h | 1 -
include/configs/sun5i.h | 1 -
include/configs/sun6i.h | 1 -
include/configs/sun7i.h | 1 -
include/configs/sun8i.h | 1 -
8 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/Kconfig b/Kconfig
index 8f96c94..a6aa7ac 100644
--- 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
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 9d0eb91..2fcab60 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -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
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e1891d1..808bf82 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -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");
}
diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h
index 1537e53..7cd5c69 100644
--- a/include/configs/sun4i.h
+++ b/include/configs/sun4i.h
@@ -11,7 +11,6 @@
/*
* A10 specific configuration
*/
-#define CONFIG_CLK_FULL_SPEED 1008000000
#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h
index e755531..e0470d4 100644
--- a/include/configs/sun5i.h
+++ b/include/configs/sun5i.h
@@ -11,7 +11,6 @@
/*
* High Level Configuration Options
*/
-#define CONFIG_CLK_FULL_SPEED 1008000000
#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
diff --git a/include/configs/sun6i.h b/include/configs/sun6i.h
index f5e11dd..617c1cd 100644
--- a/include/configs/sun6i.h
+++ b/include/configs/sun6i.h
@@ -14,7 +14,6 @@
/*
* A31 specific configuration
*/
-#define CONFIG_CLK_FULL_SPEED 1008000000
#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index f817f73..0bb756f 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -12,7 +12,6 @@
/*
* A20 specific configuration
*/
-#define CONFIG_CLK_FULL_SPEED 912000000
#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 3bdedb3..79796d7 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -12,7 +12,6 @@
/*
* A23 specific configuration
*/
-#define CONFIG_CLK_FULL_SPEED 1008000000
#ifdef CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_SUNXI
--
2.1.3
More information about the U-Boot
mailing list