mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 01/11] ARM: i.MX: bbu: Add support for v1 header to MMC boot handler
Date: Tue, 18 Sep 2018 15:22:55 -0700	[thread overview]
Message-ID: <20180918222305.6834-2-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180918222305.6834-1-andrew.smirnov@gmail.com>

Convert imx_bbu_internal_v2_mmcboot_update() to use imx_bbu_update()
for actual update in order to be able to support v1 as well as v2
headers. While at it rename the function to
imx_bbu_internal_mmcboot_update() to reflect that change.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 32 +++++++++++++++-------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 504e359bc..a283b7c5c 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -401,11 +401,10 @@ static int imx_bbu_update(struct bbu_handler *handler, struct bbu_data *data)
 	return imx_handler->write_device(imx_handler, data);
 }
 
-static int imx_bbu_internal_v2_mmcboot_update(struct bbu_handler *handler,
-					      struct bbu_data *data)
+static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler,
+					   struct bbu_data *data)
 {
-	struct imx_internal_bbu_handler *imx_handler =
-		container_of(handler, struct imx_internal_bbu_handler, handler);
+	struct bbu_data _data = *data;
 	int ret;
 	char *bootpartvar;
 	const char *bootpart;
@@ -427,16 +426,14 @@ static int imx_bbu_internal_v2_mmcboot_update(struct bbu_handler *handler,
 	if (ret < 0)
 		goto free_bootpartvar;
 
-	ret = imx_bbu_check_prereq(imx_handler, devicefile, data,
-				   filetype_imx_image_v2);
+	_data.devicefile = devicefile;
+
+	ret = imx_bbu_update(handler, &_data);
 	if (ret)
 		goto free_devicefile;
 
-	ret = imx_bbu_write_device(imx_handler, devicefile, data, data->image, data->len);
-
-	if (!ret)
-		/* on success switch boot source */
-		ret = setenv(bootpartvar, bootpart);
+	/* on success switch boot source */
+	ret = setenv(bootpartvar, bootpart);
 
 free_devicefile:
 	free(devicefile);
@@ -586,20 +583,25 @@ int imx8mq_bbu_internal_mmc_register_handler(const char *name,
  * Note that no further partitioning of the boot partition is supported up to
  * now.
  */
-int imx6_bbu_internal_mmcboot_register_handler(const char *name,
-					       const char *devicefile,
-					       unsigned long flags)
+static int imx_bbu_internal_mmcboot_register_handler(const char *name,
+						     const char *devicefile,
+						     unsigned long flags)
 {
 	struct imx_internal_bbu_handler *imx_handler;
 
 	imx_handler = __init_handler(name, devicefile, flags);
 	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
 
-	imx_handler->handler.handler = imx_bbu_internal_v2_mmcboot_update;
+	imx_handler->handler.handler = imx_bbu_internal_mmcboot_update;
 
 	return __register_handler(imx_handler);
 }
 
+int imx6_bbu_internal_mmcboot_register_handler(const char *name,
+					       const char *devicefile,
+					       unsigned long flags)
+	__alias(imx_bbu_internal_mmcboot_register_handler);
+
 /*
  * Register an i.MX53 internal boot update handler for i2c/spi
  * EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-09-18 22:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 22:22 [PATCH 00/11] Switch ZII boards to use MMC boot partitions Andrey Smirnov
2018-09-18 22:22 ` Andrey Smirnov [this message]
2018-09-18 22:22 ` [PATCH 02/11] ARM: i.MX51: bbu: Add a handler for " Andrey Smirnov
2018-09-18 22:22 ` [PATCH 03/11] ARM: i.MX: bbu: Check retrun value of getenv() Andrey Smirnov
2018-09-18 22:22 ` [PATCH 04/11] ARM: i.MX: bbu: Convert devicefile to device name Andrey Smirnov
2018-09-18 22:22 ` [PATCH 05/11] ARM: i.MX: bbu: Detect MMC before reading current boot partition Andrey Smirnov
2018-09-18 22:23 ` [PATCH 06/11] ARM: VFxxx: bbu: Add a handler for MMC boot partitions Andrey Smirnov
2018-09-18 22:23 ` [PATCH 07/11] dts: VFxxx: Add aliases for ESDHC controllers Andrey Smirnov
2018-09-18 22:23 ` [PATCH 08/11] ARM: zii-vf610-dev: Switch MMC BBU to use boot partitions Andrey Smirnov
2018-09-18 22:23 ` [PATCH 09/11] ARM: rdu2: " Andrey Smirnov
2018-09-18 22:23 ` [PATCH 10/11] ARM: rdu1: Change BBU names to match RDU2 Andrey Smirnov
2018-09-18 22:23 ` [PATCH 11/11] ARM: rdu1: Switch MMC BBU to use boot partitions Andrey Smirnov
2018-09-19  7:54 ` [PATCH 00/11] Switch ZII boards to use MMC " Sascha Hauer

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=20180918222305.6834-2-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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