Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5557415rwr; Mon, 1 May 2023 07:36:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nG9jnggTNlMfHeC91vB1bY0pKmvgWL4zq925gWu8qjFJ0buMTopFNQpd0/K2/yy6lNhfA X-Received: by 2002:a05:6a00:1385:b0:63d:4752:4da3 with SMTP id t5-20020a056a00138500b0063d47524da3mr22812090pfg.25.1682951819096; Mon, 01 May 2023 07:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682951819; cv=none; d=google.com; s=arc-20160816; b=hLzvhXHqCVK8/odmh+zAngs8FBFfpjB69zv/SF+wAMB9wBxlt+th+GHnYLTPoBfhRT r3sgDnAzG3pOYPv9j1maQzSLQa8OapOlYeYni6b0xd9fkbqUFlLOARgrHUdEUJpzjyse zOxYBNRYphyg26dfVMptQY/rlsu8BQq/EZkLSKt8Ql8ntJR+YBGzsFHO2+c5uS4pWD34 NzNisCd7DsTAVhQzR/7p/2btr+fy/CP+XfsPUaLspf1CvU2gaqichIl2a09Hht0i3c6c z/UgF3ftIZE5e2CA5e5OBz1C2rMsfwCPO51+tBysS3V/wNQ3A66DY0xmFc3XYMYSJYUJ qKwQ== 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=SHJpOQOaDQimrpDNKLc96uJyDLYS5uU5n2YMSTNQvrg=; b=yc2dbT0+OCxA8/Rc5+7NBaWDN2p+pCZbpSNvaIgzScZES2HyGkBZpRuiewktAMBD8I CFX2/Wv+X/7IefmH43ljeYce2y2MM37xpk8lkGtlc9u25pAWdV462+IYs4+xdxpHLGGK +opfjeZNbv80xiAUcOk9Ix+xtZe0SVRWoxTfUcHvG+K+MtlZ+bvfo8pGMAzxdJRG9VyG +OIUxxw+hskQyAZNR3XbURgL29OBURkaS+PCTfqusl1oaWtNIlYEU12L61/qeU2rFhGY mKKwoQB2n05n6z1zE8M/9KBluNd3Kmf+RRlfgJGlcFNbZYESUS0QrKDTTb8y+PzffmmN 9H7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p6QWS1JL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020aa79f45000000b0063b16cf691esi28437157pfr.385.2023.05.01.07.36.44; Mon, 01 May 2023 07:36:59 -0700 (PDT) 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=p6QWS1JL; 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 S232512AbjEAOft (ORCPT + 99 others); Mon, 1 May 2023 10:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjEAOfo (ORCPT ); Mon, 1 May 2023 10:35:44 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E4651707; Mon, 1 May 2023 07:35:43 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 341EHJm4028582; Mon, 1 May 2023 14:35:28 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=SHJpOQOaDQimrpDNKLc96uJyDLYS5uU5n2YMSTNQvrg=; b=p6QWS1JL7Y74r1KoC7ZFCxmZ/O/0bPiz/vI6TdkvGGV3zggIrwg9HvMQBZ+cNTswBpvf ov/DPIhsk46oUnbIum8YiTcFii0gbxBahcGEL2wWjZKRzDiTiswZzjI/qDBHTi2U93VU XbFF4E0WHGOyXsnWAJ2qBD7CeYBcDjI7T+CKSkOPhmo2CT3eQD1UwUn/LdAJyYYsNEi9 vJaGg8IVoZ/cyLw1wiH870LIW9pj0fI+BhrJONb2CEPsbD8ColQMlgf9wyNqG74NlNcM 97pWIv0XkVa1ehrogtKOQMemxhT7GxP9LmXtYOnFEow0nHHjVxEwrKV4GpqsMigH3Eyv ew== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q8v0rukw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 May 2023 14:35:27 +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 341EZQJA015913 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 May 2023 14:35:26 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.986.42; Mon, 1 May 2023 07:35:20 -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 CC: , , , , , , , , , , Krishna Kurapati Subject: [PATCH v7 4/9] usb: dwc3: core: Skip setting event buffers for host only controllers Date: Mon, 1 May 2023 20:04:40 +0530 Message-ID: <20230501143445.3851-5-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230501143445.3851-1-quic_kriskura@quicinc.com> References: <20230501143445.3851-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: -_WjZryAEt_KX7j76HGaEwC_HHoYfZDJ X-Proofpoint-ORIG-GUID: -_WjZryAEt_KX7j76HGaEwC_HHoYfZDJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-01_08,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=957 suspectscore=0 adultscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 spamscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305010117 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,T_SCC_BODY_TEXT_LINE 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 On some SoC's like SA8295P where the tertiary controller is host-only capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible. Trying to setup them up during core_init 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. Signed-off-by: Krishna Kurapati --- drivers/usb/dwc3/core.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b8ac7bcee391..8625fc5c7ab4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -835,7 +835,12 @@ static void dwc3_clk_disable(struct dwc3 *dwc) static void dwc3_core_exit(struct dwc3 *dwc) { - dwc3_event_buffers_cleanup(dwc); + unsigned int hw_mode; + + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); + if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST) + dwc3_event_buffers_cleanup(dwc); + dwc3_phy_power_off(dwc); dwc3_phy_exit(dwc); dwc3_clk_disable(dwc); @@ -1141,10 +1146,12 @@ static int dwc3_core_init(struct dwc3 *dwc) if (ret) goto err_exit_phy; - ret = dwc3_event_buffers_setup(dwc); - if (ret) { - dev_err(dwc->dev, "failed to setup event buffers\n"); - goto err_power_off_phy; + if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST) { + ret = dwc3_event_buffers_setup(dwc); + if (ret) { + dev_err(dwc->dev, "failed to setup event buffers\n"); + goto err_power_off_phy; + } } /* @@ -1958,7 +1965,10 @@ static int dwc3_probe(struct platform_device *pdev) err_exit_debugfs: dwc3_debugfs_exit(dwc); - dwc3_event_buffers_cleanup(dwc); + + if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST) + dwc3_event_buffers_cleanup(dwc); + dwc3_phy_power_off(dwc); dwc3_phy_exit(dwc); dwc3_ulpi_exit(dwc); -- 2.40.0