|
@@ -25,7 +25,7 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
|
|
u8 *part_num, struct part_info **part);
|
|
u8 *part_num, struct part_info **part);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
#include <flash.h>
|
|
#include <flash.h>
|
|
#include <mtd/cfi_flash.h>
|
|
#include <mtd/cfi_flash.h>
|
|
extern flash_info_t flash_info[]; /* info for FLASH chips */
|
|
extern flash_info_t flash_info[]; /* info for FLASH chips */
|
|
@@ -271,11 +271,11 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
|
|
|
|
|
|
return rcode;
|
|
return rcode;
|
|
}
|
|
}
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
|
|
|
|
static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
{
|
|
{
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
ulong bank;
|
|
ulong bank;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -283,7 +283,7 @@ static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
dataflash_print_info();
|
|
dataflash_print_info();
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
if (argc == 1) { /* print info for all FLASH banks */
|
|
if (argc == 1) { /* print info for all FLASH banks */
|
|
for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
|
|
for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
|
|
printf ("\nBank # %ld: ", bank+1);
|
|
printf ("\nBank # %ld: ", bank+1);
|
|
@@ -301,13 +301,13 @@ static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
}
|
|
}
|
|
printf ("\nBank # %ld: ", bank);
|
|
printf ("\nBank # %ld: ", bank);
|
|
flash_print_info (&flash_info[bank-1]);
|
|
flash_print_info (&flash_info[bank-1]);
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
{
|
|
{
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
flash_info_t *info = NULL;
|
|
flash_info_t *info = NULL;
|
|
ulong bank, addr_first, addr_last;
|
|
ulong bank, addr_first, addr_last;
|
|
int n, sect_first = 0, sect_last = 0;
|
|
int n, sect_first = 0, sect_last = 0;
|
|
@@ -395,10 +395,10 @@ static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
return rcode;
|
|
return rcode;
|
|
#else
|
|
#else
|
|
return 0;
|
|
return 0;
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
}
|
|
}
|
|
|
|
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
int flash_sect_erase (ulong addr_first, ulong addr_last)
|
|
int flash_sect_erase (ulong addr_first, ulong addr_last)
|
|
{
|
|
{
|
|
flash_info_t *info;
|
|
flash_info_t *info;
|
|
@@ -436,12 +436,12 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
|
|
}
|
|
}
|
|
return rcode;
|
|
return rcode;
|
|
}
|
|
}
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
|
|
|
|
static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
{
|
|
{
|
|
int rcode = 0;
|
|
int rcode = 0;
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
flash_info_t *info = NULL;
|
|
flash_info_t *info = NULL;
|
|
ulong bank;
|
|
ulong bank;
|
|
int i, n, sect_first = 0, sect_last = 0;
|
|
int i, n, sect_first = 0, sect_last = 0;
|
|
@@ -450,11 +450,11 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
struct part_info *part;
|
|
struct part_info *part;
|
|
u8 dev_type, dev_num, pnum;
|
|
u8 dev_type, dev_num, pnum;
|
|
#endif
|
|
#endif
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
#ifdef CONFIG_HAS_DATAFLASH
|
|
#ifdef CONFIG_HAS_DATAFLASH
|
|
int status;
|
|
int status;
|
|
#endif
|
|
#endif
|
|
-#if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
|
|
|
|
|
|
+#if defined(CONFIG_MTD_NOR_FLASH) || defined(CONFIG_HAS_DATAFLASH)
|
|
int p;
|
|
int p;
|
|
ulong addr_first, addr_last;
|
|
ulong addr_first, addr_last;
|
|
#endif
|
|
#endif
|
|
@@ -462,7 +462,7 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
if (argc < 3)
|
|
if (argc < 3)
|
|
return CMD_RET_USAGE;
|
|
return CMD_RET_USAGE;
|
|
|
|
|
|
-#if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
|
|
|
|
|
|
+#if defined(CONFIG_MTD_NOR_FLASH) || defined(CONFIG_HAS_DATAFLASH)
|
|
if (strcmp(argv[1], "off") == 0)
|
|
if (strcmp(argv[1], "off") == 0)
|
|
p = 0;
|
|
p = 0;
|
|
else if (strcmp(argv[1], "on") == 0)
|
|
else if (strcmp(argv[1], "on") == 0)
|
|
@@ -489,7 +489,7 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
if (strcmp(argv[2], "all") == 0) {
|
|
if (strcmp(argv[2], "all") == 0) {
|
|
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
|
|
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
|
|
info = &flash_info[bank-1];
|
|
info = &flash_info[bank-1];
|
|
@@ -611,11 +611,11 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
return CMD_RET_USAGE;
|
|
return CMD_RET_USAGE;
|
|
|
|
|
|
rcode = flash_sect_protect (p, addr_first, addr_last);
|
|
rcode = flash_sect_protect (p, addr_first, addr_last);
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
return rcode;
|
|
return rcode;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifndef CONFIG_SYS_NO_FLASH
|
|
|
|
|
|
+#ifdef CONFIG_MTD_NOR_FLASH
|
|
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
|
|
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
|
|
{
|
|
{
|
|
flash_info_t *info;
|
|
flash_info_t *info;
|
|
@@ -664,7 +664,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
|
|
}
|
|
}
|
|
return rcode;
|
|
return rcode;
|
|
}
|
|
}
|
|
-#endif /* CONFIG_SYS_NO_FLASH */
|
|
|
|
|
|
+#endif /* CONFIG_MTD_NOR_FLASH */
|
|
|
|
|
|
|
|
|
|
/**************************************************/
|
|
/**************************************************/
|