2014-08-01 21:56:31 +00:00
|
|
|
/*
|
|
|
|
* BCM63XX specific implementation parts
|
|
|
|
*
|
2020-05-20 07:14:02 +00:00
|
|
|
* Copyright (C) 2020 Álvaro Fernández Rojas <noltari@gmail.com>
|
2014-08-01 21:56:31 +00:00
|
|
|
* Copyright (C) 2014 Jonas Gorski <jogo@openwrt.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define READREG(r) *(volatile unsigned int *)(r)
|
|
|
|
#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v
|
|
|
|
|
|
|
|
#define UART_IR_REG 0x10
|
|
|
|
#define UART_FIFO_REG 0x14
|
|
|
|
|
|
|
|
static void wait_xfered(void)
|
|
|
|
{
|
|
|
|
unsigned int val;
|
|
|
|
|
|
|
|
do {
|
2020-05-20 07:14:02 +00:00
|
|
|
val = READREG(UART_BASE + UART_IR_REG);
|
2014-08-01 21:56:31 +00:00
|
|
|
if (val & (1 << 5))
|
|
|
|
break;
|
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void board_putc(int ch)
|
|
|
|
{
|
2020-05-20 07:14:02 +00:00
|
|
|
if (!UART_BASE)
|
2014-08-01 21:56:31 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
wait_xfered();
|
2020-05-20 07:14:02 +00:00
|
|
|
WRITEREG(UART_BASE + UART_FIFO_REG, ch);
|
2014-08-01 21:56:31 +00:00
|
|
|
wait_xfered();
|
|
|
|
}
|