summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-09-06 08:01:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-09-06 08:01:02 +0000
commit47262e2d33ab712b068ff95f285a7507eaea6669 (patch)
tree2a248a93914928182cd93d62c43a86dbe6776851
parenteb6444be9218520b716f377b4ca282b6fd8ff64b (diff)
Don't try disabling bus power before setting the voltage on
the buggy ENE controller. Tested by Alexey Suslikov <alexey.suslikov@gmail.com> who pointed out a similiar workaround in Linux. ok miod@, nit and ok kettenis@
-rw-r--r--sys/dev/pci/sdhc_pci.c7
-rw-r--r--sys/dev/sdmmc/sdhc.c5
-rw-r--r--sys/dev/sdmmc/sdhcvar.h6
3 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/pci/sdhc_pci.c b/sys/dev/pci/sdhc_pci.c
index 5ae66552af5..46a7ebe66f0 100644
--- a/sys/dev/pci/sdhc_pci.c
+++ b/sys/dev/pci/sdhc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc_pci.c,v 1.5 2006/07/19 20:58:45 fgsch Exp $ */
+/* $OpenBSD: sdhc_pci.c,v 1.6 2007/09/06 08:01:01 jsg Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -85,6 +85,11 @@ sdhc_pci_attach(struct device *parent, struct device *self, void *aux)
pa->pa_function == 4)
sdhc_takecontroller(pa);
+ /* ENE controllers break if set to 0V bus power */
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ENE &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ENE_SDCARD)
+ sc->sc.sc_flags |= SDHC_F_NOPWR0;
+
if (pci_intr_map(pa, &ih)) {
printf(": can't map interrupt\n");
return;
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c
index 295d0ce5047..52220e17205 100644
--- a/sys/dev/sdmmc/sdhc.c
+++ b/sys/dev/sdmmc/sdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc.c,v 1.21 2007/05/31 23:37:21 uwe Exp $ */
+/* $OpenBSD: sdhc.c,v 1.22 2007/09/06 08:01:01 jsg Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -390,7 +390,8 @@ sdhc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
/*
* Disable bus power before voltage change.
*/
- HWRITE1(hp, SDHC_POWER_CTL, 0);
+ if (!(hp->sc->sc_flags & SDHC_F_NOPWR0))
+ HWRITE1(hp, SDHC_POWER_CTL, 0);
/* If power is disabled, reset the host and return now. */
if (ocr == 0) {
diff --git a/sys/dev/sdmmc/sdhcvar.h b/sys/dev/sdmmc/sdhcvar.h
index f129f2fdb16..be883e395e5 100644
--- a/sys/dev/sdmmc/sdhcvar.h
+++ b/sys/dev/sdmmc/sdhcvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhcvar.h,v 1.2 2006/07/17 20:48:27 fgsch Exp $ */
+/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -27,6 +27,7 @@ struct sdhc_softc {
struct device sc_dev;
struct sdhc_host **sc_host;
int sc_nhosts;
+ u_int sc_flags;
};
/* Host controller functions called by the attachment driver. */
@@ -36,4 +37,7 @@ void sdhc_power(int, void *);
void sdhc_shutdown(void *);
int sdhc_intr(void *);
+/* flag values */
+#define SDHC_F_NOPWR0 (1 << 0)
+
#endif