linux-mips
[Top] [All Lists]

[PATCH 1/2] MIPS: boot: Fixes for compressed/uart-16550.c

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 1/2] MIPS: boot: Fixes for compressed/uart-16550.c
From: "Jayachandran C" <jchandra@broadcom.com>
Date: Mon, 10 Jun 2013 13:03:25 +0530
Cc: "Jayachandran C" <jchandra@broadcom.com>
In-reply-to: <1370849606-5025-1-git-send-email-jchandra@broadcom.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1370849606-5025-1-git-send-email-jchandra@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
Fix uart-16550.c for adding XLR/XLP support, changes are:
* Make register read/write use volatile pointers
* Support 32 bit IO read/write
* Increase timeout in waiting for UART LSR

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/mips/boot/compressed/uart-16550.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/mips/boot/compressed/uart-16550.c 
b/arch/mips/boot/compressed/uart-16550.c
index 1c7b739..90ae440 100644
--- a/arch/mips/boot/compressed/uart-16550.c
+++ b/arch/mips/boot/compressed/uart-16550.c
@@ -23,23 +23,27 @@
 #define PORT(offset) (UART0_BASE + (4 * offset))
 #endif
 
+#ifndef IOTYPE
+#define IOTYPE char
+#endif
+
 #ifndef PORT
 #error please define the serial port address for your own machine
 #endif
 
 static inline unsigned int serial_in(int offset)
 {
-       return *((char *)PORT(offset));
+       return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
 }
 
 static inline void serial_out(int offset, int value)
 {
-       *((char *)PORT(offset)) = value;
+       *((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
 }
 
 void putc(char c)
 {
-       int timeout = 1024;
+       int timeout = 1000000;
 
        while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
                ;
-- 
1.7.9.5



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