]> git.sur5r.net Git - u-boot/blobdiff - board/incaip/incaip.c
Merge branch 'master' of git://www.denx.de/git/u-boot-mips
[u-boot] / board / incaip / incaip.c
index 72f1c21512fbd6ffb8738efa191273351d573015..ac7ad8f292e438b00aa36607c8054d40a64cf373 100644 (file)
 #include <command.h>
 #include <asm/addrspace.h>
 #include <asm/inca-ip.h>
+#include <asm/io.h>
+#include <asm/reboot.h>
 
+extern uint incaip_get_cpuclk(void);
+
+void _machine_restart(void)
+{
+       *INCA_IP_WDT_RST_REQ = 0x3f;
+}
 
 static ulong max_sdram_size(void)
 {
@@ -45,53 +53,7 @@ static ulong max_sdram_size(void)
        return size;
 }
 
-/*
- * Check memory range for valid RAM. A simple memory test determines
- * the actually available RAM size between addresses `base' and
- * `base + maxsize'. Some (not all) hardware errors are detected:
- * - short between address lines
- * - short between data lines
- */
-
-static long int dram_size(long int *base, long int maxsize)
-{
-       volatile long int *addr;
-       ulong cnt, val;
-       ulong save[32];                 /* to make test non-destructive */
-       unsigned char i = 0;
-
-       for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
-               addr = base + cnt;              /* pointer arith! */
-
-               save[i++] = *addr;
-               *addr = ~cnt;
-       }
-
-       /* write 0 to base address */
-       addr = base;
-       save[i] = *addr;
-       *addr = 0;
-
-       /* check at base address */
-       if ((val = *addr) != 0) {
-               *addr = save[i];
-               return (0);
-       }
-
-       for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
-               addr = base + cnt;              /* pointer arith! */
-
-               val = *addr;
-               *addr = save[--i];
-
-               if (val != (~cnt)) {
-                       return (cnt * sizeof (long));
-               }
-       }
-       return (maxsize);
-}
-
-long int initdram(int board_type)
+phys_size_t initdram(int board_type)
 {
        int   rows, cols, best_val = *INCA_IP_SDRAM_MC_CFGPB0;
        ulong size, max_size       = 0;
@@ -101,7 +63,7 @@ long int initdram(int board_type)
 
                /* Can't probe for RAM size unless we are running from Flash.
                 */
-       if (PHYSADDR(our_address) < PHYSADDR(PHYS_FLASH_1))
+       if (CPHYSADDR(our_address) < CPHYSADDR(PHYS_FLASH_1))
        {
                return max_sdram_size();
        }
@@ -112,7 +74,7 @@ long int initdram(int board_type)
                {
                        *INCA_IP_SDRAM_MC_CFGPB0 = (0x14 << 8) |
                                                   (rows << 4) | cols;
-                       size = dram_size((ulong *)CFG_SDRAM_BASE,
+                       size = get_ram_size((long *)CFG_SDRAM_BASE,
                                                             max_sdram_size());
 
                        if (size > max_size)
@@ -127,3 +89,30 @@ long int initdram(int board_type)
        return max_size;
 }
 
+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);
+
+       set_io_port_base(0);
+
+       return 0;
+}