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