Commit Graph

8374 Commits

Author SHA1 Message Date
Andrea della Porta
78d08697e3 mmc: sdhci-brcmstb: Add BCM2712 support
Broadcom BCM2712 SoC has an SDHCI card controller using the SDIO CFG
register block present on other STB chips. Add support for BCM2712
SD capabilities of this chipset.
The silicon is SD Express capable but this driver port does not currently
include that feature yet.
Based on downstream driver by raspberry foundation maintained kernel.

Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/ad2ec39c62c2783dd5de4bf2ec581866e822e2b1.1717061147.git.andrea.porta@suse.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-06-20 10:59:28 +02:00
Linus Torvalds
8b06f7538a MMC core:
- Increase the timeout period of the ACMD41 command
  - Add card entry for quirks to debugfs
  - Add mmc_gpiod_set_cd_config() function
  - Store owner from SDIO modules with sdio_register_driver()
 
 MMC host:
  - atmel-mci: Some cleanups and a switch to use dev_err_probe()
  - renesas_sdhi: Add support for RZ/G2L, RZ/G3S and RZ/V2M variants
  - renesas_sdhi: Set the SDBUF after reset
  - sdhci: Add support for "Tuning Error" interrupts
  - sdhci-acpi: Add quirk to enable pull-up on the card-detect GPIO on Asus T100TA
  - sdhci-acpi: Disable write protect detection on Toshiba WT10-A
  - sdhci-acpi: Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working
  - sdhci_am654: Re-work and fix the tuning support for multiple speed-modes
  - sdhci_am654: Add tuning algorithm for delay chain
  - sdhci-esdhc-imx: Add NXP S32G3 support
  - sdhci-of-dwcmshc: Add tuning support for Sophgo CV1800B and SG200X
  - sdhci-of-dwcmshc: Implement SDHCI CQE support
  - sdhci-pci-gli: Use the proper pci_set_power_state() instead of PMCSR writes
 
 MEMSTICK:
  - Convert a couple of drivers to use the ->remove_new() callback
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmZGI0UXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCk0Bw//cSgatLPu9ypQv8N2pIL9FTBR
 0Y7cwoQmEp35WArHUl+ouqN9It8FHKUB55jmBTv1STd9Rf+VMKlCCRODYjVZwcTV
 cQRlIx6iAwvVyNr8JY1V9nfpgYnHCtd1uJJXqBm1d3p7cU3RQl6Bnn/0WxOgcCxT
 jUwR4VeMj6m+g9q9vck5+PFVZ4plznygzcJ6mIBtWSiQj8/XpYS1TaoYX4bxCfB7
 vESICzp4+VpK8SbJzxtfcLL+SGU2HIpHhFOW7vsI2pY+Tf4wu2QDyB/6od5RxfDY
 xC8mCRFp+WpG5Txvb0kbbf9munFCTl+xiXemqIlCZ4gsmjPNhtPhp2xeJhL1e9yI
 s9C20SCABgS0AbV0AmS+vQNe9cEL1/rFOjaNZi1scseVTSxsDr7YHTp3bPs8C/rs
 JZgjmxBmnQfmSwKjRuv9Rj77L3VD4RcMzrc0SQ0PjXEivtf/m636AVlbiytCRrTo
 BlqoIOoWBXUkoKiFCJn5ne63jGRRjYv5BhZaVmeaYVvbooQhaFpzBRkozoExm8Mk
 ZiY2HdUY5uDdwWVPyldP/f9PHIJAAKdzbPf0K6sQBDJgzzH5OMT39SdxDQ9rAAUl
 RO03A2Ntkx9eFZOo/4TjShI1rCKOVXytoB3sjONSCBFg+teYUdpmDvbZXtAcqJWV
 Sowz+pVjVkiefXBLGgg=
 =I2JP
 -----END PGP SIGNATURE-----

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

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Increase the timeout period of the ACMD41 command
   - Add card entry for quirks to debugfs
   - Add mmc_gpiod_set_cd_config() function
   - Store owner from SDIO modules with sdio_register_driver()

  MMC host:
   - atmel-mci: Some cleanups and a switch to use dev_err_probe()
   - renesas_sdhi:
      - Add support for RZ/G2L, RZ/G3S and RZ/V2M variants
      - Set the SDBUF after reset
   - sdhci: Add support for "Tuning Error" interrupts
   - sdhci-acpi:
      - Add quirk to enable pull-up on the card-detect GPIO on Asus
        T100TA
      - Disable write protect detection on Toshiba WT10-A
      - Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working
   - sdhci_am654:
      - Re-work and fix the tuning support for multiple speed-modes
      - Add tuning algorithm for delay chain
   - sdhci-esdhc-imx: Add NXP S32G3 support
   - sdhci-of-dwcmshc:
      - Add tuning support for Sophgo CV1800B and SG200X
      - Implement SDHCI CQE support
   - sdhci-pci-gli: Use the proper pci_set_power_state() instead of
     PMCSR writes"

  MEMSTICK:
   - Convert a couple of drivers to use the ->remove_new() callback"

