]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/esd/common/auto_update.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / board / esd / common / auto_update.c
index 4ea373a7c0df1da3a20628cce4ed89f4f03b323c..85c3567b0ba2774121a85904125803fd8d54763a 100644 (file)
@@ -1,25 +1,9 @@
 /*
  * (C) Copyright 2003-2004
- * Gary Jennejohn, DENX Software Engineering, gj@denx.de.
+ * Gary Jennejohn, DENX Software Engineering, garyj@denx.de.
  * 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>
@@ -27,9 +11,6 @@
 #include <command.h>
 #include <image.h>
 #include <asm/byteorder.h>
-#if defined(CONFIG_NAND_LEGACY)
-#include <linux/mtd/nand_legacy.h>
-#endif
 #include <fat.h>
 #include <part.h>
 
@@ -58,20 +39,6 @@ extern int flash_sect_erase(ulong, ulong);
 extern int flash_sect_protect (int, ulong, ulong);
 extern int flash_write (char *, ulong, ulong);
 
-#if defined(CONFIG_CMD_NAND) && defined(CONFIG_NAND_LEGACY)
-/* references to names in cmd_nand.c */
-#define NANDRW_READ    0x01
-#define NANDRW_WRITE   0x00
-#define NANDRW_JFFS2   0x02
-#define NANDRW_JFFS2_SKIP      0x04
-extern struct nand_chip nand_dev_desc[];
-extern int nand_legacy_rw(struct nand_chip* nand, int cmd,
-                         size_t start, size_t len,
-                         size_t * retlen, u_char * buf);
-extern int nand_legacy_erase(struct nand_chip* nand, size_t ofs,
-                            size_t len, int clean);
-#endif
-
 extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
 
 int au_check_cksum_valid(int i, long nbytes)
@@ -108,7 +75,6 @@ int au_check_cksum_valid(int i, long nbytes)
 int au_check_header_valid(int i, long nbytes)
 {
        image_header_t *hdr;
-       unsigned long checksum;
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
@@ -144,9 +110,6 @@ int au_check_header_valid(int i, long nbytes)
                return -1;
        }
 
-       /* recycle checksum */
-       checksum = image_get_data_size (hdr);
-
        return 0;
 }
 
@@ -158,9 +121,6 @@ int au_do_update(int i, long sz)
        int off, rc;
        uint nbytes;
        int k;
-#if defined(CONFIG_CMD_NAND) && defined(CONFIG_NAND_LEGACY)
-       int total;
-#endif
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
@@ -240,15 +200,6 @@ int au_do_update(int i, long sz)
                                au_image[i].name);
                        debug ("flash_sect_erase(%lx, %lx);\n", start, end);
                        flash_sect_erase (start, end);
-               } else {
-#if defined(CONFIG_CMD_NAND) && defined(CONFIG_NAND_LEGACY)
-                       printf ("Updating NAND FLASH with image %s\n",
-                               au_image[i].name);
-                       debug ("nand_legacy_erase(%lx, %lx);\n", start, end);
-                       rc = nand_legacy_erase (nand_dev_desc, start,
-                                               end - start + 1, 0);
-                       debug ("nand_legacy_erase returned %x\n", rc);
-#endif
                }
 
                udelay(10000);
@@ -273,18 +224,7 @@ int au_do_update(int i, long sz)
                        rc = flash_write ((char *)addr, start,
                                          (nbytes + 1) & ~1);
                } else {
-#if defined(CONFIG_CMD_NAND) && defined(CONFIG_NAND_LEGACY)
-                       debug ("nand_legacy_rw(%p, %lx, %x)\n",
-                              addr, start, nbytes);
-                       rc = nand_legacy_rw (nand_dev_desc,
-                                            NANDRW_WRITE | NANDRW_JFFS2,
-                                            start, nbytes, (size_t *)&total,
-                                            (uchar *)addr);
-                       debug ("nand_legacy_rw: ret=%x total=%d nbytes=%d\n",
-                              rc, total, nbytes);
-#else
                        rc = -1;
-#endif
                }
                if (rc != 0) {
                        printf ("Flashing failed due to error %d\n", rc);
@@ -297,16 +237,6 @@ int au_do_update(int i, long sz)
                if (au_image[i].type != AU_NAND) {
                        rc = crc32 (0, (uchar *)(start + off),
                                    image_get_data_size (hdr));
-               } else {
-#if defined(CONFIG_CMD_NAND) && defined(CONFIG_NAND_LEGACY)
-                       rc = nand_legacy_rw (nand_dev_desc,
-                                            NANDRW_READ | NANDRW_JFFS2 |
-                                            NANDRW_JFFS2_SKIP,
-                                            start, nbytes, (size_t *)&total,
-                                            (uchar *)addr);
-                       rc = crc32 (0, (uchar *)(addr + off),
-                                   image_get_data_size (hdr));
-#endif
                }
                if (rc != image_get_dcrc (hdr)) {
                        printf ("Image %s Bad Data Checksum After COPY\n",
@@ -447,7 +377,7 @@ int do_auto_update(void)
 {
        block_dev_desc_t *stor_dev = NULL;
        long sz;
-       int i, res, cnt, old_ctrlc, got_ctrlc;
+       int i, res, cnt, old_ctrlc;
        char buffer[32];
        char str[80];
        int n;
@@ -523,8 +453,6 @@ int do_auto_update(void)
                        /* let the user break out of the loop */
                        if (ctrlc() || had_ctrlc ()) {
                                clear_ctrlc ();
-                               if (res < 0)
-                                       got_ctrlc = 1;
                                break;
                        }
                        cnt++;
@@ -542,7 +470,7 @@ int do_auto_update(void)
        return 0;
 }
 
-int auto_update(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int auto_update(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        do_auto_update();
 
@@ -551,6 +479,6 @@ int auto_update(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 U_BOOT_CMD(
        autoupd,        1,      1,      auto_update,
        "Automatically update images",
-       NULL
+       ""
 );
 #endif /* CONFIG_AUTO_UPDATE */