From patchwork Fri Aug 11 21:48:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 134760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1403628vqi; Fri, 11 Aug 2023 16:00:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF31HrT+bbWAaKqcL0gC70EVjMoh6fK/Mh0fo1BsJwLRa+bDfERlZCGRw0QttJygdE519na X-Received: by 2002:a05:6358:9312:b0:135:ae78:56c9 with SMTP id x18-20020a056358931200b00135ae7856c9mr3125650rwa.6.1691794843159; Fri, 11 Aug 2023 16:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691794843; cv=none; d=google.com; s=arc-20160816; b=0Yt4ZNYypqd7pu45L6P2dpqIQEQJiBdLP1MUPmkOcBopWa3yGv2FbMGADTM+P+GehM WpnPbLa5g7g8lKK2QDnIktff4Vnf4AZ03RJsRh2xgXdgLOIPwl8QDHUBIekPMX1h0fdM X7CoPznk8qgVPQ373YE1KW7cpRcrYVksCGyW2XB2+YYcQVVLRkfcynmVCuDZ8Hb401Ft 0jHnEDdrOX8iN7X7rCWyBrU0jkffFnAVuHoC0u2DmkpwZYAvWZ0lHxL7uDzb9Uc8OvFL 22IP/mmtf5vu7ZiMNULImjQq/3+w2ivVtA9h/As9zhz08alPuz5DmW5kdDbIXd2L7phs 9TmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=l/UBGJG5Ir5w+uZTNb/QEzQZVvezGJOLjCKIbndxO84=; fh=5uVfcxjThYjkWop8OhbPQgnPnSgfMKqLO6QbGNO62Ow=; b=ijLlILlLZMI7Fi4GzxcKDWpXQu4jTKNO0D7nP+qPNRoX3/6iO3fjeBWzUpFLgRKWUt RgmnDKas31AMjTGz+EaIaAd4rhwaYF34nWlzhfRRPi6sfYPflS9xnfJa9c7Y3XRdmrrU i0xFeTt+zsXbLPQTpBQQqgVKea9iBvBRtSMthnPfLMwEOxfeylTYg5F+8yI7l7DfRfat wFb3mOlyblQFDsGVNETaNrPCMMqXSzwZal3fHk2w03xEnJcFDf55CX41dcT2kG7SAByi Rt2OyaBx8S0jCMafCB+ZuPAtOUASjW9PZMHVZ3grfko5Fk2Df9dS/w51Uzb1j5Y8axnM 5bjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=D0rnICc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr12-20020a056a000f0c00b0068730bad8b5si4059027pfb.209.2023.08.11.16.00.29; Fri, 11 Aug 2023 16:00:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=D0rnICc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237061AbjHKVuP (ORCPT + 99 others); Fri, 11 Aug 2023 17:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237019AbjHKVuO (ORCPT ); Fri, 11 Aug 2023 17:50:14 -0400 X-Greylist: delayed 61 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 11 Aug 2023 14:50:12 PDT Received: from smtpdh19-su.aruba.it (smtpdh19-su.aruba.it [62.149.155.160]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F1A72D43 for ; Fri, 11 Aug 2023 14:50:12 -0700 (PDT) Received: from localhost.localdomain ([95.47.160.93]) by Aruba Outgoing Smtp with ESMTPSA id Ua0Aq7XLHFroIUa0CqW4bs; Fri, 11 Aug 2023 23:49:08 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1691790548; bh=KJngbAjEFPIyEBfjQn07lPW+qRTIhtdwoSvYTeTqKZY=; h=From:To:Subject:Date:MIME-Version; b=D0rnICc6gHCRqrtX0c/5GJvFlidvSBLxQKTGADCP8vpvR3pCflK5tMIGRpPxCsWUN goWIH+T4ZzTjSRWekdEcN6k8Y87bkWZvE2Dhj8oUpbzWnJmFcnlSOIYQ1dAV0BGR1V qtJ6qWcjLfAN5CBHI7cu5mCqHvqmchWU3+/wsb9CbVf99Q3fuUNEDebW4sYqgFNSnX GHjwIeqxfLhZAwVwAXjD5bIfnmeVHPVOzbAW+Rm8dT4/EJVSAXtg0sHCp7jBTjILq7 mY6lcv8jLNDVrJ9G1gGeG81FnvfjQ7G4ZTmmOAyswkE/komPpxh9D8SjrPicaCsoPW mN8rgsxqgTPVw== From: Giulio Benetti To: Haibo Chen , Ulf Hansson , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team Cc: Adrian Hunter , Pengutronix Kernel Team , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti , Jim Reinhart , James Autry , Matthew Maron Subject: [PATCH] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 Date: Fri, 11 Aug 2023 23:48:53 +0200 Message-Id: <20230811214853.8623-1-giulio.benetti@benettiengineering.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4xfHpN8j46R7b2UpflHNODCxRDbca5TpBTdczR3rUGOoes8cF4qEerGe3nlPgCwdTFQN9CLc6xzMi1zADjleFUxD+qnOhufHUAubLxLwS2DpoLzPDYxiTk yI5czAh5FHAzUV0Qkwj2zj1ziTPr4iwVxovcDHdHuRF4y/fVAi2MBI2RzRj56YvegBAHUuB/f0+OTa8EwUWnqDhE/Mx9mxOad5sbWEBvwBeeFOH5K1j8AlZB 4T5YD0k6hcl7x7A6746gS048o1R96aA4VnTLjPYUCgLR15pmLd3eDhBYI7ISx0f25huCh3JXevu5LspKeJhdvpy6rHieCumdl9XADoj3sK9yiYo1CePhTHXz pXnBPnJB6cs3x4D1zgDClPZ7hH17nDvOuwZc2nrJUNSvSfAn+/x5pfhfzAF1WmBEkpya/nSrfD5tEM1gWBmUfouGq6OYeKaoLzcDgGsQXfsbpbHKc5KvPQha y3K+yjXxA6/TT8zHPjThrtSADYUa4IdobJr76MSnx5cKAPg/ngvmCd/bojNgPawSqNzWdEj5pO/dDGvoKn2g5Eit4yG67j9dNqJD4VdfTxhkET+jKDeUbCXD doALwMcFkupxx4LtIHMYo4bgf6MxtpYx9pg8Sow9h4c5sGK/i+qowJQVFNNYXDQrbAj5E6DZL0mWOaW2YpmLS4YkQI0hWa5dH6eymCcXYMSn9JOXA2oGusTA jllcmnfTfVY= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773975469049546783 X-GMAIL-MSGID: 1773975469049546783 Errata ERR010450 only shows up if voltage is 1.8V, but if the device is supplied by 3v3 the errata can be ignored. So let's check for if quirk SDHCI_QUIRK2_NO_1_8_V is defined or not before limiting the frequency. Sponsored by: Tekvox Inc. Cc: Jim Reinhart Cc: James Autry Cc: Matthew Maron Signed-off-by: Giulio Benetti --- drivers/mmc/host/sdhci-esdhc-imx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index eebf94604a7f..cddecc1e1ac2 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -171,8 +171,8 @@ #define ESDHC_FLAG_HS400 BIT(9) /* * The IP has errata ERR010450 - * uSDHC: Due to the I/O timing limit, for SDR mode, SD card clock can't - * exceed 150MHz, for DDR mode, SD card clock can't exceed 45MHz. + * uSDHC: At 1.8V due to the I/O timing limit, for SDR mode, SD card + * clock can't exceed 150MHz, for DDR mode, SD card clock can't exceed 45MHz. */ #define ESDHC_FLAG_ERR010450 BIT(10) /* The IP supports HS400ES mode */ @@ -961,7 +961,8 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, | ESDHC_CLOCK_MASK); sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); - if (imx_data->socdata->flags & ESDHC_FLAG_ERR010450) { + if ((imx_data->socdata->flags & ESDHC_FLAG_ERR010450) && + (!(host->quirks2 & SDHCI_QUIRK2_NO_1_8_V))) { unsigned int max_clock; max_clock = imx_data->is_ddr ? 45000000 : 150000000;