From patchwork Fri Mar 21 13:58:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 876109 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 5935478F47; Fri, 21 Mar 2025 13:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565543; cv=none; b=fHgQDL5TvblVi/0q3L/DP5+ht8TnLTwl/ozNjXBzqfcF7T8n5yub4EytkZwSlRWLgAguYVc/6pcmWDbuF/D/XEZ5TLxfb4zRFRC9TI1xGLwLDhiowZ0VSKCj236FniAbwhErobCyRXmabXetJ3GBc1l3P4T+XSayiwRUuh0TZ0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565543; c=relaxed/simple; bh=x8ajurCf6ZvLIBQzFoAafPLIC4tfA+qOVsXwL5R+C/Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PP/ibHDtJLVPB3vcPfzleyeR4idSPujs3ZKo4Atez+IzcBoHxe2cSPDIPWUcce+66N9d7tYBsR2OeS0cKcIOEYpiwI5ipHd5U6pEPP1T3hVrqHbqgpxhMkDNiZYB4d68rQ5mWztSWLZT5FU/uA1aRe02UqKqo2XVDhqnYgGzGxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RsvCvtcM; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RsvCvtcM" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3914a5def6bso1234429f8f.1; Fri, 21 Mar 2025 06:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565539; x=1743170339; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bHKxmG8ByngkXQTkMpyDFQIrJdv7U/tLvQeFlUSDHEw=; b=RsvCvtcM59y4LP5atzhUXa7ki3jQp9uZCPUncVbmyxXhAZqyOmGD2SS/CVdLj0XI2Y zzMvRZrtXfXViRyMF0qoduAAOdQfYXEdmUvKJgfxYpgEWR3SCZ3wCmISV7+GHLR7nrHT 1js/3IBS9/VaX91Fi24/3KQ6u+A5mIwCl+rNPOskgdxThGM2pjKOcfqPOIsEbtlZzDVH Y4pfAJyZhwXXImD7xe6O+lPQ39Hxr3/yc4Q0OSrgqSOtL8irMhjvCTVLBBIErrQxR7Op vQVO/IkSS0waCM2CH8c/MOLtH6uCbJwzFyApweV6Qs5jvtJuUzdPDfrAKDKnfWek603f C1OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565539; x=1743170339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bHKxmG8ByngkXQTkMpyDFQIrJdv7U/tLvQeFlUSDHEw=; b=O795l1EEEhDQGUXojI8aRkZbT2L48pMxa/IW2Kt1Av1f4BE3ZvrcE1EHV4y1t47WII HwlevEjbWyuT+v1SvFFD3SKywxdlagpsGDOHG9XwKXfwnGxn/BHKuPCABXi2bn4dbewu V7Zvh4noBjUivVSv1ZSntatj0zrqreOwzRc//dfYLbPEOHpvjqA6cCf2yG2PRrpFEbF7 A9O9FGl/PKCQ6xml6KacYTya+fK0K5QBj6wYP3LuiEEnZQcoFzYT17CRB4lV1j4hdRPX hwWUAd76gtlWJ5le25Gmmk4s5rmPcht0rbomLWTr+ED82xc1TmmbVhHDs2zElBjzfxsj NEoQ== X-Forwarded-Encrypted: i=1; AJvYcCVGpFT25JNFMvkMPopCJEaKPfia1BKcWlPb/BBTifNy81ve769FmlVyxDhJqGmGMg0JT0tRDBvoMDRp@vger.kernel.org, AJvYcCXAr8GF5I008NZt+9Jg8Np//TT/2/8gg2suBc8RCNr/RM1xLxZ7Od8RUx/AFGnbYcpYyKy4bJc3PpXiR3s0YuN4clw=@vger.kernel.org, AJvYcCXfl4uk/9qwoLevoufS6s3A9fAElMmoRZWutY2Z/SAwE3xKvAARFDoSH+NWWYHVIDKUukIrGrgcbc5oAkwv@vger.kernel.org X-Gm-Message-State: AOJu0YzJHQReJ4NVOHj19k87XT0Sxts9Rav2cdpM63mXdwmfHbQRMD7M QnwTxQu2WHQSKJDrF6S2peYRm7oF2qWlLcDucBkBSScaCOyiAucOuPCjRg== X-Gm-Gg: ASbGnctGOND0Xj5q3WjEbQl2a+isADg9SHiBSleL5Op44WxR+J5Kg8f2twLHD7HClQa 2B1iK4v5tGA/81j1Vweiy1HDZ6vIcInQlOEmN2OejXaueNzot7HuvBfgDadmnd2IG5abr4Yl7qC E/7092GErjMKEOPkuCpCg22PkSvXw8thUZHk6z0q2Qlr38ivqzZZqJBKmxDTEKIr6WuSGfZxij6 Od7TnUDYweD1XkX3f8bcX17S5kxImB+A8DqAClqeOWIKpLCZCLJExz4xdkjwjwoBP9ldjvmyiuQ RlZP182Ni7EMkomiljxrOWOVVTlO50CFJyKneHmsG+0yzEkBpCHDzwwDVTlGoUH56jjuXPyaNTA 8t0NEsM9aftBBvpFJaIa0 X-Google-Smtp-Source: AGHT+IE4BN38JBiKx76BxP/6BUTVPP+3ckbM6pNBbK+SmHspfVRVwIu2YBrzhMH7wBCy1RoE1+z6EQ== X-Received: by 2002:a05:6000:1445:b0:390:e655:f998 with SMTP id ffacd0b85a97d-3997f909fa6mr2839938f8f.26.1742565539267; Fri, 21 Mar 2025 06:58:59 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:58:58 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 01/10] dt-bindings: phy: add exynos2200 eusb2 phy support Date: Fri, 21 Mar 2025 15:58:45 +0200 Message-ID: <20250321135854.1431375-2-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As Samsung has been using the same Synopsys eUSB2 IP in Exynos2200, albeit with a different register layout, rename qcom,snps-eusb2-phy to snps,eusb2-phy and drop mentions of it being only for Qualcomm SoCs in the binding description. Document the exynos2200 eUSB2 compatible. Unlike the currently documented Qualcomm SoCs, it doesn't provide reset lines for reset control and uses more clocks. Signed-off-by: Ivaylo Ivanov --- ...nps-eusb2-phy.yaml => snps,eusb2-phy.yaml} | 62 ++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) rename Documentation/devicetree/bindings/phy/{qcom,snps-eusb2-phy.yaml => snps,eusb2-phy.yaml} (59%) diff --git a/Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml b/Documentation/devicetree/bindings/phy/snps,eusb2-phy.yaml similarity index 59% rename from Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml rename to Documentation/devicetree/bindings/phy/snps,eusb2-phy.yaml index 142b3c883..87f2c6756 100644 --- a/Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml +++ b/Documentation/devicetree/bindings/phy/snps,eusb2-phy.yaml @@ -1,16 +1,16 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/phy/qcom,snps-eusb2-phy.yaml# +$id: http://devicetree.org/schemas/phy/snps,eusb2-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Qualcomm SNPS eUSB2 phy controller +title: SNPS eUSB2 phy controller maintainers: - Abel Vesa description: - eUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. + eUSB2 controller supports LS/FS/HS usb connectivity. properties: compatible: @@ -23,6 +23,7 @@ properties: - qcom,x1e80100-snps-eusb2-phy - const: qcom,sm8550-snps-eusb2-phy - const: qcom,sm8550-snps-eusb2-phy + - const: samsung,exynos2200-snps-eusb2-phy reg: maxItems: 1 @@ -31,12 +32,12 @@ properties: const: 0 clocks: - items: - - description: ref + minItems: 1 + maxItems: 3 clock-names: - items: - - const: ref + minItems: 1 + maxItems: 3 resets: maxItems: 1 @@ -62,7 +63,52 @@ required: - clock-names - vdd-supply - vdda12-supply - - resets + +allOf: + - if: + properties: + compatible: + contains: + enum: + - qcom,sm8550-snps-eusb2-phy + + then: + properties: + reg: + maxItems: 1 + + clocks: + items: + - description: ref + + clock-names: + items: + - const: ref + + required: + - resets + + - if: + properties: + compatible: + contains: + enum: + - samsung,exynos2200-snps-eusb2-phy + + then: + properties: + + clocks: + items: + - description: Reference clock + - description: Bus (APB) clock + - description: Control clock + + clock-names: + items: + - const: ref + - const: bus + - const: ctrl additionalProperties: false From patchwork Fri Mar 21 13:58:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 875278 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 AA34813B59B; Fri, 21 Mar 2025 13:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565544; cv=none; b=N9sFWoJjEOm0PwciBA9S7zE9AZuqpxp30v5Gy4i6oBrw/hIbLRealsfAX3lXk1IHnIxgK6gVS+Hm/UrCHVWvhtmZfggzVdZj0dPOV8G7h3ondUE/JFPQIpmd62vEmdnACpgxS3e0hucI1+lTXFq8UtzGZQdmOglhxWiaPBpaDrY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565544; c=relaxed/simple; bh=jsQQOkrQmvbShJEtG/AMWe3sjG5owu6VcOYtQWsu03I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QcEHB1zPEr/PjFVFClMO7VoDeWWUb6SKPWVFnHmb+nVbKTQhnRFgtp2IcipwHQLcLfVGcY5ckPS1FuaJKKruQmWDXobiAKAa8XX4pNeLVRgARxI8IHrJN8TfQXac2KOrTJ7tiZxU9qDcdqVbIIMJ0DA2VOKgN+EcQH4BxowUZbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A8zRqAwD; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A8zRqAwD" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3913958ebf2so1697589f8f.3; Fri, 21 Mar 2025 06:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565541; x=1743170341; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YIPPP5ujVDHuio5jUo3vfs/ZWMgoIwqmA1jTNPm5vS8=; b=A8zRqAwDY1EkUiho9InAXa++qRN/oPHZlPRRkCscr1by6Epa+QCKkgYA/v/uJoVt2P U4EKOEloqZV5+dGaoMM3oauc0u4y5qL9iQWk6UcoFr7GWa+w1mwRMqEgvi2zULCsyQ6b kfkjOUlqoBi//rcAUGxxZoTbgItHF4SJ/N3R83C25Nc4u2uVucWwri12v28AXcjMasWo fDcuS9+K/L/npRRlWoIAA8qZsxFC3yX7kQ1sMJIulY1Fq18af7oT5yPBH0EZCDcbtRgp dMzcR5xBSk6YogUgO2a3Wh7s4cGe94nS06ODF/rPXoVpxGqslUSB4WBmLmxQ1kLRUE/I NTGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565541; x=1743170341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YIPPP5ujVDHuio5jUo3vfs/ZWMgoIwqmA1jTNPm5vS8=; b=mrFglYEtppJu63xpzHGeMfOiFg/BKksIRLLBaGjnG5DxlKUSGxfjejCRKwGl5pnDFf n7CPYozmMoTBmvmSPV4cOxxupy83O0rKHVt7Wus5G2rEk6VCpK5eKpj1s1NuzSOmcrkp mOIdr+M3EXkYOIa2CdGT9qCXNZod1KcuD36asEuSX8tGtj7NXaWyJyfEU+2CQZASLrpM KKowyR/QlS8GTYAOV7pmQZT80KGhuPVwYOm2n7nnX45KHCs611X56dRxLauZg+1HrziH VKzKRfW5WpGVLZNCFXP8Pmhpti+UCydYYsoUzziG+0KWyD6fY4v4YmGNt8Hemr/53LhM 40xg== X-Forwarded-Encrypted: i=1; AJvYcCULMhd7XOcwmTt9rhQLE37gtAV/ucZiOFBT4039HUYKvT6rxHV6I+9OujcDtKsMnKhI8l6dJAuMIP17@vger.kernel.org, AJvYcCUalvarDaFZvcPF1+7TggOEgHl8SUU2lnyW7Q6qBy4uWUifiFP4uS23XEqiiGwXsDHMjekBJGhQjsf+WewJYklgvew=@vger.kernel.org, AJvYcCW+DFgzmFm0fUGSWMVlk2nQbdMSrb7J9BEbKv4hYTIq1+xH5k/tDYoZdKACKqRX6y+p9lfSVDr9KrlLCVgQ@vger.kernel.org X-Gm-Message-State: AOJu0YzuJIed63pULa64Z7KXcGcyCsAXzvm4Fwd6gw4xudYMYc0xe7ic xsH3pXTJXx9QU5Pjp/P74zAxnU4G9SQRccR4VYEYJnt580xyDdam X-Gm-Gg: ASbGnct67JQUxHl2Wlz99WhE1cikG4XFOczEiAxo3yPI7/qIOsZr14Dt61sKnU+QKu7 NhTPNBEELMhe4n5cvaII1/tAUQKwC+2/8tNZg1ldnoKZ+QtDm6cYESvCikWT7Q87q2NsPt8iJTV f5uVlUAdPVeb5gN7LDH5DIfMQrtnkO7a7ehkh4jxD/F5GLY4BAbAxtiKAmwOy2IK+gfS7pW7olm 3fkXBgNDbEsbKNmQLXmiBMCxvAbl+BsIX8PY0lUJ3/bgl+gFM5DvcgeI8XmBGKB3I40OYi+Cvcv akbgjJarDVAfn9hTvNOCdGUUfCE5p4Phr5w/5poVYpIoaXatEHAQai+atDzj+OCeMx/wTCdwh2f +4BiiIhGGs+834DJDCW+AbWDZHRtu5jQ= X-Google-Smtp-Source: AGHT+IFPFP42aVOYqjs1M5n27C94uUx314miaX7k0Qe1RphsqIE1/Aq6oAnk++IxGDHQycnfkPWZLg== X-Received: by 2002:a5d:6485:0:b0:391:4231:414 with SMTP id ffacd0b85a97d-3997f9397e6mr3645126f8f.40.1742565540690; Fri, 21 Mar 2025 06:59:00 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:00 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 02/10] dt-bindings: phy: samsung,usb3-drd-phy: add exynos2200 support Date: Fri, 21 Mar 2025 15:58:46 +0200 Message-ID: <20250321135854.1431375-3-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document support for Exynos2200. As the USBDRD 3.2 4nm controller consists of Synopsys eUSB2.0 phy and USBDP/SS combophy, which will be handled by external drivers, define only the bus clocked used by the link controller. Signed-off-by: Ivaylo Ivanov --- .../bindings/phy/samsung,usb3-drd-phy.yaml | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml index 16321cdd4..819e4afe6 100644 --- a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml +++ b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml @@ -26,6 +26,7 @@ properties: compatible: enum: - google,gs101-usb31drd-phy + - samsung,exynos2200-usb32drd-phy - samsung,exynos5250-usbdrd-phy - samsung,exynos5420-usbdrd-phy - samsung,exynos5433-usbdrd-phy @@ -33,24 +34,32 @@ properties: - samsung,exynos850-usbdrd-phy clocks: - minItems: 2 + minItems: 1 maxItems: 5 clock-names: - minItems: 2 + minItems: 1 maxItems: 5 description: | - At least two clocks:: + Typically two clocks:: - Main PHY clock (same as USB DRD controller i.e. DWC3 IP clock), used for register access. - PHY reference clock (usually crystal clock), used for PHY operations, associated by phy name. It is used to determine bit values for clock settings register. For Exynos5420 this is given as 'sclk_usbphy30' - in the CMU. + in the CMU. It's not needed for Exynos2200. "#phy-cells": const: 1 + phys: + maxItems: 1 + description: + Phandle to USBDRD-underlying high-speed PHY + + phy-names: + const: hs + port: $ref: /schemas/graph.yaml#/properties/port description: @@ -137,6 +146,27 @@ allOf: - vdda-usbdp-supply - vddh-usbdp-supply + - if: + properties: + compatible: + contains: + enum: + - samsung,exynos2200-usb32drd-phy + then: + properties: + clocks: + maxItems: 1 + clock-names: + items: + - const: phy + reg: + maxItems: 1 + reg-names: + maxItems: 1 + required: + - phys + - phy-names + - if: properties: compatible: From patchwork Fri Mar 21 13:58:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 876108 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 47653169397; Fri, 21 Mar 2025 13:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565546; cv=none; b=dasKJWD4N97tywTqVyQKlaF0DDkgNS7nUt+9NycrBIMfQJJw5zsA9NR0PBQrG/9Zzz9VbOmihgA/HLhgDGSRTCREPxTJQ560vVMDcP7FUXIZVstJAKB/UTxj0SM47VXFLty18u2rP7FjAfNMySrcXoWn4pRP8IZIG0CM4AolMC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565546; c=relaxed/simple; bh=ZJC40o810p8ayiR7NIMSKxZSOPhG8klnx2E364F9OX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dme4bBKP08PrMflvSPUMeOyV/VSCKZCu0pdfmgzTRVT6ZDGcoFMOuim2DNH2Q3AOZypIKfi0wb0e2jFIMFS80acZwfXsEJzwov/jtCt8WPNiszPS8pBWDtQqxGhcFzMLdXJdmCkuTRdku6C1NB/Tro66bZV/e1GBR1H0aKmE0TU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=muz2KIDv; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="muz2KIDv" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-39141ffa9fcso1802881f8f.0; Fri, 21 Mar 2025 06:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565542; x=1743170342; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w5bLkk6uqPyWirFskOF6TYLbFYm64XVe1/MBmiWZndA=; b=muz2KIDvIoSFFZBOrmOSzDD7TV3720ukHzsqbggCFxSSrJ2hlULemXZiDmL5RmE8+z dGbyqEAqGW6n466hq8cRZAFGSigSIyX7xQtlOlyrLvbfBWnpenH4vBTNh293HnyS8lWa Lb3R43EzQk7utdhN1cKB5ep7RfJeZ9GxKbtLvzCeef/T2Lq1uT9B9QTXCjxzrPoZOyAZ F8eZG3e2zto9cH4N3xVzeYdWUNIM2bFCS1Y30XglfdRmr4iAuoX/FTfSoWIHYEdfTTzd VtQm3hBbq/e8fnpS2isD79zJUH3jxTzgPY4NJe3eQHdl98HV5K6NWI6jGYedKDfgrHYr stOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565542; x=1743170342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w5bLkk6uqPyWirFskOF6TYLbFYm64XVe1/MBmiWZndA=; b=IBGDhZ3xwe02lOIhPKrLexTu9XVkQkn3mbMBJGLKlDTE4NrobpNwwmBx1y7T7L7705 mrNYJYup26miOIVN0Rp6fV3IH7yCEB+Zr4qTvVIXzfR31cA1YOU2iKYLv1tf3+CV7QsT VFBm77WLpykFh6K51VTuu+EfFkYYROUI2XvV5XZIZ1X4GivoeFDPHWjiiGJJGOPGGq8L Wduak/uHypKzFK7bDswG5ZsPZ2ZfXVHnQmQbktgpT8z/U4C6n+qB8Eok4JHgmy7R7WML SHMjf4DSA0/Zi8bWrRu3u8Mbzn42Cyx1LBPu8gVmtIhcWS5WJhPXxdDoW/SyNS07uk+d X5Xw== X-Forwarded-Encrypted: i=1; AJvYcCVIRukFx8Fy5X7BzPlgldkUgyU94u7xCqG0hGcsL7BNMfGGNbOd1sf0ux+1bvsM1DOozqZg18CwtDjgwu1Q@vger.kernel.org, AJvYcCXZ242u08Qz9Lo0nmf1RfwWKiDOpW3mPMbkuD8sCRb2u4RQkJfBi+C7Dl1UhIOierl5vY+NaQ2XVnUD@vger.kernel.org, AJvYcCXxE0D+g+1ergW/gAZ2tCjAc337eMfdinqnQpDEs+vFHP7vwBDkkuCdmSvyG1thMBbQoUV0m4XaPIs2gRPwpwEksKw=@vger.kernel.org X-Gm-Message-State: AOJu0YxuXQmCEj0Fs2H/qhvXmW0Rk/+Rb7KfMvQT64xkAZdEykdXZW+0 Z/StXpcSnudj0J0jzgui1AhZcWsS8g25aqezrDC/tlM0BC4ygzwJ X-Gm-Gg: ASbGncvdIJctE+MvghgTkPrzgMGMCi+ibcWyge2nWJEI6OzbwlfPW8hfc3vLVQ7fMMK jo726scJdrtGttVE2fTIiGQnVmiC9VyZaufHvbiUJPbdqI2ZCqyi0NdcZSu7kpQsJ1I44Xe0l8J TzeSb0UNZurBCQXDmgQt7SkXznjfS9nZmp+Bbx9z6x6zsnA73zCuTo7sX3V/VDnLyiXdMKWqj4L mkHWO/xoiHhoQBjW1jQWp2GGBVlb7mSJJMbHK+UbI9p3KQm/O9BvSoFk9JjQ/erT1ZYFPhEjFjB YOnbI1xazIAHfi1RndxviLNOc8n2bPTLtA0b4eZWjZsB4pt1lvMbQeUTb0dlUSItSY8f98pwrKM 9Smt5TeQ/gqvqJsQUdImT X-Google-Smtp-Source: AGHT+IHNOmMa9KW3MUdMo1gO9oj/91uP7LkUin/DdC6+LBE4xrKRJwfNY8vmAFeiFQoQQMTRjkFDAQ== X-Received: by 2002:a5d:584b:0:b0:390:f9a5:bd79 with SMTP id ffacd0b85a97d-3997f90ab9emr3286675f8f.26.1742565542199; Fri, 21 Mar 2025 06:59:02 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:01 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 03/10] phy: move phy-qcom-snps-eusb2 out of its vendor sub-directory Date: Fri, 21 Mar 2025 15:58:47 +0200 Message-ID: <20250321135854.1431375-4-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As not only Qualcomm, but also Samsung is using the Synopsys eUSB2 IP (albeit with a different register layout) in their newer SoCs, move the driver out of its vendor sub-directory and rename it to phy-snps-eusb2. Signed-off-by: Ivaylo Ivanov Suggested-by: Krzysztof Kozlowski --- drivers/phy/Kconfig | 8 ++++++++ drivers/phy/Makefile | 1 + .../{qualcomm/phy-qcom-snps-eusb2.c => phy-snps-eusb2.c} | 0 drivers/phy/qualcomm/Kconfig | 9 --------- drivers/phy/qualcomm/Makefile | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) rename drivers/phy/{qualcomm/phy-qcom-snps-eusb2.c => phy-snps-eusb2.c} (100%) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 8d58efe99..11c166204 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -43,6 +43,14 @@ config PHY_PISTACHIO_USB help Enable this to support the USB2.0 PHY on the IMG Pistachio SoC. +config PHY_SNPS_EUSB2 + tristate "SNPS eUSB2 PHY Driver" + depends on OF && (ARCH_QCOM || COMPILE_TEST) + select GENERIC_PHY + help + Enable support for the USB high-speed SNPS eUSB2 phy on select + SoCs. The PHY is usually paired with a Synopsys DWC3 USB controller. + config PHY_XGENE tristate "APM X-Gene 15Gbps PHY support" depends on HAS_IOMEM && OF && (ARCH_XGENE || COMPILE_TEST) diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index e281442ac..c670a8dac 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_PHY_CAN_TRANSCEIVER) += phy-can-transceiver.o obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o obj-$(CONFIG_PHY_XGENE) += phy-xgene.o obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o +obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o diff --git a/drivers/phy/qualcomm/phy-qcom-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c similarity index 100% rename from drivers/phy/qualcomm/phy-qcom-snps-eusb2.c rename to drivers/phy/phy-snps-eusb2.c diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig index 846f8c995..914547068 100644 --- a/drivers/phy/qualcomm/Kconfig +++ b/drivers/phy/qualcomm/Kconfig @@ -125,15 +125,6 @@ config PHY_QCOM_QUSB2 PHY which is usually paired with either the ChipIdea or Synopsys DWC3 USB IPs on MSM SOCs. -config PHY_QCOM_SNPS_EUSB2 - tristate "Qualcomm SNPS eUSB2 PHY Driver" - depends on OF && (ARCH_QCOM || COMPILE_TEST) - select GENERIC_PHY - help - Enable support for the USB high-speed SNPS eUSB2 phy on Qualcomm - chipsets. The PHY is paired with a Synopsys DWC3 USB controller - on Qualcomm SOCs. - config PHY_QCOM_EUSB2_REPEATER tristate "Qualcomm SNPS eUSB2 Repeater Driver" depends on OF && (ARCH_QCOM || COMPILE_TEST) diff --git a/drivers/phy/qualcomm/Makefile b/drivers/phy/qualcomm/Makefile index eb60e950a..2121e92df 100644 --- a/drivers/phy/qualcomm/Makefile +++ b/drivers/phy/qualcomm/Makefile @@ -15,7 +15,6 @@ obj-$(CONFIG_PHY_QCOM_QMP_USB) += phy-qcom-qmp-usb.o obj-$(CONFIG_PHY_QCOM_QMP_USB_LEGACY) += phy-qcom-qmp-usb-legacy.o obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o -obj-$(CONFIG_PHY_QCOM_SNPS_EUSB2) += phy-qcom-snps-eusb2.o obj-$(CONFIG_PHY_QCOM_EUSB2_REPEATER) += phy-qcom-eusb2-repeater.o obj-$(CONFIG_PHY_QCOM_USB_HS) += phy-qcom-usb-hs.o obj-$(CONFIG_PHY_QCOM_USB_HSIC) += phy-qcom-usb-hsic.o From patchwork Fri Mar 21 13:58:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 875277 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 C1C0919CC20; Fri, 21 Mar 2025 13:59:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565548; cv=none; b=EqHen7aPZVchtd5nhie80v/i0Qw42HO6lMmVsQ86np8TOUwfKfcUkVXa2pdQWUr3ONhuExnKHfUdaEpgrkDM3c/aYo7SyDzcA9cvddH7NleQ/pT0ZpwHSXEJrmM6PmSW0Ae44hhjRJEHTj/vD8LK50nWxARYhWuNDna5iFAhVp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565548; c=relaxed/simple; bh=Vd6yLjEX26lMBr9pzDtU86YyAUSSWm1Er8D9VPcmLec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pEHNkt9HjGW3Docr7sp/KfWSywEbThBOSXn3h1pcdM+xYRD5iXrIfnuOnYzrlfPw8AnD3R+RJdePwtyt4HjAFPXuxVA9pZFVGMxut27WjxqwHb1v/pqRcVi0Ml86GpRwaTiDT75At4SMuRnUyEolQHhD4K7D1O8A5GMRqv2KFLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y9tW2gVi; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y9tW2gVi" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43cf034d4abso21215635e9.3; Fri, 21 Mar 2025 06:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565544; x=1743170344; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I+G5XKLXnsjT0t04w7zApTjDNVwodljF6Xa/DfGbxTo=; b=Y9tW2gVi0RofDYhuuPf6eI/yxFj/eRoXhsdvxg+QX1lw58oaHDEgPNxXip5p19ngO+ h5uMs+JouiGa1+2TG/lDW7+hAO4r1wqn17XdpA0B+HDDKG+t0wbj2ZGsyKnPGFZU7Onr gZKtMNrjsWNcbOeZu3UNLNShekSpFLuH45eZhL3IS8kOSvXv1/JXRm/1BVAcnTM0rZJT uuTzP1WMZIqcWBKPzNH1lf/ZMGKhsyUXbtQ4A/aBTwpRrTfKze4NoGVB/xtlsCwvSOOM jZFtBr29xBNXzWKPVQ/57ugMRYUSCGuipa5E7yJ0JapcJnRPn4GYDSpXcOLihdkwDoRN VOCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565544; x=1743170344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I+G5XKLXnsjT0t04w7zApTjDNVwodljF6Xa/DfGbxTo=; b=ml3oCuHRe+tlmcrAv6AtYvMTYTuXasNO5B88j27YJMM2WL0F+D0MnA9Ircnj3TO43Y b6fGiLsqczKU82hSJx7P5hKFNdZkJXiTigaa4An19XnB+QUB6VRJ7X5TJgJa4YkoNh2H kKxgv8tAcJ9MSQBu4Axl2ZMy8Mcc4teE5ewdMC8tsGjx8QB5TU3DUO2E5O9jvAq3ICgW KaEeGsKevobDwOJrm45teoseYxyczCsX2tSeEh55JJ81PhZ0u7PVOc9AmhtkLb0GVwOO noCxH07Dn8RGgAY/YFHaZAt8e2SXyCSQw2XDphdlBW5IvPOqLmcuPdx8GA5sJO5kI3e4 +bCA== X-Forwarded-Encrypted: i=1; AJvYcCU1yL7aE8iodJjvhJuYp8AraWEVGYHfaP2IuaGgAc2/2UgeZj/zd/SZG70SCMTyDiPqkp0ijxhnAM0H7ikXgG8zX2s=@vger.kernel.org, AJvYcCUDLL9rZAAcacsI9aC/Nhve4ENwhehoXTBYzQlLG3V1pSBiUeDBAFL2nZJU72oOYVIZhY/nJbNePwmP@vger.kernel.org, AJvYcCWSH+GeVKj+sjBuaqXiLoPOTaGPw/uJtn/IUOrri5PsNtECr5fFJjFtLagbx0Q9cQ+ziVUc/xjKR8UT+9wN@vger.kernel.org X-Gm-Message-State: AOJu0YyJKpKZJzJBY6ll5lhTYrxOa9g61LmnKt3x78TidbkROHBwxIej EkJ81bYHIUlvWbCoXTIcDLmEVG9Z5pAtn7TqEaUcBXVjblLYWdLw X-Gm-Gg: ASbGncuprHGv5ZDyLdGMM7y9c/t77LJ6TWUi/X+Vd1lYNGput8y44XLla+Abmlj3U+U xZRWHoc1o2DXGsnIp5aZ45eMK2Lq4burJ0STbSLEVJCVCPMKSRZuVl+3TLxXrxlC67ziucyEdoz w+YKFNi5eI3Y6RZSW4ccvkVDC4cSWTPi+RG9C/VKf42mVM+9yUYBRg9TMmSBX9bFbHQKRNtuBIK +qOjtgdxbTjdhPyy1x2/00ZwLWWPR/CCvLmCegeuT7Zywv+Mqm/0ueqQVkAUZ2CAerQCyCG+5LX GPqoXB+xAVc1NWAcBnIEqOff/2gIOeGOq4Fbx73WooL9DF+FVhJDQLJtsAn9oGOubAPtgX5+q3o yyTYoQpjVTZ6MbMykn52+ X-Google-Smtp-Source: AGHT+IFKfqglKy6unbExfxvsFYJAMzRfF8Xb7sXWGXsVaDBguWXoVT05UEhV400UKIAEyMg4TnkG+Q== X-Received: by 2002:a05:6000:1ac9:b0:390:fbdd:994d with SMTP id ffacd0b85a97d-3997f910670mr3640019f8f.27.1742565543606; Fri, 21 Mar 2025 06:59:03 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:03 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 04/10] phy: phy-snps-eusb2: refactor constructs names Date: Fri, 21 Mar 2025 15:58:48 +0200 Message-ID: <20250321135854.1431375-5-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As the driver now resides outside the phy subdirectory under a different name, refactor all definitions, structures and functions to explicitly specify what code is Qualcomm-specific and what is not. Signed-off-by: Ivaylo Ivanov --- drivers/phy/phy-snps-eusb2.c | 256 +++++++++++++++++------------------ 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index 1484691a4..405278c18 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -13,15 +13,15 @@ #include #include -#define USB_PHY_UTMI_CTRL0 (0x3c) +#define QCOM_USB_PHY_UTMI_CTRL0 (0x3c) #define SLEEPM BIT(0) #define OPMODE_MASK GENMASK(4, 3) #define OPMODE_NONDRIVING BIT(3) -#define USB_PHY_UTMI_CTRL5 (0x50) +#define QCOM_USB_PHY_UTMI_CTRL5 (0x50) #define POR BIT(1) -#define USB_PHY_HS_PHY_CTRL_COMMON0 (0x54) +#define QCOM_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54) #define PHY_ENABLE BIT(0) #define SIDDQ_SEL BIT(1) #define SIDDQ BIT(2) @@ -30,15 +30,15 @@ #define FSEL_19_2_MHZ_VAL (0x0) #define FSEL_38_4_MHZ_VAL (0x4) -#define USB_PHY_CFG_CTRL_1 (0x58) +#define QCOM_USB_PHY_CFG_CTRL_1 (0x58) #define PHY_CFG_PLL_CPBIAS_CNTRL_MASK GENMASK(7, 1) -#define USB_PHY_CFG_CTRL_2 (0x5c) +#define QCOM_USB_PHY_CFG_CTRL_2 (0x5c) #define PHY_CFG_PLL_FB_DIV_7_0_MASK GENMASK(7, 0) #define DIV_7_0_19_2_MHZ_VAL (0x90) #define DIV_7_0_38_4_MHZ_VAL (0xc8) -#define USB_PHY_CFG_CTRL_3 (0x60) +#define QCOM_USB_PHY_CFG_CTRL_3 (0x60) #define PHY_CFG_PLL_FB_DIV_11_8_MASK GENMASK(3, 0) #define DIV_11_8_19_2_MHZ_VAL (0x1) #define DIV_11_8_38_4_MHZ_VAL (0x0) @@ -46,73 +46,73 @@ #define PHY_CFG_PLL_REF_DIV GENMASK(7, 4) #define PLL_REF_DIV_VAL (0x0) -#define USB_PHY_HS_PHY_CTRL2 (0x64) +#define QCOM_USB_PHY_HS_PHY_CTRL2 (0x64) #define VBUSVLDEXT0 BIT(0) #define USB2_SUSPEND_N BIT(2) #define USB2_SUSPEND_N_SEL BIT(3) #define VBUS_DET_EXT_SEL BIT(4) -#define USB_PHY_CFG_CTRL_4 (0x68) +#define QCOM_USB_PHY_CFG_CTRL_4 (0x68) #define PHY_CFG_PLL_GMP_CNTRL_MASK GENMASK(1, 0) #define PHY_CFG_PLL_INT_CNTRL_MASK GENMASK(7, 2) -#define USB_PHY_CFG_CTRL_5 (0x6c) +#define QCOM_USB_PHY_CFG_CTRL_5 (0x6c) #define PHY_CFG_PLL_PROP_CNTRL_MASK GENMASK(4, 0) #define PHY_CFG_PLL_VREF_TUNE_MASK GENMASK(7, 6) -#define USB_PHY_CFG_CTRL_6 (0x70) +#define QCOM_USB_PHY_CFG_CTRL_6 (0x70) #define PHY_CFG_PLL_VCO_CNTRL_MASK GENMASK(2, 0) -#define USB_PHY_CFG_CTRL_7 (0x74) +#define QCOM_USB_PHY_CFG_CTRL_7 (0x74) -#define USB_PHY_CFG_CTRL_8 (0x78) +#define QCOM_USB_PHY_CFG_CTRL_8 (0x78) #define PHY_CFG_TX_FSLS_VREF_TUNE_MASK GENMASK(1, 0) #define PHY_CFG_TX_FSLS_VREG_BYPASS BIT(2) #define PHY_CFG_TX_HS_VREF_TUNE_MASK GENMASK(5, 3) #define PHY_CFG_TX_HS_XV_TUNE_MASK GENMASK(7, 6) -#define USB_PHY_CFG_CTRL_9 (0x7c) +#define QCOM_USB_PHY_CFG_CTRL_9 (0x7c) #define PHY_CFG_TX_PREEMP_TUNE_MASK GENMASK(2, 0) #define PHY_CFG_TX_RES_TUNE_MASK GENMASK(4, 3) #define PHY_CFG_TX_RISE_TUNE_MASK GENMASK(6, 5) #define PHY_CFG_RCAL_BYPASS BIT(7) -#define USB_PHY_CFG_CTRL_10 (0x80) +#define QCOM_USB_PHY_CFG_CTRL_10 (0x80) -#define USB_PHY_CFG0 (0x94) +#define QCOM_USB_PHY_CFG0 (0x94) #define DATAPATH_CTRL_OVERRIDE_EN BIT(0) #define CMN_CTRL_OVERRIDE_EN BIT(1) -#define UTMI_PHY_CMN_CTRL0 (0x98) +#define QCOM_UTMI_PHY_CMN_CTRL0 (0x98) #define TESTBURNIN BIT(6) -#define USB_PHY_FSEL_SEL (0xb8) +#define QCOM_USB_PHY_FSEL_SEL (0xb8) #define FSEL_SEL BIT(0) -#define USB_PHY_APB_ACCESS_CMD (0x130) +#define QCOM_USB_PHY_APB_ACCESS_CMD (0x130) #define RW_ACCESS BIT(0) #define APB_START_CMD BIT(1) #define APB_LOGIC_RESET BIT(2) -#define USB_PHY_APB_ACCESS_STATUS (0x134) +#define QCOM_USB_PHY_APB_ACCESS_STATUS (0x134) #define ACCESS_DONE BIT(0) #define TIMED_OUT BIT(1) #define ACCESS_ERROR BIT(2) #define ACCESS_IN_PROGRESS BIT(3) -#define USB_PHY_APB_ADDRESS (0x138) +#define QCOM_USB_PHY_APB_ADDRESS (0x138) #define APB_REG_ADDR_MASK GENMASK(7, 0) -#define USB_PHY_APB_WRDATA_LSB (0x13c) +#define QCOM_USB_PHY_APB_WRDATA_LSB (0x13c) #define APB_REG_WRDATA_7_0_MASK GENMASK(3, 0) -#define USB_PHY_APB_WRDATA_MSB (0x140) +#define QCOM_USB_PHY_APB_WRDATA_MSB (0x140) #define APB_REG_WRDATA_15_8_MASK GENMASK(7, 4) -#define USB_PHY_APB_RDDATA_LSB (0x144) +#define QCOM_USB_PHY_APB_RDDATA_LSB (0x144) #define APB_REG_RDDATA_7_0_MASK GENMASK(3, 0) -#define USB_PHY_APB_RDDATA_MSB (0x148) +#define QCOM_USB_PHY_APB_RDDATA_MSB (0x148) #define APB_REG_RDDATA_15_8_MASK GENMASK(7, 4) static const char * const eusb2_hsphy_vreg_names[] = { @@ -121,7 +121,7 @@ static const char * const eusb2_hsphy_vreg_names[] = { #define EUSB2_NUM_VREGS ARRAY_SIZE(eusb2_hsphy_vreg_names) -struct qcom_snps_eusb2_hsphy { +struct snps_eusb2_hsphy { struct phy *phy; void __iomem *base; @@ -135,17 +135,17 @@ struct qcom_snps_eusb2_hsphy { struct phy *repeater; }; -static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode) +static int snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode) { - struct qcom_snps_eusb2_hsphy *phy = phy_get_drvdata(p); + struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); phy->mode = mode; return phy_set_mode_ext(phy->repeater, mode, submode); } -static void qcom_snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset, - u32 mask, u32 val) +static void snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset, + u32 mask, u32 val) { u32 reg; @@ -158,65 +158,65 @@ static void qcom_snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset, readl_relaxed(base + offset); } -static void qcom_eusb2_default_parameters(struct qcom_snps_eusb2_hsphy *phy) +static void qcom_eusb2_default_parameters(struct snps_eusb2_hsphy *phy) { /* default parameters: tx pre-emphasis */ - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_9, - PHY_CFG_TX_PREEMP_TUNE_MASK, - FIELD_PREP(PHY_CFG_TX_PREEMP_TUNE_MASK, 0)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_9, + PHY_CFG_TX_PREEMP_TUNE_MASK, + FIELD_PREP(PHY_CFG_TX_PREEMP_TUNE_MASK, 0)); /* tx rise/fall time */ - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_9, - PHY_CFG_TX_RISE_TUNE_MASK, - FIELD_PREP(PHY_CFG_TX_RISE_TUNE_MASK, 0x2)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_9, + PHY_CFG_TX_RISE_TUNE_MASK, + FIELD_PREP(PHY_CFG_TX_RISE_TUNE_MASK, 0x2)); /* source impedance adjustment */ - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_9, - PHY_CFG_TX_RES_TUNE_MASK, - FIELD_PREP(PHY_CFG_TX_RES_TUNE_MASK, 0x1)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_9, + PHY_CFG_TX_RES_TUNE_MASK, + FIELD_PREP(PHY_CFG_TX_RES_TUNE_MASK, 0x1)); /* dc voltage level adjustement */ - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_8, - PHY_CFG_TX_HS_VREF_TUNE_MASK, - FIELD_PREP(PHY_CFG_TX_HS_VREF_TUNE_MASK, 0x3)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_8, + PHY_CFG_TX_HS_VREF_TUNE_MASK, + FIELD_PREP(PHY_CFG_TX_HS_VREF_TUNE_MASK, 0x3)); /* transmitter HS crossover adjustement */ - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_8, - PHY_CFG_TX_HS_XV_TUNE_MASK, - FIELD_PREP(PHY_CFG_TX_HS_XV_TUNE_MASK, 0x0)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_8, + PHY_CFG_TX_HS_XV_TUNE_MASK, + FIELD_PREP(PHY_CFG_TX_HS_XV_TUNE_MASK, 0x0)); } -static int qcom_eusb2_ref_clk_init(struct qcom_snps_eusb2_hsphy *phy) +static int qcom_eusb2_ref_clk_init(struct snps_eusb2_hsphy *phy) { unsigned long ref_clk_freq = clk_get_rate(phy->ref_clk); switch (ref_clk_freq) { case 19200000: - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL_COMMON0, - FSEL_MASK, - FIELD_PREP(FSEL_MASK, FSEL_19_2_MHZ_VAL)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + FSEL_MASK, + FIELD_PREP(FSEL_MASK, FSEL_19_2_MHZ_VAL)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_2, - PHY_CFG_PLL_FB_DIV_7_0_MASK, - DIV_7_0_19_2_MHZ_VAL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_2, + PHY_CFG_PLL_FB_DIV_7_0_MASK, + DIV_7_0_19_2_MHZ_VAL); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_3, - PHY_CFG_PLL_FB_DIV_11_8_MASK, - DIV_11_8_19_2_MHZ_VAL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, + PHY_CFG_PLL_FB_DIV_11_8_MASK, + DIV_11_8_19_2_MHZ_VAL); break; case 38400000: - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL_COMMON0, - FSEL_MASK, - FIELD_PREP(FSEL_MASK, FSEL_38_4_MHZ_VAL)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + FSEL_MASK, + FIELD_PREP(FSEL_MASK, FSEL_38_4_MHZ_VAL)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_2, - PHY_CFG_PLL_FB_DIV_7_0_MASK, - DIV_7_0_38_4_MHZ_VAL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_2, + PHY_CFG_PLL_FB_DIV_7_0_MASK, + DIV_7_0_38_4_MHZ_VAL); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_3, - PHY_CFG_PLL_FB_DIV_11_8_MASK, - DIV_11_8_38_4_MHZ_VAL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, + PHY_CFG_PLL_FB_DIV_11_8_MASK, + DIV_11_8_38_4_MHZ_VAL); break; default: @@ -224,15 +224,15 @@ static int qcom_eusb2_ref_clk_init(struct qcom_snps_eusb2_hsphy *phy) return -EINVAL; } - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_3, - PHY_CFG_PLL_REF_DIV, PLL_REF_DIV_VAL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, + PHY_CFG_PLL_REF_DIV, PLL_REF_DIV_VAL); return 0; } -static int qcom_snps_eusb2_hsphy_init(struct phy *p) +static int snps_eusb2_hsphy_init(struct phy *p) { - struct qcom_snps_eusb2_hsphy *phy = phy_get_drvdata(p); + struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); int ret; ret = regulator_bulk_enable(ARRAY_SIZE(phy->vregs), phy->vregs); @@ -265,73 +265,73 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p) goto disable_ref_clk; } - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG0, - CMN_CTRL_OVERRIDE_EN, CMN_CTRL_OVERRIDE_EN); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG0, + CMN_CTRL_OVERRIDE_EN, CMN_CTRL_OVERRIDE_EN); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_UTMI_CTRL5, POR, POR); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_UTMI_CTRL5, POR, POR); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL_COMMON0, - PHY_ENABLE | RETENABLEN, PHY_ENABLE | RETENABLEN); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + PHY_ENABLE | RETENABLEN, PHY_ENABLE | RETENABLEN); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_APB_ACCESS_CMD, - APB_LOGIC_RESET, APB_LOGIC_RESET); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_APB_ACCESS_CMD, + APB_LOGIC_RESET, APB_LOGIC_RESET); - qcom_snps_eusb2_hsphy_write_mask(phy->base, UTMI_PHY_CMN_CTRL0, TESTBURNIN, 0); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_UTMI_PHY_CMN_CTRL0, TESTBURNIN, 0); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_FSEL_SEL, - FSEL_SEL, FSEL_SEL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_FSEL_SEL, + FSEL_SEL, FSEL_SEL); /* update ref_clk related registers */ ret = qcom_eusb2_ref_clk_init(phy); if (ret) - goto disable_ref_clk; + return ret; - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_1, - PHY_CFG_PLL_CPBIAS_CNTRL_MASK, - FIELD_PREP(PHY_CFG_PLL_CPBIAS_CNTRL_MASK, 0x1)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_1, + PHY_CFG_PLL_CPBIAS_CNTRL_MASK, + FIELD_PREP(PHY_CFG_PLL_CPBIAS_CNTRL_MASK, 0x1)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_4, - PHY_CFG_PLL_INT_CNTRL_MASK, - FIELD_PREP(PHY_CFG_PLL_INT_CNTRL_MASK, 0x8)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_4, + PHY_CFG_PLL_INT_CNTRL_MASK, + FIELD_PREP(PHY_CFG_PLL_INT_CNTRL_MASK, 0x8)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_4, - PHY_CFG_PLL_GMP_CNTRL_MASK, - FIELD_PREP(PHY_CFG_PLL_GMP_CNTRL_MASK, 0x1)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_4, + PHY_CFG_PLL_GMP_CNTRL_MASK, + FIELD_PREP(PHY_CFG_PLL_GMP_CNTRL_MASK, 0x1)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_5, - PHY_CFG_PLL_PROP_CNTRL_MASK, - FIELD_PREP(PHY_CFG_PLL_PROP_CNTRL_MASK, 0x10)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_5, + PHY_CFG_PLL_PROP_CNTRL_MASK, + FIELD_PREP(PHY_CFG_PLL_PROP_CNTRL_MASK, 0x10)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_6, - PHY_CFG_PLL_VCO_CNTRL_MASK, - FIELD_PREP(PHY_CFG_PLL_VCO_CNTRL_MASK, 0x0)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_6, + PHY_CFG_PLL_VCO_CNTRL_MASK, + FIELD_PREP(PHY_CFG_PLL_VCO_CNTRL_MASK, 0x0)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_CFG_CTRL_5, - PHY_CFG_PLL_VREF_TUNE_MASK, - FIELD_PREP(PHY_CFG_PLL_VREF_TUNE_MASK, 0x1)); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_5, + PHY_CFG_PLL_VREF_TUNE_MASK, + FIELD_PREP(PHY_CFG_PLL_VREF_TUNE_MASK, 0x1)); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL2, - VBUS_DET_EXT_SEL, VBUS_DET_EXT_SEL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL2, + VBUS_DET_EXT_SEL, VBUS_DET_EXT_SEL); /* set default parameters */ qcom_eusb2_default_parameters(phy); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL2, - USB2_SUSPEND_N_SEL | USB2_SUSPEND_N, - USB2_SUSPEND_N_SEL | USB2_SUSPEND_N); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL2, + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N, + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_UTMI_CTRL0, SLEEPM, SLEEPM); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_UTMI_CTRL0, SLEEPM, SLEEPM); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL_COMMON0, - SIDDQ_SEL, SIDDQ_SEL); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + SIDDQ_SEL, SIDDQ_SEL); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL_COMMON0, - SIDDQ, 0); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + SIDDQ, 0); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_UTMI_CTRL5, POR, 0); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_UTMI_CTRL5, POR, 0); - qcom_snps_eusb2_hsphy_write_mask(phy->base, USB_PHY_HS_PHY_CTRL2, - USB2_SUSPEND_N_SEL, 0); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL2, + USB2_SUSPEND_N_SEL, 0); return 0; @@ -344,9 +344,9 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p) return ret; } -static int qcom_snps_eusb2_hsphy_exit(struct phy *p) +static int snps_eusb2_hsphy_exit(struct phy *p) { - struct qcom_snps_eusb2_hsphy *phy = phy_get_drvdata(p); + struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); clk_disable_unprepare(phy->ref_clk); @@ -357,18 +357,18 @@ static int qcom_snps_eusb2_hsphy_exit(struct phy *p) return 0; } -static const struct phy_ops qcom_snps_eusb2_hsphy_ops = { - .init = qcom_snps_eusb2_hsphy_init, - .exit = qcom_snps_eusb2_hsphy_exit, - .set_mode = qcom_snps_eusb2_hsphy_set_mode, +static const struct phy_ops snps_eusb2_hsphy_ops = { + .init = snps_eusb2_hsphy_init, + .exit = snps_eusb2_hsphy_exit, + .set_mode = snps_eusb2_hsphy_set_mode, .owner = THIS_MODULE, }; -static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev) +static int snps_eusb2_hsphy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct qcom_snps_eusb2_hsphy *phy; + struct snps_eusb2_hsphy *phy; struct phy_provider *phy_provider; struct phy *generic_phy; int ret, i; @@ -405,7 +405,7 @@ static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(phy->repeater), "failed to get repeater\n"); - generic_phy = devm_phy_create(dev, NULL, &qcom_snps_eusb2_hsphy_ops); + generic_phy = devm_phy_create(dev, NULL, &snps_eusb2_hsphy_ops); if (IS_ERR(generic_phy)) { dev_err(dev, "failed to create phy %d\n", ret); return PTR_ERR(generic_phy); @@ -418,25 +418,25 @@ static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev) if (IS_ERR(phy_provider)) return PTR_ERR(phy_provider); - dev_info(dev, "Registered Qcom-eUSB2 phy\n"); + dev_info(dev, "Registered Snps-eUSB2 phy\n"); return 0; } -static const struct of_device_id qcom_snps_eusb2_hsphy_of_match_table[] = { +static const struct of_device_id snps_eusb2_hsphy_of_match_table[] = { { .compatible = "qcom,sm8550-snps-eusb2-phy", }, { }, }; -MODULE_DEVICE_TABLE(of, qcom_snps_eusb2_hsphy_of_match_table); +MODULE_DEVICE_TABLE(of, snps_eusb2_hsphy_of_match_table); -static struct platform_driver qcom_snps_eusb2_hsphy_driver = { - .probe = qcom_snps_eusb2_hsphy_probe, +static struct platform_driver snps_eusb2_hsphy_driver = { + .probe = snps_eusb2_hsphy_probe, .driver = { - .name = "qcom-snps-eusb2-hsphy", - .of_match_table = qcom_snps_eusb2_hsphy_of_match_table, + .name = "snps-eusb2-hsphy", + .of_match_table = snps_eusb2_hsphy_of_match_table, }, }; -module_platform_driver(qcom_snps_eusb2_hsphy_driver); -MODULE_DESCRIPTION("Qualcomm SNPS eUSB2 HS PHY driver"); +module_platform_driver(snps_eusb2_hsphy_driver); +MODULE_DESCRIPTION("SNPS eUSB2 HS PHY driver"); MODULE_LICENSE("GPL"); From patchwork Fri Mar 21 13:58:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 876107 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 1039B1C863C; Fri, 21 Mar 2025 13:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565548; cv=none; b=lh7N0zPJIRgsnO6tqvd4r3tCZxU7dXwYr9OU3KOSyJGeyDHDD9/W02jfNruJNr/x3T9+9+YIkzXMhHIvV+EQOjMpG8jSFvAcqn0GhmebL+fWWNHnEWppDqzkbR7NanIj8wSkVUtcjdoGxVRvbCAf9OD0nIaEUefEvMdLl9CV7Sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565548; c=relaxed/simple; bh=m6hZszT1VHbW/jN06s9zsoAvK38ySkDC7EKMfjH0DpY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ju7SQKIs60VGCDcNcN6QoxeUX1NM+auvRivn0tRZiV3T2ZyPYeen80Sh7wCD1Gf7svC6k49PHqNC3bMQGqkTRsGh4ojusx21O8SR4SUOE5csjWHXcSlLYchw3vo+4NcKgEfjw2jc87RHTGql09NvXaYXXgaiOyXU7rZoCp6vGzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nVHQzFzE; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nVHQzFzE" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3912e96c8e8so1236122f8f.2; Fri, 21 Mar 2025 06:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565545; x=1743170345; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dL00t3QE4ASPpAeBNPhfJbN60yp6PFJbIaqm4DRKcSA=; b=nVHQzFzEwO3EBSrhlIRFI/XIiPauja+jfpUjEmIPxLa/H8QgcVPDvQmBfq+fn0CoZB pLP+BTgX1CFnfzOzGMTsKGVB3oAsn94kkvsQv6OrzteYGMAxYVvJxbTHlOFus2sqKbFU zUsSnU5VRiGMPLURhVvQuHwJB4AxnLdaf4h4DiHIrmuNFItIdsEH3ejJsivV2gdD2gwt 7DA/9lnldx3H2VS1XvWPNlBN3VJHi18BJrQADsJoESMedo7jOeENfgUfLh30wfCgh0sq oJuuGmZiJpnwdJE/UPS0CWeXoZMY9Z+i6TleQc3umV4XdiEKgEb0KX4BVSsNBT3eWfgG /aGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565545; x=1743170345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dL00t3QE4ASPpAeBNPhfJbN60yp6PFJbIaqm4DRKcSA=; b=A815xKVZ8v3Bj44pZBKUpqa8TbaqgdrV4m/xZVcU+LC+OD/vIO03lqctzwr14BuQCx sJToZjbrTxvLxwEOCymkmvbRq7UrVqWc+CoYIHRH4TEKMtXQohmmz3C80A/T4+2LL0rR vlrnLso7iXpFixtxlMFg2gmvuBqbNp6BoYi7AtZX4vBO2Tlhvsy2wMrJWUyfc8W/rvVX 0D1C5d78P/waQ6ww9lGYlGaZo7EEa3oBHvzJuURTKFmaXJe4pMURJeDxoYrOSuvN5IoZ U1vaUUa50s50YVYz/me5qjEAFwdFJAPV+JrhO3k2m/OJl915RIuKt7SrPU4mm9zN6xYb 8xRA== X-Forwarded-Encrypted: i=1; AJvYcCV/G4EM+ZdIiqCdLTi/RZnT42FxlE25xk8brujMdronq7HmU6Orvj2k+a3TODKsdodfR2sboDQg0lpR@vger.kernel.org, AJvYcCWWmCYvdAJSI1Dfc1cGAvIHyrXWKh6/uETq8v0ihT/meP0CaKENE+r77o0XkJ5JQPhcprR5S1mt6p7CFdmk@vger.kernel.org, AJvYcCX186Nvq9Qu/ghRLbbm2Xjq4YpdgRmhUNjf/l6ddLH+G0SwtkcNrHsHRCHwhw82Hkh+MTD2gJQ9q9eo8eHhROYiKQc=@vger.kernel.org X-Gm-Message-State: AOJu0YxKKU5EFklHV1iXEMy5E1CmlVQhBqJ9U2sjMRbfwuz4H54nmawe s1PqMXIZiHUNdsndU91w82/vStvjZ5yl84/lhPxsLFrTgzrnSE1F X-Gm-Gg: ASbGncvrBLU2wb1YU11DTHH+DQTW8jEXuiStRvfjKrywH85bysWX5z8flX09mwO9ljP zydGUNWlSi5ym/VhXV0BsKz3U6rFNZWGhkZJPw5fom6VcuQrC8YON3aFhwRpVW78FUDSF7ud38V YGkpDgKcH4of/x+on6g00iht5zo7BKzsciDy/f1WIoSapi/du3YTSjKhADJYAxfvOFWifdWLIJ6 BxW3C1oge5EvlzRn5HCpWlY0dKvp4QBX5LerUhvi/Ukewp44VpYg/qWmONKoWhws9RIcFEcP/CV 1VQ4LT5FoOj1ko3aT58GKyeUO32w+nYhMX+0AkyNtW6Whg3ISrV7l6U62s663UvbW75T6RS+pDF llwBVni+23v/U9A8ShGlB X-Google-Smtp-Source: AGHT+IFquZF4hd4nWmTPWqI68wVcBaR6V5d+ZVDKcCwV1vPKm3ReaFGvjX+0+VE46ogmhHCnIcBjWg== X-Received: by 2002:a5d:64e4:0:b0:38f:3b9b:6f91 with SMTP id ffacd0b85a97d-3997f8fa8f5mr3266881f8f.12.1742565545103; Fri, 21 Mar 2025 06:59:05 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:04 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 05/10] phy: phy-snps-eusb2: split phy init code Date: Fri, 21 Mar 2025 15:58:49 +0200 Message-ID: <20250321135854.1431375-6-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current phy init consists of hardware power-up, as well as QCOM-specific eUSB2 init code. Split it into two parts, to make room for such non-QCOM init code. Signed-off-by: Ivaylo Ivanov --- drivers/phy/phy-snps-eusb2.c | 96 +++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index 405278c18..fa878389f 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -121,6 +121,10 @@ static const char * const eusb2_hsphy_vreg_names[] = { #define EUSB2_NUM_VREGS ARRAY_SIZE(eusb2_hsphy_vreg_names) +struct snps_eusb2_phy_drvdata { + int (*phy_init)(struct phy *p); +}; + struct snps_eusb2_hsphy { struct phy *phy; void __iomem *base; @@ -133,6 +137,8 @@ struct snps_eusb2_hsphy { enum phy_mode mode; struct phy *repeater; + + const struct snps_eusb2_phy_drvdata *data; }; static int snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode) @@ -230,41 +236,11 @@ static int qcom_eusb2_ref_clk_init(struct snps_eusb2_hsphy *phy) return 0; } -static int snps_eusb2_hsphy_init(struct phy *p) +static int qcom_snps_eusb2_hsphy_init(struct phy *p) { struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); int ret; - ret = regulator_bulk_enable(ARRAY_SIZE(phy->vregs), phy->vregs); - if (ret) - return ret; - - ret = phy_init(phy->repeater); - if (ret) { - dev_err(&p->dev, "repeater init failed. %d\n", ret); - goto disable_vreg; - } - - ret = clk_prepare_enable(phy->ref_clk); - if (ret) { - dev_err(&p->dev, "failed to enable ref clock, %d\n", ret); - goto disable_vreg; - } - - ret = reset_control_assert(phy->phy_reset); - if (ret) { - dev_err(&p->dev, "failed to assert phy_reset, %d\n", ret); - goto disable_ref_clk; - } - - usleep_range(100, 150); - - ret = reset_control_deassert(phy->phy_reset); - if (ret) { - dev_err(&p->dev, "failed to de-assert phy_reset, %d\n", ret); - goto disable_ref_clk; - } - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG0, CMN_CTRL_OVERRIDE_EN, CMN_CTRL_OVERRIDE_EN); @@ -334,6 +310,52 @@ static int snps_eusb2_hsphy_init(struct phy *p) USB2_SUSPEND_N_SEL, 0); return 0; +} + +static const struct snps_eusb2_phy_drvdata sm8550_snps_eusb2_phy = { + .phy_init = qcom_snps_eusb2_hsphy_init, +}; + +static int snps_eusb2_hsphy_init(struct phy *p) +{ + struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(phy->vregs), phy->vregs); + if (ret) + return ret; + + ret = phy_init(phy->repeater); + if (ret) { + dev_err(&p->dev, "repeater init failed. %d\n", ret); + goto disable_vreg; + } + + ret = clk_prepare_enable(phy->ref_clk); + if (ret) { + dev_err(&p->dev, "failed to enable ref clock, %d\n", ret); + goto disable_vreg; + } + + ret = reset_control_assert(phy->phy_reset); + if (ret) { + dev_err(&p->dev, "failed to assert phy_reset, %d\n", ret); + goto disable_ref_clk; + } + + usleep_range(100, 150); + + ret = reset_control_deassert(phy->phy_reset); + if (ret) { + dev_err(&p->dev, "failed to de-assert phy_reset, %d\n", ret); + goto disable_ref_clk; + } + + ret = phy->data->phy_init(p); + if (ret) + goto disable_ref_clk; + + return 0; disable_ref_clk: clk_disable_unprepare(phy->ref_clk); @@ -371,6 +393,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) struct snps_eusb2_hsphy *phy; struct phy_provider *phy_provider; struct phy *generic_phy; + const struct snps_eusb2_phy_drvdata *drv_data; int ret, i; int num; @@ -378,6 +401,11 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) if (!phy) return -ENOMEM; + drv_data = of_device_get_match_data(dev); + if (!drv_data) + return -EINVAL; + phy->data = drv_data; + phy->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(phy->base)) return PTR_ERR(phy->base); @@ -424,8 +452,10 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) } static const struct of_device_id snps_eusb2_hsphy_of_match_table[] = { - { .compatible = "qcom,sm8550-snps-eusb2-phy", }, - { }, + { + .compatible = "qcom,sm8550-snps-eusb2-phy", + .data = &sm8550_snps_eusb2_phy, + }, { }, }; MODULE_DEVICE_TABLE(of, snps_eusb2_hsphy_of_match_table); From patchwork Fri Mar 21 13:58:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 875276 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 6CE431D5174; Fri, 21 Mar 2025 13:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565550; cv=none; b=cuUKdpSPCO41425y/vDF7K7Fkndr2Up5lKE2iAtNF5rrTC5KCSmDnJuwQq7edmfDTIo0IGChF8TR0s1c3C0IMd7EXhnSDBMb6UOnSGXuWEb5mU41xsqW9jGLzUzIiAtRPz0ZargnoQYslyuwvwhf5Vl0j7DwG0P7Dgpq+NzZaVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565550; c=relaxed/simple; bh=/UBXs8B2ANn3JFt73DSb+86Bqqp5l0ecdRr9t2D0OTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hzIPW1+B6NYCOyopnRH1+StnhZndynRe9mUJw9GhgdKJ5yszabG2Mvr37AvqsA9Nsvi2PH0JcvrQYMn4s2QYbcAmssbQXyxmTWFSsQiptIp8mXAwtzg51MuIcGI9mckVX2AFxmvgmwHDiwxvSCbDkzNiSMVCb8oE59Y0BsNFlos= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GGLi9Lzd; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GGLi9Lzd" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-399676b7c41so1130691f8f.3; Fri, 21 Mar 2025 06:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565546; x=1743170346; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yKyiSlNdwX7DjF+cflTvTcf4eOt0dAS41mN07rs6ryI=; b=GGLi9Lzdidbh585tnKTCtB4Yw4CmwPrp4JqxSFcKa9279WC7lVEYaqrPqzcL7wTNlQ BDM9fXWbn5mlyv9+E+nFMIfJntV0uF/9SwD7XCX384SP6G+KD6CdFlPYrQENuqmjHml2 ycD9lYdAvCWfWTz7Z4c8c0oqhJTeBS/UEB4J2tl5K5P0Z1xd/yDTNFjZ5g4xocCAF2Yg hOd6uxl6EgaA4+rf8Wqe/uFWFjSQylPP7FlEhETyfdbcyd4d244t24yJ5A6Wrp8fE3zC jLML7Q0AQSYnEHs5pbLydH0NcXJJQ7clZyvsrwMUtZXSycbioQu21iC0Xw/MNF0ma7z5 15Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565546; x=1743170346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yKyiSlNdwX7DjF+cflTvTcf4eOt0dAS41mN07rs6ryI=; b=Jduk/lVbZEuacab7iixauFPuAHX3SrzJuNtJPTfI9DEyyws05djfqx5+yc5qMbQwzL ofETU6A1QHAm0QNlXDCVoO/DdqDdTd1m+AiCxUn2SoejJSwsUNnxObMXlF4cIEc+XXLr /X/yS+1wvTh0PY09UEN9bxlXRzjJ1C/VKtbG62mksRuSmv5mLz+e9kuyWQzUgyRwL0k0 n59gHRP6WGc9NI0BbBYKTihYHGv53FTUBVoQ863BuF489vf4c7JOLX8ikS6kgsVZ5MK5 spsIxNHLZk66hYdoxenLkyCm5wtkGc0JBWJ8gI6xAHwKbE8uAYDmAIGH4FByBx71qAtG xwUQ== X-Forwarded-Encrypted: i=1; AJvYcCUpZSbF5Jo+7yWXTerhrSIZwzrinP0+HnwNpypyXV9RI4CGLc45miHm3ytZCXkG3SLUOmWl+eRt4pQs@vger.kernel.org, AJvYcCVfnmYMKYSIZIVPWb0AuWDQMO25tXAXQaI5YGsDPHSTsqFz3M2HTk0a3zNAUYeYhW0ovhBCIP/os4nojMurpu8CNjU=@vger.kernel.org, AJvYcCXf/SYZAeuk+ErLT6cXIMGp27l5d7oHnBYxp6LsmAW31kEOKvezEb0PLb6AMEy2FAYMhch4fyXL+ahHAlq6@vger.kernel.org X-Gm-Message-State: AOJu0YwqMgm6xZ9UKa8nfU9NwMW0W49emahT3Ys9Zr2XiWGISEDM6uo6 rSsr8J8fLxjvbwKFN7VE7ZXpoaZDmBOtBbGILVcTv1lg5s2DJw40 X-Gm-Gg: ASbGnct40kqe2OuRNs7IgFWfu1Bbw/AJsoAUM6HYokQWl1lgLYWygGiaSsL5CQ6OVEC nDz5FtUMhR3QGLcjNtmU660yFzSikv8xsj0yGDmwusOo2lMCfh8e91rTKQMZC3sDM6HpAEB4xNV 47QcI1NUefJnR8SQkkXjCZDniBnIFixfefzGLmh38UOVWF+w8aZGOIvZO9u71qQAX/cnwW6z3i9 y3OGXrvZXDH3nYizXPnoNUYJJvjUn1kgP1a4JqTjI6wp1UpKfybwi5Gozg22qPllVqQJYw5BGLp uRFpW3V+qQvIyY52+MMAvm1hk1C8ByGamUb30erfPAButKcrzOcZb7T/j9BZxVDuW6/LfosHZiu DUWee2gOYnt//IrOu5RxD X-Google-Smtp-Source: AGHT+IHKCNFnqK6pDIgCowKP73ucm3N0R/ZSYYNAOEojeB9gyAuveeAPgC5emyHRkRJvTkfkUr+V4w== X-Received: by 2002:a05:6000:1ac8:b0:390:e853:85bd with SMTP id ffacd0b85a97d-3997f9371f1mr4236408f8f.48.1742565546499; Fri, 21 Mar 2025 06:59:06 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:06 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 06/10] phy: phy-snps-eusb2: make repeater optional Date: Fri, 21 Mar 2025 15:58:50 +0200 Message-ID: <20250321135854.1431375-7-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As described in the device tree bindings, it's not necessary for the SNPS eUSB2 phy to be connected to a repeater. In configurations where there are such instances, the driver probing fails and the usb controller does not work. Make the repeater optional to avoid that, which also lets us use the eUSB2 phy when it's connected to a repeater that is not configurable by the kernel (for example it's missing a driver), as long as it has been configured beforehand (usually by the bootloader). Signed-off-by: Ivaylo Ivanov Acked-by: Neil Armstrong Reviewed-by: Dmitry Baryshkov --- drivers/phy/phy-snps-eusb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index fa878389f..8ccd432a0 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -428,7 +428,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) return dev_err_probe(dev, ret, "failed to get regulator supplies\n"); - phy->repeater = devm_of_phy_get_by_index(dev, np, 0); + phy->repeater = devm_of_phy_optional_get(dev, np, 0); if (IS_ERR(phy->repeater)) return dev_err_probe(dev, PTR_ERR(phy->repeater), "failed to get repeater\n"); From patchwork Fri Mar 21 13:58:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 876106 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 DCF251D86DC; Fri, 21 Mar 2025 13:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565552; cv=none; b=pfDl2b2oQd1TDNZMPme5hg8LMJ1WZ3nP4vLxvF6lW20O8Ro2aExHy6LZJvAXOT6zt7gDRg+2i5lDYD/dRcNa9ClWlpFKFKpktdOuRSab/BUALg11zxGrFx0PFSI2UqV++KzYrwPR7mKmM+baLbDilNu6n1n5g7aOYO2YC5B4wpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565552; c=relaxed/simple; bh=aG9NoIWabNMfOTs0C2SDDYKzoP6m6WnbmaDWoB6bUR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Av0DubOIjYr3nJo9z5F6t7lNz6rbU5e/kDUdipDOvm+bYWRzwMxT4OEUHfWkfpmGAXMyxGMSl2IWfN1YT93nSUwc0/C+HPkTtjgv7m+ZzK+bFZuVeQ2wrhTnZeHP6jraLss54YqBdTfLU+NdWqwBrXgTTotTq5JzOx2ijB8o82w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ag5Bf0G2; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ag5Bf0G2" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-399737f4fa4so1253374f8f.0; Fri, 21 Mar 2025 06:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565548; x=1743170348; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uD97zpV+wlCAc5Dqa3CJHXuYAasrjMGVcgw8nIaOK+Y=; b=ag5Bf0G2GSH1Ct9DNjUZucPCehh4tECvIViBM49XPZpTNJe+ZafrClsvDEzrujSQLg VPjJrasNcSgM1iuMEw00EJRS4Mlj0zDRq6N3WxWsh+vBn+wxcBFFRE1LzgHnq1jr/Kkb B5Tic4JHPM64CKV3HiTzza2giIo5tNxLU4Hkql8nWjzuYdd1qaw+AhPzGFFlDJKilFAw QG93oEjgTjvrIQlovqmmqgz0EyZ6zJavy1rOZ1rcPhD7BJN07RktYHPpkgIE+vBf5yKS vKZXIreEpkGf87GZASS4sqW0A+32QFxWGKikp8b9+ldpJcG7S9jlW5j5XnlLVa91DQwx Ft6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565548; x=1743170348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uD97zpV+wlCAc5Dqa3CJHXuYAasrjMGVcgw8nIaOK+Y=; b=eFTZ9WD6E9Uf1B9u/NaMM97uJywGWbmFZf/lbn8bhSpSvOdZmdjM+wG0AMVZBNxZrJ 2659tGeyyAiUdhtzshOyMXsQasfSYINilaLqJXzP3KlJQxudGyMVUeCKjxd+oTzbvVw7 H5EtcL+C7LAA1uimuNAqz8lPVJqde8bHnQHBvul67Ha/QErMRB5z5cYNfePGKF1WZyOB 5J1xEQxf2mSMCpMLyZovRTt59buMm3y2K/IACO0VrxEkP/Vs4y1hTX84qaBUh0iVTPw6 JQvsvo4jc32jiksOdAIvTuDClFShSsRIEWMO+5g1tkZr84MD0vCCmpSPzWvJAD75AjEP 4SaA== X-Forwarded-Encrypted: i=1; AJvYcCUw3ryfTMFwdrcy7EQ1ACqvvaJYrAzRhpAOOkdaOiVDuXcxI1rF5k7n2EgnbjW0lvIjMbbNWKzk5xrA@vger.kernel.org, AJvYcCV3qOSjz18SDBxHo365Lo7VytnaJ/g0hqzb7qdsA+QPzX5TPuLhuWJWQyu+vm8qbM5pN6wK2jHQNtBqyUKJ@vger.kernel.org, AJvYcCVzCAPkOtClafLU8r6CR+iKPM9ioX/fFmUDbbjcnqinz4R8Tx2LioxUTjLb+GM9cdUe874DpsEXXre/ng6FCXd9sD4=@vger.kernel.org X-Gm-Message-State: AOJu0YzWP+P+tkBfVEm5eQdV0IOQ8bQuolBqpA91xp45WutWRXnPmOA+ 89Ah2df9jePKvhZyXjAuZBSueDvPESNT3iALMKvxqHfQtcZw4U+ZxIq2NQ== X-Gm-Gg: ASbGnctqHBvog0aAhsuAXRm6DX+6aseaUkFo9leADPKWxgWbndTFy22fqgwFS5K8ubm V3wqCAZAxCZIKx4SEz2w0L0XcaFGEyjWwg6Ym9C9BCiYiAno3Gqe3UmSjZ/yIKZwWVkYEaPk7Wu MAVAofSUDXShS8MlDYaDx+wHt9acTgSqEiD5Qxe4iaT8kFXpbmXEWOjx42Iuv8oJuqYUKEf2K5d cN87z5UgvdF17j1RrWQlKheu+frst8dghYmMiVfnL4rBgjQ1U/7jflZ8lGxWRwHH1fl8xHHOi3S ydL2eN6Y483Dha14wDWmpoMRdNedOv5tOtH8nFkckcl40ffPXK8rY7k1p4ayXeoGkC4fRkeH9KE OsFF0Q/vEyE2lJFx7tC+C X-Google-Smtp-Source: AGHT+IHNglCQ4pfTDqUg0F9f2emm3ZLLUSteSk2Ug+yZnhnzh83HDlmHCb8q2+bgezMSK3osOJoQPw== X-Received: by 2002:a5d:6d88:0:b0:391:1473:336a with SMTP id ffacd0b85a97d-3997f937d76mr3249245f8f.36.1742565547842; Fri, 21 Mar 2025 06:59:07 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:07 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 07/10] phy: phy-snps-eusb2: make reset control optional Date: Fri, 21 Mar 2025 15:58:51 +0200 Message-ID: <20250321135854.1431375-8-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Not all SoCs expose the reset line controls to the kernel, so make them optional. Signed-off-by: Ivaylo Ivanov Reviewed-by: Dmitry Baryshkov --- drivers/phy/phy-snps-eusb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index 8ccd432a0..1e7e75bbc 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -410,7 +410,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) if (IS_ERR(phy->base)) return PTR_ERR(phy->base); - phy->phy_reset = devm_reset_control_get_exclusive(dev, NULL); + phy->phy_reset = devm_reset_control_get_optional_exclusive(dev, NULL); if (IS_ERR(phy->phy_reset)) return PTR_ERR(phy->phy_reset); From patchwork Fri Mar 21 13:58:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 875275 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 093011D88A6; Fri, 21 Mar 2025 13:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565552; cv=none; b=VubBWpuQ5w+WT4Fkhv7AcnM/JaYX3PB5WGXGymKvVfqCImkFUaJGeXDWIArvenvqNxtrp00WdVW3DAv72U5UW5KYAoRxYWFooVRl/LAQbOyPpBbKP2/YK6Ixjk1BJHEjXzRPvW5vUvriKLgPELJvHglUyg+0OChhSRDAQthsj30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565552; c=relaxed/simple; bh=h/V2Ksaq8LPf2QWafaITViF6wassvP4bTVR+DxHPzik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SSz7PZ2ast0LMfVVjkx6u/5OV8PiqBVXDWP+rNdViz7RhXIZWBbZi6NTrryt4pidDNt2vFXYXFVUBZyIq/u7H7Bmn9W8itSNmBXg4kqZMerRy0EZMuYdKx0XgSFpJN8CKrgGhVhutIAYH358gHyPfZBlt8DG2AFBaSpFIo+ejRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kdj+jYYD; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kdj+jYYD" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-39133f709f5so1091194f8f.0; Fri, 21 Mar 2025 06:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565549; x=1743170349; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sbyZcoaajFlmts2XUhsZjMQOjAP2jAbADTedozzwVLU=; b=kdj+jYYDnhPxzNcdn0oUrIrrZfLy20qhH0N2OYzoE1/9t/68X5W5bAboRvv2OdK9Y4 8N3PPL9kNvXuoxsO33POy9/Cme05QNlEIuaCpUFeCAyqvrLZndj3jMT0LKdpBG2SfFBv 1tbdRs5nGPmRUiubWJQ1UiTflv0XWxpcfDxV7RhjBGz9wxsYN5ORqy0B3PIU9p3st49W UDe3gBszyD16iXywmlszj7G9P1JdLzpwAUOzOHugnNGo5KVILSV2JlcUJf2iMnKDgQbD ApYPJIQcVzCaWd5fN9W7/j13yDeCCZcu3KbPMsBz4CaRH7PE2nB9kuouty4TKB8xrEgv Z6Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565549; x=1743170349; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sbyZcoaajFlmts2XUhsZjMQOjAP2jAbADTedozzwVLU=; b=KFhlQpwtxycbVQEVg5NnDvGGrxRYI8yI3l7zsUHjIMLZHMBB9CuKwMPtC0ja6J9I0x toYR9oqo0RzyjAmE9qvmrcdyrcb8G+obFOUDlO8on6Ct4c7+/36rpw5NnskRdJ4zNuT+ CM4GQ1cINhWyztMXiivR29DPl2JsgL8p9e9jWElK6y/7EAK4LvUODfeDRrmH+g5fGGRY pAyx2jdB3AUvTTZod5qv9AUy8zg3TZKiZ781TePPv2rYXW1fuDxrNsVQvKaqeg6s2nRR FL5hamu94xyLH5bQNsNce7xYwey6H/cYaNa05ZQBJqdDsRDhk0ATNhQLkDTm4de1z6d3 Q7ww== X-Forwarded-Encrypted: i=1; AJvYcCVSQTg4YE2WBYDYlRviUi01KjfSIXA/arRjfeCXN+7D9LaYtu9fqoRHpy1xdb4Hh724CsyROcaEpTtN@vger.kernel.org, AJvYcCXMDcaEDJkcKGGPZZ2afAP6IudTk1taLfnihh0xvfjiw0VgXJ7Ye+EYF2SVLsA8X/Ob/vkXJBSHtEnXwKnlsP++oX8=@vger.kernel.org, AJvYcCXq3n5gf46+HrBFu6AzZOPgpIW+TEFSGCJY5Ut/ez+mIsCF4YibH2UzuVRD1u8CmKWcczQwMtADpCLCW7Dk@vger.kernel.org X-Gm-Message-State: AOJu0YwNTvB7TQUqcC9FjYv4P97tj+a1ZRgMcOgebUVKJLnm+RhahmVb z25fJ5KqY85GMPoRhcQ4poUlnrFmOg6/EMsMkbS9W+V1r/wEXc0w X-Gm-Gg: ASbGncs9nq21xyT9iiCulNb0YGOgUbM1QmW7gQJDZQRtTg3cidoW+jMj8g9FLIzJoCa 7W2SK/lwRkOTBCxYAfiv7A7yzdvpLNeAwoNqZYp/+yBvCYJog1wbYAFDgq3Oq3aeVHeu6qJ0v39 KJ2Uzq2PR/T8ncV4NlJGPAqWe4G0WaUQozF2row+AdBEc8UFrSkfkxzKkh+UHdmi3j76dnoe2pM bt176CsSeP3N5e+epLE4tKgKxAAltgdA/BOcGoRXFwY4DbDQyTKFOg8UkKviYEZe53qSjMtuKkI 7a5Rr6eut7JdgMTqr+M51w+FPHf3CfzKB0Q3fagIjSWtZArrp2802wc/g4q6AAV2PJdeyy9jONP 3PtJqjIpFVPNP3wqbAQKL X-Google-Smtp-Source: AGHT+IH5K8T4c9k4ekIQnpelX9sEZXchTsHL4Ta9XthUbbS4ibsFVFojmfNk/OO/KF7tgKLwgcCcCA== X-Received: by 2002:a05:6000:1a8e:b0:391:4559:8773 with SMTP id ffacd0b85a97d-3997f938993mr3360194f8f.51.1742565549242; Fri, 21 Mar 2025 06:59:09 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:08 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 08/10] phy: phy-snps-eusb2: refactor reference clock init Date: Fri, 21 Mar 2025 15:58:52 +0200 Message-ID: <20250321135854.1431375-9-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of matching frequencies with a switch and case, introduce a table-based lookup. This improves readability, reduces redundancy, and makes it easier to extend support for additional frequencies in the future. Signed-off-by: Ivaylo Ivanov --- drivers/phy/phy-snps-eusb2.c | 61 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index 1e7e75bbc..4ca11860a 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -192,44 +192,47 @@ static void qcom_eusb2_default_parameters(struct snps_eusb2_hsphy *phy) FIELD_PREP(PHY_CFG_TX_HS_XV_TUNE_MASK, 0x0)); } +struct snps_eusb2_ref_clk { + unsigned long freq; + u32 fsel_val; + u32 div_7_0_val; + u32 div_11_8_val; +}; + +static const struct snps_eusb2_ref_clk qcom_eusb2_ref_clk[] = { + { 19200000, FSEL_19_2_MHZ_VAL, DIV_7_0_19_2_MHZ_VAL, DIV_11_8_19_2_MHZ_VAL }, + { 38400000, FSEL_38_4_MHZ_VAL, DIV_7_0_38_4_MHZ_VAL, DIV_11_8_38_4_MHZ_VAL }, +}; + static int qcom_eusb2_ref_clk_init(struct snps_eusb2_hsphy *phy) { + const struct snps_eusb2_ref_clk *config = NULL; unsigned long ref_clk_freq = clk_get_rate(phy->ref_clk); - switch (ref_clk_freq) { - case 19200000: - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, - FSEL_MASK, - FIELD_PREP(FSEL_MASK, FSEL_19_2_MHZ_VAL)); - - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_2, - PHY_CFG_PLL_FB_DIV_7_0_MASK, - DIV_7_0_19_2_MHZ_VAL); - - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, - PHY_CFG_PLL_FB_DIV_11_8_MASK, - DIV_11_8_19_2_MHZ_VAL); - break; - - case 38400000: - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, - FSEL_MASK, - FIELD_PREP(FSEL_MASK, FSEL_38_4_MHZ_VAL)); - - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_2, - PHY_CFG_PLL_FB_DIV_7_0_MASK, - DIV_7_0_38_4_MHZ_VAL); - - snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, - PHY_CFG_PLL_FB_DIV_11_8_MASK, - DIV_11_8_38_4_MHZ_VAL); - break; + for (int i = 0; i < ARRAY_SIZE(qcom_eusb2_ref_clk); i++) { + if (qcom_eusb2_ref_clk[i].freq == ref_clk_freq) { + config = &qcom_eusb2_ref_clk[i]; + break; + } + } - default: + if (!config) { dev_err(&phy->phy->dev, "unsupported ref_clk_freq:%lu\n", ref_clk_freq); return -EINVAL; } + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_HS_PHY_CTRL_COMMON0, + FSEL_MASK, + FIELD_PREP(FSEL_MASK, config->fsel_val)); + + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_2, + PHY_CFG_PLL_FB_DIV_7_0_MASK, + config->div_7_0_val); + + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, + PHY_CFG_PLL_FB_DIV_11_8_MASK, + config->div_11_8_val); + snps_eusb2_hsphy_write_mask(phy->base, QCOM_USB_PHY_CFG_CTRL_3, PHY_CFG_PLL_REF_DIV, PLL_REF_DIV_VAL); From patchwork Fri Mar 21 13:58:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 876105 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 C745D1DDC1B; Fri, 21 Mar 2025 13:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565554; cv=none; b=k4BdbCNeLz5Eil3WkF+rkqkvcQpO4rZSecThmvwZk9Twx5S0jsFga+4nyySBva7ldQ0mZjQcC8ZQF+A2dIjFal7RdCPnzyURnYnyt1wHjWBzX4SmaLYXIb+V3A5NPuw1G0uS8/kYIv/4ysMeNdLaGycmG8jvvA82mwgeBYOy8Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565554; c=relaxed/simple; bh=x7h3U+lfjE80O+91xu7pUmKrz6v3HRS99ScnnIhKqeA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JMbu5zSRy8M9SG1A58bNDObYxJhBzZeQRVlEdCRhUPGX4daT6Ler77W0SdJqUNxanc18J8DN1WLeHlFCCEwTUxPzW+ukR8AcnaHbUt34Yh4Gs9v9v1hTXbAf1uTE7t8Bv0oMvheC8juPuck6WQdjI23m1eFScPGP/2Orfy2P2fQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gboFinPi; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gboFinPi" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43d04ea9d9aso9457215e9.3; Fri, 21 Mar 2025 06:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565551; x=1743170351; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CgZMHv0Maj+ykqpVS5qC2n9kdvYUkd9lbOYXYbxjsJY=; b=gboFinPiYA09rXVunYUVTAX9+/BFk6Z08ui8lSZqKiqfPVUuKEk5K87hlSMFpmrPzh uxjmDqUhSEmrS57cB1Q+szvPjzK4BHWSKjnSWtqIyPeSl35XYLzDdEm9wNbsgT/38F3+ yAuvhR86AVSTZso/TYX1DgtO/gJzQ8RALuyyomV6IKBj0zHL3WNhKdI7Xl71KOIjWtNZ LEBqm+b0tTuaBoMZyYJzovkCkc/uyW6BcBJThTanKnDVTDLC6DBPuXy/evfzg4ejspSC 2K6v2cihrUgWlY0GoS/V8kSOJ4QL0CP4x5zBRsgMLrDG60VnCE08II0V3ecTRlrHqSNc MHHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565551; x=1743170351; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CgZMHv0Maj+ykqpVS5qC2n9kdvYUkd9lbOYXYbxjsJY=; b=s9b1FLitExlErGmm2KPSp68B6Y8KaAITFFQbBdhLrt3idAGhSNJlK0r53+fH3/Z4Yt 5oy6sSWBckzVTuSIXwiYChkjn6LqTTuaCcCYETsw67bLZzDbacremUEkS0z0DWaSOVHm gr+wsdPQSvP0Ri/un4h6GTCdnEuuiKq9w5CrvNcqPD4rhqCNuLpkVq8OP14FaVepPjdp l0GXEa8rpKMaZLV0+bKTFuzdix46dCz+fPlCEbJCTjtgOgQ/okTL3BdobNVRSj9a3UNx jMD45dn6BHaZHsq142ebo38Rz89S2acxI4grGkUhMKLo2JZBt/7EbM4JB0LhjKQtyhLz pIMw== X-Forwarded-Encrypted: i=1; AJvYcCUxIidZsvb+fG15Ay0OmnLvDbFM8w9u7l98yZjvg27z6tJys0bdVCdcdm1Gd5MYSVYgMfHlBE+9Xc6Z@vger.kernel.org, AJvYcCV14i+b3guax1nWeoDl19yg/5Gy5GfRV3xl1+djcTcxRB7DMJF7k3JRX5ZoQhj2g3twuAg3rW/dVj4ikuNVbu6DGqY=@vger.kernel.org, AJvYcCV1TfwN6m0LlZL6evaBnxQAcMTPrLFi+/fZwabavbSlfeZ5tKQ8KwQ5a40ANJm9W2+CDRUQY/jJtTushrIg@vger.kernel.org X-Gm-Message-State: AOJu0YwwLkU6THZpH+8a5bItoEnl3gku/Cg3otHJiu5/Ot6cDMrr/kPt BeBNjh/DZqr7EqVrMQ7AH+skEteZAyKoAAlUmNO+DexnkhcxSaed X-Gm-Gg: ASbGncvO7SueJxEEBHSp871DQ9fV8MhXq1xEebYYaB5INZdBM1/KxBqGNYj7Ap7MiO2 A4UuToxBr7eSAZbsEdA+bTsNZ/SFbAjQs1ZMaexIQZPjEoNQlTclOZSCUuaoxX1tBtZhn6aft8A XLbzHr3QF7EGGED9Ufz5y5b6gLUWBxjDpp2CxV7hS5azTCOSRqcvNQBD0jEjtlwn0xxFuJcAmha PEsY+kfwEgwQDIXQ8SHiBqEcGuVbtXef8GXQ2/8LBvVYNa+kUNWnFzcE9IF0YdYw2R839trfCri D5kSo/HjOlaXm2d6ihw7J8FDFstQz9GPvsjXFl5Z9NAtiVe3S9i7lILvb61bJQJZLTi6g5dOIIL 5jzdAP8KnzPJ4PaPrxtmb X-Google-Smtp-Source: AGHT+IG483kXiPjaAemdueHV42vkF2NnkMPu50jCxoNzdFurIxOd7T8xvIFGk0X9jQOIsr28IXGPnw== X-Received: by 2002:a05:600c:1f92:b0:43d:45a:8fca with SMTP id 5b1f17b1804b1-43d50a3c79fmr27723135e9.30.1742565550669; Fri, 21 Mar 2025 06:59:10 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:10 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 09/10] phy: phy-snps-eusb2: add support for exynos2200 Date: Fri, 21 Mar 2025 15:58:53 +0200 Message-ID: <20250321135854.1431375-10-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The Exynos2200 SoC reuses the Synopsis eUSB2 PHY IP, alongside an external repeater, for USB 2.0. Add support for it to the existing driver, while keeping in mind that it requires enabled more than the reference clock. Signed-off-by: Ivaylo Ivanov --- drivers/phy/Kconfig | 2 +- drivers/phy/phy-snps-eusb2.c | 162 ++++++++++++++++++++++++++++++++++- 2 files changed, 159 insertions(+), 5 deletions(-) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 11c166204..58c911e1b 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -45,7 +45,7 @@ config PHY_PISTACHIO_USB config PHY_SNPS_EUSB2 tristate "SNPS eUSB2 PHY Driver" - depends on OF && (ARCH_QCOM || COMPILE_TEST) + depends on OF && (ARCH_EXYNOS || ARCH_QCOM || COMPILE_TEST) select GENERIC_PHY help Enable support for the USB high-speed SNPS eUSB2 phy on select diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c index 4ca11860a..951f58119 100644 --- a/drivers/phy/phy-snps-eusb2.c +++ b/drivers/phy/phy-snps-eusb2.c @@ -13,6 +13,39 @@ #include #include +#define EXYNOS_USB_PHY_HS_PHY_CTRL_RST (0x0) +#define USB_PHY_RST_MASK GENMASK(1, 0) +#define UTMI_PORT_RST_MASK GENMASK(5, 4) + +#define EXYNOS_USB_PHY_HS_PHY_CTRL_COMMON (0x4) +#define RPTR_MODE BIT(10) +#define FSEL_20_MHZ_VAL (0x1) +#define FSEL_24_MHZ_VAL (0x2) +#define FSEL_26_MHZ_VAL (0x3) +#define FSEL_48_MHZ_VAL (0x2) + +#define EXYNOS_USB_PHY_CFG_PLLCFG0 (0x8) +#define PHY_CFG_PLL_FB_DIV_19_8_MASK GENMASK(19, 8) +#define DIV_19_8_19_2_MHZ_VAL (0x170) +#define DIV_19_8_20_MHZ_VAL (0x160) +#define DIV_19_8_24_MHZ_VAL (0x120) +#define DIV_19_8_26_MHZ_VAL (0x107) +#define DIV_19_8_48_MHZ_VAL (0x120) + +#define EXYNOS_USB_PHY_CFG_PLLCFG1 (0xc) +#define EXYNOS_PHY_CFG_PLL_FB_DIV_11_8_MASK GENMASK(11, 8) +#define EXYNOS_DIV_11_8_19_2_MHZ_VAL (0x0) +#define EXYNOS_DIV_11_8_20_MHZ_VAL (0x0) +#define EXYNOS_DIV_11_8_24_MHZ_VAL (0x0) +#define EXYNOS_DIV_11_8_26_MHZ_VAL (0x0) +#define EXYNOS_DIV_11_8_48_MHZ_VAL (0x1) + +#define EXYNOS_PHY_CFG_TX (0x14) +#define EXYNOS_PHY_CFG_TX_FSLS_VREF_TUNE_MASK GENMASK(2, 1) + +#define EXYNOS_USB_PHY_UTMI_TESTSE (0x20) +#define TEST_IDDQ BIT(6) + #define QCOM_USB_PHY_UTMI_CTRL0 (0x3c) #define SLEEPM BIT(0) #define OPMODE_MASK GENMASK(4, 3) @@ -123,6 +156,8 @@ static const char * const eusb2_hsphy_vreg_names[] = { struct snps_eusb2_phy_drvdata { int (*phy_init)(struct phy *p); + const char * const *clk_names; + int num_clks; }; struct snps_eusb2_hsphy { @@ -130,6 +165,7 @@ struct snps_eusb2_hsphy { void __iomem *base; struct clk *ref_clk; + struct clk_bulk_data *clks; struct reset_control *phy_reset; struct regulator_bulk_data vregs[EUSB2_NUM_VREGS]; @@ -199,6 +235,46 @@ struct snps_eusb2_ref_clk { u32 div_11_8_val; }; +static const struct snps_eusb2_ref_clk exynos_eusb2_ref_clk[] = { + { 19200000, FSEL_19_2_MHZ_VAL, DIV_19_8_19_2_MHZ_VAL, EXYNOS_DIV_11_8_19_2_MHZ_VAL }, + { 20000000, FSEL_20_MHZ_VAL, DIV_19_8_20_MHZ_VAL, EXYNOS_DIV_11_8_20_MHZ_VAL }, + { 24000000, FSEL_24_MHZ_VAL, DIV_19_8_24_MHZ_VAL, EXYNOS_DIV_11_8_24_MHZ_VAL }, + { 26000000, FSEL_26_MHZ_VAL, DIV_19_8_26_MHZ_VAL, EXYNOS_DIV_11_8_26_MHZ_VAL }, + { 48000000, FSEL_48_MHZ_VAL, DIV_19_8_48_MHZ_VAL, EXYNOS_DIV_11_8_48_MHZ_VAL }, +}; + +static int exynos_eusb2_ref_clk_init(struct snps_eusb2_hsphy *phy) +{ + const struct snps_eusb2_ref_clk *config = NULL; + unsigned long ref_clk_freq = clk_get_rate(phy->ref_clk); + + for (int i = 0; i < ARRAY_SIZE(exynos_eusb2_ref_clk); i++) { + if (exynos_eusb2_ref_clk[i].freq == ref_clk_freq) { + config = &exynos_eusb2_ref_clk[i]; + break; + } + } + + if (!config) { + dev_err(&phy->phy->dev, "unsupported ref_clk_freq:%lu\n", ref_clk_freq); + return -EINVAL; + } + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_COMMON, + FSEL_MASK, + FIELD_PREP(FSEL_MASK, config->fsel_val)); + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_CFG_PLLCFG0, + PHY_CFG_PLL_FB_DIV_19_8_MASK, + FIELD_PREP(PHY_CFG_PLL_FB_DIV_19_8_MASK, + config->div_7_0_val)); + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_CFG_PLLCFG1, + EXYNOS_PHY_CFG_PLL_FB_DIV_11_8_MASK, + config->div_11_8_val); + return 0; +} + static const struct snps_eusb2_ref_clk qcom_eusb2_ref_clk[] = { { 19200000, FSEL_19_2_MHZ_VAL, DIV_7_0_19_2_MHZ_VAL, DIV_11_8_19_2_MHZ_VAL }, { 38400000, FSEL_38_4_MHZ_VAL, DIV_7_0_38_4_MHZ_VAL, DIV_11_8_38_4_MHZ_VAL }, @@ -239,6 +315,55 @@ static int qcom_eusb2_ref_clk_init(struct snps_eusb2_hsphy *phy) return 0; } +static int exynos_snps_eusb2_hsphy_init(struct phy *p) +{ + struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); + int ret; + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_RST, + USB_PHY_RST_MASK | UTMI_PORT_RST_MASK, + USB_PHY_RST_MASK | UTMI_PORT_RST_MASK); + fsleep(50); /* required after holding phy in reset */ + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_COMMON, + RPTR_MODE, RPTR_MODE); + + /* update ref_clk related registers */ + ret = exynos_eusb2_ref_clk_init(phy); + if (ret) + return ret; + + /* default parameter: tx fsls-vref */ + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_PHY_CFG_TX, + EXYNOS_PHY_CFG_TX_FSLS_VREF_TUNE_MASK, + FIELD_PREP(EXYNOS_PHY_CFG_TX_FSLS_VREF_TUNE_MASK, 0x0)); + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_UTMI_TESTSE, + TEST_IDDQ, 0); + fsleep(10); /* required after releasing test_iddq */ + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_RST, + USB_PHY_RST_MASK, 0); + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_COMMON, + PHY_ENABLE, PHY_ENABLE); + + snps_eusb2_hsphy_write_mask(phy->base, EXYNOS_USB_PHY_HS_PHY_CTRL_RST, + UTMI_PORT_RST_MASK, 0); + + return 0; +} + +static const char * const exynos_eusb2_hsphy_clock_names[] = { + "ref", "bus", "ctrl", +}; + +static const struct snps_eusb2_phy_drvdata exynos2200_snps_eusb2_phy = { + .phy_init = exynos_snps_eusb2_hsphy_init, + .clk_names = exynos_eusb2_hsphy_clock_names, + .num_clks = ARRAY_SIZE(exynos_eusb2_hsphy_clock_names), +}; + static int qcom_snps_eusb2_hsphy_init(struct phy *p) { struct snps_eusb2_hsphy *phy = phy_get_drvdata(p); @@ -315,8 +440,14 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p) return 0; } +static const char * const qcom_eusb2_hsphy_clock_names[] = { + "ref", +}; + static const struct snps_eusb2_phy_drvdata sm8550_snps_eusb2_phy = { .phy_init = qcom_snps_eusb2_hsphy_init, + .clk_names = qcom_eusb2_hsphy_clock_names, + .num_clks = ARRAY_SIZE(qcom_eusb2_hsphy_clock_names), }; static int snps_eusb2_hsphy_init(struct phy *p) @@ -334,7 +465,7 @@ static int snps_eusb2_hsphy_init(struct phy *p) goto disable_vreg; } - ret = clk_prepare_enable(phy->ref_clk); + ret = clk_bulk_prepare_enable(phy->data->num_clks, phy->clks); if (ret) { dev_err(&p->dev, "failed to enable ref clock, %d\n", ret); goto disable_vreg; @@ -361,7 +492,7 @@ static int snps_eusb2_hsphy_init(struct phy *p) return 0; disable_ref_clk: - clk_disable_unprepare(phy->ref_clk); + clk_bulk_disable_unprepare(phy->data->num_clks, phy->clks); disable_vreg: regulator_bulk_disable(ARRAY_SIZE(phy->vregs), phy->vregs); @@ -417,8 +548,28 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) if (IS_ERR(phy->phy_reset)) return PTR_ERR(phy->phy_reset); - phy->ref_clk = devm_clk_get(dev, "ref"); - if (IS_ERR(phy->ref_clk)) + phy->clks = devm_kcalloc(dev, phy->data->num_clks, sizeof(*phy->clks), + GFP_KERNEL); + if (!phy->clks) + return -ENOMEM; + + for (int i = 0; i < phy->data->num_clks; ++i) + phy->clks[i].id = phy->data->clk_names[i]; + + ret = devm_clk_bulk_get(dev, phy->data->num_clks, phy->clks); + if (ret) + return dev_err_probe(dev, ret, + "failed to get phy clock(s)\n"); + + phy->ref_clk = NULL; + for (int i = 0; i < phy->data->num_clks; ++i) { + if (!strcmp(phy->clks[i].id, "ref")) { + phy->ref_clk = phy->clks[i].clk; + break; + } + } + + if (IS_ERR_OR_NULL(phy->ref_clk)) return dev_err_probe(dev, PTR_ERR(phy->ref_clk), "failed to get ref clk\n"); @@ -458,6 +609,9 @@ static const struct of_device_id snps_eusb2_hsphy_of_match_table[] = { { .compatible = "qcom,sm8550-snps-eusb2-phy", .data = &sm8550_snps_eusb2_phy, + }, { + .compatible = "samsung,exynos2200-snps-eusb2-phy", + .data = &exynos2200_snps_eusb2_phy, }, { }, }; MODULE_DEVICE_TABLE(of, snps_eusb2_hsphy_of_match_table); From patchwork Fri Mar 21 13:58:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 875274 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 0F8EF22578A; Fri, 21 Mar 2025 13:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565556; cv=none; b=JzDZvEttkKEmOiT2EG4VzGsJ6706hD0tBib5MnffgzrDyLhGoZtaVQxytyS/zaiJVv9Vqez8/ZuCVay6E2qe4vb9XSBHEyk6I/DPhKw5OAFrCHW094AcxlyVvq8zCz4jVeiKDOk2N3jqkkaHL/v9dfQbppWEOcnMZYOudwuNqos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742565556; c=relaxed/simple; bh=A3em0Lfxm7ZnWn4ONR98tbJRiGQCPpUSTel3ORvpaHI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r32aL120ERmBujCyJJ/iF/ANN58LJ5LVM6oExx6Sejaksk0VB1chgjWYrlAhG43PnaRvj5AlZU9U1WNZok4+1Bc0xij8tQa0GutM5CfjIb+UDbAoEZGWDqzS95N6BDxaLAIxF9r1cPn0doS3CHQ7fyY3d0VyCBIc3BZij2e6sBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NJxMHW8O; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NJxMHW8O" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3996af42857so2049245f8f.0; Fri, 21 Mar 2025 06:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742565552; x=1743170352; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EoHg50laesVH6CBpuSOJvrId0cJWf2bjffYDRvhMe1w=; b=NJxMHW8Ol3pYAuGwp8aTfr+VoJ74cO2TVz3aHR05cy79xJON49D1jFPXg6xoF0RPlX /dUt56kohg4d7E7lP+ZzaL20hHiEfLkprdnDd+FfHeXtuzAFh1eWDpJWkZcX3XrAtHD6 WV35B3tIq0NaNUula5P3+snOrKm65JjGw3OtjdaezJwcSvQUkX0S98RRXP+9Sz6lK1e/ E2QH6vw8O6+eiE8fNqrGCNSTz8tEJGl9k0CrKdJ6pk7Y+58wHtxZD2ZD5TKlb0zsbSUZ DXPeG84stJq5I7gBCUGkruTylggQtDQZV5QpuPAO1A8HQ4BYIOS6dUUpn7V9YVpMHRCL V22g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742565552; x=1743170352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EoHg50laesVH6CBpuSOJvrId0cJWf2bjffYDRvhMe1w=; b=B+CtgBsj2xTtn3yfhNrgtwXvYOSUe+So46Ft+uxRIVolxInNbU3wq33z7EnSVnw1lg iBJEOb25NMYo8vUt8Y+GkZ4nVKVbns/OOsQ5nf916SBmqr5fPU88MF+btnwsqNSRKLq/ EQleEx/FqRTIWNw6s2V81IYTjgvgmT1h5EJ4v9QU4t8ZPfVhGWS2ZGbzScujPaiKFw3V rc1T4FS4iZxbiFa8gOcUXgsRiPrNfHuv1aKbzHpaOZHjSSt+r3j0+CQ9FdJ3Zd2uFrE3 uQ9fjE2CU7Kh5wq4udRFvcnojAUx+JjcfZx2qxFX+n7Q9OLSy7fJoP9wlW5I76sXkDDO 8jRQ== X-Forwarded-Encrypted: i=1; AJvYcCU84lTcn0xh+95PuwWD3WbDgyTyRcf0nDkVH/26TAQS6eNJyJHEUAyctxAVH/ljsRzrqLetyGd1ZemI2k0X@vger.kernel.org, AJvYcCVPOMtBvdvjUeJyxfXQLalwLuyDaOHWSeuaFBEet4gi4a2Nirs9RONgx68Wj1WZz7Jy2tKLKo0X3MXZ@vger.kernel.org, AJvYcCWiYO4qZajKNyDgVE/pEZqFEAQl28qCthdCDBSmuljN64H0fHAVEzv0/lDwXZfK5gGoBCvZt3Ob2eGjN7Hrc9r81j4=@vger.kernel.org X-Gm-Message-State: AOJu0YxOBtw39CZaZuAI8WzC7rLvyTJ3oUCXR52d0tpZQiskyRXvpjFD oRISh1Agx3oNXM1aUWJcLIENLko5XKGRmp0y6R9PGHgqWmKkw8mk X-Gm-Gg: ASbGncuHw928+O1/2lTepa/d5upHC9Zv+jjxILhr+k4zniRuaeyksU6fLwfbYa49GrJ 1j6Hq9JvfStHzpuV1jCw8Xgqt4wV69j+M5EcYTkSbjfyGh2tbWhARSc93nogAA/pGbcqHB2cI6y rkkvT4pa7W7ELZGr09Xp5IoEuRIOWchibFJ/dlYmAtXIlF1ejS4PCgtNQYyPeshP+bM1zzdlhAV cPiWtzglleJK0z0e5tuWzZe8+81tJSIhxwCcD08NxL5CVj9Gkl5dVBTlzo0xKIKEAkJuZx4r2aq D0oYhHNxZB+prsBP8vEq5ppyF0wBg+4elpVHG/ozeyMZV8TGu30920GQXkmxctgRlXmrjs33dAT o2v3ah/C9ksZCSuYfEeV/0yx0s50qtJ8= X-Google-Smtp-Source: AGHT+IH8AxzOKAAv4IyhNwmi4+8+DTPXWnwEhFBpJxheVkEB9WaJ5eFWW7j3piT/WonO+0Ku4TvAWw== X-Received: by 2002:a5d:5989:0:b0:38a:4184:14ec with SMTP id ffacd0b85a97d-3997f8f7526mr3595461f8f.1.1742565552184; Fri, 21 Mar 2025 06:59:12 -0700 (PDT) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6651sm2437162f8f.75.2025.03.21.06.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 06:59:11 -0700 (PDT) From: Ivaylo Ivanov To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Philipp Zabel , Marek Szyprowski , Sylwester Nawrocki , Abel Vesa Cc: linux-arm-msm@vger.kernel.org, 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 Subject: [PATCH v3 10/10] phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller Date: Fri, 21 Mar 2025 15:58:54 +0200 Message-ID: <20250321135854.1431375-11-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> References: <20250321135854.1431375-1-ivo.ivanov.ivanov1@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for the Exynos USB 3.2 DRD 4nm controller. It's used in recent 4nm SoCs like Exynos2200 and Exynos2400. This device consists of 3 underlying and independent phys: SEC link control phy, Synopsys eUSB 2.0 and Synopsys USBDP/SS combophy. Unlike older device designs, where the internal phy blocks were all IP of Samsung, Synopsys phys are present. This means that the link controller is now mapped differently to account for missing bits and registers. The Synopsys phys also have separate register bases. As there are non-SEC PHYs present now, it doesn't make much sense to implement them in this driver. They are expected to be configured by external drivers, so pass phandles to them. USBDRD3.2 link controller set up is still required beforehand. This commit adds the necessary changes for USB HS to work. USB SS and DisplayPort are out of scope in this commit and will be introduced in the future. Signed-off-by: Ivaylo Ivanov --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 227 ++++++++++++++++++-- include/linux/soc/samsung/exynos-regs-pmu.h | 3 + 2 files changed, 215 insertions(+), 15 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index c421b495e..f85b22a7a 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -34,6 +34,21 @@ #define EXYNOS5_FSEL_26MHZ 0x6 #define EXYNOS5_FSEL_50MHZ 0x7 +/* USB 3.2 DRD 4nm PHY link controller registers */ +#define EXYNOS2200_DRD_CLKRST 0x0c +#define EXYNOS2200_CLKRST_LINK_PCLK_SEL BIT(1) + +#define EXYNOS2200_DRD_UTMI 0x10 +#define EXYNOS2200_UTMI_FORCE_VBUSVALID BIT(1) +#define EXYNOS2200_UTMI_FORCE_BVALID BIT(0) + +#define EXYNOS2200_DRD_HSP_MISC 0x114 +#define HSP_MISC_SET_REQ_IN2 BIT(4) +#define HSP_MISC_RES_TUNE GENMASK(1, 0) +#define RES_TUNE_PHY1_PHY2 0x1 +#define RES_TUNE_PHY1 0x2 +#define RES_TUNE_PHY2 0x3 + /* Exynos5: USB 3.0 DRD PHY registers */ #define EXYNOS5_DRD_LINKSYSTEM 0x04 #define LINKSYSTEM_XHCI_VERSION_CONTROL BIT(27) @@ -383,6 +398,7 @@ struct exynos5_usbdrd_phy_drvdata { * @clks: clocks for register access * @core_clks: core clocks for phy (ref, pipe3, utmi+, ITP, etc. as required) * @drv_data: pointer to SoC level driver data structure + * @hs_phy: pointer to non-Samsung IP high-speed phy controller * @phys: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY * instances each with its 'phy' and 'phy_cfg'. * @extrefclk: frequency select settings when using 'separate @@ -397,6 +413,7 @@ struct exynos5_usbdrd_phy { struct clk_bulk_data *clks; struct clk_bulk_data *core_clks; const struct exynos5_usbdrd_phy_drvdata *drv_data; + struct phy *hs_phy; struct phy_usb_instance { struct phy *phy; u32 index; @@ -1049,6 +1066,149 @@ static const struct phy_ops exynos5_usbdrd_phy_ops = { .owner = THIS_MODULE, }; +static void exynos2200_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) +{ + /* Configure non-Samsung IP PHY, responsible for UTMI */ + phy_init(phy_drd->hs_phy); +} + +static void exynos2200_usbdrd_link_init(struct exynos5_usbdrd_phy *phy_drd) +{ + void __iomem *regs_base = phy_drd->reg_phy; + u32 reg; + + /* + * Disable HWACG (hardware auto clock gating control). This will force + * QACTIVE signal in Q-Channel interface to HIGH level, to make sure + * the PHY clock is not gated by the hardware. + */ + reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); + reg |= LINKCTRL_FORCE_QACT; + writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); + + /* De-assert link reset */ + reg = readl(regs_base + EXYNOS2200_DRD_CLKRST); + reg &= ~CLKRST_LINK_SW_RST; + writel(reg, regs_base + EXYNOS2200_DRD_CLKRST); + + /* Set link VBUS Valid */ + reg = readl(regs_base + EXYNOS2200_DRD_UTMI); + reg |= EXYNOS2200_UTMI_FORCE_BVALID | EXYNOS2200_UTMI_FORCE_VBUSVALID; + writel(reg, regs_base + EXYNOS2200_DRD_UTMI); +} + +static void +exynos2200_usbdrd_link_attach_detach_pipe3_phy(struct phy_usb_instance *inst) +{ + struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); + void __iomem *regs_base = phy_drd->reg_phy; + u32 reg; + + reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); + if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { + /* force pipe3 signal for link */ + reg &= ~LINKCTRL_FORCE_PHYSTATUS; + reg |= LINKCTRL_FORCE_PIPE_EN | LINKCTRL_FORCE_RXELECIDLE; + } else { + /* disable forcing pipe interface */ + reg &= ~LINKCTRL_FORCE_PIPE_EN; + } + writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); + + reg = readl(regs_base + EXYNOS2200_DRD_HSP_MISC); + if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { + /* calibrate only eUSB phy */ + reg |= FIELD_PREP(HSP_MISC_RES_TUNE, RES_TUNE_PHY1); + reg |= HSP_MISC_SET_REQ_IN2; + } else { + /* calibrate for dual phy */ + reg |= FIELD_PREP(HSP_MISC_RES_TUNE, RES_TUNE_PHY1_PHY2); + reg &= ~HSP_MISC_SET_REQ_IN2; + } + writel(reg, regs_base + EXYNOS2200_DRD_HSP_MISC); + + reg = readl(regs_base + EXYNOS2200_DRD_CLKRST); + if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) + reg &= ~EXYNOS2200_CLKRST_LINK_PCLK_SEL; + else + reg |= EXYNOS2200_CLKRST_LINK_PCLK_SEL; + + writel(reg, regs_base + EXYNOS2200_DRD_CLKRST); +} + +static int exynos2200_usbdrd_phy_init(struct phy *phy) +{ + struct phy_usb_instance *inst = phy_get_drvdata(phy); + struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); + int ret; + + if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { + /* Power-on PHY ... */ + ret = regulator_bulk_enable(phy_drd->drv_data->n_regulators, + phy_drd->regulators); + if (ret) { + dev_err(phy_drd->dev, + "Failed to enable PHY regulator(s)\n"); + return ret; + } + } + /* + * ... and ungate power via PMU. Without this here, we get an SError + * trying to access PMA registers + */ + exynos5_usbdrd_phy_isol(inst, false); + + ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); + if (ret) + return ret; + + /* Set up the link controller */ + exynos2200_usbdrd_link_init(phy_drd); + + /* UTMI or PIPE3 link preparation */ + exynos2200_usbdrd_link_attach_detach_pipe3_phy(inst); + + /* UTMI or PIPE3 specific init */ + inst->phy_cfg->phy_init(phy_drd); + + clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); + + return 0; +} + +static int exynos2200_usbdrd_phy_exit(struct phy *phy) +{ + struct phy_usb_instance *inst = phy_get_drvdata(phy); + struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); + void __iomem *regs_base = phy_drd->reg_phy; + u32 reg; + int ret; + + ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); + if (ret) + return ret; + + reg = readl(regs_base + EXYNOS2200_DRD_UTMI); + reg &= ~(EXYNOS2200_UTMI_FORCE_BVALID | EXYNOS2200_UTMI_FORCE_VBUSVALID); + writel(reg, regs_base + EXYNOS2200_DRD_UTMI); + + reg = readl(regs_base + EXYNOS2200_DRD_CLKRST); + reg |= CLKRST_LINK_SW_RST; + writel(reg, regs_base + EXYNOS2200_DRD_CLKRST); + + clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); + + exynos5_usbdrd_phy_isol(inst, true); + return regulator_bulk_disable(phy_drd->drv_data->n_regulators, + phy_drd->regulators); +} + +static const struct phy_ops exynos2200_usbdrd_phy_ops = { + .init = exynos2200_usbdrd_phy_init, + .exit = exynos2200_usbdrd_phy_exit, + .owner = THIS_MODULE, +}; + static void exynos5_usbdrd_usb_v3p1_pipe_override(struct exynos5_usbdrd_phy *phy_drd) { @@ -1350,27 +1510,37 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) return dev_err_probe(phy_drd->dev, ret, "failed to get phy core clock(s)\n"); - ref_clk = NULL; - for (int i = 0; i < phy_drd->drv_data->n_core_clks; ++i) { - if (!strcmp(phy_drd->core_clks[i].id, "ref")) { - ref_clk = phy_drd->core_clks[i].clk; - break; + if (phy_drd->drv_data->n_core_clks) { + ref_clk = NULL; + for (int i = 0; i < phy_drd->drv_data->n_core_clks; ++i) { + if (!strcmp(phy_drd->core_clks[i].id, "ref")) { + ref_clk = phy_drd->core_clks[i].clk; + break; + } } + if (!ref_clk) + return dev_err_probe(phy_drd->dev, -ENODEV, + "failed to find phy reference clock\n"); + + ref_rate = clk_get_rate(ref_clk); + ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk); + if (ret) + return dev_err_probe(phy_drd->dev, ret, + "clock rate (%ld) not supported\n", + ref_rate); } - if (!ref_clk) - return dev_err_probe(phy_drd->dev, -ENODEV, - "failed to find phy reference clock\n"); - - ref_rate = clk_get_rate(ref_clk); - ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk); - if (ret) - return dev_err_probe(phy_drd->dev, ret, - "clock rate (%ld) not supported\n", - ref_rate); return 0; } +static const struct exynos5_usbdrd_phy_config phy_cfg_exynos2200[] = { + { + .id = EXYNOS5_DRDPHY_UTMI, + .phy_isol = exynos5_usbdrd_phy_isol, + .phy_init = exynos2200_usbdrd_utmi_init, + }, +}; + static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = { { .id = EXYNOS5_DRDPHY_UTMI, @@ -1410,6 +1580,19 @@ static const char * const exynos5_regulator_names[] = { "vbus", "vbus-boost", }; +static const struct exynos5_usbdrd_phy_drvdata exynos2200_usb32drd_phy = { + .phy_cfg = phy_cfg_exynos2200, + .phy_ops = &exynos2200_usbdrd_phy_ops, + .pmu_offset_usbdrd0_phy = EXYNOS2200_PHY_CTRL_USB20, + .clk_names = exynos5_clk_names, + .n_clks = ARRAY_SIZE(exynos5_clk_names), + /* clocks and regulators are specific to the underlying PHY blocks */ + .core_clk_names = NULL, + .n_core_clks = 0, + .regulator_names = NULL, + .n_regulators = 0, +}; + static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, .phy_ops = &exynos5_usbdrd_phy_ops, @@ -1651,6 +1834,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { { .compatible = "google,gs101-usb31drd-phy", .data = &gs101_usbd31rd_phy + }, { + .compatible = "samsung,exynos2200-usb32drd-phy", + .data = &exynos2200_usb32drd_phy, }, { .compatible = "samsung,exynos5250-usbdrd-phy", .data = &exynos5250_usbdrd_phy @@ -1719,6 +1905,17 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) return PTR_ERR(phy_drd->reg_phy); } + /* + * USB32DRD 4nm controller implements Synopsys eUSB2.0 PHY + * and Synopsys SS/USBDP COMBOPHY, managed by external code. + */ + if (of_property_present(dev->of_node, "phy-names")) { + phy_drd->hs_phy = devm_of_phy_get(dev, dev->of_node, "hs"); + if (IS_ERR(phy_drd->hs_phy)) + return dev_err_probe(dev, PTR_ERR(phy_drd->hs_phy), + "failed to get hs_phy\n"); + } + ret = exynos5_usbdrd_phy_clk_handle(phy_drd); if (ret) return ret; diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h index ce1a3790d..b77187ba5 100644 --- a/include/linux/soc/samsung/exynos-regs-pmu.h +++ b/include/linux/soc/samsung/exynos-regs-pmu.h @@ -185,6 +185,9 @@ /* Only for S5Pv210 */ #define S5PV210_EINT_WAKEUP_MASK 0xC004 +/* Only for Exynos2200 */ +#define EXYNOS2200_PHY_CTRL_USB20 0x72C + /* Only for Exynos4210 */ #define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154 #define S5P_CMU_RESET_LCD1_LOWPWR 0x1174