Skip to contentSkip to conversation

MMC: DWMMC: Fix FIFO_DEPTH calculation

PATCH Superseded Rajeshwari Shinde 5 participants 9 messages May 23, 2013 – May 24, 2013 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +4 -2
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
 	dwmci_writel(host, DWMCI_BMOD, 1);
 
 	fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-	if (host->fifoth_val)
+	if (host->fifoth_val) {
 		fifoth_val = host->fifoth_val;
-	else
+	} else {
 		fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
 			TX_WMARK(fifo_size/2);
+		host->fifoth_val = fifoth_val;
+	}
 	dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
 	dwmci_writel(host, DWMCI_CLKENA, 0);
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Hi Rajeshwari

On Thu, May 23, 2013 at 6:45 PM, Rajeshwari Shinde <[email protected]

Quoted 26 lines

wrote:

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time
for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1).
Instead of storing the correct value, we were recalculating the FIFO_DEPT each
time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 342

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -2
-       if (host->fifoth_val)
+       if (host->fifoth_val) {
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
 

Looks Good to me.

Quoted 11 lines
drivers/mmc/dw_mmc.c +0 -0
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);

--
1.7.4.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

In reply to Rajeshwari Shinde
Quoted 18 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -1
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

Quoted 11 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

#3 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Quoted 22 lines · Jagan Teki
Quoted 20 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
Quoted 5 lines

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 3 lines
drivers/mmc/dw_mmc.c +1 -1
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

It should be set into board-specific file(dw-mmc_exynos.c) or others.

Best Regards,
Jaehoon Chung

Quoted 18 lines
Quoted 12 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

#4 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Quoted 23 lines · Jaehoon Chung
Quoted 22 lines · Jagan Teki
Quoted 20 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
Quoted 6 lines
Quoted 5 lines

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 3 lines
drivers/mmc/dw_mmc.c +1 -1
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

It should be set into board-specific file(dw-mmc_exynos.c) or others.

I am unable to find dw-mmc_exynos.c on the master, and also I haven't see fifoth_val used other than dw_mmc.c
Could you please help me out.

Thanks,
Jagan.

Quoted 22 lines

Best Regards,
Jaehoon Chung

Quoted 18 lines
Quoted 12 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

#5 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Hi Jagan,

Please find my comments below.

Quoted 29 lines · Jagan Teki
Quoted 28 lines · Jaehoon Chung
Quoted 27 lines · Jagan Teki
Quoted 18 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -1
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

Quoted 5 lines
Quoted 1 line

It should be set into board-specific file(dw-mmc_exynos.c) or others.

I am unable to find dw-mmc_exynos.c on the master, and also I haven't see fifoth_val used other than dw_mmc.c
Could you please help me out.

dw-mmc_exynos.c is merged in mmc tree. Yes FIFO_DEPTH is set only in dw_mmc.c

Quoted 30 lines

Thanks,
Jagan.

Quoted 22 lines

Best Regards,
Jaehoon Chung

Quoted 18 lines
Quoted 12 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
Regards,
Rajeshwari Shinde
#6 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Hi Jagan,

Quoted 33 lines · Rajeshwari Birje

Hi Jagan,

Please find my comments below.

Quoted 29 lines · Jagan Teki
Quoted 28 lines · Jaehoon Chung
Quoted 27 lines · Jagan Teki
Quoted 18 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 5 lines
drivers/mmc/dw_mmc.c +1 -1
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

It should be set into board-specific file(dw-mmc_exynos.c) or others.

I am unable to find dw-mmc_exynos.c on the master, and also I haven't see fifoth_val used other than dw_mmc.c
Could you please help me out.

dw-mmc_exynos.c is merged in mmc tree. Yes FIFO_DEPTH is set only in dw_mmc.c

host->fifoth_val should be set to hard-coding by developer.
In general case, it's right that fifoth_Val is calculated with register value. But sometime, it needs to set to other value, not register value. Then we can use the host->fifoth_val in board-specific file. Maybe it didn't use the host->fifoth_val anywhere. In future, we can use this.

