Date: Fri, 03 Aug 2012 09:49:59 -0600 From: Ian Lepore <freebsd@damnhippie.dyndns.org> To: freebsd-arm@freebsd.org Subject: Complete patchset to support DreamPlug on Freebsd 8.x Message-ID: <1344008999.10571.8.camel@revolution.hippie.lan>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Here is a complete patchset for running freebsd 8.x on a dreamplug.
I've verified that you can check out a clean 8.3-RELEASE or 8-stable
tree, apply this patchset, and end up with a bootable dreamplug with
SATA, USB, and both ethernet ports working.
The kernel config file is pre-set for nfs root using bootp config, but
contains several alternate ROOTDEVNAME lines that can be un-commented to
use a filesystem on a usb or sata drive as root.
(Note that this doesn't contain the fix for the disabled-icache-pages
bug, because that's not a dreamplug-specific thing; I'll post that
separately when it's ready.)
-- Ian
[-- Attachment #2 --]
Add support to 8.x for GlobalScale Technologies DreamPlug units.
diff -r f782e529a926 -r 48d067ff170d sys/arm/conf/DREAMPLUG
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ sys/arm/conf/DREAMPLUG Fri Aug 03 09:09:39 2012 -0600
@@ -0,0 +1,96 @@
+#
+# Custom kernel for GlobalScale Technologies DreamPlug units.
+#
+# $FreeBSD: $
+#
+
+ident DREAMPLUG
+include "../mv/kirkwood/std.dreamplug"
+
+options SOC_MV_KIRKWOOD
+makeoptions MODULES_OVERRIDE=""
+
+# Enable these options for nfs root configured via BOOTP.
+options BOOTP
+options BOOTP_NFSROOT
+options BOOTP_NFSV3
+options BOOTP_WIRED_TO=mge0
+
+# If not using BOOTP, use something like one of these...
+#options ROOTDEVNAME=\"ufs:/dev/da0a\"
+#options ROOTDEVNAME=\"ufs:/dev/da0s1a\"
+#options ROOTDEVNAME=\"ufs:/dev/da0p10\"
+#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\"
+
+options SCHED_4BSD #4BSD scheduler
+options INET #InterNETworking
+options INET6 #IPv6 communications protocols
+options FFS #Berkeley Fast Filesystem
+
+options NFSCLIENT #Network Filesystem Client
+options NFSLOCKD #Network Lock Manager
+options NFS_ROOT #NFS usable as /, requires NFSCLIENT
+
+options SYSVSHM #SYSV-style shared memory
+options SYSVMSG #SYSV-style message queues
+options SYSVSEM #SYSV-style semaphores
+options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options MUTEX_NOINLINE
+options RWLOCK_NOINLINE
+options NO_FFS_SNAPSHOT
+options NO_SWAPPING
+
+options GEOM_PART_GPT
+options GEOM_PART_MBR
+
+# Debugging
+#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
+options BREAK_TO_DEBUGGER
+options ALT_BREAK_TO_DEBUGGER
+options DDB
+options KDB
+#options DIAGNOSTIC
+#options INVARIANTS #Enable calls of extra sanity checking
+#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS
+#options WITNESS #Enable checks to detect deadlocks and cycles
+#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed
+#options WITNESS_KDB
+
+# Pseudo devices
+device loop
+device md
+device pty
+device random
+
+# cam support for umass and ahci
+device scbus
+device pass
+device da
+
+# Onboard hardware from here down...
+device pci
+
+# Serial ports
+device uart
+
+# Networking
+device ether
+device mge # Marvell Gigabit Ethernet controller
+device mii
+device e1000phy
+device bpf
+
+# USB
+#options USB_DEBUG # enable debug msgs
+device usb
+device ehci
+device umass
+
+# I2C (TWSI)
+device iic
+device iicbus
+
+# SATA
+device mvs
+device ahci
+
diff -r f782e529a926 -r 48d067ff170d sys/arm/mv/common.c
--- sys/arm/mv/common.c Fri Aug 03 07:24:13 2012 -0600
+++ sys/arm/mv/common.c Fri Aug 03 09:09:39 2012 -0600
@@ -307,7 +307,7 @@ soc_decode_win(void)
decode_win_cpu_setup();
decode_win_usb_setup();
decode_win_eth_setup(MV_ETH0_BASE);
- if (dev == MV_DEV_MV78100 || dev == MV_DEV_MV78100_Z0)
+ if (dev == MV_DEV_MV78100 || dev == MV_DEV_MV78100_Z0 || dev == MV_DEV_88F6281)
decode_win_eth_setup(MV_ETH1_BASE);
if (dev == MV_DEV_88F6281 || dev == MV_DEV_MV78100 ||
dev == MV_DEV_MV78100_Z0)
diff -r f782e529a926 -r 48d067ff170d sys/arm/mv/kirkwood/dreamplug.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ sys/arm/mv/kirkwood/dreamplug.c Fri Aug 03 09:09:39 2012 -0600
@@ -0,0 +1,185 @@
+/*-
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
+ * All rights reserved.
+ *
+ * Developed by Semihalf.
+ *
+ * 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.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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>
+__FBSDID("$FreeBSD: $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
+#include <machine/bus.h>
+#include <machine/pte.h>
+#include <machine/pmap.h>
+#include <machine/vmparam.h>
+
+#include <arm/mv/mvreg.h>
+#include <arm/mv/mvvar.h>
+#include <arm/mv/mvwin.h>
+
+/*
+ * Virtual address space layout:
+ * -----------------------------
+ * 0x0000_0000 - 0xbfff_ffff : user process
+ *
+ * 0xc040_0000 - virtual_avail : kernel reserved (text, data, page tables
+ * : structures, ARM stacks etc.)
+ * virtual_avail - 0xefff_ffff : KVA (virtual_avail is typically < 0xc0a0_0000)
+ * 0xf000_0000 - 0xf0ff_ffff : no-cache allocation area (16MB)
+ * 0xf100_0000 - 0xf10f_ffff : SoC integrated devices registers range (1MB)
+ * 0xf110_0000 - 0xf11f_ffff : PCI-Express I/O space (1MB)
+ * 0xf120_0000 - 0xf12f_ffff : unused (1MB)
+ * 0xf130_0000 - 0xf52f_ffff : PCI-Express memory space (64MB)
+ * 0xf930_0000 - 0xfffe_ffff : unused (~172MB)
+ * 0xffff_0000 - 0xffff_0fff : 'high' vectors page (4KB)
+ * 0xffff_1000 - 0xffff_1fff : ARM_TP_ADDRESS/RAS page (4KB)
+ * 0xffff_2000 - 0xffff_ffff : unused (~55KB)
+ */
+
+/* Static device mappings. */
+const struct pmap_devmap pmap_devmap[] = {
+ /*
+ * Map the on-board devices VA == PA so that we can access them
+ * with the MMU on or off.
+ */
+ { /* SoC integrated peripherals registers range */
+ MV_BASE,
+ MV_PHYS_BASE,
+ MV_SIZE,
+ VM_PROT_READ | VM_PROT_WRITE,
+ PTE_NOCACHE,
+ },
+ { /* PCIE I/O */
+ MV_PCIE_IO_BASE,
+ MV_PCIE_IO_PHYS_BASE,
+ MV_PCIE_IO_SIZE,
+ VM_PROT_READ | VM_PROT_WRITE,
+ PTE_NOCACHE,
+ },
+ { /* PCIE Memory */
+ MV_PCIE_MEM_BASE,
+ MV_PCIE_MEM_PHYS_BASE,
+ MV_PCIE_MEM_SIZE,
+ VM_PROT_READ | VM_PROT_WRITE,
+ PTE_NOCACHE,
+ },
+ { 0, 0, 0, 0, 0, }
+};
+
+const struct gpio_config mv_gpio_config[] = {
+ { -1, -1, -1 }
+};
+
+void
+platform_mpp_init(void)
+{
+
+ /* MPP configuration for GlobalScale Technologies DreamPlug v10.
+ * Given the absence of schematics or other detailed documentation,
+ * these settings are based on the diagnostic messages emitted at boot
+ * time by the linux that comes pre-installed on the unit.
+ *
+ * MPP[ 0]: NF_IO[2]
+ * MPP[ 1]: NF_IO[3]
+ * MPP[ 2]: NF_IO[4]
+ * MPP[ 3]: NF_IO[5]
+ * MPP[ 4]: NF_IO[6]
+ * MPP[ 5]: NF_IO[7]
+ * MPP[ 6]: SYSRST_OUTn
+ * MPP[ 7]: GPO[7]
+ * MPP[ 8]: TW_SDA
+ * MPP[ 9]: TW_SCK
+ * MPP[10]: UA0_TXD
+ * MPP[11]: US0_RXD
+ * MPP[12]: SD_CLK
+ * MPP[13]: SD_CMD
+ * MPP[14]: SD_D[0]
+ * MPP[15]: SD_D[1]
+ * MPP[16]: SD_D[2]
+ * MPP[17]: SD_D[3]
+ * MPP[18]: NF_IO[0]
+ * MPP[19]: NF_IO[1]
+ * MPP[20]: GE1[ 0]
+ * MPP[21]: GE1[ 1]
+ * MPP[22]: GE1[ 2]
+ * MPP[23]: GE1[ 3]
+ * MPP[24]: GE1[ 4]
+ * MPP[25]: GE1[ 5]
+ * MPP[26]: GE1[ 6]
+ * MPP[27]: GE1[ 7]
+ * MPP[28]: GE1[ 8]
+ * MPP[29]: GE1[ 9]
+ * MPP[30]: GE1[10]
+ * MPP[31]: GE1[11]
+ * MPP[32]: GE1[12]
+ * MPP[33]: GE1[13]
+ * MPP[34]: GE1[14]
+ * MPP[35]: GE1[15]
+ * MPP[36]: GPIO[36]
+ * MPP[37]: GPIO[37]
+ * MPP[38]: GPIO[38]
+ * MPP[39]: GPIO[39]
+ * MPP[40]: TDM_SPI_SCK
+ * MPP[41]: TDM_SPI_MISO
+ * MPP[42]: TDM_SPI_MOSI
+ * MPP[43]: GPIO[43]
+ * MPP[44]: GPIO[44]
+ * MPP[45]: GPIO[45]
+ * MPP[46]: GPIO[46]
+ * MPP[47]: GPIO[47]
+ * MPP[48]: GPIO[48]
+ * MPP[49]: GPIO[49]
+ */
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL0, 0x01111111);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL1, 0x11113311);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL2, 0x33331111);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL3, 0x33333333);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL4, 0x00003333);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL5, 0x00000222);
+ bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL6, 0x00000000);
+}
+
+static void
+platform_identify(void *dummy)
+{
+
+ soc_identify();
+
+ /*
+ * XXX Board identification e.g. read out from FPGA or similar should
+ * go here
+ */
+}
+SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL);
diff -r f782e529a926 -r 48d067ff170d sys/arm/mv/kirkwood/files.dreamplug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ sys/arm/mv/kirkwood/files.dreamplug Fri Aug 03 09:09:39 2012 -0600
@@ -0,0 +1,5 @@
+# $FreeBSD: $
+
+include "arm/mv/kirkwood/files.kirkwood"
+arm/mv/kirkwood/dreamplug.c standard
+
diff -r f782e529a926 -r 48d067ff170d sys/arm/mv/kirkwood/kirkwood.c
--- sys/arm/mv/kirkwood/kirkwood.c Fri Aug 03 07:24:13 2012 -0600
+++ sys/arm/mv/kirkwood/kirkwood.c Fri Aug 03 09:09:39 2012 -0600
@@ -95,6 +95,12 @@ struct obio_device obio_devices[] = {
{ -1 },
CPU_PM_CTRL_GE0
},
+ { "mge", MV_ETH1_BASE, MV_ETH_SIZE,
+ { MV_INT_GBE1RX, MV_INT_GBE1TX, MV_INT_GBE1MISC,
+ MV_INT_GBE1SUM, MV_INT_GBE1ERR, -1 },
+ { -1 },
+ CPU_PM_CTRL_GE1
+ },
{ "twsi", MV_TWSI0_BASE, MV_TWSI_SIZE,
{ -1 }, { -1 },
CPU_PM_CTRL_NONE
diff -r f782e529a926 -r 48d067ff170d sys/arm/mv/kirkwood/std.dreamplug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ sys/arm/mv/kirkwood/std.dreamplug Fri Aug 03 09:09:39 2012 -0600
@@ -0,0 +1,8 @@
+# $FreeBSD: $
+
+include "../mv/std.mv"
+include "../mv/kirkwood/std.kirkwood"
+files "../mv/kirkwood/files.dreamplug"
+
+options PHYSMEM_SIZE=0x20000000
+
diff -r f782e529a926 -r 48d067ff170d sys/dev/mge/if_mge.c
--- sys/dev/mge/if_mge.c Fri Aug 03 07:24:13 2012 -0600
+++ sys/dev/mge/if_mge.c Fri Aug 03 09:09:39 2012 -0600
@@ -70,7 +70,7 @@
#include <dev/mii/miivar.h>
#ifndef MII_ADDR_BASE
-#define MII_ADDR_BASE 8
+#define MII_ADDR_BASE 0
#endif
#include <dev/mge/if_mgevar.h>
@@ -692,13 +692,14 @@ mge_attach(device_t dev)
mge_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
if (error) {
device_printf(dev, "attaching PHYs failed\n");
- if_free(ifp);
- sc->ifp = NULL;
mge_detach(dev);
return (error);
}
sc->mii = device_get_softc(sc->miibus);
+ /* Tell the MAC which PHY to use. */
+ MGE_WRITE(sc, MGE_REG_PHYDEV, phy);
+
/* Attach interrupt handlers */
for (i = 0; i < 2; ++i) {
error = bus_setup_intr(dev, sc->res[1 + i],
@@ -732,16 +733,20 @@ mge_detach(device_t dev)
/* Stop and release all interrupts */
for (i = 0; i < 2; ++i) {
- error = bus_teardown_intr(dev, sc->res[1 + i], sc->ih_cookie[i]);
- if (error)
- device_printf(dev, "could not release %s\n",
- mge_intrs[i].description);
+ if (sc->ih_cookie[i] != NULL) {
+ error = bus_teardown_intr(dev, sc->res[1 + i], sc->ih_cookie[i]);
+ if (error)
+ device_printf(dev, "could not release %s\n",
+ mge_intrs[i].description);
+ sc->ih_cookie[i] = NULL;
+ }
}
/* Detach network interface */
if (sc->ifp) {
ether_ifdetach(sc->ifp);
if_free(sc->ifp);
+ sc->ifp = NULL;
}
/* Free DMA resources */
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1344008999.10571.8.camel>
