Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcarm/sa11x0 Use platid based mechanism to select ...



details:   https://anonhg.NetBSD.org/src/rev/46dd7210abe7
branches:  trunk
changeset: 512172:46dd7210abe7
user:      toshii <toshii%NetBSD.org@localhost>
date:      Sat Jul 07 08:45:43 2001 +0000

description:
Use platid based mechanism to select PCMCIA socket voltage.

diffstat:

 sys/arch/hpcarm/sa11x0/sa11x1_pcic.c    |  26 ++++++++++++++++++++++++--
 sys/arch/hpcarm/sa11x0/sa11xx_pcic.c    |  15 +++++++++++----
 sys/arch/hpcarm/sa11x0/sa11xx_pcicvar.h |   4 +++-
 3 files changed, 38 insertions(+), 7 deletions(-)

diffs (116 lines):

diff -r 6994e6cd422e -r 46dd7210abe7 sys/arch/hpcarm/sa11x0/sa11x1_pcic.c
--- a/sys/arch/hpcarm/sa11x0/sa11x1_pcic.c      Sat Jul 07 08:10:15 2001 +0000
+++ b/sys/arch/hpcarm/sa11x0/sa11x1_pcic.c      Sat Jul 07 08:45:43 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sa11x1_pcic.c,v 1.5 2001/06/29 17:22:52 toshii Exp $        */
+/*      $NetBSD: sa11x1_pcic.c,v 1.6 2001/07/07 08:45:43 toshii Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -47,6 +47,9 @@
 #include <sys/malloc.h>
 
 #include <machine/bus.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
+
 #include <dev/pcmcia/pcmciachip.h>
 #include <dev/pcmcia/pcmciavar.h>
 #include <hpcarm/sa11x0/sa11x0_reg.h>
@@ -87,6 +90,16 @@
        sacpcic_intr_disestablish
 };
 
+static int j720_power_capability[] = {
+       SAPCIC_POWER_5V | SAPCIC_POWER_3V, SAPCIC_POWER_3V
+};
+
+static struct platid_data sacpcic_platid_table[] = {
+       { &platid_mask_MACH_HP_JORNADA_720, j720_power_capability },
+       { &platid_mask_MACH_HP_JORNADA_720JP, j720_power_capability },
+       { NULL, NULL }
+};
+
 struct cfattach sacpcic_ca = {
        sizeof(struct sacpcic_softc), sacpcic_match, sacpcic_attach
 };
@@ -106,15 +119,17 @@
        struct device *self;
        void *aux;
 {
-       int i;
+       int i, *ip;
        struct pcmciabus_attach_args paa;
        struct sacpcic_softc *sc = (struct sacpcic_softc *)self;
        struct sacc_softc *psc = (struct sacc_softc *)parent;
+       struct platid_data *p;
 
        printf("\n");
 
        sc->sc_pc.sc_iot = psc->sc_iot;
        sc->sc_ioh = psc->sc_ioh;
+       p = platid_search(&platid, sacpcic_platid_table);
 
        for(i = 0; i < 2; i++) {
                sc->sc_socket[i].sc = (struct sapcic_softc *)sc;
@@ -128,6 +143,13 @@
                sc->sc_socket[i].laststatus = SAPCIC_CARD_INVALID;
                sc->sc_socket[i].shutdown = 0;
 
+               if (p == NULL) {
+                       sc->sc_socket[i].power_capability = SAPCIC_POWER_5V;
+               } else {
+                       ip = (int *)p->data;
+                       sc->sc_socket[i].power_capability = ip[i];
+               }
+
                paa.paa_busname = "pcmcia";
                paa.pct = (pcmcia_chipset_tag_t)&sa11x0_pcmcia_functions;
                paa.pch = (pcmcia_chipset_handle_t)&sc->sc_socket[i];
diff -r 6994e6cd422e -r 46dd7210abe7 sys/arch/hpcarm/sa11x0/sa11xx_pcic.c
--- a/sys/arch/hpcarm/sa11x0/sa11xx_pcic.c      Sat Jul 07 08:10:15 2001 +0000
+++ b/sys/arch/hpcarm/sa11x0/sa11xx_pcic.c      Sat Jul 07 08:45:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11xx_pcic.c,v 1.3 2001/03/27 18:06:39 toshii Exp $   */
+/*     $NetBSD: sa11xx_pcic.c,v 1.4 2001/07/07 08:45:43 toshii Exp $   */
 
 /*
  * Copyright (c) 2001 IWAMOTO Toshihiro.  All rights reserved.
@@ -402,9 +402,16 @@
        sapcic_delay(300 + 100, "pccen0");
 
        /* power up the socket */
-       (so->pcictag->set_power)(so, so->socket ? SAPCIC_POWER_3V : SAPCIC_POWER_5V); /* XXX */
-       (so->pcictag->write)(so, SAPCIC_CONTROL_POWERSELECT,
-                            so->socket ? SAPCIC_POWER_3V : SAPCIC_POWER_5V); /* XXX */
+       /* XXX voltage selection should be done in PCMCIA code */
+       if (so->power_capability & SAPCIC_POWER_5V) {
+               (so->pcictag->set_power)(so, SAPCIC_POWER_5V);
+               (so->pcictag->write)(so, SAPCIC_CONTROL_POWERSELECT,
+                                    SAPCIC_POWER_5V);
+       } else {
+               (so->pcictag->set_power)(so, SAPCIC_POWER_3V);
+               (so->pcictag->write)(so, SAPCIC_CONTROL_POWERSELECT,
+                                    SAPCIC_POWER_3V);
+       }
 
        /* enable PCMCIA control lines */
        (so->pcictag->write)(so, SAPCIC_CONTROL_LINEENABLE, 1);
diff -r 6994e6cd422e -r 46dd7210abe7 sys/arch/hpcarm/sa11x0/sa11xx_pcicvar.h
--- a/sys/arch/hpcarm/sa11x0/sa11xx_pcicvar.h   Sat Jul 07 08:10:15 2001 +0000
+++ b/sys/arch/hpcarm/sa11x0/sa11xx_pcicvar.h   Sat Jul 07 08:45:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11xx_pcicvar.h,v 1.3 2001/07/07 08:10:15 ichiro Exp $        */
+/*     $NetBSD: sa11xx_pcicvar.h,v 1.4 2001/07/07 08:45:43 toshii Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -47,6 +47,8 @@
        int laststatus;
        int shutdown;
 
+       int power_capability;
+
        /* private data for pcictag functions */
        struct sa11x0_softc *saip_sc;
        struct sacc_softc *sacc_sc;



Home | Main Index | Thread Index | Old Index