aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/flash
diff options
context:
space:
mode:
authorStanislav Galabov <sgalabov@FreeBSD.org>2016-04-20 14:33:00 +0000
committerStanislav Galabov <sgalabov@FreeBSD.org>2016-04-20 14:33:00 +0000
commit009e872ef78246e2403a8f9af388941ef2f63210 (patch)
tree6366530101d38fd4ed869fac225a93b425f39bec /sys/dev/flash
parente3a1a618a30a2b458617a8ae38a0580c6361c179 (diff)
Notes
Diffstat (limited to 'sys/dev/flash')
-rw-r--r--sys/dev/flash/mx25l.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c
index 9b5b9aa786496..338129a07650d 100644
--- a/sys/dev/flash/mx25l.c
+++ b/sys/dev/flash/mx25l.c
@@ -443,12 +443,26 @@ static struct ofw_compat_data compat_data[] = {
static int
mx25l_probe(device_t dev)
{
-
#ifdef FDT
+ int i;
+
if (!ofw_bus_status_okay(dev))
return (ENXIO);
- if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
- return (ENXIO);
+
+ /* First try to match the compatible property to the compat_data */
+ if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 1)
+ goto found;
+
+ /*
+ * Next, try to find a compatible device using the names in the
+ * flash_devices structure
+ */
+ for (i = 0; i < nitems(flash_devices); i++)
+ if (ofw_bus_is_compatible(dev, flash_devices[i].name))
+ goto found;
+
+ return (ENXIO);
+found:
#endif
device_set_desc(dev, "M25Pxx Flash Family");