Skip to content

Commit 8a985bc

Browse files
nxpfranklijannau
authored andcommitted
usb: dwc3: Add software-managed properties for flattened model
Add software-managed properties for the flattened model, which does not need to use device tree properties to pass down information to the common DWC3 core. Add 'properties' in dwc3_probe_data and set default values for existing users (dwc3-qcom, dwc3-generic-plat). No functional changes. Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250929-ls_dma_coherence-v5-2-2ebee578eb7e@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7d25645 commit 8a985bc

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

drivers/usb/dwc3/core.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,14 +1667,21 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
16671667
dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true);
16681668
}
16691669

1670-
static void dwc3_get_software_properties(struct dwc3 *dwc)
1670+
static void dwc3_get_software_properties(struct dwc3 *dwc,
1671+
const struct dwc3_properties *properties)
16711672
{
16721673
struct device *tmpdev;
16731674
u16 gsbuscfg0_reqinfo;
16741675
int ret;
16751676

16761677
dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
16771678

1679+
if (properties->gsbuscfg0_reqinfo !=
1680+
DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED) {
1681+
dwc->gsbuscfg0_reqinfo = properties->gsbuscfg0_reqinfo;
1682+
return;
1683+
}
1684+
16781685
/*
16791686
* Iterate over all parent nodes for finding swnode properties
16801687
* and non-DT (non-ABI) properties.
@@ -2207,7 +2214,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
22072214

22082215
dwc3_get_properties(dwc);
22092216

2210-
dwc3_get_software_properties(dwc);
2217+
dwc3_get_software_properties(dwc, &data->properties);
22112218

22122219
dwc->usb_psy = dwc3_get_usb_power_supply(dwc);
22132220
if (IS_ERR(dwc->usb_psy))
@@ -2357,6 +2364,7 @@ static int dwc3_probe(struct platform_device *pdev)
23572364

23582365
probe_data.dwc = dwc;
23592366
probe_data.res = res;
2367+
probe_data.properties = DWC3_DEFAULT_PROPERTIES;
23602368

23612369
return dwc3_core_probe(&probe_data);
23622370
}

drivers/usb/dwc3/dwc3-generic-plat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static int dwc3_generic_probe(struct platform_device *pdev)
7575
probe_data.dwc = &dwc3g->dwc;
7676
probe_data.res = res;
7777
probe_data.ignore_clocks_and_resets = true;
78+
probe_data.properties = DWC3_DEFAULT_PROPERTIES;
7879
ret = dwc3_core_probe(&probe_data);
7980
if (ret)
8081
return dev_err_probe(dev, ret, "failed to register DWC3 Core\n");

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
704704
probe_data.dwc = &qcom->dwc;
705705
probe_data.res = &res;
706706
probe_data.ignore_clocks_and_resets = true;
707+
probe_data.properties = DWC3_DEFAULT_PROPERTIES;
707708
ret = dwc3_core_probe(&probe_data);
708709
if (ret) {
709710
ret = dev_err_probe(dev, ret, "failed to register DWC3 Core\n");

drivers/usb/dwc3/glue.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,31 @@
99
#include <linux/types.h>
1010
#include "core.h"
1111

12+
/**
13+
* dwc3_properties: DWC3 core properties
14+
* @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
15+
*/
16+
struct dwc3_properties {
17+
u32 gsbuscfg0_reqinfo;
18+
};
19+
20+
#define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){ \
21+
.gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED, \
22+
})
23+
1224
/**
1325
* dwc3_probe_data: Initialization parameters passed to dwc3_core_probe()
1426
* @dwc: Reference to dwc3 context structure
1527
* @res: resource for the DWC3 core mmio region
1628
* @ignore_clocks_and_resets: clocks and resets defined for the device should
1729
* be ignored by the DWC3 core, as they are managed by the glue
30+
* @properties: dwc3 software manage properties
1831
*/
1932
struct dwc3_probe_data {
2033
struct dwc3 *dwc;
2134
struct resource *res;
2235
bool ignore_clocks_and_resets;
36+
struct dwc3_properties properties;
2337
};
2438

2539
int dwc3_core_probe(const struct dwc3_probe_data *data);

0 commit comments

Comments
 (0)