lkml.org 
[lkml]   [2009]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add poll_get_char and poll_put_char uart_ops to atmel_serial.
[added AT91 maintainers to Cc]

Albin Tonnerre wrote:
> +#ifdef CONFIG_CONSOLE_POLL
> +static int atmel_poll_get_char(struct uart_port *port)
> +{
> + struct atmel_uart_port *aup = to_atmel_uart_port(port);
> +
> + while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_RXRDY))
> + barrier();
> +
> + return readb(aup->uart.membase + ATMEL_US_RHR);
> +}
> +
> +static void atmel_poll_put_char(struct uart_port *port, unsigned char ch)
> +{
> + struct atmel_uart_port *aup = to_atmel_uart_port(port);
> + unsigned int status;
> +
> + while (!(readb(aup->uart.membase + ATMEL_US_CSR) & ATMEL_US_TXRDY))
> + barrier();
> +
> + writeb(ch, aup->uart.membase + ATMEL_US_THR);
> +}
> +#endif

All the registers are 32 bits wide, so you should use __raw_readl() and
__raw_writel() to avoid any endianness issues (AT91 is little endian
and AVR32 is big endian).

Haavard


\
 
 \ /
  Last update: 2009-07-27 16:25    [W:0.064 / U:0.384 seconds]
©2003-2014 Jasper Spaans. Advertise on this site