Merge branch 'spi' of git://git.denx.de/u-boot-x86
[oweals/u-boot.git] / arch / powerpc / cpu / mpc83xx / ecc.c
index 8dadd64b4255bebba261ca0efde73f3c351acdee..985a024425525637a3b3529ef0cb23da2d197780 100644 (file)
@@ -1,16 +1,10 @@
 /*
- * Copyright (C) 2007 Freescale Semiconductor, Inc.
+ * Copyright (C) 2007-2011 Freescale Semiconductor, Inc.
  *
  * Dave Liu <daveliu@freescale.com>
  * based on the contribution of Marian Balakowicz <m8@semihalf.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.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #if defined(CONFIG_DDR_ECC) && defined(CONFIG_DDR_ECC_CMD)
 void ecc_print_status(void)
 {
-       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-       volatile ddr83xx_t *ddr = &immap->ddr;
+       immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+#ifdef CONFIG_SYS_FSL_DDR2
+       struct ccsr_ddr __iomem *ddr = &immap->ddr;
+#else
+       ddr83xx_t *ddr = &immap->ddr;
+#endif
 
        printf("\nECC mode: %s\n\n",
               (ddr->sdram_cfg & SDRAM_CFG_ECC_EN) ? "ON" : "OFF");
@@ -100,8 +98,12 @@ void ecc_print_status(void)
 
 int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
-       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-       volatile ddr83xx_t *ddr = &immap->ddr;
+       immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+#ifdef CONFIG_SYS_FSL_DDR2
+       struct ccsr_ddr __iomem *ddr = &immap->ddr;
+#else
+       ddr83xx_t *ddr = &immap->ddr;
+#endif
        volatile u32 val;
        u64 *addr;
        u32 count;
@@ -118,10 +120,8 @@ int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        writeback[0] = 0x01234567UL;
        writeback[1] = 0x89abcdefUL;
 
-       if (argc > 4) {
-               cmd_usage(cmdtp);
-               return 1;
-       }
+       if (argc > 4)
+               return cmd_usage(cmdtp);
 
        if (argc == 2) {
                if (strcmp(argv[1], "status") == 0) {
@@ -350,8 +350,7 @@ int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        return 0;
                }
        }
-       cmd_usage(cmdtp);
-       return 1;
+       return cmd_usage(cmdtp);
 }
 
 U_BOOT_CMD(ecc, 4, 0, do_ecc,