summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-07-10 03:04:01 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-07-10 03:04:01 +0000
commitc20e832bb76854793e20cf167b57d4c8cfd187ca (patch)
tree55fb761e7b4b6e1d6b6fd50a4a8be64399dcff9f /sys
parent27921c5aa636b4b42210571e5c0d8af97e57890d (diff)
Instead of attaching the omap device based on board ids follow imx
and match based on the compatible property of the root node in the fdt. Each of am33xx, omap3, and omap4 have their own list of devices to attach.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/armv7/omap/omap.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/sys/arch/armv7/omap/omap.c b/sys/arch/armv7/omap/omap.c
index ad93d0bf0d0..8a8f0895313 100644
--- a/sys/arch/armv7/omap/omap.c
+++ b/sys/arch/armv7/omap/omap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap.c,v 1.15 2016/06/26 09:06:35 jsg Exp $ */
+/* $OpenBSD: omap.c,v 1.16 2016/07/10 03:04:00 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
@@ -23,6 +23,8 @@
#include <arm/mainbus/mainbus.h>
#include <armv7/armv7/armv7var.h>
+#include <dev/ofw/fdt.h>
+
int omap_match(struct device *, void *, void *);
void omap3_init();
void omap4_init();
@@ -36,7 +38,7 @@ struct cfdriver omap_cd = {
NULL, "omap", DV_DULL
};
-struct board_dev beagleboard_devs[] = {
+struct board_dev omap3_dev[] = {
{ "prcm", 0 },
{ "intc", 0 },
{ "gptimer", 0 },
@@ -50,7 +52,7 @@ struct board_dev beagleboard_devs[] = {
{ NULL, 0 }
};
-struct board_dev beaglebone_devs[] = {
+struct board_dev am33xx_dev[] = {
{ "prcm", 0 },
{ "sitaracm", 0 },
{ "intc", 0 },
@@ -64,21 +66,7 @@ struct board_dev beaglebone_devs[] = {
{ NULL, 0 }
};
-struct board_dev overo_devs[] = {
- { "prcm", 0 },
- { "intc", 0 },
- { "gptimer", 0 },
- { "gptimer", 1 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { NULL, 0 }
-};
-
-struct board_dev pandaboard_devs[] = {
+struct board_dev omap4_dev[] = {
{ "omapid", 0 },
{ "prcm", 0 },
{ "omgpio", 0 },
@@ -91,50 +79,61 @@ struct board_dev pandaboard_devs[] = {
{ NULL, 0 }
};
-struct armv7_board omap_boards[] = {
+struct omap_soc {
+ char *compatible;
+ struct board_dev *devs;
+ void (*init)(void);
+};
+
+struct omap_soc omap_socs[] = {
{
- BOARD_ID_OMAP3_BEAGLE,
- beagleboard_devs,
+ "ti,omap3",
+ omap3_dev,
omap3_init,
},
{
- BOARD_ID_AM335X_BEAGLEBONE,
- beaglebone_devs,
+ "ti,am33xx",
+ am33xx_dev,
am335x_init,
},
{
- BOARD_ID_OMAP3_OVERO,
- overo_devs,
- omap3_init,
- },
- {
- BOARD_ID_OMAP4_PANDA,
- pandaboard_devs,
+ "ti,omap4",
+ omap4_dev,
omap4_init,
},
- { 0, NULL, NULL },
+ { NULL, NULL, NULL },
};
struct board_dev *
omap_board_devs(void)
{
+ void *node;
int i;
- for (i = 0; omap_boards[i].board_id != 0; i++) {
- if (omap_boards[i].board_id == board_id)
- return (omap_boards[i].devs);
+ node = fdt_find_node("/");
+ if (node == NULL)
+ return NULL;
+
+ for (i = 0; omap_socs[i].compatible != NULL; i++) {
+ if (fdt_is_compatible(node, omap_socs[i].compatible))
+ return omap_socs[i].devs;
}
- return (NULL);
+ return NULL;
}
void
omap_board_init(void)
{
+ void *node;
int i;
- for (i = 0; omap_boards[i].board_id != 0; i++) {
- if (omap_boards[i].board_id == board_id) {
- omap_boards[i].init();
+ node = fdt_find_node("/");
+ if (node == NULL)
+ return;
+
+ for (i = 0; omap_socs[i].compatible != NULL; i++) {
+ if (fdt_is_compatible(node, omap_socs[i].compatible)) {
+ omap_socs[i].init();
break;
}
}