aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-06-19 07:17:30 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:35:03 -0400
commit91f8c2d805f5c5fd82bf8655065148b2e16967ff (patch)
treeb7c7f6904e42ab4e3b64f056eec9fdd4faf164cc /drivers/tty
parent805bf3daf361a501594f8b27b394a8d7372ebe3c (diff)
tty: atmel_serial: prepare clk before calling enable
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/atmel_serial.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 3467462869ce..691265faebbe 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1100,7 +1100,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
1100 * Enable the peripheral clock for this serial port. 1100 * Enable the peripheral clock for this serial port.
1101 * This is called on uart_open() or a resume event. 1101 * This is called on uart_open() or a resume event.
1102 */ 1102 */
1103 clk_enable(atmel_port->clk); 1103 clk_prepare_enable(atmel_port->clk);
1104 1104
1105 /* re-enable interrupts if we disabled some on suspend */ 1105 /* re-enable interrupts if we disabled some on suspend */
1106 UART_PUT_IER(port, atmel_port->backup_imr); 1106 UART_PUT_IER(port, atmel_port->backup_imr);
@@ -1114,7 +1114,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
1114 * Disable the peripheral clock for this serial port. 1114 * Disable the peripheral clock for this serial port.
1115 * This is called on uart_close() or a suspend event. 1115 * This is called on uart_close() or a suspend event.
1116 */ 1116 */
1117 clk_disable(atmel_port->clk); 1117 clk_disable_unprepare(atmel_port->clk);
1118 break; 1118 break;
1119 default: 1119 default:
1120 printk(KERN_ERR "atmel_serial: unknown pm %d\n", state); 1120 printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
@@ -1458,9 +1458,10 @@ static void atmel_of_init_port(struct atmel_uart_port *atmel_port,
1458/* 1458/*
1459 * Configure the port from the platform device resource info. 1459 * Configure the port from the platform device resource info.
1460 */ 1460 */
1461static void atmel_init_port(struct atmel_uart_port *atmel_port, 1461static int atmel_init_port(struct atmel_uart_port *atmel_port,
1462 struct platform_device *pdev) 1462 struct platform_device *pdev)
1463{ 1463{
1464 int ret;
1464 struct uart_port *port = &atmel_port->uart; 1465 struct uart_port *port = &atmel_port->uart;
1465 struct atmel_uart_data *pdata = pdev->dev.platform_data; 1466 struct atmel_uart_data *pdata = pdev->dev.platform_data;
1466 1467
@@ -1496,9 +1497,19 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
1496 /* for console, the clock could already be configured */ 1497 /* for console, the clock could already be configured */
1497 if (!atmel_port->clk) { 1498 if (!atmel_port->clk) {
1498 atmel_port->clk = clk_get(&pdev->dev, "usart"); 1499 atmel_port->clk = clk_get(&pdev->dev, "usart");
1499 clk_enable(atmel_port->clk); 1500 if (IS_ERR(atmel_port->clk)) {
1501 ret = PTR_ERR(atmel_port->clk);
1502 atmel_port->clk = NULL;
1503 return ret;
1504 }
1505 ret = clk_prepare_enable(atmel_port->clk);
1506 if (ret) {
1507 clk_put(atmel_port->clk);
1508 atmel_port->clk = NULL;
1509 return ret;
1510 }
1500 port->uartclk = clk_get_rate(atmel_port->clk); 1511 port->uartclk = clk_get_rate(atmel_port->clk);
1501 clk_disable(atmel_port->clk); 1512 clk_disable_unprepare(atmel_port->clk);
1502 /* only enable clock when USART is in use */ 1513 /* only enable clock when USART is in use */
1503 } 1514 }
1504 1515
@@ -1511,6 +1522,8 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,
1511 } else { 1522 } else {
1512 atmel_port->tx_done_mask = ATMEL_US_TXRDY; 1523 atmel_port->tx_done_mask = ATMEL_US_TXRDY;
1513 } 1524 }
1525
1526 return 0;
1514} 1527}
1515 1528
1516struct platform_device *atmel_default_console_device; /* the serial console device */ 1529struct platform_device *atmel_default_console_device; /* the serial console device */
@@ -1601,6 +1614,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
1601 1614
1602static int __init atmel_console_setup(struct console *co, char *options) 1615static int __init atmel_console_setup(struct console *co, char *options)
1603{ 1616{
1617 int ret;
1604 struct uart_port *port = &atmel_ports[co->index].uart; 1618 struct uart_port *port = &atmel_ports[co->index].uart;
1605 int baud = 115200; 1619 int baud = 115200;
1606 int bits = 8; 1620 int bits = 8;
@@ -1612,7 +1626,9 @@ static int __init atmel_console_setup(struct console *co, char *options)
1612 return -ENODEV; 1626 return -ENODEV;
1613 } 1627 }
1614 1628
1615 clk_enable(atmel_ports[co->index].clk); 1629 ret = clk_prepare_enable(atmel_ports[co->index].clk);
1630 if (ret)
1631 return ret;
1616 1632
1617 UART_PUT_IDR(port, -1); 1633 UART_PUT_IDR(port, -1);
1618 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); 1634 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
@@ -1645,6 +1661,7 @@ static struct console atmel_console = {
1645 */ 1661 */
1646static int __init atmel_console_init(void) 1662static int __init atmel_console_init(void)
1647{ 1663{
1664 int ret;
1648 if (atmel_default_console_device) { 1665 if (atmel_default_console_device) {
1649 struct atmel_uart_data *pdata = 1666 struct atmel_uart_data *pdata =
1650 atmel_default_console_device->dev.platform_data; 1667 atmel_default_console_device->dev.platform_data;
@@ -1655,7 +1672,9 @@ static int __init atmel_console_init(void)
1655 port->uart.line = id; 1672 port->uart.line = id;
1656 1673
1657 add_preferred_console(ATMEL_DEVICENAME, id, NULL); 1674 add_preferred_console(ATMEL_DEVICENAME, id, NULL);
1658 atmel_init_port(port, atmel_default_console_device); 1675 ret = atmel_init_port(port, atmel_default_console_device);
1676 if (ret)
1677 return ret;
1659 register_console(&atmel_console); 1678 register_console(&atmel_console);
1660 } 1679 }
1661 1680
@@ -1786,7 +1805,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
1786 port->backup_imr = 0; 1805 port->backup_imr = 0;
1787 port->uart.line = ret; 1806 port->uart.line = ret;
1788 1807
1789 atmel_init_port(port, pdev); 1808 ret = atmel_init_port(port, pdev);
1809 if (ret)
1810 goto err;
1790 1811
1791 pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 1812 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
1792 if (IS_ERR(pinctrl)) { 1813 if (IS_ERR(pinctrl)) {
@@ -1812,9 +1833,9 @@ static int atmel_serial_probe(struct platform_device *pdev)
1812 && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) { 1833 && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
1813 /* 1834 /*
1814 * The serial core enabled the clock for us, so undo 1835 * The serial core enabled the clock for us, so undo
1815 * the clk_enable() in atmel_console_setup() 1836 * the clk_prepare_enable() in atmel_console_setup()
1816 */ 1837 */
1817 clk_disable(port->clk); 1838 clk_disable_unprepare(port->clk);
1818 } 1839 }
1819#endif 1840#endif
1820 1841