From patchwork Mon Apr 17 09:11:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdellatif El Khlifi X-Patchwork-Id: 1769483 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q0Lst6HY1z1yb4 for ; Mon, 17 Apr 2023 19:12:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 442CF85B0C; Mon, 17 Apr 2023 11:12:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 771FD85B0C; Mon, 17 Apr 2023 11:12:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 062F4856FA for ; Mon, 17 Apr 2023 11:12:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6E231063; Mon, 17 Apr 2023 02:12:51 -0700 (PDT) Received: from e130802.arm.com (unknown [10.57.22.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 63CD63F6C4; Mon, 17 Apr 2023 02:12:05 -0700 (PDT) From: Abdellatif El Khlifi To: abdellatif.elkhlifi@arm.com Cc: Drew.Reed@arm.com, Xueliang.Zhong@arm.com, nd@arm.com, sjg@chromium.org, trini@konsulko.com, u-boot@lists.denx.de, rui.silva@linaro.org Subject: [PATCH v2 0/7] introduce NVM XIP block storage emulation Date: Mon, 17 Apr 2023 10:11:51 +0100 Message-Id: <20230417091158.37734-1-abdellatif.elkhlifi@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230116172832.1946-1-abdellatif.elkhlifi@arm.com> References: <20230116172832.1946-1-abdellatif.elkhlifi@arm.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Adding block storage emulation for NVM XIP flash devices. Some paltforms such as Corstone-1000 need to see NVM XIP raw flash as a block storage device with read only capability. Here NVM flash devices are devices with addressable memory (e.g: QSPI NOR flash). The NVM XIP block storage emulation provides the following features: - Emulate NVM XIP raw flash as a block storage device with read only capability - Being generic by design and can be used by any platform - Device tree node - Platforms can use multiple NVM XIP devices at the same time by defining a DT node for each one of them - A generic NVMXIP block driver allowing to read from the XIP flash - A generic NVMXIP Uclass driver for binding the block device - A generic NVMXIP QSPI driver - Implemented on top of memory-mapped IO (using readq macro) - Enabling NVMXIP in sandbox64 - A sandbox test case - Enabling NVMXIP in Corstone1000 platform as a use case For more details please refer to the readme [A]. Changelog of the major changes: =========================== v2: * move the drivers under drivers/mtd * shorten the block device name * rename nvmxip_init() to nvmxip_post_bind(), call it from the uclass when a new device is bound * use uclass_id_count() in place of nvmxip_bdev_max_devs * moving the NVMXIP QSPI driver to a seperate commit * address nits v1: [1] * introduce the new feature Cheers, Abdellatif List of previous patches: [1]: https://lore.kernel.org/all/20230116172832.1946-1-abdellatif.elkhlifi@arm.com/ More details: [A]: doc/develop/driver-model/nvmxip.rst Cc: Tom Rini Cc: Simon Glass Cc: Drew Reed Cc: Xueliang Zhong Cc: Rui Miguel Silva Abdellatif El Khlifi (7): drivers/mtd/nvmxip: introduce NVM XIP block storage emulation drivers/mtd/nvmxip: introduce QSPI XIP driver sandbox64: fix: return unsigned long in readq() sandbox64: add support for NVMXIP QSPI corstone1000: add NVM XIP QSPI device tree node corstone1000: enable NVM XIP QSPI flash sandbox64: add a test case for UCLASS_NVMXIP MAINTAINERS | 8 + arch/arm/dts/corstone1000.dtsi | 9 +- arch/sandbox/cpu/cpu.c | 2 +- arch/sandbox/dts/sandbox64.dts | 13 ++ arch/sandbox/dts/test.dts | 14 ++ arch/sandbox/include/asm/io.h | 2 +- configs/corstone1000_defconfig | 1 + configs/sandbox64_defconfig | 1 + doc/develop/driver-model/index.rst | 1 + doc/develop/driver-model/nvmxip.rst | 91 +++++++++++ .../nvmxip/nvmxip_qspi.txt | 56 +++++++ drivers/block/blk-uclass.c | 1 + drivers/mtd/Kconfig | 2 + drivers/mtd/Makefile | 1 + drivers/mtd/nvmxip/Kconfig | 19 +++ drivers/mtd/nvmxip/Makefile | 8 + drivers/mtd/nvmxip/nvmxip-uclass.c | 74 +++++++++ drivers/mtd/nvmxip/nvmxip.c | 119 ++++++++++++++ drivers/mtd/nvmxip/nvmxip.h | 32 ++++ drivers/mtd/nvmxip/nvmxip_qspi.c | 70 +++++++++ include/dm/uclass-id.h | 1 + test/dm/Makefile | 5 + test/dm/nvmxip.c | 145 ++++++++++++++++++ 23 files changed, 672 insertions(+), 3 deletions(-) create mode 100644 doc/develop/driver-model/nvmxip.rst create mode 100644 doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt create mode 100644 drivers/mtd/nvmxip/Kconfig create mode 100644 drivers/mtd/nvmxip/Makefile create mode 100644 drivers/mtd/nvmxip/nvmxip-uclass.c create mode 100644 drivers/mtd/nvmxip/nvmxip.c create mode 100644 drivers/mtd/nvmxip/nvmxip.h create mode 100644 drivers/mtd/nvmxip/nvmxip_qspi.c create mode 100644 test/dm/nvmxip.c