208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. From 4e9c34a37bd3442b286ba55441bfe22c1ac5b65f Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sun, 9 Mar 2014 04:08:06 +0100
  4. Subject: [PATCH 41/44] MIPS: BCM63XX: pass a mac addresss allocator to board
  5. setup
  6. Pass a mac address allocator to board setup code to allow board
  7. implementations to work with third party bootloaders not using nvram
  8. for configuration storage.
  9. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  10. ---
  11. arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++-
  12. arch/mips/bcm63xx/boards/board_common.c | 16 ++++++++++------
  13. arch/mips/bcm63xx/boards/board_common.h | 3 ++-
  14. 3 files changed, 14 insertions(+), 8 deletions(-)
  15. --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
  16. +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
  17. @@ -742,7 +742,8 @@ void __init board_prom_init(void)
  18. if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
  19. continue;
  20. /* copy, board desc array is marked initdata */
  21. - board_early_setup(bcm963xx_boards[i]);
  22. + board_early_setup(bcm963xx_boards[i],
  23. + bcm63xx_nvram_get_mac_address);
  24. break;
  25. }
  26. --- a/arch/mips/bcm63xx/boards/board_common.c
  27. +++ b/arch/mips/bcm63xx/boards/board_common.c
  28. @@ -18,7 +18,6 @@
  29. #include <bcm63xx_dev_uart.h>
  30. #include <bcm63xx_regs.h>
  31. #include <bcm63xx_io.h>
  32. -#include <bcm63xx_nvram.h>
  33. #include <bcm63xx_dev_pci.h>
  34. #include <bcm63xx_dev_enet.h>
  35. #include <bcm63xx_dev_dsp.h>
  36. @@ -81,15 +80,20 @@ const char *board_get_name(void)
  37. return board.name;
  38. }
  39. +static int (*board_get_mac_address)(u8 mac[ETH_ALEN]);
  40. +
  41. /*
  42. * setup board for device registration
  43. */
  44. -void __init board_early_setup(const struct board_info *target)
  45. +void __init board_early_setup(const struct board_info *target,
  46. + int (*get_mac_address)(u8 mac[ETH_ALEN]))
  47. {
  48. u32 val;
  49. memcpy(&board, target, sizeof(board));
  50. + board_get_mac_address = get_mac_address;
  51. +
  52. /* setup pin multiplexing depending on board enabled device,
  53. * this has to be done this early since PCI init is done
  54. * inside arch_initcall */
  55. @@ -162,15 +166,15 @@ int __init board_register_devices(void)
  56. bcm63xx_pcmcia_register();
  57. if (board.has_enet0 &&
  58. - !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr))
  59. + !board_get_mac_address(board.enet0.mac_addr))
  60. bcm63xx_enet_register(0, &board.enet0);
  61. if (board.has_enet1 &&
  62. - !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr))
  63. + !board_get_mac_address(board.enet1.mac_addr))
  64. bcm63xx_enet_register(1, &board.enet1);
  65. if (board.has_enetsw &&
  66. - !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
  67. + !board_get_mac_address(board.enetsw.mac_addr))
  68. bcm63xx_enetsw_register(&board.enetsw);
  69. if (board.has_usbd)
  70. @@ -189,7 +193,7 @@ int __init board_register_devices(void)
  71. * do this after registering enet devices
  72. */
  73. #ifdef CONFIG_SSB_PCIHOST
  74. - if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) {
  75. + if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
  76. memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
  77. memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
  78. if (ssb_arch_register_fallback_sprom(
  79. --- a/arch/mips/bcm63xx/boards/board_common.h
  80. +++ b/arch/mips/bcm63xx/boards/board_common.h
  81. @@ -3,6 +3,7 @@
  82. #include <board_bcm963xx.h>
  83. -void board_early_setup(const struct board_info *board);
  84. +void board_early_setup(const struct board_info *board,
  85. + int (*get_mac_address)(u8 mac[ETH_ALEN]));
  86. #endif /* __BOARD_COMMON_H */