Skip to contentSkip to conversation

mmc/dwmmc: modify FIFO threshold only if value explicitly set

PATCH Superseded Alexey Brodkin 3 participants 5 messages Nov 27, 2013 – Dec 8, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc/dwmmc: modify FIFO threshold only if value explicitly set

If platform provides "host->fifoth_val" it will be used for initialization of DWMCI_FIFOTH register. Otherwise default value will be used.

This implementation allows:
* escape unclear and recursive calculations that are currently in use
* use whatever custom value for DWMCI_FIFOTH initialization if any
particular SoC requires it

Cc Mischa Jonker <[email protected]>
Cc Alim Akhtar <[email protected]>
Cc Rajeshwari Shinde <[email protected]>
Cc Jaehoon Chung <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Andy Fleming <[email protected]>
---
 drivers/mmc/dw_mmc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/dw_mmc.c +2 -7
index 1e0f72b..a47e02c 100644
@@ -300,7 +300,6 @@ static void dwmci_set_ios(struct mmc *mmc)
 static int dwmci_init(struct mmc *mmc)
 {
 	struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
-	u32 fifo_size;
 
 	if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) {
 		dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
@@ -330,13 +329,9 @@ static int dwmci_init(struct mmc *mmc)
 	dwmci_writel(host, DWMCI_IDINTEN, 0);
 	dwmci_writel(host, DWMCI_BMOD, 1);
 
-	if (!host->fifoth_val) {
-		fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-		fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
-		host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) |
-			TX_WMARK(fifo_size / 2);
+	if (host->fifoth_val) {
+		dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 	}
-	dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 
 	dwmci_writel(host, DWMCI_CLKENA, 0);
 	dwmci_writel(host, DWMCI_CLKSRC, 0);
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH v2 1/1 mmc/dwmmc: modify FIFO threshold only if value explicitly set

Quoted 54 lines · Alexey Brodkin

If platform provides "host->fifoth_val" it will be used for initialization of DWMCI_FIFOTH register. Otherwise default value will be used.

This implementation allows:
* escape unclear and recursive calculations that are currently in use
* use whatever custom value for DWMCI_FIFOTH initialization if any
particular SoC requires it

Cc Mischa Jonker <[email protected]>
Cc Alim Akhtar <[email protected]>
Cc Rajeshwari Shinde <[email protected]>
Cc Jaehoon Chung <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Andy Fleming <[email protected]>
---
 drivers/mmc/dw_mmc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/dw_mmc.c +2 -7
index 1e0f72b..a47e02c 100644
@@ -300,7 +300,6 @@ static void dwmci_set_ios(struct mmc *mmc)
 static int dwmci_init(struct mmc *mmc)
 {
 	struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
-	u32 fifo_size;
 
 	if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) {
 		dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
@@ -330,13 +329,9 @@ static int dwmci_init(struct mmc *mmc)
 	dwmci_writel(host, DWMCI_IDINTEN, 0);
 	dwmci_writel(host, DWMCI_BMOD, 1);
 
-	if (!host->fifoth_val) {
-		fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-		fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
-		host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) |
-			TX_WMARK(fifo_size / 2);
+	if (host->fifoth_val) {
+		dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 	}
-	dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 
 	dwmci_writel(host, DWMCI_CLKENA, 0);
 	dwmci_writel(host, DWMCI_CLKSRC, 0);
#3 lore raw

PATCH v2 1/1 mmc/dwmmc: modify FIFO threshold only if value explicitly set

Hi Alexey,

Will do so over the weekend.

Regards

-- Pantelis

Quoted 6 lines · Alexey Brodkin
Quoted 1 line · Jaehoon Chung

Any chance to get this patch applied?

-Alexey

#4 lore raw

PATCH v2 1/1 mmc/dwmmc: modify FIFO threshold only if value explicitly set

In reply to Alexey Brodkin

Hi Alexey,

Quoted 56 lines · Alexey Brodkin

If platform provides "host->fifoth_val" it will be used for initialization of DWMCI_FIFOTH register. Otherwise default value will be used.

This implementation allows:
* escape unclear and recursive calculations that are currently in use
* use whatever custom value for DWMCI_FIFOTH initialization if any particular SoC requires it

Cc Mischa Jonker <[email protected]>
Cc Alim Akhtar <[email protected]>
Cc Rajeshwari Shinde <[email protected]>
Cc Jaehoon Chung <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Andy Fleming <[email protected]>

---
drivers/mmc/dw_mmc.c | 9 ++-------

1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/dw_mmc.c +2 -7
index 1e0f72b..a47e02c 100644
@@ -300,7 +300,6 @@ static void dwmci_set_ios(struct mmc *mmc)
 static int dwmci_init(struct mmc *mmc)
 {
 	struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
-	u32 fifo_size;
 
 	if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) {
 		dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
@@ -330,13 +329,9 @@ static int dwmci_init(struct mmc *mmc)
 	dwmci_writel(host, DWMCI_IDINTEN, 0);
 	dwmci_writel(host, DWMCI_BMOD, 1);
 
-	if (!host->fifoth_val) {
-		fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
-		fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
-		host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) |
-			TX_WMARK(fifo_size / 2);
+	if (host->fifoth_val) {
+		dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 	}
-	dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val);
 
 	dwmci_writel(host, DWMCI_CLKENA, 0);
 	dwmci_writel(host, DWMCI_CLKSRC, 0);
Signature · 1 line
1.8.4.2

Thanks

-- Pantelis