Skip to contentSkip to conversation

mmc: dw_mmc: change the read/write order under fifo mode

PATCH New Jacob Chen 5 participants 17 messages Aug 29, 2016 – Sep 24, 2016 MMC, SD and SDIO

lore
Share & tools
lore

Jacob Chen

author
#0 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

---

 drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +17 -15
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
 		if (host->fifo_mode && size) {
 			len = 0;
-			if (data->flags == MMC_DATA_READ) {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_RXDR)) {
+			if (data->flags == MMC_DATA_READ &&
+			    (mask & DWMCI_INTMSK_RXDR)) {
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = (len >> DWMCI_FIFO_SHIFT) &
-						    DWMCI_FIFO_MASK;
+					    DWMCI_FIFO_MASK;
 					len = min(size, len);
 					for (i = 0; i < len; i++)
 						*buf++ =
-						dwmci_readl(host, DWMCI_DATA);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_RXDR);
+						    dwmci_readl(host,
+								DWMCI_DATA);
+					size = size > len ? (size - len) : 0;
 				}
-			} else {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_TXDR)) {
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_RXDR);
+			} else if (data->flags == MMC_DATA_WRITE &&
+				   (mask & DWMCI_INTMSK_TXDR)) {
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = fifo_depth - ((len >>
-						   DWMCI_FIFO_SHIFT) &
-						   DWMCI_FIFO_MASK);
+							     DWMCI_FIFO_SHIFT) &
+							    DWMCI_FIFO_MASK);
 					len = min(size, len);
 					for (i = 0; i < len; i++)
 						dwmci_writel(host, DWMCI_DATA,
 							     *buf++);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_TXDR);
+					size = size > len ? (size - len) : 0;
 				}
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_TXDR);
 			}
-			size = size > len ? (size - len) : 0;
 		}
 
 		/* Data arrived correctly. */
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/3 rockchip: add usb mass storage feature support for rk3036

From: "jacob2.chen" <[email protected]>

Enable ums feature for rk3036 boards, so that we can mount the mmc device to PC.

---

 include/configs/rk3036_common.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/rk3036_common.h +4 -0
index 21d4683..dea4acb 100644
@@ -74,6 +74,10 @@
 #define CONFIG_FASTBOOT_BUF_ADDR	CONFIG_SYS_LOAD_ADDR
 #define CONFIG_FASTBOOT_BUF_SIZE	0x08000000
 
+/* usb mass storage */
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_CMD_USB_MASS_STORAGE
+
 #define CONFIG_USB_GADGET_DOWNLOAD
 #define CONFIG_G_DNL_MANUFACTURER	"Rockchip"
 #define CONFIG_G_DNL_VENDOR_NUM		0x2207
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH 3/3 rockchip: use rockchip linux partitions map

In reply to Jacob Chen

From: "jacob2.chen" <[email protected]>

Below link contains documents about rockchip linux partitions.
http://rockchip.wikidot.com/partitions

---

 include/configs/kylin_rk3036.h  | 25 +++++++++----------------
 include/configs/rk3288_common.h |  7 ++++++-
 2 files changed, 15 insertions(+), 17 deletions(-)
include/configs/kylin_rk3036.h +9 -16
index e8ca76d..e08654b 100644
@@ -18,7 +18,6 @@
 #undef CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV		0 /* emmc */
-#define CONFIG_SYS_MMC_ENV_PART		0 /* user area */
 #define CONFIG_ENV_OFFSET		(SZ_4M - SZ_64K) /* reserved area */
 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
@@ -28,25 +27,19 @@
 #define CONFIG_RANDOM_UUID
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
-	"name=loader,start=32K,size=4000K,uuid=${uuid_gpt_loader};" \
-	"name=reserved,size=64K,uuid=${uuid_gpt_reserved};" \
-	"name=misc,size=4M,uuid=${uuid_gpt_misc};" \
-	"name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
-	"name=boot_a,size=32M,uuid=${uuid_gpt_boot_a};" \
-	"name=boot_b,size=32M,uuid=${uuid_gpt_boot_b};" \
-	"name=system_a,size=818M,uuid=${uuid_gpt_system_a};" \
-	"name=system_b,size=818M,uuid=${uuid_gpt_system_b};" \
-	"name=vendor_a,size=50M,uuid=${uuid_gpt_vendor_a};" \
-	"name=vendor_b,size=50M,uuid=${uuid_gpt_vendor_b};" \
-	"name=cache,size=100M,uuid=${uuid_gpt_cache};" \
-	"name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \
-	"name=persist,size=4M,uuid=${uuid_gpt_persist};" \
-	"name=userdata,size=-,uuid=${uuid_gpt_userdata};\0" \
+	"name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
+	"name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
+	"name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
+	"name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
+	"name=atf,size=4M,uuid=${uuid_gpt_atf};" \
+	"name=boot,size=128M,bootable,uuid=${uuid_gpt_boot};" \
+	"name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \
 
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"partitions=" PARTS_DEFAULT \
-
+	ENV_MEM_LAYOUT_SETTINGS \
+	BOOTENV
 #endif
 
 #define CONFIG_BOARD_LATE_INIT
