| 1 | /* |
| 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. |
| 6 | * |
| 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. |
| 11 | * |
| 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. |
| 15 | * |
| 16 | * Copyright 2007 John Crispin <blogic@openwrt.org> |
| 17 | */ |
| 18 | |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/string.h> |
| 21 | #include <linux/ctype.h> |
| 22 | #include <linux/kernel.h> |
| 23 | #include <linux/mm.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> |
| 30 | #include <asm/cpu.h> |
| 31 | |
| 32 | void prom_putchar(char c) |
| 33 | { |
| 34 | /* Wait for FIFO to empty */ |
| 35 | while ((amazon_readl(AMAZON_ASC_FSTAT) >> 8) != 0x00) ; |
| 36 | /* Crude cr/nl handling is better than none */ |
| 37 | if(c == '\n') |
| 38 | amazon_writel('\r', AMAZON_ASC_TBUF); |
| 39 | amazon_writel(c, AMAZON_ASC_TBUF); |
| 40 | } |
| 41 | |
| 42 | void __init prom_init(void) |
| 43 | { |
| 44 | char **envp = (char **) fw_arg2; |
| 45 | |
| 46 | int memsize = 16; /* assume 16M as default */ |
| 47 | |
| 48 | envp = (char **)KSEG1ADDR((unsigned long)envp); |
| 49 | while (*envp) { |
| 50 | char *e = (char *)KSEG1ADDR(*envp); |
| 51 | |
| 52 | if (!strncmp(e, "memsize=", 8)) { |
| 53 | e += 8; |
| 54 | memsize = simple_strtoul(e, NULL, 10); |
| 55 | } |
| 56 | envp++; |
| 57 | } |
| 58 | memsize *= 1024 * 1024; |
| 59 | |
| 60 | strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2"); |
| 61 | |
| 62 | add_memory_region(0x00000000, memsize, BOOT_MEM_RAM); |
| 63 | } |
| 64 | |
| 65 | void prom_free_prom_memory(void) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | const char *get_system_type(void) |
| 70 | { |
| 71 | return BOARD_SYSTEM_TYPE; |
| 72 | } |
| 73 | |