Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1412566lqd; Thu, 25 Apr 2024 15:06:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhZCElJBBKDRTr7bkABH4f2kCy084edlqVo5yoxJ8XR5cjMGJkSNv0Qnc5EqHtZbroiMcijfA1ryg07wYmMssD5uuaOc603T79wB3h8w== X-Google-Smtp-Source: AGHT+IGBHuvtlrQeLNtfFGTb/yvQ5RvPBEnweB/Bsaz1W9ZJ2x6mnxoYNacHyjpXIPbhnMhp6+Q4 X-Received: by 2002:a67:e90b:0:b0:47c:e2b:69f7 with SMTP id c11-20020a67e90b000000b0047c0e2b69f7mr974163vso.4.1714082801257; Thu, 25 Apr 2024 15:06:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714082801; cv=pass; d=google.com; s=arc-20160816; b=GX7TTEA6pAbFDZkOhiHo4FzW7Avn3UZsfMrYo9XTCWZE3MNDs64dpJYXuMNGps+U2c CP3/cxZBOElWWVjwRl5Bhp4vqDFHxDCUE6ijBd3VGP9kfTXyY/t1jh0aKmHH3s2XgdDT k1J2EB8j3EChlBolAAeBpf+CpQx3mHVsfhY4YBsXpLjen/qly0oMe0jxpkzmhbYI4Hk8 KvKhLE+TOsi9U+z6tj+yUIzoaC17Xzaky/SfcV/aGZGJyGpBmMk5mXDBggdA7db83jpn S8nOx/+XtxYeih4CPkzq6YZcbWs+Ve+CWZ7zMjkaTy0gLpCzn03StZe1jib6aAjttoE7 2AaQ== 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=mPYnSHhww+dnO/xtOvIyImY1XDW/IpPUnelRQ1U4wHe+EIM7TglXbFCGYPFmlw6NRx LrUTjdlgRYSdUSe0FPe9oD6f++WQHqf0mmz1F9LaD84xzXQA/qLbmYPh3+NTu/lJcsn8 iq6ftrGMbzOajR7wJ5XmRQ7y1EaxA9ePYtnnNT2dAz++mYZVpMCpF4zSkeLPboh4w7en 2DJvnml25giOk6Hn0tEAxDtJ+Eb70pAHzGHQPJQsSWk+S0RURHmXtAcGlJYmK76cqSHt n2yS25PTWoYQnZxMOJdimHoga+caFseoBrGYZ6lfMyYP/fpbuXt0aLPQy3C48+XIXIvc CfPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=emKrG8B7; 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-159279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id hz10-20020a0561024a8a00b0047c19e86ed3si657481vsb.631.2024.04.25.15.06.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 15:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159279-linux.lists.archive=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=emKrG8B7; 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-159279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159279-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 226DA1C24281 for ; Thu, 25 Apr 2024 22:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D6A61C6890; Thu, 25 Apr 2024 21:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="emKrG8B7" 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 E9B4315625E; Thu, 25 Apr 2024 21:52:20 +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=1714081943; cv=none; b=HYfqwMPRWpk9YuJdyNrCgQI8dcrtN3uCT/EHE8IfquwLi4Q800qcFdOeGz/WgFWnIb+ZBicuMeSO02lkK5blgXqmC5RhrQj5WO8HiyTtSWaZlLzmXNAqUi3a1apv6LG92jVZbAT1g4O9qHCD0VzPs2fbTZW+XXwdvrNcjsrb/aE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714081943; 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=DDN6+SNaiKoE0M2k5kg6VkKc1ueHpvxEyFCfFYNGPVoj9v4cKoYS4ccOETvO6kkGbqPGX9NKqFVS+Aab7l+C23QI1NDw7cWQRewgrRhlJTSNqB1mZWFneH0qohzxi2MvzYZbVYILM+t0DBpycK8N/B4EU/0Qw5KbhQWTugPOICw= 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=emKrG8B7; 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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43PL8P9V004840; Thu, 25 Apr 2024 21:51:43 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=emKrG8B7JWwVkPypT+UzsY9JOXk0rlpgk0HH RfrWZ+jRjWJfdVDGpJNhGp9F22r18a5rfO2YTe5jLlTmc2NW02iO9NX1uu0JMtm1 U+mjldthLgC4Y8AmG6VyZMxEdjy/3sOorSvUx1ux67rTJgoR8aflh83SfXJzZuJ5 4RZar8s+73bgHdd1gu5rlP7SVc/Co+Aym2kM3x78IJr7Dr3fy8EZTeTVo28cubfZ zJ8cVnnOxIxy1DAswKSsQykpTseoqdQjbaIrFAVz2W68MeSSFs/SF/DAuZUTuUIR bPrMvUwyNpGdMDqS4M7Qltgn24QMjYURP8QhPyjz2Pv6QabYUQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqqtf15jt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 21:51:42 +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 43PLpftC011200 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 21:51:41 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; Thu, 25 Apr 2024 14:51:41 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v20 17/41] usb: dwc3: Specify maximum number of XHCI interrupters Date: Thu, 25 Apr 2024 14:51:01 -0700 Message-ID: <20240425215125.29761-18-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240425215125.29761-1-quic_wcheng@quicinc.com> References: <20240425215125.29761-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-GUID: lweYk4XMFr3WfcGZRxN_0tfvtBJjxi-2 X-Proofpoint-ORIG-GUID: lweYk4XMFr3WfcGZRxN_0tfvtBJjxi-2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_21,2024-04-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 bulkscore=0 mlxlogscore=963 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250159 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) {