Card Memory windows in client driver - how to access ?

Dominik Brodowski linux at dominikbrodowski.net
Tue Mar 23 11:30:02 EDT 2010


Hey,


On Mon, Mar 22, 2010 at 04:40:33PM -0700, raraks wrote:
> I have a 16 bit PCMCIA card driver I am working on which requires
> memory windows to read and write both attribute and common memory.
> Card needs only memory windows to work (no IO or irq).
> 
> I use the foll. method to get access to the card memory windows
> after setting up  the window attributes appropriately
> 
> link->conf.ConfigBase = parse.config.base;
> link->conf.Present = parse.config.rmask[0];

That's already available in
	p_dev->conf.ConfigBase
	p_dev->conf.Present
no need to overwrite it here. Unless, of course, you're using an oooold
kernel.

> link->conf.IntType = INT_MEMORY;

What happens if you set this to INT_MEMORY_AND_IO ?

> dev->request_attr_memory.Attributes = ( WIN_DATA_WIDTH_8 |
> WIN_MEMORY_TYPE_AM | WIN_ENABLE );
> dev->request_attr_memory.Base = 0;
> dev->request_attr_memory.Size = 0x1000;
> dev->request_attr_memory.AccessSpeed = 200;

Have you tried different accessspeed settings, or keeping it at 0?
> 
> ret = pcmcia_request_window(&link, &dev->request_attr_memory,
> &dev->handle_attr_memory);
> 
> if (ret != 0) {
>  cs_error(link, RequestWindow, ret);
> }

Using cs_error is deprecated.

> memreq_attr_memory.CardOffset = 0;

0?

> memreq_attr_memory.Page = 0;
> 
> ret = pcmcia_map_mem_page(dev->handle_attr_memory, &memreq_attr_memory);
> 
> if (ret != 0) {
>  cs_error(link, MapMemPage, ret);}
> 
> dev->attr_memory = ioremap( dev->request_attr_memory.Base,
> dev->request_attr_memory.Size);
> 
> All the above succeed and then I call pcmcia_request_configuration

Is this ordering correct? IIRC you shouldn't even have to call
pcmcia_request_configuration... 

Best,
	Dominik



More information about the linux-pcmcia mailing list