rename CFG_ENV macros to CONFIG_ENV
[platform/kernel/u-boot.git] / board / pcs440ep / pcs440ep.c
index 696423e..2140582 100644 (file)
@@ -30,6 +30,7 @@
 #include <spd_sdram.h>
 #include <status_led.h>
 #include <sha1.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -174,7 +175,7 @@ int board_early_init_f(void)
         *-------------------------------------------------------------------*/
        mfsdr(sdr_pci0, reg);
        mtsdr(sdr_pci0, 0x80000000 | reg);      /* PCI arbiter enabled */
-       mtsdr(sdr_pfc0, 0x00000100);    /* Pin function: enable GPIO49-63 */
+       mtsdr(sdr_pfc0, 0x00000000);    /* Pin function: enable GPIO49-63 */
        mtsdr(sdr_pfc1, 0x00048000);    /* Pin function: UART0 has 4 pins, select IRQ5 */
 
        return 0;
@@ -490,8 +491,8 @@ int misc_init_r (void)
 
        /* Env protection ON by default */
        (void)flash_protect(FLAG_PROTECT_SET,
-                           CFG_ENV_ADDR_REDUND,
-                           CFG_ENV_ADDR_REDUND + 2*CFG_ENV_SECT_SIZE - 1,
+                           CONFIG_ENV_ADDR_REDUND,
+                           CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1,
                            &flash_info[1]);
 
        pcs440ep_readinputs ();
@@ -536,7 +537,7 @@ void spd_ddr_init_hang (void)
        }
 }
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
        long dram_size = 0;
 
@@ -552,44 +553,6 @@ long int initdram (int board_type)
        return dram_size;
 }
 
-#if defined(CFG_DRAM_TEST)
-int testdram(void)
-{
-       unsigned long *mem = (unsigned long *)0;
-       const unsigned long kend = (1024 / sizeof(unsigned long));
-       unsigned long k, n;
-
-       mtmsr(0);
-
-       for (k = 0; k < CFG_KBYTES_SDRAM;
-            ++k, mem += (1024 / sizeof(unsigned long))) {
-               if ((k & 1023) == 0) {
-                       printf("%3d MB\r", k / 1024);
-               }
-
-               memset(mem, 0xaaaaaaaa, 1024);
-               for (n = 0; n < kend; ++n) {
-                       if (mem[n] != 0xaaaaaaaa) {
-                               printf("SDRAM test fails at: %08x\n",
-                                      (uint) & mem[n]);
-                               return 1;
-                       }
-               }
-
-               memset(mem, 0x55555555, 1024);
-               for (n = 0; n < kend; ++n) {
-                       if (mem[n] != 0x55555555) {
-                               printf("SDRAM test fails at: %08x\n",
-                                      (uint) & mem[n]);
-                               return 1;
-                       }
-               }
-       }
-       printf("SDRAM test passes\n");
-       return 0;
-}
-#endif
-
 /*************************************************************************
  *  pci_pre_init
  *
@@ -797,8 +760,8 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD(
-       led,    2,      1,      do_led,
-       "led [bitmask]   - set the DIAG-LED\n",
+       led,    2,      1,      do_led,
+       "led [bitmask]   - set the DIAG-LED\n",
        "[bitmask] 0x01 = DIAG 1 on\n"
        "              0x02 = DIAG 2 on\n"
        "              0x04 = DIAG 3 on\n"
@@ -859,14 +822,37 @@ int do_sha1 (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD(
-       sha1,   4,      1,      do_sha1,
-       "sha1    - calculate the SHA1 Sum\n",
+       sha1,   4,      1,      do_sha1,
+       "sha1    - calculate the SHA1 Sum\n",
        "address len [addr]  calculate the SHA1 sum [save at addr]\n"
        "     -p calculate the SHA1 sum from the U-Boot image in flash and print\n"
        "     -c check the U-Boot image in flash\n"
 );
 #endif
 
+#if defined (CONFIG_CMD_IDE)
+/* These addresses need to be shifted one place to the left
+ * ( bus per_addr 20 -30 is connectsd on CF bus A10-A0)
+ * These values are shifted
+ */
+extern ulong *ide_bus_offset;
+void inline ide_outb(int dev, int port, unsigned char val)
+{
+       debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
+               dev, port, val, (ATA_CURR_BASE(dev)+port));
+
+       out_be16((u16 *)(ATA_CURR_BASE(dev)+(port << 1)), val);
+}
+unsigned char inline ide_inb(int dev, int port)
+{
+       uchar val;
+       val = in_be16((u16 *)(ATA_CURR_BASE(dev)+(port << 1)));
+       debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
+               dev, port, (ATA_CURR_BASE(dev)+port), val);
+       return (val);
+}
+#endif
+
 #ifdef CONFIG_IDE_PREINIT
 int ide_preinit (void)
 {
@@ -879,7 +865,7 @@ int ide_preinit (void)
 }
 #endif
 
-#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
+#if defined (CONFIG_CMD_IDE) && defined (CONFIG_IDE_RESET)
 void ide_set_reset (int idereset)
 {
        debug ("ide_reset(%d)\n", idereset);
@@ -890,4 +876,4 @@ void ide_set_reset (int idereset)
        }
        udelay (10000);
 }
-#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
+#endif /* defined (CONFIG_CMD_IDE) && defined (CONFIG_IDE_RESET) */