Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308227
b: refs/heads/master
c: 3a9465f
h: refs/heads/master
i:
  308225: 4e2cc1e
  308223: 0939018
v: v3
  • Loading branch information
Sascha Hauer committed Apr 25, 2012
1 parent 8db78c7 commit d30891c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 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: 52dac6150580f356a96b9a49715f6234fbf00d3a
refs/heads/master: 3a9465fa2dc42a8ebc2fe9144f4dfa23d5899f85
38 changes: 23 additions & 15 deletions trunk/drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ struct imx_port {
unsigned int irda_inv_rx:1;
unsigned int irda_inv_tx:1;
unsigned short trcv_delay; /* transceiver delay */
struct clk *clk;
struct clk *clk_ipg;
struct clk *clk_per;
struct imx_uart_data *devdata;
};

Expand Down Expand Up @@ -672,7 +673,7 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
* RFDIV is set such way to satisfy requested uartclk value
*/
val = TXTL << 10 | RXTL;
ufcr_rfdiv = (clk_get_rate(sport->clk) + sport->port.uartclk / 2)
ufcr_rfdiv = (clk_get_rate(sport->clk_per) + sport->port.uartclk / 2)
/ sport->port.uartclk;

if(!ufcr_rfdiv)
Expand Down Expand Up @@ -1285,7 +1286,7 @@ imx_console_get_options(struct imx_port *sport, int *baud,
else
ucfr_rfdiv = 6 - ucfr_rfdiv;

uartclk = clk_get_rate(sport->clk);
uartclk = clk_get_rate(sport->clk_per);
uartclk /= ucfr_rfdiv;

{ /*
Expand Down Expand Up @@ -1503,14 +1504,22 @@ static int serial_imx_probe(struct platform_device *pdev)
sport->timer.function = imx_timeout;
sport->timer.data = (unsigned long)sport;

sport->clk = clk_get(&pdev->dev, "uart");
if (IS_ERR(sport->clk)) {
ret = PTR_ERR(sport->clk);
sport->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(sport->clk_ipg)) {
ret = PTR_ERR(sport->clk_ipg);
goto unmap;
}
clk_prepare_enable(sport->clk);

sport->port.uartclk = clk_get_rate(sport->clk);
sport->clk_per = devm_clk_get(&pdev->dev, "per");
if (IS_ERR(sport->clk_per)) {
ret = PTR_ERR(sport->clk_per);
goto unmap;
}

clk_prepare_enable(sport->clk_per);
clk_prepare_enable(sport->clk_ipg);

sport->port.uartclk = clk_get_rate(sport->clk_per);

imx_ports[sport->port.line] = sport;

Expand All @@ -1531,8 +1540,8 @@ static int serial_imx_probe(struct platform_device *pdev)
if (pdata && pdata->exit)
pdata->exit(pdev);
clkput:
clk_disable_unprepare(sport->clk);
clk_put(sport->clk);
clk_disable_unprepare(sport->clk_per);
clk_disable_unprepare(sport->clk_ipg);
unmap:
iounmap(sport->port.membase);
free:
Expand All @@ -1550,11 +1559,10 @@ static int serial_imx_remove(struct platform_device *pdev)

platform_set_drvdata(pdev, NULL);

if (sport) {
uart_remove_one_port(&imx_reg, &sport->port);
clk_disable_unprepare(sport->clk);
clk_put(sport->clk);
}
uart_remove_one_port(&imx_reg, &sport->port);

clk_disable_unprepare(sport->clk_per);
clk_disable_unprepare(sport->clk_ipg);

if (pdata && pdata->exit)
pdata->exit(pdev);
Expand Down

0 comments on commit d30891c

Please sign in to comment.