Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2597558lqt; Mon, 22 Apr 2024 16:04:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDXkyad8nyBSOA84EXYR160lruEoemBhc6EaZTW8h8gVGysZaQJXDDmTy8mS+ZwelsTx6pF7IuuBC9X4JhzKbygNdSKd91BHYR6JwQdw== X-Google-Smtp-Source: AGHT+IGlmEBXXaolL6M6S7bpLP1FVBmCwujEYvsuhTdbfgVB5iMGh70Fil8F3m7UfiGAynGMyk7T X-Received: by 2002:a05:6a20:918d:b0:1a3:dc33:2e47 with SMTP id v13-20020a056a20918d00b001a3dc332e47mr12169004pzd.4.1713827080896; Mon, 22 Apr 2024 16:04:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713827080; cv=pass; d=google.com; s=arc-20160816; b=pX1YMm1ilJrpUEFCnsu46G14oA1xr1mnoz/wngDCV7C/a4fuOl9zOoyHwAoAu2Byii tX1SMkbp+yrHTvi8s451+TjrMQT4OYKqcBxm7qMGV/T2KzJugpZ6Wj0+3VjyDffDTS3V FwAAYQBkvztOCA/6tEiQVkY3Krq65DVebg3RUpYKX0d/ckw5MLI114tx5pmiXmwKgYih 9Yr0r966lD3rvrI5e+NtHEZOcA3BmeW2VwPmwlK2FYJxmlpGSIeefIZKIZ8JJ7NNKstX rYf5l0pLvc7tPfVIS2ACXj95Fwwv+o1gEfW8fn0TuzoEBS1NfXgMq2W6IV52DQVfmegI m51g== 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=jy+rSd+FFwErag3/oT7DHEU9Tujf+Svnym7NOQ2yylU=; fh=usWEz1eJjYCle08WABmDyuqCrJGq9m48/LVlmybnzRs=; b=i8wURXOCrA5K7GggP10Byg6kZt1zCqQBjZ41w6PAX3lrrSuXaQ8hoakXBjKek+rtfN C5+rpcL8KjFNKlw7deWM+Gq7EetYxolR1rQUk6JFlJNRlCKzf9WXNCTk7EB1wQAV0huu +J5Dc6sOCyyKbEDDXgwo3uEMqu0KG+o8oEF+SKxxqnV12jY0N1sWQvn+5ymBI2QeQYcu Si08c8PDnebgakV0WO9EqouaHvHmrOPJJ3ge81FcEds2xbBG0z3fiAlHSGkC15wiAJhE 03+EnYVf0FT37T7RVRUzt8HBtXNnYAOes1LRa/2SC2nvbhS7vs0tGQSRaOBU/8SsHpRd oB4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GDko0B1B; 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-154150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154150-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e13-20020a63e00d000000b005e45abc8c8fsi8667116pgh.306.2024.04.22.16.04.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 16:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GDko0B1B; 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-154150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154150-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 87237B242B7 for ; Mon, 22 Apr 2024 22:58:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 140F415E7EE; Mon, 22 Apr 2024 22:50:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GDko0B1B" 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 1F8B5156876; Mon, 22 Apr 2024 22:50:07 +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=1713826210; cv=none; b=RQsqwFTOMKM4oIhfV9BzL7uK/b9Q1OykRWEGzIqSmt71PSozlG6FdC30k7ddgHu3N2lKxFWROcOUZofKfRxQSuh1bi830bVShob0f7gMrsRs/InNI5Jf53cT2oDtFnyrDjBFtFEEp458OQviuXo8Keo4BFdGlFQBdCGp1E4FSKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713826210; c=relaxed/simple; bh=nRjB1K+kfOW1e0yWp51RBstfMI1T5eWD/hq3PN+8tK4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ROhnxy4Y4F0RlmCRW3elF19pep3ljpwEHGdmDgxk4MDK96xsPSHbWAxRYjkv2mcrgtyzKXyJyZWHGDvFgNrsRkXysDCGJ7ABP8o1zFxDaxpgvKc9YSdlGjgiYYj9bVUq/6oIupYzvcl3+10X0F71ekhGa28lyBXURcu6OmzuzE0= 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=GDko0B1B; 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43MMlixi028585; Mon, 22 Apr 2024 22:49:42 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=jy+rSd+FFwErag3/oT7D HEU9Tujf+Svnym7NOQ2yylU=; b=GDko0B1BhBw3doB4akzuIYcbwY5/N5J/Y8T2 y4jwzt/+l9TQ287VC4KWTf/8ZGGFL/hjdRZdT46LK1MvtIC/ae0JoP1nKeJf6bfw Hc9/zhev/zhlbNf3cPq0OlZLUCWecI0Eb7NSl9YtHVf9Jaw4oiH1uovP/JZox42+ phBvH3K28m5SdvdREmV9dLyAM/ABS3yEICuez3jkbLIuQK+a6cqLTNQasPWv174K tDLg8F1anmnUZKrmCIKPi6pVPGSRx/YLFvbn+/fGrk4qZc2HRA/lxTAbsJ+y6Qy/ pptNlLev6gl8tgPr8dHwh9z34s+5xqad7ojr5cDqa+n8qXGfAQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xnr49s99s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 22:49:41 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43MMnLAA027733 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 22:49:21 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; Mon, 22 Apr 2024 15:49:21 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v19 17/41] usb: dwc3: Specify maximum number of XHCI interrupters Date: Mon, 22 Apr 2024 15:48:42 -0700 Message-ID: <20240422224906.15868-18-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240422224906.15868-1-quic_wcheng@quicinc.com> References: <20240422224906.15868-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: 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-ORIG-GUID: 1Z6VjSDohAXchKUZQX80jGonWFxpsVDD X-Proofpoint-GUID: 1Z6VjSDohAXchKUZQX80jGonWFxpsVDD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_16,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1015 mlxlogscore=962 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220096 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 637194af506f..5e31946a1831 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1488,6 +1488,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; @@ -1510,6 +1511,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); @@ -1563,6 +1567,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) @@ -1651,6 +1661,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 7e80dd3d466b..57c2735925c4 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 @@ -1306,6 +1307,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) {