Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Work-in-progress Odroid-C1 support.
details: https://anonhg.NetBSD.org/src/rev/34d6ae438016
branches: trunk
changeset: 336032:34d6ae438016
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Feb 07 17:20:16 2015 +0000
description:
Work-in-progress Odroid-C1 support.
diffstat:
sys/arch/arm/amlogic/amlogic_board.c | 65 +++
sys/arch/arm/amlogic/amlogic_com.c | 121 ++++++
sys/arch/arm/amlogic/amlogic_comreg.h | 42 ++
sys/arch/arm/amlogic/amlogic_intr.h | 41 ++
sys/arch/arm/amlogic/amlogic_io.c | 121 ++++++
sys/arch/arm/amlogic/amlogic_reg.h | 48 ++
sys/arch/arm/amlogic/amlogic_space.c | 425 +++++++++++++++++++++
sys/arch/arm/amlogic/amlogic_var.h | 59 ++
sys/arch/arm/amlogic/files.amlogic | 33 +
sys/arch/evbarm/amlogic/amlogic_machdep.c | 596 ++++++++++++++++++++++++++++++
sys/arch/evbarm/amlogic/amlogic_start.S | 318 ++++++++++++++++
sys/arch/evbarm/amlogic/genassym.cf | 37 +
sys/arch/evbarm/amlogic/platform.h | 39 +
sys/arch/evbarm/conf/ODROID-C1 | 199 ++++++++++
sys/arch/evbarm/conf/files.amlogic | 10 +
sys/arch/evbarm/conf/mk.amlogic | 33 +
sys/arch/evbarm/conf/std.amlogic | 29 +
17 files changed, 2216 insertions(+), 0 deletions(-)
diffs (truncated from 2284 to 300 lines):
diff -r 0e5eb22528fc -r 34d6ae438016 sys/arch/arm/amlogic/amlogic_board.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/amlogic/amlogic_board.c Sat Feb 07 17:20:16 2015 +0000
@@ -0,0 +1,65 @@
+/* $NetBSD: amlogic_board.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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.
+ */
+
+#include "opt_amlogic.h"
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: amlogic_board.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $");
+
+#define _ARM32_BUS_DMA_PRIVATE
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/cpu.h>
+#include <sys/device.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <arm/bootconfig.h>
+#include <arm/cpufunc.h>
+
+#include <arm/amlogic/amlogic_reg.h>
+#include <arm/amlogic/amlogic_var.h>
+
+bus_space_handle_t amlogic_core_bsh;
+
+struct arm32_bus_dma_tag amlogic_dma_tag = {
+ _BUS_DMAMAP_FUNCS,
+ _BUS_DMAMEM_FUNCS,
+ _BUS_DMATAG_FUNCS,
+};
+
+void
+amlogic_bootstrap(void)
+{
+ int error;
+
+ error = bus_space_map(&amlogic_bs_tag, AMLOGIC_CORE_BASE,
+ AMLOGIC_CORE_SIZE, 0, &amlogic_core_bsh);
+ if (error)
+ panic("%s: failed to map CORE registers: %d", __func__, error);
+}
diff -r 0e5eb22528fc -r 34d6ae438016 sys/arch/arm/amlogic/amlogic_com.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/amlogic/amlogic_com.c Sat Feb 07 17:20:16 2015 +0000
@@ -0,0 +1,121 @@
+/* $NetBSD: amlogic_com.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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 "locators.h"
+
+#include <sys/cdefs.h>
+
+__KERNEL_RCSID(1, "$NetBSD: amlogic_com.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/device.h>
+#include <sys/intr.h>
+#include <sys/systm.h>
+#include <sys/time.h>
+#include <sys/termios.h>
+
+#include <arm/amlogic/amlogic_reg.h>
+#include <arm/amlogic/amlogic_var.h>
+
+#include <dev/ic/comvar.h>
+
+static int amlogic_com_match(device_t, cfdata_t, void *);
+static void amlogic_com_attach(device_t, device_t, void *);
+
+struct amlogic_com_softc {
+ struct com_softc asc_sc;
+ void *asc_ih;
+};
+
+CFATTACH_DECL_NEW(amlogic_com, sizeof(struct amlogic_com_softc),
+ amlogic_com_match, amlogic_com_attach, NULL, NULL);
+
+static int amlogic_com_ports;
+
+static int
+amlogic_com_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct amlogicio_attach_args * const aio = aux;
+ const struct amlogic_locators * const loc = &aio->aio_loc;
+ bus_space_tag_t iot = aio->aio_core_a4x_bst;
+ bus_space_handle_t bsh;
+
+ KASSERT(!strcmp(cf->cf_name, loc->loc_name));
+ KASSERT((amlogic_com_ports & __BIT(loc->loc_port)) == 0);
+ KASSERT(cf->cf_loc[AMLOGICIOCF_PORT] == AMLOGICIOCF_PORT_DEFAULT
+ || cf->cf_loc[AMLOGICIOCF_PORT] == loc->loc_port);
+
+ if (com_is_console(iot, AMLOGIC_CORE_BASE + loc->loc_offset, NULL))
+ return 1;
+
+ bus_space_subregion(iot, aio->aio_bsh,
+ loc->loc_offset, loc->loc_size, &bsh);
+
+ const int rv = comprobe1(iot, bsh);
+
+ return rv;
+}
+
+static void
+amlogic_com_attach(device_t parent, device_t self, void *aux)
+{
+ struct amlogic_com_softc * const asc = device_private(self);
+ struct com_softc * const sc = &asc->asc_sc;
+ struct amlogicio_attach_args * const aio = aux;
+ const struct amlogic_locators * const loc = &aio->aio_loc;
+ bus_space_tag_t iot = aio->aio_core_a4x_bst;
+ const bus_addr_t iobase = AMLOGIC_CORE_BASE + loc->loc_offset;
+ bus_space_handle_t ioh;
+
+ amlogic_com_ports |= __BIT(loc->loc_port);
+
+ sc->sc_dev = self;
+ sc->sc_frequency = AMLOGIC_UART_FREQ;
+ sc->sc_type = COM_TYPE_NORMAL;
+
+ if (com_is_console(iot, iobase, &ioh) == 0
+ && bus_space_subregion(iot, aio->aio_bsh,
+ loc->loc_offset / 4, loc->loc_size, &ioh)) {
+ panic(": can't map registers");
+ }
+ COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);
+
+ com_attach_subr(sc);
+ aprint_naive("\n");
+
+ KASSERT(loc->loc_intr != AMLOGICIO_INTR_DEFAULT);
+ asc->asc_ih = intr_establish(loc->loc_intr, IPL_SERIAL,
+ IST_EDGE | IST_MPSAFE, comintr, sc);
+ if (asc->asc_ih == NULL)
+ panic("%s: failed to establish interrupt %d",
+ device_xname(self), loc->loc_intr);
+}
diff -r 0e5eb22528fc -r 34d6ae438016 sys/arch/arm/amlogic/amlogic_comreg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/amlogic/amlogic_comreg.h Sat Feb 07 17:20:16 2015 +0000
@@ -0,0 +1,42 @@
+/* $NetBSD: amlogic_comreg.h,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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.
+ */
+
+#ifndef _ARM_AMLOGIC_COMREG_H
+#define _ARM_AMLOGIC_COMREG_H
+
+#define UART_WFIFO_REG 0x00
+#define UART_RFIFO_REG 0x04
+#define UART_CONTROL_REG 0x08
+#define UART_STATUS_REG 0x0c
+#define UART_MISC_REG 0x10
+#define UART_REG5_REG 0x14
+
+#define UART_STATUS_TX_BUSY __BIT(25)
+#define UART_STATUS_TX_EMPTY __BIT(22)
+
+#endif /* _ARM_AMLOGIC_COMREG_H */
diff -r 0e5eb22528fc -r 34d6ae438016 sys/arch/arm/amlogic/amlogic_intr.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/amlogic/amlogic_intr.h Sat Feb 07 17:20:16 2015 +0000
@@ -0,0 +1,41 @@
+/* $NetBSD: amlogic_intr.h,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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.
+ */
+
+#ifndef _ARM_AMLOGIC_INTR_H
+#define _ARM_AMLOGIC_INTR_H
+
+#define PIC_MAXSOURCES 224
+#define PIC_MAXMAXSOURCES 256
+
+#include <arm/cortex/gic_intr.h>
+#include <arm/cortex/a9tmr_intr.h>
+
+#define AMLOGIC_INTR_UART2AO 70
+#define AMLOGIC_INTR_UART0AO 122
+
+#endif /* _ARM_AMLOGIC_INTR_H */
diff -r 0e5eb22528fc -r 34d6ae438016 sys/arch/arm/amlogic/amlogic_io.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/amlogic/amlogic_io.c Sat Feb 07 17:20:16 2015 +0000
@@ -0,0 +1,121 @@
+/* $NetBSD: amlogic_io.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * 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.
Home |
Main Index |
Thread Index |
Old Index