* [PATCH v3 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
2024-09-04 15:49 [PATCH v3 0/3] usb: imx8mp: collect some improvement Frank Li
@ 2024-09-04 15:49 ` Frank Li
2024-09-04 15:49 ` [PATCH v3 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
2024-09-04 15:49 ` [PATCH v3 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Frank Li
2 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2024-09-04 15:49 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-usb, linux-kernel, imx, linux-arm-kernel, jun.li, Frank Li
Parse software managed property 'xhci-skip-phy-init-quirk' and
'xhci-skip-phy-init-quirk' to apply related quirk. It allows usb glue layer
driver apply these quirk.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/usb/host/xhci-plat.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 31bdfa52eeb25..ecaa75718e592 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -259,6 +259,12 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
if (device_property_read_bool(tmpdev, "write-64-hi-lo-quirk"))
xhci->quirks |= XHCI_WRITE_64_HI_LO;
+ if (device_property_read_bool(tmpdev, "xhci-missing-cas-quirk"))
+ xhci->quirks |= XHCI_MISSING_CAS;
+
+ if (device_property_read_bool(tmpdev, "xhci-skip-phy-init-quirk"))
+ xhci->quirks |= XHCI_SKIP_PHY_INIT;
+
device_property_read_u32(tmpdev, "imod-interval-ns",
&xhci->imod_interval);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
2024-09-04 15:49 [PATCH v3 0/3] usb: imx8mp: collect some improvement Frank Li
2024-09-04 15:49 ` [PATCH v3 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
@ 2024-09-04 15:49 ` Frank Li
2024-09-04 21:46 ` Thinh Nguyen
2024-09-04 15:49 ` [PATCH v3 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Frank Li
2 siblings, 1 reply; 5+ messages in thread
From: Frank Li @ 2024-09-04 15:49 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-usb, linux-kernel, imx, linux-arm-kernel, jun.li, Frank Li
Add 2 software manage quirk properties (xhci-missing-cas-quirk and
xhci-skip-phy-init-quirk) for xhci host.
dwc3 driver have PHY management to cover both device and host mode, so add
xhci-skip-phy-init-quirk to skip PHY management from HCD core.
Cold Attach Status (CAS) bit can't be set at i.MX8MP after resume from
suspend state. So set xhci-missing-cas-quirk.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v2 to v3
- rework commit message to descript why need set quirk.
Change from v1 to v2
- use {0}
---
drivers/usb/dwc3/dwc3-imx8mp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index 392fa1232788c..bd6953246f42e 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -144,6 +144,17 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
return IRQ_HANDLED;
}
+static int dwc3_imx8mp_set_software_node(struct device *dev)
+{
+ struct property_entry props[3] = { 0 };
+ int prop_idx = 0;
+
+ props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk");
+ props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk");
+
+ return device_create_managed_software_node(dev, props, NULL);
+}
+
static int dwc3_imx8mp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -226,6 +237,13 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
goto disable_rpm;
}
+ err = dwc3_imx8mp_set_software_node(dev);
+ if (err) {
+ err = -ENODEV;
+ dev_err(dev, "failed to create software node\n");
+ goto disable_rpm;
+ }
+
err = of_platform_populate(node, NULL, NULL, dev);
if (err) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
2024-09-04 15:49 ` [PATCH v3 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
@ 2024-09-04 21:46 ` Thinh Nguyen
0 siblings, 0 replies; 5+ messages in thread
From: Thinh Nguyen @ 2024-09-04 21:46 UTC (permalink / raw)
To: Frank Li
Cc: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
jun.li@nxp.com
On Wed, Sep 04, 2024, Frank Li wrote:
> Add 2 software manage quirk properties (xhci-missing-cas-quirk and
> xhci-skip-phy-init-quirk) for xhci host.
>
> dwc3 driver have PHY management to cover both device and host mode, so add
> xhci-skip-phy-init-quirk to skip PHY management from HCD core.
>
> Cold Attach Status (CAS) bit can't be set at i.MX8MP after resume from
> suspend state. So set xhci-missing-cas-quirk.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> Change from v2 to v3
> - rework commit message to descript why need set quirk.
>
> Change from v1 to v2
> - use {0}
> ---
> drivers/usb/dwc3/dwc3-imx8mp.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
> index 392fa1232788c..bd6953246f42e 100644
> --- a/drivers/usb/dwc3/dwc3-imx8mp.c
> +++ b/drivers/usb/dwc3/dwc3-imx8mp.c
> @@ -144,6 +144,17 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
> return IRQ_HANDLED;
> }
>
> +static int dwc3_imx8mp_set_software_node(struct device *dev)
> +{
> + struct property_entry props[3] = { 0 };
> + int prop_idx = 0;
> +
> + props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk");
> + props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk");
> +
> + return device_create_managed_software_node(dev, props, NULL);
> +}
> +
> static int dwc3_imx8mp_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -226,6 +237,13 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
> goto disable_rpm;
> }
>
> + err = dwc3_imx8mp_set_software_node(dev);
> + if (err) {
> + err = -ENODEV;
> + dev_err(dev, "failed to create software node\n");
> + goto disable_rpm;
> + }
> +
> err = of_platform_populate(node, NULL, NULL, dev);
> if (err) {
> dev_err(&pdev->dev, "failed to create dwc3 core\n");
>
> --
> 2.34.1
>
This doesn't look like it's based on top of Greg's usb-testing branch.
But I think it should still apply, please double check.
Regardless,
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
2024-09-04 15:49 [PATCH v3 0/3] usb: imx8mp: collect some improvement Frank Li
2024-09-04 15:49 ` [PATCH v3 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
2024-09-04 15:49 ` [PATCH v3 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
@ 2024-09-04 15:49 ` Frank Li
2 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2024-09-04 15:49 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-usb, linux-kernel, imx, linux-arm-kernel, jun.li, Frank Li,
Xu Yang
From: Li Jun <jun.li@nxp.com>
SS_CON and U3 wakeup need 'ref_clk' on. iMX8MP turn off it while system
sleep, So disable these wakeup source and only enable DP/DM wakeup source
for host mode.
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/usb/dwc3/dwc3-imx8mp.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index bd6953246f42e..02159cd820a10 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -96,7 +96,8 @@ static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx)
writel(value, dwc3_imx->glue_base + USB_CTRL1);
}
-static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx)
+static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx,
+ pm_message_t msg)
{
struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3);
u32 val;
@@ -106,12 +107,14 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx)
val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
- if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci)
- val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN |
- USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN;
- else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE)
+ if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) {
+ val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN;
+ if (PMSG_IS_AUTO(msg))
+ val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN;
+ } else {
val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN |
USB_WAKEUP_VBUS_SRC_SESS_VAL;
+ }
writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
}
@@ -307,7 +310,7 @@ static int dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, pm_message_t msg)
/* Wakeup enable */
if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc3_imx->dev))
- dwc3_imx8mp_wakeup_enable(dwc3_imx);
+ dwc3_imx8mp_wakeup_enable(dwc3_imx, msg);
dwc3_imx->pm_suspended = true;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread