Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp642010rwl; Wed, 5 Apr 2023 06:00:31 -0700 (PDT) X-Google-Smtp-Source: AKy350afZnAi9zS8ADnXmsUDyzYmFNCYKnGv/fVaTQmbuh3QGpKdmYGU359cgrKc1ZC76ZcjRSYH X-Received: by 2002:a17:906:35d8:b0:88d:ba89:1837 with SMTP id p24-20020a17090635d800b0088dba891837mr2252083ejb.8.1680699630889; Wed, 05 Apr 2023 06:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680699630; cv=none; d=google.com; s=arc-20160816; b=bciit0iPv6xeIzCItAlNrpgBCyYTAOeKn9dyg+GjGIc+RNdkOPZL6ZQEa0mIdl5n7P XvezgVGdEiR2N3b/W2RIvhfro2nU6sPjeylgQJi15b1vQYa7iKdjkdLcrPwTIoPJgj/x v1qQwwVFGwoff18zS6UHZSVLbwo1ZoWsK8oRdBIWa4687s97MpIq9EOOZ8yFRUNXJ5jY mq4Uz3Cx8MmYZ976diKg6qoqDpZHEYJYSgs0Ej5nq25GZXuCwYMlanqj2S42pT+1KTn6 aGoxKTWlnXbINU1k5/J2fOXeblXkYyMDtg/K+dQzamFqnRJDvQDSIjf4ofxKWWpTwHtJ i/Dw== 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=lY5SWbXTZbHga92Nc/RFPY6MGhTnq0qvDaUfk3nkSg8=; b=jQcYsTxQHzlj0j+ipolbIpFFt2X6u34zLc2JRJY8D7CoTLk6QucJ0+Usf1MISDllVr ajx8R3ijVQdozp/MHgtibD67JbMbqgtEQka9n6T8JOnOv0CvaY1tR95pu/ytY6xQvNn8 2OgZRiMFLgSHG1HOjTwA1pT+eo6V0HlQNaE3ppRRlQBkxFHTSjSitcpzicZfQUTsd5qW 2Z27A0Q0z0GbFfPbxVH2isLyIyk9IyHiDulrs199Ec4xXDe4G+Sirkq/QfoP2gLM4VhH IEpH7gz4dPQXzfTDhw/08az61KPANynzrQIJ0goDhwLA856QFqfn/bhy3bty5RFK9ARe kspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OWxHuX9a; 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 rl16-20020a170907217000b008cdf4a9c9a1si4134706ejb.622.2023.04.05.06.00.02; Wed, 05 Apr 2023 06:00:30 -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=OWxHuX9a; 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 S238032AbjDEM7O (ORCPT + 99 others); Wed, 5 Apr 2023 08:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238110AbjDEM7K (ORCPT ); Wed, 5 Apr 2023 08:59:10 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F2A45FFC; Wed, 5 Apr 2023 05:58:53 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3359c5ff017586; Wed, 5 Apr 2023 12:58:45 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=lY5SWbXTZbHga92Nc/RFPY6MGhTnq0qvDaUfk3nkSg8=; b=OWxHuX9a9hVbwI/NbwL8uVFeEFdW4wWhhPu3X5VkSWfXBUJPPJTkqADTdWG1Zo662D77 esXzl5t9b11g5x9e9s1RB/xuCi/ZAMuwXSWD6GVd9WEkruG6NAtq6NfdWDXNPIh6kMZq IHt9Lgl46wQVckwyG9ILhLtiiR10S+qIb5hsJGrvRdbcDHUl5Xp8IDeFs1AdmB6KRFLn uLGijfUXVw/ai0zrRKTKyE08v0e5p06PQYmmtjenonsRxzZQl8S5BtCw3Vi4Yq3s//y9 dtwDy2qAC0CXsjXFRX+2kC9Ze883g2Y/HTMil2gn3ez5xNAVoDinLlmbKU+1dsdyAEEa +g== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3prwc79gn4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 12:58:45 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 335CwiD3016466 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 5 Apr 2023 12:58:44 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; Wed, 5 Apr 2023 05:58:38 -0700 From: Krishna Kurapati To: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , "Andy Gross" , Bjorn Andersson , "Konrad Dybcio" , Rob Herring , Krzysztof Kozlowski CC: , , , , , , , , , , , Krishna Kurapati Subject: [PATCH v6 3/8] usb: dwc3: core: Skip setting event buffers for host only controllers Date: Wed, 5 Apr 2023 18:27:54 +0530 Message-ID: <20230405125759.4201-4-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405125759.4201-1-quic_kriskura@quicinc.com> References: <20230405125759.4201-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: D6DHpjeo6yqjmQj-d8XdPi6J6ma1WXjF X-Proofpoint-ORIG-GUID: D6DHpjeo6yqjmQj-d8XdPi6J6ma1WXjF 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-04-05_08,2023-04-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=879 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050117 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 --- Link to v5: https://lore.kernel.org/all/20230310163420.7582-4-quic_kriskura@quicinc.com/ drivers/usb/dwc3/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 567ae79389a1..2964bcaa0a27 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -839,7 +839,11 @@ 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); usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1); @@ -1176,10 +1180,12 @@ static int dwc3_core_init(struct dwc3 *dwc) if (ret < 0) goto err3; - ret = dwc3_event_buffers_setup(dwc); - if (ret) { - dev_err(dwc->dev, "failed to setup event buffers\n"); - goto err4; + 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 err4; + } } /* @@ -2002,7 +2008,9 @@ static int dwc3_probe(struct platform_device *pdev) err5: dwc3_debugfs_exit(dwc); - dwc3_event_buffers_cleanup(dwc); + + if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST) + dwc3_event_buffers_cleanup(dwc); usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1); -- 2.40.0