]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_source.c
karo: tx51: remove duplicate CONFIG_SYS_SDRAM_CLK definition
[karo-tx-uboot.git] / common / cmd_source.c
index 02a862cc5a353b4c5788de13137c26f40d26b345..54ffd16470e8c9d0c43ba1c209fee241163bdcd1 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2001
  * Kyle Harris, kharris@nexus-tech.net
  *
- * 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+
  */
 
 /*
@@ -36,6 +20,7 @@
 #include <image.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
+#include <asm/io.h>
 #if defined(CONFIG_8xx)
 #include <mpc8xx.h>
 #endif
@@ -44,9 +29,10 @@ int
 source (ulong addr, const char *fit_uname)
 {
        ulong           len;
-       image_header_t  *hdr;
+       const image_header_t *hdr;
        ulong           *data;
        int             verify;
+       void *buf;
 #if defined(CONFIG_FIT)
        const void*     fit_hdr;
        int             noffset;
@@ -56,9 +42,10 @@ source (ulong addr, const char *fit_uname)
 
        verify = getenv_yesno ("verify");
 
-       switch (genimg_get_format ((void *)addr)) {
+       buf = map_sysmem(addr, 0);
+       switch (genimg_get_format(buf)) {
        case IMAGE_FORMAT_LEGACY:
-               hdr = (image_header_t *)addr;
+               hdr = buf;
 
                if (!image_check_magic (hdr)) {
                        puts ("Bad magic number\n");
@@ -104,7 +91,7 @@ source (ulong addr, const char *fit_uname)
                        return 1;
                }
 
-               fit_hdr = (const void *)addr;
+               fit_hdr = buf;
                if (!fit_check_format (fit_hdr)) {
                        puts ("Bad FIT image format\n");
                        return 1;
@@ -124,7 +111,7 @@ source (ulong addr, const char *fit_uname)
 
                /* verify integrity */
                if (verify) {
-                       if (!fit_image_check_hashes (fit_hdr, noffset)) {
+                       if (!fit_image_verify(fit_hdr, noffset)) {
                                puts ("Bad Data Hash\n");
                                return 1;
                        }