aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-09-19 13:50:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-09-19 13:50:30 -0400
commitb29f83aa8b7018cdbe687dd57b239160e25889f0 (patch)
tree224532c951bff92d37788511d39d9173bce24152
parent73030efad5bd280ae9c3b5073710786e6300906e (diff)
parent649ae75286793304130e747efa7d1a88daaf7e2e (diff)
Merge tag 'pci-v3.17-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas: "These fix: - Boot video device detection on dual-GPU Apple systems - Hotplug fiascos on VGA switcheroo with radeon & nouveau drivers - Boot hang on Freescale i.MX6 systems - Excessive "no hotplug settings from platform" warnings In particular: Enumeration - Don't default exclusively to first video device (Bruno Prémont) PCI device hotplug - Remove "no hotplug settings from platform" warning (Bjorn Helgaas) - Add pci_ignore_hotplug() for VGA switcheroo (Bjorn Helgaas) Freescale i.MX6 - Put LTSSM in "Detect" state before disabling (Lucas Stach)" * tag 'pci-v3.17-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: vgaarb: Drop obsolete #ifndef vgaarb: Don't default exclusively to first video device with mem+io ACPIPHP / radeon / nouveau: Remove acpi_bus_no_hotplug() PCI: Remove "no hotplug settings from platform" warning PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device PCI: imx6: Put LTSSM in "Detect" state before disabling it MAINTAINERS: Add Lucas Stach as co-maintainer for i.MX6 PCI driver
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/ia64/pci/fixup.c24
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--drivers/acpi/bus.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c16
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c1
-rw-r--r--drivers/gpu/vga/vgaarb.c46
-rw-r--r--drivers/pci/host/pci-imx6.c38
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c16
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c12
-rw-r--r--drivers/pci/hotplug/pcihp_slot.c6
-rw-r--r--include/acpi/acpi_bus.h4
-rw-r--r--include/linux/pci.h6
-rw-r--r--include/linux/vgaarb.h2
16 files changed, 110 insertions, 114 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 809ecd680d88..670b3dcce2de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6876,7 +6876,7 @@ F: arch/x86/kernel/quirks.c
6876 6876
6877PCI DRIVER FOR IMX6 6877PCI DRIVER FOR IMX6
6878M: Richard Zhu <r65037@freescale.com> 6878M: Richard Zhu <r65037@freescale.com>
6879M: Shawn Guo <shawn.guo@freescale.com> 6879M: Lucas Stach <l.stach@pengutronix.de>
6880L: linux-pci@vger.kernel.org 6880L: linux-pci@vger.kernel.org
6881L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6881L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
6882S: Maintained 6882S: Maintained
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index ec73b2cf912a..fc505d58f078 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -38,27 +38,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
38 return; 38 return;
39 /* Maybe, this machine supports legacy memory map. */ 39 /* Maybe, this machine supports legacy memory map. */
40 40
41 if (!vga_default_device()) {
42 resource_size_t start, end;
43 int i;
44
45 /* Does firmware framebuffer belong to us? */
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
48 continue;
49
50 start = pci_resource_start(pdev, i);
51 end = pci_resource_end(pdev, i);
52
53 if (!start || !end)
54 continue;
55
56 if (screen_info.lfb_base >= start &&
57 (screen_info.lfb_base + screen_info.lfb_size) < end)
58 vga_set_default_device(pdev);
59 }
60 }
61
62 /* Is VGA routed to us? */ 41 /* Is VGA routed to us? */
63 bus = pdev->bus; 42 bus = pdev->bus;
64 while (bus) { 43 while (bus) {
@@ -83,8 +62,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
83 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 pci_read_config_word(pdev, PCI_COMMAND, &config);
84 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
85 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
86 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
87 vga_set_default_device(pdev);
88 } 66 }
89 } 67 }
90} 68}
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c61ea57d1ba1..9a2b7101ae8a 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
350 /* Is VGA routed to us? */ 329 /* Is VGA routed to us? */
351 bus = pdev->bus; 330 bus = pdev->bus;
352 while (bus) { 331 while (bus) {
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
371 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 pci_read_config_word(pdev, PCI_COMMAND, &config);
372 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
373 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
374 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
375 vga_set_default_device(pdev);
376 } 354 }
377 } 355 }
378} 356}
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 8581f5b84f48..8b67bd0f6bb5 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle)
177} 177}
178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); 178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data);
179 179
180void acpi_bus_no_hotplug(acpi_handle handle)
181{
182 struct acpi_device *adev = NULL;
183
184 acpi_bus_get_device(handle, &adev);
185 if (adev)
186 adev->flags.no_hotplug = true;
187}
188EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug);
189
190static void acpi_print_osc_error(acpi_handle handle, 180static void acpi_print_osc_error(acpi_handle handle,
191 struct acpi_osc_context *context, char *error) 181 struct acpi_osc_context *context, char *error)
192{ 182{
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 279206997e5c..622424692b3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv {
46 bool dsm_detected; 46 bool dsm_detected;
47 bool optimus_detected; 47 bool optimus_detected;
48 acpi_handle dhandle; 48 acpi_handle dhandle;
49 acpi_handle other_handle;
50 acpi_handle rom_handle; 49 acpi_handle rom_handle;
51} nouveau_dsm_priv; 50} nouveau_dsm_priv;
52 51
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
222 if (!dhandle) 221 if (!dhandle)
223 return false; 222 return false;
224 223
225 if (!acpi_has_method(dhandle, "_DSM")) { 224 if (!acpi_has_method(dhandle, "_DSM"))
226 nouveau_dsm_priv.other_handle = dhandle;
227 return false; 225 return false;
228 } 226
229 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, 227 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
230 1 << NOUVEAU_DSM_POWER)) 228 1 << NOUVEAU_DSM_POWER))
231 retval |= NOUVEAU_DSM_HAS_MUX; 229 retval |= NOUVEAU_DSM_HAS_MUX;
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void)
301 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", 299 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
302 acpi_method_name); 300 acpi_method_name);
303 nouveau_dsm_priv.dsm_detected = true; 301 nouveau_dsm_priv.dsm_detected = true;
304 /*
305 * On some systems hotplug events are generated for the device
306 * being switched off when _DSM is executed. They cause ACPI
307 * hotplug to trigger and attempt to remove the device from
308 * the system, which causes it to break down. Prevent that from
309 * happening by setting the no_hotplug flag for the involved
310 * ACPI device objects.
311 */
312 acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle);
313 acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle);
314 ret = true; 302 ret = true;
315 } 303 }
316 304
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 250a5e88c751..9c3af96a7153 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -627,6 +627,7 @@ int nouveau_pmops_suspend(struct device *dev)
627 627
628 pci_save_state(pdev); 628 pci_save_state(pdev);
629 pci_disable_device(pdev); 629 pci_disable_device(pdev);
630 pci_ignore_hotplug(pdev);
630 pci_set_power_state(pdev, PCI_D3hot); 631 pci_set_power_state(pdev, PCI_D3hot);
631 return 0; 632 return 0;
632} 633}
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index a9fb0d016d38..8bc7d0bbd3c8 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv {
33 bool atpx_detected; 33 bool atpx_detected;
34 /* handle for device - and atpx */ 34 /* handle for device - and atpx */
35 acpi_handle dhandle; 35 acpi_handle dhandle;
36 acpi_handle other_handle;
37 struct radeon_atpx atpx; 36 struct radeon_atpx atpx;
38} radeon_atpx_priv; 37} radeon_atpx_priv;
39 38
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
453 return false; 452 return false;
454 453
455 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); 454 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
456 if (ACPI_FAILURE(status)) { 455 if (ACPI_FAILURE(status))
457 radeon_atpx_priv.other_handle = dhandle;
458 return false; 456 return false;
459 } 457
460 radeon_atpx_priv.dhandle = dhandle; 458 radeon_atpx_priv.dhandle = dhandle;
461 radeon_atpx_priv.atpx.handle = atpx_handle; 459 radeon_atpx_priv.atpx.handle = atpx_handle;
462 return true; 460 return true;
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void)
540 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", 538 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
541 acpi_method_name); 539 acpi_method_name);
542 radeon_atpx_priv.atpx_detected = true; 540 radeon_atpx_priv.atpx_detected = true;
543 /*
544 * On some systems hotplug events are generated for the device
545 * being switched off when ATPX is executed. They cause ACPI
546 * hotplug to trigger and attempt to remove the device from
547 * the system, which causes it to break down. Prevent that from
548 * happening by setting the no_hotplug flag for the involved
549 * ACPI device objects.
550 */
551 acpi_bus_no_hotplug(radeon_atpx_priv.dhandle);
552 acpi_bus_no_hotplug(radeon_atpx_priv.other_handle);
553 return true; 541 return true;
554 } 542 }
555 return false; 543 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 8df888908833..abbd87adfd75 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -440,6 +440,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
440 ret = radeon_suspend_kms(drm_dev, false, false); 440 ret = radeon_suspend_kms(drm_dev, false, false);
441 pci_save_state(pdev); 441 pci_save_state(pdev);
442 pci_disable_device(pdev); 442 pci_disable_device(pdev);
443 pci_ignore_hotplug(pdev);
443 pci_set_power_state(pdev, PCI_D3cold); 444 pci_set_power_state(pdev, PCI_D3cold);
444 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; 445 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
445 446
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index d2077f040f3e..77711623b973 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -41,6 +41,7 @@
41#include <linux/poll.h> 41#include <linux/poll.h>
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/screen_info.h>
44 45
45#include <linux/uaccess.h> 46#include <linux/uaccess.h>
46 47
@@ -112,10 +113,8 @@ both:
112 return 1; 113 return 1;
113} 114}
114 115
115#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
116/* this is only used a cookie - it should not be dereferenced */ 116/* this is only used a cookie - it should not be dereferenced */
117static struct pci_dev *vga_default; 117static struct pci_dev *vga_default;
118#endif
119 118
120static void vga_arb_device_card_gone(struct pci_dev *pdev); 119static void vga_arb_device_card_gone(struct pci_dev *pdev);
121 120
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev)
131} 130}
132 131
133/* Returns the default VGA device (vgacon's babe) */ 132/* Returns the default VGA device (vgacon's babe) */
134#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
135struct pci_dev *vga_default_device(void) 133struct pci_dev *vga_default_device(void)
136{ 134{
137 return vga_default; 135 return vga_default;
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev)
147 pci_dev_put(vga_default); 145 pci_dev_put(vga_default);
148 vga_default = pci_dev_get(pdev); 146 vga_default = pci_dev_get(pdev);
149} 147}
150#endif
151 148
152static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) 149static inline void vga_irq_set_state(struct vga_device *vgadev, bool state)
153{ 150{
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
583 /* Deal with VGA default device. Use first enabled one 580 /* Deal with VGA default device. Use first enabled one
584 * by default if arch doesn't have it's own hook 581 * by default if arch doesn't have it's own hook
585 */ 582 */
586#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
587 if (vga_default == NULL && 583 if (vga_default == NULL &&
588 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) 584 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {
585 pr_info("vgaarb: setting as boot device: PCI:%s\n",
586 pci_name(pdev));
589 vga_set_default_device(pdev); 587 vga_set_default_device(pdev);
590#endif 588 }
591 589
592 vga_arbiter_check_bridge_sharing(vgadev); 590 vga_arbiter_check_bridge_sharing(vgadev);
593 591
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev)
621 goto bail; 619 goto bail;
622 } 620 }
623 621
624#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
625 if (vga_default == pdev) 622 if (vga_default == pdev)
626 vga_set_default_device(NULL); 623 vga_set_default_device(NULL);
627#endif
628 624
629 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) 625 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
630 vga_decode_count--; 626 vga_decode_count--;
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void)
1320 pr_info("vgaarb: loaded\n"); 1316 pr_info("vgaarb: loaded\n");
1321 1317
1322 list_for_each_entry(vgadev, &vga_list, list) { 1318 list_for_each_entry(vgadev, &vga_list, list) {
1319#if defined(CONFIG_X86) || defined(CONFIG_IA64)
1320 /* Override I/O based detection done by vga_arbiter_add_pci_device()
1321 * as it may take the wrong device (e.g. on Apple system under EFI).
1322 *
1323 * Select the device owning the boot framebuffer if there is one.
1324 */
1325 resource_size_t start, end;
1326 int i;
1327
1328 /* Does firmware framebuffer belong to us? */
1329 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
1330 if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM))
1331 continue;
1332
1333 start = pci_resource_start(vgadev->pdev, i);
1334 end = pci_resource_end(vgadev->pdev, i);
1335
1336 if (!start || !end)
1337 continue;
1338
1339 if (screen_info.lfb_base < start ||
1340 (screen_info.lfb_base + screen_info.lfb_size) >= end)
1341 continue;
1342 if (!vga_default_device())
1343 pr_info("vgaarb: setting as boot device: PCI:%s\n",
1344 pci_name(vgadev->pdev));
1345 else if (vgadev->pdev != vga_default_device())
1346 pr_info("vgaarb: overriding boot device: PCI:%s\n",
1347 pci_name(vgadev->pdev));
1348 vga_set_default_device(vgadev->pdev);
1349 }
1350#endif
1323 if (vgadev->bridge_has_one_vga) 1351 if (vgadev->bridge_has_one_vga)
1324 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); 1352 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev));
1325 else 1353 else
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index a568efaa331c..35fc73a8d0b3 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -49,6 +49,9 @@ struct imx6_pcie {
49 49
50/* PCIe Port Logic registers (memory-mapped) */ 50/* PCIe Port Logic registers (memory-mapped) */
51#define PL_OFFSET 0x700 51#define PL_OFFSET 0x700
52#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
53#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
54#define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
52#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) 55#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
53#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) 56#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
54#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) 57#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr,
214static int imx6_pcie_assert_core_reset(struct pcie_port *pp) 217static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
215{ 218{
216 struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); 219 struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
220 u32 val, gpr1, gpr12;
221
222 /*
223 * If the bootloader already enabled the link we need some special
224 * handling to get the core back into a state where it is safe to
225 * touch it for configuration. As there is no dedicated reset signal
226 * wired up for MX6QDL, we need to manually force LTSSM into "detect"
227 * state before completely disabling LTSSM, which is a prerequisite
228 * for core configuration.
229 *
230 * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
231 * indication that the bootloader activated the link.
232 */
233 regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1);
234 regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12);
235
236 if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) &&
237 (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) {
238 val = readl(pp->dbi_base + PCIE_PL_PFLR);
239 val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
240 val |= PCIE_PL_PFLR_FORCE_LINK;
241 writel(val, pp->dbi_base + PCIE_PL_PFLR);
242
243 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
244 IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
245 }
217 246
218 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, 247 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
219 IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); 248 IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18);
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
589 return 0; 618 return 0;
590} 619}
591 620
621static void imx6_pcie_shutdown(struct platform_device *pdev)
622{
623 struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev);
624
625 /* bring down link, so bootloader gets clean state in case of reboot */
626 imx6_pcie_assert_core_reset(&imx6_pcie->pp);
627}
628
592static const struct of_device_id imx6_pcie_of_match[] = { 629static const struct of_device_id imx6_pcie_of_match[] = {
593 { .compatible = "fsl,imx6q-pcie", }, 630 { .compatible = "fsl,imx6q-pcie", },
594 {}, 631 {},
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = {
601 .owner = THIS_MODULE, 638 .owner = THIS_MODULE,
602 .of_match_table = imx6_pcie_of_match, 639 .of_match_table = imx6_pcie_of_match,
603 }, 640 },
641 .shutdown = imx6_pcie_shutdown,
604}; 642};
605 643
606/* Freescale PCIe driver does not allow module unload */ 644/* Freescale PCIe driver does not allow module unload */
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 70741c8c46a0..6cd5160fc057 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -560,19 +560,15 @@ static void disable_slot(struct acpiphp_slot *slot)
560 slot->flags &= (~SLOT_ENABLED); 560 slot->flags &= (~SLOT_ENABLED);
561} 561}
562 562
563static bool acpiphp_no_hotplug(struct acpi_device *adev)
564{
565 return adev && adev->flags.no_hotplug;
566}
567
568static bool slot_no_hotplug(struct acpiphp_slot *slot) 563static bool slot_no_hotplug(struct acpiphp_slot *slot)
569{ 564{
570 struct acpiphp_func *func; 565 struct pci_bus *bus = slot->bus;
566 struct pci_dev *dev;
571 567
572 list_for_each_entry(func, &slot->funcs, sibling) 568 list_for_each_entry(dev, &bus->devices, bus_list) {
573 if (acpiphp_no_hotplug(func_to_acpi_device(func))) 569 if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug)
574 return true; 570 return true;
575 571 }
576 return false; 572 return false;
577} 573}
578 574
@@ -645,7 +641,7 @@ static void trim_stale_devices(struct pci_dev *dev)
645 641
646 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); 642 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
647 alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) 643 alive = (ACPI_SUCCESS(status) && device_status_valid(sta))
648 || acpiphp_no_hotplug(adev); 644 || dev->ignore_hotplug;
649 } 645 }
650 if (!alive) 646 if (!alive)
651 alive = pci_device_is_present(dev); 647 alive = pci_device_is_present(dev);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 9da84b8b27d8..5e01ae39ec46 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -506,6 +506,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
506{ 506{
507 struct controller *ctrl = (struct controller *)dev_id; 507 struct controller *ctrl = (struct controller *)dev_id;
508 struct pci_dev *pdev = ctrl_dev(ctrl); 508 struct pci_dev *pdev = ctrl_dev(ctrl);
509 struct pci_bus *subordinate = pdev->subordinate;
510 struct pci_dev *dev;
509 struct slot *slot = ctrl->slot; 511 struct slot *slot = ctrl->slot;
510 u16 detected, intr_loc; 512 u16 detected, intr_loc;
511 513
@@ -539,6 +541,16 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
539 wake_up(&ctrl->queue); 541 wake_up(&ctrl->queue);
540 } 542 }
541 543
544 if (subordinate) {
545 list_for_each_entry(dev, &subordinate->devices, bus_list) {
546 if (dev->ignore_hotplug) {
547 ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n",
548 intr_loc, pci_name(dev));
549 return IRQ_HANDLED;
550 }
551 }
552 }
553
542 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) 554 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC))
543 return IRQ_HANDLED; 555 return IRQ_HANDLED;
544 556
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c
index e246a10a0d2c..3e36ec8d708a 100644
--- a/drivers/pci/hotplug/pcihp_slot.c
+++ b/drivers/pci/hotplug/pcihp_slot.c
@@ -46,7 +46,6 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp)
46 */ 46 */
47 if (pci_is_pcie(dev)) 47 if (pci_is_pcie(dev))
48 return; 48 return;
49 dev_info(&dev->dev, "using default PCI settings\n");
50 hpp = &pci_default_type0; 49 hpp = &pci_default_type0;
51 } 50 }
52 51
@@ -153,7 +152,6 @@ void pci_configure_slot(struct pci_dev *dev)
153{ 152{
154 struct pci_dev *cdev; 153 struct pci_dev *cdev;
155 struct hotplug_params hpp; 154 struct hotplug_params hpp;
156 int ret;
157 155
158 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || 156 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL ||
159 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && 157 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
@@ -163,9 +161,7 @@ void pci_configure_slot(struct pci_dev *dev)
163 pcie_bus_configure_settings(dev->bus); 161 pcie_bus_configure_settings(dev->bus);
164 162
165 memset(&hpp, 0, sizeof(hpp)); 163 memset(&hpp, 0, sizeof(hpp));
166 ret = pci_get_hp_params(dev, &hpp); 164 pci_get_hp_params(dev, &hpp);
167 if (ret)
168 dev_warn(&dev->dev, "no hotplug settings from platform\n");
169 165
170 program_hpp_type2(dev, hpp.t2); 166 program_hpp_type2(dev, hpp.t2);
171 program_hpp_type1(dev, hpp.t1); 167 program_hpp_type1(dev, hpp.t1);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c1c9de19edbe..d91e59b79f0d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -204,10 +204,9 @@ struct acpi_device_flags {
204 u32 match_driver:1; 204 u32 match_driver:1;
205 u32 initialized:1; 205 u32 initialized:1;
206 u32 visited:1; 206 u32 visited:1;
207 u32 no_hotplug:1;
208 u32 hotplug_notify:1; 207 u32 hotplug_notify:1;
209 u32 is_dock_station:1; 208 u32 is_dock_station:1;
210 u32 reserved:22; 209 u32 reserved:23;
211}; 210};
212 211
213/* File System */ 212/* File System */
@@ -411,7 +410,6 @@ void acpi_bus_private_data_handler(acpi_handle, void *);
411int acpi_bus_get_private_data(acpi_handle, void **); 410int acpi_bus_get_private_data(acpi_handle, void **);
412int acpi_bus_attach_private_data(acpi_handle, void *); 411int acpi_bus_attach_private_data(acpi_handle, void *);
413void acpi_bus_detach_private_data(acpi_handle); 412void acpi_bus_detach_private_data(acpi_handle);
414void acpi_bus_no_hotplug(acpi_handle handle);
415extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 413extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
416extern int register_acpi_notifier(struct notifier_block *); 414extern int register_acpi_notifier(struct notifier_block *);
417extern int unregister_acpi_notifier(struct notifier_block *); 415extern int unregister_acpi_notifier(struct notifier_block *);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 61978a460841..96453f9bc8ba 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -303,6 +303,7 @@ struct pci_dev {
303 D3cold, not set for devices 303 D3cold, not set for devices
304 powered on/off by the 304 powered on/off by the
305 corresponding bridge */ 305 corresponding bridge */
306 unsigned int ignore_hotplug:1; /* Ignore hotplug events */
306 unsigned int d3_delay; /* D3->D0 transition time in ms */ 307 unsigned int d3_delay; /* D3->D0 transition time in ms */
307 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 308 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
308 309
@@ -1021,6 +1022,11 @@ bool pci_dev_run_wake(struct pci_dev *dev);
1021bool pci_check_pme_status(struct pci_dev *dev); 1022bool pci_check_pme_status(struct pci_dev *dev);
1022void pci_pme_wakeup_bus(struct pci_bus *bus); 1023void pci_pme_wakeup_bus(struct pci_bus *bus);
1023 1024
1025static inline void pci_ignore_hotplug(struct pci_dev *dev)
1026{
1027 dev->ignore_hotplug = 1;
1028}
1029
1024static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1030static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1025 bool enable) 1031 bool enable)
1026{ 1032{
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..c37bd4d06739 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 * vga_get()... 182 * vga_get()...
183 */ 183 */
184 184
185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB 185#ifdef CONFIG_VGA_ARB
187extern struct pci_dev *vga_default_device(void); 186extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev); 187extern void vga_set_default_device(struct pci_dev *pdev);
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev);
190static inline struct pci_dev *vga_default_device(void) { return NULL; }; 189static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { }; 190static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif 191#endif
193#endif
194 192
195/** 193/**
196 * vga_conflicts 194 * vga_conflicts