diff --git a/board/davinci/sysmobts_v2/sysmobts_v2.c b/board/davinci/sysmobts_v2/sysmobts_v2.c index 2eca859f6a..1952e638fd 100644 --- a/board/davinci/sysmobts_v2/sysmobts_v2.c +++ b/board/davinci/sysmobts_v2/sysmobts_v2.c @@ -170,7 +170,7 @@ int misc_init_r(void) if (sysmobts_v2_read_mac_address(eeprom_enetaddr)) davinci_sync_env_enetaddr(eeprom_enetaddr); - setenv("fwup", "dhcp;setenv filesize 0;tftp 85000000 ${tftp_serverip}:rootfs.ubi;mtdpart default;nand erase.part RootFs;nand write 85000000 RootFs ${filesize}"); + setenv("fwup", "dhcp;setenv filesize 0;tftp 85000000 ${tftp_serverip}:rootfs.ubi;mtdpart default;nand rem.nwp;nand erase.part RootFs;nand write 85000000 RootFs ${filesize}"); return(0); } @@ -180,3 +180,11 @@ void hw_watchdog_reset(void) davinci_hw_watchdog_reset(); } #endif + +void hw_nand_rem_nwp(void) +{ + if (get_board_revision() >= 5) { + gpio_direction_output(33, 1); + udelay(100); + } +} diff --git a/cmd/nand.c b/cmd/nand.c index c16ec77ed4..0cae77294b 100644 --- a/cmd/nand.c +++ b/cmd/nand.c @@ -776,6 +776,15 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } #endif + if (strcmp(cmd, "rem.nwp") == 0) { +#ifdef SYSMOBTS_V2 + printf("\nSetting nWP\n"); + hw_nand_rem_nwp(); +#else + printf("\nNot supported yet.\n"); +#endif + return 0; + } usage: return CMD_RET_USAGE; @@ -784,6 +793,7 @@ usage: #ifdef CONFIG_SYS_LONGHELP static char nand_help_text[] = "info - show available NAND devices\n" + "nand rem.nwp - Remove the WP of the flash\n" "nand device [dev] - show or set current device\n" "nand read - addr off|partition size\n" "nand write - addr off|partition size\n" diff --git a/common/cmd_recovery.c b/common/cmd_recovery.c index d2ccde1301..b3ac91557b 100644 --- a/common/cmd_recovery.c +++ b/common/cmd_recovery.c @@ -109,7 +109,7 @@ static int do_run_recovery(cmd_tbl_t *cmdtp, int flag, int argc, char * const ar BLINK_LED(5); status_led_set(0, CONFIG_LED_STATUS_ON); - rc = run_command("mtdpart default; " + rc = run_command("nand rem.nwp; mtdpart default; " "nand erase.part U-Boot-Environment", 0); if (rc != 0) return env_failed(); diff --git a/include/configs/davinci_sysmobts_v2.h b/include/configs/davinci_sysmobts_v2.h index 16db6c723c..2fd4f53749 100644 --- a/include/configs/davinci_sysmobts_v2.h +++ b/include/configs/davinci_sysmobts_v2.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Holger Hans Peter Freyther + * Copyright (C) 2012, 2015 Holger Hans Peter Freyther * Copyright (C) 2009 Lyrtech RD Inc. * * Based on dvevm/dvevm.c, original copyright follows: @@ -141,7 +141,7 @@ #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTARGS "console=ttyS0,115200n8 root=ubi0:sysmobts-v2-rootfs ubi.mtd=3 rootfstype=ubifs rw noinitrd" -#define CONFIG_BOOTCOMMAND "mtdpart default;setenv bootargs ${bootargs} ${mtdparts};ubi part RootFs;ubifsmount ubi:sysmobts-v2-rootfs;ubifsload 85000000 /boot/uImage;bootm 85000000" +#define CONFIG_BOOTCOMMAND "nand rem.nwp; mtdpart default;setenv bootargs ${bootargs} ${mtdparts};ubi part RootFs; ubifsmount ubi:sysmobts-v2-rootfs;ubifsload 85000000 /boot/uImage; bootm 85000000" /*=================*/ /* U-Boot commands */ /*=================*/ diff --git a/include/nand.h b/include/nand.h index b6eb223fb6..b17c660eb2 100644 --- a/include/nand.h +++ b/include/nand.h @@ -145,3 +145,5 @@ int spl_nand_erase_one(int block, int page); /* platform specific init functions */ void sunxi_nand_init(void); + +void hw_nand_rem_nwp(void);