* Re: [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
@ 2026-11-25 3:30 ` Xu Yang
2026-11-25 14:54 ` Frank Li
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Xu Yang @ 2026-11-25 3:30 UTC (permalink / raw)
To: Thinh Nguyen
Cc: Greg Kroah-Hartman, Frank Li, Sven Peter, Janne Grunau,
Peter Griffin, Sascha Hauer, 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
On Tue, Nov 24, 2026 at 10:59:31PM +0000, Thinh Nguyen wrote:
> 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.
Tested-by: Xu Yang <xu.yang_2@nxp.com> # dwc3-imx.c
Thanks,
Xu Yang
>
> 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 [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
2026-11-25 3:30 ` Xu Yang
@ 2026-11-25 14:54 ` Frank Li
2026-11-25 15:47 ` Sven Peter
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2026-11-25 14:54 UTC (permalink / raw)
To: Thinh Nguyen
Cc: Greg Kroah-Hartman, Frank Li, Sven Peter, Janne Grunau,
Peter Griffin, Sascha Hauer, 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
On Tue, Nov 24, 2026 at 10:59:31PM +0000, Thinh Nguyen wrote:
> 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>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.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 [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
2026-11-25 3:30 ` Xu Yang
2026-11-25 14:54 ` Frank Li
@ 2026-11-25 15:47 ` Sven Peter
2026-11-25 19:11 ` Krishna Kurapati
2026-11-26 12:49 ` André Draszik
4 siblings, 0 replies; 7+ messages in thread
From: Sven Peter @ 2026-11-25 15:47 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, Frank Li, 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
On 24.11.26 23:59, Thinh Nguyen wrote:
> 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>
> ---
Acked-by: Sven Peter <sven@kernel.org>
Sven
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
` (2 preceding siblings ...)
2026-11-25 15:47 ` Sven Peter
@ 2026-11-25 19:11 ` Krishna Kurapati
2026-11-26 12:49 ` André Draszik
4 siblings, 0 replies; 7+ messages in thread
From: Krishna Kurapati @ 2026-11-25 19:11 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, 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
On 11/25/2026 4:29 AM, Thinh Nguyen wrote:
> 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>
Rebased [1] on top of this series and tested it:
Tested-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
[1]:
https://lore.kernel.org/all/20260914-xhci-skip-phy-init-v1-1-9c46b31a5a39@oss.qualcomm.com/
Regards,
Krishna,
> ---
> 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);
> };
>
> /**
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties
2026-11-24 22:59 ` [PATCH 3/3] usb: dwc3: Allow glue drivers to override all dwc3_properties Thinh Nguyen
` (3 preceding siblings ...)
2026-11-25 19:11 ` Krishna Kurapati
@ 2026-11-26 12:49 ` André Draszik
4 siblings, 0 replies; 7+ messages in thread
From: André Draszik @ 2026-11-26 12:49 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman, 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,
Pengutronix Kernel Team, Neal Gompa, asahi@lists.linux.dev,
imx@lists.linux.dev, Fabio Estevam
On Tue, 2026-11-24 at 22:59 +0000, Thinh Nguyen wrote:
> 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(-)
Reviewed-by: André Draszik <andre.draszik@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread