]> err.no Git - linux-2.6/commitdiff
sdio: fix the use of hard coded timeout value.
authorBenzi Zbit <benzi.zbit@intel.com>
Wed, 9 Jul 2008 23:41:43 +0000 (02:41 +0300)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 15 Jul 2008 13:47:03 +0000 (15:47 +0200)
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>
drivers/mmc/core/sdio_cis.c
drivers/mmc/core/sdio_io.c
include/linux/mmc/sdio_func.h

index d5e51b1c7b3fb715ebc81dcad5468c572748d42e..956bd7677502c3c1ebe69d3c03f65641abce060e 100644 (file)
@@ -129,6 +129,12 @@ static int cistpl_funce_func(struct sdio_func *func,
        /* TPLFE_MAX_BLK_SIZE */
        func->max_blksize = buf[12] | (buf[13] << 8);
 
+       /* TPLFE_ENABLE_TIMEOUT_VAL, present in ver 1.1 and above */
+       if (vsn > SDIO_SDIO_REV_1_00)
+               func->enable_timeout = (buf[28] | (buf[29] << 8)) * 10;
+       else
+               func->enable_timeout = jiffies_to_msecs(HZ);
+
        return 0;
 }
 
index 3ccf6919877ca80cf7e92d9eed10fc942b96c78c..0888df64581f12b3200e7c4f1d61c120cffbd932 100755 (executable)
@@ -76,11 +76,7 @@ int sdio_enable_func(struct sdio_func *func)
        if (ret)
                goto err;
 
-       /*
-        * FIXME: This should timeout based on information in the CIS,
-        * but we don't have card to parse that yet.
-        */
-       timeout = jiffies + HZ;
+       timeout = jiffies + msecs_to_jiffies(func->enable_timeout);
 
        while (1) {
                ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
index 28fb0a33acf87416ac29be9ef4f443fe585b7630..07bee4a0d457e71c50eb9a7bbded7f69fd3d8d94 100755 (executable)
@@ -46,6 +46,8 @@ struct sdio_func {
        unsigned                max_blksize;    /* maximum block size */
        unsigned                cur_blksize;    /* current block size */
 
+       unsigned                enable_timeout; /* max enable timeout in msec */
+
        unsigned int            state;          /* function state */
 #define SDIO_STATE_PRESENT     (1<<0)          /* present in sysfs */