Message ID | 1395699232-28727-1-git-send-email-yinghai@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Just a note :-) > -v2: use second way that is suggested by Bjorn. > It also solve the problem on Rajat's sytem that have wrong inital CC Er, not wrong initial CC. Just a different (but not necessarily wrong) different CC bit behavior :-). In my systems, the CC bit gets set for every write to the slot control register (even if Button, LED, EMI, power controller are not implemented). > Tested-by: Rajat Jain <rajatxjain@gmail.com> Yes, I tested and it seems to work fine on such systems too. Best Regards, Rajat -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Mar 24, 2014 at 4:19 PM, Rajat Jain <rajatjain@juniper.net> wrote: > Just a note :-) > >> -v2: use second way that is suggested by Bjorn. >> It also solve the problem on Rajat's sytem that have wrong inital CC > > Er, not wrong initial CC. > > Just a different (but not necessarily wrong) different CC bit behavior :-). In my systems, the CC bit gets set for every write to the slot control register (even if Button, LED, EMI, power controller are not implemented). > >> Tested-by: Rajat Jain <rajatxjain@gmail.com> > > Yes, I tested and it seems to work fine on such systems too. Thanks for inputs for change log changes. Assume Bjorn will sort it out. Thanks Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c @@ -158,15 +158,8 @@ static void pcie_write_cmd(struct contro mutex_lock(&ctrl->ctrl_lock); pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); - if (slot_status & PCI_EXP_SLTSTA_CC) { - if (!ctrl->no_cmd_complete) { - /* - * After 1 sec and CMD_COMPLETED still not set, just - * proceed forward to issue the next command according - * to spec. Just print out the error message. - */ - ctrl_dbg(ctrl, "CMD_COMPLETED not clear after 1 sec\n"); - } else if (!NO_CMD_CMPL(ctrl)) { + if (ctrl->no_cmd_complete && slot_status & PCI_EXP_SLTSTA_CC) { + if (!NO_CMD_CMPL(ctrl)) { /* * This controller seems to notify of command completed * event even though it supports none of power @@ -182,16 +175,11 @@ static void pcie_write_cmd(struct contro } pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl); - slot_ctrl &= ~mask; - slot_ctrl |= (cmd & mask); - ctrl->cmd_busy = 1; - smp_mb(); - pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl); - /* * Wait for command completion. */ - if (!ctrl->no_cmd_complete) { + if (!ctrl->no_cmd_complete && (slot_status & PCI_EXP_SLTSTA_CC) && + ctrl->cmd_busy) { int poll = 0; /* * if hotplug interrupt is not enabled or command @@ -203,6 +191,12 @@ static void pcie_write_cmd(struct contro poll = 1; pcie_wait_cmd(ctrl, poll); } + + slot_ctrl &= ~mask; + slot_ctrl |= (cmd & mask); + ctrl->cmd_busy = 1; + smp_mb(); + pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl); mutex_unlock(&ctrl->ctrl_lock); }