Re: [PATCH v2 1/2] usb: cdns3: Add quirk flag to enable suspend residency

From: Ravi Gunasekaran
Date: Thu May 16 2024 - 00:35:20 EST




On 5/16/24 9:58 AM, Ravi Gunasekaran wrote:
> From: Roger Quadros <rogerq@xxxxxxxxxx>
>
> 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: Roger Quadros <rogerq@xxxxxxxxxx>
> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@xxxxxx>
> ---
> Change log:
> ----------
>
> Changes since v1:
> ----------------
> * Grouped the susp_ctrl register update along with
> existing CDNS3 snippet as suggested by Peter Chen
>
> v1: https://lore.kernel.org/all/20240514092421.20897-1-r-gunasekaran@xxxxxx/#t

[...]

> - u32 state;
> + u32 state, reg;
> int ret;
>
> regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res);
> @@ -433,12 +433,21 @@ int cdns_drd_init(struct cdns *cdns)
> cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
> &cdns->otg_v1_regs->ien;
> 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;
> } else {
> dev_err(cdns->dev, "not supported DID=0x%08x\n", state);
> return -EINVAL;
> }
>
> +

Please ignore this patch. I didn't notice this.
I will send a v3 fixing it.


> dev_dbg(cdns->dev, "DRD version v1 (ID: %08x, rev: %08x)\n",
> readl(&cdns->otg_v1_regs->did),
> readl(&cdns->otg_v1_regs->rid));
> diff --git a/drivers/usb/cdns3/drd.h b/drivers/usb/cdns3/drd.h
> index d72370c321d3..1e2aee14d629 100644
> --- a/drivers/usb/cdns3/drd.h
> +++ b/drivers/usb/cdns3/drd.h
> @@ -193,6 +193,9 @@ struct cdns_otg_irq_regs {
> /* OTGREFCLK - bitmasks */
> #define OTGREFCLK_STB_CLK_SWITCH_EN BIT(31)
>
> +/* SUPS_CTRL - bitmasks */
> +#define SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE BIT(17)
> +
> /* OVERRIDE - bitmasks */
> #define OVERRIDE_IDPULLUP BIT(0)
> /* Only for CDNS3_CONTROLLER_V0 version */

--
Regards,
Ravi