Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1431290rdb; Fri, 16 Feb 2024 16:22:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwfoxagwkO+OL7ZAymmjFxJnMccGVzU+7wuWS6NQc/EovwDiQ4SwJPewvmgVqy8Y+lSJbgzF19KDXOgac/8jXk6B1a2Hqb3tXSg1lf+g== X-Google-Smtp-Source: AGHT+IHL9jXosnzXeCYdl7X8h0exzqMOZBqLKZM+U5Hir2juY50RY17aldyENxIj54PDE81XBCjf X-Received: by 2002:a19:f70b:0:b0:511:5028:4cbe with SMTP id z11-20020a19f70b000000b0051150284cbemr4687737lfe.62.1708129348096; Fri, 16 Feb 2024 16:22:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708129348; cv=pass; d=google.com; s=arc-20160816; b=FEU5KV/GWWQV69B9DHsu0j7FyA8pJvrgUhsvqivstR9afNR1ekrD2r6sI5Hgpaa0cI yWTEYfF76ncDd7w/q9C1JY1/heDZVi6P0tKqBYHs9g5/3yoz+oPwdITIJm3FxUNuyZnf hjBphmFONxo+ICidpIcI4O+b6BZ2GnzxlRBZ1DLnTI16/wsoQoFFOIVYexHuJMyP+a2L Ntv8QPHcXUcy4cP4KSG2yE09B90U0v38BIo+MfFn0YXb80AIYXXNsPuQjnLNYHXYu6N5 Sxpe1OjX9YJo1orzO2hBHvs41WXWUq24lA5TGSsGyxTGkwm4Dluq2vXZMHpUK4rNGOSq TCwA== 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=lt/j32UTgUeYlRBM63KMA6i1P8ud0+8Dc0alV8zEtVc=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=k3uhZzeVlzqBDfaUIfyqQVosVkuVtlvh2QnlX7XufquPc4NXxsfs9QNOWxeWiHKjcu GP3sCqypx7Hg4uPHMvxlV7EKioiugRlSh9Lg0woAtd21rHk47v0iBQp+o0XQYPoIrIER LFPbBsPwAh0xLgSHgutCaXlbQNKNAmY8xxhm5ZNsAzS6/DO5/l7Bm4wHjGMQPwQVsWlv 7GD83OvR/QeqMWUZs2CICQZ+WaiFgRQ8JS97sshjzkp9Zf/flTsF2m5/RaZMkkUvTTbi EDGEtjcIGaJfKi6Jbyi1KiMnEbnYhiASto7IomB/2SErLHc0zujNsyaOa/veP/0F5WYc yv0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EUp9u5V7; 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-69552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69552-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. [147.75.80.249]) by mx.google.com with ESMTPS id b1-20020aa7df81000000b00562253e8090si391006edy.52.2024.02.16.16.22.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EUp9u5V7; 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-69552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69552-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 D826F1F24B5C for ; Sat, 17 Feb 2024 00:21:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D24DB79944; Sat, 17 Feb 2024 00:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="EUp9u5V7" 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 E64225024F; Sat, 17 Feb 2024 00:10:59 +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=1708128662; cv=none; b=ALnpc8VVYreXMAbzRhHJQOcWrauZRlUVL4r92e4t1vrxBP4un8h0Ugsh1HEq8Q8E2yet+Cy0CHhAHKXRawQCbNHryJa4muvPk+9bNqAyIzNMS1ssyljtEMDYja6PqUGN7XLsoNgs1eHxDV98q+6DVthoBm0g0E88qwK51X3xGHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708128662; c=relaxed/simple; bh=DXi8VTCNBy0X+AhWlXb5y++2tV6nTErvcSqx/Hn0qD8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XumPADD+nb6ixtGbHyy0nlJA+59Fe4Fpzxpm7Lvu9VLV1L59/z6kngsl9X1mvXXf37AdsStRM21iqauMmxeqkXO8tcoTFWykQvwII5FbgG5pq0vpFI/HXiD0klRdhEA9S9+qiGgqsPJ9UnrtZ22UStzZPUd4uXPCPuSuGT+FS+4= 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=EUp9u5V7; 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41GNqEPf014066; Sat, 17 Feb 2024 00:10:38 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=lt/j32UTgUeYlRBM63KM A6i1P8ud0+8Dc0alV8zEtVc=; b=EUp9u5V7pGvM22UWGF1Q8Q53rtgY38oCXoWF LAJg2drrAKy7wOY8MfC4gWw65SthOHofln06iSzgWB6nie+ERAojf4dJgzDKCvKf K/TT9Grwxu1cCZkRPuj4bi89yzF5m4L2M6DAWKZfEqn1SYD5e441Co0JkwYoy4ks d3fN9yKx6A7kp3EPa3YjEFpZaOQ7B2lelYeSMi+YtEHfDicf+RLKcBp6QQGN2yMT I4/NIpoF11blhqxpiTexYsj7yXh2n6cSJ/kBT0jN3Qf4ztW7fH2CCn6IdyBMnCWq +/+n9KZ7Cav3nv6RNhYH+crwDkBY1awpJfi+c9QRqXS0BGxm/w== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wa51xhkeu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:37 +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 41H0AbAK012906 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:37 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; Fri, 16 Feb 2024 16:10:36 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v17 26/51] usb: dwc3: Specify maximum number of XHCI interrupters Date: Fri, 16 Feb 2024 16:09:52 -0800 Message-ID: <20240217001017.29969-27-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240217001017.29969-1-quic_wcheng@quicinc.com> References: <20240217001017.29969-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-ORIG-GUID: s425lILC7xUUvCnrnJzbhKqIOei8FheW X-Proofpoint-GUID: s425lILC7xUUvCnrnJzbhKqIOei8FheW 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-16_23,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 impostorscore=0 mlxlogscore=927 priorityscore=1501 phishscore=0 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160189 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 3b68e8e45b8b..7ac02339458e 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) @@ -1649,6 +1659,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 df544ec730d2..a851ea0ea2c6 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 @@ -1305,6 +1306,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 ae189b7a4f8b..940fdaf3bec9 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -160,6 +160,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) {