Skip to contentSkip to conversation

colibri-imx7: Call fdt_increase_size()

PATCH Superseded Fabio Estevam 2 participants 2 messages Jul 4, 2023 Arm i.MX and Layerscape

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 colibri-imx7: Call fdt_increase_size()

From: Fabio Estevam <[email protected]>

For changing the USB OTG node status from "okay" to "disabled" more space is needed, so call fdt_increase_size() to avoid the following error:

```
 U-Boot 2023.07-rc5-0.0.0-devel+git.580eb31199be (Jun 27 2023 - 13:39:58 +0000)
 CPU:   Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz)
 CPU:   Extended Commercial temperature grade (-20C to 105C) at 30C
 Reset cause: POR
 DRAM:  initcall sequence 8786eafc failed at call 8781b351 (err=-3)
 ### ERROR ### Please RESET the board ###
```

Ideally, fdt_status_disabled() should call fdt_increase_size() internally, so that there would be no need for manually calling it in board code.

Do it manually for now to fix the regression.

Based on the code from board/CZ.NIC/turris_omnia/turris_omnia.c.

---
 board/toradex/colibri_imx7/colibri_imx7.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
board/toradex/colibri_imx7/colibri_imx7.c +12 -0
index 3e79ab93a982..78be17c3b550 100644
@@ -311,10 +311,22 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #ifdef CONFIG_USB_EHCI_MX7
 int board_fix_fdt(void *rw_fdt_blob)
 {
+	int ret;
+
 	/* i.MX 7Solo has only one single USB OTG1 but no USB host port */
 	if (is_cpu_type(MXC_CPU_MX7S)) {
 		int offset = fdt_path_offset(rw_fdt_blob, "/soc/bus@30800000/usb@30b20000");
 
+	/*
+	 * We're changing from status = "okay" to status = "disabled".
+	 * In this case we'll need more space, so increase the size
+	 * a little bit.
+	 */
+	ret = fdt_increase_size(rw_fdt_blob, 32);
+	if (ret < 0) {
+		printf("Cannot increase FDT size: %d\n", ret);
+		return ret;
+	}
 		return fdt_status_disabled(rw_fdt_blob, offset);
 	}
 
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 42 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

For changing the USB OTG node status from "okay" to "disabled" more space is needed, so call fdt_increase_size() to avoid the following error:

```
 U-Boot 2023.07-rc5-0.0.0-devel+git.580eb31199be (Jun 27 2023 - 13:39:58 +0000)
 CPU:   Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz)
 CPU:   Extended Commercial temperature grade (-20C to 105C) at 30C
 Reset cause: POR
 DRAM:  initcall sequence 8786eafc failed at call 8781b351 (err=-3)
 ### ERROR ### Please RESET the board ###
```

Ideally, fdt_status_disabled() should call fdt_increase_size() internally, so that there would be no need for manually calling it in board code.

Do it manually for now to fix the regression.

Based on the code from board/CZ.NIC/turris_omnia/turris_omnia.c.

---
 board/toradex/colibri_imx7/colibri_imx7.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
board/toradex/colibri_imx7/colibri_imx7.c +2 -0
index 3e79ab93a982..78be17c3b550 100644
@@ -311,10 +311,22 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #ifdef CONFIG_USB_EHCI_MX7
 int board_fix_fdt(void *rw_fdt_blob)
 {
+	int ret;
+
 	/* i.MX 7Solo has only one single USB OTG1 but no USB host port */
 	if (is_cpu_type(MXC_CPU_MX7S)) {
 		int offset = fdt_path_offset(rw_fdt_blob, "/soc/bus@30800000/usb@30b20000");
 

board/toradex/colibri_imx7/colibri_imx7.c int ft_board_setup(void *blob, struct bd_info *bd) · line 329

Quoted 10 lines
board/toradex/colibri_imx7/colibri_imx7.c +10 -0
+	/*
+	 * We're changing from status = "okay" to status = "disabled".
+	 * In this case we'll need more space, so increase the size
+	 * a little bit.
+	 */
+	ret = fdt_increase_size(rw_fdt_blob, 32);
+	if (ret < 0) {
+		printf("Cannot increase FDT size: %d\n", ret);
+		return ret;
+	}

Thanks for the patch!

You miss one level of indentation here, with this fixed

And, in any case,

Francesco