357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. From 9912a8b3c240a9b0af01ff496b7e8ed9e4cc5b82 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Tue, 29 Jul 2014 21:43:49 +0200
  4. Subject: [PATCH 02/10] MIPS: BCM63XX: use platform data for the sprom
  5. Similar to ethernet setup, use a platform data struct for passing
  6. the mac. This eliminates the requirement to allocate an array on
  7. stack for the mac passed.
  8. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  9. ---
  10. arch/mips/bcm63xx/boards/board_common.c | 6 ++----
  11. arch/mips/bcm63xx/sprom.c | 8 ++++----
  12. arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 +++++++-
  13. arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 4 ++++
  14. 4 files changed, 17 insertions(+), 9 deletions(-)
  15. --- a/arch/mips/bcm63xx/boards/board_common.c
  16. +++ b/arch/mips/bcm63xx/boards/board_common.c
  17. @@ -157,7 +157,6 @@ int __init board_register_devices(void)
  18. int button_count = 0;
  19. int led_count = 0;
  20. int usbh_ports = 0;
  21. - u8 mac[ETH_ALEN];
  22. if (board.has_uart0)
  23. bcm63xx_uart_register(0);
  24. @@ -203,8 +202,8 @@ int __init board_register_devices(void)
  25. * do this after registering enet devices
  26. */
  27. - if (board_get_mac_address(mac) ||
  28. - bcm63xx_register_fallback_sprom(mac))
  29. + if (board_get_mac_address(board.fallback_sprom.mac_addr) ||
  30. + bcm63xx_register_fallback_sprom(&board.fallback_sprom))
  31. pr_err(PFX "failed to register fallback SPROM\n");
  32. bcm63xx_spi_register();
  33. --- a/arch/mips/bcm63xx/sprom.c
  34. +++ b/arch/mips/bcm63xx/sprom.c
  35. @@ -55,14 +55,14 @@ int bcm63xx_get_fallback_sprom(struct ss
  36. }
  37. #endif
  38. -int __init bcm63xx_register_fallback_sprom(u8 *mac)
  39. +int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data)
  40. {
  41. int ret = 0;
  42. #ifdef CONFIG_SSB_PCIHOST
  43. - memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN);
  44. - memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN);
  45. - memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN);
  46. + memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
  47. + memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
  48. + memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
  49. ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom);
  50. #endif
  51. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
  52. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
  53. @@ -1,6 +1,12 @@
  54. #ifndef __BCM63XX_FALLBACK_SPROM
  55. #define __BCM63XX_FALLBACK_SPROM
  56. -int bcm63xx_register_fallback_sprom(u8 *mac);
  57. +#include <linux/if_ether.h>
  58. +
  59. +struct fallback_sprom_data {
  60. + u8 mac_addr[ETH_ALEN];
  61. +};
  62. +
  63. +int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data);
  64. #endif
  65. --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
  66. +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
  67. @@ -8,6 +8,7 @@
  68. #include <bcm63xx_dev_enet.h>
  69. #include <bcm63xx_dev_usb_usbd.h>
  70. #include <bcm63xx_dev_dsp.h>
  71. +#include <bcm63xx_fallback_sprom.h>
  72. /*
  73. * flash mapping
  74. @@ -59,6 +60,9 @@ struct board_info {
  75. /* External PHY reset GPIO flags from gpio.h */
  76. unsigned long ephy_reset_gpio_flags;
  77. + /* fallback sprom config */
  78. + struct fallback_sprom_data fallback_sprom;
  79. +
  80. /* Additional platform devices */
  81. struct platform_device **devs;
  82. unsigned int num_devs;