Re: [PATCH v4 03/16] [loongson] early_printk: add new implmentation

From: Ralf Baechle
Date: Mon Jul 06 2009 - 06:44:08 EST


On Thu, Jul 02, 2009 at 11:20:20PM +0800, Wu Zhangjin wrote:

> +#include <asm/mips-boards/bonito64.h>
> +
> +#define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
> +
> +#define PORT(base, offset) (u8 *)(base + offset)
> +
> +static inline unsigned int serial_in(phys_addr_t base, int offset)
> +{
> + return readb(PORT(base, offset));
> +}
> +
> +static inline void serial_out(phys_addr_t base, int offset, int value)
> +{
> + writeb(value, PORT(base, offset));

Why not inb(0x3f8, + offset) rsp. outb()?

> +}
> +
> +void prom_putchar(char c)
> +{
> + phys_addr_t uart_base =
> + (phys_addr_t) ioremap_nocache(UART_BASE, 8);

ioremap_nocache returns a virtual address, not a physical address, so
this type should probably be unsigned char *.

> + while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0)

Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/