Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338370
b: refs/heads/master
c: c08f015
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Shiyan authored and Greg Kroah-Hartman committed Oct 24, 2012
1 parent 8faca3e commit 76049a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c7e9eb1603d21659a38b92f5b764d41d88fa652
refs/heads/master: c08f0153f54ee0a7f3eeaf7f48dce1a71b3f8c7d
20 changes: 15 additions & 5 deletions trunk/drivers/tty/serial/clps711x.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/serial_core.h>
#include <linux/serial.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/platform_device.h>

#include <mach/hardware.h>
Expand All @@ -58,6 +59,7 @@

struct clps711x_port {
struct uart_driver uart;
struct clk *uart_clk;
struct uart_port port[UART_CLPS711X_NR];
int tx_enabled[UART_CLPS711X_NR];
#ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
Expand Down Expand Up @@ -299,10 +301,9 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
*/
termios->c_cflag |= CREAD;

/*
* Ask the core to calculate the divisor for us.
*/
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
/* Ask the core to calculate the divisor for us */
baud = uart_get_baud_rate(port, termios, old, port->uartclk / 4096,
port->uartclk / 16);
quot = uart_get_divisor(port, baud);

switch (termios->c_cflag & CSIZE) {
Expand Down Expand Up @@ -487,6 +488,13 @@ static int __devinit uart_clps711x_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, s);

s->uart_clk = devm_clk_get(&pdev->dev, "uart");
if (IS_ERR(s->uart_clk)) {
dev_err(&pdev->dev, "Can't get UART clocks\n");
ret = PTR_ERR(s->uart_clk);
goto err_out;
}

s->uart.owner = THIS_MODULE;
s->uart.dev_name = "ttyCL";
s->uart.major = UART_CLPS711X_MAJOR;
Expand All @@ -505,6 +513,7 @@ static int __devinit uart_clps711x_probe(struct platform_device *pdev)
ret = uart_register_driver(&s->uart);
if (ret) {
dev_err(&pdev->dev, "Registering UART driver failed\n");
devm_clk_put(&pdev->dev, s->uart_clk);
goto err_out;
}

Expand All @@ -516,7 +525,7 @@ static int __devinit uart_clps711x_probe(struct platform_device *pdev)
s->port[i].type = PORT_CLPS711X;
s->port[i].fifosize = 16;
s->port[i].flags = UPF_SKIP_TEST | UPF_FIXED_TYPE;
s->port[i].uartclk = 3686400;
s->port[i].uartclk = clk_get_rate(s->uart_clk);
s->port[i].ops = &uart_clps711x_ops;
WARN_ON(uart_add_one_port(&s->uart, &s->port[i]));
}
Expand All @@ -537,6 +546,7 @@ static int __devexit uart_clps711x_remove(struct platform_device *pdev)
for (i = 0; i < UART_CLPS711X_NR; i++)
uart_remove_one_port(&s->uart, &s->port[i]);

devm_clk_put(&pdev->dev, s->uart_clk);
uart_unregister_driver(&s->uart);
platform_set_drvdata(pdev, NULL);

Expand Down

0 comments on commit 76049a1

Please sign in to comment.