linux-uconsole/drivers/mmc/host
Evgeniy Didin 192b050c35 UPSTREAM: mmc: dw_mmc: Fix the DTO/CTO timeout overflow calculation for 32-bit systems
The commit 9d9491a7da ("mmc: dw_mmc: Fix the DTO timeout calculation")
and commit 4c2357f57d ("mmc: dw_mmc: Fix the CTO timeout calculation")
made changes, which cause multiply overflow for 32-bit systems. The
broken
timeout calculations leads to unexpected ETIMEDOUT errors and causes
stacktrace splat (such as below) during normal data exchange with
SD-card.

| Running :  4M-check-reassembly-tcp-cmykw2-rotatew2.out -v0 -w1
| -  Info: Finished target initialization.
| mmcblk0: error -110 transferring data, sector 320544, nr 2048, cmd
| response 0x900, card status 0x0

DIV_ROUND_UP_ULL helps to escape usage of __udivdi3() from libgcc and so
code gets compiled on all 32-bit platforms as opposed to usage of
DIV_ROUND_UP when we may only compile stuff on a very few arches.

Lets cast this multiply to u64 type to prevent the overflow.

Change-Id: I45462bac22f946c5129eab0e0d5b22b3ed7ca19d
Fixes: 9d9491a7da ("mmc: dw_mmc: Fix the DTO timeout calculation")
Fixes: 4c2357f57d ("mmc: dw_mmc: Fix the CTO timeout calculation")
Tested-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> # ARC STAR
9001306872 HSDK, sdio: board crashes when copying big files
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Cc: <stable@vger.kernel.org> # 4.14
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from c715160225)
2018-03-07 08:46:47 +08:00
..
android-goldfish.c mmc: android-goldfish: remove incorrect __iomem annotation 2015-09-01 14:19:11 +02:00
atmel-mci-regs.h
atmel-mci.c rk: revert to v3.10 2015-11-11 15:57:28 +08:00
au1xmmc.c
bfin_sdh.c
cb710-mmc.c
cb710-mmc.h
davinci_mmc.c mmc: davinci: Constify platform_device_id 2015-06-01 09:06:49 +02:00
dw_mmc-exynos.c mmc: mmc: extend the mmc_send_tuning() 2015-10-27 10:38:41 +01:00
dw_mmc-exynos.h
dw_mmc-k3.c mmc: dw_mmc: k3: Fix modalias to make module auto-loading work 2015-06-01 09:07:05 +02:00
dw_mmc-pci.c
dw_mmc-pltfm.c mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference 2016-11-10 16:36:35 +01:00
dw_mmc-pltfm.h rk: temp revert rk change 2015-11-11 15:54:30 +08:00
dw_mmc-rockchip.c mmc: dw_mmc-rockchip: add MMC_CAP_CMD23 capabilities 2016-05-30 17:33:38 +08:00
dw_mmc.c UPSTREAM: mmc: dw_mmc: Fix the DTO/CTO timeout overflow calculation for 32-bit systems 2018-03-07 08:46:47 +08:00
dw_mmc.h mmc: dw_mmc: fix the CardThreshold boundary at CardThrCtl register 2015-10-29 11:00:37 +01:00
jz4740_mmc.c rk: temp revert rk change 2015-11-11 15:54:30 +08:00
Kconfig mmc: sdhci-acpi: Reduce Baytrail eMMC/SD/SDIO hangs 2016-09-07 08:32:37 +02:00
Makefile mmc: porting legacy tactices into develop-4.4 2015-11-25 14:03:32 +08:00
mmc_spi.c mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case 2016-04-12 09:09:01 -07:00
mmci.c mmc: mmci: fix an ages old detection error 2016-03-03 15:07:15 -08:00
mmci.h
mmci_qcom_dml.c
mmci_qcom_dml.h
moxart-mmc.c mmc: moxart: Fix module autoload for OF platform driver 2015-10-26 15:59:57 +01:00
mtk-sd.c mmc: mediatek: Fixed bug where clock frequency could be set wrong 2017-12-20 10:04:55 +01:00
mvsdio.c rk: temp revert rk change 2015-11-11 15:54:30 +08:00
mvsdio.h
mxcmmc.c mmc: host: mxcmmc: Simplify a trivial if-return sequence 2015-06-01 09:07:02 +02:00
mxs-mmc.c mmc: mxs-mmc: Fix additional cycles after transmission stop 2017-01-26 08:23:48 +01:00
of_mmc_spi.c
omap.c mmc: omap: Fix module autoload for OF platform driver 2015-10-26 15:59:58 +01:00
omap_hsmmc.c mmc: host: omap_hsmmc: Fix MMC for omap3 legacy booting 2015-10-08 09:36:13 +02:00
pxamci.c mmc: pxamci: fix potential oops 2016-10-07 15:23:41 +02:00
pxamci.h
rk_sdmmc.h mmc: rk_sdmmc: support RK3228 chip 2015-11-10 10:55:33 +08:00
rk_sdmmc_dbg.c
rk_sdmmc_dbg.h
rk_sdmmc_ops.c mmc: host: rk_sdmmc_ops: fix area access error 2017-05-25 20:07:45 +08:00
rtsx_pci_sdmmc.c rk: revert to v3.10 2015-11-11 15:57:28 +08:00
rtsx_usb_sdmmc.c mmc: rtsx_usb_sdmmc: Handle runtime PM while changing the led 2016-10-28 03:01:35 -04:00
s3cmci.c mmc: s3cmci: include linux/interrupt.h for tasklet_struct 2017-11-08 10:06:28 +01:00
s3cmci.h
sdhci-acpi.c mmc: sdhci-acpi: Reduce Baytrail eMMC/SD/SDIO hangs 2016-09-07 08:32:37 +02:00
sdhci-bcm-kona.c mmc: sdhci-bcm-kona: fix logic to check for 8-bit data width 2015-10-26 15:59:55 +01:00
sdhci-bcm2835.c mmc: sdhci-bcm2835: Actually enable the clock 2015-06-01 09:56:07 +02:00
sdhci-cns3xxx.c
sdhci-dove.c
sdhci-esdhc-imx.c mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for DDR50 card 2017-04-27 09:09:33 +02:00
sdhci-esdhc.h rk: revert to v3.10 2015-11-11 15:57:28 +08:00
sdhci-iproc.c mmc: sdhci-iproc: suppress spurious interrupt with Multiblock read 2017-06-07 12:06:00 +02:00
sdhci-msm.c mmc: mmc: extend the mmc_send_tuning() 2015-10-27 10:38:41 +01:00
sdhci-of-arasan.c mmc: sdhci-of-arasan: add sdhci_arasan_voltage_switch for arasan,5.1 2016-09-23 17:10:28 +08:00
sdhci-of-at91.c mmc: sdhci-of-at91: remove a line of dead code 2015-10-26 15:59:56 +01:00
sdhci-of-esdhc.c mmc: sdhci-of-esdhc: add/remove some quirks according to vendor version 2018-01-31 12:06:09 +01:00
sdhci-of-hlwd.c
sdhci-pci-core.c mmc: sdhci-pci: Remove MMC_CAP_BUS_WIDTH_TEST for Intel controllers 2016-06-01 12:15:50 -07:00
sdhci-pci-data.c mmc: sdhci-pci: Add support for drive strength selection for SPT 2015-06-01 09:07:14 +02:00
sdhci-pci-o2micro.c mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci-o2micro.h mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci.h mmc: sdhci-pci: Add support and PCI IDs for more Broxton host controllers 2016-04-20 15:42:14 +09:00
sdhci-pltfm.c mmc: sdhci-pltfm: Use of_property_read_u32 instead of open-coding it 2015-10-26 15:59:57 +01:00
sdhci-pltfm.h
sdhci-pxav2.c mmc: sdhci-{pxav2,pxav3}: Use of_match_ptr() macro 2015-06-01 09:06:53 +02:00
sdhci-pxav3.c rk: revert to v3.10 2015-11-11 15:57:28 +08:00
sdhci-s3c-regs.h
sdhci-s3c.c mmc: sdhci-s3c: Constify platform_device_id 2015-06-01 09:06:52 +02:00
sdhci-sirf.c rk: temp revert rk change 2015-11-11 15:54:30 +08:00
sdhci-spear.c Update Viresh Kumar's email address 2015-07-17 16:39:53 -07:00
sdhci-st.c mmc: sdhci-st: Fix modalias to make module auto-loading work 2015-06-01 09:07:07 +02:00
sdhci-tegra.c
sdhci.c Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git 2017-05-06 14:23:00 +08:00
sdhci.h mmc: sdhci: 64-bit DMA actually has 4-byte alignment 2016-09-15 08:27:44 +02:00
sdhci_f_sdh30.c mmc: sdhci_f_sdh30: Fix the size passed to sdhci_alloc_host 2015-06-01 09:06:46 +02:00
sdricoh_cs.c
sh_mmcif.c mmc: sh_mmcif: Correct TX DMA channel allocation 2016-04-12 09:08:32 -07:00
sh_mobile_sdhi.c
sunxi-mmc.c mmc: sunxi: Add card busy detection 2015-10-26 16:00:02 +01:00
tifm_sd.c
tmio_mmc.c mmc: TMIO: Use devm_request_irq() 2015-06-01 09:06:48 +02:00
tmio_mmc.h
tmio_mmc_dma.c rk: revert to v3.10 2015-11-11 15:57:28 +08:00
tmio_mmc_pio.c rk: temp revert rk change 2015-11-11 15:54:30 +08:00
toshsd.c
toshsd.h
usdhi6rol0.c mmc: usdhi6rol0: handle NULL data in timeout 2016-03-03 15:07:15 -08:00
ushc.c mmc: ushc: fix NULL-deref at probe 2017-03-30 09:35:17 +02:00
via-sdmmc.c
vub300.c mmc: vub300: Remove unneded semicolons 2015-10-26 15:59:54 +01:00
wbsd.c mmc: wbsd: Remove unneded semicolon 2015-10-26 15:59:53 +01:00
wbsd.h
wmt-sdmmc.c