Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcarm Allow jornada720 LCD and keyboard to be used...



details:   https://anonhg.NetBSD.org/src/rev/c23635b0cfc3
branches:  trunk
changeset: 519819:c23635b0cfc3
user:      toshii <toshii%NetBSD.org@localhost>
date:      Fri Dec 28 01:41:53 2001 +0000

description:
Allow jornada720 LCD and keyboard to be used as a boot console.

diffstat:

 sys/arch/hpcarm/dev/j720ssp.c        |  24 +++++++++++++++++++++---
 sys/arch/hpcarm/dev/sed_saip.c       |  19 +++++++------------
 sys/arch/hpcarm/hpcarm/hpc_machdep.c |  26 +++++++++++---------------
 3 files changed, 39 insertions(+), 30 deletions(-)

diffs (199 lines):

diff -r ded876a27c91 -r c23635b0cfc3 sys/arch/hpcarm/dev/j720ssp.c
--- a/sys/arch/hpcarm/dev/j720ssp.c     Fri Dec 28 01:40:50 2001 +0000
+++ b/sys/arch/hpcarm/dev/j720ssp.c     Fri Dec 28 01:41:53 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: j720ssp.c,v 1.2 2001/06/29 17:22:50 toshii Exp $ */
+/* $NetBSD: j720ssp.c,v 1.3 2001/12/28 01:41:53 toshii Exp $ */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@
 #include <machine/bus.h>
 #include <machine/config_hook.h>
 
+#include <hpc/hpc/bootinfo.h>
 #include <hpc/hpc/config_hook.h>
 #include <hpcarm/dev/sed1356var.h>
 #include <hpcarm/sa11x0/sa11x0_var.h>
@@ -156,6 +157,7 @@
 static int j720ssp_powerstate = 1;
 
 static struct j720ssp_softc j720kbdcons_sc;
+static int j720kbdcons_initstate = 0;
 
 #define DEBUG
 #ifdef DEBUG
@@ -206,6 +208,15 @@
        a.accessops = &j720kbd_accessops;
        a.accesscookie = sc;
 
+       /* Do console initialization */
+       if (! (bootinfo->bi_cnuse & BI_CNUSE_SERIAL)) {
+               j720kbdcons_sc = *sc;
+               a.console = 1;
+
+               wskbd_cnattach(&j720kbd_consops, NULL, &j720kbd_keymapdata);
+               j720kbdcons_initstate = 1;
+       }
+
        /*
         * Attach the wskbd, saving a handle to it.
         * XXX XXX XXX
@@ -218,6 +229,9 @@
        j720sspwaittime = 0;
 #endif
 
+       if (j720kbdcons_initstate == 1)
+               j720kbd_enable(sc, 1);
+
        /* LCD control is on the same bus */
        config_hook(CONFIG_HOOK_SET, CONFIG_HOOK_BRIGHTNESS,
                    CONFIG_HOOK_SHARE, j720lcdparam, sc);
@@ -480,12 +494,13 @@
        return 0;
 }
 
-
 #if 0
 int
 j720kbd_cnattach()
 {
-       /* XXX */
+       /* XXX defer initialization till j720sspattach */
+
+       return (0);
 }
 #endif
 
@@ -495,6 +510,9 @@
 {
        char buf[9];
 
+       if (j720kbdcons_initstate < 1)
+               return;
+
        for (;;) {
                j720kbd_read(&j720kbdcons_sc, buf);
 
diff -r ded876a27c91 -r c23635b0cfc3 sys/arch/hpcarm/dev/sed_saip.c
--- a/sys/arch/hpcarm/dev/sed_saip.c    Fri Dec 28 01:40:50 2001 +0000
+++ b/sys/arch/hpcarm/dev/sed_saip.c    Fri Dec 28 01:41:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sed_saip.c,v 1.8 2001/07/22 09:56:40 takemura Exp $    */
+/*     $NetBSD: sed_saip.c,v 1.9 2001/12/28 01:41:54 toshii Exp $      */
 
 /*-
  * Copyright (c) 1999-2001
@@ -100,7 +100,6 @@
        sed1356_ioctl, sed1356_mmap
 };
 
-static int console_flag = 0;
 static int attach_flag = 0;
 
 /*
@@ -119,6 +118,7 @@
 {
        struct sed1356_softc *sc = (struct sed1356_softc *)self;
        struct hpcfb_attach_args ha;
+       int console = (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) ? 0 : 1;
 
        printf("\n");
 
@@ -141,7 +141,7 @@
        }
 
        printf("%s: Epson SED1356", sc->sc_dev.dv_xname);
-       if (console_flag) {
+       if (console) {
                printf(", console");
        }
        printf("\n");
@@ -161,7 +161,10 @@
        sed1356_init_contrast(sc, 1);
        sed1356_init_backlight(sc, 1);
 
-       ha.ha_console = console_flag;
+       if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0)
+               panic("sed1356attach: cannot init fb console");
+
+       ha.ha_console = console;
        ha.ha_accessops = &sed1356_ha;
        ha.ha_accessctx = sc;
        ha.ha_curfbconf = 0;
@@ -181,14 +184,6 @@
        config_found(self, &ha, hpcfbprint);
 }
 
-int
-sed1356_getcnfb(struct hpcfb_fbconf *fb)
-{
-       console_flag = 1;
-
-       return sed1356_init(fb);
-}
-
 static int
 sed1356_init(struct hpcfb_fbconf *fb)
 {
diff -r ded876a27c91 -r c23635b0cfc3 sys/arch/hpcarm/hpcarm/hpc_machdep.c
--- a/sys/arch/hpcarm/hpcarm/hpc_machdep.c      Fri Dec 28 01:40:50 2001 +0000
+++ b/sys/arch/hpcarm/hpcarm/hpc_machdep.c      Fri Dec 28 01:41:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpc_machdep.c,v 1.24 2001/11/27 01:12:55 thorpej Exp $ */
+/*     $NetBSD: hpc_machdep.c,v 1.25 2001/12/28 01:41:54 toshii Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -124,10 +124,6 @@
 u_int free_pages;
 int physmem = 0;
 
-#define biconscnpollc      nullcnpollc
-cons_decl(bicons);
-static struct consdev bicons = cons_init(bicons);
-
 #ifndef PMAP_STATIC_L1S
 int max_processes = 64;                        /* Default number */
 #endif /* !PMAP_STATIC_L1S */
@@ -178,7 +174,7 @@
 /* Prototypes */
 
 void physcon_display_base      __P((u_int addr));
-extern void consinit           __P((void));
+void consinit          __P((void));
 
 void map_section       __P((vaddr_t pt, vaddr_t va, vaddr_t pa,
                             int cacheable));
@@ -670,14 +666,7 @@
        /* Enable MMU, I-cache, D-cache, write buffer. */
        cpufunc_control(0x337f, 0x107d);
 
-       if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL)
-               consinit();
-       else {
-               /* XXX this isn't useful for normal use, but helps debuging */
-               biconscninit(&bicons);
-               cn_tab = &bicons;
-               cn_tab->cn_pri = CN_REMOTE;
-       }
+       consinit();
 
 #ifdef VERBOSE_INIT_ARM
        printf("freemempos=%08lx\n", freemempos);
@@ -741,7 +730,14 @@
                return;
 
        consinit_called = 1;
-       cninit();
+       if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL)
+               cninit();
+       else {
+               /*
+                * Nothing to do here.  Console initialization is done at
+                * autoconf device attach time.
+                */
+       }
 }
 
 #ifdef DEBUG_BEFOREMMU



Home | Main Index | Thread Index | Old Index