Best Regards,
Jaehoon Chung

Quoted 31 lines
Quoted 30 lines

Thanks,
Jagan.

Quoted 22 lines

Best Regards,
Jaehoon Chung

Quoted 18 lines
Quoted 12 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#7 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

Quoted 41 lines · Jaehoon Chung

Hi Jagan,

Quoted 38 lines · Rajeshwari Birje

Hi Jagan,

Please find my comments below.

Quoted 34 lines · Jagan Teki
Quoted 23 lines · Jaehoon Chung
Quoted 22 lines · Jagan Teki
Quoted 20 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
        dwmci_writel(host, DWMCI_BMOD, 1);
 
Quoted 6 lines
Quoted 5 lines

drivers/mmc/dw_mmc.c static int dwmci_init(struct mmc *mmc) · line 335

Quoted 3 lines
drivers/mmc/dw_mmc.c +1 -1
        fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-       if (host->fifoth_val)
+       if (host->fifoth_val) {

What is the inital value for host->fifoth_val, for the first time call.?

It should be set into board-specific file(dw-mmc_exynos.c) or others.

I am unable to find dw-mmc_exynos.c on the master, and also I haven't see fifoth_val used other than dw_mmc.c
Could you please help me out.

Quoted 6 lines
Quoted 1 line

dw-mmc_exynos.c is merged in mmc tree. Yes FIFO_DEPTH is set only in dw_mmc.c

host->fifoth_val should be set to hard-coding by developer.
In general case, it's right that fifoth_Val is calculated with register value. But sometime, it needs to set to other value, not register value. Then we can use the host->fifoth_val in board-specific file. Maybe it didn't use the host->fifoth_val anywhere. In future, we can use this.

Ok, thanks for your response.
If that is the case may be we can initialize host->fifoth_val on add_dwmci() for as of now.
Once the proper init of this is done in board specific file in future may be we can remove this.

Thanks,
Jagan.

Quoted 35 lines

Best Regards,
Jaehoon Chung

Quoted 31 lines
Quoted 30 lines

Thanks,
Jagan.

Quoted 22 lines

Best Regards,
Jaehoon Chung

Quoted 18 lines
Quoted 12 lines
drivers/mmc/dw_mmc.c +3 -2
                fifoth_val = host->fifoth_val;
-       else
+       } else {
                fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
                        TX_WMARK(fifo_size/2);
+               host->fifoth_val = fifoth_val;
+       }
        dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
        dwmci_writel(host, DWMCI_CLKENA, 0);
--
Quoted 2 lines

1.7.4.4

Thanks,
Jagan.

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#8 lore raw

PATCH 1/1 MMC: DWMMC: Fix FIFO_DEPTH calculation

In reply to Rajeshwari Shinde
Quoted 34 lines · Rajeshwari Shinde

Current DWMMC driver used to give FIFO underrun/overrun error every 3rd time for mmc rescan command.
In current code FIFO_DEPTH is getting calculated after reading the FIFOTH register and extracting the RX_WMARK bits from it i.e (RX_WMARK = FIFO_DEPTH/2 -1). Instead of storing the correct value, we were recalculating the FIFO_DEPT each time which is not correct.

---
 drivers/mmc/dw_mmc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/dw_mmc.c +4 -2
index 4070d4e..be590a4 100644
@@ -332,11 +332,13 @@ static int dwmci_init(struct mmc *mmc)
 	dwmci_writel(host, DWMCI_BMOD, 1);
 
 	fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-	if (host->fifoth_val)
+	if (host->fifoth_val) {
 		fifoth_val = host->fifoth_val;
-	else
+	} else {
 		fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
 			TX_WMARK(fifo_size/2);
+		host->fifoth_val = fifoth_val;
+	}
 	dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
 
 	dwmci_writel(host, DWMCI_CLKENA, 0);