Skip to contentSkip to conversation

drivers/Makefile: Fix TPL build with dwc3 generic

PATCH In review Tom Rini 3 participants 13 messages Feb 10, 2025 – Feb 11, 2025 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/6 drivers/Makefile: Fix TPL build with dwc3 generic

When building TPL with DWC3 generic enabled, the following error is
occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3-generic.c:529: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
 drivers/Makefile | 1 +
 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
index 0e1f58c515b..7cee5750396 100644
@@ -78,6 +78,7 @@ endif
 ifdef CONFIG_TPL_BUILD
 
 obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/
 
 endif
 
Signature · 1 line
2.39.5
author
#2 lore raw
Quoted 25 lines · Arnaud Patard

When building TPL with DWC3 generic enabled, the following error is
occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3-generic.c:529: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3-generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode' make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
 drivers/Makefile | 1 +
 1 file changed, 1 insertion(+)
drivers/Makefile +0 -0
index 0e1f58c515b..7cee5750396 100644

drivers/Makefile endif · line 83

Quoted 6 lines
drivers/Makefile +1 -0
@@ -78,6 +78,7 @@ endif
 ifdef CONFIG_TPL_BUILD
 
 obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/
 
 endif

Do we really need DWC3 in TPL?

Signature · 1 line
Tom
#3 lore raw
Quoted 34 lines · Tom Rini
Quoted 33 lines · Arnaud Patard

When building TPL with DWC3 generic enabled, the following error is occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3-generic.c:529:
undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3- generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to
fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode' make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
 drivers/Makefile | 1 +

 1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 11 lines
drivers/Makefile +0 -0
index 0e1f58c515b..7cee5750396 100644
@@ -78,6 +78,7 @@ endif

 ifdef CONFIG_TPL_BUILD

 obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/

 endif

Do we really need DWC3 in TPL?

No, not really but I failed at finding a way to not get DWC3 built for TPL. I tried to modify the Kconfig files with no success. So, I took a different approach.
For DFU over SPL, it's obviously only needed in SPL for DFU and in u- boot proper.

Arnaud

author
#4 lore raw
Quoted 50 lines · Arnaud Patard
Quoted 34 lines · Tom Rini
Quoted 33 lines · Arnaud Patard

When building TPL with DWC3 generic enabled, the following error is occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3-generic.c:529:
undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3- generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to
fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode' make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
 drivers/Makefile | 1 +

 1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 11 lines
drivers/Makefile +0 -0
index 0e1f58c515b..7cee5750396 100644
@@ -78,6 +78,7 @@ endif

 ifdef CONFIG_TPL_BUILD

 obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/

 endif

Do we really need DWC3 in TPL?

Quoted 5 lines

No, not really but I failed at finding a way to not get DWC3 built for TPL. I tried to modify the Kconfig files with no success. So, I took a different approach.
For DFU over SPL, it's obviously only needed in SPL for DFU and in u- boot proper.

Please post something that introduces the failure so someone can take a look at it, thanks.

Signature · 1 line
Tom
#5 lore raw
In reply to Arnaud Patard

Hi Arnaud,

Quoted 50 lines · Arnaud Patard
Quoted 41 lines · Tom Rini
Quoted 40 lines · Arnaud Patard

When building TPL with DWC3 generic enabled, the following error is occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3-generic.c:529:
undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3- generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to
fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode' make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
  drivers/Makefile | 1 +
  1 file changed, 1 insertion(+)
drivers/Makefile +0 -0
index 0e1f58c515b..7cee5750396 100644
@@ -78,6 +78,7 @@ endif
  ifdef CONFIG_TPL_BUILD
 
Quoted 7 lines

drivers/Makefile endif · line 83

Quoted 4 lines
drivers/Makefile +1 -0
  obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/
 
  endif

Do we really need DWC3 in TPL?

Quoted 6 lines

No, not really but I failed at finding a way to not get DWC3 built for TPL. I tried to modify the Kconfig files with no success. So, I took a different approach.
For DFU over SPL, it's obviously only needed in SPL for DFU and in u- boot proper.

Would https://lore.kernel.org/u-boot/[email protected]/T/#m15a3058ef1ec8afb76528e1ed3edf864c8a77ef0 help?

Cheers,
Quentin

#6 lore raw

Hi,

Quoted 67 lines · Quentin Schulz

Hi Arnaud,

Quoted 54 lines · Arnaud Patard
Quoted 38 lines · Tom Rini
Quoted 37 lines · Arnaud Patard

