Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp593262rwd; Tue, 16 May 2023 05:32:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4gcEzMqv4ZzbCdoeo1jk4PB6BPGTysEXV32WiAZF9O8Wwwf7Gz/W1DBGRyhZqqhukfpEFl X-Received: by 2002:a17:90a:d252:b0:250:1d63:3227 with SMTP id o18-20020a17090ad25200b002501d633227mr36919975pjw.10.1684240340629; Tue, 16 May 2023 05:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684240340; cv=none; d=google.com; s=arc-20160816; b=PB4R7T/1pKjQvzFQb03mRm6Hr8tdycn0nzHT+BPLhih4U2OOHEJsbCPLuAttsn9419 yjvrnZK17nbkvtOXkDwucmLaBvQFuQtWO9FmJnY4P+Y3wqGkZYPSOnNqGdTYfgfU2ZYu V73G6Pq/wv2KOY22tmMIvmNYccm+9q4R3RzOXcofBKbDn20AIn5e6IMRPtAf0KjT7F+T 6SQ4eo1dUHt3ehRLNcJjgES15olLlEd94Odd3XgIPrirlc/N7PMSgIttTsnlm5hNKZwc 1H8s2qYlkUj99QhrPxCgjprputmfY6D+355l/37XSS8VC9bhkN9Qh9jMWos5tNXyWgPa EfzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=b3lgHFBS0wL5LvDInTRZ7v8BtOtMresqkA/jbQJItQw=; b=BQVZEJMEIfXyPEpfQPcI269IIZlMhGGi+Lmfkc9xtIB/qISZ2U2ms/RQQar6JcMwmf 78zyhfBhIB+bnzfwuvpC146MI7jh7f05bJXnTLYOO2ysmvGdB+SaxWHgJdLkm9A1s7MG ZTR6i+273xUG1eRze3yrSDKewb++Et4D77z0C8WYUGIbLwI8VizD+ymhEPvZ66b3c3Au 3yujx0RfbXc4ZPqNL5q5oeAFcR2ishV1LjQ2sq1b4y6GX1szuTBBFWBvg/qYtsLW8ytz NnZVBqqn2QWVnqa3mhUeIc75X/Y23vRaCG7QMF55RYT0a7MpfcPpSYToGFdX1YFrpY4W v4Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PC2dFqdc; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g66-20020a636b45000000b0052c9e5561ebsi17780361pgc.821.2023.05.16.05.32.05; Tue, 16 May 2023 05:32:20 -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=@kernel.org header.s=k20201202 header.b=PC2dFqdc; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbjEPMRe (ORCPT + 99 others); Tue, 16 May 2023 08:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbjEPMRd (ORCPT ); Tue, 16 May 2023 08:17:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6438D4698; Tue, 16 May 2023 05:17:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EAA5460F5A; Tue, 16 May 2023 12:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BE48C433EF; Tue, 16 May 2023 12:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684239451; bh=FUya8l0e9W9RYjyU+HM+cs83+DOnaPciCuvV7VzRtTY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PC2dFqdc1Z/sdXZ5oYa4dBdtDdnVirjaldQ/c52s9XJSgc+dL6PzDhDqFcp2t3h8s zYfoMkYN/25F07KizBYjudULLyvUqwGH4yudmVo1ypcJJouV1/5+Mg4MeS5B8lMkD0 hQFQoQIq+YgyjIykKOhLxfIocaQC41WOqBWGXbhiVLWe6fe28VCP3WdVWmpSQCjDGZ 4aUtJ+q5C2ZDupcuSwaDldLY/u4MQlQ0TzGZBRKjwKENXZiV02g38rH23LqSunEk2C ZcPR/87t5GlnvCLL0uv1alI+o744JmEyXHD56IECx3oXhz5KtTzRNFnXlUcJFOS1/L +dh0MXsyQXSYg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pytcR-0008TQ-5q; Tue, 16 May 2023 14:17:31 +0200 Date: Tue, 16 May 2023 14:17:31 +0200 From: Johan Hovold To: Krishna Kurapati Cc: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_wcheng@quicinc.com, quic_jackp@quicinc.com, quic_harshq@quicinc.com, ahalaney@redhat.com Subject: Re: [PATCH v8 4/9] usb: dwc3: core: Skip setting event buffers for host only controllers Message-ID: References: <20230514054917.21318-1-quic_kriskura@quicinc.com> <20230514054917.21318-5-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230514054917.21318-5-quic_kriskura@quicinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Sun, May 14, 2023 at 11:19:12AM +0530, Krishna Kurapati wrote: > 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 | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index e983aef1fb93..46192d08d1b6 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -505,6 +505,11 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length) > int dwc3_event_buffers_setup(struct dwc3 *dwc) > { > struct dwc3_event_buffer *evt; > + unsigned int hw_mode; > + > + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); > + if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) > + return 0; > > evt = dwc->ev_buf; How about adding this check to dwc3_alloc_event_buffers() instead as there should be no need to allocate buffer that you never use? Then you can just check dwc->ev_buf here and elsewhere. Johan