All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tobias Müller" <Tobias_Mueller@twam.info>
To: linux-ide@vger.kernel.org
Subject: Re: 40-wire cable detected when directly connected
Date: Sat, 12 Jan 2008 18:23:52 +0100	[thread overview]
Message-ID: <4788F7A8.4080707@twam.info> (raw)
In-Reply-To: <200801121709.26920.bzolnier@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3210 bytes --]

Hi

Bartlomiej Zolnierkiewicz schrieb:
> As a workaround you can try using IDE subsystem siimage driver and pass
> "idex=ata66" option or modify Tejun's patch to also override device side
> cable detection by replacing ATA_CBL_PATA80 with ATA_CBL_PATA40_SHORT.
I changed some code in libata=core.c in ata_dev_xfermask (see patch2), 
that xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA) isn't set, when forcing 80c.

Everything seems to work now. I have a about 41 MB/s while reading.

Regards
   Tobias


dmesg says

[   40.854101] ata7: PATA max UDMA/133 irq 16
[   40.854162] ata8: PATA max UDMA/133 irq 16
[   41.008881] ata7: forcing 80c
[   41.008949] ata7.00: ATA-4: SanDisk SDCFX4-8192, HDX 4.20, max UDMA/66
[   41.009014] ata7.00: 16007040 sectors, multi 0: LBA
[   41.009751] ata7.00: configured for UDMA/66
[   41.168606] ata8: forcing 80c
[   41.168673] ata8.00: ATA-4: SanDisk SDCFX3-2048, HDX 4.08, max MWDMA2
[   41.168738] ata8.00: 4001760 sectors, multi 0: LBA
[   41.188267] ata8.00: configured for MWDMA2
[   41.188418] scsi 6:0:0:0: Direct-Access     ATA      SanDisk SDCFX4-8 
HDX  PQ: 0 ANSI: 5
[   41.188622] sd 6:0:0:0: [sdc] 16007040 512-byte hardware sectors 
(8196 MB)
[   41.188696] sd 6:0:0:0: [sdc] Write Protect is off
[   41.188759] sd 6:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[   41.188776] sd 6:0:0:0: [sdc] Write cache: disabled, read cache: 
enabled, doesn't support DPO or FUA
[   41.188918] sd 6:0:0:0: [sdc] 16007040 512-byte hardware sectors 
(8196 MB)
[   41.188990] sd 6:0:0:0: [sdc] Write Protect is off
[   41.189054] sd 6:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[   41.189070] sd 6:0:0:0: [sdc] Write cache: disabled, read cache: 
enabled, doesn't support DPO or FUA
[   41.189167]  sdc: sdc1 sdc2
[   41.189880] sd 6:0:0:0: [sdc] Attached SCSI disk
[   41.190092] scsi 7:0:0:0: Direct-Access     ATA      SanDisk SDCFX3-2 
HDX  PQ: 0 ANSI: 5
[   41.190283] sd 7:0:0:0: [sdd] 4001760 512-byte hardware sectors (2049 MB)
[   41.190357] sd 7:0:0:0: [sdd] Write Protect is off
[   41.190419] sd 7:0:0:0: [sdd] Mode Sense: 00 3a 00 00
[   41.190436] sd 7:0:0:0: [sdd] Write cache: disabled, read cache: 
enabled, doesn't support DPO or FUA
[   41.190567] sd 7:0:0:0: [sdd] 4001760 512-byte hardware sectors (2049 MB)
[   41.190640] sd 7:0:0:0: [sdd] Write Protect is off
[   41.190702] sd 7:0:0:0: [sdd] Mode Sense: 00 3a 00 00
[   41.190719] sd 7:0:0:0: [sdd] Write cache: disabled, read cache: 
enabled, doesn't support DPO or FUA
[   41.190815]  sdd: sdd1
[   41.191733] sd 7:0:0:0: [sdd] Attached SCSI disk


hdparm -I /dev/sda

[...]
Capabilities:
         LBA, IORDY(may be)(cannot be disabled)
         Standby timer values: spec'd by Vendor
         R/W multiple sector transfer: Max = 4   Current = 0
         DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 *udma4
              Cycle time: min=120ns recommended=120ns
         PIO: pio0 pio1 pio2 pio3 pio4
              Cycle time: no flow control=120ns  IORDY flow control=120ns
