aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mvsas/mv_sas.c
diff options
context:
space:
mode:
authorXiangliang Yu <yuxiangl@marvell.com>2011-05-24 10:37:25 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-07-26 02:38:01 -0400
commit84fbd0cea11b80d7b7097343d5262004d42b8a9a (patch)
treea59d58e1ce8558f02dba14e0cb335ee8bb666306 /drivers/scsi/mvsas/mv_sas.c
parenta4632aae8b662b1f32fe3fc558a813cd5c3daae6 (diff)
[SCSI] mvsas: misc improvements
Change code to match HBA datasheet. Change code to make it readable. Add support big endian for mvs_prd_imt. Add cpu_to_le32 and cpu_to_le64 to use on addr. Add scan_finished for structure mvs_prv_info. Signed-off-by: Xiangliang Yu <yuxiangl@marvell.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mvsas/mv_sas.c')
-rw-r--r--drivers/scsi/mvsas/mv_sas.c109
1 files changed, 53 insertions, 56 deletions
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 38b47918c047..31ca8fe25cae 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -300,7 +300,10 @@ int mvs_slave_configure(struct scsi_device *sdev)
300 300
301 if (ret) 301 if (ret)
302 return ret; 302 return ret;
303 if (dev_is_sata(dev)) { 303 if (!dev_is_sata(dev)) {
304 sas_change_queue_depth(sdev,
305 MVS_QUEUE_SIZE,
306 SCSI_QDEPTH_DEFAULT);
304 } 307 }
305 return 0; 308 return 0;
306} 309}
@@ -311,6 +314,7 @@ void mvs_scan_start(struct Scsi_Host *shost)
311 unsigned short core_nr; 314 unsigned short core_nr;
312 struct mvs_info *mvi; 315 struct mvs_info *mvi;
313 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); 316 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
317 struct mvs_prv_info *mvs_prv = sha->lldd_ha;
314 318
315 core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host; 319 core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host;
316 320
@@ -319,15 +323,17 @@ void mvs_scan_start(struct Scsi_Host *shost)
319 for (i = 0; i < mvi->chip->n_phy; ++i) 323 for (i = 0; i < mvi->chip->n_phy; ++i)
320 mvs_bytes_dmaed(mvi, i); 324 mvs_bytes_dmaed(mvi, i);
321 } 325 }
326 mvs_prv->scan_finished = 1;
322} 327}
323 328
324int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time) 329int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time)
325{ 330{
326 /* give the phy enabling interrupt event time to come in (1s 331 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
327 * is empirically about all it takes) */ 332 struct mvs_prv_info *mvs_prv = sha->lldd_ha;
328 if (time < HZ) 333
334 if (mvs_prv->scan_finished == 0)
329 return 0; 335 return 0;
330 /* Wait for discovery to finish */ 336
331 scsi_flush_work(shost); 337 scsi_flush_work(shost);
332 return 1; 338 return 1;
333} 339}
@@ -625,6 +631,9 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi,
625 } 631 }
626 if (is_tmf) 632 if (is_tmf)
627 flags |= (MCH_SSP_FR_TASK << MCH_SSP_FR_TYPE_SHIFT); 633 flags |= (MCH_SSP_FR_TASK << MCH_SSP_FR_TYPE_SHIFT);
634 else
635 flags |= (MCH_SSP_FR_CMD << MCH_SSP_FR_TYPE_SHIFT);
636
628 hdr->flags = cpu_to_le32(flags | (tei->n_elem << MCH_PRD_LEN_SHIFT)); 637 hdr->flags = cpu_to_le32(flags | (tei->n_elem << MCH_PRD_LEN_SHIFT));
629 hdr->tags = cpu_to_le32(tag); 638 hdr->tags = cpu_to_le32(tag);
630 hdr->data_len = cpu_to_le32(task->total_xfer_len); 639 hdr->data_len = cpu_to_le32(task->total_xfer_len);
@@ -1049,9 +1058,9 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task,
1049 mvs_slot_free(mvi, slot_idx); 1058 mvs_slot_free(mvi, slot_idx);
1050} 1059}
1051 1060
1052static void mvs_update_wideport(struct mvs_info *mvi, int i) 1061static void mvs_update_wideport(struct mvs_info *mvi, int phy_no)
1053{ 1062{
1054 struct mvs_phy *phy = &mvi->phy[i]; 1063 struct mvs_phy *phy = &mvi->phy[phy_no];
1055 struct mvs_port *port = phy->port; 1064 struct mvs_port *port = phy->port;
1056 int j, no; 1065 int j, no;
1057 1066
@@ -1106,16 +1115,16 @@ static void *mvs_get_d2h_reg(struct mvs_info *mvi, int i, void *buf)
1106 return NULL; 1115 return NULL;
1107 1116
1108 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG3); 1117 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG3);
1109 s[3] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i); 1118 s[3] = cpu_to_le32(MVS_CHIP_DISP->read_port_cfg_data(mvi, i));
1110 1119
1111 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG2); 1120 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG2);
1112 s[2] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i); 1121 s[2] = cpu_to_le32(MVS_CHIP_DISP->read_port_cfg_data(mvi, i));
1113 1122
1114 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG1); 1123 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG1);
1115 s[1] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i); 1124 s[1] = cpu_to_le32(MVS_CHIP_DISP->read_port_cfg_data(mvi, i));
1116 1125
1117 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG0); 1126 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_SATA_SIG0);
1118 s[0] = MVS_CHIP_DISP->read_port_cfg_data(mvi, i); 1127 s[0] = cpu_to_le32(MVS_CHIP_DISP->read_port_cfg_data(mvi, i));
1119 1128
1120 /* Workaround: take some ATAPI devices for ATA */ 1129 /* Workaround: take some ATAPI devices for ATA */
1121 if (((s[1] & 0x00FFFFFF) == 0x00EB1401) && (*(u8 *)&s[3] == 0x01)) 1130 if (((s[1] & 0x00FFFFFF) == 0x00EB1401) && (*(u8 *)&s[3] == 0x01))
@@ -1201,9 +1210,9 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st)
1201 if (MVS_CHIP_DISP->phy_work_around) 1210 if (MVS_CHIP_DISP->phy_work_around)
1202 MVS_CHIP_DISP->phy_work_around(mvi, i); 1211 MVS_CHIP_DISP->phy_work_around(mvi, i);
1203 } 1212 }
1204 mv_dprintk("port %d attach dev info is %x\n", 1213 mv_dprintk("phy %d attach dev info is %x\n",
1205 i + mvi->id * mvi->chip->n_phy, phy->att_dev_info); 1214 i + mvi->id * mvi->chip->n_phy, phy->att_dev_info);
1206 mv_dprintk("port %d attach sas addr is %llx\n", 1215 mv_dprintk("phy %d attach sas addr is %llx\n",
1207 i + mvi->id * mvi->chip->n_phy, phy->att_dev_sas_addr); 1216 i + mvi->id * mvi->chip->n_phy, phy->att_dev_sas_addr);
1208out_done: 1217out_done:
1209 if (get_st) 1218 if (get_st)
@@ -1228,10 +1237,10 @@ static void mvs_port_notify_formed(struct asd_sas_phy *sas_phy, int lock)
1228 } 1237 }
1229 hi = i/((struct mvs_prv_info *)sas_ha->lldd_ha)->n_phy; 1238 hi = i/((struct mvs_prv_info *)sas_ha->lldd_ha)->n_phy;
1230 mvi = ((struct mvs_prv_info *)sas_ha->lldd_ha)->mvi[hi]; 1239 mvi = ((struct mvs_prv_info *)sas_ha->lldd_ha)->mvi[hi];
1231 if (sas_port->id >= mvi->chip->n_phy) 1240 if (i >= mvi->chip->n_phy)
1232 port = &mvi->port[sas_port->id - mvi->chip->n_phy]; 1241 port = &mvi->port[i - mvi->chip->n_phy];
1233 else 1242 else
1234 port = &mvi->port[sas_port->id]; 1243 port = &mvi->port[i];
1235 if (lock) 1244 if (lock)
1236 spin_lock_irqsave(&mvi->lock, flags); 1245 spin_lock_irqsave(&mvi->lock, flags);
1237 port->port_attached = 1; 1246 port->port_attached = 1;
@@ -1260,7 +1269,7 @@ static void mvs_port_notify_deformed(struct asd_sas_phy *sas_phy, int lock)
1260 return; 1269 return;
1261 } 1270 }
1262 list_for_each_entry(dev, &port->dev_list, dev_list_node) 1271 list_for_each_entry(dev, &port->dev_list, dev_list_node)
1263 mvs_do_release_task(phy->mvi, phy_no, NULL); 1272 mvs_do_release_task(phy->mvi, phy_no, dev);
1264 1273
1265} 1274}
1266 1275
@@ -1324,6 +1333,7 @@ int mvs_dev_found_notify(struct domain_device *dev, int lock)
1324 mvi_device->dev_status = MVS_DEV_NORMAL; 1333 mvi_device->dev_status = MVS_DEV_NORMAL;
1325 mvi_device->dev_type = dev->dev_type; 1334 mvi_device->dev_type = dev->dev_type;
1326 mvi_device->mvi_info = mvi; 1335 mvi_device->mvi_info = mvi;
1336 mvi_device->sas_device = dev;
1327 if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) { 1337 if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) {
1328 int phy_id; 1338 int phy_id;
1329 u8 phy_num = parent_dev->ex_dev.num_phys; 1339 u8 phy_num = parent_dev->ex_dev.num_phys;
@@ -1375,6 +1385,7 @@ void mvs_dev_gone_notify(struct domain_device *dev)
1375 mv_dprintk("found dev has gone.\n"); 1385 mv_dprintk("found dev has gone.\n");
1376 } 1386 }
1377 dev->lldd_dev = NULL; 1387 dev->lldd_dev = NULL;
1388 mvi_dev->sas_device = NULL;
1378 1389
1379 spin_unlock_irqrestore(&mvi->lock, flags); 1390 spin_unlock_irqrestore(&mvi->lock, flags);
1380} 1391}
@@ -1455,7 +1466,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
1455 } 1466 }
1456 1467
1457 wait_for_completion(&task->completion); 1468 wait_for_completion(&task->completion);
1458 res = -TMF_RESP_FUNC_FAILED; 1469 res = TMF_RESP_FUNC_FAILED;
1459 /* Even TMF timed out, return direct. */ 1470 /* Even TMF timed out, return direct. */
1460 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { 1471 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
1461 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { 1472 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
@@ -1505,11 +1516,10 @@ static int mvs_debug_issue_ssp_tmf(struct domain_device *dev,
1505 u8 *lun, struct mvs_tmf_task *tmf) 1516 u8 *lun, struct mvs_tmf_task *tmf)
1506{ 1517{
1507 struct sas_ssp_task ssp_task; 1518 struct sas_ssp_task ssp_task;
1508 DECLARE_COMPLETION_ONSTACK(completion);
1509 if (!(dev->tproto & SAS_PROTOCOL_SSP)) 1519 if (!(dev->tproto & SAS_PROTOCOL_SSP))
1510 return TMF_RESP_FUNC_ESUPP; 1520 return TMF_RESP_FUNC_ESUPP;
1511 1521
1512 strncpy((u8 *)&ssp_task.LUN, lun, 8); 1522 memcpy(ssp_task.LUN, lun, 8);
1513 1523
1514 return mvs_exec_internal_tmf_task(dev, &ssp_task, 1524 return mvs_exec_internal_tmf_task(dev, &ssp_task,
1515 sizeof(ssp_task), tmf); 1525 sizeof(ssp_task), tmf);
@@ -1533,7 +1543,7 @@ static int mvs_debug_I_T_nexus_reset(struct domain_device *dev)
1533int mvs_lu_reset(struct domain_device *dev, u8 *lun) 1543int mvs_lu_reset(struct domain_device *dev, u8 *lun)
1534{ 1544{
1535 unsigned long flags; 1545 unsigned long flags;
1536 int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; 1546 int rc = TMF_RESP_FUNC_FAILED;
1537 struct mvs_tmf_task tmf_task; 1547 struct mvs_tmf_task tmf_task;
1538 struct mvs_device * mvi_dev = dev->lldd_dev; 1548 struct mvs_device * mvi_dev = dev->lldd_dev;
1539 struct mvs_info *mvi = mvi_dev->mvi_info; 1549 struct mvs_info *mvi = mvi_dev->mvi_info;
@@ -1542,10 +1552,8 @@ int mvs_lu_reset(struct domain_device *dev, u8 *lun)
1542 mvi_dev->dev_status = MVS_DEV_EH; 1552 mvi_dev->dev_status = MVS_DEV_EH;
1543 rc = mvs_debug_issue_ssp_tmf(dev, lun, &tmf_task); 1553 rc = mvs_debug_issue_ssp_tmf(dev, lun, &tmf_task);
1544 if (rc == TMF_RESP_FUNC_COMPLETE) { 1554 if (rc == TMF_RESP_FUNC_COMPLETE) {
1545 num = mvs_find_dev_phyno(dev, phyno);
1546 spin_lock_irqsave(&mvi->lock, flags); 1555 spin_lock_irqsave(&mvi->lock, flags);
1547 for (i = 0; i < num; i++) 1556 mvs_release_task(mvi, dev);
1548 mvs_release_task(mvi, dev);
1549 spin_unlock_irqrestore(&mvi->lock, flags); 1557 spin_unlock_irqrestore(&mvi->lock, flags);
1550 } 1558 }
1551 /* If failed, fall-through I_T_Nexus reset */ 1559 /* If failed, fall-through I_T_Nexus reset */
@@ -1563,6 +1571,8 @@ int mvs_I_T_nexus_reset(struct domain_device *dev)
1563 1571
1564 if (mvi_dev->dev_status != MVS_DEV_EH) 1572 if (mvi_dev->dev_status != MVS_DEV_EH)
1565 return TMF_RESP_FUNC_COMPLETE; 1573 return TMF_RESP_FUNC_COMPLETE;
1574 else
1575 mvi_dev->dev_status = MVS_DEV_NORMAL;
1566 rc = mvs_debug_I_T_nexus_reset(dev); 1576 rc = mvs_debug_I_T_nexus_reset(dev);
1567 mv_printk("%s for device[%x]:rc= %d\n", 1577 mv_printk("%s for device[%x]:rc= %d\n",
1568 __func__, mvi_dev->device_id, rc); 1578 __func__, mvi_dev->device_id, rc);
@@ -1606,9 +1616,6 @@ int mvs_query_task(struct sas_task *task)
1606 case TMF_RESP_FUNC_FAILED: 1616 case TMF_RESP_FUNC_FAILED:
1607 case TMF_RESP_FUNC_COMPLETE: 1617 case TMF_RESP_FUNC_COMPLETE:
1608 break; 1618 break;
1609 default:
1610 rc = TMF_RESP_FUNC_COMPLETE;
1611 break;
1612 } 1619 }
1613 } 1620 }
1614 mv_printk("%s:rc= %d\n", __func__, rc); 1621 mv_printk("%s:rc= %d\n", __func__, rc);
@@ -1628,8 +1635,8 @@ int mvs_abort_task(struct sas_task *task)
1628 u32 tag; 1635 u32 tag;
1629 1636
1630 if (!mvi_dev) { 1637 if (!mvi_dev) {
1631 mv_printk("%s:%d TMF_RESP_FUNC_FAILED\n", __func__, __LINE__); 1638 mv_printk("Device has removed\n");
1632 rc = TMF_RESP_FUNC_FAILED; 1639 return TMF_RESP_FUNC_FAILED;
1633 } 1640 }
1634 1641
1635 mvi = mvi_dev->mvi_info; 1642 mvi = mvi_dev->mvi_info;
@@ -1677,22 +1684,15 @@ int mvs_abort_task(struct sas_task *task)
1677 /* to do free register_set */ 1684 /* to do free register_set */
1678 if (SATA_DEV == dev->dev_type) { 1685 if (SATA_DEV == dev->dev_type) {
1679 struct mvs_slot_info *slot = task->lldd_task; 1686 struct mvs_slot_info *slot = task->lldd_task;
1680 struct task_status_struct *tstat;
1681 u32 slot_idx = (u32)(slot - mvi->slot_info); 1687 u32 slot_idx = (u32)(slot - mvi->slot_info);
1682 tstat = &task->task_status; 1688 mv_dprintk("mvs_abort_task() mvi=%p task=%p "
1683 mv_dprintk(KERN_DEBUG "mv_abort_task() mvi=%p task=%p "
1684 "slot=%p slot_idx=x%x\n", 1689 "slot=%p slot_idx=x%x\n",
1685 mvi, task, slot, slot_idx); 1690 mvi, task, slot, slot_idx);
1686 tstat->stat = SAS_ABORTED_TASK; 1691 mvs_tmf_timedout((unsigned long)task);
1687 if (mvi_dev && mvi_dev->running_req)
1688 mvi_dev->running_req--;
1689 if (sas_protocol_ata(task->task_proto))
1690 mvs_free_reg_set(mvi, mvi_dev);
1691 mvs_slot_task_free(mvi, task, slot, slot_idx); 1692 mvs_slot_task_free(mvi, task, slot, slot_idx);
1692 return -1; 1693 rc = TMF_RESP_FUNC_COMPLETE;
1694 goto out;
1693 } 1695 }
1694 } else {
1695 /* SMP */
1696 1696
1697 } 1697 }
1698out: 1698out:
@@ -1813,7 +1813,7 @@ static int mvs_slot_err(struct mvs_info *mvi, struct sas_task *task,
1813{ 1813{
1814 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx]; 1814 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx];
1815 int stat; 1815 int stat;
1816 u32 err_dw0 = le32_to_cpu(*(u32 *) (slot->response)); 1816 u32 err_dw0 = le32_to_cpu(*(u32 *)slot->response);
1817 u32 err_dw1 = le32_to_cpu(*((u32 *)slot->response + 1)); 1817 u32 err_dw1 = le32_to_cpu(*((u32 *)slot->response + 1));
1818 u32 tfs = 0; 1818 u32 tfs = 0;
1819 enum mvs_port_type type = PORT_TYPE_SAS; 1819 enum mvs_port_type type = PORT_TYPE_SAS;
@@ -1847,10 +1847,8 @@ static int mvs_slot_err(struct mvs_info *mvi, struct sas_task *task,
1847 case SAS_PROTOCOL_STP: 1847 case SAS_PROTOCOL_STP:
1848 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: 1848 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
1849 { 1849 {
1850 if (err_dw0 == 0x80400002)
1851 mv_printk("find reserved error, why?\n");
1852
1853 task->ata_task.use_ncq = 0; 1850 task->ata_task.use_ncq = 0;
1851 stat = SAS_PROTO_RESPONSE;
1854 mvs_sata_done(mvi, task, slot_idx, err_dw0); 1852 mvs_sata_done(mvi, task, slot_idx, err_dw0);
1855 } 1853 }
1856 break; 1854 break;
@@ -1912,6 +1910,9 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1912 1910
1913 /* error info record present */ 1911 /* error info record present */
1914 if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) { 1912 if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) {
1913 mv_dprintk("port %d slot %d rx_desc %X has error info"
1914 "%016llX.\n", slot->port->sas_port.id, slot_idx,
1915 rx_desc, (u64)(*(u64 *)slot->response));
1915 tstat->stat = mvs_slot_err(mvi, task, slot_idx); 1916 tstat->stat = mvs_slot_err(mvi, task, slot_idx);
1916 tstat->resp = SAS_TASK_COMPLETE; 1917 tstat->resp = SAS_TASK_COMPLETE;
1917 goto out; 1918 goto out;
@@ -1973,8 +1974,7 @@ out:
1973 spin_unlock(&mvi->lock); 1974 spin_unlock(&mvi->lock);
1974 if (task->task_done) 1975 if (task->task_done)
1975 task->task_done(task); 1976 task->task_done(task);
1976 else 1977
1977 mv_dprintk("why has not task_done.\n");
1978 spin_lock(&mvi->lock); 1978 spin_lock(&mvi->lock);
1979 1979
1980 return sts; 1980 return sts;
@@ -2115,9 +2115,10 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
2115 struct mvs_phy *phy = &mvi->phy[phy_no]; 2115 struct mvs_phy *phy = &mvi->phy[phy_no];
2116 2116
2117 phy->irq_status = MVS_CHIP_DISP->read_port_irq_stat(mvi, phy_no); 2117 phy->irq_status = MVS_CHIP_DISP->read_port_irq_stat(mvi, phy_no);
2118 mv_dprintk("port %d ctrl sts=0x%X.\n", phy_no+mvi->id*mvi->chip->n_phy, 2118 MVS_CHIP_DISP->write_port_irq_stat(mvi, phy_no, phy->irq_status);
2119 mv_dprintk("phy %d ctrl sts=0x%08X.\n", phy_no+mvi->id*mvi->chip->n_phy,
2119 MVS_CHIP_DISP->read_phy_ctl(mvi, phy_no)); 2120 MVS_CHIP_DISP->read_phy_ctl(mvi, phy_no));
2120 mv_dprintk("Port %d irq sts = 0x%X\n", phy_no+mvi->id*mvi->chip->n_phy, 2121 mv_dprintk("phy %d irq sts = 0x%08X\n", phy_no+mvi->id*mvi->chip->n_phy,
2121 phy->irq_status); 2122 phy->irq_status);
2122 2123
2123 /* 2124 /*
@@ -2126,11 +2127,12 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
2126 */ 2127 */
2127 2128
2128 if (phy->irq_status & PHYEV_DCDR_ERR) { 2129 if (phy->irq_status & PHYEV_DCDR_ERR) {
2129 mv_dprintk("port %d STP decoding error.\n", 2130 mv_dprintk("phy %d STP decoding error.\n",
2130 phy_no + mvi->id*mvi->chip->n_phy); 2131 phy_no + mvi->id*mvi->chip->n_phy);
2131 } 2132 }
2132 2133
2133 if (phy->irq_status & PHYEV_POOF) { 2134 if (phy->irq_status & PHYEV_POOF) {
2135 mdelay(500);
2134 if (!(phy->phy_event & PHY_PLUG_OUT)) { 2136 if (!(phy->phy_event & PHY_PLUG_OUT)) {
2135 int dev_sata = phy->phy_type & PORT_TYPE_SATA; 2137 int dev_sata = phy->phy_type & PORT_TYPE_SATA;
2136 int ready; 2138 int ready;
@@ -2141,10 +2143,6 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
2141 (void *)(unsigned long)phy_no, 2143 (void *)(unsigned long)phy_no,
2142 PHY_PLUG_EVENT); 2144 PHY_PLUG_EVENT);
2143 ready = mvs_is_phy_ready(mvi, phy_no); 2145 ready = mvs_is_phy_ready(mvi, phy_no);
2144 if (!ready)
2145 mv_dprintk("phy%d Unplug Notice\n",
2146 phy_no +
2147 mvi->id * mvi->chip->n_phy);
2148 if (ready || dev_sata) { 2146 if (ready || dev_sata) {
2149 if (MVS_CHIP_DISP->stp_reset) 2147 if (MVS_CHIP_DISP->stp_reset)
2150 MVS_CHIP_DISP->stp_reset(mvi, 2148 MVS_CHIP_DISP->stp_reset(mvi,
@@ -2164,7 +2162,7 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
2164 if (phy->timer.function == NULL) { 2162 if (phy->timer.function == NULL) {
2165 phy->timer.data = (unsigned long)phy; 2163 phy->timer.data = (unsigned long)phy;
2166 phy->timer.function = mvs_sig_time_out; 2164 phy->timer.function = mvs_sig_time_out;
2167 phy->timer.expires = jiffies + 10*HZ; 2165 phy->timer.expires = jiffies + 5*HZ;
2168 add_timer(&phy->timer); 2166 add_timer(&phy->timer);
2169 } 2167 }
2170 } 2168 }
@@ -2198,12 +2196,11 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
2198 phy_no + mvi->id*mvi->chip->n_phy); 2196 phy_no + mvi->id*mvi->chip->n_phy);
2199 } 2197 }
2200 } else if (phy->irq_status & PHYEV_BROAD_CH) { 2198 } else if (phy->irq_status & PHYEV_BROAD_CH) {
2201 mv_dprintk("port %d broadcast change.\n", 2199 mv_dprintk("phy %d broadcast change.\n",
2202 phy_no + mvi->id*mvi->chip->n_phy); 2200 phy_no + mvi->id*mvi->chip->n_phy);
2203 mvs_handle_event(mvi, (void *)(unsigned long)phy_no, 2201 mvs_handle_event(mvi, (void *)(unsigned long)phy_no,
2204 EXP_BRCT_CHG); 2202 EXP_BRCT_CHG);
2205 } 2203 }
2206 MVS_CHIP_DISP->write_port_irq_stat(mvi, phy_no, phy->irq_status);
2207} 2204}
2208 2205
2209int mvs_int_rx(struct mvs_info *mvi, bool self_clear) 2206int mvs_int_rx(struct mvs_info *mvi, bool self_clear)