diff options
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/imx.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index ec206732f68c..4ef747307ecb 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -205,7 +205,8 @@ struct imx_port { | |||
205 | unsigned int irda_inv_rx:1; | 205 | unsigned int irda_inv_rx:1; |
206 | unsigned int irda_inv_tx:1; | 206 | unsigned int irda_inv_tx:1; |
207 | unsigned short trcv_delay; /* transceiver delay */ | 207 | unsigned short trcv_delay; /* transceiver delay */ |
208 | struct clk *clk; | 208 | struct clk *clk_ipg; |
209 | struct clk *clk_per; | ||
209 | struct imx_uart_data *devdata; | 210 | struct imx_uart_data *devdata; |
210 | }; | 211 | }; |
211 | 212 | ||
@@ -673,7 +674,7 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode) | |||
673 | * RFDIV is set such way to satisfy requested uartclk value | 674 | * RFDIV is set such way to satisfy requested uartclk value |
674 | */ | 675 | */ |
675 | val = TXTL << 10 | RXTL; | 676 | val = TXTL << 10 | RXTL; |
676 | ufcr_rfdiv = (clk_get_rate(sport->clk) + sport->port.uartclk / 2) | 677 | ufcr_rfdiv = (clk_get_rate(sport->clk_per) + sport->port.uartclk / 2) |
677 | / sport->port.uartclk; | 678 | / sport->port.uartclk; |
678 | 679 | ||
679 | if(!ufcr_rfdiv) | 680 | if(!ufcr_rfdiv) |
@@ -1286,7 +1287,7 @@ imx_console_get_options(struct imx_port *sport, int *baud, | |||
1286 | else | 1287 | else |
1287 | ucfr_rfdiv = 6 - ucfr_rfdiv; | 1288 | ucfr_rfdiv = 6 - ucfr_rfdiv; |
1288 | 1289 | ||
1289 | uartclk = clk_get_rate(sport->clk); | 1290 | uartclk = clk_get_rate(sport->clk_per); |
1290 | uartclk /= ucfr_rfdiv; | 1291 | uartclk /= ucfr_rfdiv; |
1291 | 1292 | ||
1292 | { /* | 1293 | { /* |
@@ -1511,14 +1512,22 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1511 | goto unmap; | 1512 | goto unmap; |
1512 | } | 1513 | } |
1513 | 1514 | ||
1514 | sport->clk = clk_get(&pdev->dev, "uart"); | 1515 | sport->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); |
1515 | if (IS_ERR(sport->clk)) { | 1516 | if (IS_ERR(sport->clk_ipg)) { |
1516 | ret = PTR_ERR(sport->clk); | 1517 | ret = PTR_ERR(sport->clk_ipg); |
1517 | goto unmap; | 1518 | goto unmap; |
1518 | } | 1519 | } |
1519 | clk_prepare_enable(sport->clk); | ||
1520 | 1520 | ||
1521 | sport->port.uartclk = clk_get_rate(sport->clk); | 1521 | sport->clk_per = devm_clk_get(&pdev->dev, "per"); |
1522 | if (IS_ERR(sport->clk_per)) { | ||
1523 | ret = PTR_ERR(sport->clk_per); | ||
1524 | goto unmap; | ||
1525 | } | ||
1526 | |||
1527 | clk_prepare_enable(sport->clk_per); | ||
1528 | clk_prepare_enable(sport->clk_ipg); | ||
1529 | |||
1530 | sport->port.uartclk = clk_get_rate(sport->clk_per); | ||
1522 | 1531 | ||
1523 | imx_ports[sport->port.line] = sport; | 1532 | imx_ports[sport->port.line] = sport; |
1524 | 1533 | ||
@@ -1539,8 +1548,8 @@ deinit: | |||
1539 | if (pdata && pdata->exit) | 1548 | if (pdata && pdata->exit) |
1540 | pdata->exit(pdev); | 1549 | pdata->exit(pdev); |
1541 | clkput: | 1550 | clkput: |
1542 | clk_disable_unprepare(sport->clk); | 1551 | clk_disable_unprepare(sport->clk_per); |
1543 | clk_put(sport->clk); | 1552 | clk_disable_unprepare(sport->clk_ipg); |
1544 | unmap: | 1553 | unmap: |
1545 | iounmap(sport->port.membase); | 1554 | iounmap(sport->port.membase); |
1546 | free: | 1555 | free: |
@@ -1558,11 +1567,10 @@ static int serial_imx_remove(struct platform_device *pdev) | |||
1558 | 1567 | ||
1559 | platform_set_drvdata(pdev, NULL); | 1568 | platform_set_drvdata(pdev, NULL); |
1560 | 1569 | ||
1561 | if (sport) { | 1570 | uart_remove_one_port(&imx_reg, &sport->port); |
1562 | uart_remove_one_port(&imx_reg, &sport->port); | 1571 | |
1563 | clk_disable_unprepare(sport->clk); | 1572 | clk_disable_unprepare(sport->clk_per); |
1564 | clk_put(sport->clk); | 1573 | clk_disable_unprepare(sport->clk_ipg); |
1565 | } | ||
1566 | 1574 | ||
1567 | if (pdata && pdata->exit) | 1575 | if (pdata && pdata->exit) |
1568 | pdata->exit(pdev); | 1576 | pdata->exit(pdev); |