45c6e63a175ed3a777ce94abb09392b2e9305b26
3 **********************************************************************
4 * P . Sadik Oct 10, 2003
7 * idt_cpu_freq is make a kernel configuration parameter
8 * idt_cpu_freq is exported so that other modules can use it.
10 **********************************************************************
11 * P. Sadik Oct 20, 2003
13 * Removed NVRAM code from here, since they are already available under
15 * Added serial port initialisation.
16 **********************************************************************
17 **********************************************************************
18 * P. Sadik Oct 30, 2003
20 * Added reset_cons_port
21 **********************************************************************
23 P.Christeas, 2005-2006
24 Port to 2.6, add 2.6 cmdline parsing
28 #include <linux/autoconf.h>
29 #include <linux/init.h>
31 #include <linux/module.h>
32 #include <linux/string.h>
33 #include <linux/console.h>
34 #include <asm/bootinfo.h>
35 #include <linux/bootmem.h>
36 #include <linux/ioport.h>
37 #include <linux/blkdev.h>
38 #include <asm/rc32434/ddr.h>
40 #define PROM_ENTRY(x) (0xbfc00000+((x)*8))
41 extern void __init
setup_serial_port(void);
43 unsigned int idt_cpu_freq
= 132000000;
44 EXPORT_SYMBOL(idt_cpu_freq
);
46 EXPORT_SYMBOL(board_type
);
47 unsigned int gpio_bootup_state
= 0;
48 EXPORT_SYMBOL(gpio_bootup_state
);
51 char mips_mac_address
[18] = "08:00:06:05:40:01";
52 EXPORT_SYMBOL(mips_mac_address
);
54 /* what to append to cmdline when button is [not] pressed */
55 #define GPIO_INIT_NOBUTTON ""
56 #define GPIO_INIT_BUTTON " 2"
58 #ifdef CONFIG_MIKROTIK_RB500
59 unsigned soft_reboot
= 0;
60 EXPORT_SYMBOL(soft_reboot
);
63 #define SR_NMI 0x00180000 /* NMI */
64 #define SERIAL_SPEED_ENTRY 0x00000001
66 #ifdef CONFIG_REMOTE_DEBUG
67 extern int remote_debug
;
70 extern unsigned long mips_machgroup
;
71 extern unsigned long mips_machtype
;
73 #define FREQ_TAG "HZ="
74 #define GPIO_TAG "gpio="
75 #define KMAC_TAG "kmac="
76 #define MEM_TAG "mem="
77 #define BOARD_TAG "board="
78 #define IGNORE_CMDLINE_MEM 1
81 void parse_soft_settings(unsigned *ptr
, unsigned size
);
82 void parse_hard_settings(unsigned *ptr
, unsigned size
);
84 void __init
prom_setup_cmdline(void);
86 void __init
prom_init(void)
88 DDR_t ddr
= (DDR_t
) DDR_VirtualAddress
; /* define the pointer to the DDR registers */
89 phys_t memsize
= 0-ddr
->ddrmask
;
91 /* this should be the very first message, even before serial is properly initialized */
95 mips_machgroup
= MACH_GROUP_MIKROTIK
;
96 soft_reboot
= read_c0_status() & SR_NMI
;
100 * give all RAM to boot allocator,
101 * except for the first 0x400 and the last 0x200 bytes
103 add_memory_region(ddr
->ddrbase
+ 0x400, memsize
- 0x600, BOOT_MEM_RAM
);
106 void __init
prom_free_prom_memory(void)
108 /* No prom memory to free */
111 extern char _image_cmdline
;
112 void __init
prom_setup_cmdline(void){
113 char cmd_line
[CL_SIZE
];
116 char **prom_argv
, **prom_envp
;
120 prom_argv
= (char **) fw_arg1
;
121 prom_envp
= (char **) fw_arg2
;
124 /* Note: it is common that parameters start at argv[1] and not argv[0],
125 however, our elf loader starts at [0] */
126 for(i
=0;i
<prom_argc
;i
++){
127 if (strncmp(prom_argv
[i
], FREQ_TAG
, sizeof(FREQ_TAG
) - 1) == 0) {
128 idt_cpu_freq
= simple_strtoul(prom_argv
[i
] + sizeof(FREQ_TAG
) - 1, 0, 10);
131 #ifdef IGNORE_CMDLINE_MEM
132 /* parses out the "mem=xx" arg */
133 if (strncmp(prom_argv
[i
], MEM_TAG
, sizeof(MEM_TAG
) - 1) == 0) {
137 if (i
>0) *(cp
++) = ' ';
138 if (strncmp(prom_argv
[i
], BOARD_TAG
, sizeof(BOARD_TAG
) - 1) == 0) {
139 strcpy(board_type
, prom_argv
[i
] + sizeof(BOARD_TAG
) -1);
141 if (strncmp(prom_argv
[i
], GPIO_TAG
, sizeof(GPIO_TAG
) - 1) == 0) {
142 gpio_bootup_state
= simple_strtoul(prom_argv
[i
] + sizeof(GPIO_TAG
) - 1, 0, 10);
144 strcpy(cp
,prom_argv
[i
]);
145 cp
+=strlen(prom_argv
[i
]);
148 strcpy(cp
,(&_image_cmdline
+ 8));
149 cp
+= strlen(&_image_cmdline
);
151 i
=strlen(arcs_cmdline
);
154 strcpy(cp
,arcs_cmdline
);
155 cp
+=strlen(arcs_cmdline
);
157 if (gpio_bootup_state
&0x02)
158 strcpy(cp
,GPIO_INIT_NOBUTTON
);
160 strcpy(cp
,GPIO_INIT_BUTTON
);
161 cmd_line
[CL_SIZE
-1] = '\0';
163 strcpy(arcs_cmdline
,cmd_line
);
This page took 0.050602 seconds and 3 git commands to generate.