aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-08-19 09:55:06 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:41 -0400
commite0dfb20c2b77c6626a24578240266ace928cd2e7 (patch)
tree67666f032698a62b00ee6d91328dd641abe1c498
parentf96a3383cfede841cdf80a5927f14478981ed78c (diff)
MIPS: TXx9: Improve handling of built-in and command-line args
* Make prom_init_cmdline() static and be called from prom_init. * Append built-in args if the first character was '+'. * Drop command-line args if the first character of built-in was '-'. * Enclose args include spaces by quotes. * TX4938_NAND_BOOT is no longer needed. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/txx9/Kconfig7
-rw-r--r--arch/mips/txx9/generic/setup.c42
-rw-r--r--arch/mips/txx9/jmr3927/prom.c1
-rw-r--r--arch/mips/txx9/rbtx4927/prom.c1
-rw-r--r--arch/mips/txx9/rbtx4938/prom.c3
-rw-r--r--include/asm-mips/txx9/generic.h1
6 files changed, 31 insertions, 24 deletions
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 840fe757c48d..6fb2ef09d5dd 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -97,13 +97,6 @@ config TOSHIBA_RBTX4938_MPLEX_ATA
97 97
98endchoice 98endchoice
99 99
100config TX4938_NAND_BOOT
101 depends on EXPERIMENTAL && TOSHIBA_RBTX4938_MPLEX_NAND
102 bool "NAND Boot Support (EXPERIMENTAL)"
103 help
104 This is only for Toshiba RBTX4938 reference board, which has NAND IPL.
105 Select this option if you need to use NAND boot.
106
107endif 100endif
108 101
109config PCI_TX4927 102config PCI_TX4927
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index fe6bee09cece..33d8c9e3223d 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -127,31 +127,51 @@ extern struct txx9_board_vec rbtx4938_vec;
127struct txx9_board_vec *txx9_board_vec __initdata; 127struct txx9_board_vec *txx9_board_vec __initdata;
128static char txx9_system_type[32]; 128static char txx9_system_type[32];
129 129
130void __init prom_init_cmdline(void) 130static void __init prom_init_cmdline(void)
131{ 131{
132 int argc = (int)fw_arg0; 132 int argc = (int)fw_arg0;
133 char **argv = (char **)fw_arg1; 133 int *argv32 = (int *)fw_arg1;
134 int i; /* Always ignore the "-c" at argv[0] */ 134 int i; /* Always ignore the "-c" at argv[0] */
135#ifdef CONFIG_64BIT 135 char builtin[CL_SIZE];
136 char *fixed_argv[32];
137 for (i = 0; i < argc; i++)
138 fixed_argv[i] = (char *)(long)(*((__s32 *)argv + i));
139 argv = fixed_argv;
140#endif
141 136
142 /* ignore all built-in args if any f/w args given */ 137 /* ignore all built-in args if any f/w args given */
143 if (argc > 1) 138 /*
144 *arcs_cmdline = '\0'; 139 * But if built-in strings was started with '+', append them
140 * to command line args. If built-in was started with '-',
141 * ignore all f/w args.
142 */
143 builtin[0] = '\0';
144 if (arcs_cmdline[0] == '+')
145 strcpy(builtin, arcs_cmdline + 1);
146 else if (arcs_cmdline[0] == '-') {
147 strcpy(builtin, arcs_cmdline + 1);
148 argc = 0;
149 } else if (argc <= 1)
150 strcpy(builtin, arcs_cmdline);
151 arcs_cmdline[0] = '\0';
145 152
146 for (i = 1; i < argc; i++) { 153 for (i = 1; i < argc; i++) {
154 char *str = (char *)(long)argv32[i];
147 if (i != 1) 155 if (i != 1)
148 strcat(arcs_cmdline, " "); 156 strcat(arcs_cmdline, " ");
149 strcat(arcs_cmdline, argv[i]); 157 if (strchr(str, ' ')) {
158 strcat(arcs_cmdline, "\"");
159 strcat(arcs_cmdline, str);
160 strcat(arcs_cmdline, "\"");
161 } else
162 strcat(arcs_cmdline, str);
163 }
164 /* append saved builtin args */
165 if (builtin[0]) {
166 if (arcs_cmdline[0])
167 strcat(arcs_cmdline, " ");
168 strcat(arcs_cmdline, builtin);
150 } 169 }
151} 170}
152 171
153void __init prom_init(void) 172void __init prom_init(void)
154{ 173{
174 prom_init_cmdline();
155#ifdef CONFIG_CPU_TX39XX 175#ifdef CONFIG_CPU_TX39XX
156 txx9_board_vec = &jmr3927_vec; 176 txx9_board_vec = &jmr3927_vec;
157#endif 177#endif
diff --git a/arch/mips/txx9/jmr3927/prom.c b/arch/mips/txx9/jmr3927/prom.c
index 70c4c8ec3e84..c899c0c087a0 100644
--- a/arch/mips/txx9/jmr3927/prom.c
+++ b/arch/mips/txx9/jmr3927/prom.c
@@ -47,7 +47,6 @@ void __init jmr3927_prom_init(void)
47 if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0) 47 if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0)
48 printk(KERN_ERR "TX3927 TLB off\n"); 48 printk(KERN_ERR "TX3927 TLB off\n");
49 49
50 prom_init_cmdline();
51 add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM); 50 add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM);
52 txx9_sio_putchar_init(TX3927_SIO_REG(1)); 51 txx9_sio_putchar_init(TX3927_SIO_REG(1));
53} 52}
diff --git a/arch/mips/txx9/rbtx4927/prom.c b/arch/mips/txx9/rbtx4927/prom.c
index 1dc0a5b1956b..cc97c6a6011b 100644
--- a/arch/mips/txx9/rbtx4927/prom.c
+++ b/arch/mips/txx9/rbtx4927/prom.c
@@ -36,7 +36,6 @@
36 36
37void __init rbtx4927_prom_init(void) 37void __init rbtx4927_prom_init(void)
38{ 38{
39 prom_init_cmdline();
40 add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM); 39 add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM);
41 txx9_sio_putchar_init(TX4927_SIO_REG(0) & 0xfffffffffULL); 40 txx9_sio_putchar_init(TX4927_SIO_REG(0) & 0xfffffffffULL);
42} 41}
diff --git a/arch/mips/txx9/rbtx4938/prom.c b/arch/mips/txx9/rbtx4938/prom.c
index d73123cd2ab9..bcb469247e8c 100644
--- a/arch/mips/txx9/rbtx4938/prom.c
+++ b/arch/mips/txx9/rbtx4938/prom.c
@@ -18,9 +18,6 @@
18 18
19void __init rbtx4938_prom_init(void) 19void __init rbtx4938_prom_init(void)
20{ 20{
21#ifndef CONFIG_TX4938_NAND_BOOT
22 prom_init_cmdline();
23#endif
24 add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM); 21 add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM);
25 txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL); 22 txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL);
26} 23}
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
index 5b1ccf901c62..c9eed7ea148c 100644
--- a/include/asm-mips/txx9/generic.h
+++ b/include/asm-mips/txx9/generic.h
@@ -42,7 +42,6 @@ struct txx9_board_vec {
42}; 42};
43extern struct txx9_board_vec *txx9_board_vec; 43extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending); 44extern int (*txx9_irq_dispatch)(int pending);
45void prom_init_cmdline(void);
46char *prom_getcmdline(void); 45char *prom_getcmdline(void);
47void txx9_wdt_init(unsigned long base); 46void txx9_wdt_init(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq); 47void txx9_spi_init(int busid, unsigned long base, int irq);