From patchwork Wed Jan 15 01:26:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7D3FC02183 for ; Wed, 15 Jan 2025 01:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ansZ00GjXjiQCrDHJEgw6lZ+KJlG1Gj5pb/6tacFV4k=; b=K6Q2TKIx8luOQj K2gcObwR+QydVCg9fs9q474qJBN0uLSV57/gc6o8PPT8ipztqKHfNzzfXJ0Y8yq9E79dsYqUGYJcB lS4yNS22b1Br3S/HHQfl5sObw40wXiEJEbIFQBGcxMIcZohZ2KJIngvq0mDJHeyMHEw9jUxrpwRsx rfvqs3lw4Q03xn4/xOSTMJxWPxgx2glbBVspe3vmejdnQiJMeQLDARgZwtMCjbijP8aEVmUXUPXCo HeUB/6sCv6cCoCHd6jCxiyh3OPyEnnMs45rpPn2yLTzFqW5ohIkdfLhQAxRUBp0AB/nRry5lZCDBT zv46VeWiBcjBsP8/4w5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsCN-0000000AIDB-2DYC; Wed, 15 Jan 2025 01:27:59 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsB7-0000000AHni-3acL; Wed, 15 Jan 2025 01:26:42 +0000 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-467725245a2so56516591cf.3; Tue, 14 Jan 2025 17:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904401; x=1737509201; darn=lists.infradead.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=TW/78u/K4Tk/9Y6Jt2yXAKfWS6TVs/Gwl1yC2tUVx0I=; b=hI6RscksAV+7XIQA3Yq+MHpMNLriUsRsG+K11UxDWnJEq9moP5MGKGg8G2JmAdv14J 9HucTI9wpsK/c0mPOQDOQdJcxT9oVNazKErXp0zEJSFBtXpOEOKVQ+sNh5Su7DWPY50x jkcCEWs9LN9aoKYG3tTNKqXb86dcJTj84YuZKZwqsoE31OG9KS8M68RLwcDz/8b0O2vx kpIHNwBzuCG+pt++zranfapGgnuuviNLjk3BmWqQCarJRn+2p09w7R9LfNbaRf888Hif jrsOqqV5K+XvdQLivQA81TsGH6YzGPsLN8BGGyYdC+U7u5vlmX3BYKpBU56hAEHXzL/k 5Weg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904401; x=1737509201; 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=TW/78u/K4Tk/9Y6Jt2yXAKfWS6TVs/Gwl1yC2tUVx0I=; b=RNgUPLPrNg1yMddOvdCR2yrYwtPmCGeyW1aactQhXc7oSBjZEr4lJt0j2aWoeRYApW lFmuJapEfPwinTz3vBkjTYBIg/hgbGC9nFCAn0UsHB4KwABLQpC3zYBsDX6dv1Y7Hi+i AgdubTgZFeEx0sxrNXZfPTCO+psuLAl9FpRstJtVmbTvAQ3VJJSkdKOqqBDwd3igirbg Ow6+lVBIvUOU5y/FQAGMLBg/ZiZW3KzAH82vQf177rR7Bc9jz5mchUqh/DUq2fNnWZ5B /Yp95NBrnUOCSI4jZS7LkiFGOGzHWwKikYEMDNkOPAagWDP40RZI+f+fHcIUoW4B/G3S maww== X-Forwarded-Encrypted: i=1; AJvYcCV8zI/S93b+bbGfbNXOPiYbMzSxm8qHzEkQ8GoGL6ENp0lWFBu4iQ+4/Q7rnrA5d8+GCo/LuuwBDIu8i4R3x44=@lists.infradead.org, AJvYcCXOnwiiv8835I9Vh5F5AKB06LDFC0hQWXcDHq0v3V5X5+JiFicPj+gC376Z1D3Erbwqnpm019BMdFRlKrJPB4Um@lists.infradead.org X-Gm-Message-State: AOJu0YyhqUL2yQ91TZlmTrE0dySh+2S7fHZXFAMeRrSN8Adf0jz3LCqU 6eg7Yr36VOxJIas5v6WTVdkYroPw+VIpwHEShJEVAUoVSD1/3y/q X-Gm-Gg: ASbGncurJvd0YteF4SsZMAodXKJbhqtVatCM00rcfMSqBePUArcyUp6CuHMJ4dbhlS0 LKqi6Xnx8E+JUcB0Utlut+HTrt8UA64p/Ksoqw6AkT4pYe0U/qpFX6LZ7CWQhsfpY1yTVO0Zssr bvGMOAyNn4nzJ/GIV2f04C7XXfutdFfPRjZUwI/Lwb5fQZ3QZT9xUEJTXVLZEUe6i+dhD/vV/cJ zhgJ8SI8pvgvVmDWHr7ALiw1KYvOenbH0PI2YBCk1AK1cGNtgpR+dYD5GF4c5Z46yD9 X-Google-Smtp-Source: AGHT+IGzpUTf+PdyMGFAlYG5FILFZ7yZKz+uleYeo3HfOkexgjV2nVfuoZLKrOOmDZVssLq3Z0Vfhw== X-Received: by 2002:ac8:5746:0:b0:467:50d0:8869 with SMTP id d75a77b69052e-46c71004b3amr471379241cf.18.1736904400689; Tue, 14 Jan 2025 17:26:40 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:40 -0800 (PST) From: Peter Geis To: Heiko Stuebner Cc: zyw@rock-chips.com, kever.yang@rock-chips.com, frank.wang@rock-chips.com, william.wu@rock-chips.com, wulf@rock-chips.com, linux-rockchip@lists.infradead.org, Peter Geis , Elaine Zhang , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 1/6] clk: rockchip: fix wrong clk_ref_usb3otg parent for rk3328 Date: Wed, 15 Jan 2025 01:26:22 +0000 Message-Id: <20250115012628.1035928-2-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172641_893958_B026BD37 X-CRM114-Status: GOOD ( 11.26 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Correct the clk_ref_usb3otg parent to fix clock control for the usb3 controller on rk3328. Verified against the rk3328 trm, the rk3228h trm, and the rk3328 usb3 phy clock map. Fixes: fe3511ad8a1c ("clk: rockchip: add clock controller for rk3328") Signed-off-by: Peter Geis --- drivers/clk/rockchip/clk-rk3328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c index 3bb87b27b662..cf60fcf2fa5c 100644 --- a/drivers/clk/rockchip/clk-rk3328.c +++ b/drivers/clk/rockchip/clk-rk3328.c @@ -201,7 +201,7 @@ PNAME(mux_aclk_peri_pre_p) = { "cpll_peri", "gpll_peri", "hdmiphy_peri" }; PNAME(mux_ref_usb3otg_src_p) = { "xin24m", - "clk_usb3otg_ref" }; + "clk_ref_usb3otg_src" }; PNAME(mux_xin24m_32k_p) = { "xin24m", "clk_rtc32k" }; PNAME(mux_mac2io_src_p) = { "clk_mac2io_src", From patchwork Wed Jan 15 01:26:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3ACFE77188 for ; Wed, 15 Jan 2025 01:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T1yRQmg2fHriKEXCvDQG58s0xHs3uV6zoHe9qydF4tg=; b=10imDxSYv36sGN LXnpUYmyouXS16clPcTOVNjRVrNH9FgT1bRPJdPahaMgNA1uMBmk0Sxiu6R+Z1LVpcEiqy1gkS9BK MjkJIY8IyTfNbkiW8Od6ZCLl92knR2lk6398I7YsX7zK9zyCpP31e1qU+6CBU/36MoZtthBi/xccV s+H63S62xdqsnhFRacqyui6cMVU86aXDOdEul+maErZvt53aBzk2Vc5B4/L41DCDs8q3E95sPO7yo hrXR37LmHvGgZ3r1SUp2qHeW8Ne8dB6kZ7PuKMcbTupyZ6brObFsiELXk9hfRdCweK1bCDbEGtXQp IO6pPzzs8YOsVd9UoTbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsDa-0000000AIXh-201x; Wed, 15 Jan 2025 01:29:14 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsBA-0000000AHoc-1xAb; Wed, 15 Jan 2025 01:26:46 +0000 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-467a1d43821so3505131cf.1; Tue, 14 Jan 2025 17:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904403; x=1737509203; darn=lists.infradead.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=Snarum8RemNk17GrbLyNHBNd9vFMQQrcExzWnVGfdHE=; b=RlBYqpQXSMclrLIkK5QJFbvI78cdqlLqLmzIAEK8cFPPMU4mvWWtX/hIuIqzzkLsDO xEU+sESSometqu8KewDHVzsvUmFzLMyCyvWB/4qTQZ1IPO4RaPWTEebLpmpI9pGrGhWS kQweic6NWvy9F4fdXGilhik/XRXFzv1F7eBfeiGfb3PBR32X/2iqe7asGlxf5rFeugLo cn9XzVaik3yocq5h9il/eeB8tmIc8PDVxORK0Kzhnpl7IeoLnZwVUhdmL6JlEXQvL6oR +IoOXYogUAgOcR2BrVFtLJZKEC+BlY00Yx3WOjMdofp/+wlD4lWz2g/NjKiSC0U8sAsd qzxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904403; x=1737509203; 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=Snarum8RemNk17GrbLyNHBNd9vFMQQrcExzWnVGfdHE=; b=sVvhPjA28tPYivE5MDrjaI5OQjsnjedvJekDrVjGWPFdTwYDvQGIHvtMpMdTYvhuIo NZGA8MspeN3vfSfDTybS4vaLVs8hTCTUVzYjosckCPyXlIg7WQc24Ek0dRsSD3xHeKrC vaMW4lAuNwsaZsPM2slPhMzx08EmQZeRZIuy1OrmnK5etmko+0zdcb7TGmnvHlo3jO/A FTN+i6to4NqMOjv4GtCk8vl8pvQx261dzsMiFGhdeCdq5rYv2yBxc53cZlHagU0wtXo/ jX6H93kW0ajZipkFez2QQSYaWt3APpOhV++/fOCe/pGfO+hPU6JlqgwXivz9Jd1qJNsr pfTA== X-Forwarded-Encrypted: i=1; AJvYcCUVpZf+lh5thWDhtyIBHsO0bUVslh16lz0dMUooTKyWy92CBdnSWoXc7cOTmUBUM+mT89udHobHjAAz@lists.infradead.org, AJvYcCV//CWQRPgwvJz0JQ3V+37ebRkbDeEFgZu0/i4dAOe6hk0A2jHczOkVgtrSAb8KWqkh4wZx2djO0ObAeoNzNEc=@lists.infradead.org, AJvYcCW41DwUIZxfTiYeT9Kv6jVCDNtp3ziAQcDu2wx3NosV4kdzyV/uU69Z8fgsavcerNk5iGDTspnmBPxhqxKGoj+w@lists.infradead.org X-Gm-Message-State: AOJu0YxZuS99uVOjAi0nKWbpCXUsQ6txW8cWr8ohfMBQfD4Ub0uirQvd DdPKvWR+Lmw2BeOY9nNbdVGfRjq/myjMGa1jw3W2IXott8B0PQYO X-Gm-Gg: ASbGncsjCrYjHUDHGAk49PXv6bdZL6mWi8xZ6qzeWZ73dzrzAZ5q6ZDQxINIqWbjVqg IDCI9QB4NZNqwWidfORbIxevkz9eTdUNAyNPUDxnk7QOmiUQ0ffxrp0+osghJdjE2vN+cYKdBj2 A48E+jShSYHaEbUnO73WvdqRbJEhTc4gsYfL0oV6hZP2ArcH9dVbU4zvsBp90Ef+fo5m+cajo5x kdqY0DMpyj02m0bCCZ43ySDZ+JF47Sf5yd8aju6wjwxZE/nq7E2nS8Q8gwRsp+mlmnq X-Google-Smtp-Source: AGHT+IGOUmK+RMSPaiPxBiaoCjQrSZ5Ap13SAxkBgzinR11U70sZUt737IPnaRgevXgbi2ZEV1eQwQ== X-Received: by 2002:a05:622a:181b:b0:466:9197:b4fa with SMTP id d75a77b69052e-46df5760914mr22651911cf.21.1736904403233; Tue, 14 Jan 2025 17:26:43 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:42 -0800 (PST) From: Peter Geis To: Heiko Stuebner Cc: zyw@rock-chips.com, kever.yang@rock-chips.com, frank.wang@rock-chips.com, william.wu@rock-chips.com, wulf@rock-chips.com, linux-rockchip@lists.infradead.org, Peter Geis , Conor Dooley , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org Subject: [RFC PATCH v1 2/6] dt-bindings: phy: rockchip: add rk3328 usb3 phy Date: Wed, 15 Jan 2025 01:26:23 +0000 Message-Id: <20250115012628.1035928-3-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172644_920456_D2226BC3 X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add documentation for the usb3 phy as implemented on the rk3328 SoC. Signed-off-by: Peter Geis --- .../bindings/phy/rockchip,inno-usb3phy.yaml | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip,inno-usb3phy.yaml diff --git a/Documentation/devicetree/bindings/phy/rockchip,inno-usb3phy.yaml b/Documentation/devicetree/bindings/phy/rockchip,inno-usb3phy.yaml new file mode 100644 index 000000000000..cde489ca87ab --- /dev/null +++ b/Documentation/devicetree/bindings/phy/rockchip,inno-usb3phy.yaml @@ -0,0 +1,166 @@ +# SPDX-License-Identifier: GPL-2.0-only +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip,inno-usb3phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip USB 3.0 phy with Innosilicon IP block + +maintainers: + - Heiko Stuebner + +properties: + compatible: + enum: + - rockchip,rk3328-usb3phy + + reg: + maxItems: 1 + + clocks: + minItems: 3 + maxItems: 3 + + clock-names: + items: + - const: refclk-usb3otg + - const: usb3phy-otg + - const: usb3phy-pipe + + interrupts: + minItems: 4 + + interrupt-names: + items: + - const: bvalid + - const: id + - const: linestate + - const: rxdet + + resets: + minItems: 6 + + reset-names: + items: + - const: usb3phy-u2-por + - const: usb3phy-u3-por + - const: usb3phy-pipe-mac + - const: usb3phy-utmi-mac + - const: usb3phy-utmi-apb + - const: usb3phy-pipe-apb + + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: true + +patternProperties: + + utmi-port@[0-9a-f]+$: + type: object + additionalProperties: false + + properties: + compatible: + enum: + - rockchip,rk3328-usb3phy-utmi + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + + phy-supply: + description: + Phandle to a regulator that provides power to VBUS. + See ./phy-bindings.txt for details. + + required: + - compatible + - reg + - "#phy-cells" + + pipe-port@[0-9a-f]+$: + type: object + additionalProperties: false + + properties: + compatible: + enum: + - rockchip,rk3328-usb3phy-pipe + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + + phy-supply: + description: + Phandle to a regulator that provides power to VBUS. + See ./phy-bindings.txt for details. + + required: + - compatible + - reg + - "#phy-cells" + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - interrupt-names + - resets + - reset-names + +additionalProperties: false + +examples: + - | + #include + #include + #include + soc { + #address-cells = <2>; + #size-cells = <2>; + + usb3phy: usb3-phy@ff460000 { + compatible = "rockchip,rk3328-usb3phy"; + reg = <0x0 0xff460000 0x0 0x10000>; + clocks = <&cru SCLK_REF_USB3OTG>, <&cru PCLK_USB3PHY_OTG>, <&cru PCLK_USB3PHY_PIPE>; + clock-names = "refclk-usb3otg", "usb3phy-otg", "usb3phy-pipe"; + interrupts = , , + , ; + interrupt-names = "bvalid", "id", "linestate", "rxdet"; + resets = <&cru SRST_USB3PHY_U2>, + <&cru SRST_USB3PHY_U3>, + <&cru SRST_USB3PHY_PIPE>, + <&cru SRST_USB3OTG_UTMI>, + <&cru SRST_USB3PHY_OTG_P>, + <&cru SRST_USB3PHY_PIPE_P>; + reset-names = "usb3phy-u2-por", "usb3phy-u3-por", + "usb3phy-pipe-mac", "usb3phy-utmi-mac", + "usb3phy-utmi-apb", "usb3phy-pipe-apb"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + usb3phy_utmi: utmi-port@ff470000 { + compatible = "rockchip,rk3328-usb3phy-utmi"; + reg = <0x0 0xff470000 0x0 0x8000>; + #phy-cells = <0>; + }; + + usb3phy_pipe: pipe-port@ff478000 { + compatible = "rockchip,rk3328-usb3phy-pipe"; + reg = <0x0 0xff478000 0x0 0x8000>; + #phy-cells = <0>; + }; + }; + }; From patchwork Wed Jan 15 01:26:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92F15E77188 for ; Wed, 15 Jan 2025 01:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q2KkXj3xFISTDvHzmcD8Kbo5vVtJvlIqKpZOtNJ6UvM=; b=i11o/DUhMwOOzl 6iYLboKyZ9I7JerPQ6hM+enyH/LzerZELYO687ZwICeqyMavcEiYsNo7QDog3yKGoV177V4MnNqLi J/SSVUhKnA2HkCoC9zMd9+2Jhf68W2Ud0ezqYcJJFKPHNUcJ5z/49N4fpw/5IsjSIorGY0ry+WIyY /6yNw1rffBc393VubU5TQSPwM7bosk4xKeWDXU5R9emWo4OKn4NpxJjZ1/lC3ChD2CZcNDWdpqhHj 5P/P2QvzrvvFSKFsTmdse+xExAs0qSr2gIg1mu7SzqwzUWn2IlignNSFazApC0vPOsjSlu005Sp6P TIKjtYPZSTWEiI9VqpAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsEo-0000000AIlP-3UK4; Wed, 15 Jan 2025 01:30:30 +0000 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsBD-0000000AHq3-2TKN; Wed, 15 Jan 2025 01:26:49 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-6d89a727a19so3906586d6.0; Tue, 14 Jan 2025 17:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904406; x=1737509206; darn=lists.infradead.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=TSu2ilieqgUO5zKTRGeUD5qv6+cUUmQ28sg6xpl/Ysk=; b=IROkqdszgkVIT/d8VdPq/YTtw/LmkUmrS9RA+5G+/wcng+/FWgyOkyk+KZLcsuCX84 L9ufRi+SKb4vA2H0jOQk33HTvp7LMdMDwSM8Qq6QRBSdPC6GX313iU3EF42DUmXx1gyb 4fLxC/Mne9CcGEbMfPEQjlfpMgfodyQMsXNEP4ktWBPjAHDO8QkM4ehh8GWqegoHD2eW RFytNb8v33ni4piYqZGFSNb0Ay8ZOnD3ayyZ7Yz1EHqKyBHeTwE/IvzefTewR0sSFLqn Jb+Fl0Ppgp7dfgqpht0FPX0Rnejjs6Pk5NlDfObSKtpvZVAUkFSJP0Wgunv1Qg3IDnAg d7KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904406; x=1737509206; 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=TSu2ilieqgUO5zKTRGeUD5qv6+cUUmQ28sg6xpl/Ysk=; b=ckcvfrB4KDboOsbF/iIy13C6OeLAw1yuVREo9Mh4qkMfHYROkNe4DX0P8mqEOpo0ln qd9IHS867P1H/rruRizUa+sC9jnbjF9cVGBJjRzC4BGS0XmKPiUc4e7uKtDTL6UpAEm5 kD++VG39u7GOWI9XUKrEA6Yr0gLtC9dCVopHvEZ1YJvzAl9L7L+rVUVwcamFUAuFAeL4 ZhOsOESrbRP3JoPVT9MjqiyZpncZdZs9zuUYOdqF7dGnD+mOam8DRUZ1T7XB/yUHH1PM biZeoDNfYh0YI+EIbUYRwxwtMGH57XH47I5CQZ5FXZtTqaGdrnztEOcI7ms+mvBQma1c R3gQ== X-Forwarded-Encrypted: i=1; AJvYcCVoXXY1razGeyYjYwIkQRprjOWpnvOATGDYriEJCC3dEVUdosJH5w/lPnl8/s7j1YTrZCL/SnVnZso6SInxODyb@lists.infradead.org, AJvYcCX6RqIJlFVpNEi+DbpzwJBwizPx4OuCIn9J+19WHZFpafissVOSX6lveSI1ydrRhCpIAuZPYJOJ/UHfgUGKZDg=@lists.infradead.org, AJvYcCXOzsTSEzATtsFRP+DPBtgisZ7t1igrCldnYgPhEUxuzRiXCirZ/YLtJqKGLcMAHUuFkkMxWbO8DSUq@lists.infradead.org X-Gm-Message-State: AOJu0Ywwin7e7FHneLqmPpkivQoR3sQ/VpKvfcF7n1n7YILQH9etLuLX swoiAr2G/NaLfQEluTVUVqvXXMdD9mdHbdIzn/kMtb/p7kUdrzyf X-Gm-Gg: ASbGnctWZlGtUwnDBFG/guB/AK1YnStZEHE2H4N/BX8VYAmXsAWwZjduheWq6sLlKmY ziqITk0FcW6brCKSLYZT23JacSjFu/I6jMgG4SC84D8mMutI+NyjGcmYkx5wL2tK9O2B8XzoZnQ FiEM1Vq8r2GdwLB6Fm7CY6OemgPwo5KVqCS2/8wCNc0SEXOa1TkR5NR4RAf7nbQltzabi0au2ag D6gZ8kNSw99xkain91s496rif+U47NUV5clPZbJVwTczrTJ2Ln3+acGHiZJSl210O+5 X-Google-Smtp-Source: AGHT+IGx11grCIzrhEM4SMHaq84/7LtIocdm3qvr8pA/OIlL6tsAfWKasVwNac41UogFfWfziivrKA== X-Received: by 2002:a05:6214:4d83:b0:6d8:99cf:d2d0 with SMTP id 6a1803df08f44-6e192cb7ecfmr18890756d6.19.1736904406049; Tue, 14 Jan 2025 17:26:46 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:44 -0800 (PST) From: Peter Geis To: Heiko Stuebner Subject: [RFC PATCH v1 3/6] phy: rockchip: add driver for rk3328 usb3 phy Date: Wed, 15 Jan 2025 01:26:24 +0000 Message-Id: <20250115012628.1035928-4-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172647_638527_63A7FF01 X-CRM114-Status: GOOD ( 20.08 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kishon Vijay Abraham I , Algea Cao , linux-kernel@vger.kernel.org, Philipp Zabel , Arnd Bergmann , frank.wang@rock-chips.com, william.wu@rock-chips.com, kever.yang@rock-chips.com, linux-phy@lists.infradead.org, Sebastian Reichel , linux-rockchip@lists.infradead.org, Vinod Koul , Zhang Yubing , Peter Geis , zyw@rock-chips.com, wulf@rock-chips.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The rk3328 has a combined usb2 and usb3 phy block for the usb3 dwc interface. The implementation up until now has been bugged, with multiple issues ranging from disconnect detection failures to low performance. This driver fixes the majority of the original issues and allows better performance for the rk3328 usb3 port. This driver sources data from multiple sources, including the rk3328 trm, the rk3228h trm, emails from Rockchip, and both the 4.4 and 5.10 downstream drivers. The current implementation allows for basic bring up of the phy block and fixes the detection issues. Interrupts are enabled, but currently only used for debugging. Features missing currently are power management, OTG handling, board specific tuning, regulator control, Currently the only known bugs are a AX88179 usb3 gigabit adapter crashes when operating at usb3 speeds and transmitting large amounts of data and full disconnection detections may be slower than expected (~5-10 seconds). Signed-off-by: Peter Geis --- drivers/phy/rockchip/Kconfig | 10 + drivers/phy/rockchip/Makefile | 1 + drivers/phy/rockchip/phy-rockchip-inno-usb3.c | 869 ++++++++++++++++++ 3 files changed, 880 insertions(+) create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-usb3.c diff --git a/drivers/phy/rockchip/Kconfig b/drivers/phy/rockchip/Kconfig index 2f7a05f21dc5..aac623e84f96 100644 --- a/drivers/phy/rockchip/Kconfig +++ b/drivers/phy/rockchip/Kconfig @@ -48,6 +48,16 @@ config PHY_ROCKCHIP_INNO_USB2 help Support for Rockchip USB2.0 PHY with Innosilicon IP block. +config PHY_ROCKCHIP_INNO_USB3 + tristate "Rockchip INNO USB3PHY Driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + depends on COMMON_CLK + depends on USB_SUPPORT + select GENERIC_PHY + select USB_COMMON + help + Support for Rockchip USB3.0 PHY with Innosilicon IP block. + config PHY_ROCKCHIP_INNO_CSIDPHY tristate "Rockchip Innosilicon MIPI CSI PHY driver" depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF diff --git a/drivers/phy/rockchip/Makefile b/drivers/phy/rockchip/Makefile index 010a824e32ce..ec15dcf37fba 100644 --- a/drivers/phy/rockchip/Makefile +++ b/drivers/phy/rockchip/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY) += phy-rockchip-inno-csidphy.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI) += phy-rockchip-inno-hdmi.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB3) += phy-rockchip-inno-usb3.o obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX) += phy-rockchip-samsung-hdptx.o diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb3.c b/drivers/phy/rockchip/phy-rockchip-inno-usb3.c new file mode 100644 index 000000000000..51b9f3b7fbfa --- /dev/null +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb3.c @@ -0,0 +1,869 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * phy-rockchip-inno-usb3.c - USB3 PHY based on Innosilicon IP as + * implemented on Rockchip rk3328. Tuning data magic bits are taken as is + * from the downstream driver. Downstream driver is located at: + * https://github.com/rockchip-linux/kernel/blob/240a5660d7c23841ccf7b7cc489078bf521b9802/drivers/phy/rockchip/phy-rockchip-inno-usb3.c + * + * Author: Peter Geis + * TODO: + * - Find the rest of the register names / definitions. + * - Implement pm functions. + * - Implement board specific tuning from dts. + * - Implement regulator control. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_WRITE_MASK GENMASK(31, 16) +#define REG_WRITE_SHIFT 16 +#define DISABLE_BITS 0x0 + +/* USB3PHY GRF Registers */ +#define USB3PHY_WAKEUP_CON_REG 0x40 +#define USB3PHY_WAKEUP_STAT_REG 0x44 +#define USB3_LINESTATE_IRQ_EN BIT(0) +#define USB3_RXDET_IRQ_EN BIT(1) +#define USB3_BVALID_RISE_IRQ_EN BIT(2) +#define USB3_BVALID_FALL_IRQ_EN BIT(3) +#define USB3_BVALID_CLEAR_MASK GENMASK(3, 2) +#define USB3_ID_RISE_IRQ_EN BIT(4) +#define USB3_ID_FALL_IRQ_EN BIT(5) +#define USB3_ID_CLEAR_MASK GENMASK(5, 4) +#define USB3_RXDET_EN BIT(6) + +/* PIPE registers */ +/* 0x08 for SSC, default 0x0e */ +#define UNKNOWN_PIPE_REG_000 0x000 +#define UNKNOWN_SSC_000_MASK GENMASK(2, 1) +#define UNKNOWN_SSC_000_ENABLE (0x00 << 1) + +/* 0x83 for 24m, 0x01 for 25m, default 0x86 */ +#define PIPE_REG_020 0x020 +/* RX CDR multiplier high bits [7:6], as P, default 0x2, RX data rate = (2*refclk*P)/Q */ +#define PIPE_RX_CDR_MULT_HIGH_MASK GENMASK(7, 6) +/* TX PLL divider bits [4:0], as N, default 0x6, TX data rate = (2*refclk*M)/N */ +#define PIPE_TX_PLL_DIV_MASK GENMASK(4, 0) + +/* 0x71 for 24m, 0x64 for 25m, default 0x71 */ +#define PIPE_REG_028 0x028 +/* RX CDR multiplier low bits [7:0], as P, default 0x71, RX data rate = (2*refclk*P)/Q */ +#define PIPE_RX_CDR_MULT_LOW_MASK GENMASK(7, 0) + +/* 0x26 for 24m?, 0x21 for 25m, default 0x26 */ +#define PIPE_REG_030 0x030 +/* RX CDR divider bits [4:0], as Q, default 0x6, RX data rate = (2*refclk*P)/Q */ +#define PIPE_RX_CDR_DIV_MASK GENMASK(4, 0) + +/* 1'b1 Disable bandgap power, default 0x00 */ +#define PIPE_REG_044 0x044 +#define BANDGAP_POWER_DISABLE BIT(4) + +/* 0xe0 for rx tune?, default 0xe1 */ +#define PIPE_REG_060 0x060 +#define PIPE_TX_DETECT_BYPASS_DEBUG BIT(4) /* enable to always force detection */ +/* RX CTLE frequency bandwidth response tuning bits [1:0], default 0x1 */ +#define PIPE_RX_CTLE_FREQ_BW_MASK GENMASK(1, 0) +#define PIPE_RX_CTLE_FREQ_BW_TUNE 0x0 + +/* default 0x49 */ +#define PIPE_REG_064 0x064 +/* RX equalizer tail current control bits [6:4], default 0x4 */ +#define PIPE_RX_EQ_TAIL_CURR_MASK GENMASK(6, 4) + +/* 0x08 for rx tune?, default 0x07 */ +#define PIPE_REG_068 0x068 +/* RX equalizer low frequency gain control bits [7:4], default 0x0 */ +#define PIPE_RX_EQ_LOW_GAIN_MASK GENMASK(7, 4) +#define PIPE_RX_EQ_LOW_GAIN_TUNE (0x1 << 4) +/* RX CTLE gain tuning bits [3:0], higher = more gain default 0x7 */ +#define PIPE_RX_CTLE_GAIN_MASK GENMASK(3, 0) +#define PIPE_RX_CTLE_GAIN_TUNE 0x7 /* 0x5 lowest functional value, 0xf highest */ + +/* RX ODT manual resistance config, higher = less resistance, depends on REG_1C4 BIT(5) set */ +#define PIPE_REG_06C 0x06c +/* RX ODT manual resistance high bits [3:0], default 0x0 */ +#define PIPE_RX_ODT_RES_HIGH_MASK GENMASK(3, 0) +#define PIPE_RX_ODT_RES_HIGH_TUNE 0xf + +#define PIPE_REG_070 0x070 +/* RX ODT manual resistance mid bits [7:0], default 0x03 */ +#define PIPE_RX_ODT_RES_MID_MASK GENMASK(7, 0) +#define PIPE_RX_ODT_RES_MID_TUNE 0xff + +#define PIPE_REG_074 0x074 +/* RX ODT manual resistance low bits [7:0], default 0xff */ +#define PIPE_RX_ODT_RES_LOW_MASK GENMASK(7, 0) +#define PIPE_RX_ODT_RES_LOW_TUNE 0xff + +/* default 0x08 */ +#define PIPE_REG_080 0x080 +#define PIPE_TX_COMMON_MODE_DIS BIT(2) /* 1'b1 disable TX common type */ + +/* default 0x33 */ +#define PIPE_REG_088 0x088 +#define PIPE_TX_DRIVER_PREEMP_EN BIT(4) /* 1'b1 enable pre-emphasis */ + +/* default 0x18 */ +#define PIPE_REG_0C0 0x0c0 +#define PIPE_RX_CM_EN BIT(3) /* 1'b1 enable RX CM */ +#define PIPE_TX_OBS_EN BIT(4) /* 1'b1 enable TX OBS */ + +/* 0x12 for rx tune?, default 0x14 */ +#define PIPE_REG_0C8 0x0c8 +/* RX CDR charge pump current bits [3:1], default 0x2 */ +#define PIPE_RX_CDR_CHG_PUMP_MASK GENMASK(3, 1) +#define PIPE_RX_CDR_CHG_PUMP_TUNE (0x2 << 1) + +/* 0x02 for 24m, 0x06 for 25m, default 0x06 */ +#define UNKNOWN_PIPE_REG_108 0x108 +#define UNKNOWN_REFCLK_108_24M 0x02 + +/* 0x80 for 24m, default 0x00 */ +#define UNKNOWN_PIPE_REG_10C 0x10c +#define UNKNOWN_REFCLK_10C_24M BIT(7) + +/* 0x01 for 24m, 0x00 for 25m, default 0x02 */ +#define PIPE_REG_118 0x118 +/* TX PLL multiplier high bits [3:0], as M, default 0x2, TX data rate = (2*refclk*M)/N */ +#define PIPE_TX_PLL_MUL_HIGH_MASK GENMASK(3, 0) + +/* 0x38 for 24m, 0x64 for 25m, default 0x71 */ +#define PIPE_REG_11C 0x11c +/* TX PLL multiplier low bits [7:0], as M, default 0x71, TX data rate = (2*refclk*M)/N */ +#define PIPE_TX_PLL_MUL_LOW_MASK GENMASK(7, 0) + +/* 0x0c for SSC, default 0x1c */ +#define UNKNOWN_PIPE_REG_120 0x120 +#define UNKNOWN_SSC_120_MASK BIT(4) +#define UNKNOWN_SSC_120_ENABLE (0x0 << 4) + +/* default 0x40 */ +#define PIPE_REG_12C 0x12c +#define PIPE_TX_PLL_ALWAYS_ON BIT(0) /* disable for PLL control by pipe_pd */ + +/* 0x05 for rx tune, default 0x01 */ +#define PIPE_REG_148 0x148 +#define PIPE_RX_CHG_PUMP_DIV_2 BIT(2) /* RX CDR charge pump div/2, default 0 */ + +/* 0x70 for rx tune, default 0x72 */ +#define PIPE_REG_150 0x150 +#define PIPE_TX_BIAS_EN BIT(6) /* 1'b1 Enable TX Bias */ +/* RX CDR phase tracking speed bits [3:0], default 0x2 */ +#define PIPE_RX_CDR_SPEED_MASK GENMASK(3, 0) +#define PIPE_RX_CDR_SPEED_TUNE 0x00 + +/* default 0xd4 */ +#define PIPE_REG_160 +/* RX common mode voltage strength bits [5:4], default 0x1 */ +#define PIPE_RX_CDR_COM_VOLT_MASK GENMASK(5, 4) +#define PIPE_RX_CDR_COM_VOLT_TUNE (0x1 << 4) + +/* default 0x00 */ +#define PIPE_REG_180 0x180 +/* TX driver bias reference voltage bits [3:2], in mv */ +#define PIPE_TX_BIAS_REF_VOLT_MASK GENMASK(3, 2) +#define PIPE_TX_BIAS_REF_VOLT_200 (0x0 << 2) +#define PIPE_TX_BIAS_REF_VOLT_175 (0x1 << 2) +#define PIPE_TX_BIAS_REF_VOLT_225 (0x2 << 2) /* downstream 5.10 driver setting */ +#define PIPE_TX_BIAS_REF_VOLT_250 (0x3 << 2) + +/* default 0x01 */ +#define PIPE_REG_1A8 0x1a8 +#define PIPE_LDO_POWER_DIS BIT(4) /* 1'b1 Disable LDO Power */ + +/* default 0x07 */ +#define PIPE_REG_1AC 0x1ac +/* TX driver output common voltage bits [5:4], in mv */ +#define PIPE_TX_COMMON_VOLT_MASK GENMASK(5, 4) +#define PIPE_TX_COMMON_VOLT_800 (0x0 << 4) +#define PIPE_TX_COMMON_VOLT_750 (0x1 << 4) +#define PIPE_TX_COMMON_VOLT_950 (0x2 << 4) +#define PIPE_TX_COMMON_VOLT_1100 (0x3 << 4) + +/* default 0xfb */ +#define PIPE_REG_1B8 0x1b8 +/* TX driver swing strength bits [7:4], range 0x0 to 0xf */ +#define PIPE_TX_DRIVER_SWING_MASK GENMASK(7, 4) /* 0x2 lowest functional value */ +/* TX driver pre-emphasis strength bits [1:0], default 0x3, enabled by REG 088 */ +#define PIPE_TX_DRIVER_PREEMP_STR_MASK GENMASK(1, 0) + +/* set to 0xf0 for rx tune?, default 0xd0 */ +#define PIPE_REG_1C4 0x1c4 +#define PIPE_RX_ODT_AUTO_DIS BIT(5) /* Disable RX ODT auto compensation */ +#define PIPE_TX_ODT_AUTO_DIS BIT(3) /* Disable TX ODT auto compensation */ + +/* UTMI registers */ +/* 0x0f for utmi tune, default 0x09*/ +#define UTMI_REG_030 0x030 +/* {bits[2:0]=111}: always enable pre-emphasis */ +#define UTMI_ENABLE_PRE_EMPH_MASK GENMASK(2, 0) +#define UTMI_ENABLE_PRE_EMPH 0x07 + +/* 0x41 for utmi tune, default 0x49 */ +#define UTMI_REG_040 0x040 +/* TX HS pre-emphasis strength bits [5:3], default 0x1*/ +#define UTMI_TX_PRE_EMPH_STR_MASK GENMASK(5, 3) +#define UTMI_TX_PRE_EMPH_WEAKEST (0x0 << 3) + +/* set to 0xb5 for utmi tune, default 0xb5 */ +#define UTMI_REG_11C 0x11c +/* {bits[4:0]=10101}: odt 45ohm tuning */ +#define UTMI_ODT_45_OHM_MASK GENMASK(4, 0) +#define UTMI_ODT_45_OHM_TUNE 0x15 + +enum rockchip_usb3phy_type { + USB3PHY_TYPE_USB2, + USB3PHY_TYPE_USB3, + USB3PHY_TYPE_MAX, +}; + +/** + * struct rockchip_usb3phy_port - usb-phy port data. + * @phy: port usb phy struct. + * @regmap: port regmap. + * @type: port usb phy type. + */ +struct rockchip_usb3phy_port { + struct phy *phy; + struct regmap *regmap; + enum rockchip_usb3phy_type type; +}; + +struct rockchip_usb3phy { + struct device *dev; + struct regmap *regmap; + struct clk *clk_pipe; + struct clk *clk_otg; + struct clk *clk_ref; + struct reset_control *u3por_rst; + struct reset_control *u2por_rst; + struct reset_control *pipe_rst; + struct reset_control *utmi_rst; + struct reset_control *pipe_apb_rst; + struct reset_control *utmi_apb_rst; + struct rockchip_usb3phy_port ports[USB3PHY_TYPE_MAX]; + int bvalid_irq; + int id_irq; + int ls_irq; + int rxdet_irq; +}; + +struct usb3phy_config { + unsigned int reg; + unsigned int mask; + u8 def; +}; + +static const struct usb3phy_config rk3328_rx_config[] = { + { PIPE_REG_150, PIPE_RX_CDR_SPEED_MASK, PIPE_RX_CDR_SPEED_TUNE }, + { PIPE_REG_0C8, PIPE_RX_CDR_CHG_PUMP_MASK, PIPE_RX_CDR_CHG_PUMP_TUNE }, + { PIPE_REG_148, PIPE_RX_CHG_PUMP_DIV_2, PIPE_RX_CHG_PUMP_DIV_2 }, + { PIPE_REG_068, PIPE_RX_CTLE_GAIN_MASK, PIPE_RX_CTLE_GAIN_TUNE }, +// { PIPE_REG_1C4, PIPE_RX_ODT_AUTO_DIS, PIPE_RX_ODT_AUTO_DIS }, + { PIPE_REG_070, PIPE_RX_ODT_RES_MID_MASK, PIPE_RX_ODT_RES_MID_TUNE }, + { PIPE_REG_06C, PIPE_RX_ODT_RES_HIGH_MASK, PIPE_RX_ODT_RES_HIGH_TUNE }, + { PIPE_REG_060, PIPE_RX_CTLE_FREQ_BW_MASK, PIPE_RX_CTLE_FREQ_BW_TUNE }, + { UNKNOWN_PIPE_REG_10C, UNKNOWN_REFCLK_10C_24M, UNKNOWN_REFCLK_10C_24M }, + { PIPE_REG_060, PIPE_RX_CTLE_FREQ_BW_MASK, PIPE_RX_CTLE_FREQ_BW_TUNE }, + { PIPE_REG_068, PIPE_RX_EQ_LOW_GAIN_MASK, PIPE_RX_EQ_LOW_GAIN_TUNE }, +}; + +static const struct usb3phy_config rk3328_tx_config[] = { + { PIPE_REG_180, PIPE_TX_BIAS_REF_VOLT_MASK, PIPE_TX_BIAS_REF_VOLT_250 }, +}; + +static const struct usb3phy_config rk3328_ssc_config[] = { + { UNKNOWN_PIPE_REG_000, UNKNOWN_SSC_000_MASK, UNKNOWN_SSC_000_ENABLE }, + { UNKNOWN_PIPE_REG_120, UNKNOWN_SSC_120_MASK, UNKNOWN_SSC_120_ENABLE }, +}; + +static const struct usb3phy_config rk3328_utmi_config[] = { + { UTMI_REG_030, UTMI_ENABLE_PRE_EMPH_MASK, UTMI_ENABLE_PRE_EMPH }, + { UTMI_REG_040, UTMI_TX_PRE_EMPH_STR_MASK, UTMI_TX_PRE_EMPH_WEAKEST }, + { UTMI_REG_11C, UTMI_ODT_45_OHM_MASK, UTMI_ODT_45_OHM_TUNE }, +}; + +static const struct usb3phy_config rk3328_pipe_pwr_en_config[] = { + { PIPE_REG_1A8, PIPE_LDO_POWER_DIS, DISABLE_BITS }, + { PIPE_REG_044, BANDGAP_POWER_DISABLE, DISABLE_BITS }, + { PIPE_REG_150, PIPE_TX_BIAS_EN, PIPE_TX_BIAS_EN }, + { PIPE_REG_080, PIPE_TX_COMMON_MODE_DIS, DISABLE_BITS }, + { PIPE_REG_0C0, PIPE_TX_OBS_EN, PIPE_TX_OBS_EN }, + { PIPE_REG_0C0, PIPE_RX_CM_EN, PIPE_RX_CM_EN }, +}; + +static int rockchip_usb3phy_reset(struct rockchip_usb3phy *usb3phy, + bool reset, enum rockchip_usb3phy_type type) +{ + if (reset) { + if (type == USB3PHY_TYPE_USB2) { + clk_disable_unprepare(usb3phy->clk_otg); + reset_control_assert(usb3phy->utmi_rst); + reset_control_assert(usb3phy->u2por_rst); + } + if (type == USB3PHY_TYPE_USB3) { + clk_disable_unprepare(usb3phy->clk_pipe); + reset_control_assert(usb3phy->pipe_rst); + reset_control_assert(usb3phy->u3por_rst); + } + } else { + if (type == USB3PHY_TYPE_USB2) { + reset_control_deassert(usb3phy->u2por_rst); + fsleep(1000); + clk_prepare_enable(usb3phy->clk_otg); + fsleep(500); + reset_control_deassert(usb3phy->utmi_rst); + fsleep(100); + } + if (type == USB3PHY_TYPE_USB3) { + reset_control_deassert(usb3phy->u3por_rst); + fsleep(500); + clk_prepare_enable(usb3phy->clk_pipe); + fsleep(1000); + reset_control_deassert(usb3phy->pipe_rst); + fsleep(100); + } + } + return 0; +} + +static irqreturn_t rockchip_usb3phy_linestate_irq(int irq, void *data) +{ + struct rockchip_usb3phy *usb3phy = data; + int tmp; + + /* check if the interrupt is enabled */ + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, &tmp); + if (!(tmp & USB3_LINESTATE_IRQ_EN)) { + dev_warn(usb3phy->dev, "invalid linestate irq received\n"); + return IRQ_NONE; + } + + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, &tmp); + if (tmp & USB3_LINESTATE_IRQ_EN) + dev_dbg_ratelimited(usb3phy->dev, "linestate irq received\n"); + + /* clear the interrupt */ + regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, USB3_LINESTATE_IRQ_EN); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_usb3phy_bvalid_irq(int irq, void *data) +{ + struct rockchip_usb3phy *usb3phy = data; + int tmp; + + /* check if the interrupt is enabled */ + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, &tmp); + if (!((tmp & USB3_BVALID_FALL_IRQ_EN) | (tmp & USB3_BVALID_RISE_IRQ_EN))) { + dev_warn_ratelimited(usb3phy->dev, "invalid bvalid irq received\n"); + return IRQ_NONE; + } + + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, &tmp); + if (tmp & USB3_BVALID_FALL_IRQ_EN) + dev_dbg(usb3phy->dev, "bvalid falling irq received\n"); + if (tmp & USB3_BVALID_RISE_IRQ_EN) + dev_dbg(usb3phy->dev, "bvalid rising irq received\n"); + + /* clear the interrupt */ + regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, USB3_BVALID_CLEAR_MASK); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_usb3phy_id_irq(int irq, void *data) +{ + struct rockchip_usb3phy *usb3phy = data; + int tmp; + + /* check if the interrupt is enabled */ + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, &tmp); + if (!((tmp & USB3_ID_FALL_IRQ_EN) | (tmp & USB3_ID_RISE_IRQ_EN))) { + dev_warn(usb3phy->dev, "invalid id irq received\n"); + return IRQ_NONE; + } + + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, &tmp); + if (tmp & USB3_ID_FALL_IRQ_EN) + dev_dbg(usb3phy->dev, "id falling irq received\n"); + if (tmp & USB3_ID_RISE_IRQ_EN) + dev_dbg(usb3phy->dev, "id rising irq received\n"); + + /* clear the interrupt */ + regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, USB3_ID_CLEAR_MASK); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_usb3phy_rxdet_irq(int irq, void *data) +{ + struct rockchip_usb3phy *usb3phy = data; + int tmp; + + /* check if the interrupt is enabled */ + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, &tmp); + if (!(tmp & USB3_RXDET_IRQ_EN)) { + dev_warn(usb3phy->dev, "invalid rxdet irq received\n"); + return IRQ_NONE; + } + + regmap_read(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, &tmp); + if (tmp & USB3_RXDET_IRQ_EN) + dev_dbg_ratelimited(usb3phy->dev, "rxdet irq received\n"); + + /* clear the interrupt */ + regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_STAT_REG, USB3_RXDET_IRQ_EN); + + return IRQ_HANDLED; +} + +static int rockchip_usb3phy_bulk_update(struct rockchip_usb3phy *usb3phy, struct regmap *regmap, + const struct usb3phy_config *config, unsigned int size) +{ + unsigned int i, val, tmp; + int ret = 0; + + for (i = 0; i < size; i++) { + ret = regmap_read(regmap, config[i].reg, &val); + if (ret < 0) { + dev_err(usb3phy->dev, "failed to read addr: 0x%02x\n", config[i].reg); + return ret; + } + tmp = val & ~config[i].mask; + tmp |= config[i].def; + dev_dbg(usb3phy->dev, "write: 0x%03x old: 0x%02x new: 0x%02x\n", + config[i].reg, val, tmp); + ret = regmap_write(regmap, config[i].reg, tmp); + if (ret < 0) { + dev_err(usb3phy->dev, "failed to write addr: 0x%02x\n", config[i].reg); + return ret; + } + } + + return ret; +} + +static int rockchip_usb3phy_calc_rate(struct rockchip_usb3phy *usb3phy, struct regmap *regmap) +{ + long rate; + unsigned int mul, div, target = (5000000000 / 100000); + + rate = clk_get_rate(usb3phy->clk_ref) / 100000; + if (rate < 0) { + dev_err(usb3phy->dev, "failed to get refclk, %ld\n", rate); + return rate; + /* lowest possible supported clock is 4.8MHZ, highest rk3328 can do is 1.6GHZ */ + } else if ((rate < 48) | (rate > 16000)) { + goto error; + } + + for (div = 1; div < 32; div++) { + for (mul = 1; mul < 1024; mul++) { + if (((2 * rate * mul) / div) == target) + goto done; + if (((2 * rate * mul) / div) > target) + break; + } + } + +error: + dev_err(usb3phy->dev, "invalid refclock rate, %ld\n", rate * 100000); + return -EINVAL; + +done: + dev_dbg(usb3phy->dev, "refclk rate mul: %x div: %x rate: %ld\n", mul, div, (rate * 100000)); + + regmap_write(regmap, PIPE_REG_020, (mul >> 2) & PIPE_RX_CDR_MULT_HIGH_MASK); + regmap_write(regmap, PIPE_REG_020, div & PIPE_TX_PLL_DIV_MASK); + regmap_write(regmap, PIPE_REG_028, mul & PIPE_RX_CDR_MULT_LOW_MASK); + regmap_write(regmap, PIPE_REG_030, div & PIPE_RX_CDR_DIV_MASK); + regmap_write(regmap, PIPE_REG_118, (mul >> 8) & PIPE_TX_PLL_MUL_HIGH_MASK); + regmap_write(regmap, PIPE_REG_11C, mul & PIPE_TX_PLL_MUL_LOW_MASK); + + return 0; +} + +static int rockchip_usb3phy_init(struct phy *phy) +{ + struct rockchip_usb3phy_port *port = phy_get_drvdata(phy); + struct rockchip_usb3phy *usb3phy = dev_get_drvdata(phy->dev.parent); + int tmp, ret; + + dev_warn(usb3phy->dev, "usb3phy_init %s\n", dev_name(&phy->dev)); + clk_prepare_enable(usb3phy->clk_ref); + rockchip_usb3phy_reset(usb3phy, false, port->type); + + if (port->type == USB3PHY_TYPE_USB2) { + /* + * "For RK3328 SoC, pre-emphasis and pre-emphasis strength must be + * written as one fixed value. The ODT 45ohm value should be tuned + * for different boards to adjust HS eye height." + */ + dev_dbg(usb3phy->dev, "tuning UTMI\n"); + ret = rockchip_usb3phy_bulk_update(usb3phy, port->regmap, rk3328_utmi_config, + ARRAY_SIZE(rk3328_utmi_config)); + } + + if (port->type == USB3PHY_TYPE_USB3) { + /* Enable interrupts */ + tmp = (USB3_LINESTATE_IRQ_EN | USB3_ID_FALL_IRQ_EN | USB3_ID_RISE_IRQ_EN | + USB3_RXDET_IRQ_EN | USB3_BVALID_RISE_IRQ_EN | USB3_BVALID_FALL_IRQ_EN); + tmp |= (tmp << REG_WRITE_SHIFT); + + ret = regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, tmp); + if (ret < 0) { + /* interrupt write determines if we have write access */ + dev_err(usb3phy->dev, "failed to write interrupts\n"); + return ret; + } + + /* Configure for 24M ref clk */ + dev_dbg(usb3phy->dev, "setting pipe for 24M refclk\n"); + if (rockchip_usb3phy_calc_rate(usb3phy, usb3phy->regmap)) + return -EINVAL; + + /* Enable SSC */ + udelay(3); + dev_dbg(usb3phy->dev, "setting pipe for SSC\n"); + ret = rockchip_usb3phy_bulk_update(usb3phy, port->regmap, rk3328_ssc_config, + ARRAY_SIZE(rk3328_ssc_config)); + + /* "Tuning RX for compliance RJTL test" */ + dev_dbg(usb3phy->dev, "setting pipe for RX tuning\n"); + ret = rockchip_usb3phy_bulk_update(usb3phy, port->regmap, rk3328_rx_config, + ARRAY_SIZE(rk3328_rx_config)); + if (ret) + return ret; + + /* + * "Tuning TX to increase the bias current used in TX driver and RX EQ, + * it can also increase the voltage of LFPS." + */ + dev_dbg(usb3phy->dev, "setting pipe for TX tuning\n"); + ret = rockchip_usb3phy_bulk_update(usb3phy, port->regmap, + rk3328_tx_config, ARRAY_SIZE(rk3328_tx_config)); + + /* Power up the pipe */ + dev_dbg(usb3phy->dev, "setting pipe power on\n"); + ret = rockchip_usb3phy_bulk_update(usb3phy, port->regmap, rk3328_pipe_pwr_en_config, + ARRAY_SIZE(rk3328_pipe_pwr_en_config)); + } + + return 0; +} + +static int rockchip_usb3phy_parse_dt(struct rockchip_usb3phy *usb3phy, struct device *dev) +{ + int ret; + + usb3phy->clk_pipe = devm_clk_get(dev, "usb3phy-pipe"); + if (IS_ERR(usb3phy->clk_pipe)) { + dev_err(dev, "could not get usb3phy pipe clock\n"); + return PTR_ERR(usb3phy->clk_pipe); + } + + usb3phy->clk_otg = devm_clk_get(dev, "usb3phy-otg"); + if (IS_ERR(usb3phy->clk_otg)) { + dev_err(dev, "could not get usb3phy otg clock\n"); + return PTR_ERR(usb3phy->clk_otg); + } + + usb3phy->clk_ref = devm_clk_get(dev, "refclk-usb3otg"); + if (IS_ERR(usb3phy->clk_ref)) { + dev_err(dev, "could not get usb3phy ref clock\n"); + return PTR_ERR(usb3phy->clk_ref); + } + + usb3phy->u2por_rst = devm_reset_control_get(dev, "usb3phy-u2-por"); + if (IS_ERR(usb3phy->u2por_rst)) { + dev_err(dev, "no usb3phy-u2-por reset control found\n"); + return PTR_ERR(usb3phy->u2por_rst); + } + + usb3phy->u3por_rst = devm_reset_control_get(dev, "usb3phy-u3-por"); + if (IS_ERR(usb3phy->u3por_rst)) { + dev_err(dev, "no usb3phy-u3-por reset control found\n"); + return PTR_ERR(usb3phy->u3por_rst); + } + + usb3phy->pipe_rst = devm_reset_control_get(dev, "usb3phy-pipe-mac"); + if (IS_ERR(usb3phy->pipe_rst)) { + dev_err(dev, "no usb3phy_pipe_mac reset control found\n"); + return PTR_ERR(usb3phy->pipe_rst); + } + + usb3phy->utmi_rst = devm_reset_control_get(dev, "usb3phy-utmi-mac"); + if (IS_ERR(usb3phy->utmi_rst)) { + dev_err(dev, "no usb3phy-utmi-mac reset control found\n"); + return PTR_ERR(usb3phy->utmi_rst); + } + + usb3phy->pipe_apb_rst = devm_reset_control_get(dev, "usb3phy-pipe-apb"); + if (IS_ERR(usb3phy->pipe_apb_rst)) { + dev_err(dev, "no usb3phy-pipe-apb reset control found\n"); + return PTR_ERR(usb3phy->pipe_apb_rst); + } + + usb3phy->utmi_apb_rst = devm_reset_control_get(dev, "usb3phy-utmi-apb"); + if (IS_ERR(usb3phy->utmi_apb_rst)) { + dev_err(dev, "no usb3phy-utmi-apb reset control found\n"); + return PTR_ERR(usb3phy->utmi_apb_rst); + } + + usb3phy->ls_irq = of_irq_get_byname(dev->of_node, "linestate"); + if (usb3phy->ls_irq < 0) { + dev_err(dev, "no linestate irq provided\n"); + return usb3phy->ls_irq; + } + + ret = devm_request_threaded_irq(dev, usb3phy->ls_irq, NULL, rockchip_usb3phy_linestate_irq, + IRQF_ONESHOT, "rockchip_usb3phy_ls", usb3phy); + if (ret) { + dev_err(dev, "failed to request linestate irq handle\n"); + return ret; + } + + usb3phy->bvalid_irq = of_irq_get_byname(dev->of_node, "bvalid"); + if (usb3phy->bvalid_irq < 0) { + dev_err(dev, "no bvalid irq provided\n"); + return usb3phy->bvalid_irq; + } + + ret = devm_request_threaded_irq(dev, usb3phy->bvalid_irq, NULL, rockchip_usb3phy_bvalid_irq, + IRQF_ONESHOT, "rockchip_usb3phy_bvalid", usb3phy); + if (ret) { + dev_err(dev, "failed to request bvalid irq handle\n"); + return ret; + } + + usb3phy->id_irq = of_irq_get_byname(dev->of_node, "id"); + if (usb3phy->id_irq < 0) { + dev_err(dev, "no id irq provided\n"); + return usb3phy->id_irq; + } + + ret = devm_request_threaded_irq(dev, usb3phy->id_irq, NULL, rockchip_usb3phy_id_irq, + IRQF_ONESHOT, "rockchip_usb3phy-id", usb3phy); + if (ret) { + dev_err(dev, "failed to request id irq handle\n"); + return ret; + } + + usb3phy->rxdet_irq = of_irq_get_byname(dev->of_node, "rxdet"); + if (usb3phy->rxdet_irq < 0) { + dev_err(dev, "no rxdet irq provided\n"); + return usb3phy->rxdet_irq; + } + + ret = devm_request_threaded_irq(dev, usb3phy->rxdet_irq, NULL, rockchip_usb3phy_rxdet_irq, + IRQF_ONESHOT, "rockchip_usb3phy-rxdet", usb3phy); + if (ret) { + dev_err(dev, "failed to request rxdet irq handle\n"); + return ret; + } + + return 0; +} + +static int rockchip_usb3phy_exit(struct phy *phy) +{ + struct rockchip_usb3phy_port *port = phy_get_drvdata(phy); + struct rockchip_usb3phy *usb3phy = dev_get_drvdata(phy->dev.parent); + + dev_dbg(usb3phy->dev, "usb3phy_shutdown\n"); + rockchip_usb3phy_reset(usb3phy, true, port->type); + + return 0; +} + +static const struct phy_ops rockchip_usb3phy_ops = { + .init = rockchip_usb3phy_init, + .exit = rockchip_usb3phy_exit, + .owner = THIS_MODULE, +}; + +static const struct regmap_config rockchip_usb3phy_utmi_port_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 0x400, + .cache_type = REGCACHE_NONE, + .fast_io = true, + .name = "utmi-port", +}; + +static const struct regmap_config rockchip_usb3phy_pipe_port_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 0x400, + .cache_type = REGCACHE_NONE, + .fast_io = true, + .name = "pipe-port", +}; + +static const struct regmap_config rockchip_usb3phy_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 0x400, + .write_flag_mask = REG_WRITE_MASK, + .cache_type = REGCACHE_NONE, + .fast_io = true, +}; + +static int rockchip_usb3phy_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *child_np; + struct phy_provider *provider; + struct rockchip_usb3phy *usb3phy; + const struct regmap_config regmap_config = rockchip_usb3phy_regmap_config; + void __iomem *base; + int i, ret; + + dev_dbg(dev, "Probe usb3phy main block\n"); + usb3phy = devm_kzalloc(dev, sizeof(*usb3phy), GFP_KERNEL); + if (!usb3phy) + return -ENOMEM; + + ret = rockchip_usb3phy_parse_dt(usb3phy, dev); + if (ret) { + dev_err(dev, "parse dt failed %i\n", ret); + return ret; + } + + base = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(base)) { + dev_err(dev, "failed port ioremap\n"); + return PTR_ERR(base); + } + + usb3phy->regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(usb3phy->regmap)) { + dev_err(dev, "regmap init failed\n"); + return PTR_ERR(usb3phy->regmap); + } + + usb3phy->dev = dev; + platform_set_drvdata(pdev, usb3phy); + + /* place block in reset */ + reset_control_assert(usb3phy->pipe_rst); + reset_control_assert(usb3phy->utmi_rst); + reset_control_assert(usb3phy->u3por_rst); + reset_control_assert(usb3phy->u2por_rst); + reset_control_assert(usb3phy->pipe_apb_rst); + reset_control_assert(usb3phy->utmi_apb_rst); + + fsleep(20); + + /* take apb interface out of reset */ + reset_control_deassert(usb3phy->utmi_apb_rst); + reset_control_deassert(usb3phy->pipe_apb_rst); + + /* enable usb3phy rx detection to fix disconnection issues */ + regmap_write(usb3phy->regmap, USB3PHY_WAKEUP_CON_REG, + (USB3_RXDET_EN | (USB3_RXDET_EN << REG_WRITE_SHIFT))); + + dev_dbg(dev, "Completed usb3phy core probe\n"); + + /* probe the actual ports */ + i = 0; + for_each_available_child_of_node(np, child_np) { + const struct regmap_config *regmap_port_config; + struct rockchip_usb3phy_port *port = &usb3phy->ports[i]; + struct phy *phy; + + if (of_node_name_eq(child_np, "utmi-port")) { + port->type = USB3PHY_TYPE_USB2; + regmap_port_config = &rockchip_usb3phy_utmi_port_regmap_config; + } else if (of_node_name_eq(child_np, "pipe-port")) { + port->type = USB3PHY_TYPE_USB3; + regmap_port_config = &rockchip_usb3phy_pipe_port_regmap_config; + } else { + dev_err(dev, "unknown child node port type %s\n", child_np->name); + goto err_port; + } + + base = devm_of_iomap(dev, child_np, 0, NULL); + if (IS_ERR(base)) { + dev_err(dev, "failed port ioremap\n"); + ret = PTR_ERR(base); + goto err_port; + } + + port->regmap = devm_regmap_init_mmio(dev, base, regmap_port_config); + if (IS_ERR(port->regmap)) { + dev_err(dev, "regmap init failed\n"); + ret = PTR_ERR(port->regmap); + goto err_port; + } + + phy = devm_phy_create(dev, child_np, &rockchip_usb3phy_ops); + if (IS_ERR(phy)) { + dev_err_probe(dev, PTR_ERR(phy), "failed to create phy\n"); + ret = PTR_ERR(phy); + goto err_port; + } + + port->phy = phy; + phy_set_drvdata(port->phy, port); + + /* to prevent out of boundary */ + if (++i >= USB3PHY_TYPE_MAX) { + of_node_put(child_np); + break; + } + + dev_info(dev, "Completed usb3phy %s port init\n", child_np->name); + } + + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + return PTR_ERR_OR_ZERO(provider); + +err_port: + of_node_put(child_np); + return ret; +} + +static const struct of_device_id rockchip_usb3phy_dt_ids[] = { + { .compatible = "rockchip,rk3328-usb3phy", }, +}; + +MODULE_DEVICE_TABLE(of, rockchip_usb3phy_dt_ids); + +static struct platform_driver rockchip_usb3phy_driver = { + .probe = rockchip_usb3phy_probe, + .driver = { + .name = "rockchip-usb3-phy", + .of_match_table = rockchip_usb3phy_dt_ids, + }, +}; + +module_platform_driver(rockchip_usb3phy_driver); + +MODULE_AUTHOR("Peter Geis "); +MODULE_DESCRIPTION("Rockchip Innosilicon USB3PHY driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Jan 15 01:26:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77EFAE77188 for ; Wed, 15 Jan 2025 01:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QXa5LZpdPNLkvHcgXAicEaKK0nHgygehaQMmXMve70I=; b=aCH0XmS4fIB1kV P129wJmk0g8tgqooQZ8E2cyyZ2w08UC3QufGk4zbI1gmkM+HU/JLI+M4jQv92YcOsTuSgqW6Cl31I OjS7JqT5/yw7jMaxrTTOl2tGZYT/qWi00NUpg2uKe+CtA8R8ElvFKbu1yJz/e+FMRZxqMFZLa5Oh6 jnUQ2l8nNT+fzv/Q3BsLcfYus0rtcE3qKOKbI7OLggZKy4jeqtDYtjX2qL2KOtbJIDK4bVM709WKN GeQHSjisd/PG0mKWyEcj1zN5qUnNhpMsNM7GjTxLp08zU8RKKW/NBJ9+6kUkcw/QGNUI/LM/T2BX3 d8LV3XF19OxcxY10k82Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsG1-0000000AIzW-1oVV; Wed, 15 Jan 2025 01:31:45 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsBF-0000000AHrc-2kin; Wed, 15 Jan 2025 01:26:51 +0000 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-467a3f1e667so41608631cf.0; Tue, 14 Jan 2025 17:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904409; x=1737509209; darn=lists.infradead.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=yyuiOWHUod2sqfzhej2zdZRrKrw1CUBKcQwVtOUV0E8=; b=QQw+LX0Cdl0Uo/hvVEQdwT9Urxfe3ZvIHc87ViSmqHgHck/vxFrx83hc61AwD0YFi8 2AQrEIitW27RtqhjXTJzydQ6Fr4/bxUutqBiLpcoXwTF+/ORx7QcIk7C0xaiXzoNsWE8 ULNiPGiZmJR3N18KM0uNQP0qFFaL+ecNRFZMD3afDHsSD6OJ6zrKz4YOFfE9cHtjjEUp kNi5s9VKNJMUdz8x3k88Yi1+jje1slcLJmgkE3IKoeWb4JoABK94YtD24RnDq8R8YCkC QMu0AdI8GYEPZvoSPMcIsqtJljCGvcKDHIdQ5a2a6WY1G5Hv1AP6fDhIEUXXgMLSKRAA XhSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904409; x=1737509209; 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=yyuiOWHUod2sqfzhej2zdZRrKrw1CUBKcQwVtOUV0E8=; b=SOsZA3taUrvpUan3oMBvm5T8IiTKS2lQZd09ZHqduxXhlY0njO0zQmDcot7KgcefJc vKKmZgfkiK3VXh1wsbXKq0w4XjC1SGCoFZgPpquw8r+oM7BIJymqXq1srt3UvzD5u1Ce IfzzOO1PzCLFqTGDJWyO7D+Y55yscN9Uu7AEv+g+0m0w8/ZrWuftQeHqblSMJI08GLyJ dZSwYrsutvdqt8u/66/0x2S0NbJYfKG3Gzj0GFSolivMtpc6QCvDoYw0b/Qw7c0QQFyC WM0Ttj59hvE6Xpp/OXO2hjWzSqObjaU1gyhHw9Z3VxTrycbKpuuuqpiKpzc7L2NQcHOo mL+g== X-Forwarded-Encrypted: i=1; AJvYcCWwvXdnUDpqdXuNWFhNhkbJe95fOo8y3lFI1tAk9ltCmEANt/aOZC47tFAZ5EmPzA8BSFq60ORssOESoZatd2w=@lists.infradead.org, AJvYcCXtS+Q3xnA6ADNhCa1NeHo9TyPPLoRe6vr++bErRDIzGSumKuvucLMst1s6+j6+Zzx4Qxc69KEanxOMM0FrhOmy@lists.infradead.org X-Gm-Message-State: AOJu0YzGy2V2tTBtaREW3KlnZjkmrj6u1j0OJbhps7lhymLJxkKU9Gq3 MvmMLWNVd0YKaVM4SuJe09+WVFcWqLBlegq64wc948qlSxbY6nnO X-Gm-Gg: ASbGnctBKcCb3uOd7Tah3/g1NQikamfAaZAJdYmDO1jc6nBHSWsK6nQ6jrwDB6omWhI WhtyG/imtaO7dE1GTU1Ze+ou693O5q317Ww/US0qa7ukvjI/2EnOCs4zz0XtNT9RHQZwhrG8RYG 7JuIGZRisAxAsK+s6WXqgF9K7VJXCykUgyjnnELKXh2x1PW8ezLCOzJL4rWVF5YzmUj8mAZh+B9 2PZp5NQmGXNjQ3l+DQGOC3MpDMIomQoILct0juY2ROuR9TX2Hlx1GLNZzmRUDNiZEzD X-Google-Smtp-Source: AGHT+IGVwN2rLclQGuxl2u8LG0fj7kqMeY5ZEai4kqHocjNfKR80vQhAtoz97g9hIjYX7GdkJYOSuQ== X-Received: by 2002:ac8:5916:0:b0:467:706f:14b7 with SMTP id d75a77b69052e-46c710a98ebmr466909541cf.30.1736904408728; Tue, 14 Jan 2025 17:26:48 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:47 -0800 (PST) From: Peter Geis To: Heiko Stuebner Cc: zyw@rock-chips.com, kever.yang@rock-chips.com, frank.wang@rock-chips.com, william.wu@rock-chips.com, wulf@rock-chips.com, linux-rockchip@lists.infradead.org, Peter Geis , Alex Bee , Conor Dooley , Diederik de Haas , Dragan Simic , Johan Jonker , Jonas Karlman , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 4/6] arm64: dts: rockchip: add rk3328 usb3 phy node Date: Wed, 15 Jan 2025 01:26:25 +0000 Message-Id: <20250115012628.1035928-5-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172649_691018_D2BAE516 X-CRM114-Status: GOOD ( 10.56 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Add the node for the rk3328 usb3 phy. This node provides a combined usb2 and usb3 phy which are permenantly tied to the dwc3 usb3 controller. Signed-off-by: Peter Geis --- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi index 7d992c3c01ce..181a900d41f9 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi @@ -903,6 +903,43 @@ u2phy_host: host-port { }; }; + usb3phy: usb3-phy@ff460000 { + compatible = "rockchip,rk3328-usb3phy"; + reg = <0x0 0xff460000 0x0 0x10000>; + clocks = <&cru SCLK_REF_USB3OTG>, <&cru PCLK_USB3PHY_OTG>, <&cru PCLK_USB3PHY_PIPE>; + clock-names = "refclk-usb3otg", "usb3phy-otg", "usb3phy-pipe"; + interrupts = , , + , ; + interrupt-names = "bvalid", "id", "linestate", "rxdet"; + resets = <&cru SRST_USB3PHY_U2>, + <&cru SRST_USB3PHY_U3>, + <&cru SRST_USB3PHY_PIPE>, + <&cru SRST_USB3OTG_UTMI>, + <&cru SRST_USB3PHY_OTG_P>, + <&cru SRST_USB3PHY_PIPE_P>; + reset-names = "usb3phy-u2-por", "usb3phy-u3-por", + "usb3phy-pipe-mac", "usb3phy-utmi-mac", + "usb3phy-utmi-apb", "usb3phy-pipe-apb"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "disabled"; + + usb3phy_utmi: utmi-port@ff470000 { + compatible = "rockchip,rk3328-usb3phy-utmi"; + reg = <0x0 0xff470000 0x0 0x8000>; + #phy-cells = <0>; + status = "disabled"; + }; + + usb3phy_pipe: pipe-port@ff478000 { + compatible = "rockchip,rk3328-usb3phy-pipe"; + reg = <0x0 0xff478000 0x0 0x8000>; + #phy-cells = <0>; + status = "disabled"; + }; + }; + sdmmc: mmc@ff500000 { compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; reg = <0x0 0xff500000 0x0 0x4000>; @@ -1067,6 +1104,8 @@ usbdrd3: usb@ff600000 { clock-names = "ref_clk", "suspend_clk", "bus_clk"; dr_mode = "otg"; + phys = <&usb3phy_utmi>, <&usb3phy_pipe>; + phy-names = "usb2-phy", "usb3-phy"; phy_type = "utmi_wide"; snps,dis-del-phy-power-chg-quirk; snps,dis_enblslpm_quirk; From patchwork Wed Jan 15 01:26:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF8A5E77188 for ; Wed, 15 Jan 2025 01:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VZjSR8nN/LQJ/T10j/brK8ZwxR6OhvETbjz7TFulFbw=; b=2m7em9cnfDSh91 ZjUCHPyq0Z4yobBt/5rFKbZaqcMiZ/Svwm1DHjAo3xflM1AXT/+Iv2F8Yox4+xFbQUHUy//KnrH4b Dt5HZLuok9Q6ivUiFY0eUkmep65o+6H6vCwDZxbFDoO+LK1UF9rnAUl09/E3EZVRDh48n19R8uy4d JW46WkddzerJfWJBM8K0W+M7ZB5TK2+2MwDsfiKPxy4c21MMNLwtBtKvx3L3t/eQ8QL6gSBee1Ygf fgUr56J4kAtfhZtdfmzEc6z2Gcspsnow7NT68OnCDhqzP4t0illbk5XkNtFwYxvRX3TbznjP0ReFa Lj7j7ZkXVt0Se4ozIMaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsHE-0000000AJBn-2nsO; Wed, 15 Jan 2025 01:33:00 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsBI-0000000AHsp-1mSm; Wed, 15 Jan 2025 01:26:53 +0000 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-4678cce3d60so59702691cf.2; Tue, 14 Jan 2025 17:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904411; x=1737509211; darn=lists.infradead.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=gVssDOqm+J+pahSUoCWyMm9PmHHWDBPd01GSGUshCEI=; b=MypT0kdM+noi2RG2BlNCCKWIJDMxIxNbh3aKNUAGXNkeqVvvjp2AwZlS46D7S1Mxws f/ARJrV0U5/7ywGz5/MmTovF6+WetM3+p5yqfLn4VHQuzpDsgtmYKm+7zlbv1m5ROL2J 8fiBzeRQvlclmxXhAT9P7tAePIm71frSG8LvCn4NEPKWYHiBJPGOltXuJ9nU2L2IsGv1 UhZg4DaMJ5vOjxiONLEsrbo2yzl6w8N9yZDnsMpL4iZLbALhXBC+ToZRpwqVeqwVK2nT uqTJkszxwAaWK/OKjkQ1u+UPEC4nhIf5fNfJaQzutjoFyj5rJdpB4h/kFf3gbvvJ3BP9 Vftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904411; x=1737509211; 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=gVssDOqm+J+pahSUoCWyMm9PmHHWDBPd01GSGUshCEI=; b=IEyJgwAH5ktWXXSWtPAWZ7f1K+PeggkWIybvQOLLPgFfzqUGDJqddw9gEAaCXqGS6Y rugJcyifVrGQyfVn0GAxBda/ymH6fjUUqacZGyum8WnghaDU/P7owciu7VjxBASmdjVA myVSIGlQYGXJxiYTl3Nj1tNAO2aw1ZJT2S+zL04K2rfxMHjEUYy2Y3Ww4LJb/UUKISQS QG8DSs8yEXKJKUXFFPvRH4qHnqeuwvI4IIPXGC9qnAJYhq4QEpR76wm7y6Y2VMYIK7JH ROE7Wk249v/IMLhQr/uTVx2+fiPdX9bQ0hWZl626lqPz/KkO6d4GTuG3e4dqiRVIr3Bi BGfg== X-Forwarded-Encrypted: i=1; AJvYcCUdAoRAnlj4t9Rzr5eDEk6UjObUfqauzp2SZs2ddgrwQ5i3XVlKdgRBmvk4mbrCwdDwH8oN9JrGrGHnXkH/7UM=@lists.infradead.org, AJvYcCVajKsj6ffe7DjDrS63FPFmMkl0CGt3GZ1nnJPlEWyL5NACpaL6gTeHryCpbxsuTdMF2MoD+OcZl10V/k206vpg@lists.infradead.org X-Gm-Message-State: AOJu0Yy6zFeXxnegiR3neL4c3yqj4KGfoljjZxDRgkWLuPZNGPeMQ5Zz QIAthpydPxgVDuKtgKqj0eYq3N+bTA4qmASLpl5PrcTBbwZZ8Ovk X-Gm-Gg: ASbGnctwI2mJqJbgv0gL5v4vjUv5xV1iOcKs4+XfO2e+KiziBr1C3/u26BP8P/Wx0S+ eTKAqtWLrRybZldzAkMd1bBaCDnSZcyNhSRy+EBn6JLQvhDDLYAa7DtuPJ5Mm1hM3DVS8TnHqHZ icBVxZ6ZDZKmXOK1mTn3qFm2HQ7DcY4NcGbdZ2MV8wEgSZJDStyGHHD5gIYmvDxCGBS9S9deeIs SYypOkLEwLAWEzK8cAABPs+ggMAFW9bPwGHyvPcGBbAFExh+sYgrc1gmuVKf9hmaBVr X-Google-Smtp-Source: AGHT+IFrgnJpvh7aaVGnucMvaHv2rELTJ/5OFWUkqkYUWq+MAPY2UvyFQanWVih4LLhOlXh3fh8rug== X-Received: by 2002:a05:622a:1a94:b0:467:4380:76f6 with SMTP id d75a77b69052e-46c70fd31efmr447700921cf.11.1736904411316; Tue, 14 Jan 2025 17:26:51 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:50 -0800 (PST) From: Peter Geis To: Heiko Stuebner Cc: zyw@rock-chips.com, kever.yang@rock-chips.com, frank.wang@rock-chips.com, william.wu@rock-chips.com, wulf@rock-chips.com, linux-rockchip@lists.infradead.org, Peter Geis , Conor Dooley , Diederik de Haas , Dragan Simic , Johan Jonker , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 5/6] arm64: dts: rockchip: enable the usb3 phy on rk3328-roc boards Date: Wed, 15 Jan 2025 01:26:26 +0000 Message-Id: <20250115012628.1035928-6-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172652_466202_1CBF9C8D X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Enable the new usb3 phy nodes on the rk3328-roc boards. Signed-off-by: Peter Geis --- arch/arm64/boot/dts/rockchip/rk3328-roc.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-roc.dtsi index b5bd5e7d5748..22d93c1901ed 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc.dtsi @@ -360,6 +360,18 @@ &usbdrd3 { status = "okay"; }; +&usb3phy { + status = "okay"; +}; + +&usb3phy_utmi { + status = "okay"; +}; + +&usb3phy_pipe { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; }; From patchwork Wed Jan 15 01:26:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 13939733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 804A3E77188 for ; Wed, 15 Jan 2025 01:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=87SHSmCPNzmJ4HJ+1OOv5SdiuovwUnTF8QY/4CSTLIU=; b=eTHDJf3TDVw+Pf kZ1koG6HuekLrB0Rx9gY9DBSHVr6Oey348wHcrYn/ewOZJN/B4pUDWjsNhx1fwgdBA1ED3KkAwEIJ JwdP48soqafZV2SbaRTVdMe1eoaSF/2xZxSJvjZhGkbrRABEuqK1pZfxWO7v4bUY4U8hFVos/79hO VJ8hwxnFQ88svCF7yhENFf1meYVLGh6FiRqyVj2zthzOipPxod/fEWurESIweJAgQu+irBP+vJb/P s22ovKKrbEPOya0t4rBboog7Aq9os+k6GHBPVb6WWC3Fawr2Pj47A95MuIzK8awXwJqcotukB4xu3 1d1iQFb8NAdgQ/humoKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXsIR-0000000AJMV-2bXV; Wed, 15 Jan 2025 01:34:15 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXsBL-0000000AHu2-0SPn; Wed, 15 Jan 2025 01:26:57 +0000 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-46b1d40ac6bso3507761cf.0; Tue, 14 Jan 2025 17:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736904414; x=1737509214; darn=lists.infradead.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=hFMwJAaeoRNdQ7wFB7oOxwf1IaEkyF3Nv5JGSL6B9MU=; b=T7Wj2di/aPMiUmP4bdgIr92du6aqk0fMOm7N6XsaUM/tSFb4tfe/WQm8vs8zWW8rvY dtrf8Io6u0Z6sr33BtvrSAPYOL3iXSXbDC5z8TDwd+LJvFfuKQSaee0CyE4v7p80K2r6 Ds+xMOFfG46MP1zAXkZGth5oYIrOObnKrvpzhQU7nLgAJIx3vKjqQEVfda6q9GU6ClVO HrAP+iptsWT/d5weoPDVNitjZ0YdCI/Z0j6lkWz7gkgfaMyL/FG6Xq8hzhUCr/nuUYvy R2lwxNgubFTnmNeGjD2mtfgN62Gs4sZdcxq2CKAJph+Sh0e8SKq5xLXITEedpXd9OaQn uhuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736904414; x=1737509214; 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=hFMwJAaeoRNdQ7wFB7oOxwf1IaEkyF3Nv5JGSL6B9MU=; b=r1DbBu6YcosncQZfWZXL0qXkFJwapXHcqwERBTTVJa8nmXSqSmfEPkScwXNe/8p2pR vQt/duly5Kqk3pwNtmErMhq/OrLOrGcyqxrOw0dzN/MKniE/W7kOOsnyF+No2D2FkRx6 0wTG0/c1SdKGbOMWTD8PNe1VZ7GsJ4TnsPl/DZ/tnv7SrjxWmNO/2SMGxfKrTlOm4Si6 VFzPw+52KtkujjcfhoTE+XXi6LAwyhpVvbZDfe2H08pilqhs4C2m5UahdqV9LofiPwIC Hcx2yR/d3Co0jbgG2VRVcNkXgkUCT6elFtTDxurF8hVC3fY+hp0/TLZOuR3d75wRGdf9 yL/g== X-Forwarded-Encrypted: i=1; AJvYcCUGa8gpc88XE4G4G8oM22uVrFG9TuE/k335CXBBgIU/D4rorRNCncOH51PWQFyzeZspVG9GeM0DM+pN7On+76c=@lists.infradead.org, AJvYcCUdLb1kjniMkDwlj2gAgdp5Gzn32/DcsXTzEZ5+2Y27iiq7gkoxpqHqDsRbn1RFp+TpzbwH43JXk7E288pGCTr/@lists.infradead.org X-Gm-Message-State: AOJu0YzXfNUt7zngDs8/ynKWSjLTqOZ3RzyU0LfrKKjbbuh/dk9UDjV1 41gLr3MkTqkoiaFi+BcNwWdPy22HKqi9p5/1Epb/hS/bMDsUwHgE X-Gm-Gg: ASbGncsjU2R7ppOsHbKkCe/MTN/XG5Bkiupfj1jeQJzMAJo5DAIuNHlKZVFW9kQb+gk 3BdjO22ZeEc2gN2ba9awKYGIV8wkNFPMjsyWug+CDml0y//N8RwlMcWGzbYRVP76RJ2MW5lHTIh r8qJUfkziTvv31aTR4jSfbjDEBiI110SjqHInIJ1s4j+DcFHSK6510DXv5DjPe5eQHI31OttXWN ZG+Lo3igBNjUpe0yZr5cjTNPdDAk/naP8UQMufWAAbV3XlBPi2wxVTq3FFZtUIOYWMw X-Google-Smtp-Source: AGHT+IFbToSOgBgyFlAAQb6WU2ckT5CIGlBK7iJrhnVXB8ROQS2yvhyIzkDE/m/9jLZTkhccFjgHlg== X-Received: by 2002:a05:622a:344:b0:467:6654:3dda with SMTP id d75a77b69052e-46df56ad2d9mr20388131cf.12.1736904413930; Tue, 14 Jan 2025 17:26:53 -0800 (PST) Received: from master-x64.sparksnet ([204.111.227.95]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46c8733130dsm59933881cf.25.2025.01.14.17.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 17:26:52 -0800 (PST) From: Peter Geis To: Heiko Stuebner Cc: zyw@rock-chips.com, kever.yang@rock-chips.com, frank.wang@rock-chips.com, william.wu@rock-chips.com, wulf@rock-chips.com, linux-rockchip@lists.infradead.org, Peter Geis , Conor Dooley , Diederik de Haas , Dragan Simic , FUKAUMI Naoki , Johan Jonker , Krzysztof Kozlowski , Rob Herring , Trevor Woerner , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 6/6] arm64: dts: rockchip: enable the usb3 phy on remaining rk3328 boards Date: Wed, 15 Jan 2025 01:26:27 +0000 Message-Id: <20250115012628.1035928-7-pgwipeout@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250115012628.1035928-1-pgwipeout@gmail.com> References: <20250115012628.1035928-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250114_172655_145634_159BEB3F X-CRM114-Status: GOOD ( 10.07 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Enable the new usb3 phy nodes on the remaining rk3328 boards. This is done separately from the rk3328-roc boards due to lack of testing, in case of regressions. Signed-off-by: Peter Geis --- arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2.dtsi | 12 ++++++++++++ .../boot/dts/rockchip/rk3328-orangepi-r1-plus.dtsi | 12 ++++++++++++ arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 12 ++++++++++++ arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 12 ++++++++++++ 4 files changed, 48 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2.dtsi index 1715d311e1f2..a4d880725a96 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2.dtsi @@ -385,6 +385,18 @@ rtl8153: device@2 { }; }; +&usb3phy { + status = "okay"; +}; + +&usb3phy_utmi { + status = "okay"; +}; + +&usb3phy_pipe { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dtsi index 82021ffb0a49..f70d28e6da5d 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dtsi @@ -349,6 +349,18 @@ rtl8153: device@2 { }; }; +&usb3phy { + status = "okay"; +}; + +&usb3phy_utmi { + status = "okay"; +}; + +&usb3phy_pipe { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts index 425de197ddb8..4ce6b16cf291 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts @@ -440,6 +440,18 @@ &usbdrd3 { status = "okay"; }; +&usb3phy { + status = "okay"; +}; + +&usb3phy_utmi { + status = "okay"; +}; + +&usb3phy_pipe { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts index 745d3e996418..2e366de96390 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts @@ -379,6 +379,18 @@ &usbdrd3 { status = "okay"; }; +&usb3phy { + status = "okay"; +}; + +&usb3phy_utmi { + status = "okay"; +}; + +&usb3phy_pipe { + status = "okay"; +}; + &usb_host0_ehci { status = "okay"; };