Problems with pcmcia code

David Hinds dhinds at
Tue Oct 21 11:26:19 BST 2003

On Tue, Oct 21, 2003 at 10:50:36AM -0500, Larry W. Finger wrote:
> yenta_sock_init: entry
> yenta_sock_init: re-enabling CSC interrupts

At a glance, I think there could be several bugs in yenta_sock_init().
Whenever you write to the CB_SOCKET_MASK register, you must always
also do:

	cb_writel(socket, CB_SOCKET_EVENT, -1);

This might account for the every-other-insert-is-seen behavior, though
it doesn't seem to be completely consistent with that.

Also I am suspicious of this:

	cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);

I would instead try something like:

	u32 state = cb_readl(socket, CB_SOCKET_STATE);
	if (!(state & (CB_CDETECT1 | CB_CDETECT2 | CB_5VCARD |
		cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);

I'm not sure I can give a succinct explanation why.  I only remember
that "bad things happened" when I tried using CVSTEST liberally, and I
later decided to never use it on a socket that had already completed
card interrogation.

To the original poster, I'd suggest using "cardctl eject" and "cardctl
insert" to trigger soft insert and eject events, to separate the event
detection issue from what the modules do in response to the events.

-- Dave

More information about the linux-pcmcia mailing list