serial: rk30: enable pclk_uart
author黄涛 <huangtao@rock-chips.com>
Thu, 10 May 2012 13:31:33 +0000 (21:31 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 10 May 2012 13:32:14 +0000 (21:32 +0800)
drivers/tty/serial/rk_serial.c

index 84e40f8aa0904f04fbdbeea29c6cf407cdd12ee0..b4d4756c80fda251b6348c16cb4fbe3770f52d89 100644 (file)
@@ -173,6 +173,7 @@ struct uart_rk_port {
        struct uart_port        port;\r
        struct platform_device  *pdev;\r
        struct clk              *clk;\r
+       struct clk              *pclk;\r
        unsigned int            tx_loadsz;      /* transmit fifo load size */\r
        unsigned char           ier;\r
        unsigned char           lcr;\r
@@ -1204,6 +1205,7 @@ static int serial_rk_startup(struct uart_port *port)
 \r
        up->mcr = 0;\r
 \r
+       clk_enable(up->pclk);\r
        clk_enable(up->clk);  // enable the config uart clock\r
 \r
        /*\r
@@ -1317,6 +1319,7 @@ static void serial_rk_shutdown(struct uart_port *port)
 \r
        free_irq(up->port.irq, up);\r
        clk_disable(up->clk);\r
+       clk_disable(up->pclk);\r
 }\r
 \r
 static void\r
@@ -1537,10 +1540,13 @@ serial_rk_pm(struct uart_port *port, unsigned int state,
                container_of(port, struct uart_rk_port, port);\r
 \r
        dev_dbg(port->dev, "%s: %s\n", __func__, state ? "disable" : "enable");\r
-       if (state)\r
+       if (state) {\r
                clk_disable(up->clk);\r
-       else\r
+               clk_disable(up->pclk);\r
+       } else {\r
+               clk_enable(up->pclk);\r
                clk_enable(up->clk);\r
+       }\r
 }\r
 \r
 static void serial_rk_release_port(struct uart_port *port)\r
@@ -1763,6 +1769,7 @@ static int __devinit serial_rk_probe(struct platform_device *pdev)
 \r
        sprintf(up->name, "rk29_serial.%d", pdev->id);\r
        up->pdev = pdev;\r
+       up->pclk = clk_get(&pdev->dev, "pclk_uart");\r
        up->clk = clk_get(&pdev->dev, "uart");\r
        if (unlikely(IS_ERR(up->clk))) {\r
                ret = PTR_ERR(up->clk);\r
@@ -1856,6 +1863,7 @@ do_iounmap:
        up->port.membase = NULL;\r
 do_put_clk:\r
        clk_put(up->clk);\r
+       clk_put(up->pclk);\r
 do_free:\r
        kfree(up);\r
 do_release_region:\r
@@ -1876,6 +1884,7 @@ static int __devexit serial_rk_remove(struct platform_device *pdev)
                iounmap(up->port.membase);\r
                up->port.membase = NULL;\r
                clk_put(up->clk);\r
+               clk_put(up->pclk);\r
                kfree(up);\r
                release_mem_region(mem->start, (mem->end - mem->start) + 1);\r
        }\r