Re: [U-Boot] [PATCH v2] driver: fsl_qspi: disable AHB buffer prefetch

2016-07-11 Thread Yunhui Cui

On 07/11, 2016, 11:17 PM, York Wrote:
> On 07/11/2016 12:49 AM, Yunhui Cui wrote:
> > From: Yunhui Cui 
> >
> > Errata: A-009282: QuadSPI data pre-fetch can result in incorrect data
> >
> > Signed-off-by: Yunhui Cui 
> > ---
> >   drivers/spi/fsl_qspi.c | 14 --
> >   1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index
> > 75cbab2..99634db 100644
> > --- a/drivers/spi/fsl_qspi.c
> > +++ b/drivers/spi/fsl_qspi.c
> > @@ -438,14 +438,24 @@ static void qspi_enable_ddr_mode(struct
> fsl_qspi_priv *priv)
> >   static void qspi_init_ahb_read(struct fsl_qspi_priv *priv)
> >   {
> > struct fsl_qspi_regs *regs = priv->regs;
> > +   int rx_size = 0x80;
> >
> > /* AHB configuration for access buffer 0/1/2 .*/
> > qspi_write32(priv->flags, >buf0cr,
> QSPI_BUFXCR_INVALID_MSTRID);
> > qspi_write32(priv->flags, >buf1cr,
> QSPI_BUFXCR_INVALID_MSTRID);
> > qspi_write32(priv->flags, >buf2cr,
> QSPI_BUFXCR_INVALID_MSTRID);
> > -   qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
> > -(0x80 << QSPI_BUF3CR_ADATSZ_SHIFT));
> >
> > +#if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A) \
> > +   || defined(CONFIG_LS1012A) || defined(CONFIG_LS102XA)
> > +   /*A-009282: QuadSPI data pre-fetch can result in incorrect data
> > +*Workaround: Keep the read data size to 64 bits (8 Bytes), which
> > +*disables the prefetch on the AHB buffer,and prevents this issue
> > +*from occurring.
> > +   */
> > +   rx_size = 0x1;
> > +#endif
> > +   qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
> > +(rx_size << QSPI_BUF3CR_ADATSZ_SHIFT));
> > /* We only use the buffer3 */
> > qspi_write32(priv->flags, >buf0ind, 0);
> > qspi_write32(priv->flags, >buf1ind, 0);
> >
> 
> Yunhui,
> 
> I suggested to use erratum macro, like CONFIG_SYS_FSL_ERRATUM_A009282.

[Yunhui] ok, I will update it in v3, thanks a lot.

> 
> York

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] driver: fsl_qspi: disable AHB buffer prefetch

2016-07-11 Thread Yunhui Cui
From: Yunhui Cui 

Errata: A-009282: QuadSPI data pre-fetch can result in incorrect data

Signed-off-by: Yunhui Cui 
---
 drivers/spi/fsl_qspi.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 75cbab2..99634db 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -438,14 +438,24 @@ static void qspi_enable_ddr_mode(struct fsl_qspi_priv 
*priv)
 static void qspi_init_ahb_read(struct fsl_qspi_priv *priv)
 {
struct fsl_qspi_regs *regs = priv->regs;
+   int rx_size = 0x80;
 
/* AHB configuration for access buffer 0/1/2 .*/
qspi_write32(priv->flags, >buf0cr, QSPI_BUFXCR_INVALID_MSTRID);
qspi_write32(priv->flags, >buf1cr, QSPI_BUFXCR_INVALID_MSTRID);
qspi_write32(priv->flags, >buf2cr, QSPI_BUFXCR_INVALID_MSTRID);
-   qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
-(0x80 << QSPI_BUF3CR_ADATSZ_SHIFT));
 
+#if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A) \
+   || defined(CONFIG_LS1012A) || defined(CONFIG_LS102XA)
+   /*A-009282: QuadSPI data pre-fetch can result in incorrect data
+*Workaround: Keep the read data size to 64 bits (8 Bytes), which
+*disables the prefetch on the AHB buffer,and prevents this issue
+*from occurring.
+   */
+   rx_size = 0x1;
+#endif
+   qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
+(rx_size << QSPI_BUF3CR_ADATSZ_SHIFT));
/* We only use the buffer3 */
qspi_write32(priv->flags, >buf0ind, 0);
qspi_write32(priv->flags, >buf1ind, 0);
-- 
2.1.0.27.g96db324

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] driver: fsl_qspi: disable AHB buffer prefetch

2016-07-11 Thread york sun
On 07/11/2016 12:49 AM, Yunhui Cui wrote:
> From: Yunhui Cui 
>
> Errata: A-009282: QuadSPI data pre-fetch can result in incorrect data
>
> Signed-off-by: Yunhui Cui 
> ---
>   drivers/spi/fsl_qspi.c | 14 --
>   1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
> index 75cbab2..99634db 100644
> --- a/drivers/spi/fsl_qspi.c
> +++ b/drivers/spi/fsl_qspi.c
> @@ -438,14 +438,24 @@ static void qspi_enable_ddr_mode(struct fsl_qspi_priv 
> *priv)
>   static void qspi_init_ahb_read(struct fsl_qspi_priv *priv)
>   {
>   struct fsl_qspi_regs *regs = priv->regs;
> + int rx_size = 0x80;
>
>   /* AHB configuration for access buffer 0/1/2 .*/
>   qspi_write32(priv->flags, >buf0cr, QSPI_BUFXCR_INVALID_MSTRID);
>   qspi_write32(priv->flags, >buf1cr, QSPI_BUFXCR_INVALID_MSTRID);
>   qspi_write32(priv->flags, >buf2cr, QSPI_BUFXCR_INVALID_MSTRID);
> - qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
> -  (0x80 << QSPI_BUF3CR_ADATSZ_SHIFT));
>
> +#if defined(CONFIG_LS1043A) || defined(CONFIG_LS2080A) \
> + || defined(CONFIG_LS1012A) || defined(CONFIG_LS102XA)
> + /*A-009282: QuadSPI data pre-fetch can result in incorrect data
> +  *Workaround: Keep the read data size to 64 bits (8 Bytes), which
> +  *disables the prefetch on the AHB buffer,and prevents this issue
> +  *from occurring.
> + */
> + rx_size = 0x1;
> +#endif
> + qspi_write32(priv->flags, >buf3cr, QSPI_BUF3CR_ALLMST_MASK |
> +  (rx_size << QSPI_BUF3CR_ADATSZ_SHIFT));
>   /* We only use the buffer3 */
>   qspi_write32(priv->flags, >buf0ind, 0);
>   qspi_write32(priv->flags, >buf1ind, 0);
>

Yunhui,

I suggested to use erratum macro, like CONFIG_SYS_FSL_ERRATUM_A009282.

York
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot