From 8f74c88a7330cfb9f8be768c1ddfb48159eb74af Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Wed, 30 Mar 2016 17:00:33 +0000 Subject: [PATCH] Add basic FDT support for the mx25l SPI flash. Sponsored by: Rubicon Communications (Netgate) --- sys/dev/flash/mx25l.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c index c4dad4b28775..c43b751fb1fb 100644 --- a/sys/dev/flash/mx25l.c +++ b/sys/dev/flash/mx25l.c @@ -26,6 +26,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include @@ -40,6 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#endif + #include #include "spibus_if.h" @@ -360,7 +368,15 @@ mx25l_read(device_t dev, off_t offset, caddr_t data, off_t count) static int mx25l_probe(device_t dev) { + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (!ofw_bus_is_compatible(dev, "st,m25p")) + return (ENXIO); +#endif device_set_desc(dev, "M25Pxx Flash Family"); + return (0); }