提交 b843aa21 编写于 作者: R Remy Bohmer 提交者: Linus Torvalds

atmel_serial: clean up the code

Clean up the atmel_serial driver to conform the coding rules.  It contains no
functional change.
Signed-off-by: NRemy Bohmer <linux@bohmer.net>
Signed-off-by: NHaavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: NAndrew Victor <linux@maxim.org.za>
Tested-by: NMarc Pignat <marc.pignat@hevs.ch>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a1cfac48
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#define ATMEL_ISR_PASS_LIMIT 256 #define ATMEL_ISR_PASS_LIMIT 256
/* UART registers. CR is write-only, hence no GET macro */
#define UART_PUT_CR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_CR) #define UART_PUT_CR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_CR)
#define UART_GET_MR(port) __raw_readl((port)->membase + ATMEL_US_MR) #define UART_GET_MR(port) __raw_readl((port)->membase + ATMEL_US_MR)
#define UART_PUT_MR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_MR) #define UART_PUT_MR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_MR)
...@@ -86,8 +87,6 @@ ...@@ -86,8 +87,6 @@
#define UART_PUT_BRGR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR) #define UART_PUT_BRGR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR)
#define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)
// #define UART_GET_CR(port) __raw_readl((port)->membase + ATMEL_US_CR) // is write-only
/* PDC registers */ /* PDC registers */
#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) #define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR)
...@@ -100,8 +99,6 @@ ...@@ -100,8 +99,6 @@
#define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR) #define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR)
#define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR) #define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR)
//#define UART_PUT_TNPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNPR)
//#define UART_PUT_TNCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNCR)
static int (*atmel_open_hook)(struct uart_port *); static int (*atmel_open_hook)(struct uart_port *);
static void (*atmel_close_hook)(struct uart_port *); static void (*atmel_close_hook)(struct uart_port *);
...@@ -141,8 +138,8 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) ...@@ -141,8 +138,8 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
#ifdef CONFIG_ARCH_AT91RM9200 #ifdef CONFIG_ARCH_AT91RM9200
if (cpu_is_at91rm9200()) { if (cpu_is_at91rm9200()) {
/* /*
* AT91RM9200 Errata #39: RTS0 is not internally connected to PA21. * AT91RM9200 Errata #39: RTS0 is not internally connected
* We need to drive the pin manually. * to PA21. We need to drive the pin manually.
*/ */
if (port->mapbase == AT91RM9200_BASE_US0) { if (port->mapbase == AT91RM9200_BASE_US0) {
if (mctrl & TIOCM_RTS) if (mctrl & TIOCM_RTS)
...@@ -227,7 +224,8 @@ static void atmel_stop_rx(struct uart_port *port) ...@@ -227,7 +224,8 @@ static void atmel_stop_rx(struct uart_port *port)
*/ */
static void atmel_enable_ms(struct uart_port *port) static void atmel_enable_ms(struct uart_port *port)
{ {
UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC | ATMEL_US_CTSIC); UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC
| ATMEL_US_DCDIC | ATMEL_US_CTSIC);
} }
/* /*
...@@ -246,7 +244,7 @@ static void atmel_break_ctl(struct uart_port *port, int break_state) ...@@ -246,7 +244,7 @@ static void atmel_break_ctl(struct uart_port *port, int break_state)
*/ */
static void atmel_rx_chars(struct uart_port *port) static void atmel_rx_chars(struct uart_port *port)
{ {
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
struct tty_struct *tty = port->info->tty; struct tty_struct *tty = port->info->tty;
unsigned int status, ch, flg; unsigned int status, ch, flg;
...@@ -265,10 +263,12 @@ static void atmel_rx_chars(struct uart_port *port) ...@@ -265,10 +263,12 @@ static void atmel_rx_chars(struct uart_port *port)
if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME
| ATMEL_US_OVRE | ATMEL_US_RXBRK) | ATMEL_US_OVRE | ATMEL_US_RXBRK)
|| atmel_port->break_active)) { || atmel_port->break_active)) {
UART_PUT_CR(port, ATMEL_US_RSTSTA); /* clear error */ /* clear error */
UART_PUT_CR(port, ATMEL_US_RSTSTA);
if (status & ATMEL_US_RXBRK if (status & ATMEL_US_RXBRK
&& !atmel_port->break_active) { && !atmel_port->break_active) {
status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME); /* ignore side-effect */ /* ignore side-effect */
status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME);
port->icount.brk++; port->icount.brk++;
atmel_port->break_active = 1; atmel_port->break_active = 1;
UART_PUT_IER(port, ATMEL_US_RXBRK); UART_PUT_IER(port, ATMEL_US_RXBRK);
...@@ -308,7 +308,7 @@ static void atmel_rx_chars(struct uart_port *port) ...@@ -308,7 +308,7 @@ static void atmel_rx_chars(struct uart_port *port)
uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg); uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg);
ignore_char: ignore_char:
status = UART_GET_CSR(port); status = UART_GET_CSR(port);
} }
...@@ -349,44 +349,73 @@ static void atmel_tx_chars(struct uart_port *port) ...@@ -349,44 +349,73 @@ static void atmel_tx_chars(struct uart_port *port)
} }
/* /*
* Interrupt handler * receive interrupt handler.
*/ */
static irqreturn_t atmel_interrupt(int irq, void *dev_id) static void
atmel_handle_receive(struct uart_port *port, unsigned int pending)
{ {
struct uart_port *port = dev_id; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
unsigned int status, pending, pass_counter = 0;
status = UART_GET_CSR(port);
pending = status & UART_GET_IMR(port);
while (pending) {
/* Interrupt receive */ /* Interrupt receive */
if (pending & ATMEL_US_RXRDY) if (pending & ATMEL_US_RXRDY)
atmel_rx_chars(port); atmel_rx_chars(port);
else if (pending & ATMEL_US_RXBRK) { else if (pending & ATMEL_US_RXBRK) {
/* /*
* End of break detected. If it came along * End of break detected. If it came along with a
* with a character, atmel_rx_chars will * character, atmel_rx_chars will handle it.
* handle it.
*/ */
UART_PUT_CR(port, ATMEL_US_RSTSTA); UART_PUT_CR(port, ATMEL_US_RSTSTA);
UART_PUT_IDR(port, ATMEL_US_RXBRK); UART_PUT_IDR(port, ATMEL_US_RXBRK);
atmel_port->break_active = 0; atmel_port->break_active = 0;
} }
}
/*
* transmit interrupt handler.
*/
static void
atmel_handle_transmit(struct uart_port *port, unsigned int pending)
{
/* Interrupt transmit */
if (pending & ATMEL_US_TXRDY)
atmel_tx_chars(port);
}
// TODO: All reads to CSR will clear these interrupts! /*
if (pending & ATMEL_US_RIIC) port->icount.rng++; * status flags interrupt handler.
if (pending & ATMEL_US_DSRIC) port->icount.dsr++; */
static void
atmel_handle_status(struct uart_port *port, unsigned int pending,
unsigned int status)
{
/* TODO: All reads to CSR will clear these interrupts! */
if (pending & ATMEL_US_RIIC)
port->icount.rng++;
if (pending & ATMEL_US_DSRIC)
port->icount.dsr++;
if (pending & ATMEL_US_DCDIC) if (pending & ATMEL_US_DCDIC)
uart_handle_dcd_change(port, !(status & ATMEL_US_DCD)); uart_handle_dcd_change(port, !(status & ATMEL_US_DCD));
if (pending & ATMEL_US_CTSIC) if (pending & ATMEL_US_CTSIC)
uart_handle_cts_change(port, !(status & ATMEL_US_CTS)); uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
if (pending & (ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC | ATMEL_US_CTSIC)) if (pending & (ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC
| ATMEL_US_CTSIC))
wake_up_interruptible(&port->info->delta_msr_wait); wake_up_interruptible(&port->info->delta_msr_wait);
}
/* Interrupt transmit */ /*
if (pending & ATMEL_US_TXRDY) * Interrupt handler
atmel_tx_chars(port); */
static irqreturn_t atmel_interrupt(int irq, void *dev_id)
{
struct uart_port *port = dev_id;
unsigned int status, pending, pass_counter = 0;
status = UART_GET_CSR(port);
pending = status & UART_GET_IMR(port);
while (pending) {
atmel_handle_receive(port, pending);
atmel_handle_status(port, pending, status);
atmel_handle_transmit(port, pending);
if (pass_counter++ > ATMEL_ISR_PASS_LIMIT) if (pass_counter++ > ATMEL_ISR_PASS_LIMIT)
break; break;
...@@ -414,7 +443,8 @@ static int atmel_startup(struct uart_port *port) ...@@ -414,7 +443,8 @@ static int atmel_startup(struct uart_port *port)
/* /*
* Allocate the IRQ * Allocate the IRQ
*/ */
retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED, "atmel_serial", port); retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED,
"atmel_serial", port);
if (retval) { if (retval) {
printk("atmel_serial: atmel_startup - Can't get irq\n"); printk("atmel_serial: atmel_startup - Can't get irq\n");
return retval; return retval;
...@@ -436,9 +466,11 @@ static int atmel_startup(struct uart_port *port) ...@@ -436,9 +466,11 @@ static int atmel_startup(struct uart_port *port)
* Finally, enable the serial port * Finally, enable the serial port
*/ */
UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); /* enable xmit & rcvr */ /* enable xmit & rcvr */
UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
UART_PUT_IER(port, ATMEL_US_RXRDY); /* enable receive only */ /* enable receive only */
UART_PUT_IER(port, ATMEL_US_RXRDY);
return 0; return 0;
} }
...@@ -470,9 +502,10 @@ static void atmel_shutdown(struct uart_port *port) ...@@ -470,9 +502,10 @@ static void atmel_shutdown(struct uart_port *port)
/* /*
* Power / Clock management. * Power / Clock management.
*/ */
static void atmel_serial_pm(struct uart_port *port, unsigned int state, unsigned int oldstate) static void atmel_serial_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
{ {
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
switch (state) { switch (state) {
case 0: case 0:
...@@ -497,15 +530,17 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, unsigned ...@@ -497,15 +530,17 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, unsigned
/* /*
* Change the port parameters * Change the port parameters
*/ */
static void atmel_set_termios(struct uart_port *port, struct ktermios * termios, struct ktermios * old) static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
{ {
unsigned long flags; unsigned long flags;
unsigned int mode, imr, quot, baud; unsigned int mode, imr, quot, baud;
/* Get current mode register */ /* Get current mode register */
mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR); mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL
| ATMEL_US_NBSTOP | ATMEL_US_PAR);
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
quot = uart_get_divisor(port, baud); quot = uart_get_divisor(port, baud);
if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */ if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */
...@@ -535,18 +570,17 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios, ...@@ -535,18 +570,17 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios,
/* parity */ /* parity */
if (termios->c_cflag & PARENB) { if (termios->c_cflag & PARENB) {
if (termios->c_cflag & CMSPAR) { /* Mark or Space parity */ /* Mark or Space parity */
if (termios->c_cflag & CMSPAR) {
if (termios->c_cflag & PARODD) if (termios->c_cflag & PARODD)
mode |= ATMEL_US_PAR_MARK; mode |= ATMEL_US_PAR_MARK;
else else
mode |= ATMEL_US_PAR_SPACE; mode |= ATMEL_US_PAR_SPACE;
} } else if (termios->c_cflag & PARODD)
else if (termios->c_cflag & PARODD)
mode |= ATMEL_US_PAR_ODD; mode |= ATMEL_US_PAR_ODD;
else else
mode |= ATMEL_US_PAR_EVEN; mode |= ATMEL_US_PAR_EVEN;
} } else
else
mode |= ATMEL_US_PAR_NONE; mode |= ATMEL_US_PAR_NONE;
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
...@@ -572,16 +606,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios, ...@@ -572,16 +606,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios,
if (termios->c_iflag & IGNPAR) if (termios->c_iflag & IGNPAR)
port->ignore_status_mask |= ATMEL_US_OVRE; port->ignore_status_mask |= ATMEL_US_OVRE;
} }
/* TODO: Ignore all characters if CREAD is set.*/
// TODO: Ignore all characters if CREAD is set.
/* update the per-port timeout */ /* update the per-port timeout */
uart_update_timeout(port, termios->c_cflag, baud); uart_update_timeout(port, termios->c_cflag, baud);
/* disable interrupts and drain transmitter */ /* save/disable interrupts and drain transmitter */
imr = UART_GET_IMR(port); /* get interrupt mask */ imr = UART_GET_IMR(port);
UART_PUT_IDR(port, -1); /* disable all interrupts */ UART_PUT_IDR(port, -1);
while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY)) { barrier(); } while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
barrier();
/* disable receiver and transmitter */ /* disable receiver and transmitter */
UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS); UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS);
...@@ -707,7 +741,8 @@ static struct uart_ops atmel_pops = { ...@@ -707,7 +741,8 @@ static struct uart_ops atmel_pops = {
/* /*
* Configure the port from the platform device resource info. * Configure the port from the platform device resource info.
*/ */
static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct platform_device *pdev) static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
struct platform_device *pdev)
{ {
struct uart_port *port = &atmel_port->uart; struct uart_port *port = &atmel_port->uart;
struct atmel_uart_data *data = pdev->dev.platform_data; struct atmel_uart_data *data = pdev->dev.platform_data;
...@@ -730,7 +765,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct ...@@ -730,7 +765,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct
port->membase = NULL; port->membase = NULL;
} }
if (!atmel_port->clk) { /* for console, the clock could already be configured */ /* for console, the clock could already be configured */
if (!atmel_port->clk) {
atmel_port->clk = clk_get(&pdev->dev, "usart"); atmel_port->clk = clk_get(&pdev->dev, "usart");
clk_enable(atmel_port->clk); clk_enable(atmel_port->clk);
port->uartclk = clk_get_rate(atmel_port->clk); port->uartclk = clk_get_rate(atmel_port->clk);
...@@ -754,7 +790,6 @@ void __init atmel_register_uart_fns(struct atmel_port_fns *fns) ...@@ -754,7 +790,6 @@ void __init atmel_register_uart_fns(struct atmel_port_fns *fns)
atmel_pops.set_wake = fns->set_wake; atmel_pops.set_wake = fns->set_wake;
} }
#ifdef CONFIG_SERIAL_ATMEL_CONSOLE #ifdef CONFIG_SERIAL_ATMEL_CONSOLE
static void atmel_console_putchar(struct uart_port *port, int ch) static void atmel_console_putchar(struct uart_port *port, int ch)
{ {
...@@ -774,7 +809,7 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) ...@@ -774,7 +809,7 @@ static void atmel_console_write(struct console *co, const char *s, u_int count)
/* /*
* First, save IMR and then disable interrupts * First, save IMR and then disable interrupts
*/ */
imr = UART_GET_IMR(port); /* get interrupt mask */ imr = UART_GET_IMR(port);
UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY); UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY);
uart_console_write(port, s, count, atmel_console_putchar); uart_console_write(port, s, count, atmel_console_putchar);
...@@ -786,14 +821,16 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) ...@@ -786,14 +821,16 @@ static void atmel_console_write(struct console *co, const char *s, u_int count)
do { do {
status = UART_GET_CSR(port); status = UART_GET_CSR(port);
} while (!(status & ATMEL_US_TXRDY)); } while (!(status & ATMEL_US_TXRDY));
UART_PUT_IER(port, imr); /* set interrupts back the way they were */ /* set interrupts back the way they were */
UART_PUT_IER(port, imr);
} }
/* /*
* If the port was already initialised (eg, by a boot loader), try to determine * If the port was already initialised (eg, by a boot loader),
* the current setup. * try to determine the current setup.
*/ */
static void __init atmel_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits) static void __init atmel_console_get_options(struct uart_port *port, int *baud,
int *parity, int *bits)
{ {
unsigned int mr, quot; unsigned int mr, quot;
...@@ -835,10 +872,12 @@ static int __init atmel_console_setup(struct console *co, char *options) ...@@ -835,10 +872,12 @@ static int __init atmel_console_setup(struct console *co, char *options)
int parity = 'n'; int parity = 'n';
int flow = 'n'; int flow = 'n';
if (port->membase == 0) /* Port not initialized yet - delay setup */ if (port->membase == NULL) {
/* Port not initialized yet - delay setup */
return -ENODEV; return -ENODEV;
}
UART_PUT_IDR(port, -1); /* disable interrupts */ UART_PUT_IDR(port, -1);
UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
...@@ -870,13 +909,16 @@ static struct console atmel_console = { ...@@ -870,13 +909,16 @@ static struct console atmel_console = {
static int __init atmel_console_init(void) static int __init atmel_console_init(void)
{ {
if (atmel_default_console_device) { if (atmel_default_console_device) {
add_preferred_console(ATMEL_DEVICENAME, atmel_default_console_device->id, NULL); add_preferred_console(ATMEL_DEVICENAME,
atmel_init_port(&(atmel_ports[atmel_default_console_device->id]), atmel_default_console_device); atmel_default_console_device->id, NULL);
atmel_init_port(&atmel_ports[atmel_default_console_device->id],
atmel_default_console_device);
register_console(&atmel_console); register_console(&atmel_console);
} }
return 0; return 0;
} }
console_initcall(atmel_console_init); console_initcall(atmel_console_init);
/* /*
...@@ -884,11 +926,13 @@ console_initcall(atmel_console_init); ...@@ -884,11 +926,13 @@ console_initcall(atmel_console_init);
*/ */
static int __init atmel_late_console_init(void) static int __init atmel_late_console_init(void)
{ {
if (atmel_default_console_device && !(atmel_console.flags & CON_ENABLED)) if (atmel_default_console_device
&& !(atmel_console.flags & CON_ENABLED))
register_console(&atmel_console); register_console(&atmel_console);
return 0; return 0;
} }
core_initcall(atmel_late_console_init); core_initcall(atmel_late_console_init);
#else #else
...@@ -906,12 +950,14 @@ static struct uart_driver atmel_uart = { ...@@ -906,12 +950,14 @@ static struct uart_driver atmel_uart = {
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state) static int atmel_serial_suspend(struct platform_device *pdev,
pm_message_t state)
{ {
struct uart_port *port = platform_get_drvdata(pdev); struct uart_port *port = platform_get_drvdata(pdev);
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
if (device_may_wakeup(&pdev->dev) && !at91_suspend_entering_slow_clock()) if (device_may_wakeup(&pdev->dev)
&& !at91_suspend_entering_slow_clock())
enable_irq_wake(port->irq); enable_irq_wake(port->irq);
else { else {
uart_suspend_port(&atmel_uart, port); uart_suspend_port(&atmel_uart, port);
...@@ -924,13 +970,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state ...@@ -924,13 +970,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state
static int atmel_serial_resume(struct platform_device *pdev) static int atmel_serial_resume(struct platform_device *pdev)
{ {
struct uart_port *port = platform_get_drvdata(pdev); struct uart_port *port = platform_get_drvdata(pdev);
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
if (atmel_port->suspended) { if (atmel_port->suspended) {
uart_resume_port(&atmel_uart, port); uart_resume_port(&atmel_uart, port);
atmel_port->suspended = 0; atmel_port->suspended = 0;
} } else
else
disable_irq_wake(port->irq); disable_irq_wake(port->irq);
return 0; return 0;
...@@ -960,7 +1005,7 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) ...@@ -960,7 +1005,7 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
static int __devexit atmel_serial_remove(struct platform_device *pdev) static int __devexit atmel_serial_remove(struct platform_device *pdev)
{ {
struct uart_port *port = platform_get_drvdata(pdev); struct uart_port *port = platform_get_drvdata(pdev);
struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; struct atmel_uart_port *atmel_port = (struct atmel_uart_port *)port;
int ret = 0; int ret = 0;
clk_disable(atmel_port->clk); clk_disable(atmel_port->clk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册