summaryrefslogtreecommitdiffstats
path: root/sys/dev/sec/sec.c
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2010-07-11 21:08:29 +0000
committerraj <raj@FreeBSD.org>2010-07-11 21:08:29 +0000
commit6496d826ccfca6b78860dfa86efcb3f96cb6053f (patch)
tree827f9dce3768613a609f3a9e594b123936ec2e0e /sys/dev/sec/sec.c
parent710dc13ac9dfbfa4fead6e52f9efb9e7b6af119e (diff)
downloadFreeBSD-src-6496d826ccfca6b78860dfa86efcb3f96cb6053f.zip
FreeBSD-src-6496d826ccfca6b78860dfa86efcb3f96cb6053f.tar.gz
Convert Freescale PowerPC platforms to FDT convention.
The following systems are affected: - MPC8555CDS - MPC8572DS This overhaul covers the following major changes: - All integrated peripherals drivers for Freescale MPC85XX SoC, which are currently in the FreeBSD source tree are reworked and adjusted so they derive config data out of the device tree blob (instead of hard coded / tabelarized values). - This includes: LBC, PCI / PCI-Express, I2C, DS1553, OpenPIC, TSEC, SEC, QUICC, UART, CFI. - Thanks to the common FDT infrastrucutre (fdtbus, simplebus) we retire ocpbus(4) driver, which was based on hard-coded config data. Note that world for these platforms has to be built WITH_FDT. Reviewed by: imp Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/sec/sec.c')
-rw-r--r--sys/dev/sec/sec.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/sys/dev/sec/sec.c b/sys/dev/sec/sec.c
index 6b0a62f..36fc9ce 100644
--- a/sys/dev/sec/sec.c
+++ b/sys/dev/sec/sec.c
@@ -45,12 +45,12 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <machine/bus.h>
-#include <machine/ocpbus.h>
#include <machine/resource.h>
#include <opencrypto/cryptodev.h>
#include "cryptodev_if.h"
+#include <dev/ofw/ofw_bus_subr.h>
#include <dev/sec/sec.h>
static int sec_probe(device_t dev);
@@ -153,7 +153,7 @@ static driver_t sec_driver = {
};
static devclass_t sec_devclass;
-DRIVER_MODULE(sec, ocpbus, sec_driver, sec_devclass, 0, 0);
+DRIVER_MODULE(sec, simplebus, sec_driver, sec_devclass, 0, 0);
MODULE_DEPEND(sec, crypto, 1, 1, 1);
static struct sec_eu_methods sec_eus[] = {
@@ -201,24 +201,16 @@ static int
sec_probe(device_t dev)
{
struct sec_softc *sc;
- device_t parent;
- uintptr_t devtype;
uint64_t id;
- int error;
- parent = device_get_parent(dev);
- error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype);
- if (error)
- return (error);
-
- if (devtype != OCPBUS_DEVTYPE_SEC)
+ if (!ofw_bus_is_compatible(dev, "fsl,sec2.0"))
return (ENXIO);
sc = device_get_softc(dev);
sc->sc_rrid = 0;
- sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid,
- 0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+ sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid,
+ RF_ACTIVE);
if (sc->sc_rres == NULL)
return (ENXIO);
@@ -276,8 +268,8 @@ sec_attach(device_t dev)
/* Allocate I/O memory for SEC registers */
sc->sc_rrid = 0;
- sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid,
- 0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+ sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid,
+ RF_ACTIVE);
if (sc->sc_rres == NULL) {
device_printf(dev, "could not allocate I/O memory!\n");
@@ -295,12 +287,15 @@ sec_attach(device_t dev)
if (error)
goto fail2;
- sc->sc_sec_irid = 1;
- error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand,
- &sc->sc_sec_irid, sec_secondary_intr, "secondary");
- if (error)
- goto fail3;
+ if (sc->sc_version == 3) {
+ sc->sc_sec_irid = 1;
+ error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand,
+ &sc->sc_sec_irid, sec_secondary_intr, "secondary");
+
+ if (error)
+ goto fail3;
+ }
/* Alloc DMA memory for descriptors and link tables */
error = sec_alloc_dma_mem(sc, &(sc->sc_desc_dmem),
OpenPOWER on IntegriCloud