3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/addrspace.h>
12 #include <asm/inca-ip.h>
14 #include <asm/reboot.h>
16 extern uint
incaip_get_cpuclk(void);
18 void _machine_restart(void)
20 *INCA_IP_WDT_RST_REQ
= 0x3f;
23 static ulong
max_sdram_size(void)
25 /* The only supported SDRAM data width is 16bit.
27 #define CONFIG_SYS_DW 2
29 /* The only supported number of SDRAM banks is 4.
31 #define CONFIG_SYS_NB 4
33 ulong cfgpb0
= *INCA_IP_SDRAM_MC_CFGPB0
;
34 int cols
= cfgpb0
& 0xF;
35 int rows
= (cfgpb0
& 0xF0) >> 4;
36 ulong size
= (1 << (rows
+ cols
)) * CONFIG_SYS_DW
* CONFIG_SYS_NB
;
41 phys_size_t
initdram(int board_type
)
43 int rows
, cols
, best_val
= *INCA_IP_SDRAM_MC_CFGPB0
;
44 ulong size
, max_size
= 0;
47 asm volatile ("move %0, $25" : "=r" (our_address
) :);
49 /* Can't probe for RAM size unless we are running from Flash.
51 if (CPHYSADDR(our_address
) < CPHYSADDR(PHYS_FLASH_1
))
53 return max_sdram_size();
56 for (cols
= 0x8; cols
<= 0xC; cols
++)
58 for (rows
= 0xB; rows
<= 0xD; rows
++)
60 *INCA_IP_SDRAM_MC_CFGPB0
= (0x14 << 8) |
62 size
= get_ram_size((long *)CONFIG_SYS_SDRAM_BASE
,
67 best_val
= *INCA_IP_SDRAM_MC_CFGPB0
;
73 *INCA_IP_SDRAM_MC_CFGPB0
= best_val
;
79 unsigned long chipid
= *INCA_IP_WDT_CHIPID
;
82 puts ("Board: INCA-IP ");
83 part_num
= (chipid
>> 12) & 0xffff;
86 printf ("Standard Version, ");
89 printf ("Basic Version, ");
92 printf ("Unknown Part Number 0x%x ", part_num
);
96 printf ("Chip V1.%ld, ", (chipid
>> 28));
98 printf("CPU Speed %d MHz\n", incaip_get_cpuclk()/1000000);
105 #if defined(CONFIG_INCA_IP_SWITCH)
106 int board_eth_init(bd_t
*bis
)
108 return inca_switch_initialize(bis
);