mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* AM335x patches
@ 2014-09-30 13:10 Sascha Hauer
  2014-09-30 13:10 ` [PATCH 1/6] ARM: am33xx update SPI NOR: Check image size before flashing Sascha Hauer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

AM335x related patches, additions to the update handlers code and
documentation updates.

Sascha

----------------------------------------------------------------
Sascha Hauer (6):
      ARM: am33xx update SPI NOR: Check image size before flashing
      ARM: am33xx update SPI NOR: Ask use before flashing
      ARM: am335x: Add a NAND update handler for the regular barebox
      ARM: am335x Phytec phyCORE: register SPI NOR and NAND update handlers
      ARM: am335x: NAND MLO update: always let the user confirm updating
      Documentation: Add some TI AM335x specific documentation

 Documentation/boards/am335x.rst                    | 42 +++++++++++++++++++
 Documentation/boards/omap.rst                      |  4 +-
 Documentation/user/barebox.rst                     |  2 +
 arch/arm/boards/phytec-phycore-am335x/board.c      |  2 +
 arch/arm/configs/am335x_defconfig                  |  2 +-
 arch/arm/mach-omap/Kconfig                         | 11 ++---
 arch/arm/mach-omap/Makefile                        |  2 +-
 ...3xx_bbu_nand_xloadslots.c => am33xx_bbu_nand.c} | 47 ++++++++++++++++++++--
 arch/arm/mach-omap/am33xx_bbu_spi_mlo.c            | 17 ++++++++
 arch/arm/mach-omap/include/mach/bbu.h              |  8 +++-
 10 files changed, 123 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/boards/am335x.rst
 rename arch/arm/mach-omap/{am33xx_bbu_nand_xloadslots.c => am33xx_bbu_nand.c} (74%)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] ARM: am33xx update SPI NOR: Check image size before flashing
  2014-09-30 13:10 AM335x patches Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  2014-09-30 13:10 ` [PATCH 2/6] ARM: am33xx update SPI NOR: Ask use " Sascha Hauer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

Test if the image fits into the partition before flashing it. Makes
the update process more safe.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-omap/am33xx_bbu_spi_mlo.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
index 665a53b..c979302 100644
--- a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
+++ b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
@@ -19,6 +19,7 @@
 #include <bbu.h>
 #include <fs.h>
 #include <fcntl.h>
