From patchwork Wed Sep 8 18:56:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 1525992 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=LZ0It3a3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H4WbF0ryNz9sX3 for ; Thu, 9 Sep 2021 04:57:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9DD2783451; Wed, 8 Sep 2021 20:57:05 +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="LZ0It3a3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28357833CE; Wed, 8 Sep 2021 20:56:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) (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 CA9B68344C for ; Wed, 8 Sep 2021 20:56:54 +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-lj1-x233.google.com with SMTP id y6so5178517lje.2 for ; Wed, 08 Sep 2021 11:56:54 -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=TAb2xWMulA1tEjSFvUC0S8ycbNMsxyaahqRY0tMr3sM=; b=LZ0It3a3vEKqpUQ/3eENbHHVa8nvLym1fEVVFgpiT+f1zJybI6WUSvhIeqmSzJ3Vij 9jH6bPN5+k+Rqh8PHEEyxBfxzXAmF9y3BxYQ9Ioyr/RIItrApZ8pGQVraf9Yi07F9NE1 gd0M5uuzJU2MqpSBjVmhYMcqhmRbG/txXtk2YMJuxvqoH2OiUgjOOor1gY0mrCsbckUg gdNnqypTGpTTUG1r/nW4JCLRWE5X8qoVBd72+TUcZJDKJQQrrCTsu3lBtPaZLJAPrwwd CVZZycMlVItFXrMHfQPpbcuco8o6ejz+q6pJ/CuYjfhhFRfEck4b7csvDus7WuBdn9gd jUtg== 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=TAb2xWMulA1tEjSFvUC0S8ycbNMsxyaahqRY0tMr3sM=; b=NeYVWLuH4wIlg8sYsEo793an3kqLxi5XW1FOuLcMlwaHNIvJ4ZVRjKcZrLqOZTwWiN qDUILCW1kLQSwJDetuH0Y6ZcHzceAgMmZqtwB1LN1NHHgYhst9zXL+CEk2uQoe92lXGZ +XfDzRu7YavX0aIxVNyaqxH23M3LTbLnG652CUEv8DVHZy9g6qulQxQz7JhO5UNIia1N jS75Wb2utyGBwzGxUF1GjMmEJs+B2TTFiz+z0J2YIhPRvWW2CnTJkADJkzShsvBE/4Qz Dq0IkhKOOGx5LO89gSZXW5F23WTQdmCTEtIDTp27Xa4e4wTZveGuSSBfNc1E4AahxN2N 0FTw== X-Gm-Message-State: AOAM531s/mUukcWvw9LZrLvv9y2I135MfWDsSz9MSi2AmA/sbvy+0zQs BQ7TAaSIPrv/m4FFJe33kBy558dyBJ9UkQ== X-Google-Smtp-Source: ABdhPJwpybSLagPlIEqmLR3x77ny18l8Eb2uXzNWuVb7uGM3eobz3yBrjUMJsUKzZOCU1uv2ESWswg== X-Received: by 2002:a05:651c:54d:: with SMTP id q13mr4038492ljp.526.1631127413939; Wed, 08 Sep 2021 11:56:53 -0700 (PDT) Received: from cryobook.bearlog ([82.193.109.226]) by smtp.gmail.com with ESMTPSA id a13sm326700ljk.92.2021.09.08.11.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 11:56:53 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Ricardo Salveti , Igor Opaniuk , Jorge Ramirez-Ortiz , Oleksandr Suvorov , Fabio Estevam , Jaehoon Chung , Peng Fan Subject: [PATCH v3 1/2] mmc: fsl_esdhc_imx: initialize data for imx7ulp Date: Wed, 8 Sep 2021 21:56:42 +0300 Message-Id: <20210908215616.v3.1.104188ed8bd4245cb4cf6e483afce2dfcc7deb73@changeid> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210908185644.111802-1-oleksandr.suvorov@foundries.io> References: <20210908185644.111802-1-oleksandr.suvorov@foundries.io> MIME-Version: 1.0 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 From: Jorge Ramirez-Ortiz Import data for eSDHC driver for SoC iMX7ULP from the Linux kernel. Set supported by u-boot flags only. Signed-off-by: Jorge Ramirez-Ortiz Signed-off-by: Ricardo Salveti Co-developed-by: Oleksandr Suvorov Signed-off-by: Oleksandr Suvorov Reviewed-by: Fabio Estevam Reviewed-by: Jaehoon Chung Reviewed-by: Igor Opaniuk --- Changes in v3: - add a Reviewed-by record Changes in v2: - add a Reviewed-by record drivers/mmc/fsl_esdhc_imx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index aabf39535f..6c8f77f9ee 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1706,6 +1706,11 @@ static struct esdhc_soc_data usdhc_imx7d_data = { | ESDHC_FLAG_HS400, }; +static struct esdhc_soc_data usdhc_imx7ulp_data = { + .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING + | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200, +}; + static struct esdhc_soc_data usdhc_imx8qm_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 | @@ -1720,7 +1725,7 @@ static const struct udevice_id fsl_esdhc_ids[] = { { .compatible = "fsl,imx6sl-usdhc", }, { .compatible = "fsl,imx6q-usdhc", }, { .compatible = "fsl,imx7d-usdhc", .data = (ulong)&usdhc_imx7d_data,}, - { .compatible = "fsl,imx7ulp-usdhc", }, + { .compatible = "fsl,imx7ulp-usdhc", .data = (ulong)&usdhc_imx7ulp_data,}, { .compatible = "fsl,imx8qm-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, { .compatible = "fsl,imx8mm-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, { .compatible = "fsl,imx8mn-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, From patchwork Wed Sep 8 18:56:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 1525993 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=GQh80ZL/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H4WbS4Tz3z9sX3 for ; Thu, 9 Sep 2021 04:57:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4086883462; Wed, 8 Sep 2021 20:57:11 +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="GQh80ZL/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D56458344C; Wed, 8 Sep 2021 20:57:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) (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 2A6E583450 for ; Wed, 8 Sep 2021 20:56:56 +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-lj1-x231.google.com with SMTP id q21so5154086ljj.6 for ; Wed, 08 Sep 2021 11:56:56 -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=Gnu07dhnKXs1Y1EV6cxvIyfUghaxz71Cw630Dkn2eA8=; b=GQh80ZL/yLPVicevcQzrw28wd5i+3xhC8XHONfAB9rcrmZZxWxtKeOZFPMTVmoGYB5 b4tUJ2r20UHROWTvXN7Hlw6aJ85bTCXGFznHXBwg1gBpQ/AizuYgLn11d0Xxkk1WTNM2 m5ryDaXRSisBn/LjZefBgJmJdu1RHAA+WmHl94fBlR0ybOey5Eq7dVuJdNzBph2bl34U DGHqdEe28BwZN+MaCmqehqMFomOylifdrfR/XdRJLH3h8+ucDHQtNRzHa64ZKCrcBC/L X7qKG6EfYLWBMwD+sXCerawNnoeWiNNvp2CZJVgmNIYoSbdreToqpNINv1zl+pORwL9R 7UcA== 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=Gnu07dhnKXs1Y1EV6cxvIyfUghaxz71Cw630Dkn2eA8=; b=oSdwy5FO9l9c3vSVgrsptpYsp6nbNQ6AeiDI4sO5xQ8zrfVNEeT6dZJLlXwcbkncIw WfhwDU5gngz7EoUbn4veQlFoLTYxVv4ssmLWlCigDNEFa4LJPoM4nHJgbs2XKSePylSV 13J2cwtrhkteYQL05Bf2ktKCuakxEr28glsMhA/Hi+qJbWFKnqGZrrgTBXIMxfvTq5dW 6LotioSEt9HxRCrAfmJP+sk/FFWGp+ZlucSskkG8sS6sadljx7v1Kg0ho2ZJbClkwP5X dxzll0OY7OEI16T0/7A25wK0REx1V7GwnFaGjcZilDB931lHSpBOG02vi0bryUKKaxMZ IdNQ== X-Gm-Message-State: AOAM532b7Jri+lgPUDl9z+TCa2SJ90j/U7QIXPI4GjDz2ZKMc69LTlG6 J731iBQrxILbJ5LPhKsHCAjlxmoxnNLQqA== X-Google-Smtp-Source: ABdhPJx19SupCVHdn55C3aLEEBvmsKBlu+GrDL/w3oLjl5AK5lfep7h2ZrkvWB0SaslqkOJ2PkQ7Jg== X-Received: by 2002:a2e:7c0a:: with SMTP id x10mr4084413ljc.340.1631127415233; Wed, 08 Sep 2021 11:56:55 -0700 (PDT) Received: from cryobook.bearlog ([82.193.109.226]) by smtp.gmail.com with ESMTPSA id a13sm326700ljk.92.2021.09.08.11.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 11:56:54 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Ricardo Salveti , Igor Opaniuk , Jorge Ramirez-Ortiz , Oleksandr Suvorov , Fabio Estevam , Jaehoon Chung , Haibo Chen , Peng Fan Subject: [PATCH v3 2/2] mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP Date: Wed, 8 Sep 2021 21:56:43 +0300 Message-Id: <20210908215616.v3.2.89dae794dc03b6dfca7994ee9274ca487cd52a89@changeid> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210908215616.v3.1.104188ed8bd4245cb4cf6e483afce2dfcc7deb73@changeid> References: <20210908185644.111802-1-oleksandr.suvorov@foundries.io> <20210908215616.v3.1.104188ed8bd4245cb4cf6e483afce2dfcc7deb73@changeid> MIME-Version: 1.0 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 Reviewed-by: Jaehoon Chung Reviewed-by: Igor Opaniuk --- Changes in v3: - added a cover letter. - removed an extra blank line. - added Reviewed-by records. Changes in v2: - fixed Series-notes record. - added Reviewed-by records. drivers/mmc/fsl_esdhc_imx.c | 10 +++++++--- include/fsl_esdhc_imx.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 6c8f77f9ee..9b991a6026 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -727,17 +727,20 @@ 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 +1711,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)