Commit 0aca19e4 authored by Roger Quadros's avatar Roger Quadros Committed by Greg Kroah-Hartman

usb: cdns3: Add quirk flag to enable suspend residency

Some platforms (e.g. ti,j721e-usb, ti,am64-usb) require
this bit to be set to workaround a lockup issue with PHY
short suspend intervals [1]. Add a platform quirk flag
to indicate if Suspend Residency should be enabled.

[1] - https://www.ti.com/lit/er/sprz457h/sprz457h.pdf
i2409 - USB: USB2 PHY locks up due to short suspend
Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
Signed-off-by: default avatarRavi Gunasekaran <r-gunasekaran@ti.com>
Acked-by: default avatarPeter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20240516044537.16801-2-r-gunasekaran@ti.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8b6b386f
...@@ -44,6 +44,7 @@ struct cdns3_platform_data { ...@@ -44,6 +44,7 @@ struct cdns3_platform_data {
bool suspend, bool wakeup); bool suspend, bool wakeup);
unsigned long quirks; unsigned long quirks;
#define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0)
#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1)
}; };
/** /**
......
...@@ -389,7 +389,7 @@ static irqreturn_t cdns_drd_irq(int irq, void *data) ...@@ -389,7 +389,7 @@ static irqreturn_t cdns_drd_irq(int irq, void *data)
int cdns_drd_init(struct cdns *cdns) int cdns_drd_init(struct cdns *cdns)
{ {
void __iomem *regs; void __iomem *regs;
u32 state; u32 state, reg;
int ret; int ret;
regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res); regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res);
...@@ -433,6 +433,14 @@ int cdns_drd_init(struct cdns *cdns) ...@@ -433,6 +433,14 @@ int cdns_drd_init(struct cdns *cdns)
cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
&cdns->otg_v1_regs->ien; &cdns->otg_v1_regs->ien;
writel(1, &cdns->otg_v1_regs->simulate); writel(1, &cdns->otg_v1_regs->simulate);
if (cdns->pdata &&
(cdns->pdata->quirks & CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE)) {
reg = readl(&cdns->otg_v1_regs->susp_ctrl);
reg |= SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE;
writel(reg, &cdns->otg_v1_regs->susp_ctrl);
}
cdns->version = CDNS3_CONTROLLER_V1; cdns->version = CDNS3_CONTROLLER_V1;
} else { } else {
dev_err(cdns->dev, "not supported DID=0x%08x\n", state); dev_err(cdns->dev, "not supported DID=0x%08x\n", state);
......
...@@ -193,6 +193,9 @@ struct cdns_otg_irq_regs { ...@@ -193,6 +193,9 @@ struct cdns_otg_irq_regs {
/* OTGREFCLK - bitmasks */ /* OTGREFCLK - bitmasks */
#define OTGREFCLK_STB_CLK_SWITCH_EN BIT(31) #define OTGREFCLK_STB_CLK_SWITCH_EN BIT(31)
/* SUPS_CTRL - bitmasks */
#define SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE BIT(17)
/* OVERRIDE - bitmasks */ /* OVERRIDE - bitmasks */
#define OVERRIDE_IDPULLUP BIT(0) #define OVERRIDE_IDPULLUP BIT(0)
/* Only for CDNS3_CONTROLLER_V0 version */ /* Only for CDNS3_CONTROLLER_V0 version */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment