提交 7d34f464 编写于 作者: L Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  sata_fsl: Split hard and soft reset
...@@ -707,34 +707,17 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) ...@@ -707,34 +707,17 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
return ata_dev_classify(&tf); return ata_dev_classify(&tf);
} }
static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline) static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
{
/* 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,
unsigned long deadline) unsigned long deadline)
{ {
struct ata_port *ap = link->ap; 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; struct sata_fsl_host_priv *host_priv = ap->host->private_data;
void __iomem *hcr_base = host_priv->hcr_base; void __iomem *hcr_base = host_priv->hcr_base;
int pmp = sata_srst_pmp(link);
u32 temp; u32 temp;
struct ata_taskfile tf;
u8 *cfis;
u32 Serror;
int i = 0; int i = 0;
unsigned long start_jiffies; unsigned long start_jiffies;
DPRINTK("in xx_softreset\n"); DPRINTK("in xx_hardreset\n");
if (pmp != SATA_PMP_CTRL_PORT)
goto issue_srst;
try_offline_again: try_offline_again:
/* /*
...@@ -749,7 +732,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -749,7 +732,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
if (temp & ONLINE) { if (temp & ONLINE) {
ata_port_printk(ap, KERN_ERR, 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 * Try to offline controller atleast twice
...@@ -761,7 +744,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -761,7 +744,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
goto 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("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
...@@ -786,11 +769,11 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -786,11 +769,11 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
if (!(temp & ONLINE)) { if (!(temp & ONLINE)) {
ata_port_printk(ap, KERN_ERR, ata_port_printk(ap, KERN_ERR,
"Softreset failed, not on-lined\n"); "Hardreset failed, not on-lined\n");
goto err; 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("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
...@@ -806,7 +789,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -806,7 +789,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
"No Device OR PHYRDY change,Hstatus = 0x%x\n", "No Device OR PHYRDY change,Hstatus = 0x%x\n",
ioread32(hcr_base + HSTATUS)); ioread32(hcr_base + HSTATUS));
*class = ATA_DEV_NONE; *class = ATA_DEV_NONE;
goto out; return 0;
} }
/* /*
...@@ -819,11 +802,44 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -819,11 +802,44 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
if ((temp & 0xFF) != 0x18) { if ((temp & 0xFF) != 0x18) {
ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); ata_port_printk(ap, KERN_WARNING, "No Signature Update\n");
*class = ATA_DEV_NONE; *class = ATA_DEV_NONE;
goto out; goto do_followup_srst;
} else { } else {
ata_port_printk(ap, KERN_INFO, ata_port_printk(ap, KERN_INFO,
"Signature Update detected @ %d msecs\n", "Signature Update detected @ %d msecs\n",
jiffies_to_msecs(jiffies - start_jiffies)); 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 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -834,7 +850,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
* reached here, we can send a command to the target device * reached here, we can send a command to the target device
*/ */
issue_srst:
DPRINTK("Sending SRST/device reset\n"); DPRINTK("Sending SRST/device reset\n");
ata_tf_init(link->device, &tf); ata_tf_init(link->device, &tf);
...@@ -860,6 +875,8 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -860,6 +875,8 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
ioread32(CA + hcr_base), ioread32(CC + hcr_base)); ioread32(CA + hcr_base), ioread32(CC + hcr_base));
iowrite32(0xFFFF, CC + hcr_base); iowrite32(0xFFFF, CC + hcr_base);
if (pmp != SATA_PMP_CTRL_PORT)
iowrite32(pmp, CQPMP + hcr_base);
iowrite32(1, CQ + hcr_base); iowrite32(1, CQ + hcr_base);
temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
...@@ -926,7 +943,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, ...@@ -926,7 +943,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
} }
out:
return 0; return 0;
err: err:
...@@ -988,18 +1004,6 @@ static void sata_fsl_error_intr(struct ata_port *ap) ...@@ -988,18 +1004,6 @@ static void sata_fsl_error_intr(struct ata_port *ap)
ehi->err_mask |= AC_ERR_ATA_BUS; ehi->err_mask |= AC_ERR_ATA_BUS;
ehi->action |= ATA_EH_SOFTRESET; 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; freeze = 1;
} }
...@@ -1267,8 +1271,8 @@ static struct ata_port_operations sata_fsl_ops = { ...@@ -1267,8 +1271,8 @@ static struct ata_port_operations sata_fsl_ops = {
.freeze = sata_fsl_freeze, .freeze = sata_fsl_freeze,
.thaw = sata_fsl_thaw, .thaw = sata_fsl_thaw,
.prereset = sata_fsl_prereset,
.softreset = sata_fsl_softreset, .softreset = sata_fsl_softreset,
.hardreset = sata_fsl_hardreset,
.pmp_softreset = sata_fsl_softreset, .pmp_softreset = sata_fsl_softreset,
.error_handler = sata_fsl_error_handler, .error_handler = sata_fsl_error_handler,
.post_internal_cmd = sata_fsl_post_internal_cmd, .post_internal_cmd = sata_fsl_post_internal_cmd,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册