From patchwork Tue Apr 23 17:06:06 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: 13640404 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 51BA8C10F1A for ; Tue, 23 Apr 2024 17:06:50 +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=Ju6doFu9/O2UucdsOwXfHhCHDEXvJ1S53pLH1U3Pb64=; b=zfpRc/xh9HyJlj bo7ODQEdM0pwR7Je0nx0XVV1h+iCW20WjQAj+vjhaBp9rJG1+zChwroMjEwXsEkMysOf7tzSakIFP jp7SY2l77Xy1OKhWzyILN5tIMvHAIDCwToyL3mIyTst+xyjGMrhvLIJ1f3Zv3lNzReZ6wbnYh51la zT9J2WGz5wu/L1UN4SaI/dJ1uxX/zxOiy2VaARgdnud3uI7uxQL77tC7Opcvc0cXulFRL7JE524is 8sbqqkMUmGvrA31tqc3M2LI6BepCaptM0adTu7eLM4YMLQ3wzq1kY2NvVVaB8fmQwkDYVoDR4nVE3 AG9Y4ICxaFi8uTsLpipA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzJbV-00000000sNt-37N8; Tue, 23 Apr 2024 17:06:49 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzJbA-00000000sAh-0haa for linux-phy@lists.infradead.org; Tue, 23 Apr 2024 17:06:31 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a588405be6cso95077866b.2 for ; Tue, 23 Apr 2024 10:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713891987; x=1714496787; 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=7PAyFdu9H0sY3Lt54kr3wrNBIQI45vetjxyjmFr1cOo=; b=Au5JFjBM6PX+cvWfWGBf5Z0NeoxnbvQcdZiopvYEq0mkgNeRwxrvNvWWxsrewC/5hA Si4XJmwAZ3+9oCMnPkUwcm7hV0gm2zl3jj7NbWuUUH/E/owza+d4P7a8wOJPRqP8tkKq FYBOdElLkCABjj0yw6XfzdqJBeLmzeqlaHMfl89HObAcAWQgts2XzEHLzmCtvdaY+6it MO1m3GjsnNN4VI1TzSvwSkkrgG2TYMSlc3MmF+TXG/l/7f14bSgn6A3fttvoUD0i3+Hk a1O9bCTYlEOEhrWmLAhTkT+AJG7kV3L7svXQmxSJpctKpwpeVgdBvhjR1/uiXT4aEH6q Q11w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713891987; x=1714496787; 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=7PAyFdu9H0sY3Lt54kr3wrNBIQI45vetjxyjmFr1cOo=; b=OtaowXsoGb46P1f4F5rOVK1SF5V1VhuMhMSBsPJIUTisM20CbByz9YfIJp0eXaeXxC 0ZH8++nu+2v2Vn/HT3Kdf0un5fHSXN5N9Lc4W4drlURi2GM3AdJxYrHn3jJxKsZMwb1a URjquIQYi+7djApgnHx237jK9Y6710loJpVxfCb579ZETfu3gipuSvH1hhy58QuWtoSS MbKM41opBB9daL9hzfvXcevoFJ8mdHpkh6XFn/5cbBBWKrt+ARLAZybpMB4Y23lEmtbk P04N237+fzF0t09BfbnUe60XaMNEUv2dCO/ZdeMruIqnQAwgrRhASkRAkQIe6nywvcM4 hL0A== X-Forwarded-Encrypted: i=1; AJvYcCVSemOJFILmsatuAolD9jEhMFgXuBmtGc1iWg5aANCcqRkKt2HThb771R0h7xVqJmG3L4Qgyb42pfLyYTOgMNrRqvtntdX4nt8W4nDi4A== X-Gm-Message-State: AOJu0Yxn7IT1RxC2mw0Y+yiuk3CrHjsELqtLThI9fqAEQXB6Q9Ovmloa 8KHPKGV0n65OyQffacL4ZBFDp69gjlPlpr0Dw7fsAkWb9wFUZCKfr4v34YHhO/8= X-Google-Smtp-Source: AGHT+IEY3fEkZYym5AetXKUhc3n7D5n6/HgpY9y7SZRytgjmS2FxWFGvhQdXsj4H4Kyog2WyOktaKw== X-Received: by 2002:a17:906:578d:b0:a58:734d:f111 with SMTP id k13-20020a170906578d00b00a58734df111mr2664615ejq.11.1713891986669; Tue, 23 Apr 2024 10:06:26 -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 t22-20020a1709063e5600b00a5209dc79c1sm7351624eji.146.2024.04.23.10.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:06:26 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Tue, 23 Apr 2024 18:06:06 +0100 Subject: [PATCH 4/7] phy: exynos5-usbdrd: set ref clk freq in exynos850_usbdrd_utmi_init() MIME-Version: 1.0 Message-Id: <20240423-usb-phy-gs101-v1-4-ebdcb3ac174d@linaro.org> References: <20240423-usb-phy-gs101-v1-0-ebdcb3ac174d@linaro.org> In-Reply-To: <20240423-usb-phy-gs101-v1-0-ebdcb3ac174d@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Griffin , Marek Szyprowski , Sylwester Nawrocki , Alim Akhtar , Sam Protsenko Cc: Krzysztof Kozlowski , Tudor Ambarus , 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, 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-20240423_100628_275421_F1EB5554 X-CRM114-Status: UNSURE ( 9.57 ) 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 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. Do so. Fixes: 691525074db9 ("phy: exynos5-usbdrd: Add Exynos850 support") Signed-off-by: André Draszik --- Feel free to drop the Fixes: if you think that is unwarranted here. --- drivers/phy/samsung/phy-exynos5-usbdrd.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c index d69187c22613..0f9078689856 100644 --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c @@ -155,6 +155,9 @@ #define CLKRST_PORT_RST BIT(1) #define CLKRST_PHY_SW_RST BIT(3) +#define EXYNOS850_DRD_SSPPLLCTL 0x30 +#define SSPPLLCTL_FSEL GENMASK(2, 0) + #define EXYNOS850_DRD_UTMI 0x50 #define UTMI_FORCE_SLEEP BIT(0) #define UTMI_FORCE_SUSPEND BIT(1) @@ -788,6 +791,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;