]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/ait/cam_enc_4xx/cam_enc_4xx.c
Merge branch 'u-boot-ti/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / board / ait / cam_enc_4xx / cam_enc_4xx.c
index bb29cf3f58b5d6f30ae0a540527a9a456ffd8905..290dc1984ab3a9508e2dc3a2b6c0e393838691c3 100644 (file)
@@ -4,22 +4,11 @@
  * Copyright (C) 2011
  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <cli.h>
 #include <errno.h>
 #include <linux/mtd/nand.h>
 #include <nand.h>
@@ -27,7 +16,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/nand_defs.h>
+#include <asm/ti-common/davinci_nand.h>
 #include <asm/arch/davinci_misc.h>
 #ifdef CONFIG_DAVINCI_MMC
 #include <mmc.h>
@@ -119,7 +108,7 @@ int board_eth_init(bd_t *bis)
 #ifdef CONFIG_NAND_DAVINCI
 static int
 davinci_std_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
-                                  uint8_t *buf, int page)
+                                  uint8_t *buf, int oob_required, int page)
 {
        struct nand_chip *this = mtd->priv;
        int i, eccsize = chip->ecc.size;
@@ -166,8 +155,9 @@ davinci_std_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
        return 0;
 }
 
-static void davinci_std_write_page_syndrome(struct mtd_info *mtd,
-                                   struct nand_chip *chip, const uint8_t *buf)
+static int davinci_std_write_page_syndrome(struct mtd_info *mtd,
+                                   struct nand_chip *chip, const uint8_t *buf,
+                                   int oob_required)
 {
        unsigned char davinci_ecc_buf[NAND_MAX_OOBSIZE];
        struct nand_chip *this = mtd->priv;
@@ -217,6 +207,7 @@ static void davinci_std_write_page_syndrome(struct mtd_info *mtd,
        i = mtd->oobsize - (oob - chip->oob_poi);
        if (i)
                chip->write_buf(mtd, oob, i);
+       return 0;
 }
 
 static int davinci_std_write_oob_syndrome(struct mtd_info *mtd,
@@ -238,7 +229,7 @@ static int davinci_std_write_oob_syndrome(struct mtd_info *mtd,
 }
 
 static int davinci_std_read_oob_syndrome(struct mtd_info *mtd,
-       struct nand_chip *chip, int page, int sndcmd)
+       struct nand_chip *chip, int page)
 {
        struct nand_chip *this = mtd->priv;
        uint8_t *buf = chip->oob_poi;
@@ -248,7 +239,7 @@ static int davinci_std_read_oob_syndrome(struct mtd_info *mtd,
 
        chip->read_buf(mtd, bufpoi, mtd->oobsize);
 
-       return 1;
+       return 0;
 }
 
 static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
@@ -554,13 +545,14 @@ static char *menu_handle(struct menu_display *display)
 {
        struct menu *m;
        int i;
-       char *choice = NULL;
+       void *choice = NULL;
        char key[2];
        int ret;
        char *s;
        char temp[6][200];
 
-       m = menu_create(display->title, display->timeout, 1, ait_menu_print);
+       m = menu_create(display->title, display->timeout, 1, ait_menu_print,
+                       NULL, NULL);
 
        for (i = 0; display->menulist[i]; i++) {
                sprintf(key, "%d", i + 1);
@@ -606,7 +598,7 @@ static char *menu_handle(struct menu_display *display)
        sprintf(key, "%d", 1);
        menu_default_set(m, key);
 
-       if (menu_get_choice(m, (void **)&choice) != 1)
+       if (menu_get_choice(m, &choice) != 1)
                debug("Problem picking a choice!\n");
 
        menu_destroy(m);
@@ -653,7 +645,7 @@ static int ait_writeublheader(void)
                sprintf(s, "%lx", i);
                ret = setenv("header_addr", s);
                if (ret == 0)
-                       ret = run_command2("run img_writeheader", 0);
+                       ret = run_command("run img_writeheader", 0);
                if (ret != 0)
                        break;
        }
@@ -697,7 +689,7 @@ static int ait_menu_install_images(void)
                setenv("filesize", s);
                switch (imgs[count].subtype) {
                case FIT_SUBTYPE_DF_ENV_IMAGE:
-                       ret = run_command2("run img_writedfenv", 0);
+                       ret = run_command("run img_writedfenv", 0);
                        break;
                case FIT_SUBTYPE_RAMDISK_IMAGE:
                        t = getenv("img_volume");
@@ -713,16 +705,16 @@ static int ait_menu_install_images(void)
                        if (ret != 0)
                                break;
 
-                       ret = run_command2("run img_writeramdisk", 0);
+                       ret = run_command("run img_writeramdisk", 0);
                        break;
                case FIT_SUBTYPE_SPL_IMAGE:
-                       ret = run_command2("run img_writespl", 0);
+                       ret = run_command("run img_writespl", 0);
                        break;
                case FIT_SUBTYPE_UBL_HEADER:
                        ret = ait_writeublheader();
                        break;
                case FIT_SUBTYPE_UBOOT_IMAGE:
-                       ret = run_command2("run img_writeuboot", 0);
+                       ret = run_command("run img_writeuboot", 0);
                        break;
                default:
                        /* not supported type */
@@ -731,8 +723,19 @@ static int ait_menu_install_images(void)
                count++;
        }
        /* now save dvn_* and img_volume env vars to new values */
-       if (ret == 0)
-               ret = run_command2("run savenewvers", 0);
+       if (ret == 0) {
+               t = getenv("x_dvn_boot_vers");
+               if (t)
+                       setenv("dvn_boot_vers", t);
+
+               t = getenv("x_dvn_app_vers");
+               if (t)
+                       setenv("dvn_boot_vers", t);
+
+               setenv("x_dvn_boot_vers", NULL);
+               setenv("x_dvn_app_vers", NULL);
+               ret = run_command("run savenewvers", 0);
+       }
 
        return ret;
 }
@@ -749,6 +752,8 @@ static int ait_menu_evaluate_load(char *choice)
                break;
        case '2':
                /* cancel, back to main */
+               setenv("x_dvn_boot_vers", NULL);
+               setenv("x_dvn_app_vers", NULL);
                break;
        }
 
@@ -772,7 +777,7 @@ static void ait_menu_read_env(char *name)
 
        sprintf(output, "%s old: %s value: ", name, getenv(name));
        memset(cbuf, 0, CONFIG_SYS_CBSIZE);
-       readret = readline_into_buffer(output, cbuf, 0);
+       readret = cli_readline_into_buffer(output, cbuf, 0);
 
        if (readret >= 0) {
                ret = setenv(name, cbuf);
@@ -961,7 +966,7 @@ static int ait_menu_check_image(void)
                if (s) {
                        ret = strcmp(s, imgs[found_uboot].desc);
                        if (ret != 0) {
-                               setenv("dvn_boot_vers",
+                               setenv("x_dvn_boot_vers",
                                        imgs[found_uboot].desc);
                        } else {
                                found_uboot = -1;
@@ -976,7 +981,7 @@ static int ait_menu_check_image(void)
                if (s) {
                        ret = strcmp(s, imgs[found_ramdisk].desc);
                        if (ret != 0) {
-                               setenv("dvn_app_vers",
+                               setenv("x_dvn_app_vers",
                                        imgs[found_ramdisk].desc);
                        } else {
                                found_ramdisk = -1;
@@ -1005,7 +1010,7 @@ static int ait_menu_evaluate_update(char *choice)
                break;
        case '2':
                /* load image */
-               ret = run_command2("run load_img", 0);
+               ret = run_command("run load_img", 0);
                printf("ret: %d\n", ret);
                if (ret)
                        return MENU_UPDATE;
@@ -1073,9 +1078,9 @@ int menu_show(int bootdelay)
 {
        int ret;
 
-       run_command2("run saveparms", 0);
+       run_command("run saveparms", 0);
        ret = ait_menu_show(&ait_main, bootdelay);
-       run_command2("run restoreparms", 0);
+       run_command("run restoreparms", 0);
 
        if (ret == MENU_EXIT_BOOTCMD)
                return 0;
@@ -1085,8 +1090,17 @@ int menu_show(int bootdelay)
 
 void menu_display_statusline(struct menu *m)
 {
-       printf("State: dvn_boot_vers: %s dvn_app_vers: %s\n",
-               getenv("dvn_boot_vers"), getenv("dvn_app_vers"));
+       char *s1, *s2;
+
+       s1 = getenv("x_dvn_boot_vers");
+       if (!s1)
+               s1 = getenv("dvn_boot_vers");
+
+       s2 = getenv("x_dvn_app_vers");
+       if (!s2)
+               s2 = getenv("dvn_app_vers");
+
+       printf("State: dvn_boot_vers: %s dvn_app_vers: %s\n", s1, s2);
        return;
 }
 #endif