Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2013 15:15:25 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245369 - in head/sys: conf dev/altera/sdcard
Message-ID:  <201301131515.r0DFFPwm090873@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Sun Jan 13 15:15:24 2013
New Revision: 245369
URL: http://svnweb.freebsd.org/changeset/base/245369

Log:
  Merge Perforce changeset 219927 to head:
  
    Implement an FDT attachment for the Altera SD Card driver
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/conf/files
  head/sys/dev/altera/sdcard/altera_sdcard_fdt.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sun Jan 13 15:13:25 2013	(r245368)
+++ head/sys/conf/files	Sun Jan 13 15:15:24 2013	(r245369)
@@ -641,6 +641,7 @@ dev/altera/avgen/altera_avgen.c		optiona
 dev/altera/sdcard/altera_sdcard.c	optional altera_sdcard
 dev/altera/sdcard/altera_sdcard_disk.c	optional altera_sdcard
 dev/altera/sdcard/altera_sdcard_io.c	optional altera_sdcard
+dev/altera/sdcard/altera_sdcard_fdt.c	optional altera_sdcard fdt
 dev/altera/sdcard/altera_sdcard_nexus.c	optional altera_sdcard
 dev/amr/amr.c			optional amr
 dev/amr/amr_cam.c		optional amrp amr

Modified: head/sys/dev/altera/sdcard/altera_sdcard_fdt.c
==============================================================================
--- head/sys/dev/altera/sdcard/altera_sdcard_fdt.c	Sun Jan 13 15:13:25 2013	(r245368)
+++ head/sys/dev/altera/sdcard/altera_sdcard_fdt.c	Sun Jan 13 15:15:24 2013	(r245369)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301131515.r0DFFPwm090873>