1 /*****************************************************************************
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2003 ADMtek Incorporated.
5 * daniell@admtek.com.tw
6 * Copyright (C) 2007 OpenWrt.org
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *****************************************************************************/
23 #include <linux/init.h>
24 #include <linux/autoconf.h>
25 #include <linux/kernel.h>
26 #include <linux/string.h>
28 #include <linux/bootmem.h>
30 #include <asm/bootinfo.h>
31 #include <asm/addrspace.h>
33 #include <asm/mach-adm5120/adm5120_info.h>
35 void setup_prom_printf(int);
36 void prom_printf(char *, ...);
37 void prom_meminit(void);
39 #define ADM5120_ENVC 1
41 char *adm5120_envp
[2*ADM5120_ENVC
] = {"memsize","0x001000000"};
43 #define READCSR(r) *(volatile unsigned long *)(0xB2600000+(r))
44 #define WRITECSR(r,v) *(volatile unsigned long *)(0xB2600000+(r)) = v
46 #define UART_DR_REG 0x00
47 #define UART_FR_REG 0x18
48 #define UART_TX_FIFO_FULL 0x20
50 int putPromChar(char c
)
52 WRITECSR(UART_DR_REG
, c
);
53 while ( (READCSR(UART_FR_REG
) & UART_TX_FIFO_FULL
) );
58 * Ugly prom_printf used for debugging
61 void prom_printf(char *fmt
, ...)
69 l
= vsprintf(buf
, fmt
, args
); /* hopefully i < sizeof(buf) */
74 for (p
= buf
; p
< buf_end
; p
++) {
75 /* Crude cr/nl handling is better than none */
82 char *prom_getenv(char *envname
)
88 printk(KERN_INFO
"GETENV: envname is %s\n", envname
);
90 while(index
< (2*ADM5120_ENVC
)) {
91 if(strncmp(envname
, adm5120_envp
[index
], i
) == 0) {
92 printk(KERN_INFO
"GETENV: returning %s\n", adm5120_envp
[index
+1]);
93 return(adm5120_envp
[index
+1]);
98 printk(KERN_INFO
"GETENV: not found.\n");
104 * initialize the prom module.
106 void __init
prom_init(void)
110 /* you should these macros defined in include/asm/bootinfo.h */
111 mips_machgroup
= MACH_GROUP_ADM5120
;
112 mips_machtype
= adm5120_board
.mach_type
;
114 /* init command line, register a default kernel command line */
115 strcpy(&(arcs_cmdline
[0]), CONFIG_CMDLINE
);
117 /* init memory map */
This page took 0.048723 seconds and 5 git commands to generate.