* tag 'mmc-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (59 commits)
  mmc: renesas_sdhi: Add compatible string for RZ/G2L family, RZ/G3S, and RZ/V2M SoCs
  dt-bindings: mmc: renesas,sdhi: Document RZ/G2L family compatibility
  dt-bindings: mmc: renesas,sdhi: Group single const value items into an enum list
  mmc: renesas_sdhi: Set the SDBUF after reset
  mmc: core: Increase the timeout period of the ACMD41 command
  mmc: core: Convert to use __mmc_poll_for_busy() SD_APP_OP_COND too
  mmc: atmel-mci: Switch to use dev_err_probe()
  mmc: atmel-mci: Incapsulate used to be a platform data into host structure
  mmc: atmel-mci: Replace platform device pointer by generic one
  mmc: atmel-mci: Use temporary variable for struct device
  mmc: atmel-mci: Get rid of platform data leftovers
  mmc: sdhci-of-dwcmshc: Add tuning support for Sophgo CV1800B and SG200X
  mmc: sdhci-of-dwcmshc: Remove useless "&" of th1520_execute_tuning
  mmc: sdhci-s3c: Choose sdhci_ops based on variant
  mmc: sdhci_am654: Constify struct sdhci_ops
  mmc: sdhci-sprd: Constify struct sdhci_ops
  mmc: sdhci-omap: Constify struct sdhci_ops
  mmc: sdhci-esdhc-mcf: Constify struct sdhci_ops
  mmc: slot-gpio: Use irq_handler_t type
  mmc: sdhci-acpi: Add quirk to enable pull-up on the card-detect GPIO on Asus T100TA
  ...
2024-05-16 08:56:49 -07:00
Rafael J. Wysocki
440f9d47df Merge branches 'pm-cpuidle', 'pm-sleep' and 'pm-powercap'
Merge cpuidle updates, changes related to system sleep and power capping
updates for 6.10:

 - Fix kerneldoc description of ladder_do_selection() (Jeff Johnson).

 - Convert the cpuidle kirkwood driver to platform remove callback
   returning void (Yangtao Li).

 - Replace deprecated strncpy() with strscpy() in the hibernation core
   code (Justin Stitt).

 - Use %ps to simplify debug output in the core system-wide suspend and
   resume code (Len Brown).

 - Remove unnecessary else from device_init_wakeup() and make
   device_wakeup_disable() return void (Dhruva Gole).

 - Enable PMU support in the Intel TPMI RAPL driver (Zhang Rui).

 - Add support for ArrowLake-H platform to the Intel RAPL driver (Zhang
   Rui).

 - Avoid explicit cpumask allocation on stack in DTPM (Dawei Li).

* pm-cpuidle:
  cpuidle: ladder: fix ladder_do_selection() kernel-doc
  cpuidle: kirkwood: Convert to platform remove callback returning void

* pm-sleep:
  PM: hibernate: replace deprecated strncpy() with strscpy()
  PM: sleep: Take advantage of %ps to simplify debug output
  PM: wakeup: Remove unnecessary else from device_init_wakeup()
  PM: wakeup: make device_wakeup_disable() return void

* pm-powercap:
  powercap: intel_rapl_tpmi: Enable PMU support
  powercap: intel_rapl: Introduce APIs for PMU support
  powercap: intel_rapl: Sort header files
  powercap: intel_rapl: Add support for ArrowLake-H platform
  powercap: DTPM: Avoid explicit cpumask allocation on stack
2024-05-13 20:14:10 +02:00
Lad Prabhakar
35eea0defb mmc: renesas_sdhi: Add compatible string for RZ/G2L family, RZ/G3S, and RZ/V2M SoCs
- RZ/G2UL and RZ/Five ("r9a07g043")
- RZ/G2L(C) ("r9a07g044")
- RZ/V2L ("r9a07g054")
- RZ/G3S ("r9a08g045")
- RZ/V2M ("r9a09g011")

The above SoCs have HS400 disabled and use fixed address mode. Add a
generic compatible 'renesas,rzg2l-sdhi' fallback string for these SoCs,
where fixed_addr_mode and hs400_disabled quirks are applied.

For backward compatibility, compatible string 'renesas,sdhi-r9a09g011' for
RZ/V2M is retained.

Also rename sdhi_quirks_r9a09g011->sdhi_quirks_rzg2l and
of_r9a09g011_compatible->of_rzg2l_compatible to make it generic.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430145937.133643-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-05-03 14:33:05 +02:00
Claudiu Beznea
68dbe38ed7 mmc: renesas_sdhi: Set the SDBUF after reset
For development purpose, renesas_sdhi_probe() could be called w/
dma_ops = NULL to force the usage of PIO mode. In this case the
renesas_sdhi_enable_dma() will not be called before transferring data.

