diff options
-rw-r--r-- | Documentation/devicetree/bindings/pci/designware-pcie.txt | 7 | ||||
-rw-r--r-- | MAINTAINERS | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh.c | 3 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 2 | ||||
-rw-r--r-- | arch/x86/pci/fixup.c | 18 | ||||
-rw-r--r-- | drivers/acpi/apei/apei-base.c | 6 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 18 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 246 | ||||
-rw-r--r-- | drivers/pci/host/Kconfig | 6 | ||||
-rw-r--r-- | drivers/pci/host/Makefile | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-exynos.c | 112 | ||||
-rw-r--r-- | drivers/pci/host/pci-imx6.c | 575 | ||||
-rw-r--r-- | drivers/pci/host/pci-tegra.c | 4 | ||||
-rw-r--r-- | drivers/pci/host/pcie-designware.c | 240 | ||||
-rw-r--r-- | drivers/pci/host/pcie-designware.h | 14 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpi_pcihp.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 2 | ||||
-rw-r--r-- | drivers/pci/probe.c | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 53 | ||||
-rw-r--r-- | drivers/scsi/csiostor/csio_hw.c | 22 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mr.c | 6 | ||||
-rw-r--r-- | include/linux/acpi.h | 81 | ||||
-rw-r--r-- | include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 8 | ||||
-rw-r--r-- | include/uapi/linux/pci_regs.h | 3 |
24 files changed, 1202 insertions, 236 deletions
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index eabcb4b5db6e..dd8d920bcbd6 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt | |||
@@ -3,7 +3,7 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: should contain "snps,dw-pcie" to identify the | 4 | - compatible: should contain "snps,dw-pcie" to identify the |
5 | core, plus an identifier for the specific instance, such | 5 | core, plus an identifier for the specific instance, such |
6 | as "samsung,exynos5440-pcie". | 6 | as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". |
7 | - reg: base addresses and lengths of the pcie controller, | 7 | - reg: base addresses and lengths of the pcie controller, |
8 | the phy controller, additional register for the phy controller. | 8 | the phy controller, additional register for the phy controller. |
9 | - interrupts: interrupt values for level interrupt, | 9 | - interrupts: interrupt values for level interrupt, |
@@ -21,6 +21,11 @@ Required properties: | |||
21 | - num-lanes: number of lanes to use | 21 | - num-lanes: number of lanes to use |
22 | - reset-gpio: gpio pin number of power good signal | 22 | - reset-gpio: gpio pin number of power good signal |
23 | 23 | ||
24 | Optional properties for fsl,imx6q-pcie | ||
25 | - power-on-gpio: gpio pin number of power-enable signal | ||
26 | - wake-up-gpio: gpio pin number of incoming wakeup signal | ||
27 | - disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal | ||
28 | |||
24 | Example: | 29 | Example: |
25 | 30 | ||
26 | SoC specific DT Entry: | 31 | SoC specific DT Entry: |
diff --git a/MAINTAINERS b/MAINTAINERS index e61c2e83fc2b..bc6d82162ebe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6346,6 +6346,12 @@ S: Supported | |||
6346 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 6346 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt |
6347 | F: drivers/pci/host/pci-tegra.c | 6347 | F: drivers/pci/host/pci-tegra.c |
6348 | 6348 | ||
6349 | PCI DRIVER FOR SAMSUNG EXYNOS | ||
6350 | M: Jingoo Han <jg1.han@samsung.com> | ||
6351 | L: linux-pci@vger.kernel.org | ||
6352 | S: Maintained | ||
6353 | F: drivers/pci/host/pci-exynos.c | ||
6354 | |||
6349 | PCMCIA SUBSYSTEM | 6355 | PCMCIA SUBSYSTEM |
6350 | P: Linux PCMCIA Team | 6356 | P: Linux PCMCIA Team |
6351 | L: linux-pcmcia@lists.infradead.org | 6357 | L: linux-pcmcia@lists.infradead.org |
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 55593ee2d5aa..6ebbe545b7a5 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -189,8 +189,7 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | /* If PCI-E capable, dump PCI-E cap 10, and the AER */ | 191 | /* If PCI-E capable, dump PCI-E cap 10, and the AER */ |
192 | cap = pci_find_capability(dev, PCI_CAP_ID_EXP); | 192 | if (pci_is_pcie(dev)) { |
193 | if (cap) { | ||
194 | n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); | 193 | n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); |
195 | printk(KERN_WARNING | 194 | printk(KERN_WARNING |
196 | "EEH: PCI-E capabilities and status follow:\n"); | 195 | "EEH: PCI-E capabilities and status follow:\n"); |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index ccfb50ddfe38..92e7258478d8 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -45,7 +45,7 @@ static void quirk_fsl_pcie_header(struct pci_dev *dev) | |||
45 | u8 hdr_type; | 45 | u8 hdr_type; |
46 | 46 | ||
47 | /* if we aren't a PCIe don't bother */ | 47 | /* if we aren't a PCIe don't bother */ |
48 | if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) | 48 | if (!pci_is_pcie(dev)) |
49 | return; | 49 | return; |
50 | 50 | ||
51 | /* if we aren't in host mode don't bother */ | 51 | /* if we aren't in host mode don't bother */ |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index f5809fa2753e..b046e070e088 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -231,7 +231,7 @@ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int wh | |||
231 | offset = quirk_aspm_offset[GET_INDEX(bus->self->device, devfn)]; | 231 | offset = quirk_aspm_offset[GET_INDEX(bus->self->device, devfn)]; |
232 | 232 | ||
233 | if ((offset) && (where == offset)) | 233 | if ((offset) && (where == offset)) |
234 | value = value & 0xfffffffc; | 234 | value = value & ~PCI_EXP_LNKCTL_ASPMC; |
235 | 235 | ||
236 | return raw_pci_write(pci_domain_nr(bus), bus->number, | 236 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
237 | devfn, where, size, value); | 237 | devfn, where, size, value); |
@@ -252,7 +252,7 @@ static struct pci_ops quirk_pcie_aspm_ops = { | |||
252 | */ | 252 | */ |
253 | static void pcie_rootport_aspm_quirk(struct pci_dev *pdev) | 253 | static void pcie_rootport_aspm_quirk(struct pci_dev *pdev) |
254 | { | 254 | { |
255 | int cap_base, i; | 255 | int i; |
256 | struct pci_bus *pbus; | 256 | struct pci_bus *pbus; |
257 | struct pci_dev *dev; | 257 | struct pci_dev *dev; |
258 | 258 | ||
@@ -278,7 +278,7 @@ static void pcie_rootport_aspm_quirk(struct pci_dev *pdev) | |||
278 | for (i = GET_INDEX(pdev->device, 0); i <= GET_INDEX(pdev->device, 7); ++i) | 278 | for (i = GET_INDEX(pdev->device, 0); i <= GET_INDEX(pdev->device, 7); ++i) |
279 | quirk_aspm_offset[i] = 0; | 279 | quirk_aspm_offset[i] = 0; |
280 | 280 | ||
281 | pbus->ops = pbus->parent->ops; | 281 | pci_bus_set_ops(pbus, pbus->parent->ops); |
282 | } else { | 282 | } else { |
283 | /* | 283 | /* |
284 | * If devices are attached to the root port at power-up or | 284 | * If devices are attached to the root port at power-up or |
@@ -286,13 +286,15 @@ static void pcie_rootport_aspm_quirk(struct pci_dev *pdev) | |||
286 | * each root port to save the register offsets and replace the | 286 | * each root port to save the register offsets and replace the |
287 | * bus ops. | 287 | * bus ops. |
288 | */ | 288 | */ |
289 | list_for_each_entry(dev, &pbus->devices, bus_list) { | 289 | list_for_each_entry(dev, &pbus->devices, bus_list) |
290 | /* There are 0 to 8 devices attached to this bus */ | 290 | /* There are 0 to 8 devices attached to this bus */ |
291 | cap_base = pci_find_capability(dev, PCI_CAP_ID_EXP); | 291 | quirk_aspm_offset[GET_INDEX(pdev->device, dev->devfn)] = |
292 | quirk_aspm_offset[GET_INDEX(pdev->device, dev->devfn)] = cap_base + 0x10; | 292 | dev->pcie_cap + PCI_EXP_LNKCTL; |
293 | } | 293 | |
294 | pbus->ops = &quirk_pcie_aspm_ops; | 294 | pci_bus_set_ops(pbus, &quirk_pcie_aspm_ops); |
295 | dev_info(&pbus->dev, "writes to ASPM control bits will be ignored\n"); | ||
295 | } | 296 | } |
297 | |||
296 | } | 298 | } |
297 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA, pcie_rootport_aspm_quirk); | 299 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA, pcie_rootport_aspm_quirk); |
298 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA1, pcie_rootport_aspm_quirk); | 300 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PA1, pcie_rootport_aspm_quirk); |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 46f80e2c92f7..6d2c49b86b7f 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -758,9 +758,9 @@ int apei_osc_setup(void) | |||
758 | .cap.pointer = capbuf, | 758 | .cap.pointer = capbuf, |
759 | }; | 759 | }; |
760 | 760 | ||
761 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 761 | capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; |
762 | capbuf[OSC_SUPPORT_TYPE] = 1; | 762 | capbuf[OSC_SUPPORT_DWORD] = 1; |
763 | capbuf[OSC_CONTROL_TYPE] = 0; | 763 | capbuf[OSC_CONTROL_DWORD] = 0; |
764 | 764 | ||
765 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) | 765 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) |
766 | || ACPI_FAILURE(acpi_run_osc(handle, &context))) | 766 | || ACPI_FAILURE(acpi_run_osc(handle, &context))) |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index b587ec8257b2..fbcfaa682c15 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -255,7 +255,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) | |||
255 | acpi_print_osc_error(handle, context, | 255 | acpi_print_osc_error(handle, context, |
256 | "_OSC invalid revision"); | 256 | "_OSC invalid revision"); |
257 | if (errors & OSC_CAPABILITIES_MASK_ERROR) { | 257 | if (errors & OSC_CAPABILITIES_MASK_ERROR) { |
258 | if (((u32 *)context->cap.pointer)[OSC_QUERY_TYPE] | 258 | if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD] |
259 | & OSC_QUERY_ENABLE) | 259 | & OSC_QUERY_ENABLE) |
260 | goto out_success; | 260 | goto out_success; |
261 | status = AE_SUPPORT; | 261 | status = AE_SUPPORT; |
@@ -295,30 +295,30 @@ static void acpi_bus_osc_support(void) | |||
295 | }; | 295 | }; |
296 | acpi_handle handle; | 296 | acpi_handle handle; |
297 | 297 | ||
298 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 298 | capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; |
299 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ | 299 | capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ |
300 | #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ | 300 | #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ |
301 | defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) | 301 | defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) |
302 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; | 302 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT; |
303 | #endif | 303 | #endif |
304 | 304 | ||
305 | #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) | 305 | #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) |
306 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; | 306 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; |
307 | #endif | 307 | #endif |
308 | 308 | ||
309 | #ifdef ACPI_HOTPLUG_OST | 309 | #ifdef ACPI_HOTPLUG_OST |
310 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_HOTPLUG_OST_SUPPORT; | 310 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | if (!ghes_disable) | 313 | if (!ghes_disable) |
314 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT; | 314 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; |
315 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) | 315 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) |
316 | return; | 316 | return; |
317 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) { | 317 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) { |
318 | u32 *capbuf_ret = context.ret.pointer; | 318 | u32 *capbuf_ret = context.ret.pointer; |
319 | if (context.ret.length > OSC_SUPPORT_TYPE) | 319 | if (context.ret.length > OSC_SUPPORT_DWORD) |
320 | osc_sb_apei_support_acked = | 320 | osc_sb_apei_support_acked = |
321 | capbuf_ret[OSC_SUPPORT_TYPE] & OSC_SB_APEI_SUPPORT; | 321 | capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; |
322 | kfree(context.ret.pointer); | 322 | kfree(context.ret.pointer); |
323 | } | 323 | } |
324 | /* do we need to check other returned cap? Sounds no */ | 324 | /* do we need to check other returned cap? Sounds no */ |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index d3874f425653..924ad92852c1 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -49,10 +49,10 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
49 | const struct acpi_device_id *not_used); | 49 | const struct acpi_device_id *not_used); |
50 | static void acpi_pci_root_remove(struct acpi_device *device); | 50 | static void acpi_pci_root_remove(struct acpi_device *device); |
51 | 51 | ||
52 | #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ | 52 | #define ACPI_PCIE_REQ_SUPPORT (OSC_PCI_EXT_CONFIG_SUPPORT \ |
53 | | OSC_ACTIVE_STATE_PWR_SUPPORT \ | 53 | | OSC_PCI_ASPM_SUPPORT \ |
54 | | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ | 54 | | OSC_PCI_CLOCK_PM_SUPPORT \ |
55 | | OSC_MSI_SUPPORT) | 55 | | OSC_PCI_MSI_SUPPORT) |
56 | 56 | ||
57 | static const struct acpi_device_id root_device_ids[] = { | 57 | static const struct acpi_device_id root_device_ids[] = { |
58 | {"PNP0A03", 0}, | 58 | {"PNP0A03", 0}, |
@@ -127,6 +127,55 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle, | |||
127 | return AE_OK; | 127 | return AE_OK; |
128 | } | 128 | } |
129 | 129 | ||
130 | struct pci_osc_bit_struct { | ||
131 | u32 bit; | ||
132 | char *desc; | ||
133 | }; | ||
134 | |||
135 | static struct pci_osc_bit_struct pci_osc_support_bit[] = { | ||
136 | { OSC_PCI_EXT_CONFIG_SUPPORT, "ExtendedConfig" }, | ||
137 | { OSC_PCI_ASPM_SUPPORT, "ASPM" }, | ||
138 | { OSC_PCI_CLOCK_PM_SUPPORT, "ClockPM" }, | ||
139 | { OSC_PCI_SEGMENT_GROUPS_SUPPORT, "Segments" }, | ||
140 | { OSC_PCI_MSI_SUPPORT, "MSI" }, | ||
141 | }; | ||
142 | |||
143 | static struct pci_osc_bit_struct pci_osc_control_bit[] = { | ||
144 | { OSC_PCI_EXPRESS_NATIVE_HP_CONTROL, "PCIeHotplug" }, | ||
145 | { OSC_PCI_SHPC_NATIVE_HP_CONTROL, "SHPCHotplug" }, | ||
146 | { OSC_PCI_EXPRESS_PME_CONTROL, "PME" }, | ||
147 | { OSC_PCI_EXPRESS_AER_CONTROL, "AER" }, | ||
148 | { OSC_PCI_EXPRESS_CAPABILITY_CONTROL, "PCIeCapability" }, | ||
149 | }; | ||
150 | |||
151 | static void decode_osc_bits(struct acpi_pci_root *root, char *msg, u32 word, | ||
152 | struct pci_osc_bit_struct *table, int size) | ||
153 | { | ||
154 | char buf[80]; | ||
155 | int i, len = 0; | ||
156 | struct pci_osc_bit_struct *entry; | ||
157 | |||
158 | buf[0] = '\0'; | ||
159 | for (i = 0, entry = table; i < size; i++, entry++) | ||
160 | if (word & entry->bit) | ||
161 | len += snprintf(buf + len, sizeof(buf) - len, "%s%s", | ||
162 | len ? " " : "", entry->desc); | ||
163 | |||
164 | dev_info(&root->device->dev, "_OSC: %s [%s]\n", msg, buf); | ||
165 | } | ||
166 | |||
167 | static void decode_osc_support(struct acpi_pci_root *root, char *msg, u32 word) | ||
168 | { | ||
169 | decode_osc_bits(root, msg, word, pci_osc_support_bit, | ||
170 | ARRAY_SIZE(pci_osc_support_bit)); | ||
171 | } | ||
172 | |||
173 | static void decode_osc_control(struct acpi_pci_root *root, char *msg, u32 word) | ||
174 | { | ||
175 | decode_osc_bits(root, msg, word, pci_osc_control_bit, | ||
176 | ARRAY_SIZE(pci_osc_control_bit)); | ||
177 | } | ||
178 | |||
130 | static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; | 179 | static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; |
131 | 180 | ||
132 | static acpi_status acpi_pci_run_osc(acpi_handle handle, | 181 | static acpi_status acpi_pci_run_osc(acpi_handle handle, |
@@ -158,14 +207,14 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, | |||
158 | support &= OSC_PCI_SUPPORT_MASKS; | 207 | support &= OSC_PCI_SUPPORT_MASKS; |
159 | support |= root->osc_support_set; | 208 | support |= root->osc_support_set; |
160 | 209 | ||
161 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 210 | capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; |
162 | capbuf[OSC_SUPPORT_TYPE] = support; | 211 | capbuf[OSC_SUPPORT_DWORD] = support; |
163 | if (control) { | 212 | if (control) { |
164 | *control &= OSC_PCI_CONTROL_MASKS; | 213 | *control &= OSC_PCI_CONTROL_MASKS; |
165 | capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set; | 214 | capbuf[OSC_CONTROL_DWORD] = *control | root->osc_control_set; |
166 | } else { | 215 | } else { |
167 | /* Run _OSC query only with existing controls. */ | 216 | /* Run _OSC query only with existing controls. */ |
168 | capbuf[OSC_CONTROL_TYPE] = root->osc_control_set; | 217 | capbuf[OSC_CONTROL_DWORD] = root->osc_control_set; |
169 | } | 218 | } |
170 | 219 | ||
171 | status = acpi_pci_run_osc(root->device->handle, capbuf, &result); | 220 | status = acpi_pci_run_osc(root->device->handle, capbuf, &result); |
@@ -180,11 +229,7 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, | |||
180 | static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) | 229 | static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) |
181 | { | 230 | { |
182 | acpi_status status; | 231 | acpi_status status; |
183 | acpi_handle tmp; | ||
184 | 232 | ||
185 | status = acpi_get_handle(root->device->handle, "_OSC", &tmp); | ||
186 | if (ACPI_FAILURE(status)) | ||
187 | return status; | ||
188 | mutex_lock(&osc_lock); | 233 | mutex_lock(&osc_lock); |
189 | status = acpi_pci_query_osc(root, flags, NULL); | 234 | status = acpi_pci_query_osc(root, flags, NULL); |
190 | mutex_unlock(&osc_lock); | 235 | mutex_unlock(&osc_lock); |
@@ -316,9 +361,8 @@ EXPORT_SYMBOL_GPL(acpi_get_pci_dev); | |||
316 | acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) | 361 | acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) |
317 | { | 362 | { |
318 | struct acpi_pci_root *root; | 363 | struct acpi_pci_root *root; |
319 | acpi_status status; | 364 | acpi_status status = AE_OK; |
320 | u32 ctrl, capbuf[3]; | 365 | u32 ctrl, capbuf[3]; |
321 | acpi_handle tmp; | ||
322 | 366 | ||
323 | if (!mask) | 367 | if (!mask) |
324 | return AE_BAD_PARAMETER; | 368 | return AE_BAD_PARAMETER; |
@@ -331,10 +375,6 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) | |||
331 | if (!root) | 375 | if (!root) |
332 | return AE_NOT_EXIST; | 376 | return AE_NOT_EXIST; |
333 | 377 | ||
334 | status = acpi_get_handle(handle, "_OSC", &tmp); | ||
335 | if (ACPI_FAILURE(status)) | ||
336 | return status; | ||
337 | |||
338 | mutex_lock(&osc_lock); | 378 | mutex_lock(&osc_lock); |
339 | 379 | ||
340 | *mask = ctrl | root->osc_control_set; | 380 | *mask = ctrl | root->osc_control_set; |
@@ -349,17 +389,21 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) | |||
349 | goto out; | 389 | goto out; |
350 | if (ctrl == *mask) | 390 | if (ctrl == *mask) |
351 | break; | 391 | break; |
392 | decode_osc_control(root, "platform does not support", | ||
393 | ctrl & ~(*mask)); | ||
352 | ctrl = *mask; | 394 | ctrl = *mask; |
353 | } | 395 | } |
354 | 396 | ||
355 | if ((ctrl & req) != req) { | 397 | if ((ctrl & req) != req) { |
398 | decode_osc_control(root, "not requesting control; platform does not support", | ||
399 | req & ~(ctrl)); | ||
356 | status = AE_SUPPORT; | 400 | status = AE_SUPPORT; |
357 | goto out; | 401 | goto out; |
358 | } | 402 | } |
359 | 403 | ||
360 | capbuf[OSC_QUERY_TYPE] = 0; | 404 | capbuf[OSC_QUERY_DWORD] = 0; |
361 | capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set; | 405 | capbuf[OSC_SUPPORT_DWORD] = root->osc_support_set; |
362 | capbuf[OSC_CONTROL_TYPE] = ctrl; | 406 | capbuf[OSC_CONTROL_DWORD] = ctrl; |
363 | status = acpi_pci_run_osc(handle, capbuf, mask); | 407 | status = acpi_pci_run_osc(handle, capbuf, mask); |
364 | if (ACPI_SUCCESS(status)) | 408 | if (ACPI_SUCCESS(status)) |
365 | root->osc_control_set = *mask; | 409 | root->osc_control_set = *mask; |
@@ -369,6 +413,87 @@ out: | |||
369 | } | 413 | } |
370 | EXPORT_SYMBOL(acpi_pci_osc_control_set); | 414 | EXPORT_SYMBOL(acpi_pci_osc_control_set); |
371 | 415 | ||
416 | static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, | ||
417 | int *clear_aspm) | ||
418 | { | ||
419 | u32 support, control, requested; | ||
420 | acpi_status status; | ||
421 | struct acpi_device *device = root->device; | ||
422 | acpi_handle handle = device->handle; | ||
423 | |||
424 | /* | ||
425 | * All supported architectures that use ACPI have support for | ||
426 | * PCI domains, so we indicate this in _OSC support capabilities. | ||
427 | */ | ||
428 | support = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | ||
429 | if (pci_ext_cfg_avail()) | ||
430 | support |= OSC_PCI_EXT_CONFIG_SUPPORT; | ||
431 | if (pcie_aspm_support_enabled()) | ||
432 | support |= OSC_PCI_ASPM_SUPPORT | OSC_PCI_CLOCK_PM_SUPPORT; | ||
433 | if (pci_msi_enabled()) | ||
434 | support |= OSC_PCI_MSI_SUPPORT; | ||
435 | |||
436 | decode_osc_support(root, "OS supports", support); | ||
437 | status = acpi_pci_osc_support(root, support); | ||
438 | if (ACPI_FAILURE(status)) { | ||
439 | dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", | ||
440 | acpi_format_exception(status)); | ||
441 | *no_aspm = 1; | ||
442 | return; | ||
443 | } | ||
444 | |||
445 | if (pcie_ports_disabled) { | ||
446 | dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n"); | ||
447 | return; | ||
448 | } | ||
449 | |||
450 | if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) { | ||
451 | decode_osc_support(root, "not requesting OS control; OS requires", | ||
452 | ACPI_PCIE_REQ_SUPPORT); | ||
453 | return; | ||
454 | } | ||
455 | |||
456 | control = OSC_PCI_EXPRESS_CAPABILITY_CONTROL | ||
457 | | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | ||
458 | | OSC_PCI_EXPRESS_PME_CONTROL; | ||
459 | |||
460 | if (pci_aer_available()) { | ||
461 | if (aer_acpi_firmware_first()) | ||
462 | dev_info(&device->dev, | ||
463 | "PCIe AER handled by firmware\n"); | ||
464 | else | ||
465 | control |= OSC_PCI_EXPRESS_AER_CONTROL; | ||
466 | } | ||
467 | |||
468 | requested = control; | ||
469 | status = acpi_pci_osc_control_set(handle, &control, | ||
470 | OSC_PCI_EXPRESS_CAPABILITY_CONTROL); | ||
471 | if (ACPI_SUCCESS(status)) { | ||
472 | decode_osc_control(root, "OS now controls", control); | ||
473 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
474 | /* | ||
475 | * We have ASPM control, but the FADT indicates | ||
476 | * that it's unsupported. Clear it. | ||
477 | */ | ||
478 | *clear_aspm = 1; | ||
479 | } | ||
480 | } else { | ||
481 | decode_osc_control(root, "OS requested", requested); | ||
482 | decode_osc_control(root, "platform willing to grant", control); | ||
483 | dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", | ||
484 | acpi_format_exception(status)); | ||
485 | |||
486 | /* | ||
487 | * We want to disable ASPM here, but aspm_disabled | ||
488 | * needs to remain in its state from boot so that we | ||
489 | * properly handle PCIe 1.1 devices. So we set this | ||
490 | * flag here, to defer the action until after the ACPI | ||
491 | * root scan. | ||
492 | */ | ||
493 | *no_aspm = 1; | ||
494 | } | ||
495 | } | ||
496 | |||
372 | static int acpi_pci_root_add(struct acpi_device *device, | 497 | static int acpi_pci_root_add(struct acpi_device *device, |
373 | const struct acpi_device_id *not_used) | 498 | const struct acpi_device_id *not_used) |
374 | { | 499 | { |
@@ -376,9 +501,8 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
376 | acpi_status status; | 501 | acpi_status status; |
377 | int result; | 502 | int result; |
378 | struct acpi_pci_root *root; | 503 | struct acpi_pci_root *root; |
379 | u32 flags, base_flags; | ||
380 | acpi_handle handle = device->handle; | 504 | acpi_handle handle = device->handle; |
381 | bool no_aspm = false, clear_aspm = false; | 505 | int no_aspm = 0, clear_aspm = 0; |
382 | 506 | ||
383 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 507 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
384 | if (!root) | 508 | if (!root) |
@@ -431,81 +555,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
431 | 555 | ||
432 | root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle); | 556 | root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle); |
433 | 557 | ||
434 | /* | 558 | negotiate_os_control(root, &no_aspm, &clear_aspm); |
435 | * All supported architectures that use ACPI have support for | ||
436 | * PCI domains, so we indicate this in _OSC support capabilities. | ||
437 | */ | ||
438 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | ||
439 | acpi_pci_osc_support(root, flags); | ||
440 | |||
441 | if (pci_ext_cfg_avail()) | ||
442 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | ||
443 | if (pcie_aspm_support_enabled()) { | ||
444 | flags |= OSC_ACTIVE_STATE_PWR_SUPPORT | | ||
445 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT; | ||
446 | } | ||
447 | if (pci_msi_enabled()) | ||
448 | flags |= OSC_MSI_SUPPORT; | ||
449 | if (flags != base_flags) { | ||
450 | status = acpi_pci_osc_support(root, flags); | ||
451 | if (ACPI_FAILURE(status)) { | ||
452 | dev_info(&device->dev, "ACPI _OSC support " | ||
453 | "notification failed, disabling PCIe ASPM\n"); | ||
454 | no_aspm = true; | ||
455 | flags = base_flags; | ||
456 | } | ||
457 | } | ||
458 | |||
459 | if (!pcie_ports_disabled | ||
460 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | ||
461 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | ||
462 | | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | ||
463 | | OSC_PCI_EXPRESS_PME_CONTROL; | ||
464 | |||
465 | if (pci_aer_available()) { | ||
466 | if (aer_acpi_firmware_first()) | ||
467 | dev_dbg(&device->dev, | ||
468 | "PCIe errors handled by BIOS.\n"); | ||
469 | else | ||
470 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; | ||
471 | } | ||
472 | |||
473 | dev_info(&device->dev, | ||
474 | "Requesting ACPI _OSC control (0x%02x)\n", flags); | ||
475 | |||
476 | status = acpi_pci_osc_control_set(handle, &flags, | ||
477 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | ||
478 | if (ACPI_SUCCESS(status)) { | ||
479 | dev_info(&device->dev, | ||
480 | "ACPI _OSC control (0x%02x) granted\n", flags); | ||
481 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
482 | /* | ||
483 | * We have ASPM control, but the FADT indicates | ||
484 | * that it's unsupported. Clear it. | ||
485 | */ | ||
486 | clear_aspm = true; | ||
487 | } | ||
488 | } else { | ||
489 | dev_info(&device->dev, | ||
490 | "ACPI _OSC request failed (%s), " | ||
491 | "returned control mask: 0x%02x\n", | ||
492 | acpi_format_exception(status), flags); | ||
493 | dev_info(&device->dev, | ||
494 | "ACPI _OSC control for PCIe not granted, disabling ASPM\n"); | ||
495 | /* | ||
496 | * We want to disable ASPM here, but aspm_disabled | ||
497 | * needs to remain in its state from boot so that we | ||
498 | * properly handle PCIe 1.1 devices. So we set this | ||
499 | * flag here, to defer the action until after the ACPI | ||
500 | * root scan. | ||
501 | */ | ||
502 | no_aspm = true; | ||
503 | } | ||
504 | } else { | ||
505 | dev_info(&device->dev, | ||
506 | "Unable to request _OSC control " | ||
507 | "(_OSC support mask: 0x%02x)\n", flags); | ||
508 | } | ||
509 | 559 | ||
510 | /* | 560 | /* |
511 | * TBD: Need PCI interface for enumeration/configuration of roots. | 561 | * TBD: Need PCI interface for enumeration/configuration of roots. |
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index 3d9504811126..efa24d9a3361 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig | |||
@@ -15,6 +15,12 @@ config PCI_EXYNOS | |||
15 | select PCIEPORTBUS | 15 | select PCIEPORTBUS |
16 | select PCIE_DW | 16 | select PCIE_DW |
17 | 17 | ||
18 | config PCI_IMX6 | ||
19 | bool "Freescale i.MX6 PCIe controller" | ||
20 | depends on SOC_IMX6Q | ||
21 | select PCIEPORTBUS | ||
22 | select PCIE_DW | ||
23 | |||
18 | config PCI_TEGRA | 24 | config PCI_TEGRA |
19 | bool "NVIDIA Tegra PCIe controller" | 25 | bool "NVIDIA Tegra PCIe controller" |
20 | depends on ARCH_TEGRA | 26 | depends on ARCH_TEGRA |
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile index c9a997b2690d..287d6a053dda 100644 --- a/drivers/pci/host/Makefile +++ b/drivers/pci/host/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o | 1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o |
2 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o | 2 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o |
3 | obj-$(CONFIG_PCI_IMX6) += pci-imx6.o | ||
3 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o | 4 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o |
4 | obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o | 5 | obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o |
diff --git a/drivers/pci/host/pci-exynos.c b/drivers/pci/host/pci-exynos.c index 94e096bb2d0a..ee692c2c3d73 100644 --- a/drivers/pci/host/pci-exynos.c +++ b/drivers/pci/host/pci-exynos.c | |||
@@ -48,6 +48,7 @@ struct exynos_pcie { | |||
48 | #define PCIE_IRQ_SPECIAL 0x008 | 48 | #define PCIE_IRQ_SPECIAL 0x008 |
49 | #define PCIE_IRQ_EN_PULSE 0x00c | 49 | #define PCIE_IRQ_EN_PULSE 0x00c |
50 | #define PCIE_IRQ_EN_LEVEL 0x010 | 50 | #define PCIE_IRQ_EN_LEVEL 0x010 |
51 | #define IRQ_MSI_ENABLE (0x1 << 2) | ||
51 | #define PCIE_IRQ_EN_SPECIAL 0x014 | 52 | #define PCIE_IRQ_EN_SPECIAL 0x014 |
52 | #define PCIE_PWR_RESET 0x018 | 53 | #define PCIE_PWR_RESET 0x018 |
53 | #define PCIE_CORE_RESET 0x01c | 54 | #define PCIE_CORE_RESET 0x01c |
@@ -77,18 +78,28 @@ struct exynos_pcie { | |||
77 | #define PCIE_PHY_PLL_BIAS 0x00c | 78 | #define PCIE_PHY_PLL_BIAS 0x00c |
78 | #define PCIE_PHY_DCC_FEEDBACK 0x014 | 79 | #define PCIE_PHY_DCC_FEEDBACK 0x014 |
79 | #define PCIE_PHY_PLL_DIV_1 0x05c | 80 | #define PCIE_PHY_PLL_DIV_1 0x05c |
81 | #define PCIE_PHY_COMMON_POWER 0x064 | ||
82 | #define PCIE_PHY_COMMON_PD_CMN (0x1 << 3) | ||
80 | #define PCIE_PHY_TRSV0_EMP_LVL 0x084 | 83 | #define PCIE_PHY_TRSV0_EMP_LVL 0x084 |
81 | #define PCIE_PHY_TRSV0_DRV_LVL 0x088 | 84 | #define PCIE_PHY_TRSV0_DRV_LVL 0x088 |
82 | #define PCIE_PHY_TRSV0_RXCDR 0x0ac | 85 | #define PCIE_PHY_TRSV0_RXCDR 0x0ac |
86 | #define PCIE_PHY_TRSV0_POWER 0x0c4 | ||
87 | #define PCIE_PHY_TRSV0_PD_TSV (0x1 << 7) | ||
83 | #define PCIE_PHY_TRSV0_LVCC 0x0dc | 88 | #define PCIE_PHY_TRSV0_LVCC 0x0dc |
84 | #define PCIE_PHY_TRSV1_EMP_LVL 0x144 | 89 | #define PCIE_PHY_TRSV1_EMP_LVL 0x144 |
85 | #define PCIE_PHY_TRSV1_RXCDR 0x16c | 90 | #define PCIE_PHY_TRSV1_RXCDR 0x16c |
91 | #define PCIE_PHY_TRSV1_POWER 0x184 | ||
92 | #define PCIE_PHY_TRSV1_PD_TSV (0x1 << 7) | ||
86 | #define PCIE_PHY_TRSV1_LVCC 0x19c | 93 | #define PCIE_PHY_TRSV1_LVCC 0x19c |
87 | #define PCIE_PHY_TRSV2_EMP_LVL 0x204 | 94 | #define PCIE_PHY_TRSV2_EMP_LVL 0x204 |
88 | #define PCIE_PHY_TRSV2_RXCDR 0x22c | 95 | #define PCIE_PHY_TRSV2_RXCDR 0x22c |
96 | #define PCIE_PHY_TRSV2_POWER 0x244 | ||
97 | #define PCIE_PHY_TRSV2_PD_TSV (0x1 << 7) | ||
89 | #define PCIE_PHY_TRSV2_LVCC 0x25c | 98 | #define PCIE_PHY_TRSV2_LVCC 0x25c |
90 | #define PCIE_PHY_TRSV3_EMP_LVL 0x2c4 | 99 | #define PCIE_PHY_TRSV3_EMP_LVL 0x2c4 |
91 | #define PCIE_PHY_TRSV3_RXCDR 0x2ec | 100 | #define PCIE_PHY_TRSV3_RXCDR 0x2ec |
101 | #define PCIE_PHY_TRSV3_POWER 0x304 | ||
102 | #define PCIE_PHY_TRSV3_PD_TSV (0x1 << 7) | ||
92 | #define PCIE_PHY_TRSV3_LVCC 0x31c | 103 | #define PCIE_PHY_TRSV3_LVCC 0x31c |
93 | 104 | ||
94 | static inline void exynos_elb_writel(struct exynos_pcie *pcie, u32 val, u32 reg) | 105 | static inline void exynos_elb_writel(struct exynos_pcie *pcie, u32 val, u32 reg) |
@@ -202,6 +213,58 @@ static void exynos_pcie_deassert_phy_reset(struct pcie_port *pp) | |||
202 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_TRSV_RESET); | 213 | exynos_blk_writel(exynos_pcie, 0, PCIE_PHY_TRSV_RESET); |
203 | } | 214 | } |
204 | 215 | ||
216 | static void exynos_pcie_power_on_phy(struct pcie_port *pp) | ||
217 | { | ||
218 | u32 val; | ||
219 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
220 | |||
221 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); | ||
222 | val &= ~PCIE_PHY_COMMON_PD_CMN; | ||
223 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_COMMON_POWER); | ||
224 | |||
225 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV0_POWER); | ||
226 | val &= ~PCIE_PHY_TRSV0_PD_TSV; | ||
227 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV0_POWER); | ||
228 | |||
229 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV1_POWER); | ||
230 | val &= ~PCIE_PHY_TRSV1_PD_TSV; | ||
231 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV1_POWER); | ||
232 | |||
233 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV2_POWER); | ||
234 | val &= ~PCIE_PHY_TRSV2_PD_TSV; | ||
235 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV2_POWER); | ||
236 | |||
237 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV3_POWER); | ||
238 | val &= ~PCIE_PHY_TRSV3_PD_TSV; | ||
239 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); | ||
240 | } | ||
241 | |||
242 | static void exynos_pcie_power_off_phy(struct pcie_port *pp) | ||
243 | { | ||
244 | u32 val; | ||
245 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
246 | |||
247 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_COMMON_POWER); | ||
248 | val |= PCIE_PHY_COMMON_PD_CMN; | ||
249 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_COMMON_POWER); | ||
250 | |||
251 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV0_POWER); | ||
252 | val |= PCIE_PHY_TRSV0_PD_TSV; | ||
253 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV0_POWER); | ||
254 | |||
255 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV1_POWER); | ||
256 | val |= PCIE_PHY_TRSV1_PD_TSV; | ||
257 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV1_POWER); | ||
258 | |||
259 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV2_POWER); | ||
260 | val |= PCIE_PHY_TRSV2_PD_TSV; | ||
261 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV2_POWER); | ||
262 | |||
263 | val = exynos_phy_readl(exynos_pcie, PCIE_PHY_TRSV3_POWER); | ||
264 | val |= PCIE_PHY_TRSV3_PD_TSV; | ||
265 | exynos_phy_writel(exynos_pcie, val, PCIE_PHY_TRSV3_POWER); | ||
266 | } | ||
267 | |||
205 | static void exynos_pcie_init_phy(struct pcie_port *pp) | 268 | static void exynos_pcie_init_phy(struct pcie_port *pp) |
206 | { | 269 | { |
207 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | 270 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); |
@@ -270,6 +333,9 @@ static int exynos_pcie_establish_link(struct pcie_port *pp) | |||
270 | /* de-assert phy reset */ | 333 | /* de-assert phy reset */ |
271 | exynos_pcie_deassert_phy_reset(pp); | 334 | exynos_pcie_deassert_phy_reset(pp); |
272 | 335 | ||
336 | /* power on phy */ | ||
337 | exynos_pcie_power_on_phy(pp); | ||
338 | |||
273 | /* initialize phy */ | 339 | /* initialize phy */ |
274 | exynos_pcie_init_phy(pp); | 340 | exynos_pcie_init_phy(pp); |
275 | 341 | ||
@@ -302,6 +368,9 @@ static int exynos_pcie_establish_link(struct pcie_port *pp) | |||
302 | PCIE_PHY_PLL_LOCKED); | 368 | PCIE_PHY_PLL_LOCKED); |
303 | dev_info(pp->dev, "PLL Locked: 0x%x\n", val); | 369 | dev_info(pp->dev, "PLL Locked: 0x%x\n", val); |
304 | } | 370 | } |
371 | /* power off phy */ | ||
372 | exynos_pcie_power_off_phy(pp); | ||
373 | |||
305 | dev_err(pp->dev, "PCIe Link Fail\n"); | 374 | dev_err(pp->dev, "PCIe Link Fail\n"); |
306 | return -EINVAL; | 375 | return -EINVAL; |
307 | } | 376 | } |
@@ -342,9 +411,36 @@ static irqreturn_t exynos_pcie_irq_handler(int irq, void *arg) | |||
342 | return IRQ_HANDLED; | 411 | return IRQ_HANDLED; |
343 | } | 412 | } |
344 | 413 | ||
414 | static irqreturn_t exynos_pcie_msi_irq_handler(int irq, void *arg) | ||
415 | { | ||
416 | struct pcie_port *pp = arg; | ||
417 | |||
418 | dw_handle_msi_irq(pp); | ||
419 | |||
420 | return IRQ_HANDLED; | ||
421 | } | ||
422 | |||
423 | static void exynos_pcie_msi_init(struct pcie_port *pp) | ||
424 | { | ||
425 | u32 val; | ||
426 | struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp); | ||
427 | |||
428 | dw_pcie_msi_init(pp); | ||
429 | |||
430 | /* enable MSI interrupt */ | ||
431 | val = exynos_elb_readl(exynos_pcie, PCIE_IRQ_EN_LEVEL); | ||
432 | val |= IRQ_MSI_ENABLE; | ||
433 | exynos_elb_writel(exynos_pcie, val, PCIE_IRQ_EN_LEVEL); | ||
434 | return; | ||
435 | } | ||
436 | |||
345 | static void exynos_pcie_enable_interrupts(struct pcie_port *pp) | 437 | static void exynos_pcie_enable_interrupts(struct pcie_port *pp) |
346 | { | 438 | { |
347 | exynos_pcie_enable_irq_pulse(pp); | 439 | exynos_pcie_enable_irq_pulse(pp); |
440 | |||
441 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
442 | exynos_pcie_msi_init(pp); | ||
443 | |||
348 | return; | 444 | return; |
349 | } | 445 | } |
350 | 446 | ||
@@ -430,6 +526,22 @@ static int add_pcie_port(struct pcie_port *pp, struct platform_device *pdev) | |||
430 | return ret; | 526 | return ret; |
431 | } | 527 | } |
432 | 528 | ||
529 | if (IS_ENABLED(CONFIG_PCI_MSI)) { | ||
530 | pp->msi_irq = platform_get_irq(pdev, 0); | ||
531 | if (!pp->msi_irq) { | ||
532 | dev_err(&pdev->dev, "failed to get msi irq\n"); | ||
533 | return -ENODEV; | ||
534 | } | ||
535 | |||
536 | ret = devm_request_irq(&pdev->dev, pp->msi_irq, | ||
537 | exynos_pcie_msi_irq_handler, | ||
538 | IRQF_SHARED, "exynos-pcie", pp); | ||
539 | if (ret) { | ||
540 | dev_err(&pdev->dev, "failed to request msi irq\n"); | ||
541 | return ret; | ||
542 | } | ||
543 | } | ||
544 | |||
433 | pp->root_bus_nr = -1; | 545 | pp->root_bus_nr = -1; |
434 | pp->ops = &exynos_pcie_host_ops; | 546 | pp->ops = &exynos_pcie_host_ops; |
435 | 547 | ||
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c new file mode 100644 index 000000000000..5afa9226a080 --- /dev/null +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -0,0 +1,575 @@ | |||
1 | /* | ||
2 | * PCIe host controller driver for Freescale i.MX6 SoCs | ||
3 | * | ||
4 | * Copyright (C) 2013 Kosagi | ||
5 | * http://www.kosagi.com | ||
6 | * | ||
7 | * Author: Sean Cross <xobs@kosagi.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/clk.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/mfd/syscon.h> | ||
19 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/of_gpio.h> | ||
22 | #include <linux/pci.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/regmap.h> | ||
25 | #include <linux/resource.h> | ||
26 | #include <linux/signal.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | #include "pcie-designware.h" | ||
30 | |||
31 | #define to_imx6_pcie(x) container_of(x, struct imx6_pcie, pp) | ||
32 | |||
33 | struct imx6_pcie { | ||
34 | int reset_gpio; | ||
35 | int power_on_gpio; | ||
36 | int wake_up_gpio; | ||
37 | int disable_gpio; | ||
38 | struct clk *lvds_gate; | ||
39 | struct clk *sata_ref_100m; | ||
40 | struct clk *pcie_ref_125m; | ||
41 | struct clk *pcie_axi; | ||
42 | struct pcie_port pp; | ||
43 | struct regmap *iomuxc_gpr; | ||
44 | void __iomem *mem_base; | ||
45 | }; | ||
46 | |||
47 | /* PCIe Port Logic registers (memory-mapped) */ | ||
48 | #define PL_OFFSET 0x700 | ||
49 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) | ||
50 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) | ||
51 | |||
52 | #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) | ||
53 | #define PCIE_PHY_CTRL_DATA_LOC 0 | ||
54 | #define PCIE_PHY_CTRL_CAP_ADR_LOC 16 | ||
55 | #define PCIE_PHY_CTRL_CAP_DAT_LOC 17 | ||
56 | #define PCIE_PHY_CTRL_WR_LOC 18 | ||
57 | #define PCIE_PHY_CTRL_RD_LOC 19 | ||
58 | |||
59 | #define PCIE_PHY_STAT (PL_OFFSET + 0x110) | ||
60 | #define PCIE_PHY_STAT_ACK_LOC 16 | ||
61 | |||
62 | /* PHY registers (not memory-mapped) */ | ||
63 | #define PCIE_PHY_RX_ASIC_OUT 0x100D | ||
64 | |||
65 | #define PHY_RX_OVRD_IN_LO 0x1005 | ||
66 | #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) | ||
67 | #define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3) | ||
68 | |||
69 | static int pcie_phy_poll_ack(void __iomem *dbi_base, int exp_val) | ||
70 | { | ||
71 | u32 val; | ||
72 | u32 max_iterations = 10; | ||
73 | u32 wait_counter = 0; | ||
74 | |||
75 | do { | ||
76 | val = readl(dbi_base + PCIE_PHY_STAT); | ||
77 | val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1; | ||
78 | wait_counter++; | ||
79 | |||
80 | if (val == exp_val) | ||
81 | return 0; | ||
82 | |||
83 | udelay(1); | ||
84 | } while (wait_counter < max_iterations); | ||
85 | |||
86 | return -ETIMEDOUT; | ||
87 | } | ||
88 | |||
89 | static int pcie_phy_wait_ack(void __iomem *dbi_base, int addr) | ||
90 | { | ||
91 | u32 val; | ||
92 | int ret; | ||
93 | |||
94 | val = addr << PCIE_PHY_CTRL_DATA_LOC; | ||
95 | writel(val, dbi_base + PCIE_PHY_CTRL); | ||
96 | |||
97 | val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC); | ||
98 | writel(val, dbi_base + PCIE_PHY_CTRL); | ||
99 | |||
100 | ret = pcie_phy_poll_ack(dbi_base, 1); | ||
101 | if (ret) | ||
102 | return ret; | ||
103 | |||
104 | val = addr << PCIE_PHY_CTRL_DATA_LOC; | ||
105 | writel(val, dbi_base + PCIE_PHY_CTRL); | ||
106 | |||
107 | ret = pcie_phy_poll_ack(dbi_base, 0); | ||
108 | if (ret) | ||
109 | return ret; | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ | ||
115 | static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data) | ||
116 | { | ||
117 | u32 val, phy_ctl; | ||
118 | int ret; | ||
119 | |||
120 | ret = pcie_phy_wait_ack(dbi_base, addr); | ||
121 | if (ret) | ||
122 | return ret; | ||
123 | |||
124 | /* assert Read signal */ | ||
125 | phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC; | ||
126 | writel(phy_ctl, dbi_base + PCIE_PHY_CTRL); | ||
127 | |||
128 | ret = pcie_phy_poll_ack(dbi_base, 1); | ||
129 | if (ret) | ||
130 | return ret; | ||
131 | |||
132 | val = readl(dbi_base + PCIE_PHY_STAT); | ||
133 | *data = val & 0xffff; | ||
134 | |||
135 | /* deassert Read signal */ | ||
136 | writel(0x00, dbi_base + PCIE_PHY_CTRL); | ||
137 | |||
138 | ret = pcie_phy_poll_ack(dbi_base, 0); | ||
139 | if (ret) | ||
140 | return ret; | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | static int pcie_phy_write(void __iomem *dbi_base, int addr, int data) | ||
146 | { | ||
147 | u32 var; | ||
148 | int ret; | ||
149 | |||
150 | /* write addr */ | ||
151 | /* cap addr */ | ||
152 | ret = pcie_phy_wait_ack(dbi_base, addr); | ||
153 | if (ret) | ||
154 | return ret; | ||
155 | |||
156 | var = data << PCIE_PHY_CTRL_DATA_LOC; | ||
157 | writel(var, dbi_base + PCIE_PHY_CTRL); | ||
158 | |||
159 | /* capture data */ | ||
160 | var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC); | ||
161 | writel(var, dbi_base + PCIE_PHY_CTRL); | ||
162 | |||
163 | ret = pcie_phy_poll_ack(dbi_base, 1); | ||
164 | if (ret) | ||
165 | return ret; | ||
166 | |||
167 | /* deassert cap data */ | ||
168 | var = data << PCIE_PHY_CTRL_DATA_LOC; | ||
169 | writel(var, dbi_base + PCIE_PHY_CTRL); | ||
170 | |||
171 | /* wait for ack de-assertion */ | ||
172 | ret = pcie_phy_poll_ack(dbi_base, 0); | ||
173 | if (ret) | ||
174 | return ret; | ||
175 | |||
176 | /* assert wr signal */ | ||
177 | var = 0x1 << PCIE_PHY_CTRL_WR_LOC; | ||
178 | writel(var, dbi_base + PCIE_PHY_CTRL); | ||
179 | |||
180 | /* wait for ack */ | ||
181 | ret = pcie_phy_poll_ack(dbi_base, 1); | ||
182 | if (ret) | ||
183 | return ret; | ||
184 | |||
185 | /* deassert wr signal */ | ||
186 | var = data << PCIE_PHY_CTRL_DATA_LOC; | ||
187 | writel(var, dbi_base + PCIE_PHY_CTRL); | ||
188 | |||
189 | /* wait for ack de-assertion */ | ||
190 | ret = pcie_phy_poll_ack(dbi_base, 0); | ||
191 | if (ret) | ||
192 | return ret; | ||
193 | |||
194 | writel(0x0, dbi_base + PCIE_PHY_CTRL); | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | /* Added for PCI abort handling */ | ||
200 | static int imx6q_pcie_abort_handler(unsigned long addr, | ||
201 | unsigned int fsr, struct pt_regs *regs) | ||
202 | { | ||
203 | /* | ||
204 | * If it was an imprecise abort, then we need to correct the | ||
205 | * return address to be _after_ the instruction. | ||
206 | */ | ||
207 | if (fsr & (1 << 10)) | ||
208 | regs->ARM_pc += 4; | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) | ||
213 | { | ||
214 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | ||
215 | |||
216 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | ||
217 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); | ||
218 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
219 | IMX6Q_GPR12_PCIE_CTL_2, 1 << 10); | ||
220 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | ||
221 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); | ||
222 | |||
223 | gpio_set_value(imx6_pcie->reset_gpio, 0); | ||
224 | msleep(100); | ||
225 | gpio_set_value(imx6_pcie->reset_gpio, 1); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) | ||
231 | { | ||
232 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | ||
233 | int ret; | ||
234 | |||
235 | if (gpio_is_valid(imx6_pcie->power_on_gpio)) | ||
236 | gpio_set_value(imx6_pcie->power_on_gpio, 1); | ||
237 | |||
238 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | ||
239 | IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); | ||
240 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | ||
241 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); | ||
242 | |||
243 | ret = clk_prepare_enable(imx6_pcie->sata_ref_100m); | ||
244 | if (ret) { | ||
245 | dev_err(pp->dev, "unable to enable sata_ref_100m\n"); | ||
246 | goto err_sata_ref; | ||
247 | } | ||
248 | |||
249 | ret = clk_prepare_enable(imx6_pcie->pcie_ref_125m); | ||
250 | if (ret) { | ||
251 | dev_err(pp->dev, "unable to enable pcie_ref_125m\n"); | ||
252 | goto err_pcie_ref; | ||
253 | } | ||
254 | |||
255 | ret = clk_prepare_enable(imx6_pcie->lvds_gate); | ||
256 | if (ret) { | ||
257 | dev_err(pp->dev, "unable to enable lvds_gate\n"); | ||
258 | goto err_lvds_gate; | ||
259 | } | ||
260 | |||
261 | ret = clk_prepare_enable(imx6_pcie->pcie_axi); | ||
262 | if (ret) { | ||
263 | dev_err(pp->dev, "unable to enable pcie_axi\n"); | ||
264 | goto err_pcie_axi; | ||
265 | } | ||
266 | |||
267 | /* allow the clocks to stabilize */ | ||
268 | usleep_range(200, 500); | ||
269 | |||
270 | return 0; | ||
271 | |||
272 | err_pcie_axi: | ||
273 | clk_disable_unprepare(imx6_pcie->lvds_gate); | ||
274 | err_lvds_gate: | ||
275 | clk_disable_unprepare(imx6_pcie->pcie_ref_125m); | ||
276 | err_pcie_ref: | ||
277 | clk_disable_unprepare(imx6_pcie->sata_ref_100m); | ||
278 | err_sata_ref: | ||
279 | return ret; | ||
280 | |||
281 | } | ||
282 | |||
283 | static void imx6_pcie_init_phy(struct pcie_port *pp) | ||
284 | { | ||
285 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | ||
286 | |||
287 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
288 | IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); | ||
289 | |||
290 | /* configure constant input signal to the pcie ctrl and phy */ | ||
291 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
292 | IMX6Q_GPR12_DEVICE_TYPE, PCI_EXP_TYPE_ROOT_PORT << 12); | ||
293 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
294 | IMX6Q_GPR12_LOS_LEVEL, 9 << 4); | ||
295 | |||
296 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, | ||
297 | IMX6Q_GPR8_TX_DEEMPH_GEN1, 0 << 0); | ||
298 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, | ||
299 | IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, 0 << 6); | ||
300 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, | ||
301 | IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, 20 << 12); | ||
302 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, | ||
303 | IMX6Q_GPR8_TX_SWING_FULL, 127 << 18); | ||
304 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, | ||
305 | IMX6Q_GPR8_TX_SWING_LOW, 127 << 25); | ||
306 | } | ||
307 | |||
308 | static void imx6_pcie_host_init(struct pcie_port *pp) | ||
309 | { | ||
310 | int count = 0; | ||
311 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | ||
312 | |||
313 | imx6_pcie_assert_core_reset(pp); | ||
314 | |||
315 | imx6_pcie_init_phy(pp); | ||
316 | |||
317 | imx6_pcie_deassert_core_reset(pp); | ||
318 | |||
319 | dw_pcie_setup_rc(pp); | ||
320 | |||
321 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
322 | IMX6Q_GPR12_PCIE_CTL_2, 1 << 10); | ||
323 | |||
324 | while (!dw_pcie_link_up(pp)) { | ||
325 | usleep_range(100, 1000); | ||
326 | count++; | ||
327 | if (count >= 10) { | ||
328 | dev_err(pp->dev, "phy link never came up\n"); | ||
329 | dev_dbg(pp->dev, | ||
330 | "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", | ||
331 | readl(pp->dbi_base + PCIE_PHY_DEBUG_R0), | ||
332 | readl(pp->dbi_base + PCIE_PHY_DEBUG_R1)); | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | |||
337 | return; | ||
338 | } | ||
339 | |||
340 | static int imx6_pcie_link_up(struct pcie_port *pp) | ||
341 | { | ||
342 | u32 rc, ltssm, rx_valid, temp; | ||
343 | |||
344 | /* link is debug bit 36, debug register 1 starts at bit 32 */ | ||
345 | rc = readl(pp->dbi_base + PCIE_PHY_DEBUG_R1) & (0x1 << (36 - 32)); | ||
346 | if (rc) | ||
347 | return -EAGAIN; | ||
348 | |||
349 | /* | ||
350 | * From L0, initiate MAC entry to gen2 if EP/RC supports gen2. | ||
351 | * Wait 2ms (LTSSM timeout is 24ms, PHY lock is ~5us in gen2). | ||
352 | * If (MAC/LTSSM.state == Recovery.RcvrLock) | ||
353 | * && (PHY/rx_valid==0) then pulse PHY/rx_reset. Transition | ||
354 | * to gen2 is stuck | ||
355 | */ | ||
356 | pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid); | ||
357 | ltssm = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0) & 0x3F; | ||
358 | |||
359 | if (rx_valid & 0x01) | ||
360 | return 0; | ||
361 | |||
362 | if (ltssm != 0x0d) | ||
363 | return 0; | ||
364 | |||
365 | dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n"); | ||
366 | |||
367 | pcie_phy_read(pp->dbi_base, | ||
368 | PHY_RX_OVRD_IN_LO, &temp); | ||
369 | temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | ||
370 | | PHY_RX_OVRD_IN_LO_RX_PLL_EN); | ||
371 | pcie_phy_write(pp->dbi_base, | ||
372 | PHY_RX_OVRD_IN_LO, temp); | ||
373 | |||
374 | usleep_range(2000, 3000); | ||
375 | |||
376 | pcie_phy_read(pp->dbi_base, | ||
377 | PHY_RX_OVRD_IN_LO, &temp); | ||
378 | temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | ||
379 | | PHY_RX_OVRD_IN_LO_RX_PLL_EN); | ||
380 | pcie_phy_write(pp->dbi_base, | ||
381 | PHY_RX_OVRD_IN_LO, temp); | ||
382 | |||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | static struct pcie_host_ops imx6_pcie_host_ops = { | ||
387 | .link_up = imx6_pcie_link_up, | ||
388 | .host_init = imx6_pcie_host_init, | ||
389 | }; | ||
390 | |||
391 | static int imx6_add_pcie_port(struct pcie_port *pp, | ||
392 | struct platform_device *pdev) | ||
393 | { | ||
394 | int ret; | ||
395 | |||
396 | pp->irq = platform_get_irq(pdev, 0); | ||
397 | if (!pp->irq) { | ||
398 | dev_err(&pdev->dev, "failed to get irq\n"); | ||
399 | return -ENODEV; | ||
400 | } | ||
401 | |||
402 | pp->root_bus_nr = -1; | ||
403 | pp->ops = &imx6_pcie_host_ops; | ||
404 | |||
405 | spin_lock_init(&pp->conf_lock); | ||
406 | ret = dw_pcie_host_init(pp); | ||
407 | if (ret) { | ||
408 | dev_err(&pdev->dev, "failed to initialize host\n"); | ||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | static int __init imx6_pcie_probe(struct platform_device *pdev) | ||
416 | { | ||
417 | struct imx6_pcie *imx6_pcie; | ||
418 | struct pcie_port *pp; | ||
419 | struct device_node *np = pdev->dev.of_node; | ||
420 | struct resource *dbi_base; | ||
421 | int ret; | ||
422 | |||
423 | imx6_pcie = devm_kzalloc(&pdev->dev, sizeof(*imx6_pcie), GFP_KERNEL); | ||
424 | if (!imx6_pcie) | ||
425 | return -ENOMEM; | ||
426 | |||
427 | pp = &imx6_pcie->pp; | ||
428 | pp->dev = &pdev->dev; | ||
429 | |||
430 | /* Added for PCI abort handling */ | ||
431 | hook_fault_code(16 + 6, imx6q_pcie_abort_handler, SIGBUS, 0, | ||
432 | "imprecise external abort"); | ||
433 | |||
434 | dbi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
435 | if (!dbi_base) { | ||
436 | dev_err(&pdev->dev, "dbi_base memory resource not found\n"); | ||
437 | return -ENODEV; | ||
438 | } | ||
439 | |||
440 | pp->dbi_base = devm_ioremap_resource(&pdev->dev, dbi_base); | ||
441 | if (IS_ERR(pp->dbi_base)) { | ||
442 | dev_err(&pdev->dev, "unable to remap dbi_base\n"); | ||
443 | ret = PTR_ERR(pp->dbi_base); | ||
444 | goto err; | ||
445 | } | ||
446 | |||
447 | /* Fetch GPIOs */ | ||
448 | imx6_pcie->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0); | ||
449 | if (!gpio_is_valid(imx6_pcie->reset_gpio)) { | ||
450 | dev_err(&pdev->dev, "no reset-gpio defined\n"); | ||
451 | ret = -ENODEV; | ||
452 | } | ||
453 | ret = devm_gpio_request_one(&pdev->dev, | ||
454 | imx6_pcie->reset_gpio, | ||
455 | GPIOF_OUT_INIT_LOW, | ||
456 | "PCIe reset"); | ||
457 | if (ret) { | ||
458 | dev_err(&pdev->dev, "unable to get reset gpio\n"); | ||
459 | goto err; | ||
460 | } | ||
461 | |||
462 | imx6_pcie->power_on_gpio = of_get_named_gpio(np, "power-on-gpio", 0); | ||
463 | if (gpio_is_valid(imx6_pcie->power_on_gpio)) { | ||
464 | ret = devm_gpio_request_one(&pdev->dev, | ||
465 | imx6_pcie->power_on_gpio, | ||
466 | GPIOF_OUT_INIT_LOW, | ||
467 | "PCIe power enable"); | ||
468 | if (ret) { | ||
469 | dev_err(&pdev->dev, "unable to get power-on gpio\n"); | ||
470 | goto err; | ||
471 | } | ||
472 | } | ||
473 | |||
474 | imx6_pcie->wake_up_gpio = of_get_named_gpio(np, "wake-up-gpio", 0); | ||
475 | if (gpio_is_valid(imx6_pcie->wake_up_gpio)) { | ||
476 | ret = devm_gpio_request_one(&pdev->dev, | ||
477 | imx6_pcie->wake_up_gpio, | ||
478 | GPIOF_IN, | ||
479 | "PCIe wake up"); | ||
480 | if (ret) { | ||
481 | dev_err(&pdev->dev, "unable to get wake-up gpio\n"); | ||
482 | goto err; | ||
483 | } | ||
484 | } | ||
485 | |||
486 | imx6_pcie->disable_gpio = of_get_named_gpio(np, "disable-gpio", 0); | ||
487 | if (gpio_is_valid(imx6_pcie->disable_gpio)) { | ||
488 | ret = devm_gpio_request_one(&pdev->dev, | ||
489 | imx6_pcie->disable_gpio, | ||
490 | GPIOF_OUT_INIT_HIGH, | ||
491 | "PCIe disable endpoint"); | ||
492 | if (ret) { | ||
493 | dev_err(&pdev->dev, "unable to get disable-ep gpio\n"); | ||
494 | goto err; | ||
495 | } | ||
496 | } | ||
497 | |||
498 | /* Fetch clocks */ | ||
499 | imx6_pcie->lvds_gate = devm_clk_get(&pdev->dev, "lvds_gate"); | ||
500 | if (IS_ERR(imx6_pcie->lvds_gate)) { | ||
501 | dev_err(&pdev->dev, | ||
502 | "lvds_gate clock select missing or invalid\n"); | ||
503 | ret = PTR_ERR(imx6_pcie->lvds_gate); | ||
504 | goto err; | ||
505 | } | ||
506 | |||
507 | imx6_pcie->sata_ref_100m = devm_clk_get(&pdev->dev, "sata_ref_100m"); | ||
508 | if (IS_ERR(imx6_pcie->sata_ref_100m)) { | ||
509 | dev_err(&pdev->dev, | ||
510 | "sata_ref_100m clock source missing or invalid\n"); | ||
511 | ret = PTR_ERR(imx6_pcie->sata_ref_100m); | ||
512 | goto err; | ||
513 | } | ||
514 | |||
515 | imx6_pcie->pcie_ref_125m = devm_clk_get(&pdev->dev, "pcie_ref_125m"); | ||
516 | if (IS_ERR(imx6_pcie->pcie_ref_125m)) { | ||
517 | dev_err(&pdev->dev, | ||
518 | "pcie_ref_125m clock source missing or invalid\n"); | ||
519 | ret = PTR_ERR(imx6_pcie->pcie_ref_125m); | ||
520 | goto err; | ||
521 | } | ||
522 | |||
523 | imx6_pcie->pcie_axi = devm_clk_get(&pdev->dev, "pcie_axi"); | ||
524 | if (IS_ERR(imx6_pcie->pcie_axi)) { | ||
525 | dev_err(&pdev->dev, | ||
526 | "pcie_axi clock source missing or invalid\n"); | ||
527 | ret = PTR_ERR(imx6_pcie->pcie_axi); | ||
528 | goto err; | ||
529 | } | ||
530 | |||
531 | /* Grab GPR config register range */ | ||
532 | imx6_pcie->iomuxc_gpr = | ||
533 | syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); | ||
534 | if (IS_ERR(imx6_pcie->iomuxc_gpr)) { | ||
535 | dev_err(&pdev->dev, "unable to find iomuxc registers\n"); | ||
536 | ret = PTR_ERR(imx6_pcie->iomuxc_gpr); | ||
537 | goto err; | ||
538 | } | ||
539 | |||
540 | ret = imx6_add_pcie_port(pp, pdev); | ||
541 | if (ret < 0) | ||
542 | goto err; | ||
543 | |||
544 | platform_set_drvdata(pdev, imx6_pcie); | ||
545 | return 0; | ||
546 | |||
547 | err: | ||
548 | return ret; | ||
549 | } | ||
550 | |||
551 | static const struct of_device_id imx6_pcie_of_match[] = { | ||
552 | { .compatible = "fsl,imx6q-pcie", }, | ||
553 | {}, | ||
554 | }; | ||
555 | MODULE_DEVICE_TABLE(of, imx6_pcie_of_match); | ||
556 | |||
557 | static struct platform_driver imx6_pcie_driver = { | ||
558 | .driver = { | ||
559 | .name = "imx6q-pcie", | ||
560 | .owner = THIS_MODULE, | ||
561 | .of_match_table = of_match_ptr(imx6_pcie_of_match), | ||
562 | }, | ||
563 | }; | ||
564 | |||
565 | /* Freescale PCIe driver does not allow module unload */ | ||
566 | |||
567 | static int __init imx6_pcie_init(void) | ||
568 | { | ||
569 | return platform_driver_probe(&imx6_pcie_driver, imx6_pcie_probe); | ||
570 | } | ||
571 | module_init(imx6_pcie_init); | ||
572 | |||
573 | MODULE_AUTHOR("Sean Cross <xobs@kosagi.com>"); | ||
574 | MODULE_DESCRIPTION("Freescale i.MX6 PCIe host controller driver"); | ||
575 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 2e9888a0635a..7c4f38dd42ba 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -408,7 +408,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie, | |||
408 | 408 | ||
409 | list_for_each_entry(bus, &pcie->busses, list) | 409 | list_for_each_entry(bus, &pcie->busses, list) |
410 | if (bus->nr == busnr) | 410 | if (bus->nr == busnr) |
411 | return bus->area->addr; | 411 | return (void __iomem *)bus->area->addr; |
412 | 412 | ||
413 | bus = tegra_pcie_bus_alloc(pcie, busnr); | 413 | bus = tegra_pcie_bus_alloc(pcie, busnr); |
414 | if (IS_ERR(bus)) | 414 | if (IS_ERR(bus)) |
@@ -416,7 +416,7 @@ static void __iomem *tegra_pcie_bus_map(struct tegra_pcie *pcie, | |||
416 | 416 | ||
417 | list_add_tail(&bus->list, &pcie->busses); | 417 | list_add_tail(&bus->list, &pcie->busses); |
418 | 418 | ||
419 | return bus->area->addr; | 419 | return (void __iomem *)bus->area->addr; |
420 | } | 420 | } |
421 | 421 | ||
422 | static void __iomem *tegra_pcie_conf_address(struct pci_bus *bus, | 422 | static void __iomem *tegra_pcie_conf_address(struct pci_bus *bus, |
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index c10e9ac9bbbc..896301788e9d 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -11,8 +11,11 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/irq.h> | ||
15 | #include <linux/irqdomain.h> | ||
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/msi.h> | ||
16 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
17 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
18 | #include <linux/pci_regs.h> | 21 | #include <linux/pci_regs.h> |
@@ -142,6 +145,204 @@ int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, | |||
142 | return ret; | 145 | return ret; |
143 | } | 146 | } |
144 | 147 | ||
148 | static struct irq_chip dw_msi_irq_chip = { | ||
149 | .name = "PCI-MSI", | ||
150 | .irq_enable = unmask_msi_irq, | ||
151 | .irq_disable = mask_msi_irq, | ||
152 | .irq_mask = mask_msi_irq, | ||
153 | .irq_unmask = unmask_msi_irq, | ||
154 | }; | ||
155 | |||
156 | /* MSI int handler */ | ||
157 | void dw_handle_msi_irq(struct pcie_port *pp) | ||
158 | { | ||
159 | unsigned long val; | ||
160 | int i, pos; | ||
161 | |||
162 | for (i = 0; i < MAX_MSI_CTRLS; i++) { | ||
163 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, 4, | ||
164 | (u32 *)&val); | ||
165 | if (val) { | ||
166 | pos = 0; | ||
167 | while ((pos = find_next_bit(&val, 32, pos)) != 32) { | ||
168 | generic_handle_irq(pp->msi_irq_start | ||
169 | + (i * 32) + pos); | ||
170 | pos++; | ||
171 | } | ||
172 | } | ||
173 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, 4, val); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | void dw_pcie_msi_init(struct pcie_port *pp) | ||
178 | { | ||
179 | pp->msi_data = __get_free_pages(GFP_KERNEL, 0); | ||
180 | |||
181 | /* program the msi_data */ | ||
182 | dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4, | ||
183 | virt_to_phys((void *)pp->msi_data)); | ||
184 | dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_HI, 4, 0); | ||
185 | } | ||
186 | |||
187 | static int find_valid_pos0(struct pcie_port *pp, int msgvec, int pos, int *pos0) | ||
188 | { | ||
189 | int flag = 1; | ||
190 | |||
191 | do { | ||
192 | pos = find_next_zero_bit(pp->msi_irq_in_use, | ||
193 | MAX_MSI_IRQS, pos); | ||
194 | /*if you have reached to the end then get out from here.*/ | ||
195 | if (pos == MAX_MSI_IRQS) | ||
196 | return -ENOSPC; | ||
197 | /* | ||
198 | * Check if this position is at correct offset.nvec is always a | ||
199 | * power of two. pos0 must be nvec bit alligned. | ||
200 | */ | ||
201 | if (pos % msgvec) | ||
202 | pos += msgvec - (pos % msgvec); | ||
203 | else | ||
204 | flag = 0; | ||
205 | } while (flag); | ||
206 | |||
207 | *pos0 = pos; | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) | ||
212 | { | ||
213 | int res, bit, irq, pos0, pos1, i; | ||
214 | u32 val; | ||
215 | struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata); | ||
216 | |||
217 | if (!pp) { | ||
218 | BUG(); | ||
219 | return -EINVAL; | ||
220 | } | ||
221 | |||
222 | pos0 = find_first_zero_bit(pp->msi_irq_in_use, | ||
223 | MAX_MSI_IRQS); | ||
224 | if (pos0 % no_irqs) { | ||
225 | if (find_valid_pos0(pp, no_irqs, pos0, &pos0)) | ||
226 | goto no_valid_irq; | ||
227 | } | ||
228 | if (no_irqs > 1) { | ||
229 | pos1 = find_next_bit(pp->msi_irq_in_use, | ||
230 | MAX_MSI_IRQS, pos0); | ||
231 | /* there must be nvec number of consecutive free bits */ | ||
232 | while ((pos1 - pos0) < no_irqs) { | ||
233 | if (find_valid_pos0(pp, no_irqs, pos1, &pos0)) | ||
234 | goto no_valid_irq; | ||
235 | pos1 = find_next_bit(pp->msi_irq_in_use, | ||
236 | MAX_MSI_IRQS, pos0); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | irq = (pp->msi_irq_start + pos0); | ||
241 | |||
242 | if ((irq + no_irqs) > (pp->msi_irq_start + MAX_MSI_IRQS-1)) | ||
243 | goto no_valid_irq; | ||
244 | |||
245 | i = 0; | ||
246 | while (i < no_irqs) { | ||
247 | set_bit(pos0 + i, pp->msi_irq_in_use); | ||
248 | irq_alloc_descs((irq + i), (irq + i), 1, 0); | ||
249 | irq_set_msi_desc(irq + i, desc); | ||
250 | /*Enable corresponding interrupt in MSI interrupt controller */ | ||
251 | res = ((pos0 + i) / 32) * 12; | ||
252 | bit = (pos0 + i) % 32; | ||
253 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
254 | val |= 1 << bit; | ||
255 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
256 | i++; | ||
257 | } | ||
258 | |||
259 | *pos = pos0; | ||
260 | return irq; | ||
261 | |||
262 | no_valid_irq: | ||
263 | *pos = pos0; | ||
264 | return -ENOSPC; | ||
265 | } | ||
266 | |||
267 | static void clear_irq(unsigned int irq) | ||
268 | { | ||
269 | int res, bit, val, pos; | ||
270 | struct irq_desc *desc; | ||
271 | struct msi_desc *msi; | ||
272 | struct pcie_port *pp; | ||
273 | |||
274 | /* get the port structure */ | ||
275 | desc = irq_to_desc(irq); | ||
276 | msi = irq_desc_get_msi_desc(desc); | ||
277 | pp = sys_to_pcie(msi->dev->bus->sysdata); | ||
278 | if (!pp) { | ||
279 | BUG(); | ||
280 | return; | ||
281 | } | ||
282 | |||
283 | pos = irq - pp->msi_irq_start; | ||
284 | |||
285 | irq_free_desc(irq); | ||
286 | |||
287 | clear_bit(pos, pp->msi_irq_in_use); | ||
288 | |||
289 | /* Disable corresponding interrupt on MSI interrupt controller */ | ||
290 | res = (pos / 32) * 12; | ||
291 | bit = pos % 32; | ||
292 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
293 | val &= ~(1 << bit); | ||
294 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
295 | } | ||
296 | |||
297 | static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, | ||
298 | struct msi_desc *desc) | ||
299 | { | ||
300 | int irq, pos, msgvec; | ||
301 | u16 msg_ctr; | ||
302 | struct msi_msg msg; | ||
303 | struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata); | ||
304 | |||
305 | if (!pp) { | ||
306 | BUG(); | ||
307 | return -EINVAL; | ||
308 | } | ||
309 | |||
310 | pci_read_config_word(pdev, desc->msi_attrib.pos+PCI_MSI_FLAGS, | ||
311 | &msg_ctr); | ||
312 | msgvec = (msg_ctr&PCI_MSI_FLAGS_QSIZE) >> 4; | ||
313 | if (msgvec == 0) | ||
314 | msgvec = (msg_ctr & PCI_MSI_FLAGS_QMASK) >> 1; | ||
315 | if (msgvec > 5) | ||
316 | msgvec = 0; | ||
317 | |||
318 | irq = assign_irq((1 << msgvec), desc, &pos); | ||
319 | if (irq < 0) | ||
320 | return irq; | ||
321 | |||
322 | msg_ctr &= ~PCI_MSI_FLAGS_QSIZE; | ||
323 | msg_ctr |= msgvec << 4; | ||
324 | pci_write_config_word(pdev, desc->msi_attrib.pos + PCI_MSI_FLAGS, | ||
325 | msg_ctr); | ||
326 | desc->msi_attrib.multiple = msgvec; | ||
327 | |||
328 | msg.address_lo = virt_to_phys((void *)pp->msi_data); | ||
329 | msg.address_hi = 0x0; | ||
330 | msg.data = pos; | ||
331 | write_msi_msg(irq, &msg); | ||
332 | |||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static void dw_msi_teardown_irq(struct msi_chip *chip, unsigned int irq) | ||
337 | { | ||
338 | clear_irq(irq); | ||
339 | } | ||
340 | |||
341 | static struct msi_chip dw_pcie_msi_chip = { | ||
342 | .setup_irq = dw_msi_setup_irq, | ||
343 | .teardown_irq = dw_msi_teardown_irq, | ||
344 | }; | ||
345 | |||
145 | int dw_pcie_link_up(struct pcie_port *pp) | 346 | int dw_pcie_link_up(struct pcie_port *pp) |
146 | { | 347 | { |
147 | if (pp->ops->link_up) | 348 | if (pp->ops->link_up) |
@@ -150,6 +351,20 @@ int dw_pcie_link_up(struct pcie_port *pp) | |||
150 | return 0; | 351 | return 0; |
151 | } | 352 | } |
152 | 353 | ||
354 | static int dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq, | ||
355 | irq_hw_number_t hwirq) | ||
356 | { | ||
357 | irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq); | ||
358 | irq_set_chip_data(irq, domain->host_data); | ||
359 | set_irq_flags(irq, IRQF_VALID); | ||
360 | |||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static const struct irq_domain_ops msi_domain_ops = { | ||
365 | .map = dw_pcie_msi_map, | ||
366 | }; | ||
367 | |||
153 | int __init dw_pcie_host_init(struct pcie_port *pp) | 368 | int __init dw_pcie_host_init(struct pcie_port *pp) |
154 | { | 369 | { |
155 | struct device_node *np = pp->dev->of_node; | 370 | struct device_node *np = pp->dev->of_node; |
@@ -157,6 +372,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
157 | struct of_pci_range_parser parser; | 372 | struct of_pci_range_parser parser; |
158 | u32 val; | 373 | u32 val; |
159 | 374 | ||
375 | struct irq_domain *irq_domain; | ||
376 | |||
160 | if (of_pci_range_parser_init(&parser, np)) { | 377 | if (of_pci_range_parser_init(&parser, np)) { |
161 | dev_err(pp->dev, "missing ranges property\n"); | 378 | dev_err(pp->dev, "missing ranges property\n"); |
162 | return -EINVAL; | 379 | return -EINVAL; |
@@ -223,6 +440,18 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
223 | return -EINVAL; | 440 | return -EINVAL; |
224 | } | 441 | } |
225 | 442 | ||
443 | if (IS_ENABLED(CONFIG_PCI_MSI)) { | ||
444 | irq_domain = irq_domain_add_linear(pp->dev->of_node, | ||
445 | MAX_MSI_IRQS, &msi_domain_ops, | ||
446 | &dw_pcie_msi_chip); | ||
447 | if (!irq_domain) { | ||
448 | dev_err(pp->dev, "irq domain init failed\n"); | ||
449 | return -ENXIO; | ||
450 | } | ||
451 | |||
452 | pp->msi_irq_start = irq_find_mapping(irq_domain, 0); | ||
453 | } | ||
454 | |||
226 | if (pp->ops->host_init) | 455 | if (pp->ops->host_init) |
227 | pp->ops->host_init(pp); | 456 | pp->ops->host_init(pp); |
228 | 457 | ||
@@ -485,10 +714,21 @@ int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
485 | return pp->irq; | 714 | return pp->irq; |
486 | } | 715 | } |
487 | 716 | ||
717 | static void dw_pcie_add_bus(struct pci_bus *bus) | ||
718 | { | ||
719 | if (IS_ENABLED(CONFIG_PCI_MSI)) { | ||
720 | struct pcie_port *pp = sys_to_pcie(bus->sysdata); | ||
721 | |||
722 | dw_pcie_msi_chip.dev = pp->dev; | ||
723 | bus->msi = &dw_pcie_msi_chip; | ||
724 | } | ||
725 | } | ||
726 | |||
488 | static struct hw_pci dw_pci = { | 727 | static struct hw_pci dw_pci = { |
489 | .setup = dw_pcie_setup, | 728 | .setup = dw_pcie_setup, |
490 | .scan = dw_pcie_scan_bus, | 729 | .scan = dw_pcie_scan_bus, |
491 | .map_irq = dw_pcie_map_irq, | 730 | .map_irq = dw_pcie_map_irq, |
731 | .add_bus = dw_pcie_add_bus, | ||
492 | }; | 732 | }; |
493 | 733 | ||
494 | void dw_pcie_setup_rc(struct pcie_port *pp) | 734 | void dw_pcie_setup_rc(struct pcie_port *pp) |
diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index 133820f1da97..faccbbf31907 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h | |||
@@ -20,6 +20,14 @@ struct pcie_port_info { | |||
20 | phys_addr_t mem_bus_addr; | 20 | phys_addr_t mem_bus_addr; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | /* | ||
24 | * Maximum number of MSI IRQs can be 256 per controller. But keep | ||
25 | * it 32 as of now. Probably we will never need more than 32. If needed, | ||
26 | * then increment it in multiple of 32. | ||
27 | */ | ||
28 | #define MAX_MSI_IRQS 32 | ||
29 | #define MAX_MSI_CTRLS (MAX_MSI_IRQS / 32) | ||
30 | |||
23 | struct pcie_port { | 31 | struct pcie_port { |
24 | struct device *dev; | 32 | struct device *dev; |
25 | u8 root_bus_nr; | 33 | u8 root_bus_nr; |
@@ -38,6 +46,10 @@ struct pcie_port { | |||
38 | int irq; | 46 | int irq; |
39 | u32 lanes; | 47 | u32 lanes; |
40 | struct pcie_host_ops *ops; | 48 | struct pcie_host_ops *ops; |
49 | int msi_irq; | ||
50 | int msi_irq_start; | ||
51 | unsigned long msi_data; | ||
52 | DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); | ||
41 | }; | 53 | }; |
42 | 54 | ||
43 | struct pcie_host_ops { | 55 | struct pcie_host_ops { |
@@ -57,6 +69,8 @@ int cfg_read(void __iomem *addr, int where, int size, u32 *val); | |||
57 | int cfg_write(void __iomem *addr, int where, int size, u32 val); | 69 | int cfg_write(void __iomem *addr, int where, int size, u32 val); |
58 | int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, u32 val); | 70 | int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, u32 val); |
59 | int dw_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, u32 *val); | 71 | int dw_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, u32 *val); |
72 | void dw_handle_msi_irq(struct pcie_port *pp); | ||
73 | void dw_pcie_msi_init(struct pcie_port *pp); | ||
60 | int dw_pcie_link_up(struct pcie_port *pp); | 74 | int dw_pcie_link_up(struct pcie_port *pp); |
61 | void dw_pcie_setup_rc(struct pcie_port *pp); | 75 | void dw_pcie_setup_rc(struct pcie_port *pp); |
62 | int dw_pcie_host_init(struct pcie_port *pp); | 76 | int dw_pcie_host_init(struct pcie_port *pp); |
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 2a47e82821da..f8140164ec0b 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
@@ -338,7 +338,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) | |||
338 | acpi_handle chandle, handle; | 338 | acpi_handle chandle, handle; |
339 | struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; | 339 | struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; |
340 | 340 | ||
341 | flags &= OSC_SHPC_NATIVE_HP_CONTROL; | 341 | flags &= OSC_PCI_SHPC_NATIVE_HP_CONTROL; |
342 | if (!flags) { | 342 | if (!flags) { |
343 | err("Invalid flags %u specified!\n", flags); | 343 | err("Invalid flags %u specified!\n", flags); |
344 | return -EINVAL; | 344 | return -EINVAL; |
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index e260f207a90e..d876e4b3c6a9 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -191,7 +191,7 @@ static inline const char *slot_name(struct slot *slot) | |||
191 | #include <linux/pci-acpi.h> | 191 | #include <linux/pci-acpi.h> |
192 | static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev) | 192 | static inline int get_hp_hw_control_from_firmware(struct pci_dev *dev) |
193 | { | 193 | { |
194 | u32 flags = OSC_SHPC_NATIVE_HP_CONTROL; | 194 | u32 flags = OSC_PCI_SHPC_NATIVE_HP_CONTROL; |
195 | return acpi_get_hp_hw_control_from_firmware(dev, flags); | 195 | return acpi_get_hp_hw_control_from_firmware(dev, flags); |
196 | } | 196 | } |
197 | #else | 197 | #else |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2372babe2fc5..5e14f5a51357 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -641,8 +641,7 @@ static void pci_set_bus_speed(struct pci_bus *bus) | |||
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | 643 | ||
644 | pos = pci_find_capability(bridge, PCI_CAP_ID_EXP); | 644 | if (pci_is_pcie(bridge)) { |
645 | if (pos) { | ||
646 | u32 linkcap; | 645 | u32 linkcap; |
647 | u16 linksta; | 646 | u16 linksta; |
648 | 647 | ||
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index f8ca7becacca..7591fa4e28bb 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -766,49 +766,20 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) | |||
766 | bfad->pcidev = pdev; | 766 | bfad->pcidev = pdev; |
767 | 767 | ||
768 | /* Adjust PCIe Maximum Read Request Size */ | 768 | /* Adjust PCIe Maximum Read Request Size */ |
769 | if (pcie_max_read_reqsz > 0) { | 769 | if (pci_is_pcie(pdev) && pcie_max_read_reqsz) { |
770 | int pcie_cap_reg; | 770 | if (pcie_max_read_reqsz >= 128 && |
771 | u16 pcie_dev_ctl; | 771 | pcie_max_read_reqsz <= 4096 && |
772 | u16 mask = 0xffff; | 772 | is_power_of_2(pcie_max_read_reqsz)) { |
773 | 773 | int max_rq = pcie_get_readrq(pdev); | |
774 | switch (pcie_max_read_reqsz) { | 774 | printk(KERN_WARNING "BFA[%s]: " |
775 | case 128: | ||
776 | mask = 0x0; | ||
777 | break; | ||
778 | case 256: | ||
779 | mask = 0x1000; | ||
780 | break; | ||
781 | case 512: | ||
782 | mask = 0x2000; | ||
783 | break; | ||
784 | case 1024: | ||
785 | mask = 0x3000; | ||
786 | break; | ||
787 | case 2048: | ||
788 | mask = 0x4000; | ||
789 | break; | ||
790 | case 4096: | ||
791 | mask = 0x5000; | ||
792 | break; | ||
793 | default: | ||
794 | break; | ||
795 | } | ||
796 | |||
797 | pcie_cap_reg = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
798 | if (mask != 0xffff && pcie_cap_reg) { | ||
799 | pcie_cap_reg += 0x08; | ||
800 | pci_read_config_word(pdev, pcie_cap_reg, &pcie_dev_ctl); | ||
801 | if ((pcie_dev_ctl & 0x7000) != mask) { | ||
802 | printk(KERN_WARNING "BFA[%s]: " | ||
803 | "pcie_max_read_request_size is %d, " | 775 | "pcie_max_read_request_size is %d, " |
804 | "reset to %d\n", bfad->pci_name, | 776 | "reset to %d\n", bfad->pci_name, max_rq, |
805 | (1 << ((pcie_dev_ctl & 0x7000) >> 12)) << 7, | ||
806 | pcie_max_read_reqsz); | 777 | pcie_max_read_reqsz); |
807 | 778 | pcie_set_readrq(pdev, pcie_max_read_reqsz); | |
808 | pcie_dev_ctl &= ~0x7000; | 779 | } else { |
809 | pci_write_config_word(pdev, pcie_cap_reg, | 780 | printk(KERN_WARNING "BFA[%s]: invalid " |
810 | pcie_dev_ctl | mask); | 781 | "pcie_max_read_request_size %d ignored\n", |
811 | } | 782 | bfad->pci_name, pcie_max_read_reqsz); |
812 | } | 783 | } |
813 | } | 784 | } |
814 | 785 | ||
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index 0eb35b9b3784..0eaec4748957 100644 --- a/drivers/scsi/csiostor/csio_hw.c +++ b/drivers/scsi/csiostor/csio_hw.c | |||
@@ -852,22 +852,6 @@ csio_hw_get_flash_params(struct csio_hw *hw) | |||
852 | return 0; | 852 | return 0; |
853 | } | 853 | } |
854 | 854 | ||
855 | static void | ||
856 | csio_set_pcie_completion_timeout(struct csio_hw *hw, u8 range) | ||
857 | { | ||
858 | uint16_t val; | ||
859 | int pcie_cap; | ||
860 | |||
861 | if (!csio_pci_capability(hw->pdev, PCI_CAP_ID_EXP, &pcie_cap)) { | ||
862 | pci_read_config_word(hw->pdev, | ||
863 | pcie_cap + PCI_EXP_DEVCTL2, &val); | ||
864 | val &= 0xfff0; | ||
865 | val |= range ; | ||
866 | pci_write_config_word(hw->pdev, | ||
867 | pcie_cap + PCI_EXP_DEVCTL2, val); | ||
868 | } | ||
869 | } | ||
870 | |||
871 | /*****************************************************************************/ | 855 | /*****************************************************************************/ |
872 | /* HW State machine assists */ | 856 | /* HW State machine assists */ |
873 | /*****************************************************************************/ | 857 | /*****************************************************************************/ |
@@ -2069,8 +2053,10 @@ csio_hw_configure(struct csio_hw *hw) | |||
2069 | goto out; | 2053 | goto out; |
2070 | } | 2054 | } |
2071 | 2055 | ||
2072 | /* Set pci completion timeout value to 4 seconds. */ | 2056 | /* Set PCIe completion timeout to 4 seconds */ |
2073 | csio_set_pcie_completion_timeout(hw, 0xd); | 2057 | if (pci_is_pcie(hw->pdev)) |
2058 | pcie_capability_clear_and_set_word(hw->pdev, PCI_EXP_DEVCTL2, | ||
2059 | PCI_EXP_DEVCTL2_COMP_TIMEOUT, 0xd); | ||
2074 | 2060 | ||
2075 | hw->chip_ops->chip_set_mem_win(hw, MEMWIN_CSIOSTOR); | 2061 | hw->chip_ops->chip_set_mem_win(hw, MEMWIN_CSIOSTOR); |
2076 | 2062 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 62ee7131b204..30d20e74e48a 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c | |||
@@ -507,7 +507,7 @@ qlafx00_pci_config(scsi_qla_host_t *vha) | |||
507 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); | 507 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); |
508 | 508 | ||
509 | /* PCIe -- adjust Maximum Read Request Size (2048). */ | 509 | /* PCIe -- adjust Maximum Read Request Size (2048). */ |
510 | if (pci_find_capability(ha->pdev, PCI_CAP_ID_EXP)) | 510 | if (pci_is_pcie(ha->pdev)) |
511 | pcie_set_readrq(ha->pdev, 2048); | 511 | pcie_set_readrq(ha->pdev, 2048); |
512 | 512 | ||
513 | ha->chip_revision = ha->pdev->revision; | 513 | ha->chip_revision = ha->pdev->revision; |
@@ -660,10 +660,8 @@ char * | |||
660 | qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str) | 660 | qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str) |
661 | { | 661 | { |
662 | struct qla_hw_data *ha = vha->hw; | 662 | struct qla_hw_data *ha = vha->hw; |
663 | int pcie_reg; | ||
664 | 663 | ||
665 | pcie_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP); | 664 | if (pci_is_pcie(ha->pdev)) { |
666 | if (pcie_reg) { | ||
667 | strcpy(str, "PCIe iSA"); | 665 | strcpy(str, "PCIe iSA"); |
668 | return str; | 666 | return str; |
669 | } | 667 | } |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index a5db4aeefa36..e2e52cf53224 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -294,58 +294,51 @@ void __init acpi_nvs_nosave_s3(void); | |||
294 | #endif /* CONFIG_PM_SLEEP */ | 294 | #endif /* CONFIG_PM_SLEEP */ |
295 | 295 | ||
296 | struct acpi_osc_context { | 296 | struct acpi_osc_context { |
297 | char *uuid_str; /* uuid string */ | 297 | char *uuid_str; /* UUID string */ |
298 | int rev; | 298 | int rev; |
299 | struct acpi_buffer cap; /* arg2/arg3 */ | 299 | struct acpi_buffer cap; /* list of DWORD capabilities */ |
300 | struct acpi_buffer ret; /* free by caller if success */ | 300 | struct acpi_buffer ret; /* free by caller if success */ |
301 | }; | 301 | }; |
302 | 302 | ||
303 | #define OSC_QUERY_TYPE 0 | ||
304 | #define OSC_SUPPORT_TYPE 1 | ||
305 | #define OSC_CONTROL_TYPE 2 | ||
306 | |||
307 | /* _OSC DW0 Definition */ | ||
308 | #define OSC_QUERY_ENABLE 1 | ||
309 | #define OSC_REQUEST_ERROR 2 | ||
310 | #define OSC_INVALID_UUID_ERROR 4 | ||
311 | #define OSC_INVALID_REVISION_ERROR 8 | ||
312 | #define OSC_CAPABILITIES_MASK_ERROR 16 | ||
313 | |||
314 | acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); | 303 | acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); |
315 | 304 | ||
316 | /* platform-wide _OSC bits */ | 305 | /* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */ |
317 | #define OSC_SB_PAD_SUPPORT 1 | 306 | #define OSC_QUERY_DWORD 0 /* DWORD 1 */ |
318 | #define OSC_SB_PPC_OST_SUPPORT 2 | 307 | #define OSC_SUPPORT_DWORD 1 /* DWORD 2 */ |
319 | #define OSC_SB_PR3_SUPPORT 4 | 308 | #define OSC_CONTROL_DWORD 2 /* DWORD 3 */ |
320 | #define OSC_SB_HOTPLUG_OST_SUPPORT 8 | 309 | |
321 | #define OSC_SB_APEI_SUPPORT 16 | 310 | /* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */ |
311 | #define OSC_QUERY_ENABLE 0x00000001 /* input */ | ||
312 | #define OSC_REQUEST_ERROR 0x00000002 /* return */ | ||
313 | #define OSC_INVALID_UUID_ERROR 0x00000004 /* return */ | ||
314 | #define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */ | ||
315 | #define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */ | ||
316 | |||
317 | /* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */ | ||
318 | #define OSC_SB_PAD_SUPPORT 0x00000001 | ||
319 | #define OSC_SB_PPC_OST_SUPPORT 0x00000002 | ||
320 | #define OSC_SB_PR3_SUPPORT 0x00000004 | ||
321 | #define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008 | ||
322 | #define OSC_SB_APEI_SUPPORT 0x00000010 | ||
323 | #define OSC_SB_CPC_SUPPORT 0x00000020 | ||
322 | 324 | ||
323 | extern bool osc_sb_apei_support_acked; | 325 | extern bool osc_sb_apei_support_acked; |
324 | 326 | ||
325 | /* PCI defined _OSC bits */ | 327 | /* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */ |
326 | /* _OSC DW1 Definition (OS Support Fields) */ | 328 | #define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001 |
327 | #define OSC_EXT_PCI_CONFIG_SUPPORT 1 | 329 | #define OSC_PCI_ASPM_SUPPORT 0x00000002 |
328 | #define OSC_ACTIVE_STATE_PWR_SUPPORT 2 | 330 | #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 |
329 | #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 | 331 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 |
330 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 | 332 | #define OSC_PCI_MSI_SUPPORT 0x00000010 |
331 | #define OSC_MSI_SUPPORT 16 | 333 | #define OSC_PCI_SUPPORT_MASKS 0x0000001f |
332 | #define OSC_PCI_SUPPORT_MASKS 0x1f | 334 | |
333 | 335 | /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ | |
334 | /* _OSC DW1 Definition (OS Control Fields) */ | 336 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 |
335 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 | 337 | #define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002 |
336 | #define OSC_SHPC_NATIVE_HP_CONTROL 2 | 338 | #define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004 |
337 | #define OSC_PCI_EXPRESS_PME_CONTROL 4 | 339 | #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008 |
338 | #define OSC_PCI_EXPRESS_AER_CONTROL 8 | 340 | #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 |
339 | #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 | 341 | #define OSC_PCI_CONTROL_MASKS 0x0000001f |
340 | |||
341 | #define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ | ||
342 | OSC_SHPC_NATIVE_HP_CONTROL | \ | ||
343 | OSC_PCI_EXPRESS_PME_CONTROL | \ | ||
344 | OSC_PCI_EXPRESS_AER_CONTROL | \ | ||
345 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) | ||
346 | |||
347 | #define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ | ||
348 | OSC_SHPC_NATIVE_HP_CONTROL) | ||
349 | 342 | ||
350 | extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, | 343 | extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, |
351 | u32 *mask, u32 req); | 344 | u32 *mask, u32 req); |
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h index b6bdcd66c07d..e00e9f362fd5 100644 --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | |||
@@ -241,6 +241,12 @@ | |||
241 | 241 | ||
242 | #define IMX6Q_GPR5_L2_CLK_STOP BIT(8) | 242 | #define IMX6Q_GPR5_L2_CLK_STOP BIT(8) |
243 | 243 | ||
244 | #define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25) | ||
245 | #define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18) | ||
246 | #define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12) | ||
247 | #define IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB (0x3f << 6) | ||
248 | #define IMX6Q_GPR8_TX_DEEMPH_GEN1 (0x3f << 0) | ||
249 | |||
244 | #define IMX6Q_GPR9_TZASC2_BYP BIT(1) | 250 | #define IMX6Q_GPR9_TZASC2_BYP BIT(1) |
245 | #define IMX6Q_GPR9_TZASC1_BYP BIT(0) | 251 | #define IMX6Q_GPR9_TZASC1_BYP BIT(0) |
246 | 252 | ||
@@ -273,7 +279,9 @@ | |||
273 | #define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26) | 279 | #define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26) |
274 | #define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25) | 280 | #define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25) |
275 | #define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24) | 281 | #define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24) |
282 | #define IMX6Q_GPR12_DEVICE_TYPE (0xf << 12) | ||
276 | #define IMX6Q_GPR12_PCIE_CTL_2 BIT(10) | 283 | #define IMX6Q_GPR12_PCIE_CTL_2 BIT(10) |
284 | #define IMX6Q_GPR12_LOS_LEVEL (0x1f << 4) | ||
277 | 285 | ||
278 | #define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30) | 286 | #define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30) |
279 | #define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) | 287 | #define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index f0509148111d..0890556f779e 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
@@ -557,7 +557,8 @@ | |||
557 | #define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */ | 557 | #define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */ |
558 | #define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */ | 558 | #define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */ |
559 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ | 559 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ |
560 | #define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ | 560 | #define PCI_EXP_DEVCTL2_COMP_TIMEOUT 0x000f /* Completion Timeout Value */ |
561 | #define PCI_EXP_DEVCTL2_ARI 0x0020 /* Alternative Routing-ID */ | ||
561 | #define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */ | 562 | #define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */ |
562 | #define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */ | 563 | #define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */ |
563 | #define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */ | 564 | #define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */ |