Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5119606imb; Thu, 7 Mar 2019 08:10:27 -0800 (PST) X-Google-Smtp-Source: APXvYqxxRUgxeVlnNjrpee4dMqhbjejVLvXkkzE9Y71H1BkTdkeWyILRfwsntDRilFxX46ofYhfE X-Received: by 2002:a62:aa08:: with SMTP id e8mr13421746pff.139.1551975027700; Thu, 07 Mar 2019 08:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551975027; cv=none; d=google.com; s=arc-20160816; b=t0tyQXsYwU7FL95Au1B5ImYweKw9e610RdUhB7KlPDykQSVKfPVxUetRYl3jlPG9iQ zqQ9aDIbl8Ko2lj/y+SuoX7nXOrCQeDMJhTpALfOLmbgUxL7WZlOY3pYQ1Z7Ob8dKqtU q+NZPhwOesGpxNXKpjwupyAQtLwviZAfjND2oAmEnzuw9ha8UZbrJzrihPObM0f+VaCo XKa3/QASf/fbz3v6QIixXmGzKpIYEx3W/yJhBsvXn3aIUBb+sQ3R8LCU20zmsV6gnWH+ UmgfCRFqBYKkZFsZ6lwpxScBjH9QTrHFlAVwOaMbu9BnjOaj0VjYTmAZOQbC8cW28e4O 5XMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rV/JEOtQ34mI2W1JyeD2iMtK5Fe2tHJoIWT2YvMjkdY=; b=tk/JUzTrh5G/4RNBE50aT+r97txX7WZdI91aaVFExESLV5r3qphGJnYspDuqqh/eMU NVYwhZYNbH9JFilgTZ8eT1jbyp64Pe9zedDgEHJbLc7eJA4U/NcRonbzGXrlrEFmUurJ lqb/s4eRfgRcqtjIrjkBrWoLr7His5BXzUgd8TasIq2UK7zpdlpv+6OVyMzy8OhCIJly orYeLxHPGr9Xh5857UGjPFrMyzcrnvOG7TQwlrU3GJWUQV4pTEk55XcCmvz9JFbjbNoW yQ8s6wt2xXEd76yVhJApV0oouI6EFSp4jPyv6IW6TWezscJIL8tug2r17s5puQxoInlH oyog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="WxrE/1wr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 136si4736917pfu.221.2019.03.07.08.10.11; Thu, 07 Mar 2019 08:10:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="WxrE/1wr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfCGQJn (ORCPT + 99 others); Thu, 7 Mar 2019 11:09:43 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:54294 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfCGQJn (ORCPT ); Thu, 7 Mar 2019 11:09:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rV/JEOtQ34mI2W1JyeD2iMtK5Fe2tHJoIWT2YvMjkdY=; b=WxrE/1wryIiCnpx1GKWCtGF9v ZsKdYiUTx/0d2kG9ssUGID1mmHsZ/AEiZ2y5jA/MDysNDqMl4uV4BjXpTmmF8Wbey/18yxTjzn9Zu 2OrnqOl8nY0G3fYhvdbtkdeTSXheDnV3Hqu6KB9qi+O9N7P/mx3MIiHp8ZDl0gpbVK5cs=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1h1vaH-0006Nf-1U; Thu, 07 Mar 2019 16:09:25 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 630F61128841; Thu, 7 Mar 2019 16:09:24 +0000 (GMT) Date: Thu, 7 Mar 2019 16:09:24 +0000 From: Mark Brown To: Jarkko Nikula Cc: xiao jin , daniel@zonque.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, yanmin.zhang@intel.com, bo Subject: Re: [PATCH] [RFC] spi: pxa2xx: Do cs if restart the SSP during pxa2xx_spi_transfer_one() Message-ID: <20190307160924.GE6529@sirena.org.uk> References: <20190307072424.18820-1-jin.xiao@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9crTWz/Z+Zyzu20v" Content-Disposition: inline In-Reply-To: X-Cookie: All celebrity voices impersonated. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --9crTWz/Z+Zyzu20v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 07, 2019 at 05:26:53PM +0200, Jarkko Nikula wrote: > On 3/7/19 9:24 AM, xiao jin wrote: > > The patch is to do cs again if spi-pxa2xx restar the SSP during > > pxa2xx_spi_transfer_one() > Hmm.. please correct me if I'm wrong but pxa2xx_spi_unprepare_transfer() = is > called always when there is no more messages pending and the spi core sho= uld > have deasserted the CS already? Yes. > > @@ -1056,6 +1057,11 @@ static int pxa2xx_spi_transfer_one(struct spi_co= ntroller *master, > > if ((pxa2xx_spi_read(drv_data, SSCR0) !=3D cr0) > > || (pxa2xx_spi_read(drv_data, SSCR1) & change_mask) > > !=3D (cr1 & change_mask)) { > > + /* It needs to deassert the chip selection > > + * firstly before restart the SPP */ > > + need_cs_change =3D true; > > + cs_deassert(spi); > I think code comes here at the beginning of each transfer so will be hit > multiple times before pxa2xx_spi_unprepare_transfer() if SPI message > consists of multiple transfers. > This makes me wondering if the device driver setting up the "struct > spi_transfer" is maybe missing the cs_change flag set for transfers before > last one in case HW needs CS toggling between transfers? For instance what > following drivers are doing with the cs_change flag: > drivers/char/tpm/tpm_tis_spi.c: tpm_tis_spi_transfer() > drivers/input/touchscreen/ad7877.c: ad7877_read(), ad7877_read_adc() Right, this really feels like it's fixing the wrong thing. =20 --9crTWz/Z+Zyzu20v Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlyBQjMACgkQJNaLcl1U h9D+IAf/RPJBHypK+ouTHdrAKEfxDNywJpo2oajUzbpOk+84L90tpxhXxJqmNkfO wBqnszhfTMXP/bPgFKBRxni3WdiHW8De4enQ0SrP3MPUEh4t6j1iUsbTTpbocxbl SsosvIJKdjFTvz0oE5rUM6OKl5wB6ENyk2AFZffJxY0I3ktHkEgdSYJ1bi006x5X uIwEUJwM8I/wwo151dQXsUOGu93b7j92P6p5iTEnPL+gbiE/0X8OxCxe1KVveCbY flsc/Sk6IFJ2p4Ll5qKooM6Ef+/fCXiTeFkSIolUXBwnR04R2sC404aelPR2zj7X /EQ3J6/PFUg4m9aV/HQNiJCKp6bmXw== =7VDL -----END PGP SIGNATURE----- --9crTWz/Z+Zyzu20v--