xref: /openbmc/linux/arch/mips/txx9/rbtx4927/prom.c (revision 22b1d707)
122b1d707SAtsushi Nemoto /*
222b1d707SAtsushi Nemoto  * rbtx4927 specific prom routines
322b1d707SAtsushi Nemoto  *
422b1d707SAtsushi Nemoto  * Author: MontaVista Software, Inc.
522b1d707SAtsushi Nemoto  *         source@mvista.com
622b1d707SAtsushi Nemoto  *
722b1d707SAtsushi Nemoto  * Copyright 2001-2002 MontaVista Software Inc.
822b1d707SAtsushi Nemoto  *
922b1d707SAtsushi Nemoto  * Copyright (C) 2004 MontaVista Software Inc.
1022b1d707SAtsushi Nemoto  * Author: Manish Lachwani, mlachwani@mvista.com
1122b1d707SAtsushi Nemoto  *
1222b1d707SAtsushi Nemoto  *  This program is free software; you can redistribute it and/or modify it
1322b1d707SAtsushi Nemoto  *  under the terms of the GNU General Public License as published by the
1422b1d707SAtsushi Nemoto  *  Free Software Foundation; either version 2 of the License, or (at your
1522b1d707SAtsushi Nemoto  *  option) any later version.
1622b1d707SAtsushi Nemoto  *
1722b1d707SAtsushi Nemoto  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1822b1d707SAtsushi Nemoto  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1922b1d707SAtsushi Nemoto  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2022b1d707SAtsushi Nemoto  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2122b1d707SAtsushi Nemoto  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2222b1d707SAtsushi Nemoto  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2322b1d707SAtsushi Nemoto  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2422b1d707SAtsushi Nemoto  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
2522b1d707SAtsushi Nemoto  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2622b1d707SAtsushi Nemoto  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2722b1d707SAtsushi Nemoto  *
2822b1d707SAtsushi Nemoto  *  You should have received a copy of the GNU General Public License along
2922b1d707SAtsushi Nemoto  *  with this program; if not, write to the Free Software Foundation, Inc.,
3022b1d707SAtsushi Nemoto  *  675 Mass Ave, Cambridge, MA 02139, USA.
3122b1d707SAtsushi Nemoto  */
3222b1d707SAtsushi Nemoto #include <linux/init.h>
3322b1d707SAtsushi Nemoto #include <linux/string.h>
3422b1d707SAtsushi Nemoto #include <asm/bootinfo.h>
3522b1d707SAtsushi Nemoto #include <asm/cpu.h>
3622b1d707SAtsushi Nemoto #include <asm/mipsregs.h>
3722b1d707SAtsushi Nemoto #include <asm/txx9/tx4927.h>
3822b1d707SAtsushi Nemoto 
3922b1d707SAtsushi Nemoto void __init prom_init_cmdline(void)
4022b1d707SAtsushi Nemoto {
4122b1d707SAtsushi Nemoto 	int argc = (int) fw_arg0;
4222b1d707SAtsushi Nemoto 	char **argv = (char **) fw_arg1;
4322b1d707SAtsushi Nemoto 	int i;			/* Always ignore the "-c" at argv[0] */
4422b1d707SAtsushi Nemoto 
4522b1d707SAtsushi Nemoto 	/* ignore all built-in args if any f/w args given */
4622b1d707SAtsushi Nemoto 	if (argc > 1) {
4722b1d707SAtsushi Nemoto 		*arcs_cmdline = '\0';
4822b1d707SAtsushi Nemoto 	}
4922b1d707SAtsushi Nemoto 
5022b1d707SAtsushi Nemoto 	for (i = 1; i < argc; i++) {
5122b1d707SAtsushi Nemoto 		if (i != 1) {
5222b1d707SAtsushi Nemoto 			strcat(arcs_cmdline, " ");
5322b1d707SAtsushi Nemoto 		}
5422b1d707SAtsushi Nemoto 		strcat(arcs_cmdline, argv[i]);
5522b1d707SAtsushi Nemoto 	}
5622b1d707SAtsushi Nemoto }
5722b1d707SAtsushi Nemoto 
5822b1d707SAtsushi Nemoto void __init prom_init(void)
5922b1d707SAtsushi Nemoto {
6022b1d707SAtsushi Nemoto 	extern int tx4927_get_mem_size(void);
6122b1d707SAtsushi Nemoto 	extern char* toshiba_name;
6222b1d707SAtsushi Nemoto 	int msize;
6322b1d707SAtsushi Nemoto 
6422b1d707SAtsushi Nemoto 	prom_init_cmdline();
6522b1d707SAtsushi Nemoto 
6622b1d707SAtsushi Nemoto 	if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) {
6722b1d707SAtsushi Nemoto 		mips_machtype = MACH_TOSHIBA_RBTX4927;
6822b1d707SAtsushi Nemoto 		toshiba_name  = "TX4927";
6922b1d707SAtsushi Nemoto 	} else {
7022b1d707SAtsushi Nemoto 		mips_machtype = MACH_TOSHIBA_RBTX4937;
7122b1d707SAtsushi Nemoto 		toshiba_name  = "TX4937";
7222b1d707SAtsushi Nemoto 	}
7322b1d707SAtsushi Nemoto 
7422b1d707SAtsushi Nemoto 	msize = tx4927_get_mem_size();
7522b1d707SAtsushi Nemoto 	add_memory_region(0, msize << 20, BOOT_MEM_RAM);
7622b1d707SAtsushi Nemoto }
7722b1d707SAtsushi Nemoto 
7822b1d707SAtsushi Nemoto void __init prom_free_prom_memory(void)
7922b1d707SAtsushi Nemoto {
8022b1d707SAtsushi Nemoto }
8122b1d707SAtsushi Nemoto 
8222b1d707SAtsushi Nemoto const char *get_system_type(void)
8322b1d707SAtsushi Nemoto {
8422b1d707SAtsushi Nemoto 	return "Toshiba RBTX4927/RBTX4937";
8522b1d707SAtsushi Nemoto }
8622b1d707SAtsushi Nemoto 
8722b1d707SAtsushi Nemoto char * __init prom_getcmdline(void)
8822b1d707SAtsushi Nemoto {
8922b1d707SAtsushi Nemoto         return &(arcs_cmdline[0]);
9022b1d707SAtsushi Nemoto }
9122b1d707SAtsushi Nemoto 
92