blob: 6301f73bcab0525980171bcf12b39b907e6120f4 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 0daf361ea799fba0af5a232036d0f06cea85ad24 Mon Sep 17 00:00:00 2001
2From: Jonas Gorski <jogo@openwrt.org>
3Date: Sat, 21 Jun 2014 12:47:49 +0200
4Subject: [PATCH 42/44] MIPS: BCM63XX: allow building support for more than one
5 board type
6
7Use the arguments passed to the kernel to detect being booted with
8CFE as the indicator for bcm963xx board support, allowing the
9non presence of CFE_EPTSEAL to assume a different board type.
10
11Signed-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 # 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
34-endchoice
35+endmenu
36--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
37+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
38@@ -683,7 +683,7 @@ static const struct board_info __initcon
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@@ -13,6 +13,8 @@
50 #include <linux/platform_device.h>
51 #include <linux/ssb/ssb.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@@ -30,6 +32,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 static struct board_info board;
67@@ -80,6 +84,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 */