Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118446
b: refs/heads/master
c: 06a7f05
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Nov 6, 2008
1 parent 195de45 commit 743f049
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 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: b225d44e27521290faca2e0f9b1a4a8c74dc510a
refs/heads/master: 06a7f058761cd232cab42d5c7da82f7255b51d5b
17 changes: 14 additions & 3 deletions trunk/drivers/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
atmel_port->clk = clk_get(&pdev->dev, "usart");
clk_enable(atmel_port->clk);
port->uartclk = clk_get_rate(atmel_port->clk);
clk_disable(atmel_port->clk);
/* only enable clock when USART is in use */
}

atmel_port->use_dma_rx = data->use_dma_rx;
Expand Down Expand Up @@ -1379,6 +1381,8 @@ static int __init atmel_console_setup(struct console *co, char *options)
return -ENODEV;
}

clk_enable(atmel_ports[co->index].clk);

UART_PUT_IDR(port, -1);
UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
Expand All @@ -1403,7 +1407,7 @@ static struct console atmel_console = {
.data = &atmel_uart,
};

#define ATMEL_CONSOLE_DEVICE &atmel_console
#define ATMEL_CONSOLE_DEVICE (&atmel_console)

/*
* Early console initialization (before VM subsystem initialized).
Expand Down Expand Up @@ -1534,6 +1538,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
if (ret)
goto err_add_port;

if (atmel_is_console_port(&port->uart)
&& ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
/*
* The serial core enabled the clock for us, so undo
* the clk_enable() in atmel_console_setup()
*/
clk_disable(port->clk);
}

device_init_wakeup(&pdev->dev, 1);
platform_set_drvdata(pdev, port);

Expand All @@ -1544,7 +1557,6 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
port->rx_ring.buf = NULL;
err_alloc_ring:
if (!atmel_is_console_port(&port->uart)) {
clk_disable(port->clk);
clk_put(port->clk);
port->clk = NULL;
}
Expand All @@ -1568,7 +1580,6 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev)

/* "port" is allocated statically, so we shouldn't free it */

clk_disable(atmel_port->clk);
clk_put(atmel_port->clk);

return ret;
Expand Down

0 comments on commit 743f049

Please sign in to comment.