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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EFCBCA0FF2 for ; Sun, 31 Aug 2025 11:21:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6A09683487; Sun, 31 Aug 2025 13:21:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="nFDUDh41"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B948183906; Sun, 31 Aug 2025 13:21:10 +0200 (CEST) Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EB2DF83447 for ; Sun, 31 Aug 2025 13:21:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=SRS0=0b89=3L=kwiboo.se=jonas@fe-bounces.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1756639266; bh=YEEId1Y0S+HJRAmhF1+1IXep9XihM+KsRdcuIQc2LGc=; b=nFDUDh41+xvEU26ERgqfzSTOjQeWliheyQCDBZ7SMJUooXYdAd4S3TKo1bpI/8rDsz/AMgt95 bzL220b6B0/wNhJW0bbpunK+U1nbpxp5NtnWVMgn4I9w9rziyWQHkQt6RgTCe+VX9U/NjcDAHfd YcSgaXGq3WFUiD5i6MQZWhV7HzNToDWMPZNAaj+xm4UFeLnPYA5WgFh7Xid0VXNiA9kEaR6/4k8 lbzacb5oKDGsgr5e3R8NxertAQnEAeug+X+d1eikehnt8JXHjjetokXqVvz8RIN0WTml/lmMKK3 1p5Etmlea2hN0jwp7pwecbCZSi/Z5Jarrr46dpyk6h6g== X-Forward-Email-ID: 68b4302032f03f9a5e9085f4 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 1.2.11 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman To: Kever Yang , Simon Glass , Philipp Tomsich , Tom Rini , Jagan Teki Cc: Quentin Schulz , u-boot@lists.denx.de, Jonas Karlman , Jon Lin Subject: [PATCH v3 01/10] spi: rockchip_sfc: Support sclk_x2 version Date: Sun, 31 Aug 2025 11:20:22 +0000 Message-ID: <20250831112046.2642363-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250831112046.2642363-1-jonas@kwiboo.se> References: <20250831112046.2642363-1-jonas@kwiboo.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Jon Lin SFC after version 8 supports dtr mode, so the IO is the binary output of the controller clock. Signed-off-by: Jon Lin Signed-off-by: Jonas Karlman --- v3: No change v2: No change --- drivers/spi/rockchip_sfc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/spi/rockchip_sfc.c b/drivers/spi/rockchip_sfc.c index 73738ab26d33..60e74117057a 100644 --- a/drivers/spi/rockchip_sfc.c +++ b/drivers/spi/rockchip_sfc.c @@ -108,6 +108,7 @@ #define SFC_VER_3 0x3 #define SFC_VER_4 0x4 #define SFC_VER_5 0x5 +#define SFC_VER_8 0x8 /* Delay line controller resiter */ #define SFC_DLL_CTRL0 0x3C @@ -589,6 +590,16 @@ static int rockchip_sfc_adjust_op_size(struct spi_slave *mem, struct spi_mem_op return 0; } +#if CONFIG_IS_ENABLED(CLK) +static int rockchip_sfc_clk_set_rate(struct rockchip_sfc *sfc, uint speed) +{ + if (sfc->version >= SFC_VER_8) + return clk_set_rate(&sfc->clk, speed * 2); + else + return clk_set_rate(&sfc->clk, speed); +} +#endif + static int rockchip_sfc_set_speed(struct udevice *bus, uint speed) { struct rockchip_sfc *sfc = dev_get_plat(bus); @@ -600,7 +611,7 @@ static int rockchip_sfc_set_speed(struct udevice *bus, uint speed) return 0; #if CONFIG_IS_ENABLED(CLK) - int ret = clk_set_rate(&sfc->clk, speed); + int ret = rockchip_sfc_clk_set_rate(sfc, speed); if (ret < 0) { dev_err(sfc->dev, "set_freq=%dHz fail, check if it's the cru support level\n", -- 2.51.0