Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp270986rdh; Mon, 18 Dec 2023 20:16:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN0qPgORUdok4mV5hSzQpxxx6HiqP0Yu4jEUDqnJ1J9sA/co6PYj4rQg57kEQq1a8WdnY2 X-Received: by 2002:a05:6e02:1d05:b0:35f:ae20:2037 with SMTP id i5-20020a056e021d0500b0035fae202037mr2471462ila.116.1702959393471; Mon, 18 Dec 2023 20:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702959393; cv=none; d=google.com; s=arc-20160816; b=kAa+WYcomAZAuJk9wQXe6OKL/c8h5HHDeO4mUFq0bqT8o/TaOMTU+c13+rtrySwpHn he+N8Xfmmrg46c79psomJcLEy3B5GOJq0p5u1H/HAepTpMzGeYP3rlQ7QFFQyArIpRt/ YHRj/obF7d4bnhyuOyQXFdRmd7JXlTQ7OQuF3/rqtN6wTlWtExXtxaPAk1yz9H3Ac8BC BYHsd+c9P82VB1wndiZT8pfVSh3IBznTYdM7UhfTgZxazawbbgNvmgGjuKMANAoU9VyK ODasBe+hEdovWyovK9cEtk0Gdzd3HLe8XqAQ4Xs/BLEAsPH5EQQkDZrAOacXeJei68RD FBiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=cp6gcxEPcCu0+spcZ8mgLz2Ddq1D9u4PJmxznZRurMA=; fh=kV+yWbVihu73sdb1/KiQbbSHHpenekcxLyA2tbLDe1g=; b=EGK5oyu44voTX0fKnUR0301nGLS1VCo9sXoLL2OaPDw1R1gTWZK//CkmxORpRv7hE1 Wt2dyqWNTxDTITKGnZftU416lL+BN9Ku796GvDR2ogxLO5ejauF96KuQ1bqUY7F9OxVO fPxsrWEczyazTAvehXahXmTWu5/k4AyvPUx1OUEOJKcHrXUKtacZpAl05aY4h7Jl1A2I MImOpeR3IQSYKEJ8a73UgTBwbUfM4jCG03eYm4SqSN/WxmOluSIQ16kIMV9DJE/75fMp Nu8+OuCt3IiCzoZ0ok6ixO22o190niXpj1D7uZObnaLEtTtNADs2Naf5koV20Jummnzt tA8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ALRtdugm; spf=pass (google.com: domain of linux-kernel+bounces-4666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j192-20020a638bc9000000b005cd8486d5ccsi4899874pge.65.2023.12.18.20.16.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 20:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4666-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=@quicinc.com header.s=qcppdkim1 header.b=ALRtdugm; spf=pass (google.com: domain of linux-kernel+bounces-4666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 4B279B22BF2 for ; Tue, 19 Dec 2023 04:16:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EBDE613B; Tue, 19 Dec 2023 04:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ALRtdugm" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 CE3485380; Tue, 19 Dec 2023 04:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BJ3LD9N008508; Tue, 19 Dec 2023 04:16:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=cp6gcxE PcCu0+spcZ8mgLz2Ddq1D9u4PJmxznZRurMA=; b=ALRtdugmiHfKIse9YZoTxDl 1m79rFTKJNmd8H7DVYy2zQyIVQUQY75f5W6EkRSxWJ7UGst8B7VsVBx2B4qJVz7R vNdSvF4X16ea3f2kzsiR2kC1LmLX/yxR4Mp8Hna1RkhAa8ZOk903Ux4ufQ/+5PoG poKyE8EWd209lv/IxpP8lHAy7WgnGU961n1l5Ep7lP3fQFhTU3evD2tvdrRu3Qor erXYInR+far9Qm4WDH4thPrshsEVRKWDySjoKAQMhOfrUSXcup0c4HA6TDP1JPdU mBs/BdO67kpk5dHh91Cdd1P6jhQiQ07WBmueBnyYVzwVOP/FOBNlZarMGAmaN3A= = Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v2n17a62x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Dec 2023 04:16:12 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BJ4GBLn021662 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Dec 2023 04:16:11 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 18 Dec 2023 20:16:08 -0800 From: Krishna Kurapati To: Thinh Nguyen , Greg Kroah-Hartman CC: , , , , Krishna Kurapati Subject: [PATCH v3] usb: dwc3: core: set force_gen1 bit in USB31 devices if max speed is SS Date: Tue, 19 Dec 2023 09:45:59 +0530 Message-ID: <20231219041559.15789-1-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ioWWIKVhyGQgrN2-0LFaf3aoiNsIIAkp X-Proofpoint-GUID: ioWWIKVhyGQgrN2-0LFaf3aoiNsIIAkp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 adultscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312190029 Currently for dwc3_usb31 controller, if maximum_speed is limited to super-speed in DT, then device mode is limited to SS, but host mode still works in SSP. The documentation for max-speed property is as follows: "Tells USB controllers we want to work up to a certain speed. Incase this isn't passed via DT, USB controllers should default to their maximum HW capability." It doesn't specify that the property is only for device mode. There are cases where we need to limit the host's maximum speed to SuperSpeed only. Use this property for host mode to contrain host's speed to SuperSpeed. Signed-off-by: Krishna Kurapati --- Link to v2: https://lore.kernel.org/all/20230514145118.20973-1-quic_kriskura@quicinc.com/ Link to v1: https://lore.kernel.org/all/20230512170107.18821-1-quic_kriskura@quicinc.com/ Discussion regarding the same at: https://lore.kernel.org/all/e465c69c-3a9d-cbdb-d44e-96b99cfa1a92@quicinc.com/ --- drivers/usb/dwc3/core.c | 12 ++++++++++++ drivers/usb/dwc3/core.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b101dbf8c5dc..056ba95d9295 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1367,6 +1367,18 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc3_config_threshold(dwc); + /* + * Modify this for all supported Super Speed ports when + * multiport support is added. + */ + if (hw_mode != DWC3_GHWPARAMS0_MODE_GADGET && + (DWC3_IP_IS(DWC31)) && + dwc->maximum_speed == USB_SPEED_SUPER) { + reg = dwc3_readl(dwc->regs, DWC3_LLUCTL); + reg |= DWC3_LLUCTL_FORCE_GEN1; + dwc3_writel(dwc->regs, DWC3_LLUCTL, reg); + } + return 0; err_power_off_phy: diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index efe6caf4d0e8..e120611a5174 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -172,6 +172,8 @@ #define DWC3_OEVTEN 0xcc0C #define DWC3_OSTS 0xcc10 +#define DWC3_LLUCTL 0xd024 + /* Bit fields */ /* Global SoC Bus Configuration INCRx Register 0 */ @@ -657,6 +659,9 @@ #define DWC3_OSTS_VBUSVLD BIT(1) #define DWC3_OSTS_CONIDSTS BIT(0) +/* Force Gen1 speed on Gen2 link */ +#define DWC3_LLUCTL_FORCE_GEN1 BIT(10) + /* Structures */ struct dwc3_trb; -- 2.42.0