aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2014-06-16 09:25:17 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-10 18:27:37 -0400
commit7d78cbefaa465bbf36e2b4b90d3c196a00f54008 (patch)
tree9bce39e9e8c77f596280a1d59784d82c958e42eb /drivers/tty
parentd8782c7452b4a54cc8830074e8cd967e17559880 (diff)
serial: 8250_dw: add ability to handle the peripheral clock
First try to find the named clock variants then fall back to the already existing handling of a nameless declared baudclk. This also adds the missing documentation for this already existing variant. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/8250/8250_dw.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index a1450ae6f9c1..c531fa42f838 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -59,6 +59,7 @@ struct dw8250_data {
59 int last_mcr; 59 int last_mcr;
60 int line; 60 int line;
61 struct clk *clk; 61 struct clk *clk;
62 struct clk *pclk;
62 struct uart_8250_dma dma; 63 struct uart_8250_dma dma;
63}; 64};
64 65
@@ -359,10 +360,25 @@ static int dw8250_probe(struct platform_device *pdev)
359 return -ENOMEM; 360 return -ENOMEM;
360 361
361 data->usr_reg = DW_UART_USR; 362 data->usr_reg = DW_UART_USR;
362 data->clk = devm_clk_get(&pdev->dev, NULL); 363 data->clk = devm_clk_get(&pdev->dev, "baudclk");
364 if (IS_ERR(data->clk))
365 data->clk = devm_clk_get(&pdev->dev, NULL);
363 if (!IS_ERR(data->clk)) { 366 if (!IS_ERR(data->clk)) {
364 clk_prepare_enable(data->clk); 367 err = clk_prepare_enable(data->clk);
365 uart.port.uartclk = clk_get_rate(data->clk); 368 if (err)
369 dev_warn(&pdev->dev, "could not enable optional baudclk: %d\n",
370 err);
371 else
372 uart.port.uartclk = clk_get_rate(data->clk);
373 }
374
375 data->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
376 if (!IS_ERR(data->pclk)) {
377 err = clk_prepare_enable(data->pclk);
378 if (err) {
379 dev_err(&pdev->dev, "could not enable apb_pclk\n");
380 return err;
381 }
366 } 382 }
367 383
368 data->dma.rx_chan_id = -1; 384 data->dma.rx_chan_id = -1;
@@ -408,6 +424,9 @@ static int dw8250_remove(struct platform_device *pdev)
408 424
409 serial8250_unregister_port(data->line); 425 serial8250_unregister_port(data->line);
410 426
427 if (!IS_ERR(data->pclk))
428 clk_disable_unprepare(data->pclk);
429
411 if (!IS_ERR(data->clk)) 430 if (!IS_ERR(data->clk))
412 clk_disable_unprepare(data->clk); 431 clk_disable_unprepare(data->clk);
413 432
@@ -445,6 +464,9 @@ static int dw8250_runtime_suspend(struct device *dev)
445 if (!IS_ERR(data->clk)) 464 if (!IS_ERR(data->clk))
446 clk_disable_unprepare(data->clk); 465 clk_disable_unprepare(data->clk);
447 466
467 if (!IS_ERR(data->pclk))
468 clk_disable_unprepare(data->pclk);
469
448 return 0; 470 return 0;
449} 471}
450 472
@@ -452,6 +474,9 @@ static int dw8250_runtime_resume(struct device *dev)
452{ 474{
453 struct dw8250_data *data = dev_get_drvdata(dev); 475 struct dw8250_data *data = dev_get_drvdata(dev);
454 476
477 if (!IS_ERR(data->pclk))
478 clk_prepare_enable(data->pclk);
479
455 if (!IS_ERR(data->clk)) 480 if (!IS_ERR(data->clk))
456 clk_prepare_enable(data->clk); 481 clk_prepare_enable(data->clk);
457 482