PERFORCE change 108195 for review
Olivier Houchard
cognet at FreeBSD.org
Fri Oct 20 15:42:02 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=108195
Change 108195 by cognet at cognet on 2006/10/20 22:41:46
Hack and slash to get the UART working, even in userland :
- call device_add_child for the uart0.
- Hack the allocation routines to special case for the UART. The way
used to detect if it is the uart is WRONG, it is probably best to add
a new "bus", just for the UART.
Affected files ...
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425.c#10 edit
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/uart_bus_ixp425.c#3 edit
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/uart_cpu_ixp425.c#3 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425.c#10 (text+ko) ====
@@ -229,6 +229,7 @@
device_add_child(dev, "pcib", 0);
device_add_child(dev, "ixpclk", 0);
device_add_child(dev, "ixpiic", 0);
+ device_add_child(dev, "uart", 0);
if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE,
0, &sc->sc_gpio_ioh))
@@ -257,6 +258,15 @@
case SYS_RES_MEMORY:
rmanp = &sc->sc_mem_rman;
+ /* Naughty hack to get the UART memory-mapped register. */
+ /* I'm not sure of how to do it cleanly. */
+ if (start == 0 && end == ~0) {
+ if (device_get_unit(dev) == 0)
+ start = IXP425_UART0_HWBASE;
+ else
+ start = IXP425_UART1_HWBASE;
+ end = start + 0x1000;
+ }
if (getvbase(start, end - start, &vbase))
return (rv);
break;
@@ -269,7 +279,11 @@
if (rv != NULL) {
rman_set_rid(rv, *rid);
if (type == SYS_RES_MEMORY) {
- rman_set_bustag(rv, sc->sc_iot);
+ if (start == IXP425_UART0_HWBASE || start ==
+ IXP425_UART1_HWBASE)
+ rman_set_bustag(rv, &ixp425_a4x_bs_tag);
+ else
+ rman_set_bustag(rv, sc->sc_iot);
rman_set_bushandle(rv, vbase);
}
}
@@ -283,6 +297,13 @@
void **cookiep)
{
+ if (flags & INTR_TYPE_TTY) {
+ /* XXX: wrong. */
+ if (device_get_unit(dev) == 0)
+ rman_set_start(ires, IXP425_INT_UART0);
+ else
+ rman_set_start(ires, IXP425_INT_UART1);
+ }
BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, intr, arg,
cookiep);
intr_enabled |= 1 << rman_get_start(ires);
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/uart_bus_ixp425.c#3 (text+ko) ====
@@ -36,12 +36,14 @@
#include <machine/resource.h>
#include <dev/pci/pcivar.h>
+#include <dev/ic/ns16550.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_bus.h>
#include <dev/uart/uart_cpu.h>
#include <arm/xscale/ixp425/ixp425reg.h>
+#include <arm/xscale/ixp425/ixp425var.h>
#include "uart_if.h"
@@ -71,6 +73,8 @@
sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
sc->sc_class = &uart_ns8250_class;
bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
+ bus_space_write_4(&ixp425_a4x_bs_tag, device_get_unit(dev) == 0 ?
+ IXP425_UART0_VBASE : IXP425_UART1_VBASE, REG_IER, 0x40);
return(uart_bus_probe(dev, 0, IXP425_UART_FREQ, 0, 0));
}
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/uart_cpu_ixp425.c#3 (text+ko) ====
More information about the p4-projects
mailing list