Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2391517lqt; Mon, 22 Apr 2024 09:23:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUg80jQ8bYkEPZKxXDKxYpoDjSMEsOf7ExtaW7KBvu3NJUxhLC0FKrxUhA/BG9K6V7yZt5DGmx24LoolJQwVXAebP6Eow20fhgrVngvsA== X-Google-Smtp-Source: AGHT+IHqj9Gxf7fl1WigVoFZrB0zCcROU0ehlSA9Da7ig7QVf0Cb8KDpdC8BsmJR2Ls1luQenGKL X-Received: by 2002:a17:903:584:b0:1e5:d083:c5b3 with SMTP id jv4-20020a170903058400b001e5d083c5b3mr11921754plb.5.1713803022173; Mon, 22 Apr 2024 09:23:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713803022; cv=pass; d=google.com; s=arc-20160816; b=Vb5qOjS8DfvYXsMGRzvoGmwo886HJyNZ9/u+Wql14LryBYzhDiJ3Vetv6wBKDmpOGj bo8ZVeIWWlTEGQThDvTmho6pzr6ZRBaV9NKpI8YfJL4gXUGRIuZhVySfYavFwMIgi9l4 dLqSF6YVu0D0rUlfsQdItBUPWvi8ZhOserN00FZawv1oEP50UNsZ4Yea+cIQqCqlk6qe Cs5ItrzHWLkf0ePZ1eNE+kL+GUKIJ0IRy0Ojqsobd+txQS4pUVU/fXUyv8kZnRAVicMF ZYFYcFmM2aWsMj/QaeH/DeFMg/XZdyP4a7NAZc5/vJm6oU8lcjYcl2qrvxsxjRBpwI9J /EYg== 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=UigiJGKVyD3hcdHo0QQp9u8trakpeRpp/X7RhI5AgA8=; fh=FeOwP1duDFt9BuMaZUehMqUcGCUd+LYKvvclTkqyM/A=; b=knsVYwIbbtcVd3qMylqvG+qq4fvaD4/+OYpAbd4Lc/Fbv0tdEZHhdxcHmUeleMATvj TkfatBqeJWHM5UepIAgOBeauXu5h9qdqYixkMx0dNpGhITV0Im0XmCc0EPakCCnQGs1H wir4TgrCSBKAvef5NQ6FEQ/HyGqXkgEyT0Vppdt5Rw+NFD0vDnwEeb/UIikQAkpHQjAr lVt/Y6KLGya+pnjYvbYefRuSwAg75sgxkItiF7aqG42OWcs7rBeLyOjJoxWjmWbIfRLs xVkVq5KeVELAIZjqUB5xzLDwedJQ9+LOZ5HgoI+82qqLkLIdoe4k247ESqw1bxiJ6MMD JGSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VwEfKmyw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-153699-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153699-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 g2-20020a6544c2000000b005dcbb6b4bffsi8200680pgs.335.2024.04.22.09.23.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:23:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153699-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=VwEfKmyw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-153699-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153699-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 75B71281FBD for ; Mon, 22 Apr 2024 16:22:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9E48153806; Mon, 22 Apr 2024 16:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VwEfKmyw" 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 B61D615380D; Mon, 22 Apr 2024 16:21:32 +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=1713802892; cv=none; b=igWZha/4Rk3FDo5xX1W6eiN6wRing8oQat9YOsQiAIBjlKAttal4GNZKWkqoTBHt6uzb1zicP0pa70KAQRA+d5ryDIFO4t7QPsJTO7XR2E4KZ0jbv4FNxUarRVyfeOBDztyR35zE0StFZg9bK6Wi9nz5y7a13tKyGv9Vt0nXDjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713802892; c=relaxed/simple; bh=AFRCwPy48IRqorUVwWw91pu04QMTojwYvcp8gaaxSg0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jr6hPJB5WIaBsDwOFzistBZ41OAbrHnJ7ObIx7uexNwHVgDWRuJYzLF7kcgcU61dPnrEkMALNEwGewW1wJv93EUU/YyfCdipGwWe30yDUG7p2Waet5u0AQqR/U2yC7mgqgIC/LckoywhoE0dVQ+sz3ECby2Qt/yPoBLPdR/G68o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VwEfKmyw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7896C113CC; Mon, 22 Apr 2024 16:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713802892; bh=AFRCwPy48IRqorUVwWw91pu04QMTojwYvcp8gaaxSg0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VwEfKmyw82HsaUL37rAvvwNItHpyNTg1GIg4F221ja1a+s0OhbrcRDX70Jgm16kUT vtLXqqSOky87PY/5F8n6SXjoV5HGzkM+gVF9EiYx38t93a9DukxQ3vyTS++Bn9KNPw thg1unZuJLGivIPRQ3096RmQEAcje2tsQR0dbzo7oba/aEc3aYY2YQBu1Uy6d1n8W+ kZSQUT8H2NdxkoO3JG0MnoLT0arPg2iP/nF1/Dz4Bl+h12ceknFXltsMdXLuvDels/ aTeU6Jyjs7+jjtEinE1t5/3zVhFqRJ4OJSrr3WPxtFAoitQtxlDOD+GCjfLypqx1V4 P7GRQ6DfgwGyw== Date: Mon, 22 Apr 2024 17:21:26 +0100 From: Conor Dooley To: Inochi Amaoto Cc: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Jisheng Zhang , Liu Gui , Jingbao Qiu , dlan@gentoo.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH 1/2] dt-bindings: phy: Add Sophgo CV1800 USB phy Message-ID: <20240422-folic-obtuse-570b1747e7b9@spud> References: <20240419-harmful-neutron-d0db367cf659@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zBWc+J/izNiVp8j0" Content-Disposition: inline In-Reply-To: --zBWc+J/izNiVp8j0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 20, 2024 at 09:39:18AM +0800, Inochi Amaoto wrote: > On Fri, Apr 19, 2024 at 03:26:53PM GMT, Conor Dooley wrote: > > On Fri, Apr 12, 2024 at 03:22:24PM +0800, Inochi Amaoto wrote: > > > The USB phy of Sophgo CV18XX series SoC needs to sense a pin called > > > "VBUS_DET" to get the right operation mode. If this pin is not > > > connected, it only supports setting the mode manually. > > >=20 > > > Add USB phy bindings for Sophgo CV18XX/SG200X series SoC. > > >=20 > > > Signed-off-by: Inochi Amaoto > > > --- > > > .../bindings/phy/sophgo,cv1800-usb-phy.yaml | 90 +++++++++++++++++= ++ > > > 1 file changed, 90 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/phy/sophgo,cv18= 00-usb-phy.yaml > > >=20 > > > diff --git a/Documentation/devicetree/bindings/phy/sophgo,cv1800-usb-= phy.yaml b/Documentation/devicetree/bindings/phy/sophgo,cv1800-usb-phy.yaml > > > new file mode 100644 > > > index 000000000000..cb394ac5d8c4 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/phy/sophgo,cv1800-usb-phy.yaml > > > @@ -0,0 +1,90 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/phy/sophgo,cv1800-usb-phy.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: Sophgo CV18XX/SG200X USB 2.0 PHY > > > + > > > +maintainers: > > > + - Inochi Amaoto > > > + > > > +properties: > > > + compatible: > > > + const: sophgo,cv1800-usb-phy > > > + > > > + reg: > > > + maxItems: 1 > > > + > > > + "#phy-cells": > > > + const: 0 > > > + > > > + clocks: > > > + items: > > > + - description: PHY clock > > > + - description: PHY app clock > > > + - description: PHY stb clock > > > + - description: PHY lpm clock > > > + > > > + clock-names: > > > + items: > > > + - const: phy > > > + - const: app > > > + - const: stb > > > + - const: lpm > > > + > > > + dr_mode: > > > + description: PHY device mode when initing. > >=20 > > "initing" isn't a word, "initialising" is the correct word. Or > > "initializing" if you speak American. But if it is just the value during > > initialisation, why do we need to know - we can just overwrite it in > > software, right? > >=20 > > Are you sure that this is limited to initialisation? I would have > > thought that it describes the configuration that the board is in, and is > > a fixed property of the system? > >=20 > > > + enum: [host, peripheral, otg] > >=20 > > Rob, I know this is a phy rather than a controller, so referencing > > usb-drd.yaml doesn't really make sense, but there are several PHYs using > > dr_mode so it feels like there should be something to reference here > > rather than defining the property anew. > >=20 >=20 > Yes, you are right. Using dr_mode in initialisation is not necessary. > We can just let it go and using the default mode. In fact, for most > boards with this SoC, host mode is just enough. And it is just easy=20 > to overwrite the mode value in the driver if we want another mode.=20 > For the OTG, it can just check the `vbus_det-gpios`. I will remove=20 > this property, thanks. Just to be clear, it's valid to have a dr_mode property in cases that you cannot detect what the mode is dynamically. What I was questioning was the wording about only valid for init. > > > + vbus_det-gpios: > > > + description: GPIO to the USB OTG VBUS detect pin. This should no= t be > > > + defined if vbus_det gpio and switch gpio are connected. > >=20 > > I don't understand the second sentence here. Ah, with your explanation below I now understand what you mean here. I think this needs to be re-written - I think it would be easier to understand with s/gpio/pin/ in the second line. > > > + maxItems: 1 > > > + > > > + sophgo,switch-gpios: > > > + description: GPIO for the phy to control connected switch. > > > + maxItems: 2 > >=20 > > You've got two items here, they should be described. /But/ the property > > above says "switch gpio", which is singular. Which is it? > >=20 >=20 > `switch-gpios` is gpios to controll USB switch connected to the > phy. Sophgo recommends that phy use a switch to separate device > port and host port if it supports both. I know this is weird, > but many board follows this design, such as Huashan PI and=20 > Milkv Duo S. As for item number, it is just an array of gpios > to process one by one, I mark it as two just because Milkv=20 > Duo S use two gpios to controll the USB switch. Right, but what I'm looking for is a description for what each GPIO does, so that someone can know how the dts should be written. > For vbus_det gpio description, There is because the design of=20 > Milk-v Duo S, which connect the switch gpio and VBUS detect=20 > gpio. In this case the OTG function is broken and we can just=20 > change the mode by toggling switch gpios. So I suggest not=20 > defining this property. Okay. See my comment on it above. Thanks, Conor. --zBWc+J/izNiVp8j0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZiaOhgAKCRB4tDGHoIJi 0q3VAQCrGsXppmUynfWM7SA2AFjgkUzDreJrN1u78Q9BRRDXjgD/c6kSQbgAQB85 O/F2pHE5G5vYsnXHPejmMURPSVfkmQ4= =AGnu -----END PGP SIGNATURE----- --zBWc+J/izNiVp8j0--