Patchwork [U-Boot,2/9] mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode

login
register
mail settings
Submitter Otavio Salvador
Date Jan. 22, 2013, 1:47 a.m.
Message ID <1358819250-31625-3-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/214304/
State Not Applicable
Headers show

Comments

Marek Vasut - Jan. 22, 2013, 1:45 a.m.
Dear Otavio Salvador,

> From: Marek Vasut <marex@denx.de>
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
> index 0c4cd54..4b178be 100644
> --- a/drivers/mmc/mxsmmc.c
> +++ b/drivers/mmc/mxsmmc.c
> @@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
> struct mmc_data *data) }
> 
>  		ctrl0 |= SSP_CTRL0_DATA_XFER;
> +
> +		reg = data->blocksize * data->blocks;
> +#if defined(CONFIG_MX23)
> +		if (reg & ~SSP_CTRL0_XFER_COUNT_MASK) {
> +			printf("MMC%d: Transfer too large (%i bytes)!\n",
> +				mmc->block_dev.dev, reg);
> +			return -EINVAL;
> +		}
> +
> +		ctrl0 |= reg & SSP_CTRL0_XFER_COUNT_MASK;
> +
> +		reg = readl(&ssp_regs->hw_ssp_cmd0);
> +		reg &= ~0xfff00;
> +		reg |= (data->blocks - 1) << 8;
> +		reg |= (ffs(data->blocksize) - 1) << 16;

This is using some random hard-coded offsets, I told you numerous times I will 
NAK this.

Sorry.

Best regards,
Marek Vasut
Otavio Salvador - Jan. 22, 2013, 1:47 a.m.
From: Marek Vasut <marex@denx.de>

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
Otavio Salvador - Jan. 22, 2013, 1:53 a.m.
On Mon, Jan 21, 2013 at 11:45 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> From: Marek Vasut <marex@denx.de>
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>>  drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++---
>>  1 file changed, 21 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
>> index 0c4cd54..4b178be 100644
>> --- a/drivers/mmc/mxsmmc.c
>> +++ b/drivers/mmc/mxsmmc.c
>> @@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
>> struct mmc_data *data) }
>>
>>               ctrl0 |= SSP_CTRL0_DATA_XFER;
>> +
>> +             reg = data->blocksize * data->blocks;
>> +#if defined(CONFIG_MX23)
>> +             if (reg & ~SSP_CTRL0_XFER_COUNT_MASK) {
>> +                     printf("MMC%d: Transfer too large (%i bytes)!\n",
>> +                             mmc->block_dev.dev, reg);
>> +                     return -EINVAL;
>> +             }
>> +
>> +             ctrl0 |= reg & SSP_CTRL0_XFER_COUNT_MASK;
>> +
>> +             reg = readl(&ssp_regs->hw_ssp_cmd0);
>> +             reg &= ~0xfff00;
>> +             reg |= (data->blocks - 1) << 8;
>> +             reg |= (ffs(data->blocksize) - 1) << 16;
>
> This is using some random hard-coded offsets, I told you numerous times I will
> NAK this.

It is your patch ;-) So ...

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Marek Vasut - Jan. 22, 2013, 2:01 a.m.
Dear Otavio Salvador,

> On Mon, Jan 21, 2013 at 11:45 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Otavio Salvador,
> > 
> >> From: Marek Vasut <marex@denx.de>
> >> 
> >> Signed-off-by: Marek Vasut <marex@denx.de>
> >> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> >> ---
> >> 
> >>  drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++---
> >>  1 file changed, 21 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
> >> index 0c4cd54..4b178be 100644
> >> --- a/drivers/mmc/mxsmmc.c
> >> +++ b/drivers/mmc/mxsmmc.c
> >> @@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd
> >> *cmd, struct mmc_data *data) }
> >> 
> >>               ctrl0 |= SSP_CTRL0_DATA_XFER;
> >> 
> >> +
> >> +             reg = data->blocksize * data->blocks;
> >> +#if defined(CONFIG_MX23)
> >> +             if (reg & ~SSP_CTRL0_XFER_COUNT_MASK) {
> >> +                     printf("MMC%d: Transfer too large (%i bytes)!\n",
> >> +                             mmc->block_dev.dev, reg);
> >> +                     return -EINVAL;
> >> +             }
> >> +
> >> +             ctrl0 |= reg & SSP_CTRL0_XFER_COUNT_MASK;
> >> +
> >> +             reg = readl(&ssp_regs->hw_ssp_cmd0);
> >> +             reg &= ~0xfff00;
> >> +             reg |= (data->blocks - 1) << 8;
> >> +             reg |= (ffs(data->blocksize) - 1) << 16;
> > 
> > This is using some random hard-coded offsets, I told you numerous times I
> > will NAK this.
> 
> It is your patch ;-) So ...

So I'll NAK it. I have no problem with it. Besides, this is only based on my 
work, but whatever.

Best regards,
Marek Vasut

Patch

diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 0c4cd54..4b178be 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -211,14 +211,32 @@  mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 		}
 
 		ctrl0 |= SSP_CTRL0_DATA_XFER;
+
+		reg = data->blocksize * data->blocks;
+#if defined(CONFIG_MX23)
+		if (reg & ~SSP_CTRL0_XFER_COUNT_MASK) {
+			printf("MMC%d: Transfer too large (%i bytes)!\n",
+				mmc->block_dev.dev, reg);
+			return -EINVAL;
+		}
+
+		ctrl0 |= reg & SSP_CTRL0_XFER_COUNT_MASK;
+
+		reg = readl(&ssp_regs->hw_ssp_cmd0);
+		reg &= ~0xfff00;
+		reg |= (data->blocks - 1) << 8;
+		reg |= (ffs(data->blocksize) - 1) << 16;
+
+		writel(reg, &ssp_regs->hw_ssp_cmd0);
+#elif defined(CONFIG_MX28)
+		writel(reg, &ssp_regs->hw_ssp_xfer_size);
+
 		reg = ((data->blocks - 1) <<
 			SSP_BLOCK_SIZE_BLOCK_COUNT_OFFSET) |
 			((ffs(data->blocksize) - 1) <<
 			SSP_BLOCK_SIZE_BLOCK_SIZE_OFFSET);
 		writel(reg, &ssp_regs->hw_ssp_block_size);
-
-		reg = data->blocksize * data->blocks;
-		writel(reg, &ssp_regs->hw_ssp_xfer_size);
+#endif
 	}
 
 	/* Kick off the command */