Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275476 > unrolled thread

[PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version

Started byLudovic Desroches <ludovic.desroches@atmel.com>
First post2015-11-23 16:30 +0100
Last post2015-11-25 17:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version Ludovic Desroches <ludovic.desroches@atmel.com> - 2015-11-23 16:30 +0100
    Re: [PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on  controller version Ulf Hansson <ulf.hansson@linaro.org> - 2015-11-25 17:40 +0100

#1275476 — [PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version

FromLudovic Desroches <ludovic.desroches@atmel.com>
Date2015-11-23 16:30 +0100
Subject[PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version
Message-ID<qy1e2-3DU-17@gated-at.bofh.it>
The atmci_convert_chksize() function is no more valid for controller
version 0x600 due to the introduction of '2 data' chunk size.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 9f3bb61..a36ebda 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -180,20 +180,6 @@
 #	define ATMCI_PDC_CONNECTED	1
 #endif
 
-/*
- * Fix sconfig's burst size according to atmel MCI. We need to convert them as:
- * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
- *
- * This can be done by finding most significant bit set.
- */
-static inline unsigned int atmci_convert_chksize(unsigned int maxburst)
-{
-	if (maxburst > 1)
-		return fls(maxburst) - 2;
-	else
-		return 0;
-}
-
 #define AUTOSUSPEND_DELAY	50
 
 #define ATMCI_DATA_ERROR_FLAGS	(ATMCI_DCRCE | ATMCI_DTOE | ATMCI_OVRE | ATMCI_UNRE)
@@ -732,6 +718,29 @@ static inline unsigned int atmci_get_version(struct atmel_mci *host)
 	return atmci_readl(host, ATMCI_VERSION) & 0x00000fff;
 }
 
+/*
+ * Fix sconfig's burst size according to atmel MCI. We need to convert them as:
+ * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
+ * With version 0x600, we need to convert them as: 1 -> 0, 2 -> 1, 4 -> 2,
+ * 8 -> 3, 16 -> 4.
+ *
+ * This can be done by finding most significant bit set.
+ */
+static inline unsigned int atmci_convert_chksize(struct atmel_mci *host,
+						 unsigned int maxburst)
+{
+	unsigned int version = atmci_get_version(host);
+	unsigned int offset = 2;
+
+	if (version >= 0x600)
+		offset = 1;
+
+	if (maxburst > 1)
+		return fls(maxburst) - offset;
+	else
+		return 0;
+}
+
 static void atmci_timeout_timer(unsigned long data)
 {
 	struct atmel_mci *host;
@@ -1182,11 +1191,13 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 	if (data->flags & MMC_DATA_READ) {
 		direction = DMA_FROM_DEVICE;
 		host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
-		maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst);
+		maxburst = atmci_convert_chksize(host,
+						 host->dma_conf.src_maxburst);
 	} else {
 		direction = DMA_TO_DEVICE;
 		host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
-		maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst);
+		maxburst = atmci_convert_chksize(host,
+						 host->dma_conf.dst_maxburst);
 	}
 
 	if (host->caps.has_dma_conf_reg)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1277586 — Re: [PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version

FromUlf Hansson <ulf.hansson@linaro.org>
Date2015-11-25 17:40 +0100
SubjectRe: [PATCH 3/3] mmc: atmel-mci: atmci_convert_chksize depends on controller version
Message-ID<qyLgS-jU-41@gated-at.bofh.it>
In reply to#1275476
On 23 November 2015 at 16:27, Ludovic Desroches
<ludovic.desroches@atmel.com> wrote:
> The atmci_convert_chksize() function is no more valid for controller
> version 0x600 due to the introduction of '2 data' chunk size.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/atmel-mci.c | 43 +++++++++++++++++++++++++++----------------
>  1 file changed, 27 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 9f3bb61..a36ebda 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -180,20 +180,6 @@
>  #      define ATMCI_PDC_CONNECTED      1
>  #endif
>
> -/*
> - * Fix sconfig's burst size according to atmel MCI. We need to convert them as:
> - * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
> - *
> - * This can be done by finding most significant bit set.
> - */
> -static inline unsigned int atmci_convert_chksize(unsigned int maxburst)
> -{
> -       if (maxburst > 1)
> -               return fls(maxburst) - 2;
> -       else
> -               return 0;
> -}
> -
>  #define AUTOSUSPEND_DELAY      50
>
>  #define ATMCI_DATA_ERROR_FLAGS (ATMCI_DCRCE | ATMCI_DTOE | ATMCI_OVRE | ATMCI_UNRE)
> @@ -732,6 +718,29 @@ static inline unsigned int atmci_get_version(struct atmel_mci *host)
>         return atmci_readl(host, ATMCI_VERSION) & 0x00000fff;
>  }
>
> +/*
> + * Fix sconfig's burst size according to atmel MCI. We need to convert them as:
> + * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
> + * With version 0x600, we need to convert them as: 1 -> 0, 2 -> 1, 4 -> 2,
> + * 8 -> 3, 16 -> 4.
> + *
> + * This can be done by finding most significant bit set.
> + */
> +static inline unsigned int atmci_convert_chksize(struct atmel_mci *host,
> +                                                unsigned int maxburst)
> +{
> +       unsigned int version = atmci_get_version(host);
> +       unsigned int offset = 2;
> +
> +       if (version >= 0x600)
> +               offset = 1;
> +
> +       if (maxburst > 1)
> +               return fls(maxburst) - offset;
> +       else
> +               return 0;
> +}
> +
>  static void atmci_timeout_timer(unsigned long data)
>  {
>         struct atmel_mci *host;
> @@ -1182,11 +1191,13 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
>         if (data->flags & MMC_DATA_READ) {
>                 direction = DMA_FROM_DEVICE;
>                 host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
> -               maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst);
> +               maxburst = atmci_convert_chksize(host,
> +                                                host->dma_conf.src_maxburst);
>         } else {
>                 direction = DMA_TO_DEVICE;
>                 host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
> -               maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst);
> +               maxburst = atmci_convert_chksize(host,
> +                                                host->dma_conf.dst_maxburst);
>         }
>
>         if (host->caps.has_dma_conf_reg)
> --
> 2.5.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web