Re: Problem accessing Sandisk CompactFlash Cards (Connected to the IDE bus)

From: Marc Strämke
Date: Mon Aug 30 2004 - 10:52:17 EST


Tracing back through the code it looks to me like we get the ATA disk print in the event that this test in do_identify:
/*
* Check for an ATAPI device
*/
if (cmd == WIN_PIDENTIFY) {

that would explain why the drive_is_flashcard test is getting skipped, why setting removable is making no difference, and why your card is being identified as an ATA device. It looks as though the WIN_PIDENTIFY command is sent down to this routine from ide_probe_for_drive in this snip of code:

/* if !(success||timed-out) */
if (do_probe(drive, WIN_IDENTIFY) >= 2) {
/* look for ATAPI device */
(void) do_probe(drive, WIN_PIDENTIFY);
}
Both Cards, the old and the new on dont get to the ATAPI probing (which seems correct to me, or is compactflash an ATAPI device???)



So it would seem that WIN_PIDENTIFY is issued only if a WIN_IDENTIFY command fails with an rc greater than 2. I would suggest instrumenting
WIN_IDENTIFY returns a rc of 0 (for success) with both the old and the new card. Still the old ones gets detected as CFA!


One thing i did notice when tracing these functions, is that the new card returns 0x44a in drive->id->config, while the old one returns 0x848a, according to the manual from SanDisk(http://www.sandisk.com/pdf/industrial/ProdManualIndustrialGradeATAv2.6.pdf) Should only be returned in memory mapped(cardbus/pc-card) mode, and not in True IDE mode, which the card is appearently running, otherwise the bios couldnt not boot from it, nor would the electrical interface be compatible (if i get the manual right). That is imo why hdparm -I doesnt detect the card as beein removable and Compactflash too, i looked as the sourcode of hdparm, and it seems to read the ATA configuration registers trough a proc file, and interpret it directly (without intervention of the kernel).
So the data the does return indeed marks it as an ATA harddisk, and not as a compactflash card, the real question then is why doesnt it work as a harddisk, which according to the specifications it should? Iam not really experienced in the ide stuff, so iam not sure what the CompactFlash detection in linux changes in behaviour.
I can get the kernel to report it as a "CFA DISK Drive" in dmesg by forcing the flags i mentioned before, but the error is exactly the same.

Thx for your help,
Marc

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/