Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Support MV64361 on PegasosII by gt(4).
details: https://anonhg.NetBSD.org/src/rev/78808a8d79e3
branches: trunk
changeset: 755547:78808a8d79e3
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Wed Jun 09 04:41:42 2010 +0000
description:
Support MV64361 on PegasosII by gt(4).
+ Support gtpci@gt instead of pegasospci more smartly.
+ Support Gigabit Ethernet by mvgbe@gt.
diffstat:
sys/arch/ofppc/conf/GENERIC | 12 +-
sys/arch/ofppc/conf/files.ofppc | 10 +-
sys/arch/ofppc/include/pegasosreg.h | 14 +-
sys/arch/ofppc/ofppc/mainbus.c | 20 +-
sys/arch/ofppc/pci/gt_mainbus.c | 316 ++++++++++++++++++++++++++++++++++++
sys/arch/ofppc/pci/pegasospci.c | 273 -------------------------------
sys/arch/powerpc/oea/ofw_autoconf.c | 111 ++++++++++++-
7 files changed, 458 insertions(+), 298 deletions(-)
diffs (truncated from 895 to 300 lines):
diff -r 226aaf5379ad -r 78808a8d79e3 sys/arch/ofppc/conf/GENERIC
--- a/sys/arch/ofppc/conf/GENERIC Wed Jun 09 04:20:10 2010 +0000
+++ b/sys/arch/ofppc/conf/GENERIC Wed Jun 09 04:41:42 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.129 2010/05/08 22:16:29 mrg Exp $
+# $NetBSD: GENERIC,v 1.130 2010/06/09 04:41:42 kiyohara Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.129 $"
+#ident "GENERIC-$Revision: 1.130 $"
maxusers 32
@@ -180,11 +180,15 @@
# Generic OpenFirmware console support
rtas* at mainbus?
+gt* at mainbus? # Marvell MV64361 Discovery II
+mvgbec* at gt? offset ? # Gigabit Ethernet
+mvgbe0 at mvgbec? port 1 irq 9
+
# PCI root nodes
ofwpci* at mainbus?
pci* at ofwpci? bus ?
-pegasospci* at mainbus?
-pci* at pegasospci? bus ?
+gtpci* at gt? unit ?
+pci* at gtpci? bus ?
# PCI bridges
pchb* at pci? dev ? function ?
diff -r 226aaf5379ad -r 78808a8d79e3 sys/arch/ofppc/conf/files.ofppc
--- a/sys/arch/ofppc/conf/files.ofppc Wed Jun 09 04:20:10 2010 +0000
+++ b/sys/arch/ofppc/conf/files.ofppc Wed Jun 09 04:41:42 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.ofppc,v 1.41 2010/03/14 10:14:14 kiyohara Exp $
+# $NetBSD: files.ofppc,v 1.42 2010/06/09 04:41:42 kiyohara Exp $
#
# NetBSD/ofppc configuration info
#
@@ -89,9 +89,11 @@
attach ofwpci at mainbus
file arch/ofppc/pci/ofwpci.c ofwpci
-device pegasospci: pcibus
-attach pegasospci at mainbus
-file arch/ofppc/pci/pegasospci.c pegasospci
+# Marvell System-Controller MV64361(Discovery II) (on PegasosII)
+include "dev/marvell/files.discovery"
+attach gt at mainbus
+file arch/ofppc/pci/gt_mainbus.c gt
+file arch/powerpc/marvell/pci_machdep.c gtpci
device pchb: pcibus
attach pchb at pci
diff -r 226aaf5379ad -r 78808a8d79e3 sys/arch/ofppc/include/pegasosreg.h
--- a/sys/arch/ofppc/include/pegasosreg.h Wed Jun 09 04:20:10 2010 +0000
+++ b/sys/arch/ofppc/include/pegasosreg.h Wed Jun 09 04:41:42 2010 +0000
@@ -1,20 +1,10 @@
-/* $NetBSD: pegasosreg.h,v 1.1 2007/11/04 17:07:10 garbled Exp $ */
+/* $NetBSD: pegasosreg.h,v 1.2 2010/06/09 04:41:42 kiyohara Exp $ */
#ifndef _MACHINE_PEGASOSREG_H_
#define _MACHINE_PEGASOSREG_H_
-#define PEGASOS2_MARVELL_REGBASE 0xf1000000
-#define PEGASOS2_MARVELL_REGSIZE 0x4000
+#define PEGASOS2_GT_REGBASE 0xf1000000
#define PEGASOS2_SRAM_BASE 0xf2000000
#define PEGASOS2_SRAM_SIZE 0x40000
-#define PEGASOS2_PCI0_ADDR (PEGASOS2_MARVELL_REGBASE | 0xc78)
-#define PEGASOS2_PCI0_DATA (PEGASOS2_MARVELL_REGBASE | 0xc7c)
-
-#define PEGASOS2_PCI1_ADDR (PEGASOS2_MARVELL_REGBASE | 0xcf8)
-#define PEGASOS2_PCI1_DATA (PEGASOS2_MARVELL_REGBASE | 0xcfc)
-#define PEGASOS2_AGP_MAGIC (PEGASOS2_MARVELL_REGBASE | 0xf118)
-
-#define PEGASOS2_AGP_MAGIC_COOKIE 0x00800000
-
#endif /*_MACHINE_PEGASOSREG_H_*/
diff -r 226aaf5379ad -r 78808a8d79e3 sys/arch/ofppc/ofppc/mainbus.c
--- a/sys/arch/ofppc/ofppc/mainbus.c Wed Jun 09 04:20:10 2010 +0000
+++ b/sys/arch/ofppc/ofppc/mainbus.c Wed Jun 09 04:41:42 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.25 2010/03/10 18:06:57 kiyohara Exp $ */
+/* $NetBSD: mainbus.c,v 1.26 2010/06/09 04:41:42 kiyohara Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2010/03/10 18:06:57 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.26 2010/06/09 04:41:42 kiyohara Exp $");
#include "opt_interrupt.h"
#include "opt_multiprocessor.h"
@@ -260,6 +260,18 @@
config_found(self, &oba, NULL);
}
+ if (strcmp(model_name, "Pegasos2") == 0) {
+ /*
+ * Configure to System Controller MV64361.
+ * And skip other devices. These attached from it.
+ */
+ ca.ca_name = "gt";
+
+ config_found(self, &ca, NULL);
+
+ goto config_fin;
+ }
+
/* this primarily searches for pci bridges on the root bus */
for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) {
memset(name, 0, sizeof(name));
@@ -273,9 +285,11 @@
ca.ca_node = node;
ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg));
ca.ca_reg = reg;
- config_found(self, &ca, NULL);
+ config_found(self, &ca, NULL);
}
+
+config_fin:
pic_finish_setup();
}
diff -r 226aaf5379ad -r 78808a8d79e3 sys/arch/ofppc/pci/gt_mainbus.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/ofppc/pci/gt_mainbus.c Wed Jun 09 04:41:42 2010 +0000
@@ -0,0 +1,316 @@
+/* $NetBSD: gt_mainbus.c,v 1.1 2010/06/09 04:41:42 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: gt_mainbus.c,v 1.1 2010/06/09 04:41:42 kiyohara Exp $");
+
+#include "opt_pci.h"
+#include "opt_marvell.h"
+#include "gtpci.h"
+#include "pci.h"
+#include "isa.h"
+
+#define _POWERPC_BUS_DMA_PRIVATE
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/extent.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/isa_machdep.h>
+#include <machine/pegasosreg.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pciconf.h>
+
+#include <dev/marvell/gtreg.h>
+#include <dev/marvell/gtvar.h>
+#include <dev/marvell/gtpcireg.h>
+#include <dev/marvell/gtpcivar.h>
+#include <dev/marvell/marvellvar.h>
+#include <dev/ofw/openfirm.h>
+
+
+static int gt_match(device_t, cfdata_t, void *);
+static void gt_attach(device_t, device_t, void *);
+
+#if NGTPCI > 0
+static void gtpci_md_attach_hook(device_t, device_t,
+ struct pcibus_attach_args *);
+void gtpci_md_conf_interrupt(void *, int, int, int, int, int *);
+int gtpci_md_conf_hook(void *, int, int, int, pcireg_t);
+#endif
+
+CFATTACH_DECL_NEW(gt, sizeof(struct gt_softc), gt_match, gt_attach, NULL, NULL);
+
+static struct powerpc_bus_space pegasosii_gt_bs_tag = {
+ .pbs_offset = PEGASOS2_GT_REGBASE,
+ .pbs_base = 0x00000000,
+ .pbs_limit = GT_SIZE,
+};
+static char ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
+ __attribute__((aligned(8)));
+
+struct powerpc_bus_dma_tag pegasosii_bus_dma_tag = {
+ 0, /* _bounce_thresh */
+ _bus_dmamap_create,
+ _bus_dmamap_destroy,
+ _bus_dmamap_load,
+ _bus_dmamap_load_mbuf,
+ _bus_dmamap_load_uio,
+ _bus_dmamap_load_raw,
+ _bus_dmamap_unload,
+ _bus_dmamap_sync,
+ _bus_dmamem_alloc,
+ _bus_dmamem_free,
+ _bus_dmamem_map,
+ _bus_dmamem_unmap,
+ _bus_dmamem_mmap,
+};
+
+#if NGTPCI > 0
+struct powerpc_bus_space
+ gtpci0_io_bs_tag, gtpci0_mem_bs_tag,
+ gtpci1_io_bs_tag, gtpci1_mem_bs_tag;
+#endif
+
+struct gtpci_prot gtpci0_prot = {
+ GTPCI_ACBL_RDSIZE_32BYTE |
+ GTPCI_ACBL_RDMBURST_32BYTE |
+ GTPCI_ACBL_PCISWAP_BYTESWAP |
+ GTPCI_ACBL_SNOOP_WB |
+ GTPCI_ACBL_EN,
+ 0,
+}, gtpci1_prot = {
+ GTPCI_ACBL_RDSIZE_128BYTE |
+ GTPCI_ACBL_RDMBURST_32BYTE |
+ GTPCI_ACBL_PCISWAP_BYTESWAP |
+ GTPCI_ACBL_SNOOP_WB |
+ GTPCI_ACBL_EN,
+ 0,
+};
+
+
+int
+gt_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct confargs *ca = aux;
+ int node, pci, ethernet;
+ char name[32];
+
+ if (strcmp(ca->ca_name, "gt") != 0 ||
+ strcmp(model_name, "Pegasos2") != 0)
+ return 0;
+
+ /* Paranoid check... */
+
+ pci = ethernet = 0;
+ for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) {
+ memset(name, 0, sizeof(name));
+ if (OF_getprop(node, "name", name, sizeof(name)) == -1)
+ continue;
+ if (strcmp(name, "pci") == 0)
+ pci++;
+ else if (strcmp(name, "ethernet") == 0)
+ ethernet++;
+
+ }
+ if (pci == 2 && ethernet == 1)
+ return 1;
+ return 0;
+}
+
+/* ARGSUSED */
+void
+gt_attach(device_t parent, device_t self, void *aux)
+{
+ struct gt_softc *sc = device_private(self);
+#if NGTPCI > 0
+ uint32_t busrange[2];
+ int node;
+ extern struct genppc_pci_chipset
+ genppc_gtpci0_chipset, genppc_gtpci1_chipset;
+#endif
Home |
Main Index |
Thread Index |
Old Index