Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1304185 > unrolled thread

[PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

Started byDaniel Walker <danielwa@cisco.com>
First post2016-01-08 06:30 +0100
Last post2016-01-08 21:50 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number Daniel Walker <danielwa@cisco.com> - 2016-01-08 06:30 +0100
    Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending  on model number Tejun Heo <tj@kernel.org> - 2016-01-08 16:40 +0100
      Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on  model number Daniel Walker <danielwa@cisco.com> - 2016-01-08 21:20 +0100
        Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on  model number Tejun Heo <tj@kernel.org> - 2016-01-08 21:30 +0100
          Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on  model number Daniel Walker <danielwa@cisco.com> - 2016-01-08 21:50 +0100

#1304185 — [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

FromDaniel Walker <danielwa@cisco.com>
Date2016-01-08 06:30 +0100
Subject[PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Message-ID<qOxMB-28c-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1304655 — Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

FromTejun Heo <tj@kernel.org>
Date2016-01-08 16:40 +0100
SubjectRe: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Message-ID<qOHiV-cO-5@gated-at.bofh.it>
In reply to#1304185
Hello, Daniel.

On Thu, Jan 07, 2016 at 09:18:51PM -0800, Daniel Walker wrote:
> 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.

Hmmm... is this specific to pata_octeon_cf or should it apply to the
device regardless of the controller in use?

Thanks.

-- 
tejun

[toc] | [prev] | [next] | [standalone]


#1304984 — Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

FromDaniel Walker <danielwa@cisco.com>
Date2016-01-08 21:20 +0100
SubjectRe: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Message-ID<qOLFU-3oB-19@gated-at.bofh.it>
In reply to#1304655
On 01/08/2016 07:30 AM, Tejun Heo wrote:
> Hello, Daniel.
>
> On Thu, Jan 07, 2016 at 09:18:51PM -0800, Daniel Walker wrote:
>> 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.
> Hmmm... is this specific to pata_octeon_cf or should it apply to the
> device regardless of the controller in use?
>
>

It's not specific to pata_octeon_cf , it should be applied to the device 
regardless of controller. Is there a better place to put this to cover all ?

Daniel

[toc] | [prev] | [next] | [standalone]


#1304989 — Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

FromTejun Heo <tj@kernel.org>
Date2016-01-08 21:30 +0100
SubjectRe: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Message-ID<qOLPA-3s7-9@gated-at.bofh.it>
In reply to#1304984
Hello,

On Fri, Jan 8, 2016 at 3:11 PM, Daniel Walker <danielwa@cisco.com> wrote:
> It's not specific to pata_octeon_cf , it should be applied to the device
> regardless of controller. Is there a better place to put this to cover all ?

Yeap, libata-core.c:ata_device_blacklist[]

Thanks.

-- 
tejun

[toc] | [prev] | [next] | [standalone]


#1305003 — Re: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number

FromDaniel Walker <danielwa@cisco.com>
Date2016-01-08 21:50 +0100
SubjectRe: [PATCH 1/2] drivers: pata_octeon_cf : Switch IO mode depending on model number
Message-ID<qOM8V-3B5-1@gated-at.bofh.it>
In reply to#1304989
On 01/08/2016 12:22 PM, Tejun Heo wrote:
> Hello,
>
> On Fri, Jan 8, 2016 at 3:11 PM, Daniel Walker <danielwa@cisco.com> wrote:
>> It's not specific to pata_octeon_cf , it should be applied to the device
>> regardless of controller. Is there a better place to put this to cover all ?
> Yeap, libata-core.c:ata_device_blacklist[]
>
> Thanks.
>

Will do (and resend). Thanks for the review.

Daniel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web