Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sdio: fix the use of hard coded timeout value.

This adds reading and using of enable_timeout from the CIS

Signed-off-by: Benzi Zbit <benzi.zbit@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

authored by

Benzi Zbit and committed by
Pierre Ossman
62a7573e c71f6512

+9 -5
+6
drivers/mmc/core/sdio_cis.c
··· 129 129 /* TPLFE_MAX_BLK_SIZE */ 130 130 func->max_blksize = buf[12] | (buf[13] << 8); 131 131 132 + /* TPLFE_ENABLE_TIMEOUT_VAL, present in ver 1.1 and above */ 133 + if (vsn > SDIO_SDIO_REV_1_00) 134 + func->enable_timeout = (buf[28] | (buf[29] << 8)) * 10; 135 + else 136 + func->enable_timeout = jiffies_to_msecs(HZ); 137 + 132 138 return 0; 133 139 } 134 140
+1 -5
drivers/mmc/core/sdio_io.c
··· 76 76 if (ret) 77 77 goto err; 78 78 79 - /* 80 - * FIXME: This should timeout based on information in the CIS, 81 - * but we don't have card to parse that yet. 82 - */ 83 - timeout = jiffies + HZ; 79 + timeout = jiffies + msecs_to_jiffies(func->enable_timeout); 84 80 85 81 while (1) { 86 82 ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
+2
include/linux/mmc/sdio_func.h
··· 46 46 unsigned max_blksize; /* maximum block size */ 47 47 unsigned cur_blksize; /* current block size */ 48 48 49 + unsigned enable_timeout; /* max enable timeout in msec */ 50 + 49 51 unsigned int state; /* function state */ 50 52 #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ 51 53