354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. From 0daf361ea799fba0af5a232036d0f06cea85ad24 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sat, 21 Jun 2014 12:47:49 +0200
  4. Subject: [PATCH 42/44] MIPS: BCM63XX: allow building support for more than one
  5. board type
  6. Use the arguments passed to the kernel to detect being booted with
  7. CFE as the indicator for bcm963xx board support, allowing the
  8. non presence of CFE_EPTSEAL to assume a different board type.
  9. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  10. ---
  11. arch/mips/bcm63xx/boards/Kconfig | 7 +++----
  12. arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
  13. arch/mips/bcm63xx/boards/board_common.c | 13 +++++++++++++
  14. arch/mips/bcm63xx/boards/board_common.h | 6 ++++++
  15. 4 files changed, 23 insertions(+), 5 deletions(-)
  16. --- a/arch/mips/bcm63xx/boards/Kconfig
  17. +++ b/arch/mips/bcm63xx/boards/Kconfig
  18. @@ -1,11 +1,10 @@
  19. -choice
  20. - prompt "Board support"
  21. +menu "Board support"
  22. depends on BCM63XX
  23. - default BOARD_BCM963XX
  24. config BOARD_BCM963XX
  25. bool "Generic Broadcom 963xx boards"
  26. select SSB
  27. + default y
  28. help
  29. -endchoice
  30. +endmenu
  31. --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
  32. +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
  33. @@ -701,7 +701,7 @@ static const struct board_info __initcon
  34. /*
  35. * early init callback, read nvram data from flash and checksum it
  36. */
  37. -void __init board_prom_init(void)
  38. +void __init board_bcm963xx_init(void)
  39. {
  40. unsigned int i;
  41. u8 *boot_addr, *cfe;
  42. --- a/arch/mips/bcm63xx/boards/board_common.c
  43. +++ b/arch/mips/bcm63xx/boards/board_common.c
  44. @@ -14,6 +14,8 @@
  45. #include <linux/ssb/ssb.h>
  46. #include <linux/spi/spi.h>
  47. #include <asm/addrspace.h>
  48. +#include <asm/bootinfo.h>
  49. +#include <asm/fw/cfe/cfe_api.h>
  50. #include <bcm63xx_board.h>
  51. #include <bcm63xx_cpu.h>
  52. #include <bcm63xx_dev_uart.h>
  53. @@ -31,6 +33,8 @@
  54. #include <bcm63xx_dev_usb_usbd.h>
  55. #include <board_bcm963xx.h>
  56. +#include "board_common.h"
  57. +
  58. #define PFX "board: "
  59. static struct board_info board;
  60. @@ -81,6 +85,15 @@ const char *board_get_name(void)
  61. return board.name;
  62. }
  63. +void __init board_prom_init(void)
  64. +{
  65. + /* detect bootloader */
  66. + if (fw_arg3 == CFE_EPTSEAL)
  67. + board_bcm963xx_init();
  68. + else
  69. + panic("unsupported bootloader detected");
  70. +}
  71. +
  72. static int (*board_get_mac_address)(u8 mac[ETH_ALEN]);
  73. /*
  74. --- a/arch/mips/bcm63xx/boards/board_common.h
  75. +++ b/arch/mips/bcm63xx/boards/board_common.h
  76. @@ -6,4 +6,10 @@
  77. void board_early_setup(const struct board_info *board,
  78. int (*get_mac_address)(u8 mac[ETH_ALEN]));
  79. +#if defined(CONFIG_BOARD_BCM963XX)
  80. +void board_bcm963xx_init(void);
  81. +#else
  82. +static inline void board_bcm963xx_init(void) { }
  83. +#endif
  84. +
  85. #endif /* __BOARD_COMMON_H */