]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/fads/fads.c
rename CFG_ macros to CONFIG_SYS
[karo-tx-uboot.git] / board / fads / fads.c
index 150714636650cdb451812336cea2d183f6d26a67..278fa2ab2e2b331062cdacf5ab2db40f9fd2f56a 100644 (file)
 #include <config.h>
 #include <common.h>
 #include <mpc8xx.h>
+#include <pcmcia.h>
 
 #define        _NOT_USED_      0xFFFFFFFF
 
 /* ========================================================================= */
 
-#ifndef CONFIG_DUET_ADS /* No old DRAM on Duet */
+#ifndef CONFIG_MPC885ADS /* No old DRAM on MPC885ADS */
 
 #if defined(CONFIG_DRAM_50MHZ)
 /* 50MHz tables */
@@ -189,7 +190,7 @@ static const uint edo_70ns[] =
 /* ------------------------------------------------------------------------- */
 static int _draminit (uint base, uint noMbytes, uint edo, uint delay)
 {
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        /* init upm */
@@ -282,7 +283,7 @@ static int _draminit (uint base, uint noMbytes, uint edo, uint delay)
 
 static void _dramdisable(void)
 {
-       volatile immap_t     *immap = (immap_t *)CFG_IMMR;
+       volatile immap_t     *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        memctl->memc_br2 = 0x00000000;
@@ -290,7 +291,7 @@ static void _dramdisable(void)
 
        /* maybe we should turn off upma here or something */
 }
-#endif /* !CONFIG_DUET_ADS */
+#endif /* !CONFIG_MPC885ADS */
 
 /* ========================================================================= */
 
@@ -422,7 +423,7 @@ static const uint sdram_table[] =
 
 static int _initsdram(uint base, uint noMbytes)
 {
-       volatile immap_t     *immap = (immap_t *)CFG_IMMR;
+       volatile immap_t     *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        upmconfig(UPMB, (uint *)sdram_table,sizeof(sdram_table)/sizeof(uint));
@@ -500,7 +501,7 @@ static int _initsdram(uint base, uint noMbytes)
 
 static int _initsdram(uint base, uint noMbytes)
 {
-       volatile immap_t     *immap = (immap_t *)CFG_IMMR;
+       volatile immap_t     *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        upmconfig(UPMB, (uint *)sdram_table,sizeof(sdram_table)/sizeof(uint));
@@ -563,7 +564,7 @@ static int _initsdram(uint base, uint noMbytes)
 
 static void _sdramdisable(void)
 {
-       volatile immap_t     *immap = (immap_t *)CFG_IMMR;
+       volatile immap_t     *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        memctl->memc_br4 = 0x00000000;
@@ -575,7 +576,7 @@ static void _sdramdisable(void)
 
 static int initsdram(uint base, uint *noMbytes)
 {
-       uint m = CFG_SDRAM_SIZE>>20;
+       uint m = CONFIG_SYS_SDRAM_SIZE>>20;
 
        /* _initsdram needs access to sdram */
        *((uint *)BCSR1) |= BCSR1_SDRAM_EN; /* enable sdram */
@@ -599,12 +600,12 @@ static int initsdram(uint base, uint *noMbytes)
 
 /* ========================================================================= */
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
        uint sdramsz = 0;       /* size of sdram in Mbytes */
        uint base = 0;          /* base of dram in bytes */
        uint m = 0;             /* size of dram in Mbytes */
-#ifndef CONFIG_DUET_ADS
+#ifndef CONFIG_MPC885ADS
        uint k, s;
 #endif
 
@@ -614,7 +615,7 @@ long int initdram (int board_type)
                printf ("(%u MB SDRAM) ", sdramsz);
        }
 #endif
-#ifndef CONFIG_DUET_ADS /* No old DRAM on Duet */
+#ifndef CONFIG_MPC885ADS /* No old DRAM on MPC885ADS */
        k = (*((uint *) BCSR2) >> 23) & 0x0f;
 
        switch (k & 0x3) {
@@ -665,7 +666,7 @@ long int initdram (int board_type)
                _dramdisable ();
                m = 0;
        }
-#endif /* !CONFIG_DUET_ADS */
+#endif /* !CONFIG_MPC885ADS */
        m += sdramsz;                           /* add sdram size to total */
 
        return (m << 20);
@@ -687,7 +688,7 @@ int testdram (void)
  * Check Board Identity:
  */
 
-#if defined(CONFIG_FADS) && defined(CFG_DAUGHTERBOARD)
+#if defined(CONFIG_FADS) && defined(CONFIG_SYS_DAUGHTERBOARD)
 static void checkdboard(void)
 {
        /* get db type from BCSR 3 */
@@ -721,28 +722,27 @@ static void checkdboard(void)
        default : printf("0x%x", k);
        }
 }
-#endif /* defined(CONFIG_FADS) && defined(CFG_DAUGHTERBOARD) */
+#endif /* defined(CONFIG_FADS) && defined(CONFIG_SYS_DAUGHTERBOARD) */
 
 int checkboard (void)
 {
-       /* get revision from BCSR 3 */
+#if   defined(CONFIG_MPC86xADS)
+       puts ("Board: MPC86xADS\n");
+#elif defined(CONFIG_MPC885ADS)
+       puts ("Board: MPC885ADS\n");
+#else /* Only old ADS/FADS have got revision ID in BCSR3 */
        uint r =  (((*((uint *) BCSR3) >> 23) & 1) << 3)
                | (((*((uint *) BCSR3) >> 19) & 1) << 2)
                | (((*((uint *) BCSR3) >> 16) & 3));
 
        puts ("Board: ");
-
-#if defined(CONFIG_MPC86xADS)
-       puts ("MPC86xADS");
-#elif defined(CONFIG_DUET_ADS)
-       puts ("DUET ADS");
-       r = 0; /* I've got NR (No Revision) board */
-#elif defined(CONFIG_FADS)
+#if defined(CONFIG_FADS)
        puts ("FADS");
        checkdboard ();
 #else
        puts ("ADS");
 #endif
+
        puts (" rev ");
 
        switch (r) {
@@ -757,13 +757,9 @@ int checkboard (void)
                puts ("A - warning, read errata \n");
                break;
        case 0x03:
-               puts ("B \n");
-               break;
-#elif defined(CONFIG_DUET_ADS)
-       case 0x00:
-               puts ("NR\n");
+               puts ("B\n");
                break;
-#else  /* FADS and newer */
+#else  /* FADS */
        case 0x00:
                puts ("ENG\n");
                break;
@@ -775,40 +771,41 @@ int checkboard (void)
                printf ("unknown (0x%x)\n", r);
                return -1;
        }
+#endif /* CONFIG_MPC86xADS */
 
        return 0;
 }
 
 /* ========================================================================= */
 
-#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
+#if defined(CONFIG_CMD_PCMCIA)
 
-#ifdef CFG_PCMCIA_MEM_ADDR
-volatile unsigned char *pcmcia_mem = (unsigned char*)CFG_PCMCIA_MEM_ADDR;
+#ifdef CONFIG_SYS_PCMCIA_MEM_ADDR
+volatile unsigned char *pcmcia_mem = (unsigned char*)CONFIG_SYS_PCMCIA_MEM_ADDR;
 #endif
 
 int pcmcia_init(void)
 {
        volatile pcmconf8xx_t   *pcmp;
-       uint v, slota, slotb;
+       uint v, slota = 0, slotb = 0;
 
        /*
        ** Enable the PCMCIA for a Flash card.
        */
-       pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
+       pcmp = (pcmconf8xx_t *)(&(((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia));
 
 #if 0
-       pcmp->pcmc_pbr0 = CFG_PCMCIA_MEM_ADDR;
+       pcmp->pcmc_pbr0 = CONFIG_SYS_PCMCIA_MEM_ADDR;
        pcmp->pcmc_por0 = 0xc00ff05d;
 #endif
 
        /* Set all slots to zero by default. */
        pcmp->pcmc_pgcra = 0;
        pcmp->pcmc_pgcrb = 0;
-#ifdef PCMCIA_SLOT_A
+#ifdef CONFIG_PCMCIA_SLOT_A
        pcmp->pcmc_pgcra = 0x40;
 #endif
-#ifdef PCMCIA_SLOT_B
+#ifdef CONFIG_PCMCIA_SLOT_B
        pcmp->pcmc_pgcrb = 0x40;
 #endif
 
@@ -817,17 +814,17 @@ int pcmcia_init(void)
 
        /* Check if any PCMCIA card is plugged in. */
 
+#ifdef CONFIG_PCMCIA_SLOT_A
        slota = (pcmp->pcmc_pipr & 0x18000000) == 0 ;
+#endif
+#ifdef CONFIG_PCMCIA_SLOT_B
        slotb = (pcmp->pcmc_pipr & 0x00001800) == 0 ;
+#endif
 
        if (!(slota || slotb)) {
                printf("No card present\n");
-#ifdef PCMCIA_SLOT_A
                pcmp->pcmc_pgcra = 0;
-#endif
-#ifdef PCMCIA_SLOT_B
                pcmp->pcmc_pgcrb = 0;
-#endif
                return -1;
        }
        else
@@ -847,7 +844,7 @@ int pcmcia_init(void)
        switch ((pcmp->pcmc_pipr >> 14) & 3)
 #endif
        {
-       case 0x00 :
+       case 0x03 :
                printf("5V");
                v = 5;
                break;
@@ -859,7 +856,7 @@ int pcmcia_init(void)
                v = 5;
 #endif
                break;
-       case 0x03 :
+       case 0x00 :
                printf("5V, 3V and x.xV");
 #ifdef CONFIG_FADS
                v = 3; /* User lower voltage if supported! */
@@ -908,9 +905,10 @@ int pcmcia_init(void)
 
        udelay(20);
 
-#ifdef PCMCIA_SLOT_A
+#ifdef CONFIG_PCMCIA_SLOT_A
        pcmp->pcmc_pgcra = 0;
-#elif PCMCIA_SLOT_B
+#endif
+#ifdef CONFIG_PCMCIA_SLOT_B
        pcmp->pcmc_pgcrb = 0;
 #endif
 
@@ -923,29 +921,29 @@ int pcmcia_init(void)
        return 0;
 }
 
-#endif /* CFG_CMD_PCMCIA */
+#endif
 
 /* ========================================================================= */
 
-#ifdef CFG_PC_IDE_RESET
+#ifdef CONFIG_SYS_PC_IDE_RESET
 
 void ide_set_reset(int on)
 {
-       volatile immap_t *immr = (immap_t *)CFG_IMMR;
+       volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
        /*
         * Configure PC for IDE Reset Pin
         */
        if (on) {               /* assert RESET */
-               immr->im_ioport.iop_pcdat &= ~(CFG_PC_IDE_RESET);
+               immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET);
        } else {                /* release RESET */
-               immr->im_ioport.iop_pcdat |=   CFG_PC_IDE_RESET;
+               immr->im_ioport.iop_pcdat |=   CONFIG_SYS_PC_IDE_RESET;
        }
 
        /* program port pin as GPIO output */
-       immr->im_ioport.iop_pcpar &= ~(CFG_PC_IDE_RESET);
-       immr->im_ioport.iop_pcso  &= ~(CFG_PC_IDE_RESET);
-       immr->im_ioport.iop_pcdir |=   CFG_PC_IDE_RESET;
+       immr->im_ioport.iop_pcpar &= ~(CONFIG_SYS_PC_IDE_RESET);
+       immr->im_ioport.iop_pcso  &= ~(CONFIG_SYS_PC_IDE_RESET);
+       immr->im_ioport.iop_pcdir |=   CONFIG_SYS_PC_IDE_RESET;
 }
 
-#endif /* CFG_PC_IDE_RESET */
+#endif /* CONFIG_SYS_PC_IDE_RESET */