aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c25
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--include/linux/libata.h15
3 files changed, 24 insertions, 18 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 90db054fa994..73174452d1c1 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -61,9 +61,9 @@
61#include "libata.h" 61#include "libata.h"
62 62
63/* debounce timing parameters in msecs { interval, duration, timeout } */ 63/* debounce timing parameters in msecs { interval, duration, timeout } */
64const unsigned long sata_deb_timing_boot[] = { 5, 100, 2000 }; 64const unsigned long sata_deb_timing_normal[] = { 5, 100, 2000 };
65const unsigned long sata_deb_timing_eh[] = { 25, 500, 2000 }; 65const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };
66const unsigned long sata_deb_timing_before_fsrst[] = { 100, 2000, 5000 }; 66const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
67 67
68static unsigned int ata_dev_init_params(struct ata_device *dev, 68static unsigned int ata_dev_init_params(struct ata_device *dev,
69 u16 heads, u16 sectors); 69 u16 heads, u16 sectors);
@@ -2588,7 +2588,7 @@ static void ata_wait_spinup(struct ata_port *ap)
2588 2588
2589 /* first, debounce phy if SATA */ 2589 /* first, debounce phy if SATA */
2590 if (ap->cbl == ATA_CBL_SATA) { 2590 if (ap->cbl == ATA_CBL_SATA) {
2591 rc = sata_phy_debounce(ap, sata_deb_timing_eh); 2591 rc = sata_phy_debounce(ap, sata_deb_timing_hotplug);
2592 2592
2593 /* if debounced successfully and offline, no need to wait */ 2593 /* if debounced successfully and offline, no need to wait */
2594 if ((rc == 0 || rc == -EOPNOTSUPP) && ata_port_offline(ap)) 2594 if ((rc == 0 || rc == -EOPNOTSUPP) && ata_port_offline(ap))
@@ -2624,7 +2624,7 @@ static void ata_wait_spinup(struct ata_port *ap)
2624int ata_std_prereset(struct ata_port *ap) 2624int ata_std_prereset(struct ata_port *ap)
2625{ 2625{
2626 struct ata_eh_context *ehc = &ap->eh_context; 2626 struct ata_eh_context *ehc = &ap->eh_context;
2627 const unsigned long *timing; 2627 const unsigned long *timing = sata_ehc_deb_timing(ehc);
2628 int rc; 2628 int rc;
2629 2629
2630 /* handle link resume & hotplug spinup */ 2630 /* handle link resume & hotplug spinup */
@@ -2642,11 +2642,6 @@ int ata_std_prereset(struct ata_port *ap)
2642 2642
2643 /* if SATA, resume phy */ 2643 /* if SATA, resume phy */
2644 if (ap->cbl == ATA_CBL_SATA) { 2644 if (ap->cbl == ATA_CBL_SATA) {
2645 if (ap->pflags & ATA_PFLAG_LOADING)
2646 timing = sata_deb_timing_boot;
2647 else
2648 timing = sata_deb_timing_eh;
2649
2650 rc = sata_phy_resume(ap, timing); 2645 rc = sata_phy_resume(ap, timing);
2651 if (rc && rc != -EOPNOTSUPP) { 2646 if (rc && rc != -EOPNOTSUPP) {
2652 /* phy resume failed */ 2647 /* phy resume failed */
@@ -2734,6 +2729,8 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes)
2734 */ 2729 */
2735int sata_std_hardreset(struct ata_port *ap, unsigned int *class) 2730int sata_std_hardreset(struct ata_port *ap, unsigned int *class)
2736{ 2731{
2732 struct ata_eh_context *ehc = &ap->eh_context;
2733 const unsigned long *timing = sata_ehc_deb_timing(ehc);
2737 u32 scontrol; 2734 u32 scontrol;
2738 int rc; 2735 int rc;
2739 2736
@@ -2771,7 +2768,7 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class)
2771 msleep(1); 2768 msleep(1);
2772 2769
2773 /* bring phy back */ 2770 /* bring phy back */
2774 sata_phy_resume(ap, sata_deb_timing_eh); 2771 sata_phy_resume(ap, timing);
2775 2772
2776 /* TODO: phy layer with polling, timeouts, etc. */ 2773 /* TODO: phy layer with polling, timeouts, etc. */
2777 if (ata_port_offline(ap)) { 2774 if (ata_port_offline(ap)) {
@@ -5852,9 +5849,9 @@ u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
5852 * Do not depend on ABI/API stability. 5849 * Do not depend on ABI/API stability.
5853 */ 5850 */
5854 5851
5855EXPORT_SYMBOL_GPL(sata_deb_timing_boot); 5852EXPORT_SYMBOL_GPL(sata_deb_timing_normal);
5856EXPORT_SYMBOL_GPL(sata_deb_timing_eh); 5853EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug);
5857EXPORT_SYMBOL_GPL(sata_deb_timing_before_fsrst); 5854EXPORT_SYMBOL_GPL(sata_deb_timing_long);
5858EXPORT_SYMBOL_GPL(ata_std_bios_param); 5855EXPORT_SYMBOL_GPL(ata_std_bios_param);
5859EXPORT_SYMBOL_GPL(ata_std_ports); 5856EXPORT_SYMBOL_GPL(ata_std_ports);
5860EXPORT_SYMBOL_GPL(ata_device_add); 5857EXPORT_SYMBOL_GPL(ata_device_add);
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 07a1c6a8a414..04ae1ef25484 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -607,7 +607,7 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class)
607 /* SStatus oscillates between zero and valid status after 607 /* SStatus oscillates between zero and valid status after
608 * DEV_RST, debounce it. 608 * DEV_RST, debounce it.
609 */ 609 */
610 rc = sata_phy_debounce(ap, sata_deb_timing_before_fsrst); 610 rc = sata_phy_debounce(ap, sata_deb_timing_long);
611 if (rc) { 611 if (rc) {
612 reason = "PHY debouncing failed"; 612 reason = "PHY debouncing failed";
613 goto err; 613 goto err;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 4d4ed2c8fec7..2f7bbfc0c41b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -629,9 +629,18 @@ struct ata_timing {
629 629
630#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) 630#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
631 631
632extern const unsigned long sata_deb_timing_boot[]; 632extern const unsigned long sata_deb_timing_normal[];
633extern const unsigned long sata_deb_timing_eh[]; 633extern const unsigned long sata_deb_timing_hotplug[];
634extern const unsigned long sata_deb_timing_before_fsrst[]; 634extern const unsigned long sata_deb_timing_long[];
635
636static inline const unsigned long *
637sata_ehc_deb_timing(struct ata_eh_context *ehc)
638{
639 if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
640 return sata_deb_timing_hotplug;
641 else
642 return sata_deb_timing_normal;
643}
635 644
636extern void ata_port_probe(struct ata_port *); 645extern void ata_port_probe(struct ata_port *);
637extern void __sata_phy_reset(struct ata_port *ap); 646extern void __sata_phy_reset(struct ata_port *ap);