Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4117430imm; Mon, 18 Jun 2018 09:24:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLv9EDt/Cq9YAv5ge1AhcOII2q49lQ/fY2EJSeCxv20pmlCfK2wRqjDcZalZ6fo5KN/+Mcf X-Received: by 2002:a17:902:8a87:: with SMTP id p7-v6mr14665033plo.281.1529339076739; Mon, 18 Jun 2018 09:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529339076; cv=none; d=google.com; s=arc-20160816; b=dcy+Ff5Xegbcs5u4gBCdwBEtVhI8V0J9nZ++pnTDG44+lsz6qYHLGVfwrpyVFkGap0 rT8VBrHRkWa/sZFLpS+j5YAVm+3yXRwzi4pNl8LCkTR44ROvVZX7xflhqZNew0mSoQsT tby5aokksc+t7oPPmPp4xwmcnPgGvF/cEEujgfn7hyUDzRwokmce3VhHIFD1aqymxJlL T5ooD5HMWgOpuUdnzLE2oCMk/hkHIO3mUEOOYAA5mmXhoSdc0UCBWJ9X2kh+QST26dXB VFwfiuUX3BO9y6RfYRlXjoAQQc5tTxQt9TUoO3d/DNHCdGKkelele4O8oL14ad/K0vDX ZC2A== 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:arc-authentication-results; bh=Rnc5Bticpciszux3a/NDWbIH+7cs+NeUCsYkT2wve4g=; b=szMagcHJDI0OBVCcur0zRJNMu2w1tIUcgQciMEVsdgv5TV/JI2sDCDqi0s98Ah2v+u TdEcFoCPNmm8uwQGcqK495oMOLOX4IGu9W+CN0ouD4N4Rpc5FEZmd/AY3Thq8sOSEHaW nh14Di0/hVGLvG0r7dm/VZGq1vzQS9ykat9N/LDgFSp+nNmSueO6fz68BynKQh5BtvCm 82XorpVDYIdYDwdeZHoN3UVMs++fbPv+IIptPYq18evWjviAhJv1qAFgjvfDsjby/W3g jgd041aiZyd02oEy2G20ZOQc8qJ39lyK74zecGNuu8PllZjoDzqwMrTsN5lJ3IR1RAG0 EXPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LPY0XRuW; 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 k134-v6si12136611pga.149.2018.06.18.09.24.22; Mon, 18 Jun 2018 09:24:36 -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=LPY0XRuW; 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 S1755307AbeFRQVv (ORCPT + 99 others); Mon, 18 Jun 2018 12:21:51 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:44418 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754492AbeFRQVt (ORCPT ); Mon, 18 Jun 2018 12:21:49 -0400 Received: by mail-lf0-f67.google.com with SMTP id p23-v6so13878743lfh.11; Mon, 18 Jun 2018 09:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Rnc5Bticpciszux3a/NDWbIH+7cs+NeUCsYkT2wve4g=; b=LPY0XRuWxUt7TFXOF0EeIJaqkA5LrcoISBMBtFoMr8tyK/vgIfck7Wwy6yKRyuAhMW FdiqLQSVUt/O4Hz00n6Ui6Nd4GMILUUcvmVZ4S+Le8R2kue5+J39SjKxY1dh0Wt3eHWq PQ0iaQWgPDumlR3M7kgY56aDsdboSk1DsrS3A0dRFpamz+ct2+pY4YiDpwQm5658P7RF IuoVBOkZiFo4z+Z8Wey0E/IoPelPH62Ag/LhGo/Skes4QwaWjd+k0urANHWwCYEzPsZA sgeog90iQzexTlOLz7YAuXMvuO9qSlev2lA9VC6o9yuiUA+L9HdTeMek8yXyLJqI07S3 tXhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Rnc5Bticpciszux3a/NDWbIH+7cs+NeUCsYkT2wve4g=; b=O6ZST6YSdqwJV6vl/v9th6iFW4Zd/JOqxLw4QD1+w+ZbSLDTgsMr/s/FL363NeEYJq msx+FYieQBMmJ5Z1MsMa8CX0oz0TvKBztr7vyHBoUYuhIGjkey02vzqXBK6ZLDT0f9DW nmA8WQz1WremIdbocuvUR6kAshHhYI7JEnyJJutuzn6q0i4DKlAakcEdpc7FImWDwpt1 78q91yNKws88piMFPIHwwCj2+180FledENEUPr6EaVk444f5bfMp7ak8GmTpTyQscT0E LFTN3Wt0ScS3IsAyqzb6eMoqe4zFN7jYUhlpApLg/tGcH+Ou7Ye/dZknfmFY+Mwg1pHT OieQ== X-Gm-Message-State: APt69E37zBh2CVLRqzsxLKuJH6Y/qj2WOxNB7WPhK47GRosVHZvZ94MA 1mt4ihutJ63GVUOQjLWREg== X-Received: by 2002:a2e:2206:: with SMTP id i6-v6mr8526327lji.119.1529338907515; Mon, 18 Jun 2018 09:21:47 -0700 (PDT) Received: from localhost.localdomain (89-64-25-103.dynamic.chello.pl. [89.64.25.103]) by smtp.gmail.com with ESMTPSA id h90-v6sm2761220ljf.65.2018.06.18.09.21.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 09:21:46 -0700 (PDT) From: Piotr Bugalski To: Mark Brown , linux-spi@vger.kernel.org, David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , Cyrille Pitchen , Tudor Ambarus , Piotr Bugalski Subject: [RFC PATCH 0/2] New QuadSPI driver for Atmel SAMA5D2 Date: Mon, 18 Jun 2018 18:21:22 +0200 Message-Id: <20180618162124.21749-1-bugalski.piotr@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best Regards, Piotr Piotr Bugalski (2): spi: Add QuadSPI driver for Atmel SAMA5D2 dt-bindings: spi: QuadSPI driver for Atmel SAMA5D2 documentation .../devicetree/bindings/spi/spi_atmel-qspi.txt | 41 ++ drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-atmel-qspi.c | 480 +++++++++++++++++++++ 4 files changed, 531 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel-qspi.txt create mode 100644 drivers/spi/spi-atmel-qspi.c -- 2.11.0