* [PATCH v2 0/3] usb: imx8mp: collect some improvement
@ 2024-08-21 16:19 Frank Li
2024-08-21 16:19 ` [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Frank Li @ 2024-08-21 16:19 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
Apply two quirk for imx8mp dwc3 host controller:
usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
Runtime pm and wakeup:
usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Changes in v2:
- Remove patch dwc3: core: add a core init flag for device mode resume
The problem can't reproduce in latest kernel. pm_runtime_get() in irq
handle return false because run time pm already disabled at
device_suspend_late(). So runtime_resume will not happen before system
resume.
- Link to v1: https://lore.kernel.org/r/20240712-dwc-mp-v1-0-295e5c4e3ec9@nxp.com
---
Frank Li (2):
usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
Li Jun (1):
usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
drivers/usb/dwc3/dwc3-imx8mp.c | 33 +++++++++++++++++++++++++++------
drivers/usb/host/xhci-plat.c | 6 ++++++
2 files changed, 33 insertions(+), 6 deletions(-)
---
base-commit: 82313624b2ae5a943d16475a566b65c873989e9f
change-id: 20240711-dwc-mp-d1564eec57b1
Best regards,
---
Frank Li <Frank.Li@nxp.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
2024-08-21 16:19 [PATCH v2 0/3] usb: imx8mp: collect some improvement Frank Li
@ 2024-08-21 16:19 ` Frank Li
2024-08-21 21:16 ` Fabio Estevam
2024-08-21 16:19 ` [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
2024-08-21 16:19 ` [PATCH v2 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Frank Li
2 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2024-08-21 16:19 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] 7+ messages in thread
* [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
2024-08-21 16:19 [PATCH v2 0/3] usb: imx8mp: collect some improvement Frank Li
2024-08-21 16:19 ` [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
@ 2024-08-21 16:19 ` Frank Li
2024-08-21 21:18 ` Fabio Estevam
2024-08-21 16:19 ` [PATCH v2 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Frank Li
2 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2024-08-21 16:19 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 properites (xhci-missing-cas-quirk and
xhci-skip-phy-init-quirk) for xhci host.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
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] 7+ messages in thread
* [PATCH v2 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
2024-08-21 16:19 [PATCH v2 0/3] usb: imx8mp: collect some improvement Frank Li
2024-08-21 16:19 ` [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
2024-08-21 16:19 ` [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
@ 2024-08-21 16:19 ` Frank Li
2 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2024-08-21 16:19 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] 7+ messages in thread
* Re: [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
2024-08-21 16:19 ` [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
@ 2024-08-21 21:16 ` Fabio Estevam
2024-08-22 1:27 ` Frank Li
0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2024-08-21 21:16 UTC (permalink / raw)
To: Frank Li
Cc: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, linux-usb, linux-kernel,
imx, linux-arm-kernel, jun.li
Hi Frank,
On Wed, Aug 21, 2024 at 1:19 PM Frank Li <Frank.Li@nxp.com> wrote:
>
> 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.
Please explain the reason in the commit log.
What does it fix? Why do we need these quirks? Or what does it improve?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
2024-08-21 16:19 ` [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
@ 2024-08-21 21:18 ` Fabio Estevam
0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2024-08-21 21:18 UTC (permalink / raw)
To: Frank Li
Cc: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, linux-usb, linux-kernel,
imx, linux-arm-kernel, jun.li
On Wed, Aug 21, 2024 at 1:19 PM Frank Li <Frank.Li@nxp.com> wrote:
>
> Add 2 software manage quirk properites (xhci-missing-cas-quirk and
Typo in 'properties'. Please improve the commit log.
Why are you adding these quirks?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
2024-08-21 21:16 ` Fabio Estevam
@ 2024-08-22 1:27 ` Frank Li
0 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2024-08-22 1:27 UTC (permalink / raw)
To: Fabio Estevam
Cc: Mathias Nyman, Greg Kroah-Hartman, Thinh Nguyen, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, linux-usb, linux-kernel,
imx, linux-arm-kernel, jun.li
On Wed, Aug 21, 2024 at 06:16:18PM -0300, Fabio Estevam wrote:
> Hi Frank,
>
> On Wed, Aug 21, 2024 at 1:19 PM Frank Li <Frank.Li@nxp.com> wrote:
> >
> > 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.
>
> Please explain the reason in the commit log.
XHCI_MISSING_CAS and XHCI_SKIP_PHY_INIT is already defined at
drivers/usb/host/xhci.h
This patch just add software manage dt property map to these exist quirk.
>
> What does it fix? Why do we need these quirks? Or what does it improve?
This one just add map dt property to driver existed quirk, not fix anything
in this patch.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-22 1:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 16:19 [PATCH v2 0/3] usb: imx8mp: collect some improvement Frank Li
2024-08-21 16:19 ` [PATCH v2 1/3] usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk Frank Li
2024-08-21 21:16 ` Fabio Estevam
2024-08-22 1:27 ` Frank Li
2024-08-21 16:19 ` [PATCH v2 2/3] usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode Frank Li
2024-08-21 21:18 ` Fabio Estevam
2024-08-21 16:19 ` [PATCH v2 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox