Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/marvell Add support Marvell Sheeva Core and SoC...



details:   https://anonhg.NetBSD.org/src/rev/bb46ea00e595
branches:  trunk
changeset: 757913:bb46ea00e595
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sun Oct 03 05:49:24 2010 +0000

description:
Add support Marvell Sheeva Core and SoC. (Orion/Kirkwood)
  Discovery Innovation not yet.

diffstat:

 sys/arch/arm/marvell/files.marvell |   71 ++++
 sys/arch/arm/marvell/kirkwood.c    |  292 ++++++++++++++++
 sys/arch/arm/marvell/kirkwoodreg.h |  206 +++++++++++
 sys/arch/arm/marvell/mv78xx0reg.h  |  206 +++++++++++
 sys/arch/arm/marvell/mvsoc.c       |  649 +++++++++++++++++++++++++++++++++++++
 sys/arch/arm/marvell/mvsoc_dma.c   |   74 ++++
 sys/arch/arm/marvell/mvsoc_intr.c  |  153 ++++++++
 sys/arch/arm/marvell/mvsoc_intr.h  |   49 ++
 sys/arch/arm/marvell/mvsoc_space.c |  320 ++++++++++++++++++
 sys/arch/arm/marvell/mvsocgpp.c    |  455 +++++++++++++++++++++++++
 sys/arch/arm/marvell/mvsocgppreg.h |   67 +++
 sys/arch/arm/marvell/mvsocgppvar.h |   45 ++
 sys/arch/arm/marvell/mvsocreg.h    |  134 +++++++
 sys/arch/arm/marvell/mvsoctmr.c    |  305 +++++++++++++++++
 sys/arch/arm/marvell/mvsoctmrreg.h |   45 ++
 sys/arch/arm/marvell/mvsocvar.h    |   92 +++++
 sys/arch/arm/marvell/orion.c       |  257 ++++++++++++++
 sys/arch/arm/marvell/orionreg.h    |  206 +++++++++++
 sys/arch/arm/marvell/pci_machdep.c |  419 +++++++++++++++++++++++
 19 files changed, 4045 insertions(+), 0 deletions(-)

diffs (truncated from 4121 to 300 lines):

diff -r d9c47efa3ed0 -r bb46ea00e595 sys/arch/arm/marvell/files.marvell
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/marvell/files.marvell        Sun Oct 03 05:49:24 2010 +0000
@@ -0,0 +1,71 @@
+#       $NetBSD: files.marvell,v 1.1 2010/10/03 05:49:24 kiyohara Exp $
+#
+# Configuration info for Marvell System on Chip support
+#
+
+include "arch/arm/pic/files.pic"
+
+device mvsoc { [unit = -1], [offset = -1], [irq = -1] } : bus_space_generic, pic
+attach mvsoc at mainbus
+file   arch/arm/marvell/mvsoc.c                mvsoc
+file   arch/arm/marvell/mvsoc_space.c
+file   arch/arm/marvell/mvsoc_dma.c
+
+file   arch/arm/arm32/irq_dispatch.S
+
+defflag opt_mvsoc.h                            ORION KIRKWOOD MV78XX0
+file   arch/arm/marvell/mvsoc_intr.c
+file   arch/arm/marvell/orion.c                orion
+file   arch/arm/marvell/kirkwood.c             kirkwood
+#file  arch/arm/marvell/mv78xx0.c              mv78xx0
+
+
+# Integrated peripherals
+include "dev/marvell/files.discovery"
+
+# Timers
+device mvsoctmr
+attach mvsoctmr at mvsoc
+file   arch/arm/marvell/mvsoctmr.c             mvsoctmr
+
+
+# PCI Express Interface
+attach mvpex at mvsoc with mvpex_mbus
+
+# PCI Interface
+attach gtpci at mvsoc with gtpci_mbus
+
+file   arch/arm/marvell/pci_machdep.c          mvpex | gtpci
+
+device pchb
+attach pchb at pci
+file   dev/marvell/pchb.c                      pchb
+
+# Serial-ATA II Host Controller (SATAHC)
+attach mvsata at mvsoc with mvsata_mbus
+
+# Gigabit Ethernet Controller Interface
+attach mvgbec at mvsoc with mvgbec_mbus
+
+# USB 2.0 Interface
+attach ehci at mvsoc with mvusb_mbus
+
+# Cryptographic Engines and Security Accelerator
+attach mvcesa at mvsoc with mvcesa_mbus
+
+# TWSI Two-Wire Serial Interface
+attach gttwsi at mvsoc with gttwsi_mbus
+
+# UART Interface
+attach com at mvsoc with mvuart_mbus
+
+# IDMA Controller and XOR Engine
+attach gtidmac at mvsoc with gtidmac_mbus
+
+# General Purpose I/O Port Interface
+device mvsocgpp: gpiobus, pic
+attach mvsocgpp at mvsoc
+file   arch/arm/marvell/mvsocgpp.c             mvsocgpp        needs-flag
+
+# Secure Digital Input/Output (SDIO) Interface
+attach mvsdio at mvsoc with mvsdio_mbus
diff -r d9c47efa3ed0 -r bb46ea00e595 sys/arch/arm/marvell/kirkwood.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/marvell/kirkwood.c   Sun Oct 03 05:49:24 2010 +0000
@@ -0,0 +1,292 @@
+/*     $NetBSD: kirkwood.c,v 1.1 2010/10/03 05:49:24 kiyohara Exp $    */
+/*
+ * Copyright (c) 2010 KIYOHARA Takashi
+ * 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.1 2010/10/03 05:49:24 kiyohara Exp $");
+
+#define _INTR_PRIVATE
+
+#include "mvsocgpp.h"
+
+#include <sys/param.h>
+#include <sys/bus.h>
+
+#include <machine/intr.h>
+
+#include <arm/pic/picvar.h>
+#include <arm/pic/picvar.h>
+
+#include <arm/marvell/mvsocreg.h>
+#include <arm/marvell/mvsocvar.h>
+#include <arm/marvell/kirkwoodreg.h>
+
+#include <dev/marvell/marvellreg.h>
+
+
+static void kirkwood_intr_init(void);
+
+static void kirkwood_pic_unblock_low_irqs(struct pic_softc *, size_t, uint32_t);
+static void kirkwood_pic_unblock_high_irqs(struct pic_softc *, size_t,
+                                          uint32_t);
+static void kirkwood_pic_block_low_irqs(struct pic_softc *, size_t, uint32_t);
+static void kirkwood_pic_block_high_irqs(struct pic_softc *, size_t, uint32_t);
+static int kirkwood_pic_find_pending_high_irqs(struct pic_softc *);
+static void kirkwood_pic_establish_irq(struct pic_softc *, struct intrsource *);
+static void kirkwood_pic_source_name(struct pic_softc *, int, char *, size_t);
+
+static int kirkwood_find_pending_irqs(void);
+
+static const char * const sources[64] = {
+    "MainHighSum(0)",  "Bridge(1)",       "Host2CPU DB(2)",  "CPU2Host DB(3)",
+    "Reserved_4(4)",   "Xor0Chan0(5)",    "Xor0Chan1(6)",    "Xor1Chan0(7)",
+    "Xor1Chan1(8)",    "PEX0INT(9)",      "Reserved(10)",    "GbE0Sum(11)",
+    "GbE0Rx(12)",      "GbE0Tx(13)",      "GbE0Misc(14)",    "GbE1Sum(15)",
+    "GbE1Rx(16)",      "GbE1Tx(17)",      "GbE1Misc(18)",    "USB0Cnt(19)",
+    "Reserved(20)",    "Sata(21)",        "SecurityInt(22)", "SPIInt(23)",
+    "AudioINT(24)",    "Reserved(25)",    "TS0Int(26)",      "Reserved(27)",
+    "SDIOInt(28)",     "TWSI(29)",        "AVBInt(30)",      "TDMInt(31)"
+
+    "Reserved(32)",    "Uart0Int(33)",    "Uart1Int(34)",    "GPIOLo7_0(35)"
+    "GPIOLo8_15(36)",  "GPIOLo16_23(37)", "GPIOLo24_31(38)", "GPIOHi7_0(39)"
+    "GPIOHi8_15(40)",  "GPIOHi16_23(41)", "XOR0Err(42)",     "XOR1Err(43)"
+    "PEX0Err(44)",     "Reserved(45)",    "GbE0Err(46)",     "GbE1Err(47)"
+    "USBErr(48)",      "SecurityErr(49)", "AudioErr(50)",    "Reserved(51)"
+    "Reserved(52)",    "RTCInt(53)",      "Reserved(54)",    "Reserved(55)"
+    "Reserved(56)",    "Reserved(57)",    "Reserved(58)",    "Reserved(59)"
+    "Reserved(60)",    "Reserved(61)",    "Reserved(62)",    "Reserved(63)"
+};
+
+static struct pic_ops kirkwood_picops_low = {
+       .pic_unblock_irqs = kirkwood_pic_unblock_low_irqs,
+       .pic_block_irqs = kirkwood_pic_block_low_irqs,
+       .pic_establish_irq = kirkwood_pic_establish_irq,
+       .pic_source_name = kirkwood_pic_source_name,
+};
+static struct pic_ops kirkwood_picops_high = {
+       .pic_unblock_irqs = kirkwood_pic_unblock_high_irqs,
+       .pic_block_irqs = kirkwood_pic_block_high_irqs,
+       .pic_find_pending_irqs = kirkwood_pic_find_pending_high_irqs,
+       .pic_establish_irq = kirkwood_pic_establish_irq,
+       .pic_source_name = kirkwood_pic_source_name,
+};
+static struct pic_softc kirkwood_pic_low = {
+       .pic_ops = &kirkwood_picops_low,
+       .pic_maxsources = 32,
+       .pic_name = "kirkwood_low",
+};
+static struct pic_softc kirkwood_pic_high = {
+       .pic_ops = &kirkwood_picops_high,
+       .pic_maxsources = 32,
+       .pic_name = "kirkwood_high",
+};
+
+
+/*
+ * kirkwood_intr_bootstrap:
+ *
+ *     Initialize the rest of the interrupt subsystem, making it
+ *     ready to handle interrupts from devices.
+ */
+void
+kirkwood_intr_bootstrap(void)
+{
+       extern void (*mvsoc_intr_init)(void);
+
+       /* disable all interrupts */
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR, 0);
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR, 0);
+
+       /* disable all bridge interrupts */
+       write_mlmbreg(MVSOC_MLMB_MLMBIMR, 0);
+
+       mvsoc_intr_init = kirkwood_intr_init;
+
+#if NMVSOCGPP > 0
+       switch (mvsoc_model()) {
+       case MARVELL_KIRKWOOD_88F6180: gpp_npins = 30; break;
+       case MARVELL_KIRKWOOD_88F6192: gpp_npins = 36; break;
+       case MARVELL_KIRKWOOD_88F6281: gpp_npins = 50; break;
+       }
+       gpp_irqbase = 96;       /* Main Low(32) + High(32) + Bridge(32) */
+#endif
+}
+
+static void
+kirkwood_intr_init(void)
+{
+       extern struct pic_softc mvsoc_bridge_pic;
+       void *ih;
+
+       pic_add(&kirkwood_pic_low, 0);
+
+       pic_add(&kirkwood_pic_high, 32);
+       ih = intr_establish(KIRKWOOD_IRQ_HIGH, IPL_HIGH, IST_LEVEL_HIGH,
+           pic_handle_intr, &kirkwood_pic_high);
+       KASSERT(ih != NULL);
+
+       pic_add(&mvsoc_bridge_pic, 64);
+       ih = intr_establish(KIRKWOOD_IRQ_BRIDGE, IPL_HIGH, IST_LEVEL_HIGH,
+           pic_handle_intr, &mvsoc_bridge_pic);
+       KASSERT(ih != NULL);
+
+       find_pending_irqs = kirkwood_find_pending_irqs;
+}
+
+/* ARGSUSED */
+static void
+kirkwood_pic_unblock_low_irqs(struct pic_softc *pic, size_t irqbase,
+                             uint32_t irq_mask)
+{
+
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR,
+           read_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR) | irq_mask);
+}
+
+/* ARGSUSED */
+static void
+kirkwood_pic_unblock_high_irqs(struct pic_softc *pic, size_t irqbase,
+                              uint32_t irq_mask)
+{
+
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR,
+           read_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR) | irq_mask);
+}
+
+/* ARGSUSED */
+static void
+kirkwood_pic_block_low_irqs(struct pic_softc *pic, size_t irqbase,
+                           uint32_t irq_mask)
+{
+
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR,
+           read_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR) & ~irq_mask);
+}
+
+/* ARGSUSED */
+static void
+kirkwood_pic_block_high_irqs(struct pic_softc *pic, size_t irqbase,
+                            uint32_t irq_mask)
+{
+
+       write_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR,
+           read_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR) & ~irq_mask);
+}
+
+static int
+kirkwood_pic_find_pending_high_irqs(struct pic_softc *pic)
+{
+       uint32_t pending;
+
+       pending = read_mlmbreg(KIRKWOOD_MLMB_MICHR) &
+           read_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR);
+       if (pending == 0)
+               return 0;
+       pic_mark_pending_sources(pic, 0, pending);
+       return 1;
+}
+
+/* ARGSUSED */
+static void
+kirkwood_pic_establish_irq(struct pic_softc *pic, struct intrsource *is)
+{
+       /* Nothing */
+}
+
+static void
+kirkwood_pic_source_name(struct pic_softc *pic, int irq, char *buf, size_t len)
+{



Home | Main Index | Thread Index | Old Index