Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2039121imm; Sun, 23 Sep 2018 18:35:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV61gaA59RcvsUO59wJx8AdeHvsFcsuG4eIHRae/SJZScMWQPtzttBxupgUyYY5MCZxy7nhs4 X-Received: by 2002:a63:f110:: with SMTP id f16-v6mr4738581pgi.236.1537752925501; Sun, 23 Sep 2018 18:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537752925; cv=none; d=google.com; s=arc-20160816; b=fXj1XIs5fY81lYA22xe4bkoqkZiazOuRRKR/FcIyHjqMpQy4nB+hHCQSuLXDCsBhQK jUCGNvDBWpwXmjo10LX4MEMNvYByYNNDRZvqf1fVOF9aJDoLnPzgty8n+ZeKSXto9mpX nxuOezUfQsBJkiZRt4gNHKuY61E3V3lj4I/0lLzkLwwaD4jQwAWApvodDIjyU59vNP9t d3kjmM4NRO/0oNEL4DJyQD5W2VhhABLAFAxnYzV/hVubAAY193uSYSl4aKj9i3j4ioTY mjW3/AzrAe0+279ElrLR2W5fg1j2iUMv/YAbL/w7WmAX9AkCmmqauoQKKigx3pZb3kio F7yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=WnumxkXPUODljWxWnms1EA2VOICpKj7KP0Y0t3598Zc=; b=jvzOah3wV6MSewJfOtUWWX9aJkLIdLwhBU+J2h1h5D0B15x0Yp7yjMfi4ZYGcn+rUW yDJpT7L3riJ3fAhf51yJVt+qUttSnBVK/lDhQWVmtNlgzINYqWuKKL46CtHRAlnV/Ro4 VTTzF+N9hnZAemvqyAZH7l1dg04qFu/joaMLXKwMU6ZIvTXOfuw8ElCQ6ZCt/T4lNfES nbJFIJy2NLuZnTHk8ExGMdfV5LsWg4ImmlNxZG6wyo9ZpOSbITuL+pqnEayFJ3XZfBcy HIktPtWxH3FBGwj0xhBIGu+nQm+0eTbJs80vEPqLcIFQtYwz+izB2H2aL16aI1Yqlkc9 eGkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=fSftghN+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q21-v6si11700357pgc.86.2018.09.23.18.35.09; Sun, 23 Sep 2018 18:35:25 -0700 (PDT) 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=@lechnology.com header.s=default header.b=fSftghN+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbeIXHbo (ORCPT + 99 others); Mon, 24 Sep 2018 03:31:44 -0400 Received: from vern.gendns.com ([206.190.152.46]:40156 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbeIXHbo (ORCPT ); Mon, 24 Sep 2018 03:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WnumxkXPUODljWxWnms1EA2VOICpKj7KP0Y0t3598Zc=; b=fSftghN+bR8QI9Yw/igiZlzuFu 2DrEeN3Fxlq/AQ+Q3iUc+5Md6PcsJm+ZG/NwDWAUeiCwqBOi2HPNlmuvBN9uQ4hygC/aU1eFfGE8J fOJa/I+npUkhbCyOxDwn8oA1cUJswhZpepMube+F/rOFStGVPqPcuIZs+uFDtfityMf7IrCn0pTLB Ge0oH5wpve6HrBDQ/QAmJi5spr+9kU1smZr+w2niyj+5n1YMC7+pZPdQX48Lmg2Ffv6i4zKfB5+wR eW47IVZBTR7dLjxg6BTqO7RhvUv8I1gYK6ZI0kkqsZQK5akJEFhYJ4Y8fXkhLz7KsmQaJWRRx9Y1W U0t8dTFA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:59868 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g4FjB-001qJJ-7h; Sun, 23 Sep 2018 21:31:57 -0400 From: David Lechner To: Sekhar Nori Cc: David Lechner , Kevin Hilman , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: dts: da850-lego-ev3: slow down A/DC as much as possible Date: Sun, 23 Sep 2018 20:31:46 -0500 Message-Id: <20180924013146.18121-1-david@lechnology.com> X-Mailer: git-send-email 2.17.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Due to the electrical design of the A/DC circuits on LEGO MINDSTORMS EV3, if we are reading analog values as fast as possible (i.e. using DMA to service the SPI) the A/DC chip will read incorrect values - as much as 0.1V off when the SPI is running at 10MHz. (This has to do with the capacitor charge time when channels are muxed in the A/DC.) This patch slows down the SPI as much as possible (if CPU is at 456MHz, SPI runs at 1/2 of that, so 228MHz and has a max prescalar of 256, so we could get ~891kHz, but we're just rounding it to 1MHz). We also use the max allowable value for WDELAY to slow things down even more. These changes reduce the error of the analog values to about 5mV, which is tolerable. Commits a3762b13a596 ("spi: spi-davinci: Add support for SPI_CS_WORD") and e2540da86ef8 ("iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage") introduce changes that allow DMA transfers to be used, so this slow down is needed now. Signed-off-by: David Lechner --- FYI, this patch doesn't strictly depend on the other two mentioned. In fact, it would better if it got merged before them, but the consequences are minimal, so it doesn't seem worth it to me to try coordinating merges here. Both of these patches mentioned have been picked up in the respective subsystems. arch/arm/boot/dts/da850-lego-ev3.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/da850-lego-ev3.dts b/arch/arm/boot/dts/da850-lego-ev3.dts index c4729d0e6c19..66fcadf0ba91 100644 --- a/arch/arm/boot/dts/da850-lego-ev3.dts +++ b/arch/arm/boot/dts/da850-lego-ev3.dts @@ -352,7 +352,8 @@ compatible = "ti,ads7957"; reg = <3>; #io-channel-cells = <1>; - spi-max-frequency = <10000000>; + spi-max-frequency = <1000000>; + ti,spi-wdelay = <63>; vref-supply = <&adc_ref>; }; }; -- 2.17.1