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.
This commit is contained in:
mycroft 2003-09-12 22:09:04 +00:00
parent 91e2bd73c5
commit ec14ab4b89
2 changed files with 12 additions and 21 deletions

View File

@ -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 <sys/cdefs.h>
__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;

View File

@ -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