[U-Boot] [PATCH v6 06/10] ns16550: add support for mips
Wills Wang
wills.wang at live.com
Mon Jan 4 12:14:57 CET 2016
MIPS archtecture have no "in_le32/in_be32/out_le32/out_be32" macro,
but usually define CONFIG_SYS_BIG_ENDIAN, this patch use readl/writel
for register operation in mips when define CONFIG_SYS_NS16550_MEM32.
Signed-off-by: Wills Wang <wills.wang at live.com>
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/serial/ns16550.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 3fab3f1..3b24af0 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -64,12 +64,16 @@ static inline void serial_out_shift(void *addr, int shift, int value)
{
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
outb(value, (ulong)addr);
-#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_SYS_BIG_ENDIAN)
- out_le32(addr, value);
-#elif defined(CONFIG_SYS_NS16550_MEM32) && defined(CONFIG_SYS_BIG_ENDIAN)
- out_be32(addr, value);
#elif defined(CONFIG_SYS_NS16550_MEM32)
+#ifdef CONFIG_MIPS
writel(value, addr);
+#else
+#ifndef CONFIG_SYS_BIG_ENDIAN
+ out_le32(addr, value);
+#else
+ out_be32(addr, value);
+#endif
+#endif
#elif defined(CONFIG_SYS_BIG_ENDIAN)
writeb(value, addr + (1 << shift) - 1);
#else
@@ -81,12 +85,16 @@ static inline int serial_in_shift(void *addr, int shift)
{
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
return inb((ulong)addr);
-#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_SYS_BIG_ENDIAN)
- return in_le32(addr);
-#elif defined(CONFIG_SYS_NS16550_MEM32) && defined(CONFIG_SYS_BIG_ENDIAN)
- return in_be32(addr);
#elif defined(CONFIG_SYS_NS16550_MEM32)
+#ifdef CONFIG_MIPS
return readl(addr);
+#else
+#ifndef CONFIG_SYS_BIG_ENDIAN
+ return in_le32(addr);
+#else
+ return in_be32(addr);
+#endif
+#endif
#elif defined(CONFIG_SYS_BIG_ENDIAN)
return readb(addr + (1 << shift) - 1);
#else
--
1.9.1
More information about the U-Boot
mailing list