030-03-MIPS-BCM47XX-Make-bcma-init-NVRAM-instead-of-bcm47xx.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. From 7177efc5b030012c54c2e217c9d6decc0bcc1c53 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 13:30:23 +0100
  4. Subject: [PATCH 156/158] MIPS: BCM47XX: Make bcma init NVRAM instead of
  5. bcm47xx polling it
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. This drops ssb/bcma dependency and will allow us to make it a standalone
  10. driver.
  11. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12. Cc: linux-mips@linux-mips.org
  13. Cc: Hauke Mehrtens <hauke@hauke-m.de>
  14. Patchwork: https://patchwork.linux-mips.org/patch/8233/
  15. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  16. ---
  17. arch/mips/bcm47xx/nvram.c | 42 ++----------------------------------------
  18. drivers/bcma/driver_mips.c | 13 +++++++++++--
  19. 2 files changed, 13 insertions(+), 42 deletions(-)
  20. --- a/arch/mips/bcm47xx/nvram.c
  21. +++ b/arch/mips/bcm47xx/nvram.c
  22. @@ -121,48 +121,10 @@ int bcm47xx_nvram_init_from_mem(u32 base
  23. return err;
  24. }
  25. -#ifdef CONFIG_BCM47XX_BCMA
  26. -static int nvram_init_bcma(void)
  27. -{
  28. - struct bcma_drv_cc *cc = &bcm47xx_bus.bcma.bus.drv_cc;
  29. - u32 base;
  30. - u32 lim;
  31. -
  32. -#ifdef CONFIG_BCMA_NFLASH
  33. - if (cc->nflash.boot) {
  34. - base = BCMA_SOC_FLASH1;
  35. - lim = BCMA_SOC_FLASH1_SZ;
  36. - } else
  37. -#endif
  38. - if (cc->pflash.present) {
  39. - base = cc->pflash.window;
  40. - lim = cc->pflash.window_size;
  41. -#ifdef CONFIG_BCMA_SFLASH
  42. - } else if (cc->sflash.present) {
  43. - base = cc->sflash.window;
  44. - lim = cc->sflash.size;
  45. -#endif
  46. - } else {
  47. - pr_err("Couldn't find supported flash memory\n");
  48. - return -ENXIO;
  49. - }
  50. -
  51. - return bcm47xx_nvram_init_from_mem(base, lim);
  52. -}
  53. -#endif
  54. -
  55. static int nvram_init(void)
  56. {
  57. - switch (bcm47xx_bus_type) {
  58. -#ifdef CONFIG_BCM47XX_SSB
  59. - case BCM47XX_BUS_TYPE_SSB:
  60. - break;
  61. -#endif
  62. -#ifdef CONFIG_BCM47XX_BCMA
  63. - case BCM47XX_BUS_TYPE_BCMA:
  64. - return nvram_init_bcma();
  65. -#endif
  66. - }
  67. + /* TODO: Look for MTD "nvram" partition */
  68. +
  69. return -ENXIO;
  70. }
  71. --- a/drivers/bcma/driver_mips.c
  72. +++ b/drivers/bcma/driver_mips.c
  73. @@ -20,6 +20,9 @@
  74. #include <linux/serial_core.h>
  75. #include <linux/serial_reg.h>
  76. #include <linux/time.h>
  77. +#ifdef CONFIG_BCM47XX
  78. +#include <bcm47xx_nvram.h>
  79. +#endif
  80. enum bcma_boot_dev {
  81. BCMA_BOOT_DEV_UNK = 0,
  82. @@ -316,10 +319,16 @@ static void bcma_core_mips_flash_detect(
  83. switch (boot_dev) {
  84. case BCMA_BOOT_DEV_PARALLEL:
  85. case BCMA_BOOT_DEV_SERIAL:
  86. - /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */
  87. +#ifdef CONFIG_BCM47XX
  88. + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH2,
  89. + BCMA_SOC_FLASH2_SZ);
  90. +#endif
  91. break;
  92. case BCMA_BOOT_DEV_NAND:
  93. - /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */
  94. +#ifdef CONFIG_BCM47XX
  95. + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH1,
  96. + BCMA_SOC_FLASH1_SZ);
  97. +#endif
  98. break;
  99. default:
  100. break;