include/configs/rk3288_common.h +6 -1
index d3d4c68..cf5ab59 100644
@@ -120,7 +120,12 @@
 #define CONFIG_RANDOM_UUID
 #define PARTS_DEFAULT \
 	"uuid_disk=${uuid_gpt_disk};" \
-	"name=boot,start=8M,size=64M,bootable,uuid=${uuid_gpt_boot};" \
+	"name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
+	"name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
+	"name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
+	"name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
+	"name=atf,size=4M,uuid=${uuid_gpt_atf};" \
+	"name=boot,size=128M,bootable,uuid=${uuid_gpt_boot};" \
 	"name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \
 
 /* First try to boot from SD (index 0), then eMMC (index 1 */
Signature · 1 line
2.7.4
#7 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

In reply to Jacob Chen

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 3 lines

Could you change from jacob2.chen to your name?

Quoted 13 lines

---

 drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
 		if (host->fifo_mode && size) {
 			len = 0;

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -4
-			if (data->flags == MMC_DATA_READ) {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_RXDR)) {
+			if (data->flags == MMC_DATA_READ &&
+			    (mask & DWMCI_INTMSK_RXDR)) {
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = (len >> DWMCI_FIFO_SHIFT) &
-						    DWMCI_FIFO_MASK;
+					    DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 7 lines
drivers/mmc/dw_mmc.c +1 -3
 					len = min(size, len);
 					for (i = 0; i < len; i++)
 						*buf++ =
-						dwmci_readl(host, DWMCI_DATA);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_RXDR);
+						    dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+								DWMCI_DATA);
+					size = size > len ? (size - len) : 0;
 				}
-			} else {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_TXDR)) {
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_RXDR);
+			} else if (data->flags == MMC_DATA_WRITE &&
+				   (mask & DWMCI_INTMSK_TXDR)) {

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = fifo_depth - ((len >>
-						   DWMCI_FIFO_SHIFT) &
-						   DWMCI_FIFO_MASK);
+							     DWMCI_FIFO_SHIFT) &
+							    DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 16 lines
drivers/mmc/dw_mmc.c +3 -3
 					len = min(size, len);
 					for (i = 0; i < len; i++)
 						dwmci_writel(host, DWMCI_DATA,
 							     *buf++);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_TXDR);
+					size = size > len ? (size - len) : 0;
 				}
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_TXDR);
 			}
-			size = size > len ? (size - len) : 0;
 		}
 
 		/* Data arrived correctly. */
#8 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Hi jaehoon,

2016-08-30 17:54 GMT+08:00 Jaehoon Chung <[email protected]>:

Quoted 9 lines

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

This bug affects data reading and make board fail to boot. There will be some errors like,
"Warning - bad CRC, using the default environmen" "ERROR: Can 't read GPT header"

Actually I am not very familiar with the MMC hardware and i don't know why former implemen will cause this bug.....
I just rewrite it according to the driver in kernel.

Quoted 50 lines
Quoted 3 lines

Could you change from jacob2.chen to your name?

Quoted 13 lines

---

 drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
              if (host->fifo_mode && size) {
                      len = 0;

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -4
-                     if (data->flags == MMC_DATA_READ) {
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_RXDR)) {
+                     if (data->flags == MMC_DATA_READ &&
+                         (mask & DWMCI_INTMSK_RXDR)) {
+                             while (size) {
                                      len = dwmci_readl(host, DWMCI_STATUS);
                                      len = (len >> DWMCI_FIFO_SHIFT) &
-                                                 DWMCI_FIFO_MASK;
+                                         DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 7 lines
drivers/mmc/dw_mmc.c +1 -3
                                      len = min(size, len);
                                      for (i = 0; i < len; i++)
                                              *buf++ =
-                                             dwmci_readl(host, DWMCI_DATA);
-                                     dwmci_writel(host, DWMCI_RINTSTS,
-                                                  DWMCI_INTMSK_RXDR);
+                                                 dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+                                                             DWMCI_DATA);
+                                     size = size > len ? (size - len) : 0;
                              }
-                     } else {
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_TXDR)) {
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_RXDR);
+                     } else if (data->flags == MMC_DATA_WRITE &&
+                                (mask & DWMCI_INTMSK_TXDR)) {
Quoted 2 lines

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

The reason why i write it so strange is that it warning "Too many leading tabs"....

Quoted 35 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 8 lines
drivers/mmc/dw_mmc.c +3 -2
+                             while (size) {
                                      len = dwmci_readl(host, DWMCI_STATUS);
                                      len = fifo_depth - ((len >>
-                                                DWMCI_FIFO_SHIFT) &
-                                                DWMCI_FIFO_MASK);
+                                                          DWMCI_FIFO_SHIFT) &
+                                                         DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 6 lines
drivers/mmc/dw_mmc.c +0 -1
                                      len = min(size, len);
                                      for (i = 0; i < len; i++)
                                              dwmci_writel(host, DWMCI_DATA,
                                                           *buf++);
-                                     dwmci_writel(host, DWMCI_RINTSTS,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 156

Quoted 10 lines
drivers/mmc/dw_mmc.c +3 -2
-                                                  DWMCI_INTMSK_TXDR);
+                                     size = size > len ? (size - len) : 0;
                              }
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_TXDR);
                      }
