From: Gabor Juhos Date: Sat, 2 Dec 2017 19:15:29 +0100 Subject: [PATCH] MIPS: ath79: fix board detection with newer RouterBOOT versions Recent RouterBOOT version (at least version 3.41 on RB911G-5HPacD) use "Board=" kernel parameter instead of "board=" to pass the board name to the kernel. Due to this change the board detection code is not working on the devices shipped with the new RouterBOOT version. Because the kernel is unable to identify these boards they become unusable despite that they are supported by the current code. Update the prom_init code to convert the 'Board' kernel parameter to 'board'. After this change, the board detection works also with the new RouterBOOT versions. Signed-off-by: Gabor Juhos --- --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c @@ -104,6 +104,7 @@ static int __init ath79_prom_init_myload void __init prom_init(void) { const char *env; + char *c; if (ath79_prom_init_myloader()) return; @@ -137,6 +138,15 @@ void __init prom_init(void) } #endif + /* + * RouterBOOT uses "Board" kernel parameter instead of "board" since + * version 3.41 (or so). Replace the first character of the parameter + * to keep board detection working. + */ + c = strstr(arcs_cmdline, "Board="); + if (c) + c[0] = 'b'; + if (strstr(arcs_cmdline, "board=750Gr3") || strstr(arcs_cmdline, "board=750i") || strstr(arcs_cmdline, "board=750-hb") || 18.06 upstream openwrtJames
aboutsummaryrefslogtreecommitdiffstats
blob: aedda9689551f621d47078be506cd13b92d624d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
From 83131acbfb59760a19f3711c09526e191c8aad54 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Tue, 29 Jul 2014 21:52:56 +0200
Subject: [PATCH 03/10] MIPS: BCM63XX: make fallback sprom optional

Some devices do not provide enough mac addresses to populate wifi in
addition to ethernet.

Use having pci enabled as a rough heuristic which boards should have it
enabled.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/bcm63xx/boards/board_bcm963xx.c           | 12 ++++++++++++
 arch/mips/bcm63xx/boards/board_common.c             |  5 +++--
 arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h |  1 +
 3 files changed, 16 insertions(+), 2 deletions(-)

--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -74,6 +74,7 @@ static struct board_info __initdata boar
 	.has_uart0			= 1,
 	.has_pci			= 1,
 	.has_usbd			= 0,
+	.use_fallback_sprom		= 1,
 
 	.usbd = {
 		.use_fullspeed		= 0,
@@ -223,6 +224,7 @@ static struct board_info __initdata boar
 	.has_uart0			= 1,
 	.has_enet0			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -268,6 +270,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -328,6 +331,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -392,6 +396,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -460,6 +465,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -483,6 +489,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -501,6 +508,7 @@ static struct board_info __initdata boar
 
 	.has_uart0			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 	.has_ohci0			= 1,
 
 	.has_enet0			= 1,
@@ -523,6 +531,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -549,6 +558,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -601,6 +611,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
@@ -672,6 +683,7 @@ static struct board_info __initdata boar
 	.has_enet0			= 1,
 	.has_enet1			= 1,
 	.has_pci			= 1,
+	.use_fallback_sprom		= 1,
 
 	.enet0 = {
 		.has_phy		= 1,
--- a/arch/mips/bcm63xx/boards/board_common.c
+++ b/arch/mips/bcm63xx/boards/board_common.c
@@ -202,8 +202,9 @@ int __init board_register_devices(void)
 	 * do this after registering enet devices
 	 */
 
-	if (board_get_mac_address(board.fallback_sprom.mac_addr) ||
-	    bcm63xx_register_fallback_sprom(&board.fallback_sprom))
+	if (board.use_fallback_sprom &&
+	    (board_get_mac_address(board.fallback_sprom.mac_addr) ||
+	     bcm63xx_register_fallback_sprom(&board.fallback_sprom)))
 		pr_err(PFX "failed to register fallback SPROM\n");
 
 	bcm63xx_spi_register();
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -35,6 +35,7 @@ struct board_info {
 	unsigned int	has_dsp:1;
 	unsigned int	has_uart0:1;
 	unsigned int	has_uart1:1;
+	unsigned int	use_fallback_sprom:1;
 
 	/* ethernet config */
 	struct bcm63xx_enet_platform_data enet0;