UDMA for Compact Flash over PC Card?

Asher asher at inbox.com
Mon Mar 24 08:33:29 EDT 2008


I tried your patch in my laptop (see appendix) to speed up PCMCIA card.
Unfortunatelly with no great speed increase. My experience might help you?

I used vanilla 2.6.15 and your generic.patch. 
I realized, that on my hardware the interrupt does not work. 
I fixed this problem by switching back to IntType=INT_MEMORY_AND_IO 
(instead of INT_MEMORY) - and interrupt started to operate.
But next problem: after ide_execute_command (file ide-iops.c) the interrupt 
was not understand.
It was throwen away after check by the function drive_is_ready
(file ide-iops.c). 
I realized, that it is due to timing and folowing piece of code 
(in function drive_is_ready) helps a lot:

--- former/ide-iops.c	2006-01-03 04:21:10.000000000 +0100
+++ ide-iops.c	2008-03-24 12:36:27.400422043 +0100
@@ -486,6 +486,17 @@
 		/* Note: this may clear a pending IRQ!! */
 		stat = hwif->INB(IDE_STATUS_REG);
 
+	int i;
+	for(i=0;i<1000;i++)
+	{
+		if (! (stat & BUSY_STAT))
+			break;
+		stat = hwif->INB(IDE_ALTSTATUS_REG);
+		udelay(1);
+	}
+	if(i==1000)
+		printk("DRIVE_IS_NOT_READY:%X,i:%d\n",(int)stat,i);
+
 	if (stat & BUSY_STAT)
 		/* drive busy:  definitely not interrupting */
 		return 0;

Frankly: wait for up to 1000 times one microsecond until the device says it's
ready. Otherwise print an message (both is poor hack). 
After that I was able to see partitions, but mount worked badly with more
problems, but sometimes (twice) it worked. 
I guess the problem is somewhere in ide-taskfile.c connected to some
timing - similar as above. 
I had no time to hunt it an I continued to measure the speed.

After that problematic mount I was able to check the speed of your patch. 
I measured reading of file of 30Mbytes within 30 second, which is about 
the same (horribly slow) rate as PIO0 available in vanilla code.

Please, can you tell, what speed do you expect/measure from such memory mapped
io method? 
Is it possible to go forward the theoretical maximum 20MBytes per second? 
Do you have any suggestion - did I do something wrong? 
Should I change some timming?
Please can you let here the argumentation why kernel people refused Thomas
Keffel patch?
Thank you for any suggestion.

I also tried to connect my pretec 8GByte 333x Compact flash to IDE interface and
maximum speed I achieved is 20MBytes / udma2. 
I said to myself, that the IDE drive might be old and slow. 
Did anyone try that with better speed? 
My cf card should be capable to read at 50MB/s and write at 40MB/s. 
Is it easier to build my embedded hardware in ide/cf mode? 

Or better to focuse to sata interface to connect compact flash to linux in a
fast way? 
Thank you for any suggestion.

Sincerely, asher



Appendix: about my hardware:
A) Laptop dell lattitude D620, Compact Flash pretec 8GB 333x, 
passive "pretec" pcmcia/cf adapter.
-------------------------
lspci says:
0000:00:00.0 Host bridge: Intel Corp.: Unknown device 27a0 (rev 03)
0000:00:01.0 PCI bridge: Intel Corp.: Unknown device 27a1 (rev 03)
0000:00:1b.0 Class 0403: Intel Corp.: Unknown device 27d8 (rev 01)
0000:00:1c.0 PCI bridge: Intel Corp.: Unknown device 27d0 (rev 01)
0000:00:1c.1 PCI bridge: Intel Corp.: Unknown device 27d2 (rev 01)
0000:00:1c.2 PCI bridge: Intel Corp.: Unknown device 27d4 (rev 01)
0000:00:1d.0 USB Controller: Intel Corp.: Unknown device 27c8 (rev 01)
0000:00:1d.1 USB Controller: Intel Corp.: Unknown device 27c9 (rev 01)
0000:00:1d.2 USB Controller: Intel Corp.: Unknown device 27ca (rev 01)
0000:00:1d.3 USB Controller: Intel Corp.: Unknown device 27cb (rev 01)
0000:00:1d.7 USB Controller: Intel Corp.: Unknown device 27cc (rev 01)
0000:00:1e.0 PCI bridge: Intel Corp. 82801 Mobile PCI Bridge (rev e1)
0000:00:1f.0 ISA bridge: Intel Corp.: Unknown device 27b9 (rev 01)
0000:00:1f.2 IDE interface: Intel Corp.: Unknown device 27c4 (rev 01)
0000:00:1f.3 SMBus: Intel Corp.: Unknown device 27da (rev 01)
0000:01:00.0 VGA compatible controller: nVidia Corporation: Unknown device 01d7
(rev a1)
0000:03:01.0 CardBus bridge: O2 Micro, Inc. OZ6912 Cardbus Controller (rev 40)
0000:09:00.0 Ethernet controller: Broadcom Corporation: Unknown device 1600 
(rev 02)
0000:0c:00.0 Network controller: Broadcom Corporation: Unknown device 4311 
(rev 01)

