b70a0e70e4b3478ae8e75d4c5994dba06401990e
[openwrt.git] / target / linux / aruba-2.6 / files / arch / mips / aruba / prom.c
1 /**************************************************************************
2  *
3  *  BRIEF MODULE DESCRIPTION
4  *     prom interface routines
5  *
6  *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7  *         
8  *  This program is free software; you can redistribute  it and/or modify it
9  *  under  the terms of  the GNU General  Public License as published by the
10  *  Free Software Foundation;  either version 2 of the  License, or (at your
11  *  option) any later version.
12  *
13  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
15  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
16  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
17  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
19  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
21  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  *  You should have received a copy of the  GNU General Public License along
25  *  with this program; if not, write  to the Free Software Foundation, Inc.,
26  *  675 Mass Ave, Cambridge, MA 02139, USA.
27  *
28  *
29  **************************************************************************
30  * May 2004 rkt, neb
31  *
32  * Initial Release
33  *
34  * 
35  *
36  **************************************************************************
37  */
38
39 #include <linux/autoconf.h>
40 #include <linux/init.h>
41 #include <linux/mm.h>
42 #include <linux/module.h>
43 #include <linux/string.h>
44 #include <linux/console.h>
45 #include <asm/bootinfo.h>
46 #include <linux/bootmem.h>
47 #include <linux/ioport.h>
48 #include <linux/serial.h>
49 #include <linux/serialP.h>
50 #include <asm/serial.h>
51 #include <linux/ioport.h>
52
53 unsigned int idt_cpu_freq;
54 EXPORT_SYMBOL(idt_cpu_freq);
55
56 unsigned int arch_has_pci=0;
57
58 /* Kernel Boot parameters */
59 static unsigned char bootparm[] = 
60         "init=/etc/preinit noinitrd "
61         "mtdparts=physmap-flash.0:3520k@0x080000(kernel),2752k@0x140000(rootfs),8k@0x3f8000(NVRAM) "
62         "console=ttyS0,9600 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 ";
63
64 extern unsigned long mips_machgroup;
65 extern unsigned long mips_machtype;
66
67 extern void setup_serial_port(void);
68 extern char * getenv(char *e);
69
70 /* IDT 79EB434 memory map -- we really should be auto sizing it */
71 #define RAM_SIZE        32*1024*1024
72
73 char *__init prom_getcmdline(void)
74 {
75         return &(arcs_cmdline[0]);
76 }
77
78 void __init prom_init(void)
79 {
80         char *boardname;
81         sprintf(arcs_cmdline, "%s", bootparm);
82
83         /* set our arch type */
84         mips_machgroup = MACH_GROUP_ARUBA;
85         mips_machtype = MACH_ARUBA_UNKNOWN;
86
87         boardname=getenv("boardname");
88
89         if (!strcmp(boardname,"Muscat")) {
90                 mips_machtype = MACH_ARUBA_AP70;
91                 idt_cpu_freq = 133000000;
92                 arch_has_pci=1;
93         } else if (!strcmp(boardname,"Mataro")) {
94                 mips_machtype = MACH_ARUBA_AP65;
95                 idt_cpu_freq = 110000000;
96         } else if (!strcmp(boardname,"Merlot")) {
97                 mips_machtype = MACH_ARUBA_AP60;
98                 idt_cpu_freq = 90000000;
99         }
100
101         /* turn on the console */
102         setup_serial_port();
103
104         /*
105          * give all RAM to boot allocator,
106          * except where the kernel was loaded
107          */
108         add_memory_region(0,RAM_SIZE,BOOT_MEM_RAM);
109 }
110
111 void prom_free_prom_memory(void)
112 {
113         printk("stubbed prom_free_prom_memory()\n");
114 }