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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF7A1C432BE for ; Tue, 31 Aug 2021 17:50:20 +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 0CA44610D1 for ; Tue, 31 Aug 2021 17:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0CA44610D1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=foundries.io 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 E9B688347C; Tue, 31 Aug 2021 19:50:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="Q97P/u1+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AF65C831D8; Tue, 31 Aug 2021 19:50:03 +0200 (CEST) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (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 A407F81FC6 for ; Tue, 31 Aug 2021 19:49:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=oleksandr.suvorov@foundries.io Received: by mail-lf1-x12c.google.com with SMTP id k13so558926lfv.2 for ; Tue, 31 Aug 2021 10:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lWpd++eXy8UGFLQ562HZqK7gIX+rfbpr4zcUsbctwXE=; b=Q97P/u1+VOCcOybilkaILfWmP1v3GY0pZUJx46pHZl1mmz4Y6ngv+WoLF9zXwZCQR1 0PohhFLMgpjCc4a6PC9tL3v6b2R5JrUbUSTP2bclhSKJodYZQS8HKurpLoOQj+eOgxzf fwzYdjNDLOK1xkypos/ygPIqIDTZk3aNbD+U0DvCrMzVHj34vMICW7ClBkKEi/SPpxTs 8ReqPaWAIOByt/EepfqCA+f+WzxN3kwJ1SCAubKWZNtvH9ngViukBTr8O1puf/42mlLv nkNBgX8eEdQ/d/RLAcRXaqXm9QqLaLKNwgfCVGFHdOVzLy8MzuAytfZoSYvtmYaSh2MH WiFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lWpd++eXy8UGFLQ562HZqK7gIX+rfbpr4zcUsbctwXE=; b=lY8j9ATjWm2faohsxiruQLJZkAjJYU7s6MZpQMFjzD5kJxAhbVuDvrrVXfAIq7UBq4 2TkfngWv/7NFajaQc6awHDcX+LHIl+2Ql3pIyTWj76AdxPXjotXa6D+FhmwS4GdKp4fn nNzi1bFA6Yc8B6NW14b8qy4HxC07wfV3NRr+BUWiNfO47jMBPapeLSELx1fcx4RhqMFH /EJkMcZ+d769yQAoQuXqe5uns+1bUx2HslQQ0KNnSTSAl6KCuLnszoG+zd669hBEaE6x 6Mx+f0f3AVDIH96OfJVBAD0uoB85elqGthx3QuzzzpsFLNQyp7Bi486AOgQFbQA5zLSx jD2Q== X-Gm-Message-State: AOAM531Ul878HBgBy47K+gJe70RoyAGwE+3X/+r47dbrtNL2ZlFGf6tE SrLAiPZtd8xeLtYsj7zRDY5v1aLiRPVmOg== X-Google-Smtp-Source: ABdhPJx7xiC0ZdC7ePQS9jfPzrmYzLNKnHT4csQStRZv9yQBI9cAI4hmPRbnBknJvKAXw1FLAQbqRA== X-Received: by 2002:a05:6512:e99:: with SMTP id bi25mr22014021lfb.486.1630432198796; Tue, 31 Aug 2021 10:49:58 -0700 (PDT) Received: from cryobook.bearlog ([82.193.109.226]) by smtp.gmail.com with ESMTPSA id x9sm1788277lfa.233.2021.08.31.10.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 10:49:58 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Ricardo Salveti , Igor Opaniuk , Jorge Ramirez-Ortiz , Oleksandr Suvorov , Fabio Estevam , Haibo Chen , Jaehoon Chung , Peng Fan Subject: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP Date: Tue, 31 Aug 2021 20:49:54 +0300 Message-Id: <20210831204945.v2.2.575fac7c32@changeid> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210831174954.72009-1-oleksandr.suvorov@foundries.io> References: <20210831174954.72009-1-oleksandr.suvorov@foundries.io> 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 Import HS400 support for iMX7ULP B0 from the Linux kernel: 2eaf5a533afd ("mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP") According to IC suggest, need to clear the STROBE_DLL_CTRL_RESET before any setting of STROBE_DLL_CTRL register. USDHC has register bits(bit[27~20] of register STROBE_DLL_CTRL) for slave sel value. If this register bits value is 0, it needs 256 ref_clk cycles to update slave sel value. IC suggest to set bit[27~20] to 0x4, it only need 4 ref_clk cycle to update slave sel value. This will short the lock time of slave. i.MX7ULP B0 will need more time to lock the REF and SLV, so change to add 5us delay. Signed-off-by: Oleksandr Suvorov Reviewed-by: Fabio Estevam --- Changes in v2: - fixed Series-notes record. - added Reviewed-by records. drivers/mmc/fsl_esdhc_imx.c | 11 ++++++++--- include/fsl_esdhc_imx.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 6c8f77f9ee..569f099d9b 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -727,17 +727,21 @@ static void esdhc_set_strobe_dll(struct mmc *mmc) if (priv->clock > ESDHC_STROBE_DLL_CLK_FREQ) { esdhc_write32(®s->strobe_dllctrl, ESDHC_STROBE_DLL_CTRL_RESET); + /* clear the reset bit on strobe dll before any setting */ + esdhc_write32(®s->strobe_dllctrl, 0); + /* * enable strobe dll ctrl and adjust the delay target * for the uSDHC loopback read clock */ val = ESDHC_STROBE_DLL_CTRL_ENABLE | + ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT | (priv->strobe_dll_delay_target << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); esdhc_write32(®s->strobe_dllctrl, val); - /* wait 1us to make sure strobe dll status register stable */ - mdelay(1); + /* wait 5us to make sure strobe dll status register stable */ + mdelay(5); val = esdhc_read32(®s->strobe_dllstat); if (!(val & ESDHC_STROBE_DLL_STS_REF_LOCK)) pr_warn("HS400 strobe DLL status REF not lock!\n"); @@ -1708,7 +1712,8 @@ static struct esdhc_soc_data usdhc_imx7d_data = { static struct esdhc_soc_data usdhc_imx7ulp_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING - | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200, + | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 + | ESDHC_FLAG_HS400, }; static struct esdhc_soc_data usdhc_imx8qm_data = { diff --git a/include/fsl_esdhc_imx.h b/include/fsl_esdhc_imx.h index 45ed635a77..12e9163382 100644 --- a/include/fsl_esdhc_imx.h +++ b/include/fsl_esdhc_imx.h @@ -194,6 +194,7 @@ #define ESDHC_STROBE_DLL_CTRL_RESET BIT(1) #define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT 0x7 #define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 +#define ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT (4 << 20) #define ESDHC_STROBE_DLL_STATUS 0x74 #define ESDHC_STROBE_DLL_STS_REF_LOCK BIT(1) -- 2.31.1