#endif //CYGSEM_REDBOOT_FLASH_CONFIG
+#ifdef CYGPKG_IO_FLASH
+#include <cyg/io/flash.h>
+#endif
+
static void runImg(int argc, char *argv[]);
static void do_mem(int argc, char *argv[]);
);
}
-extern unsigned long entry_address;
-
static void runImg(int argc,char *argv[])
{
unsigned int virt_addr, phys_addr;
romupdate
);
-extern int flash_program(void *_addr, void *_data, int len, void **err_addr);
-extern int flash_erase(void *addr, int len, void **err_addr);
-extern char *flash_errmsg(int err);
-
#ifdef CYGPKG_IO_FLASH
void romupdate(int argc, char *argv[])
{
void *err_addr, *base_addr;
int stat;
- base_addr = (void*)MXC_NAND_BASE_DUMMY;
+ base_addr = (void*)(MXC_NAND_BASE_DUMMY + CYGBLD_REDBOOT_FLASH_BOOT_OFFSET);
diag_printf("Updating RedBoot in NAND flash\n");
// Erase area to be programmed
return;
}
// Now program it
- if ((stat = flash_program(base_addr, ram_end - CYGMEM_REGION_rom_SIZE,
+ if ((stat = flash_program(base_addr, ram_end,
CYGBLD_REDBOOT_MIN_IMAGE_SIZE, &err_addr)) != 0) {
diag_printf("Can't program region at %p: %s\n",
err_addr, flash_errmsg(stat));
}
#endif //CYGPKG_IO_FLASH
#endif /* CYG_HAL_STARTUP_ROMRAM */
-
-static void setcorevol(int argc, char *argv[]);
-
-RedBoot_cmd("setcorevol",
- "Set the core voltage. Setting is not checked against current core frequency.",
- "[1.2 | 1.25 | 1.3 | 1.35 | 1.4 | 1.45 | 1.5 | 1.55 | 1.6]",
- setcorevol
- );
-
-/*
- * This function communicates with LP3972 to set the core voltage according to
- * the argument
- */
-// LW: revisit use I2C routines for LP3972
-unsigned int setCoreVoltage(unsigned int coreVol)
-{
- /* Set the core voltage */
- diag_printf("%s: Not yet implemented\n", __FUNCTION__);
- return 0;
-}
-
-static void setcorevol(int argc, char *argv[])
-{
- unsigned int coreVol;
-
- /* check if the number of args is OK. 1 arg expected. argc = 2 */
- if (argc != 2) {
- diag_printf("Invalid argument. Need to specify a voltage\n");
- return;
- }
-
- /* check if the argument is valid. */
- if (strcasecmp(argv[1], "1.2") == 0) {
- coreVol = 0xC;
- } else if (strcasecmp(argv[1], "1.25") == 0) {
- coreVol = 0xE;
- } else if (strcasecmp(argv[1], "1.3") == 0) {
- coreVol = 0x10;
- } else if (strcasecmp(argv[1], "1.35") == 0) {
- coreVol = 0x12;
- } else if (strcasecmp(argv[1], "1.4") == 0) {
- coreVol = 0x14;
- } else if (strcasecmp(argv[1], "1.45") == 0) {
- coreVol = 0x16;
- } else if (strcasecmp(argv[1], "1.5") == 0) {
- coreVol = 0x18;
- } else if (strcasecmp(argv[1], "1.55") == 0) {
- coreVol = 0x1A;
- } else if (strcasecmp(argv[1], "1.6") == 0) {
- coreVol = 0x1C;
- } else {
- diag_printf("Invalid argument. Type help setcorevol for valid values\n");
- return ;
- }
-
- setCoreVoltage(coreVol);
- return;
-}