summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm/devarch.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-04-11 13:21:06 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2019-04-11 13:21:06 +0200
commit6a3a3d69c67647db5d5176a7cf9ee68e9fce4352 (patch)
tree349781e2abd5c79cae9a2d1c94880afd86b319ed /sys/src/9/bcm/devarch.c
parentfe34e52d19aeeb04bc34114fda928b6afeb62253 (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/devarch.c')
-rw-r--r--sys/src/9/bcm/devarch.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/src/9/bcm/devarch.c b/sys/src/9/bcm/devarch.c
index f799e33c6..9469a4716 100644
--- a/sys/src/9/bcm/devarch.c
+++ b/sys/src/9/bcm/devarch.c
@@ -174,6 +174,34 @@ archinit(void)
}
void
+uartconsinit(void)
+{
+ extern PhysUart *physuart[];
+ char *p, *cmd;
+ Uart *uart;
+ int i, n;
+
+ if((p = getconf("console")) == nil)
+ return;
+ i = strtoul(p, &cmd, 0);
+ if(p == cmd)
+ return;
+ /* we only have two possible uarts, the pl011 and aux */
+ for(n = 0; physuart[n] != nil; n++)
+ ;
+ if(i < 0 || i >= n)
+ return;
+ uart = physuart[i]->pnp();
+ if(!uart->enabled)
+ (*uart->phys->enable)(uart, 0);
+ uartctl(uart, "l8 pn s1");
+ if(*cmd != '\0')
+ uartctl(uart, cmd);
+ consuart = uart;
+ uart->console = 1;
+}
+
+void
okay(int on)
{
static int first;