diff --git a/board/davinci/sysmobts_v2/sysmobts_v2.c b/board/davinci/sysmobts_v2/sysmobts_v2.c index ad9048e7e2..f3faf58b1d 100644 --- a/board/davinci/sysmobts_v2/sysmobts_v2.c +++ b/board/davinci/sysmobts_v2/sysmobts_v2.c @@ -166,7 +166,14 @@ 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); } + +void hw_nand_rem_nwp(void) +{ + if (get_board_revision() == 5) { + gpio_direction_output(33, 1); + } +} diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 3e2edb8aaa..ddf2c22a9b 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -10,6 +10,8 @@ * (C) Copyright 2006-2007 OpenMoko, Inc. * Added 16-bit nand support * (C) 2004 Texas Instruments + + * (C) Copyright sysmocom s.f.m.c. GmbH * * Copyright 2010 Freescale Semiconductor * The portions of this file whose copyright is held by Freescale and which @@ -717,6 +719,15 @@ 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(\n"Not supported yet.\n"); +#endif + return 0; + } usage: return cmd_usage(cmdtp); @@ -726,6 +737,7 @@ U_BOOT_CMD( nand, CONFIG_SYS_MAXARGS, 1, do_nand, "NAND sub-system", "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 4456cf8a0e..d7139167c5 100644 --- a/common/cmd_recovery.c +++ b/common/cmd_recovery.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013 sysmocom s.f.m.c. GmbH + * Copyright (C) 2012, 2013, 2015 sysmocom s.f.m.c. GmbH * Author: Holger Hans Peter Freyther * This program is free software; you can redistribute it and/or modify @@ -109,7 +109,7 @@ static int do_run_recovery(cmd_tbl_t *cmdtp, int flag, int argc, const char *arg BLINK_LED(5); status_led_set(0, STATUS_LED_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 1476d8a829..02a885f63d 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: @@ -147,7 +147,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 sysmobts-v2-rootfs;ubifsload 85000000 /boot/uImage;bootm 85000000" +#define CONFIG_BOOTCOMMAND "mtdpart default;setenv bootargs ${bootargs} ${mtdparts};ubi part RootFs;ubifsmount sysmobts-v2-rootfs;ubifsload 85000000 /boot/uImage; nand rem.nwp; bootm 85000000" /*=================*/ /* U-Boot commands */ /*=================*/ diff --git a/include/nand.h b/include/nand.h index d444ddcefe..fbe6d7e556 100644 --- a/include/nand.h +++ b/include/nand.h @@ -151,3 +151,5 @@ __attribute__((noreturn)) void nand_boot(void); #define ENV_OFFSET_SIZE 8 int get_nand_env_oob(nand_info_t *nand, unsigned long *result); #endif + +void hw_nand_rem_nwp(void);