If renesas_sdhi_enable_dma() is not called, renesas_sdhi_clk_enable()
call from renesas_sdhi_probe() will configure SDBUF by calling the
renesas_sdhi_sdbuf_width() function, but then SDBUF will be reset in
tmio_mmc_host_probe() when calling tmio_mmc_reset() though host->reset().
If SDBUF is zero the data transfer will not work in PIO mode for RZ/G3S.

To fix this call again the renesas_sdhi_sdbuf_width(host, 16) in
renesas_sdhi_reset(). The call of renesas_sdhi_sdbuf_width() was not
removed from renesas_sdhi_clk_enable() as the host->reset() is optional.

Co-developed-by: Hien Huynh <hien.huynh.px@renesas.com>
Signed-off-by: Hien Huynh <hien.huynh.px@renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430093724.2692232-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-05-03 14:30:49 +02:00
Felix Qin
ef65b1fdd1 mmc: core: Increase the timeout period of the ACMD41 command
Extensive testing has shown that some specific SD cards require an
increased command timeout to be successfully initialized.

More info:
Platform: Rockchip SoC + DW Multimedia host Controller
SD card: Xvv microSD CMH34A17TMA12 (Made in Korea)
Note: The SD card is custom-made by the customer in collaboration
with the wafer foundry.

Signed-off-by: Felix Qin <xiaokeqinhealth@126.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Link: https://lore.kernel.org/r/20240429071955.163282-1-xiaokeqinhealth@126.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-05-03 14:28:27 +02:00
Ulf Hansson
3ae4f2657b mmc: core: Convert to use __mmc_poll_for_busy() SD_APP_OP_COND too
Similar to what has already been changed for eMMC and the MMC_SEND_OP_COND
(CMD1), let's convert the SD_APP_OP_COND (ACMD41) for SD cards to use the
common __mmc_poll_for_busy() too.

This change means the initial delay period, that starts as 10ms will now
increase for every loop when being busy. The total accepted timeout for
being busy is 1s, which is according to the SD spec.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Felix Qin <xiaokeqinhealth@126.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Link: https://lore.kernel.org/r/20240425133034.79599-1-ulf.hansson@linaro.org
2024-05-03 14:27:55 +02:00
Linus Torvalds
4630932a55 MMC host:
- moxart: Fix regression for sg_miter for PIO mode
  - sdhci-msm: Avoid hang by preventing access to suspended controller
  - sdhci-of-dwcmshc: Fix SD card tuning error for th1520
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmYsBW4XHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjClo4A/+OccOI5V64s/INp2D9VdP3aRj
 8bSlK0wp6cnMXVdFpYYItM/HvHlsd0ACHNyDSIqbZ5uh2qHUvNnthBnZ61zZGKTk
 I60if0iOg0NS5MnWWy2J4L/djq3xMF+tqAvBsD3UcgaUcpfyvggR7AdmzPsfBawy
 BBQUnELu2LUpRHU7mmJ3gnkXemjdOL1BSvtH24o9tf4Tz/1u7sCjI45eNd9hKnrD
 GT7CAqCwVhJtcuQl2AH/2/jV/r6Ffsek3JbHtAbYPDQMh3Y7U+bj8DtHxxX4+pGn
 OEIrUCHH/1xXajVAaX62TeX1gbszNCKye2VxCQxeCnfo9ocptP3aG0pcOCSJG8JN
 mLett85SK/IKmveQSmSh5qOUpRS677T2uF/O1mBeoqFHMWeao5Nvu0bZMtABqp/+
 T7dGldPj+IvksP1qc1naB0K+Iz4xJfbZNARz3WHPsxw9WIBIHLGrteqSDHH0Js1U
 A5jVMqfChtETMTKGcfmjKZEO5x0knK8gOuhel4jY35M2BZuQqdZ4P0af4c+qok0I
 FUQ7Dm+3wqUqrRHNz34Yk6Zu6f7GyHmqrxGxAvY27lI6zOIOjkDDuluBOP1htbDp
 TBw/DRX51AfXaJDjclsVeYDWfY+j7OMwC6KXonrfz97EAwHr0TJ3VpBgj5QxmIbc
 /JObflLakgaC+gKx+iM=
 =lioY
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC host fixes from Ulf Hansson:

 - moxart: Fix regression for sg_miter for PIO mode

 - sdhci-msm: Avoid hang by preventing access to suspended controller

 - sdhci-of-dwcmshc: Fix SD card tuning error for th1520

* tag 'mmc-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: moxart: fix handling of sgm->consumed, otherwise WARN_ON triggers
  mmc: sdhci-of-dwcmshc: th1520: Increase tuning loop count to 128
  mmc: sdhci-msm: pervent access to suspended controller
