08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

20 Feb, 2020

1 commit

  • [ Upstream commit 9073d10b098973519044f5fcdc25586810b435da ]

    Use MMC_CAP2_RO_ACTIVE_HIGH flag as indicator if GPIO line is to be
    inverted compared to DT/platform-specified polarity. The flag is not used
    after init in GPIO mode anyway. No functional changes intended.

    Signed-off-by: Michał Mirosław
    Link: https://lore.kernel.org/r/a60f563f11bbff821da2fa2949ca82922b144860.1576031637.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Michał Mirosław
     

11 Feb, 2020

3 commits

  • [ Upstream commit a04184ce777b46e92c2b3c93c6dcb2754cb005e1 ]

    sdhci_alloc_host() does its work not using managed infrastructure, so
    needs explicit free on error path. Add it where needed.

    Cc:
    Fixes: bb5f8ea4d514 ("mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC")
    Signed-off-by: Michał Mirosław
    Acked-by: Ludovic Desroches
    Acked-by: Adrian Hunter
    Link: https://lore.kernel.org/r/b2a44d5be2e06ff075f32477e466598bb0f07b36.1577961679.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Michał Mirosław
     
  • commit af3ed119329cf9690598c5a562d95dfd128e91d6 upstream.

    The code in mmc_spi_initsequence() tries to send a burst with
    high chipselect and for this reason hardcodes the device into
    SPI_CS_HIGH.

    This is not good because the SPI_CS_HIGH flag indicates
    logical "asserted" CS not always the physical level. In
    some cases the signal is inverted in the GPIO library and
    in that case SPI_CS_HIGH is already set, and enforcing
    SPI_CS_HIGH again will actually drive it low.

    Instead of hard-coding this, toggle the polarity so if the
    default is LOW it goes high to assert chipselect but if it
    is already high then toggle it low instead.

    Cc: Phil Elwell
    Reported-by: Mark Brown
    Signed-off-by: Linus Walleij
    Reviewed-by: Mark Brown
    Link: https://lore.kernel.org/r/20191204152749.12652-1-linus.walleij@linaro.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Linus Walleij
     
  • commit 38413ce39a4bd908c02257cd2f9e0c92b27886f4 upstream.

    Fix sparse warnings:

    drivers/mmc/host/sdhci-pci-core.c:1599:6: warning: symbol 'amd_sdhci_reset' was not declared. Should it be static?

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    zhengbin
     

01 Feb, 2020

2 commits

  • [ Upstream commit 315e3bd7ac19b18ba704d96cbb9b79bad485c01f ]

    Add PCI Ids for Intel JSL.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Adrian Hunter
     
  • [ Upstream commit 7a869f00bb15bcefb8804d798a49b086267b03e6 ]

    AMD SDHC 0x7906 requires a hard reset to clear all internal state.
    Otherwise it can get into a bad state where the DATA lines are always
    read as zeros.

    This change requires firmware that can transition the device into
    D3Cold for it to work correctly. If the firmware does not support
    transitioning to D3Cold then the power state transitions are a no-op.

    Signed-off-by: Raul E Rangel
    Signed-off-by: Shyam Sundar S K
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Raul E Rangel
     

29 Jan, 2020

