Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp670740rdb; Thu, 8 Feb 2024 18:47:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPkwE1ZN7r7ur473ghdQVow8SdSrm5C/qCq+DcU5VGbBMEyZ+bKCge70YRS268QtETsHAO X-Received: by 2002:a17:906:710b:b0:a31:64d2:d0c2 with SMTP id x11-20020a170906710b00b00a3164d2d0c2mr123315ejj.10.1707446820795; Thu, 08 Feb 2024 18:47:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707446820; cv=pass; d=google.com; s=arc-20160816; b=zlM6qf84WfMfVaXskXLtVYakD41WgbxBAZGS+epmd1E2WvvF8rknH/XKTzpaAt6DES DOJbCbatgSEnzs6Hmzuy/32krArUDVuZrRJQzxzyNcdUjR8OtZq4+8BOb31ynRaN+G1S QF9oYrjFgs/igdAN2eU2jb+YPHlG+eTMZIdkQC20B9FOh1hd+lPVqcACTxWj2itYBleX 14zcIhwWTgQn57Clb3xwemX+JOQXL4yJDK0BMVbittpq9l62jVGIFjleJisRcyEMxq1v 5y/LwfuEQUx3CHysX5lJnsTsgMhbsFg8nIGEMOGikh3vsC9H0yBQBpaj+ZCZH3PnRFzS mGDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2YX5ZKTaVH4smcMzweyW9rG6g5zEtQgklv68MnyM68Y=; fh=yMKS1wizmazmm6XKjDCiBGiOnyY+1Csnzz8IK5kihaU=; b=S+llWMzMpJs9bRe0rMOub4SWjz7t+gezanwwZYwzixt96ZIAasUYIJlNgH7+fOF8s9 UCOaXJ3hn6zLsbqZCnEvvyQUG76AFCg7KSxUDInXIROb13TOu/MAeaaOnLAt0a9UZlDw RxFHDsJWvLG/xF3cBNyhZVs9sUdoJBX91+ZAiAJ3WloREm8x21jA0QFiM4m03PogS48C vi0IUZHB0tfCO+a6Lg2CB3ihW0jTmVXhCUMwWAqZW4vOWElc0usr6Q85l6meD+jyqd6+ J9vG2G/icdmBiyhue5sBjB9fVYwxpishSC/3X1kgSl3wnwK9PunrcGreZYdumcCjLwuV 0Ohw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WRLbXTwx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-58946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXxsCyzOobOt863DAI8gjEZauG3zOrFE/BWwalbm+rnG5iHVeuCUoLAdHpU234pOlhe8rOtb6YKep6wiOELD2KwT7+mYEGCZizEuxNnaw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kf19-20020a17090776d300b00a37624dd374si312283ejc.101.2024.02.08.18.47.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 18:47:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WRLbXTwx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-58946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id AFFA41F245FA for ; Fri, 9 Feb 2024 02:46:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 680FD2103; Fri, 9 Feb 2024 02:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WRLbXTwx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 87C221C27; Fri, 9 Feb 2024 02:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707446769; cv=none; b=LwXgQ+o67F72oqt743Sru4nnsdwfXob6yTXNN4OHU1GgoGcn6IxhfkUj/W01m2Ko0ie8i/g6WiPhu+x9X1nRK+aUB3+9MeVlW2p0aZjucSxKqXbdm3XHPPEK6auI7mKIFOk8YxiWaWantiWjTlNo9tgt+u/+Y/XlZ+bSzKgUhxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707446769; c=relaxed/simple; bh=+jDlR+fy0YI8uizn8b/8Ith4qzKH8NBzerA/is5ZlIo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BxsKb5DIvMwW5iVAMw+510/+JaoXd+Nl9mUycZEQU6zyFTOmLb8dEmR2bYtjRlrp0AWFcMK02wMRhLlbHcWF92TH4rrkLCCk0Pk9V8BTzCR5K4EVFf+23t+yxsjKfwHQaNtM2b5U0dcEqyq+8V/RarnVHhwqLsX/oTufFgTdV5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WRLbXTwx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C12BEC433F1; Fri, 9 Feb 2024 02:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707446769; bh=+jDlR+fy0YI8uizn8b/8Ith4qzKH8NBzerA/is5ZlIo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WRLbXTwxj1gUy2X+LJipT5mGbQlPhev7F0h9KX2r0On98CRXnyH7gf1+XdV1f7hxK mUWQ110dYj2RYfPs3HGMHOeZ9UCiykrF4ijlheE914WgspWiSl/WxPRmvV2lwbLLuO lPssFBTUmYebxMNNwQCJOWI+ZkJXBuG+BhYY6uI/z34I0mpLNliuN3Z46Kj0g3ien4 7JUgWWPs9wv3GI0aTTgRW+EuxUafNyOP4kW/Dq/r0XRZ1Qk76YmO/VXqPqrRgu/fMT QJGGbvA1cPVl5h9eRDoxjLpvT98kl54JuaevHeJlNxrHgfG9aQbHSvG6Zry+exko7C YivzToFlwvtPg== Date: Thu, 8 Feb 2024 20:46:05 -0600 From: Bjorn Andersson To: Krishna Kurapati Cc: Krzysztof Kozlowski , Rob Herring , Wesley Cheng , Konrad Dybcio , Greg Kroah-Hartman , Conor Dooley , Thinh Nguyen , Felipe Balbi , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_ppratap@quicinc.com, quic_jackp@quicinc.com, Johan Hovold , Johan Hovold Subject: Re: [PATCH v14 3/9] usb: dwc3: core: Skip setting event buffers for host only controllers Message-ID: References: <20240206051825.1038685-1-quic_kriskura@quicinc.com> <20240206051825.1038685-4-quic_kriskura@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; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240206051825.1038685-4-quic_kriskura@quicinc.com> On Tue, Feb 06, 2024 at 10:48:19AM +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 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 > Reviewed-by: Johan Hovold Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > 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 965eaad195fb..c47fec10b231 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.34.1 >