1
0

020-ssb_update.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. --- a/drivers/ssb/pcihost_wrapper.c
  2. +++ b/drivers/ssb/pcihost_wrapper.c
  3. @@ -11,15 +11,17 @@
  4. * Licensed under the GNU/GPL. See COPYING for details.
  5. */
  6. +#include <linux/pm.h>
  7. #include <linux/pci.h>
  8. #include <linux/export.h>
  9. #include <linux/slab.h>
  10. #include <linux/ssb/ssb.h>
  11. -#ifdef CONFIG_PM
  12. -static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
  13. +#ifdef CONFIG_PM_SLEEP
  14. +static int ssb_pcihost_suspend(struct device *d)
  15. {
  16. + struct pci_dev *dev = to_pci_dev(d);
  17. struct ssb_bus *ssb = pci_get_drvdata(dev);
  18. int err;
  19. @@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pc
  20. return err;
  21. pci_save_state(dev);
  22. pci_disable_device(dev);
  23. - pci_set_power_state(dev, pci_choose_state(dev, state));
  24. +
  25. + /* if there is a wakeup enabled child device on ssb bus,
  26. + enable pci wakeup posibility. */
  27. + device_set_wakeup_enable(d, d->power.wakeup_path);
  28. +
  29. + pci_prepare_to_sleep(dev);
  30. return 0;
  31. }
  32. -static int ssb_pcihost_resume(struct pci_dev *dev)
  33. +static int ssb_pcihost_resume(struct device *d)
  34. {
  35. + struct pci_dev *dev = to_pci_dev(d);
  36. struct ssb_bus *ssb = pci_get_drvdata(dev);
  37. int err;
  38. - pci_set_power_state(dev, PCI_D0);
  39. + pci_back_from_sleep(dev);
  40. err = pci_enable_device(dev);
  41. if (err)
  42. return err;
  43. @@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci
  44. return 0;
  45. }
  46. -#else /* CONFIG_PM */
  47. -# define ssb_pcihost_suspend NULL
  48. -# define ssb_pcihost_resume NULL
  49. -#endif /* CONFIG_PM */
  50. +
  51. +static const struct dev_pm_ops ssb_pcihost_pm_ops = {
  52. + SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
  53. +};
  54. +
  55. +#endif /* CONFIG_PM_SLEEP */
  56. static int ssb_pcihost_probe(struct pci_dev *dev,
  57. const struct pci_device_id *id)
  58. @@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driv
  59. {
  60. driver->probe = ssb_pcihost_probe;
  61. driver->remove = ssb_pcihost_remove;
  62. - driver->suspend = ssb_pcihost_suspend;
  63. - driver->resume = ssb_pcihost_resume;
  64. +#ifdef CONFIG_PM_SLEEP
  65. + driver->driver.pm = &ssb_pcihost_pm_ops;
  66. +#endif
  67. return pci_register_driver(driver);
  68. }
  69. --- a/drivers/ssb/driver_pcicore.c
  70. +++ b/drivers/ssb/driver_pcicore.c
  71. @@ -357,6 +357,16 @@ static void ssb_pcicore_init_hostmode(st
  72. pcicore_write32(pc, SSB_PCICORE_SBTOPCI2,
  73. SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA);
  74. + /*
  75. + * Accessing PCI config without a proper delay after devices reset (not
  76. + * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704).
  77. + * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it
  78. + * completely. Flushing all writes was also tested but with no luck.
  79. + * The same problem was reported for WRT350N v1 (BCM4705), so we just
  80. + * sleep here unconditionally.
  81. + */
  82. + usleep_range(1000, 2000);
  83. +
  84. /* Enable PCI bridge BAR0 prefetch and burst */
  85. val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  86. ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2);
  87. --- a/drivers/ssb/main.c
  88. +++ b/drivers/ssb/main.c
  89. @@ -90,25 +90,6 @@ found:
  90. }
  91. #endif /* CONFIG_SSB_PCMCIAHOST */
  92. -#ifdef CONFIG_SSB_SDIOHOST
  93. -struct ssb_bus *ssb_sdio_func_to_bus(struct sdio_func *func)
  94. -{
  95. - struct ssb_bus *bus;
  96. -
  97. - ssb_buses_lock();
  98. - list_for_each_entry(bus, &buses, list) {
  99. - if (bus->bustype == SSB_BUSTYPE_SDIO &&
  100. - bus->host_sdio == func)
  101. - goto found;
  102. - }
  103. - bus = NULL;
  104. -found:
  105. - ssb_buses_unlock();
  106. -
  107. - return bus;
  108. -}
  109. -#endif /* CONFIG_SSB_SDIOHOST */
  110. -
  111. int ssb_for_each_bus_call(unsigned long data,
  112. int (*func)(struct ssb_bus *bus, unsigned long data))
  113. {
  114. @@ -1154,6 +1135,8 @@ static u32 ssb_tmslow_reject_bitmask(str
  115. case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */
  116. case SSB_IDLOW_SSBREV_27: /* same here */
  117. return SSB_TMSLOW_REJECT; /* this is a guess */
  118. + case SSB_IDLOW_SSBREV:
  119. + break;
  120. default:
  121. WARN(1, KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev);
  122. }