]> git.sur5r.net Git - u-boot/blobdiff - common/spl/spl_nand.c
Merge git://git.denx.de/u-boot-i2c
[u-boot] / common / spl / spl_nand.c
index 61de5a4f05fe3a67562bb35c595c03cd2f4c509f..b7801cb4605f16c54c99f65e3e8ed93db5d3e564 100644 (file)
@@ -2,23 +2,7 @@
  * Copyright (C) 2011
  * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
  *
- * 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>
 #include <config.h>
 #include <asm/io.h>
 #include <nand.h>
 
+#if defined(CONFIG_SPL_NAND_RAW_ONLY)
+void spl_nand_load_image(void)
+{
+       nand_init();
+
+       nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+                           CONFIG_SYS_NAND_U_BOOT_SIZE,
+                           (void *)CONFIG_SYS_NAND_U_BOOT_DST);
+       spl_set_header_raw_uboot();
+       nand_deselect();
+}
+#else
 void spl_nand_load_image(void)
 {
        struct image_header *header;
@@ -60,7 +56,7 @@ void spl_nand_load_image(void)
 
                /* load linux */
                nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
-                       CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+                       sizeof(*header), (void *)header);
                spl_parse_image_header(header);
                if (header->ih_os == IH_OS_LINUX) {
                        /* happy - was a linux */
@@ -78,13 +74,13 @@ void spl_nand_load_image(void)
 #endif
 #ifdef CONFIG_NAND_ENV_DST
        nand_spl_load_image(CONFIG_ENV_OFFSET,
-               CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+               sizeof(*header), (void *)header);
        spl_parse_image_header(header);
        nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
                (void *)spl_image.load_addr);
 #ifdef CONFIG_ENV_OFFSET_REDUND
        nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
-               CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+               sizeof(*header), (void *)header);
        spl_parse_image_header(header);
        nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
                (void *)spl_image.load_addr);
@@ -92,9 +88,10 @@ void spl_nand_load_image(void)
 #endif
        /* Load u-boot */
        nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-               CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+               sizeof(*header), (void *)header);
        spl_parse_image_header(header);
        nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
                spl_image.size, (void *)spl_image.load_addr);
        nand_deselect();
 }
+#endif