mmc: dw_mmc: modified the DMA threshold for SD card
Subsystems (2)
Jaehoon Chung
maintainerPATCH 1/1 mmc: dw_mmc: modified the DMA threshold for SD card
This patch modified the DMA threshold.
I didn't know exactly why need this threshold.
But if this value is 16, we didn't read SCR register for SD card. Because in mmc_app_send_scr this values are used data.blocks=1 and data.blksz=8. (data.blocks * data.blksz = 8...so return -EINVAL)
We didn't read the SCR register, then maybe should be set with wrong configuration.
--- drivers/mmc/host/dw_mmc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/dw_mmc.c +1 -1
@@ -47,7 +47,7 @@ DW_MCI_CMD_ERROR_FLAGS | SDMMC_INT_HLE)#define DW_MCI_SEND_STATUS 1#define DW_MCI_RECV_STATUS 2 -#define DW_MCI_DMA_THRESHOLD 16 +#define DW_MCI_DMA_THRESHOLD 8#ifdef CONFIG_MMC_DW_IDMAC struct idmac_desc {
Quoted 6 lines · Jaehoon Chung
This patch modified the DMA threshold.
I didn't know exactly why need this threshold.
But if this value is 16, we didn't read SCR register for SD card. Because inmmc_app_send_scrthis values are used data.blocks=1 and data.blksz=8. (data.blocks * data.blksz = 8...so return-EINVAL)
The idea is that for a small transaction the time to set up the DMA is probably not worth the effort, therefore it does it using PIO mode (see dw_mci_submit_data, if dw_mci_submit_data_dma fails, it sets itself up for pio mode instead).
So if it's using PIO mode and the SCR cannot be read, then PIO mode is broken. What's the value of the register HCON? dw_mci_probe reads it and decides which pio push and pull function to use based on the host data width. I've only tested one of them as we only have one configuration of hardware available, but you may have a different one.
Cheers
James
Quoted 22 lines
We didn't read the SCR register, then maybe should be set with wrong configuration.
Signed-off-by Jaehoon Chung <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/mmc/host/dw_mmc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/mmc/host/dw_mmc.c +1
-1@@ -47,7 +47,7 @@ DW_MCI_CMD_ERROR_FLAGS | SDMMC_INT_HLE)#define DW_MCI_SEND_STATUS 1#define DW_MCI_RECV_STATUS 2 -#define DW_MCI_DMA_THRESHOLD 16 +#define DW_MCI_DMA_THRESHOLD 8#ifdef CONFIG_MMC_DW_IDMAC struct idmac_desc {
Jaehoon Chung
maintainerQuoted 8 lines · James Hogan
Quoted 6 lines · Jaehoon Chung
This patch modified the DMA threshold.
I didn't know exactly why need this threshold.
But if this value is 16, we didn't read SCR register for SD card. Because inmmc_app_send_scrthis values are used data.blocks=1 and data.blksz=8. (data.blocks * data.blksz = 8...so return-EINVAL)
Quoted 4 lines
The idea is that for a small transaction the time to set up the DMA is probably not worth the effort, therefore it does it using PIO mode (see
dw_mci_submit_data, ifdw_mci_submit_data_dmafails, it sets itself up for pio mode instead).
Is there some reason that threshold is set 16?
Quoted 6 lines
So if it's using PIO mode and the SCR cannot be read, then PIO mode is broken. What's the value of the register HCON?
dw_mci_probereads it and decides which pio push and pull function to use based on the host data width. I've only tested one of them as we only have one configuration of hardware available, but you may have a different one.
i used push/pull_data_32. What do you doubt this problem?
Best regards,
Jaehon Chung
Hi,
Quoted 10 lines · Jaehoon Chung
Quoted 8 lines · James Hogan
Quoted 6 lines · Jaehoon Chung
This patch modified the DMA threshold.
I didn't know exactly why need this threshold.
But if this value is 16, we didn't read SCR register for SD card. Because inmmc_app_send_scrthis values are used data.blocks=1 and data.blksz=8. (data.blocks * data.blksz = 8...so return-EINVAL)
Quoted 6 lines
Quoted 4 lines
The idea is that for a small transaction the time to set up the DMA is probably not worth the effort, therefore it does it using PIO mode (see
dw_mci_submit_data, ifdw_mci_submit_data_dmafails, it sets itself up for pio mode instead).Is there some reason that threshold is set 16?
I expect it's fairly arbitrary, and the optimum value would depend on what DMA is used etc.
Quoted 10 lines
Quoted 7 lines
So if it's using PIO mode and the SCR cannot be read, then PIO mode is broken. What's the value of the register HCON?
dw_mci_probereads it and decides which pio push and pull function to use based on the host data width. I've only tested one of them as we only have one configuration of hardware available, but you may have a different one.i used push/pull_data_32. What do you doubt this problem?
Our current hardware also has a data width of 32.
Does it work if you disable DMA (by returning -ENODEV at the beginning of dw_mci_submit_data_dma)? That would prove that the problem wasn't caused by DMA mode leaving the hardware in a bad state before switching to PIO mode.
Cheers
James
Quoted 5 lines
Best regards,
Jaehon Chung
Jaehoon Chung
maintainerHi James.
I found other problem about not reading scr register.
Did you have 2.40a spec?
Our code is based on lower version than 2.40a.
In DWC_mobile_storage 2.40a spec, DATA register address is changed.
Now we used DATA register address is 0x100.(in 2.40a, Address 0x100 is used for CardThrCtl register) But in 2.40a, DATA register address is 0x200...
Maybe i think the reason why PIO mode is broken.
We need to set DATA register according to VERID.(reading VERID register)
I will send the patch for this point.
Best Regards,
Jaehoon Chung
Quoted 22 lines
Our current hardware also has a data width of 32.
Does it work if you disable DMA (by returning
-ENODEVat the beginning ofdw_mci_submit_data_dma)? That would prove that the problem wasn't caused by DMA mode leaving the hardware in a bad state before switching to PIO mode.Cheers
JamesQuoted 4 lines
Best regards,
Jaehon Chung--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html