2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright 2007 John Crispin <blogic@openwrt.org>
19 #include <linux/init.h>
20 #include <linux/string.h>
21 #include <linux/ctype.h>
22 #include <linux/kernel.h>
24 #include <linux/bootmem.h>
25 #include <linux/ioport.h>
26 #include <asm/bootinfo.h>
27 #include <asm/amazon/amazon.h>
28 #include <asm/amazon/irq.h>
29 #include <asm/amazon/model.h>
32 void prom_putchar(char c)
34 /* Wait for FIFO to empty */
35 while ((amazon_readl(AMAZON_ASC_FSTAT) >> 8) != 0x00) ;
36 /* Crude cr/nl handling is better than none */
38 amazon_writel('\r', AMAZON_ASC_TBUF);
39 amazon_writel(c, AMAZON_ASC_TBUF);
42 void prom_printf(const char * fmt, ...)
50 /* FIXME - hopefully i < sizeof(buf) */
51 l = vsprintf(buf, fmt, args);
55 for (p = buf; p < buf_end; p++)
60 void __init prom_init(void)
62 char **envp = (char **) fw_arg2;
64 int memsize = 16; /* assume 16M as default */
66 mips_machgroup = MACH_GROUP_INFINEON;
67 mips_machtype = MACH_INFINEON_AMAZON;
69 envp = (char **)KSEG1ADDR((unsigned long)envp);
71 char *e = (char *)KSEG1ADDR(*envp);
73 if (!strncmp(e, "memsize=", 8)) {
75 memsize = simple_strtoul(e, NULL, 10);
79 memsize *= 1024 * 1024;
81 strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2");
83 add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
86 void prom_free_prom_memory(void)
90 const char *get_system_type(void)
92 return BOARD_SYSTEM_TYPE;