From patchwork Thu Jul 25 20:45:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 814406 Delivered-To: patch@linaro.org Received: by 2002:adf:e641:0:b0:367:895a:4699 with SMTP id b1csp567565wrn; Thu, 25 Jul 2024 13:50:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVsQ/AFyddT9by7Qf7WqBChAHnhziLAe5l56fZ2yGAE1W60uq+25vFZ+Aqji63QUbT358noORSWqqTJlt+z89/q X-Google-Smtp-Source: AGHT+IG7qtK0MTc/1r+kMTf3kj3AgHv0TkgfShGBXlrNsmELernZ+8eZrHlYUUHer6kigx86FYs6 X-Received: by 2002:a05:6512:3b0e:b0:52c:8df9:2e6f with SMTP id 2adb3069b0e04-52fd3f8ec42mr3055763e87.42.1721940635946; Thu, 25 Jul 2024 13:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721940635; cv=none; d=google.com; s=arc-20160816; b=ajJGKHwsO3iA4oG+ysJoEmjIhYlM2anMAzl6mhuabQZCiBdwDITr1YLDHCrI7fR08D LHryxyd94esNQ37iuxeXmhO+uF8qlIBZxhlIyiCbiO0shjDDMHjSMe8jt6Gz37m+de2d hZHdJuaRxaLBZaQIazNLjfcOC1I6BjuYLLTCXj7lzH7E3+PGR6P931dtIkfdL16xUkBm mFUphvNb1jHcsc96WOXPZHNah8dOPECsCec/RSIRxGV1TOF3vxXlHkV7E/7/nMg94GEw Qg8/2JhS9KNQdxtYRYOJNA70FbvUoBqSuG4jX1Za1sbciOO72mNeu681NBc4aHk23qaU i2Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s2Pqoyr35+7fx/+L9NHlNn9vjAMBq6pejH5ouGBVKPI=; fh=kIP0lsadriTHrMtXsSbuPh+PiAovIqHnrGC9g+/ykCY=; b=IvHenfxgnmFFLTpGMh/3P/6yI2qO+zn04o+7ajZwcnaCK1fCYBkzOTbSZSK40PrYBA BgYh6Zq2dUu1n54ElKJW3TUzFKXwdnHO3+jCd8KKec1uSC7csTOso0as7Gsm5IUdO7hy szc0QR74plQ3hoM7JKpjtE3KlatWbKpLrda1BmoH3hhPUZ6tCYn8q6jv/bJupJP1gE8B oplD57V+Fjbfrr0/wfWh/lQBbZAFd1rilN6NAuZ0a1jpIb/7HUFuHax09g7c57o4qsOw eSxYPGEhQB9w0UnX+Xaqr5yBJ3azyA8eFumfcbKetO3TI5LHooiyab3GLCljJq/CKnhu /TAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFnagMNs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 2adb3069b0e04-52fd5bfbd45si680604e87.398.2024.07.25.13.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 13:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFnagMNs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B65578875D; Thu, 25 Jul 2024 22:45:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="fFnagMNs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20A5E88730; Thu, 25 Jul 2024 22:45:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 F16F88863E for ; Thu, 25 Jul 2024 22:45:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-708adad61f8so197679a34.1 for ; Thu, 25 Jul 2024 13:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721940343; x=1722545143; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s2Pqoyr35+7fx/+L9NHlNn9vjAMBq6pejH5ouGBVKPI=; b=fFnagMNsYO+3prDgSATE8fYe1kxmqZEZdVemd/27cBHUTqY+qOEKaZI/BdTDyX00zc vJ0DdHBKzgiLhpYkVT/Aeh8fToKZoOeR78f0DoJ3eQx6Ui672ILfcx3QPuFtSmgeJUnK EwUFiHXh1t1ixyAR+zAQiC6K9aPC2rAiB6J0u82AUCDpLK+nBjEoPuYjFlttJy64cFhw 3LOad0ZNiAW8+SAPF+iqajgPJ1W0rbQq5aYLu2tFJb+5zNsKYjqzkYFzWAxeW2vqNfvU WWca2WwdmlP4kFXLOND3Yyj/66S9eTLow9xzpreyGndG1k+6DgIdeiIH2Kr5Wan+C1Be FLoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721940343; x=1722545143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s2Pqoyr35+7fx/+L9NHlNn9vjAMBq6pejH5ouGBVKPI=; b=FQ12BL1wvOb5qJMF8hDLXXtOvft0sFeLYi6p4He1Du7hztw+XFBg5im05ch826l1k7 RiGEMcBDNqPMuQk/mDSvc2VNTwQHajp7h4eJTYqvm4UpgRe8lOtD6oWHF959Jzj1Ppg1 c4VTi985MyMTPhzRjvV3gfl5VURAt6Oj+USWLkZWR8AcpqtNxbyfEL+TTyuDZ/kS8sHv HJjkZm3Vfm/lkLTDOkur+CSCwXCuuSaS3bsN5Qz7Lup46MmNX2iMiMfck4snoJjcmQTd /Zjm8Ae0h4TWQ0NMGeWAIlj3qKVb1a3zTX5nXs0uLd8R9mnFYAuG2LlxeMst3PcYAo7N z0kA== X-Forwarded-Encrypted: i=1; AJvYcCXRB+2sbujBVu0Bt6/RwDx0swZue+Xy7udsDoJQCLrmI0/TW4coEytenuralrSFxeAcVwMY7wlE/n/H19adZ7iVeW75fg== X-Gm-Message-State: AOJu0YwUO7hSY/H/94/5uMg4ITWx/gTgiLnbPlsAlbEda5QIav1S9KjB vwStoll2COhKju7mSvAR+7SXq9Ym7WXPAsJefraqrGI8KTv7KT0O5wFPx/4KR/c= X-Received: by 2002:a05:6830:388a:b0:709:30eb:dfcb with SMTP id 46e09a7af769-7093223599emr4099788a34.18.1721940342772; Thu, 25 Jul 2024 13:45:42 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d5b349a4desm249334eaf.11.2024.07.25.13.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 13:45:42 -0700 (PDT) From: Sam Protsenko To: Jaehoon Chung Cc: Minkyu Kang , Minkyu Kang , Tom Rini , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v4 29/38] mmc: exynos_dw_mmc: Read and use DDR timing when available Date: Thu, 25 Jul 2024 15:45:11 -0500 Message-Id: <20240725204520.18134-30-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240725204520.18134-1-semen.protsenko@linaro.org> References: <20240725204520.18134-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 DDR timing values should be defined in "samsung,dw-mshc-ddr-timing" dts property, and used when DDR MMC mode is selected. Read that value from dts and use it. If it's not available, use SDR timing values instead. This change is following upstream Linux kernel implementation. Signed-off-by: Sam Protsenko --- Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index b9d655c0d5c8..32f3ea168b6c 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -52,6 +52,7 @@ struct dwmci_exynos_priv_data { #endif struct clk clk; u32 sdr_timing; + u32 ddr_timing; const struct exynos_dwmmc_variant *chip; }; @@ -127,8 +128,14 @@ static int exynos_dwmmc_set_sclk(struct dwmci_host *host, unsigned long rate) static int exynos_dwmci_clksel(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); + u32 timing; - dwmci_writel(host, priv->chip->clksel, priv->sdr_timing); + if (host->mmc->selected_mode == MMC_DDR_52) + timing = priv->ddr_timing; + else + timing = priv->sdr_timing; + + dwmci_writel(host, priv->chip->clksel, timing); return 0; } @@ -305,6 +312,17 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) priv->sdr_timing = DWMMC_MMC2_SDR_TIMING_VAL; } + err = dev_read_u32_array(dev, "samsung,dw-mshc-ddr-timing", timing, 2); + if (err) { + debug("DWMMC%d: Can't get ddr-timings, using sdr-timings\n", + host->dev_index); + priv->ddr_timing = priv->sdr_timing; + } else { + priv->ddr_timing = DWMCI_SET_SAMPLE_CLK(timing[0]) | + DWMCI_SET_DRV_CLK(timing[1]) | + DWMCI_SET_DIV_RATIO(div); + } + host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); host->bus_hz = dev_read_u32_default(dev, "clock-frequency", 0);