Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1030272rdb; Sat, 7 Oct 2023 08:49:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwU8/LHC1EWsCR9qcDwoTT+dInR7XzXEJiuoNYf6TFAD4aDeURqYvIQkmKBrl1zzLIgBV0 X-Received: by 2002:a05:6830:3d17:b0:6c0:e5c3:40b5 with SMTP id eu23-20020a0568303d1700b006c0e5c340b5mr10429359otb.6.1696693761284; Sat, 07 Oct 2023 08:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696693761; cv=none; d=google.com; s=arc-20160816; b=lBeySI+y381SuTqG0WHE3RUMB7U5s06MaQ2uiU7EzRFpnBJindAsWhTnUfqPMj/whf n0sAOajSS23YOrBdvK61Exj+dp5kCCSYNjN1/oHMAUGavmc3S2ljkimcwdYdRrPAl/d+ DOA/+QO7iyTPIGezMX0B00Uf0LfQuiompn/Sxv9Fma0d7hlz7vwjy5VFctEfYnKH/WjA 29o7iPsTuaUViHChe7dCXvko94HzHbGHwbvpeoCJiJH6we5FpZKbABygQe4f4HsIOoVr tOmjLx48SSi9Rx8N7WUrGJGsEVnFwa+mp61ZgXWs4fQDIToLPeMbBskVdbJjcSW7ZjVW PxdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9ALIUoz1vkM6MhoUdR9nJ++NWyOo4YGcWioNI82djYU=; fh=a++TWPJw3Cn9MYBczZLXAB+Eob7lKtyrQCXvx5EPkG8=; b=XKTgBE3ArK5ptV1DvMV1io94UQtBWKLvaaJIk1Kg8Od2TqVsGlZE5j4qWKFvLPuPTt NAPrDKbj5xspx8fWAwG8dsnlybMcvWzPd03iz/GSZMkmYo0aOcIkOWcqcFVd94jwk8LY dHm3YW7jidnrJ/bwxRYRoTMSCW5o9LNc9IiNvcA0QthUvxTyBk3chdandfLfVEbI+bS4 fqw9VTDeubO4dFa+K7qaK9OWEg8bExk4eRNtSOoPXBCZtG0p4FZbULj6sZR+IvBJpK11 Wb3GnGWLxucPuVjy4cIQWW+KG27ZtjkMoGSwcBwaf9fSueXdJjBIQLPZamdHK/P5bkbg wjHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pzloFblL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id s35-20020a634523000000b00573f9d84ecbsi5989732pga.387.2023.10.07.08.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 08:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pzloFblL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 94331805C3D9; Sat, 7 Oct 2023 08:49:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344042AbjJGPtC (ORCPT + 99 others); Sat, 7 Oct 2023 11:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343934AbjJGPs6 (ORCPT ); Sat, 7 Oct 2023 11:48:58 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22B7FB9; Sat, 7 Oct 2023 08:48:58 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 397FdCeB007664; Sat, 7 Oct 2023 15:48:39 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-transfer-encoding : content-type; s=qcppdkim1; bh=9ALIUoz1vkM6MhoUdR9nJ++NWyOo4YGcWioNI82djYU=; b=pzloFblL6VGlSvWLw42aH65GguszTcoev09GlpoPoYHaI4bBZaLcfCSQSwV+jpbi/eK5 Ggfziz36aEG+bjiCrx3pqUztkf/VRoiSEkYtjbk6EmNs4HFV9K1gvMNEXe1WKFJwbyar z6VJGQ/5CX6dMyEi9YPAp8onMan9a4vyc5poqgql1nzol7h0gnAuX6N7sJuWoSrHIhhA Y8h9V+Vt1ljBpjS9pOeHN/XX6Hj4ChbifS9HZIlECE25ij4ltpwgEiW4wFD1FAnV3g5K d+sDfIwhhmVfxc0r1dghVUJE2YFBKZfNX+EaL1U5mpeI80yO7NdEU9OCAeEpkasfnA3X 5A== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tjx9y10vq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 07 Oct 2023 15:48:39 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 397FmcWs028624 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 7 Oct 2023 15:48:38 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sat, 7 Oct 2023 08:48:32 -0700 From: Krishna Kurapati To: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , "Andy Gross" , Bjorn Andersson , "Konrad Dybcio" , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , Wesley Cheng , Johan Hovold CC: , , , , , , , , , Krishna Kurapati Subject: [PATCH v13 02/10] usb: dwc3: core: Skip setting event buffers for host only controllers Date: Sat, 7 Oct 2023 21:17:58 +0530 Message-ID: <20231007154806.605-3-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231007154806.605-1-quic_kriskura@quicinc.com> References: <20231007154806.605-1-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: T03puQC3Z5iMNuTtKK6pIibMHKMf9E87 X-Proofpoint-ORIG-GUID: T03puQC3Z5iMNuTtKK6pIibMHKMf9E87 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-07_12,2023-10-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 bulkscore=0 phishscore=0 clxscore=1015 impostorscore=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=970 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310070143 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 07 Oct 2023 08:49:18 -0700 (PDT) X-Spam-Level: ** On some SoC's like SA8295P where the tertiary controller is host-only capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible. Trying to access them leads to a crash. For DRD/Peripheral supported controllers, event buffer setup is done again in gadget_pullup. Skip setup or cleanup of event buffers if controller is host-only capable. Suggested-by: Johan Hovold Signed-off-by: Krishna Kurapati Acked-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d7c5669ebd06..3e507e4cc542 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -486,6 +486,13 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length) { struct dwc3_event_buffer *evt; + unsigned int hw_mode; + + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); + if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) { + dwc->ev_buf = NULL; + return 0; + } evt = dwc3_alloc_one_event_buffer(dwc, length); if (IS_ERR(evt)) { @@ -507,6 +514,9 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) { struct dwc3_event_buffer *evt; + if (!dwc->ev_buf) + return 0; + evt = dwc->ev_buf; evt->lpos = 0; dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0), @@ -524,6 +534,9 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc) { struct dwc3_event_buffer *evt; + if (!dwc->ev_buf) + return; + evt = dwc->ev_buf; evt->lpos = 0; -- 2.42.0