.. | .. |
---|
164 | 164 | } |
---|
165 | 165 | __setup("pcie_port_pm=", pcie_port_pm_setup); |
---|
166 | 166 | |
---|
167 | | -/* Time to wait after a reset for device to become responsive */ |
---|
168 | | -#define PCIE_RESET_READY_POLL_MS 60000 |
---|
169 | | - |
---|
170 | 167 | /** |
---|
171 | 168 | * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children |
---|
172 | 169 | * @bus: pointer to PCI bus structure to search |
---|
.. | .. |
---|
1228 | 1225 | return -ENOTTY; |
---|
1229 | 1226 | } |
---|
1230 | 1227 | |
---|
1231 | | - if (delay > 1000) |
---|
| 1228 | + if (delay > PCI_RESET_WAIT) |
---|
1232 | 1229 | pci_info(dev, "not ready %dms after %s; waiting\n", |
---|
1233 | 1230 | delay - 1, reset_type); |
---|
1234 | 1231 | |
---|
.. | .. |
---|
1237 | 1234 | pci_read_config_dword(dev, PCI_COMMAND, &id); |
---|
1238 | 1235 | } |
---|
1239 | 1236 | |
---|
1240 | | - if (delay > 1000) |
---|
| 1237 | + if (delay > PCI_RESET_WAIT) |
---|
1241 | 1238 | pci_info(dev, "ready %dms after %s\n", delay - 1, |
---|
1242 | 1239 | reset_type); |
---|
1243 | 1240 | |
---|
.. | .. |
---|
2840 | 2837 | { |
---|
2841 | 2838 | /* |
---|
2842 | 2839 | * Downstream device is not accessible after putting a root port |
---|
2843 | | - * into D3cold and back into D0 on Elo i2. |
---|
| 2840 | + * into D3cold and back into D0 on Elo Continental Z2 board |
---|
2844 | 2841 | */ |
---|
2845 | | - .ident = "Elo i2", |
---|
| 2842 | + .ident = "Elo Continental Z2", |
---|
2846 | 2843 | .matches = { |
---|
2847 | | - DMI_MATCH(DMI_SYS_VENDOR, "Elo Touch Solutions"), |
---|
2848 | | - DMI_MATCH(DMI_PRODUCT_NAME, "Elo i2"), |
---|
2849 | | - DMI_MATCH(DMI_PRODUCT_VERSION, "RevB"), |
---|
| 2844 | + DMI_MATCH(DMI_BOARD_VENDOR, "Elo Touch Solutions"), |
---|
| 2845 | + DMI_MATCH(DMI_BOARD_NAME, "Geminilake"), |
---|
| 2846 | + DMI_MATCH(DMI_BOARD_VERSION, "Continental Z2"), |
---|
2850 | 2847 | }, |
---|
2851 | 2848 | }, |
---|
2852 | 2849 | #endif |
---|
.. | .. |
---|
4799 | 4796 | /** |
---|
4800 | 4797 | * pci_bridge_wait_for_secondary_bus - Wait for secondary bus to be accessible |
---|
4801 | 4798 | * @dev: PCI bridge |
---|
| 4799 | + * @reset_type: reset type in human-readable form |
---|
| 4800 | + * @timeout: maximum time to wait for devices on secondary bus (milliseconds) |
---|
4802 | 4801 | * |
---|
4803 | 4802 | * Handle necessary delays before access to the devices on the secondary |
---|
4804 | | - * side of the bridge are permitted after D3cold to D0 transition. |
---|
| 4803 | + * side of the bridge are permitted after D3cold to D0 transition |
---|
| 4804 | + * or Conventional Reset. |
---|
4805 | 4805 | * |
---|
4806 | 4806 | * For PCIe this means the delays in PCIe 5.0 section 6.6.1. For |
---|
4807 | 4807 | * conventional PCI it means Tpvrh + Trhfa specified in PCI 3.0 section |
---|
4808 | 4808 | * 4.3.2. |
---|
| 4809 | + * |
---|
| 4810 | + * Return 0 on success or -ENOTTY if the first device on the secondary bus |
---|
| 4811 | + * failed to become accessible. |
---|
4809 | 4812 | */ |
---|
4810 | | -void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) |
---|
| 4813 | +int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type, |
---|
| 4814 | + int timeout) |
---|
4811 | 4815 | { |
---|
4812 | 4816 | struct pci_dev *child; |
---|
4813 | 4817 | int delay; |
---|
4814 | 4818 | |
---|
4815 | 4819 | if (pci_dev_is_disconnected(dev)) |
---|
4816 | | - return; |
---|
| 4820 | + return 0; |
---|
4817 | 4821 | |
---|
4818 | | - if (!pci_is_bridge(dev) || !dev->bridge_d3) |
---|
4819 | | - return; |
---|
| 4822 | + if (!pci_is_bridge(dev)) |
---|
| 4823 | + return 0; |
---|
4820 | 4824 | |
---|
4821 | 4825 | down_read(&pci_bus_sem); |
---|
4822 | 4826 | |
---|
.. | .. |
---|
4828 | 4832 | */ |
---|
4829 | 4833 | if (!dev->subordinate || list_empty(&dev->subordinate->devices)) { |
---|
4830 | 4834 | up_read(&pci_bus_sem); |
---|
4831 | | - return; |
---|
| 4835 | + return 0; |
---|
4832 | 4836 | } |
---|
4833 | 4837 | |
---|
4834 | 4838 | /* Take d3cold_delay requirements into account */ |
---|
4835 | 4839 | delay = pci_bus_max_d3cold_delay(dev->subordinate); |
---|
4836 | 4840 | if (!delay) { |
---|
4837 | 4841 | up_read(&pci_bus_sem); |
---|
4838 | | - return; |
---|
| 4842 | + return 0; |
---|
4839 | 4843 | } |
---|
4840 | 4844 | |
---|
4841 | 4845 | child = list_first_entry(&dev->subordinate->devices, struct pci_dev, |
---|
.. | .. |
---|
4844 | 4848 | |
---|
4845 | 4849 | /* |
---|
4846 | 4850 | * Conventional PCI and PCI-X we need to wait Tpvrh + Trhfa before |
---|
4847 | | - * accessing the device after reset (that is 1000 ms + 100 ms). In |
---|
4848 | | - * practice this should not be needed because we don't do power |
---|
4849 | | - * management for them (see pci_bridge_d3_possible()). |
---|
| 4851 | + * accessing the device after reset (that is 1000 ms + 100 ms). |
---|
4850 | 4852 | */ |
---|
4851 | 4853 | if (!pci_is_pcie(dev)) { |
---|
4852 | 4854 | pci_dbg(dev, "waiting %d ms for secondary bus\n", 1000 + delay); |
---|
4853 | 4855 | msleep(1000 + delay); |
---|
4854 | | - return; |
---|
| 4856 | + return 0; |
---|
4855 | 4857 | } |
---|
4856 | 4858 | |
---|
4857 | 4859 | /* |
---|
.. | .. |
---|
4868 | 4870 | * configuration requests if we only wait for 100 ms (see |
---|
4869 | 4871 | * https://bugzilla.kernel.org/show_bug.cgi?id=203885). |
---|
4870 | 4872 | * |
---|
4871 | | - * Therefore we wait for 100 ms and check for the device presence. |
---|
4872 | | - * If it is still not present give it an additional 100 ms. |
---|
| 4873 | + * Therefore we wait for 100 ms and check for the device presence |
---|
| 4874 | + * until the timeout expires. |
---|
4873 | 4875 | */ |
---|
4874 | 4876 | if (!pcie_downstream_port(dev)) |
---|
4875 | | - return; |
---|
| 4877 | + return 0; |
---|
4876 | 4878 | |
---|
4877 | 4879 | if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { |
---|
4878 | 4880 | pci_dbg(dev, "waiting %d ms for downstream link\n", delay); |
---|
.. | .. |
---|
4883 | 4885 | if (!pcie_wait_for_link_delay(dev, true, delay)) { |
---|
4884 | 4886 | /* Did not train, no need to wait any further */ |
---|
4885 | 4887 | pci_info(dev, "Data Link Layer Link Active not set in 1000 msec\n"); |
---|
4886 | | - return; |
---|
| 4888 | + return -ENOTTY; |
---|
4887 | 4889 | } |
---|
4888 | 4890 | } |
---|
4889 | 4891 | |
---|
4890 | | - if (!pci_device_is_present(child)) { |
---|
4891 | | - pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); |
---|
4892 | | - msleep(delay); |
---|
4893 | | - } |
---|
| 4892 | + return pci_dev_wait(child, reset_type, timeout - delay); |
---|
4894 | 4893 | } |
---|
4895 | 4894 | |
---|
4896 | 4895 | void pci_reset_secondary_bus(struct pci_dev *dev) |
---|
.. | .. |
---|
4909 | 4908 | |
---|
4910 | 4909 | ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET; |
---|
4911 | 4910 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl); |
---|
4912 | | - |
---|
4913 | | - /* |
---|
4914 | | - * Trhfa for conventional PCI is 2^25 clock cycles. |
---|
4915 | | - * Assuming a minimum 33MHz clock this results in a 1s |
---|
4916 | | - * delay before we can consider subordinate devices to |
---|
4917 | | - * be re-initialized. PCIe has some ways to shorten this, |
---|
4918 | | - * but we don't make use of them yet. |
---|
4919 | | - */ |
---|
4920 | | - ssleep(1); |
---|
4921 | 4911 | } |
---|
4922 | 4912 | |
---|
4923 | 4913 | void __weak pcibios_reset_secondary_bus(struct pci_dev *dev) |
---|
.. | .. |
---|
4936 | 4926 | { |
---|
4937 | 4927 | pcibios_reset_secondary_bus(dev); |
---|
4938 | 4928 | |
---|
4939 | | - return pci_dev_wait(dev, "bus reset", PCIE_RESET_READY_POLL_MS); |
---|
| 4929 | + return pci_bridge_wait_for_secondary_bus(dev, "bus reset", |
---|
| 4930 | + PCIE_RESET_READY_POLL_MS); |
---|
4940 | 4931 | } |
---|
4941 | 4932 | EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset); |
---|
4942 | 4933 | |
---|
.. | .. |
---|
6159 | 6150 | { |
---|
6160 | 6151 | u32 v; |
---|
6161 | 6152 | |
---|
| 6153 | + /* Check PF if pdev is a VF, since VF Vendor/Device IDs are 0xffff */ |
---|
| 6154 | + pdev = pci_physfn(pdev); |
---|
6162 | 6155 | if (pci_dev_is_disconnected(pdev)) |
---|
6163 | 6156 | return false; |
---|
6164 | 6157 | return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); |
---|