2003-03-27 12:09:35 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2003
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2008-08-31 17:16:59 +00:00
|
|
|
#include <netdev.h>
|
2003-03-27 12:09:35 +00:00
|
|
|
#include <asm/addrspace.h>
|
|
|
|
#include <asm/inca-ip.h>
|
2007-11-13 08:11:05 +00:00
|
|
|
#include <asm/io.h>
|
2008-03-25 12:30:07 +00:00
|
|
|
#include <asm/reboot.h>
|
2003-03-27 12:09:35 +00:00
|
|
|
|
2003-03-31 16:34:49 +00:00
|
|
|
extern uint incaip_get_cpuclk(void);
|
|
|
|
|
2008-03-25 12:30:07 +00:00
|
|
|
void _machine_restart(void)
|
|
|
|
{
|
|
|
|
*INCA_IP_WDT_RST_REQ = 0x3f;
|
|
|
|
}
|
|
|
|
|
2003-03-27 12:09:35 +00:00
|
|
|
static ulong max_sdram_size(void)
|
|
|
|
{
|
|
|
|
/* The only supported SDRAM data width is 16bit.
|
|
|
|
*/
|
2008-10-16 13:01:15 +00:00
|
|
|
#define CONFIG_SYS_DW 2
|
2003-03-27 12:09:35 +00:00
|
|
|
|
|
|
|
/* The only supported number of SDRAM banks is 4.
|
|
|
|
*/
|
2008-10-16 13:01:15 +00:00
|
|
|
#define CONFIG_SYS_NB 4
|
2003-03-27 12:09:35 +00:00
|
|
|
|
|
|
|
ulong cfgpb0 = *INCA_IP_SDRAM_MC_CFGPB0;
|
|
|
|
int cols = cfgpb0 & 0xF;
|
|
|
|
int rows = (cfgpb0 & 0xF0) >> 4;
|
2008-10-16 13:01:15 +00:00
|
|
|
ulong size = (1 << (rows + cols)) * CONFIG_SYS_DW * CONFIG_SYS_NB;
|
2003-03-27 12:09:35 +00:00
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2008-06-09 21:03:40 +00:00
|
|
|
phys_size_t initdram(int board_type)
|
2003-03-27 12:09:35 +00:00
|
|
|
{
|
|
|
|
int rows, cols, best_val = *INCA_IP_SDRAM_MC_CFGPB0;
|
|
|
|
ulong size, max_size = 0;
|
|
|
|
ulong our_address;
|
|
|
|
|
|
|
|
asm volatile ("move %0, $25" : "=r" (our_address) :);
|
|
|
|
|
|
|
|
/* Can't probe for RAM size unless we are running from Flash.
|
|
|
|
*/
|
2008-06-05 13:29:00 +00:00
|
|
|
if (CPHYSADDR(our_address) < CPHYSADDR(PHYS_FLASH_1))
|
2003-03-27 12:09:35 +00:00
|
|
|
{
|
|
|
|
return max_sdram_size();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (cols = 0x8; cols <= 0xC; cols++)
|
|
|
|
{
|
|
|
|
for (rows = 0xB; rows <= 0xD; rows++)
|
|
|
|
{
|
|
|
|
*INCA_IP_SDRAM_MC_CFGPB0 = (0x14 << 8) |
|
|
|
|
(rows << 4) | cols;
|
2008-10-16 13:01:15 +00:00
|
|
|
size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
|
2003-03-27 12:09:35 +00:00
|
|
|
max_sdram_size());
|
|
|
|
|
|
|
|
if (size > max_size)
|
|
|
|
{
|
|
|
|
best_val = *INCA_IP_SDRAM_MC_CFGPB0;
|
|
|
|
max_size = size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*INCA_IP_SDRAM_MC_CFGPB0 = best_val;
|
|
|
|
return max_size;
|
|
|
|
}
|
|
|
|
|
2003-03-31 16:34:49 +00:00
|
|
|
int checkboard (void)
|
|
|
|
{
|
|
|
|
unsigned long chipid = *INCA_IP_WDT_CHIPID;
|
|
|
|
int part_num;
|
|
|
|
|
|
|
|
puts ("Board: INCA-IP ");
|
|
|
|
part_num = (chipid >> 12) & 0xffff;
|
|
|
|
switch (part_num) {
|
|
|
|
case 0xc0:
|
|
|
|
printf ("Standard Version, ");
|
|
|
|
break;
|
|
|
|
case 0xc1:
|
|
|
|
printf ("Basic Version, ");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf ("Unknown Part Number 0x%x ", part_num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf ("Chip V1.%ld, ", (chipid >> 28));
|
|
|
|
|
|
|
|
printf("CPU Speed %d MHz\n", incaip_get_cpuclk()/1000000);
|
|
|
|
|
2007-11-13 08:11:05 +00:00
|
|
|
set_io_port_base(0);
|
|
|
|
|
2003-03-31 16:34:49 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-08-31 17:16:59 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_INCA_IP_SWITCH)
|
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return inca_switch_initialize(bis);
|
|
|
|
}
|
|
|
|
#endif
|