summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
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/uart
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/uart')
-rw-r--r--sys/dev/uart/uart_bus_ocp.c88
-rw-r--r--sys/dev/uart/uart_cpu_powerpc.c34
2 files changed, 2 insertions, 120 deletions
diff --git a/sys/dev/uart/uart_bus_ocp.c b/sys/dev/uart/uart_bus_ocp.c
deleted file mode 100644
index e7f0971..0000000
--- a/sys/dev/uart/uart_bus_ocp.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright 2006 by Juniper Networks.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/tty.h>
-#include <machine/bus.h>
-
-#include <machine/ocpbus.h>
-
-#include <dev/uart/uart.h>
-#include <dev/uart/uart_bus.h>
-
-static int uart_ocp_probe(device_t);
-
-static device_method_t uart_ocp_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, uart_ocp_probe),
- DEVMETHOD(device_attach, uart_bus_attach),
- DEVMETHOD(device_detach, uart_bus_detach),
- { 0, 0 }
-};
-
-static driver_t uart_ocp_driver = {
- uart_driver_name,
- uart_ocp_methods,
- sizeof(struct uart_softc),
-};
-
-static int
-uart_ocp_probe(device_t dev)
-{
- device_t parent;
- struct uart_softc *sc;
- uintptr_t clock, devtype;
- 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_UART)
- return (ENXIO);
-
- sc = device_get_softc(dev);
- sc->sc_class = &uart_ns8250_class;
-
- if (BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_CLOCK, &clock))
- clock = 0;
- return (uart_bus_probe(dev, 0, clock, 0, 0));
-}
-
-DRIVER_MODULE(uart, ocpbus, uart_ocp_driver, uart_devclass, 0, 0);
diff --git a/sys/dev/uart/uart_cpu_powerpc.c b/sys/dev/uart/uart_cpu_powerpc.c
index 8e4c1da..997bdd8 100644
--- a/sys/dev/uart/uart_cpu_powerpc.c
+++ b/sys/dev/uart/uart_cpu_powerpc.c
@@ -27,57 +27,28 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_platform.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/bus.h>
-
-#ifndef MPC85XX
-#include <dev/ofw/openfirm.h>
#include <machine/ofw_machdep.h>
-#endif
+#include <dev/ofw/openfirm.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_cpu.h>
-#ifdef MPC85XX
-bus_space_tag_t uart_bus_space_io = &bs_be_tag;
-bus_space_tag_t uart_bus_space_mem = &bs_be_tag;
-#else
bus_space_tag_t uart_bus_space_io = &bs_le_tag;
bus_space_tag_t uart_bus_space_mem = &bs_le_tag;
-#endif
int
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
{
-#ifdef MPC85XX
- return ((b1->bsh == b2->bsh) ? 1 : 0);
-#else
+
return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ? 1 : 0);
-#endif
}
-#ifdef MPC85XX
-int
-uart_cpu_getdev(int devtype, struct uart_devinfo *di)
-{
- struct uart_class *class;
-
- class = &uart_ns8250_class;
- if (class == NULL)
- class = &uart_quicc_class;
- if (class == NULL)
- return (ENXIO);
-
- /* Check the environment. */
- return (uart_getenv(devtype, di, class));
-}
-#else
static int
ofw_get_uart_console(phandle_t opts, phandle_t *result, const char *inputdev,
const char *outputdev)
@@ -174,4 +145,3 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->parity = UART_PARITY_NONE;
return (0);
}
-#endif
OpenPOWER on IntegriCloud