[U-Boot] [PATCH 3/3] nds32: asm/io.h: add __iormb and __iowmb support

馬克泡 macpaul at gmail.com
Tue Oct 25 12:16:53 CEST 2011


Hi Marek,

2011/10/25 Marek Vasut <marek.vasut at gmail.com>:

[snip]

>> Hi Marek,
>>
>> And there are also address casted in (ulong) in ns16550.c.
>> serial_out(UART_LCR_BKSE | UART_LCRVAL, (ulong)&com_port->lcr);
>> I'm not sure to fix this way would affect ns16550 in other architecutre?.
>> #define serial_out(x, y)       writeb(x, (unsigned int *)y)
>
> This is definitelly wrong. I'd like to see others comment on this one.

I'm agree with you but I'm not sure why dose it need a ulong casting
(64 bit data?) since I'm not familiar
with ns16550 hardware.

Please check ns16550.c, current code has another such kind of casting
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
#define serial_out(x, y)        outb(x, (ulong)y)
#define serial_in(y)            inb((ulong)y)
[...]
#else
#define serial_out(x, y)        writeb(x, y)
#define serial_in(y)            readb(y)
#endif

>>
>> And there are also problems when translating readb from macro to
>> inline function.
>
> Why?

Oh I've just found where the problem is inside the io.h
There are the same problem in other io.h (and in linux) if the specific
macro wasn't defined, the header will use a kind of default macro.
I'll post the patch for NDS32 later which also fix this problem.

Plesse give comment to the PATCH v2 later and see if everyone like
such kind of implement.

-- 
Best regards,
Macpaul Lin


More information about the U-Boot mailing list