summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-11-11 15:54:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-11-11 15:54:26 +0000
commitfdc324b442a5abfb30c5fb71dd0e0523b7eb0516 (patch)
treea845b233dc6e182d02afce324af296d5f27e8a30 /sys/arch
parenteca89ecce3fcb8427ea554e977d2e1f5f67a8717 (diff)
Perform a bit more kbc initialization, instead of relying upon the prom to
do this for us; PS/2 ports on CADduo boards attach keyboard and mouse now. ok jsing@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sgi/dev/iockbc.c21
-rw-r--r--sys/arch/sgi/pci/iocreg.h14
2 files changed, 33 insertions, 2 deletions
diff --git a/sys/arch/sgi/dev/iockbc.c b/sys/arch/sgi/dev/iockbc.c
index 164ddc341c7..8c1bc2d4cb2 100644
--- a/sys/arch/sgi/dev/iockbc.c
+++ b/sys/arch/sgi/dev/iockbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iockbc.c,v 1.1 2009/11/10 15:50:09 jsing Exp $ */
+/* $OpenBSD: iockbc.c,v 1.2 2009/11/11 15:54:24 miod Exp $ */
/*
* Copyright (c) 2006, 2007, 2009 Joel Sing <jsing@openbsd.org>
*
@@ -228,6 +228,7 @@ iockbc_attach(struct device *parent, struct device *self, void *aux)
struct ioc_attach_args *iaa = aux;
struct pckbc_softc *sc = &isc->sc_pckbc;
struct pckbc_internal *t;
+ uint32_t csr;
/*
* For some reason keyboard and mouse ports are inverted on
@@ -271,6 +272,19 @@ iockbc_attach(struct device *parent, struct device *self, void *aux)
printf(": unable to establish interrupt\n");
/*
+ * Setup up controller: do not force pull clock and data lines low,
+ * clamp clocks after three bytes received.
+ */
+ csr = bus_space_read_4(isc->iot, isc->ioh, IOC3_KBC_CTRL_STATUS);
+ csr &= ~(IOC3_KBC_CTRL_KBD_PULL_DATA_LOW |
+ IOC3_KBC_CTRL_KBD_PULL_CLOCK_LOW |
+ IOC3_KBC_CTRL_AUX_PULL_DATA_LOW |
+ IOC3_KBC_CTRL_AUX_PULL_CLOCK_LOW |
+ IOC3_KBC_CTRL_KBD_CLAMP_1 | IOC3_KBC_CTRL_AUX_CLAMP_1);
+ csr |= IOC3_KBC_CTRL_KBD_CLAMP_3 | IOC3_KBC_CTRL_AUX_CLAMP_3;
+ bus_space_write_4(isc->iot, isc->ioh, IOC3_KBC_CTRL_STATUS, csr);
+
+ /*
* Attach "slots".
*/
iockbc_attach_slot(isc, PCKBC_KBD_SLOT);
@@ -401,6 +415,7 @@ iockbc_poll_write(struct pckbc_internal *t, pckbc_slot_t slot, int val)
delay(50);
}
+ DPRINTF("iockbc_poll_write: timeout, sts %08x\n", stat);
return -1;
}
@@ -423,6 +438,10 @@ iockbc_poll_read(struct pckbc_internal *t, pckbc_slot_t slot)
break;
delay(50);
}
+ if ((val & IOC3_KBC_DATA_VALID) == 0) {
+ DPRINTF("iockbc_poll_read: timeout, wx %08x\n", val);
+ return -1;
+ }
/* Process received data. */
if (val & IOC3_KBC_DATA_2_VALID)
diff --git a/sys/arch/sgi/pci/iocreg.h b/sys/arch/sgi/pci/iocreg.h
index 0029793595e..ac3a2b0c369 100644
--- a/sys/arch/sgi/pci/iocreg.h
+++ b/sys/arch/sgi/pci/iocreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iocreg.h,v 1.8 2009/11/10 15:50:10 jsing Exp $ */
+/* $OpenBSD: iocreg.h,v 1.9 2009/11/11 15:54:25 miod Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -111,6 +111,18 @@
/* bits in KBC_CTRL_STATUS */
#define IOC3_KBC_STATUS_KBD_WRITE_PENDING 0x00000001
#define IOC3_KBC_STATUS_AUX_WRITE_PENDING 0x00000002
+#define IOC3_KBC_STATUS_KBD_DATA 0x00000010
+#define IOC3_KBC_STATUS_KBD_CLOCK 0x00000020
+#define IOC3_KBC_CTRL_KBD_PULL_DATA_LOW 0x00000040
+#define IOC3_KBC_CTRL_KBD_PULL_CLOCK_LOW 0x00000080
+#define IOC3_KBC_STATUS_AUX_DATA 0x00000100
+#define IOC3_KBC_STATUS_AUX_CLOCK 0x00000200
+#define IOC3_KBC_CTRL_AUX_PULL_DATA_LOW 0x00000400
+#define IOC3_KBC_CTRL_AUX_PULL_CLOCK_LOW 0x00000800
+#define IOC3_KBC_CTRL_KBD_CLAMP_1 0x00100000
+#define IOC3_KBC_CTRL_AUX_CLAMP_1 0x00200000
+#define IOC3_KBC_CTRL_KBD_CLAMP_3 0x00400000
+#define IOC3_KBC_CTRL_AUX_CLAMP_3 0x00800000
/* bits in KBC_*_RX */
#define IOC3_KBC_DATA_0_VALID 0x80000000