@@ -206,6 +206,9 @@ static int board_added(struct slot *p_sl
if (PWR_LED(ctrl))
pciehp_green_led_blink(p_slot);
+ /* Wait for ~1 second */
+ msleep(1000);
+
/* Check link training status */
retval = pciehp_check_link_status(ctrl);
if (retval) {
@@ -241,52 +241,11 @@ static int pcie_write_cmd(struct control
return retval;
}
-static inline int check_link_active(struct controller *ctrl)
-{
- u16 link_status;
-
- if (pciehp_readw(ctrl, PCI_EXP_LNKSTA, &link_status))
- return 0;
- return !!(link_status & PCI_EXP_LNKSTA_DLLLA);
-}
-
-static void pcie_wait_link_active(struct controller *ctrl)
-{
- int timeout = 1000;
-
- if (check_link_active(ctrl))
- return;
- while (timeout > 0) {
- msleep(10);
- timeout -= 10;
- if (check_link_active(ctrl))
- return;
- }
- ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n");
-}
-
int pciehp_check_link_status(struct controller *ctrl)
{
u16 lnk_status;
int retval = 0;
- /*
- * Data Link Layer Link Active Reporting must be capable for
- * hot-plug capable downstream port. But old controller might
- * not implement it. In this case, we wait for 1000 ms.
- */
- if (ctrl->link_active_reporting){
- /* Wait for Data Link Layer Link Active bit to be set */
- pcie_wait_link_active(ctrl);
- /*
- * We must wait for 100 ms after the Data Link Layer
- * Link Active bit reads 1b before initiating a
- * configuration access to the hot added device.
- */
- msleep(100);
- } else
- msleep(1000);
-
retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
if (retval) {
ctrl_err(ctrl, "Cannot read LNKSTATUS register\n");