2024-04-26 13:17:33 -07:00
Andy Shevchenko
e38063b943 mmc: atmel-mci: Switch to use dev_err_probe()
Switch to use dev_err_probe() to simplify the error path and
unify a message template.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240425170900.3767990-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:51:09 +02:00
Andy Shevchenko
0a454e9523 mmc: atmel-mci: Incapsulate used to be a platform data into host structure
After platform data is gone, we always allocate memory for the slot
information. Incapsulate the array of the latter into the host structure,
so we allocate memory only once. This makes code simpler.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240425170900.3767990-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:51:09 +02:00
Ulf Hansson
0b7b565d10 mmc: Merge branch fixes into next
Merge the mmc fixes for v6.9-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.10.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:09 +02:00
Andy Shevchenko
d07ebeaa65 mmc: atmel-mci: Replace platform device pointer by generic one
There no need to keep a pointer to a platform device as it's not
used outside of ->probe() and ->remove() callbacks.

Replace platform device pointer by generic one in host structure.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240417165708.2965612-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Andy Shevchenko
5c30bd24a8 mmc: atmel-mci: Use temporary variable for struct device
Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240417165708.2965612-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Andy Shevchenko
ba7916180e mmc: atmel-mci: Get rid of platform data leftovers
The commit d2c6d518c2 ("mmc: atmel-mci: move atmel MCI header file")
made sure that there is no in-kernel user of the platform data. But
at the same time it hadn't removed the code around that data structure.
Finish the job here and remove a dead code.

Fixes: d2c6d518c2 ("mmc: atmel-mci: move atmel MCI header file")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240417165708.2965612-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Jisheng Zhang
b1b661c47c mmc: sdhci-of-dwcmshc: Add tuning support for Sophgo CV1800B and SG200X
Implement the .platform_execute_tuning for Sophgo CV1800B and SG200X.
Some code is borrowed from sdhci-esdhc-imx.c. The tuning result is
similar as the one of SoC vendor's SDK.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240420021429.454-1-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Jisheng Zhang
7a5149d3ce mmc: sdhci-of-dwcmshc: Remove useless "&" of th1520_execute_tuning
The preceding "&" before th1520_execute_tuning is useless, remove it.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240414164357.2841-1-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Krzysztof Kozlowski
e4c0277902 mmc: sdhci-s3c: Choose sdhci_ops based on variant
The difference between old S3C64xx and newer Exynos4 SDHCI controller
variants is in clock handling (the "no_divider" field in drvdata).
Choose the proper sdhci_ops based on the variant instead of patching
ops in probe, if Exynos4 is used.

This allows making struct sdhci_ops const for code safety and probably
opens further options in the future, as the dynamic pointer ops table is
not anymore that dynamic.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240414-mmc-const-sdhci-ops-v2-5-262f81faadac@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Krzysztof Kozlowski
24922c1a5c mmc: sdhci_am654: Constify struct sdhci_ops
The local struct sdhci_ops can be made const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240414-mmc-const-sdhci-ops-v2-4-262f81faadac@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Krzysztof Kozlowski
8fc516cb22 mmc: sdhci-sprd: Constify struct sdhci_ops
The local struct sdhci_ops can be made const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240414-mmc-const-sdhci-ops-v2-3-262f81faadac@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Krzysztof Kozlowski
c5daec6479 mmc: sdhci-omap: Constify struct sdhci_ops
The local struct sdhci_ops can be made const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240414-mmc-const-sdhci-ops-v2-2-262f81faadac@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Krzysztof Kozlowski
bdbb201a61 mmc: sdhci-esdhc-mcf: Constify struct sdhci_ops
The local struct sdhci_ops can be made const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240414-mmc-const-sdhci-ops-v2-1-262f81faadac@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Andy Shevchenko
6faaea2c70 mmc: slot-gpio: Use irq_handler_t type
The irq_handler_t is already defined globally, let's use it
in slot-gpio code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Link: https://lore.kernel.org/r/20240410195618.1632778-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:47:04 +02:00
Hans de Goede
431946c0f6 mmc: sdhci-acpi: Add quirk to enable pull-up on the card-detect GPIO on Asus T100TA
The card-detect GPIO for the microSD slot on Asus T100TA / T100TAM models
stopped working under Linux after commit 6fd03f0248 ("gpiolib: acpi:
support bias pull disable").

The GPIO in question is connected to a mechanical switch in the slot
which shorts the pin to GND when a card is inserted.

The GPIO pin correctly gets configured with a 20K pull-up by the BIOS,
but there is a bug in the DSDT where the GpioInt for the card-detect is
configured with a PullNone setting:

    GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x2710,
        "\\_SB.GPO0", 0x00, ResourceConsumer, ,
        )
        {   // Pin list
        0x0026
        }

Linux now actually honors the PullNone setting and disables the 20K pull-up
configured by the BIOS.

Add a new DMI_QUIRK_SD_CD_ENABLE_PULL_UP quirk which when set calls
mmc_gpiod_set_cd_config() to re-enable the pull-up and set this for
the Asus T100TA models to fix this.

Fixes: 6fd03f0248 ("gpiolib: acpi: support bias pull disable")
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-7-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:58 +02:00
Hans de Goede
ef3eab75e1 mmc: sdhci-acpi: Disable write protect detection on Toshiba WT10-A
On the Toshiba WT10-A the microSD slot always reports the card being
write-protected, just like on the Toshiba WT8-B.

Add a DMI quirk to work around this.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-6-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:47 +02:00
Hans de Goede
f3521d7cba mmc: sdhci-acpi: Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working
The Lenovo Yoga Tablet 2 Pro 1380 sdcard slot has an active high cd pin
and a broken wp pin which always reports the card being write-protected.

Add a DMI quirk to address both issues.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-5-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:43 +02:00
Hans de Goede
a92a73b1d9 mmc: sdhci-acpi: Sort DMI quirks alphabetically
Sort the DMI quirks alphabetically.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-4-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:38 +02:00
Adrian Hunter
b3855668d9 mmc: sdhci: Add support for "Tuning Error" interrupts
Most Bay Trail devices do not enable UHS modes for the external sdcard slot
the Lenovo Yoga Tablet 2 830 / 1050 and Lenovo Yoga Tablet 2 Pro 1380 (8",
10" and 13") models however do enable this.

Using a UHS cards in these tablets results in errors like this one:

