summary refs log tree commit diff
path: root/arch/mips/ath79/dev-common.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-08-28 10:41:44 +0200
committerRalf Baechle <ralf@linux-mips.org>2013-09-03 23:22:17 +0200
commit2310780244d5c3b6cc843d4cc0b63332016678a0 (patch)
treea5d9acd309caa01f549d4c895687fe91235e2805 /arch/mips/ath79/dev-common.c
parent837f036c8ab201965b9fb0f6b743a415f555493f (diff)
downloadlinux-2310780244d5c3b6cc843d4cc0b63332016678a0.tar.gz
MIPS: ath79: Use a helper function to get system clock rates
The ath79 platform uses similar code to get the
rate of various clocks during init. Separate the
similar code into a new helper function and use
that to avoid code duplication.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5778/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath79/dev-common.c')
-rw-r--r--arch/mips/ath79/dev-common.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/mips/ath79/dev-common.c b/arch/mips/ath79/dev-common.c
index a3a2741d0688..c3b04c929f29 100644
--- a/arch/mips/ath79/dev-common.c
+++ b/arch/mips/ath79/dev-common.c
@@ -81,21 +81,19 @@ static struct platform_device ar933x_uart_device = {
 
 void __init ath79_register_uart(void)
 {
-	struct clk *clk;
+	unsigned long uart_clk_rate;
 
-	clk = clk_get(NULL, "uart");
-	if (IS_ERR(clk))
-		panic("unable to get UART clock, err=%ld", PTR_ERR(clk));
+	uart_clk_rate = ath79_get_sys_clk_rate("uart");
 
 	if (soc_is_ar71xx() ||
 	    soc_is_ar724x() ||
 	    soc_is_ar913x() ||
 	    soc_is_ar934x() ||
 	    soc_is_qca955x()) {
-		ath79_uart_data[0].uartclk = clk_get_rate(clk);
+		ath79_uart_data[0].uartclk = uart_clk_rate;
 		platform_device_register(&ath79_uart_device);
 	} else if (soc_is_ar933x()) {
-		ar933x_uart_data.uartclk = clk_get_rate(clk);
+		ar933x_uart_data.uartclk = uart_clk_rate;
 		platform_device_register(&ar933x_uart_device);
 	} else {
 		BUG();