MMC host:

- sdhci: Fix performance regression with auto CMD auto select
  - sdhci-of-esdhc: Fix initialization for eMMC HS400 mode
  - sdhci-of-esdhc: Fix timeout bug for tuning commands
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAl+cAaAXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCk1TxAArYMU3N/xv05wsgqY2v3S9chF
 WZluEFcY27XwC327gev8009+a4iC2425j6VXy15IQ85r2EG1HrkxOVL+JpAbPrAC
 EKcdaqbMfp6onpGpx7PRj8VeAtx6ZTYO1iUyxQDJjS2DtRxIerSxHp5kDOYPiH+X
 O2vlzyqIS4c6g1cmY9wbSG0ii8Nw3JgMDhANsqYYXIjnNkZblZKFp/j5W0RcQ15m
 hhXYkK4m1YxsMtmWywYG3+YeVV6M8qkpjGHY0H0+IxWJY6sFF5vyBZ/SrkfnOSlC
 lghQVv4vCzecZbonUawR12GMSzu9U5f2vwHya1e1uKXVKJVK6Tw0mXOohhbnE8q6
 rAHeDuMpUp+0QZW/oJ6CqGMEmnqsmpdvtSvlN943US7M/xnQBHyznK/3t80tM1fv
 Npgvzwz1mBjUlWutiRQUUyNCZT/7cBNWaaSPly8/cnHyxUgZb6M7gVEel23xFE9i
 nAbJjKL5TWQUdp7EFKMSpic12Gu5RbkeLs2/UW60UlAz9hfGo2ADzwIrRS/nC8ni
 8Ko8y8RNhAJ4cQJDUMd3F2JwIS4AjJgXOGg9R1u0KO2ocAnB7CADzamIUDTywwam
 576RgYWiR3nppnRno1e69392y2orRFzHbMWzi+r32phjQs+q5qHodB0Yzn2ikg+7
 zn1zCQwFyTuD3LwThoQ=
 =LDSp
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC host fixes from Ulf Hansson:

 - sdhci: Fix performance regression with auto CMD auto select

 - sdhci-of-esdhc: Fix initialization for eMMC HS400 mode

 - sdhci-of-esdhc: Fix timeout bug for tuning commands

* tag 'mmc-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: sdhci-of-esdhc: make sure delay chain locked for HS400
  mmc: sdhci-of-esdhc: set timeout to max before tuning
  mmc: sdhci: Use Auto CMD Auto Select only when v4_mode is true
This commit is contained in:
Linus Torvalds 2020-10-30 11:04:11 -07:00
commit 88098fd61b
3 changed files with 34 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* Copyright (c) 2007 Freescale Semiconductor, Inc.
* Copyright (c) 2009 MontaVista Software, Inc.
* Copyright (c) 2010 Pengutronix e.K.
* Copyright 2020 NXP
* Author: Wolfram Sang <kernel@pengutronix.de>
*/
@ -88,6 +89,7 @@
/* DLL Config 0 Register */
#define ESDHC_DLLCFG0 0x160
#define ESDHC_DLL_ENABLE 0x80000000
#define ESDHC_DLL_RESET 0x40000000
#define ESDHC_DLL_FREQ_SEL 0x08000000
/* DLL Config 1 Register */

View File

@ -4,6 +4,7 @@
*
* Copyright (c) 2007, 2010, 2012 Freescale Semiconductor, Inc.
* Copyright (c) 2009 MontaVista Software, Inc.
* Copyright 2020 NXP
*
* Authors: Xiaobo Xie <X.Xie@freescale.com>
* Anton Vorontsov <avorontsov@ru.mvista.com>
@ -19,6 +20,7 @@
#include <linux/clk.h>
#include <linux/ktime.h>
#include <linux/dma-mapping.h>
#include <linux/iopoll.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include "sdhci-pltfm.h"
@ -743,6 +745,21 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
if (host->mmc->actual_clock == MMC_HS200_MAX_DTR)
temp |= ESDHC_DLL_FREQ_SEL;
sdhci_writel(host, temp, ESDHC_DLLCFG0);
temp |= ESDHC_DLL_RESET;
sdhci_writel(host, temp, ESDHC_DLLCFG0);
udelay(1);
temp &= ~ESDHC_DLL_RESET;
sdhci_writel(host, temp, ESDHC_DLLCFG0);
/* Wait max 20 ms */
if (read_poll_timeout(sdhci_readl, temp,
temp & ESDHC_DLL_STS_SLV_LOCK,
10, 20000, false,
host, ESDHC_DLLSTAT0))
pr_err("%s: timeout for delay chain lock.\n",
mmc_hostname(host->mmc));
temp = sdhci_readl(host, ESDHC_TBCTL);
sdhci_writel(host, temp | ESDHC_HS400_WNDW_ADJUST, ESDHC_TBCTL);
@ -1052,6 +1069,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
esdhc_tuning_block_enable(host, true);
/*
* The eSDHC controller takes the data timeout value into account
* during tuning. If the SD card is too slow sending the response, the
* timer will expire and a "Buffer Read Ready" interrupt without data
* is triggered. This leads to tuning errors.
*
* Just set the timeout to the maximum value because the core will
* already take care of it in sdhci_send_tuning().
*/
sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
hs400_tuning = host->flags & SDHCI_HS400_TUNING;
do {

View File

@ -1384,9 +1384,11 @@ static inline void sdhci_auto_cmd_select(struct sdhci_host *host,
/*
* In case of Version 4.10 or later, use of 'Auto CMD Auto
* Select' is recommended rather than use of 'Auto CMD12
* Enable' or 'Auto CMD23 Enable'.
* Enable' or 'Auto CMD23 Enable'. We require Version 4 Mode
* here because some controllers (e.g sdhci-of-dwmshc) expect it.
*/
if (host->version >= SDHCI_SPEC_410 && (use_cmd12 || use_cmd23)) {
if (host->version >= SDHCI_SPEC_410 && host->v4_mode &&
(use_cmd12 || use_cmd23)) {
*mode |= SDHCI_TRNS_AUTO_SEL;
ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);