mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
XLP UART code udpate.
Move XLP PCI UART device to sys/mips/nlm/dev/ directory. Other drivers for the XLP SoC devices will be added here as well. Update uart_cpu_xlp.c and uart_pci_xlp.c use macros for uart port, speed and IO frequency.
This commit is contained in:
parent
02fe8590fd
commit
250a191260
4 changed files with 35 additions and 27 deletions
|
|
@ -43,6 +43,10 @@
|
|||
#define EEPROM_SIZE 48
|
||||
#define EEPROM_MACADDR_OFFSET 2
|
||||
|
||||
/* used if there is no FDT */
|
||||
#define BOARD_CONSOLE_SPEED 115200
|
||||
#define BOARD_CONSOLE_UART 0
|
||||
|
||||
/*
|
||||
* EVP board CPLD chip select and daughter card info field
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
/*-
|
||||
* Copyright (c) 2011 Netlogic Microsystems Inc.
|
||||
*
|
||||
* (based on dev/uart/uart_bus_pci.c)
|
||||
* Copyright (c) 2006 Marcel Moolenaar
|
||||
* Copyright (c) 2001 M. Warner Losh
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2003-2012 Broadcom Corporation
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BROADCOM ``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 BROADCOM OR CONTRIBUTORS 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>
|
||||
|
|
@ -56,7 +55,8 @@ static device_method_t uart_soc_methods[] = {
|
|||
DEVMETHOD(device_probe, uart_soc_probe),
|
||||
DEVMETHOD(device_attach, uart_bus_attach),
|
||||
DEVMETHOD(device_detach, uart_bus_detach),
|
||||
{ 0, 0 }
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t uart_soc_driver = {
|
||||
|
|
@ -77,7 +77,7 @@ uart_soc_probe(device_t dev)
|
|||
sc = device_get_softc(dev);
|
||||
sc->sc_class = &uart_ns8250_class;
|
||||
device_set_desc(dev, "Netlogic SoC UART");
|
||||
return (uart_bus_probe(dev, 2, 133000000, 0, 0));
|
||||
return (uart_bus_probe(dev, 2, XLP_IO_CLK, 0, 0));
|
||||
}
|
||||
|
||||
DRIVER_MODULE(uart_soc, pci, uart_soc_driver, uart_devclass, 0, 0);
|
||||
|
|
@ -13,12 +13,13 @@ mips/nlm/board_eeprom.c standard
|
|||
mips/nlm/board_cpld.c standard
|
||||
mips/nlm/xlp_pci.c optional pci
|
||||
mips/nlm/intern_dev.c optional pci
|
||||
mips/nlm/uart_pci_xlp.c optional uart
|
||||
mips/nlm/uart_cpu_xlp.c optional uart
|
||||
mips/nlm/usb_init.c optional usb
|
||||
#
|
||||
# Network driver and micro-core code
|
||||
# Simple SoC devices
|
||||
mips/nlm/dev/uart_pci_xlp.c optional uart
|
||||
#
|
||||
# Network driver and micro-core code
|
||||
mips/nlm/dev/net/nae.c optional xlpge
|
||||
mips/nlm/dev/net/mdio.c optional xlpge
|
||||
mips/nlm/dev/net/sgmii.c optional xlpge
|
||||
|
|
|
|||
|
|
@ -58,15 +58,18 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#include <mips/nlm/hal/haldefs.h>
|
||||
#include <mips/nlm/hal/iomap.h>
|
||||
#include <mips/nlm/hal/mips-extns.h>
|
||||
#include <mips/nlm/hal/uart.h>
|
||||
|
||||
#include <mips/nlm/board.h>
|
||||
|
||||
bus_space_tag_t uart_bus_space_io;
|
||||
bus_space_tag_t uart_bus_space_mem;
|
||||
|
||||
int
|
||||
uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
|
||||
{
|
||||
return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0);
|
||||
return (b1->bsh == b2->bsh && b1->bst == b2->bst);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -75,12 +78,12 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||
di->ops = uart_getops(&uart_ns8250_class);
|
||||
di->bas.chan = 0;
|
||||
di->bas.bst = rmi_uart_bus_space;
|
||||
di->bas.bsh = nlm_get_uart_regbase(0, 0);
|
||||
di->bas.bsh = nlm_get_uart_regbase(0, BOARD_CONSOLE_UART);
|
||||
|
||||
di->bas.regshft = 2;
|
||||
/* divisor = rclk / (baudrate * 16); */
|
||||
di->bas.rclk = 133000000;
|
||||
di->baudrate = 115200;
|
||||
di->bas.rclk = XLP_IO_CLK;
|
||||
di->baudrate = BOARD_CONSOLE_SPEED;
|
||||
di->databits = 8;
|
||||
di->stopbits = 1;
|
||||
di->parity = UART_PARITY_NONE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue