> Date: Thu, 15 Dec 2011 22:21:19 -0500
> From: Brian Callahan <kors...@gmail.com>
> 
>       On my Lenovo ThinkPad Edge E420, when inserting an SD card into its
> built-in card slot, I am presented with a random number of the
> following five error messages:
> sdmmc0: can't supply bus power
> sdmmc0: can't enable card
> sdmmc0: can't set mem RCA
> sdmmc0: can't identify card
> sdmmc0: no functions

Does the following diff work?

Index: sdhc_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/sdhc_pci.c,v
retrieving revision 1.11
diff -u -p -r1.11 sdhc_pci.c
--- sdhc_pci.c  31 Jul 2011 16:55:01 -0000      1.11
+++ sdhc_pci.c  16 Dec 2011 21:53:12 -0000
@@ -98,11 +98,42 @@ sdhc_pci_attach(struct device *parent, s
 
        /* Some RICOH controllers lack a capability register. */
        if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RICOH &&
-           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823)
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823) {
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xf8);
+               reg &= ~0x0000ff00;
+               reg |= 0x0000fc00;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0xf8, reg);
+
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x150);
+               reg &= ~0x000000ff;
+               reg |= 0x00000010;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0x150, reg);
+
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xf8);
+               reg &= ~0x0000ff00;
+               reg |= 0x00000000;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0xf8, reg);
+
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xfc);
+               reg &= ~0x000000ff;
+               reg |= 0x00000001;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0xfc, reg);
+
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xe0);
+               reg &= ~0x0000ff00;
+               reg |= 0x00003200;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0xe1, reg);
+
+               reg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xfc);
+               reg &= ~0x000000ff;
+               reg |= 0x00000000;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, 0xfc, reg);
+
                caps = (0x21 << SDHC_BASE_FREQ_SHIFT) |
                        (0x21 << SDHC_TIMEOUT_FREQ_SHIFT) |
                        SDHC_TIMEOUT_FREQ_UNIT | SDHC_VOLTAGE_SUPP_3_3V |
                        SDHC_DMA_SUPPORT;
+       }
 
        if (pci_intr_map(pa, &ih)) {
                printf(": can't map interrupt\n");

Reply via email to