Subject: Re: bug in cbb power reactivation (patch)
To: None <dyoung@pobox.com>
From: M. Warner Losh <imp@bsdimp.com>
List: tech-kern
Date: 04/17/2006 00:48:11
In message: <20060417035541.GI1787@che.ojctech.com>
            David Young <dyoung@pobox.com> writes:
: I have attached a patch that makes pccbb_power() consume the power-cycle
: event *always*, even on a powerup->powerdown transition.  Also, it DTRT
: before interrupts have been enabled.  Comments, please.

How extensively have you tested these changes?  When I did similar
work for FreeBSD, I discovered what appeared to be bridges that did
give a power-up interrupt, but didn't give a power-off interrupt.  Now
it is possible that I did something wrong, but when running the code
on some machines (TI based) it worked, and other machines (Ricoh
based) it didn't.  It would be prudent to at least test on TI bridges
and on Ricoh bridges to make sure that these details are handled
consistantly between them.

In the Ricoh data sheets, bit3 is named PowerUpComplete, and the
description is:
	This bit is set when the R5C478II detected to complete
	powering up the PC Card-32 socket.  The Socket Present State
	register should be read to determine whether or not the
	voltage requested was actually applied.  This bit is cleared
	by writing one.  ... This bit has no meaning when the 16-bit
	card is inserted.

Some of this is bad english, but I've also observed the bit only is
set when the socket powers up, but not down.

Contrast this with the TI-1410 datasheet, which is typical of the TI
line:
	Bit 3 is set when the PCI1410 detects that bit 3 (PWRCYCLE) in
	the socket present state register (CardBus offset 08h, see
	Section 6.3) has changed state. This bit is cleared by writing
	a 1.
and bit 3 of the socket present state register is described as
	Bit 3 indicates the status of each card powering request. This
	bit is encoded as: 0 = Socket powered down (default) 1 =
	Socket powered up

so it definitely is both directions.  I've observed this behavior as
well.

Warner