4 commits

  • commit de31f6ab68a3f548d88686d53514f252d78f61d5 upstream.

    The tuning data is leftover in the buffer after tuning. This can cause
    issues in future data commands, especially with CQHCI. Reset the command
    and data lines after tuning to continue from a clean state.

    Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Faiz Abbas
    Acked-by: Adrian Hunter
    Link: https://lore.kernel.org/r/20200108143301.1929-3-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Faiz Abbas
     
  • commit 4d627c88546a697b07565dbb70d2f9f46a5ee76f upstream.

    The MMC/SD controllers on am65x and j721e don't in fact detect the write
    protect line as inverted. No issues were detected because of this
    because the sdwp line is not connected on any of the evms. Fix this by
    removing the flag.

    Fixes: 1accbced1c32 ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
    Cc: stable@vger.kernel.org
    Signed-off-by: Faiz Abbas
    Acked-by: Adrian Hunter
    Link: https://lore.kernel.org/r/20200108143301.1929-2-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Faiz Abbas
     
  • commit 2a187d03352086e300daa2044051db00044cd171 upstream.

    For SDHCIv3+ with programmable clock mode, minimal clock frequency is
    still base clock / max(divider). Minimal programmable clock frequency is
    always greater than minimal divided clock frequency. Without this patch,
    SDHCI uses out-of-spec initial frequency when multiplier is big enough:

    mmc1: mmc_rescan_try_freq: trying to init card at 468750 Hz
    [for 480 MHz source clock divided by 1024]

    The code in sdhci_calc_clk() already chooses a correct SDCLK clock mode.

    Fixes: c3ed3877625f ("mmc: sdhci: add support for programmable clock mode")
    Cc: # 4f6aa3264af4: mmc: tegra: Only advertise UHS modes if IO regulator is present
    Cc:
    Signed-off-by: Michał Mirosław
    Acked-by: Adrian Hunter
    Link: https://lore.kernel.org/r/ffb489519a446caffe7a0a05c4b9372bd52397bb.1579082031.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Michał Mirosław
     
  • commit f571389c0b015e76f91c697c4c1700aba860d34f upstream.

    Commit 7ad2ed1dfcbe inadvertently mixed up a quirk flag's name and
    broke SDR50 tuning override. Use correct NVQUIRK_ name.

    Fixes: 7ad2ed1dfcbe ("mmc: tegra: enable UHS-I modes")
    Cc:
    Acked-by: Adrian Hunter
    Reviewed-by: Thierry Reding
    Tested-by: Thierry Reding
    Signed-off-by: Michał Mirosław
    Link: https://lore.kernel.org/r/9aff1d859935e59edd81e4939e40d6c55e0b55f6.1578390388.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Michał Mirosław
     

26 Jan, 2020

1 commit

  • [ Upstream commit 16568b4a4f0c34bd35cfadac63303c7af7812764 ]

    wl1251 and wl1271 have different vendor id and device id.
    So we need to handle both with sdio quirks.

    Fixes: 884f38607897 ("mmc: core: move some sdio IDs out of quirks file")
    Signed-off-by: H. Nikolaus Schaller
    Cc: # v4.11+
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    H. Nikolaus Schaller
     

05 Jan, 2020

2 commits

  • [ Upstream commit f667216c5c7c967c3e568cdddefb51fe606bfe26 ]

    The erratum A-009204 workaround patch was reverted because of
    incorrect implementation.

    8b6dc6b mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add
    erratum A-009204 support"

    This patch is to re-implement the workaround (add a 5 ms delay
    before setting SYSCTL[RSTD] to make sure all the DMA transfers
    are finished).

    Signed-off-by: Yangbo Lu
    Link: https://lore.kernel.org/r/20191219032335.26528-1-yangbo.lu@nxp.com
    Fixes: 5dd195522562 ("mmc: sdhci-of-esdhc: add erratum A-009204 support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Yangbo Lu
     
  • [ Upstream commit 22dc132d5448db1b1c021de0c34aa8033ca7d98f ]

    A previous patch implemented an incomplete workaround of erratum
    A-008171. The complete workaround is as below. This patch is to
    implement the complete workaround which uses SW tuning if HW tuning
    fails, and retries both HW/SW tuning once with reduced clock if
    workaround fails. This is suggested by hardware team, and the patch
    had been verified on LS1046A eSDHC + Phison 32G eMMC which could
    trigger the erratum.

    Workaround:
    /* For T1040, T2080, LS1021A, T1023 Rev 1: */
    1. Program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO.
    2. Program TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
    3. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
    4. Set SYSCTL2[EXTN] and SYSCTL2[SAMPCLKSEL].
    5. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
    6. Wait for IRQSTAT[BRR], buffer read ready, to be set.
    7. Clear IRQSTAT[BRR].
    8. Check SYSCTL2[EXTN] to be cleared.
    9. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
    indicate tuning procedure success, and clear indicate failure.
    In case of tuning failure, fixed sampling scheme could be used by
    clearing TBCTL[TB_EN].
    /* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0: */
    1. Read the TBCTL[31:0] register. Write TBCTL[11:8]=4'h8 and wait for
    1ms.
    2. Read the TBCTL[31:0] register and rewrite again. Wait for 1ms second.
    3. Read the TBSTAT[31:0] register twice.
    3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
    3.2 Check ESDHCCTL[RSTD] bit.
    3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
    3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
    4. if TBSTAT[15:8]-TBSTAT[7:0] > 4*DIV_RATIO or TBSTAT[7:0]-TBSTAT[15:8]
    > 4*DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] = 4*DIV_RATIO and
    program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
    /* For LS1012A Rev1, LS1043A Rev 1.x, LS1046A 1.0: */
    1. Read the TBCTL[0:31] register. Write TBCTL[20:23]=4'h8 and wait for
    1ms.
    2. Read the TBCTL[0:31] register and rewrite again. Wait for 1ms second.
    3. Read the TBSTAT[0:31] register twice.
    3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
    3.2 Check ESDHCCTL[RSTD] bit.
    3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
    3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
    4. if TBSTAT[16:23]-TBSTAT[24:31] > 4*DIV_RATIO or TBSTAT[24:31]-
    TBSTAT[16:23] > 4* DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] =
    4*DIV_RATIO and program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
    /* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0 LS1012A Rev1,
    * LS1043A Rev 1.x, LS1046A 1.0:
    */
    5. else program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO and program
    TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
    6. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
    7. Set SYSCTL2[EXTN], wait 1us and SYSCTL2[SAMPCLKSEL].
    8. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
    9. Wait for IRQSTAT[BRR], buffer read ready, to be set.
    10. Clear IRQSTAT[BRR].
    11. Check SYSCTL2[EXTN] to be cleared.
    12. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
    indicate tuning procedure success, and clear indicate failure.
    In case of tuning failure, fixed sampling scheme could be used by
    clearing TBCTL[TB_EN].

    Fixes: b1f378ab5334 ("mmc: sdhci-of-esdhc: add erratum A008171 support")
    Signed-off-by: Yinbo Zhu
    Signed-off-by: Yangbo Lu
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Yangbo Lu
     

31 Dec, 2019

