From patchwork Wed Nov 7 14:43:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 10672479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF71014D6 for ; Wed, 7 Nov 2018 14:56:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD58E2BDC2 for ; Wed, 7 Nov 2018 14:56:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A090C2BE02; Wed, 7 Nov 2018 14:56:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D38A2BDC2 for ; Wed, 7 Nov 2018 14:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731139AbeKHA0o (ORCPT ); Wed, 7 Nov 2018 19:26:44 -0500 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.131]:34947 "EHLO mo4-p05-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387948AbeKHA0n (ORCPT ); Wed, 7 Nov 2018 19:26:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1541602560; s=strato-dkim-0002; d=as-electronics.de; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=yYF7CdtYHk3kXdhl/FafyrpZMGBtjGtDagS0q6xO4LM=; b=emGnwgJC1q6kgQxWBFHFK+s4sl+xP2APzVmkLbU+jF42sjXQCMVhogRRcGvJTSsxHK GuX6zw1DQA48us/ZGEqr4C/bWP2hHSlqcNxcnYrIdjE1woe0yIJS0qBfvqiIFgdxd1Id ++6coZ8WNEuQdJDvxx0y8R8LZpoiQ8HWrT+TOYy9bE5X2aksI+RJ77t/GEBUCUdDPXhK L5ni9AHUPxWrd2XVMIT2g8s0RKUmkWyQ8Vv1zJsx3rXcokrwgmaCmAhxMQLPMOmjHojz CFg2sHbN70CwDmziNuyMRPIRRhVqZ2XW/dhGs1PJmioDyHwgy9XsB2oJlKYMjUScOsvw InvA== X-RZG-AUTH: ":LX8JdEmkW/4tAFwMkcNJIloh1hrA5u3owhPk7bdT5Fx22AatU+eLaHfutoZdl+X9BETxn4/4+IVqx7ZdE8mPU5nMS5P2QgHAetWm5FNngAjmE0pFNjw=" X-RZG-CLASS-ID: mo05 Received: from fs-work.fritz.box by smtp.strato.de (RZmta 44.3 AUTH) with ESMTPSA id j097e4uA7EheUQU (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 7 Nov 2018 15:43:40 +0100 (CET) From: Frieder Schrempf To: linux-mtd@lists.infradead.org, boris.brezillon@bootlin.com, linux-spi@vger.kernel.org Cc: dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, richard@nod.at, miquel.raynal@bootlin.com, broonie@kernel.org, david.wolfe@nxp.com, fabio.estevam@nxp.com, prabhakar.kushwaha@nxp.com, yogeshnarayan.gaur@nxp.com, han.xu@nxp.com, shawnguo@kernel.org, Frieder Schrempf Subject: [PATCH v4 00/10] Port the FSL QSPI driver to the SPI framework Date: Wed, 7 Nov 2018 15:43:17 +0100 Message-Id: <1541601809-16950-1-git-send-email-frieder.schrempf@kontron.de> X-Mailer: git-send-email 2.7.4 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the SPI memory interface was introduced by Boris [1], it is possible to move drivers from mtd/spi-nor to the SPI framework in order to use them for different type of SPI memory chips. Patch 1 adds the driver for the Freescale QSPI controller to the SPI framework. Together with m25p80.c it can be used to interface SPI NOR flashes just as the old driver did. For this to work properly a few minor changes to the devicetrees might be necessary (see patches 2 to 5). Patch 6 changes the defconfigs to use the new driver and patch 9 removes the old driver. Patch 8 and 9 remove 'fsl,qspi-has-second-chip' from the devicetrees. Patch 10 adjusts the MAINTAINERS file. The new driver was tested with i.MX6UL and a Micron SPI NOR @ 60MHz. The read performance of the new driver is almost the same or even better than the old driver, depending on the block size. The write performance is a bit slower on average (~10-15%). The new driver was also tested with the SPI NAND framework [2] and a Toshiba TC58CVG2S0H flash. If someone has a board that uses two chips on a single bus, it would be really nice to have the driver be tested on such a setup. [1] https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git/commit/?h=for-4.18&id=c36ff266dc82f4ae797a6f3513c6ffa344f7f1c7 [2] https://patchwork.ozlabs.org/cover/913728/ --- Changes in v4: ============== * Rebase on top of v4.20-rc1 * Drop patches that were merged separately * Address change of company name and email address * Use readl_poll_timeout() instead of busy waiting * Revert change to use callback functions for register read/write * Avoid divide by zero by checking op->dummy.nbytes * Make big-endian setting SoC-specific and don't read it from devicetree * Improve some register macros and masks Changes in v3: ============== * Move fix for typo in spi-mem.h to a separate patch * Fix documentation of spi_mem_get_name() and get_name() * Avoid overwriting the name of the memory device in probe of m25p80 * Add Suggested-by tags Changes in v2: ============== * Rebase on top of nand/next * Add a name field to struct spi_mem and fill it while probing * Add Yogesh Gaur and Suresh Gupta as authors * Use GENMASK() for generating bitmasks * Use callback functions for read/write of registers * Attach the seq variable to the selected CS * Avoid using conditional in read/write loop * Avoid infinite loop and use a timeout instead * Return error pointer when allocation in fsl_qspi_get_name() fails * Remove redundant iounmap() * Put suspend()/resume() in dev_pm_ops instead of platform_driver * Split the moving and editing of the dt-bindings in two patches --- Frieder Schrempf (10): spi: Add a driver for the Freescale/NXP QuadSPI controller dt-bindings: spi: Move the bindings for the FSL QSPI driver dt-bindings: spi: Adjust the bindings for the FSL QSPI driver ARM: dts: Reflect change of FSL QSPI driver and remove unused properties arm64: dts: Reflect change of FSL QSPI driver and remove unused properties ARM: defconfig: Use the new FSL QSPI driver under the SPI framework mtd: fsl-quadspi: Remove the driver as it was replaced by spi-fsl-qspi.c ARM: dts: ls1021a: Remove fsl,qspi-has-second-chip as it is not used ARM64: dts: ls1046a: Remove fsl,qspi-has-second-chip as it is not used MAINTAINERS: Move the Freescale QSPI driver to the SPI framework .../devicetree/bindings/mtd/fsl-quadspi.txt | 65 - .../devicetree/bindings/spi/spi-fsl-qspi.txt | 62 + MAINTAINERS | 4 +- arch/arm/boot/dts/imx6sx-sdb-reva.dts | 8 +- arch/arm/boot/dts/imx6sx-sdb.dts | 8 +- arch/arm/boot/dts/imx6ul-14x14-evk.dtsi | 2 + arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts | 6 +- arch/arm/configs/imx_v6_v7_defconfig | 2 +- arch/arm/configs/multi_v7_defconfig | 2 +- .../boot/dts/freescale/fsl-ls1043a-qds.dts | 3 +- .../boot/dts/freescale/fsl-ls1046a-qds.dts | 4 +- .../boot/dts/freescale/fsl-ls1046a-rdb.dts | 6 +- arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 1 - .../boot/dts/freescale/fsl-ls208xa-qds.dtsi | 4 + drivers/mtd/spi-nor/Kconfig | 9 - drivers/mtd/spi-nor/Makefile | 1 - drivers/mtd/spi-nor/fsl-quadspi.c | 1224 ------------------ drivers/spi/Kconfig | 11 + drivers/spi/Makefile | 1 + drivers/spi/spi-fsl-qspi.c | 948 ++++++++++++++ 20 files changed, 1054 insertions(+), 1317 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mtd/fsl-quadspi.txt create mode 100644 Documentation/devicetree/bindings/spi/spi-fsl-qspi.txt delete mode 100644 drivers/mtd/spi-nor/fsl-quadspi.c create mode 100644 drivers/spi/spi-fsl-qspi.c