-                     size = size > len ? (size - len) : 0;
              }
 
              /* Data arrived correctly. */

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

#9 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Quoted 7 lines · ??

Hi jaehoon,

2016-08-30 17:54 GMT+08:00 Jaehoon Chung <[email protected]>:

Quoted 3 lines

Hi Jacob,

On 08/30/2016 02:26 AM, Jacob Chen wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

This bug affects data reading and make board fail to boot. There will be some errors like,
"Warning - bad CRC, using the default environmen"

It's not cause by mmc device, U-Boot will read env from media device, and do CRC checking.

Quoted 1 line

"ERROR: Can 't read GPT header"

Which board do you use? RK3288 use DMA-mode for dw_mmc, not pio. I'm interest in it, show me more information.

Quoted 95 lines

Actually I am not very familiar with the MMC hardware and i don't know why former implemen will cause this bug.....
I just rewrite it according to the driver in kernel.

Quoted 46 lines
Quoted 2 lines

Could you change from jacob2.chen to your name?

Quoted 13 lines

---

  drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
               if (host->fifo_mode && size) {
                       len = 0;

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -4
-                     if (data->flags == MMC_DATA_READ) {
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_RXDR)) {
+                     if (data->flags == MMC_DATA_READ &&
+                         (mask & DWMCI_INTMSK_RXDR)) {
+                             while (size) {
                                       len = dwmci_readl(host, DWMCI_STATUS);
                                       len = (len >> DWMCI_FIFO_SHIFT) &
-                                                 DWMCI_FIFO_MASK;
+                                         DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 7 lines
drivers/mmc/dw_mmc.c +1 -3
                                       len = min(size, len);
                                       for (i = 0; i < len; i++)
                                               *buf++ =
-                                             dwmci_readl(host, DWMCI_DATA);
-                                     dwmci_writel(host, DWMCI_RINTSTS,
-                                                  DWMCI_INTMSK_RXDR);
+                                                 dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+                                                             DWMCI_DATA);
+                                     size = size > len ? (size - len) : 0;
                               }
-                     } else {
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_TXDR)) {
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_RXDR);
+                     } else if (data->flags == MMC_DATA_WRITE &&
+                                (mask & DWMCI_INTMSK_TXDR)) {
Quoted 2 lines

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

The reason why i write it so strange is that it warning "Too many leading tabs"....

Quoted 26 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+                             while (size) {
                                       len = dwmci_readl(host, DWMCI_STATUS);
                                       len = fifo_depth - ((len >>
-                                                DWMCI_FIFO_SHIFT) &
-                                                DWMCI_FIFO_MASK);
+                                                          DWMCI_FIFO_SHIFT) &
+                                                         DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 14 lines
drivers/mmc/dw_mmc.c +3 -3
                                       len = min(size, len);
                                       for (i = 0; i < len; i++)
                                               dwmci_writel(host, DWMCI_DATA,
                                                            *buf++);
-                                     dwmci_writel(host, DWMCI_RINTSTS,
-                                                  DWMCI_INTMSK_TXDR);
+                                     size = size > len ? (size - len) : 0;
                               }
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_TXDR);
                       }
-                     size = size > len ? (size - len) : 0;
               }
 
Quoted 6 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 156

Quoted 2 lines
drivers/mmc/dw_mmc.c +0 -0
               /* Data arrived correctly. */

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

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

#10 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Hi Ziyuan,

It was rk3036-kylin board.
This bug will make distro_boot failed.

2016-08-30 22:11 GMT+08:00 Ziyuan Xu <[email protected]>:

Quoted 148 lines · ??
Quoted 12 lines

Hi jaehoon,

2016-08-30 17:54 GMT+08:00 Jaehoon Chung <[email protected]>:

Quoted 7 lines

Hi Jacob,

Quoted 3 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

This bug affects data reading and make board fail to boot. There will be some errors like,
"Warning - bad CRC, using the default environmen"

It's not cause by mmc device, U-Boot will read env from media device, and do CRC checking.

Quoted 1 line

"ERROR: Can 't read GPT header"

