sysmobts-v2: Allow to remove the WP of the NAND flash
Starting from revision F we need to set nWP before writing to flash. Create a new NAND command that can be used for that and use it for fwup, booting and recovery mode. We assume that the payload runs a RW filesystem so we set the GPIO before booting the system. sysmobts: ubifsmount might already write to the nand... Remove the write protect a lot earlier as ubifsmount might already try to grow the freshly flashed UBIFS and allocate UBIs for it. sysmobts: Add a huge sleep to wait for the pin to be driven Add some margin and wait for the pin to get high and such. I can't easily measure if we sleep at all or if it is really 100ms but it can't hurt and we don't optimize for boot times yet. sysmobts: Toggle nWP on RevG and later as well sysmobts-v2: ubi part appears to write as well The ubi part command will write for the same reason. Move the command line to the front. (untested)
This commit is contained in:
parent
648cc337cd
commit
64b07727fb
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
10
cmd/nand.c
10
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"
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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. <www.lyrtech.com>
|
||||
*
|
||||
* 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 */
|
||||
/*=================*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue