summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-10-08 05:55:04 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-10-08 05:55:04 +0000
commitbebf220494dd8147d791addb2bd93ab62ce6e627 (patch)
treec7915cdfbfc70f93b0a08984287e48526b085845
parentd44367aeca165fc751609e0c6b01a4af7a003845 (diff)
Use the fdt root node instead of board ids to gate omap4 specific code.
-rw-r--r--sys/arch/armv7/omap/omapid.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/arch/armv7/omap/omapid.c b/sys/arch/armv7/omap/omapid.c
index 406c9d6739f..efe3587e3db 100644
--- a/sys/arch/armv7/omap/omapid.c
+++ b/sys/arch/armv7/omap/omapid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omapid.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */
+/* $OpenBSD: omapid.c,v 1.3 2016/10/08 05:55:03 jsg Exp $ */
/*
* Copyright (c) 2013 Dale Rahn <drahn@dalerahn.com>
*
@@ -27,6 +27,8 @@
#include <machine/bus.h>
#include <armv7/armv7/armv7var.h>
+#include <dev/ofw/fdt.h>
+
/* registers */
#define O4_ID_SIZE 0x1000
#define O4_FUSE_ID0 0x200
@@ -68,6 +70,7 @@ omapid_attach(struct device *parent, struct device *self, void *args)
uint32_t rev;
uint32_t newclockrate = 0;
char *board;
+ void *node;
sc->sc_iot = aa->aa_iot;
if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
@@ -76,9 +79,13 @@ omapid_attach(struct device *parent, struct device *self, void *args)
omapid_sc = sc;
+ node = fdt_find_node("/");
+ if (node == NULL)
+ panic("%s: could not get fdt root node",
+ sc->sc_dev.dv_xname);
+
board = "unknown";
- switch (board_id) {
- case BOARD_ID_OMAP4_PANDA:
+ if (fdt_is_compatible(node, "ti,omap4")) {
rev = bus_space_read_4(sc->sc_iot, sc->sc_ioh, O4_ID_CODE);
switch ((rev >> 12) & 0xffff) {
case 0xB852:
@@ -91,9 +98,6 @@ omapid_attach(struct device *parent, struct device *self, void *args)
newclockrate = 350 * 1000 * 1000;
break;
}
- break;
- default:
- break;
}
printf(": %s\n", board);
if (newclockrate != 0)