023-bcma-from-4.9.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. --- a/drivers/bcma/driver_chipcommon.c
  2. +++ b/drivers/bcma/driver_chipcommon.c
  3. @@ -36,12 +36,31 @@ u32 bcma_chipco_get_alp_clock(struct bcm
  4. }
  5. EXPORT_SYMBOL_GPL(bcma_chipco_get_alp_clock);
  6. +static bool bcma_core_cc_has_pmu_watchdog(struct bcma_drv_cc *cc)
  7. +{
  8. + struct bcma_bus *bus = cc->core->bus;
  9. +
  10. + if (cc->capabilities & BCMA_CC_CAP_PMU) {
  11. + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573) {
  12. + WARN(bus->chipinfo.rev <= 1, "No watchdog available\n");
  13. + /* 53573B0 and 53573B1 have bugged PMU watchdog. It can
  14. + * be enabled but timer can't be bumped. Use CC one
  15. + * instead.
  16. + */
  17. + return false;
  18. + }
  19. + return true;
  20. + } else {
  21. + return false;
  22. + }
  23. +}
  24. +
  25. static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
  26. {
  27. struct bcma_bus *bus = cc->core->bus;
  28. u32 nb;
  29. - if (cc->capabilities & BCMA_CC_CAP_PMU) {
  30. + if (bcma_core_cc_has_pmu_watchdog(cc)) {
  31. if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
  32. nb = 32;
  33. else if (cc->core->id.rev < 26)
  34. @@ -95,9 +114,16 @@ static int bcma_chipco_watchdog_ticks_pe
  35. int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)
  36. {
  37. + struct bcma_bus *bus = cc->core->bus;
  38. struct bcm47xx_wdt wdt = {};
  39. struct platform_device *pdev;
  40. + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573 &&
  41. + bus->chipinfo.rev <= 1) {
  42. + pr_debug("No watchdog on 53573A0 / 53573A1\n");
  43. + return 0;
  44. + }
  45. +
  46. wdt.driver_data = cc;
  47. wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
  48. wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
  49. @@ -105,7 +131,7 @@ int bcma_chipco_watchdog_register(struct
  50. bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
  51. pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
  52. - cc->core->bus->num, &wdt,
  53. + bus->num, &wdt,
  54. sizeof(wdt));
  55. if (IS_ERR(pdev))
  56. return PTR_ERR(pdev);
  57. @@ -217,7 +243,7 @@ u32 bcma_chipco_watchdog_timer_set(struc
  58. u32 maxt;
  59. maxt = bcma_chipco_watchdog_get_max_timer(cc);
  60. - if (cc->capabilities & BCMA_CC_CAP_PMU) {
  61. + if (bcma_core_cc_has_pmu_watchdog(cc)) {
  62. if (ticks == 1)
  63. ticks = 2;
  64. else if (ticks > maxt)
  65. --- a/include/linux/bcma/bcma.h
  66. +++ b/include/linux/bcma/bcma.h
  67. @@ -204,6 +204,9 @@ struct bcma_host_ops {
  68. #define BCMA_PKG_ID_BCM4709 0
  69. #define BCMA_CHIP_ID_BCM47094 53030
  70. #define BCMA_CHIP_ID_BCM53018 53018
  71. +#define BCMA_CHIP_ID_BCM53573 53573
  72. +#define BCMA_PKG_ID_BCM53573 0
  73. +#define BCMA_PKG_ID_BCM47189 1
  74. /* Board types (on PCI usually equals to the subsystem dev id) */
  75. /* BCM4313 */
  76. --- a/drivers/bcma/main.c
  77. +++ b/drivers/bcma/main.c
  78. @@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct p
  79. core->dev.of_node = node;
  80. core->irq = bcma_of_get_irq(parent, core, 0);
  81. +
  82. + of_dma_configure(&core->dev, node);
  83. }
  84. unsigned int bcma_core_irq(struct bcma_device *core, int num)
  85. @@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus *
  86. core->irq = bus->host_pci->irq;
  87. break;
  88. case BCMA_HOSTTYPE_SOC:
  89. - core->dev.dma_mask = &core->dev.coherent_dma_mask;
  90. - if (bus->host_pdev) {
  91. + if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
  92. core->dma_dev = &bus->host_pdev->dev;
  93. core->dev.parent = &bus->host_pdev->dev;
  94. bcma_of_fill_device(bus->host_pdev, core);
  95. } else {
  96. + core->dev.dma_mask = &core->dev.coherent_dma_mask;
  97. core->dma_dev = &core->dev;
  98. }
  99. break;