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 95091C433EF for ; Tue, 15 Mar 2022 17:47:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D82683C0C; Tue, 15 Mar 2022 18:47:07 +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="njhf2ein"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A451C83C09; Tue, 15 Mar 2022 18:47:00 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 BC43F83BEB for ; Tue, 15 Mar 2022 18:46: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=alpernebiyasak@gmail.com Received: by mail-wr1-x42a.google.com with SMTP id j26so30204044wrb.1 for ; Tue, 15 Mar 2022 10:46:56 -0700 (PDT) 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=mWnbRa8V7sDSXxMcn965uLo2m3u2s9iWBvZa6DJQc+s=; b=njhf2ein+gm/7jV+Qh87MzDTlLwCkLRHMTSwhdzVMirG3W4XXT6qq3YMq0/ULBw2hT 2HXMGpxxXBrJIJ1mi4CT4rMQ+7UDCbSaUtaX6ykt9CaV4QfbzQTI9IHH0DPs+Qo/rala HZSV4yoEts7RZZMTdQ4eQ3goGT5ekptob0LBcesIxbn0OXFe7oeDyMJRwKZQqBYWdbPS A1g+QTNPGGdaT+/w/ltOF1eaKoS2rQOUkDeWDeA7uB4NKg+eo3JkItX9f3uVNmx8UUxo 48mFvYGlxVO8fSySUc+DkwNvASULz0GIBM5bf12eqdpA5ycg/cyseM5DAO94fvVJ0Ot1 t++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=mWnbRa8V7sDSXxMcn965uLo2m3u2s9iWBvZa6DJQc+s=; b=1enWB0m7RbMOzLsZVwYb/zRqQG72DsfGRc5qrdAUig5YFzqHU2R0NEPl9LabSMJo6E R8hGZCM6pEMZ+6SDmt/jx0C/jIFaFyUeSbBS4MatUE4yEuH5LFJPUsY5zvrEgVB+dHn2 xVKX9bB6m6NouXUqmxdViMCPGlbrd35VvzpQGA0U7Z9Jc+w+WIcMC6BdBaGnHKdRDDx9 9CZHsCoObe6l9hiHvpJXMPyTQffEYAWVQr0cVEk8GwN5VJjZ1aAnk2TCJLPApc+SHBM5 zjTmasvdwZh/JuWE4KWv75Crelw30NdgspTbK726Rx++qbwD/D41HB9gyHQUpNbIxU7W m1Pw== X-Gm-Message-State: AOAM533qHk23pD2MPZZAmFasGSRqGitypc0UVeOSRz51tZVXk4WSZBfI oMfkEXb4YD5y5rwpVxAbHibPMzy/n/+23Q== X-Google-Smtp-Source: ABdhPJyoXkkFFj2K4TXDsM/yXizjTMmEdMHNib4yzte/LXV6fO37FvUcPj2OgEACuPzIo+hXIhOeiw== X-Received: by 2002:adf:ebd0:0:b0:1e3:f9b:7b77 with SMTP id v16-20020adfebd0000000b001e30f9b7b77mr20557183wrn.691.1647366416127; Tue, 15 Mar 2022 10:46:56 -0700 (PDT) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id p4-20020a05600c358400b00389f61bce7csm4578374wmq.32.2022.03.15.10.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 10:46:55 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Faiz Abbas , Jaehoon Chung , Philipp Tomsich , Peter Robinson , Peng Fan , Peter Geis , Jagan Teki , Samuel Dionne-Riel , Simon Glass , Kever Yang , Ashok Reddy Soma , Aswath Govindraju , Jack Mitchell , Heinrich Schuchardt , Yifeng Zhao , Michal Simek , Stephen Carlson , Alper Nebi Yasak Subject: [PATCH v5 1/3] mmc: sdhci: Add HS400 Enhanced Strobe support Date: Tue, 15 Mar 2022 20:46:26 +0300 Message-Id: <20220315174629.7467-2-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220315174629.7467-1-alpernebiyasak@gmail.com> References: <20220315174629.7467-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 --- (no changes since v4) 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.35.1