Skip to content

Commit

Permalink
flash: complete CONFIG_SYS_NO_FLASH move with renaming
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
masahir0y authored and trini committed Feb 12, 2017
1 parent a931e99 commit e856bdc
Show file tree
Hide file tree
Showing 904 changed files with 751 additions and 589 deletions.
13 changes: 0 additions & 13 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2780,19 +2780,6 @@ The following options need to be configured:
this is instead controlled by the value of
/config/load-environment.

- Parallel Flash support:
CONFIG_SYS_NO_FLASH

Traditionally U-Boot was run on systems with parallel NOR
flash. This option is used to disable support for parallel NOR
flash. This option should be defined if the board does not have
parallel flash.

If this option is not defined one of the generic flash drivers
(e.g. CONFIG_FLASH_CFI_DRIVER or CONFIG_ST_SMI) must be
selected or the board must provide an implementation of the
flash API (see include/flash.h).

- DataFlash Support:
CONFIG_HAS_DATAFLASH

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv7/mx6/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ void select_ldb_di_clock_source(enum ldb_di_clock clk)
}
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
void enable_eim_clk(unsigned char enable)
{
u32 reg;
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-uniphier/micro-support-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int board_eth_init(bd_t *bis)
}
#endif

#if !defined(CONFIG_SYS_NO_FLASH)
#if defined(CONFIG_MTD_NOR_FLASH)

#include <mtd/cfi_flash.h>

Expand Down Expand Up @@ -157,11 +157,11 @@ static void detect_num_flash_banks(void)

debug("number of flash banks: %d\n", cfi_flash_num_flash_banks);
}
#else /* CONFIG_SYS_NO_FLASH */
#else /* CONFIG_MTD_NOR_FLASH */
static void detect_num_flash_banks(void)
{
};
#endif /* CONFIG_SYS_NO_FLASH */
#endif /* CONFIG_MTD_NOR_FLASH */

void support_card_late_init(void)
{
Expand Down
8 changes: 4 additions & 4 deletions board/amcc/sequoia/sequoia.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

DECLARE_GLOBAL_DATA_PTR;

#if !defined(CONFIG_SYS_NO_FLASH)
#if defined(CONFIG_MTD_NOR_FLASH)
extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
#endif

Expand Down Expand Up @@ -124,7 +124,7 @@ int board_early_init_f(void)

int misc_init_r(void)
{
#if !defined(CONFIG_SYS_NO_FLASH)
#if defined(CONFIG_MTD_NOR_FLASH)
uint pbcr;
int size_val = 0;
#endif
Expand All @@ -136,7 +136,7 @@ int misc_init_r(void)
#endif
u32 reg;

#if !defined(CONFIG_SYS_NO_FLASH)
#if defined(CONFIG_MTD_NOR_FLASH)
/* Re-do flash sizing to get full correct info */

/* adjust flash start and offset */
Expand Down Expand Up @@ -176,7 +176,7 @@ int misc_init_r(void)
CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1,
&flash_info[0]);
#endif
#endif /* CONFIG_SYS_NO_FLASH */
#endif /* CONFIG_MTD_NOR_FLASH */

/*
* USB suff...
Expand Down
8 changes: 4 additions & 4 deletions board/atmel/at91sam9263ek/at91sam9263ek.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ static void at91sam9263ek_lcd_hw_init(void)
#include <nand.h>
#include <version.h>

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
extern flash_info_t flash_info[];
#endif

void lcd_show_board_info(void)
{
ulong dram_size, nand_size;
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
ulong flash_size;
#endif
int i;
Expand All @@ -192,15 +192,15 @@ void lcd_show_board_info(void)
nand_size = 0;
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
nand_size += nand_info[i]->size;
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
flash_size = 0;
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++)
flash_size += flash_info[i].size;
#endif
lcd_printf (" %ld MB SDRAM, %ld MB NAND",
dram_size >> 20,
nand_size >> 20 );
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
lcd_printf (",\n %ld MB NOR",
flash_size >> 20);
#endif
Expand Down
4 changes: 2 additions & 2 deletions board/atmel/sama5d3xek/sama5d3xek.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void sama5d3xek_nand_hw_init(void)
}
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
static void sama5d3xek_nor_hw_init(void)
{
struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
Expand Down Expand Up @@ -236,7 +236,7 @@ int board_init(void)
#ifdef CONFIG_NAND_ATMEL
sama5d3xek_nand_hw_init();
#endif
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
sama5d3xek_nor_hw_init();
#endif
#ifdef CONFIG_CMD_USB
Expand Down
4 changes: 2 additions & 2 deletions board/bf518f-ezbrd/bf518f-ezbrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int checkboard(void)
#if defined(CONFIG_BFIN_MAC)
static void board_init_enetaddr(uchar *mac_addr)
{
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we cram the MAC in the last flash sector */
uchar *board_mac_addr = (uchar *)0x203F0096;
if (is_valid_ethaddr(board_mac_addr)) {
Expand Down Expand Up @@ -136,7 +136,7 @@ int misc_init_r(void)
board_init_enetaddr(enetaddr);
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we use the last sector for the MAC address / POST LDR */
extern flash_info_t flash_info[];
flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
Expand Down
4 changes: 2 additions & 2 deletions board/bf526-ezbrd/bf526-ezbrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we cram the MAC in the last flash sector */
uchar *board_mac_addr = (uchar *)0x203F0096;
if (is_valid_ethaddr(board_mac_addr)) {
Expand All @@ -50,7 +50,7 @@ int misc_init_r(void)
board_init_enetaddr(enetaddr);
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we use the last sector for the MAC address / POST LDR */
extern flash_info_t flash_info[];
flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
Expand Down
4 changes: 2 additions & 2 deletions board/bf537-stamp/bf537-stamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we cram the MAC in the last flash sector */
uchar *board_mac_addr = (uchar *)0x203F0000;
if (is_valid_ethaddr(board_mac_addr)) {
Expand All @@ -54,7 +54,7 @@ int misc_init_r(void)
board_init_enetaddr(enetaddr);
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we use the last sector for the MAC address / POST LDR */
extern flash_info_t flash_info[];
flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
Expand Down
4 changes: 2 additions & 2 deletions board/dnp5370/dnp5370.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we cram the MAC in the last flash sector */
uchar *board_mac_addr = (uchar *)0x202F0000;
if (is_valid_ethaddr(board_mac_addr)) {
Expand All @@ -63,7 +63,7 @@ int misc_init_r(void)
board_init_enetaddr(enetaddr);
#endif

#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
/* we use the last sector for the MAC address / POST LDR */
extern flash_info_t flash_info[];
flash_protect(FLAG_PROTECT_SET, 0x202F0000, 0x202FFFFF, &flash_info[0]);
Expand Down
2 changes: 1 addition & 1 deletion board/freescale/bsc9132qds/bsc9132qds.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void dsp_ddr_configure(void)

int board_early_init_r(void)
{
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
int flash_esel = find_tlb_idx((void *)flashbase, 1);

Expand Down
2 changes: 1 addition & 1 deletion board/freescale/t102xqds/law.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/mmu.h>

struct law_entry law_table[] = {
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_IFC),
#endif
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
Expand Down
2 changes: 1 addition & 1 deletion board/freescale/t102xrdb/law.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/mmu.h>

struct law_entry law_table[] = {
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_IFC),
#endif
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
Expand Down
2 changes: 1 addition & 1 deletion board/freescale/t1040qds/law.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/mmu.h>

struct law_entry law_table[] = {
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_IFC),
#endif
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
Expand Down
2 changes: 1 addition & 1 deletion board/freescale/t104xrdb/law.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/mmu.h>

struct law_entry law_table[] = {
#ifndef CONFIG_SYS_NO_FLASH
#ifdef CONFIG_MTD_NOR_FLASH
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_IFC),
#endif
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
Expand Down
10 changes: 5 additions & 5 deletions board/renesas/blanche/blanche.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void s_init(void)
/* SCIF Init */
pin_init();

#if !defined(CONFIG_SYS_NO_FLASH)
#if defined(CONFIG_MTD_NOR_FLASH)
struct rcar_lbsc *lbsc = (struct rcar_lbsc *)LBSC_BASE;
struct rcar_dbsc3 *dbsc3_0 = (struct rcar_dbsc3 *)DBSC3_0_BASE;

Expand Down Expand Up @@ -300,7 +300,7 @@ void s_init(void)

/* This locks the access to the PHY unit registers */
writel(0x00000000, &dbsc3_0->dbpdlck);
#endif /* CONFIG_SYS_NO_FLASH */
#endif /* CONFIG_MTD_NOR_FLASH */

}

Expand Down Expand Up @@ -368,21 +368,21 @@ int board_init(void)
gpio_request(GPIO_FN_A17, NULL);
gpio_request(GPIO_FN_A18, NULL);
gpio_request(GPIO_FN_A19, NULL);
#if defined(CONFIG_SYS_NO_FLASH)
#if !defined(CONFIG_MTD_NOR_FLASH)
gpio_request(GPIO_FN_MOSI_IO0, NULL);
gpio_request(GPIO_FN_MISO_IO1, NULL);
gpio_request(GPIO_FN_IO2, NULL);
gpio_request(GPIO_FN_IO3, NULL);
gpio_request(GPIO_FN_SPCLK, NULL);
gpio_request(GPIO_FN_SSL, NULL);
#else /* CONFIG_SYS_NO_FLASH */
#else /* CONFIG_MTD_NOR_FLASH */
gpio_request(GPIO_FN_A20, NULL);
gpio_request(GPIO_FN_A21, NULL);
gpio_request(GPIO_FN_A22, NULL);
gpio_request(GPIO_FN_A23, NULL);
gpio_request(GPIO_FN_A24, NULL);
gpio_request(GPIO_FN_A25, NULL);
#endif /* CONFIG_SYS_NO_FLASH */
#endif /* CONFIG_MTD_NOR_FLASH */

gpio_request(GPIO_FN_CS1_A26, NULL);
gpio_request(GPIO_FN_EX_CS0, NULL);
Expand Down
2 changes: 1 addition & 1 deletion cmd/cramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
Loading

0 comments on commit e856bdc

Please sign in to comment.