linux-mips
[Top] [All Lists]

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

To: Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH v4 03/16] [loongson] early_printk: add new implmentation
From: Ralf Baechle <ralf@linux-mips.org>
Date: Mon, 6 Jul 2009 11:43:21 +0100
Cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Jason Wessel <jason.wessel@windriver.com>, Wu Zhangjin <wuzj@lemote.com>, Yan Hua <yanh@lemote.com>, Philippe Vachon <philippe@cowpig.ca>, Zhang Le <r0bertz@gentoo.org>, Zhang Fuxin <zhangfx@lemote.com>, loongson-dev <loongson-dev@googlegroups.com>, Liu Junliang <liujl@lemote.com>, Erwan Lerale <erwan@thiscow.com>, Arnaud Patard <apatard@mandriva.com>
In-reply-to: <9e23b4150f183c0817f2abbb95525279c2006a83.1246546684.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1246546684.git.wuzhangjin@gmail.com> <9e23b4150f183c0817f2abbb95525279c2006a83.1246546684.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
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

<Prev in Thread] Current Thread [Next in Thread>