diff mbox series

[U-Boot,08/12] board/BuR/common: refactor ft_board_setup(...)

Message ID 1530884489-28089-9-git-send-email-oe5hpm@oevsv.at
State Accepted
Commit d63f7130cea19c5f356ba651f0cbd37a964c1dc6
Delegated to: Tom Rini
Headers show
Series Refactor bur board/common code | expand

Commit Message

Hannes Schmelzer July 6, 2018, 1:41 p.m. UTC
On other OS, not one provided by B&R, it is not guaranteed that there
are factory-settings within a devicetree. So we must not treat the
absence of them as error.
Further we've the fact that on different version of the device-tree
files there are different namings of the factory-settings, we consider
this with searching for an alternative name.

changing things as following:

- don't treat as error if the bootloader version cannot written into
devicetree.

- since the naming of the factory-settings are different in different
versions of the provided device-tree we search for the alternate name
"/fset"

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
---

 board/BuR/common/common.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Tom Rini July 20, 2018, 12:37 p.m. UTC | #1
On Fri, Jul 06, 2018 at 03:41:25PM +0200, Hannes Schmelzer wrote:

> On other OS, not one provided by B&R, it is not guaranteed that there
> are factory-settings within a devicetree. So we must not treat the
> absence of them as error.
> Further we've the fact that on different version of the device-tree
> files there are different namings of the factory-settings, we consider
> this with searching for an alternative name.
> 
> changing things as following:
> 
> - don't treat as error if the bootloader version cannot written into
> devicetree.
> 
> - since the naming of the factory-settings are different in different
> versions of the provided device-tree we search for the alternate name
> "/fset"
> 
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 38da36d..01e3078 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -252,15 +252,20 @@  int ft_board_setup(void *blob, bd_t *bd)
 
 	nodeoffset = fdt_path_offset(blob, "/factory-settings");
 	if (nodeoffset < 0) {
-		puts("set bootloader version 'factory-settings' not in dtb!\n");
-		return -1;
+		printf("%s: cannot find /factory-settings, trying /fset\n",
+		       __func__);
+		nodeoffset = fdt_path_offset(blob, "/fset");
+		if (nodeoffset < 0) {
+			printf("%s: cannot find /fset.\n", __func__);
+			return 0;
+		}
 	}
+
 	if (fdt_setprop(blob, nodeoffset, "bl-version",
 			PLAIN_VERSION, strlen(PLAIN_VERSION)) != 0) {
-		puts("set bootloader version 'bl-version' prop. not in dtb!\n");
-		return -1;
+		printf("%s: no 'bl-version' prop in fdt!\n", __func__);
+		return 0;
 	}
-
 	return 0;
 }