Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp936465lqh; Sat, 1 Jun 2024 02:32:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHjvFr9iwikK9bOb4LFDjbD6ZH2bMdcitZidCuosKrREsZrHL9VoB5J2uktbEyfVemct8xmU/K9VPLgNTf4I0Z5sdKbBNKtyinZIm6GA== X-Google-Smtp-Source: AGHT+IFnzHJFkTz8fU1sX+qM+Cj8yC3EwnEkcB+qeuPQPNiglre58IcXfsjp6yrMy55uUgLExVN/ X-Received: by 2002:a17:902:bb87:b0:1f6:3429:69d7 with SMTP id d9443c01a7336-1f63709e4ffmr37592865ad.52.1717234371055; Sat, 01 Jun 2024 02:32:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717234371; cv=pass; d=google.com; s=arc-20160816; b=pnXTxUpcgv/cOPJK/hd5a8m26O09DnhASu7+t9NZCm73hCxOwOJe42kfmnHNKAOykX 8YWUpjko1E+vfxbV12neZGMJWtuxZjLbKL+q5H3QXAkP6/M35fAGsFsplOmQTxYbJvM3 tv/Rhk0PR2Lai8unZ7HF5oLi78pnBqsfr/mcqXUFpsvhHT/0bsSiW8Xty2ZciNYmZXyv oT9OmSGr1H53jWz7JsuGH6zZPDXDVueeEAlkMbtS95SGPNZURB8T06ZKjI7ylkTtNyFC ARu5WRw0VDAVqpUCeUEfyidAVfFoz04j4IfKKPRaEKPgcudVgphFqSed1lFq8X2o3M73 R3tA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=WfDan29VxVHZmK0WASWdz2aN4PE4yQZdFHSJZf8M3Io=; fh=c4hJd0cCgfc/pRpk3o+DN/45g/1QiVXmZGQ3oXCcNFo=; b=Q52nFg+mEsVlqDC0upR2K2kJrlH3f5FM5PkVcTG5Md7/PudE0CBK19gGORmDTLpSKk Jo6a+mnHyYnHaq84ehxRKM396RtRk2K+n5ILM7+QaW62h06VI9fKAg2UlKjXq61JbiRN dK9nK81sOZ5mqGH9forvYVxaaleJtZCHgtH9j4y/VR0hSbmWmyBPmvkBO0N6Kk5blWlb orPoxwVER2kxh2xpEotdNurM8rPX0vmFBPeGJg+qrSm8l4AFZmQlenBKhnOe2wshAXX4 Is9oi9jUHKoecTY0ePZMuhtoOhBGKZfd8MN0m9AgBJHZKSR83eCx47ZwujfxLPT9eKT3 1NaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VHOLZ8D/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-197788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323dd9c3si31177875ad.230.2024.06.01.02.32.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 02:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VHOLZ8D/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-197788-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 19589B216EA for ; Sat, 1 Jun 2024 09:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E417114EC45; Sat, 1 Jun 2024 09:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VHOLZ8D/" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C85AD6AAD; Sat, 1 Jun 2024 09:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717234359; cv=none; b=hpaZ/ws3gYK4y8t8H41TI04PrXvhydju5dTPG++UIHbQRcHK+RN+6AsuKP7AC0LHH7C1hBldC2j748TgGCKrv2kfs7MFaBRXz8+FziW2OsHnhf5ixvlCG+ihuLSBFh/KN/1aAogLj9wQTTei7Bed/4DEUolYmeAEknXPid7pj/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717234359; c=relaxed/simple; bh=8qeuq/9NyK9dd0k3Ody3dB9SOCFgZ5HrBOGAyz4hQwo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=e15RouO2EVSVxKGZ2XqhXIok4YKQbcFeCQRGxueUhniUR1u/TExvAsQVAdBRc/5wFFM9C80hW67Nn+r/KvlgdJ03sxJcfQzTzY2Ah75IRX8LvmmoHKFFWpCyJnSuP5C6zHYG1+YBaT8cR2idxcEMePkLDDQsWbZ+PT694NMybR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VHOLZ8D/; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f62fae8c3cso17325205ad.3; Sat, 01 Jun 2024 02:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717234357; x=1717839157; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=WfDan29VxVHZmK0WASWdz2aN4PE4yQZdFHSJZf8M3Io=; b=VHOLZ8D/0MKfMb5/9DzrnPU4zL+fMrFJPRGS0Y6qh4JeOtR2cJMjwtDR2x16H52DuB LgZuzG+IX0/awRRIBFQhoHO5lzI8zpClqokIZBFUcCW9CsTZu/cHJnnrxWaaIjnXoS2B kCK8M/tSVqQ+buIRmE4aydUALXc8Mi/szGmrJnDAqAYgRSfS47WgtuxheWDBYt7Is380 RqplniEn1zRs4TVbP3vEnmcdEFJq9uiyQgO42d71NLuH38z3m7Xtu27Ee9VIJh+E908x rvZSoQEuKQwzZRiG0FFqiWadXD79YfsmCs6LhpnGM6r8FQhY+sCt/Tx22KPg6IdASiTB UVYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717234357; x=1717839157; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WfDan29VxVHZmK0WASWdz2aN4PE4yQZdFHSJZf8M3Io=; b=sMfo8sAEXFtVhj84AfQWvwOpIrxBRQD18wlDsb1zSMtklMtNstNvOFjjtGLNG1STQi 7D2uxDRq45df/zH9RGs1ryBTHM5FIWap/4vHngaWZ7WeGYbP5f3ghFvdqMtvd1kFjA4a 6ZQGFDkE9sQPXbJS5uWPfpoqqEiPHVtIccbsaydyhWEcbR0ue6vE4l8pA/OmsYTll5p5 RyYaelWP8pZyMdTAyM92YrhV3kys++d0ZR7Or9qYmmRFoYLanWPXfwUMhGifQGHg+Trf dee7OEe/rkKrNrQ0/NP0rBaVjYY7Om0l6MkfnKVMxQAPIYxf14Dl3VEsMV5VOtAUnzkP jLwg== X-Forwarded-Encrypted: i=1; AJvYcCUtU2kTDp4c+Sw7TqLvf43Qu2g0ZjmVHg6top6oaoXPCHFxvhK0OSTRnVOMOCAAVUsJdCDHFDgxqqgHh+IXUz/FQfkvUzCaOQuclTkCq+npgIb1x493s+xClBGIgpeESjknEn/uzg7N X-Gm-Message-State: AOJu0Ywqz+ENoMp4T0cGj1FkXEQl92OgLZEoHVXi9jr7h0KK42kis88N uYPdApCrZjD4meKulfLo/HFDYymOc/XtX9Dhe8yL45WJySoG51lt X-Received: by 2002:a17:903:22c3:b0:1f4:bb5c:b7bd with SMTP id d9443c01a7336-1f6370b8aa1mr45185795ad.61.1717234357015; Sat, 01 Jun 2024 02:32:37 -0700 (PDT) Received: from localhost ([219.144.1.218]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323feaa0sm30271675ad.230.2024.06.01.02.32.36 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Jun 2024 02:32:36 -0700 (PDT) From: joswang To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, joswang Subject: [PATCH 2/2] usb: dwc3: core: Workaround for CSR read timeout Date: Sat, 1 Jun 2024 17:32:32 +0800 Message-Id: <20240601093232.52319-1-joswang1221@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240601092646.52139-1-joswang1221@gmail.com> References: <20240601092646.52139-1-joswang1221@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: joswang DWC31 version 2.00a have an issue that would cause a CSR read timeout When CSR read coincides with RAM Clock Gating Entry. This workaround solution disable Clock Gating, sacrificing power consumption for normal operation. Signed-off-by: joswang --- drivers/usb/dwc3/core.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3a8fbc2d6b99..1df85c505c9e 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -978,11 +978,22 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc) * * STAR#9000588375: Clock Gating, SOF Issues when ref_clk-Based * SOF/ITP Mode Used + * + * WORKAROUND: DWC31 version 2.00a have an issue that would + * cause a CSR read timeout When CSR read coincides with RAM + * Clock Gating Entry. + * + * This workaround solution disable Clock Gating, sacrificing + * power consumption for normal operation. */ if ((dwc->dr_mode == USB_DR_MODE_HOST || dwc->dr_mode == USB_DR_MODE_OTG) && DWC3_VER_IS_WITHIN(DWC3, 210A, 250A)) reg |= DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITPSYNC; + else if ((dwc->dr_mode == USB_DR_MODE_HOST || + dwc->dr_mode == USB_DR_MODE_OTG) && + DWC3_VER_IS(DWC31, 200A)) + reg |= DWC3_GCTL_DSBLCLKGTNG; else reg &= ~DWC3_GCTL_DSBLCLKGTNG; break; @@ -992,6 +1003,18 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc) * will work. Device-mode hibernation is not yet implemented. */ reg |= DWC3_GCTL_GBLHIBERNATIONEN; + + /* + * WORKAROUND: DWC31 version 2.00a have an issue that would + * cause a CSR read timeout When CSR read coincides with RAM + * Clock Gating Entry. + * + * This workaround solution disable Clock Gating, sacrificing + * power consumption for normal operation. + */ + if ((dwc->dr_mode == USB_DR_MODE_HOST || + dwc->dr_mode == USB_DR_MODE_OTG) && DWC3_VER_IS(DWC31, 200A)) + reg |= DWC3_GCTL_DSBLCLKGTNG; break; default: /* nothing */ -- 2.17.1