9 commits

  • commit 75d27ea1abf7af3cc2cdec3513e74f52191605c8 upstream.

    Command queuing has been reported broken on some systems based on Intel
    GLK. A separate patch disables command queuing in some cases.

    This patch adds a quirk for broken command queuing, which enables users
    with problems to disable command queuing using sdhci module parameters for
    quirks.

    Fixes: 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")
    Signed-off-by: Adrian Hunter
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191217095349.14592-2-adrian.hunter@intel.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit bedf9fc01ff1f40cfd1a79ccacedd9f3cd8e652a upstream.

    Command queuing has been reported broken on some Lenovo systems based on
    Intel GLK. This is likely a BIOS issue, so disable command queuing for
    Intel GLK if the BIOS vendor string is "LENOVO".

    Fixes: 8ee82bda230f ("mmc: sdhci-pci: Add CQHCI support for Intel GLK")
    Signed-off-by: Adrian Hunter
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191217095349.14592-1-adrian.hunter@intel.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit fe0acab448f68c3146235afe03fb932e242ec94c upstream.

    Two previous patches introduced below quirks for P2020 platforms.
    - SDHCI_QUIRK_RESET_AFTER_REQUEST
    - SDHCI_QUIRK_BROKEN_TIMEOUT_VAL

    The patches made a mistake to add them in quirks2 of sdhci_host
    structure, while they were defined for quirks.
    host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
    host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;

    This patch is to fix them.
    host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
    host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;

    Fixes: 05cb6b2a66fa ("mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support")
    Fixes: a46e42712596 ("mmc: sdhci-of-esdhc: add erratum eSDHC5 support")
    Signed-off-by: Yangbo Lu
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191216031842.40068-1-yangbo.lu@nxp.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Yangbo Lu
     
  • commit 2c92dd20304f505b6ef43d206fff21bda8f1f0ae upstream.

    Tuning support in DDR50 speed mode was added in SD Specifications Part1
    Physical Layer Specification v3.01. Its not possible to distinguish
    between v3.00 and v3.01 from the SCR and that is why since
    commit 4324f6de6d2e ("mmc: core: enable CMD19 tuning for DDR50 mode")
    tuning failures are ignored in DDR50 speed mode.

    Cards compatible with v3.00 don't respond to CMD19 in DDR50 and this
    error gets printed during enumeration and also if retune is triggered at
    any time during operation. Update the printk level to pr_debug so that
    these errors don't lead to false error reports.

    Signed-off-by: Faiz Abbas
    Cc: stable@vger.kernel.org # v4.4+
    Link: https://lore.kernel.org/r/20191206114326.15856-1-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Faiz Abbas
     
  • commit 8b6dc6b2d60221e90703babbc141f063b8a07e72 upstream.

    This reverts commit 5dd195522562542bc6ebe6e7bd47890d8b7ca93c.

    First, the fix seems to be plain wrong, since the erratum suggests
    waiting 5ms before setting setting SYSCTL[RSTD], but this msleep()
    happens after the call of sdhci_reset() which is where that bit gets
    set (if SDHCI_RESET_DATA is in mask).

    Second, walking the whole device tree to figure out if some node has a
    "fsl,p2020-esdhc" compatible string is hugely expensive - about 70 to
    100 us on our mpc8309 board. Walking the device tree is done under a
    raw_spin_lock, so this is obviously really bad on an -rt system, and a
    waste of time on all.

    In fact, since esdhc_reset() seems to get called around 100 times per
    second, that mpc8309 now spends 0.8% of its time determining that
    it is not a p2020. Whether those 100 calls/s are normal or due to some
    other bug or misconfiguration, regularly hitting a 100 us
    non-preemptible window is unacceptable.

    Signed-off-by: Rasmus Villemoes
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191204085447.27491-1-linux@rasmusvillemoes.dk
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Rasmus Villemoes
     
  • commit fa56ac9792265354b565f28def7164e7d7db2b1e upstream.

    The DDR_CONFIG register offset got updated after a specific
    minor version of sdcc V4. This offset change has not been properly
    taken care of while updating register changes for sdcc V5.

    Correcting proper offset for this register.
    Also updating this register value to reflect the recommended RCLK
    delay.

    Signed-off-by: Veerabhadrarao Badiganti
    Link: https://lore.kernel.org/r/0101016ea738ec72-fa0f852d-20f8-474a-80b2-4b0ef63b132c-000000@us-west-2.amazonses.com
    Fixes: f15358885dda ("mmc: sdhci-msm: Define new Register address map")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Veerabhadrarao Badiganti
     
  • commit 8f34e5bd7024d1ffebddd82d7318b1be17be9e9a upstream.

    there is a chance that always get response CRC error after HS200 tuning,
    the reason is that need set CMD_TA to 2. this modification is only for
    MT8173.

    Signed-off-by: Chaotian Jing
    Tested-by: Hsin-Yi Wang
    Cc: stable@vger.kernel.org
    Fixes: 1ede5cb88a29 ("mmc: mediatek: Use data tune for CMD line tune")
    Link: https://lore.kernel.org/r/20191204071958.18553-1-chaotian.jing@mediatek.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Chaotian Jing
     
  • commit 07bcc411567cb96f9d1fc84fff8d387118a2920d upstream.

    This reverts commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37.

    This commit aims to treat SD High speed and SDR25 as the same while
    setting UHS Timings in HOST_CONTROL2 which leads to failures with some
    SD cards in AM65x. Revert this commit.

    The issue this commit was trying to fix can be implemented in a platform
    specific callback instead of common sdhci code.

    Cc:
    Signed-off-by: Faiz Abbas
    Acked-by: Adrian Hunter
    Link: https://lore.kernel.org/r/20191128110422.25917-1-faiz_abbas@ti.com
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Faiz Abbas
     
  • [ Upstream commit c91843463e9e821dc3b48fe37e3155fa38299f6e ]

    Isolated initially to renesas_sdhi_internal_dmac [1], Ulf suggested
    adding MMC_CAP_ERASE to the TMIO mmc core:

    On Fri, Nov 15, 2019 at 10:27:25AM +0100, Ulf Hansson wrote:
    -- snip --
    This test and due to the discussions with Wolfram and you in this
    thread, I would actually suggest that you enable MMC_CAP_ERASE for all
    tmio variants, rather than just for this particular one.

    In other words, set the cap in tmio_mmc_host_probe() should be fine,
    as it seems none of the tmio variants supports HW busy detection at
    this point.
    -- snip --

    Testing on R-Car H3ULCB-KF doesn't reveal any issues (v5.4-rc7):

    root@rcar-gen3:~# lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    mmcblk0 179:0 0 59.2G 0 disk
    Cc: Masahiro Yamada
    Cc: Andrew Gabbasov
    Originally-by: Harish Jenny K N
    Suggested-by: Ulf Hansson
    Signed-off-by: Eugeniu Rosca
    Reviewed-by: Wolfram Sang
    Signed-off-by: Ulf Hansson
    Signed-off-by: Sasha Levin

    Eugeniu Rosca
     

