from 2.4 Card Services to 2.6 linux-pcmcia

Guy Léonis Guy.Leonis at spacebel.be
Mon Dec 20 10:20:12 EST 2010


Dear Dominik,

Thank you for your first class support. The given documentation was extremely helpful.

If you have 5 minutes more for me, it would be wonderful.
I succeeded in 'porting' the driver, making changes according to the provided documentation.
At least, I can compile it and 'insmod' it without problem.
But I am unable to use it: when trying to write to a card register, the kernel hangs and the 'CAPS LOCK' starts blinking at constant frequency.
I must have forgotten something when migrating the driver, but I cannot figure out what. Any clue would be beneficial, thanks.

I have attached the driver code, which is more or less 'private' because I still haven't discussed license issues with DDC (ILC Data Device Corp). Here is a short description of what I have understood/investigated:
- kernel RHEL 5.5 (2.6.18-194.el5)
- MIL-STD-1553 I/F card from DDC (1553 is a master/slave bus protocol) with configuration registers and 4k RAM for input and output messages
- card recognised, here is 'lspcmci -vv' output:
    Socket 0 Bridge:   	[yenta_cardbus] 	(bus ID: 0000:15:00.0)
    	Configuration:	state: on	ready: yes
    			Voltage: 5.0V Vcc: 5.0V Vpp: 0.0V
    			Available IRQs: 3, 4, 5, 7, 10
    			Available ioports:0x00000100 - 0x000003af
    						0x000003e0 - 0x000004ff
    						0x00000820 - 0x000008ff
    						0x00000a00 - 0x00000aff
    						0x00000c00 - 0x00000cf7
    						0x00008000 - 0x0000bfff
    			Available iomem:	0x000c0000 - 0x000fffff
    						0x60000000 - 0x60ffffff
    						0xa0000000 - 0xa0ffffff
    						0xf84f0000 - 0xf8ccffff
    						0xf90c0000 - 0xf9c8ffff
    Socket 0 Device 0:	[pcmace]		(bus ID: 0.0)
    	Configuration:	state: on
    	Product Name:   ILC DATA DEVICE CORPORATION BU-65550M2-605 MIL-STD-1553 BC/RT/MT REVISION C 
    	Identification:	manf_id: 0x014c	card_id: 0x0101
    			prod_id(1): "ILC DATA DEVICE CORPORATION" (0x1ea29d68)
    			prod_id(2): "BU-65550M2-605" (0xee6d3698)
    			prod_id(3): "MIL-STD-1553 BC/RT/MT" (0x5714a56e)
    			prod_id(4): "REVISION C" (0x77e5469e)
- 'init' does the register_chrdev
- 'open' does a request_mem_region then a __ioremap
- 'mmap' does a request_mem_region then a remap_pfn_range
- printk done from the driver seems OK:
    pcmcia: parent PCI bridge Memory window: 0xf8100000 - 0xfbffffff
    pcmcia: parent PCI bridge Memory window: 0xf4000000 - 0xf7ffffff
    pcmcia: registering new device pcmcia0.0
    ...
    pcmace: entering fops_open
    pcmace: fops_open: 0xf84f1000 0x1000
    pcmace: entering fops_mmap
    pcmace: fops_mmap: start f7ffc000
    pcmace: fops_mmap: WndPcmciaWinAddr f84f1000
    pcmace: fops_mmap: WndPcmciaWinSize 1000
- /proc/iomem seems to show a good result too:
    ...
    f4000000-f7ffffff : PCI Bus #15
      f4000000-f5ffffff : PCI CardBus #16
      f7ffc000-f7ffcfff : pcmace
    f8000000-f80fffff : PCI Bus #02
    f8100000-fbffffff : PCI Bus #15
      f8100000-f8100fff : 0000:15:00.0
        f8100000-f8100fff : yenta_socket
      f8101000-f81017ff : 0000:15:00.1
      f8101800-f81018ff : 0000:15:00.2
        f8101800-f81018ff : sdhci:slot0
      f8101c00-f8101cff : 0000:15:00.3
      f8102000-f81020ff : 0000:15:00.4
      f8102400-f81024ff : 0000:15:00.5
      f84f0000-f84f0fff : pcmcia_socket0
      f84f1000-f84f1fff : pcmcia_socket0
        f84f1000-f84f1fff : pcmace
      f84f2000-f84f3fff : pcmcia_socket0
    ...
- gdb on the test process gives:
    253               if ((mptr->register_fd = open(RegisterDevicePath, O_RDWR)) < 0 )
    (gdb) n
    272               memBase = (u_short *) mmap(NULL, RegisterLength,
    (gdb) 
    275               RegisterBase = memBase;
    (gdb) 
    364             reg_write(START_REG,0x0001);
    (gdb) s
    reg_write (offset=3, data=1) at m1553_interface.c:80
    84          *(RegisterBase+offset) = data;
    (gdb) p *RegisterBase
    Cannot access memory at address 0xf7ffc000
    (gdb) p *0xf84f1000
    Cannot access memory at address 0xf84f1000
    (gdb) p *(RegisterBase+offset)
    Cannot access memory at address 0xf7ffc006
    (gdb) n
  and the kernel hangs when writing to the cell.
I am a bit surprised because I cannot read the cell from gdb, but writing kills the kernel and I was thinking that writing was impossible because reading is impossible. I was expecting a 'Segmentation Violation', not a kernel hanging.

Again, thank you for the already provided support. Best regards,

Guy Léonis 




Spacebel                    Tel   : +32-26 58 20 27
I. Vandammestraat 7 bus 1   Fax   : +32-26 58 20 90
B-1560 Hoeilaart            email : Guy.Leonis at spacebel.be
BELGIUM
-------------- next part --------------
An embedded message was scrubbed...
From: "Dominik Brodowski" <linux at dominikbrodowski.net>
Subject: Re: from 2.4 Card Services to 2.6 linux-pcmcia
Date: Tue, 14 Dec 2010 17:44:33 +0100
Size: 3554
URL: <http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20101220/f613e5f4/attachment-0001.mht>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcmace.c
Type: application/octet-stream
Size: 97072 bytes
Desc: pcmace.c
URL: <http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20101220/f613e5f4/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcmace.h
Type: application/octet-stream
Size: 9712 bytes
Desc: pcmace.h
URL: <http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20101220/f613e5f4/attachment-0003.obj>


More information about the linux-pcmcia mailing list