enable start-stop-daemon by default, i want to use this to clean up a few init script...
[openwrt/openwrt.git] / target / linux / amazon-2.6 / files / arch / mips / amazon / prom.c
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 prom_printf(const char * fmt, ...)
43 {
44 va_list args;
45 int l;
46 char *p, *buf_end;
47 char buf[1024];
48
49 va_start(args, fmt);
50 /* FIXME - hopefully i < sizeof(buf) */
51 l = vsprintf(buf, fmt, args);
52 va_end(args);
53 buf_end = buf + l;
54
55 for (p = buf; p < buf_end; p++)
56 prom_putchar(*p);
57 }
58
59
60 void __init prom_init(void)
61 {
62 mips_machgroup = MACH_GROUP_INFINEON;
63 mips_machtype = MACH_INFINEON_AMAZON;
64
65 strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/etc/preinit");
66
67 add_memory_region(0x00000000, 0x1000000, BOOT_MEM_RAM);
68 }
69
70 void prom_free_prom_memory(void)
71 {
72 }
73
74 const char *get_system_type(void)
75 {
76 return BOARD_SYSTEM_TYPE;
77 }