Which board do you use? RK3288 use DMA-mode for dw_mmc, not pio. I'm interest in it, show me more information.

Quoted 111 lines

Actually I am not very familiar with the MMC hardware and i don't know why former implemen will cause this bug.....
I just rewrite it according to the driver in kernel.

Quoted 54 lines
Quoted 2 lines

Could you change from jacob2.chen to your name?

Quoted 15 lines

---

  drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -1
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host
 *host, struct mmc_data *data)
 
               if (host->fifo_mode && size) {
                       len = 0;
-                     if (data->flags == MMC_DATA_READ) {

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host · line 130

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -3
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_RXDR)) {
+                     if (data->flags == MMC_DATA_READ &&
+                         (mask & DWMCI_INTMSK_RXDR)) {
+                             while (size) {
                                       len = dwmci_readl(host,
 DWMCI_STATUS);
                                       len = (len >> DWMCI_FIFO_SHIFT) &
-                                                 DWMCI_FIFO_MASK;
+                                         DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 10 lines
drivers/mmc/dw_mmc.c +2 -3
                                       len = min(size, len);
                                       for (i = 0; i < len; i++)
                                               *buf++ =
-                                             dwmci_readl(host,
 DWMCI_DATA);
-                                     dwmci_writel(host, DWMCI_RINTSTS,
-                                                  DWMCI_INTMSK_RXDR);
+                                                 dwmci_readl(host,
+
 DWMCI_DATA);

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +5 -3
+                                     size = size > len ? (size - len) :
 0;
                               }
-                     } else {
-                             if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                                  DWMCI_INTMSK_TXDR)) {
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_RXDR);
+                     } else if (data->flags == MMC_DATA_WRITE &&
+                                (mask & DWMCI_INTMSK_TXDR)) {
Quoted 2 lines

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

The reason why i write it so strange is that it warning "Too many leading tabs"....

Quoted 32 lines
Quoted 10 lines
drivers/mmc/dw_mmc.c +2 -2
+                             while (size) {
                                       len = dwmci_readl(host,
 DWMCI_STATUS);
                                       len = fifo_depth - ((len >>
-                                                DWMCI_FIFO_SHIFT) &
-                                                DWMCI_FIFO_MASK);
+

DWMCI_FIFO_SHIFT) &
+
DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 16 lines
                                       len = min(size, len);
                                       for (i = 0; i < len; i++)
                                               dwmci_writel(host,
DWMCI_DATA,
                                                            *buf++);
drivers/mmc/dw_mmc.c +1 -2
-                                     dwmci_writel(host, DWMCI_RINTSTS,
-                                                  DWMCI_INTMSK_TXDR);
+                                     size = size > len ? (size - len) :
0;
                               }
drivers/mmc/dw_mmc.c +2 -1
+                             dwmci_writel(host, DWMCI_RINTSTS,
+                                          DWMCI_INTMSK_TXDR);
                       }
-                     size = size > len ? (size - len) : 0;
               }
Quoted 6 lines
Quoted 2 lines
               /* Data arrived correctly. */

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

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

#6 lore raw

PATCH 3/3 rockchip: use rockchip linux partitions map

In reply to Jacob Chen

Hi,

Quoted 5 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

Below link contains documents about rockchip linux partitions.
http://rockchip.wikidot.com/partitions

Please add to the commit message some info about why this change is needed.

Please can you update README.rockchip with this info and the link.

Regards,
Simon

Quoted 75 lines

---

 include/configs/kylin_rk3036.h  | 25 +++++++++----------------
 include/configs/rk3288_common.h |  7 ++++++-
 2 files changed, 15 insertions(+), 17 deletions(-)
include/configs/kylin_rk3036.h +9 -16
index e8ca76d..e08654b 100644
@@ -18,7 +18,6 @@
 #undef CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV         0 /* emmc */
-#define CONFIG_SYS_MMC_ENV_PART                0 /* user area */
 #define CONFIG_ENV_OFFSET              (SZ_4M - SZ_64K) /* reserved area */
 #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
@@ -28,25 +27,19 @@
 #define CONFIG_RANDOM_UUID
 #define PARTS_DEFAULT \
        "uuid_disk=${uuid_gpt_disk};" \
-       "name=loader,start=32K,size=4000K,uuid=${uuid_gpt_loader};" \
-       "name=reserved,size=64K,uuid=${uuid_gpt_reserved};" \
-       "name=misc,size=4M,uuid=${uuid_gpt_misc};" \
-       "name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \
-       "name=boot_a,size=32M,uuid=${uuid_gpt_boot_a};" \
-       "name=boot_b,size=32M,uuid=${uuid_gpt_boot_b};" \
-       "name=system_a,size=818M,uuid=${uuid_gpt_system_a};" \
-       "name=system_b,size=818M,uuid=${uuid_gpt_system_b};" \
-       "name=vendor_a,size=50M,uuid=${uuid_gpt_vendor_a};" \
-       "name=vendor_b,size=50M,uuid=${uuid_gpt_vendor_b};" \
-       "name=cache,size=100M,uuid=${uuid_gpt_cache};" \
-       "name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \
-       "name=persist,size=4M,uuid=${uuid_gpt_persist};" \
-       "name=userdata,size=-,uuid=${uuid_gpt_userdata};\0" \
+       "name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
+       "name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
+       "name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
+       "name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
+       "name=atf,size=4M,uuid=${uuid_gpt_atf};" \
+       "name=boot,size=128M,bootable,uuid=${uuid_gpt_boot};" \
+       "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \
 
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "partitions=" PARTS_DEFAULT \
-
+       ENV_MEM_LAYOUT_SETTINGS \
+       BOOTENV
 #endif
 
 #define CONFIG_BOARD_LATE_INIT
include/configs/rk3288_common.h +6 -2
index d3d4c68..cf5ab59 100644
@@ -120,7 +120,12 @@
 #define CONFIG_RANDOM_UUID
 #define PARTS_DEFAULT \
        "uuid_disk=${uuid_gpt_disk};" \
-       "name=boot,start=8M,size=64M,bootable,uuid=${uuid_gpt_boot};" \
+       "name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
+       "name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
+       "name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
+       "name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
+       "name=atf,size=4M,uuid=${uuid_gpt_atf};" \
+       "name=boot,size=128M,bootable,uuid=${uuid_gpt_boot};" \
        "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \
 
 /* First try to boot from SD (index 0), then eMMC (index 1 */
--

2.7.4

#11 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

In reply to Jaehoon Chung

hi Jaehoon,

Quoted 23 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 2 lines

Could you change from jacob2.chen to your name?

Quoted 11 lines

---

  drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
Quoted 13 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 12 lines
drivers/mmc/dw_mmc.c +4 -4
  		if (host->fifo_mode && size) {
  			len = 0;
-			if (data->flags == MMC_DATA_READ) {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_RXDR)) {
+			if (data->flags == MMC_DATA_READ &&
+			    (mask & DWMCI_INTMSK_RXDR)) {
+				while (size) {
  					len = dwmci_readl(host, DWMCI_STATUS);
  					len = (len >> DWMCI_FIFO_SHIFT) &
-						    DWMCI_FIFO_MASK;
+					    DWMCI_FIFO_MASK;

this changing is related with bug?

I just hit this bug on rk3036 board.

When DTO interrupt occurred, there are any remaining data still in FIFO due to RX FIFO threshold is larger than remaining data. It also causes that dwmmc didn't trigger RXDR interrupt.
It's responsibility of driver to read remaining bytes on seeing DTO interrupt. So we need rework dwmci_data_transfer w/ pio mode.

Quoted 56 lines
Quoted 8 lines
drivers/mmc/dw_mmc.c +1 -3
  					len = min(size, len);
  					for (i = 0; i < len; i++)
  						*buf++ =
-						dwmci_readl(host, DWMCI_DATA);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_RXDR);
+						    dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+								DWMCI_DATA);
+					size = size > len ? (size - len) : 0;
  				}
-			} else {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_TXDR)) {
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_RXDR);
+			} else if (data->flags == MMC_DATA_WRITE &&
+				   (mask & DWMCI_INTMSK_TXDR)) {

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+				while (size) {
  					len = dwmci_readl(host, DWMCI_STATUS);
  					len = fifo_depth - ((len >>
-						   DWMCI_FIFO_SHIFT) &
-						   DWMCI_FIFO_MASK);
+							     DWMCI_FIFO_SHIFT) &
+							    DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 6 lines
drivers/mmc/dw_mmc.c +0 -1
  					len = min(size, len);
  					for (i = 0; i < len; i++)
  						dwmci_writel(host, DWMCI_DATA,
  							     *buf++);
-					dwmci_writel(host, DWMCI_RINTSTS,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 156

Quoted 10 lines
drivers/mmc/dw_mmc.c +3 -2
-						     DWMCI_INTMSK_TXDR);
+					size = size > len ? (size - len) : 0;
  				}
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_TXDR);
  			}
-			size = size > len ? (size - len) : 0;
  		}
 
  		/* Data arrived correctly. */

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

#12 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Quoted 40 lines · Ziyuan Xu

hi Jaehoon,

Quoted 27 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 2 lines

Could you change from jacob2.chen to your name?

Quoted 15 lines

