brcm47xx: update board detection patches
[openwrt.git] / target / linux / brcm47xx / patches-3.10 / 116-MIPS-BCM47xx-Remove-CFE-console.patch
1 From 5219981646071abb6731634bf47781a53e248764 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 6/6] 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/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 @@ -118,7 +118,6 @@ config BCM47XX
20         select NO_EXCEPT_FILL
21         select SYS_SUPPORTS_32BIT_KERNEL
22         select SYS_SUPPORTS_LITTLE_ENDIAN
23 -       select SYS_HAS_EARLY_PRINTK
24         help
25          Support for BCM47XX based boards
26  
27 --- a/arch/mips/bcm47xx/prom.c
28 +++ b/arch/mips/bcm47xx/prom.c
29 @@ -35,8 +35,6 @@
30  #include <bcm47xx.h>
31  #include <bcm47xx_board.h>
32  
33 -static int cfe_cons_handle;
34 -
35  static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
36  
37  const char *get_system_type(void)
38 @@ -52,89 +50,23 @@ __init void bcm47xx_set_system_type(u16
39                  chip_id);
40  }
41  
42 -void prom_putchar(char c)
43 -{
44 -       while (cfe_write(cfe_cons_handle, &c, 1) == 0)
45 -               ;
46 -}
47 -
48 -static __init void prom_init_cfe(void)
49 +static __init int prom_init_cfe(void)
50  {
51         uint32_t cfe_ept;
52         uint32_t cfe_handle;
53         uint32_t cfe_eptseal;
54 -       int argc = fw_arg0;
55 -       char **envp = (char **) fw_arg2;
56 -       int *prom_vec = (int *) fw_arg3;
57 -
58 -       /*
59 -        * Check if a loader was used; if NOT, the 4 arguments are
60 -        * what CFE gives us (handle, 0, EPT and EPTSEAL)
61 -        */
62 -       if (argc < 0) {
63 -               cfe_handle = (uint32_t)argc;
64 -               cfe_ept = (uint32_t)envp;
65 -               cfe_eptseal = (uint32_t)prom_vec;
66 -       } else {
67 -               if ((int)prom_vec < 0) {
68 -                       /*
69 -                        * Old loader; all it gives us is the handle,
70 -                        * so use the "known" entrypoint and assume
71 -                        * the seal.
72 -                        */
73 -                       cfe_handle = (uint32_t)prom_vec;
74 -                       cfe_ept = 0xBFC00500;
75 -                       cfe_eptseal = CFE_EPTSEAL;
76 -               } else {
77 -                       /*
78 -                        * Newer loaders bundle the handle/ept/eptseal
79 -                        * Note: prom_vec is in the loader's useg
80 -                        * which is still alive in the TLB.
81 -                        */
82 -                       cfe_handle = prom_vec[0];
83 -                       cfe_ept = prom_vec[2];
84 -                       cfe_eptseal = prom_vec[3];
85 -               }
86 -       }
87 +
88 +       cfe_eptseal = (uint32_t) fw_arg3;
89 +       cfe_handle = (uint32_t) fw_arg0;
90 +       cfe_ept = (uint32_t) fw_arg2;
91  
92         if (cfe_eptseal != CFE_EPTSEAL) {
93 -               /* too early for panic to do any good */
94                 printk(KERN_ERR "CFE's entrypoint seal doesn't match.");
95 -               while (1) ;
96 +               return -1;
97         }
98  
99         cfe_init(cfe_handle, cfe_ept);
100 -}
101 -
102 -static __init void prom_init_console(void)
103 -{
104 -       /* Initialize CFE console */
105 -       cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
106 -}
107 -
108 -static __init void prom_init_cmdline(void)
109 -{
110 -       static char buf[COMMAND_LINE_SIZE] __initdata;
111 -
112 -       /* Get the kernel command line from CFE */
113 -       if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) {
114 -               buf[COMMAND_LINE_SIZE - 1] = 0;
115 -               strcpy(arcs_cmdline, buf);
116 -       }
117 -
118 -       /* Force a console handover by adding a console= argument if needed,
119 -        * as CFE is not available anymore later in the boot process. */
120 -       if ((strstr(arcs_cmdline, "console=")) == NULL) {
121 -               /* Try to read the default serial port used by CFE */
122 -               if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0)
123 -                   || (strncmp("uart", buf, 4)))
124 -                       /* Default to uart0 */
125 -                       strcpy(buf, "uart0");
126 -
127 -               /* Compute the new command line */
128 -               snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200",
129 -                        arcs_cmdline, buf[4]);
130 -       }
131 +       return 0;
132  }
133  
134  static __init void prom_init_mem(void)
135 @@ -185,8 +117,6 @@ static __init void prom_init_mem(void)
136  void __init prom_init(void)
137  {
138         prom_init_cfe();
139 -       prom_init_console();
140 -       prom_init_cmdline();
141         prom_init_mem();
142  }
143