From patchwork Mon Sep 24 01:31:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 10611885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C839715A6 for ; Mon, 24 Sep 2018 01:33:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D80BE285CC for ; Mon, 24 Sep 2018 01:33:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C805A28617; Mon, 24 Sep 2018 01:33:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD7DF285CC for ; Mon, 24 Sep 2018 01:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=BuE3Q1HGJPHBFM2YRq98jpAB9CX6pSsHd89UKdzBYJc=; b=Yhf 2kTY9KtIxL3tpEY5jChhTlcsrYdeXY/2+kI+BeTilFjPzEVmmABolpf7MtR2VvYYKP/N+ZeNENCeG 2zWws+eb661e85Lv6peFup7Cmn5NGCv6xHAjOW4B2i6dq5GlhfAlwMjXEn6u9dcjt2UgakJi/j3Uy lzN3LxgdCOXSEyJmRiVQwK91XuNOk+ha7s6jXLUB+GeA7EevBFMKPhpALP2uTe5v4dIpJz6jfqiga 0bHzhCxoN43OL3crE3fTyWVqd9mJ0G6xnQlImvFYRFxyWG4I6tBOKpTbreKuw0rTeVW/atMu7fFIY VArTPnUiroYrLP9J0vVBAlzsGGPhpzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4FkB-0006Qg-Af; Mon, 24 Sep 2018 01:32:59 +0000 Received: from vern.gendns.com ([206.190.152.46]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4Fk7-0006Ox-Cc for linux-arm-kernel@lists.infradead.org; Mon, 24 Sep 2018 01:32:56 +0000 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 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 - lists.infradead.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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180923_183255_465721_9E6AF8DF X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner , linux-arm-kernel@lists.infradead.org, Kevin Hilman MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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>; }; };