[PATCH 02/18] common: Drop flash.h from common header

Simon Glass sjg at chromium.org
Tue Apr 7 04:40:15 CEST 2020


Move this uncommon header out of the common header.

Fix up some style problems in flash.h while we are here.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/arm/mach-at91/arm926ejs/eflash.c      |  9 +++----
 board/AndesTech/adp-ae3xx/adp-ae3xx.c      |  1 +
 board/AndesTech/adp-ag101p/adp-ag101p.c    |  1 +
 board/AndesTech/ax25-ae350/ax25-ae350.c    |  1 +
 board/Arcturus/ucp1020/cmd_arc.c           |  1 +
 board/atmel/at91sam9263ek/at91sam9263ek.c  |  1 +
 board/buffalo/lsxl/lsxl.c                  |  1 +
 board/cobra5272/flash.c                    | 18 +++++++-------
 board/freescale/common/fsl_validate.c      |  1 +
 board/freescale/m5253demo/flash.c          |  1 +
 board/freescale/mpc8568mds/bcsr.c          |  1 +
 board/freescale/mpc8568mds/mpc8568mds.c    |  1 +
 board/freescale/mpc8569mds/bcsr.c          |  1 +
 board/freescale/mpc8569mds/mpc8569mds.c    |  1 +
 board/gardena/smart-gateway-mt7688/board.c |  1 +
 board/gdsys/mpc8308/hrcon.c                |  1 +
 board/gdsys/mpc8308/strider.c              |  1 +
 board/renesas/sh7752evb/sh7752evb.c        |  1 +
 board/renesas/sh7753evb/sh7753evb.c        |  1 +
 board/renesas/sh7757lcr/sh7757lcr.c        |  1 +
 board/siemens/taurus/taurus.c              |  1 +
 board/socrates/socrates.c                  | 28 ++++++++++++----------
 board/spear/x600/x600.c                    |  1 +
 cmd/armflash.c                             |  1 +
 cmd/cros_ec.c                              |  1 +
 cmd/flash.c                                | 23 ++++++++++--------
 cmd/jffs2.c                                |  1 +
 cmd/mvebu/bubt.c                           |  1 +
 cmd/sf.c                                   |  1 +
 common/board_r.c                           |  1 +
 common/flash.c                             | 11 +++++----
 drivers/dfu/dfu_sf.c                       |  1 +
 drivers/fastboot/fb_command.c              |  1 +
 drivers/fastboot/fb_mmc.c                  |  1 +
 drivers/fastboot/fb_nand.c                 |  1 +
 drivers/misc/cros_ec.c                     |  1 +
 drivers/mtd/cfi_flash.c                    |  1 +
 drivers/mtd/jedec_flash.c                  |  1 +
 drivers/mtd/spi/sf_dataflash.c             |  1 +
 drivers/mtd/spi/sf_mtd.c                   |  1 +
 drivers/mtd/stm32_flash.c                  |  1 +
 env/sf.c                                   |  2 ++
 fs/cramfs/cramfs.c                         |  1 +
 fs/jffs2/jffs2_1pass.c                     |  1 +
 include/common.h                           |  1 -
 include/flash.h                            | 24 +++++++++----------
 46 files changed, 101 insertions(+), 53 deletions(-)

diff --git a/arch/arm/mach-at91/arm926ejs/eflash.c b/arch/arm/mach-at91/arm926ejs/eflash.c
index 7b61fa72260..c875bfd89b7 100644
--- a/arch/arm/mach-at91/arm926ejs/eflash.c
+++ b/arch/arm/mach-at91/arm926ejs/eflash.c
@@ -43,6 +43,7 @@
  * do a read-modify-write for partially programmed pages
  */
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_common.h>
@@ -58,7 +59,7 @@
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 static u32 pagesize;
 
-unsigned long flash_init (void)
+unsigned long flash_init(void)
 {
 	at91_eefc_t *eefc = (at91_eefc_t *) ATMEL_BASE_EEFC;
 	at91_dbu_t *dbu = (at91_dbu_t *) ATMEL_BASE_DBGU;
@@ -127,7 +128,7 @@ unsigned long flash_init (void)
 	return size;
 }
 
-void flash_print_info (flash_info_t *info)
+void flash_print_info(flash_info_t *info)
 {
 	int i;
 
@@ -202,7 +203,7 @@ static u32 erase_write_page (u32 pagenum)
 		& (AT91_EEFC_FSR_FCMDE | AT91_EEFC_FSR_FLOCKE);
 }
 