25 Dec, 2019

2 commits


21 Dec, 2019

4 commits

  • commit 2ac55d5e5ec9ad0a07e194f0eaca865fe5aa3c40 upstream.

    It have turned out that it's not a good idea to unconditionally do a power
    cycle and then to re-initialize the SDIO card, as currently done through
    mmc_hw_reset() -> mmc_sdio_hw_reset(). This because there may be multiple
    SDIO func drivers probed, who also shares the same SDIO card.

    To address these scenarios, one may be tempted to use a notification
    mechanism, as to allow the core to inform each of the probed func drivers,
    about an ongoing HW reset. However, supporting such an operation from the
    func driver point of view, may not be entirely trivial.

    Therefore, let's use a more simplistic approach to solve the problem, by
    instead forcing the card to be removed and re-detected, via scheduling a
    rescan-work. In this way, we can rely on existing infrastructure, as the
    func driver's ->remove() and ->probe() callbacks, becomes invoked to deal
    with the cleanup and the re-initialization.

    This solution may be considered as rather heavy, especially if a func
    driver doesn't share its card with other func drivers. To address this,
    let's keep the current immediate HW reset option as well, but run it only
    when there is one func driver probed for the card.

    Finally, to allow the caller of mmc_hw_reset(), to understand if the reset
    is being asynchronously managed from a scheduled work, it returns 1
    (propagated from mmc_sdio_hw_reset()). If the HW reset is executed
    successfully and synchronously it returns 0, which maintains the existing
    behaviour.

    Reviewed-by: Douglas Anderson
    Tested-by: Douglas Anderson
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Ulf Hansson
     
  • commit 99b4ddd8b76a6f60a8c2b3775849d65d21a418fc upstream.

    Upfront in mmc_rescan() we use the host->rescan_entered flag, to allow
    scanning only once for non-removable cards. Therefore, it's also not
    possible that we can have a corresponding card bus attached (host->bus_ops
    is NULL), when we are scanning non-removable cards.

    For this reason, let' drop the check for mmc_card_is_removable() as it's
    redundant.

    Reviewed-by: Douglas Anderson
    Tested-by: Douglas Anderson
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Ulf Hansson
     
  • commit a0d4c7eb71dd08a89ad631177bb0cbbabd598f84 upstream.

    MMC IOCTLS with R1B responses may cause the card to enter the busy state,
    which means it's not ready to receive a new request. To prevent new
    requests from being sent to the card, use a CMD13 polling loop to verify
    that the card returns to the transfer state, before completing the request.

    Signed-off-by: Chaotian Jing
    Reviewed-by: Avri Altman
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Chaotian Jing
     
  • commit 3869468e0c4800af52bfe1e0b72b338dcdae2cfc upstream.

    To prepare for more users of card_busy_detect(), let's drop the struct
    request * as an in-parameter and convert to log the error message via
    dev_err() instead of pr_err().

    Signed-off-by: Chaotian Jing
    Reviewed-by: Avri Altman
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Chaotian Jing
     

