PCMCIA fun

Kars de Jong jongk at linux-m68k.org
Fri Mar 19 10:06:59 GMT 2004


On Thu, 2004-03-18 at 00:05, Richard Zidlicky wrote:
> On Wed, Mar 17, 2004 at 10:11:30PM +0100, Kars de Jong wrote:
> > - drivers/pcmcia/rsrc_mgr.c:
> >   Uses readl() on ioremapped() PCMCIA common memory, but we don't define
> >   readl() unless CONFIG_PCI is defined. I added isa_readl() and
> >   isa_writel() and defined readl() and writel() to use those when 
> >   CONFIG_ISA is enabled. Gayle can handle these just fine, I don't know
> >   how to define isa_mtl() for CONFIG_Q40 and CONFIG_GG2 though. Richard?
> 
> What does your isa_writel do? Do you have a 32bit PCMCIA if?
> Q40 definitively has only 16 bit ISA so readl doesn't make much
> sense. I would expect 2 readw() behave like 1 readl() but I am
> not sure if we can rely on this.
> In rsrc_mgr.c it probably makes absolutely no difference ;)

No, the 32-bit PCMCIA interface is called CardBus and Gayle doesn't
support it.

After talking to some people at work, it seems that the Intel CPUs (or
bus interfaces) just do 2 atomic 16-bit transfers when a 32-bit transfer
is requested on a 16-bit bus.

Gayle probably does this too. It also doesn't have a split view of the
memory space for 8 or 16 bit accesses, it's one contiguous area (hence
the fact that the Gayle versions of isa_mt{wbl} don't do anything).

I suppose this is why memcpy_{to,from}io() exist, so this stuff can be
handled there. I suppose on Q40 and GG2 these need to be modified to do
the correct kind of memory accesses. The same goes for {read,write}l().

I have no idea how to handle this when a program does a mmap() from
user-space (XFree86?), since that expects to be able to just consider
the mapped area as memory. I suppose you'd have to let the processor
take a bus error and then do the transfer manually on the Q40 and GG2. I
wouldn't want to use a VGA card on such a beast :-P.

After reading what David Hinds had to say on the subject I guess I have
to conclude that the Gayle PCMCIA bus is not an ISA bus after all. It's
just a 16 bit bus which supports Intel-style I/O and memory cycles.
Hence the need for in{bw}()/out{bw}() support. Using the isa_*
definitions is actually wrong for PCMCIA drivers.

That does leave the fact that we need to solve ioremap() of ISA memory
on m68k. I thing the best way to do it is to make it behave like on
other architectures: if an ioremap() is done on an address < 16MB,
assume it's ISA. This does pose a nice problem on the Amiga which has
non-ISA resources in this range. On the other hand, that range is
always-mapped, so ioremap() and the drivers using those resources could
be made to detect this (call ioremap() with the always-mapped virtual
address instead of the physical address in drivers/video/amifb.c and
others).


Kind regards,

Kars.




More information about the linux-pcmcia mailing list