Re: libata and legacy ide pcmcia failure

From: Tejun Heo
Date: Thu Jun 07 2007 - 03:38:53 EST


Robert de Rooy wrote:
> Alan Cox wrote:
>>>> http://thread.gmane.org/gmane.linux.kernel/530099
>>>>
>>>> It seems we're losing interrupts from the CFA device. Any ideas?
>>>>
>>> Alan probably knows more, but ISTR some CFA PCMCIA devices that
>>> needed polling...
>>>
>>
>> Not that I know of. Not devices anyway - there are embedded boxes with no
>> IRQ configuration for the CF slot but we've never supported those (indeed
>> there are even people who bitbang ATA on GPIO pins...)
>>
>>
> I was able to test the same PCMCIA adapter in a different ThinkPad, an X40.
> The X40 also fails although it has a totally different Cardbus
> controller (TI on the T40 vs Ricoh on the X40)
>
> Here is the log from the X40 running the same kernel as before
> (2.6.22rc1-git5 + timing-debug.patch +
> disable-dev_init_param-and-setxfermode-for-CFA.patch)

Can you test the attached patch?

--
tejun
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4733f00..bac5e1f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3042,7 +3042,6 @@ int ata_wait_ready(struct ata_port *ap, unsigned long deadline)
static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
unsigned long deadline)
{
- struct ata_ioports *ioaddr = &ap->ioaddr;
unsigned int dev0 = devmask & (1 << 0);
unsigned int dev1 = devmask & (1 << 1);
int rc, ret = 0;
@@ -3059,22 +3058,9 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
}
}

- /* if device 1 was found in ata_devchk, wait for
- * register access, then wait for BSY to clear
- */
- while (dev1) {
- u8 nsect, lbal;
-
- ap->ops->dev_select(ap, 1);
- nsect = ioread8(ioaddr->nsect_addr);
- lbal = ioread8(ioaddr->lbal_addr);
- if ((nsect == 1) && (lbal == 1))
- break;
- if (time_after(jiffies, deadline))
- return -EBUSY;
- msleep(50); /* give drive a breather */
- }
+ /* wait for device 1 */
if (dev1) {
+ ap->ops->dev_select(ap, 1);
rc = ata_wait_ready(ap, deadline);
if (rc) {
if (rc != -ENODEV)