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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F427C433F5 for ; Mon, 1 Nov 2021 09:08:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 892C960F4F for ; Mon, 1 Nov 2021 09:08:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 892C960F4F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A59A082EA5; Mon, 1 Nov 2021 10:08: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="ZoPdTSl3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 50FF08352D; Mon, 1 Nov 2021 10:08:35 +0100 (CET) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 CA0E58352E for ; Mon, 1 Nov 2021 10:08:26 +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-x529.google.com with SMTP id g10so61829564edj.1 for ; Mon, 01 Nov 2021 02:08:26 -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=YrMVsV0PUFRYEP7dTWoPyvryOYfa18t0QMtteejSbBI=; b=ZoPdTSl3jMbKs8gJ26xt3Grcdf+9vJ32G9eU8vbDDm8obVXof12LARTaU5dMEYlM+z sS+6g70qVbUP0npXxv+AA/A5RCqdDZ1rONHYisN9rQCgKYeJV2MoLI86PiVgdRxvXnfA fP2ffBGVQk03CbjBl9y7webeKBGAa+CsimnICHS/VidvyNmTM3sjSZJnMaPfw736CsrH 9+Fb+94nYRn2/oXR7YRMwjij1UQmtA4MfIK+3jEygovGvrf9T8BcJyuUkxuKiK5gZ1Ml ugxQg9clRkgV5RaHs8bmEGY6N3T8PDEN3bcb7eGca41vH0DR+F1zQcMUAT5PNIeuX4Yt fy7Q== 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=YrMVsV0PUFRYEP7dTWoPyvryOYfa18t0QMtteejSbBI=; b=DofiuUqYdsey1i4fy0lvUjdYz35ebEaKtaf5sXBLR+WUbYrDABbJ1pWzbiizJ38ZCG +uwjeHVju5NWxJVHDvXgiGuT1tAfda1hDmbnaxMCS25iGLA9VwToNkYEBjRhP8P6xhCr r8HOo245PP50a48DHFldWcpkFntlxl1BMRqa4SyrYpZznC1SoZE1lG5AMYSa+hb9g7IU WIgGBenE44HcKs7EWMz02kW3Hq130ILJLPDTKOlokzC6ttrhceQrNLKEWvf4tTJZKXaQ 8NkPYvlE5vQwk6FgLuQiEpxerHGnOyxJ0PtKQ0eXWM7GNqqM3WyYwitohZBTwDUVKQFI X9yA== X-Gm-Message-State: AOAM530slAWu5VXib5N/cnjuKKCI7hc9G/4B4GAw+eut7A0rUNewtPbF eEwly+GMxXaW6lH6UBOP3e+cdJR4P1HD8Zkb X-Google-Smtp-Source: ABdhPJxhkZQuMBXFV6KgPQjvoaRq0mwRPyOZi81PKtRLz9jQ8WELWe8g/SwP/bhUVPhA/PHZyqOPGw== X-Received: by 2002:a17:906:c18c:: with SMTP id g12mr35794848ejz.458.1635757706480; Mon, 01 Nov 2021 02:08:26 -0700 (PDT) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id m1sm6745680ejn.121.2021.11.01.02.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:08:26 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Aswath Govindraju , Michal Simek , Philipp Tomsich , Jaehoon Chung , Stephen Carlson , Kever Yang , Faiz Abbas , Yifeng Zhao , Simon Glass , Philipp Tomsich , Peng Fan , Ashok Reddy Soma , Alper Nebi Yasak Subject: [PATCH 2/3] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399 Date: Mon, 1 Nov 2021 12:07:53 +0300 Message-Id: <20211101090755.23762-3-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101090755.23762-1-alpernebiyasak@gmail.com> References: <20211101090755.23762-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 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. This is mostly ported from Linux' 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 --- drivers/mmc/rockchip_sdhci.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 278473899c7c..7457255fa080 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) @@ -93,6 +96,7 @@ 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); + int (*set_enhanced_strobe)(struct sdhci_host *host); }; static int rk3399_emmc_phy_init(struct udevice *dev) @@ -198,6 +202,17 @@ static int rk3399_sdhci_emmc_set_clock(struct sdhci_host *host, unsigned int clo return 0; } +static int rk3399_set_enhanced_strobe(struct sdhci_host *host) +{ + u32 vendor; + + vendor = sdhci_readl(host, ARASAN_VENDOR_REGISTER); + vendor |= ARASAN_VENDOR_ENHANCED_STROBE; + sdhci_writel(host, vendor, ARASAN_VENDOR_REGISTER); + + return 0; +} + static int rk3568_emmc_phy_init(struct udevice *dev) { struct rockchip_sdhc *prv = dev_get_priv(dev); @@ -355,9 +370,21 @@ 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_enhanced_strobe = &rockchip_sdhci_set_enhanced_strobe, }; static int rockchip_sdhci_probe(struct udevice *dev) @@ -439,6 +466,7 @@ 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_enhanced_strobe = rk3399_set_enhanced_strobe, }; static const struct sdhci_data rk3568_data = { -- 2.33.1