aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYinghai Lu <yinghai.lu@oracle.com>2011-11-07 10:53:23 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-11-07 11:07:34 -0500
commitfdbd3ce9efb3a045266f2f6b2f1b6047882ff092 (patch)
treec5cc769c2e7fa8ab09061b6661406fcc168c84cb /drivers
parentc54420d3302d30999060e2669d0800b85e5b5a20 (diff)
PCI: pciehp: Retrieve link speed after link is trained
During hot plug, board_added will call pciehp_power_on_slot(). But link speed is updated in pciehp_power_on_slot(). We should not update link speed there, because that is too early. So move the link speed update to pciehp_check_link_status() after making sure the link has been trained. -v2: fix compile warning that Kenji found. Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 96dc4734e4af..6692832c9c81 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -294,6 +294,8 @@ int pciehp_check_link_status(struct controller *ctrl)
294 return retval; 294 return retval;
295 } 295 }
296 296
297 pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
298
297 return retval; 299 return retval;
298} 300}
299 301
@@ -484,7 +486,6 @@ int pciehp_power_on_slot(struct slot * slot)
484 u16 slot_cmd; 486 u16 slot_cmd;
485 u16 cmd_mask; 487 u16 cmd_mask;
486 u16 slot_status; 488 u16 slot_status;
487 u16 lnk_status;
488 int retval = 0; 489 int retval = 0;
489 490
490 /* Clear sticky power-fault bit from previous power failures */ 491 /* Clear sticky power-fault bit from previous power failures */
@@ -516,14 +517,6 @@ int pciehp_power_on_slot(struct slot * slot)
516 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, 517 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
517 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); 518 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
518 519
519 retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
520 if (retval) {
521 ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
522 __func__);
523 return retval;
524 }
525 pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
526
527 return retval; 520 return retval;
528} 521}
529 522