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. Conflicts: board/davinci/sysmobts_v2/sysmobts_v2.c include/configs/davinci_sysmobts_v2.h include/nand.h
This commit is contained in:
parent
910946bf6a
commit
ca2f91dbcb
|
@ -166,7 +166,14 @@ int misc_init_r(void)
|
||||||
if (sysmobts_v2_read_mac_address(eeprom_enetaddr))
|
if (sysmobts_v2_read_mac_address(eeprom_enetaddr))
|
||||||
davinci_sync_env_enetaddr(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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void hw_nand_rem_nwp(void)
|
||||||
|
{
|
||||||
|
if (get_board_revision() == 5) {
|
||||||
|
gpio_direction_output(33, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
* (C) Copyright 2006-2007 OpenMoko, Inc.
|
* (C) Copyright 2006-2007 OpenMoko, Inc.
|
||||||
* Added 16-bit nand support
|
* Added 16-bit nand support
|
||||||
* (C) 2004 Texas Instruments
|
* (C) 2004 Texas Instruments
|
||||||
|
|
||||||
|
* (C) Copyright sysmocom s.f.m.c. GmbH
|
||||||
*
|
*
|
||||||
* Copyright 2010 Freescale Semiconductor
|
* Copyright 2010 Freescale Semiconductor
|
||||||
* The portions of this file whose copyright is held by Freescale and which
|
* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#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:
|
usage:
|
||||||
return cmd_usage(cmdtp);
|
return cmd_usage(cmdtp);
|
||||||
|
@ -726,6 +737,7 @@ U_BOOT_CMD(
|
||||||
nand, CONFIG_SYS_MAXARGS, 1, do_nand,
|
nand, CONFIG_SYS_MAXARGS, 1, do_nand,
|
||||||
"NAND sub-system",
|
"NAND sub-system",
|
||||||
"info - show available NAND devices\n"
|
"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 device [dev] - show or set current device\n"
|
||||||
"nand read - addr off|partition size\n"
|
"nand read - addr off|partition size\n"
|
||||||
"nand write - addr off|partition size\n"
|
"nand write - addr off|partition size\n"
|
||||||
|
|
|
@ -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
|
* Author: Holger Hans Peter Freyther
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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);
|
BLINK_LED(5);
|
||||||
status_led_set(0, STATUS_LED_ON);
|
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);
|
"nand erase.part U-Boot-Environment", 0);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return env_failed();
|
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>
|
* Copyright (C) 2009 Lyrtech RD Inc. <www.lyrtech.com>
|
||||||
*
|
*
|
||||||
* Based on dvevm/dvevm.c, original copyright follows:
|
* Based on dvevm/dvevm.c, original copyright follows:
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
#define CONFIG_CMDLINE_TAG
|
#define CONFIG_CMDLINE_TAG
|
||||||
#define CONFIG_SETUP_MEMORY_TAGS
|
#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_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 */
|
/* U-Boot commands */
|
||||||
/*=================*/
|
/*=================*/
|
||||||
|
|
|
@ -151,3 +151,5 @@ __attribute__((noreturn)) void nand_boot(void);
|
||||||
#define ENV_OFFSET_SIZE 8
|
#define ENV_OFFSET_SIZE 8
|
||||||
int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
|
int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void hw_nand_rem_nwp(void);
|
||||||
|
|
Loading…
Reference in New Issue