Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/zaurus more support SL-C1000.



details:   https://anonhg.NetBSD.org/src/rev/8f4b8dff8dfb
branches:  trunk
changeset: 766257:8f4b8dff8dfb
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Sun Jun 19 16:20:09 2011 +0000

description:
more support SL-C1000.

diffstat:

 sys/arch/zaurus/conf/GENERIC        |   18 +-
 sys/arch/zaurus/conf/INSTALL        |    9 +-
 sys/arch/zaurus/conf/files.zaurus   |   21 +-
 sys/arch/zaurus/dev/ioexp.c         |  343 ++++++++++++++++++++++++++++++++++++
 sys/arch/zaurus/dev/ioexpreg.h      |   55 +++++
 sys/arch/zaurus/dev/ioexpvar.h      |   82 ++++++++
 sys/arch/zaurus/dev/scoop.c         |   58 ++---
 sys/arch/zaurus/dev/scoop_pcic.c    |   10 +-
 sys/arch/zaurus/dev/zapm.c          |   12 +-
 sys/arch/zaurus/dev/zaudio.c        |  307 ++++++++++++++++++++++---------
 sys/arch/zaurus/dev/ziic.c          |  198 ++++++++++++++++++++
 sys/arch/zaurus/dev/zkbd.c          |   17 +-
 sys/arch/zaurus/dev/zkbdmap.h       |   28 +-
 sys/arch/zaurus/dev/zlcd.c          |  110 ++++++++--
 sys/arch/zaurus/dev/zlcdvar.h       |   44 ++++
 sys/arch/zaurus/dev/zmci.c          |   12 +-
 sys/arch/zaurus/dev/zrc.c           |   32 ++-
 sys/arch/zaurus/dev/zssp.c          |    9 +-
 sys/arch/zaurus/dev/zusb.c          |    6 +-
 sys/arch/zaurus/zaurus/machdep.c    |   51 ++++-
 sys/arch/zaurus/zaurus/zaurus_var.h |    4 +-
 21 files changed, 1191 insertions(+), 235 deletions(-)

diffs (truncated from 2352 to 300 lines):

diff -r 49d30e5ecd52 -r 8f4b8dff8dfb sys/arch/zaurus/conf/GENERIC
--- a/sys/arch/zaurus/conf/GENERIC      Sun Jun 19 16:16:42 2011 +0000
+++ b/sys/arch/zaurus/conf/GENERIC      Sun Jun 19 16:20:09 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC,v 1.42 2011/05/20 21:56:46 nonaka Exp $
+#      $NetBSD: GENERIC,v 1.43 2011/06/19 16:20:09 nonaka Exp $
 #
 # GENERIC machine description file
 #
@@ -190,6 +190,10 @@
 options                PXA2X0_DMAC_DMOVER_CONCURRENCY=4 # Enable dmover(9) backend
 #options       PXA2X0_DMAC_FIXED_PRIORITY      # Don't want multiple priority
 
+# I2C support
+ziic0 at pxaip?
+iic0 at ziic?
+
 # Power management
 zapm0 at pxaip?                # power management
 apmdev0 at zapm0       # APM
@@ -198,6 +202,9 @@
 scoop0 at pxaip?
 scoop1 at pxaip?
 
+# alternate GPIO contoller for SL-C1000
+ioexp0 at iic? addr 0x18
+
 # ADC, touchpad, backlight
 zssp0 at pxaip?
 
@@ -218,9 +225,10 @@
 options        PXA2X0_LCD_WRITETHROUGH
 wsdisplay* at lcd? console ?
 
-# Audio
-zaudio0 at pxaip?
+# WM8750 Audio
+zaudio0 at iic? addr 0x1b
 audio* at zaudio?
+#options       ZAUDIO_VOLUME_STRIDE=8
 
 # Audio support
 audio* at audiobus?
@@ -366,7 +374,6 @@
 pseudo-device   bpfilter                # Berkeley packet filter
 pseudo-device  loop                    # network loopback
 
-#
 # accept filters
 pseudo-device  accf_data               # "dataready" accept filter
 pseudo-device  accf_http               # "httpready" accept filter
