Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp58753lqo; Wed, 15 May 2024 21:29:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxwb4u0RCUcGm6GY85FHQJveSn/4H+PJz21f7VXOrgdm+FVkqbtN5V/mn88UK4q2OFQzCgjuMNwaleP6NjOTiJ1m7kom+OdnCH3mjDog== X-Google-Smtp-Source: AGHT+IHW7QrEoZ+xsUDSBLRSy6orx6zXmMv8Hx+UNfdWCdGqGRWk+dYc/frqwURwf6SMSthNDrWu X-Received: by 2002:a05:6512:54c:b0:51b:6934:1cb1 with SMTP id 2adb3069b0e04-5220fc7acd1mr10327219e87.17.1715833762386; Wed, 15 May 2024 21:29:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715833762; cv=pass; d=google.com; s=arc-20160816; b=beYdF6tsdLUNWX5y9GArssAaMrMfK5nU6nA6/cgcuWWrYRU7fSn3UMfB1OagYNGwC8 Iq9f+RJsN7ZJj9Plp5yXQyUE3davoAXQk+7rUx6XfN0rp5orl37YjyNU+eozdpv3APGz uUE6jlDNQnduPTBJGPOpXBpmQy2kGPZCc7obnioHojMC1eODSnmjLBB+2bsNRcVgvfSA ESF1SdFv2eeai6CgC0hkG/Y2vnrCUcI/VhpizAyShrGxqevSQuFPq2TI46aS2GjnnXkV nrMF86+9ct4erkfb4aTplx0WzxfXNgSUFdR+qapu1OZUmyRS6N/L4+qDobRcWvsRBxOi e5PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t5C7ocrLQ7PoqANuZtQ9oIPBKm4p3kvXbNpJapuGRs0=; fh=YM/7pYV2Tbs+FO3slQ9fvkEEW8YN0KJupCtwBtPPN3M=; b=rf8iFjzo/0Lj2yR5AzLGAVpRlBkhrfdhcbBsw250pvgDdeJc4OMGS3+s2bybvZmOf7 cjPg7hQ4cfG8aeK4VZFgnQLPVrF9Gb4Qe5bD51DCVoButr9bBO84k3EgGkO3sE0lS9E/ y0Fs8MQlaAUYYHXdZt8S/+NWLOw/2+Zmrat8zTj9xsuhabwTot2XbTLA43NMtGBnpeyB 5voUwaCdYELug+EaNolXyfqEPLxsd0sOJ8/BFWh9cKFteJnUb32Icql8cnUNEhH0G2GW 2hmLxL5yMKY42S5BmysYYbS+Aze0/OwUs8ilk1rud24FkmiZZteB1Gt5onTorqFGEzBs xWrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fHr+lHDT; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-180623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1797be18si816870066b.217.2024.05.15.21.29.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 21:29:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fHr+lHDT; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-180623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E9BC11F24011 for ; Thu, 16 May 2024 04:29:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A33903C473; Thu, 16 May 2024 04:29:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="fHr+lHDT" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3041D21101; Thu, 16 May 2024 04:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715833740; cv=none; b=YQ6x4AHGVtkdmrFFRZEd6/2oIm7Zzwz++S2w61488VITmClVc6BVWh/wprW60/LtYtyjn9u81finMe0x5xNs21MfhC36DdVqaQcZ55YEv1K3yyajljEgHzeQNrp+yZzQEnOJHdhhSNI5Nrhoq7mLYdFka2q1RBu5yKmGt2txH3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715833740; c=relaxed/simple; bh=piewEItXtIVUP0WlL5syxmsPqUZJkgueBDo4HTJEflo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BzPzGBnYvQOr06vHasgQ2JC1zlsa57vIK/uC8COagL1YTrF9WgJ/Mn3g1vfYAfmEjEnOOe4TvKJBF6UbS6Qp6VWHoxNsrawD/i1AlUveFgxzK4akgL/pFNsR8LKLdOdz/GcXMu7F6tv7JbfxybaTRoBHzdwIzNbddzV7hnk6Rb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=fHr+lHDT; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44G4Sq3I055411; Wed, 15 May 2024 23:28:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1715833732; bh=t5C7ocrLQ7PoqANuZtQ9oIPBKm4p3kvXbNpJapuGRs0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fHr+lHDTegJhvxYdStbhTDGzO7GwI1oAbZM91XVqSPsDuvcOJt5gvSnnmo5SL/h6g JJsUHvr0QURsOQB+lrbZmi4sFdqeVjKNN1VRAVvbxseKUkMVNpekcjFn9/eCzQOPm6 NBxwQhLOP04soPAPnhW3e4z0hqpQIRn31nmZGv8c= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44G4SqhG043689 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 May 2024 23:28:52 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 15 May 2024 23:28:51 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 15 May 2024 23:28:51 -0500 Received: from uda0500640.dal.design.ti.com (uda0500640.dhcp.ti.com [172.24.227.88]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44G4Skhj089022; Wed, 15 May 2024 23:28:49 -0500 From: Ravi Gunasekaran To: , , CC: , , , , Subject: [PATCH v2 1/2] usb: cdns3: Add quirk flag to enable suspend residency Date: Thu, 16 May 2024 09:58:44 +0530 Message-ID: <20240516042845.31211-2-r-gunasekaran@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240516042845.31211-1-r-gunasekaran@ti.com> References: <20240516042845.31211-1-r-gunasekaran@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 From: Roger Quadros 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 Signed-off-by: Ravi Gunasekaran --- 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@ti.com/#t drivers/usb/cdns3/core.h | 1 + drivers/usb/cdns3/drd.c | 11 ++++++++++- drivers/usb/cdns3/drd.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 81a9c9d6be08..57d47348dc19 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -44,6 +44,7 @@ struct cdns3_platform_data { bool suspend, bool wakeup); unsigned long quirks; #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) +#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1) }; /** diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index 8b936a2e93a0..4902849d28d6 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -389,7 +389,7 @@ static irqreturn_t cdns_drd_irq(int irq, void *data) int cdns_drd_init(struct cdns *cdns) { void __iomem *regs; - 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; } + 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 */ -- 2.17.1