-int flash_erase (flash_info_t *info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	debug("erase first=%d last=%d\n", s_first, s_last);
 	puts("this flash does not need and support erasing!\n");
@@ -215,7 +216,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
  * 1 - write timeout
  */
 
-int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 {
 	u32 pagenum;
 	u32 *src32, *dst32;
diff --git a/board/AndesTech/adp-ae3xx/adp-ae3xx.c b/board/AndesTech/adp-ae3xx/adp-ae3xx.c
index a04415decaf..8eb40bf295c 100644
--- a/board/AndesTech/adp-ae3xx/adp-ae3xx.c
+++ b/board/AndesTech/adp-ae3xx/adp-ae3xx.c
@@ -8,6 +8,7 @@
 #include <init.h>
 #include <asm/mach-types.h>
 #include <common.h>
+#include <flash.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
diff --git a/board/AndesTech/adp-ag101p/adp-ag101p.c b/board/AndesTech/adp-ag101p/adp-ag101p.c
index faf39b4ba6a..d349b19648d 100644
--- a/board/AndesTech/adp-ag101p/adp-ag101p.c
+++ b/board/AndesTech/adp-ag101p/adp-ag101p.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c
index f164073000c..de546dab174 100644
--- a/board/AndesTech/ax25-ae350/ax25-ae350.c
+++ b/board/AndesTech/ax25-ae350/ax25-ae350.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index b50de63c5e0..2b4853f8f91 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -12,6 +12,7 @@
 #include <cpu_func.h>
 #include <div64.h>
 #include <env.h>
+#include <flash.h>
 #include <malloc.h>
 #include <spi_flash.h>
 #include <mmc.h>
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index b811d931c44..be132bc185f 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <flash.h>
 #include <init.h>
 #include <net.h>
 #include <vsprintf.h>
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 95d3a5e1f57..aa641259ac6 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <net.h>
 #include <malloc.h>
 #include <netdev.h>
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 1d3c5acddf8..5860cd0ac03 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -7,14 +7,16 @@
 #include <common.h>
 #include <console.h>
 #include <cpu_func.h>
+#include <flash.h>
 #include <irq_func.h>
+#include <uuid.h>
 
 #define PHYS_FLASH_1 CONFIG_SYS_FLASH_BASE
 #define FLASH_BANK_SIZE 0x200000
 
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 
-void flash_print_info (flash_info_t * info)
+void flash_print_info(flash_info_t *info)
 {
 	int i;
 
@@ -55,7 +57,7 @@ Done:
 }
 
 
-unsigned long flash_init (void)
+unsigned long flash_init(void)
 {
 	int i, j;
 	ulong size = 0;
@@ -98,9 +100,9 @@ unsigned long flash_init (void)
 		size += flash_info[i].size;
 	}
 
-	flash_protect (FLAG_PROTECT_SET,
-		       CONFIG_SYS_FLASH_BASE,
-		       CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
+	flash_protect(FLAG_PROTECT_SET,
+		      CONFIG_SYS_FLASH_BASE,
+		      CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
 
 	return size;
 }
@@ -127,7 +129,7 @@ unsigned long flash_init (void)
 #define TMO   4
 
 
-int flash_erase (flash_info_t * info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	ulong result;
 	int iflag, cflag, prot, sect;
@@ -244,7 +246,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	return rc;
 }
 
-static int write_word (flash_info_t * info, ulong dest, ulong data)
+static int write_word(flash_info_t *info, ulong dest, ulong data)
 {
 	volatile u16 *addr = (volatile u16 *) dest;
 	ulong result;
@@ -311,7 +313,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 }
 
 
-int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 {
 	ulong wp, data;
 	int rc;
diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index 2bf9d587460..6aa412a9377 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <flash.h>
 #include <fsl_validate.h>
 #include <fsl_secboot_err.h>
 #include <fsl_sfp.h>
diff --git a/board/freescale/m5253demo/flash.c b/board/freescale/m5253demo/flash.c
index a5223ecee6c..87368564afa 100644
--- a/board/freescale/m5253demo/flash.c
+++ b/board/freescale/m5253demo/flash.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <irq_func.h>
 
 #include <asm/immap.h>
diff --git a/board/freescale/mpc8568mds/bcsr.c b/board/freescale/mpc8568mds/bcsr.c
index 28e2a9435c6..b1e638af5ae 100644
--- a/board/freescale/mpc8568mds/bcsr.c
+++ b/board/freescale/mpc8568mds/bcsr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #include "bcsr.h"
diff --git a/board/freescale/mpc8568mds/mpc8568mds.c b/board/freescale/mpc8568mds/mpc8568mds.c
index 5167f81be71..da974956640 100644
--- a/board/freescale/mpc8568mds/mpc8568mds.c
+++ b/board/freescale/mpc8568mds/mpc8568mds.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
 #include <pci.h>
 #include <asm/processor.h>
diff --git a/board/freescale/mpc8569mds/bcsr.c b/board/freescale/mpc8569mds/bcsr.c
index 57cea0af689..9ed00f6e5b1 100644
--- a/board/freescale/mpc8569mds/bcsr.c
+++ b/board/freescale/mpc8569mds/bcsr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #include "bcsr.h"
diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c
index cf5d8a5244f..18e0d87a488 100644
--- a/board/freescale/mpc8569mds/mpc8569mds.c
+++ b/board/freescale/mpc8569mds/mpc8569mds.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <init.h>
 #include <pci.h>
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index 48cf3091e99..0fcb605e1b9 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <init.h>
 #include <led.h>
 #include <malloc.h>
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index d1110157a2e..8994c8c71b4 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index 9ba9e4278a5..a12e08685bf 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index 203eecf3d6d..135aaa5234c 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c
index 0b118b2f65d..fbfc49ee01d 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c
index e8d1fdd03fa..ed041b14ee8 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 0979df563ae..9f9cdfa2346 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9260_matrix.h>
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index b0ddee7906a..84644a85c7b 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -14,6 +14,7 @@
 #include <clock_legacy.h>
 #include <env.h>
 #include <pci.h>
+#include <uuid.h>
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
 #include <ioports.h>
@@ -105,25 +106,26 @@ int misc_init_r (void)
 		/*
 		 * Re-do flash protection upon new addresses
 		 */
-		flash_protect (FLAG_PROTECT_CLEAR,
-			       gd->bd->bi_flashstart, 0xffffffff,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_CLEAR,
+			      gd->bd->bi_flashstart, 0xffffffff,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Monitor protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_BASE +
+			      monitor_flash_len - 1,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Environment protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_ENV_ADDR,
-			       CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_ENV_ADDR,
+			      CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Redundant environment protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_ENV_ADDR_REDUND,
-			       CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_ENV_ADDR_REDUND,
+			      CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
 			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 	}
 
diff --git a/board/spear/x600/x600.c b/board/spear/x600/x600.c
index e1232edd143..7cff6eecf25 100644
--- a/board/spear/x600/x600.c
+++ b/board/spear/x600/x600.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
 #include <micrel.h>
 #include <nand.h>
diff --git a/cmd/armflash.c b/cmd/armflash.c
index 6872b0dde3d..f82f3dd1a37 100644
--- a/cmd/armflash.c
+++ b/cmd/armflash.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #define MAX_REGIONS 4
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index 9e2f1b06f3c..c6bbed9c4a2 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <cros_ec.h>
 #include <dm.h>
+#include <flash.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 
diff --git a/cmd/flash.c b/cmd/flash.c
index cd1758d7e2e..df97fe740d8 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -9,6 +9,7 @@
  */
 #include <common.h>
 #include <command.h>
+#include <uuid.h>
 
 #if defined(CONFIG_CMD_MTDPARTS)
 #include <jffs2/jffs2.h>
@@ -88,7 +89,7 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
 /*
  * Take *addr in Flash and adjust it to fall on the end of its sector
  */
-int flash_sect_roundb (ulong *addr)
+int flash_sect_roundb(ulong *addr)
 {
 	flash_info_t *info;
 	ulong bank, sector_end_addr;
@@ -279,7 +280,7 @@ static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("\nBank # %ld: ", bank+1);
 
-			flash_print_info (&flash_info[bank]);
+			flash_print_info(&flash_info[bank]);
 		}
 		return 0;
 	}
@@ -291,7 +292,7 @@ static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 	}
 	printf ("\nBank # %ld: ", bank);
-	flash_print_info (&flash_info[bank-1]);
+	flash_print_info(&flash_info[bank - 1]);
 #endif /* CONFIG_MTD_NOR_FLASH */
 	return 0;
 }
@@ -316,7 +317,7 @@ static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("Erase Flash Bank # %ld ", bank);
 			info = &flash_info[bank-1];
-			rcode = flash_erase (info, 0, info->sector_count-1);
+			rcode = flash_erase(info, 0, info->sector_count - 1);
 		}
 		return rcode;
 	}
@@ -370,7 +371,7 @@ static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 		printf ("Erase Flash Bank # %ld ", bank);
 		info = &flash_info[bank-1];
-		rcode = flash_erase (info, 0, info->sector_count-1);
+		rcode = flash_erase(info, 0, info->sector_count - 1);
 		return rcode;
 	}
 
@@ -390,7 +391,7 @@ static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 }
 
 #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;
 	ulong bank;
@@ -415,7 +416,8 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
 						info->start[0] + info->size - 1:
 						info->start[s_last[bank]+1] - 1,
 					bank+1);
-				rcode = flash_erase (info, s_first[bank], s_last[bank]);
+				rcode = flash_erase(info, s_first[bank],
+						    s_last[bank]);
 			}
 		}
 		if (rcode == 0)
@@ -526,7 +528,8 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 						p ? "" : "Un", argv[1],
 						bank, addr_first, addr_last);
 
-				rcode = flash_sect_protect (p, addr_first, addr_last);
+				rcode = flash_sect_protect(p, addr_first,
+							   addr_last);
 				return rcode;
 			}
 
@@ -580,13 +583,13 @@ static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (addr_first >= addr_last)
 		return CMD_RET_USAGE;
 
-	rcode = flash_sect_protect (p, addr_first, addr_last);
+	rcode = flash_sect_protect(p, addr_first, addr_last);
 #endif /* CONFIG_MTD_NOR_FLASH */
 	return rcode;
 }
 
 #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;
 	ulong bank;
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index da2580d85d7..748a73e2af9 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -73,6 +73,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <image.h>
 #include <malloc.h>
 #include <jffs2/jffs2.h>
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 2041a7a29aa..a422dee168a 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <image.h>
 #include <vsprintf.h>
 #include <errno.h>
diff --git a/cmd/sf.c b/cmd/sf.c
index e993b3e5adc..2b9c268ac42 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <div64.h>
 #include <dm.h>
+#include <flash.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <spi.h>
diff --git a/common/board_r.c b/common/board_r.c
index 0bbeaa7594c..1f1c23bfe7c 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -13,6 +13,7 @@
 #include <api.h>
 #include <cpu_func.h>
 #include <exports.h>
+#include <flash.h>
 #include <hang.h>
 #include <image.h>
 #include <irq_func.h>
diff --git a/common/flash.c b/common/flash.c
index 5f155aefd1d..4a28ac5d347 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <flash.h>
+#include <uuid.h>
 
 #include <mtd/cfi_flash.h>
 
@@ -24,7 +25,7 @@ extern flash_info_t  flash_info[]; /* info for FLASH chips */
  * If necessary you have to map the second bank at lower addresses.
  */
 void
-flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
+flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 {
 	ulong b_end;
 	short s_end;
@@ -84,7 +85,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
  */
 
 flash_info_t *
-addr2info (ulong addr)
+addr2info(ulong addr)
 {
 	flash_info_t *info;
 	int i;
@@ -119,12 +120,12 @@ addr2info (ulong addr)
  *			(only some targets require alignment)
  */
 int
-flash_write (char *src, ulong addr, ulong cnt)
+flash_write(char *src, ulong addr, ulong cnt)
 {
 	int i;
 	ulong         end        = addr + cnt - 1;
-	flash_info_t *info_first = addr2info (addr);
-	flash_info_t *info_last  = addr2info (end );
+	flash_info_t *info_first = addr2info(addr);
+	flash_info_t *info_last  = addr2info(end);
 	flash_info_t *info;
 	__maybe_unused char *src_orig = src;
 	__maybe_unused char *addr_orig = (char *)addr;
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 0fdbfae4341..318e43c179b 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <errno.h>
 #include <div64.h>
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 3c4acfecf6d..49f6a61c374 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -10,6 +10,7 @@
 #include <fastboot-internal.h>
 #include <fb_mmc.h>
 #include <fb_nand.h>
+#include <flash.h>
 #include <part.h>
 #include <stdlib.h>
 
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index d7cf9f4aac7..d3249a54f7c 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -10,6 +10,7 @@
 #include <fastboot.h>
 #include <fastboot-internal.h>
 #include <fb_mmc.h>
+#include <flash.h>
 #include <image-sparse.h>
 #include <part.h>
 #include <mmc.h>
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 6756ea769f3..b1654681450 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <flash.h>
 
 #include <fastboot.h>
 #include <image-sparse.h>
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index fa9984f6bd9..c145b679318 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <flash.h>
 #include <i2c.h>
 #include <cros_ec.h>
 #include <fdtdec.h>
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 4ce183b6f31..036cf0b4a1e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -22,6 +22,7 @@
 #include <env.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <flash.h>
 #include <irq_func.h>
 #include <asm/processor.h>
 #include <asm/io.h>
diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c
index f59b2bc62fb..ce921b461af 100644
--- a/drivers/mtd/jedec_flash.c
+++ b/drivers/mtd/jedec_flash.c
@@ -12,6 +12,7 @@
 /*#define DEBUG*/
 
 #include <common.h>
+#include <flash.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
index 55fb4bd31ac..b1a38048d32 100644
--- a/drivers/mtd/spi/sf_dataflash.c
+++ b/drivers/mtd/spi/sf_dataflash.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <flash.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <div64.h>
diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c
index 68c36002bee..987fac2501f 100644
--- a/drivers/mtd/spi/sf_mtd.c
+++ b/drivers/mtd/spi/sf_mtd.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <linux/errno.h>
 #include <linux/mtd/mtd.h>
diff --git a/drivers/mtd/stm32_flash.c b/drivers/mtd/stm32_flash.c
index fd0d5506e8f..95afa2d6bc7 100644
--- a/drivers/mtd/stm32_flash.c
+++ b/drivers/mtd/stm32_flash.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
 #include "stm32_flash.h"
diff --git a/env/sf.c b/env/sf.c
index 5ef40552194..ac16ed5bdd4 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -12,11 +12,13 @@
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <search.h>
 #include <errno.h>
+#include <uuid.h>
 #include <dm/device-internal.h>
 #include <u-boot/crc.h>
 
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 228f599d44b..7ef48bbc064 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -25,6 +25,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/stat.h>
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 5912cde8384..f58ec0e9a04 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -113,6 +113,7 @@
 
 #include <common.h>
 #include <config.h>
+#include <flash.h>
 #include <malloc.h>
 #include <div64.h>
 #include <linux/compiler.h>
diff --git a/include/common.h b/include/common.h
index a8242cafc51..1705d85e8a9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -29,7 +29,6 @@
 #include <stdio.h>
 #include <linux/kernel.h>
 #include <part.h>
-#include <flash.h>
 #include <image.h>
 #include <log.h>
 #include <asm/u-boot.h> /* boot information for Linux kernel */
diff --git a/include/flash.h b/include/flash.h
index 2655c72087f..3bf6b22399e 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -84,20 +84,20 @@ typedef unsigned long flash_sect_t;
 
 /* Prototypes */
 
-extern unsigned long flash_init (void);
-extern void flash_print_info (flash_info_t *);
-extern int flash_erase	(flash_info_t *, int, int);
-extern int flash_sect_erase (ulong addr_first, ulong addr_last);
-extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
-extern int flash_sect_roundb (ulong *addr);
-extern unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect);
-extern void flash_set_verbose(uint);
+unsigned long flash_init(void);
+void flash_print_info(flash_info_t *info);
+int flash_erase(flash_info_t *info, int s_first, int s_last);
+int flash_sect_erase(ulong addr_first, ulong addr_last);
+int flash_sect_protect(int flag, ulong addr_first, ulong addr_last);
+int flash_sect_roundb(ulong *addr);
+unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect);
+void flash_set_verbose(uint v);
 
 /* common/flash.c */
-extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
-extern int flash_write (char *, ulong, ulong);
-extern flash_info_t *addr2info (ulong);
-extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
+void flash_protect(int flag, ulong from, ulong to, flash_info_t *info);
+int flash_write(char *src, ulong addr, ulong cnt);
+flash_info_t *addr2info(ulong addr);
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt);
 
 /* drivers/mtd/cfi_mtd.c */
 #ifdef CONFIG_FLASH_CFI_MTD
-- 
2.26.0.292.g33ef6b2f38-goog



More information about the U-Boot mailing list