---

  drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -3
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
            if (host->fifo_mode && size) {
              len = 0;
-            if (data->flags == MMC_DATA_READ) {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_RXDR)) {
Quoted 8 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 7 lines
drivers/mmc/dw_mmc.c +4 -1
+            if (data->flags == MMC_DATA_READ &&
+                (mask & DWMCI_INTMSK_RXDR)) {
+                while (size) {
                      len = dwmci_readl(host, DWMCI_STATUS);
                      len = (len >> DWMCI_FIFO_SHIFT) &
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 1 line

I just hit this bug on rk3036 board.

This changing is just an indentation, isn't?
It looks like unnecessary modifying.

Quoted 3 lines

When DTO interrupt occurred, there are any remaining data still in FIFO due to RX FIFO threshold is larger than remaining data. It also causes that dwmmc didn't trigger RXDR interrupt. It's responsibility of driver to read remaining bytes on seeing DTO interrupt. So we need rework dwmci_data_transfer w/ pio mode.

Sure, your bug is possible to occur..but my mean is that modified DWMCI_FIFO_MASK isn't related with your entire bug.

Best Regards,
Jaehoon Chung

Quoted 61 lines
Quoted 56 lines
Quoted 9 lines
drivers/mmc/dw_mmc.c +1 -3
                      len = min(size, len);
                      for (i = 0; i < len; i++)
                          *buf++ =
-                        dwmci_readl(host, DWMCI_DATA);
-                    dwmci_writel(host, DWMCI_RINTSTS,
-                             DWMCI_INTMSK_RXDR);
+                            dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+                                DWMCI_DATA);
+                    size = size > len ? (size - len) : 0;
                  }
-            } else {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_TXDR)) {
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_RXDR);
+            } else if (data->flags == MMC_DATA_WRITE &&
+                   (mask & DWMCI_INTMSK_TXDR)) {

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+                while (size) {
                      len = dwmci_readl(host, DWMCI_STATUS);
                      len = fifo_depth - ((len >>
-                           DWMCI_FIFO_SHIFT) &
-                           DWMCI_FIFO_MASK);
+                                 DWMCI_FIFO_SHIFT) &
+                                DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 5 lines
drivers/mmc/dw_mmc.c +0 -1
                      len = min(size, len);
                      for (i = 0; i < len; i++)
                          dwmci_writel(host, DWMCI_DATA,
                                   *buf++);
-                    dwmci_writel(host, DWMCI_RINTSTS,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)

Quoted 10 lines
drivers/mmc/dw_mmc.c +3 -2
-                             DWMCI_INTMSK_TXDR);
+                    size = size > len ? (size - len) : 0;
                  }
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_TXDR);
              }
-            size = size > len ? (size - len) : 0;
          }
            /* Data arrived correctly. */
 

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

#13 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Quoted 39 lines · Jaehoon Chung
Quoted 38 lines · Ziyuan Xu

hi Jaehoon,

Quoted 34 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 1 line

Could you change from jacob2.chen to your name?

Quoted 12 lines

---

   drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
   1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -0
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
             if (host->fifo_mode && size) {
               len = 0;

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 127

Quoted 10 lines
drivers/mmc/dw_mmc.c +4 -4
-            if (data->flags == MMC_DATA_READ) {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_RXDR)) {
+            if (data->flags == MMC_DATA_READ &&
+                (mask & DWMCI_INTMSK_RXDR)) {
+                while (size) {
                       len = dwmci_readl(host, DWMCI_STATUS);
                       len = (len >> DWMCI_FIFO_SHIFT) &
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 7 lines
Quoted 1 line

I just hit this bug on rk3036 board.

This changing is just an indentation, isn't?
It looks like unnecessary modifying.

Quoted 2 lines

When DTO interrupt occurred, there are any remaining data still in FIFO due to RX FIFO threshold is larger than remaining data. It also causes that dwmmc didn't trigger RXDR interrupt. It's responsibility of driver to read remaining bytes on seeing DTO interrupt. So we need rework dwmci_data_transfer w/ pio mode.

Sure, your bug is possible to occur..but my mean is that modified DWMCI_FIFO_MASK isn't related with your entire bug.

Okay I see. If I understand correctly, you recommend that set fifo-depth to 1, so that host can trigger RXDR interrupt as soon as 1 bytes data come in.
I think it's inefficient.

Quoted 65 lines

Best Regards,
Jaehoon Chung

Quoted 58 lines
Quoted 54 lines
Quoted 7 lines
drivers/mmc/dw_mmc.c +1 -3
                       len = min(size, len);
                       for (i = 0; i < len; i++)
                           *buf++ =
-                        dwmci_readl(host, DWMCI_DATA);
-                    dwmci_writel(host, DWMCI_RINTSTS,
-                             DWMCI_INTMSK_RXDR);
+                            dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+                                DWMCI_DATA);
+                    size = size > len ? (size - len) : 0;
                   }
-            } else {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_TXDR)) {
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_RXDR);
+            } else if (data->flags == MMC_DATA_WRITE &&
+                   (mask & DWMCI_INTMSK_TXDR)) {

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 144

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+                while (size) {
                       len = dwmci_readl(host, DWMCI_STATUS);
                       len = fifo_depth - ((len >>
-                           DWMCI_FIFO_SHIFT) &
-                           DWMCI_FIFO_MASK);
+                                 DWMCI_FIFO_SHIFT) &
+                                DWMCI_FIFO_MASK);

