2 * Copyright (C) 2009 Texas Instruments Incorporated
5 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/mtd/nand.h>
30 #include <asm/arch/hardware.h>
31 #include <asm/arch/nand_defs.h>
32 #include <asm/arch/davinci_misc.h>
33 #ifdef CONFIG_DAVINCI_MMC
35 #include <asm/arch/sdmmc_defs.h>
38 DECLARE_GLOBAL_DATA_PTR;
40 #ifndef CONFIG_SPL_BUILD
41 static struct davinci_timer *timer =
42 (struct davinci_timer *)DAVINCI_TIMER3_BASE;
44 static unsigned long get_timer_val(void)
46 unsigned long now = readl(&timer->tim34);
51 static int timer_running(void)
53 return readl(&timer->tcr) &
54 (DV_TIMER_TCR_ENAMODE_MASK << DV_TIMER_TCR_ENAMODE34_SHIFT);
57 static void stop_timer(void)
59 writel(0x0, &timer->tcr);
65 printf("Board: AIT CAM ENC 4XX\n");
71 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
76 #ifdef CONFIG_DRIVER_TI_EMAC
77 static int cam_enc_4xx_check_network(void)
81 s = getenv("ethaddr");
85 if (!is_valid_ether_addr((const u8 *)s))
92 s = getenv("netmask");
96 s = getenv("serverip");
100 s = getenv("gatewayip");
106 int board_eth_init(bd_t *bis)
110 ret = cam_enc_4xx_check_network();
114 davinci_emac_initialize();
120 #ifdef CONFIG_NAND_DAVINCI
122 davinci_std_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
123 uint8_t *buf, int page)
125 struct nand_chip *this = mtd->priv;
126 int i, eccsize = chip->ecc.size;
127 int eccbytes = chip->ecc.bytes;
128 int eccsteps = chip->ecc.steps;
130 uint8_t *oob = chip->oob_poi;
132 chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x0, page & this->pagemask);
134 chip->read_buf(mtd, oob, mtd->oobsize);
136 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x0, page & this->pagemask);
139 for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
142 chip->ecc.hwctl(mtd, NAND_ECC_READ);
143 chip->read_buf(mtd, p, eccsize);
144 chip->ecc.hwctl(mtd, NAND_ECC_READSYN);
146 if (chip->ecc.prepad)
147 oob += chip->ecc.prepad;
149 stat = chip->ecc.correct(mtd, p, oob, NULL);
152 mtd->ecc_stats.failed++;
154 mtd->ecc_stats.corrected += stat;
158 if (chip->ecc.postpad)
159 oob += chip->ecc.postpad;
162 /* Calculate remaining oob bytes */
163 i = mtd->oobsize - (oob - chip->oob_poi);
165 chip->read_buf(mtd, oob, i);
170 static void davinci_std_write_page_syndrome(struct mtd_info *mtd,
171 struct nand_chip *chip, const uint8_t *buf)
173 unsigned char davinci_ecc_buf[NAND_MAX_OOBSIZE];
174 struct nand_chip *this = mtd->priv;
175 int i, eccsize = chip->ecc.size;
176 int eccbytes = chip->ecc.bytes;
177 int eccsteps = chip->ecc.steps;
178 int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
180 const uint8_t *p = buf;
181 uint8_t *oob = chip->oob_poi;
183 for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
184 chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
185 chip->write_buf(mtd, p, eccsize);
187 /* Calculate ECC without prepad */
188 chip->ecc.calculate(mtd, p, oob + chip->ecc.prepad);
190 if (chip->ecc.prepad) {
191 offset = (chip->ecc.steps - eccsteps) * chunk;
192 memcpy(&davinci_ecc_buf[offset], oob, chip->ecc.prepad);
193 oob += chip->ecc.prepad;
196 offset = ((chip->ecc.steps - eccsteps) * chunk) +
198 memcpy(&davinci_ecc_buf[offset], oob, eccbytes);
201 if (chip->ecc.postpad) {
202 offset = ((chip->ecc.steps - eccsteps) * chunk) +
203 chip->ecc.prepad + eccbytes;
204 memcpy(&davinci_ecc_buf[offset], oob,
206 oob += chip->ecc.postpad;
211 * Write the sparebytes into the page once
212 * all eccsteps have been covered
214 for (i = 0; i < mtd->oobsize; i++)
215 writeb(davinci_ecc_buf[i], this->IO_ADDR_W);
217 /* Calculate remaining oob bytes */
218 i = mtd->oobsize - (oob - chip->oob_poi);
220 chip->write_buf(mtd, oob, i);
223 static int davinci_std_write_oob_syndrome(struct mtd_info *mtd,
224 struct nand_chip *chip, int page)
227 const uint8_t *bufpoi = chip->oob_poi;
229 pos = mtd->writesize;
231 chip->cmdfunc(mtd, NAND_CMD_SEQIN, pos, page);
233 chip->write_buf(mtd, bufpoi, mtd->oobsize);
235 chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
236 status = chip->waitfunc(mtd, chip);
238 return status & NAND_STATUS_FAIL ? -1 : 0;
241 static int davinci_std_read_oob_syndrome(struct mtd_info *mtd,
242 struct nand_chip *chip, int page, int sndcmd)
244 struct nand_chip *this = mtd->priv;
245 uint8_t *buf = chip->oob_poi;
246 uint8_t *bufpoi = buf;
248 chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x0, page & this->pagemask);
250 chip->read_buf(mtd, bufpoi, mtd->oobsize);
255 static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
257 struct nand_chip *this = mtd->priv;
258 unsigned long wbase = (unsigned long) this->IO_ADDR_W;
259 unsigned long rbase = (unsigned long) this->IO_ADDR_R;
262 __set_bit(14, &wbase);
263 __set_bit(14, &rbase);
265 __clear_bit(14, &wbase);
266 __clear_bit(14, &rbase);
268 this->IO_ADDR_W = (void *)wbase;
269 this->IO_ADDR_R = (void *)rbase;
272 int board_nand_init(struct nand_chip *nand)
274 davinci_nand_init(nand);
275 nand->select_chip = nand_dm365evm_select_chip;
280 struct nand_ecc_ctrl org_ecc;
281 static int notsaved = 1;
283 static int nand_switch_hw_func(int mode)
285 struct nand_chip *nand;
286 struct mtd_info *mtd;
288 if (nand_curr_device < 0 ||
289 nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
290 !nand_info[nand_curr_device].name) {
291 printf("Error: Can't switch hw functions," \
292 " no devices available\n");
296 mtd = &nand_info[nand_curr_device];
301 printf("switching to uboot hw functions.\n");
302 memcpy(&nand->ecc, &org_ecc,
303 sizeof(struct nand_ecc_ctrl));
307 printf("switching to RBL hw functions.\n");
309 memcpy(&org_ecc, &nand->ecc,
310 sizeof(struct nand_ecc_ctrl));
313 nand->ecc.mode = NAND_ECC_HW_SYNDROME;
314 nand->ecc.prepad = 6;
315 nand->ecc.read_page = davinci_std_read_page_syndrome;
316 nand->ecc.write_page = davinci_std_write_page_syndrome;
317 nand->ecc.read_oob = davinci_std_read_oob_syndrome;
318 nand->ecc.write_oob = davinci_std_write_oob_syndrome;
325 static int do_switch_ecc(cmd_tbl_t *cmdtp, int flag, int argc,
330 if (strncmp(argv[1], "rbl", 2) == 0)
331 hwmode = nand_switch_hw_func(1);
332 else if (strncmp(argv[1], "uboot", 2) == 0)
333 hwmode = nand_switch_hw_func(0);
340 printf("Usage: nandrbl %s\n", cmdtp->usage);
345 nandrbl, 2, 1, do_switch_ecc,
346 "switch between rbl/uboot NAND ECC calculation algorithm",
347 "[rbl/uboot] - Switch between rbl/uboot NAND ECC algorithm"
351 #endif /* #ifdef CONFIG_NAND_DAVINCI */
353 #ifdef CONFIG_DAVINCI_MMC
354 static struct davinci_mmc mmc_sd0 = {
355 .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
356 .input_clk = 121500000,
357 .host_caps = MMC_MODE_4BIT,
358 .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
359 .version = MMC_CTLR_VERSION_2,
362 int board_mmc_init(bd_t *bis)
366 /* Add slot-0 to mmc subsystem */
367 err = davinci_mmc_init(bis, &mmc_sd0);
373 int board_late_init(void)
375 struct davinci_gpio *gpio = davinci_gpio_bank45;
377 /* 24MHz InputClock / 15 prediv -> 1.6 MHz timer running */
378 while ((get_timer_val() < CONFIG_AIT_TIMER_TIMEOUT) &&
382 /* 1 sec reached -> stop timer, clear all LED */
384 clrbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
390 char *name = "GENERIC @ 0x00";
393 miiphy_reset(name, 0x0);
396 #else /* #ifndef CONFIG_SPL_BUILD */
397 static void cam_enc_4xx_set_all_led(void)
399 struct davinci_gpio *gpio = davinci_gpio_bank45;
401 setbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
405 * TIMER 0 is used for tick
407 static struct davinci_timer *timer =
408 (struct davinci_timer *)DAVINCI_TIMER3_BASE;
410 #define TIMER_LOAD_VAL 0xffffffff
411 #define TIM_CLK_DIV 16
413 static int cam_enc_4xx_timer_init(void)
415 /* We are using timer34 in unchained 32-bit mode, full speed */
416 writel(0x0, &timer->tcr);
417 writel(0x0, &timer->tgcr);
418 writel(0x06 | ((TIM_CLK_DIV - 1) << 8), &timer->tgcr);
419 writel(0x0, &timer->tim34);
420 writel(TIMER_LOAD_VAL, &timer->prd34);
421 writel(2 << 22, &timer->tcr);
425 void board_gpio_init(void)
427 struct davinci_gpio *gpio;
429 cam_enc_4xx_set_all_led();
430 cam_enc_4xx_timer_init();
431 gpio = davinci_gpio_bank01;
432 clrbits_le32(&gpio->dir, ~0xfdfffffe);
433 /* clear LED D14 = GPIO25 */
434 clrbits_le32(&gpio->out_data, 0x02000000);
435 gpio = davinci_gpio_bank23;
436 clrbits_le32(&gpio->dir, ~0x5ff0afef);
437 /* set GPIO61 to 1 -> intern UART0 as Console */
438 setbits_le32(&gpio->out_data, 0x20000000);
440 * PHY out of reset GIO 50 = 1
441 * NAND WP off GIO 51 = 1
443 setbits_le32(&gpio->out_data, 0x000c0004);
444 gpio = davinci_gpio_bank45;
445 clrbits_le32(&gpio->dir, ~(0xdb2fffff) | CONFIG_CAM_ENC_LED_MASK);
455 clrbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
456 gpio = davinci_gpio_bank67;
457 clrbits_le32(&gpio->dir, ~0x000007ff);
461 * functions for the post memory test.
463 int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
465 *vstart = CONFIG_SYS_SDRAM_BASE;
466 *size = PHYS_SDRAM_1_SIZE;
471 void arch_memory_failure_handle(void)
473 cam_enc_4xx_set_all_led();
474 puts("mem failure\n");
479 #if defined(CONFIG_MENU)
483 #define MENU_EXIT_BOOTCMD -2
486 #define MENU_UPDATE 2
487 #define MENU_NETWORK 3
490 static int menu_start;
492 #define FIT_SUBTYPE_UNKNOWN 0
493 #define FIT_SUBTYPE_UBL_HEADER 1
494 #define FIT_SUBTYPE_SPL_IMAGE 2
495 #define FIT_SUBTYPE_UBOOT_IMAGE 3
496 #define FIT_SUBTYPE_DF_ENV_IMAGE 4
497 #define FIT_SUBTYPE_RAMDISK_IMAGE 5
499 struct fit_images_info {
507 static struct fit_images_info imgs[10];
509 struct menu_display {
511 int timeout; /* in sec */
514 int (*menu_evaluate)(char *choice);
517 char *menu_main[] = {
519 "(2) Update Software",
520 "(3) Reset to default setting and boot",
521 "(4) Enter U-Boot console",
525 char *menu_update[] = {
526 "(1) Network settings",
532 char *menu_load[] = {
538 char *menu_network[] = {
543 "(5) tftp image name",
544 "(6) back to update software",
548 static void ait_menu_print(void *data)
550 printf("%s\n", (char *)data);
554 static char *menu_handle(struct menu_display *display)
564 m = menu_create(display->title, display->timeout, 1, ait_menu_print,
567 for (i = 0; display->menulist[i]; i++) {
568 sprintf(key, "%d", i + 1);
569 if (display->id == MENU_NETWORK) {
572 s = getenv("ipaddr");
575 s = getenv("netmask");
578 s = getenv("serverip");
581 s = getenv("gatewayip");
584 s = getenv("img_file");
591 sprintf(temp[i], "%s: %s",
592 display->menulist[i], s);
593 ret = menu_item_add(m, key, temp[i]);
595 ret = menu_item_add(m, key,
596 display->menulist[i]);
599 ret = menu_item_add(m, key, display->menulist[i]);
603 printf("failed to add item!");
608 sprintf(key, "%d", 1);
609 menu_default_set(m, key);
611 if (menu_get_choice(m, &choice) != 1)
612 debug("Problem picking a choice!\n");
619 static int ait_menu_show(struct menu_display *display, int bootdelay)
624 if ((menu_start == 0) && (display->id == MENU_MAIN))
625 display->timeout = bootdelay;
627 display->timeout = 0;
629 while (end == MENU_STAY) {
630 choice = menu_handle(display);
632 end = display->menu_evaluate(choice);
634 if (end == display->id)
636 if (display->id == MENU_MAIN) {
638 end = MENU_EXIT_BOOTCMD;
640 display->timeout = 0;
646 static int ait_writeublheader(void)
652 for (i = CONFIG_SYS_NAND_BLOCK_SIZE;
653 i < CONFIG_SYS_NAND_U_BOOT_OFFS;
654 i += CONFIG_SYS_NAND_BLOCK_SIZE) {
655 sprintf(s, "%lx", i);
656 ret = setenv("header_addr", s);
658 ret = run_command("run img_writeheader", 0);
665 static int ait_menu_install_images(void)
673 * possible image types:
674 * FIT_SUBTYPE_UNKNOWN
675 * FIT_SUBTYPE_UBL_HEADER
676 * FIT_SUBTYPE_SPL_IMAGE
677 * FIT_SUBTYPE_UBOOT_IMAGE
678 * FIT_SUBTYPE_DF_ENV_IMAGE
679 * FIT_SUBTYPE_RAMDISK_IMAGE
682 * img_addr_r: image start addr
683 * header_addr: addr where to write to UBL header
684 * img_writeheader: write ubl header to nand
685 * img_writespl: write spl to nand
686 * img_writeuboot: write uboot to nand
687 * img_writedfenv: write default environment to ubi volume
688 * img_volume: which ubi volume should be updated with img_writeramdisk
689 * filesize: size of data for updating ubi volume
690 * img_writeramdisk: write ramdisk to ubi volume
693 while (imgs[count].type != IH_TYPE_INVALID) {
694 printf("Installing %s\n",
695 genimg_get_type_name(imgs[count].type));
696 sprintf(s, "%p", imgs[count].data);
697 setenv("img_addr_r", s);
698 sprintf(s, "%lx", (unsigned long)imgs[count].size);
699 setenv("filesize", s);
700 switch (imgs[count].subtype) {
701 case FIT_SUBTYPE_DF_ENV_IMAGE:
702 ret = run_command("run img_writedfenv", 0);
704 case FIT_SUBTYPE_RAMDISK_IMAGE:
705 t = getenv("img_volume");
707 ret = setenv("img_volume", "rootfs1");
709 /* switch to other volume */
710 if (strncmp(t, "rootfs1", 7) == 0)
711 ret = setenv("img_volume", "rootfs2");
713 ret = setenv("img_volume", "rootfs1");
718 ret = run_command("run img_writeramdisk", 0);
720 case FIT_SUBTYPE_SPL_IMAGE:
721 ret = run_command("run img_writespl", 0);
723 case FIT_SUBTYPE_UBL_HEADER:
724 ret = ait_writeublheader();
726 case FIT_SUBTYPE_UBOOT_IMAGE:
727 ret = run_command("run img_writeuboot", 0);
730 /* not supported type */
735 /* now save dvn_* and img_volume env vars to new values */
737 t = getenv("x_dvn_boot_vers");
739 setenv("dvn_boot_vers", t);
741 t = getenv("x_dvn_app_vers");
743 setenv("dvn_boot_vers", t);
745 setenv("x_dvn_boot_vers", NULL);
746 setenv("x_dvn_app_vers", NULL);
747 ret = run_command("run savenewvers", 0);
753 static int ait_menu_evaluate_load(char *choice)
761 ait_menu_install_images();
764 /* cancel, back to main */
765 setenv("x_dvn_boot_vers", NULL);
766 setenv("x_dvn_app_vers", NULL);
773 struct menu_display ait_load = {
774 .title = "AIT load image",
777 .menulist = menu_load,
778 .menu_evaluate = ait_menu_evaluate_load,
781 static void ait_menu_read_env(char *name)
783 char output[CONFIG_SYS_CBSIZE];
784 char cbuf[CONFIG_SYS_CBSIZE];
788 sprintf(output, "%s old: %s value: ", name, getenv(name));
789 memset(cbuf, 0, CONFIG_SYS_CBSIZE);
790 readret = readline_into_buffer(output, cbuf, 0);
793 ret = setenv(name, cbuf);
795 printf("Error setting %s\n", name);
802 static int ait_menu_evaluate_network(char *choice)
809 ait_menu_read_env("ipaddr");
812 ait_menu_read_env("netmask");
815 ait_menu_read_env("serverip");
818 ait_menu_read_env("gatewayip");
821 ait_menu_read_env("img_file");
831 struct menu_display ait_network = {
832 .title = "AIT network settings",
835 .menulist = menu_network,
836 .menu_evaluate = ait_menu_evaluate_network,
839 static int fit_get_subtype(const void *fit, int noffset, char **subtype)
843 *subtype = (char *)fdt_getprop(fit, noffset, "subtype", &len);
844 if (*subtype == NULL)
850 static int ait_subtype_nr(char *subtype)
852 int ret = FIT_SUBTYPE_UNKNOWN;
854 if (!strncmp("ublheader", subtype, strlen("ublheader")))
855 return FIT_SUBTYPE_UBL_HEADER;
856 if (!strncmp("splimage", subtype, strlen("splimage")))
857 return FIT_SUBTYPE_SPL_IMAGE;
858 if (!strncmp("ubootimage", subtype, strlen("ubootimage")))
859 return FIT_SUBTYPE_UBOOT_IMAGE;
860 if (!strncmp("dfenvimage", subtype, strlen("dfenvimage")))
861 return FIT_SUBTYPE_DF_ENV_IMAGE;
866 static int ait_menu_check_image(void)
869 unsigned long fit_addr;
880 int found_uboot = -1;
881 int found_ramdisk = -1;
883 memset(imgs, 0, sizeof(imgs));
884 s = getenv("fit_addr_r");
885 fit_addr = s ? (unsigned long)simple_strtol(s, NULL, 16) : \
886 CONFIG_BOARD_IMG_ADDR_R;
888 addr = (void *)fit_addr;
889 /* check if it is a FIT image */
890 format = genimg_get_format(addr);
891 if (format != IMAGE_FORMAT_FIT)
894 if (!fit_check_format(addr))
897 /* print the FIT description */
898 ret = fit_get_desc(addr, 0, &desc);
899 printf("FIT description: ");
901 printf("unavailable\n");
903 printf("%s\n", desc);
906 images_noffset = fdt_path_offset(addr, FIT_IMAGES_PATH);
907 if (images_noffset < 0) {
908 printf("Can't find images parent node '%s' (%s)\n",
909 FIT_IMAGES_PATH, fdt_strerror(images_noffset));
913 /* Process its subnodes, print out component images details */
914 for (ndepth = 0, count = 0,
915 noffset = fdt_next_node(addr, images_noffset, &ndepth);
916 (noffset >= 0) && (ndepth > 0);
917 noffset = fdt_next_node(addr, noffset, &ndepth)) {
920 * Direct child node of the images parent node,
921 * i.e. component image node.
923 printf("Image %u (%s)\n", count,
924 fit_get_name(addr, noffset, NULL));
926 fit_image_print(addr, noffset, "");
928 fit_image_get_type(addr, noffset,
930 /* Mandatory properties */
931 ret = fit_get_desc(addr, noffset, &desc);
932 printf("Description: ");
934 printf("unavailable\n");
936 printf("%s\n", desc);
938 ret = fit_get_subtype(addr, noffset, &subtype);
941 printf("unavailable\n");
943 imgs[count].subtype = ait_subtype_nr(subtype);
944 printf("%s %d\n", subtype,
945 imgs[count].subtype);
948 sprintf(imgs[count].desc, "%s", desc);
950 ret = fit_image_get_data(addr, noffset,
954 printf("Data Size: ");
956 printf("unavailable\n");
958 genimg_print_size(imgs[count].size);
959 printf("Data @ %p\n", imgs[count].data);
964 for (i = 0; i < count; i++) {
965 if (imgs[i].subtype == FIT_SUBTYPE_UBOOT_IMAGE)
967 if (imgs[i].type == IH_TYPE_RAMDISK) {
969 imgs[i].subtype = FIT_SUBTYPE_RAMDISK_IMAGE;
973 /* dvn_* env var update, if the FIT descriptors are different */
974 if (found_uboot >= 0) {
975 s = getenv("dvn_boot_vers");
977 ret = strcmp(s, imgs[found_uboot].desc);
979 setenv("x_dvn_boot_vers",
980 imgs[found_uboot].desc);
983 printf("no new uboot version\n");
986 setenv("dvn_boot_vers", imgs[found_uboot].desc);
989 if (found_ramdisk >= 0) {
990 s = getenv("dvn_app_vers");
992 ret = strcmp(s, imgs[found_ramdisk].desc);
994 setenv("x_dvn_app_vers",
995 imgs[found_ramdisk].desc);
998 printf("no new ramdisk version\n");
1001 setenv("dvn_app_vers", imgs[found_ramdisk].desc);
1004 if ((found_uboot == -1) && (found_ramdisk == -1))
1010 static int ait_menu_evaluate_update(char *choice)
1017 switch (choice[1]) {
1019 return ait_menu_show(&ait_network, 0);
1023 ret = run_command("run load_img", 0);
1024 printf("ret: %d\n", ret);
1028 ret = ait_menu_check_image();
1032 return ait_menu_show(&ait_load, 0);
1043 struct menu_display ait_update = {
1044 .title = "AIT Update Software",
1047 .menulist = menu_update,
1048 .menu_evaluate = ait_menu_evaluate_update,
1051 static int ait_menu_evaluate_main(char *choice)
1057 switch (choice[1]) {
1060 return MENU_EXIT_BOOTCMD;
1063 return ait_menu_show(&ait_update, 0);
1066 /* reset to default settings */
1067 setenv("app_reset", "yes");
1068 return MENU_EXIT_BOOTCMD;
1079 struct menu_display ait_main = {
1080 .title = "AIT Main",
1081 .timeout = CONFIG_BOOTDELAY,
1083 .menulist = menu_main,
1084 .menu_evaluate = ait_menu_evaluate_main,
1087 int menu_show(int bootdelay)
1091 run_command("run saveparms", 0);
1092 ret = ait_menu_show(&ait_main, bootdelay);
1093 run_command("run restoreparms", 0);
1095 if (ret == MENU_EXIT_BOOTCMD)
1101 void menu_display_statusline(struct menu *m)
1105 s1 = getenv("x_dvn_boot_vers");
1107 s1 = getenv("dvn_boot_vers");
1109 s2 = getenv("x_dvn_app_vers");
1111 s2 = getenv("dvn_app_vers");
1113 printf("State: dvn_boot_vers: %s dvn_app_vers: %s\n", s1, s2);