linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: "Reinhard Brandstädter" <r.brandstaedter@gmx.at>
Cc: linux-ide@vger.kernel.org
Subject: Re: sata_via and SATA DVD drive (PX-712SA)
Date: Mon, 24 Apr 2006 18:22:14 +0800	[thread overview]
Message-ID: <444CA6D6.3010403@tw.ibm.com> (raw)
In-Reply-To: <200604212320.30854.r.brandstaedter@gmx.at>

Reinhard Brandstädter wrote:
> On Friday 21 April 2006 09:24, Albert Lee wrote:
> 
>>From the dmesg, PX-712SA looks like a PATA drive bridged to SATA.
>>Could you try the atapi_dmadir=1 module parameter and check if it helps?
>>(For older kernels, please #define ATAPI_ENABLE_DMADIR
>>in include/linux/libata.h and recompile the kernel.)
> 
> 
> Indeed the PX-712SA is a bridged PATA drive. In the POST message it's even 
> reported as PX-712A (the ATAPI model).
> I've tried to pass libata.atapi_dmadir=1 to the kernel but looking at dmesg 
> nothing changed (using kernel 2.6.16). I even changed libata.h and defined 
> ATAPI_ENABLE_DMADIR - same result.
> 
> What else could I try?
> 

So, it is not the DMADIR problem...

According to the Plextor website
(http://www.plextor.com/English/support/media_712SA.htm),
the PX-712SA works with VIA SATA only in PIO mode.
(The website doesn't say why. It works with other SATA controllers.)

Maybe updating the firmware of PX-712SA can help?
Otherwise, please try the attached patch to blacklist
PX-712SA DMA for sata_via.

--
albert

--- upstream0/drivers/scsi/sata_via.c	2006-04-24 17:36:23.000000000 +0800
+++ upstream1/drivers/scsi/sata_via.c	2006-04-24 17:37:06.000000000 +0800
@@ -72,6 +72,7 @@ enum {
 };
 
 static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
+static void svia_dev_config(struct ata_port *ap, struct ata_device *dev);
 static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 
@@ -82,6 +83,14 @@ static const struct pci_device_id svia_p
 	{ }	/* terminate list */
 };
 
+static const struct svia_drivelist {
+	const char *product;
+	const char *revision;
+} svia_blacklist [] = {
+	{ "DVDR PX-712A", NULL },
+	{ }
+};
+
 static struct pci_driver svia_pci_driver = {
 	.name			= DRV_NAME,
 	.id_table		= svia_pci_tbl,
@@ -108,6 +117,7 @@ static struct scsi_host_template svia_sh
 
 static const struct ata_port_operations svia_sata_ops = {
 	.port_disable		= ata_port_disable,
+	.dev_config		= svia_dev_config,
 
 	.tf_load		= ata_tf_load,
 	.tf_read		= ata_tf_read,
@@ -153,6 +163,50 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, svia_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+/**
+ *	svia_dev_config - Apply device/host-specific errata fixups
+ *	@ap: Port containing device to be examined
+ *	@dev: Device to be examined
+ *
+ *	After the IDENTIFY [PACKET] DEVICE step is complete, and a
+ *	device is known to be present, this function is called.
+ *
+ *	According to 
+ *	http://www.plextor.com/English/support/media_712SA.htm,
+ *	the Plextor PX-712SA drive works with VIA SATA
+ *	in PIO mode only. Root cause unknown yet.
+ *	The bad thing is, PX-712SA is actually a PX-712A bridged
+ *	to SATA and it report itself as PX-712A. Maybe PX-712A
+ *	works ok with VIA SATA + external (non-on-device) bridges?
+ */
+static void svia_dev_config(struct ata_port *ap, struct ata_device *dev)
+{
+	unsigned char model_num[41];
+	unsigned char model_rev[9];
+	int i, blacklisted = 0;
+
+	ata_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num));
+	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV_OFS, sizeof(model_rev));
+
+	/* check whether the drive is blacklisted */
+	for (i = 0; svia_blacklist[i].product; i++)
+		if (!strcmp(svia_blacklist[i].product, model_num))
+			if (svia_blacklist[i].revision == NULL ||
+			    !strcmp(svia_blacklist[i].revision, model_rev)) {
+				blacklisted = 1;
+				break;
+			}
+
+	if (blacklisted) {
+		/* limit to PIO */
+		printk(KERN_INFO "ata%u(%u): applying PIO limit to %s\n",
+		       ap->id, dev->devno, model_num);
+		dev->mwdma_mask = 0;
+		dev->udma_mask = 0;
+		return;
+	}
+}
+
 static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg)
 {
 	if (sc_reg > SCR_CONTROL)


      parent reply	other threads:[~2006-04-24 10:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 18:20 sata_via and SATA DVD drive (PX-712SA) Reinhard Brandstädter
2006-04-21  7:24 ` Albert Lee
2006-04-21 21:20   ` Reinhard Brandstädter
2006-04-24  9:48     ` Albert Lee
2006-04-24 15:03       ` Reinhard Brandstädter
2006-04-29 10:50       ` Reinhard Brandstädter
2006-04-24 10:22     ` Albert Lee [this message]

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=444CA6D6.3010403@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=albertl@mail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=r.brandstaedter@gmx.at \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).