From patchwork Sun Mar 30 00:27:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 27394 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9167220553 for ; Sun, 30 Mar 2014 00:28:10 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf24088778oag.1 for ; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:date :message-id:subject:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Y1AWoforsPd8HDWHCJayNe+gU4tvjQZqsx8n+AriqPw=; b=Rg4PR4mAz+UGbLTXMY+EXmgaA97YXiu8R51+S86p03shEH3WQN3mVv7JbfQaWDqmBR pTS35L1wPlYBk+fQdgBx8gLZ9xFoW4SSsMSEYrAesgmSrnlNvyW86whrc+TXcp6PeHeK hGYJzAo/AFiNqq9SltQx950fxeVUC2yVdGNxa9XvS3NvLLtzeUwEMALSc3VFMn+ftCQe /7Ns8SpoRn1R62Pbd0pQ7gL5vxnmln9sdV5NYlEe58em7OFHhoD+MSF1d19/7bdDXUdB WEz/Xpo8BbeTeQEBX6HSY8UE72/LPFzrLlRpiCjL8vzPq0I2kkpgOUWCXTqGkXaJIZDt UbTA== X-Gm-Message-State: ALoCoQkqotDUidSoQ2tguKcpTs1O6FDHfjLa3il8Y9NEmdfG1Ew1Suh4kEEh8vJcqvbOqo6V8Emj X-Received: by 10.182.87.2 with SMTP id t2mr6861391obz.2.1396139289651; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.213 with SMTP id 79ls1891659qgl.35.gmail; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) X-Received: by 10.59.7.102 with SMTP id db6mr361960ved.17.1396139289562; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id tm8si2145292vdc.206.2014.03.29.17.28.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 29 Mar 2014 17:28:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ij19so7135003vcb.38 for ; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) X-Received: by 10.52.90.37 with SMTP id bt5mr12715027vdb.7.1396139289360; Sat, 29 Mar 2014 17:28:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp39781vcv; Sat, 29 Mar 2014 17:28:08 -0700 (PDT) X-Received: by 10.68.254.5 with SMTP id ae5mr16440921pbd.83.1396139288591; Sat, 29 Mar 2014 17:28:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si6353069paa.421.2014.03.29.17.28.07; Sat, 29 Mar 2014 17:28:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554AbaC3A2D (ORCPT + 2 others); Sat, 29 Mar 2014 20:28:03 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:48837 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbaC3A2C (ORCPT ); Sat, 29 Mar 2014 20:28:02 -0400 Received: from cpc12-camd15-2-0-cust251.20-2.cable.virginm.net ([82.45.252.252] helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WU3bO-0004cX-9r; Sun, 30 Mar 2014 00:27:58 +0000 Received: from broonie by finisterre with local (Exim 4.82) (envelope-from ) id 1WU3bF-0007Wj-TL; Sun, 30 Mar 2014 00:27:45 +0000 From: Mark Brown To: Gerhard Sittig Cc: linux-spi@vger.kernel.org, linaro-kernel@lists.linaro.org, Mark Brown Date: Sun, 30 Mar 2014 00:27:45 +0000 Message-Id: <1396139265-28900-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 1.9.1 X-SA-Exim-Connect-IP: 82.45.252.252 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] spi: Fix handling of cs_change in core implementation X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-spi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Brown The core implementation of cs_change didn't follow the documentation which says that cs_change in the middle of the transfer means to briefly deassert chip select, instead it followed buggy drivers which change the polarity of chip select. Use a delay of 10us between deassert and reassert simply from pulling numbers out of a hat. Reported-by: Gerhard Sittig Signed-off-by: Mark Brown --- Compile tested only. drivers/spi/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 121c43b..4eb9bf0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -754,7 +754,6 @@ static int spi_transfer_one_message(struct spi_master *master, struct spi_message *msg) { struct spi_transfer *xfer; - bool cur_cs = true; bool keep_cs = false; int ret = 0; int ms = 1; @@ -800,8 +799,9 @@ static int spi_transfer_one_message(struct spi_master *master, &msg->transfers)) { keep_cs = true; } else { - cur_cs = !cur_cs; - spi_set_cs(msg->spi, cur_cs); + spi_set_cs(msg->spi, false); + udelay(10); + spi_set_cs(msg->spi, true); } }