From patchwork Thu Jan 26 03:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 48472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp69638wrn; Wed, 25 Jan 2023 19:17:18 -0800 (PST) X-Google-Smtp-Source: AK7set/qB6rwBAD+ZYMwZLdpnG/bmEDfpyJL+ZDrf85tBF4qurmuJvErm9xzoDMAfDEasjUHrFrE X-Received: by 2002:a17:903:11c8:b0:196:2e92:e546 with SMTP id q8-20020a17090311c800b001962e92e546mr4097086plh.44.1674703038195; Wed, 25 Jan 2023 19:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674703038; cv=none; d=google.com; s=arc-20160816; b=Z86xN2vrcYizXOg/9q/dwuV6l4gWU0ljxLMHP/KV0ExHMWGC7PenwbVX8lXJBocuDZ zthb87C1RbJKJSch8z6SHhg1LRYu+eZKufoNTBaeH7IU2+n1LbffapUu62cVzUGa3XPT NmC9W3ziRilZOZDpz2QGD83QeSeiimGD5V6LNdrTaCpfxL1Wq2B4WRtdKPpWAVReqd1R fr9Mp+3+wLmp4zrAiSZkeqbyFyn7eqjYz1e+zGEucaCA4Bg12oCJlwB/yitEstnv+hHR 6Xsf4dElnusN3BnlNs37ZW1Vkewlkc6IO8jCDZCj/mpPHc9gS6lSxBrB91naO0nqhVxS GWDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=X5M6sUavZ3fUTxE7UWPbNLuT6/8dgX69k0uiiidcChY=; b=0g2Fnx9KGqTKAN0mb4RLjOHfWSKnB5zOpnJaxPUvKXbbmDTq3aSP/YKOxjwq8VMUTi w2+9iDdeyvuqrDL5+ZHMxRL+Y34GOU7CzEdMGFeBuuuv+fGBVXz5ywTIzbZanbYlBEdK fjOUzb7eeF4ZgCTu7Bw983klthexuN/qVwooEp5THLTYw2TN0m18HEAS49I4Mj3copKs GW+Hb8KvlVL/OwFH1QC8ONnfnLdhfMwm+kDzOVA4/xwe+eEsMqWa8Ye2PCGIVvpHD6Ql zwDydX03htYt0mnkAjL7kRLwtP4GR9W5WoIFq9530/QFZBjFF53YTn/J1ZGEaic1mj4b DY2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="llnqE/Pu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a170902e54100b00189aab9cdbcsi223025plf.605.2023.01.25.19.17.06; Wed, 25 Jan 2023 19:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="llnqE/Pu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236321AbjAZDQR (ORCPT + 99 others); Wed, 25 Jan 2023 22:16:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236266AbjAZDQL (ORCPT ); Wed, 25 Jan 2023 22:16:11 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E24365F0C; Wed, 25 Jan 2023 19:15:42 -0800 (PST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30Q3EmGS017428; Thu, 26 Jan 2023 03:14:48 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=X5M6sUavZ3fUTxE7UWPbNLuT6/8dgX69k0uiiidcChY=; b=llnqE/Pu+nfIT9sEy0Y9PkamSTRCfgd7b2VpquznVHcSUgTjLG4LfVBhKUSf+zYgjzOb dI25SPmMp4ArPx03qfNKoqT8Y4eqf6GqwkiEV9ZZJPVyzOSmKELc3klzi1XWGUd/KBo3 YawrZCb9IQ66oRnUq9ehUrRyLyzALWivXz27EtQStRxuYI59JhQ84+qLUJu+KVLgtYKr 3lYnlwHmvSLMeZmeNhiklZ6GFrxoD04q/WEmSZfIu+6+oznMUPnLhXGedBiTYkYarNcF JCpxWLB9kP5nL6ynwndmplR7nwm+/TTQlw7m5YOn0hL88W/tVppvDXKMkT5UVO1W/zD0 fw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nb2nssqw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 03:14:47 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30Q3ElLH016126 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 03:14:47 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 25 Jan 2023 19:14:46 -0800 From: Wesley Cheng To: , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [RFC PATCH v2 15/22] usb: dwc3: Add DT parameter to specify maximum number of interrupters Date: Wed, 25 Jan 2023 19:14:17 -0800 Message-ID: <20230126031424.14582-16-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230126031424.14582-1-quic_wcheng@quicinc.com> References: <20230126031424.14582-1-quic_wcheng@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Iz1hvovHMkS4yg2EnzbrH7ZRdk2gOWvv X-Proofpoint-GUID: Iz1hvovHMkS4yg2EnzbrH7ZRdk2gOWvv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_14,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=621 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301260028 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756053412901072804?= X-GMAIL-MSGID: =?utf-8?q?1756053412901072804?= Allow for the DWC3 host driver to pass along a 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. 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 476b63618511..67d6f0ae81d2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1446,6 +1446,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; + u8 num_hc_interrupters; const char *usb_psy_name; int ret; @@ -1468,6 +1469,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); @@ -1511,6 +1515,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_u8(dev, "snps,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) @@ -1589,6 +1599,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 8f9959ba9fd4..09037299da53 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1050,6 +1050,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 @@ -1275,6 +1276,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; + u8 num_hc_interrupters; const char *hsphy_interface; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index f6f13e7f1ba1..52a284fdd704 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -66,7 +66,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; @@ -112,6 +112,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_U8("num-hc-interrupters", + dwc->num_hc_interrupters); + if (prop_idx) { ret = device_create_managed_software_node(&xhci->dev, props, NULL); if (ret) {