Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | NVM XIP Block Storage Emulation Driver |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 4 | ====================================== |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 5 | |
| 6 | Summary |
| 7 | ------- |
| 8 | |
| 9 | Non-Volatile Memory devices with addressable memory (e.g: QSPI NOR flash) could |
| 10 | be used for block storage needs (e.g: parsing a GPT layout in a raw QSPI NOR flash). |
| 11 | |
| 12 | The NVMXIP Uclass provides this functionality and can be used for any 64-bit platform. |
| 13 | |
| 14 | The 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 | |
Abdellatif El Khlifi | 9e115ac | 2023-04-17 10:11:53 +0100 | [diff] [blame] | 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 | |
| 54 | The implementation is generic and can be used by different platforms. |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 55 | |
| 56 | Supported hardware |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 57 | ------------------ |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 58 | |
Abdellatif El Khlifi | cc89b7c | 2023-04-17 10:11:55 +0100 | [diff] [blame] | 59 | Any plaform supporting readq(). |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 60 | |
| 61 | Configuration |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 62 | ------------- |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 63 | |
| 64 | config 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 | |
Abdellatif El Khlifi | 9e115ac | 2023-04-17 10:11:53 +0100 | [diff] [blame] | 72 | config 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 | |
| 79 | Device Tree nodes |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 80 | ----------------- |
Abdellatif El Khlifi | 9e115ac | 2023-04-17 10:11:53 +0100 | [diff] [blame] | 81 | |
| 82 | Multiple QSPI XIP flash devices can be used at the same time by describing them through DT |
| 83 | nodes. |
| 84 | |
| 85 | Please refer to the documentation of the DT binding at: |
| 86 | |
| 87 | doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt |
| 88 | |
Abdellatif El Khlifi | f37af27 | 2023-04-17 10:11:52 +0100 | [diff] [blame] | 89 | Contributors |
| 90 | ------------ |
| 91 | * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |