3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/addrspace.h>
27 #include <asm/inca-ip.h>
30 extern uint incaip_get_cpuclk(void);
32 static ulong max_sdram_size(void)
34 /* The only supported SDRAM data width is 16bit.
38 /* The only supported number of SDRAM banks is 4.
42 ulong cfgpb0 = *INCA_IP_SDRAM_MC_CFGPB0;
43 int cols = cfgpb0 & 0xF;
44 int rows = (cfgpb0 & 0xF0) >> 4;
45 ulong size = (1 << (rows + cols)) * CFG_DW * CFG_NB;
50 long int initdram(int board_type)
52 int rows, cols, best_val = *INCA_IP_SDRAM_MC_CFGPB0;
53 ulong size, max_size = 0;
56 asm volatile ("move %0, $25" : "=r" (our_address) :);
58 /* Can't probe for RAM size unless we are running from Flash.
60 if (PHYSADDR(our_address) < PHYSADDR(PHYS_FLASH_1))
62 return max_sdram_size();
65 for (cols = 0x8; cols <= 0xC; cols++)
67 for (rows = 0xB; rows <= 0xD; rows++)
69 *INCA_IP_SDRAM_MC_CFGPB0 = (0x14 << 8) |
71 size = get_ram_size((long *)CFG_SDRAM_BASE,
76 best_val = *INCA_IP_SDRAM_MC_CFGPB0;
82 *INCA_IP_SDRAM_MC_CFGPB0 = best_val;
88 unsigned long chipid = *INCA_IP_WDT_CHIPID;
91 puts ("Board: INCA-IP ");
92 part_num = (chipid >> 12) & 0xffff;
95 printf ("Standard Version, ");
98 printf ("Basic Version, ");
101 printf ("Unknown Part Number 0x%x ", part_num);
105 printf ("Chip V1.%ld, ", (chipid >> 28));
107 printf("CPU Speed %d MHz\n", incaip_get_cpuclk()/1000000);