Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build/configs/armvirt_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

CONFIG_ARCH = arm
CONFIG_PLAT = armvirt
CONFIG_ARCH_VER = armv6k
CONFIG_ARCH_VER = armv7-a

CONFIG_DEBUG = y
CONFIG_VERBOSE = y

CONFIG_UART = y
CONFIG_ARMVIRT_UART = y
CONFIG_PL011_UART = y

CONFIG_LOADER_MENU = y
CONFIG_YMODEM = y
CONFIG_KERMIT = y
CONFIG_OS_RAM_ADDR = 0x40200000
4 changes: 1 addition & 3 deletions core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <init.h>
#include <uart/uart.h>

#ifdef CONFIG_DEFAULT_LOADER
extern struct loader_opt g_loader_begin[], g_loader_end[];

static inline void boot(struct loader_opt *loader)
Expand Down Expand Up @@ -48,7 +47,6 @@ static int load_os(char key)

return 0;
}
#endif

static const char __init_data banner[] = "\ng-bios " __GBIOS_VER__
#ifdef CONFIG_VERBOSE
Expand Down Expand Up @@ -115,7 +113,7 @@ int main(void)
for (;;) {
#endif

#if 0
#if 1
char key;

if (uart_rxbuf_count() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion driver/uart/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ obj-$(CONFIG_UART_AT91) += at91_uart.o
obj-$(CONFIG_UART_OMAP3) += omap3_uart.o
obj-$(CONFIG_UART_OMAP4) += omap4_uart.o
obj-$(CONFIG_E310_UART) += e310_uart.o
obj-$(CONFIG_ARMVIRT_UART) += armvirt_uart.o
obj-$(CONFIG_PL011_UART) += pl011_uart.o
32 changes: 0 additions & 32 deletions driver/uart/armvirt_uart.c

This file was deleted.

44 changes: 44 additions & 0 deletions driver/uart/pl011_uart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <io.h>
#include <init.h>
#include <uart/uart.h>

#define PL011_UART_BASE 0x09000000

#define UART_DR 0x00
#define UART_RSRECR 0x04
#define UART_FR 0x18
#define UART_ILPR 0x20
#define UART_IBRD 0x24
#define UART_FBRD 0x28
#define UART_LCR_H 0x2C
#define UART_CR 0x30

// #define UART_FR_BUSY (1 << 3) // UART is busy?
#define UART_FR_RXFE (1 << 4) // RX FIFO is empty
#define UART_FR_TXFF (1 << 5) // TX FIFO is full

#define UART_READB(reg) \
readb(VA(PL011_UART_BASE + (reg)))

#define UART_WRITEB(reg, val) \
writeb(VA(PL011_UART_BASE + (reg)), (val))
static __init int pl011_uart_init(void)
{
return 0;
}

stdio_init(pl011_uart_init);

void uart_send_byte(__u8 b)
{
UART_WRITEB(UART_DR, b);
}
__u8 uart_recv_byte()
{
return UART_READB(UART_DR);
}

__u32 uart_rxbuf_count()
{
return UART_READB(UART_FR) & UART_FR_RXFE;
}