diff options
author | raj <raj@FreeBSD.org> | 2010-07-11 21:08:29 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2010-07-11 21:08:29 +0000 |
commit | 6496d826ccfca6b78860dfa86efcb3f96cb6053f (patch) | |
tree | 827f9dce3768613a609f3a9e594b123936ec2e0e /sys/dev/quicc | |
parent | 710dc13ac9dfbfa4fead6e52f9efb9e7b6af119e (diff) | |
download | FreeBSD-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/quicc')
-rw-r--r-- | sys/dev/quicc/quicc_bfe_fdt.c (renamed from sys/dev/quicc/quicc_bfe_ocp.c) | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/quicc/quicc_bfe_ocp.c b/sys/dev/quicc/quicc_bfe_fdt.c index e0a98e0..e1fd2d5 100644 --- a/sys/dev/quicc/quicc_bfe_ocp.c +++ b/sys/dev/quicc/quicc_bfe_fdt.c @@ -41,15 +41,15 @@ __FBSDID("$FreeBSD$"); #include <sys/tty.h> #include <machine/bus.h> -#include <machine/ocpbus.h> - +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/ofw_bus_subr.h> #include <dev/quicc/quicc_bfe.h> -static int quicc_ocp_probe(device_t dev); +static int quicc_fdt_probe(device_t dev); -static device_method_t quicc_ocp_methods[] = { +static device_method_t quicc_fdt_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, quicc_ocp_probe), + DEVMETHOD(device_probe, quicc_fdt_probe), DEVMETHOD(device_attach, quicc_bfe_attach), DEVMETHOD(device_detach, quicc_bfe_detach), @@ -65,30 +65,26 @@ static device_method_t quicc_ocp_methods[] = { { 0, 0 } }; -static driver_t quicc_ocp_driver = { +static driver_t quicc_fdt_driver = { quicc_driver_name, - quicc_ocp_methods, + quicc_fdt_methods, sizeof(struct quicc_softc), }; static int -quicc_ocp_probe(device_t dev) +quicc_fdt_probe(device_t dev) { - device_t parent; - uintptr_t clock, devtype; - int error; - - parent = device_get_parent(dev); + phandle_t par; + pcell_t clock; - error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype); - if (error) - return (error); - if (devtype != OCPBUS_DEVTYPE_QUICC) + if (!ofw_bus_is_compatible(dev, "fsl,cpm2")) return (ENXIO); - if (BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_CLOCK, &clock)) + par = OF_parent(ofw_bus_get_node(dev)); + if (OF_getprop(par, "bus-frequency", &clock, sizeof(clock)) <= 0) clock = 0; - return (quicc_bfe_probe(dev, clock)); + + return (quicc_bfe_probe(dev, (uintptr_t)clock)); } -DRIVER_MODULE(quicc, ocpbus, quicc_ocp_driver, quicc_devclass, 0, 0); +DRIVER_MODULE(quicc, simplebus, quicc_fdt_driver, quicc_devclass, 0, 0); |