Patchwork [U-Boot,3/9] mx23: Fix transfer size setting for SPI

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

Comments

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

Description missing. Was this ever tested? Does SSP DMA work?

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  drivers/spi/mxs_spi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
> index bb865b7..10bf5aa 100644
> --- a/drivers/spi/mxs_spi.c
> +++ b/drivers/spi/mxs_spi.c
> @@ -167,8 +167,13 @@ static int mxs_spi_xfer_pio(struct mxs_spi_slave
> *slave, mxs_spi_start_xfer(ssp_regs);
> 
>  	while (length--) {
> +#if defined(CONFIG_MX23)
> +		writel(SSP_CTRL0_XFER_COUNT_MASK, &ssp_regs->hw_ssp_ctrl0_clr);
> +		writel(1, &ssp_regs->hw_ssp_ctrl0_set);
> +#elif defined(CONFIG_MX28)
>  		/* We transfer 1 byte */
>  		writel(1, &ssp_regs->hw_ssp_xfer_size);
> +#endif
> 
>  		if ((flags & SPI_XFER_END) && !length)
>  			mxs_spi_end_xfer(ssp_regs);

Best regards,
Marek Vasut
Otavio Salvador - Jan. 22, 2013, 1:47 a.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 drivers/spi/mxs_spi.c | 5 +++++
 1 file changed, 5 insertions(+)
Otavio Salvador - Jan. 22, 2013, 1:55 a.m.
On Mon, Jan 21, 2013 at 11:46 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
> Description missing. Was this ever tested? Does SSP DMA work?
>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

No; I did not test it as NAND support is not yet done but this was
need to get it going. This is exactly same code as done in v3.7 kernel
so seems fine.

What you want added in description?

--
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 a.m.
Dear Otavio Salvador,

> On Mon, Jan 21, 2013 at 11:46 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Otavio Salvador,
> > 
> > Description missing. Was this ever tested? Does SSP DMA work?
> > 
> >> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> 
> No; I did not test it as NAND support is not yet done but this was
> need to get it going. This is exactly same code as done in v3.7 kernel
> so seems fine.

SPI has nothing to do with NAND. Please at least test code or clearly state the 
code was untested.

> What you want added in description?

What this patch does.

Best regards,
Marek Vasut
Marek Vasut - Jan. 24, 2013, 6:14 p.m.
Dear Otavio Salvador,

NAK, this won't work. SSP0 DMA has this +1 offset in it's channel placement (so 
SSP0 DMA channel is actually channel 1), check the MMC patch.

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  drivers/spi/mxs_spi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
> index bb865b7..10bf5aa 100644
> --- a/drivers/spi/mxs_spi.c
> +++ b/drivers/spi/mxs_spi.c
> @@ -167,8 +167,13 @@ static int mxs_spi_xfer_pio(struct mxs_spi_slave
> *slave, mxs_spi_start_xfer(ssp_regs);
> 
>  	while (length--) {
> +#if defined(CONFIG_MX23)
> +		writel(SSP_CTRL0_XFER_COUNT_MASK, &ssp_regs->hw_ssp_ctrl0_clr);
> +		writel(1, &ssp_regs->hw_ssp_ctrl0_set);
> +#elif defined(CONFIG_MX28)
>  		/* We transfer 1 byte */
>  		writel(1, &ssp_regs->hw_ssp_xfer_size);
> +#endif
> 
>  		if ((flags & SPI_XFER_END) && !length)
>  			mxs_spi_end_xfer(ssp_regs);

Best regards,
Marek Vasut

Patch

diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index bb865b7..10bf5aa 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -167,8 +167,13 @@  static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave,
 		mxs_spi_start_xfer(ssp_regs);
 
 	while (length--) {
+#if defined(CONFIG_MX23)
+		writel(SSP_CTRL0_XFER_COUNT_MASK, &ssp_regs->hw_ssp_ctrl0_clr);
+		writel(1, &ssp_regs->hw_ssp_ctrl0_set);
+#elif defined(CONFIG_MX28)
 		/* We transfer 1 byte */
 		writel(1, &ssp_regs->hw_ssp_xfer_size);
+#endif
 
 		if ((flags & SPI_XFER_END) && !length)
 			mxs_spi_end_xfer(ssp_regs);