From patchwork Tue May 7 14:14:44 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: 13657175 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 AD69FC25B4F for ; Tue, 7 May 2024 14:15: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: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=GApdXNqdMRR5PfnlYWXRzC6XERJYhEDCyGU0FKTICzs=; b=WWh9o44L/Khy// 797u/KBoelNLF4vmcgSwxmbYiMYZsQYKI1zLYPAPkScgNtR/3NhMkuoeFB1N82lV15JBpCZMmdPxA KbEmnmbxTXKUvu+0oAD4qI6pEtBvsATqfcJ/OJLp5a7Gv7CS9Qh6clKZ2q/uVO/HSdNOhMrqAEh7I C+QNrNSnKqM4G1tEbsFcuczFbZtMKgu3Jj0TxWCsOJOIQ5D8bjId0EzgPmN2BaltW0rp/MdISmBJo hctpfCeiSeM1Cw1N7p9V9dsBNExNGgPq+mLl3e2QSyDME5Sdl4QE8HQvmLXtYIwoZgdljwqOXPzSt PMsmSayHUhDnsjhb6S7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lax-0000000BQbO-1BgI; Tue, 07 May 2024 14:15:03 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lal-0000000BQRb-1xJZ for linux-phy@lists.infradead.org; Tue, 07 May 2024 14:14:59 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a59b81d087aso682760966b.3 for ; Tue, 07 May 2024 07:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715091286; x=1715696086; 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=88e0LLt+lrc5lZzN56km9yoOnQ7q4J8j+3agax3Pphk=; b=rxysbgu2aLY43NKDH976xwvxWFzgwoJkbKwWFXKfM4TL4cDbKIPk364bIqODa5rEsS IsUCeSd+aDgJ6PdtMt1rT1cc9H6VXdod7toL/zvvjdW3YBHOPT5pM3HEmWheZSBgOTa8 mHU1pwU7Eh8//VwmH9qlUdwfFytf0o0sODGXsaXjlKic23UyPj5o2lZb2LPQ696Q+WyQ opRm4uY3SGq98SJ6mG9E7NeQ5/2IoPeaQul6A5IrZ9u0LWkeR4n6g/Ikz5rClRispbCD 5IuLI8f7XYnWcCKq+4L7l2Oxdi6K2Z5xQH5WfaOIpUq9NMpGeFuoVrv+3RGtnWoULmdv DfJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091286; x=1715696086; 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=88e0LLt+lrc5lZzN56km9yoOnQ7q4J8j+3agax3Pphk=; b=Cj9HKYkqcD6gthbT/zWkoBIWKgkxRg53dDKqYA3aPQK/ni1yz1L4M4kjNjFYF6hkx7 idMI+z0wl+ykHrJS+nbCT9pq+fIPyV7dXjduB/Y6wWY6yZ7LqsaMaNfB4sklGOOOhXSp 8hUmQQVCoTYbykGR1ZlDFCHqvY14RoSiN7pMGU0FxBbRTfQo04HNYQbZBTa0mToXCWf5 4rftIdzZhPLdD73adNfWJuBV/BN6jBspne7WynaE2y4jw1Vn0fbnqTXDCEpgO+JEDFmm BEbQikuX0C8o0aGlC/OmVq4bhJStyvKdZWTTolfVs6VwKrvangq2zAUB5Xy7IEcf/WR7 yLhg== X-Forwarded-Encrypted: i=1; AJvYcCW1pTFFAmOT4m542l6ttuaR5WX9tCsBwQT+zN/RSEqRkrRpaLBYnN/d2J0Mt2vCuwF4hE7cw9f12cBbX/gbNcayu+sKKrnNP/VllTmfwA== X-Gm-Message-State: AOJu0Yy/thfm0fZCZzCxsk/1au2OMtdrlHhkQ9vUsZWD6TAxG65Imraw wyNTXq8tx3K561MDonibTwd/iJY+3042u2Xzf8eXpAmlfCifH30tYolDpMk+0+g= X-Google-Smtp-Source: AGHT+IE1P/hHMY3LIT1bpJkBILATQnwiTaFH5rXHwp3HQxVrvpMWG51xBDNGqOT3Uqe8ATRtG5gVQQ== X-Received: by 2002:a50:cd18:0:b0:572:a748:d46a with SMTP id z24-20020a50cd18000000b00572a748d46amr10471522edi.42.1715091286267; Tue, 07 May 2024 07:14:46 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id x2-20020a056402414200b00572cf08369asm5621928eda.23.2024.05.07.07.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:14:45 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 07 May 2024 15:14:44 +0100 Subject: [PATCH 1/5] phy: exynos5-usbdrd: uniform order of register bit macros MIME-Version: 1.0 Message-Id: <20240507-samsung-usb-phy-fixes-v1-1-4ccba5afa7cc@linaro.org> References: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> In-Reply-To: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , =?utf-8?q?Andr=C3=A9?= =?utf-8?q?_Draszik?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_071451_552482_6E973B9E X-CRM114-Status: UNSURE ( 8.26 ) 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 Most of the macros are ordered high -> low, but there are some outliers. Order them all uniformly from high to low. This will allow adding additional register (field) definitions in a consistent way. While at it, also remove some extra empty lines to group register bit field definitions together with the relevant register. This makes the registers easier to distinguish visually. No functional change. Signed-off-by: André Draszik Reviewed-by: Peter Griffin --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 44 +++++++++++--------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 04171eed5b16..2af192c15d78 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -35,13 +35,11 @@ /* Exynos5: USB 3.0 DRD PHY registers */ #define EXYNOS5_DRD_LINKSYSTEM 0x04 - +#define LINKSYSTEM_XHCI_VERSION_CONTROL BIT(27) #define LINKSYSTEM_FLADJ_MASK (0x3f << 1) #define LINKSYSTEM_FLADJ(_x) ((_x) << 1) -#define LINKSYSTEM_XHCI_VERSION_CONTROL BIT(27) #define EXYNOS5_DRD_PHYUTMI 0x08 - #define PHYUTMI_OTGDISABLE BIT(6) #define PHYUTMI_FORCESUSPEND BIT(1) #define PHYUTMI_FORCESLEEP BIT(0) @@ -49,40 +47,31 @@ #define EXYNOS5_DRD_PHYPIPE 0x0c #define EXYNOS5_DRD_PHYCLKRST 0x10 - #define PHYCLKRST_EN_UTMISUSPEND BIT(31) - #define PHYCLKRST_SSC_REFCLKSEL_MASK (0xff << 23) #define PHYCLKRST_SSC_REFCLKSEL(_x) ((_x) << 23) - #define PHYCLKRST_SSC_RANGE_MASK (0x03 << 21) #define PHYCLKRST_SSC_RANGE(_x) ((_x) << 21) - #define PHYCLKRST_SSC_EN BIT(20) #define PHYCLKRST_REF_SSP_EN BIT(19) #define PHYCLKRST_REF_CLKDIV2 BIT(18) - #define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f << 11) #define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF (0x19 << 11) #define PHYCLKRST_MPLL_MULTIPLIER_50M_REF (0x32 << 11) #define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF (0x68 << 11) #define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF (0x7d << 11) #define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02 << 11) - -#define PHYCLKRST_FSEL_UTMI_MASK (0x7 << 5) #define PHYCLKRST_FSEL_PIPE_MASK (0x7 << 8) +#define PHYCLKRST_FSEL_UTMI_MASK (0x7 << 5) #define PHYCLKRST_FSEL(_x) ((_x) << 5) #define PHYCLKRST_FSEL_PAD_100MHZ (0x27 << 5) #define PHYCLKRST_FSEL_PAD_24MHZ (0x2a << 5) #define PHYCLKRST_FSEL_PAD_20MHZ (0x31 << 5) #define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38 << 5) - #define PHYCLKRST_RETENABLEN BIT(4) - #define PHYCLKRST_REFCLKSEL_MASK (0x03 << 2) #define PHYCLKRST_REFCLKSEL_PAD_REFCLK (0x2 << 2) #define PHYCLKRST_REFCLKSEL_EXT_REFCLK (0x3 << 2) - #define PHYCLKRST_PORTRESET BIT(1) #define PHYCLKRST_COMMONONN BIT(0) @@ -100,30 +89,27 @@ #define PHYREG1_CR_ACK BIT(0) #define EXYNOS5_DRD_PHYPARAM0 0x1c - #define PHYPARAM0_REF_USE_PAD BIT(31) #define PHYPARAM0_REF_LOSLEVEL_MASK (0x1f << 26) #define PHYPARAM0_REF_LOSLEVEL (0x9 << 26) #define EXYNOS5_DRD_PHYPARAM1 0x20 - #define PHYPARAM1_PCS_TXDEEMPH_MASK (0x1f << 0) #define PHYPARAM1_PCS_TXDEEMPH (0x1c) #define EXYNOS5_DRD_PHYTERM 0x24 #define EXYNOS5_DRD_PHYTEST 0x28 - #define PHYTEST_POWERDOWN_SSP BIT(3) #define PHYTEST_POWERDOWN_HSP BIT(2) #define EXYNOS5_DRD_PHYADP 0x2c #define EXYNOS5_DRD_PHYUTMICLKSEL 0x30 - #define PHYUTMICLKSEL_UTMI_CLKSEL BIT(2) #define EXYNOS5_DRD_PHYRESUME 0x34 + #define EXYNOS5_DRD_LINKPORT 0x44 /* USB 3.0 DRD PHY SS Function Control Reg; accessed by CR_PORT */ @@ -147,28 +133,28 @@ /* Exynos850: USB DRD PHY registers */ #define EXYNOS850_DRD_LINKCTRL 0x04 -#define LINKCTRL_BUS_FILTER_BYPASS(_x) ((_x) << 4) #define LINKCTRL_FORCE_QACT BIT(8) +#define LINKCTRL_BUS_FILTER_BYPASS(_x) ((_x) << 4) #define EXYNOS850_DRD_CLKRST 0x20 -#define CLKRST_LINK_SW_RST BIT(0) -#define CLKRST_PORT_RST BIT(1) #define CLKRST_PHY_SW_RST BIT(3) +#define CLKRST_PORT_RST BIT(1) +#define CLKRST_LINK_SW_RST BIT(0) #define EXYNOS850_DRD_UTMI 0x50 -#define UTMI_FORCE_SLEEP BIT(0) -#define UTMI_FORCE_SUSPEND BIT(1) -#define UTMI_DM_PULLDOWN BIT(2) -#define UTMI_DP_PULLDOWN BIT(3) -#define UTMI_FORCE_BVALID BIT(4) #define UTMI_FORCE_VBUSVALID BIT(5) +#define UTMI_FORCE_BVALID BIT(4) +#define UTMI_DP_PULLDOWN BIT(3) +#define UTMI_DM_PULLDOWN BIT(2) +#define UTMI_FORCE_SUSPEND BIT(1) +#define UTMI_FORCE_SLEEP BIT(0) #define EXYNOS850_DRD_HSP 0x54 -#define HSP_COMMONONN BIT(8) -#define HSP_EN_UTMISUSPEND BIT(9) -#define HSP_VBUSVLDEXT BIT(12) -#define HSP_VBUSVLDEXTSEL BIT(13) #define HSP_FSV_OUT_EN BIT(24) +#define HSP_VBUSVLDEXTSEL BIT(13) +#define HSP_VBUSVLDEXT BIT(12) +#define HSP_EN_UTMISUSPEND BIT(9) +#define HSP_COMMONONN BIT(8) #define EXYNOS850_DRD_HSP_TEST 0x5c #define HSP_TEST_SIDDQ BIT(24) From patchwork Tue May 7 14:14:45 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: 13657176 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 38DFEC10F1A for ; Tue, 7 May 2024 14:15:06 +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=8h2rglMTQgzZrV85lnUeQZBDv9LnvNA9+sanY6KkiJE=; b=nrtvmOSrlaaupB HrY8YKubL1397wWVSsRRsS4ctOrRdFkEp2rY3VHCKzPlaFgiB5fOibm2MB4Yzuwgg+S60FYGEEeN5 M8tPfDfBUrX2L3J96Q1j6qN1ORSomQqTfMquMxJ1ENGlWRzT7jAlzJskMgSvIaogrIInmZBTe76bR 3el1L5i0rkxOGQyhsaJwaSmwMpo1lLJC3L81T426FHaOPggN+UCLzYBn7LKx7xcZHM9jdCMUBiDSS SSrv9neiBGt5EkVdeELKtKhju1K9uklXDJqr+UNZpLluBHF1hb8+4EE0G3gjdlnMSGMUueZZHq9E9 SNnJJYSHx8MX61+nA6TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Laz-0000000BQct-0Wku; Tue, 07 May 2024 14:15:05 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Laq-0000000BQRm-3TI6 for linux-phy@lists.infradead.org; Tue, 07 May 2024 14:15:00 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-572a06e47a7so224078a12.3 for ; Tue, 07 May 2024 07:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715091287; x=1715696087; 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=5eNwp1KeR6q1csnKLq9DFYvN46m+YqLkkQLc199nW5E=; b=IDnKevXcqBx+Jz1whFIQGFQid8dHrkWgk77CN/looAcpHUBKx1rr4Z6fD0ahNXWAw6 IDwWkgHpVVR8C65hymsAcwUfH6WNKIM77ySsPbxowY1IEMYlAAleOzBy5V/K0o1xEPgI X+8qIdhYKtqcSJgCz7t8WkDn7ex75gUO8hnX0Gvllo+M72BvfHyWH6hnmpyoOQ+bmLcF 1utNDJfPq+vUQfRDqczgTZk/IBmXk5RsV0GH+egH6pTbOo37a5op3h93fFDnHWK48EH7 K0jgIVBGRO6/QeOrSFEH6ZIscadJ7rGD6JMm1/8YpUrJvJt7ZdRyrnDkJNFPNEY+6IX1 KIOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091287; x=1715696087; 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=5eNwp1KeR6q1csnKLq9DFYvN46m+YqLkkQLc199nW5E=; b=MNAPivdVLhZ2Y9z8jWGavxGh8AQYBNNfWQMhoBXgo5juPWqZB9lS2CNO82lOtnSp7d nMsBbpHwiuMIMVhoRb8rsFihPhjnfxXnfssVXiK/D6GPfjwCegDS1Qy30JGC+lnQg4cz s6mLkalxnDzWVaqxLqFdZEXp153iR/4rFTACS0Rk3l0bh1xPsJKg7odeWvZh4i75j0m6 eealoNYWq7YIBBEFm95HElkZ6obdQ5xaBjpEHSkZCbnJagwGzgXYUk5xCHyzsIuJ/H58 BJfR5OJA4sZ4aTIBYC6RxcoJ4nI08SIAVzQBBNyg10BZiOjruqMeJ2myC6eDgBkF6X62 n24g== X-Forwarded-Encrypted: i=1; AJvYcCVN+eqc7OkR1zKx1Yp3F1fFOZxkEa5sJF3j7iySopPka82JZ+QsUjDtRuoA/QOnL3MwoeR6EWnJ6ZH+FHJd6PWitwIxT4n8frcfphQG7Q== X-Gm-Message-State: AOJu0YzmecB87wHWr+jd/D1PRzFaPsdDzq8gswGhJqLn4lpU+EMn8Fg7 6xQnyRQOUSh2ZseX5EV2RXn3Gu1fzUVUWmAmbLUNZfJrKGoxi/ecsicCv/mBaTw= X-Google-Smtp-Source: AGHT+IFlhgpaj8s7Ylef1U/lb5hV3d+hj+0ADsOWoK2vF6wUkDdpIOR9A24GskIxbkz+a/2MUnIIDg== X-Received: by 2002:a50:8d16:0:b0:572:6ab0:6afc with SMTP id s22-20020a508d16000000b005726ab06afcmr9113193eds.33.1715091286727; Tue, 07 May 2024 07:14:46 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id x2-20020a056402414200b00572cf08369asm5621928eda.23.2024.05.07.07.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:14:46 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 07 May 2024 15:14:45 +0100 Subject: [PATCH 2/5] phy: exynos5-usbdrd: convert udelay() to fsleep() MIME-Version: 1.0 Message-Id: <20240507-samsung-usb-phy-fixes-v1-2-4ccba5afa7cc@linaro.org> References: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> In-Reply-To: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , =?utf-8?q?Andr=C3=A9?= =?utf-8?q?_Draszik?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_071456_988518_57D99B7D X-CRM114-Status: GOOD ( 10.77 ) 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 The timers-howto recommends using usleep_range() and friends anytime waiting for >= ~10us is required. Doing so can help the timer subsystem a lot to coalesce wakeups. Additionally, fsleep() exists as a convenient wrapper so we do not have to think about which exact sleeping function is required in which case. Convert all udelay() calls in this driver to use fsleep() to follow the recommendataion. Signed-off-by: André Draszik Reviewed-by: Peter Griffin --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 2af192c15d78..1b209ab7a268 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -448,7 +448,7 @@ static int exynos5_usbdrd_phy_init(struct phy *phy) writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); - udelay(10); + fsleep(10); reg &= ~PHYCLKRST_PORTRESET; writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); @@ -779,11 +779,11 @@ static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) writel(reg, regs_base + EXYNOS850_DRD_HSP_TEST); /* Finish PHY reset (POR=low) */ - udelay(10); /* required before doing POR=low */ + fsleep(10); /* required before doing POR=low */ reg = readl(regs_base + EXYNOS850_DRD_CLKRST); reg &= ~(CLKRST_PHY_SW_RST | CLKRST_PORT_RST); writel(reg, regs_base + EXYNOS850_DRD_CLKRST); - udelay(75); /* required after POR=low for guaranteed PHY clock */ + fsleep(75); /* required after POR=low for guaranteed PHY clock */ /* Disable single ended signal out */ reg = readl(regs_base + EXYNOS850_DRD_HSP); @@ -836,7 +836,7 @@ static int exynos850_usbdrd_phy_exit(struct phy *phy) reg = readl(regs_base + EXYNOS850_DRD_CLKRST); reg |= CLKRST_LINK_SW_RST; writel(reg, regs_base + EXYNOS850_DRD_CLKRST); - udelay(10); /* required before doing POR=low */ + fsleep(10); /* required before doing POR=low */ reg &= ~CLKRST_LINK_SW_RST; writel(reg, regs_base + EXYNOS850_DRD_CLKRST); From patchwork Tue May 7 14:14:46 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: 13657178 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 CF456C25B4F for ; Tue, 7 May 2024 14:15:17 +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=CkJ4jwPkLmItV330D3Jpyt98rGStMzXjEcyGrPVCHS4=; b=4gMppOp7rseHIH OXZ+xMd2Hoe88j1miLRInM2wTSADkIlYMuWSoVvE4HgWMP2FgkR4dDGSYIXAWnuu3NoNareMJYnbi 248jarWOJ1jsiRswObv1GcE9VuVQ4jWuzirNgvxPXoj9sfPhXzSFB/x1L9PFySjvFUC5Es6HuSM2c UFwTKVQBztlRDOJcPjVPGWuj+BSKtBjg1Hx+pPHysiav8k5+6lBxVXD6MpAkbyZsvN6RsgfKHM2yo h1BhkneA2oT9vs45PgTa5pjk1puRejAjUvmOtssx2jX1PpqbK2LuOXJNKJ8YFwrlNfJf+JsU8puqs WZh7vKDwTVHeIY2L+QrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4LbB-0000000BQl7-1R1J; Tue, 07 May 2024 14:15:17 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lav-0000000BQRv-2X1n for linux-phy@lists.infradead.org; Tue, 07 May 2024 14:15:05 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a59b81d087aso682767566b.3 for ; Tue, 07 May 2024 07:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715091287; x=1715696087; 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=PzqUO+Y4mCEkRzT42mutSa2giiTX1rn5tTLc65YmNFs=; b=twv9w4DgTneJs443sPuVeaXRceadoO5SNOKUjb78AeRgtZv3qE1kE7nFAF8c46rBQf 4kCh8Qb7sb1vYvOGi7czrFaPvOjO5LrjGpL+Gl8rRoKSccHDUqDZeycwk2ZH8vKqH5z7 RozsCEC/8n99FyZ9HDAPkFcKYUzRdDiKUw8euQApoksrh0xN/lc9qftaf7EAtc96ObSg u4AOMIamSeVlBfAmxzThPpXVChVjGT5+StwAF/YAwVRJ8A/BNg4hQsTLAEdeBzcJ3gNv SEyYpOzYaDZZhqpAb+V5IKkygbbhbf6vY3YaObWE3Gl7aYXMybq+hQuDZnrswKB1AziH rgDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091287; x=1715696087; 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=PzqUO+Y4mCEkRzT42mutSa2giiTX1rn5tTLc65YmNFs=; b=IOeVA+Ib/YodfP7HIqcP4Y6e87sStUZLg0PU6UXNYs5PvDlr5qsAUGZpOHvQUBs/Yx K10NsbV688aiuOPyfUYl0Gl7H8j0BMxa0b1I80hPGmuEir5vesc36GpgThJ3B+d3te6m mZtP8gGVJWjgUVaxif0rtBJgNi5W/J96wFT830UTf7F9I3VasAZwzJY6YaJSe+RpCf0O NcCONNW3qrH1GVamKUAc1U180KXR/zXmI6qyQ0Asn3akApTK3eyXCn51h2BtPFVLumQs WNw0WMW+05kgLcEOQu8N+ONxlRX4d7k6F9Cfu+27EdLHhvMBy6VYbAgYuJLxzTkvo5oz 4oeQ== X-Forwarded-Encrypted: i=1; AJvYcCUPC/lTPaQAJHyadENRLrRzwtRjINbZ49xxGZpvh9Vao8M/XPiSkfUIukKFKzyxwfzPNj5qQsTnG4lMU+c8qDN3i5LHZEN6mQbmVhx1ew== X-Gm-Message-State: AOJu0YxAjRD4MQTl01rwCrooRYguIyFKlXVK3daOV8cw9wLdThq2CheC HV9Bdxc75J9zISb51lDaxRjmr1yOj+GXlVaIQy9/4LXq9oYHm8vIzTm5fnjOhVI= X-Google-Smtp-Source: AGHT+IFLbaE7KL4bM9NZleowwf/9bWz6QW+2cO4ZQn/n47PzlsG520bpJ6V/v0rjjw6rNMHBVt1ovw== X-Received: by 2002:a50:c319:0:b0:56f:e7b9:e67d with SMTP id a25-20020a50c319000000b0056fe7b9e67dmr13463276edb.12.1715091287117; Tue, 07 May 2024 07:14:47 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id x2-20020a056402414200b00572cf08369asm5621928eda.23.2024.05.07.07.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:14:46 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 07 May 2024 15:14:46 +0100 Subject: [PATCH 3/5] phy: exynos5-usbdrd: make phy_isol() take a bool for clarity MIME-Version: 1.0 Message-Id: <20240507-samsung-usb-phy-fixes-v1-3-4ccba5afa7cc@linaro.org> References: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> In-Reply-To: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , =?utf-8?q?Andr=C3=A9?= =?utf-8?q?_Draszik?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_071501_852090_A39FC30B X-CRM114-Status: GOOD ( 11.61 ) 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 on / not on is just a boolean flag and is a bit misleading as currently on==1 means to turn off the power, and on==0 to turn power on. Rename the flag and make it a bool to avoid confusion of future readers of this code. No functional change. While at it, fix a whitespace issue in nearby comment. No functional change. Signed-off-by: André Draszik Reviewed-by: Peter Griffin --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 1b209ab7a268..ed4898741c99 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -173,7 +173,7 @@ struct exynos5_usbdrd_phy; struct exynos5_usbdrd_phy_config { u32 id; - void (*phy_isol)(struct phy_usb_instance *inst, u32 on); + void (*phy_isol)(struct phy_usb_instance *inst, bool isolate); void (*phy_init)(struct exynos5_usbdrd_phy *phy_drd); unsigned int (*set_refclk)(struct phy_usb_instance *inst); }; @@ -273,14 +273,14 @@ static unsigned int exynos5_rate_to_clk(unsigned long rate, u32 *reg) } static void exynos5_usbdrd_phy_isol(struct phy_usb_instance *inst, - unsigned int on) + bool isolate) { unsigned int val; if (!inst->reg_pmu) return; - val = on ? 0 : EXYNOS4_PHY_ENABLE; + val = isolate ? 0 : EXYNOS4_PHY_ENABLE; regmap_update_bits(inst->reg_pmu, inst->pmu_offset, EXYNOS4_PHY_ENABLE, val); @@ -525,8 +525,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) } } - /* Power-on PHY*/ - inst->phy_cfg->phy_isol(inst, 0); + /* Power-on PHY */ + inst->phy_cfg->phy_isol(inst, false); return 0; @@ -553,7 +553,7 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) dev_dbg(phy_drd->dev, "Request to power_off usbdrd_phy phy\n"); /* Power-off the PHY */ - inst->phy_cfg->phy_isol(inst, 1); + inst->phy_cfg->phy_isol(inst, true); /* Disable VBUS supply */ if (phy_drd->vbus) From patchwork Tue May 7 14:14:47 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: 13657174 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 4BA0CC25B5F for ; Tue, 7 May 2024 14:14: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=6MtEwWRMjGSTEDnqdefjBjRWhs6dkTYJzQ72lstHyUE=; b=ZUXDx4CQJAvmiu j5ZhU5HScPoSZnnKo2Hljfnn1Zzxocu6da7DB9itK0JZMstGTqkZcFOkjKs75IxmG7pKNtEVqEX95 V9XHrocRP3wRbc1g+E/kRToFG+EEtfpq6h/O09IxpnGc9Jbskhm4LqBpb82QL3CWZXk7fJ/EtiCYM RHckYrM7x14AQJPWx7E40U/xA3e/DO2Pe2PG+yT92V0sBeS76j//yAvLMqQM0Q11x3dYhv9e1yOjn 2iP7nMs5sW4ZL0GrYxr1noRT9+CDxRETFQSrolnaOvnBuZT08Tu0dp0G3E0xYKfAlWumHhnZ8Dl1N qPJ4H3Lk5vtNoEvLqimg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lar-0000000BQX4-409J; Tue, 07 May 2024 14:14:57 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lak-0000000BQS0-3EWr for linux-phy@lists.infradead.org; Tue, 07 May 2024 14:14:55 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a5200afe39eso838631866b.1 for ; Tue, 07 May 2024 07:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715091287; x=1715696087; 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=LRJY6HmSgpn53uyORMcRB9h2EnMXe+jzCDlKmur6pwc=; b=XtSYjE267deO5E5buO2f12Dw00h0srSpLlgg/02DpSZpodA9eAE8EuF3cIww1/xlWa gLlbCKEhENXs+elSq/UloLyxAd3mBdef1KOFzAK+ZCsi9xcMK5hAkRuy7NNJJz6mDL6e zTVU38V9P103XetjRzv1fBO2IlVYolyC/fT2lxr/oY0vMjPEtlXdmjJp1bGYttnx2/KI RQVevYhoxaddJRNMk9b0GkcN2e3Jdp/RWmwGSc+36oGi70DdxxPUN82s75VW7+cW9rtP lghBo8CQ0tCn2sUBFCAteZVBfVw++GHF9WX2HGtdlipKeu7rKOVAA8q5eQ9pTVahTyKI hLTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091287; x=1715696087; 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=LRJY6HmSgpn53uyORMcRB9h2EnMXe+jzCDlKmur6pwc=; b=o1ev0imrDKKEmuDpBNMdAwMPE8ikqXs/0LpnCf9ZvYYVMh5LaFKrwowNqIBsR/xGJL UX2k3MWvTYTgdzV00gBV13g/rhOnnmHJBwbrSNiP8Az3GuMzFp6feBfwi+x1wpl4T2VO V89q/N+mXBDKjK5qEOyxCJTpySBJ5qZoXmcrg4Kd0dnKe4zteZaTKUQenIjsA0jM8Yex Bz6EgJzBjXXkkIOhIz8BS3BEEOXlr9p9DL3PrIMBtQHYkkU2g4fOXw8M7aeUHxxszB42 +nI2le4bRw5eK7u69sUIkVQ1smICkDFt4J1O2lNY2wpbV/PolUP5j2XC0tGw4dDXUn6f V+cw== X-Forwarded-Encrypted: i=1; AJvYcCWbLlxQDOKnzAseLZ8Pa+QFqw1rqJq7mA2ixitt8zDnGHpBG9gqWARxTxRlJVCwpYFIILnTKjaupjSad865Bv4pRrTjzk57XQpqPAobdw== X-Gm-Message-State: AOJu0YxDRAIbROGvTJeLNkyr4FExfQ28kdLZYCiv3Nr3s00bu0rGsyEv /tMhicAvNy21e9wVU4kV3dLa9d0sygF7lLLHJoNO9kt5c7IwQNO6+j3C+LSCcG4= X-Google-Smtp-Source: AGHT+IEdZxa78ehLtOjVAh87nK9d2t0R1fsYeVK5kmd0WktV4j/K80OYdHHk5mz5N7FPqzg+kN+QUg== X-Received: by 2002:a50:a45c:0:b0:572:9dc3:ce3b with SMTP id v28-20020a50a45c000000b005729dc3ce3bmr11623041edb.1.1715091287502; Tue, 07 May 2024 07:14:47 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id x2-20020a056402414200b00572cf08369asm5621928eda.23.2024.05.07.07.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:14:47 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 07 May 2024 15:14:47 +0100 Subject: [PATCH 4/5] phy: exynos5-usbdrd: fix definition of EXYNOS5_FSEL_26MHZ MIME-Version: 1.0 Message-Id: <20240507-samsung-usb-phy-fixes-v1-4-4ccba5afa7cc@linaro.org> References: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> In-Reply-To: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , =?utf-8?q?Andr=C3=A9?= =?utf-8?q?_Draszik?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_071450_826741_3FB9C253 X-CRM114-Status: GOOD ( 11.99 ) 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 Using 0x82 seems odd, where everything else is just a sequence. On E850, this macro isn't used (as a register value), only to assign its value to the 'extrefclk' variable, which is otherwise unused on that platform. Older platforms don't appear to support 26MHz in the first place (since this macro was added for E850). Furthermore, the downstream driver uses 0x82 to denote USBPHY_REFCLK_DIFF_26MHZ (whatever that means exactly), but for all the other values we match downstream's non-DIFF macros. Update to avoid confusion. No functional change intended. Signed-off-by: André Draszik Reviewed-by: Peter Griffin --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index ed4898741c99..1da7a4881f72 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -30,7 +30,7 @@ #define EXYNOS5_FSEL_19MHZ2 0x3 #define EXYNOS5_FSEL_20MHZ 0x4 #define EXYNOS5_FSEL_24MHZ 0x5 -#define EXYNOS5_FSEL_26MHZ 0x82 +#define EXYNOS5_FSEL_26MHZ 0x6 #define EXYNOS5_FSEL_50MHZ 0x7 /* Exynos5: USB 3.0 DRD PHY registers */ From patchwork Tue May 7 14:14:48 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: 13657177 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 4AFE4C10F1A for ; Tue, 7 May 2024 14:15:15 +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=32dZi1Fjz6l0hX7AysIxJ/hBij2K5apFR0gST6geRLc=; b=E8nVtxvTOE9/FD ixhzauvMuAJhLNUXLpLQ3dHdIZRRf5UzGsjSDjHzhifRzAMLmhbq3vDNWfMQD/GePPhW/TUPiSRM7 CFAWJAzwo3ogw9n9Tmeu7omwG0pDhNucEmucjuArI7Ue7k3tWlBaA+t1y2kO8ayhF7cIZKCF7dVmy AkXsMtT5c3r3pkd6wo2cGfCKjDJe/avjEOw129MjfaRzQ1ajq0+L5IpY+dJebdbmlFUZBkrWq0qgW JYnG/m1MllLQeDTi+ermt6LQQTDnKICqCZKszOgXIIVCE5rhVaHd1F+RvfAf2wofqmjLpjAuXTuVs aBgu03AzhJON7qgNyrEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lb8-0000000BQjE-2WZZ; Tue, 07 May 2024 14:15:14 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lav-0000000BQSI-2W9S for linux-phy@lists.infradead.org; Tue, 07 May 2024 14:15:03 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-572adaa172cso5527979a12.1 for ; Tue, 07 May 2024 07:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715091288; x=1715696088; 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=2AhGxPfO0jxLeMCNC4W84i2OQnqDzy87o4JACQM4lhg=; b=pLyExlpmmq4lMqXIZwh56GThyn60GHdN9E3v6L2ibjjkf91l2TN/qprVi2jpT79Gx4 WFCenwJQbS4KtltswpjPPwCpIikhKId8PuEXVUppB7KCvJWVbdRwsg2m6RSidC76ZRuu 2rUig1VjGkIoRHGYjQ+Meb/8MjOCKycR6KQ4e5edAENt9cBAkbzVQQtGK81KviLH9lRb sm9EH9OidrY5J5PL1J0L8kJE+k+H3VIO0ZldlyxnTviPccriXM2oYvBHKyHwRyBWdFfZ IEnei1Ps4FjJ5pM0oPb9eQtvRXJenFRAPglN1+hCGZEROSNHPMOG3eXFP6kcEHzuZMSa 0pUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091288; x=1715696088; 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=2AhGxPfO0jxLeMCNC4W84i2OQnqDzy87o4JACQM4lhg=; b=i2uphlkBvuexe0o47T3JZ9Zkik3FDJ+Yp75jJQYW87oh7cZRtfpAKfP5dsRHMT8/mc 1RLD4D0rM94oDoI4BWmpjX/rtFL5/D93sIsLFDrpEbVycumMiq0bFwZHDgh8nUqCSP8D SPQosH7n0EWhDWsOpELXn6luA7ME+lP2F0ErrUp73ScENf82h793sYDxwwPjJ7uKMT2b +ynkUK5YOcMnn93dCz0SvxXT0BTJNTSgVSW290V4qvV5DMURSe+tRlwxYlgVllsNba19 QSw/Lhmn2QEtssR26MTkGauXY0ZdFwmo3KPaCZMw85wBJhRJm8OYz+w8M0KQnVS8oJ4l ArkQ== X-Forwarded-Encrypted: i=1; AJvYcCVdCbSpTeoqyE6gh6TWgNOAPYTR1bGKNTQlhEazHycNWg+EUA03tS9ZvHY3nm+SpoNYEXAsJ4XOMKJ63WNd2mHpwETGFPCAScVs4+cOVg== X-Gm-Message-State: AOJu0Yy5XX/IekjsEcDarQAA0uCS2sGxBJpqeMx58s+H8M9xtdMy28nK fbnakZCOx8VdSk5d/g6T3+1aqON5pHn3iV1ULOQx/HXnY1jalOATDnVv429yOXk= X-Google-Smtp-Source: AGHT+IF93U5EbjSwxazXGCgRUoQpkJwYIG6vkvVms1C680kr/QzgHDatBvsRnvscl1lkUzBabOX3fA== X-Received: by 2002:a50:f683:0:b0:572:a158:8a7b with SMTP id d3-20020a50f683000000b00572a1588a7bmr2479836edn.8.1715091287917; Tue, 07 May 2024 07:14:47 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id x2-20020a056402414200b00572cf08369asm5621928eda.23.2024.05.07.07.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:14:47 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 07 May 2024 15:14:48 +0100 Subject: [PATCH 5/5] phy: exynos5-usbdrd: set ref clk freq in exynos850_usbdrd_utmi_init() MIME-Version: 1.0 Message-Id: <20240507-samsung-usb-phy-fixes-v1-5-4ccba5afa7cc@linaro.org> References: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> In-Reply-To: <20240507-samsung-usb-phy-fixes-v1-0-4ccba5afa7cc@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Krzysztof Kozlowski , Alim Akhtar , Sam Protsenko Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , =?utf-8?q?Andr=C3=A9?= =?utf-8?q?_Draszik?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_071501_759776_8B02845F X-CRM114-Status: GOOD ( 12.08 ) 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 While commit 255ec3879dd4 ("phy: exynos5-usbdrd: Add 26MHz ref clk support") correctly states that CLKRSTCTRL[7:5] doesn't need to be set on modern Exynos platforms, SSPPLLCTL[2:0] should be programmed with the frequency of the reference clock for the USB2.0 phy instead. I stumbled across this while adding support for the Google Tensor gs101, but this should apply to E850 just the same. Do so. Fixes: 691525074db9 ("phy: exynos5-usbdrd: Add Exynos850 support") Signed-off-by: André Draszik Reviewed-by: Peter Griffin --- Feel free to drop the Fixes: if you think that is unwarranted here. v2: add missing bitfield.h include (seems this is implied on some platforms, but not on others) --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index 1da7a4881f72..15be966b50ae 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -8,6 +8,7 @@ * Author: Vivek Gautam */ +#include #include #include #include @@ -141,6 +142,9 @@ #define CLKRST_PORT_RST BIT(1) #define CLKRST_LINK_SW_RST BIT(0) +#define EXYNOS850_DRD_SSPPLLCTL 0x30 +#define SSPPLLCTL_FSEL GENMASK(2, 0) + #define EXYNOS850_DRD_UTMI 0x50 #define UTMI_FORCE_VBUSVALID BIT(5) #define UTMI_FORCE_BVALID BIT(4) @@ -773,6 +777,31 @@ static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL; writel(reg, regs_base + EXYNOS850_DRD_HSP); + reg = readl(regs_base + EXYNOS850_DRD_SSPPLLCTL); + reg &= ~SSPPLLCTL_FSEL; + switch (phy_drd->extrefclk) { + case EXYNOS5_FSEL_50MHZ: + reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 7); + break; + case EXYNOS5_FSEL_26MHZ: + reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 6); + break; + case EXYNOS5_FSEL_24MHZ: + reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 2); + break; + case EXYNOS5_FSEL_20MHZ: + reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 1); + break; + case EXYNOS5_FSEL_19MHZ2: + reg |= FIELD_PREP_CONST(SSPPLLCTL_FSEL, 0); + break; + default: + dev_warn(phy_drd->dev, "unsupported ref clk: %#.2x\n", + phy_drd->extrefclk); + break; + } + writel(reg, regs_base + EXYNOS850_DRD_SSPPLLCTL); + /* Power up PHY analog blocks */ reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST); reg &= ~HSP_TEST_SIDDQ;