[...]



dd if=/dev/sdc of=/dev/null bs=1M count=16 iflag=direct

16+0 Datensätze ein
16+0 Datensätze aus
16777216 Bytes (17 MB) kopiert, 0,402367 s, 41,7 MB/s


[-- Attachment #1.2: patch2 --]
[-- Type: text/plain, Size: 3893 bytes --]

diff --git a/linux-2.6.24-rc7/drivers/ata/libata-core.c b/linux-2.6.24-rc7-twam/drivers/ata/libata-core.c
index 4753a18..ac5a0d4 100644
--- a/linux-2.6.24-rc7/drivers/ata/libata-core.c
+++ b/linux-2.6.24-rc7-twam/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");
@@ -4318,16 +4322,29 @@ static void ata_dev_xfermask(struct ata_device *dev)
 	 * drive side as well. Cases where we know a 40wire cable
 	 * is used safely for 80 are not checked here.
 	 */
-	if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
-		/* UDMA/44 or higher would be available */
-		if ((ap->cbl == ATA_CBL_PATA40) ||
-		    (ata_is_40wire(dev) &&
-		    (ap->cbl == ATA_CBL_PATA_UNK ||
-		     ap->cbl == ATA_CBL_PATA80))) {
-			ata_dev_printk(dev, KERN_WARNING,
-				 "limited to UDMA/33 due to 40-wire cable\n");
-			xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
+	if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) {
+                switch (libata_force_cbl) {
+                        case 40:
+				/* limit to UDMA/33 */
+                                ata_dev_printk(dev, KERN_INFO, "forcing 40c\n");
+				xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
+				break;
+                        case 80:
+				/* ignore cable checks */
+                                ata_dev_printk(dev, KERN_INFO, "forcing 80c\n");
+				break;
+			default:
+				/* UDMA/44 or higher would be available */
+				if ((ap->cbl == ATA_CBL_PATA40) ||
+				    (ata_is_40wire(dev) &&
+				    (ap->cbl == ATA_CBL_PATA_UNK ||
+				     ap->cbl == ATA_CBL_PATA80))) {
+					ata_dev_printk(dev, KERN_WARNING,
+						 "limited to UDMA/33 due to 40-wire cable\n");
+					xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
+				}
 		}
+	}
 
 	ata_unpack_xfermask(xfer_mask, &dev->pio_mask,
 			    &dev->mwdma_mask, &dev->udma_mask);
diff --git a/linux-2.6.24-rc7/drivers/ata/libata-eh.c b/linux-2.6.24-rc7-twam/drivers/ata/libata-eh.c
index f0124a8..7c607e0 100644
--- a/linux-2.6.24-rc7/drivers/ata/libata-eh.c
+++ b/linux-2.6.24-rc7-twam/drivers/ata/libata-eh.c
@@ -2288,9 +2288,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/linux-2.6.24-rc7/drivers/ata/libata.h b/linux-2.6.24-rc7-twam/drivers/ata/libata.h
index bbe59c2..b990a8d 100644
--- a/linux-2.6.24-rc7/drivers/ata/libata.h
+++ b/linux-2.6.24-rc7-twam/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,

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3389 bytes --]

  parent reply	other threads:[~2008-01-12 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 17:24 40-wire cable detected when directly connected Tobias Müller
2008-01-11  3:53 ` Tejun Heo
2008-01-11 11:47   ` Tobias Müller
2008-01-12  3:26     ` Tejun Heo
2008-01-12 13:40       ` Tobias Müller
2008-01-13  6:06         ` Tejun Heo
2008-01-12 14:38     ` Bartlomiej Zolnierkiewicz
2008-01-12 14:29       ` Tobias Müller
2008-01-12 16:09         ` Bartlomiej Zolnierkiewicz
2008-01-12 16:14           ` Bartlomiej Zolnierkiewicz
2008-01-12 16:22           ` Tobias Müller
2008-01-12 17:23           ` Tobias Müller [this message]
2008-01-11 13:56   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4788F7A8.4080707@twam.info \
    --to=tobias_mueller@twam.info \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.