* [PATCH] sata_fsl: Split hard and soft reset
@ 2009-10-16 16:44 Anton Vorontsov
2009-11-05 15:02 ` Kumar Gala
2009-11-19 23:18 ` Jeff Garzik
0 siblings, 2 replies; 6+ messages in thread
From: Anton Vorontsov @ 2009-10-16 16:44 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev, Jiang Yutang, Ashish Kalra, linux-ide
From: Jiang Yutang <b14898@freescale.com>
Split sata_fsl_softreset() into hard and soft resets to make
error-handling more efficient & device and PMP detection more
reliable.
Also includes fix for PMP support, driver tested with Sil3726,
Sil4726 & Exar PMP controllers.
[AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
Signed-off-by: Jiang Yutang <b14898@freescale.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/ata/sata_fsl.c | 84 +++++++++++++++++++++++++-----------------------
1 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index d344db4..172b57e 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -707,34 +707,17 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
return ata_dev_classify(&tf);
}
-static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline)
-{
- /* FIXME: Never skip softreset, sata_fsl_softreset() is
- * combination of soft and hard resets. sata_fsl_softreset()
- * needs to be splitted into soft and hard resets.
- */
- return 0;
-}
-
-static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
+static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
struct ata_port *ap = link->ap;
- struct sata_fsl_port_priv *pp = ap->private_data;
struct sata_fsl_host_priv *host_priv = ap->host->private_data;
void __iomem *hcr_base = host_priv->hcr_base;
- int pmp = sata_srst_pmp(link);
u32 temp;
- struct ata_taskfile tf;
- u8 *cfis;
- u32 Serror;
int i = 0;
unsigned long start_jiffies;
- DPRINTK("in xx_softreset\n");
-
- if (pmp != SATA_PMP_CTRL_PORT)
- goto issue_srst;
+ DPRINTK("in xx_hardreset\n");
try_offline_again:
/*
@@ -749,7 +732,7 @@ try_offline_again:
if (temp & ONLINE) {
ata_port_printk(ap, KERN_ERR,
- "Softreset failed, not off-lined %d\n", i);
+ "Hardreset failed, not off-lined %d\n", i);
/*
* Try to offline controller atleast twice
@@ -761,7 +744,7 @@ try_offline_again:
goto try_offline_again;
}
- DPRINTK("softreset, controller off-lined\n");
+ DPRINTK("hardreset, controller off-lined\n");
VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
@@ -786,11 +769,11 @@ try_offline_again:
if (!(temp & ONLINE)) {
ata_port_printk(ap, KERN_ERR,
- "Softreset failed, not on-lined\n");
+ "Hardreset failed, not on-lined\n");
goto err;
}
- DPRINTK("softreset, controller off-lined & on-lined\n");
+ DPRINTK("hardreset, controller off-lined & on-lined\n");
VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
@@ -806,7 +789,7 @@ try_offline_again:
"No Device OR PHYRDY change,Hstatus = 0x%x\n",
ioread32(hcr_base + HSTATUS));
*class = ATA_DEV_NONE;
- goto out;
+ return 0;
}
/*
@@ -819,11 +802,44 @@ try_offline_again:
if ((temp & 0xFF) != 0x18) {
ata_port_printk(ap, KERN_WARNING, "No Signature Update\n");
*class = ATA_DEV_NONE;
- goto out;
+ goto do_followup_srst;
} else {
ata_port_printk(ap, KERN_INFO,
"Signature Update detected @ %d msecs\n",
jiffies_to_msecs(jiffies - start_jiffies));
+ *class = sata_fsl_dev_classify(ap);
+ return 0;
+ }
+
+do_followup_srst:
+ /*
+ * request libATA to perform follow-up softreset
+ */
+ return -EAGAIN;
+
+err:
+ return -EIO;
+}
+
+static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
+ unsigned long deadline)
+{
+ struct ata_port *ap = link->ap;
+ struct sata_fsl_port_priv *pp = ap->private_data;
+ struct sata_fsl_host_priv *host_priv = ap->host->private_data;
+ void __iomem *hcr_base = host_priv->hcr_base;
+ int pmp = sata_srst_pmp(link);
+ u32 temp;
+ struct ata_taskfile tf;
+ u8 *cfis;
+ u32 Serror;
+
+ DPRINTK("in xx_softreset\n");
+
+ if (ata_link_offline(link)) {
+ DPRINTK("PHY reports no device\n");
+ *class = ATA_DEV_NONE;
+ return 0;
}
/*
@@ -834,7 +850,6 @@ try_offline_again:
* reached here, we can send a command to the target device
*/
-issue_srst:
DPRINTK("Sending SRST/device reset\n");
ata_tf_init(link->device, &tf);
@@ -860,6 +875,8 @@ issue_srst:
ioread32(CA + hcr_base), ioread32(CC + hcr_base));
iowrite32(0xFFFF, CC + hcr_base);
+ if (pmp != SATA_PMP_CTRL_PORT)
+ iowrite32(pmp, CQPMP + hcr_base);
iowrite32(1, CQ + hcr_base);
temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
@@ -926,7 +943,6 @@ issue_srst:
VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
}
-out:
return 0;
err:
@@ -988,18 +1004,6 @@ static void sata_fsl_error_intr(struct ata_port *ap)
ehi->err_mask |= AC_ERR_ATA_BUS;
ehi->action |= ATA_EH_SOFTRESET;
- /*
- * Ignore serror in case of fatal errors as we always want
- * to do a soft-reset of the FSL SATA controller. Analyzing
- * serror may cause libata to schedule a hard-reset action,
- * and hard-reset currently does not do controller
- * offline/online, causing command timeouts and leads to an
- * un-recoverable state, hence make libATA ignore
- * autopsy in case of fatal errors.
- */
-
- ehi->flags |= ATA_EHI_NO_AUTOPSY;
-
freeze = 1;
}
@@ -1267,8 +1271,8 @@ static struct ata_port_operations sata_fsl_ops = {
.freeze = sata_fsl_freeze,
.thaw = sata_fsl_thaw,
- .prereset = sata_fsl_prereset,
.softreset = sata_fsl_softreset,
+ .hardreset = sata_fsl_hardreset,
.pmp_softreset = sata_fsl_softreset,
.error_handler = sata_fsl_error_handler,
.post_internal_cmd = sata_fsl_post_internal_cmd,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] sata_fsl: Split hard and soft reset
2009-10-16 16:44 [PATCH] sata_fsl: Split hard and soft reset Anton Vorontsov
@ 2009-11-05 15:02 ` Kumar Gala
2009-11-17 3:42 ` Jeff Garzik
2009-11-19 13:51 ` Kumar Gala
2009-11-19 23:18 ` Jeff Garzik
1 sibling, 2 replies; 6+ messages in thread
From: Kumar Gala @ 2009-11-05 15:02 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, linux-ppc list, Ashish Kalra, Jiang Yutang
On Oct 16, 2009, at 11:44 AM, Anton Vorontsov wrote:
> From: Jiang Yutang <b14898@freescale.com>
>
> Split sata_fsl_softreset() into hard and soft resets to make
> error-handling more efficient & device and PMP detection more
> reliable.
>
> Also includes fix for PMP support, driver tested with Sil3726,
> Sil4726 & Exar PMP controllers.
>
> [AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
>
> Signed-off-by: Jiang Yutang <b14898@freescale.com>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> drivers/ata/sata_fsl.c | 84 ++++++++++++++++++++++++
> +-----------------------
> 1 files changed, 44 insertions(+), 40 deletions(-)
Jeff,
any update on this going in for .32?
- k
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sata_fsl: Split hard and soft reset
2009-11-05 15:02 ` Kumar Gala
@ 2009-11-17 3:42 ` Jeff Garzik
2009-11-19 13:51 ` Kumar Gala
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2009-11-17 3:42 UTC (permalink / raw)
To: Kumar Gala; +Cc: linux-ide, linux-ppc list, Ashish Kalra, Jiang Yutang
On 11/05/2009 10:02 AM, Kumar Gala wrote:
>
> On Oct 16, 2009, at 11:44 AM, Anton Vorontsov wrote:
>
>> From: Jiang Yutang <b14898@freescale.com>
>>
>> Split sata_fsl_softreset() into hard and soft resets to make
>> error-handling more efficient & device and PMP detection more
>> reliable.
>>
>> Also includes fix for PMP support, driver tested with Sil3726,
>> Sil4726 & Exar PMP controllers.
>>
>> [AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
>>
>> Signed-off-by: Jiang Yutang <b14898@freescale.com>
>> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>> ---
>> drivers/ata/sata_fsl.c | 84
>> +++++++++++++++++++++++++-----------------------
>> 1 files changed, 44 insertions(+), 40 deletions(-)
>
> Jeff,
>
> any update on this going in for .32?
It seems I missed this, and an SNotification patch for sata_fsl as well
(Bart noticed the latter)...
Will push, probably tomorrow...
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sata_fsl: Split hard and soft reset
2009-11-05 15:02 ` Kumar Gala
2009-11-17 3:42 ` Jeff Garzik
@ 2009-11-19 13:51 ` Kumar Gala
2009-11-19 13:57 ` Kumar Gala
1 sibling, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2009-11-19 13:51 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Jiang Yutang, Ashish Kalra, linux-ppc list
On Nov 5, 2009, at 9:02 AM, Kumar Gala wrote:
>
> On Oct 16, 2009, at 11:44 AM, Anton Vorontsov wrote:
>
>> From: Jiang Yutang <b14898@freescale.com>
>>
>> Split sata_fsl_softreset() into hard and soft resets to make
>> error-handling more efficient & device and PMP detection more
>> reliable.
>>
>> Also includes fix for PMP support, driver tested with Sil3726,
>> Sil4726 & Exar PMP controllers.
>>
>> [AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
>>
>> Signed-off-by: Jiang Yutang <b14898@freescale.com>
>> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>> ---
>> drivers/ata/sata_fsl.c | 84 ++++++++++++++++++++++++
>> +-----------------------
>> 1 files changed, 44 insertions(+), 40 deletions(-)
>
> Jeff,
>
> any update on this going in for .32?
Jeff?
- k
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sata_fsl: Split hard and soft reset
2009-11-19 13:51 ` Kumar Gala
@ 2009-11-19 13:57 ` Kumar Gala
0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2009-11-19 13:57 UTC (permalink / raw)
To: Kumar Gala
Cc: linux-ppc list, linux-ide, Ashish Kalra, Jeff Garzik,
Jiang Yutang
On Nov 19, 2009, at 7:51 AM, Kumar Gala wrote:
>
> On Nov 5, 2009, at 9:02 AM, Kumar Gala wrote:
>
>>
>> On Oct 16, 2009, at 11:44 AM, Anton Vorontsov wrote:
>>
>>> From: Jiang Yutang <b14898@freescale.com>
>>>
>>> Split sata_fsl_softreset() into hard and soft resets to make
>>> error-handling more efficient & device and PMP detection more
>>> reliable.
>>>
>>> Also includes fix for PMP support, driver tested with Sil3726,
>>> Sil4726 & Exar PMP controllers.
>>>
>>> [AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
>>>
>>> Signed-off-by: Jiang Yutang <b14898@freescale.com>
>>> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>>> ---
>>> drivers/ata/sata_fsl.c | 84 ++++++++++++++++++++++++
>>> +-----------------------
>>> 1 files changed, 44 insertions(+), 40 deletions(-)
>>
>> Jeff,
>>
>> any update on this going in for .32?
>
> Jeff?
slightly ignore me, for some reason I didn't see your reply.
- k
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sata_fsl: Split hard and soft reset
2009-10-16 16:44 [PATCH] sata_fsl: Split hard and soft reset Anton Vorontsov
2009-11-05 15:02 ` Kumar Gala
@ 2009-11-19 23:18 ` Jeff Garzik
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2009-11-19 23:18 UTC (permalink / raw)
To: Anton Vorontsov
Cc: linux-ide, Jiang Yutang, Ashish Kalra, linuxppc-dev, Jeff Garzik
On 10/16/2009 12:44 PM, Anton Vorontsov wrote:
> From: Jiang Yutang<b14898@freescale.com>
>
> Split sata_fsl_softreset() into hard and soft resets to make
> error-handling more efficient& device and PMP detection more
> reliable.
>
> Also includes fix for PMP support, driver tested with Sil3726,
> Sil4726& Exar PMP controllers.
>
> [AV: Also fixes resuming from deep sleep on MPC8315 CPUs]
>
> Signed-off-by: Jiang Yutang<b14898@freescale.com>
> Signed-off-by: Anton Vorontsov<avorontsov@ru.mvista.com>
> ---
> drivers/ata/sata_fsl.c | 84 +++++++++++++++++++++++++-----------------------
> 1 files changed, 44 insertions(+), 40 deletions(-)
applied #upstream-fixes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-19 23:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-16 16:44 [PATCH] sata_fsl: Split hard and soft reset Anton Vorontsov
2009-11-05 15:02 ` Kumar Gala
2009-11-17 3:42 ` Jeff Garzik
2009-11-19 13:51 ` Kumar Gala
2009-11-19 13:57 ` Kumar Gala
2009-11-19 23:18 ` Jeff Garzik
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).