]> git.sur5r.net Git - u-boot/blobdiff - board/esd/plu405/plu405.c
ppc4xx: Rework of 4xx serial driver (2)
[u-boot] / board / esd / plu405 / plu405.c
index 04f386f2b9e25ee8378b5c9c44f6da70cbcf7139..f026a7ac3b22d13b7664e901d9f9c753e42ea9a7 100644 (file)
 
 #include <common.h>
 #include <asm/processor.h>
+#include <asm/io.h>
 #include <command.h>
 #include <malloc.h>
 
-/* ------------------------------------------------------------------------- */
 
 #if 0
 #define FPGA_DEBUG
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+extern void lxt971_no_sleep(void);
 
 /* fpga configuration data - gzip compressed and generated by bin2c */
 const unsigned char fpgadata[] =
@@ -46,6 +49,23 @@ const unsigned char fpgadata[] =
 #include "../common/fpga.c"
 
 
+/*
+ * include common auto-update code (for esd boards)
+ */
+#include "../common/auto_update.h"
+
+au_image_t au_image[] = {
+       {"plu405/preinst.img", 0, -1, AU_SCRIPT},
+       {"plu405/u-boot.img", 0xfffc0000, 0x00040000, AU_FIRMWARE},
+       {"plu405/pImage_${bd_type}", 0x00000000, 0x00100000, AU_NAND},
+       {"plu405/pImage.initrd", 0x00100000, 0x00200000, AU_NAND},
+       {"plu405/yaffsmt2.img", 0x00300000, 0x01c00000, AU_NAND},
+       {"plu405/postinst.img", 0, 0, AU_SCRIPT},
+};
+
+int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0]));
+
+
 /* Prototypes */
 int gunzip(void *, int, unsigned char *, unsigned long *);
 
@@ -81,8 +101,6 @@ int board_early_init_f (void)
 }
 
 
-/* ------------------------------------------------------------------------- */
-
 int misc_init_f (void)
 {
        return 0;  /* dummy implementation */
@@ -99,7 +117,10 @@ int misc_init_r (void)
        int index;
        int i;
 
-#if 1 /* test-only */
+       /* adjust flash start and offset */
+       gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
+       gd->bd->bi_flashoffset = 0;
+
        dst = malloc(CFG_FPGA_MAX_SIZE);
        if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
                printf ("GUNZIP ERROR - must RESET board to recover\n");
@@ -163,23 +184,16 @@ int misc_init_r (void)
        /*
         * Reset external DUARTs
         */
-       out32(GPIO0_OR, in32(GPIO0_OR) | CFG_DUART_RST); /* set reset to high */
+       out_be32((void *)GPIO0_OR, in_be32((void *)GPIO0_OR) | CFG_DUART_RST);
        udelay(10); /* wait 10us */
-       out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_DUART_RST); /* set reset to low */
+       out_be32((void *)GPIO0_OR, in_be32((void *)GPIO0_OR) & ~CFG_DUART_RST);
        udelay(1000); /* wait 1ms */
 
-       /*
-        * Set NAND-FLASH GPIO signals to default
-        */
-       out32(GPIO0_OR, in32(GPIO0_OR) & ~(CFG_NAND_CLE | CFG_NAND_ALE));
-       out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND_CE);
-
        /*
         * Enable interrupts in exar duart mcr[3]
         */
        *duart0_mcr = 0x08;
        *duart1_mcr = 0x08;
-#endif
 
        return (0);
 }
@@ -188,10 +202,9 @@ int misc_init_r (void)
 /*
  * Check Board Identity:
  */
-
 int checkboard (void)
 {
-       unsigned char str[64];
+       char str[64];
        int i = getenv_r ("serial#", str, sizeof(str));
 
        puts ("Board: ");
@@ -203,11 +216,9 @@ int checkboard (void)
        }
 
        putc ('\n');
-
        return 0;
 }
 
-/* ------------------------------------------------------------------------- */
 
 long int initdram (int board_type)
 {
@@ -216,25 +227,9 @@ long int initdram (int board_type)
        mtdcr(memcfga, mem_mb0cf);
        val = mfdcr(memcfgd);
 
-#if 0
-       printf("\nmb0cf=%x\n", val); /* test-only */
-       printf("strap=%x\n", mfdcr(strap)); /* test-only */
-#endif
-
        return (4*1024*1024 << ((val & 0x000e0000) >> 17));
 }
 
-/* ------------------------------------------------------------------------- */
-
-int testdram (void)
-{
-       /* TODO: XXX XXX XXX */
-       printf ("test: 16 MB - ok\n");
-
-       return (0);
-}
-
-/* ------------------------------------------------------------------------- */
 
 #ifdef CONFIG_IDE_RESET
 void ide_set_reset(int on)
@@ -254,15 +249,13 @@ void ide_set_reset(int on)
 #endif /* CONFIG_IDE_RESET */
 
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
-#include <linux/mtd/nand.h>
-extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
-
-void nand_init(void)
+void reset_phy(void)
 {
-       nand_probe(CFG_NAND_BASE);
-       if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN) {
-               print_size(nand_dev_desc[0].totlen, "\n");
-       }
-}
+#ifdef CONFIG_LXT971_NO_SLEEP
+
+       /*
+        * Disable sleep mode in LXT971
+        */
+       lxt971_no_sleep();
 #endif
+}