033-03-MIPS-BCM47xx-Fetch-board-info-directly-in-callback-f.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. From d8cfb5037bfc875e6dc8e09e4caceb443c04ff6a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  3. Date: Mon, 26 Oct 2015 11:13:16 +0100
  4. Subject: [PATCH 3/3] MIPS: BCM47xx: Fetch board info directly in callback
  5. function
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. This drops another symbol dependency between setup.c and sprom.c which
  10. will allow us to make SPROM code a separated module (and share it with
  11. ARM).
  12. Patch tested on Linksys WRT300N V1.
  13. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14. Cc: Hauke Mehrtens <hauke@hauke-m.de>
  15. Cc: linux-mips@linux-mips.org
  16. Patchwork: https://patchwork.linux-mips.org/patch/11360/
  17. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  18. ---
  19. arch/mips/bcm47xx/setup.c | 19 ++++++++++++++++++-
  20. arch/mips/bcm47xx/sprom.c | 13 -------------
  21. arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 -----
  22. 3 files changed, 18 insertions(+), 19 deletions(-)
  23. --- a/arch/mips/bcm47xx/setup.c
  24. +++ b/arch/mips/bcm47xx/setup.c
  25. @@ -105,11 +105,28 @@ static int bcm47xx_get_invariants(struct
  26. struct ssb_init_invariants *iv)
  27. {
  28. char buf[20];
  29. + int len, err;
  30. /* Fill boardinfo structure */
  31. memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
  32. - bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
  33. + len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
  34. + if (len > 0) {
  35. + err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
  36. + if (err)
  37. + pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
  38. + buf);
  39. + }
  40. + if (!iv->boardinfo.vendor)
  41. + iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
  42. +
  43. + len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
  44. + if (len > 0) {
  45. + err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
  46. + if (err)
  47. + pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
  48. + buf);
  49. + }
  50. memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
  51. bcm47xx_fill_sprom(&iv->sprom, NULL, false);
  52. --- a/arch/mips/bcm47xx/sprom.c
  53. +++ b/arch/mips/bcm47xx/sprom.c
  54. @@ -599,19 +599,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom
  55. bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
  56. }
  57. -#ifdef CONFIG_BCM47XX_SSB
  58. -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
  59. - const char *prefix)
  60. -{
  61. - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
  62. - true);
  63. - if (!boardinfo->vendor)
  64. - boardinfo->vendor = SSB_BOARDVENDOR_BCM;
  65. -
  66. - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
  67. -}
  68. -#endif
  69. -
  70. #if defined(CONFIG_BCM47XX_SSB)
  71. static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
  72. {
  73. --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
  74. +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
  75. @@ -48,11 +48,6 @@ extern enum bcm47xx_bus_type bcm47xx_bus
  76. void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
  77. bool fallback);
  78. -#ifdef CONFIG_BCM47XX_SSB
  79. -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
  80. - const char *prefix);
  81. -#endif
  82. -
  83. void bcm47xx_set_system_type(u16 chip_id);
  84. #endif /* __ASM_BCM47XX_H */