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: 13657200 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 4A5E3C25B4F for ; Tue, 7 May 2024 14:15:13 +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=pVFHfNPdJzJ06qSAFA8c1nJav6x0jP3hRHPUOwjm3Is=; b=eIpbw41XSUSemS lrjmP0myhstIRT+zG8W67XgaeY3nJmETMzli7Yt9iYgDsCIsU9cRYcnQzWS+0ZLu9f+8awgqH27wO 69fvf9ocplzbwch/qdGhyYWXJiKfRDdB81Op02j8JFNnZc5SUOUvdMkesFVg/cbqXHchfISiZuF8K q5Rx4ysTOsUcmskRqwFj7wOYfZj3d6ZBK/QrOt4sBKBJ1pbh8VeHA2mcirxCERXU1NZC4aCoH43By brh3pK3fMU3U6rd0N0o3+sPEWEgM6ma5SRVh3ozQ8+0bNlGtkfZIyenNY8RwYLa6bzYF5y4IbdyN3 zHmvZU3v7CSr+Ngx4gdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lau-0000000BQYr-2Xxo; Tue, 07 May 2024 14:15:00 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lal-0000000BQRc-0BjP for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 14:14:56 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-572a93890d1so107235a12.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=ZX0JEqOpbLWPinqsz6kUkJIobKy34xJ5YXeuQeIWBOzcu62Ym2TxrsDmCvr3l3MhxW IsjVm/y3cnuhZ4XrYZlCF0DHL/PBp/8uBTn7GOk91ESgrnXHCAvLlxinPavQebIY/tvt vOBew2nFscVBdDojXjwLAeXNdct4/5FsE10U7P2lavc9n7vCAnIVM+SqDJMuj/PzvMFj wlq9TUQYmKclDBAhd2ViNSKwJAGzQ+gY3bIzZhgH9fArMckaynAovZsFqOwPzfbWiOOr UEKClCxgna3D65GnzN+OrzgzLVdyA0hPnhith5WtjaQBhMllDHTbZu98FDwyVB6iSLdB nt2g== X-Forwarded-Encrypted: i=1; AJvYcCXO/7Rb1otncX1qihJHYDD/VcIYhtG5Xxx4mwtFHrSS4v+Z/ANbQ+/1HWdRZqNwgR8A1Zgk1gTnAAsosOPdanQHq7QsbpDIFOPZlVY4iV/arCerrIw= X-Gm-Message-State: AOJu0YygQbk0xPVfcmdx/vdU1SdA3VVgjc4CgFnUaPphoLDIB9+ox2n4 lsflK7sih/dvLN9dgTp3A5AK5+w0sWwMchYXclcmm/diWfvh/2hvlWNpS2BnRFo= 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_110129_9FB41F17 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 13657202 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 08193C25B4F for ; Tue, 7 May 2024 14:15:32 +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=OdeGiD0BwrZG50/0+ebYyUl7dO8FAiq3ltcs2PLTY6U=; b=fcRql+PCiDPtDu lx7ZlkTJJO3ugoJrpQ6suaZpdQj+AugPyCcnKvYfpQ8/5wi8Z4Nk0j1LDkHVTNPglMmOiwqsH1TS6 VazZrMvo1iDQ8z7QnNnJe+8KUUQKk142qdWuVIbfamGi+LkP1UTrl0G8w3TUuKm6pt/mGgDD+86+G PnKzhXS9Lwd7syXwEcuY8KTg+SdbyoIq4JlyphZiaPi5HG7/PEAvkdp87K+h3V8ipFOYgX/98cQpa XfEKV5DfIuHiZ91gwx9WvmbAcFA8zQih1cMisqn5sxMzhPYawtvQqi9ArwIM/IM0ftOUbuzADXUKE wasvwdXAOjb9eZsuDoDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lb7-0000000BQiP-2Vj2; Tue, 07 May 2024 14:15:13 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Laq-0000000BQRi-3nL3 for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 14:15:00 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a59a17fcc6bso729566966b.1 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=ZU2nw7OxDbtq2lrpOU2tgLJZ1F2nR9wTCcZqtTi9qmjEk1DzyNNMuz719K9dSA/1L/ LEi9QCKtPWbBbv21pae4fO9D3Pje5INTsULIYIzle+7pOM5jRtPPgVZa6jEg+SpIZMAi w3XFYoAFMJ6hCFGJjUhywp0dXh8n5R6/REPO40TV6h5KZ6NhaJCRcWgbt+x/OJUsMIA7 94n9BejYClZz4xcKufL7uMLEZAVilfS+WpwtZRqqWsTFGGkRpSVeJrVhpdf2HvGMbo5q HESonO3blSB/QQsJOWhZLQHmVnubpoxRsS+M6lp2lmBQomLdx30ePPGLjmxRp1uTKEuT 5Y0w== X-Forwarded-Encrypted: i=1; AJvYcCVXtv0o6N2HWahC78338sRJYeYitFjnixp13raipc7Mo4CSJMIRI3OLY72jUSTbtuCBCNSU8HAIHV+usJlrwJBY8HGl86boQd/0+SDyu7puSTWAi3U= X-Gm-Message-State: AOJu0YynLEVw2IKEIhbLPrB2OatVxE0pCwqTEZasw9lpjIZ+BCDpL43b a3yo5QpicDE8nS7TZNnWdpvlpdWfPU/lmtjs3holKdNnJG5CHrYe1uvjA51Z8r8= 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_071457_019338_8275048B X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 13657203 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 D51F3C10F1A for ; Tue, 7 May 2024 14:15:34 +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=DETkngwu8XBIlamqv6j35+wq6ykejmB+3YevLavSQb4=; b=CmeWjgAfNikUUN HYmVmBT6x3ZL61Bf2Ou9RRM7bYVrmv3OtlIR7apf8pA3Y4UhcnlyRjuHTR+273Dqh6Pkfyg1A/CXL Mt1xB5tFwx+3ZvR3USf3YzVO4VI//r/0nZomxUwRg9FJXgBj9u28UF99gCnhNP4btA4LL4CjIdX3g NIWbarrpbEHBg+df90qL72SFmouUlkwRJRvgcwdPesJxeGnsGd4fLJCdC1LMn9flEUdc1itsHxVmf 7wsrt+RzPrXq9v2L1j/ZF2g3S9GGBTs7515mFBodYutNliKOFlw8Np+y2wDUfqu19QkelPhLtqlz+ xzPSAB8hpIXAK/aDrMaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lb9-0000000BQjk-0oEM; Tue, 07 May 2024 14:15:15 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lav-0000000BQRw-2YQH for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 14:15:03 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a59ece5e18bso206305166b.2 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=wbNh36aUfHv2UUz69U1cS0V2dPyUvzQOK8hg9x2Hzm7qZbQqWhQ4CRSTgdW5VFA/m3 tfA8qWumIPXcGidVs/dbOiYpawGVTYRHK/deSsAEnfwo828dmEKIHEwpTRlpXPrLr+aO EyJDkcFLoce5sbU4B1mT7vXTPba22gR1BQh8DeHTznbj76NQWc/QFgjWhfxIXo0DjaHD 3Gz3ViHOdwjdcyteDrhTH+5YdqS6lCAKS3nQRSMUOpQUxid1G9fFlNkfb0q/jtWVpUI1 QLrFSy17aBkmUh4ABaUd2ay43uVImIm+oT2vOQjCxqFncUOl5X0VKSELscViNsMJ4qix ociw== X-Forwarded-Encrypted: i=1; AJvYcCUVQETFjhHmwBMc9FXOZERyOaZwdrW9OKm0RdnuQ7U1MJFuIHxMYq/LzUROX4QmzJt/pBQZMIq4hQSklxqtzLKi5775adoj/XCQs0x4mjex7/iSK2w= X-Gm-Message-State: AOJu0YxvRzQqYljvqXuiDfMRDgA0XLvx+LczSDMD5U3HNUuhuc8Dd+G2 D9S0JoPiqw6AL6FpVR3Sx+jhkaVOAKrFfXMigtVN7mHIfNQdxBhQoqXxMZCERi8= 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_848156_A72B498B X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 13657198 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 460DAC10F1A for ; Tue, 7 May 2024 14:15:11 +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=QlZlthhXD+orK7OFe7tiekEnlI1mbJVn9r9k+l+T5Mg=; b=L1Wad7Xkr1nU84 XksspR7ckjHntlwiVbv89C0ZJW/9THJfgCggyDZGvfc8FVaKq6tnFFxAA6IowbxJcnKAffMSheQH+ eKCPIVFWbH01A/u6uU0o8+zJOa2inZqiJwqfEjhPrd/DppP5+ReO3erlUj4UC7mq70HbxCAPEeUrO 8qPQhTCOub125nzD0+DVgij2pgcy1AIzfs4pXUv0EJ/T+Ot1kvWaXyu34FhMS5vvCLR5gskDPGqb9 FOW26e55w5O2xA+FMj/0hh6HWxRimNLOqnHa1Ky1ydsKYofpFfSFjThzuTIFYYR1GM+9pI1S0p8xC XfT26dW9Is2eImy3cJ+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Las-0000000BQXL-1nXO; Tue, 07 May 2024 14:14:58 +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-0000000BQS1-3A5n for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 14:14:55 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a59b81d087aso682769466b.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=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=hTUeebWVKP6+pDMAXz3pfcQ7BdIRf7FCZ4LDUt/uo9qb0iHSrT2KOe6HSV+Oo8n35s Q1H1o9iQBhBfkXDj+iDmUUT2gmyIJ/EwCCd5SbPD+wu5ZU/ZEKR58B87xgQC+gAZCrsp lMuTCk42pmKcfo4znLWvaiyvI19y4cmXgFGi8IvsF7BOMbO4/sxpG0NTqBb69D3gG6vF NwUjjeG4d7Zwjvlsqg2lgenpBNdltkPOpZ3k73pkaTNKmgc53QvzBcA/KOnhOlBe1sQg 79ML/mmqGcmxWY9z37pGt3UFMRdLWjrG4o6jpEDsZm0iwOtQxQ6uakfjwMK51Ibev56m CWMQ== X-Forwarded-Encrypted: i=1; AJvYcCVEgg6ZM2XE2wCzhSf6lvhIrJ8Z5kQQd3QgM++5T8s6pVJ3Aa5f1ViDceH1i2oAIBE6Lb/PMJX1UfPZuCPUyU9NP7PWL3eYY9A908S6KSo4m11ma5s= X-Gm-Message-State: AOJu0YwinrZ+E2v39jrLGf8GN8p0sjHHqx7dpZCdAjw7lc4UbfKTFi+H fDVsli+PQE4ZXJ0b+ugWMXq0cjAOzILFGiJ++KMEEcjstMG+Klgz1XaYtgZ/LuU= 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_823597_C155B62F X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 13657201 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 4702AC10F1A for ; Tue, 7 May 2024 14:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=swKppPNa6pMRaecJ3iVVLj4lKjoOzuxlI91E90xI5Mg=; b=wsu0iAnymTpZHf OXfh1CUVBPYfYHruQIhCyLw2PXMp51aBk6CkebCxNW5Dz9EhobWSL5USQbhOccBet5DurwePnvq5v vTEw/inH7hODlA5ncYmCsTz+Cs+G1YfC8rMGNQhL1Ir0dkSJbS0KUC7CAd2zN+hkEtHwibaIo6ZT3 M1HpiLt+90LXwJmfKguvDmhZKl1XEKRKffL8TBuJUyAU7g1vfT6i1LB278TLTzBfA6Qs4tBq/l40u brH3yXawUrsLnaVHnAWM8lT7tGDxQ8TFhtu3UcBy6thxNMFNr4kWDnw4bJmXugFf02U4bIHgHMDe5 I+n1GjUn1igraaOvV84g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lav-0000000BQZR-3GSZ; Tue, 07 May 2024 14:15:01 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lal-0000000BQSH-18Dx for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 14:14:58 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-572baf393ddso9382347a12.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=HDqvHZt64N8/S2uNn5RRbtmzi928J1YFBQOPQdcBBpKp1W/fyMmdUzsB7fU/aLLVk2 ruUbneAWrmphCLceuBgt0VNcFDBpRoAbZcdLL/iCCT0rPzo+0cAsOWirMcWfzqE+SXXH PfmtJcmYVfl/zrcsNnV/Hk+MjURxSrNcDiM+N8ubRGThVC92OzGEyp3mbWNn+VGEgepL yByJWIxWEi76IN3cnXglA4GP2GYSmHI9raO+hStHxXPuiQz5CE+4xvbPt8zHasCuBFIX PKDCav8mH/q/1AcoY5v+wSgypc3xetOB08bzcQh3aM7fE1hkCGVCpb1C09y8Lna1P4pB VOug== X-Forwarded-Encrypted: i=1; AJvYcCX3/ChTPMV7QHIp6QbjsZVIw8dVpJMQFiCGG6Seyy2Qbu6mi365ElfLW+lpKMM8fDA2dtttbycsVbIC00Gpwbh2YyLOXg2ZZOS7PikbiWrxJeC86r0= X-Gm-Message-State: AOJu0YwEzfYFx+zAvsJwz1qI/B5+A1HWXhBIF9b7UQC3yj+jOeRb3qsi Q16jXAPkK07tv/ZBPZ6zJ9Ce4nWczXaTCT1uR54e9twHTDLZfzSguSOPIC2gzcE= 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_071451_379973_61CB5CFE X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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;