]> git.sur5r.net Git - u-boot/blobdiff - board/esd/apc405/apc405.c
Merge branch 'next' of git://git.denx.de/u-boot-mpc83xx
[u-boot] / board / esd / apc405 / apc405.c
index ac9bbb3f45e5be1c33538bc589bc75b4da40f4b6..f13f088d5515e67b618f743070933f2691caea2b 100644 (file)
@@ -5,23 +5,7 @@
  * (C) Copyright 2001-2003
  * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -30,6 +14,7 @@
 #include <command.h>
 #include <malloc.h>
 #include <flash.h>
+#include <mtd/cfi_flash.h>
 #include <asm/4xx_pci.h>
 #include <pci.h>
 
@@ -37,11 +22,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #undef FPGA_DEBUG
 
-extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 extern void lxt971_no_sleep(void);
-extern ulong flash_get_size (ulong base, int banknum);
-
-int flash_banks = CONFIG_SYS_MAX_FLASH_BANKS_DETECT;
 
 /* fpga configuration data - gzip compressed and generated by bin2c */
 const unsigned char fpgadata[] =
@@ -54,9 +35,6 @@ const unsigned char fpgadata[] =
  */
 #include "../common/fpga.c"
 
-/* Prototypes */
-int gunzip(void *, int, unsigned char *, unsigned long *);
-
 #ifdef CONFIG_LCD_USED
 /* logo bitmap data - gzip compressed and generated by bin2c */
 unsigned char logo_bmp[] =
@@ -92,16 +70,16 @@ int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0]));
 
 int board_revision(void)
 {
-       unsigned long cntrl0Reg;
-       volatile unsigned long value;
+       unsigned long CPC0_CR0Reg;
+       unsigned long value;
 
        /*
         * Get version of APC405 board from GPIO's
         */
 
        /* Setup GPIO pins (CS2/GPIO11, CS3/GPIO12 and CS4/GPIO13 as GPIO) */
-       cntrl0Reg = mfdcr(cntrl0);
-       mtdcr(cntrl0, cntrl0Reg | 0x03800000);
+       CPC0_CR0Reg = mfdcr(CPC0_CR0);
+       mtdcr(CPC0_CR0, CPC0_CR0Reg | 0x03800000);
        out_be32((void*)GPIO0_ODR, in_be32((void*)GPIO0_ODR) & ~0x001c0000);
        out_be32((void*)GPIO0_TCR, in_be32((void*)GPIO0_TCR) & ~0x001c0000);
 
@@ -113,7 +91,7 @@ int board_revision(void)
        /*
         * Restore GPIO settings
         */
-       mtdcr(cntrl0, cntrl0Reg);
+       mtdcr(CPC0_CR0, CPC0_CR0Reg);
 
        switch (value) {
        case 0x001c0000:
@@ -155,18 +133,18 @@ int board_early_init_f (void)
         * IRQ 30 (EXT IRQ 5) PCI INTA; active low; level sensitive
         * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
         */
-       mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
-       mtdcr(uicer, 0x00000000);       /* disable all ints */
-       mtdcr(uiccr, 0x00000000);       /* set all to be non-critical*/
-       mtdcr(uicpr, 0xFFFFFF81);       /* set int polarities */
-       mtdcr(uictr, 0x10000000);       /* set int trigger levels */
-       mtdcr(uicvcr, 0x00000001);      /* set vect base=0 */
-       mtdcr(uicsr, 0xFFFFFFFF);       /* clear all ints */
+       mtdcr(UIC0SR, 0xFFFFFFFF);       /* clear all ints */
+       mtdcr(UIC0ER, 0x00000000);       /* disable all ints */
+       mtdcr(UIC0CR, 0x00000000);       /* set all to be non-critical*/
+       mtdcr(UIC0PR, 0xFFFFFF81);       /* set int polarities */
+       mtdcr(UIC0TR, 0x10000000);       /* set int trigger levels */
+       mtdcr(UIC0VCR, 0x00000001);      /* set vect base=0 */
+       mtdcr(UIC0SR, 0xFFFFFFFF);       /* clear all ints */
 
        /*
         * EBC Configuration Register: set ready timeout to 512 ebc-clks
         */
-       mtebc(epcr, 0xa8400000); /* ebc always driven */
+       mtebc(EBC0_CFG, 0xa8400000); /* ebc always driven */
 
        /*
         * New boards have a single 32MB flash connected to CS0
@@ -174,12 +152,12 @@ int board_early_init_f (void)
         */
        if (board_revision() >= 8) {
                /* disable CS1 */
-               mtebc(pb1ap, 0);
-               mtebc(pb1cr, 0);
+               mtebc(PB1AP, 0);
+               mtebc(PB1CR, 0);
 
                /* resize CS0 to 32MB */
-               mtebc(pb0ap, CONFIG_SYS_EBC_PB0AP_HWREV8);
-               mtebc(pb0cr, CONFIG_SYS_EBC_PB0CR_HWREV8);
+               mtebc(PB0AP, CONFIG_SYS_EBC_PB0AP_HWREV8);
+               mtebc(PB0CR, CONFIG_SYS_EBC_PB0CR_HWREV8);
        }
 
        return 0;
@@ -188,7 +166,7 @@ int board_early_init_f (void)
 int board_early_init_r(void)
 {
        if (gd->board_type >= 8)
-               flash_banks = 1;
+               cfi_flash_num_flash_banks = 1;
 
        return 0;
 }
@@ -209,7 +187,7 @@ int misc_init_r(void)
        int status;
        int index;
        int i;
-       unsigned long cntrl0Reg;
+       unsigned long CPC0_CR0Reg;
        char *str;
        uchar *logo_addr;
        ulong logo_size;
@@ -219,8 +197,8 @@ int misc_init_r(void)
        /*
         * Setup GPIO pins (CS6+CS7 as GPIO)
         */
-       cntrl0Reg = mfdcr(cntrl0);
-       mtdcr(cntrl0, cntrl0Reg | 0x00300000);
+       CPC0_CR0Reg = mfdcr(CPC0_CR0);
+       mtdcr(CPC0_CR0, CPC0_CR0Reg | 0x00300000);
 
        dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
        if (gunzip(dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
@@ -265,7 +243,7 @@ int misc_init_r(void)
        }
 
        /* restore gpio/cs settings */
-       mtdcr(cntrl0, cntrl0Reg);
+       mtdcr(CPC0_CR0, CPC0_CR0Reg);
 
        puts("FPGA:  ");
 
@@ -407,7 +385,7 @@ int misc_init_r(void)
 int checkboard (void)
 {
        char str[64];
-       int i = getenv_("serial#", str, sizeof(str));
+       int i = getenv_f("serial#", str, sizeof(str));
 
        puts ("Board: ");