ramips: rt3833: fix build breakage
[oweals/openwrt.git] / target / linux / brcm63xx / patches-4.14 / 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,12 +1,11 @@
22  # SPDX-License-Identifier: GPL-2.0
23 -choice
24 -       prompt "Board support"
25 +menu "Board support"
26         depends on BCM63XX
27 -       default BOARD_BCM963XX
28  
29  config BOARD_BCM963XX
30         bool "Generic Broadcom 963xx boards"
31         select SSB
32 +       default y
33         help
34  
35 -endchoice
36 +endmenu
37 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
38 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
39 @@ -702,7 +702,7 @@ static const struct board_info __initcon
40  /*
41   * early init callback, read nvram data from flash and checksum it
42   */
43 -void __init board_prom_init(void)
44 +void __init board_bcm963xx_init(void)
45  {
46         unsigned int i;
47         u8 *boot_addr, *cfe;
48 --- a/arch/mips/bcm63xx/boards/board_common.c
49 +++ b/arch/mips/bcm63xx/boards/board_common.c
50 @@ -13,6 +13,8 @@
51  #include <linux/platform_device.h>
52  #include <linux/ssb/ssb.h>
53  #include <asm/addrspace.h>
54 +#include <asm/bootinfo.h>
55 +#include <asm/fw/cfe/cfe_api.h>
56  #include <bcm63xx_board.h>
57  #include <bcm63xx_cpu.h>
58  #include <bcm63xx_dev_uart.h>
59 @@ -31,6 +33,8 @@
60  #include <bcm63xx_dev_usb_usbd.h>
61  #include <board_bcm963xx.h>
62  
63 +#include "board_common.h"
64 +
65  #define PFX    "board: "
66  
67  static struct board_info board;
68 @@ -81,6 +85,15 @@ const char *board_get_name(void)
69         return board.name;
70  }
71  
72 +void __init board_prom_init(void)
73 +{
74 +       /* detect bootloader */
75 +       if (fw_arg3 == CFE_EPTSEAL)
76 +               board_bcm963xx_init();
77 +       else
78 +               panic("unsupported bootloader detected");
79 +}
80 +
81  static int (*board_get_mac_address)(u8 mac[ETH_ALEN]);
82  
83  /*
84 --- a/arch/mips/bcm63xx/boards/board_common.h
85 +++ b/arch/mips/bcm63xx/boards/board_common.h
86 @@ -6,4 +6,10 @@
87  void board_early_setup(const struct board_info *board,
88                        int (*get_mac_address)(u8 mac[ETH_ALEN]));
89  
90 +#if defined(CONFIG_BOARD_BCM963XX)
91 +void board_bcm963xx_init(void);
92 +#else
93 +static inline void board_bcm963xx_init(void) { }
94 +#endif
95 +
96  #endif /* __BOARD_COMMON_H */