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 69D9BC433F5 for ; Tue, 11 Jan 2022 13:40:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7930E8304F; Tue, 11 Jan 2022 14:40:00 +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="EjSIQ5g0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 844BA8304F; Tue, 11 Jan 2022 14:39:58 +0100 (CET) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 D06CD803CE for ; Tue, 11 Jan 2022 14:39:53 +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-x532.google.com with SMTP id m4so25834833edb.10 for ; Tue, 11 Jan 2022 05:39:53 -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=wLYwwWEbLbbtxt89ix7I1Ls/8w8AsMGKTbpnjBl5DKg=; b=EjSIQ5g0RmH+lgS5Sd0F9PqKFwv6CG5uOzI/chZb7xYC3+PtNLfwUP87JGYc6nOlZP HczQhR8W7b9KiJQ3nygOZlYeOiM1TK8KPYvJhwF9dk3cwSqJJNOlhPgs5ODnZax0VZjw jb90du6f9djPv94H9P+c0r2ws0+mhkdJjP/Vs7c+Ti1qGF8WIMk4Us8mWnuosw7LIYBU d97Fr/FHQ5xgGpkNoCJSCDblpYqxsAZmCcrm+VWgkIpeZpLNRq9Ay8eHe5jGmdE1QEEy yIYdbQ/uOrpHCRS38KaaZDjTHRO4H4oxUGVlYodxM70bLk9Ac0MnwhwAEO8kQKWayJZf JeSA== 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=wLYwwWEbLbbtxt89ix7I1Ls/8w8AsMGKTbpnjBl5DKg=; b=2pPD73Eop33nRKrfOY8V9ZYh1rewOze3mZC5k1G+Uc7Io/9YzKZaJe+77BWLWV8h2T n8Ro2Pp92c7qHMidLgPMD0ejO+RyXitHY3V/5eaWOjjg+Wv3grcQiaFfJt61sywzqTyF I+k2SGft5BG14U+bfZH2oonxWzElEekmbi2b9EBJ9lHayz6q0WNPdN/F5PZAZlcVc8ij eiApVOmA+QauhQcMCPYStOCfnxQd45fLLV1NIjKnk5PKctp9CWSOo7bJLzaAPU+NBN5v fOnGPdIdCIKhrSCVbW89IqUDubZG26GCXN70XFAFLu1qZCSUqEH7y/rVLPTkMentIx4m kC7Q== X-Gm-Message-State: AOAM532U0QNahF3ZbTzRQzaaHWYls8YbwQ7PZPbtb5MFBAn0L8w8MpWx rJE8X6vImfFdKFIi8mt5I4libIawgKKUPw== X-Google-Smtp-Source: ABdhPJzB6PjmGX2gbOpz/G4sbc2DNu+eaE/vy+++5TkskgkaCXyDdohe8pW5VKsJ4P5hVkYAW3IjiA== X-Received: by 2002:a17:906:5488:: with SMTP id r8mr3627440ejo.752.1641908393343; Tue, 11 Jan 2022 05:39:53 -0800 (PST) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id ck3sm1180324edb.36.2022.01.11.05.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 05:39:52 -0800 (PST) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Yifeng Zhao , Peng Fan , Ashok Reddy Soma , Samuel Dionne-Riel , Aswath Govindraju , Philipp Tomsich , Jagan Teki , Stephen Carlson , Akash Gajjar , Michal Simek , Kever Yang , Faiz Abbas , Simon Glass , Peter Robinson , Jaehoon Chung , Jack Mitchell , Alper Nebi Yasak Subject: [PATCH v2 1/4] mmc: sdhci: Add HS400 Enhanced Strobe support Date: Tue, 11 Jan 2022 16:39:28 +0300 Message-Id: <20220111133931.7866-2-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220111133931.7866-1-alpernebiyasak@gmail.com> References: <20220111133931.7866-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.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 Reviewed-by: Jaehoon Chung --- Changes in v2: - Add tag: "Reviewed-by: Jaehoon Chung " 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 -- 2.34.1