summaryrefslogtreecommitdiffstats
path: root/sys/arm/xscale/ixp425/cambria_fled.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-12-20 03:26:09 +0000
committersam <sam@FreeBSD.org>2008-12-20 03:26:09 +0000
commita273d471c70f49afa6014491acca3266bf48a1ea (patch)
treee2846ce584593b0c7b1f6aee42c91edfa7c6e26e /sys/arm/xscale/ixp425/cambria_fled.c
parent65fa43968e32d8662f094a874f393743c85d7075 (diff)
parentc3f1faeb23e27c2ffda030cf892c5df698734622 (diff)
downloadFreeBSD-src-a273d471c70f49afa6014491acca3266bf48a1ea.zip
FreeBSD-src-a273d471c70f49afa6014491acca3266bf48a1ea.tar.gz
Merge support for Gateworks Cambria boards:
o add support for IXP435 cpu's (e.g. 64 irq's) o add support for Cambria-specific devices: npe, led's (front panel and octal latch), ehci, mcu, ide cf o redo memory mapping for xscale/ixp4xx boards: previously memory was assumed aliased to 0x10000000 but this appears to be true only for ixp425 systems and breaks operation on others; rework so memory is assumed to start at 0 o rework NPE configuration support to use NPE id's instead of port #'s; these changes also rename the associated MAC's to follow the NPE's they are attached to o update npe firmware to latest rev (same license) and update default fw imageid's to match; in particular this adds NPE-A and crypto support o re-style NPE fw handling code and add a console msg identifying the attributes of the loaded fw o fix numerous problems with handling failures during npe setup o fix npe rx q setup; need to spin waiting for mailbox responses during early boot stages as qmgr interrupts are not delivered; this fixes the problem where all 8 traffic classifications were not tied to the rx q (and eliminates the console msg "remember to fix rx q setup") o add DELAY to npe MII wait logic for IXP435 o strip down builtin phys->virt address translation table in resource handling to just those resources that require it and add a console msg to alert people when this (kludge) table needs to be extended o purge a bunch of dead netbsd-ism's o cleanup avila led driver o add Cambria support to boot2 and rework code for better multi-board support Notes: 1. NPE-A doesn't work and causes NPE-C to stop working; it is disabled in the hints 2. USB isn't working yet; controller communicates ok but device discovery fails 3. Cambria support must be configured separately from IXP425 boards; multi-board support is TBD Sponsored by: Hobnob, Gateworks (board donation) Reviewed by: imp
Diffstat (limited to 'sys/arm/xscale/ixp425/cambria_fled.c')
-rw-r--r--sys/arm/xscale/ixp425/cambria_fled.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/sys/arm/xscale/ixp425/cambria_fled.c b/sys/arm/xscale/ixp425/cambria_fled.c
new file mode 100644
index 0000000..ede1577
--- /dev/null
+++ b/sys/arm/xscale/ixp425/cambria_fled.c
@@ -0,0 +1,108 @@
+/*-
+ * Copyright (c) 2008 Sam Leffler. 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>
+__FBSDID("$FreeBSD$");
+/*
+ * Cambria Front Panel LED sitting on the I2C bus.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+
+#include <machine/bus.h>
+
+#include <dev/iicbus/iiconf.h>
+#include <dev/led/led.h>
+
+#include "iicbus_if.h"
+
+#define IIC_M_WR 0 /* write operation */
+#define LED_ADDR 0xae /* slave address */
+
+struct fled_softc {
+ struct cdev *sc_led;
+};
+
+static int
+fled_probe(device_t dev)
+{
+ device_set_desc(dev, "Gateworks Cambria Front Panel LED");
+ return 0;
+}
+
+static void
+fled_cb(void *arg, int onoff)
+{
+ uint8_t data[1];
+ struct iic_msg msgs[1] = {
+ { LED_ADDR, IIC_M_WR, 1, data },
+ };
+ device_t dev = arg;
+
+ data[0] = (onoff == 0); /* NB: low true */
+ (void) iicbus_transfer(dev, msgs, 1);
+}
+
+static int
+fled_attach(device_t dev)
+{
+ struct fled_softc *sc = device_get_softc(dev);
+
+ sc->sc_led = led_create(fled_cb, dev, "front");
+
+ return 0;
+}
+
+static int
+fled_detach(device_t dev)
+{
+ struct fled_softc *sc = device_get_softc(dev);
+
+ if (sc->sc_led != NULL)
+ led_destroy(sc->sc_led);
+
+ return 0;
+}
+
+static device_method_t fled_methods[] = {
+ DEVMETHOD(device_probe, fled_probe),
+ DEVMETHOD(device_attach, fled_attach),
+ DEVMETHOD(device_detach, fled_detach),
+
+ {0, 0},
+};
+
+static driver_t fled_driver = {
+ "fled",
+ fled_methods,
+ sizeof(struct fled_softc),
+};
+static devclass_t fled_devclass;
+
+DRIVER_MODULE(fled, iicbus, fled_driver, fled_devclass, 0, 0);
+MODULE_VERSION(fled, 1);
+MODULE_DEPEND(fled, iicbus, 1, 1, 1);
OpenPOWER on IntegriCloud