From patchwork Fri Dec 15 21:49:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 179557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9598316dys; Fri, 15 Dec 2023 13:52:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBSYd1LENE7pxUJpy5/BkQIEVFhZ9Fz3WO7KhJC8vM8PhonXxHnv0X6YNEcOkTyZ1TUfiH X-Received: by 2002:a05:6870:9721:b0:203:7305:9fd6 with SMTP id n33-20020a056870972100b0020373059fd6mr1478371oaq.46.1702677146964; Fri, 15 Dec 2023 13:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702677146; cv=none; d=google.com; s=arc-20160816; b=ch6ZCtfoGueJCWTqWX7pG4nwA3D/v07AauIbxAbZVkhWL6HfELs3+tVlrjxb9/HuQh s/buTw1P5Svtufj1K6fZCf5SUnrYkJ3rpBZp3X9c672RqSIY9e3Kt0Z3635JKkJgGiF0 01+E43llZApI2ZpVOM++m897uRtj979BcsCAAmsWoi3KDlurswPip35iNUXHIgZUH4dA zr4KHYqvrKX7FtJMzpiEVIT5Lr4rAnO8BU+yS+bMykmchL7vUGdxmEodryWy5Ul0+k4+ uEYC4l7zV09kGn4R9//RsDNf3YrXSdbA9yimd0vDyvdrJbMNbpHJ0/vsjPHGDxic5LUX mQUQ== ARC-Message-Signature: i=1; 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=G2zlZoLj4tpbBf6CZGUgqbkTG0qUc5ZXENrtX1X/jwo=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=bXl09y4u/Gcjk3Bp6utz4OI+Cl2vH2HHVJ6PrqKBf9DqtQGMaYmOIqFNwtm8t5Z8jw hNktuAE2PtuwSitHbkAsTVejgiK5ygPTr6tIT6q1tYpk8y6NKZf8tvUv8Kho4fFvXYtJ bYPoBQja+c3CAru4wDYe2dVnLqZlAUg4kpsa8ZgDrn0o9CqwyQk3JHEGClmb/88XrBmw /OrYNPDBtXsuuPiBh7SCOn4xJXoCmHzvjsML3pVvcbOuW4dlBK1NUnWufVzFojvcsLB9 wR8YomwZpWw4s5ywwuLR94BUebFe7VQAQpdDWw/FEkQNqahdTGP+tEo100XhZ9TCmlsd h1cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XCPUW+tK; spf=pass (google.com: domain of linux-kernel+bounces-1683-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1683-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 k25-20020a63ba19000000b005893c5bd119si13509218pgf.425.2023.12.15.13.52.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:52:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1683-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=XCPUW+tK; spf=pass (google.com: domain of linux-kernel+bounces-1683-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1683-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 B1A5328728A for ; Fri, 15 Dec 2023 21:52:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3185367210; Fri, 15 Dec 2023 21:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="XCPUW+tK" 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 E1F4247F78; Fri, 15 Dec 2023 21:50:25 +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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BFLBFnI017078; Fri, 15 Dec 2023 21:50:11 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=G2zlZoLj4tpbBf6CZGUg qbkTG0qUc5ZXENrtX1X/jwo=; b=XCPUW+tKLgKE47XGA+nRTz9lYdwSIe52Li6C 2H6GOOaNJVo59r4CZo8yMS7Jgcwf8wzuF4L0wtRvAC8Urrq4+HVrCwl5nvBiuyRp N0KTr1RZl+F3C7a2JoIUhyR4Tn3g72k6Smd6kK/6WYGM++dpS+DCaSqWBD6oOd7N HxR6uXokIWKFVMQRIv3EEAcqgL0joYfvfg84FFr830U1v7WKl8UcQk1ujaGvB6Gb AzUYZe+jcz51zHB3c6RPY9z37ceS25Oh64czyVqtBfVBY93AkvGxnlI/oN84Iysb VqUmn4yGWdBl1binpjCn5vK9IrzwQRYzEvLjAMrgLZKEq7U1vQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0w1989gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:11 +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 3BFLoAM2012336 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:10 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, 15 Dec 2023 13:50:10 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v10 16/41] usb: dwc3: Specify maximum number of XHCI interrupters Date: Fri, 15 Dec 2023 13:49:30 -0800 Message-ID: <20231215214955.12110-17-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231215214955.12110-1-quic_wcheng@quicinc.com> References: <20231215214955.12110-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: nalasex01c.na.qualcomm.com (10.47.97.35) 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: TAfcU5y0xBnTvA_6zH1w8pvsqeSsbMXP X-Proofpoint-ORIG-GUID: TAfcU5y0xBnTvA_6zH1w8pvsqeSsbMXP 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 priorityscore=1501 malwarescore=0 mlxlogscore=755 suspectscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150152 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785386391989242256 X-GMAIL-MSGID: 1785386391989242256 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 | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b101dbf8c5dc..8b1629eff48a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1510,6 +1510,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; @@ -1532,6 +1533,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); @@ -1583,6 +1587,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) @@ -1671,6 +1681,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 efe6caf4d0e8..fb229b64946f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1062,6 +1062,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 @@ -1298,6 +1299,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 61f57fe5bb78..79ce359c342a 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -61,7 +61,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc) int dwc3_host_init(struct dwc3 *dwc) { - struct property_entry props[4]; + struct property_entry props[5]; struct platform_device *xhci; int ret, irq; int prop_idx = 0; @@ -107,6 +107,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) {