From nobody Sat Feb 7 09:58:58 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 689BA1E9B3A for ; Sat, 27 Dec 2025 00:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766796832; cv=none; b=BOXRdvfyuZz7GJEjE5jwvbME9e5uk8OEN3WfO86j4ltF7Efo+wepRXr+hVIPqWz5NuU5WT/EXaUL02hUvizAP/HEZM6DWtOnMnsK8BE63T0MXwyUoDsdLcb2L59ki0UQtO8pyoG+825lTktVraWW2p9mIC7WqKywOzA2AJMJxzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766796832; c=relaxed/simple; bh=yO5DAcUjBQX68ofPNIg3Y07ecCOxCD4cuKyrN6eAnIg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BrZPdY9XQa60BkoNOt3GCyZCEPNO9T9lMqFUfhDvNk66/xjk26lula1AZZjGj+76pfCNEwgVYEx0T1RYpsNgAtpLnpOvd1xytpJldCxbxvvMd2Lb72yhR+iycZXRfHbN0ufsPPdzzytnmpMjG2xFkAGQ5rKNmI2cLhP0Xhpl+Uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--royluo.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ylPGDwqV; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--royluo.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ylPGDwqV" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-34e70e2e363so16897045a91.1 for ; Fri, 26 Dec 2025 16:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766796830; x=1767401630; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LlaDIAdKGeeEE97V6RgS1GwSBK9EgzDYZZe0KxdpZdU=; b=ylPGDwqVHjTX+He83KUeRLnk1WCj7I8353OfRjo3YfKQmsjz5XTrsCivDixizLQYfE DqeteFi0jYewL5uVds4zzY8zZSld9gsbdO1bt5ICJz79pGPL5kt3xCQkLQ3VATFJi/7P uawPdTdqcCv8xDDSCTteoczmpADAyUW2JJQLnIGWPLwSFzoV2p50iqPweD3g/l5pjJo3 MUDMjx65iScg9IVAkPup1naTiGSbf9lSSEQ9hA0hKFNtzN+7WjvCt/Yx+10/ofR1lki+ TRCuL/a8s4mnyZBkQdsUQK0uH6gm+7j8Z4rg3aHK4F3+XB/BNCvf1Cifga3fnOvfUt/v hvoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766796830; x=1767401630; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LlaDIAdKGeeEE97V6RgS1GwSBK9EgzDYZZe0KxdpZdU=; b=UZ5Y6P3jJCEHr7kIgcMvrbMnaOINL3ujVSsJKOIwWnBGo5M9tbXtNpJBBWqrYF3B8V 1p7j4Y+TRCCMW8RM8oXyhY+5G49PGSAHB8z/8hmHsmb6AmM75+BPWK3PNeQKGhqp77uW wX/jObU3UPAxDlDxuQHU3pykqZMSyyxNtPZ2BoxjZ3CAsyI4eh1SKQvCIe6G5DZdLEcp 3dvM/IS9/mt3kkjrtN6GIqYTMwlfg0RtKDp/h8ATF9Bwq9zvFVGigBTWPipbFmiXreT2 yPKfygq9Fcja2sidAwHVbHS8q5Q5HLzs7UqenGh+zwJy9qe8Kpccw8LKs6h7VkR4yCQh QVUQ== X-Forwarded-Encrypted: i=1; AJvYcCUggf/JTlJyV+385cveEJjNtGeKBTB4cWIzzGj6ZU3Aji/oxyDl0dL70CbxIcrovXvvFGaX4DE5hpyUODw=@vger.kernel.org X-Gm-Message-State: AOJu0YyBLstNLycqSkE9/2/aDiaDLMOupP9qHaiC40CHBaA5n6SuEJkk dVhpWx+bJ9hx/gVwdlhPx7dJGT+4jUomJP9zESN8vYJkISja1/xzQAB11axV53MOb4y/FTN6DSX fojFuNA== X-Google-Smtp-Source: AGHT+IFdXmCN0u4mwRWY3qy77Zh8cuuoKlVEaOOUO4nfVPcIZQQ2y2aoetI8D8XkJwqZNnz/tP4uXOVy3WM= X-Received: from dlbcm20.prod.google.com ([2002:a05:7022:6894:b0:11d:cde5:d78e]) (user=royluo job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:f68e:b0:11a:641f:ba11 with SMTP id a92af1059eb24-121722eaec0mr21209839c88.29.1766796829667; Fri, 26 Dec 2025 16:53:49 -0800 (PST) Date: Sat, 27 Dec 2025 00:53:28 +0000 In-Reply-To: <20251227-phyb4-v10-0-e8caf6b93fe7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251227-phyb4-v10-0-e8caf6b93fe7@google.com> X-Developer-Key: i=royluo@google.com; a=ed25519; pk=nTq1n8WcJActRWe1s8jdcy+TzpTK4a+IYRCIWvQfq5k= X-Developer-Signature: v=1; a=ed25519-sha256; t=1766796826; l=5832; i=royluo@google.com; s=20251120; h=from:subject:message-id; bh=yO5DAcUjBQX68ofPNIg3Y07ecCOxCD4cuKyrN6eAnIg=; b=Y9mnKBfrv2Vcz5viNwaqvzFo0OcadQFfBlwicMDic3XcsdlvHf2j/Zc1UrCHcX4KE0QZ8RFVc tLvF/umZnhyAR7TNQ8DTLJ+IiLk5BiNX2R+QBBw43H3ZLBuu8ukVw1u X-Mailer: b4 0.14.2 Message-ID: <20251227-phyb4-v10-1-e8caf6b93fe7@google.com> Subject: [PATCH v10 1/2] dt-bindings: phy: google: Add Google Tensor G5 USB PHY From: Roy Luo To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Griffin , "=?utf-8?q?Andr=C3=A9_Draszik?=" , Tudor Ambarus , Philipp Zabel , Neil Armstrong Cc: Badhri Jagan Sridharan , Doug Anderson , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Joy Chakraborty , Naveen Kumar , Roy Luo , Krzysztof Kozlowski Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Document the device tree bindings for the USB PHY interfaces integrated with the DWC3 controller on Google Tensor SoCs, starting with G5 generation (Laguna). The USB PHY on Tensor G5 includes two integrated Synopsys PHY IPs: the eUSB 2.0 PHY IP and the USB 3.2/DisplayPort combo PHY IP. Due to a complete architectural overhaul in the Google Tensor G5, the existing Samsung/Exynos USB PHY binding for older generations of Google silicons such as gs101 are no longer compatible, necessitating this new device tree binding. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Roy Luo --- .../bindings/phy/google,lga-usb-phy.yaml | 133 +++++++++++++++++= ++++ MAINTAINERS | 1 + 2 files changed, 134 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml = b/Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml new file mode 100644 index 0000000000000000000000000000000000000000..427e2e3425f645f40c0813e29d6= efe4f62b20609 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml @@ -0,0 +1,133 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2025, Google LLC +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/google,lga-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Tensor Series G5 (Laguna) USB PHY + +maintainers: + - Roy Luo + +description: + Describes the USB PHY interfaces integrated with the DWC3 USB controller= on + Google Tensor SoCs, starting with the G5 generation (laguna). + Two specific PHY IPs from Synopsys are integrated, including eUSB 2.0 PH= Y IP + and USB3.2/DisplayPort combo PHY IP. + +properties: + compatible: + const: google,lga-usb-phy + + reg: + items: + - description: USB3.2/DisplayPort combo PHY core registers. + - description: USB3.2/DisplayPort combo PHY Type-C Assist registers. + - description: eUSB 2.0 PHY core registers. + - description: Top-level wrapper registers for the integrated PHYs. + + reg-names: + items: + - const: usb3_core + - const: usb3_tca + - const: usb2_core + - const: usbdp_top + + "#phy-cells": + description: | + The phandle's argument in the PHY specifier selects one of the three + following PHY interfaces. + - 0 for USB high-speed. + - 1 for USB super-speed. + - 2 for DisplayPort. + const: 1 + + clocks: + items: + - description: USB2 PHY clock. + - description: USB2 PHY APB clock. + - description: USB3.2/DisplayPort combo PHY clock. + - description: USB3.2/DisplayPort combo PHY firmware clock. + + clock-names: + items: + - const: usb2 + - const: usb2_apb + - const: usb3 + - const: usb3_fw + + resets: + items: + - description: USB2 PHY reset. + - description: USB2 PHY APB reset. + - description: USB3.2/DisplayPort combo PHY reset. + + reset-names: + items: + - const: usb2 + - const: usb2_apb + - const: usb3 + + power-domains: + maxItems: 1 + + orientation-switch: + type: boolean + description: + Indicates the PHY as a handler of USB Type-C orientation changes + + google,usb-cfg-csr: + description: + A phandle to a syscon node used to access the USB configuration + registers. These registers are the top-level wrapper of the USB + subsystem and provide control and status for the integrated USB + controller and USB PHY. + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to the syscon node. + - description: USB2 PHY configuration register offset. + +required: + - compatible + - reg + - reg-names + - "#phy-cells" + - clocks + - clock-names + - resets + - reset-names + - power-domains + - orientation-switch + - google,usb-cfg-csr + +additionalProperties: false + +examples: + - | + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + usb-phy@c410000 { + compatible =3D "google,lga-usb-phy"; + reg =3D <0 0x0c410000 0 0x20000>, + <0 0x0c430000 0 0x1000>, + <0 0x0c440000 0 0x10000>, + <0 0x0c637000 0 0xa0>; + reg-names =3D "usb3_core", "usb3_tca", "usb2_core", "usbdp_top= "; + #phy-cells =3D <1>; + clocks =3D <&hsion_usb2_phy_clk>, <&hsion_u2phy_apb_clk>, + <&hsion_usb3_phy_clk>, <&hsion_usb3_phy_fw_clk>; + clock-names =3D "usb2", "usb2_apb", "usb3", "usb3_fw"; + resets =3D <&hsion_resets_usb2_phy>, + <&hsion_resets_u2phy_apb>, + <&hsion_resets_usb3_phy>; + reset-names =3D "usb2", "usb2_apb", "usb3"; + power-domains =3D <&hsio_n_usb_pd>; + orientation-switch; + google,usb-cfg-csr =3D <&usb_cfg_csr 0x14>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index dc731d37c8feeff25613c59fe9c929927dadaa7e..faedcf6994e0be0c29c03dc424c= a86bc9a1bbd70 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10721,6 +10721,7 @@ S: Maintained P: Documentation/process/maintainer-soc-clean-dts.rst C: irc://irc.oftc.net/pixel6-kernel-dev F: Documentation/devicetree/bindings/clock/google,gs101-clock.yaml +F: Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml F: Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.= yaml F: arch/arm64/boot/dts/exynos/google/ F: drivers/clk/samsung/clk-gs101.c --=20 2.52.0.358.g0dd7633a29-goog From nobody Sat Feb 7 09:58:58 2026 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 437672253A1 for ; Sat, 27 Dec 2025 00:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766796835; cv=none; b=CxAIm2whb49MOGT8wa2d6TKo0b5tyRc2BAq3d2LlACQdIhz/Pbtgix1AAbkem2Un+w+JpdPsUMQbimlsK1OAM0Yml/leeK0RBpNeVzltgmMOKJO+7gW6YTPTzws/x+MKcnHb+3/QicmBlUcsx/uuAixQa2ves/C7qA9W7DFU9wE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766796835; c=relaxed/simple; bh=Q5SXXqBxPBUl+JV1mRuyOtPON0e8BKeGJC72RsaNL2I=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bHYnxmQWjdwBmx2b/NMW2QpYDwQZ6bi+cBSTqQ4bKK8tIb2RTdVLu9zCLW5opDMdwlL81bYtZFEc08/8mxpoius9aiaZACt8AJppWDw2gtZ2VXu9gKPJgtct7CayxzvvwmUqb3kR2XbbMwysj4G/sTG2GTgh+O8BKZHLi1bDoRM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--royluo.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=oBXBtZgw; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--royluo.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oBXBtZgw" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c0c7e0a8ac1so11524705a12.0 for ; Fri, 26 Dec 2025 16:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766796831; x=1767401631; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=imcuwF0JUlN4OspxFvUKhy2NCyFIaWBW487YqewJS3w=; b=oBXBtZgwAqBMfcA5kk7r3NG6g+nftOSc78NQ+7tjAy88Rb+TlOigehY+js9x9QL7wu 48gwai3qk0KJU5WfMFRE1NsjTBqgW2Plm/S2B6t0dzADdiXuf0TCmmvaPMoLfyVEISp1 MtRAX1AXeYXlzFBsKAHqmKVgqIB2doTzW/1IDLaqybPe2g7vzgaX9ZB5fNPvklCge0w+ gOW1+Ezit5h9ICWfbteWlDukK462wf09pJNRcRL4ow7Fmbxn4g4gIxOsmPORuyWy455n wFHjMNZ0NVhFCKD9PLQMYpQGj4piSr2FgD8Cl2m1sWQF6zhiRVdUAesc4Zwrfd3yMrju cMUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766796831; x=1767401631; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=imcuwF0JUlN4OspxFvUKhy2NCyFIaWBW487YqewJS3w=; b=tEMPGzmW0MYUNKunzrkHKLrYzNkDUq9JYYrqndqKhcUfywCxw/Yp4iUk1ppepkYNs3 vHQRFY85x6F9ViyU9fCq5YYIbCkqxUyKLFjzAhG3QyHsJ9+no04BwDgrHhME5+PQAclL coDj2I1c6bLmnHnSAsv7uA5ds9RlosgpT3aOZgkh3g4SAIp6RVFEEI8GicJkZ6DpxrNc SWiDbAa6hsSU0xj2IJeVSFOakH9udNJ4VBFlix7DcmxwN5gxIhq9QSySZIpPb0otrj1g RThSCI1QE7waasBpYfPlbbRM64LopRC8VSnRBE+sW0exulBIVOD4bTbUt7E39RfvfJUa ejzQ== X-Forwarded-Encrypted: i=1; AJvYcCUTamHbA89oKw3yh1ooiv63UjUnbFwGLB5H94auqL88AdiDZgE6jZHfCGuyoRHsg+DWUhX7wl2/BJIFs3A=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5J9rIVfI4dd4CRrHrzegRDVgqdCHp1xVUZwiXJaTa0lZgpJR5 /VKM6Abzg3ppIgjHsdMXguFny8FLWQjom9XzO/qS2IZs/yO6YiSLyKa6it3qXV5YAiSLA0iiw36 GXJckrA== X-Google-Smtp-Source: AGHT+IGy0NYsjSqfSY20rF06aXmXWh0DNWhjyzSD+Ty9D3mRax7bNY8RDRXwpW5ypRxibWuuFXtjthoHhiA= X-Received: from dlww9.prod.google.com ([2002:a05:7022:ea29:b0:11d:fd0d:f00f]) (user=royluo job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:6887:b0:11b:a892:80b4 with SMTP id a92af1059eb24-121721ab83amr29076221c88.5.1766796831481; Fri, 26 Dec 2025 16:53:51 -0800 (PST) Date: Sat, 27 Dec 2025 00:53:29 +0000 In-Reply-To: <20251227-phyb4-v10-0-e8caf6b93fe7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251227-phyb4-v10-0-e8caf6b93fe7@google.com> X-Developer-Key: i=royluo@google.com; a=ed25519; pk=nTq1n8WcJActRWe1s8jdcy+TzpTK4a+IYRCIWvQfq5k= X-Developer-Signature: v=1; a=ed25519-sha256; t=1766796826; l=12064; i=royluo@google.com; s=20251120; h=from:subject:message-id; bh=Q5SXXqBxPBUl+JV1mRuyOtPON0e8BKeGJC72RsaNL2I=; b=LviRio2A3aHLenK3RYCpmiwVtMO+0cAxKsaLFJCFcSw3hQUIea3n9BIP++GkzuOJPK80AgUTt BXWcwXA+KbXDc/Bp+D4eSCez9mKU2bWkKGDrrfgdkiwX6s0kJk+3TGG X-Mailer: b4 0.14.2 Message-ID: <20251227-phyb4-v10-2-e8caf6b93fe7@google.com> Subject: [PATCH v10 2/2] phy: Add Google Tensor SoC USB PHY driver From: Roy Luo To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Griffin , "=?utf-8?q?Andr=C3=A9_Draszik?=" , Tudor Ambarus , Philipp Zabel , Neil Armstrong Cc: Badhri Jagan Sridharan , Doug Anderson , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Joy Chakraborty , Naveen Kumar , Roy Luo Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Support the USB PHY found on Google Tensor G5 (Laguna). This particular USB PHY supports both high-speed and super-speed operations, and is integrated with the SNPS DWC3 controller that's also on the SoC. This initial patch specifically adds functionality for high-speed. Co-developed-by: Joy Chakraborty Signed-off-by: Joy Chakraborty Co-developed-by: Naveen Kumar Signed-off-by: Naveen Kumar Signed-off-by: Roy Luo --- MAINTAINERS | 1 + drivers/phy/Kconfig | 10 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-google-usb.c | 296 +++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 308 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index faedcf6994e0be0c29c03dc424ca86bc9a1bbd70..f220fbba72391ed8011e02d3e9c= 0dfe438c9d723 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10725,6 +10725,7 @@ F: Documentation/devicetree/bindings/phy/google,lga= -usb-phy.yaml F: Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.= yaml F: arch/arm64/boot/dts/exynos/google/ F: drivers/clk/samsung/clk-gs101.c +F: drivers/phy/phy-google-usb.c F: drivers/soc/samsung/gs101-pmu.c F: drivers/phy/samsung/phy-gs101-ufs.c F: include/dt-bindings/clock/google,gs101* diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 678dd0452f0aa0597773433f04d2a9ba77474d2a..07e71441dece2456423744a1cf9= 0fa4719b6288f 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -25,6 +25,16 @@ config GENERIC_PHY_MIPI_DPHY Provides a number of helpers a core functions for MIPI D-PHY drivers to us. =20 +config PHY_GOOGLE_USB + tristate "Google Tensor SoC USB PHY driver" + select GENERIC_PHY + help + Enable support for the USB PHY on Google Tensor SoCs, starting with + the G5 generation (Laguna). This driver provides the PHY interfaces + to interact with the SNPS eUSB2 and USB 3.2/DisplayPort Combo PHY, + both of which are integrated with the DWC3 USB DRD controller. + This driver currently supports USB high-speed. + config PHY_LPC18XX_USB_OTG tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver" depends on OF && (ARCH_LPC18XX || COMPILE_TEST) diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index bfb27fb5a494283d7fd05dd670ebd1b12df8b1a1..1d3a8333ce1512c2ec21012aacd= 75ddbbea81889 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_GENERIC_PHY) +=3D phy-core.o obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) +=3D phy-core-mipi-dphy.o obj-$(CONFIG_PHY_CAN_TRANSCEIVER) +=3D phy-can-transceiver.o +obj-$(CONFIG_PHY_GOOGLE_USB) +=3D phy-google-usb.o obj-$(CONFIG_PHY_LPC18XX_USB_OTG) +=3D phy-lpc18xx-usb-otg.o obj-$(CONFIG_PHY_XGENE) +=3D phy-xgene.o obj-$(CONFIG_PHY_PISTACHIO_USB) +=3D phy-pistachio-usb.o diff --git a/drivers/phy/phy-google-usb.c b/drivers/phy/phy-google-usb.c new file mode 100644 index 0000000000000000000000000000000000000000..ab20bc20f19eae2268ad62f9d8b= e4387f9bad92d --- /dev/null +++ b/drivers/phy/phy-google-usb.c @@ -0,0 +1,296 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * phy-google-usb.c - Google USB PHY driver + * + * Copyright (C) 2025, Google LLC + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define USBCS_USB2PHY_CFG19_OFFSET 0x0 +#define USBCS_USB2PHY_CFG19_PHY_CFG_PLL_FB_DIV GENMASK(19, 8) + +#define USBCS_USB2PHY_CFG21_OFFSET 0x8 +#define USBCS_USB2PHY_CFG21_PHY_ENABLE BIT(12) +#define USBCS_USB2PHY_CFG21_REF_FREQ_SEL GENMASK(15, 13) +#define USBCS_USB2PHY_CFG21_PHY_TX_DIG_BYPASS_SEL BIT(19) + +#define USBCS_PHY_CFG1_OFFSET 0x28 +#define USBCS_PHY_CFG1_SYS_VBUSVALID BIT(17) + +enum google_usb_phy_id { + GOOGLE_USB2_PHY, + GOOGLE_USB_PHY_NUM, +}; + +struct google_usb_phy_instance { + struct google_usb_phy *parent; + unsigned int index; + struct phy *phy; + unsigned int num_clks; + struct clk_bulk_data *clks; + unsigned int num_rsts; + struct reset_control_bulk_data *rsts; +}; + +struct google_usb_phy { + struct device *dev; + struct regmap *usb_cfg_regmap; + unsigned int usb2_cfg_offset; + void __iomem *usbdp_top_base; + struct google_usb_phy_instance *insts; + /* + * Protect phy registers from concurrent access, specifically via + * google_usb_set_orientation callback. + */ + struct mutex phy_mutex; + struct typec_switch_dev *sw; + enum typec_orientation orientation; +}; + +static void set_vbus_valid(struct google_usb_phy *gphy) +{ + u32 reg; + + if (gphy->orientation =3D=3D TYPEC_ORIENTATION_NONE) { + reg =3D readl(gphy->usbdp_top_base + USBCS_PHY_CFG1_OFFSET); + reg &=3D ~USBCS_PHY_CFG1_SYS_VBUSVALID; + writel(reg, gphy->usbdp_top_base + USBCS_PHY_CFG1_OFFSET); + } else { + reg =3D readl(gphy->usbdp_top_base + USBCS_PHY_CFG1_OFFSET); + reg |=3D USBCS_PHY_CFG1_SYS_VBUSVALID; + writel(reg, gphy->usbdp_top_base + USBCS_PHY_CFG1_OFFSET); + } +} + +static int google_usb_set_orientation(struct typec_switch_dev *sw, + enum typec_orientation orientation) +{ + struct google_usb_phy *gphy =3D typec_switch_get_drvdata(sw); + + dev_dbg(gphy->dev, "set orientation %d\n", orientation); + + gphy->orientation =3D orientation; + + if (pm_runtime_suspended(gphy->dev)) + return 0; + + guard(mutex)(&gphy->phy_mutex); + + set_vbus_valid(gphy); + + return 0; +} + +static int google_usb2_phy_init(struct phy *_phy) +{ + struct google_usb_phy_instance *inst =3D phy_get_drvdata(_phy); + struct google_usb_phy *gphy =3D inst->parent; + u32 reg; + int ret; + + dev_dbg(gphy->dev, "initializing usb2 phy\n"); + + guard(mutex)(&gphy->phy_mutex); + + regmap_read(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_C= FG21_OFFSET, ®); + reg &=3D ~USBCS_USB2PHY_CFG21_PHY_TX_DIG_BYPASS_SEL; + reg &=3D ~USBCS_USB2PHY_CFG21_REF_FREQ_SEL; + reg |=3D FIELD_PREP(USBCS_USB2PHY_CFG21_REF_FREQ_SEL, 0); + regmap_write(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_= CFG21_OFFSET, reg); + + regmap_read(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_C= FG19_OFFSET, ®); + reg &=3D ~USBCS_USB2PHY_CFG19_PHY_CFG_PLL_FB_DIV; + reg |=3D FIELD_PREP(USBCS_USB2PHY_CFG19_PHY_CFG_PLL_FB_DIV, 368); + regmap_write(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_= CFG19_OFFSET, reg); + + set_vbus_valid(gphy); + + ret =3D clk_bulk_prepare_enable(inst->num_clks, inst->clks); + if (ret) + return ret; + + ret =3D reset_control_bulk_deassert(inst->num_rsts, inst->rsts); + if (ret) { + clk_bulk_disable_unprepare(inst->num_clks, inst->clks); + return ret; + } + + regmap_read(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_C= FG21_OFFSET, ®); + reg |=3D USBCS_USB2PHY_CFG21_PHY_ENABLE; + regmap_write(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_= CFG21_OFFSET, reg); + + return 0; +} + +static int google_usb2_phy_exit(struct phy *_phy) +{ + struct google_usb_phy_instance *inst =3D phy_get_drvdata(_phy); + struct google_usb_phy *gphy =3D inst->parent; + u32 reg; + + dev_dbg(gphy->dev, "exiting usb2 phy\n"); + + guard(mutex)(&gphy->phy_mutex); + + regmap_read(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_C= FG21_OFFSET, ®); + reg &=3D ~USBCS_USB2PHY_CFG21_PHY_ENABLE; + regmap_write(gphy->usb_cfg_regmap, gphy->usb2_cfg_offset + USBCS_USB2PHY_= CFG21_OFFSET, reg); + + reset_control_bulk_assert(inst->num_rsts, inst->rsts); + clk_bulk_disable_unprepare(inst->num_clks, inst->clks); + + return 0; +} + +static const struct phy_ops google_usb2_phy_ops =3D { + .init =3D google_usb2_phy_init, + .exit =3D google_usb2_phy_exit, +}; + +static struct phy *google_usb_phy_xlate(struct device *dev, + const struct of_phandle_args *args) +{ + struct google_usb_phy *gphy =3D dev_get_drvdata(dev); + + if (args->args[0] >=3D GOOGLE_USB_PHY_NUM) { + dev_err(dev, "invalid PHY index requested from DT\n"); + return ERR_PTR(-ENODEV); + } + return gphy->insts[args->args[0]].phy; +} + +static int google_usb_phy_probe(struct platform_device *pdev) +{ + struct typec_switch_desc sw_desc =3D { }; + struct google_usb_phy_instance *inst; + struct phy_provider *phy_provider; + struct device *dev =3D &pdev->dev; + struct google_usb_phy *gphy; + struct phy *phy; + u32 args[1]; + int ret; + + gphy =3D devm_kzalloc(dev, sizeof(*gphy), GFP_KERNEL); + if (!gphy) + return -ENOMEM; + + dev_set_drvdata(dev, gphy); + gphy->dev =3D dev; + + ret =3D devm_mutex_init(dev, &gphy->phy_mutex); + if (ret) + return ret; + + gphy->usb_cfg_regmap =3D + syscon_regmap_lookup_by_phandle_args(dev->of_node, + "google,usb-cfg-csr", + ARRAY_SIZE(args), args); + if (IS_ERR(gphy->usb_cfg_regmap)) { + return dev_err_probe(dev, PTR_ERR(gphy->usb_cfg_regmap), + "invalid usb cfg csr\n"); + } + + gphy->usb2_cfg_offset =3D args[0]; + + gphy->usbdp_top_base =3D devm_platform_ioremap_resource_byname(pdev, + "usbdp_top"); + if (IS_ERR(gphy->usbdp_top_base)) + return dev_err_probe(dev, PTR_ERR(gphy->usbdp_top_base), + "invalid usbdp top\n"); + + gphy->insts =3D devm_kcalloc(dev, GOOGLE_USB_PHY_NUM, sizeof(*gphy->insts= ), GFP_KERNEL); + if (!gphy->insts) + return -ENOMEM; + + inst =3D &gphy->insts[GOOGLE_USB2_PHY]; + inst->parent =3D gphy; + inst->index =3D GOOGLE_USB2_PHY; + phy =3D devm_phy_create(dev, NULL, &google_usb2_phy_ops); + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), + "failed to create usb2 phy instance\n"); + inst->phy =3D phy; + phy_set_drvdata(phy, inst); + + inst->num_clks =3D 2; + inst->clks =3D devm_kcalloc(dev, inst->num_clks, sizeof(*inst->clks), GFP= _KERNEL); + if (!inst->clks) + return -ENOMEM; + inst->clks[0].id =3D "usb2"; + inst->clks[1].id =3D "usb2_apb"; + ret =3D devm_clk_bulk_get(dev, inst->num_clks, inst->clks); + if (ret) + return dev_err_probe(dev, ret, "failed to get u2 phy clks\n"); + + inst->num_rsts =3D 2; + inst->rsts =3D devm_kcalloc(dev, inst->num_rsts, sizeof(*inst->rsts), GFP= _KERNEL); + if (!inst->rsts) + return -ENOMEM; + inst->rsts[0].id =3D "usb2"; + inst->rsts[1].id =3D "usb2_apb"; + ret =3D devm_reset_control_bulk_get_exclusive(dev, inst->num_rsts, inst->= rsts); + if (ret) + return dev_err_probe(dev, ret, "failed to get u2 phy resets\n"); + + phy_provider =3D devm_of_phy_provider_register(dev, google_usb_phy_xlate); + if (IS_ERR(phy_provider)) + return dev_err_probe(dev, PTR_ERR(phy_provider), + "failed to register phy provider\n"); + + pm_runtime_enable(dev); + + sw_desc.fwnode =3D dev_fwnode(dev); + sw_desc.drvdata =3D gphy; + sw_desc.name =3D fwnode_get_name(dev_fwnode(dev)); + sw_desc.set =3D google_usb_set_orientation; + + gphy->sw =3D typec_switch_register(dev, &sw_desc); + if (IS_ERR(gphy->sw)) + return dev_err_probe(dev, PTR_ERR(gphy->sw), + "failed to register typec switch\n"); + + return 0; +} + +static void google_usb_phy_remove(struct platform_device *pdev) +{ + struct google_usb_phy *gphy =3D dev_get_drvdata(&pdev->dev); + + typec_switch_unregister(gphy->sw); + pm_runtime_disable(&pdev->dev); +} + +static const struct of_device_id google_usb_phy_of_match[] =3D { + { + .compatible =3D "google,lga-usb-phy", + }, + { } +}; +MODULE_DEVICE_TABLE(of, google_usb_phy_of_match); + +static struct platform_driver google_usb_phy =3D { + .probe =3D google_usb_phy_probe, + .remove =3D google_usb_phy_remove, + .driver =3D { + .name =3D "google-usb-phy", + .of_match_table =3D google_usb_phy_of_match, + } +}; + +module_platform_driver(google_usb_phy); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Google USB phy driver"); --=20 2.52.0.358.g0dd7633a29-goog