Root/target/linux/brcm47xx/patches-3.0/016-MIPS-BCM47xx-Remove-CFE-console.patch

1From 5219981646071abb6731634bf47781a53e248764 Mon Sep 17 00:00:00 2001
2From: Hauke Mehrtens <hauke@hauke-m.de>
3Date: Sun, 18 Jul 2010 15:11:26 +0200
4Subject: [PATCH 6/6] MIPS: BCM47xx: Remove CFE console
5
6Do not use the CFE console. It causes hangs on some devices like the
7Buffalo WHR-HP-G54.
8This was reported in https://dev.openwrt.org/ticket/4061 and
9https://forum.openwrt.org/viewtopic.php?id=17063
10
11Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12---
13 arch/mips/Kconfig | 1 -
14 arch/mips/bcm47xx/prom.c | 82 +++------------------------------------------
15 2 files changed, 6 insertions(+), 77 deletions(-)
16
17--- a/arch/mips/Kconfig
18+++ b/arch/mips/Kconfig
19@@ -94,7 +94,6 @@ config BCM47XX
20     select SYS_SUPPORTS_32BIT_KERNEL
21     select SYS_SUPPORTS_LITTLE_ENDIAN
22     select GENERIC_GPIO
23- select SYS_HAS_EARLY_PRINTK
24     select CFE
25     help
26      Support for BCM47XX based boards
27--- a/arch/mips/bcm47xx/prom.c
28+++ b/arch/mips/bcm47xx/prom.c
29@@ -31,96 +31,28 @@
30 #include <asm/fw/cfe/cfe_api.h>
31 #include <asm/fw/cfe/cfe_error.h>
32 
33-static int cfe_cons_handle;
34-
35 const char *get_system_type(void)
36 {
37     return "Broadcom BCM47XX";
38 }
39 
40-void prom_putchar(char c)
41-{
42- while (cfe_write(cfe_cons_handle, &c, 1) == 0)
43- ;
44-}
45-
46-static __init void prom_init_cfe(void)
47+static __init int prom_init_cfe(void)
48 {
49     uint32_t cfe_ept;
50     uint32_t cfe_handle;
51     uint32_t cfe_eptseal;
52- int argc = fw_arg0;
53- char **envp = (char **) fw_arg2;
54- int *prom_vec = (int *) fw_arg3;
55-
56- /*
57- * Check if a loader was used; if NOT, the 4 arguments are
58- * what CFE gives us (handle, 0, EPT and EPTSEAL)
59- */
60- if (argc < 0) {
61- cfe_handle = (uint32_t)argc;
62- cfe_ept = (uint32_t)envp;
63- cfe_eptseal = (uint32_t)prom_vec;
64- } else {
65- if ((int)prom_vec < 0) {
66- /*
67- * Old loader; all it gives us is the handle,
68- * so use the "known" entrypoint and assume
69- * the seal.
70- */
71- cfe_handle = (uint32_t)prom_vec;
72- cfe_ept = 0xBFC00500;
73- cfe_eptseal = CFE_EPTSEAL;
74- } else {
75- /*
76- * Newer loaders bundle the handle/ept/eptseal
77- * Note: prom_vec is in the loader's useg
78- * which is still alive in the TLB.
79- */
80- cfe_handle = prom_vec[0];
81- cfe_ept = prom_vec[2];
82- cfe_eptseal = prom_vec[3];
83- }
84- }
85+
86+ cfe_eptseal = (uint32_t) fw_arg3;
87+ cfe_handle = (uint32_t) fw_arg0;
88+ cfe_ept = (uint32_t) fw_arg2;
89 
90     if (cfe_eptseal != CFE_EPTSEAL) {
91- /* too early for panic to do any good */
92         printk(KERN_ERR "CFE's entrypoint seal doesn't match.");
93- while (1) ;
94+ return -1;
95     }
96 
97     cfe_init(cfe_handle, cfe_ept);
98-}
99-
100-static __init void prom_init_console(void)
101-{
102- /* Initialize CFE console */
103- cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
104-}
105-
106-static __init void prom_init_cmdline(void)
107-{
108- static char buf[COMMAND_LINE_SIZE] __initdata;
109-
110- /* Get the kernel command line from CFE */
111- if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) {
112- buf[COMMAND_LINE_SIZE - 1] = 0;
113- strcpy(arcs_cmdline, buf);
114- }
115-
116- /* Force a console handover by adding a console= argument if needed,
117- * as CFE is not available anymore later in the boot process. */
118- if ((strstr(arcs_cmdline, "console=")) == NULL) {
119- /* Try to read the default serial port used by CFE */
120- if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0)
121- || (strncmp("uart", buf, 4)))
122- /* Default to uart0 */
123- strcpy(buf, "uart0");
124-
125- /* Compute the new command line */
126- snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200",
127- arcs_cmdline, buf[4]);
128- }
129+ return 0;
130 }
131 
132 static __init void prom_init_mem(void)
133@@ -161,8 +93,6 @@ static __init void prom_init_mem(void)
134 void __init prom_init(void)
135 {
136     prom_init_cfe();
137- prom_init_console();
138- prom_init_cmdline();
139     prom_init_mem();
140 }
141 
142

Archive Download this file



interactive