ditto.

Best Regards,
Jaehoon Chung

Quoted 5 lines
drivers/mmc/dw_mmc.c +0 -1
                       len = min(size, len);
                       for (i = 0; i < len; i++)
                           dwmci_writel(host, DWMCI_DATA,
                                    *buf++);
-                    dwmci_writel(host, DWMCI_RINTSTS,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)

Quoted 10 lines
drivers/mmc/dw_mmc.c +3 -2
-                             DWMCI_INTMSK_TXDR);
+                    size = size > len ? (size - len) : 0;
                   }
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_TXDR);
               }
-            size = size > len ? (size - len) : 0;
           }
             /* Data arrived correctly. */
 

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

#14 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

Quoted 46 lines · Ziyuan Xu
Quoted 43 lines · Jaehoon Chung
Quoted 38 lines · Ziyuan Xu

hi Jaehoon,

Quoted 26 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 1 line

Could you change from jacob2.chen to your name?

Quoted 15 lines

---

   drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
   1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -3
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
             if (host->fifo_mode && size) {
               len = 0;
-            if (data->flags == MMC_DATA_READ) {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_RXDR)) {
Quoted 8 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 7 lines
drivers/mmc/dw_mmc.c +4 -1
+            if (data->flags == MMC_DATA_READ &&
+                (mask & DWMCI_INTMSK_RXDR)) {
+                while (size) {
                       len = dwmci_readl(host, DWMCI_STATUS);
                       len = (len >> DWMCI_FIFO_SHIFT) &
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

this changing is related with bug?

Quoted 1 line

I just hit this bug on rk3036 board.

This changing is just an indentation, isn't?
It looks like unnecessary modifying.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

When DTO interrupt occurred, there are any remaining data still in FIFO due to RX FIFO threshold is larger than remaining data. It also causes that dwmmc didn't trigger RXDR interrupt. It's responsibility of driver to read remaining bytes on seeing DTO interrupt. So we need rework dwmci_data_transfer w/ pio mode.

Sure, your bug is possible to occur..but my mean is that modified DWMCI_FIFO_MASK isn't related with your entire bug.

Okay I see. If I understand correctly, you recommend that set fifo-depth to 1, so that host can trigger RXDR interrupt as soon as 1 bytes data come in. I think it's inefficient.

Well, my meaning is " len = (len >> DWMCI_FIFO_SHIFT) & DWMCI_FIFO_MASK;"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 2 lines
drivers/mmc/dw_mmc.c +1 -1
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

It doesn't need to modify. There is no reason to change.

Quoted 32 lines
Quoted 32 lines

Best Regards,
Jaehoon Chung

Quoted 27 lines
Quoted 27 lines
Quoted 7 lines
drivers/mmc/dw_mmc.c +1 -3
                       len = min(size, len);
                       for (i = 0; i < len; i++)
                           *buf++ =
-                        dwmci_readl(host, DWMCI_DATA);
-                    dwmci_writel(host, DWMCI_RINTSTS,
-                             DWMCI_INTMSK_RXDR);
+                            dwmci_readl(host,

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 139

Quoted 10 lines
drivers/mmc/dw_mmc.c +6 -3
+                                DWMCI_DATA);
+                    size = size > len ? (size - len) : 0;
                   }
-            } else {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_TXDR)) {
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_RXDR);
+            } else if (data->flags == MMC_DATA_WRITE &&
+                   (mask & DWMCI_INTMSK_TXDR)) {

data->flags == MMC_DATA_WRITE doesn't need..flags are only two.. one is MMC_DATA_READ, otherwise it's MMC_DATA_WRITE.

Quoted 7 lines
drivers/mmc/dw_mmc.c +3 -2
+                while (size) {
                       len = dwmci_readl(host, DWMCI_STATUS);
                       len = fifo_depth - ((len >>
-                           DWMCI_FIFO_SHIFT) &
-                           DWMCI_FIFO_MASK);
+                                 DWMCI_FIFO_SHIFT) &
+                                DWMCI_FIFO_MASK);
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

ditto.

Quoted 4 lines
drivers/mmc/dw_mmc.c +2 -2
-                           DWMCI_FIFO_SHIFT) &
-                           DWMCI_FIFO_MASK);
+                                 DWMCI_FIFO_SHIFT) &
+                                DWMCI_FIFO_MASK);

Ditto.

Best Regards,
Jaehoon Chung

Quoted 38 lines
Quoted 33 lines
Quoted 30 lines
Quoted 26 lines

Best Regards,
Jaehoon Chung

