linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the mmc-uh tree
@ 2014-07-28  4:46 Stephen Rothwell
  2014-07-28 17:58 ` Sonny Rao
  2014-08-08  3:25 ` linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
  0 siblings, 2 replies; 11+ messages in thread
From: Stephen Rothwell @ 2014-07-28  4:46 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-next, linux-kernel, Sonny Rao

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

Hi Ulf,

After merging the mmc-uh tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
   dw_mci_idmac_reset(host);
   ^

Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
reset procedure").

I have used the mmc-uh tree from next-20140725 for today.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: build failure after merge of the mmc-uh tree
  2014-07-28  4:46 linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
@ 2014-07-28 17:58 ` Sonny Rao
  2014-08-04 13:44   ` Ulf Hansson
  2014-08-08  3:25 ` linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
  1 sibling, 1 reply; 11+ messages in thread
From: Sonny Rao @ 2014-07-28 17:58 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Ulf Hansson, linux-next, linux-kernel@vger.kernel.org

On Sun, Jul 27, 2014 at 9:46 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Ulf,
>
> After merging the mmc-uh tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
>
> drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
> drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
>    dw_mci_idmac_reset(host);
>    ^

Hi, sorry about that.  It looks like it fails to build when
CONFIG_MMC_DW_IDMAC is not set.
I changed that bit of code from using #ifdef to using just C if
statement, but I think in this case the function being called doesn't
exist when CONFIG_MMC_DW_IDMAC is not set, so that was incorrect and
we should go back to using something like:

#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
        /* It is also recommended that we reset and reprogram idmac */
        dw_mci_idmac_reset(host);
#endif


Ulf, I can respin the patch if you'd like or feel free to fix it
yourself too.  Thanks.


>
> Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
> reset procedure").
>
> I have used the mmc-uh tree from next-20140725 for today.
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: build failure after merge of the mmc-uh tree
  2014-07-28 17:58 ` Sonny Rao
@ 2014-08-04 13:44   ` Ulf Hansson
  2014-08-05  1:19     ` [PATCH] mmc: dw_mmc: change to use recommended reset procedure Sonny Rao
  0 siblings, 1 reply; 11+ messages in thread
From: Ulf Hansson @ 2014-08-04 13:44 UTC (permalink / raw)
  To: Sonny Rao
  Cc: Stephen Rothwell, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org

On 28 July 2014 19:58, Sonny Rao <sonnyrao@chromium.org> wrote:
> On Sun, Jul 27, 2014 at 9:46 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> Hi Ulf,
>>
>> After merging the mmc-uh tree, today's linux-next build (arm
>> multi_v7_defconfig) failed like this:
>>
>> drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
>> drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
>>    dw_mci_idmac_reset(host);
>>    ^
>
> Hi, sorry about that.  It looks like it fails to build when
> CONFIG_MMC_DW_IDMAC is not set.
> I changed that bit of code from using #ifdef to using just C if
> statement, but I think in this case the function being called doesn't
> exist when CONFIG_MMC_DW_IDMAC is not set, so that was incorrect and
> we should go back to using something like:
>
> #if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
>         /* It is also recommended that we reset and reprogram idmac */
>         dw_mci_idmac_reset(host);
> #endif
>
>
> Ulf, I can respin the patch if you'd like or feel free to fix it
> yourself too.  Thanks.

I haven't got the time to fix this yet, sorry.

It would simplify a bit if you respin the patch, so please do so.

Kind regards
Uffe

>
>
>>
>> Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
>> reset procedure").
>>
>> I have used the mmc-uh tree from next-20140725 for today.
>> --
>> Cheers,
>> Stephen Rothwell                    sfr@canb.auug.org.au

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] mmc: dw_mmc: change to use recommended reset procedure
  2014-08-04 13:44   ` Ulf Hansson
@ 2014-08-05  1:19     ` Sonny Rao
  2014-08-07  8:40       ` Jaehoon Chung
  2014-08-11  7:55       ` Ulf Hansson
  0 siblings, 2 replies; 11+ messages in thread
