From patchwork Wed May 1 09:19:39 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: 13650377 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 41ADBC4345F for ; Wed, 1 May 2024 09:20: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=xPRRjqjdGCzh0VZFC4IuxUgBbQGxM/3L4R7h0Rk33FI=; b=k64VPdVf3pcvDc Hyhu95Xl/qHy3tdtrecBOxTzEnkTL3CvE66/pGS49cVbSDjJ+CO043Q4S2RD81sRgXnZdi6yBhtNr Z1Ld3bhJHxZJ+TqDmFwZpJFXw7qFmRGLkdN/9aeMpMP6jYwq4nbYTPriEoeEamk2stPHzN+huOWl8 NFQnv757blCjA62bzdnVZtwy5RdDL03b3SFTu561XP72Jf5cyxEKJuQfh7JgYatSSgjaE1Hr8mJS1 dES7K7gU29K/ydVuNYx/4xeah0/l/G3eAhg8E0aK0Se/14ioLflDCr/UHh3zIb7jYLopR8kgMvNFy 9sdAtCZCAUX6tdxoLMrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s268F-00000008wx1-2seF; Wed, 01 May 2024 09:20:07 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s267s-00000008wid-2RYQ for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 09:19:51 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56c5d05128dso5926882a12.0 for ; Wed, 01 May 2024 02:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714555179; x=1715159979; 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=J6CBz7V/gypGkWRZPuHFUjAJNpEsLzvmA3Y5G6jT7g8=; b=uAVmSgRVdi5iOD2qItDklHEbW1wFaSsluy0GEPtASMuOHqH6nv853+X9SVEPBXIX1G OP+z1jMG7PP3i6x+KOoVY93q/nW0hpCu0JOwt2WdB3/C283oVo+SJC90pQADAgcOpGK+ G9zZX8luKR3Aom4JUq9qk5dmJQoEClMhJPlajbRVMtOTINntYHyfOlJv10dPM2J1byM3 0pnR4pJsHNVSyQFSht5QKJvRQxQmUkRPq4Rj6v/fztOd0SjH0qF5HQbSoqbicPjx0aBM 5p8do3PwPT0ZfGtJQss9ezXAgCpHeh/Zg2YseQlssaf/fxX428yYj3qw6YY/rVsapNtk G2Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714555179; x=1715159979; 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=J6CBz7V/gypGkWRZPuHFUjAJNpEsLzvmA3Y5G6jT7g8=; b=VuH/Fwj+3Njt2lJ1RawawvEGFK39/Xyna4zp2p19Y8R+4a/csaqUQ7QN8SsQlon39E 0atNADprRedjuXXIpEIerMZL3YK3PWqsF87ueaXkZWC3p1pF8O18r08pm6MRXNI3Qe4N KU5bMIoxc8q1wq1qsvzzH/b/pQOpFYzn4ClIGOy3zxlhI4s+P/WqNZviJIO5qxD4HVXG 87Izl2pVlRyhYdrSbkZJHXZseOhF1pGYmDqhYaorJ74WlFV0uf/c0Ja2YWVcpnIKihe8 zooAj/4ETokZwnEj0dIXY+A9MHUW5TUUUF6lbMjUkGXhqMnqgvAnH8YfEjP/ObndU1F3 DzaA== X-Forwarded-Encrypted: i=1; AJvYcCXObRnpZJti83f1F2jGMn/PI7LJxGETJ8JzeL/ynppAgZGowfvHkgef5Jd2/hMDuKiBgAqfk2vNJMgGRy/p7Va9hZo0idlLiCcXPIuJTqmH1Y6EfZA= X-Gm-Message-State: AOJu0YwWG6fEZBhgw2bMTQpIzg1YotnOCXBrJFxsaW8xQC6eK7Pypase mqx8X5xY5eYFo1ayG7JwnOpp1U1LEdOxKRhhR29WZBDYzqF7WIOs1GnO1EYK2Nw= X-Google-Smtp-Source: AGHT+IFCRlncLt7jDHy2teEatFl+ETJXuXLGPGbi7dqaTrvE39vqxK8MXbqrb1bOCIrsv3JqEaptYw== X-Received: by 2002:a17:906:95b:b0:a58:e569:1242 with SMTP id j27-20020a170906095b00b00a58e5691242mr1306584ejd.4.1714555179313; Wed, 01 May 2024 02:19:39 -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 bw13-20020a170906c1cd00b00a58de09fd92sm5425674ejb.27.2024.05.01.02.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 02:19:38 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Wed, 01 May 2024 10:19:39 +0100 Subject: [PATCH v2 4/7] phy: exynos5-usbdrd: set ref clk freq in exynos850_usbdrd_utmi_init() MIME-Version: 1.0 Message-Id: <20240501-usb-phy-gs101-v2-4-ed9f14a1bd6d@linaro.org> References: <20240501-usb-phy-gs101-v2-0-ed9f14a1bd6d@linaro.org> In-Reply-To: <20240501-usb-phy-gs101-v2-0-ed9f14a1bd6d@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 , Arnd Bergmann , lee@kernel.org, =?utf-8?q?Andr=C3=A9_Draszi?= =?utf-8?q?k?= X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_021944_942345_76CCF39E X-CRM114-Status: GOOD ( 13.93 ) 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. 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. 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 d69187c22613..4f30ced439b9 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 @@ -155,6 +156,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 +792,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;