Linux USB
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties
@ 2026-11-24 22:59 Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 1/3] usb: dwc3: Group glue-overridable properties in struct dwc3 Thinh Nguyen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thinh Nguyen @ 2026-11-24 22:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, Frank Li, Sven Peter,
	Janne Grunau, Peter Griffin, Sascha Hauer
  Cc: Tejas Narendra Joglekar, linux-usb@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	Tudor Ambarus, linux-arm-kernel@lists.infradead.org,
	André Draszik, Pengutronix Kernel Team, Neal Gompa,
	asahi@lists.linux.dev, imx@lists.linux.dev, Fabio Estevam

struct dwc3_properties duplicates fields of struct dwc3, and glue
drivers can only set two of them. Define it from struct dwc3 with
struct_group_tagged() and replace the properties value in struct
dwc3_probe_data with a fixup_properties() hook. The hook runs after the
DT properties are read, so glue drivers can set properties that DT does
not provide, or override DT values.

I used AI tools to help review the code and polish the commit messages.


Thinh Nguyen (3):
  usb: dwc3: Group glue-overridable properties in struct dwc3
  usb: dwc3: Move sysdev selection and clamp out of dwc3_get_properties()
  usb: dwc3: Allow glue drivers to override all dwc3_properties

 drivers/usb/dwc3/core.c              |  37 +++---
 drivers/usb/dwc3/core.h              | 163 ++++++++++++++-------------
 drivers/usb/dwc3/dwc3-apple.c        |   1 -
 drivers/usb/dwc3/dwc3-generic-plat.c |  19 ++--
 drivers/usb/dwc3/dwc3-google.c       |   1 -
 drivers/usb/dwc3/dwc3-imx.c          |   9 +-
 drivers/usb/dwc3/dwc3-qcom.c         |   1 -
 drivers/usb/dwc3/glue.h              |  21 +---
 8 files changed, 120 insertions(+), 132 deletions(-)


base-commit: 90d6263e867be7089b3d3323bef8d2accd327c77
-- 
2.53.0

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

* [PATCH 1/3] usb: dwc3: Group glue-overridable properties in struct dwc3
  2026-11-24 22:59 [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties Thinh Nguyen
@ 2026-11-24 22:59 ` Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 2/3] usb: dwc3: Move sysdev selection and clamp out of dwc3_get_properties() Thinh Nguyen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thinh Nguyen @ 2026-11-24 22:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen
  Cc: Tejas Narendra Joglekar, linux-usb@vger.kernel.org

struct dwc3_properties duplicates fields of struct dwc3, so every
property a glue driver can set is defined twice.

Define struct dwc3_properties from the matching fields of struct dwc3
with struct_group_tagged(), and move the remaining property fields into
the group. Users of dwc->X and probe_data.properties.X are unchanged.

No functional change.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/usb/dwc3/core.h | 163 ++++++++++++++++++++--------------------
 drivers/usb/dwc3/glue.h |  11 ---
 2 files changed, 83 insertions(+), 91 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index f635a9fbc151..d103a637a4f7 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1040,23 +1040,18 @@ struct dwc3_glue_ops {
  * @reset: reset control
  * @regs: base address for our registers
  * @regs_size: address space size
- * @fladj: frame length adjustment
- * @ref_clk_per: reference clock period configuration
  * @irq_gadget: peripheral controller's IRQ number
  * @otg_irq: IRQ number for OTG IRQs
  * @current_otg_role: current role of operation while using the OTG block
  * @desired_otg_role: desired role of operation while using the OTG block
  * @otg_restart_host: flag that OTG controller needs to restart host
  * @u1u2: only used on revisions <1.83a for workaround
- * @maximum_speed: maximum speed requested (mainly for testing purposes)
- * @max_ssp_rate: SuperSpeed Plus maximum signaling rate and lane count
  * @gadget_max_speed: maximum gadget speed requested
  * @gadget_ssp_rate: Gadget driver's maximum supported SuperSpeed Plus signaling
  *			rate and lane count.
  * @ip: controller's ID
  * @revision: controller's version of an IP
  * @version_type: VERSIONTYPE register contents, a sub release of a revision
- * @dr_mode: requested mode of operation
  * @current_dr_role: current role of operation when in dual-role mode
  * @desired_dr_role: desired role of operation when in dual-role mode
  * @edev: extcon handle
@@ -1098,6 +1093,25 @@ struct dwc3_glue_ops {
  * @dbg_lsp_select: current debug lsp mux register selection
  * @test_mode: true when we're entering a USB test mode
  * @test_mode_nr: test feature selector
+ * @clear_stall_protocol: endpoint number that requires a delayed status phase
+ * @connected: true when we're connected to a host, false otherwise
+ * @softconnect: true when gadget connect is called, false when disconnect runs
+ * @delayed_status: true when gadget driver asks for delayed status
+ * @ep0_bounced: true when we used bounce buffer
+ * @ep0_expect_in: true when we expect a DATA IN transfer
+ * @is_fpga: true when we are using the FPGA board
+ * @pending_events: true when we have pending IRQs to be handled
+ * @pullups_connected: true when Run/Stop bit is set
+ * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
+ * @three_stage_setup: set if we perform a three phase setup
+ * @dr_mode: requested mode of operation
+ * @fladj: frame length adjustment
+ * @ref_clk_per: reference clock period configuration
+ * @maximum_speed: maximum speed requested (mainly for testing purposes)
+ * @max_ssp_rate: SuperSpeed Plus maximum signaling rate and lane count
+ * @gsbuscfg0_reqinfo: store GSBUSCFG0.DATRDREQINFO, DESRDREQINFO,
+ *		       DATWRREQINFO, and DESWRREQINFO value passed from
+ *		       glue driver.
  * @lpm_nyet_threshold: LPM NYET response threshold
  * @hird_threshold: HIRD threshold
  * @rx_thr_num_pkt: USB receive packet count
@@ -1109,26 +1123,15 @@ struct dwc3_glue_ops {
  * @tx_thr_num_pkt_prd: periodic ESS transmit packet count
  * @tx_max_burst_prd: max periodic ESS transmit burst size
  * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize
- * @clear_stall_protocol: endpoint number that requires a delayed status phase
  * @num_hc_interrupters: number of host controller interrupters
  * @hsphy_interface: "utmi" or "ulpi"
- * @connected: true when we're connected to a host, false otherwise
- * @softconnect: true when gadget connect is called, false when disconnect runs
- * @delayed_status: true when gadget driver asks for delayed status
- * @ep0_bounced: true when we used bounce buffer
- * @ep0_expect_in: true when we expect a DATA IN transfer
  * @sysdev_is_parent: true when dwc3 device has a parent driver
  * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that
  *			there's now way for software to detect this in runtime.
  * @is_utmi_l1_suspend: the core asserts output signal
  *	0	- utmi_sleep_n
  *	1	- utmi_l1_suspend_n
- * @is_fpga: true when we are using the FPGA board
- * @pending_events: true when we have pending IRQs to be handled
  * @do_fifo_resize: true when txfifo resizing is enabled for dwc3 endpoints
- * @pullups_connected: true when Run/Stop bit is set
- * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
- * @three_stage_setup: set if we perform a three phase setup
  * @dis_start_transfer_quirk: set if start_transfer failure SW workaround is
  *			not needed for DWC_usb31 version 1.70a-ea06 and below
  * @usb3_lpm_capable: set if hadrware supports Link Power Management
@@ -1151,8 +1154,6 @@ struct dwc3_glue_ops {
  * @dis_u1_entry_quirk: set if link entering into U1 state needs to be disabled.
  * @dis_u2_entry_quirk: set if link entering into U2 state needs to be disabled.
  * @dis_rxdet_inp3_quirk: set if we disable Rx.Detect in P3
- * @async_callbacks: if set, indicate that async callbacks will be used.
- *
  * @dis_u2_freeclk_exists_quirk : set if we clear u2_freeclk_exists
  *			in GUSB2PHYCFG, specify that USB2 PHY doesn't
  *			provide a free-running PHY clock.
@@ -1178,6 +1179,7 @@ struct dwc3_glue_ops {
  *	3	- Reserved
  * @dis_metastability_quirk: set to disable metastability quirk.
  * @dis_split_quirk: set to disable split boundary.
+ * @async_callbacks: if set, indicate that async callbacks will be used.
  * @enable_usb2_transceiver_delay: Set to insert a delay before the
  *			assertion of the TxValid signal during a HS Chirp.
  * @sys_wakeup: set if the device may do system wakeup.
@@ -1193,9 +1195,6 @@ struct dwc3_glue_ops {
  * @num_ep_resized: carries the current number endpoints which have had its tx
  *		    fifo resized.
  * @debug_root: root debugfs directory for this device to put its files in.
- * @gsbuscfg0_reqinfo: store GSBUSCFG0.DATRDREQINFO, DESRDREQINFO,
- *		       DATWRREQINFO, and DESWRREQINFO value passed from
- *		       glue driver.
  * @wakeup_pending_funcs: Indicates whether any interface has requested for
  *			 function wakeup in bitmap format where bit position
  *			 represents interface_id.
@@ -1259,7 +1258,6 @@ struct dwc3 {
 	void __iomem		*regs;
 	size_t			regs_size;
 
-	enum usb_dr_mode	dr_mode;
 	u32			current_dr_role;
 	u32			desired_dr_role;
 	struct extcon_dev	*edev;
@@ -1276,17 +1274,13 @@ struct dwc3 {
 
 #define DWC3_CURRENT_UNSPECIFIED	UINT_MAX
 
-	u32			fladj;
-	u32			ref_clk_per;
 	u32			irq_gadget;
 	u32			otg_irq;
 	u32			current_otg_role;
 	u32			desired_otg_role;
 	bool			otg_restart_host;
 	u32			u1u2;
-	u32			maximum_speed;
 	u32			gadget_max_speed;
-	enum usb_ssp_rate	max_ssp_rate;
 	enum usb_ssp_rate	gadget_ssp_rate;
 
 	u32			ip;
@@ -1369,71 +1363,81 @@ struct dwc3 {
 
 	u8			test_mode;
 	u8			test_mode_nr;
-	u8			lpm_nyet_threshold;
-	u8			hird_threshold;
-	u8			rx_thr_num_pkt;
-	u8			rx_max_burst;
-	u8			tx_thr_num_pkt;
-	u8			tx_max_burst;
-	u8			rx_thr_num_pkt_prd;
-	u8			rx_max_burst_prd;
-	u8			tx_thr_num_pkt_prd;
-	u8			tx_max_burst_prd;
-	u8			tx_fifo_resize_max_num;
 	u8			clear_stall_protocol;
-	u16			num_hc_interrupters;
-
-	const char		*hsphy_interface;
 
 	unsigned		connected:1;
 	unsigned		softconnect:1;
 	unsigned		delayed_status:1;
 	unsigned		ep0_bounced:1;
 	unsigned		ep0_expect_in:1;
-	unsigned		sysdev_is_parent:1;
-	unsigned		has_lpm_erratum:1;
-	unsigned		is_utmi_l1_suspend:1;
 	unsigned		is_fpga:1;
 	unsigned		pending_events:1;
-	unsigned		do_fifo_resize:1;
 	unsigned		pullups_connected:1;
 	unsigned		setup_packet_pending:1;
 	unsigned		three_stage_setup:1;
-	unsigned		dis_start_transfer_quirk:1;
-	unsigned		usb3_lpm_capable:1;
-	unsigned		usb2_lpm_disable:1;
-	unsigned		usb2_gadget_lpm_disable:1;
-	unsigned		needs_full_reinit:1;
-
-	unsigned		disable_scramble_quirk:1;
-	unsigned		u2exit_lfps_quirk:1;
-	unsigned		u2ss_inp3_quirk:1;
-	unsigned		req_p1p2p3_quirk:1;
-	unsigned                del_p1p2p3_quirk:1;
-	unsigned		del_phy_power_chg_quirk:1;
-	unsigned		lfps_filter_quirk:1;
-	unsigned		rx_detect_poll_quirk:1;
-	unsigned		dis_u3_susphy_quirk:1;
-	unsigned		dis_u2_susphy_quirk:1;
-	unsigned		dis_enblslpm_quirk:1;
-	unsigned		dis_u1_entry_quirk:1;
-	unsigned		dis_u2_entry_quirk:1;
-	unsigned		dis_rxdet_inp3_quirk:1;
-	unsigned		dis_u2_freeclk_exists_quirk:1;
-	unsigned		dis_del_phy_power_chg_quirk:1;
-	unsigned		dis_tx_ipgap_linecheck_quirk:1;
-	unsigned		resume_hs_terminations:1;
-	unsigned		ulpi_ext_vbus_drv:1;
-	unsigned		parkmode_disable_ss_quirk:1;
-	unsigned		parkmode_disable_hs_quirk:1;
-	unsigned		gfladj_refclk_lpm_sel:1;
-
-	unsigned		tx_de_emphasis_quirk:1;
-	unsigned		tx_de_emphasis:2;
-
-	unsigned		dis_metastability_quirk:1;
-
-	unsigned		dis_split_quirk:1;
+
+	struct_group_tagged(dwc3_properties, properties,
+		enum usb_dr_mode	dr_mode;
+		u32			fladj;
+		u32			ref_clk_per;
+		u32			maximum_speed;
+		enum usb_ssp_rate	max_ssp_rate;
+		u32			gsbuscfg0_reqinfo;
+		u8			lpm_nyet_threshold;
+		u8			hird_threshold;
+		u8			rx_thr_num_pkt;
+		u8			rx_max_burst;
+		u8			tx_thr_num_pkt;
+		u8			tx_max_burst;
+		u8			rx_thr_num_pkt_prd;
+		u8			rx_max_burst_prd;
+		u8			tx_thr_num_pkt_prd;
+		u8			tx_max_burst_prd;
+		u8			tx_fifo_resize_max_num;
+		u16			num_hc_interrupters;
+
+		const char		*hsphy_interface;
+
+		unsigned		sysdev_is_parent:1;
+		unsigned		has_lpm_erratum:1;
+		unsigned		is_utmi_l1_suspend:1;
+		unsigned		do_fifo_resize:1;
+		unsigned		dis_start_transfer_quirk:1;
+		unsigned		usb3_lpm_capable:1;
+		unsigned		usb2_lpm_disable:1;
+		unsigned		usb2_gadget_lpm_disable:1;
+		unsigned		needs_full_reinit:1;
+
+		unsigned		disable_scramble_quirk:1;
+		unsigned		u2exit_lfps_quirk:1;
+		unsigned		u2ss_inp3_quirk:1;
+		unsigned		req_p1p2p3_quirk:1;
+		unsigned                del_p1p2p3_quirk:1;
+		unsigned		del_phy_power_chg_quirk:1;
+		unsigned		lfps_filter_quirk:1;
+		unsigned		rx_detect_poll_quirk:1;
+		unsigned		dis_u3_susphy_quirk:1;
+		unsigned		dis_u2_susphy_quirk:1;
+		unsigned		dis_enblslpm_quirk:1;
+		unsigned		dis_u1_entry_quirk:1;
+		unsigned		dis_u2_entry_quirk:1;
+		unsigned		dis_rxdet_inp3_quirk:1;
+		unsigned		dis_u2_freeclk_exists_quirk:1;
+		unsigned		dis_del_phy_power_chg_quirk:1;
+		unsigned		dis_tx_ipgap_linecheck_quirk:1;
+		unsigned		resume_hs_terminations:1;
+		unsigned		ulpi_ext_vbus_drv:1;
+		unsigned		parkmode_disable_ss_quirk:1;
+		unsigned		parkmode_disable_hs_quirk:1;
+		unsigned		gfladj_refclk_lpm_sel:1;
+
+		unsigned		tx_de_emphasis_quirk:1;
+		unsigned		tx_de_emphasis:2;
+
+		unsigned		dis_metastability_quirk:1;
+
+		unsigned		dis_split_quirk:1;
+	);
 	unsigned		enable_usb2_transceiver_delay:1;
 	unsigned		async_callbacks:1;
 	unsigned		sys_wakeup:1;
@@ -1447,7 +1451,6 @@ struct dwc3 {
 	int			last_fifo_depth;
 	int			num_ep_resized;
 	struct dentry		*debug_root;
-	u32			gsbuscfg0_reqinfo;
 	u32			wakeup_pending_funcs;
 };
 
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index a1284c481390..b7ce196e84ea 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -9,17 +9,6 @@
 #include <linux/types.h>
 #include "core.h"
 
-/**
- * dwc3_properties: DWC3 core properties
- * @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
- * @needs_full_reinit: indicate the controller may not remain power during system
- *			pm and need full initialization
- */
-struct dwc3_properties {
-	u32 gsbuscfg0_reqinfo;
-	unsigned needs_full_reinit:1;
-};
-
 #define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){		\
 	.gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED,	\
 	})
-- 
2.53.0

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

* [PATCH 2/3] usb: dwc3: Move sysdev selection and clamp out of dwc3_get_properties()
  2026-11-24 22:59 [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 1/3] usb: dwc3: Group glue-overridable properties in struct dwc3 Thinh Nguyen
@ 2026-11-24 22:59 ` Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
  2026-11-24 23:04 ` [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties sashiko-bot
  3 siblings, 0 replies; 5+ messages in thread
From: Thinh Nguyen @ 2026-11-24 22:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen
  Cc: Tejas Narendra Joglekar, linux-usb@vger.kernel.org

Select the sysdev and clamp num_hc_interrupters after all properties
are read, so they can follow values overridden by glue drivers in a
following change. Move the clamp to dwc3_check_params().

No functional change.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/usb/dwc3/core.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 372737f4750b..3b2b5fcc627a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1761,12 +1761,6 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 
 	dwc->sysdev_is_parent = device_property_read_bool(dev,
 				"linux,sysdev_is_parent");
-	if (dwc->sysdev_is_parent)
-		dwc->sysdev = dwc->dev->parent;
-	else
-		dwc->sysdev = dwc->dev;
-
-	dwc->sys_wakeup = device_may_wakeup(dwc->sysdev);
 
 	dwc->has_lpm_erratum = device_property_read_bool(dev,
 				"snps,has-lpm-erratum");
@@ -1802,9 +1796,6 @@ static void dwc3_get_properties(struct dwc3 *dwc)
 				&tx_max_burst_prd);
 	device_property_read_u16(dev, "num-hc-interrupters",
 				 &num_hc_interrupters);
-	/* DWC3 core allowed to have a max of 8 interrupters */
-	if (num_hc_interrupters > 8)
-		num_hc_interrupters = 8;
 
 	dwc->do_fifo_resize = device_property_read_bool(dev,
 							"tx-fifo-resize");
@@ -2001,6 +1992,10 @@ static void dwc3_check_params(struct dwc3 *dwc)
 			break;
 		}
 	}
+
+	/* DWC3 core allowed to have a max of 8 interrupters */
+	if (dwc->num_hc_interrupters > 8)
+		dwc->num_hc_interrupters = 8;
 }
 
 static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
@@ -2315,9 +2310,15 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dwc->regs_size	= resource_size(&dwc_res);
 
 	dwc3_get_properties(dwc);
-
 	dwc3_get_software_properties(dwc, &data->properties);
 
+	if (dwc->sysdev_is_parent)
+		dwc->sysdev = dwc->dev->parent;
+	else
+		dwc->sysdev = dwc->dev;
+
+	dwc->sys_wakeup = device_may_wakeup(dwc->sysdev);
+
 	spin_lock_init(&dwc->lock);
 
 	dwc3_get_usb_power_supply(dwc);
-- 
2.53.0

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

* [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
  2026-11-24 22:59 [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 1/3] usb: dwc3: Group glue-overridable properties in struct dwc3 Thinh Nguyen
  2026-11-24 22:59 ` [PATCH 2/3] usb: dwc3: Move sysdev selection and clamp out of dwc3_get_properties() Thinh Nguyen
@ 2026-11-24 22:59 ` Thinh Nguyen
  2026-11-24 23:04 ` [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties sashiko-bot
  3 siblings, 0 replies; 5+ messages in thread
From: Thinh Nguyen @ 2026-11-24 22:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, Frank Li, Sven Peter,
	Janne Grunau, Peter Griffin, Sascha Hauer
  Cc: Tejas Narendra Joglekar, linux-usb@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	Tudor Ambarus, linux-arm-kernel@lists.infradead.org,
	André Draszik, Pengutronix Kernel Team, Neal Gompa,
	asahi@lists.linux.dev, imx@lists.linux.dev, Fabio Estevam

struct dwc3_properties holds all glue-overridable properties, but glue
drivers can only set needs_full_reinit and gsbuscfg0_reqinfo.

Replace the properties value in struct dwc3_probe_data with a
fixup_properties() hook. The core calls it after reading the DT
properties, so glue drivers can set properties that DT does not
provide, or override DT values, including clearing them, to correct
broken SoC settings. Convert imx and ls1028a to the hook.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/usb/dwc3/core.c              | 18 +++++-------------
 drivers/usb/dwc3/dwc3-apple.c        |  1 -
 drivers/usb/dwc3/dwc3-generic-plat.c | 19 +++++++++++--------
 drivers/usb/dwc3/dwc3-google.c       |  1 -
 drivers/usb/dwc3/dwc3-imx.c          |  9 +++++++--
 drivers/usb/dwc3/dwc3-qcom.c         |  1 -
 drivers/usb/dwc3/glue.h              | 10 ++++------
 7 files changed, 27 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 3b2b5fcc627a..369c9ce9f1dc 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1684,24 +1684,14 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 	dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true);
 }
 
