Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Establish a powerhook and make sure the card det...



details:   https://anonhg.NetBSD.org/src/rev/f70eb3baacac
branches:  trunk
changeset: 482785:f70eb3baacac
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Feb 22 02:35:26 2000 +0000

description:
Establish a powerhook and make sure the card detect interrupt is enabled
after resume from suspend, as i82365.c does.
This is a workaround for newer Sony VAIO notebook.
Patch is submitted by Atsushi Onoe (onoe%sm.sony.co.jp@localhost) in PR#9463.

diffstat:

 sys/dev/pci/pccbb.c |  36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diffs (61 lines):

diff -r 0eb8d64cd4e7 -r f70eb3baacac sys/dev/pci/pccbb.c
--- a/sys/dev/pci/pccbb.c       Tue Feb 22 02:17:05 2000 +0000
+++ b/sys/dev/pci/pccbb.c       Tue Feb 22 02:35:26 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pccbb.c,v 1.24 2000/02/21 01:44:36 thorpej Exp $       */
+/*     $NetBSD: pccbb.c,v 1.25 2000/02/22 02:35:26 enami Exp $ */
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -167,6 +167,7 @@
 static void pccbb_pcmcia_do_io_map __P((struct pcic_handle *, int));
 static void pccbb_pcmcia_wait_ready __P((struct pcic_handle *));
 static void pccbb_pcmcia_do_mem_map __P((struct pcic_handle *, int));
+static void pccbb_powerhook __P((int, void *));
 
 /* bus-space allocation and disallocation functions */
 #if rbus
@@ -587,6 +588,7 @@
        }
 
        printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
+       powerhook_establish(pccbb_powerhook, sc);
 
        {
                u_int32_t sockstat =
@@ -3104,3 +3106,35 @@
 }
 
 #endif /* rbus */
+
+static void
+pccbb_powerhook(why, arg)
+       int why;
+       void *arg;
+{
+       struct pccbb_softc *sc = arg;
+       u_int32_t reg;
+       bus_space_tag_t base_memt = sc->sc_base_memt;   /* socket regs memory */
+       bus_space_handle_t base_memh = sc->sc_base_memh;
+
+       DPRINTF(("%s: power: why %d\n", sc->sc_dev.dv_xname, why));
+
+       if (why == PWR_RESUME) {
+               /* CSC Interrupt: Card detect interrupt on */
+               reg = bus_space_read_4(base_memt, base_memh, CB_SOCKET_MASK);
+               /* Card detect intr is turned on. */
+               reg |= CB_SOCKET_MASK_CD;
+               bus_space_write_4(base_memt, base_memh, CB_SOCKET_MASK, reg);
+               /* reset interrupt */
+               reg = bus_space_read_4(base_memt, base_memh, CB_SOCKET_EVENT);
+               bus_space_write_4(base_memt, base_memh, CB_SOCKET_EVENT, reg);
+
+               /*
+                * check for card insertion or removal during suspend period.
+                * XXX: the code can't cope with card swap (remove then insert).
+                * how can we detect such situation?
+                */
+               if (why == PWR_RESUME)
+                       (void)pccbbintr(sc);
+       }
+}



Home | Main Index | Thread Index | Old Index