From patchwork Tue Feb 13 00:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 200122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp267242dyb; Mon, 12 Feb 2024 17:23:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYUCZPy21/lQrng5OVsEuXx0P7/tfliqn0VZu61IGM6Hzdsik71NQnhJeTAnB01T0fvxYnjvDsOH9XK8agMUfce3YXyw== X-Google-Smtp-Source: AGHT+IFKeOnAO/DewZcPGONVcuXf1YXyJIxNYOxHohDV7AapkKaKJgDmUX7d28wNZgfTxCfYS9bq X-Received: by 2002:a05:622a:170f:b0:42c:6bfd:daf3 with SMTP id h15-20020a05622a170f00b0042c6bfddaf3mr9672737qtk.26.1707787395503; Mon, 12 Feb 2024 17:23:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707787395; cv=pass; d=google.com; s=arc-20160816; b=za3DXYdXyMHBI0UYFCwf5zyr4x1uaENCoZqlyYEgyI4PmlHrTF/uXC8PihNhBc/d6a h/Oaz3pNPa+71gVxeL1C0/WOftpfAYRIomrqMDC5Eqgfl3cTJH0wfHqWxHgOUqsOCTNG UKvHy0zqyEwlTOKcWvyCPZQHzdzDh5noXZQ/FQrVb0PgdK1RUId3vDtmylWxPXbUN8aH pChk2YRB89EEYc/+kDQ+TJD4By5Syqfb66sQQEFLOoWLJaapbfmf/M+UDLbkLIPO0wD2 sTofWwnBsAo/uzIGAhjeLzJBhuNN1n3kDIZbb9wowYNB6mGG+3FgP3PZcLqFBtEHnZ5r Ofwg== 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=b6o1DZWRuc04fm5lKH0e0QE9KkK0X5y0QOEParzZU0g=; fh=WlU3PYVqiu4mvMQosPI+V836IceNWdNOQGz6PtGWPUc=; b=QX+TMonZ7RIPwtzU5udBwAziOQvcFC4R2kgEaIEdOwTTjuKVRWTsYnV+le9ejvsQsj ANODmdx6HlXlWM7+s9Az75CySmjP9okfVc0/NFCH/nD6M5DPQQ6sxXfNXH1396McYBMP X95ss6U5c6WN6auw4ZkqQioA0uz2DjumUxDq8hLQU8ENXZjTRJy0Lcq4NUBMrQA7DJJw X+hWAbJSOUeHmsfVgFgXjQZy8SgWn+STK/ACCM9mgl8BwXQ/xjCgk8lvr1UF4z11U1QG s0+5ltjNITlebVAjDwXzEPUrCGFAhRtpN6aj82POZ/EQE7E5Sak+45kEucta3k+l5YyU E5uQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ij6nkd+J; 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-62779-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62779-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCUrnR0d4GWNSkAKzHHwH5672Hl+547q44XODzAJnIn2y3OiEb5SiwnT4djL0k3nPfl2xEYiHIiwfGQew0rTAnfa34sjKw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i15-20020ac8764f000000b0042c3472845fsi1673048qtr.329.2024.02.12.17.23.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:23:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62779-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ij6nkd+J; 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-62779-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62779-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3FA681C2448E for ; Tue, 13 Feb 2024 01:23:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5647755799; Tue, 13 Feb 2024 00:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Ij6nkd+J" 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 BB6161CF9C; Tue, 13 Feb 2024 00:54:54 +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=1707785696; cv=none; b=Jg2uJEtRqifXNW1HpquVJRAZLR79NAefq5ig2Ci4Ki+wXfpwmr8WJwv5s2H/MZWlaSDrEBnc3GzNvH6xf0sWU4T1lQbJuJTfA3ccooM+kqXbIukosCt3SXugbQvMsy+og9jNXLehH+0ZkJj+Y6oCLmyUsVZeBt1hCLGjEfDbcKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785696; c=relaxed/simple; bh=/yIRGDVuWTwN01jjLu9D99BsT38c9Fll4aPsKtVd2WA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HCv7kdjwqo1/f9tP9J+wHF9aqSBkNE7uY6PTV0dwzRSJ6Nf8sv+4wSgp7hYPPOVFFJIKMng9mOPOmrKrGkQsmZ0etpv8bKODDAxVXl0G3lBf9xXAYE3Z8Cg+/2cK46aiA0fRWZ8FkL6E6kDDwuk0xzB0efYziltqVPDfARGt8tg= 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=Ij6nkd+J; 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 41D0T4pn004845; Tue, 13 Feb 2024 00:54:41 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=b6o1DZWRuc04fm5lKH0e 0QE9KkK0X5y0QOEParzZU0g=; b=Ij6nkd+JU/YbmpmMEevH/yqEDiQZRwRjvDrr UMpb6GDmTIBtlx3iYqnhWv+aR6Kn4MNlHnkUBUru2xuI4rj6RKAHDODwaR0nu8Rl mdq6bNdi/3yxlr7gObxy8+OdlSXuiRu/49udMtWW3E7jWCBB6C6udG3Vobjwt4uX daK/2O6MQJyQ4olKf0EkDsEe5zSywEcLeLm/5desg/y8FG56Q6rMjAWPNLGI2cuo f0/DVKc+e7R2xPjCOLgrLF9B/4q5VW0cAxxe45hMObNi82LepK7tXLM5/ZtK4hDq h6fkOsOQCj0rYM88QLGT+kmqEDfWGOKZphC2qzm9OeXTPuUoUw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w7ww5r1ac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:41 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41D0seRD031312 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:40 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; Mon, 12 Feb 2024 16:54:39 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v15 26/50] usb: dwc3: Specify maximum number of XHCI interrupters Date: Mon, 12 Feb 2024 16:53:58 -0800 Message-ID: <20240213005422.3121-27-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213005422.3121-1-quic_wcheng@quicinc.com> References: <20240213005422.3121-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-GUID: cSb6GnVAs9v29iuJDncwqtAwV4GN7f6_ X-Proofpoint-ORIG-GUID: cSb6GnVAs9v29iuJDncwqtAwV4GN7f6_ 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-12_20,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=817 bulkscore=0 spamscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402130005 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790744876015736099 X-GMAIL-MSGID: 1790744876015736099 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 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 4957b9765dc5..3abf3b7d7c88 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -105,7 +105,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; @@ -158,6 +158,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) {