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 AE405C76196 for ; Mon, 3 Apr 2023 20:49:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6ABB185D3A; Mon, 3 Apr 2023 22:48:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject 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; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="CJBkMhw0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 03E1985D3A; Mon, 3 Apr 2023 22:48:28 +0200 (CEST) Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F95085C54 for ; Mon, 3 Apr 2023 22:48:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=kpvWS/B9Ie2lPJM+qP29qlazrlP9kGA+XhY256+vQVQ=; b=CJBkMhw0cPaqFHLdWTOpDE3yP5ay+F02fNWDUbWBzth5FxYiZp+k4fDiupcuwVNfHT4T HUddsxFyoFUBHlmHoNId9G3ErVe2PA/1zTsvFvSaeLfP1n1QrZ2IAg/szBa137Z6EoisTw +ZdAGqmXsmcsvoEP6nMXTF3Q9jrMqfWj7KGZrL8/Y8bORgTOvaD5HbC/3HPynpugrtAQ8g Vg1stJVmSP1A3oHGIk22Kd3lgC7AZZlEXoA/fNPHVPohNcxBREUtTDOZqV7vlj8OyeCSbd dn0OShbfiB246WmUQBAVtGy9asqAUXBCKhX9QjBiAqNR4bQt7efeRi4wESf35zTA== Received: by filterdrecv-5848969764-qt7ks with SMTP id filterdrecv-5848969764-qt7ks-1-642B3B95-1 2023-04-03 20:48:21.099896785 +0000 UTC m=+3020165.934933973 Received: from bionic.localdomain (unknown) by geopod-ismtpd-10 (SG) with ESMTP id -9L6fCMFQm-TtX9FkZHoOQ Mon, 03 Apr 2023 20:48:20.908 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 05/17] mmc: rockchip_sdhci: Add set_clock and config_dll sdhci_ops Date: Mon, 03 Apr 2023 20:48:21 +0000 (UTC) Message-Id: <20230403204812.2049612-6-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403204812.2049612-1-jonas@kwiboo.se> References: <20230403204812.2049612-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0hzQkZdvI+=2FHb2COZJ?= =?us-ascii?Q?ZxlQ215eoZ3PYTMiD86CFwr4g1mJww68O+t0LvX?= =?us-ascii?Q?apbCM5A5bsBk8TwruBhVgmz6ZsAVZkeyqu3wLcr?= =?us-ascii?Q?0DraAOmfUWWZ1lFqAR4x+U=2FAcs=2FRgm6IFsWfnnl?= =?us-ascii?Q?lyn9WL3go5pKvkHqXAPHJavCIX+7qgQ5E8CofA?= To: Kever Yang , Simon Glass , Philipp Tomsich , Peng Fan , Jaehoon Chung Cc: Eugen Hristev , u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 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 Add support for the set_clock and config_dll sdhci_ops. Use of these ops will allow configuration of DLL while the output clock is disabled. Signed-off-by: Jonas Karlman --- drivers/mmc/rockchip_sdhci.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 2a30974df501..bc9838ac7c45 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -139,6 +139,9 @@ struct sdhci_data { */ int (*set_ios_post)(struct sdhci_host *host); + void (*set_clock)(struct sdhci_host *host, u32 div); + int (*config_dll)(struct sdhci_host *host, u32 clock, bool enable); + /** * set_enhanced_strobe() - Set HS400 Enhanced Strobe config * @@ -430,6 +433,15 @@ static int rockchip_sdhci_set_ios_post(struct sdhci_host *host) return 0; } +static void rockchip_sdhci_set_clock(struct sdhci_host *host, u32 div) +{ + struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host); + struct sdhci_data *data = (struct sdhci_data *)dev_get_driver_data(priv->dev); + + if (data->set_clock) + data->set_clock(host, div); +} + static int rockchip_sdhci_execute_tuning(struct mmc *mmc, u8 opcode) { struct rockchip_sdhc *priv = dev_get_priv(mmc->dev); @@ -491,6 +503,17 @@ static int rockchip_sdhci_execute_tuning(struct mmc *mmc, u8 opcode) return ret; } +static int rockchip_sdhci_config_dll(struct sdhci_host *host, u32 clock, bool enable) +{ + struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host); + struct sdhci_data *data = (struct sdhci_data *)dev_get_driver_data(priv->dev); + + if (data->config_dll) + return data->config_dll(host, clock, enable); + + return 0; +} + static int rockchip_sdhci_set_enhanced_strobe(struct sdhci_host *host) { struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host); @@ -503,9 +526,11 @@ static int rockchip_sdhci_set_enhanced_strobe(struct sdhci_host *host) } static struct sdhci_ops rockchip_sdhci_ops = { - .set_ios_post = rockchip_sdhci_set_ios_post, - .platform_execute_tuning = &rockchip_sdhci_execute_tuning, .set_control_reg = rockchip_sdhci_set_control_reg, + .set_ios_post = rockchip_sdhci_set_ios_post, + .set_clock = rockchip_sdhci_set_clock, + .platform_execute_tuning = rockchip_sdhci_execute_tuning, + .config_dll = rockchip_sdhci_config_dll, .set_enhanced_strobe = rockchip_sdhci_set_enhanced_strobe, }; -- 2.40.0