From: Sumit Garg <sumit.garg@kernel.org>
To: Caleb Connolly <caleb.connolly@linaro.org>
Cc: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Lukasz Majewski <lukma@denx.de>,
Sean Anderson <seanga2@gmail.com>,
u-boot@lists.denx.de, u-boot-qcom@groups.io
Subject: Re: [PATCH 5/6] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
Date: Thu, 10 Apr 2025 14:34:28 +0530 [thread overview]
Message-ID: <Z_eJnJqRZUJHCNC5@sumit-X1> (raw)
In-Reply-To: <20250409-livetree-fixup-v1-5-76dfea80b07f@linaro.org>
On Wed, Apr 09, 2025 at 07:17:28PM +0200, Caleb Connolly wrote:
> 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.
>
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
> arch/arm/dts/qrb4210-rb2-u-boot.dtsi | 6 ------
> arch/arm/mach-snapdragon/of_fixup.c | 28 ++++++++++++++--------------
> 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 7d1375f38c44d7bd54c022fa3d390f666a35d6ee..0000000000000000000000000000000000000000
> --- 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 b39036e8e0890fdf834a0dfe6966ef3dd365f3d2..62b329e2c90d7e0a374838968ab5707333edbf03 100644
> --- a/arch/arm/mach-snapdragon/of_fixup.c
> +++ b/arch/arm/mach-snapdragon/of_fixup.c
> @@ -98,8 +98,21 @@ static int fixup_qcom_dwc3(struct device_node *glue_np)
> log_err("Failed to set 'maximum-speed' property: %d\n", ret);
> 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(gd->of_root, "qcom,qrb4210-rb2", NULL, NULL) ||
> + of_device_is_compatible(gd->of_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;
> }
>
> static void fixup_usb_nodes(void)
> @@ -162,21 +175,8 @@ static int qcom_of_fixup_nodes(void)
> }
>
> EVENT_SPY_SIMPLE(EVT_OF_LIVE_INIT, 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;
> }
We should now be able to drop OF_BOARD_SETUP from qcom_defconfig and
this API.
With that:
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
next prev parent reply other threads:[~2025-04-10 9:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 17:17 [PATCH 0/6] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
2025-04-09 17:17 ` [PATCH 1/6] event: signal when livetree has been built Caleb Connolly
2025-04-10 8:44 ` Sumit Garg
2025-04-10 8:54 ` Neil Armstrong
2025-04-10 11:27 ` Simon Glass
2025-04-10 13:00 ` Caleb Connolly
2025-04-10 13:07 ` Simon Glass
2025-04-10 14:04 ` Caleb Connolly
2025-04-10 14:15 ` Simon Glass
2025-04-10 15:41 ` Caleb Connolly
2025-04-10 21:25 ` Simon Glass
2025-04-11 11:52 ` Caleb Connolly
2025-04-11 18:30 ` Simon Glass
2025-04-09 17:17 ` [PATCH 2/6] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups Caleb Connolly
2025-04-10 8:50 ` Sumit Garg
2025-04-10 8:54 ` Neil Armstrong
2025-04-09 17:17 ` [PATCH 3/6] mach-snapdragon: of_fixup: skip disabled USB nodes Caleb Connolly
2025-04-10 7:45 ` Neil Armstrong
2025-04-10 8:51 ` Sumit Garg
2025-04-09 17:17 ` [PATCH 4/6] clk/qcom: qcm2290: show clock name in set_rate() Caleb Connolly
2025-04-10 7:45 ` Neil Armstrong
2025-04-10 8:51 ` Sumit Garg
2025-04-09 17:17 ` [PATCH 5/6] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards Caleb Connolly
2025-04-10 7:46 ` Neil Armstrong
2025-04-10 9:04 ` Sumit Garg [this message]
2025-04-09 17:17 ` [PATCH 6/6] pinctrl: qcom: qcm2290: fix off by 1 in pin_count Caleb Connolly
2025-04-10 7:46 ` Neil Armstrong
2025-04-10 9:05 ` Sumit Garg
2025-04-10 8:41 ` [PATCH 0/6] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Sumit Garg
2025-04-10 9:54 ` Caleb Connolly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_eJnJqRZUJHCNC5@sumit-X1 \
--to=sumit.garg@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=lukma@denx.de \
--cc=neil.armstrong@linaro.org \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox