public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alex Kiernan <alex.kiernan@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v7 04/18] fastboot: Correct dependencies in FASTBOOT_FLASH
Date: Thu, 24 May 2018 13:28:59 +0000	[thread overview]
Message-ID: <20180524132913.11575-5-alex.kiernan@gmail.com> (raw)
In-Reply-To: <20180524132913.11575-1-alex.kiernan@gmail.com>

Ensure that when selecting FASTBOOT_FLASH you end up with a buildable
configuration. Prior to this you could select NAND without MTDPARTS
and end up with an image which (surprisingly) excluded NAND.

Also fix dependencies on FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME which require
you have EFI_PARTITION/DOS_PARTITION enabled.

Delete redundant FASTBOOT_FLASH_NAND_DEV from Kconfig - it was only ever
used as a guard and the value was ignored in all cases, we're using
FASTBOOT_FLASH_NAND as the guard now.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v7: None
Changes in v6:
- delete redundant FASTBOOT_FLASH_NAND_DEV symbol

Changes in v5: None
Changes in v4: None
Changes in v3:
- guard FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME with EFI/DOS_PARTITION

Changes in v2: None

 arch/arm/mach-omap2/utils.c     |  4 ++--
 drivers/fastboot/Kconfig        | 17 ++++-------------
 drivers/fastboot/Makefile       |  8 ++------
 drivers/usb/gadget/f_fastboot.c | 14 +++++++-------
 4 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index dc7b37f164..edf5edcb68 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -85,7 +85,7 @@ static void omap_set_fastboot_board_rev(void)
 	env_set("fastboot.board_rev", board_rev);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 static u32 omap_mmc_get_part_size(const char *part)
 {
 	int res;
@@ -128,7 +128,7 @@ static void omap_set_fastboot_userdata_size(void)
 static inline void omap_set_fastboot_userdata_size(void)
 {
 }
-#endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */
+#endif /* CONFIG_FASTBOOT_FLASH_MMC */
 void omap_set_fastboot_vars(void)
 {
 	omap_set_fastboot_cpu();
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 93a8ac64e7..9bbc5c661d 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -56,6 +56,7 @@ config FASTBOOT_USB_DEV
 config FASTBOOT_FLASH
 	bool "Enable FASTBOOT FLASH command"
 	default y if ARCH_SUNXI
+	depends on MMC || (NAND && CMD_MTDPARTS)
 	help
 	  The fastboot protocol includes a "flash" command for writing
 	  the downloaded image to a non-volatile storage device. Define
@@ -71,7 +72,7 @@ config FASTBOOT_FLASH_MMC
 
 config FASTBOOT_FLASH_NAND
 	bool "FASTBOOT on NAND"
-	depends on NAND
+	depends on NAND && CMD_MTDPARTS
 
 endchoice
 
@@ -85,19 +86,9 @@ config FASTBOOT_FLASH_MMC_DEV
 	  regarding the non-volatile storage device. Define this to
 	  the eMMC device that fastboot should use to store the image.
 
-config FASTBOOT_FLASH_NAND_DEV
-	int "Define FASTBOOT NAND FLASH default device"
-	depends on FASTBOOT_FLASH_NAND
-	depends on CMD_MTDPARTS
-	default 0 if ARCH_SUNXI && NAND_SUNXI
-	help
-	  The fastboot "flash" command requires additional information
-	  regarding the non-volatile storage device. Define this to
-	  the NAND device that fastboot should use to store the image.
-
 config FASTBOOT_GPT_NAME
 	string "Target name for updating GPT"
-	depends on FASTBOOT_FLASH
+	depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
 	default "gpt"
 	help
 	  The fastboot "flash" command supports writing the downloaded
@@ -110,7 +101,7 @@ config FASTBOOT_GPT_NAME
 
 config FASTBOOT_MBR_NAME
 	string "Target name for updating MBR"
-	depends on FASTBOOT_FLASH
+	depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
 	default "mbr"
 	help
 	  The fastboot "flash" command allows to write the downloaded image
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index b38dcff202..e4bd389adf 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -2,9 +2,5 @@
 
 obj-y += fb_common.o
 
-ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-obj-y += fb_mmc.o
-endif
-ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-obj-y += fb_nand.o
-endif
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
+obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 2e6e1615bf..323ac89417 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -20,10 +20,10 @@
 #include <linux/compiler.h>
 #include <version.h>
 #include <g_dnl.h>
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 #include <fb_mmc.h>
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
 #include <fb_nand.h>
 #endif
 
@@ -583,11 +583,11 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 	}
 
 	fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 	fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
 			   download_bytes, response);
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
 	fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
 			    download_bytes, response);
 #endif
@@ -598,7 +598,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 static void cb_oem(struct usb_ep *ep, struct usb_request *req)
 {
 	char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 	if (strncmp("format", cmd + 4, 6) == 0) {
 		char cmdbuf[32];
                 sprintf(cmdbuf, "gpt write mmc %x $partitions",
@@ -631,10 +631,10 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req)
 	}
 
 	fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 	fb_mmc_erase(cmd, response);
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
 	fb_nand_erase(cmd, response);
 #endif
 	fastboot_tx_write_str(response);
-- 
2.17.0

  parent reply	other threads:[~2018-05-24 13:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 13:28 [U-Boot] [PATCH v7 00/18] Add fastboot UDP support Alex Kiernan
2018-05-24 13:28 ` [U-Boot] [PATCH v7 01/18] fastboot: Move fastboot to drivers/fastboot Alex Kiernan
2018-05-24 13:28 ` [U-Boot] [PATCH v7 02/18] fastboot: Refactor fastboot_okay/fail to take response Alex Kiernan
2018-05-24 13:28 ` [U-Boot] [PATCH v7 03/18] fastboot: Extract fastboot_okay/fail to fb_common.c Alex Kiernan
2018-05-24 13:28 ` Alex Kiernan [this message]
2018-05-24 13:29 ` [U-Boot] [PATCH v7 05/18] fastboot: Add missing newlines Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 06/18] fastboot: Remove FIXME for CONFIG_FASTBOOT_...NAME Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 07/18] fastboot: Fix parameter types in _fb_nand_write Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 08/18] fastboot: Rename fb_set_reboot_flag to fastboot_set_reboot_flag Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 09/18] fastboot: Extract common definitions from USB fastboot Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 10/18] fastboot: Rename public fb_ functions to fastboot_ Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 11/18] ti: fastboot: Move weak overrides to board files Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 12/18] fs: Add fs_get_type_name to return current filesystem name Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 13/18] fastboot: Migrate FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 14/18] mmc: Separate "mmc swrite" from fastboot Alex Kiernan
2018-05-25  2:41   ` Simon Glass
2018-05-25 10:02     ` Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 15/18] net: fastboot: Merge AOSP UDP fastboot Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 16/18] fastboot: Add support for 'oem format' command Alex Kiernan
2018-05-24 13:29 ` [U-Boot] [PATCH v7 17/18] usb: fastboot: Convert USB f_fastboot to shared fastboot Alex Kiernan
2018-05-25  2:41   ` Simon Glass
2018-05-24 13:29 ` [U-Boot] [PATCH v7 18/18] fastboot: Update fastboot documentation Alex Kiernan
2018-05-25  2:41   ` Simon Glass
2018-05-28  7:39 ` [U-Boot] [PATCH v7 00/18] Add fastboot UDP support Lukasz Majewski
2018-05-29 11:24   ` Alex Kiernan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180524132913.11575-5-alex.kiernan@gmail.com \
    --to=alex.kiernan@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox