Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6042294imm; Wed, 27 Jun 2018 00:54:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImhONnDw/KM7umthY7iOJzgbCjvnMNnc1qT5GZR24ztoo4rUiMkMuwt5DYhNq5HoxF4mVH X-Received: by 2002:a17:902:301:: with SMTP id 1-v6mr4996670pld.127.1530086055946; Wed, 27 Jun 2018 00:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530086055; cv=none; d=google.com; s=arc-20160816; b=eJRhDlWWCt0vSF9VKwYO7vJO17xQR9KzhNQAfbJr5c8i4dHCiVvWjmG8xlGdZBbQJ2 zEics25abprDUX762nAZgE/px7hV4BLJAsS5cucdz1m5we6iYoajql/BjkthavWYgcb/ BCFi9ZUXleszkJ/dWiFT613tWgzdPRVPt7nQwThJcFUSjaoVmUhA68M1sCsrQT4btuJw wInTlkHjv/fEP/sPcCxg/tKtuR7eO9vpzV6Yhg+NVyIc1BtYPERVNGFndjFJ+KtOs/AJ 5ljTbFYZjW1X95OwVDc9ML0KTC0F4NvhrKL+qUPjMUuPPfM2At9m5sc05+26NWfe8oJx XMRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:date:from:dkim-signature :arc-authentication-results; bh=lcGFu3Cf+HOvNT5s4dYpX9gZqwV2eJ1XJh38kWmONEs=; b=Yf7H29DbPUSHUfxVVIokQ3cICHsEmLt6fJZIrxsFlIGTyW4oPX1sK9q6S7KcisU8ai XGg3uMbGX15S2gOAEaD/pe6bSLP54MUO9EQqMp85WFSPjy+jXTMUJgnS/E1UtntvnfOr ucV7xCDLSUkCO6FgWreVKhmU1JP99khzDK+gQfPO4G2NBhMQJu1cAiERwQQIGZma4QsH DNuScyqqZPyELtCDUem5kUBzUd5r9VljpntF13HspOmBHqAulgSG5yR4V9yTtr/k8VB6 WdGIl9WbHkcF5LVrLxLF5HYlae1EHKo+cCZ8P4caua/i8s7Q/gn2rTx/nL9xAdlA1mco vyaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LT633WDk; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 136-v6si2939404pgb.587.2018.06.27.00.53.58; Wed, 27 Jun 2018 00:54:15 -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=@gmail.com header.s=20161025 header.b=LT633WDk; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933038AbeF0HwM (ORCPT + 99 others); Wed, 27 Jun 2018 03:52:12 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36350 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933003AbeF0HwK (ORCPT ); Wed, 27 Jun 2018 03:52:10 -0400 Received: by mail-ed1-f68.google.com with SMTP id t3-v6so2507380eds.3; Wed, 27 Jun 2018 00:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=lcGFu3Cf+HOvNT5s4dYpX9gZqwV2eJ1XJh38kWmONEs=; b=LT633WDkPGau4/7ZYzoYO6HLqrqsVGrNPG8ut7Do0YJ6J0R0wQqAfF50CEJ8Gqcn/9 4gr8voUG8b5GChha5/cxC2siC6gXU3KFF0OzPRHgtQAB8DTSOrupYvXqHP4+v6oEz6QI Mc+N+bSNcm4UQwjFyqCpuNpp2FOYW7Mxy9FN31nbAjYqS0Lzhzj/v1ZRfPX1XOig1gVx C3yOwbFL05x6Pwk2bz5wdOOZubgIQFhO/K75sYS4EjTWmcacFl+Zp6FFYXh3RRHAYUeL E/0N6BVF2Ua+jLgkTLgloha0/s/LmMuMy9nPCv+LsO1InN1cDdv2hI4wMZJdN91W9QRM jb2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=lcGFu3Cf+HOvNT5s4dYpX9gZqwV2eJ1XJh38kWmONEs=; b=RLrpGMIX1uXrMt6bTT6QnNvvSAgLyDmdw1X9toHbzI6RmTol0HWDI0fL8t9M/mesFW pimDDNocfyu6OzWjwwCgKp3Z1ZzpC9GNBBMpwi05qf6yxVgQENh7NyKc7Lx2n58/57rU x/vqZQmyBANRhY9yGI+AcMFbodsgqqxpxccG/2xAvVEO+m58e0cg0nIIkf7M0Nao3hlx 7StdrH7rQB55AVvJf3kMUmY/cTT3WX3d5O9TAMl6HfvDVeh0S5ZMiZQJ6UYbyqlIXT6u y/oTBm9j3niuMk6rnw3LD1ldxz0vlbqFPi5YL+WUrnL/TQr9s/gj5iUtqKutTjUhYVi7 /e2g== X-Gm-Message-State: APt69E3n8dJ35ZXqDcH2iVE85c40/rsxFsgqBGZUTgk6f55gEH8BPR3J OWBdyo0j6CSUVLIjSoxN+g== X-Received: by 2002:a50:d9c7:: with SMTP id x7-v6mr4621141edj.95.1530085929245; Wed, 27 Jun 2018 00:52:09 -0700 (PDT) Received: from [172.17.1.84] ([130.228.251.5]) by smtp.gmail.com with ESMTPSA id q5-v6sm1591264eda.14.2018.06.27.00.52.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 00:52:08 -0700 (PDT) From: Piotr Bugalski X-Google-Original-From: Piotr Bugalski Date: Wed, 27 Jun 2018 09:52:00 +0200 (CEST) To: Tudor Ambarus cc: Boris Brezillon , Piotr Bugalski , Mark Brown , linux-spi@vger.kernel.org, David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , Cyrille Pitchen , Piotr Bugalski Subject: Re: [RFC PATCH 1/2] spi: Add QuadSPI driver for Atmel SAMA5D2 In-Reply-To: <455adb76-530a-1fd5-303c-cfa158ad7870@microchip.com> Message-ID: References: <20180618162124.21749-1-bugalski.piotr@gmail.com> <20180618162124.21749-2-bugalski.piotr@gmail.com> <20180621233321.0f25f572@bbrezillon> <20180622093905.62a3b936@bbrezillon> <455adb76-530a-1fd5-303c-cfa158ad7870@microchip.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tudor, Thank you very much for comments. On Tue, 26 Jun 2018, Tudor Ambarus wrote: > Hi, Piotr, > > General things to consider for the limitation in performance: > - is the serial flash memory operating in Quad SPI? Yes, I've checked signal using logic analyzer, data is transferred using all four lines. > - QSCLK should be as high as possible Sure, but when we are using lower frequency CPU impact should be negligible while efficiency is crap on every speed. > - transfer delays - I checked them, they have default values, we should be good. > - use DMA, as you suggested > I don't understand one thing. While CPU is not busy and during my tests 100% of CPU can be used for communication, efficiency is still very low. Why DMA has such impact? It is very interesting to observe signals using logic analyzer. When CPU is used for communication, there are long delays after every byte transferred. These delays are much longer than it should be only because of writing next value by CPU. I tried to change SPI frequency. If delay were CPU related, delay time should stay the same. Unfortunately results were different - lowering SPI freqency extends delay time. Using DMA makes these delays to disappear, but how to acheive CPU communication without delays? > On 06/22/2018 10:39 AM, Boris Brezillon wrote: >> [...] >> >>>>> +/* >>>>> + * Atmel SAMA5D2 QuadSPI driver. >>>>> + * >>>>> + * Copyright (C) 2018 Cryptera A/S >>>> >>>> A non-negligible portion of this code has been copied from the existing >>>> driver. Please keep the existing copyright (you can still add Cryptera's >>>> one). >>>> >>> >>> Technically this driver were written from scratch, with spi-fsl-qspi >>> as example of new interface. Hence the name and code structure. >>> But it's the same peripheral as Atmel's driver uses so code looks >>> similar. I can unify the code to make comparsion even simpler and >>> then update copyright. >> >> Hm, ok. Some constructs really looked like they were copied >> from the old driver, hence my comment. I'll let Nicolas give his >> opinion on this aspect. > > This driver will be a conversion of the legacy one to the spi-mem interface. I > would keep the legacy copyright and add Cryptera's below, as Boris suggested. > > [...] > >>>>> +#define QSPI_SR_CMD_COMPLETED (QSPI_SR_INSTRE | QSPI_SR_CSR) >>>> >>>> Do you really to wait for both INSTRE and CSR to consider the command >>>> as complete? >>>> >>> >>> This part were really copied from Atmel driver. I wasn't sure so I >>> used tested solution. >> >> Okay. I guess that's a question for Cyrille and/or Tudor then. > > We have to wait for both INSTRE and CSR. > I've also found that information in datasheet, good we have this solution then. > Best, > ta > Best Regards, Piotr