Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2749770lqp; Mon, 25 Mar 2024 08:14:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTd8LqusSZWhp2O8jknk/46hR5oH2dY3kmSlzN1r3UrGJSGg+Yql/AZK8dCLM4C8yuzwMu+hrZiRt5FnDMFIdrPqpUjCnQe7h9WXhWjA== X-Google-Smtp-Source: AGHT+IE1XBKtE5+cBXq+KfU+Vev3OdtrUlTct6xUTSfkScRVPbk8cKJ/iY70lCBK0iesOYxMG9m5 X-Received: by 2002:a17:906:1401:b0:a47:398f:1a06 with SMTP id p1-20020a170906140100b00a47398f1a06mr4936561ejc.1.1711379654352; Mon, 25 Mar 2024 08:14:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711379654; cv=pass; d=google.com; s=arc-20160816; b=MxCA0guB06Zb/f/IAitmml+3VsDpTml7ERMJLQ5FvrSrrzYhQaL2pVNGjT5Ua9nyjq IJVXI/CSgtdcZvtyVFw52xKNmyoaX/FXNBZxSYwvI2vLFllgnJaBUr7qZvLxIp5e8ZvR tC6/wwqa8QKkiV8d+262v6U2alAhWgAMPKrKvbMAcxn8E+B1HvYVit/6o5d3Mt5D8FKC zF16zkoK7vQHQlMAPvZ8yKV0gZ5VACKHh3GmPIQfZybNEYlZ5e3TZ71DmR/42hCM4gqU 9Evc7tumJaQiAzFPbeX3FlqA8CZov9Ai5O5BCgwNeW0ldU8F0qoXDtpRycMw2AR71Zzs SE/g== 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=HVJc4zLXXT6mr/pVm1P6Zqv9fsqHO9uccYMMnYirCSM=; fh=PtsvmqCM8YUnL7H6HhLAss7sj5iFelJGGh0AaYWbgrU=; b=lR52MdJBqHb9IZlaES0JN9gUdtWBdmigtBYXsa/ynmqIlYRWKNKGDhZbRkcxqkUSSO D3WEbJkpJ2Rq/9qTe5EwztQF99sN+9AdAgUy3aSalpLCZJCSMQxwlDiTsPz14z69+OlX coM21b/o5Cd34DWk8y5ayxzd5QOv4O4iUEvMVBq3hEbXXzZlXbzEiZIv1r8qrsjKM2/O pNz5Xddmv109KqAxS9o0F9Wb7Wa3X+salbGyTHKmvU/jW+kJf+O5AWVKie3ly1gOE0j8 p6wEAvaJbbM+eJlx3aevHPuz1+sTsgJyPuCi46c4FLvnEA4TQ9rYtaRvEmmXgzZQR45h CFuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u4nlOKDq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117002-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dp1-20020a170906c14100b00a43fd9e16a4si2631747ejc.17.2024.03.25.08.14.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117002-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=u4nlOKDq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117002-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117002-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 0EF9E1F6321A for ; Mon, 25 Mar 2024 15:14:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B27E127B56; Mon, 25 Mar 2024 12:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u4nlOKDq" 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 5A23686640; Mon, 25 Mar 2024 12:31:07 +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=1711369867; cv=none; b=TmHt2Mm4fOx0anpW/XCtrt27b3hrFYvjTwlhtaLha1UKLwY0BXxZ7tPPRyGFmcUhH3XCx9qfNr7uzqoMxIx68t+fM3HwWozOnAfMvgpvxLjI6yYNjli0/A2enISVEl/KOKD060Hat3Yt5g7PCI0Aum2aN056YWBScd5EMjzrsOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711369867; c=relaxed/simple; bh=zUJo6272FnK84jmyw4NnOmR4XYdb9pIOT23e/3uwzOc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Gt1Yt6gAoZwwqQapZYPJfFg/t02hxpFszr3fZxkco2StE1KHzkg8gDFwXV8GaDn8R0O0u1mnuhKILw+BiCSmsZXyy2xGyJP/ACHSgPMh/2nO/YdM/UlaztBTu4mgzJIxVXaftJmx9b42XE18V4m9HvbY6rgDXVlmKBBitXA3wpU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u4nlOKDq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F5EC433F1; Mon, 25 Mar 2024 12:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711369866; bh=zUJo6272FnK84jmyw4NnOmR4XYdb9pIOT23e/3uwzOc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u4nlOKDquaafKy61MH0lk5iXUXr8eqGXSPQWJh9ekyP8FxbcUD1zo79mJK5m2HmUE qbktwDhqeSxwO4aO8kFWEzNsmHi31FEGZG5w8+JjZA4XpQ+c2Acnuz5rEmiw381bTt hhpJiuH+3eme/Hjt2esaB18vrXiN9zZpbnmZ0zu9iHvFS5nJyUG2OHCBYRvUZFxcKJ jgTZmJqkfyUwKnmqpGWpySkGxB+H3bun9VDqfRk3SrE+DqqU2hjG4qsXH7wveLQMl0 nLOGIi6nzebFCPOVi9OdwJIHrBqW49VMik3PCom09jHK7oRVG9DX2VHxmVt2xXixWo TkDtDiPK5OVUg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rojTt-000000001R6-39hs; Mon, 25 Mar 2024 13:31:13 +0100 Date: Mon, 25 Mar 2024 13:31:13 +0100 From: Johan Hovold To: Krishna Kurapati Cc: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , 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 Subject: Re: [PATCH v16 2/9] usb: dwc3: core: Access XHCI address space temporarily to read port info Message-ID: References: <20240307062052.2319851-1-quic_kriskura@quicinc.com> <20240307062052.2319851-3-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: <20240307062052.2319851-3-quic_kriskura@quicinc.com> On Thu, Mar 07, 2024 at 11:50:45AM +0530, Krishna Kurapati wrote: > All DWC3 Multi Port controllers that exist today only support host mode. > Temporarily map XHCI address space for host-only controllers and parse > XHCI Extended Capabilities registers to read number of usb2 ports and > usb3 ports present on multiport controller. Each USB Port is at least HS > capable. > > The port info for usb2 and usb3 phy are identified as num_usb2_ports > and num_usb3_ports. The intention is as follows: > > Wherever we need to perform phy operations like: > > LOOP_OVER_NUMBER_OF_AVAILABLE_PORTS() > { > phy_set_mode(dwc->usb2_generic_phy[i], PHY_MODE_USB_HOST); > phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST); > } > > If number of usb2 ports is 3, loop can go from index 0-2 for > usb2_generic_phy. If number of usb3-ports is 2, we don't know for sure, > if the first 2 ports are SS capable or some other ports like (2 and 3) > are SS capable. So instead, num_usb2_ports is used to loop around all > phy's (both hs and ss) for performing phy operations. If any > usb3_generic_phy turns out to be NULL, phy operation just bails out. > num_usb3_ports is used to modify GUSB3PIPECTL registers while setting up > phy's as we need to know how many SS capable ports are there for this. > > Signed-off-by: Krishna Kurapati Reviewed-by: Johan Hovold