bcm53xx: 3.18: add early support for Buffalo WZR-900DHP
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 081-MIPS-BCM47XX-Remove-CFE-support.patch
1 commit 808fe9c2fa81a6b3e20fe813d5410e7fd6606efa
2 Author: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun Jul 18 15:11:26 2010 +0200
4
5 MIPS: BCM47XX: Remove CFE support
6
7 bcm47xx only uses the CFE code for early print to a console, but that
8 is also possible with a early print serial 8250 driver.
9
10 The CFE api init causes hangs somewhere in prom_init_cfe() on some
11 devices like the Buffalo WHR-HP-G54 and the Asus WL-520GU.
12 This was reported in https://dev.openwrt.org/ticket/4061 and
13 https://forum.openwrt.org/viewtopic.php?id=17063
14
15 This will remove all the CFE handling code from bcm47xx.
16
17 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
18
19 --- a/arch/mips/Kconfig
20 +++ b/arch/mips/Kconfig
21 @@ -112,13 +112,11 @@ config BCM47XX
22 select CEVT_R4K
23 select CSRC_R4K
24 select DMA_NONCOHERENT
25 - select FW_CFE
26 select HW_HAS_PCI
27 select IRQ_CPU
28 select NO_EXCEPT_FILL
29 select SYS_SUPPORTS_32BIT_KERNEL
30 select SYS_SUPPORTS_LITTLE_ENDIAN
31 - select SYS_HAS_EARLY_PRINTK
32 help
33 Support for BCM47XX based boards
34
35 --- a/arch/mips/bcm47xx/prom.c
36 +++ b/arch/mips/bcm47xx/prom.c
37 @@ -30,12 +30,9 @@
38 #include <linux/spinlock.h>
39 #include <linux/smp.h>
40 #include <asm/bootinfo.h>
41 -#include <asm/fw/cfe/cfe_api.h>
42 -#include <asm/fw/cfe/cfe_error.h>
43 #include <bcm47xx.h>
44 #include <bcm47xx_board.h>
45
46 -static int cfe_cons_handle;
47
48 static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
49
50 @@ -52,91 +49,6 @@ __init void bcm47xx_set_system_type(u16
51 chip_id);
52 }
53
54 -void prom_putchar(char c)
55 -{
56 - while (cfe_write(cfe_cons_handle, &c, 1) == 0)
57 - ;
58 -}
59 -
60 -static __init void prom_init_cfe(void)
61 -{
62 - uint32_t cfe_ept;
63 - uint32_t cfe_handle;
64 - uint32_t cfe_eptseal;
65 - int argc = fw_arg0;
66 - char **envp = (char **) fw_arg2;
67 - int *prom_vec = (int *) fw_arg3;
68 -
69 - /*
70 - * Check if a loader was used; if NOT, the 4 arguments are
71 - * what CFE gives us (handle, 0, EPT and EPTSEAL)
72 - */
73 - if (argc < 0) {
74 - cfe_handle = (uint32_t)argc;
75 - cfe_ept = (uint32_t)envp;
76 - cfe_eptseal = (uint32_t)prom_vec;
77 - } else {
78 - if ((int)prom_vec < 0) {
79 - /*
80 - * Old loader; all it gives us is the handle,
81 - * so use the "known" entrypoint and assume
82 - * the seal.
83 - */
84 - cfe_handle = (uint32_t)prom_vec;
85 - cfe_ept = 0xBFC00500;
86 - cfe_eptseal = CFE_EPTSEAL;
87 - } else {
88 - /*
89 - * Newer loaders bundle the handle/ept/eptseal
90 - * Note: prom_vec is in the loader's useg
91 - * which is still alive in the TLB.
92 - */
93 - cfe_handle = prom_vec[0];
94 - cfe_ept = prom_vec[2];
95 - cfe_eptseal = prom_vec[3];
96 - }
97 - }
98 -
99 - if (cfe_eptseal != CFE_EPTSEAL) {
100 - /* too early for panic to do any good */
101 - printk(KERN_ERR "CFE's entrypoint seal doesn't match.");
102 - while (1) ;
103 - }
104 -
105 - cfe_init(cfe_handle, cfe_ept);
106 -}
107 -
108 -static __init void prom_init_console(void)
109 -{
110 - /* Initialize CFE console */
111 - cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
112 -}
113 -
114 -static __init void prom_init_cmdline(void)
115 -{
116 - static char buf[COMMAND_LINE_SIZE] __initdata;
117 -
118 - /* Get the kernel command line from CFE */
119 - if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) {
120 - buf[COMMAND_LINE_SIZE - 1] = 0;
121 - strcpy(arcs_cmdline, buf);
122 - }
123 -
124 - /* Force a console handover by adding a console= argument if needed,
125 - * as CFE is not available anymore later in the boot process. */
126 - if ((strstr(arcs_cmdline, "console=")) == NULL) {
127 - /* Try to read the default serial port used by CFE */
128 - if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0)
129 - || (strncmp("uart", buf, 4)))
130 - /* Default to uart0 */
131 - strcpy(buf, "uart0");
132 -
133 - /* Compute the new command line */
134 - snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200",
135 - arcs_cmdline, buf[4]);
136 - }
137 -}
138 -
139 static __init void prom_init_mem(void)
140 {
141 unsigned long mem;
142 @@ -184,9 +96,6 @@ static __init void prom_init_mem(void)
143
144 void __init prom_init(void)
145 {
146 - prom_init_cfe();
147 - prom_init_console();
148 - prom_init_cmdline();
149 prom_init_mem();
150 }
151