Quoted 13 lines
drivers/mmc/dw_mmc.c +3 -3
                       len = min(size, len);
                       for (i = 0; i < len; i++)
                           dwmci_writel(host, DWMCI_DATA,
                                    *buf++);
-                    dwmci_writel(host, DWMCI_RINTSTS,
-                             DWMCI_INTMSK_TXDR);
+                    size = size > len ? (size - len) : 0;
                   }
+                dwmci_writel(host, DWMCI_RINTSTS,
+                         DWMCI_INTMSK_TXDR);
               }
-            size = size > len ? (size - len) : 0;
           }
Quoted 2 lines
             /* Data arrived correctly. */

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

#3 lore raw

PATCH 2/3 rockchip: add usb mass storage feature support for rk3036

In reply to Simon Glass

Hi,

2016-09-06 9:03 GMT+08:00 Simon Glass <[email protected]>:

Quoted 6 lines · Jacob Chen
Quoted 5 lines

From: "jacob2.chen" <[email protected]>

Enable ums feature for rk3036 boards, so that we can mount the mmc device to PC.

Quoted 7 lines
Quoted 5 lines

---

 include/configs/rk3036_common.h | 4 ++++
 1 file changed, 4 insertions(+)

This patch has no relations with other patchs.
Can we merge it alone?

Quoted 4 lines

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

#15 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

In reply to Jaehoon Chung

Hi,

Quoted 34 lines · Jaehoon Chung
Quoted 33 lines · Ziyuan Xu
Quoted 30 lines · Jaehoon Chung
Quoted 29 lines · Ziyuan Xu

hi Jaehoon,

Quoted 25 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 1 line

Could you change from jacob2.chen to your name?

Quoted 14 lines

---

   drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
   1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -2
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
             if (host->fifo_mode && size) {
               len = 0;
-            if (data->flags == MMC_DATA_READ) {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 128

Quoted 8 lines
drivers/mmc/dw_mmc.c +4 -2
-                     DWMCI_INTMSK_RXDR)) {
+            if (data->flags == MMC_DATA_READ &&
+                (mask & DWMCI_INTMSK_RXDR)) {
+                while (size) {
                       len = dwmci_readl(host, DWMCI_STATUS);
                       len = (len >> DWMCI_FIFO_SHIFT) &
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

What is the status of this patch please?

[...]

Regards,
Simon

#16 lore raw

PATCH 1/3 mmc: dw_mmc: change the read/write order under fifo mode

hi Simon,

Quoted 37 lines · Simon Glass

Hi,

Quoted 34 lines · Jaehoon Chung
Quoted 33 lines · Ziyuan Xu
Quoted 31 lines · Jaehoon Chung
Quoted 30 lines · Ziyuan Xu

hi Jaehoon,

Quoted 26 lines · Jaehoon Chung

Hi Jacob,

Quoted 4 lines · Jacob Chen

From: "jacob2.chen" <[email protected]>

The former implement have a bug.
It will cause wrong data reading sometimes.

Could you explain what bug is there?

Quoted 1 line

Could you change from jacob2.chen to your name?

Quoted 15 lines

---

    drivers/mmc/dw_mmc.c | 32 +++++++++++++++++---------------
    1 file changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +0 -3
index afc674d..f072739 100644
@@ -120,35 +120,37 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
              if (host->fifo_mode && size) {
                len = 0;
-            if (data->flags == MMC_DATA_READ) {
-                if ((dwmci_readl(host, DWMCI_RINTSTS) &
-                     DWMCI_INTMSK_RXDR)) {
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/mmc/dw_mmc.c static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) · line 127

Quoted 7 lines
drivers/mmc/dw_mmc.c +4 -1
+            if (data->flags == MMC_DATA_READ &&
+                (mask & DWMCI_INTMSK_RXDR)) {
+                while (size) {
                        len = dwmci_readl(host, DWMCI_STATUS);
                        len = (len >> DWMCI_FIFO_SHIFT) &
-                            DWMCI_FIFO_MASK;
+                        DWMCI_FIFO_MASK;

What is the status of this patch please?

I have sent patch v2, and Jaehoon applied it. Pls see
http://patchwork.ozlabs.org/patch/671533/.
Thanks for your attention.

Quoted 8 lines

[...]

Regards,
Simon

#4 lore raw

PATCH 2/3 rockchip: add usb mass storage feature support for rk3036

In reply to 陈豪
Quoted 13 lines · ??

Hi,

2016-09-06 9:03 GMT+08:00 Simon Glass <[email protected]>:

Quoted 9 lines · Jacob Chen
Quoted 8 lines

From: "jacob2.chen" <[email protected]>

Enable ums feature for rk3036 boards, so that we can mount the mmc device to PC.

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
 include/configs/rk3036_common.h | 4 ++++
 1 file changed, 4 insertions(+)

This patch has no relations with other patchs.
Can we merge it alone?

Applied to u-boot-rockchip, thanks!