3 Copyright 2004 Broadcom Corp. All Rights Reserved.
5 This program is free software; you can distribute it and/or modify it
6 under the terms of the GNU General Public License (Version 2) as
7 published by the Free Software Foundation.
9 This program is distributed in the hope it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 * prom.c: PROM library initialization code.
23 #include <linux/init.h>
25 #include <linux/sched.h>
26 #include <linux/bootmem.h>
27 #include <linux/blkdev.h>
28 #include <asm/addrspace.h>
29 #include <asm/bootinfo.h>
33 #include <bcm_map_part.h>
35 #include "boardparms.h"
36 #include "softdsl/AdslCoreDefs.h"
39 //char arcs_cmdline[CL_SIZE] __initdata = {0};
43 char **prom_argv, **prom_envp;
45 extern int do_syslog(int, char *, int);
46 extern void serial_init(void);
47 extern void __init InitNvramInfo( void );
48 extern void kerSysFlashInit( void );
49 extern unsigned long get_nvram_start_addr(void);
50 void __init create_root_nfs_cmdline( char *cmdline );
52 #define MACH_BCM MACH_BCM96348
54 const char *get_system_type(void)
56 /*PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
58 return( pNvramData->szBoardId );*/
62 unsigned long getMemorySize(void)
64 unsigned long ulSdramType = BOARD_SDRAM_TYPE;
66 unsigned long ulSdramSize;
70 case BP_MEMORY_16MB_1_CHIP:
71 case BP_MEMORY_16MB_2_CHIP:
72 ulSdramSize = 16 * 1024 * 1024;
74 case BP_MEMORY_32MB_1_CHIP:
75 case BP_MEMORY_32MB_2_CHIP:
76 ulSdramSize = 32 * 1024 * 1024;
78 case BP_MEMORY_64MB_2_CHIP:
79 ulSdramSize = 64 * 1024 * 1024;
82 ulSdramSize = 8 * 1024 * 1024;
85 if (boot_loader_type == BOOT_CFE)
88 // assume that there is one contiguous memory map
89 return boot_mem_map.map[0].size;
92 /* --------------------------------------------------------------------------
94 -------------------------------------------------------------------------- */
95 void __init prom_init(void)
97 extern ulong r4k_interval;
102 prom_argv = (char **) fw_arg1;
103 prom_envp = (char **) fw_arg2;
105 if ((prom_argv > 0x80000000) && (prom_argv < 0x82000000)) {
106 strncpy(arcs_cmdline, prom_argv[1], CL_SIZE);
109 if (strncmp(arcs_cmdline, "boot_loader=RedBoot", 19) != 0) {
110 boot_loader_type = BOOT_CFE;
113 boot_loader_type = BOOT_REDBOOT;
116 do_syslog(8, NULL, 8);
118 printk( "%s prom init\n", get_system_type() );
122 arcs_cmdline[0] = '\0';
124 if (boot_loader_type == BOOT_CFE)
125 add_memory_region(0, (getMemorySize() - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
127 add_memory_region(0, (0x01000000 - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
129 mips_machgroup = MACH_GROUP_BRCM;
130 mips_machtype = MACH_BCM;
132 BpSetBoardId("96348GW-10");
135 /* --------------------------------------------------------------------------
136 Name: prom_free_prom_memory
138 -------------------------------------------------------------------------- */
139 void __init prom_free_prom_memory(void)