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;