Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp415668imu; Mon, 5 Nov 2018 03:04:31 -0800 (PST) X-Google-Smtp-Source: AJdET5cckPzH3iy4sLiBkFZD6b0crbCu1ZlhRWYlMU368VrkCE0/7sxbq48JopTuk7ac2XuxSZp5 X-Received: by 2002:a63:588:: with SMTP id 130mr19494214pgf.273.1541415871263; Mon, 05 Nov 2018 03:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541415871; cv=none; d=google.com; s=arc-20160816; b=fABFizP1T1VvQGpQlFN+ISOz1LjWbSDvNvf2rLb5JJsAJrmaMR6ai+XLlR4m8uQahA MIaNtLrTquI6wxA4P6OOD8WZpmPwwR7+XOyjTjzJd3FbPDqmS4yKWruUnfvCnNk/4YTh +RLW3sXqRlwh5KQiYHUDi00H2tMuzIuOkkjsYjxyOHbmnePG1aDW794duMKFfSSQ/Onk jF1+cRSyCeie1qWyXvkTl22yeN0hWQRVRpkQzNAT0BfRvDGj9fEBTG14/1rSzV9rC+0P 70DWDIfh6Ar34qbtdI893RuZDk/qdqtyALuMnx0l+mqGQvg+QUvXVWA7xnvdTUoFl6cE 11xw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Qv3jytP93aUOvV6sqHJD+9cV1AqyHWG4IkISdw7iAb0=; b=jqnG2oMsKMYd1S9saqvI1gpBrAyGki0X0tHZxifiHAGI7rud2kw7MI9VOWRXzFg4mi hSSutGBSms0lXLQq5znIBIebXHRmpzM5a0TS0pFT50UxNc9YrkQYL4ANVr73iwCDzINo MLgJ5Zk64QMVsstggTVepFG2OL00qPM4kHH938pT7ZKHeR7EPIj2y0kGLW6n0WyuUKGB t0zy4eDAuEtyXoYwi+R424MTJ/wK4NzBBQUScC9V0ZicnzPM5Chi5UmXzzQY+EM5BGBE AMcFoCnlVzfxzKfQLfYfChS712KPY5czYsPLTSuP5ZQpziK07qFSFyzqhQ+l6lHyU5fm Mv+g== ARC-Authentication-Results: i=1; mx.google.com; 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 s144-v6si34338522pfc.149.2018.11.05.03.04.14; Mon, 05 Nov 2018 03:04:31 -0800 (PST) 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; 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 S1729086AbeKEUVl (ORCPT + 99 others); Mon, 5 Nov 2018 15:21:41 -0500 Received: from mail.bootlin.com ([62.4.15.54]:34391 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727275AbeKEUVl (ORCPT ); Mon, 5 Nov 2018 15:21:41 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 84B92207B0; Mon, 5 Nov 2018 12:02:30 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (aaubervilliers-681-1-93-44.w90-88.abo.wanadoo.fr [90.88.34.44]) by mail.bootlin.com (Postfix) with ESMTPSA id 12EB1206D8; Mon, 5 Nov 2018 12:02:20 +0100 (CET) Date: Mon, 5 Nov 2018 12:02:19 +0100 From: Boris Brezillon To: Piotr Bugalski Cc: 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 , Tudor Ambarus Subject: Re: [PATCH v3 0/6] New QuadSPI driver for Atmel SAMA5D2 Message-ID: <20181105120219.03ab3b4c@bbrezillon> In-Reply-To: <20181105103625.9644-1-bugalski.piotr@gmail.com> References: <20181105103625.9644-1-bugalski.piotr@gmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Piotr, On Mon, 5 Nov 2018 11:36:19 +0100 Piotr Bugalski wrote: > Hello, > > Atmel SAMA5D2 is equipped with two QSPI interfaces. These interfaces can > work as in SPI-compatible mode or use two / four lines to improve > communication speed. At the moment there is QSPI driver strongly tied to > NOR-flash memory and MTD subsystem. > Intention of this change is to provide new driver which will not be tied > to MTD and allows using QSPI with NAND-flash memory or other peripherals > New spi-mem API provides abstraction layer which can disconnect QSPI > from MTD. This driver doesn't support regular SPI interface, it should > be used with spi-mem interface only. > Unfortunately SAMA5D2 hardware by default supports only NOR-flash > memory. It allows 24- and 32-bit addressing while NAND-flash requires > 16-bit long. To workaround hardware limitation driver is a bit more > complicated. > > Request to spi-mem contains three fiels: opcode (command), address, > dummy bytes. SAMA5D2 QSPI hardware supports opcode, address, dummy and > option byte where address field can only be 24- or 32- bytes long. > Handling 8-bits long addresses is done using option field. For 16-bits > address behaviour depends of number of requested dummy bits. If there > are 8 or more dummy cycles, address is shifted and sent with first dummy > byte. Otherwise opcode is disabled and first byte of address contains > command opcode (works only if opcode and address use the same buswidth). > The limitation is when 16-bit address is used without enough dummy > cycles and opcode is using different buswidth than address. Other modes > are supported with described workaround. > > It looks like hardware has some limitation in performance. The same issue > exists in current QSPI driver (MTD/nor-flash) and soft-pack (bare-metal > library from Atmel). Without using DMA read speed is much worse than > maximum bandwidth (efficiency 30-40%). Any help with performance > improvement is highly welcome, especially for NAND-flash memories which > offers higher capacity than NOR-flash used with previous driver. I think you can try to implement the dirmap interface proposed here [1] and use DMA+TRSFR_READ/WRITE_MEMORY for such direct mappings. This should optimize path where we really matter about perfs. > > Best Regards, > Piotr > > v3 changes: > - add get_name implementation > - email address fix > > v2 changes: > - driver is now replacement of existing atmel-quadspi > - code was re-written to follow original code structure > - deinitialization order fixed > - empty atmel_qspi_adjust_op_size function removed > - code formatting fixes > - use spi_device->max_speed_hz to get spi speed > - spi freqency set in spi_controller->setup() hook > - address range checkng for 4-bytes addressing > - use timeout to avoid infinite waiting > > Piotr Bugalski (6): > mtd: spi-nor: atmel-quaspi: Typo fix > mtd: spi-nor: atmel-quadspi: Add spi-mem support to atmel-quadspi > mtd: spi-nor: atmel-quadspi: Use spi-mem interface for atmel-quadspi > driver > mtd: spi-nor: atmel-quadspi: Remove unused code from atmel-quadspi > driver > spi: Add QuadSPI driver for Atmel SAMA5D2 > dt-bindings: spi: QuadSPI driver for Atmel SAMA5D2 The patch series is Acked-by: Boris Brezillon Mark, if you're okay with the new implementation, would you mind taking those patches in the spi tree? Thanks, Boris [1]http://patchwork.ozlabs.org/project/linux-mtd/list/?series=73235