diff options
Diffstat (limited to 'drivers/tty/serial/sirfsoc_uart.c')
-rw-r--r-- | drivers/tty/serial/sirfsoc_uart.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 4102192687ee..2f6c6b04cc8d 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c | |||
@@ -1032,10 +1032,19 @@ static void sirfsoc_uart_pm(struct uart_port *port, unsigned int state, | |||
1032 | unsigned int oldstate) | 1032 | unsigned int oldstate) |
1033 | { | 1033 | { |
1034 | struct sirfsoc_uart_port *sirfport = to_sirfport(port); | 1034 | struct sirfsoc_uart_port *sirfport = to_sirfport(port); |
1035 | if (!state) | 1035 | if (!state) { |
1036 | if (sirfport->is_bt_uart) { | ||
1037 | clk_prepare_enable(sirfport->clk_noc); | ||
1038 | clk_prepare_enable(sirfport->clk_general); | ||
1039 | } | ||
1036 | clk_prepare_enable(sirfport->clk); | 1040 | clk_prepare_enable(sirfport->clk); |
1037 | else | 1041 | } else { |
1038 | clk_disable_unprepare(sirfport->clk); | 1042 | clk_disable_unprepare(sirfport->clk); |
1043 | if (sirfport->is_bt_uart) { | ||
1044 | clk_disable_unprepare(sirfport->clk_general); | ||
1045 | clk_disable_unprepare(sirfport->clk_noc); | ||
1046 | } | ||
1047 | } | ||
1039 | } | 1048 | } |
1040 | 1049 | ||
1041 | static int sirfsoc_uart_startup(struct uart_port *port) | 1050 | static int sirfsoc_uart_startup(struct uart_port *port) |
@@ -1378,12 +1387,26 @@ usp_no_flow_control: | |||
1378 | } | 1387 | } |
1379 | port->irq = res->start; | 1388 | port->irq = res->start; |
1380 | 1389 | ||
1381 | sirfport->clk = clk_get(&pdev->dev, NULL); | 1390 | sirfport->clk = devm_clk_get(&pdev->dev, NULL); |
1382 | if (IS_ERR(sirfport->clk)) { | 1391 | if (IS_ERR(sirfport->clk)) { |
1383 | ret = PTR_ERR(sirfport->clk); | 1392 | ret = PTR_ERR(sirfport->clk); |
1384 | goto err; | 1393 | goto err; |
1385 | } | 1394 | } |
1386 | port->uartclk = clk_get_rate(sirfport->clk); | 1395 | port->uartclk = clk_get_rate(sirfport->clk); |
1396 | if (of_device_is_compatible(pdev->dev.of_node, "sirf,marco-bt-uart")) { | ||
1397 | sirfport->clk_general = devm_clk_get(&pdev->dev, "general"); | ||
1398 | if (IS_ERR(sirfport->clk_general)) { | ||
1399 | ret = PTR_ERR(sirfport->clk_general); | ||
1400 | goto err; | ||
1401 | } | ||
1402 | sirfport->clk_noc = devm_clk_get(&pdev->dev, "noc"); | ||
1403 | if (IS_ERR(sirfport->clk_noc)) { | ||
1404 | ret = PTR_ERR(sirfport->clk_noc); | ||
1405 | goto err; | ||
1406 | } | ||
1407 | sirfport->is_bt_uart = true; | ||
1408 | } else | ||
1409 | sirfport->is_bt_uart = false; | ||
1387 | 1410 | ||
1388 | port->ops = &sirfsoc_uart_ops; | 1411 | port->ops = &sirfsoc_uart_ops; |
1389 | spin_lock_init(&port->lock); | 1412 | spin_lock_init(&port->lock); |
@@ -1392,7 +1415,7 @@ usp_no_flow_control: | |||
1392 | ret = uart_add_one_port(&sirfsoc_uart_drv, port); | 1415 | ret = uart_add_one_port(&sirfsoc_uart_drv, port); |
1393 | if (ret != 0) { | 1416 | if (ret != 0) { |
1394 | dev_err(&pdev->dev, "Cannot add UART port(%d).\n", pdev->id); | 1417 | dev_err(&pdev->dev, "Cannot add UART port(%d).\n", pdev->id); |
1395 | goto port_err; | 1418 | goto err; |
1396 | } | 1419 | } |
1397 | 1420 | ||
1398 | sirfport->rx_dma_chan = dma_request_slave_channel(port->dev, "rx"); | 1421 | sirfport->rx_dma_chan = dma_request_slave_channel(port->dev, "rx"); |
@@ -1421,8 +1444,6 @@ alloc_coherent_err: | |||
1421 | sirfport->rx_dma_items[j].xmit.buf, | 1444 | sirfport->rx_dma_items[j].xmit.buf, |
1422 | sirfport->rx_dma_items[j].dma_addr); | 1445 | sirfport->rx_dma_items[j].dma_addr); |
1423 | dma_release_channel(sirfport->rx_dma_chan); | 1446 | dma_release_channel(sirfport->rx_dma_chan); |
1424 | port_err: | ||
1425 | clk_put(sirfport->clk); | ||
1426 | err: | 1447 | err: |
1427 | return ret; | 1448 | return ret; |
1428 | } | 1449 | } |
@@ -1431,7 +1452,6 @@ static int sirfsoc_uart_remove(struct platform_device *pdev) | |||
1431 | { | 1452 | { |
1432 | struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev); | 1453 | struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev); |
1433 | struct uart_port *port = &sirfport->port; | 1454 | struct uart_port *port = &sirfport->port; |
1434 | clk_put(sirfport->clk); | ||
1435 | uart_remove_one_port(&sirfsoc_uart_drv, port); | 1455 | uart_remove_one_port(&sirfsoc_uart_drv, port); |
1436 | if (sirfport->rx_dma_chan) { | 1456 | if (sirfport->rx_dma_chan) { |
1437 | int i; | 1457 | int i; |