aboutsummaryrefslogtreecommitdiff
path: root/common/debug.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
commit3ace1ddd76b9c04f3ed23883de6279b4485612e8 (patch)
tree2f4af69d70967c2455cb83d8c18a5416c8d1b54d /common/debug.c
parentb7f53b9a9001708dea5303faf52f1b508eefb712 (diff)
downloadkmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.tar.gz
kmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.zip
start trying to boot on visionfive 2
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
Diffstat (limited to 'common/debug.c')
-rw-r--r--common/debug.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/common/debug.c b/common/debug.c
index 1bc87f7..2cd4570 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -59,8 +59,8 @@ vm_t map_io_dbg(struct vmem *b)
* try to implement some kind of basic driver subsystem, but this is good enough
* for now. */
-/** NS16550A and compatible serial drivers. */
-struct __packed ns16550a {
+/** 8250 and compatible serial drivers. */
+struct __packed uart_8250 {
/** Receiver buffer/transmitter holding register. */
uint8_t data;
@@ -111,10 +111,10 @@ struct __packed ns16550a {
#define LSR_ERR (1 << 7)
/**
- * Address of ns16550a port. If other serial drivers are added, this should
- * maybe be made a void *.
+ * Address of generic 8250 port. If other serial drivers are added, this should
+ * maybe be made a void *. No support for quirks at the moment.
*/
-static struct ns16550a *port = 0;
+static struct uart_8250 *port = 0;
/**
* Serial transmitter empty.
@@ -150,8 +150,17 @@ static void __putchar(char c)
*/
static enum serial_dev __serial_dev_enum(const char *dev_name)
{
+ /* qemu, for example */
if (strncmp("ns16550", dev_name, 7) == 0)
- return NS16550A;
+ return UART_8250;
+
+ /* mentioned in dtc documentation as an example */
+ if (strncmp("ns8250", dev_name, 7) == 0)
+ return UART_8250;
+
+ /* starfive visionfive 2, for example (hopefully works) */
+ if (strncmp("snps,dw-apb-uart", dev_name, 16) == 0)
+ return UART_8250;
return -1;
}
@@ -194,8 +203,8 @@ static struct dbg_info __dbg_from_fdt(const void *fdt)
void __setup_dbg(vm_t pt, enum serial_dev dev)
{
switch (dev) {
- case NS16550A:
- port = (struct ns16550a *)pt;
+ case UART_8250:
+ port = (struct uart_8250 *)pt;
break;
}