Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3929820imb; Wed, 6 Mar 2019 00:44:19 -0800 (PST) X-Google-Smtp-Source: APXvYqwLrcgmhUGio1MpUTi4QZ+5YfFIJ+scCfCFl72GrLlQgLc8lVhb3G16P46Gv/iBBGaNtkiw X-Received: by 2002:a62:b415:: with SMTP id h21mr6145107pfn.26.1551861859663; Wed, 06 Mar 2019 00:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551861859; cv=none; d=google.com; s=arc-20160816; b=x6g9hsL1qXW3v9jkGO1EQf+o7xZvMnNF6HBX0fXopfHkAFXVxPNqNV8bnPVP1h9zYc tugR333JoB+W+lZ5xf9lyN3e1aux0Ly22TE9p0C6nTfgQptUdqJ9I0nhNnu8oihddXnE so5h7iCQyHbnKqmsuyFjTHTIuqxBoaSaEMu4IK1c0CAbB1slx5FA7iDni0cq5kreyoxp dZ4i07Xf2I/NwU6PJTgW16qjIJZtr/WX0uNCEGRordBU2RrGSN/Vse4cPbbehHd2eeqh +YbdwjfPhqZmmvr7WWm3WSj3IxAWuM4bn/n1SttXVBBG5EakVJQpioiwHrfjlVOVxutP /0Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=F40y0iDpexLn9xDGqC9XMVjWSlRPvGaiFcOLABLAUFE=; b=TtpzZhiVQ0VDtlvmq5Ex65XPm5vrplLiSgTQFYXJZwMFjgA+vaxc9KWkaWSlsVOgJ8 m9YG4Z6RgoydeIm7rgpaPxnXVOuKIbqthlXc+W9Yi1tc4s2RBPAT2wcB8ubJZGff0F+b 2Qeh/3KjtXFMGkBXmdtEI+E3n6XoOSOpgzkHpIRB2rp3fTmFoVVC00yq/MdvRtGTfMaq hk3h+r/nk1ic06I0YRnJdcopNfT9OauhH0czJ/W3HSyoMI/T/94HgS42E5xszF8NFe3X aitvE2jdwfKJhnIiVmiN9oUFCC+T6WlmED0SnB/bn23rU4G1e/ahEuvAeDB9s0hExs1j WPKA== 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 t2si936571pgk.202.2019.03.06.00.44.04; Wed, 06 Mar 2019 00:44:19 -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 S1729535AbfCFHwS (ORCPT + 99 others); Wed, 6 Mar 2019 02:52:18 -0500 Received: from mga07.intel.com ([134.134.136.100]:29627 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727133AbfCFHwS (ORCPT ); Wed, 6 Mar 2019 02:52:18 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 23:52:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,446,1544515200"; d="scan'208";a="121392893" Received: from mylly.fi.intel.com (HELO [10.237.72.57]) ([10.237.72.57]) by orsmga006.jf.intel.com with ESMTP; 05 Mar 2019 23:52:14 -0800 Subject: Re: [PATCH] spi-pxa2xx.c: modify the chip selection timing when spi transfer To: xiao jin , 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" References: <20190306030519.10746-1-jin.xiao@intel.com> From: Jarkko Nikula Message-ID: Date: Wed, 6 Mar 2019 09:52:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190306030519.10746-1-jin.xiao@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Jarkko