From ec14ab4b890ec9e6faef1c67a6ce58982feb40a1 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 12 Sep 2003 22:09:04 +0000 Subject: [PATCH] The Ricoh power hackery is not reliable -- many cards just do not have the voltage sense wired. So, disable it and force the card to 5V by default. Also, recode the hack to use the "direct Vcc" feature of the chip, letting it manage the voltage directly, as this is supported on both the 296 and 396. --- sys/dev/ic/i82365.c | 30 ++++++++++-------------------- sys/dev/ic/i82365reg.h | 3 ++- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c index 866949cec2df..5c8de6299de2 100644 --- a/sys/dev/ic/i82365.c +++ b/sys/dev/ic/i82365.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82365.c,v 1.75 2003/09/05 01:02:51 mycroft Exp $ */ +/* $NetBSD: i82365.c,v 1.76 2003/09/12 22:09:04 mycroft Exp $ */ /* * Copyright (c) 2000 Christian E. Hopps. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.75 2003/09/05 01:02:51 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.76 2003/09/12 22:09:04 mycroft Exp $"); #define PCICDEBUG @@ -1425,7 +1425,6 @@ pcic_chip_socket_enable(pch) { struct pcic_handle *h = (struct pcic_handle *) pch; int cardtype, win, intr, pwr; - int vcc_3v, regtmp; #if defined(DIAGNOSTIC) || defined(PCICDEBUG) int reg; #endif @@ -1456,25 +1455,16 @@ pcic_chip_socket_enable(pch) switch( h->vendor ) { case PCIC_VENDOR_RICOH_5C296: case PCIC_VENDOR_RICOH_5C396: - vcc_3v = 0; - regtmp = pcic_read(h, PCIC_CARD_DETECT); - if(regtmp & PCIC_CARD_DETECT_GPI_ENABLE) { - DPRINTF(("\nGPI is enabled. Can't sense VS1\n")); - } else { - regtmp = pcic_read(h, PCIC_IF_STATUS) ; - vcc_3v = (regtmp & PCIC_IF_STATUS_GPI) ? 1 : 0; - DPRINTF(("\n5VDET = %s\n", - vcc_3v ? "1 (3.3V)" : "0 (5V)")); - } - + { + int regtmp; regtmp = pcic_read(h, PCIC_RICOH_REG_MCR2); - regtmp &= ~PCIC_RICOH_MCR2_VCC_SEL_MASK; - if(vcc_3v) { - regtmp |= PCIC_RICOH_MCR2_VCC_SEL_3V; - } else { - regtmp |= PCIC_RICOH_MCR2_VCC_SEL_5V; - } +#ifdef RICOH_POWER_HACK + regtmp |= PCIC_RICOH_MCR2_VCC_DIRECT; +#else + regtmp &= ~(PCIC_RICOH_MCR2_VCC_DIRECT|PCIC_RICOH_MCR2_VCC_SEL_3V); +#endif pcic_write(h, PCIC_RICOH_REG_MCR2, regtmp); + } break; default: break; diff --git a/sys/dev/ic/i82365reg.h b/sys/dev/ic/i82365reg.h index 10d6f543003b..d282cac8a975 100644 --- a/sys/dev/ic/i82365reg.h +++ b/sys/dev/ic/i82365reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82365reg.h,v 1.7 2002/11/24 02:46:55 takemura Exp $ */ +/* $NetBSD: i82365reg.h,v 1.8 2003/09/12 22:09:04 mycroft Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -348,6 +348,7 @@ #define PCIC_RICOH_CHIP_ID_5C296 0x32 #define PCIC_RICOH_CHIP_ID_5C396 0xB2 #define PCIC_RICOH_REG_MCR2 0x2F +#define PCIC_RICOH_MCR2_VCC_DIRECT 0x08 #define PCIC_RICOH_MCR2_VCC_SEL_MASK 0x01 #define PCIC_RICOH_MCR2_VCC_SEL_3V 0x01 #define PCIC_RICOH_MCR2_VCC_SEL_5V 0x00