From mboxrd@z Thu Jan 1 00:00:00 1970 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 BA937C433EF for ; Fri, 28 Jan 2022 22:43:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6484683809; Fri, 28 Jan 2022 23:43:09 +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="i6zKdoOY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9323B83809; Fri, 28 Jan 2022 23:43:07 +0100 (CET) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 AB176837E7 for ; Fri, 28 Jan 2022 23:43:04 +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-wr1-x42b.google.com with SMTP id l25so13458483wrb.13 for ; Fri, 28 Jan 2022 14:43:04 -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=x1iap5T2FNu6QSFUQFGbW0JJC59917B6cW1lKChVirY=; b=i6zKdoOY3JwjZgUkmlgyXgodBEAWyxODadpSyrwDZ/rUl8rspodWuJyuG/W5JVLUL4 VMy6bvDWaarX47BJVLh8lAS6AfgcM0lX69q1yAwCeMGlSJvEml4PKZPNwUfT5CA2G+js dteKPj279EWDMD1TUFksDz3KKk6H1UChLNMEK212DYyzQBzfEunSM2JFrIpsD93FfzIs 0ITvZXR2FXTlF4bIxfmRl/n0kC8RX7ndiGNZ+0blIcKZp6/rde9rDg/kFtMG3anlZbsv BIlPYd1K/Qgtvia4PkDyflU6j2aIQ3fMFHwuXSOS6wXDd47WxIY7PyQahPYRB5bLoK2M GmLA== 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=x1iap5T2FNu6QSFUQFGbW0JJC59917B6cW1lKChVirY=; b=oAoT4kIvRuzomT9tln7d8DW+9x/UT4afYJSPcMsL9ukS+mcFfqKCdCq1vIGKn5OGRY IRfGeIP+YIRICvKhnEOr8L1RRYIWLq4OL+Pa33KMpYdFbst+FUkbXQGYdWKfRZ2jmv45 2rdZPnT8QQX0msubHyJCZLeDdk8se65LRpn2oiwwKsUJK+e1V9xbI5NXeaJaWm7Ay4x9 LKJqCPqYfCssBMryjQLcll9U9W84Iay88bwXplbkE+LBAicQcSRnWlgW4G24K+gyZSGE 1nPir9W/EOBxzMEQwpeIIeJpQ53kec5dgEhid/2na9MqdFtz+yRYAVqLXVKl5Us1ymu7 PNfg== X-Gm-Message-State: AOAM533EYhutdIpMRvEf9lqzAiwqpNjiPJbHJ4yicfJxBwMvEsOlcw/l 2skCBX8fx5Z2SZqsvmfByKzSCovgls/P/g== X-Google-Smtp-Source: ABdhPJzR2dxlxPoy9k9WJ+WiFsKWcXBcJF+fO/3b2I0neVG2FPLvU4oGg5uxLHkkw70doUSn8W25rA== X-Received: by 2002:adf:e90c:: with SMTP id f12mr8709286wrm.443.1643409784297; Fri, 28 Jan 2022 14:43:04 -0800 (PST) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id m8sm5413586wrn.106.2022.01.28.14.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 14:43:03 -0800 (PST) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Jack Mitchell , Kever Yang , Heinrich Schuchardt , Yifeng Zhao , Samuel Dionne-Riel , Simon Glass , Aswath Govindraju , Philipp Tomsich , Ashok Reddy Soma , Stephen Carlson , Jaehoon Chung , Michal Simek , Faiz Abbas , Jagan Teki , Peng Fan , Peter Robinson , Alper Nebi Yasak Subject: [PATCH v4 1/4] mmc: sdhci: Add HS400 Enhanced Strobe support Date: Sat, 29 Jan 2022 01:42:36 +0300 Message-Id: <20220128224240.4226-2-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128224240.4226-1-alpernebiyasak@gmail.com> References: <20220128224240.4226-1-alpernebiyasak@gmail.com> 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.5 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 Reviewed-by: Jaehoon Chung --- Changes in v4: - Add comment for SDHCI set_enhanced_strobe() operation Changes in v2: - Add tag: "Reviewed-by: Jaehoon Chung " drivers/mmc/sdhci.c | 18 ++++++++++++++++++ include/sdhci.h | 12 ++++++++++++ 2 files changed, 30 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 c8d69f5a63f7..88f1917480b6 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -272,6 +272,18 @@ 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); + + /** + * set_enhanced_strobe() - Set HS400 Enhanced Strobe config + * + * This is called after setting the card speed and mode to + * HS400 ES, and should set any host-specific configuration + * necessary for it. + * + * @host: SDHCI host structure + * Return: 0 if successful, -ve on error + */ + int (*set_enhanced_strobe)(struct sdhci_host *host); }; #define ADMA_MAX_LEN 65532 -- 2.34.1