a full updated diff

Richard E Neese r.neese at gmail.com
Thu Aug 2 16:18:35 UTC 2012


On 8/2/2012 9:44 AM, Ian Lepore wrote:
> On Thu, 2012-08-02 at 00:42 -0400, Richard E Neese wrote:
>> i merged hrs at FreeBSD.org and my patches together for dreamplug updates.
>> his added in the led lights I did not have in mine.
>> But this gives 1 full dreamplug update.
> Where's the diff?
>
> -- Ian
>
>
here is the full diff
-------------- next part --------------
Index: lib/liblzma/config.h
===================================================================
--- lib/liblzma/config.h	(revision 238981)
+++ lib/liblzma/config.h	(working copy)
@@ -85,9 +85,9 @@
 #define VERSION "5.0.3"
 #if defined(__FreeBSD__)
 #include <sys/_types.h>
-#if defined(__NO_STRICT_ALIGNMENT)
+/*#if defined(__NO_STRICT_ALIGNMENT)
 #define TUKLIB_FAST_UNALIGNED_ACCESS 1
-#endif
+#endif*/
 #include <machine/endian.h>
 #if _BYTE_ORDER == _BIG_ENDIAN
 # define WORDS_BIGENDIAN 1
Index: etc/rc.d/fsck
===================================================================
--- etc/rc.d/fsck	(revision 238981)
+++ etc/rc.d/fsck	(working copy)
@@ -27,7 +27,16 @@
 		if checkyesno background_fsck; then
 			fsck -F -p
 		else
-			fsck -p
+			   if checkyesno force_fsck; then
+				echo "Force fsck enabled"
+				for filesystem in ${force_fsck_list}
+				do
+					echo "Force check $filesystem"
+					fsck -y $filesystem
+				done
+			    else
+		                fsck -p
+			fi
 		fi
 
 		case $? in
Index: etc/master.passwd
===================================================================
--- etc/master.passwd	(revision 238981)
+++ etc/master.passwd	(working copy)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 #
-root::0:0::0:0:Charlie &:/root:/bin/csh
+root:$1$pUs8OwQY$mwQTkOTA8hwItKHdP6ECT1:0:0::0:0:Charlie &:/root:/bin/csh
 toor:*:0:0::0:0:Bourne-again Superuser:/root:
 daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin
 operator:*:2:5::0:0:System &:/:/usr/sbin/nologin
Index: sys/boot/fdt/dts/dreamplug.dts
===================================================================
--- sys/boot/fdt/dts/dreamplug.dts	(revision 0)
+++ sys/boot/fdt/dts/dreamplug.dts	(working copy)
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * 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 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 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.
+ *
+ * GlobalScale Technologies DreamPlug Device Tree Source.
+ *
+ * $FreeBSD$
+ */
+
+/dts-v1/;
+
+/ {
+	model = "GlobalScale Technologies Dreamplug";
+	compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	aliases {
+		ethernet0 = &enet0;
+		ethernet1 = &enet1;
+		mpp = &MPP;
+		serial0 = &serial0;
+		serial1 = &serial1;
+		soc = &SOC;
+		sram = &SRAM;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "ARM,88FR131";
+			reg = <0x0>;
+			d-cache-line-size = <32>;	// 32 bytes
+			i-cache-line-size = <32>;	// 32 bytes
+			d-cache-size = <0x4000>;	// L1, 16K
+			i-cache-size = <0x4000>;	// L1, 16K
+			timebase-frequency = <0>;
+			bus-frequency = <0>;
+			clock-frequency = <0>;
+		};
+
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x0 0x20000000>;		// 512M at 0x0
+	};
+
+	localbus at f1000000 {
+		#address-cells = <2>;
+		#size-cells = <1>;
+		compatible = "mrvl,lbc";
+
+		/* This reflects CPU decode windows setup. */
+		ranges = <0x0 0x0f 0xf9300000 0x00100000
+			  0x1 0x1e 0xfa000000 0x00100000
+			  0x2 0x1d 0xfa100000 0x02000000
+			  0x3 0x1b 0xfc100000 0x00000400>;
+
+		nor at 0,0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "cfi-flash";
+			reg = <0x0 0x0 0x00100000>;
+			bank-width = <2>;
+			device-width = <1>;
+		};
+
+		led at 1,0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "led";
+			reg = <0x1 0x0 0x00100000>;
+		};
+
+		nor at 2,0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "cfi-flash";
+			reg = <0x2 0x0 0x02000000>;
+			bank-width = <2>;
+			device-width = <1>;
+		};
+	};
+
+	SOC: soc88f6281 at f1000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "simple-bus";
+		ranges = <0x0 0xf1000000 0x00100000>;
+		bus-frequency = <0>;
+
+		PIC: pic at 20200 {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			reg = <0x20200 0x3c>;
+			compatible = "mrvl,pic";
+		};
+
+		timer at 20300 {
+			compatible = "mrvl,timer";
+			reg = <0x20300 0x30>;
+			interrupts = <1>;
+			interrupt-parent = <&PIC>;
+			mrvl,has-wdt;
+		};
+
+		MPP: mpp at 10000 {
+			#pin-cells = <2>;
+			compatible = "mrvl,mpp";
+			reg = <0x10000 0x34>;
+			pin-count = <50>;
+			pin-map = <
+				0  2		/* MPP[0]:  SPI_SCn */
+				1  2		/* MPP[1]:  SPI_MOSI */
+				2  2		/* MPP[2]:  SPI_SCK */
+				3  2		/* MPP[3]:  SPI_MISO */
+				6  1		/* MPP[6]:  SYSRST_OUTn */
+				8  2		/* MPP[8]:  UA0_RTS */
+				9  2		/* MPP[9]:  UA0_CTS */
+				10 3		/* MPP[10]: UA0_TXD */
+				11 3		/* MPP[11]: UA0_RXD */
+				12 1		/* MPP[12]: SD_CLK */
+				13 1		/* MPP[13]: SD_CMD */
+				14 1		/* MPP[14]: SD_D[0] */
+				15 1		/* MPP[17]: SD_D[1] */
+				21 5            /* MPP[21]: SATA0_AC */
+				23 5		/* MPP[23]: SATA0_PR */
+				28 0		/* MPP[28]: GPIO[28] */
+				29 1		/* MPP[29]: TSMP[9] */
+				37 4		/* MPP[37]: AU_SPDIFO */
+				38 4		/* MPP[38]: AU_SPDOFRMCLK */
+				39 4		/* MPP[39]: AU_I2SBCLK */
+				40 4		/* MPP[40]: AU_I2SDO */
+				41 4		/* MPP[41]: AU_I2SLRCLK */
+				42 4		/* MPP[42]: AU_I2SMCLK */
+				43 4		/* MPP[43]: AU_I2SDI */
+				44 4		/* MPP[44]: AU_EXTCLK */
+				47 0		/* MPP[47]: GPIO[47] BT LED */
+				48 0		/* MPP[48]: GPIO[48] WLAN LED */
+				49 0>;		/* MPP[49]: GPIO[49] WLAN AP */
+		};
+
+		GPIO: gpio at 10100 {
+			#gpio-cells = <3>;
+			compatible = "mrvl,gpio";
+			reg = <0x10100 0x20>;
+			gpio-controller;
+			interrupts = <35 36 37 38 39 40 41>;
+			interrupt-parent = <&PIC>;
+			pin-count = <50>;
+		};
+
+		gpioled at 0 {
+			compatible = "mrvl,gpioled";
+
+			gpios = <&GPIO 47 2 0	/* GPIO[47] BT LED: OUT */
+				 &GPIO 48 2 0	/* GPIO[48] WLAN LED: OUT */
+				 &GPIO 49 2 0>;	/* GPIO[49] WLAN AP LED: OUT */
+		};
+
+		rtc at 10300 {
+			compatible = "mrvl,rtc";
+			reg = <0x10300 0x08>;
+		};
+
+		twsi at 11000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "mrvl,twsi";
+			reg = <0x11000 0x20>;
+			interrupts = <43>;
+			interrupt-parent = <&PIC>;
+		};
+
+		enet0: ethernet at 72000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			model = "V2";
+			compatible = "mrvl,ge";
+			reg = <0x72000 0x2000>;
+			ranges = <0x0 0x72000 0x2000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <12 13 14 11 46>;
+			interrupt-parent = <&PIC>;
+			phy-handle = <&phy0>;
+
+			mdio at 0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "mrvl,mdio";
+
+				phy0: ethernet-phy at 0 {
+					reg = <0x0>;
+				};
+
+				phy1: ethernet-phy at 1 {
+					reg = <0x1>;
+				};
+			};
+		};
+
+		enet1: ethernet at 76000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			model = "V2";
+			compatible = "mrvl,ge";
+			reg = <0x76000 0x02000>;
+			ranges = <0x0 0x76000 0x2000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <16 17 18 15 47>;
+			interrupt-parent = <&PIC>;
+			phy-handle = <&phy1>;
+		};
+
+		serial0: serial at 12000 {
+			compatible = "ns16550";
+			reg = <0x12000 0x20>;
+			reg-shift = <2>;
+			clock-frequency = <0>;
+			interrupts = <33>;
+			interrupt-parent = <&PIC>;
+		};
+
+		serial1: serial at 12100 {
+			compatible = "ns16550";
+			reg = <0x12100 0x20>;
+			reg-shift = <2>;
+			clock-frequency = <0>;
+			interrupts = <34>;
+			interrupt-parent = <&PIC>;
+		};
+
+		crypto at 30000 {
+			compatible = "mrvl,cesa";
+			reg = <0x30000 0x10000>;
+			interrupts = <22>;
+			interrupt-parent = <&PIC>;
+
+			sram-handle = <&SRAM>;
+		};
+
+		usb at 50000 {
+			compatible = "mrvl,usb-ehci", "usb-ehci";
+			reg = <0x50000 0x1000>;
+			interrupts = <48 19>;
+			interrupt-parent = <&PIC>;
+		};
+
+		xor at 60000 {
+			compatible = "mrvl,xor";
+			reg = <0x60000 0x1000>;
+			interrupts = <5 6 7 8>;
+			interrupt-parent = <&PIC>;
+		};
+
+		sata at 80000 {
+			compatible = "mrvl,sata";
+			reg = <0x80000 0x6000>;
+			interrupts = <21>;
+			interrupt-parent = <&PIC>;
+		}
+
+		sdio at 90000 {
+			compatible = "mrvl,sdio";
+			reg = <0x90000 0x134>;
+			interrupts = <28>;
+			interrupt-parent = <&PIC>;
+		};
+	};
+
+	SRAM: sram at fd000000 {
+		compatible = "mrvl,cesa-sram";
+		reg = <0xfd000000 0x00100000>;
+	};
+
+	chosen {
+		stdin = "serial0";
+		stdout = "serial0";
+	};
+
+};
Index: sys/arm/mv/kirkwood/files.dreamplug
===================================================================
--- sys/arm/mv/kirkwood/files.dreamplug	(revision 0)
+++ sys/arm/mv/kirkwood/files.dreamplug	(working copy)
@@ -0,0 +1,10 @@
+# $FreeBSD:$
+
+include "arm/mv/kirkwood/files.kirkwood"
+arm/mv/kirkwood/dreamplug.c	standard
+# $FreeBSD: src/sys/arm/mv/kirkwood/files.sheevaplug,v 1.1.4.1 2011/09/23 00:51:37 kensmith Exp $
+
+include "arm/mv/kirkwood/files.kirkwood"
+arm/mv/kirkwood/sheevaplug.c	standard
+arm/mv/gpioled.c		standard
+arm/mv/kirkwood/dreamplug_led.c	standard
Index: sys/arm/mv/kirkwood/dreamplug_led.c
===================================================================
--- sys/arm/mv/kirkwood/dreamplug_led.c	(revision 0)
+++ sys/arm/mv/kirkwood/dreamplug_led.c	(working copy)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2012 Hiroki Sato <hrs at FreeBSD.org>.
+ * 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 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 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$");
+
+const char *gpioled_namelist[] = {
+    "BT",	/* GPIO[47] */
+    "WLAN",	/* GPIO[48] */
+    "WLANAP",	/* GPIO[49] */
+    0,
+};
+const char *gpioled_devdesc = "DreamPlug Front Panel LED Driver";
Index: sys/arm/mv/kirkwood/dreamplug.c
===================================================================
--- sys/arm/mv/kirkwood/dreamplug.c	(revision 0)
+++ sys/arm/mv/kirkwood/dreamplug.c	(working copy)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * 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 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 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 <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+
+#include <machine/fdt.h>
+
+int
+fdt_pci_devmap(phandle_t node, struct pmap_devmap *devmap, vm_offset_t io_va,
+    vm_offset_t mem_va)
+{
+
+	return (0);
+}
Index: sys/arm/mv/kirkwood/std.dreamplug
===================================================================
--- sys/arm/mv/kirkwood/std.dreamplug	(revision 0)
+++ sys/arm/mv/kirkwood/std.dreamplug	(working copy)
@@ -0,0 +1,10 @@
+# $FreeBSD:$
+
+include	"../mv/std.mv"
+include "../mv/kirkwood/std.kirkwood"
+files	"../mv/kirkwood/files.dreamplug"
+# $FreeBSD: src/sys/arm/mv/kirkwood/std.sheevaplug,v 1.3.2.1 2011/09/23 00:51:37 kensmith Exp $
+
+include	"../mv/std.mv"
+include "../mv/kirkwood/std.kirkwood"
+files	"../mv/kirkwood/files.dreamplug"
Index: sys/arm/mv/mvvar.h
===================================================================
--- sys/arm/mv/mvvar.h	(revision 238981)
+++ sys/arm/mv/mvvar.h	(working copy)
@@ -45,6 +45,7 @@
 #include <vm/pmap.h>
 #include <machine/pmap.h>
 #include <machine/vm.h>
