summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2012-03-27 14:48:40 +0000
committerjchandra <jchandra@FreeBSD.org>2012-03-27 14:48:40 +0000
commit126e29ce5f4fb39d333b4d155af4acb71eeb38e4 (patch)
tree610a6c247d1ef1145d6b2b7ddc4ae771b61da5aa /sys/mips
parent9fc8d42e62520327401d5e4d47a5f915bd81e4e4 (diff)
downloadFreeBSD-src-126e29ce5f4fb39d333b4d155af4acb71eeb38e4.zip
FreeBSD-src-126e29ce5f4fb39d333b4d155af4acb71eeb38e4.tar.gz
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.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/nlm/board.h4
-rw-r--r--sys/mips/nlm/dev/uart_pci_xlp.c (renamed from sys/mips/nlm/uart_pci_xlp.c)42
-rw-r--r--sys/mips/nlm/files.xlp5
-rw-r--r--sys/mips/nlm/uart_cpu_xlp.c11
4 files changed, 35 insertions, 27 deletions
diff --git a/sys/mips/nlm/board.h b/sys/mips/nlm/board.h
index 4ef4b37..859a654 100644
--- a/sys/mips/nlm/board.h
+++ b/sys/mips/nlm/board.h
@@ -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
*/
diff --git a/sys/mips/nlm/uart_pci_xlp.c b/sys/mips/nlm/dev/uart_pci_xlp.c
index 4f75081..369972e 100644
--- a/sys/mips/nlm/uart_pci_xlp.c
+++ b/sys/mips/nlm/dev/uart_pci_xlp.c
@@ -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);
diff --git a/sys/mips/nlm/files.xlp b/sys/mips/nlm/files.xlp
index fd2e0d0..a7703a9 100644
--- a/sys/mips/nlm/files.xlp
+++ b/sys/mips/nlm/files.xlp
@@ -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
diff --git a/sys/mips/nlm/uart_cpu_xlp.c b/sys/mips/nlm/uart_cpu_xlp.c
index 2e6daf4..1607e91 100644
--- a/sys/mips/nlm/uart_cpu_xlp.c
+++ b/sys/mips/nlm/uart_cpu_xlp.c
@@ -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;
OpenPOWER on IntegriCloud