Skip to content

Commit

Permalink
MIPS: boot: Fixes for compressed/uart-16550.c
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/5416/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
jchandra-brcm authored and ralfbaechle committed Jun 13, 2013
1 parent 5649d37 commit d6a5078
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arch/mips/boot/compressed/uart-16550.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
;
Expand Down

0 comments on commit d6a5078

Please sign in to comment.