initial merge of infineon code for amazon, pci is still broken a bit. a big thank...
[openwrt/svn-archive/archive.git] / target / linux / amazon-2.6 / files / arch / mips / amazon / prom.c
1 /*
2 * copyright 2007 john crispin <blogic@openwrt.org>
3 */
4 #include <linux/init.h>
5 #include <linux/string.h>
6 #include <linux/ctype.h>
7 #include <linux/kernel.h>
8 #include <linux/mm.h>
9 #include <linux/bootmem.h>
10 #include <linux/ioport.h>
11 #include <asm/bootinfo.h>
12 #include <asm/amazon/amazon.h>
13 #include <asm/amazon/irq.h>
14 #include <asm/amazon/model.h>
15 #include <asm/cpu.h>
16
17 void prom_putchar(char c)
18 {
19 /* Wait for FIFO to empty */
20 while (((*AMAZON_ASC_FSTAT) >> 8) != 0x00) ;
21 /* Crude cr/nl handling is better than none */
22 if(c == '\n')
23 *AMAZON_ASC_TBUF=('\r');
24 *AMAZON_ASC_TBUF=(c);
25 }
26
27 void prom_printf(const char * fmt, ...)
28 {
29 va_list args;
30 int l;
31 char *p, *buf_end;
32 char buf[1024];
33
34 va_start(args, fmt);
35 l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
36 va_end(args);
37 buf_end = buf + l;
38
39 for (p = buf; p < buf_end; p++)
40 prom_putchar(*p);
41 }
42
43
44 void __init prom_init(void)
45 {
46 mips_machgroup = MACH_GROUP_INFINEON;
47 mips_machtype = MACH_INFINEON_AMAZON;
48
49 strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/etc/preinit");
50
51 add_memory_region(0x00000000, 0x1000000, BOOT_MEM_RAM);
52 }
53
54 void prom_free_prom_memory(void)
55 {
56 }
57
58 const char *get_system_type(void)
59 {
60 return BOARD_SYSTEM_TYPE;
61 }