nvram.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
  2. index 35294b1..7465e8a 100644
  3. --- a/arch/mips/bcm47xx/Makefile
  4. +++ b/arch/mips/bcm47xx/Makefile
  5. @@ -3,4 +3,4 @@
  6. # under Linux.
  7. #
  8. -obj-y := gpio.o irq.o prom.o serial.o setup.o time.o wgt634u.o
  9. +obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
  10. diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
  11. index d442e11..01e1661 100644
  12. --- a/arch/mips/bcm47xx/setup.c
  13. +++ b/arch/mips/bcm47xx/setup.c
  14. @@ -33,6 +33,7 @@
  15. #include <asm/time.h>
  16. #include <bcm47xx.h>
  17. #include <asm/fw/cfe/cfe_api.h>
  18. +#include <asm/mach-bcm47xx/nvram.h>
  19. struct ssb_bus ssb_bcm47xx;
  20. EXPORT_SYMBOL(ssb_bcm47xx);
  21. @@ -77,6 +78,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
  22. struct ssb_init_invariants *iv)
  23. {
  24. char buf[100];
  25. + char *s;
  26. /* Fill boardinfo structure */
  27. memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
  28. @@ -92,18 +94,47 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
  29. memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
  30. iv->sprom.revision = 3;
  31. - if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
  32. + if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0) {
  33. str2eaddr(buf, iv->sprom.et0mac);
  34. - if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
  35. + } else {
  36. + if ((s = nvram_get("et0macaddr")))
  37. + str2eaddr(s, iv->sprom.et0mac);
  38. + }
  39. +
  40. + if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0) {
  41. str2eaddr(buf, iv->sprom.et1mac);
  42. - if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
  43. - iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
  44. - if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
  45. - iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
  46. - if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
  47. + } else {
  48. + if ((s = nvram_get("et1macaddr")))
  49. + str2eaddr(s, iv->sprom.et1mac);
  50. + }
  51. +
  52. + if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) {
  53. + iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0);
  54. + } else {
  55. + if ((s = nvram_get("et0phyaddr")))
  56. + iv->sprom.et0phyaddr = simple_strtoul(s, NULL, 0);
  57. + }
  58. +
  59. + if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) {
  60. + iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0);
  61. + } else {
  62. + if ((s = nvram_get("et1phyaddr")))
  63. + iv->sprom.et1phyaddr = simple_strtoul(s, NULL, 0);
  64. + }
  65. +
  66. + if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0) {
  67. iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
  68. - if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
  69. + } else {
  70. + if ((s = nvram_get("et0mdcport")))
  71. + iv->sprom.et0mdcport = simple_strtoul(s, NULL, 10);
  72. + }
  73. +
  74. + if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0) {
  75. iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
  76. + } else {
  77. + if ((s = nvram_get("et1mdcport")))
  78. + iv->sprom.et1mdcport = simple_strtoul(s, NULL, 10);
  79. + }
  80. return 0;
  81. }