Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp86562lqo; Tue, 7 May 2024 13:01:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVy5CHvM06Ohqlv0mQtXd/WqMZAUv1NHjYt77Ktp70Gr3sMTqNyizb7DlJvDLzl99smf2Xcb0HBKccDoO64zBTiSMCGeqWU++SUAz5jcA== X-Google-Smtp-Source: AGHT+IGTvfJ1DSU99YbAICq1v18Upi7Ah5CSDr+9YDw0cQKHUuEsNpgxuTIgitKO8h3qe/a33p+m X-Received: by 2002:a17:906:29d4:b0:a59:cb08:465a with SMTP id a640c23a62f3a-a59fb924a0cmr29083066b.7.1715112115261; Tue, 07 May 2024 13:01:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715112115; cv=pass; d=google.com; s=arc-20160816; b=JqZ/pFmwANdCuKKfgtgeWcWCiIhkPRuxzpfm0iIGp5CskTggncyEgHXUwWLtDVt6WB aCuD0P8N3pEleKlMAp1gJjX0oLhWFqgv39SOjPUZzDGd4ymuhIb5hIMyXNc9sFrLPlkP OeHoGSVmgLwTAsW6LdB/YQWKarUoJ3hPrV/EHhrOAaQa8lpPUh52QDy05/KWt7Kddxkz Xs1jiq55WecDM0r50I+RxY0RHo8/0QZygy2h4nLZ3AoymTAqtBqTfw6d9lmWRL0efRIk EZwUouzExI8csL8ni5I0bYHAtE7A5HW15MmdHI+9e368rJ/IgSSBWHzPdHNo6IBCw5sf g6PA== 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=PZmsd5A/vteQo/baFqZCHC4C+EhWlDbGSUUnNaTJVoo=; fh=tk8sqZoIP78riW3PYc75n3+DQFkqFrW+9GPE0/sstVA=; b=nQWDDtRnRr3clJFPpG9WwA+/oJ+8cQ7jKeywLA7dS3btJwKYWwLLDypd9rQ1aMvpqt HbxwQbyeb6qGB3cZM3ysySQ2Kngei4y4wc9+uMj4zF7GyS/krFRUV5YGbNrTpaWT2fhc iSNnBi0wL7IRGUoAM0JGfXOTDaYSjhsXjDyQxzbX6uIXvvx5CkRSbMEjV0PvNhRlSUGU ccS5CFxCU+hMSlYxCm1kf2NODLVcuwDvsGtsi3y9VXsgs4tbJ/HF8KlLRWoZ8maT0eBt GaLa3dQuuQ8XCcmg9w3Y4xG/T1YyZFX4QbiGghNIzJvLnoALGgbgSEPIMN+TcKUQV0sJ XRBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=G8huPZVT; 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-172103-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 k17-20020a17090666d100b00a59bf473519si3463936ejp.573.2024.05.07.13.01.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 13:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172103-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=@quicinc.com header.s=qcppdkim1 header.b=G8huPZVT; 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-172103-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172103-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 am.mirrors.kernel.org (Postfix) with ESMTPS id AEA271F2362A for ; Tue, 7 May 2024 20:01:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7D4217D1A2; Tue, 7 May 2024 19:52:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="G8huPZVT" 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 EF7DC1C9EBE; Tue, 7 May 2024 19:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715111524; cv=none; b=YIc8BUhdiitGGtkFynXeORpI1PvCN8+ckilXUd2MW0RAHfhy2gndxurQXFkzqk3ydTE3p4yTBXSghLcZjYHsykQF989MOml6rUw19QiUthGPEcWXaggJg1EeofQLFtP6LYLmVAPp0Zz/NtME9kxJn/+WujS67VVIf9zE1rZKTk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715111524; c=relaxed/simple; bh=a8/syHhmbTvyTKDOBFgJawalQWWJ5S6yVpNHwdmavoI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hfv7Yk5uVg9RMcJkayTnaCZLI6kamJkcL3pDuLb97tUV5ogGTePvdb1uMaeEvW6NowgQn82K60rGHoKbKrVjDn4F6VmNsNXwGBUK5dgxyT2O4hIYWqpr6BwNKTaD6wUy90vROkcFnNlJR8ZjN+b9Gx9ZNxnXtUEu2fRHaHxQIfE= 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=G8huPZVT; arc=none smtp.client-ip=205.220.168.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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 447Jp5vB006068; Tue, 7 May 2024 19:51:33 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=PZmsd5A/vteQo/baFqZC HC4C+EhWlDbGSUUnNaTJVoo=; b=G8huPZVTYQBWo9sRaoXBoT+7CO1whQEx442U xe1v07CkbEa+0RVwtiWevCbf8EbLDT0kiz1G/jb1ZQvR8To71ISWX+wStJl3ZETP uAOHKqyitDSMxy2K7/tjvx1Jx1KJQvmCY8vaMpz9vlZF/ZpxcWWtbjajjMuksEp7 JbntqGWJTHY9SAfGDs/dVnvc7HWKv3W7SOT2Wnb5B+QqGwEkTMUi53+LieHuX16X 7UywAjG4hGbTwJ/EIat9Bx7deQje1GPV0uSvTH10fmLyyThMsKBW4MCYmkcpO830 GvppUZjifS1DrBY8NJ6hMoeoD5aS1sFN2ZfS+fwunbmA8t0GIQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xysg4r5u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 19:51:32 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 447JpVgJ019778 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 May 2024 19:51:31 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.1544.9; Tue, 7 May 2024 12:51:31 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v21 15/39] usb: dwc3: Specify maximum number of XHCI interrupters Date: Tue, 7 May 2024 12:50:52 -0700 Message-ID: <20240507195116.9464-16-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240507195116.9464-1-quic_wcheng@quicinc.com> References: <20240507195116.9464-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 Content-Type: text/plain X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) 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-GUID: 2pOzfwamKRt3YjKdbU2dB5xLAANVRbAh X-Proofpoint-ORIG-GUID: 2pOzfwamKRt3YjKdbU2dB5xLAANVRbAh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-07_12,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 mlxlogscore=956 clxscore=1015 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405070138 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 719305ab86c0..51daddac88bb 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1595,6 +1595,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; @@ -1617,6 +1618,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); @@ -1670,6 +1674,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) @@ -1758,6 +1768,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 5cbc64883dbc..cf0d23d3f782 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1077,6 +1077,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 @@ -1318,6 +1319,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 0204787df81d..f774b843aabb 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) {