[coreboot-gerrit] New patch to review for coreboot: 4bc2c0c uart8250mem.c: Add support for using on ARM
Kevin Paul Herbert (kph@meraki.net)
gerrit at coreboot.org
Thu Dec 11 23:14:15 CET 2014
Kevin Paul Herbert (kph at meraki.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7785
-gerrit
commit 4bc2c0cf3f758962c78aa2f092c1f3249cd27c64
Author: Kevin Paul Herbert <kph at meraki.net>
Date: Fri Sep 26 17:07:05 2014 -0700
uart8250mem.c: Add support for using on ARM
Change to portable I/O functions so that this driver can be used on
ARM platforms.
Change-Id: If02a653f8e1b423af742e7df68297c90259edc4b
Signed-off-by: Kevin Paul Herbert <kph at meraki.net>
---
src/drivers/uart/uart8250mem.c | 44 +++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/drivers/uart/uart8250mem.c b/src/drivers/uart/uart8250mem.c
index 79654f1..e847023 100644
--- a/src/drivers/uart/uart8250mem.c
+++ b/src/drivers/uart/uart8250mem.c
@@ -33,65 +33,65 @@
#define SINGLE_CHAR_TIMEOUT (50 * 1000)
#define FIFO_TIMEOUT (16 * SINGLE_CHAR_TIMEOUT)
-static int uart8250_mem_can_tx_byte(unsigned base_port)
+static int uart8250_mem_can_tx_byte(void *base_port)
{
- return read8(base_port + UART8250_LSR) & UART8250_LSR_THRE;
+ return _read8(base_port + UART8250_LSR) & UART8250_LSR_THRE;
}
-static void uart8250_mem_tx_byte(unsigned base_port, unsigned char data)
+static void uart8250_mem_tx_byte(void *base_port, unsigned char data)
{
unsigned long int i = SINGLE_CHAR_TIMEOUT;
while(i-- && !uart8250_mem_can_tx_byte(base_port))
udelay(1);
- write8(base_port + UART8250_TBR, data);
+ _write8(data, base_port + UART8250_TBR);
}
-static void uart8250_mem_tx_flush(unsigned base_port)
+static void uart8250_mem_tx_flush(void *base_port)
{
unsigned long int i = FIFO_TIMEOUT;
- while(i-- && !(read8(base_port + UART8250_LSR) & UART8250_LSR_TEMT))
+ while(i-- && !(_read8(base_port + UART8250_LSR) & UART8250_LSR_TEMT))
udelay(1);
}
-static int uart8250_mem_can_rx_byte(unsigned base_port)
+static int uart8250_mem_can_rx_byte(void *base_port)
{
- return read8(base_port + UART8250_LSR) & UART8250_LSR_DR;
+ return _read8(base_port + UART8250_LSR) & UART8250_LSR_DR;
}
-static unsigned char uart8250_mem_rx_byte(unsigned base_port)
+static unsigned char uart8250_mem_rx_byte(void *base_port)
{
unsigned long int i = SINGLE_CHAR_TIMEOUT;
while(i-- && !uart8250_mem_can_rx_byte(base_port))
udelay(1);
if (i)
- return read8(base_port + UART8250_RBR);
+ return _read8(base_port + UART8250_RBR);
else
return 0x0;
}
-static void uart8250_mem_init(unsigned base_port, unsigned divisor)
+static void uart8250_mem_init(void *base_port, unsigned divisor)
{
/* Disable interrupts */
- write8(base_port + UART8250_IER, 0x0);
+ _write8(0x0, base_port + UART8250_IER);
/* Enable FIFOs */
- write8(base_port + UART8250_FCR, UART8250_FCR_FIFO_EN);
+ _write8(UART8250_FCR_FIFO_EN, base_port + UART8250_FCR);
/* Assert DTR and RTS so the other end is happy */
- write8(base_port + UART8250_MCR, UART8250_MCR_DTR | UART8250_MCR_RTS);
+ _write8(UART8250_MCR_DTR | UART8250_MCR_RTS, base_port + UART8250_MCR);
/* DLAB on */
- write8(base_port + UART8250_LCR, UART8250_LCR_DLAB | CONFIG_TTYS0_LCS);
+ _write8(UART8250_LCR_DLAB | CONFIG_TTYS0_LCS, base_port + UART8250_LCR);
- write8(base_port + UART8250_DLL, divisor & 0xFF);
- write8(base_port + UART8250_DLM, (divisor >> 8) & 0xFF);
+ _write8(divisor & 0xFF, base_port + UART8250_DLL);
+ _write8((divisor >> 8) & 0xFF, base_port + UART8250_DLM);
/* Set to 3 for 8N1 */
- write8(base_port + UART8250_LCR, CONFIG_TTYS0_LCS);
+ _write8(CONFIG_TTYS0_LCS, base_port + UART8250_LCR);
}
void uart_init(int idx)
{
- u32 base = uart_platform_base(idx);
+ void *base = uart_platform_baseptr(idx);
if (!base)
return;
@@ -102,7 +102,7 @@ void uart_init(int idx)
void uart_tx_byte(int idx, unsigned char data)
{
- u32 base = uart_platform_base(idx);
+ void *base = uart_platform_baseptr(idx);
if (!base)
return;
uart8250_mem_tx_byte(base, data);
@@ -110,7 +110,7 @@ void uart_tx_byte(int idx, unsigned char data)
unsigned char uart_rx_byte(int idx)
{
- u32 base = uart_platform_base(idx);
+ void *base = uart_platform_baseptr(idx);
if (!base)
return 0xff;
return uart8250_mem_rx_byte(base);
@@ -118,7 +118,7 @@ unsigned char uart_rx_byte(int idx)
void uart_tx_flush(int idx)
{
- u32 base = uart_platform_base(idx);
+ void *base = uart_platform_baseptr(idx);
if (!base)
return;
uart8250_mem_tx_flush(base);
More information about the coreboot-gerrit
mailing list