From: Sonny Rao @ 2014-08-05  1:19 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, linux-next, grundler, linux-samsung-soc, linux-kernel,
	Stephen Rothwell, linux-arm-kernel, jh80.chung, cjb, tgih.jun,
	kgene.kim, joshi, t.figa, dianders, Yuvaraj Kumar C D, Sonny Rao

This patch changes the fifo reset code to follow the reset procedure
outlined in the documentation of Synopsys Mobile storage host databook.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[sonnyrao: fix compile for !CONFIG_MMC_DW_IDMAC case]
---
 drivers/mmc/host/dw_mmc.c | 87 ++++++++++++++++++++++++++++++++++-------------
 drivers/mmc/host/dw_mmc.h |  5 +++
 2 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 1ac227c..39cf54f 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -111,8 +111,7 @@ static const u8 tuning_blk_pattern_8bit[] = {
 	0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
 };
 
-static inline bool dw_mci_fifo_reset(struct dw_mci *host);
-static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host);
+static bool dw_mci_reset(struct dw_mci *host);
 
 #if defined(CONFIG_DEBUG_FS)
 static int dw_mci_req_show(struct seq_file *s, void *v)
@@ -1235,7 +1234,7 @@ static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
 		 * After an error, there may be data lingering
 		 * in the FIFO
 		 */
-		dw_mci_fifo_reset(host);
+		dw_mci_reset(host);
 	} else {
 		data->bytes_xfered = data->blocks * data->blksz;
 		data->error = 0;
@@ -1352,7 +1351,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
 
 			/* CMD error in data command */
 			if (mrq->cmd->error && mrq->data)
-				dw_mci_fifo_reset(host);
+				dw_mci_reset(host);
 
 			host->cmd = NULL;
 			host->data = NULL;
@@ -1963,14 +1962,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
 			}
 
 			/* Power down slot */
-			if (present == 0) {
-				/* Clear down the FIFO */
-				dw_mci_fifo_reset(host);
-#ifdef CONFIG_MMC_DW_IDMAC
-				dw_mci_idmac_reset(host);
-#endif
-
-			}
+			if (present == 0)
+				dw_mci_reset(host);
 
 			spin_unlock_bh(&host->lock);
 
@@ -2208,8 +2201,11 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
 	return false;
 }
 
-static inline bool dw_mci_fifo_reset(struct dw_mci *host)
+static bool dw_mci_reset(struct dw_mci *host)
 {
+	u32 flags = SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET;
+	bool ret = false;
+
 	/*
 	 * Reseting generates a block interrupt, hence setting
 	 * the scatter-gather pointer to NULL.
@@ -2219,15 +2215,60 @@ static inline bool dw_mci_fifo_reset(struct dw_mci *host)
 		host->sg = NULL;
 	}
 
-	return dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
-}
+	if (host->use_dma)
+		flags |= SDMMC_CTRL_DMA_RESET;
 
-static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host)
-{
-	return dw_mci_ctrl_reset(host,
-				 SDMMC_CTRL_FIFO_RESET |
-				 SDMMC_CTRL_RESET |
-				 SDMMC_CTRL_DMA_RESET);
+	if (dw_mci_ctrl_reset(host, flags)) {
+		/*
+		 * In all cases we clear the RAWINTS register to clear any
+		 * interrupts.
+		 */
+		mci_writel(host, RINTSTS, 0xFFFFFFFF);
+
+		/* if using dma we wait for dma_req to clear */
+		if (host->use_dma) {
+			unsigned long timeout = jiffies + msecs_to_jiffies(500);
+			u32 status;
+			do {
+				status = mci_readl(host, STATUS);
+				if (!(status & SDMMC_STATUS_DMA_REQ))
+					break;
+				cpu_relax();
+			} while (time_before(jiffies, timeout));
+
+			if (status & SDMMC_STATUS_DMA_REQ) {
+				dev_err(host->dev,
+					"%s: Timeout waiting for dma_req to "
+					"clear during reset\n", __func__);
+				goto ciu_out;
+			}
+
+			/* when using DMA next we reset the fifo again */
+			if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET))
+				goto ciu_out;
+		}
+	} else {
+		/* if the controller reset bit did clear, then set clock regs */
+		if (!(mci_readl(host, CTRL) & SDMMC_CTRL_RESET)) {
+			dev_err(host->dev, "%s: fifo/dma reset bits didn't "
+				"clear but ciu was reset, doing clock update\n",
+				__func__);
+			goto ciu_out;
+		}
+	}
+
+#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
+	/* It is also recommended that we reset and reprogram idmac */
+	dw_mci_idmac_reset(host);
+#endif
+
+	ret = true;
+
+ciu_out:
+	/* After a CTRL reset we need to have CIU set clock registers  */
+	mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
+
+	return ret;
 }
 
 #ifdef CONFIG_OF
@@ -2425,7 +2466,7 @@ int dw_mci_probe(struct dw_mci *host)
 	}
 
 	/* Reset all blocks */
-	if (!dw_mci_ctrl_all_reset(host))
+	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS))
 		return -ENODEV;
 
 	host->dma_ops = host->pdata->dma_ops;
@@ -2612,7 +2653,7 @@ int dw_mci_resume(struct dw_mci *host)
 		}
 	}
 
-	if (!dw_mci_ctrl_all_reset(host)) {
+	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
 		ret = -ENODEV;
 		return ret;
 	}
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 738fa24..08fd956 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -129,6 +129,7 @@
 #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
+#define SDMMC_STATUS_DMA_REQ		BIT(31)
 /* FIFOTH register defines */
 #define SDMMC_SET_FIFOTH(m, r, t)	(((m) & 0x7) << 28 | \
 					 ((r) & 0xFFF) << 16 | \
@@ -150,6 +151,10 @@
 /* Card read threshold */
 #define SDMMC_SET_RD_THLD(v, x)		(((v) & 0x1FFF) << 16 | (x))
 
+/* All ctrl reset bits */
+#define SDMMC_CTRL_ALL_RESET_FLAGS \
+	(SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
+
 /* Register access macros */
 #define mci_readl(dev, reg)			\
 	__raw_readl((dev)->regs + SDMMC_##reg)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: change to use recommended reset procedure
  2014-08-05  1:19     ` [PATCH] mmc: dw_mmc: change to use recommended reset procedure Sonny Rao
@ 2014-08-07  8:40       ` Jaehoon Chung
  2014-08-11  7:55       ` Ulf Hansson
  1 sibling, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2014-08-07  8:40 UTC (permalink / raw)
  To: Sonny Rao, Ulf Hansson
  Cc: dianders, Stephen Rothwell, linux-samsung-soc, Yuvaraj Kumar C D,
	grundler, t.figa, linux-mmc, linux-kernel, joshi, jh80.chung,
	tgih.jun, linux-next, kgene.kim, cjb, linux-arm-kernel

Hi, 

I remembered that this patch was pushed at Ulf's tree.

Since dw_mci_idmac_reset() is located into #if CONFIG_MMC_DW_IDMAC,
it occurred the compiler error.
And it seems that didn't need to use "IS_ENABLED()" at there.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

On 08/05/2014 10:19 AM, Sonny Rao wrote:
> This patch changes the fifo reset code to follow the reset procedure
> outlined in the documentation of Synopsys Mobile storage host databook.
> 
> Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> [sonnyrao: fix compile for !CONFIG_MMC_DW_IDMAC case]
> ---
>  drivers/mmc/host/dw_mmc.c | 87 ++++++++++++++++++++++++++++++++++-------------
>  drivers/mmc/host/dw_mmc.h |  5 +++
>  2 files changed, 69 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 1ac227c..39cf54f 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -111,8 +111,7 @@ static const u8 tuning_blk_pattern_8bit[] = {
>  	0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
>  };
>  
> -static inline bool dw_mci_fifo_reset(struct dw_mci *host);
> -static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host);
> +static bool dw_mci_reset(struct dw_mci *host);
>  
>  #if defined(CONFIG_DEBUG_FS)
>  static int dw_mci_req_show(struct seq_file *s, void *v)
> @@ -1235,7 +1234,7 @@ static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
>  		 * After an error, there may be data lingering
>  		 * in the FIFO
>  		 */
> -		dw_mci_fifo_reset(host);
> +		dw_mci_reset(host);
>  	} else {
>  		data->bytes_xfered = data->blocks * data->blksz;
>  		data->error = 0;
> @@ -1352,7 +1351,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
>  
>  			/* CMD error in data command */
>  			if (mrq->cmd->error && mrq->data)
> -				dw_mci_fifo_reset(host);
> +				dw_mci_reset(host);
>  
>  			host->cmd = NULL;
>  			host->data = NULL;
> @@ -1963,14 +1962,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
>  			}
>  
>  			/* Power down slot */
> -			if (present == 0) {
> -				/* Clear down the FIFO */
> -				dw_mci_fifo_reset(host);
> -#ifdef CONFIG_MMC_DW_IDMAC
> -				dw_mci_idmac_reset(host);
> -#endif
> -
> -			}
> +			if (present == 0)
> +				dw_mci_reset(host);
>  
>  			spin_unlock_bh(&host->lock);
>  
> @@ -2208,8 +2201,11 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
>  	return false;
>  }
>  
> -static inline bool dw_mci_fifo_reset(struct dw_mci *host)
> +static bool dw_mci_reset(struct dw_mci *host)
>  {
> +	u32 flags = SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET;
> +	bool ret = false;
> +
>  	/*
>  	 * Reseting generates a block interrupt, hence setting
>  	 * the scatter-gather pointer to NULL.
> @@ -2219,15 +2215,60 @@ static inline bool dw_mci_fifo_reset(struct dw_mci *host)
>  		host->sg = NULL;
>  	}
>  
> -	return dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
> -}
> +	if (host->use_dma)
> +		flags |= SDMMC_CTRL_DMA_RESET;
>  
> -static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host)
> -{
> -	return dw_mci_ctrl_reset(host,
> -				 SDMMC_CTRL_FIFO_RESET |
> -				 SDMMC_CTRL_RESET |
> -				 SDMMC_CTRL_DMA_RESET);
> +	if (dw_mci_ctrl_reset(host, flags)) {
> +		/*
> +		 * In all cases we clear the RAWINTS register to clear any
> +		 * interrupts.
> +		 */
> +		mci_writel(host, RINTSTS, 0xFFFFFFFF);
> +
> +		/* if using dma we wait for dma_req to clear */
> +		if (host->use_dma) {
> +			unsigned long timeout = jiffies + msecs_to_jiffies(500);
> +			u32 status;
> +			do {
> +				status = mci_readl(host, STATUS);
> +				if (!(status & SDMMC_STATUS_DMA_REQ))
> +					break;
> +				cpu_relax();
> +			} while (time_before(jiffies, timeout));
> +
> +			if (status & SDMMC_STATUS_DMA_REQ) {
> +				dev_err(host->dev,
> +					"%s: Timeout waiting for dma_req to "
> +					"clear during reset\n", __func__);
> +				goto ciu_out;
> +			}
> +
> +			/* when using DMA next we reset the fifo again */
> +			if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET))
> +				goto ciu_out;
> +		}
> +	} else {
> +		/* if the controller reset bit did clear, then set clock regs */
> +		if (!(mci_readl(host, CTRL) & SDMMC_CTRL_RESET)) {
> +			dev_err(host->dev, "%s: fifo/dma reset bits didn't "
> +				"clear but ciu was reset, doing clock update\n",
> +				__func__);
> +			goto ciu_out;
> +		}
> +	}
> +
> +#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
> +	/* It is also recommended that we reset and reprogram idmac */
> +	dw_mci_idmac_reset(host);
> +#endif
> +
> +	ret = true;
> +
> +ciu_out:
> +	/* After a CTRL reset we need to have CIU set clock registers  */
> +	mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
> +
> +	return ret;
>  }
>  
>  #ifdef CONFIG_OF
> @@ -2425,7 +2466,7 @@ int dw_mci_probe(struct dw_mci *host)
>  	}
>  
>  	/* Reset all blocks */
> -	if (!dw_mci_ctrl_all_reset(host))
> +	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS))
>  		return -ENODEV;
>  
>  	host->dma_ops = host->pdata->dma_ops;
> @@ -2612,7 +2653,7 @@ int dw_mci_resume(struct dw_mci *host)
>  		}
>  	}
>  
> -	if (!dw_mci_ctrl_all_reset(host)) {
> +	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
>  		ret = -ENODEV;
>  		return ret;
>  	}
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 738fa24..08fd956 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -129,6 +129,7 @@
>  #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
>  /* Status register defines */
>  #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
> +#define SDMMC_STATUS_DMA_REQ		BIT(31)
>  /* FIFOTH register defines */
>  #define SDMMC_SET_FIFOTH(m, r, t)	(((m) & 0x7) << 28 | \
>  					 ((r) & 0xFFF) << 16 | \
> @@ -150,6 +151,10 @@
>  /* Card read threshold */
>  #define SDMMC_SET_RD_THLD(v, x)		(((v) & 0x1FFF) << 16 | (x))
>  
> +/* All ctrl reset bits */
> +#define SDMMC_CTRL_ALL_RESET_FLAGS \
> +	(SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
> +
>  /* Register access macros */
>  #define mci_readl(dev, reg)			\
>  	__raw_readl((dev)->regs + SDMMC_##reg)
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: build failure after merge of the mmc-uh tree
  2014-07-28  4:46 linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
  2014-07-28 17:58 ` Sonny Rao
@ 2014-08-08  3:25 ` Stephen Rothwell
  2014-08-11  7:54   ` Ulf Hansson
  1 sibling, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2014-08-08  3:25 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-next, linux-kernel, Sonny Rao

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

Hi all,

On Mon, 28 Jul 2014 14:46:08 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> After merging the mmc-uh tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
> drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
>    dw_mci_idmac_reset(host);
>    ^
> 
> Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
> reset procedure").
> 
> I have used the mmc-uh tree from next-20140725 for today.

Ping.  We are nearly half way through the merge window and there has
been a patch posted for this, but the tree is still broken ...

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: build failure after merge of the mmc-uh tree
  2014-08-08  3:25 ` linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
@ 2014-08-11  7:54   ` Ulf Hansson
  0 siblings, 0 replies; 11+ messages in thread
From: Ulf Hansson @ 2014-08-11  7:54 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sonny Rao

On 8 August 2014 05:25, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi all,
>
> On Mon, 28 Jul 2014 14:46:08 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>
>> After merging the mmc-uh tree, today's linux-next build (arm
>> multi_v7_defconfig) failed like this:
>>
>> drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
>> drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
>>    dw_mci_idmac_reset(host);
>>    ^
>>
>> Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
>> reset procedure").
>>
>> I have used the mmc-uh tree from next-20140725 for today.
>
> Ping.  We are nearly half way through the merge window and there has
> been a patch posted for this, but the tree is still broken ...

Sorry for the delay. I have picked up the new version of the patch now.

Kind regards
Ulf Hansson

>
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: change to use recommended reset procedure
  2014-08-05  1:19     ` [PATCH] mmc: dw_mmc: change to use recommended reset procedure Sonny Rao
  2014-08-07  8:40       ` Jaehoon Chung
@ 2014-08-11  7:55       ` Ulf Hansson
  1 sibling, 0 replies; 11+ messages in thread
From: Ulf Hansson @ 2014-08-11  7:55 UTC (permalink / raw)
  To: Sonny Rao
  Cc: linux-mmc, linux-next@vger.kernel.org, Grant Grundler,
	linux-samsung-soc, linux-kernel@vger.kernel.org, Stephen Rothwell,
	linux-arm-kernel@lists.infradead.org, Jaehoon Chung, Chris Ball,
	tgih.jun@samsung.com, Kukjin Kim, sunil joshi, Tomasz Figa,
	Doug Anderson, Yuvaraj Kumar C D

On 5 August 2014 03:19, Sonny Rao <sonnyrao@chromium.org> wrote:
> This patch changes the fifo reset code to follow the reset procedure
> outlined in the documentation of Synopsys Mobile storage host databook.
>
> Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
> Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
> Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> [sonnyrao: fix compile for !CONFIG_MMC_DW_IDMAC case]

Thanks! Applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/dw_mmc.c | 87 ++++++++++++++++++++++++++++++++++-------------
>  drivers/mmc/host/dw_mmc.h |  5 +++
>  2 files changed, 69 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 1ac227c..39cf54f 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -111,8 +111,7 @@ static const u8 tuning_blk_pattern_8bit[] = {
>         0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
>  };
>
> -static inline bool dw_mci_fifo_reset(struct dw_mci *host);
> -static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host);
> +static bool dw_mci_reset(struct dw_mci *host);
>
>  #if defined(CONFIG_DEBUG_FS)
>  static int dw_mci_req_show(struct seq_file *s, void *v)
> @@ -1235,7 +1234,7 @@ static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
>                  * After an error, there may be data lingering
>                  * in the FIFO
>                  */
> -               dw_mci_fifo_reset(host);
> +               dw_mci_reset(host);
>         } else {
>                 data->bytes_xfered = data->blocks * data->blksz;
>                 data->error = 0;
> @@ -1352,7 +1351,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
>
>                         /* CMD error in data command */
>                         if (mrq->cmd->error && mrq->data)
> -                               dw_mci_fifo_reset(host);
> +                               dw_mci_reset(host);
>
>                         host->cmd = NULL;
>                         host->data = NULL;
> @@ -1963,14 +1962,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
>                         }
>
>                         /* Power down slot */
> -                       if (present == 0) {
> -                               /* Clear down the FIFO */
> -                               dw_mci_fifo_reset(host);
> -#ifdef CONFIG_MMC_DW_IDMAC
> -                               dw_mci_idmac_reset(host);
> -#endif
> -
> -                       }
> +                       if (present == 0)
> +                               dw_mci_reset(host);
>
>                         spin_unlock_bh(&host->lock);
>
> @@ -2208,8 +2201,11 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
>         return false;
>  }
>
> -static inline bool dw_mci_fifo_reset(struct dw_mci *host)
> +static bool dw_mci_reset(struct dw_mci *host)
>  {
> +       u32 flags = SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET;
> +       bool ret = false;
> +
>         /*
>          * Reseting generates a block interrupt, hence setting
>          * the scatter-gather pointer to NULL.
> @@ -2219,15 +2215,60 @@ static inline bool dw_mci_fifo_reset(struct dw_mci *host)
>                 host->sg = NULL;
>         }
>
> -       return dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
> -}
> +       if (host->use_dma)
> +               flags |= SDMMC_CTRL_DMA_RESET;
>
> -static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host)
> -{
> -       return dw_mci_ctrl_reset(host,
> -                                SDMMC_CTRL_FIFO_RESET |
> -                                SDMMC_CTRL_RESET |
> -                                SDMMC_CTRL_DMA_RESET);
> +       if (dw_mci_ctrl_reset(host, flags)) {
> +               /*
> +                * In all cases we clear the RAWINTS register to clear any
> +                * interrupts.
> +                */
> +               mci_writel(host, RINTSTS, 0xFFFFFFFF);
> +
> +               /* if using dma we wait for dma_req to clear */
> +               if (host->use_dma) {
> +                       unsigned long timeout = jiffies + msecs_to_jiffies(500);
> +                       u32 status;
> +                       do {
> +                               status = mci_readl(host, STATUS);
> +                               if (!(status & SDMMC_STATUS_DMA_REQ))
> +                                       break;
> +                               cpu_relax();
> +                       } while (time_before(jiffies, timeout));
> +
> +                       if (status & SDMMC_STATUS_DMA_REQ) {
> +                               dev_err(host->dev,
> +                                       "%s: Timeout waiting for dma_req to "
> +                                       "clear during reset\n", __func__);
> +                               goto ciu_out;
> +                       }
> +
> +                       /* when using DMA next we reset the fifo again */
> +                       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET))
> +                               goto ciu_out;
> +               }
> +       } else {
> +               /* if the controller reset bit did clear, then set clock regs */
> +               if (!(mci_readl(host, CTRL) & SDMMC_CTRL_RESET)) {
> +                       dev_err(host->dev, "%s: fifo/dma reset bits didn't "
> +                               "clear but ciu was reset, doing clock update\n",
> +                               __func__);
> +                       goto ciu_out;
> +               }
> +       }
> +
> +#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
> +       /* It is also recommended that we reset and reprogram idmac */
> +       dw_mci_idmac_reset(host);
> +#endif
> +
> +       ret = true;
> +
> +ciu_out:
> +       /* After a CTRL reset we need to have CIU set clock registers  */
> +       mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
> +
> +       return ret;
>  }
>
>  #ifdef CONFIG_OF
> @@ -2425,7 +2466,7 @@ int dw_mci_probe(struct dw_mci *host)
>         }
>
>         /* Reset all blocks */
> -       if (!dw_mci_ctrl_all_reset(host))
> +       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS))
>                 return -ENODEV;
>
>         host->dma_ops = host->pdata->dma_ops;
> @@ -2612,7 +2653,7 @@ int dw_mci_resume(struct dw_mci *host)
>                 }
>         }
>
> -       if (!dw_mci_ctrl_all_reset(host)) {
> +       if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
>                 ret = -ENODEV;
>                 return ret;
>         }
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 738fa24..08fd956 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -129,6 +129,7 @@
>  #define SDMMC_CMD_INDX(n)              ((n) & 0x1F)
>  /* Status register defines */
>  #define SDMMC_GET_FCNT(x)              (((x)>>17) & 0x1FFF)
> +#define SDMMC_STATUS_DMA_REQ           BIT(31)
>  /* FIFOTH register defines */
>  #define SDMMC_SET_FIFOTH(m, r, t)      (((m) & 0x7) << 28 | \
>                                          ((r) & 0xFFF) << 16 | \
> @@ -150,6 +151,10 @@
>  /* Card read threshold */
>  #define SDMMC_SET_RD_THLD(v, x)                (((v) & 0x1FFF) << 16 | (x))
>
> +/* All ctrl reset bits */
> +#define SDMMC_CTRL_ALL_RESET_FLAGS \
> +       (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
> +
>  /* Register access macros */
>  #define mci_readl(dev, reg)                    \
>         __raw_readl((dev)->regs + SDMMC_##reg)
> --
> 1.8.3.2
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: build failure after merge of the mmc-uh tree
@ 2015-08-26  2:04 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2015-08-26  2:04 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-next, linux-kernel, Srinivas Kandagatla

Hi Ulf,

After merging the mmc-uh tree, today's linux-next build (x86_64
allmodconfig) failed like this:

ERROR: "pinctrl_bind_pins" [drivers/mmc/core/mmc_core.ko] undefined!

Caused by commit

  175172f6367f ("mmc: pwrseq: bind pinctrl pins before using the gpios")

I have used te mmc-uh tree from next-20150825 for today.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: build failure after merge of the mmc-uh tree
@ 2015-12-31  3:53 Stephen Rothwell
  2016-01-05 16:30 ` Thierry Reding
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2015-12-31  3:53 UTC (permalink / raw)
  To: Ulf Hansson, Stephen Warren, Colin Cross, Olof Johansson,
	Thierry Reding
  Cc: linux-next, linux-kernel, Lucas Stach

Hi Ulf,

After merging the mmc-uh tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

drivers/mmc/host/sdhci-tegra.c:361:38: error: redefinition of 'sdhci_tegra210_pdata'
 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
                                      ^
drivers/mmc/host/sdhci-tegra.c:343:38: note: previous definition of 'sdhci_tegra210_pdata' was here
 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
                                      ^
drivers/mmc/host/sdhci-tegra.c:370:42: error: redefinition of 'soc_data_tegra210'
 static const struct sdhci_tegra_soc_data soc_data_tegra210 = {
                                          ^
drivers/mmc/host/sdhci-tegra.c:354:42: note: previous definition of 'soc_data_tegra210' was here
 static const struct sdhci_tegra_soc_data soc_data_tegra210 = {
                                          ^
drivers/mmc/host/sdhci-tegra.c:372:14: error: 'NVQUIRK_DISABLE_SDR50' undeclared here (not in a function)
  .nvquirks = NVQUIRK_DISABLE_SDR50 |
              ^
drivers/mmc/host/sdhci-tegra.c:373:7: error: 'NVQUIRK_DISABLE_DDR50' undeclared here (not in a function)
       NVQUIRK_DISABLE_DDR50 |
       ^
drivers/mmc/host/sdhci-tegra.c:374:7: error: 'NVQUIRK_DISABLE_SDR104' undeclared here (not in a function)
       NVQUIRK_DISABLE_SDR104,
       ^

Caused by patch

   "mmc: tegra: Add Tegra210 support"

turning up in two trees (mmc-uh and tegra) as separate commits and then
further changes to this file in the mmc-uh tree.

I used the version of the file from the mmc-uh tree.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: build failure after merge of the mmc-uh tree
  2015-12-31  3:53 Stephen Rothwell
@ 2016-01-05 16:30 ` Thierry Reding
  0 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2016-01-05 16:30 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Ulf Hansson, Stephen Warren, Colin Cross, Olof Johansson,
	linux-next, linux-kernel, Lucas Stach

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

On Thu, Dec 31, 2015 at 02:53:29PM +1100, Stephen Rothwell wrote:
> Hi Ulf,
> 
> After merging the mmc-uh tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> drivers/mmc/host/sdhci-tegra.c:361:38: error: redefinition of 'sdhci_tegra210_pdata'
>  static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
>                                       ^
> drivers/mmc/host/sdhci-tegra.c:343:38: note: previous definition of 'sdhci_tegra210_pdata' was here
>  static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
>                                       ^
> drivers/mmc/host/sdhci-tegra.c:370:42: error: redefinition of 'soc_data_tegra210'
>  static const struct sdhci_tegra_soc_data soc_data_tegra210 = {
>                                           ^
> drivers/mmc/host/sdhci-tegra.c:354:42: note: previous definition of 'soc_data_tegra210' was here
>  static const struct sdhci_tegra_soc_data soc_data_tegra210 = {
>                                           ^
> drivers/mmc/host/sdhci-tegra.c:372:14: error: 'NVQUIRK_DISABLE_SDR50' undeclared here (not in a function)
>   .nvquirks = NVQUIRK_DISABLE_SDR50 |
>               ^
> drivers/mmc/host/sdhci-tegra.c:373:7: error: 'NVQUIRK_DISABLE_DDR50' undeclared here (not in a function)
>        NVQUIRK_DISABLE_DDR50 |
>        ^
> drivers/mmc/host/sdhci-tegra.c:374:7: error: 'NVQUIRK_DISABLE_SDR104' undeclared here (not in a function)
>        NVQUIRK_DISABLE_SDR104,
>        ^
> 
> Caused by patch
> 
>    "mmc: tegra: Add Tegra210 support"
> 
> turning up in two trees (mmc-uh and tegra) as separate commits and then
> further changes to this file in the mmc-uh tree.
> 
> I used the version of the file from the mmc-uh tree.

Sorry about this. I had meant to send this to Ulf as a pull request
before the Christmas break but then got side-tracked and never got
around to it.

I've now removed that branch from the Tegra tree.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-01-05 16:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28  4:46 linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
2014-07-28 17:58 ` Sonny Rao
2014-08-04 13:44   ` Ulf Hansson
2014-08-05  1:19     ` [PATCH] mmc: dw_mmc: change to use recommended reset procedure Sonny Rao
2014-08-07  8:40       ` Jaehoon Chung
2014-08-11  7:55       ` Ulf Hansson
2014-08-08  3:25 ` linux-next: build failure after merge of the mmc-uh tree Stephen Rothwell
2014-08-11  7:54   ` Ulf Hansson
  -- strict thread matches above, loose matches on Subject: below --
2015-08-26  2:04 Stephen Rothwell
2015-12-31  3:53 Stephen Rothwell
2016-01-05 16:30 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).