xref: /openbmc/linux/arch/mips/txx9/rbtx4927/prom.c (revision 22b1d707ffc99faebd86257ad19d5bb9fc624734)
1*22b1d707SAtsushi Nemoto /*
2*22b1d707SAtsushi Nemoto  * rbtx4927 specific prom routines
3*22b1d707SAtsushi Nemoto  *
4*22b1d707SAtsushi Nemoto  * Author: MontaVista Software, Inc.
5*22b1d707SAtsushi Nemoto  *         source@mvista.com
6*22b1d707SAtsushi Nemoto  *
7*22b1d707SAtsushi Nemoto  * Copyright 2001-2002 MontaVista Software Inc.
8*22b1d707SAtsushi Nemoto  *
9*22b1d707SAtsushi Nemoto  * Copyright (C) 2004 MontaVista Software Inc.
10*22b1d707SAtsushi Nemoto  * Author: Manish Lachwani, mlachwani@mvista.com
11*22b1d707SAtsushi Nemoto  *
12*22b1d707SAtsushi Nemoto  *  This program is free software; you can redistribute it and/or modify it
13*22b1d707SAtsushi Nemoto  *  under the terms of the GNU General Public License as published by the
14*22b1d707SAtsushi Nemoto  *  Free Software Foundation; either version 2 of the License, or (at your
15*22b1d707SAtsushi Nemoto  *  option) any later version.
16*22b1d707SAtsushi Nemoto  *
17*22b1d707SAtsushi Nemoto  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18*22b1d707SAtsushi Nemoto  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*22b1d707SAtsushi Nemoto  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20*22b1d707SAtsushi Nemoto  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21*22b1d707SAtsushi Nemoto  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22*22b1d707SAtsushi Nemoto  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23*22b1d707SAtsushi Nemoto  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24*22b1d707SAtsushi Nemoto  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25*22b1d707SAtsushi Nemoto  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26*22b1d707SAtsushi Nemoto  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*22b1d707SAtsushi Nemoto  *
28*22b1d707SAtsushi Nemoto  *  You should have received a copy of the GNU General Public License along
29*22b1d707SAtsushi Nemoto  *  with this program; if not, write to the Free Software Foundation, Inc.,
30*22b1d707SAtsushi Nemoto  *  675 Mass Ave, Cambridge, MA 02139, USA.
31*22b1d707SAtsushi Nemoto  */
32*22b1d707SAtsushi Nemoto #include <linux/init.h>
33*22b1d707SAtsushi Nemoto #include <linux/string.h>
34*22b1d707SAtsushi Nemoto #include <asm/bootinfo.h>
35*22b1d707SAtsushi Nemoto #include <asm/cpu.h>
36*22b1d707SAtsushi Nemoto #include <asm/mipsregs.h>
37*22b1d707SAtsushi Nemoto #include <asm/txx9/tx4927.h>
38*22b1d707SAtsushi Nemoto 
39*22b1d707SAtsushi Nemoto void __init prom_init_cmdline(void)
40*22b1d707SAtsushi Nemoto {
41*22b1d707SAtsushi Nemoto 	int argc = (int) fw_arg0;
42*22b1d707SAtsushi Nemoto 	char **argv = (char **) fw_arg1;
43*22b1d707SAtsushi Nemoto 	int i;			/* Always ignore the "-c" at argv[0] */
44*22b1d707SAtsushi Nemoto 
45*22b1d707SAtsushi Nemoto 	/* ignore all built-in args if any f/w args given */
46*22b1d707SAtsushi Nemoto 	if (argc > 1) {
47*22b1d707SAtsushi Nemoto 		*arcs_cmdline = '\0';
48*22b1d707SAtsushi Nemoto 	}
49*22b1d707SAtsushi Nemoto 
50*22b1d707SAtsushi Nemoto 	for (i = 1; i < argc; i++) {
51*22b1d707SAtsushi Nemoto 		if (i != 1) {
52*22b1d707SAtsushi Nemoto 			strcat(arcs_cmdline, " ");
53*22b1d707SAtsushi Nemoto 		}
54*22b1d707SAtsushi Nemoto 		strcat(arcs_cmdline, argv[i]);
55*22b1d707SAtsushi Nemoto 	}
56*22b1d707SAtsushi Nemoto }
57*22b1d707SAtsushi Nemoto 
58*22b1d707SAtsushi Nemoto void __init prom_init(void)
59*22b1d707SAtsushi Nemoto {
60*22b1d707SAtsushi Nemoto 	extern int tx4927_get_mem_size(void);
61*22b1d707SAtsushi Nemoto 	extern char* toshiba_name;
62*22b1d707SAtsushi Nemoto 	int msize;
63*22b1d707SAtsushi Nemoto 
64*22b1d707SAtsushi Nemoto 	prom_init_cmdline();
65*22b1d707SAtsushi Nemoto 
66*22b1d707SAtsushi Nemoto 	if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) {
67*22b1d707SAtsushi Nemoto 		mips_machtype = MACH_TOSHIBA_RBTX4927;
68*22b1d707SAtsushi Nemoto 		toshiba_name  = "TX4927";
69*22b1d707SAtsushi Nemoto 	} else {
70*22b1d707SAtsushi Nemoto 		mips_machtype = MACH_TOSHIBA_RBTX4937;
71*22b1d707SAtsushi Nemoto 		toshiba_name  = "TX4937";
72*22b1d707SAtsushi Nemoto 	}
73*22b1d707SAtsushi Nemoto 
74*22b1d707SAtsushi Nemoto 	msize = tx4927_get_mem_size();
75*22b1d707SAtsushi Nemoto 	add_memory_region(0, msize << 20, BOOT_MEM_RAM);
76*22b1d707SAtsushi Nemoto }
77*22b1d707SAtsushi Nemoto 
78*22b1d707SAtsushi Nemoto void __init prom_free_prom_memory(void)
79*22b1d707SAtsushi Nemoto {
80*22b1d707SAtsushi Nemoto }
81*22b1d707SAtsushi Nemoto 
82*22b1d707SAtsushi Nemoto const char *get_system_type(void)
83*22b1d707SAtsushi Nemoto {
84*22b1d707SAtsushi Nemoto 	return "Toshiba RBTX4927/RBTX4937";
85*22b1d707SAtsushi Nemoto }
86*22b1d707SAtsushi Nemoto 
87*22b1d707SAtsushi Nemoto char * __init prom_getcmdline(void)
88*22b1d707SAtsushi Nemoto {
89*22b1d707SAtsushi Nemoto         return &(arcs_cmdline[0]);
90*22b1d707SAtsushi Nemoto }
91*22b1d707SAtsushi Nemoto 
92