summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly <caleb.connolly@linaro.org>2025-04-11 14:47:43 +0200
committerTom Rini <trini@konsulko.com>2025-05-02 08:38:02 -0600
commit3b983cf48e70ecb6aadca788d0d91a021340c802 (patch)
treea51b89927851121eb001c9d9fcf94ab7e0dcd112
parent9bc7eef9bf58c4c1d453cba81060dc61375f5354 (diff)
mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
The RB1 and RB2 have a single USB controller which is manually muxed between a type-c port and an internal USB hub via a DIP switch. OTG is supported in Linux, but the DWC3 driver in U-Boot can only handle a single mode, and defaults to peripheral mode. We did hack around this on the RB2, but the RB1 got left out. Now that we can fix up the live tree before devices are bound, drop the DTS hacks and do the fixup at runtime instead. Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Tested-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
-rw-r--r--arch/arm/dts/qrb4210-rb2-u-boot.dtsi6
-rw-r--r--arch/arm/mach-snapdragon/of_fixup.c28
2 files changed, 14 insertions, 20 deletions
diff --git a/arch/arm/dts/qrb4210-rb2-u-boot.dtsi b/arch/arm/dts/qrb4210-rb2-u-boot.dtsi
deleted file mode 100644
index 7d1375f38c4..00000000000
--- a/arch/arm/dts/qrb4210-rb2-u-boot.dtsi
+++ /dev/null
@@ -1,6 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-/* This is usually OTG but U-Boot doesn't support that properly */
-&usb_dwc3 {
- dr_mode = "host";
-};
diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index 10053e48d88..b398c6b7b9f 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -99,6 +99,19 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
return ret;
}
+ /*
+ * The RB1/2 boards only have a single USB controller and it's muxed between the type-C port
+ * and a USB hub. Since we can't do OTG in U-Boot properly we prefer to put it into host mode.
+ */
+ if (of_device_is_compatible(root, "qcom,qrb4210-rb2", NULL, NULL) ||
+ of_device_is_compatible(root, "qcom,qrb2210-rb1", NULL, NULL)) {
+ ret = of_write_prop(dwc3, "dr_mode", sizeof("host"), "host");
+ if (ret) {
+ log_err("Failed to set 'dr_mode' property: %d\n", ret);
+ return ret;
+ }
+ }
+
return 0;
}
@@ -165,20 +178,7 @@ static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
EVENT_SPY_FULL(EVT_OF_LIVE_BUILT, qcom_of_fixup_nodes);
-int ft_board_setup(void *blob, struct bd_info __maybe_unused *bd)
+int ft_board_setup(void __maybe_unused *blob, struct bd_info __maybe_unused *bd)
{
- struct fdt_header *fdt = blob;
- int node;
-
- /* On RB1/2 we need to fix-up the dr_mode */
- if (!fdt_node_check_compatible(fdt, 0, "qcom,qrb4210-rb2") ||
- !fdt_node_check_compatible(fdt, 0, "qcom,qrb2210-rb1")) {
- fdt_for_each_node_by_compatible(node, blob, 0, "snps,dwc3") {
- log_debug("%s: Setting 'dr_mode' to OTG\n", fdt_get_name(blob, node, NULL));
- fdt_setprop_string(fdt, node, "dr_mode", "otg");
- break;
- }
- }
-
return 0;
}