1.. SPDX-License-Identifier: GPL-2.0+
2
3NVM XIP Block Storage Emulation Driver
4======================================
5
6Summary
7-------
8
9Non-Volatile Memory devices with addressable memory (e.g: QSPI NOR flash) could
10be used for block storage needs (e.g: parsing a GPT layout in a raw QSPI NOR flash).
11
12The NVMXIP Uclass provides this functionality and can be used for any 64-bit platform.
13
14The NVMXIP Uclass provides the following drivers:
15
16      nvmxip-blk block driver:
17
18        A generic block driver allowing to read from the XIP flash.
19	The driver belongs to UCLASS_BLK.
20	The driver implemented by drivers/mtd/nvmxip/nvmxip.c
21
22      nvmxip Uclass driver:
23
24        When a device is described in the DT and associated with UCLASS_NVMXIP,
25        the Uclass creates a block device and binds it with the nvmxip-blk.
26	The Uclass driver implemented by drivers/mtd/nvmxip/nvmxip-uclass.c
27
28      nvmxip_qspi driver :
29
30        The driver probed with the DT and is the parent of the blk#<id> device.
31        nvmxip_qspi can be reused by other platforms. If the platform
32        has custom settings to apply before using the flash, then the platform
33        can provide its own parent driver belonging to UCLASS_NVMXIP and reuse
34        nvmxip-blk. The custom driver can be implemented like nvmxip_qspi in
35        addition to the platform custom settings.
36	The nvmxip_qspi driver belongs to UCLASS_NVMXIP.
37	The driver implemented by drivers/mtd/nvmxip/nvmxip_qspi.c
38
39	For example, if we have two NVMXIP devices described in the DT
40	The devices hierarchy is as follows:
41
42::
43
44   => dm tree
45
46        Class     Index  Probed  Driver                Name
47    -----------------------------------------------------------
48    ...
49     nvmxip        0  [ + ]   nvmxip_qspi           |-- nvmxip-qspi1@08000000
50     blk           3  [ + ]   nvmxip-blk                    |   `-- nvmxip-qspi1@08000000.blk#1
51     nvmxip        1  [ + ]   nvmxip_qspi           |-- nvmxip-qspi2@08200000
52     blk           4  [ + ]   nvmxip-blk                    |   `-- nvmxip-qspi2@08200000.blk#2
53
54The implementation is generic and can be used by different platforms.
55
56Supported hardware
57------------------
58
59Any plaform supporting readq().
60
61Configuration
62-------------
63
64config NVMXIP
65	  This option allows the emulation of a block storage device
66	  on top of a direct access non volatile memory XIP flash devices.
67	  This support provides the read operation.
68	  This option provides the block storage driver nvmxip-blk which
69	  handles the read operation. This driver is HW agnostic and can support
70	  multiple flash devices at the same time.
71
72config NVMXIP_QSPI
73	  This option allows the emulation of a block storage device on top of a QSPI XIP flash.
74	  Any platform that needs to emulate one or multiple QSPI XIP flash devices can turn this
75	  option on to enable the functionality. NVMXIP config is selected automatically.
76	  Platforms that need to add custom treatments before accessing to the flash, can
77	  write their own driver (same as nvmxip_qspi in addition to the custom settings).
78
79Device Tree nodes
80-----------------
81
82Multiple QSPI XIP flash devices can be used at the same time by describing them through DT
83nodes.
84
85Please refer to the documentation of the DT binding at:
86
87doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt
88
89Contributors
90------------
91   * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
92