Subject: Re: pcmcia multifunction cards and CCR window mapping
To: Antti Kantee <pooka@iki.fi>
From: Gregory McGarry <g.mcgarry@ieee.org>
List: tech-kern
Date: 08/24/2001 08:54:48
Antti Kantee wrote:

> I'm trying to get the Psion Gold Card ethernet supported by the
> sm-driver. It's basically working, but I have a slight problem with the
> CCR registers.
> 
> The CCR register window is (un)mapped in pcmcia_function_dis/enable().
> On multifunction cards, CCR registers are used in
> pcmcia_intr_dis/establish(). Currently the driver calls these two
> functions in the wrong order, so pcmcia_ccr_read() called from
> intr_dis/establish() pagefaults. I solved the problem by reversing the
> order of the calls, and everything seems to work fine now. Is there any
> reason why this wouldn't be a good solution?

You're right, this is a problem and rearranging the calls shouldn't
matter.  A few notes:

- I suppose all pcmcia drivers should be changed to be consistent.
  Putting a panic in pcmcia_intr_establish() if the function isn't
  enabled would be useful for tracking these down.

- There are some drivers which establish the interrupt once during
  attach and freely enable and disable the card.  This might be a
  problem on multi-function cards?

- pcmcia(9) should be updated to reflect the clarification in the API.

> However, what I definately can't understand, is why sm_pcmcia_enable()
> works happily the first time when it's called even if the above calls
> are "in the wrong order".

I dunno.  Which chipset do you have?  Setting a breakpoint on
 sm_pcmcia_enable() and getting a stacktrace may give you an idea.

	-- Gregory McGarry <g.mcgarry@ieee.org>