From 71779872ed7072f0ca90dd4db776dd8960b595f4 Mon Sep 17 00:00:00 2001 From: Allen Xu Date: Mon, 19 Jan 2015 11:10:15 -0600 Subject: MLK-10178-9 qspi:fsl_qspi txfifo min size 16bytes for mx7 Fix the TXFIFO need to be filled to 16 bytes limitation for i.MX7D Signed-off-by: Peng Fan Signed-off-by: Allen Xu --- drivers/spi/fsl_qspi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index 8439dbd..de9cb41 100644 --- a/drivers/spi/fsl_qspi.c +++ b/drivers/spi/fsl_qspi.c @@ -1,7 +1,7 @@ /* * Freescale QuadSPI driver. * - * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -785,7 +785,7 @@ static void fsl_qspi_ip_read(struct fsl_qspi *q, int len, u8 *rxbuf) static void fsl_qspi_write_data(struct fsl_qspi *q, int len, u8* txbuf) { u32 tmp; - u32 t1, t2; + u32 t1, t2, t3; int j; /* clear the TX FIFO. */ @@ -795,6 +795,7 @@ static void fsl_qspi_write_data(struct fsl_qspi *q, int len, u8* txbuf) /* fill the TX data to the FIFO */ t2 = len % 4; t1 = len >> 2; /* 4 Bytes aligned */ + t3 = t1 + t2; for (j = 0; j < t1; j++) { memcpy(&tmp, txbuf, 4); @@ -809,6 +810,13 @@ static void fsl_qspi_write_data(struct fsl_qspi *q, int len, u8* txbuf) tmp = fsl_qspi_endian_xchg(q, tmp); writel(tmp, q->iobase + QUADSPI_TBDR); } + +#if defined(CONFIG_MX7D) + /* iMX7D TXFIFO must be at least 16 bytes*/ + for (; t3 < 4; t3++) + writel(tmp, q->iobase + QUADSPI_TBDR); +#endif + } /* see the spi_flash_read_write() */ -- cgit v1.1