@@ -384,9 +391,6 @@
 # a pseudo device needed for SMBFS
 #pseudo-device nsmb                    # experimental - SMB requester
 
-# a pseudo device needed for verified exec
-#pseudo-device  veriexec
-
 # wscons pseudo-devices
 pseudo-device  wsmux                   # mouse & keyboard multiplexor
 pseudo-device  wsfont
diff -r 49d30e5ecd52 -r 8f4b8dff8dfb sys/arch/zaurus/conf/INSTALL
--- a/sys/arch/zaurus/conf/INSTALL      Sun Jun 19 16:16:42 2011 +0000
+++ b/sys/arch/zaurus/conf/INSTALL      Sun Jun 19 16:20:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.9 2011/05/20 07:57:07 tsutsui Exp $
+# $NetBSD: INSTALL,v 1.10 2011/06/19 16:20:09 nonaka Exp $
 #
 # INSTALL config file (GENERIC with memory disk root)
 #
@@ -6,7 +6,7 @@
 include        "arch/zaurus/conf/GENERIC"
 
 # Enable the hooks used for initializing the root memory-disk.
-options        MEMORY_DISK_HOOKS
+options        MEMORY_DISK_HOOKS       # enable root ramdisk
 options        MEMORY_DISK_IS_ROOT     # force root on memory disk
 options        MEMORY_DISK_SERVER=0    # no userspace memory disk support
 options        MEMORY_DISK_ROOT_SIZE=4096      # size of memory disk, in blocks
@@ -38,16 +38,19 @@
 no options             WSDISPLAY_COMPAT_PCVT
 no options             WSDISPLAY_COMPAT_USL
 no options             WSDISPLAY_COMPAT_RAWKBD
+options                RASOPS_SMALL
 
 no options             DIAGNOSTIC
 no options             DDB
 no options             DDB_HISTORY_SIZE
 no options             SYMTAB_SPACE
 
+no zrc0 at pxaip?
+
 no ztp0 at pxaip?
 no wsmouse* at ztp?
 
-no zaudio0 at pxaip?
+no zaudio0 at iic?
 no audio* at zaudio?
 
 no ums* at uhidev?
diff -r 49d30e5ecd52 -r 8f4b8dff8dfb sys/arch/zaurus/conf/files.zaurus
--- a/sys/arch/zaurus/conf/files.zaurus Sun Jun 19 16:16:42 2011 +0000
+++ b/sys/arch/zaurus/conf/files.zaurus Sun Jun 19 16:20:09 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.zaurus,v 1.8 2009/04/21 03:00:30 nonaka Exp $
+#      $NetBSD: files.zaurus,v 1.9 2011/06/19 16:20:09 nonaka Exp $
 #
 # Sharp Zaurus specific configuration info
 #
@@ -47,6 +47,11 @@
 # Include Intel XScale PXA2x0 config definitions.
 include "arch/arm/xscale/files.pxa2x0"
 
+# I2C controller
+device ziic: i2cbus
+attach ziic at pxaip with pxaiic
+file arch/zaurus/dev/ziic.c            ziic
+
 # 16-bit GPIO controller
 device scoop
 attach scoop at pxaip
@@ -56,6 +61,11 @@
 attach pxapcic at pxaip with pxapcic_scoop
 file arch/zaurus/dev/scoop_pcic.c      pxapcic_scoop
 
+# alternate 8-bit GPIO controller for SL-C1000
+device ioexp
+attach ioexp at iic
+file arch/zaurus/dev/ioexp.c           ioexp needs-flag
+
 # Dedicated SSP unit for ADC, touch screen, and backlight
 device zssp
 attach zssp at pxaip
@@ -75,10 +85,11 @@
 attach ztp at pxaip
 file arch/zaurus/dev/ztp.c             ztp
 
-# Zaurus sound
-device zaudio: audiobus, auconv, mulaw, aurateconv, pxaiis, pxaiic
-attach zaudio at pxaip
+# WM8750 audio
+device zaudio: audiobus, auconv, mulaw, aurateconv, pxaiis
+attach zaudio at iic
 file arch/zaurus/dev/zaudio.c          zaudio
+defparam opt_zaudio.h                  ZAUDIO_VOLUME_STRIDE
 
 # Zaurus remote control
 device zrc: wskbddev
