MIPS: Loongson1B: improve ls1x_serial_setup()
authorKelvin Cheung <keguang.zhang@gmail.com>
Tue, 23 Oct 2012 05:17:01 +0000 (05:17 +0000)
committerJohn Crispin <blogic@openwrt.org>
Fri, 9 Nov 2012 10:37:20 +0000 (11:37 +0100)
Improve ls1x_serial_setup().

Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/4432
Signed-off-by: John Crispin <blogic@openwrt.org>
arch/mips/include/asm/mach-loongson1/platform.h
arch/mips/loongson1/common/platform.c
arch/mips/loongson1/ls1b/board.c

index f584017eb8a749f9e386a27f10f3fad53bfa050e..718a1228a4f30648e219726b8f42e7e316f047c5 100644 (file)
@@ -19,6 +19,6 @@ extern struct platform_device ls1x_ehci_device;
 extern struct platform_device ls1x_rtc_device;
 
 extern void __init ls1x_clk_init(void);
-void ls1x_serial_setup(void);
+extern void __init ls1x_serial_setup(struct platform_device *pdev);
 
 #endif /* __ASM_MACH_LOONGSON1_PLATFORM_H */
index e92d59c4bd789e783809a5ed15e3e19c7f965ced..5ca38dc77080c87e16cbc4cfc49f1e28dbd2397d 100644 (file)
@@ -42,16 +42,17 @@ struct platform_device ls1x_uart_device = {
        },
 };
 
-void __init ls1x_serial_setup(void)
+void __init ls1x_serial_setup(struct platform_device *pdev)
 {
        struct clk *clk;
        struct plat_serial8250_port *p;
 
-       clk = clk_get(NULL, "dc");
+       clk = clk_get(NULL, pdev->name);
        if (IS_ERR(clk))
-               panic("unable to get dc clock, err=%ld", PTR_ERR(clk));
+               panic("unable to get %s clock, err=%ld",
+                       pdev->name, PTR_ERR(clk));
 
-       for (p = ls1x_serial8250_port; p->flags != 0; ++p)
+       for (p = pdev->dev.platform_data; p->flags != 0; ++p)
                p->uartclk = clk_get_rate(clk);
 }
 
index 295b1be893e309a021296110c41a405429ef4c31..1fbd5264f667594efbc923fa2e428213d6bbd242 100644 (file)
@@ -9,9 +9,6 @@
 
 #include <platform.h>
 
-#include <linux/serial_8250.h>
-#include <loongson1.h>
-
 static struct platform_device *ls1b_platform_devices[] __initdata = {
        &ls1x_uart_device,
        &ls1x_eth0_device,
@@ -23,7 +20,7 @@ static int __init ls1b_platform_init(void)
 {
        int err;
 
-       ls1x_serial_setup();
+       ls1x_serial_setup(&ls1x_uart_device);
 
        err = platform_add_devices(ls1b_platform_devices,
                                   ARRAY_SIZE(ls1b_platform_devices));