aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/vt8500_serial.c
diff options
context:
space:
mode:
authorTony Prisk <linux@prisktech.co.nz>2013-01-17 21:05:31 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 21:54:32 -0500
commit12faa35ae5cbfbd0d90e2103688e87ceb46c5886 (patch)
tree483496c3aab85cb54e0d8d19cba2f814718aa44d /drivers/tty/serial/vt8500_serial.c
parent962963e4ee23bc7518dfee754de5f20d35de71d9 (diff)
serial: vt8500: UART uses gated clock rather than 24Mhz reference
UART modules on Wondermedia SoCs are connected via a gated clock source, rather than directly to the 24Mhz reference clock. While uboot enables UART0 for debugging, other UART ports are unavailable until the clock is enabled. This patch checks that a valid clock is actually passed from devicetree, enables the clock in probe. This change removes the fallback when a clock was not specified as it doesn't apply any longer (and would only work if the UART clock was already enabled). DTSI files are updated for VT8500, WM8505 and WM8650. Signed-off-by: Tony Prisk <linux@prisktech.co.nz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/vt8500_serial.c')
-rw-r--r--drivers/tty/serial/vt8500_serial.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index ff391db0a220..798bf944a2e5 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -584,6 +584,23 @@ static int vt8500_serial_probe(struct platform_device *pdev)
584 if (!vt8500_port) 584 if (!vt8500_port)
585 return -ENOMEM; 585 return -ENOMEM;
586 586
587 vt8500_port->uart.membase = devm_request_and_ioremap(&pdev->dev, mmres);
588 if (!vt8500_port->uart.membase)
589 return -EADDRNOTAVAIL;
590
591 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
592 if (IS_ERR(vt8500_port->clk)) {
593 dev_err(&pdev->dev, "failed to get clock\n");
594 ret = -EINVAL;
595 goto err;
596 }
597
598 ret = clk_prepare_enable(vt8500_port->clk);
599 if (ret) {
600 dev_err(&pdev->dev, "failed to enable clock\n");
601 goto err;
602 }
603
587 vt8500_port->uart.type = PORT_VT8500; 604 vt8500_port->uart.type = PORT_VT8500;
588 vt8500_port->uart.iotype = UPIO_MEM; 605 vt8500_port->uart.iotype = UPIO_MEM;
589 vt8500_port->uart.mapbase = mmres->start; 606 vt8500_port->uart.mapbase = mmres->start;
@@ -593,25 +610,11 @@ static int vt8500_serial_probe(struct platform_device *pdev)
593 vt8500_port->uart.line = port; 610 vt8500_port->uart.line = port;
594 vt8500_port->uart.dev = &pdev->dev; 611 vt8500_port->uart.dev = &pdev->dev;
595 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 612 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
596 613 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
597 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
598 if (vt8500_port->clk) {
599 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
600 } else {
601 /* use the default of 24Mhz if not specified and warn */
602 pr_warn("%s: serial clock source not specified\n", __func__);
603 vt8500_port->uart.uartclk = 24000000;
604 }
605 614
606 snprintf(vt8500_port->name, sizeof(vt8500_port->name), 615 snprintf(vt8500_port->name, sizeof(vt8500_port->name),
607 "VT8500 UART%d", pdev->id); 616 "VT8500 UART%d", pdev->id);
608 617
609 vt8500_port->uart.membase = devm_request_and_ioremap(&pdev->dev, mmres);
610 if (!vt8500_port->uart.membase) {
611 ret = -EADDRNOTAVAIL;
612 goto err;
613 }
614
615 vt8500_uart_ports[port] = vt8500_port; 618 vt8500_uart_ports[port] = vt8500_port;
616 619
617 uart_add_one_port(&vt8500_uart_driver, &vt8500_port->uart); 620 uart_add_one_port(&vt8500_uart_driver, &vt8500_port->uart);
@@ -630,6 +633,7 @@ static int vt8500_serial_remove(struct platform_device *pdev)
630 struct vt8500_port *vt8500_port = platform_get_drvdata(pdev); 633 struct vt8500_port *vt8500_port = platform_get_drvdata(pdev);
631 634
632 platform_set_drvdata(pdev, NULL); 635 platform_set_drvdata(pdev, NULL);
636 clk_disable_unprepare(vt8500_port->clk);
633 uart_remove_one_port(&vt8500_uart_driver, &vt8500_port->uart); 637 uart_remove_one_port(&vt8500_uart_driver, &vt8500_port->uart);
634 kfree(vt8500_port); 638 kfree(vt8500_port);
635 639