linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Walker <danielwa@cisco.com>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Tejun Heo <tj@kernel.org>
Cc: Anil Veliyankara Madam <aveliyan@cisco.com>,
	xe-kernel@external.cisco.com, Shikha Jain <shikjain@cisco.com>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Date: Thu,  7 Jan 2016 21:18:51 -0800	[thread overview]
Message-ID: <1452230332-14926-1-git-send-email-danielwa@cisco.com> (raw)

From: Anil Veliyankara Madam <aveliyan@cisco.com>

Since viking flash has a problem in the MWDMA mode which causes data
corruption, this patch allows the driver to detect the model number
and switch the IO mode to PIO6 if it's a viking flash.

Cc: xe-kernel@external.cisco.com
Signed-off-by: Anil Veliyankara Madam <aveliyan@cisco.com>
Signed-off-by: Shikha Jain <shikjain@cisco.com>
---
 drivers/ata/pata_octeon_cf.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 2724595..9d05bc9 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -826,6 +826,30 @@ static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc)
 	return 0;
 }
 
+static unsigned long octeon_cf_mode_filter(struct ata_device *dev,
+						unsigned long mask)
+{
+	const char viking_model_num[] = "VRFDFC22048UCHC-TE";
+	unsigned char model_num[ATA_ID_PROD_LEN + 1];
+
+	if (dev->class != ATA_DEV_ATA)
+		return mask;
+
+	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
+	/*
+	 * Viking flash with SMI controller causes read errors in
+	 * MWDMA modes.  Force PIO mode.
+	 */
+	if (strncmp(model_num, viking_model_num,
+				strlen(viking_model_num)) == 0) {
+		DPRINTK("Viking flash with SMI controller detected.");
+		DPRINTK("Forcing PIO mode.\n");
+		mask &= ATA_MASK_PIO;
+	}
+
+	return mask;
+}
+
 static struct ata_port_operations octeon_cf_ops = {
 	.inherits		= &ata_sff_port_ops,
 	.check_atapi_dma	= octeon_cf_check_atapi_dma,
@@ -835,6 +859,7 @@ static struct ata_port_operations octeon_cf_ops = {
 	.sff_irq_on		= octeon_cf_ata_port_noaction,
 	.sff_irq_clear		= octeon_cf_ata_port_noaction,
 	.cable_detect		= ata_cable_40wire,
+	.mode_filter		= octeon_cf_mode_filter,
 	.set_piomode		= octeon_cf_set_piomode,
 	.set_dmamode		= octeon_cf_set_dmamode,
 	.dev_config		= octeon_cf_dev_config,
-- 
2.1.4

             reply	other threads:[~2016-01-08  5:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  5:18 Daniel Walker [this message]
2016-01-08 15:30 ` [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number Tejun Heo
2016-01-08 20:11   ` Daniel Walker
2016-01-08 20:22     ` Tejun Heo
2016-01-08 20:37       ` Daniel Walker

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=1452230332-14926-1-git-send-email-danielwa@cisco.com \
    --to=danielwa@cisco.com \
    --cc=aveliyan@cisco.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shikjain@cisco.com \
    --cc=tj@kernel.org \
    --cc=xe-kernel@external.cisco.com \
    /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).