From patchwork Wed Sep 26 21:07:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dale Smith X-Patchwork-Id: 187220 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5F5182C0085 for ; Thu, 27 Sep 2012 07:32:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 177CB280CE; Wed, 26 Sep 2012 23:32:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bKdIg8uNhwU9; Wed, 26 Sep 2012 23:32:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0580280C6; Wed, 26 Sep 2012 23:32:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EAFCF280BE for ; Wed, 26 Sep 2012 23:07:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g+4yUAxw1DjP for ; Wed, 26 Sep 2012 23:07:55 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-da0-f44.google.com (mail-da0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 6B91A280BC for ; Wed, 26 Sep 2012 23:07:51 +0200 (CEST) Received: by danh15 with SMTP id h15so210770dan.3 for ; Wed, 26 Sep 2012 14:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=wFkx8/JSW5H83M/GnKcUQXu8ltzODXdo3AR5nAvFsKk=; b=A0MKt9yJVMqgyetnS1+zbhWYNGs0NjNo2FD6uXECjOd/Y7wgC4NqkV5c93kHmrwNPN iUx9brWBcIZYrKnOs2dvehOb5q7GETd6tOsq1apQg2x21dEhpRxi+WlFdLnXIpenxkP7 s1NMvi5XDAFFvvwVCHvE9E1QsWR6XraxZJD7w5qCY8piu+bZPKDafG4zg2StpjzJMHyy aWyNn1avqg0xzaoSYG8slSBLU9K/6uz2XU+rI4yClmekohn0tx3Yr6AvaEFeJk9/cd5k USTsp3iIUuINCPf9SPk3tyfEddsIEMBigAhbxL/if6SrQUpYG64eirm0a0oDZaRo8c6E dH5Q== MIME-Version: 1.0 Received: by 10.66.81.202 with SMTP id c10mr4235117pay.31.1348693667498; Wed, 26 Sep 2012 14:07:47 -0700 (PDT) Received: by 10.66.8.200 with HTTP; Wed, 26 Sep 2012 14:07:47 -0700 (PDT) Date: Wed, 26 Sep 2012 17:07:47 -0400 Message-ID: From: Dale Smith To: u-boot@lists.denx.de X-Mailman-Approved-At: Wed, 26 Sep 2012 23:32:00 +0200 Subject: [U-Boot] [PATCH] FSL SPI read fix. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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;