summaryrefslogtreecommitdiffstats
path: root/sys/dev/altera
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2013-01-13 15:15:24 +0000
committerrwatson <rwatson@FreeBSD.org>2013-01-13 15:15:24 +0000
commit48778c38d73b63e50bb5bcf1ffc93c510e50669a (patch)
treebb10f4de744e6c8b8fff3067bc41da3b4358f51c /sys/dev/altera
parent55f066f4d015e37cd7014616f962b289a1979571 (diff)
downloadFreeBSD-src-48778c38d73b63e50bb5bcf1ffc93c510e50669a.zip
FreeBSD-src-48778c38d73b63e50bb5bcf1ffc93c510e50669a.tar.gz
Merge Perforce changeset 219927 to head:
Implement an FDT attachment for the Altera SD Card driver Sponsored by: DARPA, AFRL
Diffstat (limited to 'sys/dev/altera')
-rw-r--r--sys/dev/altera/sdcard/altera_sdcard_fdt.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/dev/altera/sdcard/altera_sdcard_fdt.c b/sys/dev/altera/sdcard/altera_sdcard_fdt.c
index e0fddcb..ca7be1c 100644
--- a/sys/dev/altera/sdcard/altera_sdcard_fdt.c
+++ b/sys/dev/altera/sdcard/altera_sdcard_fdt.c
@@ -52,21 +52,27 @@ __FBSDID("$FreeBSD$");
#include <dev/altera/sdcard/altera_sdcard.h>
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
/*
- * Nexus bus attachment for the Altera SD Card IP core. Appropriate for most
- * Altera FPGA SoC-style configurations in which the IP core will be exposed
- * to the processor via a memory-mapped Avalon bus.
+ * FDT bus attachment for the Altera SD Card IP core.
*/
static int
-altera_sdcard_nexus_probe(device_t dev)
+altera_sdcard_fdt_probe(device_t dev)
{
- device_set_desc(dev, "Altera Secure Data Card IP Core");
- return (BUS_PROBE_DEFAULT);
+ if (ofw_bus_is_compatible(dev, "altera,sdcard_11_2011")) {
+ device_set_desc(dev, "Altera Secure Data Card IP Core");
+ return (BUS_PROBE_DEFAULT);
+ }
+ return (ENXIO);
}
static int
-altera_sdcard_nexus_attach(device_t dev)
+altera_sdcard_fdt_attach(device_t dev)
{
struct altera_sdcard_softc *sc;
@@ -85,7 +91,7 @@ altera_sdcard_nexus_attach(device_t dev)
}
static int
-altera_sdcard_nexus_detach(device_t dev)
+altera_sdcard_fdt_detach(device_t dev)
{
struct altera_sdcard_softc *sc;
@@ -97,20 +103,20 @@ altera_sdcard_nexus_detach(device_t dev)
return (0);
}
-static device_method_t altera_sdcard_nexus_methods[] = {
- DEVMETHOD(device_probe, altera_sdcard_nexus_probe),
- DEVMETHOD(device_attach, altera_sdcard_nexus_attach),
- DEVMETHOD(device_detach, altera_sdcard_nexus_detach),
+static device_method_t altera_sdcard_fdt_methods[] = {
+ DEVMETHOD(device_probe, altera_sdcard_fdt_probe),
+ DEVMETHOD(device_attach, altera_sdcard_fdt_attach),
+ DEVMETHOD(device_detach, altera_sdcard_fdt_detach),
{ 0, 0 }
};
-static driver_t altera_sdcard_nexus_driver = {
+static driver_t altera_sdcard_fdt_driver = {
"altera_sdcardc",
- altera_sdcard_nexus_methods,
+ altera_sdcard_fdt_methods,
sizeof(struct altera_sdcard_softc),
};
static devclass_t altera_sdcard_devclass;
-DRIVER_MODULE(altera_sdcard, nexus, altera_sdcard_nexus_driver,
+DRIVER_MODULE(altera_sdcard, simplebus, altera_sdcard_fdt_driver,
altera_sdcard_devclass, 0, 0);
OpenPOWER on IntegriCloud