[U-Boot] [RFC PATCH v2 16/20] fastboot: net: Add NAND support

Alex Kiernan alex.kiernan at gmail.com
Mon Apr 30 08:32:50 UTC 2018


Add NAND support to fastboot UDP flash/erase commands

Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
---

Changes in v2: None

 net/fastboot.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/net/fastboot.c b/net/fastboot.c
index 119011c..a07b1ad 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -60,7 +60,7 @@ static int fastboot_our_port;
 static void cb_okay(char *, char *, unsigned int, char *);
 static void cb_getvar(char *, char *, unsigned int, char *);
 static void cb_download(char *, char *, unsigned int, char *);
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 static void cb_flash(char *, char *, unsigned int, char *);
 static void cb_erase(char *, char *, unsigned int, char *);
 #endif
@@ -74,7 +74,7 @@ static void (*fb_net_dispatch[])(char *cmd_parameter,
 	[FB_CMD_GETVAR] = cb_getvar,
 	[FB_CMD_DOWNLOAD] = cb_download,
 	[FB_CMD_VERIFY] = NULL,
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 	[FB_CMD_FLASH] = cb_flash,
 	[FB_CMD_ERASE] = cb_erase,
 #else
@@ -324,7 +324,7 @@ static void cb_download(char *cmd_parameter, char *fastboot_data,
 	}
 }
 
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 /**
  * Writes the previously downloaded image to the partition indicated by
  * cmd_parameter. Writes to response.
@@ -334,8 +334,14 @@ static void cb_download(char *cmd_parameter, char *fastboot_data,
 static void cb_flash(char *cmd_parameter, char *fastboot_data,
 		     unsigned int fastboot_data_len, char *response)
 {
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 	fb_mmc_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
 			   image_size, response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+	fb_nand_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+			    image_size, response);
+#endif
 }
 
 /**
@@ -347,7 +353,12 @@ static void cb_flash(char *cmd_parameter, char *fastboot_data,
 static void cb_erase(char *cmd_parameter, char *fastboot_data,
 		     unsigned int fastboot_data_len, char *response)
 {
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 	fb_mmc_erase(cmd_parameter, response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+	fb_nand_erase(cmd_parameter, response);
+#endif
 }
 #endif
 
-- 
2.7.4



More information about the U-Boot mailing list