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