When building TPL with DWC3 generic enabled, the following error is
occuring:
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_bind_common':
.../drivers/usb/dwc3/dwc3-generic.c:527: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:527:(.text.dwc3_glue_bind_common+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: .../drivers/usb/dwc3/dwc3- generic.c:529:
undefined reference to usb_get_dr_mode' .../drivers/usb/dwc3/dwc3- generic.c:529:(.text.dwc3_glue_bind_common+0x2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol usb_get_dr_mode'
aarch64-linux-gnu-ld.bfd: drivers/usb/dwc3/dwc3-generic.o: in function `dwc3_glue_probe':
.../drivers/usb/dwc3/dwc3-generic.c:683: undefined reference to `usb_get_dr_mode'
.../drivers/usb/dwc3/dwc3- generic.c:683:(.text.dwc3_glue_probe+0xb0): relocation truncated to
fit: R_AARCH64_CALL26 against undefined symbol `usb_get_dr_mode'
make[1]: *** [scripts/Makefile.xpl:544: tpl/u-boot-tpl] Error 1
make: *** [Makefile:2137: tpl/u-boot-tpl] Error 2

Enable building drivers/usb/common.c in TPL.

---
  drivers/Makefile | 1 +

  1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 11 lines
drivers/Makefile +0 -0
index 0e1f58c515b..7cee5750396 100644
@@ -78,6 +78,7 @@ endif

  ifdef CONFIG_TPL_BUILD

  obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
+obj-$(CONFIG_USB_GADGET) += usb/common/

  endif

Do we really need DWC3 in TPL?

Quoted 9 lines

No, not really but I failed at finding a way to not get DWC3 built for
TPL. I tried to modify the Kconfig files with no success. So, I took a
different approach.
For DFU over SPL, it's obviously only needed in SPL for DFU and in u-
boot proper.

Quoted 4 lines

Would
https://lore.kernel.org/u-boot/[email protected]/T/#m15a3058ef1ec8afb76528e1ed3edf864c8a77ef0

help?

Yes, I've seen it this morning. After testing, looks like it's fixing the issue I was having.

Arnaud

#7 lore raw

PATCH 2/6 arch/arm/mach-rockchip/spl-boot-order.c: Add DFU boot media

In reply to a message not in the archive

Make it possible to boot over gadget.

---
 arch/arm/mach-rockchip/spl-boot-order.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/spl-boot-order.c +3 -0
index 3dce9b30898..7cc410d0ae7 100644
@@ -75,6 +75,9 @@ static int spl_node_to_boot_device(int node)
 	if (!uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node, &parent))
 		return BOOT_DEVICE_SPI;
 
+	if (!uclass_get_device_by_of_offset(UCLASS_USB_GADGET_GENERIC, node, &parent))
+		return BOOT_DEVICE_DFU;
+
 	return -1;
 }
 
Signature · 1 line
2.39.5
#8 lore raw

PATCH 3/6 arch/arm/mach-rockchip/rk3399/rk3399.c: Add gadget device to boot devices

In reply to a message not in the archive

Define the device node used when booting over usb, allowing to use 'same-as-spl' boot entry.

---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/rk3399/rk3399.c +1 -0
index 1ce43c6f0d4..681eecb1edd 100644
@@ -27,6 +27,7 @@ const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe330000",
 	[BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d0000/flash@0",
 	[BROM_BOOTSOURCE_SD] = "/mmc@fe320000",
+	[BROM_BOOTSOURCE_USB] = "/usb@fe800000/usb@fe800000",
 };
 
 static struct mm_region rk3399_mem_map[] = {
Signature · 1 line
2.39.5
#9 lore raw

PATCH 4/6 include/configs/rk3399_common.h: define CFG_EXTRA_ENV_SETTINGS in XPL build

In reply to a message not in the archive

To use SPL DFU, some environment variables are needed so define CFG_EXTRA_ENV_SETTINGS for XPL builds.

---
 include/configs/rk3399_common.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
include/configs/rk3399_common.h +16 -2
index 76f40e7cd5f..e5f0206ba53 100644
@@ -5,7 +5,7 @@
 
 #ifndef __CONFIG_RK3399_COMMON_H
 #define __CONFIG_RK3399_COMMON_H
-
+#include <linux/stringify.h>
 #include "rockchip-common.h"
 
 #define CFG_IRAM_BASE			0xff8c0000
@@ -13,7 +13,6 @@
 #define CFG_SYS_SDRAM_BASE		0
 #define SDRAM_MAX_SIZE			0xf8000000
 
-#ifndef CONFIG_XPL_BUILD
 
 #ifndef ROCKCHIP_DEVICE_SETTINGS
 #define ROCKCHIP_DEVICE_SETTINGS
@@ -31,6 +30,8 @@
 	"ramdisk_addr_r=0x12180000\0"	\
 	"kernel_comp_size=0x8000000\0"
 
+#ifndef CONFIG_XPL_BUILD
+
 #define CFG_EXTRA_ENV_SETTINGS		\
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"	\
 	"partitions=" PARTS_DEFAULT	\
@@ -38,6 +39,19 @@
 	ROCKCHIP_DEVICE_SETTINGS	\
 	"boot_targets=" BOOT_TARGETS "\0"
 
+
+#else
+
+#define CFG_EXTRA_ENV_SETTINGS		\
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"	\
+	ENV_MEM_LAYOUT_SETTINGS		\
+	ROCKCHIP_DEVICE_SETTINGS	\
+	"dfu_alt_info=ram ram0=ram ram " \
+		__stringify(CONFIG_SPL_LOAD_FIT_ADDRESS) " " \
+		__stringify(CONFIG_SYS_DFU_DATA_BUF_SIZE) "\0"	\
+	"dfu_alt_info_ram=u-boot.itb ram " \
+		__stringify(CONFIG_SPL_LOAD_FIT_ADDRESS) " " \
+		__stringify(CONFIG_SYS_DFU_DATA_BUF_SIZE)
 #endif /* CONFIG_XPL_BUILD */
 
 #endif /* __CONFIG_RK3399_COMMON_H */
Signature · 1 line
2.39.5
#10 lore raw

Re: [PATCH 4/6] include/configs/rk3399_common.h: define CFG_EXTRA_ENV_SETTINGS in XPL build

Hi Arnaud,

Quoted 47 lines · Arnaud Patard

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

To use SPL DFU, some environment variables are needed so define CFG_EXTRA_ENV_SETTINGS for XPL builds.

---
  include/configs/rk3399_common.h | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)
include/configs/rk3399_common.h +6 -2
index 76f40e7cd5f..e5f0206ba53 100644
@@ -5,7 +5,7 @@
 
  #ifndef __CONFIG_RK3399_COMMON_H
  #define __CONFIG_RK3399_COMMON_H
-
+#include <linux/stringify.h>
  #include "rockchip-common.h"
 
  #define CFG_IRAM_BASE                  0xff8c0000
@@ -13,7 +13,6 @@
  #define CFG_SYS_SDRAM_BASE             0
  #define SDRAM_MAX_SIZE                 0xf8000000
 
-#ifndef CONFIG_XPL_BUILD
 
  #ifndef ROCKCHIP_DEVICE_SETTINGS
  #define ROCKCHIP_DEVICE_SETTINGS
@@ -31,6 +30,8 @@
         "ramdisk_addr_r=0x12180000\0"   \
         "kernel_comp_size=0x8000000\0"
 
+#ifndef CONFIG_XPL_BUILD
+
  #define CFG_EXTRA_ENV_SETTINGS         \
         "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
         "partitions=" PARTS_DEFAULT     \
@@ -38,6 +39,19 @@
         ROCKCHIP_DEVICE_SETTINGS        \
         "boot_targets=" BOOT_TARGETS "\0"
 
+
+#else
+

include/configs/rk3399_common.h line 54

Quoted 10 lines
include/configs/rk3399_common.h +10 -0
+#define CFG_EXTRA_ENV_SETTINGS         \
+       "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       ENV_MEM_LAYOUT_SETTINGS         \
+       ROCKCHIP_DEVICE_SETTINGS        \
+       "dfu_alt_info=ram ram0=ram ram " \
+               __stringify(CONFIG_SPL_LOAD_FIT_ADDRESS) " " \
+               __stringify(CONFIG_SYS_DFU_DATA_BUF_SIZE) "\0"  \
+       "dfu_alt_info_ram=u-boot.itb ram " \
+               __stringify(CONFIG_SPL_LOAD_FIT_ADDRESS) " " \
+               __stringify(CONFIG_SYS_DFU_DATA_BUF_SIZE)

Is it bad if we have dfu_alt_info and dfu_alt_info_ram defined even in proper?

If yes, just do the same trick as ENV_MEM_LAYOUT_SETTINGS, define a variable that will be empty in proper and defined in xPL? Does this work? This way we would avoid duplication of variables, which is difficult to maintain over time.

Cheers,
Quentin

#11 lore raw

PATCH 5/6 arch/arm/dts/rk3399-roc-pc-u-boot.dtsi: Prepare for SPL DFU

In reply to a message not in the archive

For SPL DFU booting, define u-boot,spl-boot-order and configure usb nodes for enabling the gadget in SPL.

---
 arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +23 -0
index 883d399a06a..e1502f30039 100644
@@ -11,6 +11,10 @@
 		sysreset-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
 	};
 
+        chosen {
+                u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc;
+        };
+
 	vcc_hub_en: vcc_hub_en-regulator {
 		compatible = "regulator-fixed";
 		enable-active-high;
@@ -75,3 +79,22 @@
 	regulator-min-microvolt = <430000>;
 	regulator-init-microvolt = <950000>;
 };
+
+&u2phy0 {
+	bootph-all;
+        status = "okay";
+
+        u2phy0_otg: otg-port {
+		bootph-all;
+                status = "okay";
+        };
+};
+&usbdrd3_0 {
+	bootph-all;
+        status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+	bootph-all;
+        status = "okay";
+};
Signature · 1 line
2.39.5
#12 lore raw

Re: [PATCH 5/6] arch/arm/dts/rk3399-roc-pc-u-boot.dtsi: Prepare for SPL DFU

Hi Arnaud,

Quoted 15 lines · Arnaud Patard

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

For SPL DFU booting, define u-boot,spl-boot-order and configure usb nodes for enabling the gadget in SPL.

---
  arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 23 +++++++++++++++++++++++
  1 file changed, 23 insertions(+)
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +0 -0
index 883d399a06a..e1502f30039 100644

arch/arm/dts/rk3399-roc-pc-u-boot.dtsi line 17

Quoted 7 lines
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +4 -0
@@ -11,6 +11,10 @@
                 sysreset-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
         };
 
+        chosen {
+                u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc;
+        };
+

This is already the default for all RK3399 boards, c.f.

arch/arm/dts/rk3399-u-boot.dtsi

Quoted 16 lines
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +9 -0
         vcc_hub_en: vcc_hub_en-regulator {
                 compatible = "regulator-fixed";
                 enable-active-high;
@@ -75,3 +79,22 @@
         regulator-min-microvolt = <430000>;
         regulator-init-microvolt = <950000>;
  };
+
+&u2phy0 {
+       bootph-all;
+        status = "okay";
+
+        u2phy0_otg: otg-port {
+               bootph-all;
+                status = "okay";
+        };

arch/arm/dts/rk3399-roc-pc-u-boot.dtsi line 100

Quoted 10 lines
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +10 -0
+};
+&usbdrd3_0 {
+       bootph-all;
+        status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       bootph-all;
+        status = "okay";
+};

For all the above, status = "okay" is already the default, it comes from dts/upstream/src/arm64/rockchip/rk3399-roc-pc.dtsi I believe since OF_UPSTREAM symbol is enabled (implied) by default.

u2phy0_otg label already exists, so you don't need to define it inside u2phy0, you can simply do:

&u2phy0_otg {
    bootph-all;
};

Although... I'm not entirely sure this is appropriate. I think you should rather have bootph-pre-ram instead, which is for the SPL. Finally, if I'm not mistaken every parent of a node with bootph- property is interpreted as having that property as well (but it is NOT written to their node), so you wouldn't need &u2phy0 nor &usbdrd3_0.

Cheers,
Quentin

#13 lore raw

PATCH 6/6 configs/roc-pc-rk3399_defconfig: Enable SPL DFU for roc-pc-rk3399

In reply to a message not in the archive

Add needed configuration to enable SPL DFU.

---
 configs/roc-pc-rk3399_defconfig | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
configs/roc-pc-rk3399_defconfig +13 -1
index 0ef86748778..a02deefbaf8 100644
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SKIP_LOWLEVEL_INIT=y
 CONFIG_COUNTER_FREQUENCY=24000000
 CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_MALLOC_F_LEN=0x500000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_SF_DEFAULT_SPEED=30000000
@@ -13,6 +14,7 @@ CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3399=y
 CONFIG_ROCKCHIP_SPI_IMAGE=y
 CONFIG_TARGET_ROC_PC_RK3399=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x300000
 CONFIG_SYS_LOAD_ADDR=0x800800
 CONFIG_SF_DEFAULT_BUS=1
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
@@ -21,10 +23,13 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_DEBUG_UART=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_SPL_FIT_PRINT=y
+CONFIG_SPL_LOAD_FIT_ADDRESS=0x20000000
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
+# CONFIG_SPL_BINMAN_UBOOT_SYMBOLS is not set
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
@@ -32,15 +37,18 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
 CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
-CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_DFU_RAM=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_ROCKCHIP_IODOMAIN=y
@@ -70,6 +78,7 @@ CONFIG_SYS_NS16550_MEM32=y
 CONFIG_ROCKCHIP_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_USB=y
+CONFIG_SPL_DM_USB_GADGET=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
@@ -77,6 +86,7 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
@@ -85,6 +95,8 @@ CONFIG_USB_ETHER_MCS7830=y
 CONFIG_USB_ETHER_RTL8152=y
 CONFIG_USB_ETHER_SMSC95XX=y
 CONFIG_USB_GADGET=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_DFU=y
 CONFIG_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
Signature · 1 line
2.39.5