@@ -92,7 +103,7 @@
 attach zapm at pxaip
 file arch/zaurus/dev/zapm.c            zapm
 
-# usb power control
+# USB power control
 device zusb
 attach zusb at pxaip
 file arch/zaurus/dev/zusb.c            zusb
diff -r 49d30e5ecd52 -r 8f4b8dff8dfb sys/arch/zaurus/dev/ioexp.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/zaurus/dev/ioexp.c       Sun Jun 19 16:20:09 2011 +0000
@@ -0,0 +1,343 @@
+/*     $NetBSD: ioexp.c,v 1.1 2011/06/19 16:20:09 nonaka Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by NONAKA Kimihiro.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
+__KERNEL_RCSID(0, "$NetBSD: ioexp.c,v 1.1 2011/06/19 16:20:09 nonaka Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/gpio.h>
+
+#include <dev/i2c/i2cvar.h>
+
+#include <arm/xscale/pxa2x0reg.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_i2c.h>
+
+#include <zaurus/zaurus/zaurus_var.h>
+#include <zaurus/dev/ioexpreg.h>
+#include <zaurus/dev/ioexpvar.h>
+
+#include "ioconf.h"
+
+struct ioexp_softc {
+       device_t        sc_dev;
+       i2c_tag_t       sc_i2c;
+
+       uint8_t         sc_output;
+       uint8_t         sc_direction;
+
+       int             sc_inited;
+};
+
+static int ioexp_match(device_t, cfdata_t, void *);
+static void ioexp_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(ioexp, sizeof(struct ioexp_softc), 
+    ioexp_match, ioexp_attach, NULL, NULL);
+
+static uint8_t output_init_value = IOEXP_IR_ON | IOEXP_AKIN_PULLUP;
+static uint8_t direction_init_value = 0;
+
+static __inline int
+ioexp_write(struct ioexp_softc *sc, uint8_t reg, uint8_t val)
+{
+       uint8_t cmd;
+       uint8_t data;
+       int error;
+
+       cmd = reg;
+       data = val;
+       error = iic_exec(sc->sc_i2c, I2C_OP_WRITE_WITH_STOP, IOEXP_ADDRESS,
+           &cmd, 1, &data, 1, 0);
+       return error;
+}
+
+static int
+ioexp_match(device_t parent, cfdata_t cf, void *aux)
+{
+       struct i2c_attach_args *ia = aux;
+
+       /* only for SL-C1000 */
+       if (!ZAURUS_ISC1000)
+               return 0;
+
+       if (ia->ia_name) {
+               /* direct config - check name */
+               if (strcmp(ia->ia_name, "ioexp") == 0)
+                       return 1;
+       } else {
+               /* indirect config - check typical address */
+               if (ia->ia_addr == IOEXP_ADDRESS)
+                       return 1;
+       }
+       return 0;
+}
+
+static void
+ioexp_attach(device_t parent, device_t self, void *aux)
+{
+       struct ioexp_softc *sc = device_private(self);
+       struct i2c_attach_args *ia = aux;
+
+       sc->sc_dev = self;
+       sc->sc_i2c = ia->ia_tag;
+
+       aprint_normal(": GPIO controller\n");
+       aprint_naive("\n");
+
+       sc->sc_output = output_init_value;
+       sc->sc_direction = direction_init_value;
+
+       iic_acquire_bus(sc->sc_i2c, 0);
+       ioexp_write(sc, IOEXP_POLARITY, 0);
+       ioexp_write(sc, IOEXP_OUTPUT, sc->sc_output);
+       ioexp_write(sc, IOEXP_DIRECTION, sc->sc_direction);
+       iic_release_bus(sc->sc_i2c, 0);
+
+       sc->sc_inited = 1;
+}
+
+#if 0
+static void
+ioexp_gpio_pin_ctl(struct ioexp_softc *sc, uint8_t bit, int flags,
+    bool acquire_bus)
+{
+       int error;
+
+       if (acquire_bus) {
+               error = iic_acquire_bus(sc->sc_i2c, 0);
+               if (error) {



Home | Main Index | Thread Index | Old Index