030-05-MIPS-BCM47XX-Initialize-bcma-bus-later-with-mm-avail.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. From e5810fa0c1bed16fdfb408862a2e17e962ec5cf6 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  3. Date: Tue, 28 Oct 2014 14:40:38 +0100
  4. Subject: [PATCH 158/158] MIPS: BCM47XX: Initialize bcma bus later (with mm
  5. available)
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Initializaion with memory allocator available will be much simpler, this
  10. will allow cleanup in the bcma code.
  11. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12. Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
  13. Cc: linux-mips@linux-mips.org
  14. Patchwork: https://patchwork.linux-mips.org/patch/8234/
  15. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  16. ---
  17. arch/mips/bcm47xx/bcm47xx_private.h | 3 +++
  18. arch/mips/bcm47xx/irq.c | 8 ++++++++
  19. arch/mips/bcm47xx/setup.c | 33 +++++++++++++++++++++++++++------
  20. 3 files changed, 38 insertions(+), 6 deletions(-)
  21. --- a/arch/mips/bcm47xx/bcm47xx_private.h
  22. +++ b/arch/mips/bcm47xx/bcm47xx_private.h
  23. @@ -15,6 +15,9 @@ int __init bcm47xx_buttons_register(void
  24. /* leds.c */
  25. void __init bcm47xx_leds_register(void);
  26. +/* setup.c */
  27. +void __init bcm47xx_bus_setup(void);
  28. +
  29. /* workarounds.c */
  30. void __init bcm47xx_workarounds(void);
  31. --- a/arch/mips/bcm47xx/irq.c
  32. +++ b/arch/mips/bcm47xx/irq.c
  33. @@ -22,6 +22,8 @@
  34. * 675 Mass Ave, Cambridge, MA 02139, USA.
  35. */
  36. +#include "bcm47xx_private.h"
  37. +
  38. #include <linux/types.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/irq.h>
  41. @@ -65,6 +67,12 @@ DEFINE_HWx_IRQDISPATCH(7)
  42. void __init arch_init_irq(void)
  43. {
  44. + /*
  45. + * This is the first arch callback after mm_init (we can use kmalloc),
  46. + * so let's finish bus initialization now.
  47. + */
  48. + bcm47xx_bus_setup();
  49. +
  50. #ifdef CONFIG_BCM47XX_BCMA
  51. if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
  52. bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
  53. --- a/arch/mips/bcm47xx/setup.c
  54. +++ b/arch/mips/bcm47xx/setup.c
  55. @@ -156,15 +156,14 @@ static void __init bcm47xx_register_bcma
  56. err = bcma_host_soc_register(&bcm47xx_bus.bcma);
  57. if (err)
  58. panic("Failed to register BCMA bus (err %d)", err);
  59. -
  60. - err = bcma_host_soc_init(&bcm47xx_bus.bcma);
  61. - if (err)
  62. - panic("Failed to initialize BCMA bus (err %d)", err);
  63. -
  64. - bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
  65. }
  66. #endif
  67. +/*
  68. + * Memory setup is done in the early part of MIPS's arch_mem_init. It's supposed
  69. + * to detect memory and record it with add_memory_region.
  70. + * Any extra initializaion performed here must not use kmalloc or bootmem.
  71. + */
  72. void __init plat_mem_setup(void)
  73. {
  74. struct cpuinfo_mips *c = &current_cpu_data;
  75. @@ -193,6 +192,28 @@ void __init plat_mem_setup(void)
  76. _machine_restart = bcm47xx_machine_restart;
  77. _machine_halt = bcm47xx_machine_halt;
  78. pm_power_off = bcm47xx_machine_halt;
  79. +}
  80. +
  81. +/*
  82. + * This finishes bus initialization doing things that were not possible without
  83. + * kmalloc. Make sure to call it late enough (after mm_init).
  84. + */
  85. +void __init bcm47xx_bus_setup(void)
  86. +{
  87. +#ifdef CONFIG_BCM47XX_BCMA
  88. + if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
  89. + int err;
  90. +
  91. + err = bcma_host_soc_init(&bcm47xx_bus.bcma);
  92. + if (err)
  93. + panic("Failed to initialize BCMA bus (err %d)", err);
  94. +
  95. + bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo,
  96. + NULL);
  97. + }
  98. +#endif
  99. +
  100. + /* With bus initialized we can access NVRAM and detect the board */
  101. bcm47xx_board_detect();
  102. mips_set_machine_name(bcm47xx_board_get_name());
  103. }