Patchwork [U-Boot] FSL SPI read fix.

login
register
mail settings
Submitter Dale Smith
Date Sept. 26, 2012, 9:07 p.m.
Message ID <CAFGZJC5LGE-ynbcKKc1kB=g1PQxkyzTUStngGQsHBmUSaPcJuw@mail.gmail.com>
Download mbox | patch
Permalink /patch/187220/
State Rejected
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Dale Smith - Sept. 26, 2012, 9:07 p.m.
The fsl spi engine is non functional when reading from a device.  This
patch fixes it.

Note that none of the other spi interfaces parse through the
datastream looking for 0x0b bytes.

-Dale

 }
Jagannadha Sutradharudu Teki - June 12, 2013, 7:02 p.m.
Hi,

Can you please update the commit header and logic of the code
w.r.t current master tree.

also please use proper commit body.

--
Thanks,
Jagan.

On 27-09-2012 02:37, Dale Smith wrote:
> The fsl spi engine is non functional when reading from a device.  This
> patch fixes it.
>
> Note that none of the other spi interfaces parse through the
> datastream looking for 0x0b bytes.
>
> -Dale
>
>   }
>
>
> diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
> index a1ebd33..737719b 100644
> --- a/drivers/spi/fsl_espi.c
> +++ b/drivers/spi/fsl_espi.c
> @@ -291,17 +291,10 @@ int spi_xfer(struct spi_slave *slave, unsigned
> int bitlen, const void *data_out,
>   				debug("***spi_xfer:...%08x readed\n", tmpdin);
>   			}
>   		}
> -		if (data_in) {
> -			memcpy(data_in, buffer + 2 * cmd_len, tran_len);
> -			if (*buffer == 0x0b) {
> -				data_in += tran_len;
> -				data_len -= tran_len;
> -				*(int *)buffer += tran_len;
> -			}
> -		}
>   		spi_cs_deactivate(slave);
>   	}
> -
> +	if (data_in)
> +		memcpy(data_in, buffer + rx_offset, len);
>   	free(buffer);
>   	return 0;
>

Patch

diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index a1ebd33..737719b 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -291,17 +291,10 @@  int spi_xfer(struct spi_slave *slave, unsigned
int bitlen, const void *data_out,
 				debug("***spi_xfer:...%08x readed\n", tmpdin);
 			}
 		}
-		if (data_in) {
-			memcpy(data_in, buffer + 2 * cmd_len, tran_len);
-			if (*buffer == 0x0b) {
-				data_in += tran_len;
-				data_len -= tran_len;
-				*(int *)buffer += tran_len;
-			}
-		}
 		spi_cs_deactivate(slave);
 	}
-
+	if (data_in)
+		memcpy(data_in, buffer + rx_offset, len);
 	free(buffer);
 	return 0;