+#include <machine/fdt.h>
 
 #define	MV_TYPE_PCI		0
 #define	MV_TYPE_PCIE		1
@@ -55,6 +56,13 @@
 	int		gc_output;	/* GPIO output value */
 };
 
+typedef int (*gpios_phandler_t)(phandle_t, pcell_t *, int);
+
+struct gpio_ctrl_entry {
+	const char 		*compat;
+	gpios_phandler_t	handler;
+};
+
 struct decode_win {
 	int		target;		/* Mbus unit ID */
 	int		attr;		/* Attributes of the target interface */
Index: sys/arm/mv/gpioled.c
===================================================================
--- sys/arm/mv/gpioled.c	(revision 0)
+++ sys/arm/mv/gpioled.c	(working copy)
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 2012 Hiroki Sato <hrs at FreeBSD.org>.
+ * 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 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 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.
+ *
+ * GPIO-LED bridge driver for Marvell GPIO Controller.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <machine/fdt.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <arm/mv/mvreg.h>
+#include <arm/mv/mvvar.h>
+
+#include <dev/led/led.h>
+
+extern const char *gpioled_devdesc;
+extern const char *gpioled_namelist[];
+
+extern struct gpio_ctrl_entry gpio_controllers[];
+
+struct gpioled_ledlist {
+	LIST_ENTRY(gpioled_ledlist)	list;
+
+	struct cdev	*ll_cdev;
+	const char 	*ll_name;
+	int 		ll_pin;
+};
+
+struct gpioled_softc {
+	LIST_HEAD(, gpioled_ledlist) sc_llh;
+
+	device_t	sc_dev;
+};
+
+static MALLOC_DEFINE(M_GPIOLED, "GPIOLED", "GPIO LED driver");
+
+static int
+led_probe(device_t dev)
+{
+
+	if (!ofw_bus_is_compatible(dev, "mrvl,gpioled"))
+		return (ENXIO);
+
+	device_set_desc(dev, gpioled_devdesc);
+
+	return (0);
+}
+
+static void
+led_onoff(void *args, int onoff)
+{
+	struct gpioled_ledlist *ll = (struct gpioled_ledlist *)args;
+
+	mv_gpio_out(ll->ll_pin, 0, onoff);
+}
+
+#define	MAX_PINS_PER_NODE	5
+#define	GPIOS_PROP_CELLS	4
+static int
+led_attach(device_t dev)
+{
+	struct gpioled_softc *sc = device_get_softc(dev);
+	struct gpio_ctrl_entry *e;
+	struct gpioled_ledlist *ll = NULL;
+	phandle_t node, ctrl = 0;
+	ihandle_t ctrl_ihandle;
+	pcell_t *g;
+	pcell_t	gpios[MAX_PINS_PER_NODE * GPIOS_PROP_CELLS];
+	pcell_t	gpio_cells, pincnt;
+	const char **nl;
+	int len, tuples, tuple_size;
+	int i;
+
+	sc->sc_dev = dev;
+	LIST_INIT(&sc->sc_llh);
+
+	if ((node = ofw_bus_get_node(dev)) == -1)
+		return (ENXIO);
+	if ((len = OF_getproplen(node, "gpios")) <= 0)
+		return (ENXIO);
+	OF_getprop(node, "gpios", &gpios, len);
+
+	e = (struct gpio_ctrl_entry *)&gpio_controllers;
+	for (; e->compat; e++) {
+		ctrl_ihandle = (ihandle_t)gpios[0];
+		ctrl_ihandle = fdt32_to_cpu(ctrl_ihandle);
+		ctrl = OF_instance_to_package(ctrl_ihandle);
+		if (fdt_is_compatible(ctrl, e->compat))
+			break;
+	}
+	if (e == NULL)
+		return (ENXIO);
+
+	if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells,
+	    sizeof(pcell_t)) < 0)
+		return (ENXIO);
+	gpio_cells = fdt32_to_cpu(gpio_cells);
+	if (gpio_cells != 3)
+		return (ENXIO);
+
+	tuple_size = gpio_cells * sizeof(pcell_t) + sizeof(phandle_t);
+	tuples = len / tuple_size;
+
+	if (OF_getprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
+		return (ENXIO);
+	pincnt = fdt32_to_cpu(pincnt);
+
+	g = (pcell_t *)&gpios;
+	nl = gpioled_namelist;
+
+	for (i = 0; i < tuples; i++) {
+		/* Ignore tuples if it too many than the name list. */
+		if (nl[i] == NULL)
+			break;
+
+ 		/* Skip controller reference. */
+		g += sizeof(ihandle_t) / sizeof(pcell_t);
+
+		/* The direction must be 2 (OUT). */
+		if (fdt32_to_cpu(g[1]) != 2)
+			continue;
+
+		/* Check maximum pin count. */
+		if (fdt32_to_cpu(g[0]) > pincnt)
+			continue;
+
+		ll = malloc(sizeof *ll, M_GPIOLED, M_WAITOK | M_ZERO);
+		ll->ll_pin = fdt32_to_cpu(g[0]);
+		ll->ll_name = nl[i];
+		ll->ll_cdev = led_create(led_onoff, ll, ll->ll_name);
+		if (bootverbose)
+			device_printf(dev, "Add LED device: %s(%d)\n",
+			    ll->ll_name, ll->ll_pin);
+		LIST_INSERT_HEAD(&sc->sc_llh, ll, list);
+
+		g += gpio_cells;
+	}
+
+	return (0);
+}
+
+static int
+led_detach(device_t dev)
+{
+	struct gpioled_softc *sc = device_get_softc(dev);
+	struct gpioled_ledlist *ll;
+
+	while (!LIST_EMPTY(&sc->sc_llh)) {
+		ll = LIST_FIRST(&sc->sc_llh);
+		LIST_REMOVE(ll, list);
+		if (ll->ll_cdev != NULL)
+			led_destroy(ll->ll_cdev);
+		free(ll, M_GPIOLED);
+	}
+
+	return (0);
+}
+
+static device_method_t led_methods[] = {
+	DEVMETHOD(device_probe,		led_probe),
+	DEVMETHOD(device_attach,	led_attach),
+	DEVMETHOD(device_detach,	led_detach),
+	{0, 0},
+};
+
+static driver_t led_driver = {
+	"gpioled",
+	led_methods,
+	sizeof(struct gpioled_softc),
+};
+
+static devclass_t led_devclass;
+DRIVER_MODULE(gpioled, simplebus, led_driver, led_devclass, 0, 0);
+MODULE_VERSION(gpioled, 1);
Index: sys/arm/conf/DREAMPLUG
===================================================================
--- sys/arm/conf/DREAMPLUG	(revision 0)
+++ sys/arm/conf/DREAMPLUG	(working copy)
@@ -0,0 +1,245 @@
+#
+# Custom kernel for Marvell DreamPlug devices.
+# 
+# $FreeBSD:$
+#
+
+ident		DREAMPLUG
+include		"../mv/kirkwood/std.dreamplug"
+
+options 	SOC_MV_KIRKWOOD
+makeoptions	MODULES_OVERRIDE=""
+
+#makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+makeoptions	WERROR="-Werror"
+
+options 	SCHED_4BSD		#4BSD scheduler
+options 	INET			#InterNETworking
+options 	INET6			#IPv6 communications protocols
+options 	FFS			#Berkeley Fast Filesystem
+options		MD_ROOT			# MD is a potential root device
+options 	NFSCL			#New Network Filesystem Client
+options 	NFSLOCKD		#Network Lock Manager
+options 	NFS_ROOT		#NFS usable as /, requires NFSCL
+
+#bootp/dhcp for remote booting
+#options 	BOOTP
+#options 	BOOTP_NFSROOT
+#options 	BOOTP_NFSV3
+#options 	BOOTP_WIRED_TO=mge0
+
+# Root fs on USB device
+options     ROOTDEVNAME=\"ufs:/dev/da2s2\" 
+
+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
+
+
+# Debugging
+#options 	ALT_BREAK_TO_DEBUGGER
+options		BREAK_TO_DEBUGGER
+options 	DDB
+#options 	DEADLKRES		#Enable the deadlock resolver
+#options 	DIAGNOSTIC
+#options 	INVARIANTS		#Enable calls of extra sanity checking
+#options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
+options 	KDB
+#options 	WITNESS			#Enable checks to detect deadlocks and cycles
+#options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
+#options 	WITNESS_KDB
+#options		DEBUG
+
+# Serial ports
+device		uart
+
+#ata devices
+device          ata             #base ata driver
+options         ATA_CAM         # Handle legacy controllers with CAM
+options         ATA_STATIC_ID   # Static device numbering
+
+# SCSI 
+options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
+device		scbus        # SCSI bus (required for SCSI) 
+device		da           # Direct Access (disks) 
+device		sa
+device		cd           # CD 
+device		pass 
+
+# SATA
+device		mvs	#Marvell Sata driver
+device          ahci    # AHCI-compatible SATA controllers
+
+# Partition support
+options 	GEOM_PART_GPT
+options 	GEOM_LABEL
+options		GEOM_ELI
+
+# UFS
+options 	UFS_ACL
+options 	UFS_DIRHASH
+options		UFS_GJOURNAL 
+options 	SOFTUPDATES
+
+# FAT support
+options 	MSDOSFS
+
+# Misc FSs
+options 	PROCFS
+options		EXT2FS 
+device		mem
+options		PSEUDOFS        #Pseudo-filesystem framework 
+options		CD9660            #ISO 9660 filesystem
+options		VFS_AIO
+options		CD9660_ICONV
+
+# Sound
+device 		sound
+device 		snd_uaudio
+
+# Networking
+device		ether
+device		mge			# Marvell Gigabit Ethernet controller
+device		mii
+device		miibus
+device		e1000phy
+device		bpf
+options		HZ=1000
+options		DEVICE_POLLING
+device		vlan
+
+#Misc Extra Netwroking
+options         NETATALK	#Appletalk communications protocols
+options         NETSMB		#SMB/CIFS requester
+options         SMBFS		#SMB/CIFS filesystem
+options         VFS_AIO
+
+# Pseudo devices.
+device		loop		# Network loopback
+device		random		# Entropy device
+device		ether		# Ethernet support
+device		vlan		# 802.1Q VLAN support
+device		tun		# Packet tunnel.
+device		pty		# BSD-style compatibility pseudo ttys
+device		md		# Memory "disks"
+device		gif		# IPv6 and IPv4 tunneling
+device		faith		# IPv6-to-IPv4 relaying (translation)
+device		firmware	# firmware assist module
+
+#crypto
+device		cesa			# Marvell security engine
+device		crypto
+device		cryptodev
+
+#Wireless Networking
+device          wlan
+options         IEEE80211_DEBUG # enable debug msgs
+options         IEEE80211_SUPPORT_MESH  # enable 802.11s draft support
+device          wlan_wep        # 802.11 WEP support
+device          wlan_ccmp       # 802.11 CCMP support
+device          wlan_tkip       # 802.11 TKIP support
+device          wlan_amrr       # AMRR transmit rate control algorithm
+
+# USB DEBUG
+#options 	USB_DEBUG	# enable debug msgs
+#options		USB_REQ_DEBUG
+
+# USB support
+device		usb		# USB Bus (required)
+device		ehci		# EHCI PCI->USB interface (USB 2.0)
+device		umass		# Disks/Mass storage - Requires scbus and da
+device		usfs
+device		uhid
+device		ums
+
+#USB WIFI
+device          rum             # Ralink Technology RT2501USB wireless NICs
+device          uath            # Atheros AR5523 wireless NICs
+device          ural            # Ralink Technology RT2500USB wireless NICs
+device          zyd             # ZyDAS zb1211/zb1211b wireless NICs
+device          urtw		# Realtek RTL8187B/L USB
+device          upgt		# Conexant/Intersil PrismGT SoftMAC USB
+
+# USB Serial devices
+device		u3g		# USB-based 3G modems (Option, Huawei, Sierra)
+#options         U3G_DEBUG
+
+#USB Over Ethernet
+device          cdce          # Generic USB over Ethernet
+
+# MMC/SD (Currently not supported)
+#device          mv_sdio
+#device          mmc
+#device          mmcsd
+#device          sdhci          
+
+#BLUETOOTH
+
+# I2C (TWSI)
+device		iic
+device		iicbus
+device		icee 
+
+options		LIBICONV 
+options		LIBMCHAIN 
+
+# Flattened Device Tree
+options 	FDT
+options		FDT_DTB_STATIC
+makeoptions	FDT_DTS_FILE=dreamplug.dts
+
+#FireWall
+device		if_bridge 
+
+# Encapsulating Interface
+device		enc
+
+# IPSec
+options		IPSEC
+options 	IPSEC_NAT_T
+options 	TCP_SIGNATURE		#include support for RFC 2385
+
+# IPFW support
+options 	IPFIREWALL
+options 	IPFIREWALL_DEFAULT_TO_ACCEPT
+options 	IPFIREWALL_FORWARD
+options 	IPFIREWALL_VERBOSE
+options 	IPFIREWALL_VERBOSE_LIMIT=100
+options 	DUMMYNET
+options 	IPDIVERT
+
+# altq(9). Enable the base part of the hooks with the ALTQ option.
+# Individual disciplines must be built into the base system and can not be
+# loaded as modules at this point. ALTQ requires a stable TSC so if yours is
+# broken or changes with CPU throttling then you must also have the ALTQ_NOPCC
+# option.
+options 	ALTQ
+options 	ALTQ_CBQ	# Class Based Queueing
+options 	ALTQ_RED	# Random Early Detection
+options 	ALTQ_RIO	# RED In/Out
+options 	ALTQ_HFSC	# Hierarchical Packet Scheduler
+options 	ALTQ_CDNR	# Traffic conditioner
+options 	ALTQ_PRIQ	# Priority Queueing
+options 	ALTQ_NOPCC	# Required if the TSC is unusable
+#options 	ALTQ_DEBUG
+
+# MROUTING enables the kernel multicast packet forwarder, which works
+# with mrouted and XORP.
+options 	MROUTING		# Multicast routing
+
+# Add multiple route table support
+options		ROUTETABLES=16
+
+# eliminating data copies on socket reads and writes.
+# man 9 zero_copy
+options		ZERO_COPY_SOCKETS
+
+#PF 
+device          pf
+device          pflog
+device          pfsync
Index: sys/dev/ofw/ofw_bus_subr.c
===================================================================
--- sys/dev/ofw/ofw_bus_subr.c	(revision 238981)
+++ sys/dev/ofw/ofw_bus_subr.c	(working copy)
@@ -167,7 +167,8 @@
 	onelen = strlen(onecompat);
 
 	while (len > 0) {
-		if (strncasecmp(compat, onecompat, onelen) == 0)
+		if (strlen(compat) == onelen &&
+		    strncasecmp(compat, onecompat, onelen) == 0)
 			/* Found it. */
 			return (1);
 
@@ -183,16 +184,31 @@
 ofw_bus_is_compatible_strict(device_t dev, const char *compatible)
 {
 	const char *compat;
+	size_t len;
 
 	if ((compat = ofw_bus_get_compat(dev)) == NULL)
 		return (0);
 
-	if (strncasecmp(compat, compatible, strlen(compatible)) == 0)
+	len = strlen(compatible);
+
+	if (strlen(compat) == len &&
+	    strncasecmp(compat, compatible, len) == 0)
 		return (1);
 
 	return (0);
 }
 
+int
+ofw_bus_has_prop(device_t dev, const char *propname)
+{
+	phandle_t node;
+
+	if ((node = ofw_bus_get_node(dev)) == -1)
+		return (0);
+
+	return (OF_hasprop(node, propname));
+}
+
 #ifndef FDT
 void
 ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz)
Index: sys/dev/ofw/ofw_bus_subr.h
===================================================================
--- sys/dev/ofw/ofw_bus_subr.h	(revision 238981)
+++ sys/dev/ofw/ofw_bus_subr.h	(working copy)
@@ -74,4 +74,7 @@
 int ofw_bus_is_compatible(device_t, const char *);
 int ofw_bus_is_compatible_strict(device_t, const char *);
 
+/* Helper routine for checking exsistence of a prop */
+int ofw_bus_has_prop(device_t, const char *);
+
 #endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */
Index: sys/dev/ofw/openfirm.c
===================================================================
--- sys/dev/ofw/openfirm.c	(revision 238981)
+++ sys/dev/ofw/openfirm.c	(working copy)
@@ -261,6 +261,14 @@
 	return (OFW_GETPROPLEN(ofw_obj, package, propname));
 }
 
+/* Check exsistence of a property of a package. */
+int
+OF_hasprop(phandle_t package, const char *propname)
+{
+
+	return (OF_getproplen(package, propname) >= 0 ? 1 : 0);
+}
+
 /* Get the value of a property of a package. */
 ssize_t
 OF_getprop(phandle_t package, const char *propname, void *buf, size_t buflen)
Index: sys/dev/ofw/openfirm.h
===================================================================
--- sys/dev/ofw/openfirm.h	(revision 238981)
+++ sys/dev/ofw/openfirm.h	(working copy)
@@ -105,6 +105,7 @@
 ssize_t		OF_getproplen(phandle_t node, const char *propname);
 ssize_t		OF_getprop(phandle_t node, const char *propname, void *buf,
 		    size_t len);
+int		OF_hasprop(phandle_t node, const char *propname);
 ssize_t		OF_searchprop(phandle_t node, const char *propname, void *buf,
 		    size_t len);
 ssize_t		OF_getprop_alloc(phandle_t node, const char *propname,


More information about the freebsd-arm mailing list