[  225.272001] mmc2: Unexpected interrupt 0x04000000.
[  225.272024] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  225.272034] mmc2: sdhci: Sys addr:  0x0712c400 | Version:  0x0000b502
[  225.272044] mmc2: sdhci: Blk size:  0x00007200 | Blk cnt:  0x00000007
[  225.272054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000023
[  225.272064] mmc2: sdhci: Present:   0x01e20002 | Host ctl: 0x00000016
[  225.272073] mmc2: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[  225.272082] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000107
[  225.272092] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000001
[  225.272101] mmc2: sdhci: Int enab:  0x03ff000b | Sig enab: 0x03ff000b
[  225.272110] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001
[  225.272119] mmc2: sdhci: Caps:      0x076864b2 | Caps_1:   0x00000004
[  225.272129] mmc2: sdhci: Cmd:       0x00000c1b | Max curr: 0x00000000
[  225.272138] mmc2: sdhci: Resp[0]:   0x00000c00 | Resp[1]:  0x00000000
[  225.272147] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000900
[  225.272155] mmc2: sdhci: Host ctl2: 0x0000000c
[  225.272164] mmc2: sdhci: ADMA Err:  0x00000003 | ADMA Ptr: 0x0712c200
[  225.272172] mmc2: sdhci: ============================================

which results in IO errors leading to issues accessing the sdcard.

0x04000000 is a so-called "Tuning Error" which sofar the SDHCI driver
does not support / enable. Modify the IRQ handler to process these.

This fixes UHS microsd cards not working with these tablets.

Link: https://lore.kernel.org/r/199bb4aa-c6b5-453e-be37-58bbf468800c@intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-3-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:27 +02:00
Hans de Goede
63a7cd6602 mmc: core: Add mmc_gpiod_set_cd_config() function
Some mmc host drivers may need to fixup a card-detection GPIO's config
to e.g. enable the GPIO controllers builtin pull-up resistor on devices
where the firmware description of the GPIO is broken (e.g. GpioInt with
PullNone instead of PullUp in ACPI DSDT).

Since this is the exception rather then the rule adding a config
parameter to mmc_gpiod_request_cd() seems undesirable, so instead
add a new mmc_gpiod_set_cd_config() function. This is simply a wrapper
to call gpiod_set_config() on the card-detect GPIO acquired through
mmc_gpiod_request_cd().

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240410191639.526324-2-hdegoede@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-26 06:46:02 +02:00
Sergei Antonov
e027e72ecc mmc: moxart: fix handling of sgm->consumed, otherwise WARN_ON triggers
When e.g. 8 bytes are to be read, sgm->consumed equals 8 immediately after
sg_miter_next() call. The driver then increments it as bytes are read,
so sgm->consumed becomes 16 and this warning triggers in sg_miter_stop():
WARN_ON(miter->consumed > miter->length);

WARNING: CPU: 0 PID: 28 at lib/scatterlist.c:925 sg_miter_stop+0x2c/0x10c
CPU: 0 PID: 28 Comm: kworker/0:2 Tainted: G        W          6.9.0-rc5-dirty #249
Hardware name: Generic DT based system
Workqueue: events_freezable mmc_rescan
Call trace:.
 unwind_backtrace from show_stack+0x10/0x14
 show_stack from dump_stack_lvl+0x44/0x5c
 dump_stack_lvl from __warn+0x78/0x16c
 __warn from warn_slowpath_fmt+0xb0/0x160
 warn_slowpath_fmt from sg_miter_stop+0x2c/0x10c
 sg_miter_stop from moxart_request+0xb0/0x468
 moxart_request from mmc_start_request+0x94/0xa8
 mmc_start_request from mmc_wait_for_req+0x60/0xa8
 mmc_wait_for_req from mmc_app_send_scr+0xf8/0x150
 mmc_app_send_scr from mmc_sd_setup_card+0x1c/0x420
 mmc_sd_setup_card from mmc_sd_init_card+0x12c/0x4dc
 mmc_sd_init_card from mmc_attach_sd+0xf0/0x16c
 mmc_attach_sd from mmc_rescan+0x1e0/0x298
 mmc_rescan from process_scheduled_works+0x2e4/0x4ec
 process_scheduled_works from worker_thread+0x1ec/0x24c
 worker_thread from kthread+0xd4/0xe0
 kthread from ret_from_fork+0x14/0x38

This patch adds initial zeroing of sgm->consumed. It is then incremented
as bytes are read or written.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Fixes: 3ee0e7c3e6 ("mmc: moxart-mmc: Use sg_miter for PIO")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240422153607.963672-1-saproj@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-25 17:48:46 +02:00
Arnd Bergmann
06bd7e4463 GPIO regression fixes for n8x0
A series of fixes for n8x0 GPIO regressions caused by the changes to use
 GPIO descriptors.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAmYNHfIRHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXOMJw/8Cdkb5dqmEur/qYK70eUE73tN6ytvncaH
 HKzPkK3251Me/zz4+iEdyEHLfKGLmVCIAYjlfVOFxmMwBLJXgg3mUmQl2n1sfaJm
 k26EkjBBcrH1ZscLoUv7J2LmRrexWOcU2LrHvaCMvuSw6O+fvk63nu6Xn9Lm+0V6
 00PR22x7FHJVKllglhcfm+gcxFNKAwCfKitRBIPC+jDirsdj91W1L0vP5FL9qt2E
 0INfpoFr4H8IhHezOuY+i4uYuaFiazzn2usL5CaDR+7g+wsDY/oP1TBXjidWMVEY
 3VPiO/h//u7jhUKvrul+I2bZN8DUPSBt5TPImXGvBfTwRVM2pJWUzTVcrAXB4BV9
 qx32rC1s0wUHSbit2d5vECjjO90xQrLLwWwfegQ7M1ALi5ZFKBEU2wq6GTMKkiQn
 7bleU4Dq64hqYA7klhHdSfhkXxfWLuS+3DOBRIYbZk468HoRtNrLWGJ5SoXURB8B
 1/wri5YarrDeo2J9J/AAentoQQyVJKvNpNBqPeEzGZApX0M/L0oKHSGqAQBZLTi2
 ooiRXjSNprh4sD+e1JiLwl7stqITAVtLksGLt99ZN7QZN76Sk661FF5RtqmCP+QG
 +kqildZALwVCO1qSe3q5Mboy/FxxQSdcg2+eKKK8kKIybqG7B/YTQMS30uPQNuTs
 QdmnSLuHqdA=
 =pHnd
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmYVTgEACgkQYKtH/8kJ
 UiethRAAjH6U7D1G4FjlixHcgkfLaunDCMjzqYqFLD0StMEz9yJ5wmADtO62Xsrz
 gH4dMjD0+5UOS4ogs6rsfq7QcKVE9Wy7RocbFw0ZyBQquL6+AAcDKTgWQGYOpJ0L
 9pAqgg/mBBgud+uk8B7nPt9qwTudQPKx6Ibj59UDwRfEoayYmu3X8t3qvVbO8ZOf
 nEjTsrZ43fceWE+0mODBBX5OKd2Vv6qZQH+w+ZTKymEfxvEw3VjoCZ/4KDW3JZq4
 e9eP0l8rdyjzwk709Eu1KDRkzXQLNBD0DIZUxXeyiNV2bE/nP/UUKk1lzgVhlvKZ
 mxHywXbLn9lR0Nmmdgu2opj0UvVBBKOSnJ4//f1TjRGx1SMDBmqHHFZ8YNAl7SJj
 1tDvxJI/pGYOK+BqU9Pj821wrTxjNzVedGTU6VCYyGn/r8OWbjVyOOMr01tI5LGK
 IDZ7mPeGaDQGk4bWRtACXzfBbm+HgHE3nUAzoZY9DszXi5/JaxOySAKiIq3X0LQT
 1dXfvCEX/p8GmNSCzlbavu9ucuDdNgNUXH6II3HszSLDZpDs7gt7DBkbkJ5w/rRt
 Exgstlv5xoolzYHdmD1XUfufsOPbSjHySLhqp2nTrjYKPsBRggP/dIzH+UFaCTSN
 ythuAm8i5MXyIOgZscPJGTH8aHSowp9DsX/x7a8luKRagiX4sh0=
 =m+W/
 -----END PGP SIGNATURE-----

Merge tag 'omap-for-v6.9/n8x0-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes

GPIO regression fixes for n8x0

A series of fixes for n8x0 GPIO regressions caused by the changes to use
GPIO descriptors.

* tag 'omap-for-v6.9/n8x0-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: fix USB regression on Nokia N8x0
  mmc: omap: restore original power up/down steps
  mmc: omap: fix deferred probe
  mmc: omap: fix broken slot switch lookup
  ARM: OMAP2+: fix N810 MMC gpiod table
  ARM: OMAP2+: fix bogus MMC GPIO labels on Nokia N8x0

Link: https://lore.kernel.org/r/pull-1712135932-125424@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-04-09 16:17:37 +02:00
Ulf Hansson
bce42d6108 mmc: Merge branch fixes into next
Merge the mmc fixes for v6.9-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.10.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-04 11:12:45 +02:00
Maksim Kiselev
ace323f80b mmc: sdhci-of-dwcmshc: th1520: Increase tuning loop count to 128
Fix SD card tuning error by increasing tuning loop count
from 40(MAX_TUNING_LOOP) to 128.

For some reason the tuning algorithm requires to move through all the taps
of delay line even if the THRESHOLD_MODE (bit 2 in AT_CTRL_R) is used
instead of the LARGEST_WIN_MODE.

Tested-by: Drew Fustini <drew@pdp7.com>
Tested-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 43658a542e ("mmc: sdhci-of-dwcmshc: Add support for T-Head TH1520")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240402093539.184287-1-bigunclemax@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-04 11:05:19 +02:00
Dhruva Gole
afde996a33 PM: wakeup: make device_wakeup_disable() return void
The device_wakeup_disable() call only returns an error if no dev exists,
but there's not much a user can do at that point.

Rather, make this function return void.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-04-03 16:51:37 +02:00
Ulf Hansson
c522e525eb mmc: Merge branch fixes into next
Merge the mmc fixes for v6.9-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.10.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:53:44 +02:00
Krzysztof Kozlowski
94cd101100 mmc: sdio: store owner from modules with sdio_register_driver()
Modules registering driver with sdio_register_driver() might
forget to set .owner field.  The field is used by some of other kernel
parts for reference counting (try_module_get()), so it is expected that
drivers will set it.

Solve the problem by moving this task away from the drivers to the core
code, just like we did for platform_driver in
commit 9447057eaf ("platform_device: use a macro instead of
platform_driver_register").

Since many drivers forget to set the .owner, this effectively will fix
them.  Examples of fixed drivers are: ath6kl, b43, btsdio.c, ks7010,
libertas, MediaTek WiFi drivers, Realtek WiFi drivers, rsi, siano,
wilc1000, wl1251 and more.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20240329-module-owner-sdio-v1-1-e4010b11ccaa@linaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:50:14 +02:00
Bjorn Helgaas
f9b17ffcb5 mmc: sdhci-pci-gli: Use pci_set_power_state(), not direct PMCSR writes
d7133797e9 ("mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter
ASPM L1.2") and 36ed2fd32b ("mmc: sdhci-pci-gli: A workaround to allow
GL9755 to enter ASPM L1.2") added writes to the Control register in the
Power Management Capability to put the device in D3hot and back to D0.

Use the pci_set_power_state() interface instead because these are generic
operations that don't need to be driver-specific.  Also, the PCI spec
requires some delays after these power transitions, and
pci_set_power_state() takes care of those, while d7133797e9 and
36ed2fd32b did not.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
Link: https://lore.kernel.org/r/20240327214831.1544595-3-helgaas@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:34:06 +02:00
Bjorn Helgaas
951b7ccc54 mmc: sdhci-pci-gli: Use PCI AER definitions, not hard-coded values
015c9cbcf0 ("mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of
AER") added PCI_GLI_9750_CORRERR_MASK, the offset of the AER Capability in
config space, and PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT, the
Replay Timer Timeout bit in the AER Correctable Error Status register.

Use pci_find_ext_capability() to locate the AER Capability and use the
existing PCI_ERR_COR_REP_TIMER definition to mask the bit.

This removes a little bit of unnecessarily device-specific code and makes
AER-related things more greppable.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20240327214831.1544595-2-helgaas@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:30:31 +02:00
Rouven Czerwinski
a18a70389f mmc: debugfs: add card entry for quirks
This is useful to check if a quirk has been applied for the connected
mmc card.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Link: https://lore.kernel.org/r/20240326094215.212930-2-r.czerwinski@pengutronix.de
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:25:08 +02:00
Rouven Czerwinski
a575e778b3 mmc: debugfs: convert permissions to octal
Convert the existing symbolic permissions to the octal presentation as
this is the preferred representation for debugfs permissions.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Link: https://lore.kernel.org/r/20240326094215.212930-1-r.czerwinski@pengutronix.de
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:25:08 +02:00
Mantas Pucka
f8def10f73 mmc: sdhci-msm: pervent access to suspended controller
Generic sdhci code registers LED device and uses host->runtime_suspended
flag to protect access to it. The sdhci-msm driver doesn't set this flag,
which causes a crash when LED is accessed while controller is runtime
suspended. Fix this by setting the flag correctly.

Cc: stable@vger.kernel.org
Fixes: 67e6db113c ("mmc: sdhci-msm: Add pm_runtime and system PM support")
Signed-off-by: Mantas Pucka <mantas@8devices.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:24:19 +02:00
Uwe Kleine-König
55c421b364 mmc: davinci: Don't strip remove function when driver is builtin
Using __exit for the remove function results in the remove callback being
discarded with CONFIG_MMC_DAVINCI=y. When such a device gets unbound (e.g.
using sysfs or hotplug), the driver is just removed without the cleanup
being performed. This results in resource leaks. Fix it by compiling in the
remove callback unconditionally.

This also fixes a W=1 modpost warning:

WARNING: modpost: drivers/mmc/host/davinci_mmc: section mismatch in
reference: davinci_mmcsd_driver+0x10 (section: .data) ->
davinci_mmcsd_remove (section: .exit.text)

Fixes: b4cff4549b ("DaVinci: MMC: MMC/SD controller driver for DaVinci family")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240324114017.231936-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Sergey Khimich
53ab7f7fe4 mmc: sdhci-of-dwcmshc: Implement SDHCI CQE support
For enabling CQE support just set 'supports-cqe' in your DevTree file
for appropriate mmc node.

Signed-off-by: Sergey Khimich <serghox@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240319115932.4108904-3-serghox@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Sergey Khimich
52bf134fca mmc: cqhci: Add cqhci set_tran_desc() callback
There are could be specific limitations for some mmc
controllers for setting cqhci transfer descriptors.
So add callback to allow implement driver specific function.

Signed-off-by: Sergey Khimich <serghox@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240319115932.4108904-2-serghox@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
f4a5ddddb1 mmc: sdhci_am654: Update comments in sdhci_am654_set_clock
The sdhci_am654_set_clock function is also used to enable
delay chain, therefore fix comments to be more generic in
case we are not enabling DLL.

Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-6-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
a66db8167a mmc: sdhci_am654: Fix itapdly/otapdly array type
While integer type works, the otap_del_sel and itap_del_sel
arrays are manipulated as u32, so change array types to u32.

Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-5-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
d3182932bb mmc: sdhci_am654: Fix ITAPDLY for HS400 timing
While STRB is currently used for DATA and CRC responses, the CMD
responses from the device to the host still require ITAPDLY for
HS400 timing.

Currently what is stored for HS400 is the ITAPDLY from High Speed
mode which is incorrect. The ITAPDLY for HS400 speed mode should
be the same as ITAPDLY as HS200 timing after tuning is executed.
Add the functionality to save ITAPDLY from HS200 tuning and save
as HS400 ITAPDLY.

Fixes: a161c45f29 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-8-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
9dff65bb5e mmc: sdhci_am654: Add ITAPDLYSEL in sdhci_j721e_4bit_set_clock
Add ITAPDLYSEL to sdhci_j721e_4bit_set_clock function.
This allows to set the correct ITAPDLY for timings that
do not carry out tuning.

Fixes: 1accbced1c ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-7-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
387c1bf7dc mmc: sdhci_am654: Add OTAP/ITAP delay enable
Currently the OTAP/ITAP delay enable functionality is incorrect in
the am654_set_clock function. The OTAP delay is not enabled when
timing < SDR25 bus speed mode. The ITAP delay is not enabled for
timings that do not carry out tuning.

Add this OTAP/ITAP delay functionality according to the datasheet
[1] OTAPDLYENA and ITAPDLYENA for MMC0.

[1] https://www.ti.com/lit/ds/symlink/am62p.pdf

Fixes: 8ee5fc0e0b ("mmc: sdhci_am654: Update OTAPDLY writes")
Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-4-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
d465234493 mmc: sdhci_am654: Write ITAPDLY for DDR52 timing
For DDR52 timing, DLL is enabled but tuning is not carried
out, therefore the ITAPDLY value in PHY CTRL 4 register is
not correct. Fix this by writing ITAPDLY after enabling DLL.

Fixes: a161c45f29 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-3-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00
Judith Mendez
6231d99dd4 mmc: sdhci_am654: Add tuning algorithm for delay chain
Currently the sdhci_am654 driver only supports one tuning
algorithm which should be used only when DLL is enabled. The
ITAPDLY is selected from the largest passing window and the
buffer is viewed as a circular buffer.

The new algorithm should be used when the delay chain
is enabled. The ITAPDLY is selected from the largest passing
window and the buffer is not viewed as a circular buffer.

This implementation is based off of the following paper: [1].

Also add support for multiple failing windows.

[1] https://www.ti.com/lit/an/spract9/spract9.pdf

Fixes: 13ebeae68a ("mmc: sdhci_am654: Add support for software tuning")
Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240320223837.959900-2-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-04-02 12:21:39 +02:00