From patchwork Tue Dec 3 12:13:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892287 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 507DAE64A83 for ; Tue, 3 Dec 2024 12:14:57 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2STWR2tlVsnOABsX2JCPKrYJExCccnhHvW9AuGMEYns=; b=htzGRQm7y7qFfA cwYaBfh7i9B+PSrU6fU9X8Aklkno8F9zmS4bAhzJ2W9cGfPvTDdV03s0ckbNtChTDri7yH3c0+5fD 4JH0HyZCYjyJ3ZGeezWn5XlO3yEqu95U9Xrl4m2rRUDR3P2IlIFmxj96iu1xwNMEYwJLTo15by83H SMLwrKcEW26k80ebKF8oqxdxZYoks6y2/cz5c8QfPXTqNkcX7PqMrzZWx7rfM67UEcsLEr63eGVKV c31hKnGanEbzuCVVTETLZCNNTRZH8tH7K1LDF+tz0Z5F/XCWf9h6+iEjiwedchxdv/lmDgrJcDzmh lP067YszCY+iL8h7Ci7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRnt-00000009NxO-0H0d; Tue, 03 Dec 2024 12:14:57 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmr-00000009Ndm-1b2G for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:55 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53ded167ae3so5888851e87.0 for ; Tue, 03 Dec 2024 04:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228031; x=1733832831; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HxSILp22APpVBx5tHexHUV/Y8I0r0x3nASsEN7dt3nk=; b=GfBMGt9tNbRZOdOPq1cEtFjLlZRg/jdinYvxBKR7v9TL8YfrZWQvOBjjJySDIaREwr XwYYup5+q38Wgc84HWUwlz692Z4oS/1MKu9uAUzSmkisqMgIhRIq4/8p7mQZ27iqmSua VfDckMVRQn7+C0EQNzNETlQsujH6kblsjrJhAS0852tiOw50DKACkyefgD8a/dhDuJUL z4opsVn2bbfPbUxrfa4r2OkaiM0qs6vRTU5CVsrQhcrC5mN2k0Wdy/x+eH0FpnA5jdaD Ru7VgZjv2Rz4axUDXofMTZlkqdbGyJ+c8OLYH4Qr8KLpkGU72GahBi9T8pWG3OJ2hoEl M5/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228031; x=1733832831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HxSILp22APpVBx5tHexHUV/Y8I0r0x3nASsEN7dt3nk=; b=I+xwKmuPrWfn3RgSWtY8ri8bny0ijyxwguEnkL+ZPgjqS8zzExqZGjL2+XuttUoU1o XhDTdJ2wmF28PZNMZsGWxkiRmqZ6vlim53T/iEuIzJwwHj2RsCyFJPb7mzQWDrS3ZmM3 YUDvv62keFudDqe5GO+j2pWUeBvemNuPQ4tvrsBo38vFT2ActbRLXyCCnnvP0Fh10GrW ib3diZI/aUjJRgFDC9SL6tRIBRx8ONSZY5HJ4nmJUgL4RVUejkg5+KdaAfP7HaQwVHQG j2gkRPTsjjIv+1UZjy0LMWQfxh2t0eXBcDupWHI+3z/jg5z0bx4fR4RAHOch+L+9BIAZ ncPg== X-Forwarded-Encrypted: i=1; AJvYcCVCCrgb0+rc/VB/ikqCMQ21vXLIYCDglBtTkKkuy/A2Ua7ZmUp/vsiC4fLaF8Ma9fMfVBeGThYW928=@lists.infradead.org X-Gm-Message-State: AOJu0YyIFVcRKiZpklCb8pvhc6rFQOXLseaMTcH5SREAMSL3nZAgxP8y MWrzXEHGO+y+LCZNbtpIwmY6vqemtGbW8Nz0vjs4ygc5Er/CMTrkPerEHjRr57w= X-Gm-Gg: ASbGncvL2qBiepZpgp60P4sF2mbDP+py3Zw2DgGi3jWagcStoV9zrmFdIZBvKRNnwhT bw0HqbuS+xGud3bv3VKP8aW3qBow3+U1qouS1+Sp6n6bn0PvmNdDS2YAU7WsrOhy1jld+9UYPqn gkZJPDM9WhR8WADtJlZcGWU01u995mznYfWNQtRoo3CVdZ/NOTvySMHg4asBM6K4BxFl0njQC7s uWS62o1ev/COzMnK9Ag8HpLWkReA7B6y+NpkPgNCM65LcaF3xob54TFGYu/iR5WmM4pDja9DWKZ T0RaaXzjRiJ954imE7lgNzvzMARa+J2bBQ== X-Google-Smtp-Source: AGHT+IGJXqz+bsjwL9K7fxpkACgJ7CUUYtTsBMRBB8QXiHvyZub3gqPv4SCB1Lxa7PjJlefvUOWsPg== X-Received: by 2002:a05:6512:3e26:b0:53d:d58a:cb67 with SMTP id 2adb3069b0e04-53e12a26e81mr1428897e87.35.1733228031160; Tue, 03 Dec 2024 04:13:51 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:50 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:49 +0000 Subject: [PATCH v2 1/8] dt-bindings: phy: samsung,usb3-drd-phy: align to universal style MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-1-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041353_417868_464EE911 X-CRM114-Status: UNSURE ( 7.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org In [1], Rob pointed out that we should really be separating properties with blank lines in between, which is universal style. Only where properties are booleans, empty lines are not required. Do so. Link: https://lore.kernel.org/all/20240711212359.GA3023490-robh@kernel.org/ [1] Reviewed-by: Peter Griffin Signed-off-by: André Draszik Acked-by: Rob Herring (Arm) --- v2: * collect tags --- .../devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml index 16321cdd4919..1f8b35917b11 100644 --- a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml +++ b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml @@ -83,14 +83,19 @@ properties: pll-supply: description: Power supply for the USB PLL. + dvdd-usb20-supply: description: DVDD power supply for the USB 2.0 phy. + vddh-usb20-supply: description: VDDh power supply for the USB 2.0 phy. + vdd33-usb20-supply: description: 3.3V power supply for the USB 2.0 phy. + vdda-usbdp-supply: description: VDDa power supply for the USB DP phy. + vddh-usbdp-supply: description: VDDh power supply for the USB DP phy. @@ -117,6 +122,7 @@ allOf: - description: Gate of control interface AXI clock - description: Gate of control interface APB clock - description: Gate of SCL APB clock + clock-names: items: - const: phy @@ -124,10 +130,13 @@ allOf: - const: ctrl_aclk - const: ctrl_pclk - const: scl_pclk + reg: minItems: 3 + reg-names: minItems: 3 + required: - reg-names - pll-supply @@ -149,6 +158,7 @@ allOf: clocks: minItems: 5 maxItems: 5 + clock-names: items: - const: phy @@ -156,8 +166,10 @@ allOf: - const: phy_utmi - const: phy_pipe - const: itp + reg: maxItems: 1 + reg-names: maxItems: 1 @@ -174,12 +186,15 @@ allOf: clocks: minItems: 2 maxItems: 2 + clock-names: items: - const: phy - const: ref + reg: maxItems: 1 + reg-names: maxItems: 1 From patchwork Tue Dec 3 12:13:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892286 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 0AA80E64A84 for ; Tue, 3 Dec 2024 12:14:57 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6AccbxbNImWCNWeaNDiNR6z3ekN11mcoUW03RHiva6k=; b=K7hkLmXX7gM+iy yQRB5zdHmEnXsJtRLxKx73f+iuRjhM0mUdVk4RJryDIWs8DSPRKFjC2WzsZNQ/wjpaMso60CIxVn6 kc28jEESY8l0Im0duZshggWmJFRBkcD0uzqIyFkMak1u0KOv2IjNAQrXk3sgzb3tt7ANSVsPqeIGp qHZcEu97nEzsOopCh7N+FzVzWo8BBaX8x4i49WzM3ktQgC2lrd60HvvKJ8QMbXgFN56V8TttXyHWj FGHn3XUJDK3XwghGuhN6WhtS0Zm7hRPnhQTwdmmQB7lYNYn4Yf7rqMQVpbjD6xZjo37z5vI1733R2 c0QYPN8PlAreB401NGUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRns-00000009Nx8-3K47; Tue, 03 Dec 2024 12:14:56 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmr-00000009Ndp-3ZKC for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:55 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-aa503cced42so802145466b.3 for ; Tue, 03 Dec 2024 04:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228032; x=1733832832; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mWpaKqqVYEb45LFrVAOE9nPtLWbHCab8i1TbI6jQ3+I=; b=SLGj/sjfsfHHDWHLd0GtXzsNkAcoR8XeuVHppQHuUaugujPsbVqx5XXmXfVya4+PnR AzuXbxRqwkrp3BNmp5NNES7xuioE6HC2uyqnxJjgYg+XSJY2PUexZtbukLANKAXF8aWG Jq9RS1jUiDn4+3K8xdrM5CpFLczE3zroHDbmktgMNcDWsyJjYMlcwpM/DTNgOJodv4PM 4h5J3jxRbQfbsN1y4bIbT0dwvHhklg6oVJCS+Of89ztLAug3DDhsnGuf1lJwvjvdPrxX /b8rnG0RszKSSy1lGC+w46Ve5kdcN/K3hTeF8ktNmMigf5/PrgGjdhO8umrOYAhUjGcW P9ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228032; x=1733832832; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mWpaKqqVYEb45LFrVAOE9nPtLWbHCab8i1TbI6jQ3+I=; b=poxXSEeADshFQNLylJ3ObO62v6oih4CcwSVy7lvmO3esj9Y0aH4icEgNWpo+mwFgSx g9xqGsPN5wBhayyiVWTn8SFLX+msZ6ayredcD57DmjGANj8A1f5rtNsRLREqmohr7dmH 1d3PRoH5q3xlRk7oA5ATmCVo/vF60bKXJCRZSdkcGU6pmE8XUH58q5RFjZYwP/77JrPi 4dteXlQnUL74oWDxOGbhUE32WE1n4b0WZ9cE/B8yamfnRKKN6oBW0aFZgrcvc/3wA+xi u6QWxyHMJgG6lt+KEXBqgSY4rCU92kAVsVhESJmkTxxWmtVXZtkIL5TT9jeqNFixd9hw yw+g== X-Forwarded-Encrypted: i=1; AJvYcCWtfscU960IvalewDu+b+88BIDt9rA2op51RZwTOF4KDqX0uvzaeobHtTaG530RsNocF6laYg2Szl8=@lists.infradead.org X-Gm-Message-State: AOJu0YxBp7WnNRypFSme7gWC+fAU5HtH9HcdQxNrkOaWmEanCmzt+GH5 rNG4IKPSPpNodS9L2VXnqEjysiUNxhp3IzZfrKj3xd22uxD54AkUbjbD5nyLCtw= X-Gm-Gg: ASbGncvhgBngIfBjW0Wt9W8fVDxB/ksVYb/xVm9I8EE6YZQ+RB3eW+VTWK87XAg2Rh4 nJMxlEXxs8SdjHdf03bxOLnG9XgsBhJRfWejA/ucfmqDqCn0gxtBcUPhCDAFcNj6OkTctKX+Zfk 35Qrzl0h7/umDakQcEnh3ULJiesplInwaRh0qMt5/dbaeNOyXP3411l+OA2UyUnp0kb2jLnlxBG iJ5jCpk/N2LYk9BbGtVFK7X1wa42HpQAzj+RIFzBhABo5jusSMnr0JOjGhej0LrN769Rha5gkMS LOf7WMdolWoAOiTP6LxiYYnt8ihTJpwE4w== X-Google-Smtp-Source: AGHT+IGn4eg/NfZJAVu0hqE9cK2q2j0R5oIme9rHukh+yJlN3vdSnhKD++AzSGAOtBHFlLtbaiKfNw== X-Received: by 2002:a17:907:7632:b0:a9e:df65:3a81 with SMTP id a640c23a62f3a-aa5f7f4f3bfmr155819366b.59.1733228031882; Tue, 03 Dec 2024 04:13:51 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:51 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:50 +0000 Subject: [PATCH v2 2/8] dt-bindings: phy: samsung,usb3-drd-phy: gs101: require Type-C properties MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-2-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041353_888856_FF9C1110 X-CRM114-Status: GOOD ( 11.04 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org orientation-switch is the standard declaration to inform the Type-C mux layer that a remote-endpoint is capable of processing orientation change messages. The USB PHY on gs101 needs to be configured based on the orientation of the connector. For that the DTS needs a link between the phy's port and a TCPCi, and we'll need to inform the phy driver that it should handle the orientation (register a handler). Update the schema to enforce that by requiring the orientation-switch and port properties on gs101 (only). We disallow orientation-switch on all other supported platforms, since other versions of this phy (or its system integration) don't currently support or even need it. Even though this new required gs101 property is an ABI break, the intention for the driver is to behave as before if it's missing (meaning for gs101 it will work in SS mode in one orientation only). Other platforms are not affected. Reviewed-by: Peter Griffin Signed-off-by: André Draszik --- v2: * squash original patches #2 and #3 * actually disallow orientation-switch on !gs101 (not just optional) (Conor) * update commit message to clarify that the intention for the driver is to work with old and new DTS (Conor) * collect tags --- Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml index 1f8b35917b11..c1d16254aeec 100644 --- a/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml +++ b/Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml @@ -51,6 +51,9 @@ properties: "#phy-cells": const: 1 + orientation-switch: + $ref: /schemas/usb/usb-switch.yaml#/properties/orientation-switch + port: $ref: /schemas/graph.yaml#/properties/port description: @@ -139,6 +142,8 @@ allOf: required: - reg-names + - orientation-switch + - port - pll-supply - dvdd-usb20-supply - vddh-usb20-supply @@ -146,6 +151,10 @@ allOf: - vdda-usbdp-supply - vddh-usbdp-supply + else: + properties: + orientation-switch: false + - if: properties: compatible: From patchwork Tue Dec 3 12:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892289 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 95843E64A83 for ; Tue, 3 Dec 2024 12:17:58 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aA/MWKcMHvlEvSF2mytGD25q2yXqc/rACkiW3VE4c8U=; b=KC21sw9w21DDiX GucU/HXHWHh5A5/fooJ2O7nkoWCZsc2XLv/aGfYqWnevvGyRAggShDMwy047UFS7mS7Rpxf+t/YzR c8W6Np7XXvnkYoM0blAjpuxPf1WHsy5mQGrcet7370tn4x9hP9Vk7IomMUjVJimPiDNjzftu9DirC wH0GGIWSisClgpInC7VUWY39e/jexo9u4m1+ta00a2BZ6rhJO9NnLFSHvO7KLpPLDCRUQcbpTXhzn xU4wEqfNngXjZ2qq50xai13oLeWExUXjmRqzAcV2udOVpMgJ8mDmpZKQgiZCU+Hhd7QRfWoWMXyTH 8Z4uwLX7ZRyifds/8cKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRqo-00000009Ofp-0nLQ; Tue, 03 Dec 2024 12:17:58 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRms-00000009NeQ-2RZp for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:56 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-53df67d6659so8480417e87.3 for ; Tue, 03 Dec 2024 04:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228032; x=1733832832; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=H11rnIjZ/6A+y0BhElAhFFU5gZO2NZydl8Xc9FZjLpY=; b=O8MCqRie4YO2ExDgGGkkbLImDvgUSK2lY9sY8WZLRPEm0OEzeEDAHBJNMJlUD9fGr8 S+dkDy4WMkaF0HkoRy69BMBWKFwIWGycpLzVNU+LIS6yRvx6TBwKaCR4CqQT7t4Uis0i aO4Hg2CASszi34y/fuWQ0Lvx0Y1B9nWiXZEeCBBzG7+ia/GQbxaP5ePD+8QkGEbNHh0W AkcoK2JCMSA2NgfOtThmSnVRsMhWCrdJrkksoCVPHE6nLQcpl7qn2imakbCvOpB5JJGv /P7UaDaMu9ivb7WgOgdz97PtB7YWGqpvgQx5Ng+BwZtAjOp7qDBPHmaImCuciszWYq9G Hpjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228032; x=1733832832; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H11rnIjZ/6A+y0BhElAhFFU5gZO2NZydl8Xc9FZjLpY=; b=aiAObjZiS53+6J/KA8/reGmz7rZb+dI0edWDJRq7uf03EqOL3dmAHXfZhMM39+d1P/ ++XeeIaMicGrbbzCr0cILugSo9GFXQlUyVY5RM5ftGSOsx3KhYIznROyCTevzWWzk5Kb HZQ2yDMtKIx5rUc3Z8Jbz4c+52d0kc+7TgXPSB49+oaUiv4U6/47jmudOU0EW+hSlwIr tAC6OquhRGhM7IIzzfKtJCRONZfmBPcCkowY6lnUudzGUEIipV+vGjHtrN70UmOPKOaT FgrZj6Zh6SVboXWqE/TEur1mLbtX7svx2CJZSh8TrBE3nhYTzRRa1zRsgjmovatN5XkS W0ZQ== X-Forwarded-Encrypted: i=1; AJvYcCUZddAx9YSbuGx3W6W4k/IQCwJ1n6QQhLeBpJPBdfFoopeeeZc3JLAYbyyghjfPTO1wDTaes4g79K4=@lists.infradead.org X-Gm-Message-State: AOJu0YyRvYm5m4rs0GavDNsXa4utFHNpDJ70/SQBeW7NHGhXEO/ndWT5 4yGfFpEJmXQ+6NlmLso/BL7J8QpxnDsavNuPdPx4g6iKgaHyw5NgbPETVouUGo0= X-Gm-Gg: ASbGncseN8OnIUyHqRsgw0F35WfCZaDQNRezf2fyqJqkAMiXVlqSQKntupw1+jGuAV7 ZSkPz6IXU3jGy19E71+tmmcHTd9fAP5VXXtvhkPszcXff6boJlJvLKPh04CyAR6M5jsx4JWFrva UPdogX0Sk1JrccgQbFcd0IrStUui5fms6a7ArukrOYL7SPdfTtPRH+hvKZgZXEDjJw9wsNYFC9B 0W/ULZYCcj8LFCDerAwnYGjBk7jm+pz+On+bryny2RfGf016beaeSsCeuTlS5fzH4TuZvNaPP9c rfGtj7vZRIpWQKGoCrwU+zGFpuhiIQniLQ== X-Google-Smtp-Source: AGHT+IHQdMSg8Woe8SDIrFAGgEbEvNlb4MTQhoB4mrSWw8iZG9ODfRvK6W0FE8ok+EwQTy/draIGwg== X-Received: by 2002:a05:6512:32c9:b0:53d:e592:5415 with SMTP id 2adb3069b0e04-53e12a07a6amr2081271e87.34.1733228032380; Tue, 03 Dec 2024 04:13:52 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:52 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:51 +0000 Subject: [PATCH v2 3/8] phy: exynos5-usbdrd: convert to dev_err_probe MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-3-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= , Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041354_624541_2F1425AC X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org dev_err_probe() exists to simplify code. Reviewed-by: Krzysztof Kozlowski Reviewed-by: Peter Griffin Signed-off-by: André Draszik --- v2: * collect tags --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index c421b495eb0f..ceae4b47cece 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -1725,10 +1725,9 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) reg_pmu = syscon_regmap_lookup_by_phandle(dev->of_node, "samsung,pmu-syscon"); - if (IS_ERR(reg_pmu)) { - dev_err(dev, "Failed to lookup PMU regmap\n"); - return PTR_ERR(reg_pmu); - } + if (IS_ERR(reg_pmu)) + return dev_err_probe(dev, PTR_ERR(reg_pmu), + "Failed to lookup PMU regmap\n"); /* * Exynos5420 SoC has multiple channels for USB 3.0 PHY, with @@ -1759,10 +1758,9 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { struct phy *phy = devm_phy_create(dev, NULL, drv_data->phy_ops); - if (IS_ERR(phy)) { - dev_err(dev, "Failed to create usbdrd_phy phy\n"); - return PTR_ERR(phy); - } + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), + "Failed to create usbdrd_phy phy\n"); phy_drd->phys[i].phy = phy; phy_drd->phys[i].index = i; @@ -1786,10 +1784,9 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) phy_provider = devm_of_phy_provider_register(dev, exynos5_usbdrd_phy_xlate); - if (IS_ERR(phy_provider)) { - dev_err(phy_drd->dev, "Failed to register phy provider\n"); - return PTR_ERR(phy_provider); - } + if (IS_ERR(phy_provider)) + return dev_err_probe(phy_drd->dev, PTR_ERR(phy_provider), + "Failed to register phy provider\n"); return 0; } From patchwork Tue Dec 3 12:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892288 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 AAA05E64A85 for ; Tue, 3 Dec 2024 12:17:58 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DB4yv9J3CDDL6Tlkdlos9Oh5A0f2bdLYqepjVpCzP/c=; b=kyllhWYHAgYfmg yZT023tCBmEbtO8Q/Rv+rRVXloNUbduZ02LdY7nb78IE6RYsWpXjTe9RQqn6kzV2LFsCrJEFc3L7a XwNwMGZtGbNIGc7xiwEnMjV7lvKNDpGSKzNtV5ezm7iNzFzheWF63g01FVFgRKiCsEr2cRGWsg7IL tt6P7Cefl42aubyc1BazdX5Hz2hRDXqwbPqAbl54LivwDRokMTUO5Ln0f3jEiFPDlQglRnrifT6Lq jXwrQdqPW2eYKfJeH9xg5xufy69hUMwBJf8ucAHOILfr7U1FgIBrCNbzKCXxfGrP1MWG75pYv+kAu XdTh1vkw0ZW9EmTseUfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRqo-00000009OgC-1tY3; Tue, 03 Dec 2024 12:17:58 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmt-00000009Nev-1dOn for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:56 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2ffdbc0c103so76359051fa.3 for ; Tue, 03 Dec 2024 04:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228033; x=1733832833; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XyAJZWh204Jg961AaAOy2+aPUgd1uUQOUoQ33ic9q34=; b=pVY9ZZKhao34IAvdXgVZwOJOKvaK3/qmMnKhMy7FWQ1OzagMiOPKo47Lf5VbYOvCj0 +DH+7btXCP23Yl1pKDxAOGxiaSoB3mcvKBg80fJa5JE9mLbw8l1SwfXE3g3k81dnPYHa uUnWY+CnwoV5pPX+gbIQgPyr4FTQW9BYrubHyWtzpmJFA79d1lNs4MnaT8GCzGW53ytE K99I7cepNoYXk06FxreycxY+8998cJWkwk82D5CqwUbm64N5Q1BqCm9Sn8QVjgHlsc1V tSwq6E+2yMfoyeoHntVMYmD7usgllTiu9f6Bc8gi91VspdQQvLedgCR9APbN8TmDGgW0 ntJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228033; x=1733832833; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XyAJZWh204Jg961AaAOy2+aPUgd1uUQOUoQ33ic9q34=; b=EVNAETbd0+g/BSqR4dKKQwzXDrQ0/UALJk6e+CKJGWpn5xSTTrjpQ7ewqwAZoWMlLg 0Mj4QhB19KKdBG2KXCmMfS4QeCJLGQqhUu3+IkiZtpTPTdV6dqvDFbDneAw6ulx6PY4V klpF4UxRxeq1YWKPvBeu9hQiKCNTGq3tZ/OWIo1WNsFSDacad0LvwEjUaEsZkX8okpa/ rc16a+TOH5PHZuwhu8J/CoqQE1WgVfGPt5lQOaysUbt8/jjDsUT3ZPiDS+s99vOcBl87 TGj8j+GmA5w0/RZkX7X490NirIymdvTFeDpchbcBlMyCsv8YdZjUeHq+2StMPR+bVsPU EwRg== X-Forwarded-Encrypted: i=1; AJvYcCXVj6NBuhvD/FkDmvNm4S06LWZTkf2BhM9wlYd82TyMZrin28ef2wWAehGSvP24lKu3q8iZ6aRnQa8=@lists.infradead.org X-Gm-Message-State: AOJu0YySLwahJ0FAIAfaqV+gLUgCfNLDr6rFgNkBdiGSEWaaq77Cdnad 9ZO8kohYIFgfAEofJ8l+oy/pryzeM+8sGwUyeRyssR/lQXGjVnXHpmXSXwT5Uz8= X-Gm-Gg: ASbGnct0wlP1qMdrhz3IF1YhsmyES7RE7h7UA16gaaKdF5c5e03uIjgCobqU3faLVxT 9S/Nw5esAovUaB9wlIT9+Vdm7Swxw6t0L06prca55MeXVB/6Fdfnez8ZdDbf5R/n0H831Nt1ZyN zmPm4sP9wZaNX3wt0/vwzy6pvJvs78HmDlntVoLyve+aBHXZd7m5vTXJbWknjCRWRRbUA67sBOy nFGfHvvRoWw1S3gR3G4PSf/+Za01TjmuSDFZ1dJwme8rW4qonzA7wKjXQehquXQS9FPBGDkCfIc ywZmf4+nlIiBiOA+/Pj/TWqVZFtg3WWKnw== X-Google-Smtp-Source: AGHT+IGgwyjBJkS8A9AXx8hnLtvyrGDGaqK5MFnxCflHlyNqWU5j8V8iVeDiiMrTGSbUFmaLqW+/tQ== X-Received: by 2002:a05:651c:b24:b0:2ff:d133:b54c with SMTP id 38308e7fff4ca-30009c63bf8mr20389271fa.11.1733228033208; Tue, 03 Dec 2024 04:13:53 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:52 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:52 +0000 Subject: [PATCH v2 4/8] phy: exynos5-usbdrd: fix EDS distribution tuning (gs101) MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-4-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041355_465658_81E5D7AC X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This code's intention is to configure lane0 and lane2 tunings, but for lane2 there is a typo and it ends up tuning something else. Fix the typo, as it doesn't appear to make sense to apply different tunings for lane0 vs lane2. The same typo appears to exist in the bootloader, hence we restore the original value in the typo'd registers as well. This can be removed once / if the bootloader is updated. Note that this is incorrect in the downstream driver as well - the values had been copied from there. Reviewed-by: Peter Griffin Tested-by: Peter Griffin Signed-off-by: André Draszik --- v2: * collect tags --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index ceae4b47cece..2a724d362c2d 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -1510,8 +1510,11 @@ static const struct exynos5_usbdrd_phy_tuning gs101_tunes_pipe3_preinit[] = { PHY_TUNING_ENTRY_PMA(0x09e0, -1, 0x00), PHY_TUNING_ENTRY_PMA(0x09e4, -1, 0x36), PHY_TUNING_ENTRY_PMA(0x1e7c, -1, 0x06), - PHY_TUNING_ENTRY_PMA(0x1e90, -1, 0x00), - PHY_TUNING_ENTRY_PMA(0x1e94, -1, 0x36), + PHY_TUNING_ENTRY_PMA(0x19e0, -1, 0x00), + PHY_TUNING_ENTRY_PMA(0x19e4, -1, 0x36), + /* fix bootloader bug */ + PHY_TUNING_ENTRY_PMA(0x1e90, -1, 0x02), + PHY_TUNING_ENTRY_PMA(0x1e94, -1, 0x0b), /* improve LVCC */ PHY_TUNING_ENTRY_PMA(0x08f0, -1, 0x30), PHY_TUNING_ENTRY_PMA(0x18f0, -1, 0x30), From patchwork Tue Dec 3 12:13:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892290 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 DE504E64A84 for ; Tue, 3 Dec 2024 12:18:58 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kaPcW77YbeytMf3qJYSP33EK6+3LcE/yfCWzVwVKVhY=; b=2ifzOf+ZfJ30Zb 5mFh7ZQrY/d2ErzD9OEa7J3vOX+ijgmYOWJF7KSi3gE8ibrerjIg/xsN/BPErisFnWWOTUon6fRwd S6XARSI3zyMj6BEVp39+APYUM/sQdZ9KsRDf+TEMlpVdV0Y2G7C++N5m5bo7UTKIa4KnfmLj+kINq W/xlfuRyvBHlv/vsxaRQD4N1FL42ABazMMDCeWHCpmd4bwI7iZY9zNRV/32BiL8nI+LlF363RxtWG dTcND92c7T4WBMDuHsSCT9CV7oEzuaDz2uPsWksPUVl4DO3pvJGzI0Ik8ibfuJSuPdfM6mul/aWcV GJsG8YGk74alndnfyR4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRrm-00000009Ovv-2oI3; Tue, 03 Dec 2024 12:18:58 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmt-00000009Nfj-3DQO for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:57 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-aa55171d73cso1147576866b.0 for ; Tue, 03 Dec 2024 04:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228034; x=1733832834; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6M6cTvNs7V+xqyuwhG0n9JcP4Mq9Zi3RChVjlFoyS9c=; b=bwsHYZw8qrZzvuEHRjKj+EzzMisoF1hFG5qVSMb9W9sw6UV+CeCkqzhG8pH8oJBV5I IZGNioo4HP9pbzJBbKhJM9CSV98HHH4/CwR71hSSORsjrfAQA1C3OONGY5rbVgiBdgpj yc9lQj5ORW6uibCVMVX115UhsOVXRIBm8weYlspqKNbKque07nRQBFjILnJSmQeDb3XH LZ64bb+8A73BY+Ys7YYGXdRPZ/gLnhUU7Lo6BJSb408fugDPMsnc+VR5g4vL9IQi8z1v P2S6PfQTggwko+sLxPNaksQuqVfiSMsSKcfarVTr0Z0hXYiv0n6RYRWYeAmCVgjFCEi6 Fx7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228034; x=1733832834; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6M6cTvNs7V+xqyuwhG0n9JcP4Mq9Zi3RChVjlFoyS9c=; b=iej2/L4URVg8lJucOkvXJurC7Hqj9iVAt/yCfb37XGNcPDofL6/VtmDEVFukgeNReR qp6hB3P+P2ZrGrUgrx0+HODXrB6ImqDb6hhhJqmK3aRlq6MHabQtcoJq72HyAyhsjozV keljz7yocMHi9dnqadXNk1+ZfnJ6Fo2eGP1Z+SHVe4n+8ve2I1R7JCuNfj5mVG19h1R6 ljth4hamTjOitGgkOEo+Bq65oBXUDQXjId2UnNwJJ+QZGwdwb9zQPQI+d9Jfg/mtZp5W 1FxzaR9Qt5meU10BnGUoHo/8/Cf+tn4l0tZ5jDpsH/55O1liDUat3y7qxIfB4IhZVLuy LtLQ== X-Forwarded-Encrypted: i=1; AJvYcCUEiA4NmeOPDiqbC7sPXPA9VGWILgNdsk3C4fdmpMLftmsztUvhhK+uYRKBhwCGFnB3hoz3THp2RAw=@lists.infradead.org X-Gm-Message-State: AOJu0YzFwFFuKkBYXiSm6p2t6QuJay0Ro1E9YQskUmZzmZD+yQcrAn/0 IBwAsIG3iTV6bRIBcnCg9S2vsA3IgWLfeewlVoECZIXJysjevi1cMFu6GKacCT8= X-Gm-Gg: ASbGncvLaIPbDOztaotT1kyPsbwJZ2HVBUXF70piiRpa7ilAA2DBWLIfs4hbHE9faUR ufPlPFvSdSHWnLQ4Z3xPPNRyMOWPWF31lhSks/NYHD/QY68jUNBB/h9nAgcrq2I+IeJ8QJO3jO+ 06xWjNMBjk5njxaPm0O6up2CwThq1rSzirWg0Ndy6Dixs4Q+0mq9cu1/k4Xu5nkcJ4gNnrLTtxC hSwRVkF/s/qZYl514fteqWc+zF7//As3HcECw29bNVareDyVCVr0nmZRIplNae/Uns2de30jTpP jHIpUszWGbpD9a98RxBbcTBxBuLZLjt2Og== X-Google-Smtp-Source: AGHT+IFmVCN79AgO12dD2PdCbqVnKblHT8yfYp2CBGY/43ZxpcqEVT7DluzFyun9DnuIF1YW27jRrA== X-Received: by 2002:a17:906:d54b:b0:aa5:3fe7:4475 with SMTP id a640c23a62f3a-aa59453454fmr3031209566b.11.1733228033761; Tue, 03 Dec 2024 04:13:53 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:53 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:53 +0000 Subject: [PATCH v2 5/8] phy: exynos5-usbdrd: gs101: ensure power is gated to SS phy in phy_exit() MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-5-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= , stable@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041355_840753_2B86B06A X-CRM114-Status: GOOD ( 10.91 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org We currently don't gate the power to the SS phy in phy_exit(). Shuffle the code slightly to ensure the power is gated to the SS phy as well. Fixes: 32267c29bc7d ("phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS)") CC: stable@vger.kernel.org # 6.11+ Reviewed-by: Krzysztof Kozlowski Reviewed-by: Peter Griffin Signed-off-by: André Draszik --- v2: * add cc-stable and fixes tags (Krzysztof) * collect tags --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 2a724d362c2d..c1ce6fdeef31 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -1296,14 +1296,17 @@ static int exynos5_usbdrd_gs101_phy_exit(struct phy *phy) struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); int ret; + if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { + ret = exynos850_usbdrd_phy_exit(phy); + if (ret) + return ret; + } + + exynos5_usbdrd_phy_isol(inst, true); + if (inst->phy_cfg->id != EXYNOS5_DRDPHY_UTMI) return 0; - ret = exynos850_usbdrd_phy_exit(phy); - if (ret) - return ret; - - exynos5_usbdrd_phy_isol(inst, true); return regulator_bulk_disable(phy_drd->drv_data->n_regulators, phy_drd->regulators); } From patchwork Tue Dec 3 12:13:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892291 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 35B0DE64A83 for ; Tue, 3 Dec 2024 12:18:59 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZzwKftbWuiTNgJv8REaxZQJ8eMNnBuMoYsSOy1Xt9BI=; b=d/fiQBIf3czPAY GdzK5WdaR99GCHdsn1oO2E4D9eoG0PLlYqiDB63hWzQpAJPC+7NaljX06Irjrynf1OpQEDxBj67nG fdsrURtoXHaKUmLutWfSiwzv9VQABz5ChF/VjIQmnJA8mxmDtx72CsaBsctiULwJiVGSEs3+sgBto tuSmHrw/wsxGxnZDtwOVCwhbbO+3PDthTjxZO6IHFCpOGsVyD4qPef4NFQD45GMCssPDPeWi8RVvv M8C0pLuKvoU36zQtOPYbdxpVO7ZmyZKL3jobuQTm40qi9AbPQQqAC/NyfP2zUDBdCBnpCdUY36xNi 9NWkP+YIUzw8D2bxvBMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRrm-00000009Ow9-40Pm; Tue, 03 Dec 2024 12:18:58 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmt-00000009NgH-3QIg for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:57 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5d0ccd931a3so4375919a12.3 for ; Tue, 03 Dec 2024 04:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228034; x=1733832834; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rbUd4Bjv9Szr1aHrKy8wPCWITceO1kvCtngZZYvRJf0=; b=VJCymMFcgNpLnfzWt1nouFItQc3KDG736wZfjzHY7g3PBoCXjdc/c313oMYPxrSmIJ 72pDeF53ROnMODPnSpERlx0M3wWG8IU3putGSilGg8RsKMYT7L73TjxgyU4yp4eZhGu4 Y2aB0itQQwjHVn3bMeSa9CvX2KAJtmg6PDI7pyLRMlVnpcMAwYtQ7FFk00kAkMgVLYS8 OtLP1xbVe09l0mAIXpIoP8+Y43dvPgFz/IBp2VZD89GOw61GpXIkrx5TiTSGK0LkLDVU sjTzkawwmKppkqLGj+IaQqqydK/Yf/m99jj3pNLCM6rU4togydZkCSialKT3uoW6ixGg hpRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228034; x=1733832834; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rbUd4Bjv9Szr1aHrKy8wPCWITceO1kvCtngZZYvRJf0=; b=vFyQ94ukoPvgMXgUS7/oAcky4gCmqNGyPgM95XY+lqLEmtnWn+uea51UW/kMIUDehx hMCvTY8gbHVKM1FVqIuZEuOLRTLvjz1NvZb6UlxzmHbB4csWuEPTfpPHXR3C+g/+AN0E wntx5luKkkxaEr/gLDfyc8VkdsqEZOV8cUGtVkOYniTyvExPVvN1vvKNEf5dV98tS8qh DOMkoXuiQ14JTtCWXmHz3jd2xjMS/xAWBTqS6l763BWM3YuZWZlyrYkURnO5u4e9MyMY 3bnqlGaAR+FpRdqrKqNXd0ZG5Y8yFr1zg5glSpoEOnSgGPROgxkqvhMdsBu5y38ux/uu PTIA== X-Forwarded-Encrypted: i=1; AJvYcCVIh7GlrKFWAaaJGb0LLTKd+5KBIFmqEJaMEGLrjXGLLT7mISCu/Z8tAfig2BeekiN3mqMAea9B1Ss=@lists.infradead.org X-Gm-Message-State: AOJu0YwzVTaHVtUQVELQHhK4aKi4RlmKV2GY3MQIFxBMx9ZgjxJ7RWnS djkmZcFBP53D4AQldXJQiDL/z5huk5SpA9l4oBpxBB5Tod6b65L+OFWcx2zDTBA= X-Gm-Gg: ASbGncvQO8UGOaK617XHYUNFurXPa8mkzOGTqA1qf2vuQJP65MssSiszZhn7IcsbU6z 4wMNsWrgF7+hAwVKs21KGkSnrqSWhEynO35jbANvpVK1LotOa6vV4mt5NvWzKIxUmd3OxXVA1Et Ni06mZ98s7ZuA7ebcUJLpES54DdrIab2FNZnt7e17K+zUAady7MHo93iPHq6QpyIdZVLQ8+8GsO M6J0P/fz8gUxrryNLu4CnK3Wrx8vVVgFhZkrpJf0YCrVz7nM3+iWL9IZJPPI6K0g8vJvJDoaH5L +K0CmYFaRCqCGvyigeFN2R89M7PnOtUD5g== X-Google-Smtp-Source: AGHT+IGLKa18ejdUf1Tw7sL45vCS/g/CfIaxb9LtOrFRmJNocgVBAascJ/N0VvxB4+rEL/yLQUTPQg== X-Received: by 2002:a17:906:fd84:b0:aa5:45f3:cbda with SMTP id a640c23a62f3a-aa5f7f2bacamr232510066b.56.1733228034234; Tue, 03 Dec 2024 04:13:54 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:53 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:54 +0000 Subject: [PATCH v2 6/8] phy: exynos5-usbdrd: gs101: configure SS lanes based on orientation MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-6-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041355_895507_DE9A32C9 X-CRM114-Status: GOOD ( 21.93 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org USB SS lanes need to be configured based on the connector orientation - at most two lanes will be in use for USB (and the remaining two for alternate modes like DP). For the USB link to come up in SS, the lane configuration registers have to be programmed accordingly. While we still need a way to be notified of the actual connector orientation and then reprogram the registers accordingly (at the moment the configuration happens just once during phy_init() and never again), we can prepare the code doing the configuration to take the orientation into account. Do so. Note: the mutex is needed to synchronize this with the upcoming connector orientation callback. Reviewed-by: Peter Griffin Tested-by: Peter Griffin Signed-off-by: André Draszik --- v2: * collect tags * replace #include typec_mux.h with typec.h, and move the former into next patch (Peter) * commit message typo (Peter) --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 72 ++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index c1ce6fdeef31..206483c7ca55 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -23,6 +23,7 @@ #include #include #include +#include /* Exynos USB PHY registers */ #define EXYNOS5_FSEL_9MHZ6 0x0 @@ -209,6 +210,10 @@ #define EXYNOS9_PMA_USBDP_CMN_REG00B8 0x02e0 #define CMN_REG00B8_LANE_MUX_SEL_DP GENMASK(3, 0) +#define CMN_REG00B8_LANE_MUX_SEL_DP_LANE3 BIT(3) +#define CMN_REG00B8_LANE_MUX_SEL_DP_LANE2 BIT(2) +#define CMN_REG00B8_LANE_MUX_SEL_DP_LANE1 BIT(1) +#define CMN_REG00B8_LANE_MUX_SEL_DP_LANE0 BIT(0) #define EXYNOS9_PMA_USBDP_CMN_REG01C0 0x0700 #define CMN_REG01C0_ANA_LCPLL_LOCK_DONE BIT(7) @@ -383,11 +388,13 @@ 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 + * @phy_mutex: mutex protecting phy_init/exit & TCPC callbacks * @phys: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY * instances each with its 'phy' and 'phy_cfg'. * @extrefclk: frequency select settings when using 'separate * reference clocks' for SS and HS operations * @regulators: regulators for phy + * @orientation: TypeC connector orientation - normal or flipped */ struct exynos5_usbdrd_phy { struct device *dev; @@ -397,6 +404,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 mutex phy_mutex; struct phy_usb_instance { struct phy *phy; u32 index; @@ -406,6 +414,8 @@ struct exynos5_usbdrd_phy { } phys[EXYNOS5_DRDPHYS_NUM]; u32 extrefclk; struct regulator_bulk_data *regulators; + + enum typec_orientation orientation; }; static inline @@ -647,22 +657,38 @@ exynos5_usbdrd_usbdp_g2_v4_pma_lane_mux_sel(struct exynos5_usbdrd_phy *phy_drd) /* lane configuration: USB on all lanes */ reg = readl(regs_base + EXYNOS9_PMA_USBDP_CMN_REG00B8); reg &= ~CMN_REG00B8_LANE_MUX_SEL_DP; - writel(reg, regs_base + EXYNOS9_PMA_USBDP_CMN_REG00B8); - /* - * FIXME: below code supports one connector orientation only. It needs - * updating once we can receive connector events. + * USB on lanes 0 & 1 in normal mode, or 2 & 3 if reversed, DP on the + * other ones. */ + reg |= FIELD_PREP(CMN_REG00B8_LANE_MUX_SEL_DP, + ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) + ? (CMN_REG00B8_LANE_MUX_SEL_DP_LANE3 + | CMN_REG00B8_LANE_MUX_SEL_DP_LANE2) + : (CMN_REG00B8_LANE_MUX_SEL_DP_LANE1 + | CMN_REG00B8_LANE_MUX_SEL_DP_LANE0))); + writel(reg, regs_base + EXYNOS9_PMA_USBDP_CMN_REG00B8); + /* override of TX receiver detector and comparator: lane 1 */ reg = readl(regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0413); - reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN; - reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_EN; + if (phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) { + reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN; + reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_EN; + } else { + reg |= TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN; + reg |= TRSV_REG0413_OVRD_LN1_TX_RXD_EN; + } writel(reg, regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0413); /* lane 3 */ reg = readl(regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0813); - reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN; - reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_EN; + if (phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) { + reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN; + reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_EN; + } else { + reg &= ~TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN; + reg &= ~TRSV_REG0813_OVRD_LN3_TX_RXD_EN; + } writel(reg, regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0813); } @@ -700,21 +726,18 @@ exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(struct exynos5_usbdrd_phy *phy_drd int err; err = readl_poll_timeout( - phy_drd->reg_pma + EXYNOS9_PMA_USBDP_TRSV_REG03C3, - reg, (reg & locked) == locked, sleep_us, timeout_us); - if (!err) - return; - - dev_err(phy_drd->dev, - "timed out waiting for CDR lock (l0): %#.8x, retrying\n", reg); - - /* based on cable orientation, this might be on the other phy port */ - err = readl_poll_timeout( - phy_drd->reg_pma + EXYNOS9_PMA_USBDP_TRSV_REG07C3, + /* lane depends on cable orientation */ + (phy_drd->reg_pma + + ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) + ? EXYNOS9_PMA_USBDP_TRSV_REG03C3 + : EXYNOS9_PMA_USBDP_TRSV_REG07C3)), reg, (reg & locked) == locked, sleep_us, timeout_us); if (err) dev_err(phy_drd->dev, - "timed out waiting for CDR lock (l2): %#.8x\n", reg); + "timed out waiting for CDR(l%d) lock: %#.8x\n", + ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) + ? 0 + : 2), reg); } static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) @@ -1184,7 +1207,8 @@ static int exynos850_usbdrd_phy_init(struct phy *phy) return ret; /* UTMI or PIPE3 specific init */ - inst->phy_cfg->phy_init(phy_drd); + scoped_guard(mutex, &phy_drd->phy_mutex) + inst->phy_cfg->phy_init(phy_drd); clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); @@ -1203,6 +1227,8 @@ static int exynos850_usbdrd_phy_exit(struct phy *phy) if (ret) return ret; + guard(mutex)(&phy_drd->phy_mutex); + /* Set PHY clock and control HS PHY */ reg = readl(regs_base + EXYNOS850_DRD_UTMI); reg &= ~(UTMI_DP_PULLDOWN | UTMI_DM_PULLDOWN); @@ -1701,6 +1727,10 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) return -EINVAL; phy_drd->drv_data = drv_data; + ret = devm_mutex_init(dev, &phy_drd->phy_mutex); + if (ret) + return ret; + if (of_property_present(dev->of_node, "reg-names")) { void __iomem *reg; From patchwork Tue Dec 3 12:13:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892313 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 AF31FE64A84 for ; Tue, 3 Dec 2024 12:21:00 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MJ2kJ65YuQd805nxfYJMRtI6UEgPo90jjTC9KJu8FNQ=; b=zuRC4K8ktGArYg j3aMaygNlwTTKmDNz95pMFWef3LfbHOlOObkSDESKdvseD6miMvaeqYOdeSFm2TNxO7/VvZiG6lRr hZrPJkGRyE60NVj1L3esk7IlS379F5KndrIn3Xn4WXyvx+eLGCpxityutOo+wsxAmmcBX2onzjNeO GIIykciXH1UBJDXCu04JdiajKIwcwsx1dL/RQ2Kxp3l162Y1wYfSmhBNYdawYBBXzKnEH1eK8qQIX 2jh3gjYL0OHucn5ftnqh4TvexRJ/z41YPxz7gmFrs4qZrtQmwP2v5rs1MkkdzmyIP4e090ruXDAPg 7OPGkwd7w/3awO4dIKlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRtk-00000009PPu-1uix; Tue, 03 Dec 2024 12:21:00 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmu-00000009NgO-3Uhr for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:58 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a9a0ef5179dso790243766b.1 for ; Tue, 03 Dec 2024 04:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228035; x=1733832835; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=54YjK1PSCj3noc28mh1Eh19wlGr7iBDWYo9sjvHvK0I=; b=ObPG3kFAsrMpqc3XKVzstTOH75yCAgaxQQf7QrncbzVBBH82qXsG1+EzP7tfPiD2y9 00j1tWmkMaLbmIP4VfBu8gt4tpwGibDGUObjsY84AWRuvScftHjR49XO2hOEKeTGfPFg 72mImbAW4gELHBLxlouCtbGa+iD6/JPeB0iQmBnZFNIhZOVFcAtVjhI1O23bC83qrWRw lkEBAvgAgfmm3Y3oObZbacjsThigYPbW8YxCXce3Mm04u6nIVhyBfPCCYZg9XZDWCUB6 IlrUGi4WtA1uQNEPyMINMgm58R2xiICwg/3o5rRQE9NF5Bk70Ti+cwTkdGTML7yGma1g zHQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228035; x=1733832835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=54YjK1PSCj3noc28mh1Eh19wlGr7iBDWYo9sjvHvK0I=; b=DoLRaV3kBlVX59o3LwtTZKKuVPESAfvvz3Inxtl4UILEvcZTu/IywzcGYCBQwuLY4D IRV4+BOyNmeui83QXYOg3yYpwXeKwdZ5KsPGEzkphi8l17GWfvVWnVXPrdIwrigo9y/w JOJyLGhzN+J8iJjxu1iu88SEa96njHDOJgVIjlODHIpPszUVaNhIHEzNxPxLS+lzsIux HxyCCxJqB7J+QO9pq1YCGy0inJGq7KqQF8Je5/VyFS/YCSFlpaE+zwQqdY1h9zgSl39K xG7zkagQMLDwS1nnAzjoKk7MZH5vWBVOunWjeLQf3MNb+cppHN2ddSSkghyoV9aq7VMl LwrA== X-Forwarded-Encrypted: i=1; AJvYcCWsRfAJ6EIotdS5YUjsIU9N5ir2Ju+11+GsYVkwxvY7c8fcxF+hallcJqjJ8YAZSfK64XOVutE20Ik=@lists.infradead.org X-Gm-Message-State: AOJu0YzlxrMXEwxr6eI/C7ifjRyvU1gbNeKN7U9zWUGd+i514bCQs9L3 N8PlNkmItTvkWiWme6JnZBgeCn5vMeIdthc94pw9aisYfa3ldOWnC5WHv//qUSQ= X-Gm-Gg: ASbGncug+zgHfAQMyMuVtjD4/JKMEQqCpdS9vSfBpwXwqX94BqCo1AglcXzRwqExDVR mBWXyVnapuhUh048WtW2xC1lyFLrwVXsVwhVKZMOEHsfJANpdCOdcT+LXLC0MGLb56e4fhWhhbz DbBDnK/puB0xJErzLl8Pi0i2+vH7GtmLq7REF2kpKr38IFTuN+68R1HehngG8XK03DQ5TlBgReU pL0igG4egYrQL46flsAto1BkQbbw7DUqNEzCoHhvPzqEqi/2LbA70ckoHLWCszP8zRklW3o0t0g Ah/0rbzIBJB5IPu8Uhp8XCGe/MKomxNPnw== X-Google-Smtp-Source: AGHT+IGlYONH0INC2ObUF4IvK3DPpOMeryroZsQD2npmBCwLgaYdxtB/m6WRr2IlPYlTnp1MvA4eXw== X-Received: by 2002:a17:906:3ca2:b0:aa5:f39a:bd7b with SMTP id a640c23a62f3a-aa5f7ccdc77mr167906966b.4.1733228034789; Tue, 03 Dec 2024 04:13:54 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:54 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:55 +0000 Subject: [PATCH v2 7/8] phy: exynos5-usbdrd: subscribe to orientation notifier if required MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-7-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041356_917051_338E78E6 X-CRM114-Status: GOOD ( 21.02 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org gs101's SS phy needs to be configured differently based on the connector orientation, as the SS link can only be established if the mux is configured correctly. The code to handle programming of the mux is in place already, this commit now adds the missing pieces to subscribe to the Type-C orientation switch event. Note that for this all to work we rely on the USB controller re-initialising us. It should invoke our .exit() upon cable unplug, and during cable plug we'll receive the orientation event after which we expect our .init() to be called. Above reinitialisation happens if the DWC3 controller can enter runtime suspend automatically. For the DWC3 driver, this is an opt-in: echo auto > /sys/devices/.../11110000.usb/power/control Once done, things work as long as the UDC is not bound as otherwise it stays busy because it doesn't cancel / stop outstanding TRBs. For now we have to manually unbind the UDC in that case: echo "" > sys/kernel/config/usb_gadget/.../UDC Note that if the orientation-switch property is missing from the DT, the code will behave as before this commit (meaning for gs101 it will work in SS mode in one orientation only). Other platforms are not affected either way. Signed-off-by: André Draszik --- v2: * move #include typec_mux.h from parent patch into this one (Peter) --- drivers/phy/samsung/Kconfig | 1 + drivers/phy/samsung/phy-exynos5-usbdrd.c | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/drivers/phy/samsung/Kconfig b/drivers/phy/samsung/Kconfig index f10afa3d7ff5..fc7bd1088576 100644 --- a/drivers/phy/samsung/Kconfig +++ b/drivers/phy/samsung/Kconfig @@ -80,6 +80,7 @@ config PHY_EXYNOS5_USBDRD tristate "Exynos5 SoC series USB DRD PHY driver" depends on (ARCH_EXYNOS && OF) || COMPILE_TEST depends on HAS_IOMEM + depends on TYPEC || (TYPEC=n && COMPILE_TEST) depends on USB_DWC3_EXYNOS select GENERIC_PHY select MFD_SYSCON diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 206483c7ca55..b1914c6c806d 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -24,6 +24,7 @@ #include #include #include +#include /* Exynos USB PHY registers */ #define EXYNOS5_FSEL_9MHZ6 0x0 @@ -394,6 +395,7 @@ struct exynos5_usbdrd_phy_drvdata { * @extrefclk: frequency select settings when using 'separate * reference clocks' for SS and HS operations * @regulators: regulators for phy + * @sw: TypeC orientation switch handle * @orientation: TypeC connector orientation - normal or flipped */ struct exynos5_usbdrd_phy { @@ -415,6 +417,7 @@ struct exynos5_usbdrd_phy { u32 extrefclk; struct regulator_bulk_data *regulators; + struct typec_switch_dev *sw; enum typec_orientation orientation; }; @@ -1400,6 +1403,60 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) return 0; } +#if IS_ENABLED(CONFIG_TYPEC) +static int exynos5_usbdrd_orien_sw_set(struct typec_switch_dev *sw, + enum typec_orientation orientation) +{ + struct exynos5_usbdrd_phy *phy_drd = typec_switch_get_drvdata(sw); + + scoped_guard(mutex, &phy_drd->phy_mutex) + phy_drd->orientation = orientation; + + return 0; +} + +static void exynos5_usbdrd_orien_switch_unregister(void *data) +{ + struct exynos5_usbdrd_phy *phy_drd = data; + + typec_switch_unregister(phy_drd->sw); +} + +static int exynos5_usbdrd_setup_notifiers(struct exynos5_usbdrd_phy *phy_drd) +{ + int ret; + + phy_drd->orientation = (enum typec_orientation)-1; + if (device_property_present(phy_drd->dev, "orientation-switch")) { + struct typec_switch_desc sw_desc = { }; + + sw_desc.drvdata = phy_drd; + sw_desc.fwnode = dev_fwnode(phy_drd->dev); + sw_desc.set = exynos5_usbdrd_orien_sw_set; + + phy_drd->sw = typec_switch_register(phy_drd->dev, &sw_desc); + if (IS_ERR(phy_drd->sw)) + return dev_err_probe(phy_drd->dev, + PTR_ERR(phy_drd->sw), + "Failed to register TypeC orientation switch\n"); + + ret = devm_add_action_or_reset(phy_drd->dev, + exynos5_usbdrd_orien_switch_unregister, + phy_drd); + if (ret) + return dev_err_probe(phy_drd->dev, ret, + "Failed to register TypeC orientation devm action\n"); + } + + return 0; +} +#else /* CONFIG_TYPEC */ +static int exynos5_usbdrd_setup_notifiers(struct exynos5_usbdrd_phy *phy_drd) +{ + return 0; +} +#endif /* CONFIG_TYPEC */ + static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = { { .id = EXYNOS5_DRDPHY_UTMI, @@ -1789,6 +1846,10 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "failed to get regulators\n"); + ret = exynos5_usbdrd_setup_notifiers(phy_drd); + if (ret) + return ret; + dev_vdbg(dev, "Creating usbdrd_phy phy\n"); for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { From patchwork Tue Dec 3 12:13:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13892314 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 DB4D1E64A84 for ; Tue, 3 Dec 2024 12:22:00 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UxwJE+MJMfiH1rzL3umObgd5ObTOQhZrUd449ekoYSM=; b=z7r+CygpCR0B6d qJVFim8K/uE3hNYY4xyFSG9AOqdYc0vOle9b/Yi2LfEET80PzclGmG3r5xE0cb3g3ed2bI0NAiQxv h+ekagWSkTXTYyftMje7E/R+UI5tlsYll4Wc7u3Y5Uboz81B84gpetXTcpsgr47CCpxaY4N8aahKc rh4hSFdrKsXXimwUl5o5TXiAiTZ/obSvss8BBOulypqUbQkd9He300JRMfjT7wjAQz1ro7+qxMz5M zaCDJvJMGRTfXyL826dgIkcPPFxC1ztv5P9XWTlVVIRf2MzuWrqb4QA3oXCIEoMSW8/d+vQd3Xjx9 6AywqtwSzLFOX+4TkdKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIRui-00000009Pc3-2hjv; Tue, 03 Dec 2024 12:22:00 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIRmu-00000009Nhq-3g8p for linux-phy@lists.infradead.org; Tue, 03 Dec 2024 12:13:58 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so6409454a12.0 for ; Tue, 03 Dec 2024 04:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733228035; x=1733832835; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uFpsvHW8LAP7lW2ogoOJaMBxsAjFS0igr/BkJ+LMT9c=; b=FfT1xiOvqPM07Wqtgxivikd+AlZmNLDoMT07+8NQ7YSZl4lROIgkUqM1wCFuqM60MB pxwVEl+ewohg9tFxrqH3L+nVxnVfJGv9KLFqlnxISKf2NGSOBgE9vml3qOFO8igH0E4w ksA1lZAe/zpvk4f1y2C06U7aTCmjoKcaf2NrWcdjdwcAntzQRwBNPJOkYcEjOYXfLIOi 1xAWlbcrDTc55qRor56Xqj9DBfRKrREwCTHQkxSQIpIU0d6WZWR5+OMXqVUuNsUvNyAX ofq4EXMAbYarc0CaVDaAG8wjKYBpIT/kRwIXumBdk0MltIst1e2/xeNRmNgrLqHxaX+1 1wZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733228035; x=1733832835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uFpsvHW8LAP7lW2ogoOJaMBxsAjFS0igr/BkJ+LMT9c=; b=kSvzfRXhO/jzzKHcZQAsBD5tyVbLgp7Lte1CNI9t0IctiV6+kqol2SHZMxX9rsxWxj /t5Sp6totJOJu6D14JlEe1TCRuWDVmsAj2+TTlvZc1gXqFFN+bEsiUWNizVlnI+DKsOo tLRZO59V1GoAKTEcaG293//F0ZhWahF7kbtVsoSL06xTfu29zIpfrtGt35iyJVLAgWgC 4HxFwUs9deFZMmIJFzyl6+nqAUcXXxGVwaQE0l7puETYKMPtVe+t8CJgoo2+xxf9QkyN TrVs+q5NU18wzcXDU7QxM/UoTR9zexDXC1HEUMPgkuOC2ujCwUviqO4oonfJb7FIipJP XZsw== X-Forwarded-Encrypted: i=1; AJvYcCXnbDQoa4BIgwG9PSQKRNI98AqBXxNKZxXRAyFZRAS8OjQf7nw64t6gMebeqek7bbxMZ8TsRJtnYZY=@lists.infradead.org X-Gm-Message-State: AOJu0YzpwrzZFbDGyQuN+mevd7u0KjwBCr/uiUcHCM+PQ0P0h5Pg3LC/ HHc4TZmPStrUyGiocswVuHf3tUd/7Q3RVxfywY6Nt7Vlwgiar5OKSRBg1phLoSM= X-Gm-Gg: ASbGncsTRCwq3u9eJ88ZOxFFq42vLZ1qFw52Tcg27JLeSr4JXr5I+rOvLSlT0yAtyoU bMVqBCkESqopgb+PJ+SKd6HKfURcgSAT0nCeBOvPFQ6/7WIeMYyzBsbD4S6hwaKNtanKA6oEsfT K4GBdtc94rooIx7iIq2PbLvNfZkhwy5E9bQwwMjkBFDtAQYsaGflvHd9ex5qhJkdUl4DKGL93OF mghcYTjetjQG7zfdz/gNtvSR9YLHLOZkOPEZ8CdFTdDbBWiVB9Bh78BUJjtKQDd45v4ZZ2SyDbp iRnlNZ1UAHREMmHlUSDVBCtVQ+L1iBL8Dw== X-Google-Smtp-Source: AGHT+IGdrwALKg1GTwldZJOY7VYAVcWh5tQKqLrkKr8AXomCGAvvPrif7tTk5yapUjTCTN1a7cYNbg== X-Received: by 2002:a17:906:4c1:b0:aa5:427e:6c76 with SMTP id a640c23a62f3a-aa5f7aaed08mr164681466b.0.1733228035286; Tue, 03 Dec 2024 04:13:55 -0800 (PST) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa5996c245bsm607603766b.8.2024.12.03.04.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 04:13:54 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 03 Dec 2024 12:13:56 +0000 Subject: [PATCH v2 8/8] phy: exynos5-usbdrd: allow DWC3 runtime suspend with UDC bound (E850+) MIME-Version: 1.0 Message-Id: <20241203-gs101-phy-lanes-orientation-phy-v2-8-40dcf1b7670d@linaro.org> References: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> In-Reply-To: <20241203-gs101-phy-lanes-orientation-phy-v2-0-40dcf1b7670d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar Cc: Peter Griffin , Tudor Ambarus , Sam Protsenko , Will McVicker , Roy Luo , kernel-team@android.com, 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241203_041356_956545_D24A5B58 X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org To make USB runtime suspend work when a UDC has been bound, the phy needs to inform the USBDRD controller (DWC3) that Vbus and bvalid are gone, so that it can in turn raise the respective gadget interrupt with event == DWC3_DEVICE_EVENT_DISCONNECT, which will cause the USB stack to clean up, allowing DWC3 to enter runtime suspend. On e850 and gs101 this isn't working, as the respective signals are not directly connected, and instead this driver uses override bits in the PHY IP to set those signals. It currently forcefully sets them to 'on', so the above mentioned interrupt will not be raised, preventing runtime suspend. To detect that state, update this driver to act on the TCPC's orientation signal - when orientation == NONE, Vbus is gone and we can clear the respective bits. Similarly, for other orientation values we re-enable them. This makes runtime suspend work on platforms with a TCPC (like Pixel6), while keeping compatibility with platforms without (e850-96). With runtime suspend working, USB-C cable orientation detection now also fully works on such platforms, and the link comes up as Superspeed as expected irrespective of the cable orientation and whether UDC / gadget are configured and active. Signed-off-by: André Draszik --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 53 +++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index b1914c6c806d..94e4f78340ff 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -1137,13 +1137,15 @@ static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) reg |= LINKCTRL_BUS_FILTER_BYPASS(0xf); writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); - reg = readl(regs_base + EXYNOS850_DRD_UTMI); - reg |= UTMI_FORCE_BVALID | UTMI_FORCE_VBUSVALID; - writel(reg, regs_base + EXYNOS850_DRD_UTMI); - - reg = readl(regs_base + EXYNOS850_DRD_HSP); - reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL; - writel(reg, regs_base + EXYNOS850_DRD_HSP); + if (!phy_drd->sw) { + reg = readl(regs_base + EXYNOS850_DRD_UTMI); + reg |= UTMI_FORCE_BVALID | UTMI_FORCE_VBUSVALID; + writel(reg, regs_base + EXYNOS850_DRD_UTMI); + + reg = readl(regs_base + EXYNOS850_DRD_HSP); + reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL; + writel(reg, regs_base + EXYNOS850_DRD_HSP); + } reg = readl(regs_base + EXYNOS850_DRD_SSPPLLCTL); reg &= ~SSPPLLCTL_FSEL; @@ -1408,9 +1410,44 @@ static int exynos5_usbdrd_orien_sw_set(struct typec_switch_dev *sw, enum typec_orientation orientation) { struct exynos5_usbdrd_phy *phy_drd = typec_switch_get_drvdata(sw); + int ret; + + if (phy_drd->orientation == orientation) + return 0; + + ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); + if (ret) { + dev_err(phy_drd->dev, "Failed to enable PHY clocks(s)\n"); + return ret; + } + + scoped_guard(mutex, &phy_drd->phy_mutex) { + void __iomem * const regs_base = phy_drd->reg_phy; + unsigned int reg; + + if (orientation == TYPEC_ORIENTATION_NONE) { + reg = readl(regs_base + EXYNOS850_DRD_UTMI); + reg &= ~(UTMI_FORCE_VBUSVALID | UTMI_FORCE_BVALID); + writel(reg, regs_base + EXYNOS850_DRD_UTMI); + + reg = readl(regs_base + EXYNOS850_DRD_HSP); + reg |= HSP_VBUSVLDEXTSEL; + reg &= ~HSP_VBUSVLDEXT; + writel(reg, regs_base + EXYNOS850_DRD_HSP); + } else { + reg = readl(regs_base + EXYNOS850_DRD_UTMI); + reg |= UTMI_FORCE_VBUSVALID | UTMI_FORCE_BVALID; + writel(reg, regs_base + EXYNOS850_DRD_UTMI); + + reg = readl(regs_base + EXYNOS850_DRD_HSP); + reg |= HSP_VBUSVLDEXTSEL | HSP_VBUSVLDEXT; + writel(reg, regs_base + EXYNOS850_DRD_HSP); + } - scoped_guard(mutex, &phy_drd->phy_mutex) phy_drd->orientation = orientation; + } + + clk_bulk_disable(phy_drd->drv_data->n_clks, phy_drd->clks); return 0; }