mmc: mmci: add busy detect for stm32 sdmmc variant
Subsystems (2)
v2 cover mmc: mmci: add busy detect for stm32 sdmmc variant
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are
different.
-Add hardware busy timeout with MMCIDATATIMER register.
V2:
-mmci_cmd_irq cleanup in separate patch.
-simplify the busy_detect_flag exclude
-replace sdmmc specific comment in
"mmc: mmci: avoid fake busy polling in mmci_irq"
to focus on common behavior
Ludovic Barre (5):
mmc: mmci: cleanup mmci_cmd_irq for busy detect feature
mmc: mmci: avoid fake busy polling in mmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variant
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/5 mmc: mmci: cleanup mmci_cmd_irq for busy detect feature
From: Ludovic Barre <[email protected]>
This patch cleans mmci_cmd_irq function for busy detect feature.
--- drivers/mmc/host/mmci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/mmci.c +4 -4
@@ -1205,12 +1205,13 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, unsigned int status) {void __iomem *base = host->base; -bool sbc; +bool sbc, busy_resp;if (!cmd)return ; sbc = (cmd == host->mrq->sbc); + busy_resp = !!(cmd->flags &MMC_RSP_BUSY );/* * We need to be one of these interrupts to be considered worth
@@ -1224,8 +1225,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,/* * ST Micro variant: handle busy detection. */ -if (host->variant->busy_detect) { -bool busy_resp = !!(cmd->flags &MMC_RSP_BUSY ); +if (busy_resp && host->variant->busy_detect) {/* We are busy with a command, return */ if (host->busy_status &&
@@ -1238,7 +1238,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,* that the special busy status bit is still set before * proceeding. */ -if (!host->busy_status && busy_resp && +if (!host->busy_status && !(status & (MCI_CMDCRCFAIL |MCI_CMDTIMEOUT )) && (readl (base +MMCISTATUS ) & host->variant->busy_detect_flag)) {
Signature · 1 line
2.7.4
PATCH v2 2/5 mmc: mmci: avoid fake busy polling in mmci_irq
In reply to Ludovic BarreFrom: Ludovic Barre <[email protected]>
mmci_irq function loops until the status is totally cleared. However the busy_detect_flag could occurred even if no busy response is expected and that busy d0 line is low (like in
cmd11: voltage switch).
Like busy_detect_flag is handled into mmci_cmd_irq this flag can be always excluded.
--- drivers/mmc/host/mmci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci.c +3 -2
@@ -1535,9 +1535,10 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) }/* -* Don't poll for busy completion in irq context. +* Busy_detect_flag has been handled by mmci_cmd_irq, +* it can be excluded to avoid to poll on it */ -if (host->variant->busy_detect && host->busy_status) +if (host->variant->busy_detect_flag) status &= ~host->variant->busy_detect_flag; ret =1 ;
Signature · 1 line
2.7.4
PATCH v2 3/5 mmc: mmci: fix clear of busy detect status
In reply to Ludovic BarreFrom: Ludovic Barre <[email protected]>
The "busy_detect_flag" is used to read/clear busy value of mmci status. The "busy_detect_mask" is used to manage busy irq of mmci mask.
For sdmmc variant, the 2 properties have not the same offset. To clear the busyd0 status bit, we must add busy detect flag, the mmci mask is not enough.
--- drivers/mmc/host/mmci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/mmci.c +2 -1
@@ -1517,7 +1517,8 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)* to make sure that both start and end interrupts are always * cleared one after the other. */ - status &=readl (host->base +MMCIMASK0 ); + status &=readl (host->base +MMCIMASK0 ) | + host->variant->busy_detect_flag;if (host->variant->busy_detect)writel (status & ~host->variant->busy_detect_mask, host->base +MMCICLEAR );
Signature · 1 line
2.7.4
Re: [PATCH V2 3/5] mmc: mmci: fix clear of busy detect status
Quoted 11 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
The "
busy_detect_flag" is used to read/clear busy value of mmci status. The "busy_detect_mask" is used to manage busy irq of mmci mask.
For sdmmc variant, the 2 properties have not the same offset. To clear the busyd0 status bit, we must add busy detect flag, the mmci mask is not enough.Signed-off-by Ludovic Barre <[email protected]>
Ludovic, again, apologies for the delay.
Quoted 9 lines
--- drivers/mmc/host/mmci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/host/mmci.c +0
-0
drivers/mmc/host/mmci.c static irqreturn_t mmci_irq(int irq, void *dev_id) · line 1521
Quoted 6 lines
drivers/mmc/host/mmci.c +2
-1@@ -1517,7 +1517,8 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)* to make sure that both start and end interrupts are always * cleared one after the other. */ - status &=readl (host->base +MMCIMASK0 ); + status &=readl (host->base +MMCIMASK0 ) | + host->variant->busy_detect_flag;
I think this is not entirely correct, because it would mean we check for busy even if we haven't unmasked the busy IRQ via the variant->busy_detect_mask.
I suggest to store a new bool in the host (call it "busy_detect_unmasked" or whatever makes sense to you), to track whether we have unmasked the busy IRQ or not. Then take this flag into account, before ORing the value of host->variant->busy_detect_flag, according to above.
Quoted 6 lines
drivers/mmc/host/mmci.c +0
-1if (host->variant->busy_detect)writel (status & ~host->variant->busy_detect_mask, host->base +MMCICLEAR ); --2.7.4
Kind regards
Uffe
Re: [PATCH V2 3/5] mmc: mmci: fix clear of busy detect status
hi Ulf
Quoted 19 lines · Ulf Hansson
Quoted 11 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
The "
busy_detect_flag" is used to read/clear busy value of mmci status. The "busy_detect_mask" is used to manage busy irq of mmci mask.
For sdmmc variant, the 2 properties have not the same offset. To clear the busyd0 status bit, we must add busy detect flag, the mmci mask is not enough.Signed-off-by Ludovic Barre <[email protected]>Ludovic, again, apologies for the delay.
Quoted 4 lines
--- drivers/mmc/host/mmci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 15 lines
drivers/mmc/host/mmci.c static irqreturn_t mmci_irq(int irq, void *dev_id) · line 1521
Quoted 11 lines
drivers/mmc/host/mmci.c +2
-1@@ -1517,7 +1517,8 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)* to make sure that both start and end interrupts are always * cleared one after the other. */ - status &=readl (host->base +MMCIMASK0 ); + status &=readl (host->base +MMCIMASK0 ) | + host->variant->busy_detect_flag;I think this is not entirely correct, because it would mean we check for busy even if we haven't unmasked the busy IRQ via the
variant->busy_detect_mask.
if the variant is busy_detect false:
=> no problem because the busy_detect_flag or busy_detect_mask is not
defined.
if variant is busy_detect true:
the busy handle is split in 3 steps (see mmci_cmd_irq):
step 1: detection of busy line => unmasked the busy irq end step 2: in busy wait => ignore cmd irq while current busy flag is enabled.
step 3: end of busy => clear and mask busy irq
To detect the first step (see mmci_cmd_irq: which unmasks the busy irq) we need to know the current busy state. Actually, the status register is re-read in mmci_cmd_irq, why not used the status read in mmci_irq and in parameter ?
Regards,
Ludo
Quoted 17 lines
I suggest to store a new bool in the host (call it "
busy_detect_unmasked" or whatever makes sense to you), to track whether we have unmasked the busy IRQ or not. Then take this flag into account, before ORing the value ofhost->variant->busy_detect_flag, according to above.Quoted 6 lines
drivers/mmc/host/mmci.c +0
-1if (host->variant->busy_detect)writel (status & ~host->variant->busy_detect_mask, host->base +MMCICLEAR ); --2.7.4
Kind regards
Uffe
Re: [PATCH V2 3/5] mmc: mmci: fix clear of busy detect status
Quoted 39 lines · Ludovic BARRE
hi Ulf
Quoted 19 lines · Ulf Hansson
Quoted 11 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
The "
busy_detect_flag" is used to read/clear busy value of mmci status. The "busy_detect_mask" is used to manage busy irq of mmci mask.
For sdmmc variant, the 2 properties have not the same offset. To clear the busyd0 status bit, we must add busy detect flag, the mmci mask is not enough.Signed-off-by Ludovic Barre <[email protected]>Ludovic, again, apologies for the delay.
Quoted 4 lines
--- drivers/mmc/host/mmci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/mmc/host/mmci.c static irqreturn_t mmci_irq(int irq, void *dev_id) · line 1521
Quoted 11 lines
drivers/mmc/host/mmci.c +2
-1@@ -1517,7 +1517,8 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)* to make sure that both start and end interrupts are always * cleared one after the other. */ - status &=readl (host->base +MMCIMASK0 ); + status &=readl (host->base +MMCIMASK0 ) | + host->variant->busy_detect_flag;I think this is not entirely correct, because it would mean we check for busy even if we haven't unmasked the busy IRQ via the
variant->busy_detect_mask.
Quoted 3 lines
if the variant is
busy_detectfalse:
=> no problem because thebusy_detect_flagorbusy_detect_maskis not
defined.
Right.
Quoted 8 lines
if variant is
busy_detecttrue:
the busy handle is split in 3 steps (seemmci_cmd_irq):
step 1: detection of busy line => unmasked the busy irq end step 2: in busy wait => ignore cmd irq while current busy flag is enabled.
step 3: end of busy => clear and mask busy irq
Quoted 4 lines
To detect the first step (see
mmci_cmd_irq: which unmasks the busy irq) we need to know the current busy state. Actually, the status register is re-read inmmci_cmd_irq, why not used the status read inmmci_irqand in parameter ?
Right, I see your point.
On the other hand, that re-read of the status registers should really not be needed. Maybe it's a leftover from my initial version of the code, but in any case we should remove that.
Quoted 16 lines
Regards,
LudoQuoted 12 lines
I suggest to store a new bool in the host (call it "
busy_detect_unmasked" or whatever makes sense to you), to track whether we have unmasked the busy IRQ or not. Then take this flag into account, before ORing the value ofhost->variant->busy_detect_flag, according to above.Quoted 5 lines
drivers/mmc/host/mmci.c +0
-1if (host->variant->busy_detect)writel (status & ~host->variant->busy_detect_mask, host->base +MMCICLEAR ); --2.7.4
Kind regards
Uffe
PATCH v2 4/5 mmc: mmci: add hardware busy timeout feature
In reply to Ludovic BarreFrom: Ludovic Barre <[email protected]>
In some variants, the data timer is enabled when the DPSM is in busy state (while data transfert or MMC_RSP_BUSY), and could generate a data timeout error if the counter reach 0.
-Define max_busy_timeout (in ms) according to clock. -Set data timer register if the command has rsp_busy flag.
If busy_timeout is not defined by framework, the busy length after Data Burst is defined as 1 second (refer: 4.6.2.2 Write of sd specification part1 v6-0).
-Add MCI_DATATIMEOUT error management in mmci_cmd_irq.
--- drivers/mmc/host/mmci.c | 43 ++++++++++++++++++++++++++++++++++++------- drivers/mmc/host/mmci.h | 2 ++ 2 files changed, 38 insertions(+), 7 deletions(-)
drivers/mmc/host/mmci.c +36 -7
@@ -1078,6 +1078,7 @@ static void mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) { void __iomem *base = host->base; +unsigned long long clks =0 ;dev_dbg (mmc_dev (host->mmc),"op %02x arg %08x flags %08x\n" , cmd->opcode, cmd->arg, cmd->flags);
@@ -1100,6 +1101,19 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c)else c |= host->variant->cmdreg_srsp; } + +if (host->variant->busy_timeout && !cmd->data) { +if (cmd->flags &MMC_RSP_BUSY ) { +if (!cmd->busy_timeout) + cmd->busy_timeout =1000 ; + + clks = (unsigned long long )cmd->busy_timeout; + clks *= host->cclk; +do_div (clks,MSEC_PER_SEC ); + } +writel_relaxed (clks, host->base +MMCIDATATIMER ); + } +if (/*interrupt*/ 0 ) c |=MCI_CPSM_INTERRUPT ;
@@ -1206,6 +1220,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, {void __iomem *base = host->base;bool sbc, busy_resp; +u32 err_msk;if (!cmd)return ;
@@ -1218,8 +1233,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,* handling. Note that we tag on any latent IRQs postponed * due to waiting for busy status. */ -if (!((status|host->busy_status) & - (MCI_CMDCRCFAIL |MCI_CMDTIMEOUT |MCI_CMDSENT |MCI_CMDRESPEND ))) + err_msk =MCI_CMDCRCFAIL |MCI_CMDTIMEOUT ; +if (host->variant->busy_timeout && busy_resp) + err_msk |=MCI_DATATIMEOUT ; + +if (!((status | host->busy_status) & + (err_msk |MCI_CMDSENT |MCI_CMDRESPEND )))return ;/*
@@ -1228,7 +1247,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,if (busy_resp && host->variant->busy_detect) {/* We are busy with a command, return */ -if (host->busy_status && +if (host->busy_status && !(status & (err_msk)) && (status & host->variant->busy_detect_flag))return ;
@@ -1238,9 +1257,9 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,* that the special busy status bit is still set before * proceeding. */ -if (!host->busy_status && - !(status & (MCI_CMDCRCFAIL |MCI_CMDTIMEOUT )) && - (readl (base +MMCISTATUS ) & host->variant->busy_detect_flag)) { +if (!host->busy_status && !(status & (err_msk)) && + (readl (base +MMCISTATUS ) & + host->variant->busy_detect_flag)) {/* Clear the busy start IRQ */ writel(host->variant->busy_detect_mask,
@@ -1282,6 +1301,9 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, cmd->error = -ETIMEDOUT ; }else if (status &MCI_CMDCRCFAIL && cmd->flags &MMC_RSP_CRC ) { cmd->error = -EILSEQ ; + }else if (host->variant->busy_timeout && busy_resp && + status &MCI_DATATIMEOUT ) { + cmd->error = -ETIMEDOUT ; }else { cmd->resp[0 ] =readl (base +MMCIRESPONSE0 ); cmd->resp[1 ] =readl (base +MMCIRESPONSE1 );
@@ -1543,6 +1565,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) status &= ~host->variant->busy_detect_flag; ret =1 ; + }while (status);spin_unlock (&host->lock);
@@ -1947,6 +1970,8 @@ static int mmci_probe(struct amba_device *dev,* Enable busy detection. */ if (variant->busy_detect) { +u32 max_busy_timeout =0 ; + mmci_ops.card_busy = mmci_card_busy;/* * Not all variants have a flag to enable busy detection
@@ -1956,7 +1981,11 @@ static int mmci_probe(struct amba_device *dev,mmci_write_datactrlreg (host, host->variant->busy_dpsm_flag); mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY ; - mmc->max_busy_timeout =0 ; + +if (variant->busy_timeout) + max_busy_timeout = ~0UL / (mmc->f_max /MSEC_PER_SEC ); + + mmc->max_busy_timeout = max_busy_timeout; }/* Prepare a CMD12 - needed to clear the DPSM on some variants. */
drivers/mmc/host/mmci.h +2 -0
@@ -290,6 +290,7 @@ struct mmci_host;* @signal_direction: input/out direction of bus signals can be indicated * @pwrreg_clkgate: MMCIPOWER register must be used to gate the clock * @busy_detect: true if the variant supports busy detection on DAT0. +* @busy_timeout: true if the variant supports hardware busy timeout on R1B. * @busy_dpsm_flag: bitmask enabling busy detection in the DPSM * @busy_detect_flag: bitmask identifying the bit in the MMCISTATUS register * indicating that the card is busy
@@ -336,6 +337,7 @@ struct variant_data { u8 signal_direction:1; u8 pwrreg_clkgate:1; u8 busy_detect:1; + u8 busy_timeout:1;u32 busy_dpsm_flag;u32 busy_detect_flag;u32 busy_detect_mask;
Signature · 1 line
2.7.4
PATCH v2 5/5 mmc: mmci: add busy detect for stm32 sdmmc variant
In reply to Ludovic BarreFrom: Ludovic Barre <[email protected]>
This patch enables busy detection for stm32 sdmmc which requires to set data timer to define the busy timeout.
sdmmc has 2 flags:
-busyd0: inverted value of d0 line.
-busyd0end which indicates only end of busy following a cmd response. Only one interrupt on busyd0end.
--- drivers/mmc/host/mmci.c | 4 ++++ drivers/mmc/host/mmci.h | 1 + 2 files changed, 5 insertions(+)
drivers/mmc/host/mmci.c +4 -0
@@ -264,6 +264,10 @@ static struct variant_data variant_stm32_sdmmc = { .datalength_bits = 25, .datactrl_blocksz = 14, .stm32_idmabsize_mask = GENMASK(12, 5), + .busy_detect = true, + .busy_timeout = true, + .busy_detect_flag = MCI_STM32_BUSYD0, + .busy_detect_mask = MCI_STM32_BUSYD0ENDMASK, .init = sdmmc_variant_init, };
drivers/mmc/host/mmci.h +1 -0
@@ -167,6 +167,7 @@#define MCI_ST_CARDBUSY (1 << 24)/* Extended status bits for the STM32 variants */ #define MCI_STM32_BUSYD0 BIT(20) +#define MCI_STM32_BUSYD0END BIT(21)#define MMCICLEAR 0x038#define MCI_CMDCRCFAILCLR (1 << 0)
Signature · 1 line
2.7.4
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variant
Quoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4
Ludovic, just wanted to let you know that I am reviewing and testing this series.
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Kind regards
Uffe
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Quoted 4 lines
Kind regards
Uffe
Quoted 40 lines · Ludovic BARRE
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 6 lines
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Thanks! Good and bad news here, then.
I now understand what is going on - and there is certainly room for improvements here, but more importantly the actual mmci busy detection works as expected.
When it comes to improvements, the main issue I have found is how we treat DATA WRITES. In many cases we simply don't use the HW busy detection at all, but instead rely on the mmc core to send CMD13 in a loop to poll. Well, then if the polling would have consisted of a couple of CMD13s that wouldn't be an issue, but my observations is rather that the numbers of CMD13 sent to poll is in the range or hundreds/thousands - per each WRITE request!
I am going to send a patch (or two) that improves the behavior. It might even involve changing parts in core layer, not sure how the end result will look like yet.
In any case, I have applied patch 1 and patch2 for next, as the tests turned out well at my side. I also took the liberty of updating some of the comments/changelogs, please have look and tell if there is something you want to change.
I will continue with the rest of series next week.
Kind regards
Uffe
hi Ulf
Quoted 62 lines · Ulf Hansson
Quoted 40 lines · Ludovic BARRE
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 6 lines
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Thanks! Good and bad news here, then.
I now understand what is going on - and there is certainly room for improvements here, but more importantly the actual mmci busy detection works as expected.
When it comes to improvements, the main issue I have found is how we treat DATA WRITES. In many cases we simply don't use the HW busy detection at all, but instead rely on the mmc core to send CMD13 in a loop to poll. Well, then if the polling would have consisted of a couple of CMD13s that wouldn't be an issue, but my observations is rather that the numbers of CMD13 sent to poll is in the range or hundreds/thousands - per each WRITE request!
Quoted 3 lines
I am going to send a patch (or two) that improves the behavior. It might even involve changing parts in core layer, not sure how the end result will look like yet.
yes, these will improve the drivers without hardware busy completion. great
Quoted 7 lines
In any case, I have applied patch 1 and patch2 for next, as the tests turned out well at my side. I also took the liberty of updating some of the comments/changelogs, please have look and tell if there is something you want to change.
I will continue with the rest of series next week.
thanks, and good week-end.
Quoted 4 lines
Kind regards
Uffe
hi Ulf
Just a "gentleman ping" about the rest of series. "mmc: mmci: add busy detect for stm32 sdmmc variant"
Regards
Ludo
Quoted 76 lines · Ulf Hansson
Quoted 40 lines · Ludovic BARRE
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 6 lines
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Thanks! Good and bad news here, then.
I now understand what is going on - and there is certainly room for improvements here, but more importantly the actual mmci busy detection works as expected.
When it comes to improvements, the main issue I have found is how we treat DATA WRITES. In many cases we simply don't use the HW busy detection at all, but instead rely on the mmc core to send CMD13 in a loop to poll. Well, then if the polling would have consisted of a couple of CMD13s that wouldn't be an issue, but my observations is rather that the numbers of CMD13 sent to poll is in the range or hundreds/thousands - per each WRITE request!
I am going to send a patch (or two) that improves the behavior. It might even involve changing parts in core layer, not sure how the end result will look like yet.
In any case, I have applied patch 1 and patch2 for next, as the tests turned out well at my side. I also took the liberty of updating some of the comments/changelogs, please have look and tell if there is something you want to change.
I will continue with the rest of series next week.
Kind regards
Uffe
Quoted 5 lines · Ludovic BARRE
hi Ulf
Just a "gentleman ping" about the rest of series. "mmc: mmci: add busy detect for stm32 sdmmc variant"
Thanks!
It's been a busy period and I am currently traveling. My plan is to look at in detail beginning of next week when get back home. I hope that's okay.
Kind regards
Uffe
Quoted 81 lines
Regards
LudoQuoted 76 lines · Ulf Hansson
Quoted 40 lines · Ludovic BARRE
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c | 61 ++++++++++++++++++++++++++++++++++++++----------- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 6 lines
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Thanks! Good and bad news here, then.
I now understand what is going on - and there is certainly room for improvements here, but more importantly the actual mmci busy detection works as expected.
When it comes to improvements, the main issue I have found is how we treat DATA WRITES. In many cases we simply don't use the HW busy detection at all, but instead rely on the mmc core to send CMD13 in a loop to poll. Well, then if the polling would have consisted of a couple of CMD13s that wouldn't be an issue, but my observations is rather that the numbers of CMD13 sent to poll is in the range or hundreds/thousands - per each WRITE request!
I am going to send a patch (or two) that improves the behavior. It might even involve changing parts in core layer, not sure how the end result will look like yet.
In any case, I have applied patch 1 and patch2 for next, as the tests turned out well at my side. I also took the liberty of updating some of the comments/changelogs, please have look and tell if there is something you want to change.
I will continue with the rest of series next week.
Kind regards
Uffe
Quoted 4 lines · Ulf Hansson
Quoted 3 lines · Ludovic BARRE
hi Ulf
Quoted 8 lines
Quoted 2 lines
Just a "gentleman ping" about the rest of series. "mmc: mmci: add busy detect for stm32 sdmmc variant"
Thanks!
It's been a busy period and I am currently traveling. My plan is to look at in detail beginning of next week when get back home. I hope that's okay.
yes, I understand, it's just to not forget me :-)
Quoted 85 lines
Kind regards
UffeQuoted 81 lines
Regards
LudoQuoted 76 lines · Ulf Hansson
Quoted 40 lines · Ludovic BARRE
Quoted 36 lines · Ulf Hansson
Quoted 24 lines · Ludovic Barre
From: Ludovic Barre <[email protected]>
This patch series adds busy detect for stm32 sdmmc variant. Some adaptations are required:
(quoted diff) +0
-3-Avoid to check and poll busy status when is not expected. -Clear busy status bit if busy_detect_flag and busy_detect_mask are different. -Add hardware busy timeout with MMCIDATATIMER register.V2:
(quoted diff) +0
-3-mmci_cmd_irq cleanup in separate patch. -simplify the busy_detect_flag exclude -replace sdmmc specific comment in"mmc: mmci: avoid fake busy polling in
mmci_irq"
to focus on common behaviorLudovic Barre (5):
mmc: mmci: cleanupmmci_cmd_irqfor busy detect feature
mmc: mmci: avoid fake busy polling inmmci_irq
mmc: mmci: fix clear of busy detect status
mmc: mmci: add hardware busy timeout feature
mmc: mmci: add busy detect for stm32 sdmmc variantQuoted 7 lines
drivers/mmc/host/mmci.c| 61 ++++++++++++++++++++++++++++++++++++++-----------drivers/mmc/host/mmci.h| 3 +++
2 files changed, 51 insertions(+), 13 deletions(-)--
2.7.4Ludovic, just wanted to let you know that I am reviewing and testing this series.
Quoted 6 lines
Quoted 4 lines
However, while running some tests on Ux500 for validating the busy detection code, even without your series applied, I encounter some odd behaviors. I am looking into the problem to understand better and will let you know as soon as I have some more data to share.
Oops, don't hesitate to share your status, if I could help.
Thanks! Good and bad news here, then.
I now understand what is going on - and there is certainly room for improvements here, but more importantly the actual mmci busy detection works as expected.
When it comes to improvements, the main issue I have found is how we treat DATA WRITES. In many cases we simply don't use the HW busy detection at all, but instead rely on the mmc core to send CMD13 in a loop to poll. Well, then if the polling would have consisted of a couple of CMD13s that wouldn't be an issue, but my observations is rather that the numbers of CMD13 sent to poll is in the range or hundreds/thousands - per each WRITE request!
I am going to send a patch (or two) that improves the behavior. It might even involve changing parts in core layer, not sure how the end result will look like yet.
In any case, I have applied patch 1 and patch2 for next, as the tests turned out well at my side. I also took the liberty of updating some of the comments/changelogs, please have look and tell if there is something you want to change.
I will continue with the rest of series next week.
Kind regards
Uffe