summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-02-11 22:43:54 +0900
committerTom Rini <trini@konsulko.com>2017-02-12 14:30:25 -0500
commite856bdcfb49291d30b19603fc101bea096c48196 (patch)
tree55b06a9fcd09e0390cafc789aff5d86638eeb3f3 /cmd
parenta931e9975bd8fa2a1866d560de6a388042d00f0b (diff)
downloadu-boot-e856bdcfb49291d30b19603fc101bea096c48196.tar.gz
u-boot-e856bdcfb49291d30b19603fc101bea096c48196.tar.bz2
u-boot-e856bdcfb49291d30b19603fc101bea096c48196.zip
flash: complete CONFIG_SYS_NO_FLASH move with renaming
We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is not completed. Finish this work by the tool. During this move, let's rename it to CONFIG_MTD_NOR_FLASH. Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH" than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will make the code more readable. Besides, negative meaning symbols do not fit in obj-$(CONFIG_...) style Makefiles. This commit was created as follows: [1] Edit "default n" to "default y" in the config entry in common/Kconfig. [2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH" [3] Rename the instances in defconfigs by the following: find . -path './configs/*_defconfig' | xargs sed -i \ -e '/CONFIG_SYS_NO_FLASH=y/d' \ -e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/' [4] Change the conditionals by the following: find . -name '*.[ch]' | xargs sed -i \ -e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \ -e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \ -e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \ -e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/' [5] Modify the following manually - Rename the rest of instances - Remove the description from README - Create the new Kconfig entry in drivers/mtd/Kconfig - Remove the old Kconfig entry from common/Kconfig - Remove the garbage comments from include/configs/*.h Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cramfs.c2
-rw-r--r--cmd/flash.c34
-rw-r--r--cmd/load.c4
-rw-r--r--cmd/mem.c4
4 files changed, 22 insertions, 22 deletions
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index c1034916c6..965ca4e60d 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -31,7 +31,7 @@
#include <flash.h>
-#ifdef CONFIG_SYS_NO_FLASH
+#ifndef CONFIG_MTD_NOR_FLASH
# define OFFSET_ADJUSTMENT 0
#else
# define OFFSET_ADJUSTMENT (flash_info[id.num].start[0])
diff --git a/cmd/flash.c b/cmd/flash.c
index 85d18bb2c5..b150940bf3 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -25,7 +25,7 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part);
#endif
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>
#include <mtd/cfi_flash.h>
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;
}
-#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[])
{
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
ulong bank;
#endif
@@ -283,7 +283,7 @@ static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
dataflash_print_info();
#endif
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
if (argc == 1) { /* print info for all FLASH banks */
for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
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);
flash_print_info (&flash_info[bank-1]);
-#endif /* CONFIG_SYS_NO_FLASH */
+#endif /* CONFIG_MTD_NOR_FLASH */
return 0;
}
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;
ulong bank, addr_first, addr_last;
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;
#else
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)
{
flash_info_t *info;
@@ -436,12 +436,12 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
}
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[])
{
int rcode = 0;
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
flash_info_t *info = NULL;
ulong bank;
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;
u8 dev_type, dev_num, pnum;
#endif
-#endif /* CONFIG_SYS_NO_FLASH */
+#endif /* CONFIG_MTD_NOR_FLASH */
#ifdef CONFIG_HAS_DATAFLASH
int status;
#endif
-#if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
+#if defined(CONFIG_MTD_NOR_FLASH) || defined(CONFIG_HAS_DATAFLASH)
int p;
ulong addr_first, addr_last;
#endif
@@ -462,7 +462,7 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc < 3)
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)
p = 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
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
if (strcmp(argv[2], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
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;
rcode = flash_sect_protect (p, addr_first, addr_last);
-#endif /* CONFIG_SYS_NO_FLASH */
+#endif /* CONFIG_MTD_NOR_FLASH */
return rcode;
}
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
{
flash_info_t *info;
@@ -664,7 +664,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
}
return rcode;
}
-#endif /* CONFIG_SYS_NO_FLASH */
+#endif /* CONFIG_MTD_NOR_FLASH */
/**************************************************/
diff --git a/cmd/load.c b/cmd/load.c
index 77c3359b29..4597ec5618 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -151,7 +151,7 @@ static ulong load_serial(long offset)
case SREC_DATA3:
case SREC_DATA4:
store_addr = addr + offset;
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
if (addr2info(store_addr)) {
int rc;
@@ -971,7 +971,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
store_addr = addr + offset;
size += res;
addr += res;
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
if (addr2info(store_addr)) {
int rc;
diff --git a/cmd/mem.c b/cmd/mem.c
index ff6a7709d2..83d34faf2d 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -396,7 +396,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
/* check if we are copying to Flash */
if ( (addr2info(dest) != NULL)
#ifdef CONFIG_HAS_DATAFLASH
@@ -436,7 +436,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Check if we are copying from DataFlash to RAM */
if (addr_dataflash(addr) && !addr_dataflash(dest)
-#ifndef CONFIG_SYS_NO_FLASH
+#ifdef CONFIG_MTD_NOR_FLASH
&& (addr2info(dest) == NULL)
#endif
){