+#include <linux/stat.h>
 
 /*
  * AM35xx, AM33xx chips use big endian MLO for SPI NOR flash
@@ -34,6 +35,7 @@ static int spi_nor_mlo_handler(struct bbu_handler *handler,
 	void *image = data->image;
 	uint32_t *header;
 	int swap = 0;
+	struct stat s;
 
 	header = data->image;
 
@@ -46,6 +48,17 @@ static int spi_nor_mlo_handler(struct bbu_handler *handler,
 			return -EINVAL;
 	}
 
+	ret = stat(data->devicefile, &s);
+	if (ret) {
+		printf("could not open %s: %s", data->devicefile, errno_str());
+		return ret;
+	}
+
+	if (size > s.st_size) {
+		printf("Image too big, need %d, have %lld\n", size, s.st_size);
+		return -ENOSPC;
+	}
+
 	dstfd = open(data->devicefile, O_WRONLY);
 	if (dstfd < 0) {
 		printf("could not open %s: %s", data->devicefile, errno_str());
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] ARM: am33xx update SPI NOR: Ask use before flashing
  2014-09-30 13:10 AM335x patches Sascha Hauer
  2014-09-30 13:10 ` [PATCH 1/6] ARM: am33xx update SPI NOR: Check image size before flashing Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  2014-09-30 13:10 ` [PATCH 3/6] ARM: am335x: Add a NAND update handler for the regular barebox Sascha Hauer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

Let the user confirm the update process before flashing the new
image.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-omap/am33xx_bbu_spi_mlo.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
index c979302..97dc54e 100644
--- a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
+++ b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
@@ -59,6 +59,10 @@ static int spi_nor_mlo_handler(struct bbu_handler *handler,
 		return -ENOSPC;
 	}
 
+	ret = bbu_confirm(data);
+	if (ret != 0)
+		return ret;
+
 	dstfd = open(data->devicefile, O_WRONLY);
 	if (dstfd < 0) {
 		printf("could not open %s: %s", data->devicefile, errno_str());
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] ARM: am335x: Add a NAND update handler for the regular barebox
  2014-09-30 13:10 AM335x patches Sascha Hauer
  2014-09-30 13:10 ` [PATCH 1/6] ARM: am33xx update SPI NOR: Check image size before flashing Sascha Hauer
  2014-09-30 13:10 ` [PATCH 2/6] ARM: am33xx update SPI NOR: Ask use " Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  2014-09-30 13:10 ` [PATCH 4/6] ARM: am335x Phytec phyCORE: register SPI NOR and NAND update handlers Sascha Hauer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

To be able to not only update the MLO in NAND but also the
regular barebox image.
Since this is implemented with help of the corresponding xload
handler this also removes the 'xload' from the Kconfig options
and the filename.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/configs/am335x_defconfig               |   2 +-
 arch/arm/mach-omap/Kconfig                      |  11 +-
 arch/arm/mach-omap/Makefile                     |   2 +-
 arch/arm/mach-omap/am33xx_bbu_nand.c            | 161 ++++++++++++++++++++++++
 arch/arm/mach-omap/am33xx_bbu_nand_xloadslots.c | 122 ------------------
 arch/arm/mach-omap/include/mach/bbu.h           |   8 +-
 6 files changed, 176 insertions(+), 130 deletions(-)
 create mode 100644 arch/arm/mach-omap/am33xx_bbu_nand.c
 delete mode 100644 arch/arm/mach-omap/am33xx_bbu_nand_xloadslots.c

diff --git a/arch/arm/configs/am335x_defconfig b/arch/arm/configs/am335x_defconfig
index 5542524..762038c 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -1,6 +1,6 @@
 CONFIG_ARCH_OMAP=y
 CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
-CONFIG_BAREBOX_UPDATE_AM33XX_NAND_XLOADSLOTS=y
+CONFIG_BAREBOX_UPDATE_AM33XX_NAND=y
 CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_AFI_GF=y
 CONFIG_MACH_BEAGLEBONE=y
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 8b35187..e30027e 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -93,15 +93,16 @@ config BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO
 	  Say Y for barebox update SPI NOR MLO handler.
 	  AM35xx, AM33xx chips use big endian MLO for SPI NOR flash.
 
-config BAREBOX_UPDATE_AM33XX_NAND_XLOADSLOTS
-	prompt "barebox update nand xload slots handler"
+config BAREBOX_UPDATE_AM33XX_NAND
+	prompt "barebox update NAND handler"
 	bool
 	depends on BAREBOX_UPDATE
 	help
-	  Say Y for barebox update nand xload slots handler.
-	  This update handler updates 4 default nand xload slots
-	  with a single command.
+	  Say Y for barebox update NAND handler. This update handler updates
+	  4 default NAND xload slots with a single command.
 	  The Handler also checks if the given image has a valid CH header.
+	  This also includes a handler for updating the regular barebox binary
+	  in NAND.
 
 config ARCH_TEXT_BASE
 	hex
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 0ebfae7..bef1d05 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -33,4 +33,4 @@ obj-$(CONFIG_MFD_TWL6030) += omap4_twl6030_mmc.o
 obj-$(CONFIG_OMAP4_USBBOOT) += omap4_rom_usb.o
 obj-$(CONFIG_CMD_BOOT_ORDER) += boot_order.o
 obj-$(CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO) += am33xx_bbu_spi_mlo.o
-obj-$(CONFIG_BAREBOX_UPDATE_AM33XX_NAND_XLOADSLOTS) += am33xx_bbu_nand_xloadslots.o
+obj-$(CONFIG_BAREBOX_UPDATE_AM33XX_NAND) += am33xx_bbu_nand.o
diff --git a/arch/arm/mach-omap/am33xx_bbu_nand.c b/arch/arm/mach-omap/am33xx_bbu_nand.c
new file mode 100644
index 0000000..ed55fd1
--- /dev/null
+++ b/arch/arm/mach-omap/am33xx_bbu_nand.c
@@ -0,0 +1,161 @@
+/*
+ * am33xx_bbu_nand_xloadslots.c - barebox update handler for
+ * the nand xload slots.
+ *
+ * Copyright (c) 2014 Wadim Egorov <w.egorov@phytec.de>, Phytec
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <errno.h>
+#include <bbu.h>
+#include <fs.h>
+#include <fcntl.h>
+#include <filetype.h>
+
+struct nand_bbu_handler {
+	struct bbu_handler bbu_handler;
+	char **devicefile;
+	int num_devicefiles;
+};
+
+static int write_image(const char *devfile, const void *image, size_t size)
+{
+	int fd = 0;
+	int ret = 0;
+
+	fd = open(devfile, O_WRONLY);
+	if (fd < 0) {
+		pr_err("could not open %s: %s\n", devfile,
+			errno_str());
+		return fd;
+	}
+
+	ret = erase(fd, ~0, 0);
+	if (ret < 0) {
+		pr_err("could not erase %s: %s\n", devfile,
+			errno_str());
+		close(fd);
+		return ret;
+	}
+
+	ret = write(fd, image, size);
+	if (ret < 0) {
+		pr_err("could not write to fd %s: %s\n", devfile,
+			errno_str());
+		close(fd);
+		return ret;
+	}
+
+	close(fd);
+
+	return 0;
+}
+
+/*
+ * This handler updates all given xload slots in nand with an image.
+ */
+static int nand_xloadslots_update_handler(struct bbu_handler *handler,
+					struct bbu_data *data)
+{
+	int ret = 0;
+	const void *image = data->image;
+	size_t size = data->len;
+	struct nand_bbu_handler *nh;
+	int i = 0;
+
+	if (file_detect_type(image, size) != filetype_ch_image) {
+		pr_err("%s is not a valid ch-image\n", data->imagefile);
+		return -EINVAL;
+	}
+
+	nh = container_of(handler, struct nand_bbu_handler, bbu_handler);
+
+	/* check if the devicefile has been overwritten */
+	if (strcmp(data->devicefile, nh->devicefile[0]) != 0) {
+		ret = bbu_confirm(data);
+		if (ret != 0)
+			return ret;
+
+		ret = write_image(data->devicefile, image, size);
+		if (ret != 0)
+			return ret;
+	} else {
+		for (i = 0; i < nh->num_devicefiles; i++) {
+			ret =  write_image(nh->devicefile[i], image, size);
+			if (ret != 0)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
+int am33xx_bbu_nand_xloadslots_register_handler(const char *name,
+						char **devicefile,
+						int num_devicefiles)
+{
+	struct nand_bbu_handler *handler;
+	int ret;
+
+	handler = xzalloc(sizeof(*handler));
+	handler->devicefile = devicefile;
+	handler->num_devicefiles = num_devicefiles;
+	handler->bbu_handler.devicefile = devicefile[0];
+	handler->bbu_handler.handler = nand_xloadslots_update_handler;
+	handler->bbu_handler.name = name;
+
+	ret = bbu_register_handler(&handler->bbu_handler);
+	if (ret)
+		free(handler);
+
+	return ret;
+}
+
+static int nand_update_handler(struct bbu_handler *handler,
+		struct bbu_data *data)
+{
+	int ret = 0;
+	const void *image = data->image;
+	size_t size = data->len;
+	struct nand_bbu_handler *nh;
+
+	if (file_detect_type(image, size) != filetype_arm_barebox) {
+		pr_err("%s is not a valid barebox image\n", data->imagefile);
+		return -EINVAL;
+	}
+
+	nh = container_of(handler, struct nand_bbu_handler, bbu_handler);
+
+	ret = bbu_confirm(data);
+	if (ret != 0)
+		return ret;
+
+	return write_image(data->devicefile, image, size);
+}
+
+int am33xx_bbu_nand_register_handler(const char *name, char *devicefile)
+{
+	struct nand_bbu_handler *handler;
+	int ret;
+
+	handler = xzalloc(sizeof(*handler));
+	handler->bbu_handler.devicefile = devicefile;
+	handler->bbu_handler.handler = nand_update_handler;
+	handler->bbu_handler.name = name;
+
+	ret = bbu_register_handler(&handler->bbu_handler);
+	if (ret)
+		free(handler);
+
+	return ret;
+}
diff --git a/arch/arm/mach-omap/am33xx_bbu_nand_xloadslots.c b/arch/arm/mach-omap/am33xx_bbu_nand_xloadslots.c
deleted file mode 100644
index 0b4f1cc..0000000
--- a/arch/arm/mach-omap/am33xx_bbu_nand_xloadslots.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * am33xx_bbu_nand_xloadslots.c - barebox update handler for
- * the nand xload slots.
- *
- * Copyright (c) 2014 Wadim Egorov <w.egorov@phytec.de>, Phytec
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <errno.h>
-#include <bbu.h>
-#include <fs.h>
-#include <fcntl.h>
-#include <filetype.h>
-
-struct nand_bbu_handler {
-	struct bbu_handler bbu_handler;
-	char **devicefile;
-	int num_devicefiles;
-};
-
-static int write_image(const char *devfile, const void *image, size_t size)
-{
-	int fd = 0;
-	int ret = 0;
-
-	fd = open(devfile, O_WRONLY);
-	if (fd < 0) {
-		pr_err("could not open %s: %s\n", devfile,
-			errno_str());
-		return fd;
-	}
-
-	ret = erase(fd, ~0, 0);
-	if (ret < 0) {
-		pr_err("could not erase %s: %s\n", devfile,
-			errno_str());
-		close(fd);
-		return ret;
-	}
-
-	ret = write(fd, image, size);
-	if (ret < 0) {
-		pr_err("could not write to fd %s: %s\n", devfile,
-			errno_str());
-		close(fd);
-		return ret;
-	}
-
-	close(fd);
-
-	return 0;
-}
-
-/*
- * This handler updates all given xload slots in nand with an image.
- */
-static int nand_xloadslots_update_handler(struct bbu_handler *handler,
-					struct bbu_data *data)
-{
-	int ret = 0;
-	const void *image = data->image;
-	size_t size = data->len;
-	struct nand_bbu_handler *nh;
-	int i = 0;
-
-	if (file_detect_type(image, size) != filetype_ch_image) {
-		pr_err("%s is not a valid ch-image\n", data->imagefile);
-		return -EINVAL;
-	}
-
-	nh = container_of(handler, struct nand_bbu_handler, bbu_handler);
-
-	/* check if the devicefile has been overwritten */
-	if (strcmp(data->devicefile, nh->devicefile[0]) != 0) {
-		ret = bbu_confirm(data);
-		if (ret != 0)
-			return ret;
-
-		ret = write_image(data->devicefile, image, size);
-		if (ret != 0)
-			return ret;
-	} else {
-		for (i = 0; i < nh->num_devicefiles; i++) {
-			ret =  write_image(nh->devicefile[i], image, size);
-			if (ret != 0)
-				return ret;
-		}
-	}
-
-	return 0;
-}
-
-int am33xx_bbu_nand_xloadslots_register_handler(const char *name,
-						char **devicefile,
-						int num_devicefiles)
-{
-	struct nand_bbu_handler *handler;
-	int ret;
-
-	handler = xzalloc(sizeof(*handler));
-	handler->devicefile = devicefile;
-	handler->num_devicefiles = num_devicefiles;
-	handler->bbu_handler.devicefile = devicefile[0];
-	handler->bbu_handler.handler = nand_xloadslots_update_handler;
-	handler->bbu_handler.name = name;
-
-	ret = bbu_register_handler(&handler->bbu_handler);
-	if (ret)
-		free(handler);
-
-	return ret;
-}
diff --git a/arch/arm/mach-omap/include/mach/bbu.h b/arch/arm/mach-omap/include/mach/bbu.h
index 8c4c5e3..36d87e1 100644
--- a/arch/arm/mach-omap/include/mach/bbu.h
+++ b/arch/arm/mach-omap/include/mach/bbu.h
@@ -18,10 +18,11 @@ static inline int am33xx_bbu_spi_nor_register_handler(const char *name, char *de
 }
 #endif
 
-#ifdef CONFIG_BAREBOX_UPDATE_AM33XX_NAND_XLOADSLOTS
+#ifdef CONFIG_BAREBOX_UPDATE_AM33XX_NAND
 int am33xx_bbu_nand_xloadslots_register_handler(const char *name,
 						char **devicefile,
 						int num_devicefiles);
+int am33xx_bbu_nand_register_handler(const char *name, char *devicefile);
 #else
 static inline int am33xx_bbu_nand_xloadslots_register_handler(const char *name,
 							char **devicefile,
@@ -29,6 +30,11 @@ static inline int am33xx_bbu_nand_xloadslots_register_handler(const char *name,
 {
 	return 0;
 }
+
+static inline int am33xx_bbu_nand_register_handler(const char *name, char *devicefile)
+{
+	return 0;
+}
 #endif
 
 #endif
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] ARM: am335x Phytec phyCORE: register SPI NOR and NAND update handlers
  2014-09-30 13:10 AM335x patches Sascha Hauer
                   ` (2 preceding siblings ...)
  2014-09-30 13:10 ` [PATCH 3/6] ARM: am335x: Add a NAND update handler for the regular barebox Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  2014-09-30 13:10 ` [PATCH 5/6] ARM: am335x: NAND MLO update: always let the user confirm updating Sascha Hauer
  2014-09-30 13:10 ` [PATCH 6/6] Documentation: Add some TI AM335x specific documentation Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

Additionally to the MLO update handlers also register the update
handlers for the regular barebox image.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/phytec-phycore-am335x/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c b/arch/arm/boards/phytec-phycore-am335x/board.c
index 9482b80..035866b 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -78,8 +78,10 @@ static int pcm051_devices_init(void)
 	defaultenv_append_directory(defaultenv_phycore_am335x);
 
 	am33xx_bbu_spi_nor_mlo_register_handler("MLO.spi", "/dev/m25p0.xload");
+	am33xx_bbu_spi_nor_register_handler("spi", "/dev/m25p0.barebox");
 	am33xx_bbu_nand_xloadslots_register_handler("MLO.nand",
 		xloadslots, ARRAY_SIZE(xloadslots));
+	am33xx_bbu_nand_register_handler("nand", "/dev/nand0.barebox.bb");
 
 	return 0;
 }
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] ARM: am335x: NAND MLO update: always let the user confirm updating
  2014-09-30 13:10 AM335x patches Sascha Hauer
                   ` (3 preceding siblings ...)
  2014-09-30 13:10 ` [PATCH 4/6] ARM: am335x Phytec phyCORE: register SPI NOR and NAND update handlers Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  2014-09-30 13:10 ` [PATCH 6/6] Documentation: Add some TI AM335x specific documentation Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

Before actually doing something the user should always confirm the
update. Move the question out of the if() block.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-omap/am33xx_bbu_nand.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap/am33xx_bbu_nand.c b/arch/arm/mach-omap/am33xx_bbu_nand.c
index ed55fd1..ee767d3 100644
--- a/arch/arm/mach-omap/am33xx_bbu_nand.c
+++ b/arch/arm/mach-omap/am33xx_bbu_nand.c
@@ -80,12 +80,12 @@ static int nand_xloadslots_update_handler(struct bbu_handler *handler,
 
 	nh = container_of(handler, struct nand_bbu_handler, bbu_handler);
 
+	ret = bbu_confirm(data);
+	if (ret != 0)
+		return ret;
+
 	/* check if the devicefile has been overwritten */
 	if (strcmp(data->devicefile, nh->devicefile[0]) != 0) {
-		ret = bbu_confirm(data);
-		if (ret != 0)
-			return ret;
-
 		ret = write_image(data->devicefile, image, size);
 		if (ret != 0)
 			return ret;
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] Documentation: Add some TI AM335x specific documentation
  2014-09-30 13:10 AM335x patches Sascha Hauer
                   ` (4 preceding siblings ...)
  2014-09-30 13:10 ` [PATCH 5/6] ARM: am335x: NAND MLO update: always let the user confirm updating Sascha Hauer
@ 2014-09-30 13:10 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-09-30 13:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Documentation/boards/am335x.rst | 42 +++++++++++++++++++++++++++++++++++++++++
 Documentation/boards/omap.rst   |  4 ++--
 Documentation/user/barebox.rst  |  2 ++
 3 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/boards/am335x.rst

diff --git a/Documentation/boards/am335x.rst b/Documentation/boards/am335x.rst
new file mode 100644
index 0000000..7959b84
--- /dev/null
+++ b/Documentation/boards/am335x.rst
@@ -0,0 +1,42 @@
+Texas Instruments AM335x
+========================
+
+The Texas Instruments AM335x SoCs have a two-stage boot process. The first stage
+loader, also known as MLO is loaded by the ROM code. The MLO loads the second stage
+loader from the same medium.
+
+Building barebox
+----------------
+
+The TI AM335x boards in barebox are covered by the ``am335x_mlo_defconfig``
+for the MLO and ``am335x_defconfig`` for the regular barebox image. The
+resulting images will be placed under ``images/``:
+
+::
+  barebox-am33xx-afi-gf.img
+  barebox-am33xx-afi-gf-mlo.img
+  barebox-am33xx-beaglebone.img
+  barebox-am33xx-beaglebone-mlo.img
+  barebox-am33xx-phytec-phycore.img
+  barebox-am33xx-phytec-phycore-mlo-1x128m16.img
+  barebox-am33xx-phytec-phycore-mlo-1x256m16.img
+  barebox-am33xx-phytec-phycore-mlo-1x512m16.img
+
+Some boards come in different variants, make sure to pick the correct one.
+
+Starting and updating barebox
+-----------------------------
+
+SPI NOR and NAND
+^^^^^^^^^^^^^^^^
+
+The regular board images can be started from another bootloader, see
+:ref:`second_stage`. The board should provide update handlers
+to update (or initially install) barebox on SPI NOR or NAND, see :ref:`update`.
+
+SD/MMC
+^^^^^^
+
+To start barebox from SD/MMC prepare a card with a FAT filesystem. Copy the MLO
+file for your board to the card and name it ``MLO``. Copy the regular image
+for your board to the card and name it ``barebox.bin``.
diff --git a/Documentation/boards/omap.rst b/Documentation/boards/omap.rst
index 5038613..c269751 100644
--- a/Documentation/boards/omap.rst
+++ b/Documentation/boards/omap.rst
@@ -1,5 +1,5 @@
-Texas Instruments OMAP/AM335x
-=============================
+Texas Instruments OMAP
+======================
 
 Texas Instruments OMAP SoCs have a two-stage boot process. The first stage is
 known as Xload which only loads the second stage bootloader. barebox can act as
diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index caf544d..00ceabb 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -171,6 +171,8 @@ the compilation process will finish with a list of images built under ``images/`
   barebox-guf-santaro.img
   barebox-gk802.img
 
+.. _second_stage:
+
 Starting barebox
 -----------------
 
-- 
2.1.0


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-30 13:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 13:10 AM335x patches Sascha Hauer
2014-09-30 13:10 ` [PATCH 1/6] ARM: am33xx update SPI NOR: Check image size before flashing Sascha Hauer
2014-09-30 13:10 ` [PATCH 2/6] ARM: am33xx update SPI NOR: Ask use " Sascha Hauer
2014-09-30 13:10 ` [PATCH 3/6] ARM: am335x: Add a NAND update handler for the regular barebox Sascha Hauer
2014-09-30 13:10 ` [PATCH 4/6] ARM: am335x Phytec phyCORE: register SPI NOR and NAND update handlers Sascha Hauer
2014-09-30 13:10 ` [PATCH 5/6] ARM: am335x: NAND MLO update: always let the user confirm updating Sascha Hauer
2014-09-30 13:10 ` [PATCH 6/6] Documentation: Add some TI AM335x specific documentation Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox