Date: Wed, 15 Mar 2000 00:41:14 -0700 From: Warner Losh <imp@village.org> To: John Hay <jhay@mikom.csir.co.za>, freebsd-mobile@FreeBSD.ORG Subject: Re: No PC-CARD Slots; Device Not Configured Message-ID: <200003150741.AAA81106@harmony.village.org> In-Reply-To: Your message of "Tue, 14 Mar 2000 23:25:20 MST." <200003150625.XAA50080@harmony.village.org> References: <200003150625.XAA50080@harmony.village.org> <200003150623.IAA64088@zibbi.mikom.csir.co.za>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <200003150625.XAA50080@harmony.village.org> Warner Losh writes:
: In message <200003150623.IAA64088@zibbi.mikom.csir.co.za> John Hay writes:
: : If you can find it, I volunteer to try it out. :-)
:
: I can find and/or rewrite it.
Wound up being impatient, and rewrote it. Turns out I didn't have the
cardbus pci card in the unit I sent to be repaired. This is lightly
tested. Looks a lot like the pd6832 version, but is different in a
few subtle ways. I suspect that we always want to do most, if not
all, of what I'm doing here. Will save us some grief no doubt. Maybe
even have a suspend/resume code to do something similar to help
some newer laptops a little before we get acpi.
Hmmm, now where did I put that paper copy of the standard that I
have. I'll have to verify this against yenta at some point. But not
tonight. Tonight I sleep.
I got my card to work in polling mode, but didn't have a spare IRQ on
my server and didn't want to try too configure one either since the
cardbus card is in the system only for a short while... Well, also
when I did specify an IRQ it was wrong and it didn't work :-)
If you have a laptop that exhibits the no slots found problem, and
have a TI 12xx chipset, please give this a spin and let me know if it
fixes it. If you don't have the no slots found problem, but do have a
TI 12xx chipset, try it and let me know if I've broken something for
you :-)
Also, don't believe the comments in the header of the
ti12xx_legacy_init code too much. The TI doc is good in some places
about calling out differences from the standard, and lousy in other
places. That's why I need to go over this when I have my pcmcia
standard paper copy in front of me and enough brain cells to ponder it
more fully.
If I was really massocistic, I'd try to talk to the cardbus bridge in
non-legacy mode and implement a newbus attachment. But I'm going to
do that anyway for NEWCARD :-)
Warner
Index: pcic_p.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/pci/pcic_p.c,v
retrieving revision 1.20
diff -u -r1.20 pcic_p.c
--- pcic_p.c 2000/02/02 16:49:21 1.20
+++ pcic_p.c 2000/03/15 07:30:23
@@ -112,6 +112,59 @@
}
/*
+ * According to the docs for the TI chipset, this will work with any YENTA
+ * conforming card bus bridge.
+ */
+static void
+ti12xx_legacy_init(device_t self)
+{
+ u_long bcr; /* to set interrupts */
+ u_short io_port; /* the io_port to map this slot on */
+
+ /*
+ * First, just to be "safe", we muck with the power registers
+ * to put the chip into D0 power state. But read the power
+ * management capabilities register first and only do it for
+ * version 1 cards.
+ */
+ if ((pci_read_config(self, 0xa2, 2) & 0x7) == 0x1) {
+ pci_write_config(self, 0xa4,
+ pci_read_config(self, 0xa4, 2) & ~0x3, 2);
+ }
+
+ /*
+ * Only set legecay mode on first card. This will have
+ * functions 0 and 1 and will probe as units 0 and 1.
+ */
+ if (device_get_unit(self) > 1)
+ return;
+
+ /*
+ * Set legacy I/O address to 0x3e0. Only need to do this
+ * for first function/unit.
+ */
+ if (device_get_unit(self) != 0) {
+ io_port = PCIC_INDEX_0;
+ pci_write_config(self, CLPD6832_LEGACY_16BIT_IOADDR,
+ io_port & ~PCI_MAP_IO, 4);
+ }
+
+ /*
+ * Set default operating mode (I/O port space, Parity error enable
+ * and busmaster).
+ */
+ pci_write_config(self, PCI_COMMAND_STATUS_REG,
+ pci_read_config(self, PCI_COMMAND_STATUS_REG, 2) | 0x47, 2);
+
+ /*
+ * Enable isa-style IRQ interrupts.
+ */
+ bcr = pci_read_config(self, 0x3e, 2);
+ bcr |= 0x84;
+ pci_write_config(self, 0x3e, bcr, 2);
+}
+
+/*
* Return the ID string for the controller if the vendor/product id
* matches, NULL otherwise.
*/
@@ -215,6 +268,13 @@
u_int32_t device_id = pci_get_devid(self);
switch (device_id) {
+ case PCI_DEVICE_ID_PCIC_TI1220:
+ case PCI_DEVICE_ID_PCIC_TI1221:
+ case PCI_DEVICE_ID_PCIC_TI1250:
+ case PCI_DEVICE_ID_PCIC_TI1251:
+ case PCI_DEVICE_ID_PCIC_TI1251B:
+ case PCI_DEVICE_ID_PCIC_TI1225:
+ ti12xx_legacy_init(self);
case PCI_DEVICE_ID_PCIC_CLPD6832:
pd6832_legacy_init(self);
break;
Index: pcic_p.h
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/pci/pcic_p.h,v
retrieving revision 1.10
diff -u -r1.10 pcic_p.h
--- pcic_p.h 1999/12/31 07:22:24 1.10
+++ pcic_p.h 2000/02/07 05:47:36
@@ -52,6 +52,8 @@
#define PCI_DEVICE_ID_RICOH_RL5C475 0x04751180ul
#define PCI_DEVICE_ID_RICOH_RL5C476 0x04761180ul
#define PCI_DEVICE_ID_RICOH_RL5C478 0x04781180ul
+
+#define PCI_DEVICE_ID_COMPAQ_CARDBUS_READER 0x010013f6ul
/* CL-PD6832 CardBus defines */
#define CLPD6832_IO_BASE0 0x002c
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003150741.AAA81106>
