Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/zaurus Add PXA25x based Zaurus SL-C700/750/760/860 ...



details:   https://anonhg.NetBSD.org/src/rev/68feac933173
branches:  trunk
changeset: 773221:68feac933173
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jan 29 10:12:41 2012 +0000

description:
Add PXA25x based Zaurus SL-C700/750/760/860 support.

All porting work was done by TOYOKURA Atsushi, with
several minor adjustments for integration by me and nonaka@.

His SL-C700 first running NetBSD/zaurus was demonstrated on
NetBSD booth at Open Source Canference 2011 Tokyo/Fall:
http://www.NetBSD.org/gallery/events.html#opensourceconf2011-tokyofall

Note GENERIC kernel works on SL-C750/760/860 (and C1000/3x00) but for now
SL-C700 requires its own kernel with special KERNEL_BASE_PHYS address
due to zbsdmod.o loader restriction (probably caused its small 32MB RAM).

diffstat:

 sys/arch/zaurus/conf/C700           |   18 +
 sys/arch/zaurus/conf/GENERIC        |    6 +-
 sys/arch/zaurus/conf/files.zaurus   |   10 +-
 sys/arch/zaurus/dev/lcdctl.c        |   14 +-
 sys/arch/zaurus/dev/scoop.c         |   16 +-
 sys/arch/zaurus/dev/scoopreg.h      |    4 +-
 sys/arch/zaurus/dev/w100.c          |  586 ++++++++++++++++++++++++++++++++++++
 sys/arch/zaurus/dev/w100lcd.c       |  227 +++++++++++++
 sys/arch/zaurus/dev/w100lcdvar.h    |    8 +
 sys/arch/zaurus/dev/w100reg.h       |    9 +
 sys/arch/zaurus/dev/w100var.h       |   88 +++++
 sys/arch/zaurus/dev/zapm.c          |   15 +-
 sys/arch/zaurus/dev/zaudio.c        |    7 +-
 sys/arch/zaurus/dev/zkbd.c          |  101 +++++-
 sys/arch/zaurus/dev/zkbdmap.h       |  172 ++++++++++-
 sys/arch/zaurus/dev/zlcd.c          |    7 +-
 sys/arch/zaurus/dev/zmci.c          |   28 +-
 sys/arch/zaurus/dev/zssp.c          |  185 ++++++----
 sys/arch/zaurus/dev/ztp.c           |  101 ++++-
 sys/arch/zaurus/zaurus/machdep.c    |   35 +-
 sys/arch/zaurus/zaurus/zaurus_reg.h |    6 +-
 21 files changed, 1479 insertions(+), 164 deletions(-)

diffs (truncated from 2400 to 300 lines):

diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/conf/C700
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/zaurus/conf/C700 Sun Jan 29 10:12:41 2012 +0000
@@ -0,0 +1,18 @@
+# $NetBSD: C700,v 1.1 2012/01/29 10:12:41 tsutsui Exp $
+#
+# kernel config file for SL-C700
+#
+
+include        "arch/zaurus/conf/GENERIC"
+
+no options     CPU_XSCALE_PXA270
+
+no makeoptions KERNEL_BASE_PHYS
+makeoptions    KERNEL_BASE_PHYS="0xa0400000"
+no makeoptions LOADADDRESS
+makeoptions    LOADADDRESS="0xc0400000"
+
+no scoop1 at pxaip?
+
+no lcd0 at pxaip?
+no wsdisplay* at lcd?
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/conf/GENERIC
--- a/sys/arch/zaurus/conf/GENERIC      Sun Jan 29 09:08:04 2012 +0000
+++ b/sys/arch/zaurus/conf/GENERIC      Sun Jan 29 10:12:41 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC,v 1.50 2012/01/25 17:18:47 tsutsui Exp $
+#      $NetBSD: GENERIC,v 1.51 2012/01/29 10:12:41 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -27,7 +27,7 @@
 # CPU options
 
 # For XScale systems
-#options       CPU_XSCALE_PXA250       # Support the XScale PXA25x core
+options        CPU_XSCALE_PXA250       # Support the XScale PXA25x core
 options        CPU_XSCALE_PXA270       # Support the XScale PXA27x core
 makeoptions    CPUFLAGS="-mcpu=xscale"
 
@@ -224,6 +224,8 @@
 lcd0 at pxaip?                         # PXA2x0 integrated LCD Controller
 options        PXA2X0_LCD_WRITETHROUGH
 wsdisplay* at lcd? console ?
+w100lcd0 at pxaip?                     # ATI Imageon100 LCDcontroller
+wsdisplay* at w100lcd? console ?
 lcdctl0 at zssp0
 
 # WM8750 Audio
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/conf/files.zaurus
--- a/sys/arch/zaurus/conf/files.zaurus Sun Jan 29 09:08:04 2012 +0000
+++ b/sys/arch/zaurus/conf/files.zaurus Sun Jan 29 10:12:41 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.zaurus,v 1.10 2012/01/25 16:51:17 tsutsui Exp $
+#      $NetBSD: files.zaurus,v 1.11 2012/01/29 10:12:41 tsutsui Exp $
 #
 # Sharp Zaurus specific configuration info
 #
@@ -71,10 +71,16 @@
 attach zssp at pxaip
 file arch/zaurus/dev/zssp.c            zssp
 
-# LCD frame buffer
+# PXA2x0 integrated LCDC frame buffer
 attach lcd at pxaip with zlcd
 file arch/zaurus/dev/zlcd.c            zlcd
 
+# LCD frame buffer for SL-C7x0
+device w100lcd: wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation
+attach w100lcd at pxaip
+file arch/zaurus/dev/w100lcd.c         w100lcd needs-flag
+file arch/zaurus/dev/w100.c            w100lcd
+
 # backlight, brightness Controller
 device lcdctl
 attach lcdctl at zssp
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/dev/lcdctl.c
--- a/sys/arch/zaurus/dev/lcdctl.c      Sun Jan 29 09:08:04 2012 +0000
+++ b/sys/arch/zaurus/dev/lcdctl.c      Sun Jan 29 10:12:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lcdctl.c,v 1.2 2012/01/27 14:48:22 tsutsui Exp $       */
+/*     $NetBSD: lcdctl.c,v 1.3 2012/01/29 10:12:41 tsutsui Exp $       */
 
 /*-
  * Copyright (C) 2012 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lcdctl.c,v 1.2 2012/01/27 14:48:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcdctl.c,v 1.3 2012/01/29 10:12:41 tsutsui Exp $");
 
 #include "ioexp.h"
 
@@ -115,8 +115,14 @@
        sc->sc_islit = true;
        sc->sc_isblank = false;
 
-       sc->sc_nbacklighttbl = __arraycount(lcdctl_backlight_c3000);
-       sc->sc_backlighttbl = lcdctl_backlight_c3000;
+       if (ZAURUS_ISC1000 || ZAURUS_ISC3000) {
+               sc->sc_nbacklighttbl = __arraycount(lcdctl_backlight_c3000);
+               sc->sc_backlighttbl = lcdctl_backlight_c3000;
+       } else {
+               /* XXX: Is this okay for C7x0/860? */
+               sc->sc_nbacklighttbl = __arraycount(lcdctl_backlight_c3000);
+               sc->sc_backlighttbl = lcdctl_backlight_c3000;
+       }
 
        /* Start with approximately 40% of full brightness. */
        lcdctl_set_brightness(sc, 3);
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/dev/scoop.c
--- a/sys/arch/zaurus/dev/scoop.c       Sun Jan 29 09:08:04 2012 +0000
+++ b/sys/arch/zaurus/dev/scoop.c       Sun Jan 29 10:12:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scoop.c,v 1.10 2012/01/27 14:48:22 tsutsui Exp $       */
+/*     $NetBSD: scoop.c,v 1.11 2012/01/29 10:12:41 tsutsui Exp $       */
 /*     $OpenBSD: zaurus_scoop.c,v 1.12 2005/11/17 05:26:31 uwe Exp $   */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.10 2012/01/27 14:48:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.11 2012/01/29 10:12:41 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -293,6 +293,9 @@
 {
        struct scoop_softc *sc;
 
+       if (ZAURUS_ISC860)
+               return;
+
        sc = device_lookup_private(&scoop_cd, 0);
 
        if (sc != NULL) {
@@ -306,6 +309,9 @@
 {
        struct scoop_softc *sc;
 
+       if (ZAURUS_ISC860)
+               return;
+
        sc = device_lookup_private(&scoop_cd, 0);
 
        if (sc != NULL) {
@@ -335,6 +341,9 @@
        bus_space_handle_t ioh;
        uint16_t cpr;
 
+       if (ZAURUS_ISC860)
+               return;
+
        sc = device_lookup_private(&scoop_cd, 0);
        if (sc == NULL)
                return;
@@ -401,6 +410,9 @@
        struct scoop_softc *sc, *sc0, *sc1;
        uint32_t rv;
 
+       if (ZAURUS_ISC860)
+               return;
+
        sc0 = device_lookup_private(&scoop_cd, 0);
        sc1 = device_lookup_private(&scoop_cd, 1);
 
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/dev/scoopreg.h
--- a/sys/arch/zaurus/dev/scoopreg.h    Sun Jan 29 09:08:04 2012 +0000
+++ b/sys/arch/zaurus/dev/scoopreg.h    Sun Jan 29 10:12:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scoopreg.h,v 1.4 2007/10/17 19:58:34 garbled Exp $     */
+/*     $NetBSD: scoopreg.h,v 1.5 2012/01/29 10:12:41 tsutsui Exp $     */
 /*     $OpenBSD: zaurus_scoopreg.h,v 1.7 2005/07/01 23:51:55 uwe Exp $ */
 
 /*
@@ -61,7 +61,9 @@
 
 #define SCOOP0_LED_GREEN               1
 #define SCOOP0_JK_B_C3000              2
+#define SCOOP0_SWA_C860                        2
 #define SCOOP0_CHARGE_OFF_C3000                3
+#define SCOOP0_SWB_C860                        3
 #define SCOOP0_MUTE_L                  4
 #define SCOOP0_MUTE_R                  5
 #define SCOOP0_AKIN_PULLUP             6
diff -r e029ea435084 -r 68feac933173 sys/arch/zaurus/dev/w100.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/zaurus/dev/w100.c        Sun Jan 29 10:12:41 2012 +0000
@@ -0,0 +1,586 @@
+/* $NetBSD: w100.c,v 1.1 2012/01/29 10:12:42 tsutsui Exp $ */
+/*
+ * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
+ * Written by Hiroyuki Bessho for Genetec Corporation.
+ *
+ * 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. The name of Genetec Corporation may not be used to endorse or
+ *    promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
+ * 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: w100.c,v 1.1 2012/01/29 10:12:42 tsutsui Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>                        /* for cold */
+
+#include <uvm/uvm_extern.h>
+
+#include <dev/cons.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wscons_callbacks.h>
+#include <dev/rasops/rasops.h>
+#include <dev/wsfont/wsfont.h>
+
+#include <sys/bus.h>
+#include <machine/cpu.h>
+#include <arm/cpufunc.h>
+
+#include <zaurus/dev/w100reg.h>
+#include <zaurus/dev/w100var.h>
+
+#include "wsdisplay.h"
+
+/* Console */
+struct {
+       int is_console;
+       struct w100_wsscreen_descr *descr;
+       const struct w100_panel_geometry *geom;
+} w100_console;
+
+static void w100_initialize(struct w100_softc *sc,
+                const struct w100_panel_geometry *geom);
+static int  w100_new_screen(struct w100_softc *sc, int depth,
+                struct w100_screen **scrpp);
+static void w100_lcd_geometry(struct w100_softc *sc,
+                 const struct w100_panel_geometry *geom);
+#if NWSDISPLAY > 0
+static void w100_setup_rasops(struct w100_softc *sc,
+                struct rasops_info *rinfo,
+                struct w100_wsscreen_descr *descr,
+                const struct w100_panel_geometry *geom);
+#endif
+
+#define w100_reg_write(sc, offset, value) \
+    bus_space_write_4((sc)->iot, (sc)->ioh_reg, offset, value)
+
+static void
+w100_lcd_geometry(struct w100_softc *sc,
+    const struct w100_panel_geometry *geom)
+{
+
+       sc->geometry = geom;
+       switch (geom->rotate) {
+       case W100_PANEL_ROTATE_CW:
+               sc->display_width  = geom->panel_height;
+               sc->display_height = geom->panel_width;
+               w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000061);
+               w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00de1d0e);
+               w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x00895b00);
+               w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x00000500);
+               break;
+       case W100_PANEL_ROTATE_CCW:
+               sc->display_width  = geom->panel_height;
+               sc->display_height = geom->panel_width;
+               w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000061);
+               w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00de1d16);
+               w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x008004fc);
+               w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x00000500);
+               break;
+       case W100_PANEL_ROTATE_UD:
+               sc->display_width  = geom->panel_width;
+               sc->display_height = geom->panel_height;
+               w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000021);
+               w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00ded7e);



Home | Main Index | Thread Index | Old Index