From patchwork Wed Feb 28 01:35:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 207604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3080086dyb; Tue, 27 Feb 2024 17:49:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5k0i/dRp9resawWXzbiLsrfolw2NqZBXOm4OnZxI5KsfkDL2CvH9baK4ETtcS9By25ku6ssj8uAwW8TozJeMqqYXuuQ== X-Google-Smtp-Source: AGHT+IHGxDXm75qd/FI/sMhAaW+rUE+UQK3n6+QpXLEZ5Aka7/NyVPdx8LJ5LQUtlP4b0tgUgCZo X-Received: by 2002:a05:6808:e8c:b0:3c1:5f25:1447 with SMTP id k12-20020a0568080e8c00b003c15f251447mr4107462oil.57.1709084992514; Tue, 27 Feb 2024 17:49:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709084992; cv=pass; d=google.com; s=arc-20160816; b=RcWrsCtg+ITs1n6BEPmlLku5PjSAKpPfVUt42+IPlf610BcSq6V+WrZxksMIITWGV6 mDU32U+p0wsymmG6G25Oobcj31PPP6aD+/M4abmhHK7Ouz1wGaoyju9NmYRCLhc4i1st 5g7bupBYaMyYlt9oS9T0dlzTKMlerQ6kjI9/zh0rixwISM+MgeGlg23aqdMj1PyYDBXv Y3OE1TLBk5QGee7SrpdtpWunarOg33pZwjnjAs3EkFW/aTdV9WLkM2FKiKoz7EiGMaSe amBAKIantwaTcc43QjSewX/V0nk6RljEOvoVmyj49icIXHAPqBQnZekgHVlPtVXKQXwS JOGA== 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=V/OMpMXlLmtcac640N0spvVlhYeejLFHdYB73PZirSg=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=NZNjtZc16lpTTOBHQ8PiUjbG5sMAMKcqEYnoNKTEjTvEdHrRaGfp9Kkvu28cBQkjTq XnRYUBrtzJfUZhnKCcDXzJ/jQwFAGA7nOmzWjtZdIfypiGuWJcqWxxpwYlX1C+TQ2Ain SGmwBvMNWMNVvX6+e2ltKsxXCC+47i1ijKZxYesOmEkGbJxUxpaybfrUVW9u4gAOuS3o DqJc6zorD6xgarNxtQvBiaEq93MkvQrG/QHkEWMGF1+yWBWyL9TR7nDZQTF/io40Jyqn uquwrxmGQ48fzOi5T1PoTNuwoj5AvO8RsEESwUsoIi7YRJmW7HMgKNfVG4Ce446MEehq 228A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UiTVatIa; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-84358-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84358-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t1-20020a63eb01000000b005d48e659692si6392123pgh.753.2024.02.27.17.49.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:49:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84358-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UiTVatIa; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-84358-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84358-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D56CA289705 for ; Wed, 28 Feb 2024 01:49:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A8FB383A9; Wed, 28 Feb 2024 01:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="UiTVatIa" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 DC07622325; Wed, 28 Feb 2024 01:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709084218; cv=none; b=cqcd3jA9EByJDmfbgcHn4EOrFJHS99hoDLTR543CJgutv67RHHo5XY2qvnQ3nSoNpHrjWJF3v2aDMJRopKWvIZc4I1XRrmHG5FIdnGKrUSsFrlQ/E+IrTk1j/FHKrmA7cHI3nWvhaAIozdhHM83NqbIxifQrlGGHynYF2KLGYks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709084218; c=relaxed/simple; bh=44bouferNtaEkl73XOuvFVO0UJd0Gh6fhQxZqS9upGk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MGFDyQpE3yhyO2XDpofPCe4/NrD/9QPQ3y9WAYfJyQesG54fEQoacTqCPVPXm1owyImmdwcaDoDhYxwR2/KWuH2jjgFq8YdmksyKvuESg/XwZluH+whsgzeQyuK4npiKA/iAH4pVvU3cgmTadipnWUG8oliMTslO4zq1+pvUISs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=UiTVatIa; arc=none smtp.client-ip=205.220.180.131 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RMbuLv025709; Wed, 28 Feb 2024 01:36:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=qcppdkim1; bh=V/OMpMXlLmtcac640N0s pvVlhYeejLFHdYB73PZirSg=; b=UiTVatIaI2ft0gyM/9Snosm6+J7Sja5ci86A nFzsiznl7hXB7ApeYN4aMfYVndQVhFkJmwNqFPTFqyKI17GBHCJbA5THyZhEam+j QqqVwID/rOjRMGq++LmCCaN5+Op5vzIXtdP43K0p+/r9rCnnWnk3IzrOQU5wBPgI RId1VEed1Cj3W+dortf53FL/GMUL9hvcYdFTINRi7277oA2ohyZM24t8WuqhQ4QS z8gwgkP7RaPpKLrQLKWNyX3CF10ljek0Q1f4K3VMxwJ8Yje0pjoLSmgXa+f4WsaU BMljQNFHYhQVdGh6+I1sutbDbtVQYWDWW6joF+d1OntGKLBcpA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh507b3ed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:35 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41S1aY1r025315 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:34 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 27 Feb 2024 17:36:33 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v18 17/41] usb: dwc3: Specify maximum number of XHCI interrupters Date: Tue, 27 Feb 2024 17:35:55 -0800 Message-ID: <20240228013619.29758-18-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240228013619.29758-1-quic_wcheng@quicinc.com> References: <20240228013619.29758-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ozmopI6r3G7hQAkL5bamaPSsDBNq-BhD X-Proofpoint-GUID: ozmopI6r3G7hQAkL5bamaPSsDBNq-BhD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-27_11,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=939 priorityscore=1501 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280011 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792105504719293459 X-GMAIL-MSGID: 1792105504719293459 Allow for the DWC3 host driver to pass along XHCI property that defines how many interrupters to allocate. This is in relation for the number of event rings that can be potentially used by other processors within the system. Acked-by: Thinh Nguyen Signed-off-by: Wesley Cheng --- drivers/usb/dwc3/core.c | 12 ++++++++++++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 3 +++ 3 files changed, 17 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3e55838c0001..cf4207760b8d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1485,6 +1485,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) u8 tx_thr_num_pkt_prd = 0; u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; + u16 num_hc_interrupters; const char *usb_psy_name; int ret; @@ -1507,6 +1508,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) */ tx_fifo_resize_max_num = 6; + /* default to a single XHCI interrupter */ + num_hc_interrupters = 1; + dwc->maximum_speed = usb_get_maximum_speed(dev); dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev); dwc->dr_mode = usb_get_dr_mode(dev); @@ -1558,6 +1562,12 @@ static void dwc3_get_properties(struct dwc3 *dwc) &tx_thr_num_pkt_prd); device_property_read_u8(dev, "snps,tx-max-burst-prd", &tx_max_burst_prd); + device_property_read_u16(dev, "num-hc-interrupters", + &num_hc_interrupters); + /* DWC3 core allowed to have a max of 8 interrupters */ + if (num_hc_interrupters > 8) + num_hc_interrupters = 8; + dwc->do_fifo_resize = device_property_read_bool(dev, "tx-fifo-resize"); if (dwc->do_fifo_resize) @@ -1646,6 +1656,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->imod_interval = 0; dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; + + dwc->num_hc_interrupters = num_hc_interrupters; } /* check whether the core supports IMOD */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 25dc0599345e..04a8b3af0f92 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1068,6 +1068,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase + * @num_hc_interrupters: number of host controller interrupters * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs @@ -1304,6 +1305,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; + u16 num_hc_interrupters; const char *hsphy_interface; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 5a5cb6ce9946..4d2cb0cb63ef 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -159,6 +159,9 @@ int dwc3_host_init(struct dwc3 *dwc) if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A)) props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); + props[prop_idx++] = PROPERTY_ENTRY_U16("num-hc-interrupters", + dwc->num_hc_interrupters); + if (prop_idx) { ret = device_create_managed_software_node(&xhci->dev, props, NULL); if (ret) {