Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4744668imb; Wed, 6 Mar 2019 22:48:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzbLIJA8rHNyDLQgqDo/EhCHAv5L5Q4IkZS6HqC4ydcBcvsSVxgKIx/PIMttpEt6Mp0zHz3 X-Received: by 2002:a65:62d4:: with SMTP id m20mr10128049pgv.416.1551941291296; Wed, 06 Mar 2019 22:48:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551941291; cv=none; d=google.com; s=arc-20160816; b=PEQDgqpsmV1Cg/6DEBKIYUdBw0WmvoLoUBKafEsomZS/bQX3VlQHHTBvJqIa9ql0Cb pXhCAh8I9D1vln95VY+tSTs47dq5HEENjWwqvnDWd8NiDVHHhlCWBMiCUzIoW50jGVYG vPcrGMZndRhf6xnMUtZewmtmKdZ8Q9B7WaQTE5zmuM818T2hLIDcrEKhsdoySRk+Up3O 8y1NRXLUMgA+VfzuhZXStNV9ZwPRLKMDon/lah2eSgOg1ogxIKBSE+TJYWbLAQ/q1C5J UnIhe9pOahTLYPRqFpzoNluJkIAMa/itP1/axreEowfExbwVFJyXimUyXVo6Y+6ReslG uEjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ythBk88pEn6kxFT97NpkLpZw3ydJM6vF7K+9lgd7CPY=; b=rAoW6Ba9OQLRtTGkhJRk9oP9kbU7IAXchsR6cqTl+8YqK3y3IeAZsGTxlyYi6dNJo1 RMVfFgWoTu0+oL6u5+hEbZfProRO7X+tk7pyWA/ZPbtCw9zRbd6AKKASn06ZzosKbSwr 0Uulx7BbKcULUXRzIVRt+aSHRPHv7yiXIRuvStRkzjFiGa2XcYIKOMkncAoDLEZxFVkj QLHDIrVHkduXoJu/sFUitMBKwElzsy195yF89+6TVb6NQOuGOmvCgORYYUn/xV8PgExZ bsdQYjH8y067Kk9LVqlg/LSpeeVw59yqHOglNWOJ9Vo6NvJLJtAs6TOWuwxPSEs9ky4V q8kw== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si3579480plg.320.2019.03.06.22.47.55; Wed, 06 Mar 2019 22:48:11 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbfCGGrf (ORCPT + 99 others); Thu, 7 Mar 2019 01:47:35 -0500 Received: from mga11.intel.com ([192.55.52.93]:49292 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfCGGrf (ORCPT ); Thu, 7 Mar 2019 01:47:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2019 22:47:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,450,1544515200"; d="scan'208";a="280504930" Received: from jxiao12-mobl1.ccr.corp.intel.com (HELO [10.239.201.138]) ([10.239.201.138]) by orsmga004.jf.intel.com with ESMTP; 06 Mar 2019 22:47:32 -0800 Subject: Re: [PATCH] spi-pxa2xx.c: modify the chip selection timing when spi transfer To: Jarkko Nikula , daniel@zonque.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, yanmin.zhang@intel.com Cc: "he, bo" , jin.xiao@intel.com References: <20190306030519.10746-1-jin.xiao@intel.com> From: "Xiao, Jin" Message-ID: <8f83eb75-d557-13b0-b2d0-1efb98d6688d@intel.com> Date: Thu, 7 Mar 2019 14:47:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:66.0) Gecko/20100101 Thunderbird/66.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jarkko, On 3/6/2019 3:52 PM, Jarkko Nikula wrote: > Hi > > On 3/6/19 5:05 AM, xiao jin wrote: >> From: "he, bo" >> >> We find spi can't work on board. More debug shows it's related >> to the following patch that changed the chip selection assert and >> deassert timing. >> > ^^ timing caught my attention. More below. > >> @@ -610,6 +596,7 @@ static void int_transfer_complete(struct >> driver_data *drv_data) >>       if (!pxa25x_ssp_comp(drv_data)) >>           pxa2xx_spi_write(drv_data, SSTO, 0); >>   +    cs_deassert(drv_data); >>       spi_finalize_current_transfer(drv_data->master); > > This > >> @@ -1070,6 +1057,7 @@ static int pxa2xx_spi_transfer_one(struct >> spi_controller *master, >>               pxa2xx_spi_write(drv_data, SSTO, chip->timeout); >>       } >>   +    cs_assert(drv_data); > > and this is not correct with core message loop. It will cause the chip > select is toggled with each transfer in PIO mode. If there is no > cs_change flag set then there shouldn't be CS toggling between the > transfers if SPI message consists of multiple transfers. > > More over this patch also will regress with DMA mode since there won't > be CS deassert at all. > > Timing reminded me I've seen two cases where there was a timing > related glitch in CS output: > > d0283eb2dbc1 ("spi: pxa2xx: Add output control for multiple Intel LPSS > chip selects") > 7a8d44bc89e5 ("spi: pxa2xx: Fix too early chipselect deassert") > > Do you have a possibility to measure with an oscilloscope what goes > wrong with the CS after d5898e19c0d7 ("spi: pxa2xx: Use core message > processing loop")? > > Can you share your setup if I can reproduce it here? E.g. SPI clock > frequency, single or multiple CS, frequency of occurrence, etc > In our setup the pxa_ssp_type is LPSS_BXT_SSP.  With more debug we find that the problem is caused in the case of "restart the SSP" when pxa2xx_spi_transfer_one. We will send another RFC patch. Thanks.