5b6c490134
Uses upstream u-boot with (only) 4 downstream patches. The device also boots way quicker now, no need to hold the power button for multiple seconds anymore [ci:skip-build] Already built well once on CI in MR
959 lines
40 KiB
Diff
959 lines
40 KiB
Diff
From patchwork Sun Jan 16 20:18:10 2022
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
X-Patchwork-Submitter: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
X-Patchwork-Id: 1580518
|
|
X-Patchwork-Delegate: ykai007@gmail.com
|
|
Return-Path: <u-boot-bounces@lists.denx.de>
|
|
X-Original-To: incoming@patchwork.ozlabs.org
|
|
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
|
|
Authentication-Results: bilbo.ozlabs.org;
|
|
dkim=pass (2048-bit key;
|
|
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
|
|
header.s=20210112 header.b=pxD8XcKe;
|
|
dkim-atps=neutral
|
|
Authentication-Results: ozlabs.org;
|
|
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
|
|
(client-ip=85.214.62.61; helo=phobos.denx.de;
|
|
envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
|
|
Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
|
|
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
|
key-exchange X25519 server-signature RSA-PSS (4096 bits))
|
|
(No client certificate requested)
|
|
by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JcRFN3hZCz9t0k
|
|
for <incoming@patchwork.ozlabs.org>; Mon, 17 Jan 2022 07:18:48 +1100 (AEDT)
|
|
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
|
|
by phobos.denx.de (Postfix) with ESMTP id D991283565;
|
|
Sun, 16 Jan 2022 21:18:39 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
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=gmail.com header.i=@gmail.com header.b="pxD8XcKe";
|
|
dkim-atps=neutral
|
|
Received: by phobos.denx.de (Postfix, from userid 109)
|
|
id CB61A81982; Sun, 16 Jan 2022 21:18:35 +0100 (CET)
|
|
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,FREEMAIL_FROM,SPF_HELO_NONE,
|
|
SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
|
|
Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com
|
|
[IPv6:2a00:1450:4864:20::533])
|
|
(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 8194981982
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 21:18:32 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=alpernebiyasak@gmail.com
|
|
Received: by mail-ed1-x533.google.com with SMTP id k15so56808471edk.13
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 12:18:32 -0800 (PST)
|
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
|
|
h=from:to:cc:subject:date:message-id:in-reply-to:references
|
|
:mime-version:content-transfer-encoding;
|
|
bh=2C0Kn8ndmd1VI8hsfzZOWxonEJzD8EOw5DdhJ4lo2Cw=;
|
|
b=pxD8XcKexp3/3nZwWQc5Fzf8tr56kzXcBfjFBGpyPyY5uOW7lgPMG35P/hAmmRqjCt
|
|
Wtkc7/Iwv4kYPcSNyLGu1XSCz61QT5ebe5fvZSVoi89r0MxT//3PmMKSegvvCcgR3LHQ
|
|
Eq7BJanYguLYi+TH9A6f/9mNy1880LS0y+HZqtPP57t/IN5HTqLigVCpgY+Tip5Fbp2L
|
|
XCiQBcfUhgZgWvNK3TpbSl5c4BF2Zae8CwnjJ2KQnXgYre9P8VvDpqlZ/UvMNumtcgzE
|
|
vq855OrixSKXI3i8JvYTq2iYxfjbjvQ+wyYZJJRwMWvl2G684TOipwO/PiUIPzW7HVkR
|
|
lJ3Q==
|
|
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
d=1e100.net; s=20210112;
|
|
h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
|
|
:references:mime-version:content-transfer-encoding;
|
|
bh=2C0Kn8ndmd1VI8hsfzZOWxonEJzD8EOw5DdhJ4lo2Cw=;
|
|
b=bkPYLiQAsc0W1z75zWZXWUMi6jkBfbRbj38s6luxcKEaCYdcW7uHy7LBDhgGbJkkcw
|
|
rRj95NVmrOlWy3I3LMN9HfFmiJRFAnRe0uWJQDDD/sDbbqTmXmpDZiR53sTdgOa5k/j5
|
|
tykGRmAGRkuBBGVbSIN2Nx6lJNwqt7uQqQyC/2ZbV948EIQF79a3wY2h9Ew7oLkE1fcY
|
|
/5gB5GyZwH8AY9AuZl3oDIbI/zF7TFLE1rtkdyu5ut+r7Ns0t6LtMhtVUE5lJjCM2a7x
|
|
t/2c8DZ0Uicru+023yCnJyZIPRZ/w3G7e9K63mPJicdC3Ll2rPOVs0RZRIkA2UWiZ/hU
|
|
9jTQ==
|
|
X-Gm-Message-State: AOAM530luCJvhPko2ejkD4MYe5YCCei3IQEUB0wAY4sz1ivzDFjKKlxy
|
|
v5M3nRdE4CFho2gC9F+l94uXfIZDnkQ=
|
|
X-Google-Smtp-Source:
|
|
ABdhPJx7y2/xLhbXxtzNtA2IFc/vo0kYP+2vbcwmSXb9Px8ofd4eyrBeCLlf/8uTj/A90mdA9GAqFA==
|
|
X-Received: by 2002:a17:907:9618:: with SMTP id
|
|
gb24mr14601890ejc.385.1642364312173;
|
|
Sun, 16 Jan 2022 12:18:32 -0800 (PST)
|
|
Received: from localhost.localdomain ([178.233.26.119])
|
|
by smtp.gmail.com with ESMTPSA id b10sm4872469edu.42.2022.01.16.12.18.29
|
|
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
|
|
Sun, 16 Jan 2022 12:18:31 -0800 (PST)
|
|
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
To: u-boot@lists.denx.de
|
|
Cc: Aswath Govindraju <a-govindraju@ti.com>,
|
|
Kever Yang <kever.yang@rock-chips.com>,
|
|
Philipp Tomsich <philipp.tomsich@vrull.eu>,
|
|
Samuel Dionne-Riel <samuel@dionne-riel.com>,
|
|
Stephen Carlson <stcarlso@linux.microsoft.com>,
|
|
Peter Robinson <pbrobinson@gmail.com>, Faiz Abbas <faiz_abbas@ti.com>,
|
|
Jack Mitchell <ml@embed.me.uk>, Simon Glass <sjg@chromium.org>,
|
|
Jaehoon Chung <jh80.chung@samsung.com>,
|
|
Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
|
|
Michal Simek <michal.simek@xilinx.com>, Peng Fan <peng.fan@nxp.com>,
|
|
Yifeng Zhao <yifeng.zhao@rock-chips.com>,
|
|
Jagan Teki <jagan@amarulasolutions.com>,
|
|
Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
Subject: [PATCH v3 1/4] mmc: sdhci: Add HS400 Enhanced Strobe support
|
|
Date: Sun, 16 Jan 2022 23:18:10 +0300
|
|
Message-Id: <20220116201814.11672-2-alpernebiyasak@gmail.com>
|
|
X-Mailer: git-send-email 2.34.1
|
|
In-Reply-To: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
References: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
MIME-Version: 1.0
|
|
X-BeenThere: u-boot@lists.denx.de
|
|
X-Mailman-Version: 2.1.39
|
|
Precedence: list
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
|
|
List-Archive: <https://lists.denx.de/pipermail/u-boot/>
|
|
List-Post: <mailto:u-boot@lists.denx.de>
|
|
List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
|
|
List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=subscribe>
|
|
Errors-To: u-boot-bounces@lists.denx.de
|
|
Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
|
|
X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de
|
|
X-Virus-Status: Clean
|
|
|
|
Delegate setting the Enhanced Strobe configuration to individual drivers
|
|
if they set a function for it. Return -ENOTSUPP if they do not, like
|
|
what the MMC uclass does.
|
|
|
|
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
|
|
---
|
|
|
|
(no changes since v2)
|
|
|
|
Changes in v2:
|
|
- Add tag: "Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>"
|
|
|
|
drivers/mmc/sdhci.c | 18 ++++++++++++++++++
|
|
include/sdhci.h | 1 +
|
|
2 files changed, 19 insertions(+)
|
|
|
|
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
|
|
index 766e4a6b0c5e..bf989a594f7e 100644
|
|
--- a/drivers/mmc/sdhci.c
|
|
+++ b/drivers/mmc/sdhci.c
|
|
@@ -513,6 +513,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host)
|
|
reg |= SDHCI_CTRL_UHS_SDR104;
|
|
break;
|
|
case MMC_HS_400:
|
|
+ case MMC_HS_400_ES:
|
|
reg |= SDHCI_CTRL_HS400;
|
|
break;
|
|
default:
|
|
@@ -666,6 +667,7 @@ static int sdhci_set_ios(struct mmc *mmc)
|
|
mmc->selected_mode == MMC_DDR_52 ||
|
|
mmc->selected_mode == MMC_HS_200 ||
|
|
mmc->selected_mode == MMC_HS_400 ||
|
|
+ mmc->selected_mode == MMC_HS_400_ES ||
|
|
mmc->selected_mode == UHS_SDR25 ||
|
|
mmc->selected_mode == UHS_SDR50 ||
|
|
mmc->selected_mode == UHS_SDR104 ||
|
|
@@ -799,6 +801,19 @@ static int sdhci_wait_dat0(struct udevice *dev, int state,
|
|
return -ETIMEDOUT;
|
|
}
|
|
|
|
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
|
|
+static int sdhci_set_enhanced_strobe(struct udevice *dev)
|
|
+{
|
|
+ struct mmc *mmc = mmc_get_mmc_dev(dev);
|
|
+ struct sdhci_host *host = mmc->priv;
|
|
+
|
|
+ if (host->ops && host->ops->set_enhanced_strobe)
|
|
+ return host->ops->set_enhanced_strobe(host);
|
|
+
|
|
+ return -ENOTSUPP;
|
|
+}
|
|
+#endif
|
|
+
|
|
const struct dm_mmc_ops sdhci_ops = {
|
|
.send_cmd = sdhci_send_command,
|
|
.set_ios = sdhci_set_ios,
|
|
@@ -808,6 +823,9 @@ const struct dm_mmc_ops sdhci_ops = {
|
|
.execute_tuning = sdhci_execute_tuning,
|
|
#endif
|
|
.wait_dat0 = sdhci_wait_dat0,
|
|
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
|
|
+ .set_enhanced_strobe = sdhci_set_enhanced_strobe,
|
|
+#endif
|
|
};
|
|
#else
|
|
static const struct mmc_ops sdhci_ops = {
|
|
diff --git a/include/sdhci.h b/include/sdhci.h
|
|
index c718dd7206c1..7a65fdf95d30 100644
|
|
--- a/include/sdhci.h
|
|
+++ b/include/sdhci.h
|
|
@@ -272,6 +272,7 @@ struct sdhci_ops {
|
|
int (*platform_execute_tuning)(struct mmc *host, u8 opcode);
|
|
int (*set_delay)(struct sdhci_host *host);
|
|
int (*deferred_probe)(struct sdhci_host *host);
|
|
+ int (*set_enhanced_strobe)(struct sdhci_host *host);
|
|
};
|
|
|
|
#define ADMA_MAX_LEN 65532
|
|
|
|
From patchwork Sun Jan 16 20:18:11 2022
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
X-Patchwork-Submitter: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
X-Patchwork-Id: 1580519
|
|
X-Patchwork-Delegate: ykai007@gmail.com
|
|
Return-Path: <u-boot-bounces@lists.denx.de>
|
|
X-Original-To: incoming@patchwork.ozlabs.org
|
|
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
|
|
Authentication-Results: bilbo.ozlabs.org;
|
|
dkim=pass (2048-bit key;
|
|
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
|
|
header.s=20210112 header.b=paWh4v1l;
|
|
dkim-atps=neutral
|
|
Authentication-Results: ozlabs.org;
|
|
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
|
|
(client-ip=85.214.62.61; helo=phobos.denx.de;
|
|
envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
|
|
Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
|
|
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
|
key-exchange X25519 server-signature RSA-PSS (4096 bits))
|
|
(No client certificate requested)
|
|
by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JcRFY230wz9ssD
|
|
for <incoming@patchwork.ozlabs.org>; Mon, 17 Jan 2022 07:18:57 +1100 (AEDT)
|
|
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
|
|
by phobos.denx.de (Postfix) with ESMTP id DD7B7835B3;
|
|
Sun, 16 Jan 2022 21:18:44 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
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=gmail.com header.i=@gmail.com header.b="paWh4v1l";
|
|
dkim-atps=neutral
|
|
Received: by phobos.denx.de (Postfix, from userid 109)
|
|
id B3BFB835B3; Sun, 16 Jan 2022 21:18:42 +0100 (CET)
|
|
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,FREEMAIL_FROM,SPF_HELO_NONE,
|
|
SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
|
|
Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com
|
|
[IPv6:2a00:1450:4864:20::52b])
|
|
(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 AB60181982
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 21:18:36 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=alpernebiyasak@gmail.com
|
|
Received: by mail-ed1-x52b.google.com with SMTP id z22so56932906edd.12
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 12:18:36 -0800 (PST)
|
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
|
|
h=from:to:cc:subject:date:message-id:in-reply-to:references
|
|
:mime-version:content-transfer-encoding;
|
|
bh=mFGD25E8/gXBhvYZrHJfWdRECSjkYQKAUcNX0UhwSxI=;
|
|
b=paWh4v1l6vK+NFDU+zjKX5QzmoIRCf1p8pIHZ9DxphdZmYVF0t+W0VhKHdSEu2fcTa
|
|
VfbDkUo+dayBL5Mmem6sWlB+GYSN/ZM+t8EpYYBe731sueNrDPkG8/QTwv7eWQyrtJz+
|
|
Ib/u5b2iJMSzknDS92Soo/LXlpL4ZnkNuvfuWbKhnZ8fiG03Qez3k/NNrCszxN723b7F
|
|
EEoo3rfw0kz5bWBkalSNNN+9e4eKcfgLxBqRkauXZK274K0geaTpj4NMgDCl4tmVACCD
|
|
iEWhkHmU1Cv+pkp5dpq5T6mBDIcx1TqTtYC0oroxiSkR+kRmLxZdCGdZ0Pw+a56/5sMV
|
|
PEKA==
|
|
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
d=1e100.net; s=20210112;
|
|
h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
|
|
:references:mime-version:content-transfer-encoding;
|
|
bh=mFGD25E8/gXBhvYZrHJfWdRECSjkYQKAUcNX0UhwSxI=;
|
|
b=NnwXsGusknZpOTk1WIs4OsN43EP2NyrGZ4So7kksQSUHMdcPRfEJ6YLFvVsbC05kDq
|
|
FqSirWS1MqtQiJBk97lSeBlxPgX0GkcWiG9PB9pjbgqXDVwSWCXnAzZa3Ks1eio5iO/S
|
|
wfBE0cBwR+zmmzy+SCIpxeWfObdQlaTeK3NVjNuZEZah/TdXwWkrMpCWTFy+tmwRK+cz
|
|
AjSqoHCICdL037739WTczcWLRY6FDVsiDqeWbHLtiz5reCZeUMubyNiA27Kou6DE6nf5
|
|
NhCfiKGpGoZ1r7sTU+muwzM/SBWj4Ut71dRx3CKw7f33QaEXW8eFkalkDHVzqd4oJ8c6
|
|
OpFg==
|
|
X-Gm-Message-State: AOAM530Ka9yN9AcNAYgPytKXI2GTyu3WkPgJJaY53WHdBINIBpimQ0cx
|
|
IpaomDT0bVH67PyBzE8qi7uIEIWHbaQ=
|
|
X-Google-Smtp-Source:
|
|
ABdhPJwrDIf7qEUFniBPQ35skp2YV6XYXTJAj98fJ3+VyQCMjeSu4pZ38v1eRXmIJU+m/Bp7lEuE1Q==
|
|
X-Received: by 2002:a17:907:971d:: with SMTP id
|
|
jg29mr14266557ejc.573.1642364316281;
|
|
Sun, 16 Jan 2022 12:18:36 -0800 (PST)
|
|
Received: from localhost.localdomain ([178.233.26.119])
|
|
by smtp.gmail.com with ESMTPSA id b10sm4872469edu.42.2022.01.16.12.18.33
|
|
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
|
|
Sun, 16 Jan 2022 12:18:35 -0800 (PST)
|
|
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
To: u-boot@lists.denx.de
|
|
Cc: Aswath Govindraju <a-govindraju@ti.com>,
|
|
Kever Yang <kever.yang@rock-chips.com>,
|
|
Philipp Tomsich <philipp.tomsich@vrull.eu>,
|
|
Samuel Dionne-Riel <samuel@dionne-riel.com>,
|
|
Stephen Carlson <stcarlso@linux.microsoft.com>,
|
|
Peter Robinson <pbrobinson@gmail.com>, Faiz Abbas <faiz_abbas@ti.com>,
|
|
Jack Mitchell <ml@embed.me.uk>, Simon Glass <sjg@chromium.org>,
|
|
Jaehoon Chung <jh80.chung@samsung.com>,
|
|
Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
|
|
Michal Simek <michal.simek@xilinx.com>, Peng Fan <peng.fan@nxp.com>,
|
|
Yifeng Zhao <yifeng.zhao@rock-chips.com>,
|
|
Jagan Teki <jagan@amarulasolutions.com>,
|
|
Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
Subject: [PATCH v3 2/4] rockchip: sdhci: Fix RK3399 eMMC PHY power cycling
|
|
Date: Sun, 16 Jan 2022 23:18:11 +0300
|
|
Message-Id: <20220116201814.11672-3-alpernebiyasak@gmail.com>
|
|
X-Mailer: git-send-email 2.34.1
|
|
In-Reply-To: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
References: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
MIME-Version: 1.0
|
|
X-BeenThere: u-boot@lists.denx.de
|
|
X-Mailman-Version: 2.1.39
|
|
Precedence: list
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
|
|
List-Archive: <https://lists.denx.de/pipermail/u-boot/>
|
|
List-Post: <mailto:u-boot@lists.denx.de>
|
|
List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
|
|
List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=subscribe>
|
|
Errors-To: u-boot-bounces@lists.denx.de
|
|
Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
|
|
X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de
|
|
X-Virus-Status: Clean
|
|
|
|
The Rockchip RK3399 eMMC PHY has to be power-cycled while changing its
|
|
clock speed to some higher speeds. This is dependent on the desired
|
|
SDHCI clock speed, and it looks like the PHY should be powered off while
|
|
setting the SDHCI clock in these cases.
|
|
|
|
Commit ac804143cfd1 ("mmc: rockchip_sdhci: add phy and clock config for
|
|
rk3399") attempts to do this in the set_ios_post() hook by setting the
|
|
SDHCI clock once more while the PHY is turned off/on as necessary, as
|
|
the SDHCI framework does not provide a way to override how it sets its
|
|
clock. However, the commit breaks reinitializing the eMMC on a few
|
|
boards including chromebook_kevin and reportedly ROCKPro64.
|
|
|
|
This patch reworks the power cycling to utilize the SDHCI framework
|
|
slightly better (using the set_control_reg() hook to power off the PHY
|
|
and set_ios_post() hook to power it back on) which happens to fix the
|
|
issue, at least on a chromebook_kevin.
|
|
|
|
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
---
|
|
RK3568 parts only build-tested as I don't have a RK3568 board.
|
|
|
|
(no changes since v2)
|
|
|
|
Changes in v2:
|
|
- Add this patch
|
|
|
|
drivers/mmc/rockchip_sdhci.c | 53 +++++++++++++++++++++++++++++-------
|
|
1 file changed, 43 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
|
|
index 278473899c7c..f0d7ba4774d6 100644
|
|
--- a/drivers/mmc/rockchip_sdhci.c
|
|
+++ b/drivers/mmc/rockchip_sdhci.c
|
|
@@ -90,9 +90,10 @@ struct rockchip_sdhc {
|
|
};
|
|
|
|
struct sdhci_data {
|
|
- int (*emmc_set_clock)(struct sdhci_host *host, unsigned int clock);
|
|
int (*emmc_phy_init)(struct udevice *dev);
|
|
int (*get_phy)(struct udevice *dev);
|
|
+ void (*set_control_reg)(struct sdhci_host *host);
|
|
+ int (*set_ios_post)(struct sdhci_host *host);
|
|
};
|
|
|
|
static int rk3399_emmc_phy_init(struct udevice *dev)
|
|
@@ -182,15 +183,28 @@ static int rk3399_emmc_get_phy(struct udevice *dev)
|
|
return 0;
|
|
}
|
|
|
|
-static int rk3399_sdhci_emmc_set_clock(struct sdhci_host *host, unsigned int clock)
|
|
+static void rk3399_sdhci_set_control_reg(struct sdhci_host *host)
|
|
{
|
|
struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
|
+ struct mmc *mmc = host->mmc;
|
|
+ uint clock = mmc->tran_speed;
|
|
int cycle_phy = host->clock != clock && clock > EMMC_MIN_FREQ;
|
|
|
|
if (cycle_phy)
|
|
rk3399_emmc_phy_power_off(priv->phy);
|
|
|
|
- sdhci_set_clock(host->mmc, clock);
|
|
+ sdhci_set_control_reg(host);
|
|
+};
|
|
+
|
|
+static int rk3399_sdhci_set_ios_post(struct sdhci_host *host)
|
|
+{
|
|
+ struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
|
+ struct mmc *mmc = host->mmc;
|
|
+ uint clock = mmc->tran_speed;
|
|
+ int cycle_phy = host->clock != clock && clock > EMMC_MIN_FREQ;
|
|
+
|
|
+ if (!clock)
|
|
+ clock = mmc->clock;
|
|
|
|
if (cycle_phy)
|
|
rk3399_emmc_phy_power_on(priv->phy, clock);
|
|
@@ -269,10 +283,8 @@ static int rk3568_emmc_get_phy(struct udevice *dev)
|
|
return 0;
|
|
}
|
|
|
|
-static int rockchip_sdhci_set_ios_post(struct sdhci_host *host)
|
|
+static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
|
|
{
|
|
- struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
|
- struct sdhci_data *data = (struct sdhci_data *)dev_get_driver_data(priv->dev);
|
|
struct mmc *mmc = host->mmc;
|
|
uint clock = mmc->tran_speed;
|
|
u32 reg;
|
|
@@ -280,8 +292,7 @@ static int rockchip_sdhci_set_ios_post(struct sdhci_host *host)
|
|
if (!clock)
|
|
clock = mmc->clock;
|
|
|
|
- if (data->emmc_set_clock)
|
|
- data->emmc_set_clock(host, clock);
|
|
+ rk3568_sdhci_emmc_set_clock(host, clock);
|
|
|
|
if (mmc->selected_mode == MMC_HS_400 || mmc->selected_mode == MMC_HS_400_ES) {
|
|
reg = sdhci_readw(host, SDHCI_HOST_CONTROL2);
|
|
@@ -295,6 +306,26 @@ static int rockchip_sdhci_set_ios_post(struct sdhci_host *host)
|
|
return 0;
|
|
}
|
|
|
|
+static void rockchip_sdhci_set_control_reg(struct sdhci_host *host)
|
|
+{
|
|
+ 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_control_reg)
|
|
+ data->set_control_reg(host);
|
|
+}
|
|
+
|
|
+static int rockchip_sdhci_set_ios_post(struct sdhci_host *host)
|
|
+{
|
|
+ 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_ios_post)
|
|
+ return data->set_ios_post(host);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int rockchip_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
|
|
{
|
|
struct sdhci_host *host = dev_get_priv(mmc->dev);
|
|
@@ -358,6 +389,7 @@ static int rockchip_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
|
|
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,
|
|
};
|
|
|
|
static int rockchip_sdhci_probe(struct udevice *dev)
|
|
@@ -436,15 +468,16 @@ static int rockchip_sdhci_bind(struct udevice *dev)
|
|
}
|
|
|
|
static const struct sdhci_data rk3399_data = {
|
|
- .emmc_set_clock = rk3399_sdhci_emmc_set_clock,
|
|
.get_phy = rk3399_emmc_get_phy,
|
|
.emmc_phy_init = rk3399_emmc_phy_init,
|
|
+ .set_control_reg = rk3399_sdhci_set_control_reg,
|
|
+ .set_ios_post = rk3399_sdhci_set_ios_post,
|
|
};
|
|
|
|
static const struct sdhci_data rk3568_data = {
|
|
- .emmc_set_clock = rk3568_sdhci_emmc_set_clock,
|
|
.get_phy = rk3568_emmc_get_phy,
|
|
.emmc_phy_init = rk3568_emmc_phy_init,
|
|
+ .set_ios_post = rk3568_sdhci_set_ios_post,
|
|
};
|
|
|
|
static const struct udevice_id sdhci_ids[] = {
|
|
|
|
From patchwork Sun Jan 16 20:18:12 2022
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
X-Patchwork-Submitter: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
X-Patchwork-Id: 1580520
|
|
X-Patchwork-Delegate: ykai007@gmail.com
|
|
Return-Path: <u-boot-bounces@lists.denx.de>
|
|
X-Original-To: incoming@patchwork.ozlabs.org
|
|
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
|
|
Authentication-Results: bilbo.ozlabs.org;
|
|
dkim=pass (2048-bit key;
|
|
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
|
|
header.s=20210112 header.b=MPxROv5X;
|
|
dkim-atps=neutral
|
|
Authentication-Results: ozlabs.org;
|
|
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
|
|
(client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;
|
|
envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
|
|
Received: from phobos.denx.de (phobos.denx.de
|
|
[IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])
|
|
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
|
key-exchange X25519 server-signature RSA-PSS (4096 bits))
|
|
(No client certificate requested)
|
|
by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JcRFk72GZz9ssD
|
|
for <incoming@patchwork.ozlabs.org>; Mon, 17 Jan 2022 07:19:06 +1100 (AEDT)
|
|
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
|
|
by phobos.denx.de (Postfix) with ESMTP id E1DDF835A8;
|
|
Sun, 16 Jan 2022 21:18:50 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
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=gmail.com header.i=@gmail.com header.b="MPxROv5X";
|
|
dkim-atps=neutral
|
|
Received: by phobos.denx.de (Postfix, from userid 109)
|
|
id 0CEF481982; Sun, 16 Jan 2022 21:18:46 +0100 (CET)
|
|
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,FREEMAIL_FROM,SPF_HELO_NONE,
|
|
SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
|
|
Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com
|
|
[IPv6:2a00:1450:4864:20::533])
|
|
(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 846EA83595
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 21:18:40 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=alpernebiyasak@gmail.com
|
|
Received: by mail-ed1-x533.google.com with SMTP id j7so8491628edr.4
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 12:18:40 -0800 (PST)
|
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
|
|
h=from:to:cc:subject:date:message-id:in-reply-to:references
|
|
:mime-version:content-transfer-encoding;
|
|
bh=IlZzw+E0OT+BGbdF8CWorWOdtXvmJ819GqtIryKc/F4=;
|
|
b=MPxROv5X+yinvW9N5ljg0IXmhleqwy/8CWIJXP95X9wrlPX1TOvzKY5nWe70xm7Y+I
|
|
7nMQIefe6zHQvgV4xCTc1qDCA8wG3b5PxLhSvppXPzdgWXp/uNy3NDX5LmqVghv0tAR1
|
|
Sng/tUsjgEmOBDaQc0i5N7Qyk/uhfRyLzWNAAeyyLwAJQ7rxmc2ztmgrYbSf1z5AGaGT
|
|
JCiZ3Xl4P4pI2HAoHtxc9etfS5H//ixzlT/0A0j6ex2MKWW575z+xff3RtQZP6cW4DA2
|
|
p65IvNbWE6v4dpn8/ZDW/UlHnUUh7kkuQzjH24nnfyXAQ849mlddRHYiHJL1QXthmVHP
|
|
uZ5g==
|
|
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
d=1e100.net; s=20210112;
|
|
h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
|
|
:references:mime-version:content-transfer-encoding;
|
|
bh=IlZzw+E0OT+BGbdF8CWorWOdtXvmJ819GqtIryKc/F4=;
|
|
b=R/36NikWM0d8xGDVMAdPf5LXJJigL6ufDi7OS34JHcGembcNMWd3igBzxbsggi4PwJ
|
|
WfL3wxnf3c9hDyTfCWSNfEKgF9javl5lmZAbT/CkqLgiVoqcZExqwhTl1MFZe1veT6/a
|
|
2ANmVjah9ojC9u0TY7TNt+uc9JyRNYIS0LUFAWiKGrxzuszAck4oteAIjjwPrnTx7cGH
|
|
blVEwilAEsj+afO3Naw78ROjDyms8xz7hG3Z/wkIinXKX5pAKUrsCi7oDZrXd/y1dm0J
|
|
r6A7uXJoY3dILJHSGmkh5Uggqyi7G3WYdkGvpsIRpon55qPpvscW13/poBVqRZOgG+G2
|
|
TRLg==
|
|
X-Gm-Message-State: AOAM531I+EYaHH0CZPRXg/T+jNkigxhUfzY3AkzYTHLEULt9gEVJ5M69
|
|
bu+4hXihyC2we1zKoC+wDwYK55T/RPQ=
|
|
X-Google-Smtp-Source:
|
|
ABdhPJyfUQzWaIKgS+YtvbvhgLDcG7oSCXEmGi3e99kyVmcTro/q3VIBnj/2yTABvTwavS98TPURSQ==
|
|
X-Received: by 2002:a05:6402:2548:: with SMTP id
|
|
l8mr18043640edb.119.1642364320222;
|
|
Sun, 16 Jan 2022 12:18:40 -0800 (PST)
|
|
Received: from localhost.localdomain ([178.233.26.119])
|
|
by smtp.gmail.com with ESMTPSA id b10sm4872469edu.42.2022.01.16.12.18.37
|
|
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
|
|
Sun, 16 Jan 2022 12:18:39 -0800 (PST)
|
|
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
To: u-boot@lists.denx.de
|
|
Cc: Aswath Govindraju <a-govindraju@ti.com>,
|
|
Kever Yang <kever.yang@rock-chips.com>,
|
|
Philipp Tomsich <philipp.tomsich@vrull.eu>,
|
|
Samuel Dionne-Riel <samuel@dionne-riel.com>,
|
|
Stephen Carlson <stcarlso@linux.microsoft.com>,
|
|
Peter Robinson <pbrobinson@gmail.com>, Faiz Abbas <faiz_abbas@ti.com>,
|
|
Jack Mitchell <ml@embed.me.uk>, Simon Glass <sjg@chromium.org>,
|
|
Jaehoon Chung <jh80.chung@samsung.com>,
|
|
Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
|
|
Michal Simek <michal.simek@xilinx.com>, Peng Fan <peng.fan@nxp.com>,
|
|
Yifeng Zhao <yifeng.zhao@rock-chips.com>,
|
|
Jagan Teki <jagan@amarulasolutions.com>,
|
|
Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
Subject: [PATCH v3 3/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for
|
|
RK3399
|
|
Date: Sun, 16 Jan 2022 23:18:12 +0300
|
|
Message-Id: <20220116201814.11672-4-alpernebiyasak@gmail.com>
|
|
X-Mailer: git-send-email 2.34.1
|
|
In-Reply-To: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
References: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
MIME-Version: 1.0
|
|
X-BeenThere: u-boot@lists.denx.de
|
|
X-Mailman-Version: 2.1.39
|
|
Precedence: list
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
|
|
List-Archive: <https://lists.denx.de/pipermail/u-boot/>
|
|
List-Post: <mailto:u-boot@lists.denx.de>
|
|
List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
|
|
List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=subscribe>
|
|
Errors-To: u-boot-bounces@lists.denx.de
|
|
Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
|
|
X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de
|
|
X-Virus-Status: Clean
|
|
|
|
On RK3399, a register bit must be set to enable Enhanced Strobe.
|
|
Let the Rockchip SDHCI driver set it when Enhanced Strobe configuration
|
|
is requested. However, having it set makes the lower-speed modes stop
|
|
working and makes reinitialization fail, so let it be unset as needed in
|
|
set_control_reg().
|
|
|
|
This is mostly ported from Linux's Arasan SDHCI driver which happens
|
|
to be the underlying IP. (drivers/mmc/host/sdhci-of-arasan.c in Linux
|
|
tree).
|
|
|
|
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
---
|
|
|
|
(no changes since v2)
|
|
|
|
Changes in v2:
|
|
- Unset ES bit in rk3399 set_control_reg() to fix a reinit issue
|
|
- Don't use unnecessary & for function pointer in ops struct
|
|
- Rename rk3399_set_enhanced_strobe -> rk3399_sdhci_set_enhanced_strobe
|
|
- Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
|
|
|
|
drivers/mmc/rockchip_sdhci.c | 41 ++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 41 insertions(+)
|
|
|
|
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
|
|
index f0d7ba4774d6..f920c5141142 100644
|
|
--- a/drivers/mmc/rockchip_sdhci.c
|
|
+++ b/drivers/mmc/rockchip_sdhci.c
|
|
@@ -42,6 +42,9 @@
|
|
((((x) >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK) ==\
|
|
PHYCTRL_DLLRDY_DONE)
|
|
|
|
+#define ARASAN_VENDOR_REGISTER 0x78
|
|
+#define ARASAN_VENDOR_ENHANCED_STROBE BIT(0)
|
|
+
|
|
/* Rockchip specific Registers */
|
|
#define DWCMSHC_EMMC_DLL_CTRL 0x800
|
|
#define DWCMSHC_EMMC_DLL_CTRL_RESET BIT(1)
|
|
@@ -94,6 +97,7 @@ struct sdhci_data {
|
|
int (*get_phy)(struct udevice *dev);
|
|
void (*set_control_reg)(struct sdhci_host *host);
|
|
int (*set_ios_post)(struct sdhci_host *host);
|
|
+ int (*set_enhanced_strobe)(struct sdhci_host *host);
|
|
};
|
|
|
|
static int rk3399_emmc_phy_init(struct udevice *dev)
|
|
@@ -183,6 +187,21 @@ static int rk3399_emmc_get_phy(struct udevice *dev)
|
|
return 0;
|
|
}
|
|
|
|
+static int rk3399_sdhci_set_enhanced_strobe(struct sdhci_host *host)
|
|
+{
|
|
+ struct mmc *mmc = host->mmc;
|
|
+ u32 vendor;
|
|
+
|
|
+ vendor = sdhci_readl(host, ARASAN_VENDOR_REGISTER);
|
|
+ if (mmc->selected_mode == MMC_HS_400_ES)
|
|
+ vendor |= ARASAN_VENDOR_ENHANCED_STROBE;
|
|
+ else
|
|
+ vendor &= ~ARASAN_VENDOR_ENHANCED_STROBE;
|
|
+ sdhci_writel(host, vendor, ARASAN_VENDOR_REGISTER);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static void rk3399_sdhci_set_control_reg(struct sdhci_host *host)
|
|
{
|
|
struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host);
|
|
@@ -194,6 +213,15 @@ static void rk3399_sdhci_set_control_reg(struct sdhci_host *host)
|
|
rk3399_emmc_phy_power_off(priv->phy);
|
|
|
|
sdhci_set_control_reg(host);
|
|
+
|
|
+ /*
|
|
+ * Reinitializing the device tries to set it to lower-speed modes
|
|
+ * first, which fails if the Enhanced Strobe bit is set, making
|
|
+ * the device impossible to use. Set the correct value here to
|
|
+ * let reinitialization attempts succeed.
|
|
+ */
|
|
+ if (CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT))
|
|
+ rk3399_sdhci_set_enhanced_strobe(host);
|
|
};
|
|
|
|
static int rk3399_sdhci_set_ios_post(struct sdhci_host *host)
|
|
@@ -386,10 +414,22 @@ static int rockchip_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
|
|
return ret;
|
|
}
|
|
|
|
+static int rockchip_sdhci_set_enhanced_strobe(struct sdhci_host *host)
|
|
+{
|
|
+ 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_enhanced_strobe)
|
|
+ return data->set_enhanced_strobe(host);
|
|
+
|
|
+ return -ENOTSUPP;
|
|
+}
|
|
+
|
|
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_enhanced_strobe = rockchip_sdhci_set_enhanced_strobe,
|
|
};
|
|
|
|
static int rockchip_sdhci_probe(struct udevice *dev)
|
|
@@ -472,6 +512,7 @@ static const struct sdhci_data rk3399_data = {
|
|
.emmc_phy_init = rk3399_emmc_phy_init,
|
|
.set_control_reg = rk3399_sdhci_set_control_reg,
|
|
.set_ios_post = rk3399_sdhci_set_ios_post,
|
|
+ .set_enhanced_strobe = rk3399_sdhci_set_enhanced_strobe,
|
|
};
|
|
|
|
static const struct sdhci_data rk3568_data = {
|
|
|
|
From patchwork Sun Jan 16 20:18:13 2022
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
X-Patchwork-Submitter: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
X-Patchwork-Id: 1580521
|
|
X-Patchwork-Delegate: ykai007@gmail.com
|
|
Return-Path: <u-boot-bounces@lists.denx.de>
|
|
X-Original-To: incoming@patchwork.ozlabs.org
|
|
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
|
|
Authentication-Results: bilbo.ozlabs.org;
|
|
dkim=pass (2048-bit key;
|
|
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
|
|
header.s=20210112 header.b=TlnDdnYe;
|
|
dkim-atps=neutral
|
|
Authentication-Results: ozlabs.org;
|
|
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
|
|
(client-ip=85.214.62.61; helo=phobos.denx.de;
|
|
envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
|
|
Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
|
|
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
|
|
key-exchange X25519 server-signature RSA-PSS (4096 bits))
|
|
(No client certificate requested)
|
|
by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JcRFw5lPTz9ssD
|
|
for <incoming@patchwork.ozlabs.org>; Mon, 17 Jan 2022 07:19:16 +1100 (AEDT)
|
|
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
|
|
by phobos.denx.de (Postfix) with ESMTP id 04CCF835EA;
|
|
Sun, 16 Jan 2022 21:18:56 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
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=gmail.com header.i=@gmail.com header.b="TlnDdnYe";
|
|
dkim-atps=neutral
|
|
Received: by phobos.denx.de (Postfix, from userid 109)
|
|
id 1D64B81982; Sun, 16 Jan 2022 21:18:49 +0100 (CET)
|
|
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,FREEMAIL_FROM,SPF_HELO_NONE,
|
|
SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
|
|
Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com
|
|
[IPv6:2a00:1450:4864:20::536])
|
|
(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 9F6E0835CB
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 21:18:45 +0100 (CET)
|
|
Authentication-Results: phobos.denx.de;
|
|
dmarc=pass (p=none dis=none) header.from=gmail.com
|
|
Authentication-Results: phobos.denx.de;
|
|
spf=pass smtp.mailfrom=alpernebiyasak@gmail.com
|
|
Received: by mail-ed1-x536.google.com with SMTP id z22so56933846edd.12
|
|
for <u-boot@lists.denx.de>; Sun, 16 Jan 2022 12:18:45 -0800 (PST)
|
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
|
|
h=from:to:cc:subject:date:message-id:in-reply-to:references
|
|
:mime-version:content-transfer-encoding;
|
|
bh=TzASpsDhcAJy3DzV3mLZW8A/StILYbd31Wt4qZD/V0U=;
|
|
b=TlnDdnYe7zRWWM0427pGMHa2zhQg5KSHy7VkrzBlixDWHldbO2BfroUeTU9lFF5ncU
|
|
apgRl8Wjn9l7FMZ70raoqT9/FFjWX2ilvXPT+FfSTv3EmMIwK8FJYemNV1jEqbaULrzg
|
|
sXim83kmpLRN+bIkFNaJt5DxT7oJW5M6L20fGkf74gB7cH307+oubN7sLVq44m/SiLZO
|
|
S2e5OiKMIzRK+Ee9m6HNJkcz6DW7z+VnEoibMY9c7aSAuHHp0Y6zDOR2sfISEfleswk2
|
|
u+LGvBh7Q26kz42DV0m6bkI1mHO5r7TSEvB7KrEMxgNeLB/tgHtYSE+vUy2Ccw3X89Dx
|
|
fM+w==
|
|
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
d=1e100.net; s=20210112;
|
|
h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
|
|
:references:mime-version:content-transfer-encoding;
|
|
bh=TzASpsDhcAJy3DzV3mLZW8A/StILYbd31Wt4qZD/V0U=;
|
|
b=A1+tlAxHYXcYx8HS2Av38s3CQgXS4ID5bCQoXJIIvSR5QMkJwufZ6kL/DDqg/opLSu
|
|
MbZERATdQ4qz0YJ0by8XDaXu/73uCJTej3Yqr9pOFXpx+JTj8X6dNCzh/wBkdtOXHQXH
|
|
RaxKdqKMVMvPdS8+XkcJcVIAwtDTVpKfII9C+LO/ZEMoSovaLggKuSAqCiFROkA21MyT
|
|
PvdjA/zZtm0VJfD+3vP4JsueqiYJ3MFJKY5uJagQP7uuPPfLkV/yq1lq6vcUtwvF4E26
|
|
FvYUcywGw0txId6JqlSETglpzciFK8g0Cr5S1P+CUvlN+qQ3ELFjlAxBCVy4cX7jIBQY
|
|
RYGQ==
|
|
X-Gm-Message-State: AOAM532CbQq0KAUNrgw1667qCgblsQY1XZL+psHwUB8C3ccyQothrzRK
|
|
vIlvOafJMtqwT+vgjG7BdwDNRY+Hrvs=
|
|
X-Google-Smtp-Source:
|
|
ABdhPJxtMQjrwuKFphsrXSA0P41IC3DuQvZ6mrS4e6pKcwKvqI8CD4SKp0JqOoqAoakhSZQ8hMKX5g==
|
|
X-Received: by 2002:a17:906:b24d:: with SMTP id
|
|
ce13mr14386681ejb.44.1642364325298;
|
|
Sun, 16 Jan 2022 12:18:45 -0800 (PST)
|
|
Received: from localhost.localdomain ([178.233.26.119])
|
|
by smtp.gmail.com with ESMTPSA id b10sm4872469edu.42.2022.01.16.12.18.41
|
|
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
|
|
Sun, 16 Jan 2022 12:18:44 -0800 (PST)
|
|
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
To: u-boot@lists.denx.de
|
|
Cc: Aswath Govindraju <a-govindraju@ti.com>,
|
|
Kever Yang <kever.yang@rock-chips.com>,
|
|
Philipp Tomsich <philipp.tomsich@vrull.eu>,
|
|
Samuel Dionne-Riel <samuel@dionne-riel.com>,
|
|
Stephen Carlson <stcarlso@linux.microsoft.com>,
|
|
Peter Robinson <pbrobinson@gmail.com>, Faiz Abbas <faiz_abbas@ti.com>,
|
|
Jack Mitchell <ml@embed.me.uk>, Simon Glass <sjg@chromium.org>,
|
|
Jaehoon Chung <jh80.chung@samsung.com>,
|
|
Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
|
|
Michal Simek <michal.simek@xilinx.com>, Peng Fan <peng.fan@nxp.com>,
|
|
Yifeng Zhao <yifeng.zhao@rock-chips.com>,
|
|
Jagan Teki <jagan@amarulasolutions.com>,
|
|
Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
Subject: [PATCH v3 4/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for
|
|
RK3568
|
|
Date: Sun, 16 Jan 2022 23:18:13 +0300
|
|
Message-Id: <20220116201814.11672-5-alpernebiyasak@gmail.com>
|
|
X-Mailer: git-send-email 2.34.1
|
|
In-Reply-To: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
References: <20220116201814.11672-1-alpernebiyasak@gmail.com>
|
|
MIME-Version: 1.0
|
|
X-BeenThere: u-boot@lists.denx.de
|
|
X-Mailman-Version: 2.1.39
|
|
Precedence: list
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
|
|
List-Archive: <https://lists.denx.de/pipermail/u-boot/>
|
|
List-Post: <mailto:u-boot@lists.denx.de>
|
|
List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
|
|
List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
|
|
<mailto:u-boot-request@lists.denx.de?subject=subscribe>
|
|
Errors-To: u-boot-bounces@lists.denx.de
|
|
Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
|
|
X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de
|
|
X-Virus-Status: Clean
|
|
|
|
On RK3568, a register bit must be set to enable Enhanced Strobe.
|
|
However, it appears that the address of this register may differ from
|
|
vendor to vendor and should be read from the underlying MMC IP. Let the
|
|
Rockchip SDHCI driver read this address and set the relevant bit when
|
|
Enhanced Strobe configuration is requested.
|
|
|
|
Additionally, a bit signifying that the connected hardware is an eMMC
|
|
chip must be set to enable Data Strobe for HS400 and HS400ES modes. Also
|
|
make the driver set this bit as appropriate.
|
|
|
|
This is partly ported from Linux's Synopsys DWC MSHC driver which
|
|
happens to be the underlying IP. (drivers/mmc/host/sdhci-of-dwcmshc.c in
|
|
Linux tree).
|
|
|
|
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
---
|
|
Only build-tested as I don't have a RK3568 board.
|
|
|
|
Changes in v3:
|
|
- Set DWCMSHC_CARD_IS_EMMC bit in rk3568_emmc_phy_init()
|
|
|
|
Changes in v2:
|
|
- Rename rk3568_set_enhanced_strobe -> rk3568_sdhci_set_enhanced_strobe
|
|
- Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
|
|
|
|
drivers/mmc/rockchip_sdhci.c | 42 ++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 42 insertions(+)
|
|
|
|
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
|
|
index f920c5141142..4c7cc7535e2e 100644
|
|
--- a/drivers/mmc/rockchip_sdhci.c
|
|
+++ b/drivers/mmc/rockchip_sdhci.c
|
|
@@ -45,6 +45,14 @@
|
|
#define ARASAN_VENDOR_REGISTER 0x78
|
|
#define ARASAN_VENDOR_ENHANCED_STROBE BIT(0)
|
|
|
|
+/* DWC IP vendor area 1 pointer */
|
|
+#define DWCMSHC_P_VENDOR_AREA1 0xe8
|
|
+#define DWCMSHC_AREA1_MASK GENMASK(11, 0)
|
|
+/* Offset inside the vendor area 1 */
|
|
+#define DWCMSHC_EMMC_CONTROL 0x2c
|
|
+#define DWCMSHC_CARD_IS_EMMC BIT(0)
|
|
+#define DWCMSHC_ENHANCED_STROBE BIT(8)
|
|
+
|
|
/* Rockchip specific Registers */
|
|
#define DWCMSHC_EMMC_DLL_CTRL 0x800
|
|
#define DWCMSHC_EMMC_DLL_CTRL_RESET BIT(1)
|
|
@@ -244,11 +252,25 @@ static int rk3568_emmc_phy_init(struct udevice *dev)
|
|
{
|
|
struct rockchip_sdhc *prv = dev_get_priv(dev);
|
|
struct sdhci_host *host = &prv->host;
|
|
+ struct mmc *mmc = host->mmc;
|
|
u32 extra;
|
|
+ u32 vendor;
|
|
+ int reg;
|
|
|
|
extra = DLL_RXCLK_NO_INVERTER << DWCMSHC_EMMC_DLL_RXCLK_SRCSEL;
|
|
sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_RXCLK);
|
|
|
|
+ /* set CARD_IS_EMMC bit to enable Data Strobe for HS400 and HS400ES */
|
|
+ reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK)
|
|
+ + DWCMSHC_EMMC_CONTROL;
|
|
+
|
|
+ vendor = sdhci_readw(host, reg);
|
|
+ if (IS_MMC(mmc))
|
|
+ vendor |= DWCMSHC_CARD_IS_EMMC;
|
|
+ else
|
|
+ vendor &= ~DWCMSHC_CARD_IS_EMMC;
|
|
+ sdhci_writew(host, vendor, reg);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -311,6 +333,25 @@ static int rk3568_emmc_get_phy(struct udevice *dev)
|
|
return 0;
|
|
}
|
|
|
|
+static int rk3568_sdhci_set_enhanced_strobe(struct sdhci_host *host)
|
|
+{
|
|
+ struct mmc *mmc = host->mmc;
|
|
+ u32 vendor;
|
|
+ int reg;
|
|
+
|
|
+ reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK)
|
|
+ + DWCMSHC_EMMC_CONTROL;
|
|
+
|
|
+ vendor = sdhci_readl(host, reg);
|
|
+ if (mmc->selected_mode == MMC_HS_400_ES)
|
|
+ vendor |= DWCMSHC_ENHANCED_STROBE;
|
|
+ else
|
|
+ vendor &= ~DWCMSHC_ENHANCED_STROBE;
|
|
+ sdhci_writel(host, vendor, reg);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
|
|
{
|
|
struct mmc *mmc = host->mmc;
|
|
@@ -519,6 +560,7 @@ static const struct sdhci_data rk3568_data = {
|
|
.get_phy = rk3568_emmc_get_phy,
|
|
.emmc_phy_init = rk3568_emmc_phy_init,
|
|
.set_ios_post = rk3568_sdhci_set_ios_post,
|
|
+ .set_enhanced_strobe = rk3568_sdhci_set_enhanced_strobe,
|
|
};
|
|
|
|
static const struct udevice_id sdhci_ids[] = {
|