18 Dec, 2019

1 commit

  • commit f6498b922e57aecbe3b7fa30a308d9d586c0c369 upstream.

    Pandora_wl1251_init_card was used to do special pdata based
    setup of the sdio mmc interface. This does no longer work with
    v4.7 and later. A fix requires a device tree based mmc3 setup.

    Therefore we move the special setup to omap_hsmmc.c instead
    of calling some pdata supplied init_card function.

    The new code checks for a DT child node compatible to wl1251
    so it will not affect other MMC3 use cases.

    Generally, this code was and still is a hack and should be
    moved to mmc core to e.g. read such properties from optional
    DT child nodes.

    Fixes: 81eef6ca9201 ("mmc: omap_hsmmc: Use dma_request_chan() for requesting DMA channel")
    Signed-off-by: H. Nikolaus Schaller
    Cc: # v4.7+
    [Ulf: Fixed up some checkpatch complaints]
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    H. Nikolaus Schaller
     

25 Nov, 2019

10 commits

  • After set the STROBE SLV delay target value, it need to wait some
    time to let the usdhc lock the REF and SLV clock. In normal case,
    1~2us is enough for imx8/imx6 and imx7d, and 4~5us is enough for
    imx7ulp, but when do reboot stress test or do the bind/unbind stress
    test, sometimes need to wait about 10us to get the status lock.

    This patch optimize delay handle method, only print the warning
    message if the status is still not lock after 1ms delay.

    Signed-off-by: Haibo Chen
    Reviewed-by: Dong Aisheng

    Haibo Chen
     
  • When force clock off, check the SDOFF of register PRSSTAT to make sure
    the clock is gate off. Before force clock on, check the SDSTB of register
    PRSSTAT to make sure the clock is stable, this will eliminate the clock
    glitch.

    Signed-off-by: Haibo Chen
    Reviewed-by: Dong Aisheng

    Haibo Chen
     
  • S32V234 uSDHC is compatible with the driver implemented for i.MX.
    Notes:
    - Errata ESDHC_FLAG_ERR004536 is not applicable for S32V234 uSDHC.
    - MMC driver is selected based on the SOC that is part of the Freescale S32
    family.

    Signed-off-by: Gilles Talis
    Signed-off-by: Mihaela Martinas
    Signed-off-by: Stoica Cosmin-Stefan
    Signed-off-by: Stefan-Gabriel Mirea
    Acked by: Haibo Chen

    Mihaela Martinas
     
  • A previous patch implemented an incomplete workaround of erratum
    A-008171. The complete workaround is as below. This patch is to
    implement the complete workaround which uses SW tuning if HW tuning
    fails, and retries both HW/SW tuning once with reduced clock if
    workaround fails. This is suggested by hardware team, and the patch
    had been verified on LS1046A eSDHC + Phison 32G eMMC which could
    trigger the erratum.

    Workaround:
    /* For T1040, T2080, LS1021A, T1023 Rev 1: */
    1. Program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO.
    2. Program TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
    3. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
    4. Set SYSCTL2[EXTN] and SYSCTL2[SAMPCLKSEL].
    5. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
    6. Wait for IRQSTAT[BRR], buffer read ready, to be set.
    7. Clear IRQSTAT[BRR].
    8. Check SYSCTL2[EXTN] to be cleared.
    9. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
    indicate tuning procedure success, and clear indicate failure.
    In case of tuning failure, fixed sampling scheme could be used by
    clearing TBCTL[TB_EN].
    /* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0: */
    1. Read the TBCTL[31:0] register. Write TBCTL[11:8]=4'h8 and wait for
    1ms.
    2. Read the TBCTL[31:0] register and rewrite again. Wait for 1ms second.
    3. Read the TBSTAT[31:0] register twice.
    3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
    3.2 Check ESDHCCTL[RSTD] bit.
    3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
    3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
    4. if TBSTAT[15:8]-TBSTAT[7:0] > 4*DIV_RATIO or TBSTAT[7:0]-TBSTAT[15:8]
    > 4*DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] = 4*DIV_RATIO and
    program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
    /* For LS1012A Rev1, LS1043A Rev 1.x, LS1046A 1.0: */
    1. Read the TBCTL[0:31] register. Write TBCTL[20:23]=4'h8 and wait for
    1ms.
    2. Read the TBCTL[0:31] register and rewrite again. Wait for 1ms second.
    3. Read the TBSTAT[0:31] register twice.
    3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
    3.2 Check ESDHCCTL[RSTD] bit.
    3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
    3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
    4. if TBSTAT[16:23]-TBSTAT[24:31] > 4*DIV_RATIO or TBSTAT[24:31]-
    TBSTAT[16:23] > 4* DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] =
    4*DIV_RATIO and program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
    /* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0 LS1012A Rev1,
    * LS1043A Rev 1.x, LS1046A 1.0:
    */
    5. else program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO and program
    TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
    6. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
    7. Set SYSCTL2[EXTN], wait 1us and SYSCTL2[SAMPCLKSEL].
    8. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
    9. Wait for IRQSTAT[BRR], buffer read ready, to be set.
    10. Clear IRQSTAT[BRR].
    11. Check SYSCTL2[EXTN] to be cleared.
    12. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
    indicate tuning procedure success, and clear indicate failure.
    In case of tuning failure, fixed sampling scheme could be used by
    clearing TBCTL[TB_EN].

    Fixes: b1f378ab5334 ("mmc: sdhci-of-esdhc: add erratum A008171 support")
    Signed-off-by: Yinbo Zhu
    Signed-off-by: Yangbo Lu
    Acked-by: Adrian Hunter

    Yangbo Lu
     
  • The ESDHC_FLUSH_ASYNC_FIFO bit which is set to flush asynchronous FIFO
    should be polled until it's auto cleared by hardware.

    Signed-off-by: Yangbo Lu

    Yangbo Lu
     
  • Currently sdhci driver free irq in host suspend, and call
    request_threaded_irq() in host resume. But during host resume,
    Ctrl+C can impact sdhci host resume, see the error log:

    CPU1 is up
    PM: noirq resume of devices complete after 0.637 msecs imx-sdma 30bd0000.sdma: loaded firmware 4.1
    PM: early resume of devices complete after 0.774 msecs
    dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
    PM: Device 30b40000.usdhc failed to resume: error -4
    dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
    PM: Device 30b50000.usdhc failed to resume: error -4
    dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
    PM: Device 30b60000.usdhc failed to resume: error -4 fec 30be0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: Timeout waiting for hardware interrupt.
    mmc0: error -110 during resume (card was removed?)
    mmc2: Timeout waiting for hardware interrupt.
    mmc2: Timeout waiting for hardware interrupt.
    mmc2: error -110 during resume (card was removed?)

    In request_threaded_irq-> __setup_irq-> kthread_create
    ->kthread_create_on_node, the comment shows that SIGKILLed will
    impact the kthread create, and return -EINTR.

    This patch replace them with disable|enable_irq(), that will prevent
    IRQs from being propagated to the sdhci driver.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • On i.MX8MM, we are running Dual Linux OS, with 1st Linux using SD Card
    as rootfs storage, 2nd Linux using eMMC as rootfs storage. We let the
    the 1st linux configure power/clock for the 2nd Linux.

    When the 2nd Linux is booting into rootfs stage, we let the 1st Linux
    to destroy the 2nd linux, then restart the 1st linux, we met SDHCI dump
    as following, after we clear the pending interrupt and halt CQCTL, issue
    gone.

    [ 1.334594] mmc2: Got command interrupt 0x00000001 even though no command operation was in progress.
    [ 1.334595] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
    [ 1.334599] mmc2: sdhci: Sys addr: 0xa05dcc00 | Version: 0x00000002
    [ 1.340819] lib80211: common routines for IEEE802.11 drivers
    [ 1.345538] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000000
    [ 1.345541] mmc2: sdhci: Argument: 0x00018000 | Trn mode: 0x00000033
    [ 1.345543] mmc2: sdhci: Present: 0x01f88008 | Host ctl: 0x00000031
    [ 1.345547] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080
    [ 1.357903] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x0000003f
    [ 1.357905] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00000000
    [ 1.357908] mmc2: sdhci: Int enab: 0x107f100b | Sig enab: 0x107f100b
    [ 1.357911] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502
    [ 1.370268] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400
    [ 1.370270] mmc2: sdhci: Cmd: 0x00000d1a | Max curr: 0x00ffffff
    [ 1.370273] mmc2: sdhci: Resp[0]: 0x00000b00 | Resp[1]: 0xffffffff
    [ 1.370276] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00
    [ 1.382132] mmc2: sdhci: Host ctl2: 0x00000000
    [ 1.382135] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0xa2040208

    [ 2.060932] mmc2: Unexpected interrupt 0x00004000.
    [ 2.065538] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
    [ 2.071720] mmc2: sdhci: Sys addr: 0x00000000 | Version: 0x00000002
    [ 2.077902] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000001
    [ 2.084083] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000000
    [ 2.090264] mmc2: sdhci: Present: 0x01f88009 | Host ctl: 0x00000011
    [ 2.096446] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080
    [ 2.102627] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x000010ff
    [ 2.108809] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00004000
    [ 2.114990] mmc2: sdhci: Int enab: 0x007f1003 | Sig enab: 0x007f1003
    [ 2.121171] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502
    [ 2.127353] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400
    [ 2.133534] mmc2: sdhci: Cmd: 0x0000371a | Max curr: 0x00ffffff
    [ 2.139715] mmc2: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff
    [ 2.145896] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00
    [ 2.152077] mmc2: sdhci: Host ctl2: 0x00000000
    [ 2.156342] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x00000000

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • Since L4.15, community involve the commit 105819c8a545 ("mmc: core: use mrq->sbc
    when sending CMD23 for RPMB"), let the usdhc to decide whether to use ACMD23 for
    RPMB. This CMD23 for RPMB need to set the bit 31 to its argument, if not, the
    RPMB write operation will return general fail.

    According to the sdhci logic, SDMA mode will disable the ACMD23, and only in
    ADMA mode, it will chose to use ACMD23 if the host support. But according to
    debug, and confirm with IC, the imx6qpdl/imx6sx/imx6sl/imx7d do not support
    the ACMD23 feature completely. These SoCs only use the 16 bit block count of
    the register 0x4 (BLOCK_ATT) as the CMD23's argument in ACMD23 mode, which
    means it will ignore the upper 16 bit of the CMD23's argument. This will block
    the reliable write operation in RPMB, because RPMB reliable write need to set
    the bit31 of the CMD23's argument. This is the hardware limitation. Due to
    imx6sl use SDMA, so for imx6qpdl/imx6sx/imx7d, it need to broke the ACMD23 for
    eMMC, SD card do not has this limitation, because SD card do not support reliable
    write.

    For imx6ul/imx6ull/imx6sll/imx7ulp/imx8, it support the ACMD23 completely, it
    change to use the 0x0 register (DS_ADDR) to put the CMD23's argument in ADMA mode.

    This patch handle 'auto-cmd23-broken' from devicetree.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • i.MX8MM contains USDHC which support eMMC V5.1 (including CMDQ and
    HS400ES), besides i.MX8MM also support bus frequency, so add a new
    esdhc_soc_data for i.MX8MM.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • Request BUS_FREQ_HIGH when bus is busy and then release BUS_FREQ_HIGH
    when bus becomes idle.

    Signed-off-by: Haibo Chen

    Haibo Chen