[PATCH] mmc: core: Fix Ignore obselete ext csd in eMMC4.5
In the eMMC 4.5 specification the EC_ERASE_MULT and SEC_TRIM_MULT have become obselete and donot carry any valid information. This patch makes sure that the above mentioned parameters are used only for versions below eMMC 4.5. All the versions above 4.5 will ignore their usage by assuming them as dont cares. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/core.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 91a0a74..47ce1e4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1351,8 +1351,12 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, erase_timeout = 1; } - /* Multiplier for secure operations */ - if (arg MMC_SECURE_ARGS) { + /* Multiplier for secure operations +* eMMC 4.5 specification defines these values +* sec_erase_mult,sec_trim_mult as obselete(so dont care). +* These multipliers are only valid for versions eMMC 4.5 +*/ + if ((arg MMC_SECURE_ARGS) (card-ext_csd.rev 6)) { if (arg == MMC_SECURE_ERASE_ARG) erase_timeout *= card-ext_csd.sec_erase_mult; else -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH V2] mmc: core: eMMC4.5 Add the timeout for switch
Hi Girish, Girish K S wrote: V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int, as it can hold a value upto 255*10=2550. This patch adds the code to handle the default timeout for switch command. For eMMC 4.5 devices if timeout is not specified for the switch command while accessing a specific field,then the default timeout shall be used to timeout. Specification says there is no timeout defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE field(so these fields are excluded). Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c |5 + drivers/mmc/core/mmc_ops.c |8 include/linux/mmc/card.h |1 + include/linux/mmc/mmc.h|4 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5700b1c..5b9fb6a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) if (card-ext_csd.rev = 5) card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; + if (card-ext_csd.rev 5) { + /* (eMMC 4.5)timeout is expressed in units of 10 ms*/ + card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10; + } + if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) card-erased_byte = 0xFF; else diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 770c3d0..c4d82f4 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; cmd.cmd_timeout_ms = timeout_ms; + /* timeout is not defined for below command indexes (eMMC 4.5) */ + if ((timeout_ms == 0) + (card-ext_csd-rev 5) + (index != EXT_CSD_BKOPS_START) + (index != EXT_CSD_SANITIZE_START) + (index != EXT_CSD_FLUSH_CACHE)) + cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout; + mmc_switch doesn't need to take over '0' value for timeout_ms except for undefined timeout(Background operation, sanitize, etc) It is possible and good to pass the argument of specific timeout_ms(including default cmd6 timeout) explicitly rather than '0', if timeout value for cmd6 is defined. Then, mmc_switch maybe doesn't need to handle timeout for some exception case. err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES); if (err) return err; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b460fc2..ef88412 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -50,6 +50,7 @@ struct mmc_ext_csd { u8 rel_sectors; u8 rel_param; u8 part_config; + unsigned intcmd6_timeout; /* timeout in ms */ unsigned intpart_time; /* Units: ms */ unsigned intsa_timeout; /* Units: 100ns */ unsigned inths_max_dtr; diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5a794cb..a23f836 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -270,8 +270,11 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_FLUSH_CACHE 32 /* R/W */ #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ #define EXT_CSD_PARTITION_SUPPORT160 /* RO */ +#define EXT_CSD_BKOPS_START 164 /* R/W */ +#define EXT_CSD_SANITIZE_START 165 /* R/W */ #define EXT_CSD_WR_REL_PARAM 166 /* RO */ #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ #define EXT_CSD_PART_CONFIG 179 /* R/W */ @@ -293,6 +296,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT232 /* RO */ +#define EXT_CSD_CMD6_TIME248 /* RO */ /* * EXT_CSD field definitions -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] mmc: core: eMMC4.5 Add the timeout for switch
Hello Mr Jeon, In case if the timeout is specified by the calling function, the code in this patch will not be executed. But if some command other than the three are called with 0, then this code will make sure that atleast the default value is used to timeout. regards Girish K S On 1 September 2011 11:50, Seungwon Jeon tgih@samsung.com wrote: Hi Girish, Girish K S wrote: V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int, as it can hold a value upto 255*10=2550. This patch adds the code to handle the default timeout for switch command. For eMMC 4.5 devices if timeout is not specified for the switch command while accessing a specific field,then the default timeout shall be used to timeout. Specification says there is no timeout defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE field(so these fields are excluded). Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c | 5 + drivers/mmc/core/mmc_ops.c | 8 include/linux/mmc/card.h | 1 + include/linux/mmc/mmc.h | 4 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5700b1c..5b9fb6a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) if (card-ext_csd.rev = 5) card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; + if (card-ext_csd.rev 5) { + /* (eMMC 4.5)timeout is expressed in units of 10 ms*/ + card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10; + } + if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) card-erased_byte = 0xFF; else diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 770c3d0..c4d82f4 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; cmd.cmd_timeout_ms = timeout_ms; + /* timeout is not defined for below command indexes (eMMC 4.5) */ + if ((timeout_ms == 0) + (card-ext_csd-rev 5) + (index != EXT_CSD_BKOPS_START) + (index != EXT_CSD_SANITIZE_START) + (index != EXT_CSD_FLUSH_CACHE)) + cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout; + mmc_switch doesn't need to take over '0' value for timeout_ms except for undefined timeout(Background operation, sanitize, etc) It is possible and good to pass the argument of specific timeout_ms(including default cmd6 timeout) explicitly rather than '0', if timeout value for cmd6 is defined. Then, mmc_switch maybe doesn't need to handle timeout for some exception case. err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES); if (err) return err; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b460fc2..ef88412 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -50,6 +50,7 @@ struct mmc_ext_csd { u8 rel_sectors; u8 rel_param; u8 part_config; + unsigned int cmd6_timeout; /* timeout in ms */ unsigned int part_time; /* Units: ms */ unsigned int sa_timeout; /* Units: 100ns */ unsigned int hs_max_dtr; diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5a794cb..a23f836 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -270,8 +270,11 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_FLUSH_CACHE 32 /* R/W */ #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ +#define EXT_CSD_BKOPS_START 164 /* R/W */ +#define EXT_CSD_SANITIZE_START 165 /* R/W */ #define EXT_CSD_WR_REL_PARAM 166 /* RO */ #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ #define EXT_CSD_PART_CONFIG 179 /* R/W */ @@ -293,6 +296,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_CMD6_TIME 248 /* RO */ /* * EXT_CSD field definitions -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message
RE: sdhci-esdhc-imx and SDIO interrupts
Chris ball's tree. -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Per-Henrik Lundblom Sent: Thursday, September 01, 2011 2:46 PM To: linux-mmc@vger.kernel.org Subject: Re: sdhci-esdhc-imx and SDIO interrupts * Lin Tony-B19295 b19...@freescale.com [110901 07:31]: I commit a patch to fix this issue. Did you update your code? Sorry for my stupid question but where did you commit that patch? /PH -- Per-Henrik Lundblom epost: p...@whatever.nu hemsida: www.whatever.nu -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/1] mmc: sdhci-esdhc: Change delay after setting clock from 100ms to 1ms
-Original Message- From: Wolfram Sang [mailto:w.s...@pengutronix.de] Sent: Thursday, September 01, 2011 1:55 PM To: Lin Tony-B19295 Cc: linux-mmc@vger.kernel.org; linux-arm-ker...@lists.infradead.org; c...@laptop.org Subject: Re: [PATCH 1/1] mmc: sdhci-esdhc: Change delay after setting clock from 100ms to 1ms On Thu, Sep 01, 2011 at 01:51:15PM +0800, Tony Lin wrote: 1ms is enough for hardware to change the clock to stable. 100ms is too long. How do you know that? Can you be sure for PowerPC as well? Have you researched why the original author of the code has chosen that value? If so, please update your commit message with such infos. I got this confirmation by IC simulation, but sorry I just noticed that's also used for PPC. I can update the information after got confirmation from author. -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] mmc: core: eMMC4.5 Add the timeout for switch
Hi Girish. I agreed for Mr.Jeon's opinion. I think that need not to check for any exception case. (Mr.Jeon mentioned the below comment, just using default cmd6_timeout) Thanks, Jaehoon Chung Girish K S wrote: Hello Mr Jeon, In case if the timeout is specified by the calling function, the code in this patch will not be executed. But if some command other than the three are called with 0, then this code will make sure that atleast the default value is used to timeout. regards Girish K S On 1 September 2011 11:50, Seungwon Jeon tgih@samsung.com wrote: Hi Girish, Girish K S wrote: V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int, as it can hold a value upto 255*10=2550. This patch adds the code to handle the default timeout for switch command. For eMMC 4.5 devices if timeout is not specified for the switch command while accessing a specific field,then the default timeout shall be used to timeout. Specification says there is no timeout defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE field(so these fields are excluded). Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c |5 + drivers/mmc/core/mmc_ops.c |8 include/linux/mmc/card.h |1 + include/linux/mmc/mmc.h|4 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5700b1c..5b9fb6a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) if (card-ext_csd.rev = 5) card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM]; + if (card-ext_csd.rev 5) { + /* (eMMC 4.5)timeout is expressed in units of 10 ms*/ + card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10; + } + if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) card-erased_byte = 0xFF; else diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 770c3d0..c4d82f4 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; cmd.cmd_timeout_ms = timeout_ms; + /* timeout is not defined for below command indexes (eMMC 4.5) */ + if ((timeout_ms == 0) + (card-ext_csd-rev 5) + (index != EXT_CSD_BKOPS_START) + (index != EXT_CSD_SANITIZE_START) + (index != EXT_CSD_FLUSH_CACHE)) + cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout; + mmc_switch doesn't need to take over '0' value for timeout_ms except for undefined timeout(Background operation, sanitize, etc) It is possible and good to pass the argument of specific timeout_ms(including default cmd6 timeout) explicitly rather than '0', if timeout value for cmd6 is defined. Then, mmc_switch maybe doesn't need to handle timeout for some exception case. err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES); if (err) return err; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b460fc2..ef88412 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -50,6 +50,7 @@ struct mmc_ext_csd { u8 rel_sectors; u8 rel_param; u8 part_config; + unsigned intcmd6_timeout; /* timeout in ms */ unsigned intpart_time; /* Units: ms */ unsigned intsa_timeout; /* Units: 100ns */ unsigned inths_max_dtr; diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5a794cb..a23f836 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -270,8 +270,11 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_FLUSH_CACHE 32 /* R/W */ #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ #define EXT_CSD_PARTITION_SUPPORT160 /* RO */ +#define EXT_CSD_BKOPS_START 164 /* R/W */ +#define EXT_CSD_SANITIZE_START 165 /* R/W */ #define EXT_CSD_WR_REL_PARAM 166 /* RO */ #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ #define EXT_CSD_PART_CONFIG 179 /* R/W */ @@ -293,6 +296,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT232 /* RO */ +#define EXT_CSD_CMD6_TIME248 /* RO */ /* * EXT_CSD field definitions -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe
Re: sdhci-esdhc-imx and SDIO interrupts
* Lin Tony-B19295 b19...@freescale.com [110901 09:34]: Chris ball's tree. Thanks! Merged relevant parts with 2.6.93.4 and the mach-mx3 platform and now it seems like SDIO interrupts are working fine. Sweet :) /PH -- Per-Henrik Lundblom epost: p...@whatever.nu hemsida: www.whatever.nu -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v4] ARM: davinci: AM18x: Add wl1271/wlan support
On Thu, Aug 04, 2011 at 13:21:23, Ido Yariv wrote: The wl1271 daughter card for AM18x EVMs is a combo wireless connectivity add-on card, based on the LS Research TiWi module with Texas Instruments' wl1271 solution. It is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line and is power-controlled by a GPIO-based fixed regulator. Add support for the WLAN capabilities of this expansion board. Signed-off-by: Ido Yariv i...@wizery.com Applied, thanks. Regards, Sekhar -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] omap: hsmmc: Normalize dma cleanup operations
Reuse omap_hsmmc_dma_cleanup even for normal dma teardown in omap_hsmmc_dma_cb. Consolidate multiple points of dma unmap into a single location in post_req function, to prevent double unmapping. Signed-off-by: Venkatraman S svenk...@ti.com --- drivers/mmc/host/omap_hsmmc.c | 20 +--- 1 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 21e4a79..5b7776c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -999,7 +999,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) { int dma_ch; - host-data-error = errno; + if (host-data) + host-data-error = errno; spin_lock(host-irq_lock); dma_ch = host-dma_ch; @@ -1007,12 +1008,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) spin_unlock(host-irq_lock); if (host-use_dma dma_ch != -1) { - dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, - host-data-sg_len, - omap_hsmmc_get_dma_dir(host, host-data)); omap_free_dma(dma_ch); } - host-data = NULL; } /* @@ -1370,7 +1367,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) { struct omap_hsmmc_host *host = cb_data; struct mmc_data *data; - int dma_ch, req_in_progress; + int req_in_progress; if (!(ch_status OMAP_DMA_BLOCK_IRQ)) { dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n, @@ -1394,16 +1391,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) return; } - if (!data-host_cookie) - dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len, -omap_hsmmc_get_dma_dir(host, data)); - req_in_progress = host-req_in_progress; - dma_ch = host-dma_ch; - host-dma_ch = -1; spin_unlock(host-irq_lock); - - omap_free_dma(dma_ch); + omap_hsmmc_dma_cleanup(host, 0); /* If DMA has finished after TC, complete the request */ if (!req_in_progress) { @@ -1575,7 +1565,7 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, struct omap_hsmmc_host *host = mmc_priv(mmc); struct mmc_data *data = mrq-data; - if (host-use_dma) { + if (data-host_cookie) { dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len, omap_hsmmc_get_dma_dir(host, data)); data-host_cookie = 0; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] omap: hsmmc: Cleanup omap hsmmc dma routines
The first patch substitutes the dma_cleanup function in place of the body of the code which does the same thing. The dma unmap operation is now restricted just to the post_req function. The second patch minimizes holding spin lock during dma configuration, where it is not necessary. Venkatraman S (2): omap: hsmmc: normalize dma cleanup operations omap: hsmmc: don't hold spinlock during dma configuration drivers/mmc/host/omap_hsmmc.c | 22 ++ 1 files changed, 6 insertions(+), 16 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] omap: hsmmc: Don't hold spinlock during dma configuration
No need to hold the spinlock during a rather long dma configuration sequence inside dma callback, which doesn't need it. Signed-off-by: Venkatraman S svenk...@ti.com --- drivers/mmc/host/omap_hsmmc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5b7776c..c5fd413 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1384,10 +1384,10 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) data = host-mrq-data; host-dma_sg_idx++; if (host-dma_sg_idx host-dma_len) { + spin_unlock(host-irq_lock); /* Fire up the next transfer. */ omap_hsmmc_config_dma_params(host, data, data-sg + host-dma_sg_idx); - spin_unlock(host-irq_lock); return; } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
On Mon, Aug 29, 2011 at 3:38 AM, Per Forlin per.for...@linaro.org wrote: Reported by Russell King: mmcblk0: error -84 transferring data, sector 149201, nr 64, cmd response 0x900, card status 0xb00 mmcblk0: retrying using single block read WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x80933000] [size=20480 bytes] - In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup() and then again in omap_hsmmc_post_req(). Resolve this by clearing the host_cookie to indicate there is no DMA mapped memory to unmap. Signed-off-by: Per Forlin per.for...@linaro.org --- Bug fix on 3.1-rc3 drivers/mmc/host/omap_hsmmc.c | 7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 21e4a79..31d9817 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) host-data-sg_len, omap_hsmmc_get_dma_dir(host, host-data)); omap_free_dma(dma_ch); + host-data-host_cookie = 0; } host-data = NULL; } @@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, struct mmc_data *data = mrq-data; if (host-use_dma) { - dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len, - omap_hsmmc_get_dma_dir(host, data)); + if (data-host_cookie) + dma_unmap_sg(mmc_dev(host-mmc), data-sg, + data-sg_len, + omap_hsmmc_get_dma_dir(host, data)); data-host_cookie = 0; } } -- 1.7.4.1 I just posted a patch [1] which just consolidates all unmapping to just post_req. This would obviously prevent double unmapping, and keeps all the related dma operations at a single place. Let me know if that works better. [1]: http://marc.info/?l=linux-mmcm=131490406920616w=2 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: RFC : mmc : Use wait_for_completion_timeout() instead of wait_for_completion in case of multiple write blocks.
2011/8/30 Linus Walleij linus.wall...@linaro.org: On Thu, Aug 25, 2011 at 6:44 AM, NamJae Jeon linkinj...@gmail.com wrote: If card is infinitely holding pull down busy line(data 0) while writing multiple blocks, write will be blocked in mmc_wait_for_req_done(). I suggest to use wait_for_completion_timeout instread of wait_for_completion like the below code. How do you think about my suggestion ? Since this is a hardware lock-up it is up to the host driver to timeout and return an error to the framework. For example only the host driver have information on the clock speed on the host controller and other information such as request size that can be used to set a suitable timeout waiting for the request to complete. If you just grep for timeout_ns in drivers/mmc/host you can see several drivers using the card-supplied timeout_ns for handing the timeout properly given local clocking constraints etc. Often host controllers can take the number of clock cycles until timeout as a parameter, and only the host controller can calculate this number. See for example in mmci_start_data() in mmci.c. So I seriously think you need to look closer at the problematic host driver if this is a problem to you, e.g. rewrite it to use wait_for_completion_timeout() there. Yours, Linus Walleij We should consider DMA situation. As I know, host controller can not rise timeout interrupt in write not read in DMA status. host controller can just know whether card is finish to program to use busy line. If unstable card is holding busy line while writing using DMA, hang problem will happen by wait_for_completion. so I think that mmc driver need some exception to avoid this problem. -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html