Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp369451rbe; Thu, 29 Feb 2024 01:51:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWT+Clvr4wo8D6y1Dr0meTS5xi7V+0AkhvNSEEmnJJpyuG3sfhbVq4m/eo8DKFluR7PWEiqZfjzd5nxHO1UsQK/Q2Byq0rF4HeenJ7+IA== X-Google-Smtp-Source: AGHT+IHfr8660Mv9Hs6eyzVAch6knoTe0MkK7/7L+JsGcDWndXVMlVhpq3r9tSrxDOI+o31hmOM2 X-Received: by 2002:a17:90a:8995:b0:299:d96f:9145 with SMTP id v21-20020a17090a899500b00299d96f9145mr1924553pjn.0.1709200264119; Thu, 29 Feb 2024 01:51:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709200264; cv=pass; d=google.com; s=arc-20160816; b=opBTfrrAxC6zQNbf2bOR27axzxYa6Nvvv3lhSJj4THU4F3k1jXDfJKT3lO0tZUb2DS hxBQ7x7KZty7R1ErXhWva1iZN5WydfPtwvKg+amxpHjsn40B7sMOm+pFxnuIYxM+oVbw BztVMbshj7hTJGP6DgEHkub3OcypfBSf+qS2HoB3vwMWxOeiPegs/cneLr9ES/2S3XHV V6umu7o/vr0Xv11eRwXdFRKHJBuCgKONirjhhYSe1xCRi7QQfbd9h/fbOJaIiKA/HY1J 42Y7wvyPIHsmegaBnWh928EyIAfoUZIEwDfpclCZWi+jK6BrGkzGWevSq9KUeahMGfmC FxWg== 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=x396/X2E2i0YmPyNUKjVLuhfNcsj+tCJwMzby2WqpTg=; fh=PtsvmqCM8YUnL7H6HhLAss7sj5iFelJGGh0AaYWbgrU=; b=AyL9POkSEy1BJcqF1SnG72pS5sDCq2h6mjsZFNqtnTbn2D7h532Y1vt9EaucLIgkD3 yPxtmnICLZAMKRlm/1zyaizGKPARf8mQccKaSP65Uy6BdoDcBy/jcwSpqVD3+TAxBpH1 cMlvZZntRHgZ9GeIYZZu+DjBAC0vLjlFL2dfMWNaV1kSi2oLb9u16oyX1RB6Rjtr8yet NO3hcOu6cDJh+bJljCzkWM8NbzhZ2cF3ggt+4Jo5VbtRbQfwu3yRc5cbYE7YMhceS1Tt cB2z5Hk/lgGRh1vOiMpq58BqDQ0CN+LhkLUQlI2Y2rt4OLHbPBVwY/IQ6kcImH4uK5Ax yJ9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UhfaqvoG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86473-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sm4-20020a17090b2e4400b00296fc31a361si1212828pjb.66.2024.02.29.01.51.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 01:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86473-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UhfaqvoG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86473-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86473-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1FF2A28805E for ; Thu, 29 Feb 2024 09:47:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D85C626A7; Thu, 29 Feb 2024 09:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UhfaqvoG" 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 AA2A75B5D2; Thu, 29 Feb 2024 09:47:11 +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=1709200031; cv=none; b=fs8D8uq0CDuFk8SfKP3PO/bATlH16iuKtnZm3aZbDUldPqD0jh7cqBY+10+qjv3J0befnjSONcvrrwAiDkG860pYlwVYO2cgC/V3aXLerXBeuPLFxXNit/AILNYpGCBe7vb9+dlAyaOCVy79RYi978zj3o9IjBwfLkqFyJ5P92M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709200031; c=relaxed/simple; bh=xc+qRjR0bWdnBIKs1iZ20uh/Wq/YWbOq3AIghhd6LfE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E8efQjdTdCNz3C2M4r211sZ9bkLV8lSQnyTSX6uSVeb1HkiOb+o1twUzdU1S4iXGilV2wTNH7VzqjddubK33HTdqhOY9P9Y5lJBzk3um22/lJMKme8DzrzxYpdI6rV7GruAlyh9WFRDGFocIHXXrLBHV7rGdhC9Hw2bn9pzNRC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UhfaqvoG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F596C433C7; Thu, 29 Feb 2024 09:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709200031; bh=xc+qRjR0bWdnBIKs1iZ20uh/Wq/YWbOq3AIghhd6LfE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UhfaqvoGfdj3afa6zQC7Y8B5MFpwLcInlkfwmi/p3rpe3opbROvbbdeKBjsUyyafR e4bq0ftGNcwoct8km6fPaK6Qy9VzQs0SNdoJoajf2GaQBYHojuJDJdj8Yi0+TRNExF beeI+ve9/2S981guPre8Ian9A20elKPZKV3qrmQjzyynmKR80aN68onGGsS3hLHeKp iiHyeBvB/zaSnqo1BRj4/xCd8H80Hk2EqYwDG70BrI6hL+UnD8o4a9q93rCnhjUh3f 3AkFmnJxe+T5kc/nHJijw9P0cfndWaxUgi6dIdzh4H3ejlByecFU1nS93Y5UxQs896 8b4hVH6vXduDQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rfd0Z-000000000me-15w5; Thu, 29 Feb 2024 10:47:19 +0100 Date: Thu, 29 Feb 2024 10:47:19 +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 v15 2/9] usb: dwc3: core: Access XHCI address space temporarily to read port info Message-ID: References: <20240216005756.762712-1-quic_kriskura@quicinc.com> <20240216005756.762712-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: <20240216005756.762712-3-quic_kriskura@quicinc.com> On Fri, Feb 16, 2024 at 06:27:49AM +0530, Krishna Kurapati wrote: > Currently Multiport DWC3 controllers are host-only capable. I already asked you to rephrase this so that it becomes clear that you are describing a property of the current hardware (and similar throughout the series): https://lore.kernel.org/all/ZTI7AtCJWgAnACSh@hovoldconsulting.com/ > +static int dwc3_read_port_info(struct dwc3 *dwc) > +{ > + void __iomem *base; > + u8 major_revision; > + u32 offset; > + u32 val; > + > + /* > + * Remap xHCI address space to access XHCI ext cap regs since it is > + * needed to get information on number of ports present. > + */ > + base = ioremap(dwc->xhci_resources[0].start, > + resource_size(&dwc->xhci_resources[0])); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + offset = 0; > + do { > + offset = xhci_find_next_ext_cap(base, offset, > + XHCI_EXT_CAPS_PROTOCOL); > + if (!offset) > + break; > + > + val = readl(base + offset); > + major_revision = XHCI_EXT_PORT_MAJOR(val); > + > + val = readl(base + offset + 0x08); > + if (major_revision == 0x03) { > + dwc->num_usb3_ports += XHCI_EXT_PORT_COUNT(val); > + } else if (major_revision <= 0x02) { > + dwc->num_usb2_ports += XHCI_EXT_PORT_COUNT(val); > + } else { > + dev_warn(dwc->dev, > + "unrecognized port major revision %d\n", I still think you should merge this with the previous line even if you end up with 83 chars. > + major_revision); > + } > + } while (1); > + /* > + * Currently only DWC3 controllers that are host-only capable > + * support Multiport. > + */ So again, also here, rephrase the comment so that it is clear that you are referring to a property of the current hardware. > + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); > + if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) { > + ret = dwc3_read_port_info(dwc); > + if (ret) > + goto err_disable_clks; > + } else { > + dwc->num_usb2_ports = 1; > + dwc->num_usb3_ports = 1; > + } Johan