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 2E364C433F5 for ; Mon, 1 Nov 2021 09:08:59 +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 98D0561027 for ; Mon, 1 Nov 2021 09:08:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 98D0561027 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 3621783557; Mon, 1 Nov 2021 10:08:43 +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="Lym8DJ1l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1F1EF81F0B; Mon, 1 Nov 2021 10:08:38 +0100 (CET) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 9065881197 for ; Mon, 1 Nov 2021 10:08:30 +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-x52e.google.com with SMTP id h7so62692175ede.8 for ; Mon, 01 Nov 2021 02:08:30 -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=KTyohvF4LudZz5HJBC9i7e5NRKeaBBCa069BrlN/+BQ=; b=Lym8DJ1luuHB440ukTyP0DUglNYGDYZyyzq9K3JAw/aUmcfnae8qAweHszwxlV4Ny2 DpXFZP8Aht1Yxxa8cOA2Xu8jSLLGexpx8dQnjvk8eHFsCXhKILQNxTRHdlS1dU6BMUjO cBfh5lzeM4Ylc96fPZ6XKtG39mCZQlTsi5ar6xpivQfE/qBeFWGpdqcVYCY381zLBS7Y 6s4BYZwcbcAggbil1ETb4usqxgwbWkLq3gX/O+flzhBDGqqhsmFkZM0HO5UlLtBtPzhi Fd9DgUZyrr85QsqKWTWxHdNRQM1cfFWT9NMn0y7RPURlPNALGFD00OUA2nDpnUEaVIva YYmg== 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=KTyohvF4LudZz5HJBC9i7e5NRKeaBBCa069BrlN/+BQ=; b=nALRRVVUx03FGSXpqZoxxtfB2P4IBsFPIGeyuT3OlOD/YErYzqI/MWT1DZQ6RpiTPj kczcWuQmWrItZUkEYUjxS2bKxEip6KO90VSuizAtru86otoQF7GPAXTACe7fM6chWjG/ HCxZdBDxrqeXUQLjk6W8BErQeQejaF7XuFehqBOVuqocy3AxrqyAWdvF2duQR8XftDoa 8cLoEbYuuxnzCofVTx1aXKU8HV2gy8an+jAvlXVycd0shw8nbaAD4xL7pfp1DCSUmRx3 9YmXaoP+rHNYUqGZ4DWNlka/IN95qIxjBonpxMjt32gVow4Aa8mv4oU/RuG5+ouGIdWK Exqg== X-Gm-Message-State: AOAM531G4Pi7dt7tg+bId+vnt4zchIhSlTbcSF0lR0qCrMnhKqKCSLqz 9adS/lW/GxXGyzz9/UfaoeMDi2yn5xtNajRQ X-Google-Smtp-Source: ABdhPJzHFh43g/rB7J7NCf5IOKHWAWSNE45VoLFREG8f8HTg/Yr8o+Dw6zi3S6G7fLm2SlCw0XbQFw== X-Received: by 2002:a17:906:e283:: with SMTP id gg3mr35853083ejb.403.1635757710164; Mon, 01 Nov 2021 02:08:30 -0700 (PDT) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id m1sm6745680ejn.121.2021.11.01.02.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:08:29 -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 3/3] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568 Date: Mon, 1 Nov 2021 12:07:54 +0300 Message-Id: <20211101090755.23762-4-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 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. This is mostly ported from Linux' 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 --- Merely build-tested as I don't have a RK3568 board. drivers/mmc/rockchip_sdhci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 7457255fa080..c95f95578672 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -45,6 +45,13 @@ #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_ENHANCED_STROBE BIT(8) + /* Rockchip specific Registers */ #define DWCMSHC_EMMC_DLL_CTRL 0x800 #define DWCMSHC_EMMC_DLL_CTRL_RESET BIT(1) @@ -284,6 +291,21 @@ static int rk3568_emmc_get_phy(struct udevice *dev) return 0; } +static int rk3568_set_enhanced_strobe(struct sdhci_host *host) +{ + u32 vendor; + int reg; + + reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK) + + DWCMSHC_EMMC_CONTROL; + + vendor = sdhci_readl(host, reg); + vendor |= DWCMSHC_ENHANCED_STROBE; + sdhci_writel(host, vendor, reg); + + return 0; +} + static int rockchip_sdhci_set_ios_post(struct sdhci_host *host) { struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, host); @@ -473,6 +495,7 @@ 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_enhanced_strobe = rk3568_set_enhanced_strobe, }; static const struct udevice_id sdhci_ids[] = { -- 2.33.1