U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2
@ 2025-04-11 12:47 Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom, Sumit Garg

Introduce a new event to signal that the live tree has been built,
allowing boards to perform fixups on the tree before devices are bound.
Crucially this allows for devices to be enabled or disabled, but also
allows for properties that are parsed during the bind stage to be
modified (such as dr_mode for dwc3).

With this in place, mach-snapdragon is switched over to use the event
and some hacky U-Boot specific DT overrides (which had to be undone
prior to booting an image) are removed in favour of fixing up the
livetree (which is not passed on to further boot stages).

Finally, some minor fixes are made for the QCM2290 RB1 board, the sdcard
is enabled and it now uses USB host mode in U-Boot like it's bigger
sibling the RB2.

---
Changes in v2:
- Rename EVT_OF_LIVE_INIT to EVT_OF_LIVE_BUILT
- Pass the root node through as event data in EVT_OF_LIVE_BUILT
- Handle errors from event_notify()
- Additional minor fixes to mach-snapdragon/of_fixup.c
- Link to v1: https://lore.kernel.org/r/20250409-livetree-fixup-v1-0-76dfea80b07f@linaro.org

---
Caleb Connolly (8):
      event: signal when livetree has been built
      mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
      mach-snapdragon: of_fixup: skip disabled USB nodes
      mach-snapdragon: of_fixup: remove confusing log message
      mach-snapdragon: of_fixup: update comment
      mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
      clk/qcom: qcm2290: show clock name in set_rate()
      pinctrl: qcom: qcm2290: fix off by 1 in pin_count

 arch/arm/dts/qrb4210-rb2-u-boot.dtsi   |  6 ---
 arch/arm/mach-snapdragon/board.c       |  1 -
 arch/arm/mach-snapdragon/of_fixup.c    | 71 +++++++++++++++++++---------------
 arch/arm/mach-snapdragon/qcom-priv.h   | 14 -------
 common/event.c                         |  3 ++
 drivers/clk/qcom/clock-qcm2290.c       |  2 +-
 drivers/pinctrl/qcom/pinctrl-qcm2290.c |  2 +-
 include/event.h                        | 18 +++++++++
 lib/of_live.c                          | 11 ++++++
 9 files changed, 74 insertions(+), 54 deletions(-)
---
base-commit: 45acd9d2d4ec84775d09c73aab75a4fd989beb41
change-id: 20250409-livetree-fixup-0d7451cc3af3

