Skip to content

Commit

Permalink
serial: Add Broadcom BCM63xx UART implementation
Browse files Browse the repository at this point in the history
Broadcom BCM63xx DSL SoCs utilize a proprietary UART which requires a
custom implementation to be done. This code is an adaptation of Linux's
arch/mips/bcm63xx/early_printk.c file.

Signed-off-by: Florian Fainelli <[email protected]>
  • Loading branch information
ffainelli committed Jul 29, 2015
1 parent c3da82f commit 93fd173
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions serial-bcm63xx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "types.h"
#include "register.h"
#include "serial.h"

#define UART_IR_REG 0x10
#define UART_IR_STAT(x) (1 << (x))
#define UART_IR_TXEMPTY 5
#define UART_FIFO_REG 0x14

/* Implementation ripped from arch/mips/bcm63xx/early_printk.c. Thanks to
* Maxime Bizon for the original code.
*/
static void wait_xfered(void)
{
unsigned int val;

/* wait for any previous char to be transmitted */
do {
val = readl(UART_BASE + UART_IR_REG);
if (val & UART_IR_STAT(UART_IR_TXEMPTY))
break;
} while (1);
}

void __putch(char c)
{
wait_xfered();
writel(c, UART_BASE + UART_FIFO_REG);
wait_xfered();
}

0 comments on commit 93fd173

Please sign in to comment.