-------------------------------
B) dmesg fragment (your patch before my changes):

XFS mounting filesystem sda7
Ending clean XFS mount for filesystem: sda7
usb 2-2.3: new full speed USB device using uhci_hcd and address 3
hub 2-2.3:1.0: USB hub found
hub 2-2.3:1.0: 3 ports detected
usb 2-2.4: new full speed USB device using uhci_hcd and address 4
usb 2-2.3.2: new full speed USB device using uhci_hcd and address 5
Bluetooth: Core ver 2.8
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: HCI USB driver ver 2.9
usbcore: registered new driver hci_usb
sd 0:0:0:0: Attached scsi generic sg0 type 0
ACPI: PCI Interrupt 0000:00:1b.0[A] -> GSI 21 (level, low) -> IRQ 20
PCI: Setting latency timer of device 0000:00:1b.0 to 64
tg3.c:v3.47 (Dec 28, 2005)
ACPI: PCI Interrupt 0000:09:00.0[A] -> GSI 18 (level, low) -> IRQ 18
PCI: Setting latency timer of device 0000:09:00.0 to 64
eth0: Tigon3 [partno(BCM5752KFBG) rev 6002 PHY(5752)] (PCI Express)
10/100/1000BaseT Ethernet 00:18:8b:c4:92:29
eth0: RXcsums[1] LinkChgREG[1] MIirq[1] ASF[0] Split[0] WireSpeed[1] TSOcap[1] 
eth0: dma_rwctrl[76180000]
ACPI: PCI Interrupt 0000:03:01.0[A] -> GSI 18 (level, low) -> IRQ 18
Yenta: CardBus bridge found at 0000:03:01.0 [1028:01c2]
Yenta O2: res at 0x94/0xD4: 00/ea
Yenta O2: enabling read prefetch/write burst
Yenta: ISA IRQ mask 0x0cb8, PCI irq 18
Socket status: 30000006
pcmcia: parent PCI bridge I/O window: 0x2000 - 0x2fff
cs: IO port probe 0x2000-0x2fff: clean.
pcmcia: parent PCI bridge Memory window: 0x52000000 - 0x54ffffff
pcmcia: parent PCI bridge Memory window: 0x50000000 - 0x51ffffff
cs: IO port probe 0xc00-0xcff: clean.
cs: IO port probe 0x800-0x8ff: excluding 0x808-0x80f
cs: IO port probe 0x100-0x4ff: excluding 0x3b0-0x3df 0x3f0-0x3ff
cs: IO port probe 0xa00-0xaff: clean.
XFS: unknown mount option [nobarrier].
Adding 1959888k swap on /dev/sda5.  Priority:-1 extents:1 across:1959888k
pccard: PCMCIA card inserted into slot 0
cs: memory probe 0xa0000000-0xa0ffffff: clean.
pcmcia: registering new device pcmcia0.0
ide-cs: trying ide_register() at 0xf8936000 & 0xf893600e, mmio = yes
Probing IDE interface ide0...
hda: RCFS08GABSLAC, CFA DISK drive
ide0 at 0xf8936400-0xf8936407,0xf893600e on irq 3
hda: max request size: 128KiB
hda: 15924384 sectors (8153 MB) w/1KiB Cache, CHS=15798/16/63
hda: cache flushes not supported
 hda:<4>hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
 hda1
ide-cs: hda: Vcc = 3.3, Vpp = 0.0
 hda:<4>hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
 hda1
 hda:<4>hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
 hda1
 hda:<4>hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
hda: lost interrupt
 hda1
 hda:<4>hda: lost interrupt
hda: lost interrupt





More information about the linux-pcmcia mailing list