aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 788bba2b1e17..6ca4bc0fcae3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -78,6 +78,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, 78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
79 ssize_t size); 79 ssize_t size);
80#define MAX_SLOTS 8 80#define MAX_SLOTS 8
81#define MAX_RETRY 15
81 82
82enum { 83enum {
83 AHCI_PCI_BAR = 5, 84 AHCI_PCI_BAR = 5,
@@ -1115,6 +1116,8 @@ static void ahci_start_port(struct ata_port *ap)
1115 struct ahci_port_priv *pp = ap->private_data; 1116 struct ahci_port_priv *pp = ap->private_data;
1116 struct ata_link *link; 1117 struct ata_link *link;
1117 struct ahci_em_priv *emp; 1118 struct ahci_em_priv *emp;
1119 ssize_t rc;
1120 int i;
1118 1121
1119 /* enable FIS reception */ 1122 /* enable FIS reception */
1120 ahci_start_fis_rx(ap); 1123 ahci_start_fis_rx(ap);
@@ -1126,7 +1129,17 @@ static void ahci_start_port(struct ata_port *ap)
1126 if (ap->flags & ATA_FLAG_EM) { 1129 if (ap->flags & ATA_FLAG_EM) {
1127 ata_for_each_link(link, ap, EDGE) { 1130 ata_for_each_link(link, ap, EDGE) {
1128 emp = &pp->em_priv[link->pmp]; 1131 emp = &pp->em_priv[link->pmp];
1129 ahci_transmit_led_message(ap, emp->led_state, 4); 1132
1133 /* EM Transmit bit maybe busy during init */
1134 for (i = 0; i < MAX_RETRY; i++) {
1135 rc = ahci_transmit_led_message(ap,
1136 emp->led_state,
1137 4);
1138 if (rc == -EBUSY)
1139 udelay(100);
1140 else
1141 break;
1142 }
1130 } 1143 }
1131 } 1144 }
1132 1145
@@ -1331,7 +1344,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1331 em_ctl = readl(mmio + HOST_EM_CTL); 1344 em_ctl = readl(mmio + HOST_EM_CTL);
1332 if (em_ctl & EM_CTL_TM) { 1345 if (em_ctl & EM_CTL_TM) {
1333 spin_unlock_irqrestore(ap->lock, flags); 1346 spin_unlock_irqrestore(ap->lock, flags);
1334 return -EINVAL; 1347 return -EBUSY;
1335 } 1348 }
1336 1349
1337 /* 1350 /*