diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-04-11 13:21:06 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-04-11 13:21:06 +0200 |
commit | 6a3a3d69c67647db5d5176a7cf9ee68e9fce4352 (patch) | |
tree | 349781e2abd5c79cae9a2d1c94880afd86b319ed /sys/src/9/bcm/uartmini.c | |
parent | fe34e52d19aeeb04bc34114fda928b6afeb62253 (diff) |
bcm: add pl011 uart driver
the raspi has two uarts, the pl011 and the mini. only one
can be used at a time due to pin muxing. the bcm kernel
uses the mini by default.
Diffstat (limited to 'sys/src/9/bcm/uartmini.c')
-rw-r--r-- | sys/src/9/bcm/uartmini.c | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/sys/src/9/bcm/uartmini.c b/sys/src/9/bcm/uartmini.c index 480d454fb..9236d2ae9 100644 --- a/sys/src/9/bcm/uartmini.c +++ b/sys/src/9/bcm/uartmini.c @@ -47,7 +47,7 @@ extern PhysUart miniphysuart; static Uart miniuart = { .regs = (u32int*)AUXREGS, - .name = "uart0", + .name = "uart1", .freq = 250000000, .baud = 115200, .phys = &miniphysuart, @@ -100,7 +100,7 @@ enable(Uart *uart, int ie) ap[MuCntl] = TxEn|RxEn; baud(uart, uart->baud); if(ie){ - intrenable(IRQaux, interrupt, uart, 0, "uart"); + intrenable(IRQaux, interrupt, uart, 0, uart->name); ap[MuIer] = RxIen|TxIen; }else ap[MuIer] = 0; @@ -259,7 +259,7 @@ donothing(Uart*, int) { } -void +static void putc(Uart*, int c) { u32int *ap; @@ -272,7 +272,7 @@ putc(Uart*, int c) ; } -int +static int getc(Uart*) { u32int *ap; @@ -283,38 +283,8 @@ getc(Uart*) return ap[MuIo] & 0xFF; } -void -uartconsinit(void) -{ - Uart *uart; - int n; - char *p, *cmd; - - if((p = getconf("console")) == nil) - return; - n = strtoul(p, &cmd, 0); - if(p == cmd) - return; - switch(n){ - default: - return; - case 0: - uart = &miniuart; - break; - } - - if(!uart->enabled) - (*uart->phys->enable)(uart, 0); - uartctl(uart, "l8 pn s1"); - if(*cmd != '\0') - uartctl(uart, cmd); - - consuart = uart; - uart->console = 1; -} - PhysUart miniphysuart = { - .name = "miniuart", + .name = "mini", .pnp = pnp, .enable = enable, .disable = disable, |