From patchwork Sat Jan 14 18:53:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 136097 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 61AE4B6EEC for ; Sun, 15 Jan 2012 05:53:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80E4128477; Sat, 14 Jan 2012 19:53:28 +0100 (CET) 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 ZI1RXWx5-uQy; Sat, 14 Jan 2012 19:53:28 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D4E00281AA; Sat, 14 Jan 2012 19:53:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EBA39281AA for ; Sat, 14 Jan 2012 19:53:23 +0100 (CET) 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 UVcjbVRtLhDK for ; Sat, 14 Jan 2012 19:53:23 +0100 (CET) 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-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by theia.denx.de (Postfix) with ESMTPS id 6E7F228150 for ; Sat, 14 Jan 2012 19:53:21 +0100 (CET) Received: by eeit10 with SMTP id t10so576324eei.3 for ; Sat, 14 Jan 2012 10:53:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yyezqIgchSglXQUxIjxTiqtSHBTJbY93t3o3gPWDTFY=; b=oHD2ubnj9nnldpo/XQlanmyCXArmNqIA1rIU0gSbiwXy6TCF/IWn3TpUCfLPez9ljE HnUUqfgWgtxcgKf89GoC1ZQ37R5kvZImRuiITP/0iPt48aApOvI36KHp0wzgG9s1tx0n 9+LfTzafMGmDhqPzbHqx4Jic2XXQXuT1svtrg= MIME-Version: 1.0 Received: by 10.213.13.66 with SMTP id b2mr1697567eba.31.1326567201444; Sat, 14 Jan 2012 10:53:21 -0800 (PST) Received: by 10.213.113.1 with HTTP; Sat, 14 Jan 2012 10:53:21 -0800 (PST) In-Reply-To: References: <4F117435.7080807@esd.eu> Date: Sat, 14 Jan 2012 16:53:21 -0200 Message-ID: From: Fabio Estevam To: Matthias Fuchs Cc: Fabio Estevam , u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver 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 On Sat, Jan 14, 2012 at 4:46 PM, Fabio Estevam wrote: > Hi Matthias, > > On Sat, Jan 14, 2012 at 10:25 AM, Matthias Fuchs wrote: >> The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the >> spi low level driver's spi_xfer() function with len=0 to deassert the >> SPI flash' chip select. But the i.MX28 spi driver rejects this call >> due to len=0. >> >> This patch implements an exception for len=0 with the SPI_XFER_END >> flag set. This results in an extra read with the chip select being >> deasserted afterwards. There seems to be no way to deassert the signal >> by hand. >> >> Signed-off-by: Matthias Fuchs > > What about the approach bellow (untested)? Actually I meant this: --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -136,7 +136,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, if (!rx && !tx) return 0; - if (flags & SPI_XFER_BEGIN) + if ((flags & SPI_XFER_BEGIN) && len) mxs_spi_start_xfer(ssp_regs); while (len--) {