Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp423181oof; Mon, 24 Sep 2018 23:06:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61AORPV40giYL+YWpUzO6x8ypXki5E9KJbS0NNarhtvGY2vYwNUCrWYf9jCzxBSn64R2JBK X-Received: by 2002:a63:c44a:: with SMTP id m10-v6mr1824168pgg.416.1537855597805; Mon, 24 Sep 2018 23:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537855597; cv=none; d=google.com; s=arc-20160816; b=pwCY8DcjFReWMKYJL8YVKLYcoEapbzhevKYD9AVk1LXMcFdMCtZlJ/VaUFmqmhlA4q 7oPNhat1RX6fH+Z0Qpp4W0ccG296hoXLuM80ohxBMlC3u/hdByudf5aRejMas0g6t/eY jzfNGVkSbAiWUSRdcZoGurT6DLiUu07cdeIkUodLc+bzciRb0CqN14hcDci1WHXz34Yu jUfgokaFZGMMqs+5NTDWM6Zxk7atMqvzbD81WxF3U3SMJqk2b3k+KsxLBdFMmeSDxsEu HIHdH9wWruZc4HCgglcQNsk5dUjYE9j76BuBtaUsFKRnetXMJ0Zp4+J8GCrj7HLBfRhy I86g== 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:dkim-signature; bh=zRaoDRJ6vx+RmcKmsgkNFV2hs1MrM1UpTi7QKAZDSF8=; b=gY1IvbkZopqn2d0MgEGN/nY/rjdmfvco52DPT7JEu3L2vj798HXQQmCb5degUwTkOK 8+OmY0cvpHFkqOSMLZwmakK/WZ6JIgYsPpuxiaovptvjOB/6dFvljhCciNJG6ozqfiS8 uPmShLFiy6ophGGcKeLynRDLn9/1XsMlI5uiPMt/gM8JmDei+7taGXwBVMr3Ij/Mjzj0 V1utTKr42QmE9EgCmR2jGcWevVHnxjC1AquFMRXQMzt3qNOIBzt+TBhUH3haxS/WoiYM rAUhVDzkZ25LEpqE3SFihSw0Zyqkn7e6/b+KTyuNFYvu7sYcclSz4V5opqUI+6oCOgeS Koiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TOdnLZlV; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8-v6si1504315plz.119.2018.09.24.23.06.22; Mon, 24 Sep 2018 23:06:37 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TOdnLZlV; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbeIYMLy (ORCPT + 99 others); Tue, 25 Sep 2018 08:11:54 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:34262 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbeIYMLy (ORCPT ); Tue, 25 Sep 2018 08:11:54 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8P64Z32080492; Tue, 25 Sep 2018 01:04:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1537855475; bh=zRaoDRJ6vx+RmcKmsgkNFV2hs1MrM1UpTi7QKAZDSF8=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=TOdnLZlVNvt0LM/O2f/Hb1DMhs5AbuonAGCk9awnUBf1C+TCDSIl52yKThuKSMuIj M/MwutMCULhq7Me6FJRbD+dwM6Ufwf1EPy053ejDtScdShdU80OqajkG2SMPynQ3qX 7GisxQQWaJ0N50qnZy9BacSwW9tfkilfm3Yln0rk= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8P64ZEe026445; Tue, 25 Sep 2018 01:04:35 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 25 Sep 2018 01:04:34 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 25 Sep 2018 01:04:34 -0500 Received: from [172.24.190.172] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8P64WU8012457; Tue, 25 Sep 2018 01:04:33 -0500 Subject: Re: [PATCH] ARM: dts: da850-lego-ev3: slow down A/DC as much as possible To: David Lechner CC: Kevin Hilman , , , References: <20180924013146.18121-1-david@lechnology.com> From: Sekhar Nori Message-ID: Date: Tue, 25 Sep 2018 11:34:32 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180924013146.18121-1-david@lechnology.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On Monday 24 September 2018 07:01 AM, David Lechner wrote: > 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.) So you believe this is an issue with the board design rather than the limitation of the ADC chip itself? Because if its the later, the fix should be in the driver instead. > > 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. Is this needed for the -rc cycle or can wait for v4.20? Thanks, Sekhar > > 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 >