public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* patch fix for intel sdd s3500 series on Sil3512 controller
@ 2014-03-22 23:32 David F.
  2014-03-24 14:15 ` One Thousand Gnomes
  0 siblings, 1 reply; 4+ messages in thread
From: David F. @ 2014-03-22 23:32 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Hi,

It appears if nIEN is set all polling type IO fails.   After an
attempt, future non-polled communications also fails.  This patch
allows it to work.  Not sure if any spin lock protection would be
needed or the system already handles the device existence for the
generated irq with polling enabled.  handler already ignored irq if
queued command was polling type.

[-- Attachment #2: fix-sil3512-intelssd.patch --]
[-- Type: application/octet-stream, Size: 2376 bytes --]

 drivers/ata/libata-sff.c | 9 ++++++---
 drivers/ata/sata_sil.c   | 6 +++++-
 include/linux/libata.h   | 1 +
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index b603720..d2bf5b3 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1423,7 +1423,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 	switch (qc->tf.protocol) {
 	case ATA_PROT_NODATA:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+      if (!(qc->tf.flags & ATA_TFLAG_POLLING_WITHOUT_NIEN))
+			  ata_qc_set_polling(qc);
 
 		ata_tf_to_host(ap, &qc->tf);
 		ap->hsm_task_state = HSM_ST_LAST;
@@ -1435,7 +1436,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 
 	case ATA_PROT_PIO:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+      if (!(qc->tf.flags & ATA_TFLAG_POLLING_WITHOUT_NIEN))
+			  ata_qc_set_polling(qc);
 
 		ata_tf_to_host(ap, &qc->tf);
 
@@ -1465,7 +1467,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 	case ATAPI_PROT_PIO:
 	case ATAPI_PROT_NODATA:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+      if (!(qc->tf.flags & ATA_TFLAG_POLLING_WITHOUT_NIEN))
+			  ata_qc_set_polling(qc);
 
 		ata_tf_to_host(ap, &qc->tf);
 
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index b7695e8..ff7cf51 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -336,8 +336,12 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
 
 static void sil_qc_prep(struct ata_queued_cmd *qc)
 {
-	if (!(qc->flags & ATA_QCFLAG_DMAMAP))
+  if (!(qc->flags & ATA_QCFLAG_DMAMAP)) {
+    // some devices (Intel s3500 series SSD drives) won't work in 
+    // polling mode on Sil3512 if the nIEN bit is enabled.
+    qc->tf.flags |= ATA_TFLAG_POLLING_WITHOUT_NIEN;
 		return;
+  }
 
 	sil_fill_sg(qc);
 }
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bec6dbe..ecda27b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -146,6 +146,7 @@ enum {
 	ATA_TFLAG_LBA		= (1 << 4), /* enable LBA */
 	ATA_TFLAG_FUA		= (1 << 5), /* enable FUA */
 	ATA_TFLAG_POLLING	= (1 << 6), /* set nIEN to 1 and use polling */
+  ATA_TFLAG_POLLING_WITHOUT_NIEN = (1 << 7), /* leave nIEN 0 while using polling */
 
 	/* protocol flags */
 	ATA_PROT_FLAG_PIO	= (1 << 0), /* is PIO */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: patch fix for intel sdd s3500 series on Sil3512 controller
  2014-03-22 23:32 patch fix for intel sdd s3500 series on Sil3512 controller David F.
@ 2014-03-24 14:15 ` One Thousand Gnomes
  2014-03-24 15:27   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: One Thousand Gnomes @ 2014-03-24 14:15 UTC (permalink / raw)
  To: David F.; +Cc: linux-kernel

On Sat, 22 Mar 2014 16:32:54 -0700
"David F." <df7729@gmail.com> wrote:

> Hi,
> 
> It appears if nIEN is set all polling type IO fails.   After an
> attempt, future non-polled communications also fails.  This patch
> allows it to work.  Not sure if any spin lock protection would be
> needed or the system already handles the device existence for the
> generated irq with polling enabled.  handler already ignored irq if
> queued command was polling type.

Does it behave plugged into a different controller without the hacks ?

Alan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch fix for intel sdd s3500 series on Sil3512 controller
  2014-03-24 14:15 ` One Thousand Gnomes
@ 2014-03-24 15:27   ` Bartlomiej Zolnierkiewicz
  2014-03-27  0:11     ` David F.
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2014-03-24 15:27 UTC (permalink / raw)
  To: One Thousand Gnomes; +Cc: David F., linux-kernel, linux-ide


+ linux-ide mailing list on Cc:

On Monday, March 24, 2014 02:15:58 PM One Thousand Gnomes wrote:
> On Sat, 22 Mar 2014 16:32:54 -0700
> "David F." <df7729@gmail.com> wrote:
> 
> > Hi,
> > 
> > It appears if nIEN is set all polling type IO fails.   After an
> > attempt, future non-polled communications also fails.  This patch
> > allows it to work.  Not sure if any spin lock protection would be
> > needed or the system already handles the device existence for the
> > generated irq with polling enabled.  handler already ignored irq if
> > queued command was polling type.
> 
> Does it behave plugged into a different controller without the hacks ?
> 
> Alan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch fix for intel sdd s3500 series on Sil3512 controller
  2014-03-24 15:27   ` Bartlomiej Zolnierkiewicz
@ 2014-03-27  0:11     ` David F.
  0 siblings, 0 replies; 4+ messages in thread
From: David F. @ 2014-03-27  0:11 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: One Thousand Gnomes, linux-kernel, linux-ide

Yes.  The drive was found fine on other controllers I tried it on.

On Mon, Mar 24, 2014 at 8:27 AM, Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:
>
> + linux-ide mailing list on Cc:
>
> On Monday, March 24, 2014 02:15:58 PM One Thousand Gnomes wrote:
>> On Sat, 22 Mar 2014 16:32:54 -0700
>> "David F." <df7729@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > It appears if nIEN is set all polling type IO fails.   After an
>> > attempt, future non-polled communications also fails.  This patch
>> > allows it to work.  Not sure if any spin lock protection would be
>> > needed or the system already handles the device existence for the
>> > generated irq with polling enabled.  handler already ignored irq if
>> > queued command was polling type.
>>
>> Does it behave plugged into a different controller without the hacks ?
>>
>> Alan
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-27  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-22 23:32 patch fix for intel sdd s3500 series on Sil3512 controller David F.
2014-03-24 14:15 ` One Thousand Gnomes
2014-03-24 15:27   ` Bartlomiej Zolnierkiewicz
2014-03-27  0:11     ` David F.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox