Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbcJEL7y (ORCPT ); Wed, 5 Oct 2016 07:59:54 -0400 Received: from smtpout.microchip.com ([198.175.253.82]:41229 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752257AbcJEL7x (ORCPT ); Wed, 5 Oct 2016 07:59:53 -0400 From: Cyrille Pitchen To: , CC: , , , , Cyrille Pitchen Subject: [PATCH v2 0/9] mtd: spi-nor: parse SFDP tables to setup (Q)SPI memories Date: Wed, 5 Oct 2016 14:00:31 +0200 Message-ID: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFvrIosTGxcLF5cOia/76S7jBiq41N1gsOqasYrK492kbo8W06e+YLe5fO81icX3ePmYH1gCGKNbMvKT8igTWjIPbPrAUXJaq+D3hLnsD42+RLkYuDiGBdYwSi9efZu5i5ORgEzCUePvgKGsXIweHiICDxLUJ+iBhZoGFjBLXTyiB2MICARKH/jxlB7FZBFQkfnbtBrN5BWwklrz5zwRiSwjISdw818kMEReUODnzCQvEHAmJgy9egMWFBNQkFrasYIaoD5RY3b+IBcJ2kug6OZENwraTODz9IjuE7SCxfdcXuJpdny9D9WpLbH+1jxXC1pHYdrAfqsZWYs+MiVD3uEs8eLQcyvaVmPWwAaomSqLx2UOmCYxis5CcOgvJqQsYmVYxSjt7+OkGh+m6Rjh7GJjo5SZnFOjmJmbm6SXn525ihERH5g7GYw3+hxglOZiURHm3TjofLsSXlJ9SmZFYnBFfVJqTWnyIUYKDR0mE13I5UI63uCAxtzgzHSYlw8GhJMEbAZISLEpNT61Iy8wpSS2CSJ9ilJQS540GSQqA9GWU5sHlLjGKSgnzRi0FyvEUpBblZpZAxG8xCnM8ZBJiycvPS5UCOpEBCDQYXzGKczAqCfO6g8ziycwrgTvhFdB1TEDXrdt9GuS6kkSElFQDY+j/0qhuvl0btkabfL+/vEMzOmGBkOoB3tOmN89cVvPNDb72ZeKipZdnBD/8uPfnEoEtEXf4LNuVFha84Ay68+FxSzYXu1Y17wkHn7Uf17GJ80zLqCgJPP2EtbH2A4d78q+ElYdcW76wNc357L9AUVig9FX0wsjLnBOWlO+UcC+LK3nh7ncvUYmlOCPRUIu5qDgRAMH9U8cEAwAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3301 Lines: 108 Hi all, This series extends support of SPI protocols to new protocols such as SPI x-2-2 and SPI x-4-4. Also spi_nor_scan() tries now to select the right op codes, timing parameters (number of mode and dummy cycles) and erase sector size by parsing the Serial Flash Discoverable Parameter (SFDP) tables, when available, as defined in the JEDEC JESD216 specifications. When SFDP tables are not available, legacy settings are still used for backward compatibility (SPI and earlier QSPI memories). Support of SPI memories >128Mbits is also improved by using the 4byte address instruction set, when available. Using those dedicated op codes is stateless as opposed to enter the 4byte address mode, hence a better compatibility with some boot loaders which expect to use 3byte address op codes. This series was tested on a Atmel sama5d2 xplained board with the atmel-qspi.c driver. Except for SST memories, the SPI bus clock was set to 83MHz. The config MTD_SPI_NOR_USE_4K_SECTORS was selected. For my tests, I used some shell scripts using mtd_debug and sha1sum to check the data integrity. e.g: #!/bin/sh mtd_debug erase /dev/mtd5 0 0x780000 mtd_debug write /dev/mtd5 0 7674703 sama5d4_doc11238.pdf mtd_debug read /dev/mtd5 0 7674703 sam5d4_tmp.pdf sha1sum sama5d4_doc11238.pdf sam5d4_tmp.pdf Depending on the actual memory size, I may have used other partitions (/dev/mtd4) and input file size (2880044 and 320044 bytes). The series was tested with the following QSPI memories: Spansion/Cypress: - s25fl127s OK - s25fl512s OK - s25fl164k OK Micron: - n25q128a OK Macronix: - mx25l6433f OK - mx25l6473f OK - mx25l12835f OK - mx25l12845g OK - mx25l12873g OK - mx25l25645g OK - mx25l25673g OK - mx25l51245g OK - mx66l1g45g OK (1) SST: - sst26vf016b OK (2) - sst26vf032b OK (2) - sst26vf064b OK (2) (1): requires patch 8 (2): requires patch 9, the SPI bus clock frequency was decreased down to 55.3MHz Best regards, Cyrille ChangeLog: v1 -> v2 - fix patch 3 to resolve compiler errors on hisi-sfc.c and cadence-quadspi.c drivers Cyrille Pitchen (9): mtd: spi-nor: improve macronix_quad_enable() mtd: spi-nor: add an alternative method to support memory >16MiB mtd: spi-nor: add support of SPI protocols like SPI 1-2-2 and SPI 1-4-4 mtd: spi-nor: remove unused set_quad_mode() function mtd: m25p80: add support of dual and quad spi protocols to all commands mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables mtd: spi-nor: parse SFDP 4-byte Address Instruction Table mtd: spi-nor: add support to Macronix mx66l1g45g mtd: spi-nor: add support to SST sst26* QSPI memories drivers/mtd/devices/m25p80.c | 204 +++++-- drivers/mtd/devices/serial_flash_cmds.h | 7 - drivers/mtd/devices/st_spi_fsm.c | 28 +- drivers/mtd/spi-nor/atmel-quadspi.c | 83 ++- drivers/mtd/spi-nor/cadence-quadspi.c | 18 +- drivers/mtd/spi-nor/fsl-quadspi.c | 8 +- drivers/mtd/spi-nor/hisi-sfc.c | 32 +- drivers/mtd/spi-nor/mtk-quadspi.c | 16 +- drivers/mtd/spi-nor/nxp-spifi.c | 21 +- drivers/mtd/spi-nor/spi-nor.c | 1013 ++++++++++++++++++++++++++++--- include/linux/mtd/spi-nor.h | 165 ++++- 11 files changed, 1359 insertions(+), 236 deletions(-) -- 2.7.4