-static void dwc3_get_software_properties(struct dwc3 *dwc,
-					 const struct dwc3_properties *properties)
+static void dwc3_get_software_properties(struct dwc3 *dwc)
 {
 	struct device *tmpdev;
 	u16 gsbuscfg0_reqinfo;
 	int ret;
 
-	if (properties->needs_full_reinit)
-		dwc->needs_full_reinit = true;
-
 	dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
 
-	if (properties->gsbuscfg0_reqinfo !=
-	    DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED) {
-		dwc->gsbuscfg0_reqinfo = properties->gsbuscfg0_reqinfo;
-		return;
-	}
-
 	/*
 	 * Iterate over all parent nodes for finding swnode properties
 	 * and non-DT (non-ABI) properties.
@@ -2310,7 +2300,10 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
 	dwc->regs_size	= resource_size(&dwc_res);
 
 	dwc3_get_properties(dwc);
-	dwc3_get_software_properties(dwc, &data->properties);
+	dwc3_get_software_properties(dwc);
+
+	if (data->fixup_properties)
+		data->fixup_properties(dwc, &dwc->properties);
 
 	if (dwc->sysdev_is_parent)
 		dwc->sysdev = dwc->dev->parent;
@@ -2470,7 +2463,6 @@ static int dwc3_probe(struct platform_device *pdev)
 
 	probe_data.dwc = dwc;
 	probe_data.res = res;
-	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
 
 	return dwc3_core_probe(&probe_data);
 }
diff --git a/drivers/usb/dwc3/dwc3-apple.c b/drivers/usb/dwc3/dwc3-apple.c
index 1f474a8bc59e..8289d22e5994 100644
--- a/drivers/usb/dwc3/dwc3-apple.c
+++ b/drivers/usb/dwc3/dwc3-apple.c
@@ -181,7 +181,6 @@ static int dwc3_apple_core_probe(struct dwc3_apple *appledwc)
 	probe_data.res = appledwc->mmio_resource;
 	probe_data.ignore_clocks_and_resets = true;
 	probe_data.skip_core_init_mode = true;
-	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
 
 	ret = dwc3_core_probe(&probe_data);
 	if (ret)
diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index 3e90ddf25809..69a6acd84a0f 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -33,7 +33,8 @@ struct dwc3_generic {
 
 struct dwc3_generic_config {
 	int (*init)(struct dwc3_generic *dwc3g);
-	struct dwc3_properties properties;
+	void (*fixup_properties)(struct dwc3 *dwc,
+				 struct dwc3_properties *props);
 };
 
 #define to_dwc3_generic(d) container_of((d), struct dwc3_generic, dwc)
@@ -137,12 +138,10 @@ static int dwc3_generic_probe(struct platform_device *pdev)
 	probe_data.ignore_clocks_and_resets = true;
 
 	plat_config = of_device_get_match_data(dev);
-	if (!plat_config) {
-		probe_data.properties = DWC3_DEFAULT_PROPERTIES;
+	if (!plat_config)
 		goto core_probe;
-	}
 
-	probe_data.properties = plat_config->properties;
+	probe_data.fixup_properties = plat_config->fixup_properties;
 	if (plat_config->init) {
 		ret = plat_config->init(dwc3g);
 		if (ret)
@@ -220,16 +219,20 @@ static const struct dev_pm_ops dwc3_generic_dev_pm_ops = {
 
 static const struct dwc3_generic_config spacemit_k1_dwc3 = {
 	.init = dwc3_spacemit_k1_init,
-	.properties = DWC3_DEFAULT_PROPERTIES,
 };
 
+static void dwc3_ls1028a_fixup_properties(struct dwc3 *dwc,
+					  struct dwc3_properties *props)
+{
+	props->gsbuscfg0_reqinfo = 0x2222;
+}
+
 static const struct dwc3_generic_config fsl_ls1028_dwc3 = {
-	.properties.gsbuscfg0_reqinfo = 0x2222,
+	.fixup_properties = dwc3_ls1028a_fixup_properties,
 };
 
 static const struct dwc3_generic_config eic7700_dwc3 =  {
 	.init = dwc3_eic7700_init,
-	.properties = DWC3_DEFAULT_PROPERTIES,
 };
 
 static const struct of_device_id dwc3_generic_of_match[] = {
diff --git a/drivers/usb/dwc3/dwc3-google.c b/drivers/usb/dwc3/dwc3-google.c
index 67eda7f0d528..213c03048aa0 100644
--- a/drivers/usb/dwc3/dwc3-google.c
+++ b/drivers/usb/dwc3/dwc3-google.c
@@ -440,7 +440,6 @@ static int dwc3_google_probe(struct platform_device *pdev)
 	probe_data.dwc = &google->dwc;
 	probe_data.res = res;
 	probe_data.ignore_clocks_and_resets = true;
-	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
 	ret = dwc3_core_probe(&probe_data);
 	if (ret)  {
 		ret = dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
diff --git a/drivers/usb/dwc3/dwc3-imx.c b/drivers/usb/dwc3/dwc3-imx.c
index 64da121a8f76..396d76311120 100644
--- a/drivers/usb/dwc3/dwc3-imx.c
+++ b/drivers/usb/dwc3/dwc3-imx.c
@@ -192,6 +192,12 @@ static const struct software_node dwc3_imx_swnode = {
 	.properties = dwc3_imx_properties,
 };
 
+static void dwc3_imx_fixup_properties(struct dwc3 *dwc,
+				      struct dwc3_properties *props)
+{
+	props->needs_full_reinit = true;
+}
+
 static int dwc3_imx_probe(struct platform_device *pdev)
 {
 	struct device		*dev = &pdev->dev;
@@ -265,8 +271,7 @@ static int dwc3_imx_probe(struct platform_device *pdev)
 
 	probe_data.res = res;
 	probe_data.dwc = dwc;
-	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
-	probe_data.properties.needs_full_reinit = true;
+	probe_data.fixup_properties = dwc3_imx_fixup_properties;
 
 	ret = dwc3_core_probe(&probe_data);
 	if (ret) {
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 5a68025ccea5..ef38308023aa 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -745,7 +745,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 	probe_data.dwc = &qcom->dwc;
 	probe_data.res = &res;
 	probe_data.ignore_clocks_and_resets = true;
-	probe_data.properties = DWC3_DEFAULT_PROPERTIES;
 	ret = dwc3_core_probe(&probe_data);
 	if (ret)  {
 		ret = dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index b7ce196e84ea..e56fee68e4bc 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -9,10 +9,6 @@
 #include <linux/types.h>
 #include "core.h"
 
-#define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){		\
-	.gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED,	\
-	})
-
 /**
  * dwc3_probe_data: Initialization parameters passed to dwc3_core_probe()
  * @dwc: Reference to dwc3 context structure
@@ -21,14 +17,16 @@
  *		be ignored by the DWC3 core, as they are managed by the glue
  * @skip_core_init_mode: Skip the final initialization of the target mode, as
  *		it must be managed by the glue
- * @properties: dwc3 software manage properties
+ * @fixup_properties: optional hook to set or override properties after
+ *		the core reads them from DT
  */
 struct dwc3_probe_data {
 	struct dwc3 *dwc;
 	struct resource *res;
 	bool ignore_clocks_and_resets;
 	bool skip_core_init_mode;
-	struct dwc3_properties properties;
+	void (*fixup_properties)(struct dwc3 *dwc,
+				 struct dwc3_properties *props);
 };
 
 /**
-- 
2.53.0

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

* Re: [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties
  2026-11-24 22:59 [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties Thinh Nguyen
                   ` (2 preceding siblings ...)
  2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
@ 2026-11-24 23:04 ` sashiko-bot
  3 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-24 23:04 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: linux-usb@vger.kernel.org

Sashiko has reviewed this 3-patch series and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795559405.git.Thinh.Nguyen@synopsys.com

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

end of thread, other threads:[~2026-11-24 23:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 22:59 [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties Thinh Nguyen
2026-11-24 22:59 ` [PATCH 1/3] usb: dwc3: Group glue-overridable properties in struct dwc3 Thinh Nguyen
2026-11-24 22:59 ` [PATCH 2/3] usb: dwc3: Move sysdev selection and clamp out of dwc3_get_properties() Thinh Nguyen
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
2026-11-24 23:04 ` [PATCH 0/3] usb: dwc3: Let glue drivers override all dwc3 properties sashiko-bot

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