Caleb Connolly <caleb.connolly@linaro.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/8] event: signal when livetree has been built
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 14:11   ` Neil Armstrong
  2025-04-11 18:27   ` Simon Glass
  2025-04-11 12:47 ` [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups Caleb Connolly
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

OF_LIVE offers a variety of benefits, one of them being that the live
tree can be modified without caring about the underlying FDT. This is
particularly valuable for working around U-Boot limitations like lacking
USB superspeed support on Qualcomm platforms, no runtime OTG, or
peripherals like the sdcard being broken (and displaying potentially
worrying error messages).

Add an event to signal when the live tree has been built so that we can
apply fixups to it directly before devices are bound.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 common/event.c  |  3 +++
 include/event.h | 18 ++++++++++++++++++
 lib/of_live.c   | 11 +++++++++++
 3 files changed, 32 insertions(+)

diff --git a/common/event.c b/common/event.c
index dda569d447851f559a83f98fb7b1f3543156eab5..8d7513eb10b61919e1e784481dfdcc076be14986 100644
--- a/common/event.c
+++ b/common/event.c
@@ -47,8 +47,11 @@ const char *const type_name[] = {
 	"ft_fixup",
 
 	/* main loop events */
 	"main_loop",
+
+	/* livetree has been built */
+	"of_live_init",
 };
 
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
 #endif
diff --git a/include/event.h b/include/event.h
index 75141a192a48b0931667632f41be8ff4d6139f7c..1d267f1d10547642d381fa287ab4981a2bf03543 100644
--- a/include/event.h
+++ b/include/event.h
@@ -152,8 +152,17 @@ enum event_t {
 	 * A non-zero return value causes the boot to fail.
 	 */
 	EVT_MAIN_LOOP,
 
+	/**
+	 * @EVT_OF_LIVE_BUILT:
+	 * This event is triggered immediately after the live device tree has been
+	 * built. This allows for machine specific fixups to be done to the live tree
+	 * (like disabling known-unsupported devices) before it is used. This
+	 * event is only available if OF_LIVE is enabled and is only used after relocation.
+	 */
+	EVT_OF_LIVE_BUILT,
+
 	/**
 	 * @EVT_COUNT:
 	 * This constants holds the maximum event number + 1 and is used when
 	 * looping over all event classes.
@@ -202,8 +211,17 @@ union event_data {
 	struct event_ft_fixup {
 		oftree tree;
 		struct bootm_headers *images;
 	} ft_fixup;
+
+	/**
+	 * struct event_of_live_built - livetree has been built
+	 *
+	 * @root: The root node of the live device tree
+	 */
+	struct event_of_live_built {
+		struct device_node *root;
+	} of_live_built;
 };
 
 /**
  * struct event - an event that can be sent and received
diff --git a/lib/of_live.c b/lib/of_live.c
index 90b9459ede313e492e28c8556c730f3bd8aaa9df..c1620616513c2e32448b4a6d156a9162d97c76b7 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -10,8 +10,9 @@
 
 #define LOG_CATEGORY	LOGC_DT
 
 #include <abuf.h>
+#include <event.h>
 #include <log.h>
 #include <linux/libfdt.h>
 #include <of_live.h>
 #include <malloc.h>
@@ -320,8 +321,9 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
 
 int of_live_build(const void *fdt_blob, struct device_node **rootp)
 {
 	int ret;
+	union event_data evt;
 
 	debug("%s: start\n", __func__);
 	ret = unflatten_device_tree(fdt_blob, rootp);
 	if (ret) {
@@ -334,8 +336,17 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
 		return ret;
 	}
 	debug("%s: stop\n", __func__);
 
+	if (CONFIG_IS_ENABLED(EVENT)) {
+		evt.of_live_built.root = *rootp;
+		ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
+		if (ret) {
+			log_debug("Failed to notify livetree build event: err=%d\n", ret);
+			return ret;
+		}
+	}
+
 	return ret;
 }
 
 void of_live_free(struct device_node *root)

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 14:10   ` Neil Armstrong
  2025-04-11 12:47 ` [PATCH v2 3/8] mach-snapdragon: of_fixup: skip disabled USB nodes Caleb Connolly
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

This will now apply fixups prior to devices being bound, which makes it
possible to enable/disable devices and adjust more properties that might
be read before devices probe.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 arch/arm/mach-snapdragon/board.c     |  1 -
 arch/arm/mach-snapdragon/of_fixup.c  | 25 ++++++++++++++++---------
 arch/arm/mach-snapdragon/qcom-priv.h | 14 --------------
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index deae4d323789eab75d5fe735159b4cd820c02c45..3ab75f0fce02ecffd476ebe2aa606b1a9024bbec 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -305,9 +305,8 @@ void __weak qcom_board_init(void)
 
 int board_init(void)
 {
 	show_psci_version();
-	qcom_of_fixup_nodes();
 	qcom_board_init();
 	return 0;
 }
 
diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index 1ea0c18c2f2789a8aa054cd95bb9e4308d6b3384..70399307bcbda1e067230f00af6ba859a98c7ac0 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -21,8 +21,9 @@
 
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dm/of_access.h>
 #include <dm/of.h>
+#include <event.h>
 #include <fdt_support.h>
 #include <linux/errno.h>
 #include <stdlib.h>
 #include <time.h>
@@ -31,9 +32,9 @@
  * USB controllers. Rather than requiring source level DT changes, we fix up
  * DT here. This improves compatibility with upstream DT and simplifies the
  * porting process for new devices.
  */
-static int fixup_qcom_dwc3(struct device_node *glue_np)
+static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np)
 {
 	struct device_node *dwc3;
 	int ret, len, hsphy_idx = 1;
 	const __be32 *phandles;
@@ -100,11 +101,11 @@ static int fixup_qcom_dwc3(struct device_node *glue_np)
 
 	return 0;
 }
 
-static void fixup_usb_nodes(void)
+static void fixup_usb_nodes(struct device_node *root)
 {
-	struct device_node *glue_np = NULL;
+	struct device_node *glue_np = root;
 	int ret;
 
 	while ((glue_np = of_find_compatible_node(glue_np, NULL, "qcom,dwc3"))) {
 		ret = fixup_qcom_dwc3(glue_np);
@@ -113,16 +114,16 @@ static void fixup_usb_nodes(void)
 	}
 }
 
 /* Remove all references to the rpmhpd device */
-static void fixup_power_domains(void)
+static void fixup_power_domains(struct device_node *root)
 {
 	struct device_node *pd = NULL, *np = NULL;
 	struct property *prop;
 	const __be32 *val;
 
 	/* All Qualcomm platforms name the rpm(h)pd "power-controller" */
-	for_each_of_allnodes(pd) {
+	for_each_of_allnodes_from(root, pd) {
 		if (pd->name && !strcmp("power-controller", pd->name))
 			break;
 	}
 
@@ -132,9 +133,9 @@ static void fixup_power_domains(void)
 		return;
 	}
 
 	/* Remove all references to the power domain controller */
-	for_each_of_allnodes(np) {
+	for_each_of_allnodes_from(root, np) {
 		if (!(prop = of_find_property(np, "power-domains", NULL)))
 			continue;
 
 		val = prop->value;
@@ -149,14 +150,20 @@ static void fixup_power_domains(void)
 		func(__VA_ARGS__); \
 		debug(#func " took %lluus\n", timer_get_us() - start); \
 	} while (0)
 
-void qcom_of_fixup_nodes(void)
+static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
 {
-	time_call(fixup_usb_nodes);
-	time_call(fixup_power_domains);
+	struct device_node *root = event->data.of_live_built.root;
+
+	time_call(fixup_usb_nodes, root);
+	time_call(fixup_power_domains, root);
+
+	return 0;
 }
 
+EVENT_SPY_FULL(EVT_OF_LIVE_BUILT, qcom_of_fixup_nodes);
+
 int ft_board_setup(void *blob, struct bd_info __maybe_unused *bd)
 {
 	struct fdt_header *fdt = blob;
 	int node;
diff --git a/arch/arm/mach-snapdragon/qcom-priv.h b/arch/arm/mach-snapdragon/qcom-priv.h
index 74d39197b89f4e769299b06214c26ee829ecdce0..4f398e2ba374f27811afd2ccf6e72037d0f9ee7f 100644
--- a/arch/arm/mach-snapdragon/qcom-priv.h
+++ b/arch/arm/mach-snapdragon/qcom-priv.h
@@ -8,19 +8,5 @@ void qcom_configure_capsule_updates(void);
 #else
 void qcom_configure_capsule_updates(void) {}
 #endif /* EFI_HAVE_CAPSULE_SUPPORT */
 
-#if CONFIG_IS_ENABLED(OF_LIVE)
-/**
- * qcom_of_fixup_nodes() - Fixup Qualcomm DT nodes
- *
- * Adjusts nodes in the live tree to improve compatibility with U-Boot.
- */
-void qcom_of_fixup_nodes(void);
-#else
-static inline void qcom_of_fixup_nodes(void)
-{
-	log_debug("Unable to dynamically fixup USB nodes, please enable CONFIG_OF_LIVE\n");
-}
-#endif /* OF_LIVE */
-
 #endif /* __QCOM_PRIV_H__ */

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/8] mach-snapdragon: of_fixup: skip disabled USB nodes
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message Caleb Connolly
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom, Sumit Garg

There's no need to waste time fixing up nodes that aren't used on this
device. Skip them.

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>
---
 arch/arm/mach-snapdragon/of_fixup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index 70399307bcbda1e067230f00af6ba859a98c7ac0..dcd09ee7cac3e02287647c9e6df5575651e18e85 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -107,9 +107,11 @@ static void fixup_usb_nodes(struct device_node *root)
 	struct device_node *glue_np = root;
 	int ret;
 
 	while ((glue_np = of_find_compatible_node(glue_np, NULL, "qcom,dwc3"))) {
-		ret = fixup_qcom_dwc3(glue_np);
+		if (!of_device_is_available(glue_np))
+			continue;
+		ret = fixup_qcom_dwc3(root, glue_np);
 		if (ret)
 			log_warning("Failed to fixup node %s: %d\n", glue_np->name, ret);
 	}
 }

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (2 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 3/8] mach-snapdragon: of_fixup: skip disabled USB nodes Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 14:11   ` Neil Armstrong
  2025-04-11 12:47 ` [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment Caleb Connolly
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

The debug log here had the logic completely backwards, even though the
code is actually correct. Remove it since it's extraneous anyway.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 arch/arm/mach-snapdragon/of_fixup.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index dcd09ee7cac3e02287647c9e6df5575651e18e85..a5515c02d3de05944dfb7c1b2a5542631b517497 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -72,13 +72,14 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
 		log_err("Failed to read second phy name: %d\n", ret);
 		return ret;
 	}
 
-	if (!strncmp("usb3-phy", second_phy_name, strlen("usb3-phy"))) {
-		log_debug("Second phy isn't superspeed (is '%s') assuming first phy is SS\n",
-			  second_phy_name);
+	/*
+	 * Determine which phy is the superspeed phy by checking the name of the second phy
+	 * since it is typically the superspeed one.
+	 */
+	if (!strncmp("usb3-phy", second_phy_name, strlen("usb3-phy")))
 		hsphy_idx = 0;
-	}
 
 	/* Overwrite the "phys" property to only contain the high-speed phy */
 	ret = of_write_prop(dwc3, "phys", sizeof(*phandles), phandles + hsphy_idx);
 	if (ret) {

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (3 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 14:12   ` Neil Armstrong
  2025-04-11 12:47 ` [PATCH v2 6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards Caleb Connolly
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

we don't rewrite the volume buttons any more.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 arch/arm/mach-snapdragon/of_fixup.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index a5515c02d3de05944dfb7c1b2a5542631b517497..10053e48d88017d2179c96f2f3724c4d5dc4f3e2 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -3,10 +3,9 @@
  * OF_LIVE devicetree fixup.
  *
  * This file implements runtime fixups for Qualcomm DT to improve
  * compatibility with U-Boot. This includes adjusting the USB nodes
- * to only use USB high-speed, as well as remapping volume buttons
- * to behave as up/down for navigating U-Boot.
+ * to only use USB high-speed.
  *
  * We use OF_LIVE for this rather than early FDT fixup for a couple
  * of reasons: it has a much nicer API, is most likely more efficient,
  * and our changes are only applied to U-Boot. This allows us to use a

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (4 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 7/8] clk/qcom: qcm2290: show clock name in set_rate() Caleb Connolly
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom, Sumit Garg

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>
---
 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 10053e48d88017d2179c96f2f3724c4d5dc4f3e2..b398c6b7b9fdaddc03324921e6b955919f9c7675 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 *root, 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(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;
 }
 
 static void fixup_usb_nodes(struct device_node *root)
@@ -164,21 +177,8 @@ 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;
 }

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 7/8] clk/qcom: qcm2290: show clock name in set_rate()
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (5 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-04-11 12:47 ` [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count Caleb Connolly
  2025-05-02 16:26 ` [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Tom Rini
  8 siblings, 0 replies; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom, Sumit Garg

The device name is always clk_qcom... Not very useful.

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>
---
 drivers/clk/qcom/clock-qcm2290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clock-qcm2290.c b/drivers/clk/qcom/clock-qcm2290.c
index 1326b770c3ebd723120de4b6657aafac726023d6..fad104fb91aec8917de66b63dd546926c8856011 100644
--- a/drivers/clk/qcom/clock-qcm2290.c
+++ b/drivers/clk/qcom/clock-qcm2290.c
@@ -87,9 +87,9 @@ static ulong qcm2290_set_rate(struct clk *clk, ulong rate)
 {
 	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
 	const struct freq_tbl *freq;
 
-	debug("%s: clk %s rate %lu\n", __func__, clk->dev->name, rate);
+	debug("%s: clk %s rate %lu\n", __func__, qcm2290_clks[clk->id].name, rate);
 
 	switch (clk->id) {
 	case GCC_QUPV3_WRAP0_S4_CLK: /*UART2*/
 		freq = qcom_find_freq(ftbl_gcc_qupv3_wrap0_s0_clk_src, rate);

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (6 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 7/8] clk/qcom: qcm2290: show clock name in set_rate() Caleb Connolly
@ 2025-04-11 12:47 ` Caleb Connolly
  2025-05-02  6:02   ` Sumit Garg
  2025-05-02 16:26 ` [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Tom Rini
  8 siblings, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-11 12:47 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom, Sumit Garg

There are 134 pins not 133, oops! This fixes the sdcard on the RB1 as
the pins now all get configured correctly.

Fixes: 0ecb8cfcb930 ("pinctrl: qcom: add qcm2290 pinctrl driver")
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>
---
 drivers/pinctrl/qcom/pinctrl-qcm2290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-qcm2290.c b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
index 0c2222ce663e6d584d229e7521f88fedf8aa19da..84f76b63b93ad78182524661dba561672feb4c85 100644
--- a/drivers/pinctrl/qcom/pinctrl-qcm2290.c
+++ b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
@@ -44,9 +44,9 @@ static int qcm2290_get_function_mux(__maybe_unused unsigned int pin, unsigned in
 }
 
 struct msm_pinctrl_data qcm2290_data = {
 	.pin_data = {
-		.pin_count = 133,
+		.pin_count = 134,
 		.special_pins_start = 127,
 	},
 	.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
 	.get_function_name = qcm2290_get_function_name,

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
  2025-04-11 12:47 ` [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups Caleb Connolly
@ 2025-04-11 14:10   ` Neil Armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: Neil Armstrong @ 2025-04-11 14:10 UTC (permalink / raw)
  To: Caleb Connolly, Simon Glass, Tom Rini, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

Hi,

On 11/04/2025 14:47, Caleb Connolly wrote:
> This will now apply fixups prior to devices being bound, which makes it
> possible to enable/disable devices and adjust more properties that might
> be read before devices probe.

Subject should be EVT_OF_LIVE_BUILT

Neil

> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   arch/arm/mach-snapdragon/board.c     |  1 -
>   arch/arm/mach-snapdragon/of_fixup.c  | 25 ++++++++++++++++---------
>   arch/arm/mach-snapdragon/qcom-priv.h | 14 --------------
>   3 files changed, 16 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index deae4d323789eab75d5fe735159b4cd820c02c45..3ab75f0fce02ecffd476ebe2aa606b1a9024bbec 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -305,9 +305,8 @@ void __weak qcom_board_init(void)
>   
>   int board_init(void)
>   {
>   	show_psci_version();
> -	qcom_of_fixup_nodes();
>   	qcom_board_init();
>   	return 0;
>   }
>   
> diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
> index 1ea0c18c2f2789a8aa054cd95bb9e4308d6b3384..70399307bcbda1e067230f00af6ba859a98c7ac0 100644
> --- a/arch/arm/mach-snapdragon/of_fixup.c
> +++ b/arch/arm/mach-snapdragon/of_fixup.c
> @@ -21,8 +21,9 @@
>   
>   #include <dt-bindings/input/linux-event-codes.h>
>   #include <dm/of_access.h>
>   #include <dm/of.h>
> +#include <event.h>
>   #include <fdt_support.h>
>   #include <linux/errno.h>
>   #include <stdlib.h>
>   #include <time.h>
> @@ -31,9 +32,9 @@
>    * USB controllers. Rather than requiring source level DT changes, we fix up
>    * DT here. This improves compatibility with upstream DT and simplifies the
>    * porting process for new devices.
>    */
> -static int fixup_qcom_dwc3(struct device_node *glue_np)
> +static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np)
>   {
>   	struct device_node *dwc3;
>   	int ret, len, hsphy_idx = 1;
>   	const __be32 *phandles;
> @@ -100,11 +101,11 @@ static int fixup_qcom_dwc3(struct device_node *glue_np)
>   
>   	return 0;
>   }
>   
> -static void fixup_usb_nodes(void)
> +static void fixup_usb_nodes(struct device_node *root)
>   {
> -	struct device_node *glue_np = NULL;
> +	struct device_node *glue_np = root;
>   	int ret;
>   
>   	while ((glue_np = of_find_compatible_node(glue_np, NULL, "qcom,dwc3"))) {
>   		ret = fixup_qcom_dwc3(glue_np);
> @@ -113,16 +114,16 @@ static void fixup_usb_nodes(void)
>   	}
>   }
>   
>   /* Remove all references to the rpmhpd device */
> -static void fixup_power_domains(void)
> +static void fixup_power_domains(struct device_node *root)
>   {
>   	struct device_node *pd = NULL, *np = NULL;
>   	struct property *prop;
>   	const __be32 *val;
>   
>   	/* All Qualcomm platforms name the rpm(h)pd "power-controller" */
> -	for_each_of_allnodes(pd) {
> +	for_each_of_allnodes_from(root, pd) {
>   		if (pd->name && !strcmp("power-controller", pd->name))
>   			break;
>   	}
>   
> @@ -132,9 +133,9 @@ static void fixup_power_domains(void)
>   		return;
>   	}
>   
>   	/* Remove all references to the power domain controller */
> -	for_each_of_allnodes(np) {
> +	for_each_of_allnodes_from(root, np) {
>   		if (!(prop = of_find_property(np, "power-domains", NULL)))
>   			continue;
>   
>   		val = prop->value;
> @@ -149,14 +150,20 @@ static void fixup_power_domains(void)
>   		func(__VA_ARGS__); \
>   		debug(#func " took %lluus\n", timer_get_us() - start); \
>   	} while (0)
>   
> -void qcom_of_fixup_nodes(void)
> +static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
>   {
> -	time_call(fixup_usb_nodes);
> -	time_call(fixup_power_domains);
> +	struct device_node *root = event->data.of_live_built.root;
> +
> +	time_call(fixup_usb_nodes, root);
> +	time_call(fixup_power_domains, root);
> +
> +	return 0;
>   }
>   
> +EVENT_SPY_FULL(EVT_OF_LIVE_BUILT, qcom_of_fixup_nodes);
> +
>   int ft_board_setup(void *blob, struct bd_info __maybe_unused *bd)
>   {
>   	struct fdt_header *fdt = blob;
>   	int node;
> diff --git a/arch/arm/mach-snapdragon/qcom-priv.h b/arch/arm/mach-snapdragon/qcom-priv.h
> index 74d39197b89f4e769299b06214c26ee829ecdce0..4f398e2ba374f27811afd2ccf6e72037d0f9ee7f 100644
> --- a/arch/arm/mach-snapdragon/qcom-priv.h
> +++ b/arch/arm/mach-snapdragon/qcom-priv.h
> @@ -8,19 +8,5 @@ void qcom_configure_capsule_updates(void);
>   #else
>   void qcom_configure_capsule_updates(void) {}
>   #endif /* EFI_HAVE_CAPSULE_SUPPORT */
>   
> -#if CONFIG_IS_ENABLED(OF_LIVE)
> -/**
> - * qcom_of_fixup_nodes() - Fixup Qualcomm DT nodes
> - *
> - * Adjusts nodes in the live tree to improve compatibility with U-Boot.
> - */
> -void qcom_of_fixup_nodes(void);
> -#else
> -static inline void qcom_of_fixup_nodes(void)
> -{
> -	log_debug("Unable to dynamically fixup USB nodes, please enable CONFIG_OF_LIVE\n");
> -}
> -#endif /* OF_LIVE */
> -
>   #endif /* __QCOM_PRIV_H__ */
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/8] event: signal when livetree has been built
  2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
@ 2025-04-11 14:11   ` Neil Armstrong
  2025-04-11 18:27   ` Simon Glass
  1 sibling, 0 replies; 21+ messages in thread
From: Neil Armstrong @ 2025-04-11 14:11 UTC (permalink / raw)
  To: Caleb Connolly, Simon Glass, Tom Rini, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

On 11/04/2025 14:47, Caleb Connolly wrote:
> OF_LIVE offers a variety of benefits, one of them being that the live
> tree can be modified without caring about the underlying FDT. This is
> particularly valuable for working around U-Boot limitations like lacking
> USB superspeed support on Qualcomm platforms, no runtime OTG, or
> peripherals like the sdcard being broken (and displaying potentially
> worrying error messages).
> 
> Add an event to signal when the live tree has been built so that we can
> apply fixups to it directly before devices are bound.
> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   common/event.c  |  3 +++
>   include/event.h | 18 ++++++++++++++++++
>   lib/of_live.c   | 11 +++++++++++
>   3 files changed, 32 insertions(+)
> 
> diff --git a/common/event.c b/common/event.c
> index dda569d447851f559a83f98fb7b1f3543156eab5..8d7513eb10b61919e1e784481dfdcc076be14986 100644
> --- a/common/event.c
> +++ b/common/event.c
> @@ -47,8 +47,11 @@ const char *const type_name[] = {
>   	"ft_fixup",
>   
>   	/* main loop events */
>   	"main_loop",
> +
> +	/* livetree has been built */
> +	"of_live_init",

"of_live_built" ?

>   };
>   
>   _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
>   #endif
> diff --git a/include/event.h b/include/event.h
> index 75141a192a48b0931667632f41be8ff4d6139f7c..1d267f1d10547642d381fa287ab4981a2bf03543 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -152,8 +152,17 @@ enum event_t {
>   	 * A non-zero return value causes the boot to fail.
>   	 */
>   	EVT_MAIN_LOOP,
>   
> +	/**
> +	 * @EVT_OF_LIVE_BUILT:
> +	 * This event is triggered immediately after the live device tree has been
> +	 * built. This allows for machine specific fixups to be done to the live tree
> +	 * (like disabling known-unsupported devices) before it is used. This
> +	 * event is only available if OF_LIVE is enabled and is only used after relocation.
> +	 */
> +	EVT_OF_LIVE_BUILT,
> +
>   	/**
>   	 * @EVT_COUNT:
>   	 * This constants holds the maximum event number + 1 and is used when
>   	 * looping over all event classes.
> @@ -202,8 +211,17 @@ union event_data {
>   	struct event_ft_fixup {
>   		oftree tree;
>   		struct bootm_headers *images;
>   	} ft_fixup;
> +
> +	/**
> +	 * struct event_of_live_built - livetree has been built
> +	 *
> +	 * @root: The root node of the live device tree
> +	 */
> +	struct event_of_live_built {
> +		struct device_node *root;
> +	} of_live_built;
>   };
>   
>   /**
>    * struct event - an event that can be sent and received
> diff --git a/lib/of_live.c b/lib/of_live.c
> index 90b9459ede313e492e28c8556c730f3bd8aaa9df..c1620616513c2e32448b4a6d156a9162d97c76b7 100644
> --- a/lib/of_live.c
> +++ b/lib/of_live.c
> @@ -10,8 +10,9 @@
>   
>   #define LOG_CATEGORY	LOGC_DT
>   
>   #include <abuf.h>
> +#include <event.h>
>   #include <log.h>
>   #include <linux/libfdt.h>
>   #include <of_live.h>
>   #include <malloc.h>
> @@ -320,8 +321,9 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
>   
>   int of_live_build(const void *fdt_blob, struct device_node **rootp)
>   {
>   	int ret;
> +	union event_data evt;
>   
>   	debug("%s: start\n", __func__);
>   	ret = unflatten_device_tree(fdt_blob, rootp);
>   	if (ret) {
> @@ -334,8 +336,17 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
>   		return ret;
>   	}
>   	debug("%s: stop\n", __func__);
>   
> +	if (CONFIG_IS_ENABLED(EVENT)) {
> +		evt.of_live_built.root = *rootp;
> +		ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
> +		if (ret) {
> +			log_debug("Failed to notify livetree build event: err=%d\n", ret);
> +			return ret;
> +		}
> +	}
> +
>   	return ret;
>   }
>   
>   void of_live_free(struct device_node *root)
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message
  2025-04-11 12:47 ` [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message Caleb Connolly
@ 2025-04-11 14:11   ` Neil Armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: Neil Armstrong @ 2025-04-11 14:11 UTC (permalink / raw)
  To: Caleb Connolly, Simon Glass, Tom Rini, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

On 11/04/2025 14:47, Caleb Connolly wrote:
> The debug log here had the logic completely backwards, even though the
> code is actually correct. Remove it since it's extraneous anyway.
> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   arch/arm/mach-snapdragon/of_fixup.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
> index dcd09ee7cac3e02287647c9e6df5575651e18e85..a5515c02d3de05944dfb7c1b2a5542631b517497 100644
> --- a/arch/arm/mach-snapdragon/of_fixup.c
> +++ b/arch/arm/mach-snapdragon/of_fixup.c
> @@ -72,13 +72,14 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
>   		log_err("Failed to read second phy name: %d\n", ret);
>   		return ret;
>   	}
>   
> -	if (!strncmp("usb3-phy", second_phy_name, strlen("usb3-phy"))) {
> -		log_debug("Second phy isn't superspeed (is '%s') assuming first phy is SS\n",
> -			  second_phy_name);
> +	/*
> +	 * Determine which phy is the superspeed phy by checking the name of the second phy
> +	 * since it is typically the superspeed one.
> +	 */
> +	if (!strncmp("usb3-phy", second_phy_name, strlen("usb3-phy")))
>   		hsphy_idx = 0;
> -	}
>   
>   	/* Overwrite the "phys" property to only contain the high-speed phy */
>   	ret = of_write_prop(dwc3, "phys", sizeof(*phandles), phandles + hsphy_idx);
>   	if (ret) {
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment
  2025-04-11 12:47 ` [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment Caleb Connolly
@ 2025-04-11 14:12   ` Neil Armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: Neil Armstrong @ 2025-04-11 14:12 UTC (permalink / raw)
  To: Caleb Connolly, Simon Glass, Tom Rini, Sumit Garg,
	Lukasz Majewski, Sean Anderson
  Cc: u-boot, u-boot-qcom

On 11/04/2025 14:47, Caleb Connolly wrote:
> we don't rewrite the volume buttons any more.
> 
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   arch/arm/mach-snapdragon/of_fixup.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
> index a5515c02d3de05944dfb7c1b2a5542631b517497..10053e48d88017d2179c96f2f3724c4d5dc4f3e2 100644
> --- a/arch/arm/mach-snapdragon/of_fixup.c
> +++ b/arch/arm/mach-snapdragon/of_fixup.c
> @@ -3,10 +3,9 @@
>    * OF_LIVE devicetree fixup.
>    *
>    * This file implements runtime fixups for Qualcomm DT to improve
>    * compatibility with U-Boot. This includes adjusting the USB nodes
> - * to only use USB high-speed, as well as remapping volume buttons
> - * to behave as up/down for navigating U-Boot.
> + * to only use USB high-speed.
>    *
>    * We use OF_LIVE for this rather than early FDT fixup for a couple
>    * of reasons: it has a much nicer API, is most likely more efficient,
>    * and our changes are only applied to U-Boot. This allows us to use a
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/8] event: signal when livetree has been built
  2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
  2025-04-11 14:11   ` Neil Armstrong
@ 2025-04-11 18:27   ` Simon Glass
  2025-04-14 12:33     ` Caleb Connolly
  1 sibling, 1 reply; 21+ messages in thread
From: Simon Glass @ 2025-04-11 18:27 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Tom Rini, Neil Armstrong, Sumit Garg, Lukasz Majewski,
	Sean Anderson, u-boot, u-boot-qcom

Hi Caleb,

On Fri, 11 Apr 2025 at 06:47, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> OF_LIVE offers a variety of benefits, one of them being that the live
> tree can be modified without caring about the underlying FDT. This is
> particularly valuable for working around U-Boot limitations like lacking
> USB superspeed support on Qualcomm platforms, no runtime OTG, or
> peripherals like the sdcard being broken (and displaying potentially
> worrying error messages).
>
> Add an event to signal when the live tree has been built so that we can
> apply fixups to it directly before devices are bound.
>
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  common/event.c  |  3 +++
>  include/event.h | 18 ++++++++++++++++++
>  lib/of_live.c   | 11 +++++++++++
>  3 files changed, 32 insertions(+)
>
> diff --git a/common/event.c b/common/event.c
> index dda569d447851f559a83f98fb7b1f3543156eab5..8d7513eb10b61919e1e784481dfdcc076be14986 100644
> --- a/common/event.c
> +++ b/common/event.c
> @@ -47,8 +47,11 @@ const char *const type_name[] = {
>         "ft_fixup",
>
>         /* main loop events */
>         "main_loop",
> +
> +       /* livetree has been built */
> +       "of_live_init",
>  };
>
>  _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
>  #endif
> diff --git a/include/event.h b/include/event.h
> index 75141a192a48b0931667632f41be8ff4d6139f7c..1d267f1d10547642d381fa287ab4981a2bf03543 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -152,8 +152,17 @@ enum event_t {
>          * A non-zero return value causes the boot to fail.
>          */
>         EVT_MAIN_LOOP,
>
> +       /**
> +        * @EVT_OF_LIVE_BUILT:
> +        * This event is triggered immediately after the live device tree has been
> +        * built. This allows for machine specific fixups to be done to the live tree
> +        * (like disabling known-unsupported devices) before it is used. This
> +        * event is only available if OF_LIVE is enabled and is only used after relocation.

Add a bit more detail, e.g.: before it is used by U-Boot
post-relocation. This means it is possible to affect the devices bound
by driver model.

You should also note that the flattree is inactive when livetree is
used and any changes may eventually be passed onto the OS, if it
doesn't have its own devicetree. This is the point we were discussing
on the other thread.

> +        */
> +       EVT_OF_LIVE_BUILT,
> +
>         /**
>          * @EVT_COUNT:
>          * This constants holds the maximum event number + 1 and is used when
>          * looping over all event classes.
> @@ -202,8 +211,17 @@ union event_data {
>         struct event_ft_fixup {
>                 oftree tree;
>                 struct bootm_headers *images;
>         } ft_fixup;
> +
> +       /**
> +        * struct event_of_live_built - livetree has been built
> +        *
> +        * @root: The root node of the live device tree
> +        */
> +       struct event_of_live_built {
> +               struct device_node *root;
> +       } of_live_built;
>  };
>
>  /**
>   * struct event - an event that can be sent and received
> diff --git a/lib/of_live.c b/lib/of_live.c
> index 90b9459ede313e492e28c8556c730f3bd8aaa9df..c1620616513c2e32448b4a6d156a9162d97c76b7 100644
> --- a/lib/of_live.c
> +++ b/lib/of_live.c
> @@ -10,8 +10,9 @@
>
>  #define LOG_CATEGORY   LOGC_DT
>
>  #include <abuf.h>
> +#include <event.h>
>  #include <log.h>
>  #include <linux/libfdt.h>
>  #include <of_live.h>
>  #include <malloc.h>
> @@ -320,8 +321,9 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
>
>  int of_live_build(const void *fdt_blob, struct device_node **rootp)
>  {
>         int ret;
> +       union event_data evt;
>
>         debug("%s: start\n", __func__);
>         ret = unflatten_device_tree(fdt_blob, rootp);
>         if (ret) {
> @@ -334,8 +336,17 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
>                 return ret;
>         }
>         debug("%s: stop\n", __func__);
>
> +       if (CONFIG_IS_ENABLED(EVENT)) {
> +               evt.of_live_built.root = *rootp;
> +               ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
> +               if (ret) {
> +                       log_debug("Failed to notify livetree build event: err=%d\n", ret);
> +                       return ret;
> +               }
> +       }
> +

This should move to the caller of this function. We should also have a
sandbox test for this feature, e.g. catch the event and add a
node/prop and check in a test in test-fdt.c (or similar) that it is
present.

I'm not sure if you need to update test_event_dump.py but since CI
presumably passes, I guess not.

>         return ret;
>  }
>
>  void of_live_free(struct device_node *root)
>
> --
> 2.49.0
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/8] event: signal when livetree has been built
  2025-04-11 18:27   ` Simon Glass
@ 2025-04-14 12:33     ` Caleb Connolly
  2025-04-17 21:37       ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-14 12:33 UTC (permalink / raw)
  To: Simon Glass
  Cc: Tom Rini, Neil Armstrong, Sumit Garg, Lukasz Majewski,
	Sean Anderson, u-boot, u-boot-qcom

Hi Simon,

On 4/11/25 20:27, Simon Glass wrote:
> Hi Caleb,
> 
> On Fri, 11 Apr 2025 at 06:47, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>>
>> OF_LIVE offers a variety of benefits, one of them being that the live
>> tree can be modified without caring about the underlying FDT. This is
>> particularly valuable for working around U-Boot limitations like lacking
>> USB superspeed support on Qualcomm platforms, no runtime OTG, or
>> peripherals like the sdcard being broken (and displaying potentially
>> worrying error messages).
>>
>> Add an event to signal when the live tree has been built so that we can
>> apply fixups to it directly before devices are bound.
>>
>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>> ---
>>   common/event.c  |  3 +++
>>   include/event.h | 18 ++++++++++++++++++
>>   lib/of_live.c   | 11 +++++++++++
>>   3 files changed, 32 insertions(+)
>>
>> diff --git a/common/event.c b/common/event.c
>> index dda569d447851f559a83f98fb7b1f3543156eab5..8d7513eb10b61919e1e784481dfdcc076be14986 100644
>> --- a/common/event.c
>> +++ b/common/event.c
>> @@ -47,8 +47,11 @@ const char *const type_name[] = {
>>          "ft_fixup",
>>
>>          /* main loop events */
>>          "main_loop",
>> +
>> +       /* livetree has been built */
>> +       "of_live_init",
>>   };
>>
>>   _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
>>   #endif
>> diff --git a/include/event.h b/include/event.h
>> index 75141a192a48b0931667632f41be8ff4d6139f7c..1d267f1d10547642d381fa287ab4981a2bf03543 100644
>> --- a/include/event.h
>> +++ b/include/event.h
>> @@ -152,8 +152,17 @@ enum event_t {
>>           * A non-zero return value causes the boot to fail.
>>           */
>>          EVT_MAIN_LOOP,
>>
>> +       /**
>> +        * @EVT_OF_LIVE_BUILT:
>> +        * This event is triggered immediately after the live device tree has been
>> +        * built. This allows for machine specific fixups to be done to the live tree
>> +        * (like disabling known-unsupported devices) before it is used. This
>> +        * event is only available if OF_LIVE is enabled and is only used after relocation.
> 
> Add a bit more detail, e.g.: before it is used by U-Boot
> post-relocation. This means it is possible to affect the devices bound
> by driver model.

I think this is really implied and made obvious by context clues. IF 
there comes a time where we build the live tree more than once (e.g. to 
build it as part of the DT_FIXUP_PROTOCOL for some reason) then the 
extra info you propose adding would no longer be correct, where the 
current wording would remain correct.

> 
> You should also note that the flattree is inactive when livetree is
> used and any changes may eventually be passed onto the OS, if it
> doesn't have its own devicetree. This is the point we were discussing
> on the other thread.

This information is totally irrelevant though, and there is no broad 
agreement with your proposed changes. The livetree API is also set up so 
that one could build multiple livetrees (for whatever reason), this 
event is modelled to reflect that (where you can see in my v1 patches 
that the event assumed you would only ever build the global tree).

> 
>> +        */
>> +       EVT_OF_LIVE_BUILT,
>> +
>>          /**
>>           * @EVT_COUNT:
>>           * This constants holds the maximum event number + 1 and is used when
>>           * looping over all event classes.
>> @@ -202,8 +211,17 @@ union event_data {
>>          struct event_ft_fixup {
>>                  oftree tree;
>>                  struct bootm_headers *images;
>>          } ft_fixup;
>> +
>> +       /**
>> +        * struct event_of_live_built - livetree has been built
>> +        *
>> +        * @root: The root node of the live device tree
>> +        */
>> +       struct event_of_live_built {
>> +               struct device_node *root;
>> +       } of_live_built;
>>   };
>>
>>   /**
>>    * struct event - an event that can be sent and received
>> diff --git a/lib/of_live.c b/lib/of_live.c
>> index 90b9459ede313e492e28c8556c730f3bd8aaa9df..c1620616513c2e32448b4a6d156a9162d97c76b7 100644
>> --- a/lib/of_live.c
>> +++ b/lib/of_live.c
>> @@ -10,8 +10,9 @@
>>
>>   #define LOG_CATEGORY   LOGC_DT
>>
>>   #include <abuf.h>
>> +#include <event.h>
>>   #include <log.h>
>>   #include <linux/libfdt.h>
>>   #include <of_live.h>
>>   #include <malloc.h>
>> @@ -320,8 +321,9 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
>>
>>   int of_live_build(const void *fdt_blob, struct device_node **rootp)
>>   {
>>          int ret;
>> +       union event_data evt;
>>
>>          debug("%s: start\n", __func__);
>>          ret = unflatten_device_tree(fdt_blob, rootp);
>>          if (ret) {
>> @@ -334,8 +336,17 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
>>                  return ret;
>>          }
>>          debug("%s: stop\n", __func__);
>>
>> +       if (CONFIG_IS_ENABLED(EVENT)) {
>> +               evt.of_live_built.root = *rootp;
>> +               ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
>> +               if (ret) {
>> +                       log_debug("Failed to notify livetree build event: err=%d\n", ret);
>> +                       return ret;
>> +               }
>> +       }
>> +
> 
> This should move to the caller of this function. We should also have a

Why move it to the caller? Then every caller would need to signal the 
event and we'd pointlessly duplicate code. The event signals that /a/ 
livetree has been built. Today this only happens once and we make the 
assumption that this livetree is to be used by U-Boot and only U-Boot.

Should this assumption become incorrect in the future, it would be 
trivial to introduce a variable to the event_data that describes what 
the livetree is and/or where it will be used so that anyone catching the 
event can decide what to do.

Since we don't yet know any other usecases, it would be overzealous to 
try and capture this information since we just don't know what's important.

> sandbox test for this feature, e.g. catch the event and add a
> node/prop and check in a test in test-fdt.c (or similar) that it is
> present.

What would this test other than that the event is sent? We already have 
tests for the event framework...

> 
> I'm not sure if you need to update test_event_dump.py but since CI
> presumably passes, I guess not.>
>>          return ret;
>>   }
>>
>>   void of_live_free(struct device_node *root)
>>
>> --
>> 2.49.0
>>
> 
> Regards,
> Simon
-- 
Caleb (they/them)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/8] event: signal when livetree has been built
  2025-04-14 12:33     ` Caleb Connolly
@ 2025-04-17 21:37       ` Simon Glass
  0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2025-04-17 21:37 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Tom Rini, Neil Armstrong, Sumit Garg, Lukasz Majewski,
	Sean Anderson, u-boot, u-boot-qcom

Hi Caleb,

On Mon, 14 Apr 2025 at 06:33, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> Hi Simon,
>
> On 4/11/25 20:27, Simon Glass wrote:
> > Hi Caleb,
> >
> > On Fri, 11 Apr 2025 at 06:47, Caleb Connolly <caleb.connolly@linaro.org> wrote:
> >>
> >> OF_LIVE offers a variety of benefits, one of them being that the live
> >> tree can be modified without caring about the underlying FDT. This is
> >> particularly valuable for working around U-Boot limitations like lacking
> >> USB superspeed support on Qualcomm platforms, no runtime OTG, or
> >> peripherals like the sdcard being broken (and displaying potentially
> >> worrying error messages).
> >>
> >> Add an event to signal when the live tree has been built so that we can
> >> apply fixups to it directly before devices are bound.
> >>
> >> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> >> ---
> >>   common/event.c  |  3 +++
> >>   include/event.h | 18 ++++++++++++++++++
> >>   lib/of_live.c   | 11 +++++++++++
> >>   3 files changed, 32 insertions(+)
> >>
> >> diff --git a/common/event.c b/common/event.c
> >> index dda569d447851f559a83f98fb7b1f3543156eab5..8d7513eb10b61919e1e784481dfdcc076be14986 100644
> >> --- a/common/event.c
> >> +++ b/common/event.c
> >> @@ -47,8 +47,11 @@ const char *const type_name[] = {
> >>          "ft_fixup",
> >>
> >>          /* main loop events */
> >>          "main_loop",
> >> +
> >> +       /* livetree has been built */
> >> +       "of_live_init",
> >>   };
> >>
> >>   _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
> >>   #endif
> >> diff --git a/include/event.h b/include/event.h
> >> index 75141a192a48b0931667632f41be8ff4d6139f7c..1d267f1d10547642d381fa287ab4981a2bf03543 100644
> >> --- a/include/event.h
> >> +++ b/include/event.h
> >> @@ -152,8 +152,17 @@ enum event_t {
> >>           * A non-zero return value causes the boot to fail.
> >>           */
> >>          EVT_MAIN_LOOP,
> >>
> >> +       /**
> >> +        * @EVT_OF_LIVE_BUILT:
> >> +        * This event is triggered immediately after the live device tree has been
> >> +        * built. This allows for machine specific fixups to be done to the live tree
> >> +        * (like disabling known-unsupported devices) before it is used. This
> >> +        * event is only available if OF_LIVE is enabled and is only used after relocation.
> >
> > Add a bit more detail, e.g.: before it is used by U-Boot
> > post-relocation. This means it is possible to affect the devices bound
> > by driver model.
>
> I think this is really implied and made obvious by context clues. IF
> there comes a time where we build the live tree more than once (e.g. to
> build it as part of the DT_FIXUP_PROTOCOL for some reason) then the
> extra info you propose adding would no longer be correct, where the
> current wording would remain correct.

OK, leave it alone if you like.

>
> >
> > You should also note that the flattree is inactive when livetree is
> > used and any changes may eventually be passed onto the OS, if it
> > doesn't have its own devicetree. This is the point we were discussing
> > on the other thread.
>
> This information is totally irrelevant though, and there is no broad
> agreement with your proposed changes. The livetree API is also set up so
> that one could build multiple livetrees (for whatever reason), this
> event is modelled to reflect that (where you can see in my v1 patches
> that the event assumed you would only ever build the global tree).

Hmmm, if Linaro is going to block livetree fixups then we are going to
have a problem. I have not heard that, but let me know.

>
> >
> >> +        */
> >> +       EVT_OF_LIVE_BUILT,
> >> +
> >>          /**
> >>           * @EVT_COUNT:
> >>           * This constants holds the maximum event number + 1 and is used when
> >>           * looping over all event classes.
> >> @@ -202,8 +211,17 @@ union event_data {
> >>          struct event_ft_fixup {
> >>                  oftree tree;
> >>                  struct bootm_headers *images;
> >>          } ft_fixup;
> >> +
> >> +       /**
> >> +        * struct event_of_live_built - livetree has been built
> >> +        *
> >> +        * @root: The root node of the live device tree
> >> +        */
> >> +       struct event_of_live_built {
> >> +               struct device_node *root;
> >> +       } of_live_built;
> >>   };
> >>
> >>   /**
> >>    * struct event - an event that can be sent and received
> >> diff --git a/lib/of_live.c b/lib/of_live.c
> >> index 90b9459ede313e492e28c8556c730f3bd8aaa9df..c1620616513c2e32448b4a6d156a9162d97c76b7 100644
> >> --- a/lib/of_live.c
> >> +++ b/lib/of_live.c
> >> @@ -10,8 +10,9 @@
> >>
> >>   #define LOG_CATEGORY   LOGC_DT
> >>
> >>   #include <abuf.h>
> >> +#include <event.h>
> >>   #include <log.h>
> >>   #include <linux/libfdt.h>
> >>   #include <of_live.h>
> >>   #include <malloc.h>
> >> @@ -320,8 +321,9 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes)
> >>
> >>   int of_live_build(const void *fdt_blob, struct device_node **rootp)
> >>   {
> >>          int ret;
> >> +       union event_data evt;
> >>
> >>          debug("%s: start\n", __func__);
> >>          ret = unflatten_device_tree(fdt_blob, rootp);
> >>          if (ret) {
> >> @@ -334,8 +336,17 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp)
> >>                  return ret;
> >>          }
> >>          debug("%s: stop\n", __func__);
> >>
> >> +       if (CONFIG_IS_ENABLED(EVENT)) {
> >> +               evt.of_live_built.root = *rootp;
> >> +               ret = event_notify(EVT_OF_LIVE_BUILT, &evt, sizeof(evt));
> >> +               if (ret) {
> >> +                       log_debug("Failed to notify livetree build event: err=%d\n", ret);
> >> +                       return ret;
> >> +               }
> >> +       }
> >> +
> >
> > This should move to the caller of this function. We should also have a
>
> Why move it to the caller? Then every caller would need to signal the
> event and we'd pointlessly duplicate code. The event signals that /a/
> livetree has been built. Today this only happens once and we make the
> assumption that this livetree is to be used by U-Boot and only U-Boot.
>
> Should this assumption become incorrect in the future, it would be
> trivial to introduce a variable to the event_data that describes what
> the livetree is and/or where it will be used so that anyone catching the
> event can decide what to do.
>
> Since we don't yet know any other usecases, it would be overzealous to
> try and capture this information since we just don't know what's important.

There is (and will only ever be) one caller. At this point I really
don't mind what you do.

>
> > sandbox test for this feature, e.g. catch the event and add a
> > node/prop and check in a test in test-fdt.c (or similar) that it is
> > present.
>
> What would this test other than that the event is sent? We already have
> tests for the event framework...

If the CI tests pass, then it's fine.


>
> >
> > I'm not sure if you need to update test_event_dump.py but since CI
> > presumably passes, I guess not.>
> >>          return ret;
> >>   }
> >>
> >>   void of_live_free(struct device_node *root)
> >>
> >> --
> >> 2.49.0
> >>

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
  2025-04-11 12:47 ` [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count Caleb Connolly
@ 2025-05-02  6:02   ` Sumit Garg
  0 siblings, 0 replies; 21+ messages in thread
From: Sumit Garg @ 2025-05-02  6:02 UTC (permalink / raw)
  To: Casey Connolly
  Cc: Simon Glass, Tom Rini, Neil Armstrong, Lukasz Majewski,
	Sean Anderson, u-boot, u-boot-qcom, Sumit Garg

Hi Casey,

On Fri, Apr 11, 2025 at 02:47:45PM +0200, Caleb Connolly wrote:
> There are 134 pins not 133, oops! This fixes the sdcard on the RB1 as
> the pins now all get configured correctly.
> 
> Fixes: 0ecb8cfcb930 ("pinctrl: qcom: add qcm2290 pinctrl driver")
> 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>
> ---
>  drivers/pinctrl/qcom/pinctrl-qcm2290.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

I think this is an independent fix for SD card to work on RB1. Can you
queue it for v2025.07?

Also, I am not sure if you are planning this complete series for
v2025.07. If not then can we atleast have a DT override for USB DR mode
to make it work on RB1 in v2025.07?

-Sumit

> diff --git a/drivers/pinctrl/qcom/pinctrl-qcm2290.c b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
> index 0c2222ce663e6d584d229e7521f88fedf8aa19da..84f76b63b93ad78182524661dba561672feb4c85 100644
> --- a/drivers/pinctrl/qcom/pinctrl-qcm2290.c
> +++ b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
> @@ -44,9 +44,9 @@ static int qcm2290_get_function_mux(__maybe_unused unsigned int pin, unsigned in
>  }
>  
>  struct msm_pinctrl_data qcm2290_data = {
>  	.pin_data = {
> -		.pin_count = 133,
> +		.pin_count = 134,
>  		.special_pins_start = 127,
>  	},
>  	.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
>  	.get_function_name = qcm2290_get_function_name,
> 
> -- 
> 2.49.0
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2
  2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
                   ` (7 preceding siblings ...)
  2025-04-11 12:47 ` [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count Caleb Connolly
@ 2025-05-02 16:26 ` Tom Rini
  2025-05-03  2:09   ` Simon Glass
  8 siblings, 1 reply; 21+ messages in thread
From: Tom Rini @ 2025-05-02 16:26 UTC (permalink / raw)
  To: Simon Glass, Neil Armstrong, Sumit Garg, Lukasz Majewski,
	Sean Anderson, Casey Connolly
  Cc: u-boot, u-boot-qcom, Sumit Garg

On Fri, 11 Apr 2025 14:47:37 +0200, Caleb Connolly wrote:

> Introduce a new event to signal that the live tree has been built,
> allowing boards to perform fixups on the tree before devices are bound.
> Crucially this allows for devices to be enabled or disabled, but also
> allows for properties that are parsed during the bind stage to be
> modified (such as dr_mode for dwc3).
> 
> With this in place, mach-snapdragon is switched over to use the event
> and some hacky U-Boot specific DT overrides (which had to be undone
> prior to booting an image) are removed in favour of fixing up the
> livetree (which is not passed on to further boot stages).
> 
> [...]

Applied to u-boot/master, thanks!

[1/8] event: signal when livetree has been built
      commit: 993a9db918af451c68851522c8770e582b717629
[2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
      commit: 5a1dfb27f9170d35a475ea8be46b5d7c037ee837
[3/8] mach-snapdragon: of_fixup: skip disabled USB nodes
      commit: 0ec337d03410a4a0b7402ae72968470cf63f0c55
[4/8] mach-snapdragon: of_fixup: remove confusing log message
      commit: a6cc4ef343dc39c17fd5b833d983aff2f26c94b7
[5/8] mach-snapdragon: of_fixup: update comment
      commit: 9bc7eef9bf58c4c1d453cba81060dc61375f5354
[6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
      commit: 3b983cf48e70ecb6aadca788d0d91a021340c802
[7/8] clk/qcom: qcm2290: show clock name in set_rate()
      commit: 229fd3f9a8d4dbaad7c9a2e9c1b62d14d0753b0b
[8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
      commit: 2803a466a96153ab01c5789321e48397b6bae9c7
-- 
Tom



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2
  2025-05-02 16:26 ` [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Tom Rini
@ 2025-05-03  2:09   ` Simon Glass
  2025-05-03 16:58     ` Tom Rini
  0 siblings, 1 reply; 21+ messages in thread
From: Simon Glass @ 2025-05-03  2:09 UTC (permalink / raw)
  To: Tom Rini
  Cc: Neil Armstrong, Sumit Garg, Lukasz Majewski, Sean Anderson,
	Casey Connolly, u-boot, u-boot-qcom, Sumit Garg

Hi Tom,

On Fri, 2 May 2025 at 10:26, Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, 11 Apr 2025 14:47:37 +0200, Caleb Connolly wrote:
>
> > Introduce a new event to signal that the live tree has been built,
> > allowing boards to perform fixups on the tree before devices are bound.
> > Crucially this allows for devices to be enabled or disabled, but also
> > allows for properties that are parsed during the bind stage to be
> > modified (such as dr_mode for dwc3).
> >
> > With this in place, mach-snapdragon is switched over to use the event
> > and some hacky U-Boot specific DT overrides (which had to be undone
> > prior to booting an image) are removed in favour of fixing up the
> > livetree (which is not passed on to further boot stages).
> >
> > [...]
>
> Applied to u-boot/master, thanks!
>
> [1/8] event: signal when livetree has been built
>       commit: 993a9db918af451c68851522c8770e582b717629
> [2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
>       commit: 5a1dfb27f9170d35a475ea8be46b5d7c037ee837
> [3/8] mach-snapdragon: of_fixup: skip disabled USB nodes
>       commit: 0ec337d03410a4a0b7402ae72968470cf63f0c55
> [4/8] mach-snapdragon: of_fixup: remove confusing log message
>       commit: a6cc4ef343dc39c17fd5b833d983aff2f26c94b7
> [5/8] mach-snapdragon: of_fixup: update comment
>       commit: 9bc7eef9bf58c4c1d453cba81060dc61375f5354
> [6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
>       commit: 3b983cf48e70ecb6aadca788d0d91a021340c802
> [7/8] clk/qcom: qcm2290: show clock name in set_rate()
>       commit: 229fd3f9a8d4dbaad7c9a2e9c1b62d14d0753b0b
> [8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
>       commit: 2803a466a96153ab01c5789321e48397b6bae9c7
> --
> Tom
>

One of the patches in this series introduces the concept of two
parallel devicetrees in U-Boot. So once we do move to livetree 'for
real' it won't work. We did have a discussion on the series and I
proposed a couple of alternatives, but have not heard back on those.

As always, I don't mind what is applied so long as we can change it later.

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2
  2025-05-03  2:09   ` Simon Glass
@ 2025-05-03 16:58     ` Tom Rini
  2025-05-06 13:24       ` Simon Glass
  0 siblings, 1 reply; 21+ messages in thread
From: Tom Rini @ 2025-05-03 16:58 UTC (permalink / raw)
  To: Simon Glass
  Cc: Neil Armstrong, Sumit Garg, Lukasz Majewski, Sean Anderson,
	Casey Connolly, u-boot, u-boot-qcom, Sumit Garg

[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]

On Fri, May 02, 2025 at 08:09:48PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Fri, 2 May 2025 at 10:26, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Fri, 11 Apr 2025 14:47:37 +0200, Caleb Connolly wrote:
> >
> > > Introduce a new event to signal that the live tree has been built,
> > > allowing boards to perform fixups on the tree before devices are bound.
> > > Crucially this allows for devices to be enabled or disabled, but also
> > > allows for properties that are parsed during the bind stage to be
> > > modified (such as dr_mode for dwc3).
> > >
> > > With this in place, mach-snapdragon is switched over to use the event
> > > and some hacky U-Boot specific DT overrides (which had to be undone
> > > prior to booting an image) are removed in favour of fixing up the
> > > livetree (which is not passed on to further boot stages).
> > >
> > > [...]
> >
> > Applied to u-boot/master, thanks!
> >
> > [1/8] event: signal when livetree has been built
> >       commit: 993a9db918af451c68851522c8770e582b717629
> > [2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
> >       commit: 5a1dfb27f9170d35a475ea8be46b5d7c037ee837
> > [3/8] mach-snapdragon: of_fixup: skip disabled USB nodes
> >       commit: 0ec337d03410a4a0b7402ae72968470cf63f0c55
> > [4/8] mach-snapdragon: of_fixup: remove confusing log message
> >       commit: a6cc4ef343dc39c17fd5b833d983aff2f26c94b7
> > [5/8] mach-snapdragon: of_fixup: update comment
> >       commit: 9bc7eef9bf58c4c1d453cba81060dc61375f5354
> > [6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
> >       commit: 3b983cf48e70ecb6aadca788d0d91a021340c802
> > [7/8] clk/qcom: qcm2290: show clock name in set_rate()
> >       commit: 229fd3f9a8d4dbaad7c9a2e9c1b62d14d0753b0b
> > [8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
> >       commit: 2803a466a96153ab01c5789321e48397b6bae9c7
> > --
> > Tom
> >
> 
> One of the patches in this series introduces the concept of two
> parallel devicetrees in U-Boot. So once we do move to livetree 'for
> real' it won't work. We did have a discussion on the series and I
> proposed a couple of alternatives, but have not heard back on those.
> 
> As always, I don't mind what is applied so long as we can change it later.

Yes, it seemed we had reached the point where there was confusion over
how things work, so we're going to move forward and see what's needed in
the future.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2
  2025-05-03 16:58     ` Tom Rini
@ 2025-05-06 13:24       ` Simon Glass
  0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2025-05-06 13:24 UTC (permalink / raw)
  To: Tom Rini
  Cc: Neil Armstrong, Sumit Garg, Lukasz Majewski, Sean Anderson,
	Casey Connolly, u-boot, u-boot-qcom, Sumit Garg

Hi Tom,

On Sat, 3 May 2025 at 18:58, Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, May 02, 2025 at 08:09:48PM -0600, Simon Glass wrote:
> > Hi Tom,
> >
> > On Fri, 2 May 2025 at 10:26, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Fri, 11 Apr 2025 14:47:37 +0200, Caleb Connolly wrote:
> > >
> > > > Introduce a new event to signal that the live tree has been built,
> > > > allowing boards to perform fixups on the tree before devices are bound.
> > > > Crucially this allows for devices to be enabled or disabled, but also
> > > > allows for properties that are parsed during the bind stage to be
> > > > modified (such as dr_mode for dwc3).
> > > >
> > > > With this in place, mach-snapdragon is switched over to use the event
> > > > and some hacky U-Boot specific DT overrides (which had to be undone
> > > > prior to booting an image) are removed in favour of fixing up the
> > > > livetree (which is not passed on to further boot stages).
> > > >
> > > > [...]
> > >
> > > Applied to u-boot/master, thanks!
> > >
> > > [1/8] event: signal when livetree has been built
> > >       commit: 993a9db918af451c68851522c8770e582b717629
> > > [2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups
> > >       commit: 5a1dfb27f9170d35a475ea8be46b5d7c037ee837
> > > [3/8] mach-snapdragon: of_fixup: skip disabled USB nodes
> > >       commit: 0ec337d03410a4a0b7402ae72968470cf63f0c55
> > > [4/8] mach-snapdragon: of_fixup: remove confusing log message
> > >       commit: a6cc4ef343dc39c17fd5b833d983aff2f26c94b7
> > > [5/8] mach-snapdragon: of_fixup: update comment
> > >       commit: 9bc7eef9bf58c4c1d453cba81060dc61375f5354
> > > [6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards
> > >       commit: 3b983cf48e70ecb6aadca788d0d91a021340c802
> > > [7/8] clk/qcom: qcm2290: show clock name in set_rate()
> > >       commit: 229fd3f9a8d4dbaad7c9a2e9c1b62d14d0753b0b
> > > [8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count
> > >       commit: 2803a466a96153ab01c5789321e48397b6bae9c7
> > > --
> > > Tom
> > >
> >
> > One of the patches in this series introduces the concept of two
> > parallel devicetrees in U-Boot. So once we do move to livetree 'for
> > real' it won't work. We did have a discussion on the series and I
> > proposed a couple of alternatives, but have not heard back on those.
> >
> > As always, I don't mind what is applied so long as we can change it later.
>
> Yes, it seemed we had reached the point where there was confusion over
> how things work, so we're going to move forward and see what's needed in
> the future.

OK. I am not sure when I will get to doing more on the OF_LIVE
migration, but it is a good reminder.

Regards,
Simon

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-05-06 13:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 12:47 [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Caleb Connolly
2025-04-11 12:47 ` [PATCH v2 1/8] event: signal when livetree has been built Caleb Connolly
2025-04-11 14:11   ` Neil Armstrong
2025-04-11 18:27   ` Simon Glass
2025-04-14 12:33     ` Caleb Connolly
2025-04-17 21:37       ` Simon Glass
2025-04-11 12:47 ` [PATCH v2 2/8] mach-snapdragon: use EVT_OF_LIVE_INIT to apply DT fixups Caleb Connolly
2025-04-11 14:10   ` Neil Armstrong
2025-04-11 12:47 ` [PATCH v2 3/8] mach-snapdragon: of_fixup: skip disabled USB nodes Caleb Connolly
2025-04-11 12:47 ` [PATCH v2 4/8] mach-snapdragon: of_fixup: remove confusing log message Caleb Connolly
2025-04-11 14:11   ` Neil Armstrong
2025-04-11 12:47 ` [PATCH v2 5/8] mach-snapdragon: of_fixup: update comment Caleb Connolly
2025-04-11 14:12   ` Neil Armstrong
2025-04-11 12:47 ` [PATCH v2 6/8] mach-snapdragon: of_fixup: set dr_mode for RB1/2 boards Caleb Connolly
2025-04-11 12:47 ` [PATCH v2 7/8] clk/qcom: qcm2290: show clock name in set_rate() Caleb Connolly
2025-04-11 12:47 ` [PATCH v2 8/8] pinctrl: qcom: qcm2290: fix off by 1 in pin_count Caleb Connolly
2025-05-02  6:02   ` Sumit Garg
2025-05-02 16:26 ` [PATCH v2 0/8] Qualcomm: cleanup OF_LIVE fixup and fix RB1/2 Tom Rini
2025-05-03  2:09   ` Simon Glass
2025-05-03 16:58     ` Tom Rini
2025-05-06 13:24       ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox