Date: Fri, 1 Dec 2006 22:58:18 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 110840 for review Message-ID: <200612012258.kB1MwIfx064487@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110840 Change 110840 by gonzo@gonzo_jeeves on 2006/12/01 22:57:53 o Add UART support. This requires OBIO driver to be brought in. Since all peripheral interrupts are cascaded to IRQ 2 we need to place OBIO "behind" the point of cascading so we make it pseudo-device on PCI bus. It requests COM0 IRQ(4) and provides uart module with access to bus. o Remove malta_console.c as obsolete. We doesn't need it since there is functional UART support. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips4k/malta/files.malta#6 edit .. //depot/projects/mips2/src/sys/mips/mips4k/malta/malta_console.c#3 delete .. //depot/projects/mips2/src/sys/mips/mips4k/malta/maltareg.h#2 edit .. //depot/projects/mips2/src/sys/mips/mips4k/malta/obio.c#1 add .. //depot/projects/mips2/src/sys/mips/mips4k/malta/obiovar.h#1 add .. //depot/projects/mips2/src/sys/mips/mips4k/malta/uart_bus_maltausart.c#3 edit .. //depot/projects/mips2/src/sys/mips/mips4k/malta/uart_cpu_maltausart.c#3 edit .. //depot/projects/mips2/src/sys/mips/mips4k/malta/uart_dev_maltausart.c#3 delete Differences ... ==== //depot/projects/mips2/src/sys/mips/mips4k/malta/files.malta#6 (text+ko) ==== @@ -1,9 +1,9 @@ # $FreeBSD$ mips/mips4k/malta/gt.c standard mips/mips4k/malta/gt_pci.c standard +mips/mips4k/malta/obio.c optional uart mips/mips4k/malta/uart_cpu_maltausart.c optional uart -mips/mips4k/malta/uart_dev_maltausart.c optional uart mips/mips4k/malta/uart_bus_maltausart.c optional uart -mips/mips4k/malta/malta_console.c standard +dev/uart/uart_dev_ns8250.c optional uart mips/mips4k/malta/malta_machdep.c standard mips/mips4k/malta/yamon.c standard ==== //depot/projects/mips2/src/sys/mips/mips4k/malta/maltareg.h#2 (text+ko) ==== @@ -210,7 +210,7 @@ #define MALTA_SMSC_COM1_ADR 0x3f8 #define MALTA_SMSC_COM2_ADR 0x2f8 -#define MALTA_UART0ADR MALTA_SMSC_COM1_ADR // MALTA_PCI0_ADDR(MALTA_SMSC_COM1_ADR) +#define MALTA_UART0ADR MALTA_PCI0_ADDR(MALTA_SMSC_COM1_ADR) #define MALTA_UART1ADR MALTA_SMSC_COM2_ADR // MALTA_PCI0_ADDR(MALTA_SMSC_COM2_ADR) #define MALTA_SMSC_1284_ADR 0x378 ==== //depot/projects/mips2/src/sys/mips/mips4k/malta/uart_bus_maltausart.c#3 (text+ko) ==== @@ -21,8 +21,6 @@ * 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. - * * $Id$ */ /* @@ -62,60 +60,39 @@ #include "uart_if.h" -static int usart_XXPROCESSOR_probe(device_t dev); +static int uart_malta_probe(device_t dev); -extern struct uart_class XXPROCESSOR_usart_class; +extern struct uart_class malta_uart_class; -static device_method_t usart_XXPROCESSOR_methods[] = { +static device_method_t uart_malta_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, usart_XXPROCESSOR_probe), + DEVMETHOD(device_probe, uart_malta_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), { 0, 0 } }; -static driver_t usart_XXPROCESSOR_driver = { +static driver_t uart_malta_driver = { uart_driver_name, - usart_XXPROCESSOR_methods, + uart_malta_methods, sizeof(struct uart_softc), }; extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; - static int -usart_XXPROCESSOR_probe(device_t dev) +uart_malta_probe(device_t dev) { struct uart_softc *sc; sc = device_get_softc(dev); - switch (device_get_unit(dev)) - { - case 0: - device_set_desc(dev, "DBGU"); - - /* XXX: This is ARM comment. - * Setting sc_sysdev makes this device a 'system device' and - * indirectly makes it the system console. - */ - sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs); - bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); - break; - case 1: - device_set_desc(dev, "USART0"); - break; - case 2: - device_set_desc(dev, "USART1"); - break; - case 3: - device_set_desc(dev, "USART2"); - break; - case 4: - device_set_desc(dev, "USART3"); - break; - } - sc->sc_class = &XXPROCESSOR_usart_class; - return (uart_bus_probe(dev, 0, 0, 0, device_get_unit(dev))); + 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)); + sc->sc_sysdev->bas.bst = 0; + sc->sc_sysdev->bas.bsh = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); + sc->sc_bas.bst = 0; + sc->sc_bas.bsh = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); + return(uart_bus_probe(dev, 0, 0, 0, 0)); } - -DRIVER_MODULE(uart, atmelarm, usart_XXPROCESSOR_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, obio, uart_malta_driver, uart_devclass, 0, 0); ==== //depot/projects/mips2/src/sys/mips/mips4k/malta/uart_cpu_maltausart.c#3 (text+ko) ==== @@ -53,8 +53,8 @@ bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; -extern struct uart_ops XXPROCESSOR_usart_ops; -extern struct bus_space XXPROCESSOR_bs_tag; +extern struct uart_ops malta_usart_ops; +extern struct bus_space malta_bs_tag; int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) @@ -66,31 +66,18 @@ int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { - di->ops = XXPROCESSOR_usart_ops; + di->ops = uart_ns8250_ops; di->bas.chan = 0; -#if 0 - di->bas.bst = &XXPROCESSOR_bs_tag; -#endif - - /* - * XXXMIPS: You might want to take a look at comment in arm/.. code to - * it's respective function. - */ - di->bas.bsh = 0; /* XXX_BASE + XXX_SYS_BASE + DBGU;*/ - di->baudrate = 115200; - + di->bas.bst = 0; di->bas.regshft = 0; di->bas.rclk = 0; + di->baudrate = 115200; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; -#if 0 - uart_bus_space_io = &XXPROCESSOR_bs_tag; - uart_bus_space_mem = NULL; -#endif - /* Check the environment for overrides */ - if (uart_getenv(devtype, di) == 0) - return (-1); - return (-1); + uart_bus_space_io = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); + uart_bus_space_mem = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); + di->bas.bsh = MIPS_PHYS_TO_KSEG1(MALTA_UART0ADR); + return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612012258.kB1MwIfx064487>