[cc'ing Alan, thanks for the information on the other message]

Tobias Müller wrote:
> Tejun Heo schrieb:
>> I don't know very well about CF but does it even fill UDMA/33?  What
>> does 'dd if=/dev/sdc of=/dev/null bs=1M count=16 iflag=direct' say?  You
>> can increase count for more reliable result.
> 
> 16+0 Datensätze ein
> 16+0 Datensätze aus
> 16777216 Bytes (17 MB) kopiert, 0,561688 s, 29,9 MB/s

Hmmm... yeah, it almost fills UDMA/33.  I wonder whether it would go higher.

> And hdparm -I /dev/sdc says it should be compatible to udma5.
> 
>         DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4

Please apply the attached patch and specify libata.force_cbl=80 as
kernel boot parameter.  If you load libata from initrd or after boot you
need to pass 'force_cbl=80' as module parameter.  How you do it depends
on your distro.

Thanks.

-- 
tejun
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4753a18..8c93878 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -119,6 +119,10 @@ int libata_noacpi = 0;
 module_param_named(noacpi, libata_noacpi, int, 0444);
 MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in probe/suspend/resume 
when set");
 
+int libata_force_cbl = 0;
+module_param_named(force_cbl, libata_force_cbl, int, 0644);
+MODULE_PARM_DESC(force_cbl, "force PATA cable type (0=keep, 40=40c, 80=80c)");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 21a81cd..7e53215 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2296,9 +2296,27 @@ static int ata_eh_revalidate_and_attach(struct ata_link 
*link,
 
        /* PDIAG- should have been released, ask cable type if post-reset */
        if (ata_is_host_link(link) && ap->ops->cable_detect &&
-           (ehc->i.flags & ATA_EHI_DID_RESET))
+           (ehc->i.flags & ATA_EHI_DID_RESET)) {
                ap->cbl = ap->ops->cable_detect(ap);
 
+               if (!(ap->flags & ATA_FLAG_SATA) && libata_force_cbl) {
+                       switch (libata_force_cbl) {
+                       case 40:
+                               ata_port_printk(ap, KERN_INFO, "forcing 40c\n");
+                               ap->cbl = ATA_CBL_PATA40;
+                               break;
+                       case 80:
+                               ata_port_printk(ap, KERN_INFO, "forcing 80c\n");
+                               ap->cbl = ATA_CBL_PATA80;
+                               break;
+                       default:
+                               ata_port_printk(ap, KERN_WARNING,
+                                               "invalid force_cbl value %d\n",
+                                               libata_force_cbl);
+                       }
+               }
+       }
+
        /* Configure new devices forward such that user doesn't see
         * device detection messages backwards.
         */
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index bbe59c2..b990a8d 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -60,6 +60,7 @@ extern int atapi_dmadir;
 extern int atapi_passthru16;
 extern int libata_fua;
 extern int libata_noacpi;
+extern int libata_force_cbl;
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
                           u64 block, u32 n_block, unsigned int tf_flags,

Reply via email to