All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Apple M1 NVMe storage support
@ 2022-01-22 19:38 Mark Kettenis
  2022-01-22 19:38 ` [PATCH v2 1/9] nvme: Split out PCI support Mark Kettenis
                   ` (8 more replies)
  0 siblings, 9 replies; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

This adds support for the (rather quirky) NVMe storage controller
integrated on Apple SoCs.  This makes it possible to boot from the
NVMe storage that is present on all the M1 machines that Apple has
released so far.

The series has been designed to have as little impact on the existing
NVMe support as possible.  It splits out the PCIe-specific bits in its
own file/driver and adds a platform driver for the Apple controller.
This platform driver handles all the quirkiness through driver ops.
The existing logic is retained when the driver ops aren't set.  I've
tested this on a firefly-rk3399 board with:

nvme0 at pci1 dev 0 function 0 "Silicon Motion SM2260 NVMe" rev 0x03: msix, NVMe 1.2
nvme0: ADATA SX8000NP, firmware C2.2.1, serial 2H1220011170

(for those not familliar with OpenBSD, that's an ADATA SX8000NP NVMe
M.2 SSD with a Silicon Motion controller)


ChangeLog:

v2: - Add various comments
    - Change SYS_SOC from "m1" to "apple"
    - Change include paths to take advantage of SYS_SOC change
    - Change alloc_queue op into setup_queue


Mark Kettenis (9):
  nvme: Split out PCI support
  mailbox: apple: Add driver for Apple IOP mailbox
  arm: apple: Change SoC name from "m1" into "apple"
  arm: apple: Add RTKit support
  nvme: Introduce driver ops
  nvme: Add shutdown function
  power: domain: apple: Add reset support
  nvme: apple: Add driver for Apple NVMe storage controller
  configs: apple: Add NVMe boot target

 arch/arm/Kconfig                              |   2 +
 arch/arm/include/asm/arch-apple/rtkit.h       |  11 +
 .../asm/{arch-m1 => arch-apple}/uart.h        |   0
 arch/arm/mach-apple/Kconfig                   |   2 +-
 arch/arm/mach-apple/Makefile                  |   1 +
 arch/arm/mach-apple/rtkit.c                   | 231 +++++++++++++++++
 configs/apple_m1_defconfig                    |   1 +
 configs/clearfog_gt_8k_defconfig              |   2 +-
 configs/firefly-rk3399_defconfig              |   2 +-
 configs/khadas-vim3_android_ab_defconfig      |   2 +-
 configs/khadas-vim3_android_defconfig         |   2 +-
 configs/khadas-vim3_defconfig                 |   2 +-
 configs/khadas-vim3l_android_ab_defconfig     |   2 +-
 configs/khadas-vim3l_android_defconfig        |   2 +-
 configs/khadas-vim3l_defconfig                |   2 +-
 configs/kontron_sl28_defconfig                |   2 +-
 configs/ls1012afrdm_qspi_defconfig            |   2 +-
 configs/ls1012afrdm_tfa_defconfig             |   2 +-
 .../ls1012afrwy_qspi_SECURE_BOOT_defconfig    |   2 +-
 configs/ls1012afrwy_qspi_defconfig            |   2 +-
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig |   2 +-
 configs/ls1012afrwy_tfa_defconfig             |   2 +-
 configs/ls1012aqds_qspi_defconfig             |   2 +-
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1012aqds_tfa_defconfig              |   2 +-
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls1012ardb_qspi_defconfig             |   2 +-
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1012ardb_tfa_defconfig              |   2 +-
 configs/ls1021aiot_qspi_defconfig             |   2 +-
 configs/ls1021aiot_sdcard_defconfig           |   2 +-
 configs/ls1021aqds_ddr4_nor_defconfig         |   2 +-
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig  |   2 +-
 configs/ls1021aqds_nand_defconfig             |   2 +-
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1021aqds_nor_defconfig              |   2 +-
 configs/ls1021aqds_nor_lpuart_defconfig       |   2 +-
 configs/ls1021aqds_qspi_defconfig             |   2 +-
 configs/ls1021aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1021aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1021atsn_qspi_defconfig             |   2 +-
 configs/ls1021atsn_sdcard_defconfig           |   2 +-
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1021atwr_nor_defconfig              |   2 +-
 configs/ls1021atwr_nor_lpuart_defconfig       |   2 +-
 configs/ls1021atwr_qspi_defconfig             |   2 +-
 configs/ls1021atwr_sdcard_ifc_defconfig       |   2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig      |   2 +-
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1028aqds_tfa_defconfig              |   2 +-
 configs/ls1028aqds_tfa_lpuart_defconfig       |   2 +-
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1028ardb_tfa_defconfig              |   2 +-
 configs/ls1043aqds_defconfig                  |   2 +-
 configs/ls1043aqds_lpuart_defconfig           |   2 +-
 configs/ls1043aqds_nand_defconfig             |   2 +-
 configs/ls1043aqds_nor_ddr3_defconfig         |   2 +-
 configs/ls1043aqds_qspi_defconfig             |   2 +-
 configs/ls1043aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1043aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1043aqds_tfa_defconfig              |   2 +-
 configs/ls1043ardb_SECURE_BOOT_defconfig      |   2 +-
 configs/ls1043ardb_defconfig                  |   2 +-
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig |   2 +-
 configs/ls1043ardb_nand_defconfig             |   2 +-
 configs/ls1043ardb_sdcard_defconfig           |   2 +-
 configs/ls1043ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1043ardb_tfa_defconfig              |   2 +-
 configs/ls1046afrwy_tfa_defconfig             |   2 +-
 configs/ls1046aqds_SECURE_BOOT_defconfig      |   2 +-
 configs/ls1046aqds_defconfig                  |   2 +-
 configs/ls1046aqds_lpuart_defconfig           |   2 +-
 configs/ls1046aqds_nand_defconfig             |   2 +-
 configs/ls1046aqds_qspi_defconfig             |   2 +-
 configs/ls1046aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1046aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1046aqds_tfa_defconfig              |   2 +-
 configs/ls1046ardb_emmc_defconfig             |   2 +-
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls1046ardb_qspi_defconfig             |   2 +-
 configs/ls1046ardb_qspi_spl_defconfig         |   2 +-
 configs/ls1046ardb_sdcard_defconfig           |   2 +-
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1046ardb_tfa_defconfig              |   2 +-
 configs/ls1088aqds_defconfig                  |   2 +-
 configs/ls1088aqds_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls1088aqds_qspi_defconfig             |   2 +-
 configs/ls1088aqds_sdcard_ifc_defconfig       |   2 +-
 configs/ls1088aqds_sdcard_qspi_defconfig      |   2 +-
 configs/ls1088aqds_tfa_defconfig              |   2 +-
 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls1088ardb_qspi_defconfig             |   2 +-
 configs/ls1088ardb_sdcard_qspi_defconfig      |   2 +-
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls1088ardb_tfa_defconfig              |   2 +-
 configs/ls2080aqds_SECURE_BOOT_defconfig      |   2 +-
 configs/ls2080aqds_defconfig                  |   2 +-
 configs/ls2080aqds_nand_defconfig             |   2 +-
 configs/ls2080aqds_qspi_defconfig             |   2 +-
 configs/ls2080aqds_sdcard_defconfig           |   2 +-
 configs/ls2080ardb_SECURE_BOOT_defconfig      |   2 +-
 configs/ls2080ardb_defconfig                  |   2 +-
 configs/ls2080ardb_nand_defconfig             |   2 +-
 configs/ls2081ardb_defconfig                  |   2 +-
 configs/ls2088aqds_tfa_defconfig              |   2 +-
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig |   2 +-
 configs/ls2088ardb_qspi_defconfig             |   2 +-
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/ls2088ardb_tfa_defconfig              |   2 +-
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/lx2160aqds_tfa_defconfig              |   2 +-
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig  |   2 +-
 configs/lx2160ardb_tfa_defconfig              |   2 +-
 configs/lx2160ardb_tfa_stmm_defconfig         |   2 +-
 configs/mvebu_crb_cn9130_defconfig            |   2 +-
 configs/mvebu_db_armada8k_defconfig           |   2 +-
 configs/mvebu_db_cn9130_defconfig             |   2 +-
 configs/mvebu_espressobin-88f3720_defconfig   |   2 +-
 configs/mvebu_mcbin-88f8040_defconfig         |   2 +-
 configs/mvebu_puzzle-m801-88f8040_defconfig   |   2 +-
 configs/nanopc-t4-rk3399_defconfig            |   2 +-
 configs/octeontx2_96xx_defconfig              |   2 +-
 configs/octeontx_81xx_defconfig               |   2 +-
 configs/octeontx_83xx_defconfig               |   2 +-
 configs/p3450-0000_defconfig                  |   2 +-
 configs/pinebook-pro-rk3399_defconfig         |   2 +-
 configs/qemu-x86_64_defconfig                 |   2 +-
 configs/qemu-x86_defconfig                    |   2 +-
 configs/qemu_arm64_defconfig                  |   2 +-
 configs/qemu_arm_defconfig                    |   2 +-
 configs/rcar3_salvator-x_defconfig            |   2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     |   2 +-
 configs/rock-pi-4-rk3399_defconfig            |   2 +-
 configs/rock-pi-4c-rk3399_defconfig           |   2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       |   2 +-
 configs/rock960-rk3399_defconfig              |   2 +-
 configs/rockpro64-rk3399_defconfig            |   2 +-
 configs/sandbox64_defconfig                   |   2 +-
 configs/sandbox_defconfig                     |   2 +-
 configs/sandbox_flattree_defconfig            |   2 +-
 configs/sandbox_noinst_defconfig              |   2 +-
 configs/sandbox_spl_defconfig                 |   2 +-
 configs/sifive_unmatched_defconfig            |   2 +-
 configs/synquacer_developerbox_defconfig      |   2 +-
 configs/turris_mox_defconfig                  |   2 +-
 configs/turris_omnia_defconfig                |   2 +-
 doc/develop/driver-model/nvme.rst             |   1 +
 drivers/mailbox/Kconfig                       |  11 +
 drivers/mailbox/Makefile                      |   1 +
 drivers/mailbox/apple-mbox.c                  |  92 +++++++
 drivers/nvme/Kconfig                          |  21 +-
 drivers/nvme/Makefile                         |   2 +
 drivers/nvme/nvme.c                           |  86 ++-----
 drivers/nvme/nvme.h                           |  70 +++++
 drivers/nvme/nvme_apple.c                     | 240 ++++++++++++++++++
 drivers/nvme/nvme_pci.c                       |  49 ++++
 drivers/power/domain/apple-pmgr.c             |  73 +++++-
 include/configs/apple.h                       |   7 +
 include/linux/apple-mailbox.h                 |  19 ++
 161 files changed, 998 insertions(+), 204 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-apple/rtkit.h
 rename arch/arm/include/asm/{arch-m1 => arch-apple}/uart.h (100%)
 create mode 100644 arch/arm/mach-apple/rtkit.c
 create mode 100644 drivers/mailbox/apple-mbox.c
 create mode 100644 drivers/nvme/nvme_apple.c
 create mode 100644 drivers/nvme/nvme_pci.c
 create mode 100644 include/linux/apple-mailbox.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v2 1/9] nvme: Split out PCI support
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:35   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox Mark Kettenis
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

Apple SoCs have an integrated NVMe controller that isn't connected
over a PCIe bus. In preparation for adding support for this NVMe
controller, split out the PCI support into its own file. This file
is selected through a new CONFIG_NVME_PCI Kconfig option, so do
a wholesale replacement of CONFIG_NVME with CONFIG_NVME_PCI.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---
 configs/clearfog_gt_8k_defconfig              |  2 +-
 configs/firefly-rk3399_defconfig              |  2 +-
 configs/khadas-vim3_android_ab_defconfig      |  2 +-
 configs/khadas-vim3_android_defconfig         |  2 +-
 configs/khadas-vim3_defconfig                 |  2 +-
 configs/khadas-vim3l_android_ab_defconfig     |  2 +-
 configs/khadas-vim3l_android_defconfig        |  2 +-
 configs/khadas-vim3l_defconfig                |  2 +-
 configs/kontron_sl28_defconfig                |  2 +-
 configs/ls1012afrdm_qspi_defconfig            |  2 +-
 configs/ls1012afrdm_tfa_defconfig             |  2 +-
 .../ls1012afrwy_qspi_SECURE_BOOT_defconfig    |  2 +-
 configs/ls1012afrwy_qspi_defconfig            |  2 +-
 configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig |  2 +-
 configs/ls1012afrwy_tfa_defconfig             |  2 +-
 configs/ls1012aqds_qspi_defconfig             |  2 +-
 configs/ls1012aqds_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1012aqds_tfa_defconfig              |  2 +-
 configs/ls1012ardb_qspi_SECURE_BOOT_defconfig |  2 +-
 configs/ls1012ardb_qspi_defconfig             |  2 +-
 configs/ls1012ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1012ardb_tfa_defconfig              |  2 +-
 configs/ls1021aiot_qspi_defconfig             |  2 +-
 configs/ls1021aiot_sdcard_defconfig           |  2 +-
 configs/ls1021aqds_ddr4_nor_defconfig         |  2 +-
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig  |  2 +-
 configs/ls1021aqds_nand_defconfig             |  2 +-
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1021aqds_nor_defconfig              |  2 +-
 configs/ls1021aqds_nor_lpuart_defconfig       |  2 +-
 configs/ls1021aqds_qspi_defconfig             |  2 +-
 configs/ls1021aqds_sdcard_ifc_defconfig       |  2 +-
 configs/ls1021aqds_sdcard_qspi_defconfig      |  2 +-
 configs/ls1021atsn_qspi_defconfig             |  2 +-
 configs/ls1021atsn_sdcard_defconfig           |  2 +-
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1021atwr_nor_defconfig              |  2 +-
 configs/ls1021atwr_nor_lpuart_defconfig       |  2 +-
 configs/ls1021atwr_qspi_defconfig             |  2 +-
 configs/ls1021atwr_sdcard_ifc_defconfig       |  2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig      |  2 +-
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1028aqds_tfa_defconfig              |  2 +-
 configs/ls1028aqds_tfa_lpuart_defconfig       |  2 +-
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1028ardb_tfa_defconfig              |  2 +-
 configs/ls1043aqds_defconfig                  |  2 +-
 configs/ls1043aqds_lpuart_defconfig           |  2 +-
 configs/ls1043aqds_nand_defconfig             |  2 +-
 configs/ls1043aqds_nor_ddr3_defconfig         |  2 +-
 configs/ls1043aqds_qspi_defconfig             |  2 +-
 configs/ls1043aqds_sdcard_ifc_defconfig       |  2 +-
 configs/ls1043aqds_sdcard_qspi_defconfig      |  2 +-
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1043aqds_tfa_defconfig              |  2 +-
 configs/ls1043ardb_SECURE_BOOT_defconfig      |  2 +-
 configs/ls1043ardb_defconfig                  |  2 +-
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig |  2 +-
 configs/ls1043ardb_nand_defconfig             |  2 +-
 configs/ls1043ardb_sdcard_defconfig           |  2 +-
 configs/ls1043ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1043ardb_tfa_defconfig              |  2 +-
 configs/ls1046afrwy_tfa_defconfig             |  2 +-
 configs/ls1046aqds_SECURE_BOOT_defconfig      |  2 +-
 configs/ls1046aqds_defconfig                  |  2 +-
 configs/ls1046aqds_lpuart_defconfig           |  2 +-
 configs/ls1046aqds_nand_defconfig             |  2 +-
 configs/ls1046aqds_qspi_defconfig             |  2 +-
 configs/ls1046aqds_sdcard_ifc_defconfig       |  2 +-
 configs/ls1046aqds_sdcard_qspi_defconfig      |  2 +-
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1046aqds_tfa_defconfig              |  2 +-
 configs/ls1046ardb_emmc_defconfig             |  2 +-
 configs/ls1046ardb_qspi_SECURE_BOOT_defconfig |  2 +-
 configs/ls1046ardb_qspi_defconfig             |  2 +-
 configs/ls1046ardb_qspi_spl_defconfig         |  2 +-
 configs/ls1046ardb_sdcard_defconfig           |  2 +-
 configs/ls1046ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1046ardb_tfa_defconfig              |  2 +-
 configs/ls1088aqds_defconfig                  |  2 +-
 configs/ls1088aqds_qspi_SECURE_BOOT_defconfig |  2 +-
 configs/ls1088aqds_qspi_defconfig             |  2 +-
 configs/ls1088aqds_sdcard_ifc_defconfig       |  2 +-
 configs/ls1088aqds_sdcard_qspi_defconfig      |  2 +-
 configs/ls1088aqds_tfa_defconfig              |  2 +-
 configs/ls1088ardb_qspi_SECURE_BOOT_defconfig |  2 +-
 configs/ls1088ardb_qspi_defconfig             |  2 +-
 configs/ls1088ardb_sdcard_qspi_defconfig      |  2 +-
 configs/ls1088ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls1088ardb_tfa_defconfig              |  2 +-
 configs/ls2080aqds_SECURE_BOOT_defconfig      |  2 +-
 configs/ls2080aqds_defconfig                  |  2 +-
 configs/ls2080aqds_nand_defconfig             |  2 +-
 configs/ls2080aqds_qspi_defconfig             |  2 +-
 configs/ls2080aqds_sdcard_defconfig           |  2 +-
 configs/ls2080ardb_SECURE_BOOT_defconfig      |  2 +-
 configs/ls2080ardb_defconfig                  |  2 +-
 configs/ls2080ardb_nand_defconfig             |  2 +-
 configs/ls2081ardb_defconfig                  |  2 +-
 configs/ls2088aqds_tfa_defconfig              |  2 +-
 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig |  2 +-
 configs/ls2088ardb_qspi_defconfig             |  2 +-
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/ls2088ardb_tfa_defconfig              |  2 +-
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/lx2160aqds_tfa_defconfig              |  2 +-
 configs/lx2160ardb_tfa_SECURE_BOOT_defconfig  |  2 +-
 configs/lx2160ardb_tfa_defconfig              |  2 +-
 configs/lx2160ardb_tfa_stmm_defconfig         |  2 +-
 configs/mvebu_crb_cn9130_defconfig            |  2 +-
 configs/mvebu_db_armada8k_defconfig           |  2 +-
 configs/mvebu_db_cn9130_defconfig             |  2 +-
 configs/mvebu_espressobin-88f3720_defconfig   |  2 +-
 configs/mvebu_mcbin-88f8040_defconfig         |  2 +-
 configs/mvebu_puzzle-m801-88f8040_defconfig   |  2 +-
 configs/nanopc-t4-rk3399_defconfig            |  2 +-
 configs/octeontx2_96xx_defconfig              |  2 +-
 configs/octeontx_81xx_defconfig               |  2 +-
 configs/octeontx_83xx_defconfig               |  2 +-
 configs/p3450-0000_defconfig                  |  2 +-
 configs/pinebook-pro-rk3399_defconfig         |  2 +-
 configs/qemu-x86_64_defconfig                 |  2 +-
 configs/qemu-x86_defconfig                    |  2 +-
 configs/qemu_arm64_defconfig                  |  2 +-
 configs/qemu_arm_defconfig                    |  2 +-
 configs/rcar3_salvator-x_defconfig            |  2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     |  2 +-
 configs/rock-pi-4-rk3399_defconfig            |  2 +-
 configs/rock-pi-4c-rk3399_defconfig           |  2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       |  2 +-
 configs/rock960-rk3399_defconfig              |  2 +-
 configs/rockpro64-rk3399_defconfig            |  2 +-
 configs/sandbox64_defconfig                   |  2 +-
 configs/sandbox_defconfig                     |  2 +-
 configs/sandbox_flattree_defconfig            |  2 +-
 configs/sandbox_noinst_defconfig              |  2 +-
 configs/sandbox_spl_defconfig                 |  2 +-
 configs/sifive_unmatched_defconfig            |  2 +-
 configs/synquacer_developerbox_defconfig      |  2 +-
 configs/turris_mox_defconfig                  |  2 +-
 configs/turris_omnia_defconfig                |  2 +-
 doc/develop/driver-model/nvme.rst             |  1 +
 drivers/nvme/Kconfig                          | 10 +++-
 drivers/nvme/Makefile                         |  1 +
 drivers/nvme/nvme.c                           | 38 ++------------
 drivers/nvme/nvme.h                           |  3 ++
 drivers/nvme/nvme_pci.c                       | 49 +++++++++++++++++++
 147 files changed, 207 insertions(+), 177 deletions(-)
 create mode 100644 drivers/nvme/nvme_pci.c

diff --git a/configs/clearfog_gt_8k_defconfig b/configs/clearfog_gt_8k_defconfig
index 6e344c9ce3..6dcd70fe12 100644
--- a/configs/clearfog_gt_8k_defconfig
+++ b/configs/clearfog_gt_8k_defconfig
@@ -56,7 +56,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index d576b5c38d..fe1c019f1d 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -41,7 +41,7 @@ CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PMIC_RK8XX=y
 CONFIG_REGULATOR_PWM=y
diff --git a/configs/khadas-vim3_android_ab_defconfig b/configs/khadas-vim3_android_ab_defconfig
index c5aaaf3ce7..7b8a0486cd 100644
--- a/configs/khadas-vim3_android_ab_defconfig
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -61,7 +61,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/khadas-vim3_android_defconfig b/configs/khadas-vim3_android_defconfig
index f0b2c205a7..6cca63f0fe 100644
--- a/configs/khadas-vim3_android_defconfig
+++ b/configs/khadas-vim3_android_defconfig
@@ -59,7 +59,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig
index 65050efd3f..5e868ce2df 100644
--- a/configs/khadas-vim3_defconfig
+++ b/configs/khadas-vim3_defconfig
@@ -47,7 +47,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/khadas-vim3l_android_ab_defconfig b/configs/khadas-vim3l_android_ab_defconfig
index 3401c51721..fd55d8473b 100644
--- a/configs/khadas-vim3l_android_ab_defconfig
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -61,7 +61,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/khadas-vim3l_android_defconfig b/configs/khadas-vim3l_android_defconfig
index 429db2b344..ff67bca6ac 100644
--- a/configs/khadas-vim3l_android_defconfig
+++ b/configs/khadas-vim3l_android_defconfig
@@ -59,7 +59,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig
index b9162c9f1e..2b391646c5 100644
--- a/configs/khadas-vim3l_defconfig
+++ b/configs/khadas-vim3l_defconfig
@@ -47,7 +47,7 @@ CONFIG_DM_MDIO=y
 CONFIG_DM_MDIO_MUX=y
 CONFIG_ETH_DESIGNWARE_MESON8B=y
 CONFIG_MDIO_MUX_MESON_G12A=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MESON=y
 CONFIG_MESON_G12A_USB_PHY=y
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index 31a1083b0a..087dcb1d0e 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -83,7 +83,7 @@ CONFIG_DM_DSA=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MSCC_FELIX_SWITCH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_RTC_RV8803=y
diff --git a/configs/ls1012afrdm_qspi_defconfig b/configs/ls1012afrdm_qspi_defconfig
index ad3b7bff42..0b3964e9d8 100644
--- a/configs/ls1012afrdm_qspi_defconfig
+++ b/configs/ls1012afrdm_qspi_defconfig
@@ -50,7 +50,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012afrdm_tfa_defconfig b/configs/ls1012afrdm_tfa_defconfig
index 3317a0592b..93514082f2 100644
--- a/configs/ls1012afrdm_tfa_defconfig
+++ b/configs/ls1012afrdm_tfa_defconfig
@@ -50,7 +50,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
index cb8b288c39..8ecef720b0 100644
--- a/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_qspi_SECURE_BOOT_defconfig
@@ -49,7 +49,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012afrwy_qspi_defconfig b/configs/ls1012afrwy_qspi_defconfig
index 610f32cd99..097349e497 100644
--- a/configs/ls1012afrwy_qspi_defconfig
+++ b/configs/ls1012afrwy_qspi_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
index b3cb6f706d..48d12802f1 100644
--- a/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig
@@ -49,7 +49,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012afrwy_tfa_defconfig b/configs/ls1012afrwy_tfa_defconfig
index afec07cf8e..5137b52fd8 100644
--- a/configs/ls1012afrwy_tfa_defconfig
+++ b/configs/ls1012afrwy_tfa_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012aqds_qspi_defconfig b/configs/ls1012aqds_qspi_defconfig
index 93e76d95f1..d10a4f558f 100644
--- a/configs/ls1012aqds_qspi_defconfig
+++ b/configs/ls1012aqds_qspi_defconfig
@@ -71,7 +71,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
index 476ebd0415..14eeade305 100644
--- a/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012aqds_tfa_SECURE_BOOT_defconfig
@@ -63,7 +63,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012aqds_tfa_defconfig b/configs/ls1012aqds_tfa_defconfig
index d4d9b8f76b..08850e5981 100644
--- a/configs/ls1012aqds_tfa_defconfig
+++ b/configs/ls1012aqds_tfa_defconfig
@@ -72,7 +72,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
index 8767c87cc6..f495367808 100644
--- a/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1012ardb_qspi_SECURE_BOOT_defconfig
@@ -51,7 +51,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1012ardb_qspi_defconfig b/configs/ls1012ardb_qspi_defconfig
index fccbef70ea..262ef9bd03 100644
--- a/configs/ls1012ardb_qspi_defconfig
+++ b/configs/ls1012ardb_qspi_defconfig
@@ -56,7 +56,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
index bf35286848..1be4478bbf 100644
--- a/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1012ardb_tfa_SECURE_BOOT_defconfig
@@ -53,7 +53,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1012ardb_tfa_defconfig b/configs/ls1012ardb_tfa_defconfig
index 7a175d3c74..12e77de638 100644
--- a/configs/ls1012ardb_tfa_defconfig
+++ b/configs/ls1012ardb_tfa_defconfig
@@ -55,7 +55,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_FSL_PFE=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1021aiot_qspi_defconfig b/configs/ls1021aiot_qspi_defconfig
index 4705e34e1d..fca79db20a 100644
--- a/configs/ls1021aiot_qspi_defconfig
+++ b/configs/ls1021aiot_qspi_defconfig
@@ -53,7 +53,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aiot_sdcard_defconfig b/configs/ls1021aiot_sdcard_defconfig
index e387264d89..c099a3ccfa 100644
--- a/configs/ls1021aiot_sdcard_defconfig
+++ b/configs/ls1021aiot_sdcard_defconfig
@@ -70,7 +70,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_ddr4_nor_defconfig b/configs/ls1021aqds_ddr4_nor_defconfig
index afd93187bc..600e6f13cc 100644
--- a/configs/ls1021aqds_ddr4_nor_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_defconfig
@@ -75,7 +75,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
index b27c67b2a3..e82d1a19db 100644
--- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
@@ -76,7 +76,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_nand_defconfig b/configs/ls1021aqds_nand_defconfig
index 915579a12a..6bde1bef2c 100644
--- a/configs/ls1021aqds_nand_defconfig
+++ b/configs/ls1021aqds_nand_defconfig
@@ -98,7 +98,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
index 5ab7d2785f..0da3a7a86d 100644
--- a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
@@ -74,7 +74,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_nor_defconfig b/configs/ls1021aqds_nor_defconfig
index 934d44fbde..f9869cef44 100644
--- a/configs/ls1021aqds_nor_defconfig
+++ b/configs/ls1021aqds_nor_defconfig
@@ -76,7 +76,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_nor_lpuart_defconfig b/configs/ls1021aqds_nor_lpuart_defconfig
index 1cf208631c..36eb669496 100644
--- a/configs/ls1021aqds_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_nor_lpuart_defconfig
@@ -77,7 +77,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_qspi_defconfig b/configs/ls1021aqds_qspi_defconfig
index f967619ef9..3a1b33dd70 100644
--- a/configs/ls1021aqds_qspi_defconfig
+++ b/configs/ls1021aqds_qspi_defconfig
@@ -67,7 +67,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_sdcard_ifc_defconfig b/configs/ls1021aqds_sdcard_ifc_defconfig
index db8a3ae9ec..c2c1b32bc4 100644
--- a/configs/ls1021aqds_sdcard_ifc_defconfig
+++ b/configs/ls1021aqds_sdcard_ifc_defconfig
@@ -94,7 +94,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021aqds_sdcard_qspi_defconfig b/configs/ls1021aqds_sdcard_qspi_defconfig
index 625dd086ab..bd3ae1a188 100644
--- a/configs/ls1021aqds_sdcard_qspi_defconfig
+++ b/configs/ls1021aqds_sdcard_qspi_defconfig
@@ -84,7 +84,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1021atsn_qspi_defconfig b/configs/ls1021atsn_qspi_defconfig
index 5c8cee3ea9..aaea7156c1 100644
--- a/configs/ls1021atsn_qspi_defconfig
+++ b/configs/ls1021atsn_qspi_defconfig
@@ -59,7 +59,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MII=y
 CONFIG_SJA1105=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/ls1021atsn_sdcard_defconfig b/configs/ls1021atsn_sdcard_defconfig
index a3b8f248c7..870fdb05bf 100644
--- a/configs/ls1021atsn_sdcard_defconfig
+++ b/configs/ls1021atsn_sdcard_defconfig
@@ -75,7 +75,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MII=y
 CONFIG_SJA1105=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
index f61d29ce89..27b28cc1c9 100644
--- a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
@@ -62,7 +62,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x60940000
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig
index 02c25cda7d..1242f9c5aa 100644
--- a/configs/ls1021atwr_nor_defconfig
+++ b/configs/ls1021atwr_nor_defconfig
@@ -64,7 +64,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x60940000
diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig
index 49d6dda6a5..2562f9077f 100644
--- a/configs/ls1021atwr_nor_lpuart_defconfig
+++ b/configs/ls1021atwr_nor_lpuart_defconfig
@@ -65,7 +65,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x60940000
diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig
index 36a8aee0b1..602ce2e9e3 100644
--- a/configs/ls1021atwr_qspi_defconfig
+++ b/configs/ls1021atwr_qspi_defconfig
@@ -63,7 +63,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1021atwr_sdcard_ifc_defconfig b/configs/ls1021atwr_sdcard_ifc_defconfig
index ede4c95dd1..cb454837bb 100644
--- a/configs/ls1021atwr_sdcard_ifc_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_defconfig
@@ -82,7 +82,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1021atwr_sdcard_qspi_defconfig b/configs/ls1021atwr_sdcard_qspi_defconfig
index 1315043094..195ce83198 100644
--- a/configs/ls1021atwr_sdcard_qspi_defconfig
+++ b/configs/ls1021atwr_sdcard_qspi_defconfig
@@ -80,7 +80,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index 2fb90735ab..64bd2bbc24 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -71,7 +71,7 @@ CONFIG_DM_DSA=y
 CONFIG_E1000=y
 CONFIG_MSCC_FELIX_SWITCH=y
 CONFIG_MDIO_MUX_I2CREG=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 0bdca833f1..ca827ac0b4 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -77,7 +77,7 @@ CONFIG_DM_DSA=y
 CONFIG_E1000=y
 CONFIG_MSCC_FELIX_SWITCH=y
 CONFIG_MDIO_MUX_I2CREG=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1028aqds_tfa_lpuart_defconfig b/configs/ls1028aqds_tfa_lpuart_defconfig
index dbf6af99f5..f7933e383d 100644
--- a/configs/ls1028aqds_tfa_lpuart_defconfig
+++ b/configs/ls1028aqds_tfa_lpuart_defconfig
@@ -76,7 +76,7 @@ CONFIG_DM_MDIO_MUX=y
 CONFIG_E1000=y
 CONFIG_FSL_ENETC=y
 CONFIG_MDIO_MUX_I2CREG=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
index 5cb55d046d..f37cca2ad6 100644
--- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
@@ -66,7 +66,7 @@ CONFIG_DM_DSA=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MSCC_FELIX_SWITCH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig
index b58254dc65..b753824e9d 100644
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -72,7 +72,7 @@ CONFIG_DM_DSA=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MSCC_FELIX_SWITCH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_defconfig b/configs/ls1043aqds_defconfig
index 1a484ff483..c30731e3df 100644
--- a/configs/ls1043aqds_defconfig
+++ b/configs/ls1043aqds_defconfig
@@ -79,7 +79,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_lpuart_defconfig b/configs/ls1043aqds_lpuart_defconfig
index dfd7fb881b..229f13cc40 100644
--- a/configs/ls1043aqds_lpuart_defconfig
+++ b/configs/ls1043aqds_lpuart_defconfig
@@ -80,7 +80,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_nand_defconfig b/configs/ls1043aqds_nand_defconfig
index 9e87f0fd88..e6ea996d3c 100644
--- a/configs/ls1043aqds_nand_defconfig
+++ b/configs/ls1043aqds_nand_defconfig
@@ -100,7 +100,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_nor_ddr3_defconfig b/configs/ls1043aqds_nor_ddr3_defconfig
index bffe105220..4d7d14ece6 100644
--- a/configs/ls1043aqds_nor_ddr3_defconfig
+++ b/configs/ls1043aqds_nor_ddr3_defconfig
@@ -80,7 +80,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_qspi_defconfig b/configs/ls1043aqds_qspi_defconfig
index e01324ccef..bbd5330c7d 100644
--- a/configs/ls1043aqds_qspi_defconfig
+++ b/configs/ls1043aqds_qspi_defconfig
@@ -74,7 +74,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x40900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_sdcard_ifc_defconfig b/configs/ls1043aqds_sdcard_ifc_defconfig
index b487b370b5..4ccbfb78db 100644
--- a/configs/ls1043aqds_sdcard_ifc_defconfig
+++ b/configs/ls1043aqds_sdcard_ifc_defconfig
@@ -98,7 +98,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_sdcard_qspi_defconfig b/configs/ls1043aqds_sdcard_qspi_defconfig
index 084d104ea4..a8cfbf09e8 100644
--- a/configs/ls1043aqds_sdcard_qspi_defconfig
+++ b/configs/ls1043aqds_sdcard_qspi_defconfig
@@ -91,7 +91,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index 3e303c5311..f495098481 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -81,7 +81,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 8d02bed8e1..39368732a3 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -90,7 +90,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1043ardb_SECURE_BOOT_defconfig b/configs/ls1043ardb_SECURE_BOOT_defconfig
index 2d85f671cc..bba6e2eb46 100644
--- a/configs/ls1043ardb_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_SECURE_BOOT_defconfig
@@ -64,7 +64,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x60940000
diff --git a/configs/ls1043ardb_defconfig b/configs/ls1043ardb_defconfig
index ca6958fdb4..e361c96049 100644
--- a/configs/ls1043ardb_defconfig
+++ b/configs/ls1043ardb_defconfig
@@ -67,7 +67,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x60940000
diff --git a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
index bbc775a4d9..6d421d5d28 100644
--- a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
@@ -79,7 +79,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FMAN_FW_IN_NAND=y
diff --git a/configs/ls1043ardb_nand_defconfig b/configs/ls1043ardb_nand_defconfig
index e8986db42b..7e0da803b2 100644
--- a/configs/ls1043ardb_nand_defconfig
+++ b/configs/ls1043ardb_nand_defconfig
@@ -87,7 +87,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FMAN_FW_IN_NAND=y
diff --git a/configs/ls1043ardb_sdcard_defconfig b/configs/ls1043ardb_sdcard_defconfig
index c399ed0891..933de4ed2a 100644
--- a/configs/ls1043ardb_sdcard_defconfig
+++ b/configs/ls1043ardb_sdcard_defconfig
@@ -85,7 +85,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x940000
diff --git a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
index 8ac9a06c72..14100c8429 100644
--- a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
@@ -65,7 +65,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x940000
diff --git a/configs/ls1043ardb_tfa_defconfig b/configs/ls1043ardb_tfa_defconfig
index 99c125731f..6281f841a4 100644
--- a/configs/ls1043ardb_tfa_defconfig
+++ b/configs/ls1043ardb_tfa_defconfig
@@ -71,7 +71,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_SYS_QE_FW_ADDR=0x940000
diff --git a/configs/ls1046afrwy_tfa_defconfig b/configs/ls1046afrwy_tfa_defconfig
index af07b1cd46..d587826d44 100644
--- a/configs/ls1046afrwy_tfa_defconfig
+++ b/configs/ls1046afrwy_tfa_defconfig
@@ -58,7 +58,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_SECURE_BOOT_defconfig b/configs/ls1046aqds_SECURE_BOOT_defconfig
index 6a0c951ed0..cd4ba1195f 100644
--- a/configs/ls1046aqds_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_SECURE_BOOT_defconfig
@@ -77,7 +77,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_defconfig b/configs/ls1046aqds_defconfig
index 507d24ec8f..ff380d6651 100644
--- a/configs/ls1046aqds_defconfig
+++ b/configs/ls1046aqds_defconfig
@@ -80,7 +80,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_lpuart_defconfig b/configs/ls1046aqds_lpuart_defconfig
index 9e8e37fdb7..a695c59975 100644
--- a/configs/ls1046aqds_lpuart_defconfig
+++ b/configs/ls1046aqds_lpuart_defconfig
@@ -81,7 +81,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x60900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_nand_defconfig b/configs/ls1046aqds_nand_defconfig
index f6c55e638a..ddd498c62e 100644
--- a/configs/ls1046aqds_nand_defconfig
+++ b/configs/ls1046aqds_nand_defconfig
@@ -100,7 +100,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_qspi_defconfig b/configs/ls1046aqds_qspi_defconfig
index fe295c51e4..6ce6abac58 100644
--- a/configs/ls1046aqds_qspi_defconfig
+++ b/configs/ls1046aqds_qspi_defconfig
@@ -75,7 +75,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x40900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_sdcard_ifc_defconfig b/configs/ls1046aqds_sdcard_ifc_defconfig
index 78402e7a96..92cbfb3cfe 100644
--- a/configs/ls1046aqds_sdcard_ifc_defconfig
+++ b/configs/ls1046aqds_sdcard_ifc_defconfig
@@ -100,7 +100,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_sdcard_qspi_defconfig b/configs/ls1046aqds_sdcard_qspi_defconfig
index 18f560e947..f85af10f73 100644
--- a/configs/ls1046aqds_sdcard_qspi_defconfig
+++ b/configs/ls1046aqds_sdcard_qspi_defconfig
@@ -93,7 +93,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index eb44c1828e..26ac87b4b7 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -81,7 +81,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index b68d8507ba..b032a5b57b 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -91,7 +91,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1046ardb_emmc_defconfig b/configs/ls1046ardb_emmc_defconfig
index 46301fb183..5c288a9e83 100644
--- a/configs/ls1046ardb_emmc_defconfig
+++ b/configs/ls1046ardb_emmc_defconfig
@@ -83,7 +83,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
index a4696f1a16..5b6d9aa24b 100644
--- a/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_qspi_SECURE_BOOT_defconfig
@@ -66,7 +66,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x40900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_qspi_defconfig b/configs/ls1046ardb_qspi_defconfig
index 1837833a8d..fd3ccc7063 100644
--- a/configs/ls1046ardb_qspi_defconfig
+++ b/configs/ls1046ardb_qspi_defconfig
@@ -70,7 +70,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x40900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_qspi_spl_defconfig b/configs/ls1046ardb_qspi_spl_defconfig
index 777b7678a3..08e1fb2ca0 100644
--- a/configs/ls1046ardb_qspi_spl_defconfig
+++ b/configs/ls1046ardb_qspi_spl_defconfig
@@ -88,7 +88,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x40900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_sdcard_defconfig b/configs/ls1046ardb_sdcard_defconfig
index ac8f2bcb1b..6e3694c42f 100644
--- a/configs/ls1046ardb_sdcard_defconfig
+++ b/configs/ls1046ardb_sdcard_defconfig
@@ -82,7 +82,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
index bd1dc05c58..eccd109b9a 100644
--- a/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046ardb_tfa_SECURE_BOOT_defconfig
@@ -62,7 +62,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1046ardb_tfa_defconfig b/configs/ls1046ardb_tfa_defconfig
index 149091af4a..ebcf6777be 100644
--- a/configs/ls1046ardb_tfa_defconfig
+++ b/configs/ls1046ardb_tfa_defconfig
@@ -68,7 +68,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_FMAN_ENET=y
 CONFIG_SYS_FMAN_FW_ADDR=0x900000
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_EP=y
diff --git a/configs/ls1088aqds_defconfig b/configs/ls1088aqds_defconfig
index 986a28d547..5ccc955557 100644
--- a/configs/ls1088aqds_defconfig
+++ b/configs/ls1088aqds_defconfig
@@ -79,7 +79,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1088aqds_qspi_SECURE_BOOT_defconfig b/configs/ls1088aqds_qspi_SECURE_BOOT_defconfig
index dbcd6e2ea2..bc9243567c 100644
--- a/configs/ls1088aqds_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1088aqds_qspi_SECURE_BOOT_defconfig
@@ -74,7 +74,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1088aqds_qspi_defconfig b/configs/ls1088aqds_qspi_defconfig
index 7033c92897..05747b0952 100644
--- a/configs/ls1088aqds_qspi_defconfig
+++ b/configs/ls1088aqds_qspi_defconfig
@@ -77,7 +77,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1088aqds_sdcard_ifc_defconfig b/configs/ls1088aqds_sdcard_ifc_defconfig
index 30ffd3c58a..77c566440b 100644
--- a/configs/ls1088aqds_sdcard_ifc_defconfig
+++ b/configs/ls1088aqds_sdcard_ifc_defconfig
@@ -89,7 +89,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1088aqds_sdcard_qspi_defconfig b/configs/ls1088aqds_sdcard_qspi_defconfig
index 9df9845296..dcf50ff803 100644
--- a/configs/ls1088aqds_sdcard_qspi_defconfig
+++ b/configs/ls1088aqds_sdcard_qspi_defconfig
@@ -87,7 +87,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig
index ae00387d3f..5632a15f4f 100644
--- a/configs/ls1088aqds_tfa_defconfig
+++ b/configs/ls1088aqds_tfa_defconfig
@@ -100,7 +100,7 @@ CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_MDIO_MUX_I2CREG=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig b/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
index ed0943b6ec..c4c1a39790 100644
--- a/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
@@ -75,7 +75,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1088ardb_qspi_defconfig b/configs/ls1088ardb_qspi_defconfig
index 486a20dbc5..2f74b87597 100644
--- a/configs/ls1088ardb_qspi_defconfig
+++ b/configs/ls1088ardb_qspi_defconfig
@@ -78,7 +78,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig b/configs/ls1088ardb_sdcard_qspi_defconfig
index d54ff504a8..89e2bcf138 100644
--- a/configs/ls1088ardb_sdcard_qspi_defconfig
+++ b/configs/ls1088ardb_sdcard_qspi_defconfig
@@ -88,7 +88,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
index dd547f797b..e2b5116c4f 100644
--- a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig
@@ -76,7 +76,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig
index fc2d1b475c..8f54aa8a12 100644
--- a/configs/ls1088ardb_tfa_defconfig
+++ b/configs/ls1088ardb_tfa_defconfig
@@ -82,7 +82,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls2080aqds_SECURE_BOOT_defconfig b/configs/ls2080aqds_SECURE_BOOT_defconfig
index b133bb7845..6cab282ed0 100644
--- a/configs/ls2080aqds_SECURE_BOOT_defconfig
+++ b/configs/ls2080aqds_SECURE_BOOT_defconfig
@@ -67,7 +67,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080aqds_defconfig b/configs/ls2080aqds_defconfig
index 63708e9b07..8ff138d55e 100644
--- a/configs/ls2080aqds_defconfig
+++ b/configs/ls2080aqds_defconfig
@@ -70,7 +70,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080aqds_nand_defconfig b/configs/ls2080aqds_nand_defconfig
index 47f09b6288..cc74c5a686 100644
--- a/configs/ls2080aqds_nand_defconfig
+++ b/configs/ls2080aqds_nand_defconfig
@@ -77,7 +77,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080aqds_qspi_defconfig b/configs/ls2080aqds_qspi_defconfig
index bbc9f3d113..8df52491a7 100644
--- a/configs/ls2080aqds_qspi_defconfig
+++ b/configs/ls2080aqds_qspi_defconfig
@@ -66,7 +66,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080aqds_sdcard_defconfig b/configs/ls2080aqds_sdcard_defconfig
index c7a6e2a851..65a0b81f15 100644
--- a/configs/ls2080aqds_sdcard_defconfig
+++ b/configs/ls2080aqds_sdcard_defconfig
@@ -72,7 +72,7 @@ CONFIG_PHY_VITESSE=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080ardb_SECURE_BOOT_defconfig b/configs/ls2080ardb_SECURE_BOOT_defconfig
index 15dec62dd4..33a129b20b 100644
--- a/configs/ls2080ardb_SECURE_BOOT_defconfig
+++ b/configs/ls2080ardb_SECURE_BOOT_defconfig
@@ -66,7 +66,7 @@ CONFIG_PHY_CORTINA=y
 CONFIG_CORTINA_FW_ADDR=0x580980000
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080ardb_defconfig b/configs/ls2080ardb_defconfig
index 909c10b631..7461713d03 100644
--- a/configs/ls2080ardb_defconfig
+++ b/configs/ls2080ardb_defconfig
@@ -69,7 +69,7 @@ CONFIG_PHY_CORTINA=y
 CONFIG_CORTINA_FW_ADDR=0x580980000
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2080ardb_nand_defconfig b/configs/ls2080ardb_nand_defconfig
index f40ecb7e68..ad301b8810 100644
--- a/configs/ls2080ardb_nand_defconfig
+++ b/configs/ls2080ardb_nand_defconfig
@@ -78,7 +78,7 @@ CONFIG_PHY_CORTINA=y
 CONFIG_CORTINA_FW_ADDR=0x980000
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2081ardb_defconfig b/configs/ls2081ardb_defconfig
index ed0b1b7622..e0c7e7b882 100644
--- a/configs/ls2081ardb_defconfig
+++ b/configs/ls2081ardb_defconfig
@@ -62,7 +62,7 @@ CONFIG_PHY_CORTINA=y
 CONFIG_CORTINA_FW_ADDR=0x980000
 CONFIG_E1000=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig
index d85c4d8b0b..12e628b55d 100644
--- a/configs/ls2088aqds_tfa_defconfig
+++ b/configs/ls2088aqds_tfa_defconfig
@@ -88,7 +88,7 @@ CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_MDIO_MUX_I2CREG=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
index c49d163346..037ee97a33 100644
--- a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig
@@ -65,7 +65,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls2088ardb_qspi_defconfig b/configs/ls2088ardb_qspi_defconfig
index b8c7c78b8e..b08bcd44e8 100644
--- a/configs/ls2088ardb_qspi_defconfig
+++ b/configs/ls2088ardb_qspi_defconfig
@@ -72,7 +72,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_SCSI=y
diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
index 3cc9168290..590f30828f 100644
--- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
@@ -77,7 +77,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index a28b45b129..dc1abed910 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -85,7 +85,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_DM_RTC=y
diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
index a9a0a27888..d6f4275b9c 100644
--- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig
@@ -80,7 +80,7 @@ CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_MDIO_MUX_I2CREG=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_GEN4=y
diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig
index de8dc553d1..920dee7916 100644
--- a/configs/lx2160aqds_tfa_defconfig
+++ b/configs/lx2160aqds_tfa_defconfig
@@ -87,7 +87,7 @@ CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_MDIO_MUX_I2CREG=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_GEN4=y
diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
index ac42c2508c..a82372d567 100644
--- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig
@@ -72,7 +72,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_GEN4=y
diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 59955eebbe..31920f4430 100644
--- a/configs/lx2160ardb_tfa_defconfig
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -81,7 +81,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_GEN4=y
diff --git a/configs/lx2160ardb_tfa_stmm_defconfig b/configs/lx2160ardb_tfa_stmm_defconfig
index 149e82bed3..35bd6a26da 100644
--- a/configs/lx2160ardb_tfa_stmm_defconfig
+++ b/configs/lx2160ardb_tfa_stmm_defconfig
@@ -81,7 +81,7 @@ CONFIG_DM_MDIO=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_FSL_LS_MDIO=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_LAYERSCAPE_RC=y
 CONFIG_PCIE_LAYERSCAPE_GEN4=y
diff --git a/configs/mvebu_crb_cn9130_defconfig b/configs/mvebu_crb_cn9130_defconfig
index 039fd8b3dc..f1215fa359 100644
--- a/configs/mvebu_crb_cn9130_defconfig
+++ b/configs/mvebu_crb_cn9130_defconfig
@@ -62,7 +62,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig
index e6168a76a6..622d687e5d 100644
--- a/configs/mvebu_db_armada8k_defconfig
+++ b/configs/mvebu_db_armada8k_defconfig
@@ -51,7 +51,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/mvebu_db_cn9130_defconfig b/configs/mvebu_db_cn9130_defconfig
index 42d7038c5a..1789838691 100644
--- a/configs/mvebu_db_cn9130_defconfig
+++ b/configs/mvebu_db_cn9130_defconfig
@@ -67,7 +67,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig
index ffe6518433..4b8206a38f 100644
--- a/configs/mvebu_espressobin-88f3720_defconfig
+++ b/configs/mvebu_espressobin-88f3720_defconfig
@@ -73,7 +73,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVNETA=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_AARDVARK=y
 CONFIG_PHY=y
diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig
index 2aa06f80a0..f45ce91f6f 100644
--- a/configs/mvebu_mcbin-88f8040_defconfig
+++ b/configs/mvebu_mcbin-88f8040_defconfig
@@ -56,7 +56,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/mvebu_puzzle-m801-88f8040_defconfig b/configs/mvebu_puzzle-m801-88f8040_defconfig
index 053b2f4c96..af01e6176a 100644
--- a/configs/mvebu_puzzle-m801-88f8040_defconfig
+++ b/configs/mvebu_puzzle-m801-88f8040_defconfig
@@ -60,7 +60,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MVPP2=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_MVEBU=y
 CONFIG_PHY=y
diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig
index f31668c5c2..3b3da3870b 100644
--- a/configs/nanopc-t4-rk3399_defconfig
+++ b/configs/nanopc-t4-rk3399_defconfig
@@ -37,7 +37,7 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PMIC_RK8XX=y
 CONFIG_REGULATOR_PWM=y
diff --git a/configs/octeontx2_96xx_defconfig b/configs/octeontx2_96xx_defconfig
index 1298bfe309..1ce892d963 100644
--- a/configs/octeontx2_96xx_defconfig
+++ b/configs/octeontx2_96xx_defconfig
@@ -99,7 +99,7 @@ CONFIG_E1000_SPI=y
 CONFIG_CMD_E1000=y
 CONFIG_NET_OCTEONTX2=y
 CONFIG_OCTEONTX_SMI=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SRIOV=y
diff --git a/configs/octeontx_81xx_defconfig b/configs/octeontx_81xx_defconfig
index ba8cc97ab8..ddb9007bf1 100644
--- a/configs/octeontx_81xx_defconfig
+++ b/configs/octeontx_81xx_defconfig
@@ -99,7 +99,7 @@ CONFIG_E1000_SPI=y
 CONFIG_CMD_E1000=y
 CONFIG_NET_OCTEONTX=y
 CONFIG_OCTEONTX_SMI=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SRIOV=y
diff --git a/configs/octeontx_83xx_defconfig b/configs/octeontx_83xx_defconfig
index 26759341c5..b8ebc2812e 100644
--- a/configs/octeontx_83xx_defconfig
+++ b/configs/octeontx_83xx_defconfig
@@ -96,7 +96,7 @@ CONFIG_E1000_SPI=y
 CONFIG_CMD_E1000=y
 CONFIG_NET_OCTEONTX=y
 CONFIG_OCTEONTX_SMI=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SRIOV=y
diff --git a/configs/p3450-0000_defconfig b/configs/p3450-0000_defconfig
index e4265d6321..46f4cd0110 100644
--- a/configs/p3450-0000_defconfig
+++ b/configs/p3450-0000_defconfig
@@ -43,7 +43,7 @@ CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SF_DEFAULT_SPEED=24000000
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_RTL8169=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_TEGRA=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 81aedb28e3..d7378f5eb3 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -56,7 +56,7 @@ CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index 2dfb48b383..0d9071850a 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -56,7 +56,7 @@ CONFIG_TFTP_TSIZE=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_SPL_DM_RTC=y
 CONFIG_SPI=y
 CONFIG_USB_KEYBOARD=y
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 6be7ce0c6e..ea86d044a7 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -39,7 +39,7 @@ CONFIG_TFTP_TSIZE=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_SPI=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig
index 8f86f19e89..606a7fdee0 100644
--- a/configs/qemu_arm64_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -48,7 +48,7 @@ CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_SCSI=y
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
index 653c76ba61..febf8f2806 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm_defconfig
@@ -50,7 +50,7 @@ CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_ECAM_GENERIC=y
 CONFIG_SCSI=y
diff --git a/configs/rcar3_salvator-x_defconfig b/configs/rcar3_salvator-x_defconfig
index 499e56e498..59e5901e73 100644
--- a/configs/rcar3_salvator-x_defconfig
+++ b/configs/rcar3_salvator-x_defconfig
@@ -80,7 +80,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
 CONFIG_RENESAS_RAVB=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_RCAR_GEN3=y
diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig
index ca2fb9e13f..b79200fd3b 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -49,7 +49,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig
index 032b908669..73f2824f0a 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -41,7 +41,7 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig
index 6f5e8666b0..ce4d7761a2 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -41,7 +41,7 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig
index bd8b1201ef..c066d9160a 100644
--- a/configs/rock-pi-n10-rk3399pro_defconfig
+++ b/configs/rock-pi-n10-rk3399pro_defconfig
@@ -42,7 +42,7 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index e46f07e74d..d95da51891 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -42,7 +42,7 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
index 637c5c2466..d5e98a4f73 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -48,7 +48,7 @@ CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY_ROCKCHIP_TYPEC=y
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index bdf805ad19..bcc3e6a1c0 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -159,7 +159,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_SANDBOX=y
 CONFIG_PHY=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 70c6b2f805..b5c1e0fc44 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -201,7 +201,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_MULTIPLEXER=y
 CONFIG_MUX_MMIO=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SANDBOX=y
diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig
index 3f69fb7464..9f05b6344e 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -135,7 +135,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SANDBOX=y
diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig
index 6679c4335b..af9af81b5d 100644
--- a/configs/sandbox_noinst_defconfig
+++ b/configs/sandbox_noinst_defconfig
@@ -155,7 +155,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_SANDBOX=y
 CONFIG_PHY=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index fddf132dfe..0a8c7ce186 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -157,7 +157,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_SANDBOX=y
 CONFIG_PHY=y
diff --git a/configs/sifive_unmatched_defconfig b/configs/sifive_unmatched_defconfig
index 299580894c..86f8c7856e 100644
--- a/configs/sifive_unmatched_defconfig
+++ b/configs/sifive_unmatched_defconfig
@@ -44,7 +44,7 @@ CONFIG_SPL_CLK=y
 CONFIG_SYS_I2C_EEPROM_ADDR=0x54
 CONFIG_SPI_FLASH_ISSI=y
 CONFIG_E1000=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCIE_DW_SIFIVE=y
 CONFIG_DM_RESET=y
diff --git a/configs/synquacer_developerbox_defconfig b/configs/synquacer_developerbox_defconfig
index da57dc288f..fe12c74374 100644
--- a/configs/synquacer_developerbox_defconfig
+++ b/configs/synquacer_developerbox_defconfig
@@ -69,7 +69,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_SNI_NETSEC=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_PCF8563=y
 CONFIG_SCSI=y
diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig
index 415387b189..84a0b4c2b2 100644
--- a/configs/turris_mox_defconfig
+++ b/configs/turris_mox_defconfig
@@ -79,7 +79,7 @@ CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_AARDVARK=y
 CONFIG_PHY=y
diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig
index d6f70caeaf..938683616b 100644
--- a/configs/turris_omnia_defconfig
+++ b/configs/turris_omnia_defconfig
@@ -78,7 +78,7 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
-CONFIG_NVME=y
+CONFIG_NVME_PCI=y
 CONFIG_PCI=y
 CONFIG_PCI_MVEBU=y
 CONFIG_DM_RTC=y
diff --git a/doc/develop/driver-model/nvme.rst b/doc/develop/driver-model/nvme.rst
index 736c0a063d..fd0c0f00d2 100644
--- a/doc/develop/driver-model/nvme.rst
+++ b/doc/develop/driver-model/nvme.rst
@@ -40,6 +40,7 @@ It only support basic block read/write functions in the NVMe driver.
 Config options
 --------------
 CONFIG_NVME	Enable NVMe device support
+CONFIG_NVME_PCI	Enable PCIe NVMe device support
 CONFIG_CMD_NVME	Enable basic NVMe commands
 
 Usage in U-Boot
diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig
index 1f6d1f5648..78da444c8b 100644
--- a/drivers/nvme/Kconfig
+++ b/drivers/nvme/Kconfig
@@ -4,8 +4,16 @@
 
 config NVME
 	bool "NVM Express device support"
-	depends on BLK && PCI
+	depends on BLK
 	select HAVE_BLOCK_DEVICE
 	help
 	  This option enables support for NVM Express devices.
 	  It supports basic functions of NVMe (read/write).
+
+config NVME_PCI
+	bool "NVM Express PCI device support"
+	depends on PCI
+	select NVME
+	help
+	  This option enables support for NVM Express PCI
+	  devices.
diff --git a/drivers/nvme/Makefile b/drivers/nvme/Makefile
index 64f102b208..fad9724e17 100644
--- a/drivers/nvme/Makefile
+++ b/drivers/nvme/Makefile
@@ -3,3 +3,4 @@
 # Copyright (C) 2017, Bin Meng <bmeng.cn@gmail.com>
 
 obj-y += nvme-uclass.o nvme.o nvme_show.o
+obj-$(CONFIG_NVME_PCI) += nvme_pci.o
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index 3c529a2fce..be518ec20b 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -12,7 +12,6 @@
 #include <log.h>
 #include <malloc.h>
 #include <memalign.h>
-#include <pci.h>
 #include <time.h>
 #include <dm/device-internal.h>
 #include <linux/compat.h>
@@ -698,7 +697,6 @@ static int nvme_blk_probe(struct udevice *udev)
 	struct blk_desc *desc = dev_get_uclass_plat(udev);
 	struct nvme_ns *ns = dev_get_priv(udev);
 	u8 flbas;
-	struct pci_child_plat *pplat;
 	struct nvme_id_ns *id;
 
 	id = memalign(ndev->page_size, sizeof(struct nvme_id_ns));
@@ -723,8 +721,7 @@ static int nvme_blk_probe(struct udevice *udev)
 	desc->log2blksz = ns->lba_shift;
 	desc->blksz = 1 << ns->lba_shift;
 	desc->bdev = udev;
-	pplat = dev_get_parent_plat(udev->parent);
-	sprintf(desc->vendor, "0x%.4x", pplat->vendor);
+	memcpy(desc->vendor, ndev->vendor, sizeof(ndev->vendor));
 	memcpy(desc->product, ndev->serial, sizeof(ndev->serial));
 	memcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev));
 
@@ -818,27 +815,13 @@ U_BOOT_DRIVER(nvme_blk) = {
 	.priv_auto	= sizeof(struct nvme_ns),
 };
 
-static int nvme_bind(struct udevice *udev)
+int nvme_init(struct udevice *udev)
 {
-	static int ndev_num;
-	char name[20];
-
-	sprintf(name, "nvme#%d", ndev_num++);
-
-	return device_set_name(udev, name);
-}
-
-static int nvme_probe(struct udevice *udev)
-{
-	int ret;
 	struct nvme_dev *ndev = dev_get_priv(udev);
 	struct nvme_id_ns *id;
-
-	ndev->instance = trailing_strtol(udev->name);
+	int ret;
 
 	INIT_LIST_HEAD(&ndev->namespaces);
-	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0,
-			PCI_REGION_MEM);
 	if (readl(&ndev->bar->csts) == -1) {
 		ret = -ENODEV;
 		printf("Error: %s: Out of memory!\n", udev->name);
@@ -922,18 +905,3 @@ free_queue:
 free_nvme:
 	return ret;
 }
-
-U_BOOT_DRIVER(nvme) = {
-	.name	= "nvme",
-	.id	= UCLASS_NVME,
-	.bind	= nvme_bind,
-	.probe	= nvme_probe,
-	.priv_auto	= sizeof(struct nvme_dev),
-};
-
-struct pci_device_id nvme_supported[] = {
-	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, ~0) },
-	{}
-};
-
-U_BOOT_PCI_DEVICE(nvme, nvme_supported);
diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h
index c6aae4da5d..8e9ae3c7f6 100644
--- a/drivers/nvme/nvme.h
+++ b/drivers/nvme/nvme.h
@@ -608,6 +608,7 @@ struct nvme_dev {
 	u32 ctrl_config;
 	struct nvme_bar __iomem *bar;
 	struct list_head namespaces;
+	char vendor[8];
 	char serial[20];
 	char model[40];
 	char firmware_rev[8];
@@ -635,4 +636,6 @@ struct nvme_ns {
 	u8 flbas;
 };
 
+int nvme_init(struct udevice *udev);
+
 #endif /* __DRIVER_NVME_H__ */
diff --git a/drivers/nvme/nvme_pci.c b/drivers/nvme/nvme_pci.c
new file mode 100644
index 0000000000..5f60fb884f
--- /dev/null
+++ b/drivers/nvme/nvme_pci.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 NXP Semiconductors
+ * Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <pci.h>
+#include "nvme.h"
+
+static int nvme_bind(struct udevice *udev)
+{
+	static int ndev_num;
+	char name[20];
+
+	sprintf(name, "nvme#%d", ndev_num++);
+
+	return device_set_name(udev, name);
+}
+
+static int nvme_probe(struct udevice *udev)
+{
+	struct nvme_dev *ndev = dev_get_priv(udev);
+	struct pci_child_plat *pplat;
+
+	pplat = dev_get_parent_plat(udev);
+	sprintf(ndev->vendor, "0x%.4x", pplat->vendor);
+
+	ndev->instance = trailing_strtol(udev->name);
+	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0,
+			PCI_REGION_MEM);
+	return nvme_init(udev);
+}
+
+U_BOOT_DRIVER(nvme) = {
+	.name	= "nvme",
+	.id	= UCLASS_NVME,
+	.bind	= nvme_bind,
+	.probe	= nvme_probe,
+	.priv_auto	= sizeof(struct nvme_dev),
+};
+
+struct pci_device_id nvme_supported[] = {
+	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, ~0) },
+	{}
+};
+
+U_BOOT_PCI_DEVICE(nvme, nvme_supported);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
  2022-01-22 19:38 ` [PATCH v2 1/9] nvme: Split out PCI support Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:35   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple" Mark Kettenis
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

This mailbox driver provides a communication channel with the
Apple IOP controllers found on Apple SoCs.  These IOP controllers
are used to implement various functions such as the System
Manegement Controller (SMC) and NVMe storage.  It allows sending
and receiving a 96-bit message over a single channel.

The header file with the struct used for mailbox messages is taken
straight from Linux.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/Kconfig              |  1 +
 drivers/mailbox/Kconfig       | 11 +++++
 drivers/mailbox/Makefile      |  1 +
 drivers/mailbox/apple-mbox.c  | 92 +++++++++++++++++++++++++++++++++++
 include/linux/apple-mailbox.h | 19 ++++++++
 5 files changed, 124 insertions(+)
 create mode 100644 drivers/mailbox/apple-mbox.c
 create mode 100644 include/linux/apple-mailbox.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6b11c3a50d..ecacd6860b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -934,6 +934,7 @@ config ARCH_APPLE
 	select DM
 	select DM_GPIO
 	select DM_KEYBOARD
+	select DM_MAILBOX
 	select DM_SERIAL
 	select DM_USB
 	select DM_VIDEO
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index dd4b0ac0c3..73db2af0b8 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -10,6 +10,17 @@ config DM_MAILBOX
 	  the basis of a variety of inter-process/inter-CPU communication
 	  protocols.
 
+config APPLE_MBOX
+	bool "Enable Apple IOP controller support"
+	depends on DM_MAILBOX && ARCH_APPLE
+	default y
+	help
+	  Enable support for the mailboxes that provide a comminucation
+	  channel with Apple IOP controllers integrated on Apple SoCs.
+	  These IOP controllers are used to implement various functions
+	  such as the System Management Controller (SMC) and NVMe and this
+	  driver is required to get that functionality up and running.
+
 config SANDBOX_MBOX
 	bool "Enable the sandbox mailbox test driver"
 	depends on DM_MAILBOX && SANDBOX
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index d2ace8cd21..59e8d0de93 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox-uclass.o
+obj-$(CONFIG_APPLE_MBOX) += apple-mbox.o
 obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox.o
 obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox-test.o
 obj-$(CONFIG_STM32_IPCC) += stm32-ipcc.o
diff --git a/drivers/mailbox/apple-mbox.c b/drivers/mailbox/apple-mbox.c
new file mode 100644
index 0000000000..30c8e2f03f
--- /dev/null
+++ b/drivers/mailbox/apple-mbox.c
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 Mark Kettenis <kettenis@openbsd.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <mailbox-uclass.h>
+#include <asm/io.h>
+#include <linux/apple-mailbox.h>
+#include <linux/delay.h>
+
+#define REG_A2I_STAT	0x110
+#define  REG_A2I_STAT_EMPTY	BIT(17)
+#define  REG_A2I_STAT_FULL	BIT(16)
+#define REG_I2A_STAT	0x114
+#define  REG_I2A_STAT_EMPTY	BIT(17)
+#define  REG_I2A_STAT_FULL	BIT(16)
+#define REG_A2I_MSG0	0x800
+#define REG_A2I_MSG1	0x808
+#define REG_I2A_MSG0	0x830
+#define REG_I2A_MSG1	0x838
+
+struct apple_mbox_priv {
+	void *base;
+};
+
+static int apple_mbox_of_xlate(struct mbox_chan *chan,
+			       struct ofnode_phandle_args *args)
+{
+	if (args->args_count != 0)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int apple_mbox_send(struct mbox_chan *chan, const void *data)
+{
+	struct apple_mbox_priv *priv = dev_get_priv(chan->dev);
+	const struct apple_mbox_msg *msg = data;
+
+	writeq(msg->msg0, priv->base + REG_A2I_MSG0);
+	writeq(msg->msg1, priv->base + REG_A2I_MSG1);
+	while (readl(priv->base + REG_A2I_STAT) & REG_A2I_STAT_FULL)
+		udelay(1);
+
+	return 0;
+}
+
+static int apple_mbox_recv(struct mbox_chan *chan, void *data)
+{
+	struct apple_mbox_priv *priv = dev_get_priv(chan->dev);
+	struct apple_mbox_msg *msg = data;
+
+	if (readl(priv->base + REG_I2A_STAT) & REG_I2A_STAT_EMPTY)
+		return -ENODATA;
+
+	msg->msg0 = readq(priv->base + REG_I2A_MSG0);
+	msg->msg1 = readq(priv->base + REG_I2A_MSG1);
+	return 0;
+}
+
+struct mbox_ops apple_mbox_ops = {
+	.of_xlate = apple_mbox_of_xlate,
+	.send = apple_mbox_send,
+	.recv = apple_mbox_recv,
+};
+
+static int apple_mbox_probe(struct udevice *dev)
+{
+	struct apple_mbox_priv *priv = dev_get_priv(dev);
+
+	priv->base = dev_read_addr_ptr(dev);
+	if (!priv->base)
+		return -EINVAL;
+
+	return 0;
+}
+
+static const struct udevice_id apple_mbox_of_match[] = {
+	{ .compatible = "apple,asc-mailbox-v4" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(apple_mbox) = {
+	.name = "apple-mbox",
+	.id = UCLASS_MAILBOX,
+	.of_match = apple_mbox_of_match,
+	.probe = apple_mbox_probe,
+	.priv_auto = sizeof(struct apple_mbox_priv),
+	.ops = &apple_mbox_ops,
+};
diff --git a/include/linux/apple-mailbox.h b/include/linux/apple-mailbox.h
new file mode 100644
index 0000000000..720fbb7029
--- /dev/null
+++ b/include/linux/apple-mailbox.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
+/*
+ * Apple mailbox message format
+ *
+ * Copyright (C) 2021 The Asahi Linux Contributors
+ */
+
+#ifndef _LINUX_APPLE_MAILBOX_H_
+#define _LINUX_APPLE_MAILBOX_H_
+
+#include <linux/types.h>
+
+/* encodes a single 96bit message sent over the single channel */
+struct apple_mbox_msg {
+	u64 msg0;
+	u32 msg1;
+};
+
+#endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple"
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
  2022-01-22 19:38 ` [PATCH v2 1/9] nvme: Split out PCI support Mark Kettenis
  2022-01-22 19:38 ` [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-01-22 22:47   ` Simon Glass
  2022-02-11  0:35   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 4/9] arm: apple: Add RTKit support Mark Kettenis
                   ` (5 subsequent siblings)
  8 siblings, 2 replies; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

U-Boot is expected to support multiple generations of Apple SoCs
in a single binary with a single defconfig. Therefore it makes
more sense to set SYS_SOC to "apple".

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
---
 arch/arm/include/asm/{arch-m1 => arch-apple}/uart.h | 0
 arch/arm/mach-apple/Kconfig                         | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/arm/include/asm/{arch-m1 => arch-apple}/uart.h (100%)

diff --git a/arch/arm/include/asm/arch-m1/uart.h b/arch/arm/include/asm/arch-apple/uart.h
similarity index 100%
rename from arch/arm/include/asm/arch-m1/uart.h
rename to arch/arm/include/asm/arch-apple/uart.h
diff --git a/arch/arm/mach-apple/Kconfig b/arch/arm/mach-apple/Kconfig
index 80e8eb2307..75ee21e0f4 100644
--- a/arch/arm/mach-apple/Kconfig
+++ b/arch/arm/mach-apple/Kconfig
@@ -7,7 +7,7 @@ config SYS_CONFIG_NAME
 	default "apple"
 
 config SYS_SOC
-	default "m1"
+	default "apple"
 
 config SYS_MALLOC_LEN
 	default 0x4000000
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 4/9] arm: apple: Add RTKit support
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (2 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple" Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:35   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 5/9] nvme: Introduce driver ops Mark Kettenis
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

Most Apple IOPs run a firmware that is based on what Apple calls
RTKit. RTKit implements a common mailbox protocol.  This code
provides an implementation of the AP side of this protocol,
providing a function to initialize RTKit-based firmwares as well
as a function to do a clean shutdown of this firmware.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---

ChangeLog:

v2: - Change include paths to take advantage of SYS_SOC change


 arch/arm/include/asm/arch-apple/rtkit.h |  11 ++
 arch/arm/mach-apple/Makefile            |   1 +
 arch/arm/mach-apple/rtkit.c             | 231 ++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-apple/rtkit.h
 create mode 100644 arch/arm/mach-apple/rtkit.c

diff --git a/arch/arm/include/asm/arch-apple/rtkit.h b/arch/arm/include/asm/arch-apple/rtkit.h
new file mode 100644
index 0000000000..51f77f298c
--- /dev/null
+++ b/arch/arm/include/asm/arch-apple/rtkit.h
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2021 Mark Kettenis <kettenis@openbsd.org>
+ */
+
+#define APPLE_RTKIT_PWR_STATE_SLEEP	0x01
+#define APPLE_RTKIT_PWR_STATE_QUIESCED	0x10
+#define APPLE_RTKIT_PWR_STATE_ON	0x20
+
+int apple_rtkit_init(struct mbox_chan *);
+int apple_rtkit_shutdown(struct mbox_chan *, int);
diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile
index e74a8c9df1..52f30a777b 100644
--- a/arch/arm/mach-apple/Makefile
+++ b/arch/arm/mach-apple/Makefile
@@ -2,3 +2,4 @@
 
 obj-y += board.o
 obj-y += lowlevel_init.o
+obj-y += rtkit.o
diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c
new file mode 100644
index 0000000000..dff475cab7
--- /dev/null
+++ b/arch/arm/mach-apple/rtkit.c
@@ -0,0 +1,231 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2021 Mark Kettenis <kettenis@openbsd.org>
+ * (C) Copyright 2021 Copyright The Asahi Linux Contributors
+ */
+
+#include <common.h>
+#include <mailbox.h>
+#include <malloc.h>
+
+#include <asm/arch/rtkit.h>
+#include <linux/apple-mailbox.h>
+#include <linux/bitfield.h>
+
+#define APPLE_RTKIT_EP_MGMT 0
+#define APPLE_RTKIT_EP_CRASHLOG	1
+#define APPLE_RTKIT_EP_SYSLOG 2
+#define APPLE_RTKIT_EP_DEBUG 3
+#define APPLE_RTKIT_EP_IOREPORT 4
+
+/* Messages for management endpoint. */
+#define APPLE_RTKIT_MGMT_TYPE GENMASK(59, 52)
+
+#define APPLE_RTKIT_MGMT_PWR_STATE GENMASK(15, 0)
+
+#define APPLE_RTKIT_MGMT_HELLO 1
+#define APPLE_RTKIT_MGMT_HELLO_REPLY 2
+#define APPLE_RTKIT_MGMT_HELLO_MINVER GENMASK(15, 0)
+#define APPLE_RTKIT_MGMT_HELLO_MAXVER GENMASK(31, 16)
+
+#define APPLE_RTKIT_MGMT_STARTEP 5
+#define APPLE_RTKIT_MGMT_STARTEP_EP GENMASK(39, 32)
+#define APPLE_RTKIT_MGMT_STARTEP_FLAG BIT(1)
+
+#define APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE 6
+#define APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE_ACK 7
+
+#define APPLE_RTKIT_MGMT_EPMAP 8
+#define APPLE_RTKIT_MGMT_EPMAP_LAST BIT(51)
+#define APPLE_RTKIT_MGMT_EPMAP_BASE GENMASK(34, 32)
+#define APPLE_RTKIT_MGMT_EPMAP_BITMAP GENMASK(31, 0)
+
+#define APPLE_RTKIT_MGMT_EPMAP_REPLY 8
+#define APPLE_RTKIT_MGMT_EPMAP_REPLY_MORE BIT(0)
+
+#define APPLE_RTKIT_MIN_SUPPORTED_VERSION 11
+#define APPLE_RTKIT_MAX_SUPPORTED_VERSION 12
+
+/* Messages for internal endpoints. */
+#define APPLE_RTKIT_BUFFER_REQUEST 1
+#define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
+#define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0)
+
+int apple_rtkit_init(struct mbox_chan *chan)
+{
+	struct apple_mbox_msg msg;
+	int endpoints[256];
+	int nendpoints = 0;
+	int endpoint;
+	int min_ver, max_ver, want_ver;
+	int msgtype, pwrstate;
+	u64 reply;
+	u32 bitmap, base;
+	int i, ret;
+
+	/* Wakup the IOP. */
+	msg.msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE) |
+		FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_ON);
+	msg.msg1 = APPLE_RTKIT_EP_MGMT;
+	ret = mbox_send(chan, &msg);
+	if (ret < 0)
+		return ret;
+
+	/* Wait for protocol version negotiation message. */
+	ret = mbox_recv(chan, &msg, 10000);
+	if (ret < 0)
+		return ret;
+
+	endpoint = msg.msg1;
+	msgtype = FIELD_GET(APPLE_RTKIT_MGMT_TYPE, msg.msg0);
+	if (endpoint != APPLE_RTKIT_EP_MGMT) {
+		printf("%s: unexpected endpoint %d\n", __func__, endpoint);
+		return -EINVAL;
+	}
+	if (msgtype != APPLE_RTKIT_MGMT_HELLO) {
+		printf("%s: unexpected message type %d\n", __func__, msgtype);
+		return -EINVAL;
+	}
+
+	min_ver = FIELD_GET(APPLE_RTKIT_MGMT_HELLO_MINVER, msg.msg0);
+	max_ver = FIELD_GET(APPLE_RTKIT_MGMT_HELLO_MAXVER, msg.msg0);
+	want_ver = min(APPLE_RTKIT_MAX_SUPPORTED_VERSION, max_ver);
+
+	if (min_ver > APPLE_RTKIT_MAX_SUPPORTED_VERSION) {
+		printf("%s: firmware min version %d is too new\n",
+		       __func__, min_ver);
+		return -ENOTSUPP;
+	}
+
+	if (max_ver < APPLE_RTKIT_MIN_SUPPORTED_VERSION) {
+		printf("%s: firmware max version %d is too old\n",
+		       __func__, max_ver);
+		return -ENOTSUPP;
+	}
+
+	/* Ack version. */
+	msg.msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_HELLO_REPLY) |
+		FIELD_PREP(APPLE_RTKIT_MGMT_HELLO_MINVER, want_ver) |
+		FIELD_PREP(APPLE_RTKIT_MGMT_HELLO_MAXVER, want_ver);
+	msg.msg1 = APPLE_RTKIT_EP_MGMT;
+	ret = mbox_send(chan, &msg);
+	if (ret < 0)
+		return ret;
+
+wait_epmap:
+	/* Wait for endpoint map message. */
+	ret = mbox_recv(chan, &msg, 10000);
+	if (ret < 0)
+		return ret;
+
+	endpoint = msg.msg1;
+	msgtype = FIELD_GET(APPLE_RTKIT_MGMT_TYPE, msg.msg0);
+	if (endpoint != APPLE_RTKIT_EP_MGMT) {
+		printf("%s: unexpected endpoint %d\n", __func__, endpoint);
+		return -EINVAL;
+	}
+	if (msgtype != APPLE_RTKIT_MGMT_EPMAP) {
+		printf("%s: unexpected message type %d\n", __func__, msgtype);
+		return -EINVAL;
+	}
+
+	bitmap = FIELD_GET(APPLE_RTKIT_MGMT_EPMAP_BITMAP, msg.msg0);
+	base = FIELD_GET(APPLE_RTKIT_MGMT_EPMAP_BASE, msg.msg0);
+	for (i = 0; i < 32; i++) {
+		if (bitmap & (1U << i))
+			endpoints[nendpoints++] = base * 32 + i;
+	}
+
+	/* Ack endpoint map. */
+	reply = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_EPMAP_REPLY) |
+		FIELD_PREP(APPLE_RTKIT_MGMT_EPMAP_BASE, base);
+	if (msg.msg0 & APPLE_RTKIT_MGMT_EPMAP_LAST)
+		reply |= APPLE_RTKIT_MGMT_EPMAP_LAST;
+	else
+		reply |= APPLE_RTKIT_MGMT_EPMAP_REPLY_MORE;
+	msg.msg0 = reply;
+	msg.msg1 = APPLE_RTKIT_EP_MGMT;
+	ret = mbox_send(chan, &msg);
+	if (ret < 0)
+		return ret;
+
+	if (reply & APPLE_RTKIT_MGMT_EPMAP_REPLY_MORE)
+		goto wait_epmap;
+
+	for (i = 0; i < nendpoints; i++) {
+		/* Don't start the syslog endpoint since we can't
+		   easily handle its messages in U-Boot. */
+		if (endpoints[i] == APPLE_RTKIT_EP_SYSLOG)
+			continue;
+
+		/* Request endpoint. */
+		msg.msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_STARTEP) |
+			FIELD_PREP(APPLE_RTKIT_MGMT_STARTEP_EP, endpoints[i]) |
+			APPLE_RTKIT_MGMT_STARTEP_FLAG;
+		msg.msg1 = APPLE_RTKIT_EP_MGMT;
+		ret = mbox_send(chan, &msg);
+		if (ret < 0)
+			return ret;
+	}
+
+	pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP;
+	while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) {
+		ret = mbox_recv(chan, &msg, 100000);
+		if (ret < 0)
+			return ret;
+
+		endpoint = msg.msg1;
+		msgtype = FIELD_GET(APPLE_RTKIT_MGMT_TYPE, msg.msg0);
+
+		if (endpoint == APPLE_RTKIT_EP_CRASHLOG ||
+		    endpoint == APPLE_RTKIT_EP_SYSLOG ||
+		    endpoint == APPLE_RTKIT_EP_IOREPORT) {
+			u64 addr = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg.msg0);
+			u64 size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg.msg0);
+
+			if (msgtype == APPLE_RTKIT_BUFFER_REQUEST && addr != 0)
+				continue;
+
+			msg.msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_BUFFER_REQUEST) |
+				FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_SIZE, size) |
+				FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_IOVA, addr);
+			msg.msg1 = endpoint;
+			ret = mbox_send(chan, &msg);
+			if (ret < 0)
+				return ret;
+			continue;
+		}
+
+		if (endpoint != APPLE_RTKIT_EP_MGMT) {
+			printf("%s: unexpected endpoint %d\n", __func__, endpoint);
+			return -EINVAL;
+		}
+		if (msgtype != APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE_ACK) {
+			printf("%s: unexpected message type %d\n", __func__, msgtype);
+			return -EINVAL;
+		}
+
+		pwrstate = FIELD_GET(APPLE_RTKIT_MGMT_PWR_STATE, msg.msg0);
+	}
+
+	return 0;
+}
+
+int apple_rtkit_shutdown(struct mbox_chan *chan, int pwrstate)
+{
+	struct apple_mbox_msg msg;
+	int ret;
+
+	msg.msg0 = FIELD_PREP(APPLE_RTKIT_MGMT_TYPE, APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE) |
+		FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, pwrstate);
+	msg.msg1 = APPLE_RTKIT_EP_MGMT;
+	ret = mbox_send(chan, &msg);
+	if (ret < 0)
+		return ret;
+
+	ret = mbox_recv(chan, &msg, 100000);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 5/9] nvme: Introduce driver ops
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (3 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 4/9] arm: apple: Add RTKit support Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:36   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 6/9] nvme: Add shutdown function Mark Kettenis
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

The NVMe storage controller integrated on Apple SoCs deviates
from the NVMe standard in two aspects.  It uses a "linear"
submission queue and it integrates an NVMMU that needs to be
programmed for each NVMe command.  Introduce driver ops such
that we can set up the linear submission queue and program the
NVMMU in the driver for this strange beast.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---

ChangeLog:

v2: - Change alloc_queue op into setup_queue
    - Add comments


 drivers/nvme/nvme.c | 45 +++++++++++++++----------------------
 drivers/nvme/nvme.h | 55 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 27 deletions(-)

diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index be518ec20b..e7cbf39c96 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -27,33 +27,6 @@
 #define IO_TIMEOUT		30
 #define MAX_PRP_POOL		512
 
-enum nvme_queue_id {
-	NVME_ADMIN_Q,
-	NVME_IO_Q,
-	NVME_Q_NUM,
-};
-
-/*
- * An NVM Express queue. Each device has at least two (one for admin
- * commands and one for I/O commands).
- */
-struct nvme_queue {
-	struct nvme_dev *dev;
-	struct nvme_command *sq_cmds;
-	struct nvme_completion *cqes;
-	wait_queue_head_t sq_full;
-	u32 __iomem *q_db;
-	u16 q_depth;
-	s16 cq_vector;
-	u16 sq_head;
-	u16 sq_tail;
-	u16 cq_head;
-	u16 qid;
-	u8 cq_phase;
-	u8 cqe_seen;
-	unsigned long cmdid_data[];
-};
-
 static int nvme_wait_ready(struct nvme_dev *dev, bool enabled)
 {
 	u32 bit = enabled ? NVME_CSTS_RDY : 0;
@@ -167,12 +140,19 @@ static u16 nvme_read_completion_status(struct nvme_queue *nvmeq, u16 index)
  */
 static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd)
 {
+	struct nvme_ops *ops;
 	u16 tail = nvmeq->sq_tail;
 
 	memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
 	flush_dcache_range((ulong)&nvmeq->sq_cmds[tail],
 			   (ulong)&nvmeq->sq_cmds[tail] + sizeof(*cmd));
 
+	ops = (struct nvme_ops *)nvmeq->dev->udev->driver->ops;
+	if (ops && ops->submit_cmd) {
+		ops->submit_cmd(nvmeq, cmd);
+		return;
+	}
+
 	if (++tail == nvmeq->q_depth)
 		tail = 0;
 	writel(tail, nvmeq->q_db);
@@ -183,6 +163,7 @@ static int nvme_submit_sync_cmd(struct nvme_queue *nvmeq,
 				struct nvme_command *cmd,
 				u32 *result, unsigned timeout)
 {
+	struct nvme_ops *ops;
 	u16 head = nvmeq->cq_head;
 	u16 phase = nvmeq->cq_phase;
 	u16 status;
@@ -203,6 +184,10 @@ static int nvme_submit_sync_cmd(struct nvme_queue *nvmeq,
 			return -ETIMEDOUT;
 	}
 
+	ops = (struct nvme_ops *)nvmeq->dev->udev->driver->ops;
+	if (ops && ops->complete_cmd)
+		ops->complete_cmd(nvmeq, cmd);
+
 	status >>= 1;
 	if (status) {
 		printf("ERROR: status = %x, phase = %d, head = %d\n",
@@ -243,6 +228,7 @@ static int nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cmd,
 static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev,
 					   int qid, int depth)
 {
+	struct nvme_ops *ops;
 	struct nvme_queue *nvmeq = malloc(sizeof(*nvmeq));
 	if (!nvmeq)
 		return NULL;
@@ -268,6 +254,10 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev,
 	dev->queue_count++;
 	dev->queues[qid] = nvmeq;
 
+	ops = (struct nvme_ops *)dev->udev->driver->ops;
+	if (ops && ops->setup_queue)
+		ops->setup_queue(nvmeq);
+
 	return nvmeq;
 
  free_queue:
@@ -821,6 +811,7 @@ int nvme_init(struct udevice *udev)
 	struct nvme_id_ns *id;
 	int ret;
 
+	ndev->udev = udev;
 	INIT_LIST_HEAD(&ndev->namespaces);
 	if (readl(&ndev->bar->csts) == -1) {
 		ret = -ENODEV;
diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h
index 8e9ae3c7f6..bc6b79f8dd 100644
--- a/drivers/nvme/nvme.h
+++ b/drivers/nvme/nvme.h
@@ -596,6 +596,7 @@ enum {
 
 /* Represents an NVM Express device. Each nvme_dev is a PCI function. */
 struct nvme_dev {
+	struct udevice *udev;
 	struct list_head node;
 	struct nvme_queue **queues;
 	u32 __iomem *dbs;
@@ -622,6 +623,33 @@ struct nvme_dev {
 	u32 nn;
 };
 
+/* Admin queue and a single I/O queue. */
+enum nvme_queue_id {
+	NVME_ADMIN_Q,
+	NVME_IO_Q,
+	NVME_Q_NUM,
+};
+
+/*
+ * An NVM Express queue. Each device has at least two (one for admin
+ * commands and one for I/O commands).
+ */
+struct nvme_queue {
+	struct nvme_dev *dev;
+	struct nvme_command *sq_cmds;
+	struct nvme_completion *cqes;
+	u32 __iomem *q_db;
+	u16 q_depth;
+	s16 cq_vector;
+	u16 sq_head;
+	u16 sq_tail;
+	u16 cq_head;
+	u16 qid;
+	u8 cq_phase;
+	u8 cqe_seen;
+	unsigned long cmdid_data[];
+};
+
 /*
  * An NVM Express namespace is equivalent to a SCSI LUN.
  * Each namespace is operated as an independent "device".
@@ -636,6 +664,33 @@ struct nvme_ns {
 	u8 flbas;
 };
 
+struct nvme_ops {
+	/**
+	 * setup_queue - Controller-specific NVM Express queue setup.
+	 *
+	 * @nvmeq: NVM Express queue
+	 * Return: 0 if OK, -ve on error
+	 */
+	int (*setup_queue)(struct nvme_queue *nvmeq);
+	/**
+	 * submit_cmd - Controller-specific NVM Express command submission.
+	 *
+	 * If this function pointer is set to NULL, normal command
+	 * submission is performed according to the NVM Express spec.
+	 *
+	 * @nvmeq: NVM Express queue
+	 * @cmd:   NVM Express command
+	 */
+	void (*submit_cmd)(struct nvme_queue *nvmeq, struct nvme_command *cmd);
+	/**
+	 * complete_cmd - Controller-specific NVM Express command completion
+	 *
+	 * @nvmeq: NVM Express queue
+	 * @cmd:   NVM Express command
+	 */
+	void (*complete_cmd)(struct nvme_queue *nvmeq, struct nvme_command *cmd);
+};
+
 int nvme_init(struct udevice *udev);
 
 #endif /* __DRIVER_NVME_H__ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 6/9] nvme: Add shutdown function
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (4 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 5/9] nvme: Introduce driver ops Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:36   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 7/9] power: domain: apple: Add reset support Mark Kettenis
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

Add a function to disable the NVMe controller. This will be used
to let the driver for the NVMe storage integrated on Apple SoCs
shutdown the NVMe controller such we can shutdown the NVMe
IOP controller in a clean way afterwards before handing control
to the OS.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---

ChangeLog:

v2: - Add comments


 drivers/nvme/nvme.c |  7 +++++++
 drivers/nvme/nvme.h | 12 ++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index e7cbf39c96..1d56517e99 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -896,3 +896,10 @@ free_queue:
 free_nvme:
 	return ret;
 }
+
+int nvme_shutdown(struct udevice *udev)
+{
+	struct nvme_dev *ndev = dev_get_priv(udev);
+
+	return nvme_disable_ctrl(ndev);
+}
diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h
index bc6b79f8dd..bc1d612dde 100644
--- a/drivers/nvme/nvme.h
+++ b/drivers/nvme/nvme.h
@@ -691,6 +691,18 @@ struct nvme_ops {
 	void (*complete_cmd)(struct nvme_queue *nvmeq, struct nvme_command *cmd);
 };
 
+/**
+ * nvme_init() - Initialize NVM Express device
+ * @udev:	The NVM Express device
+ * Return: 0 if OK, -ve on error
+ */
 int nvme_init(struct udevice *udev);
 
+/**
+ * nvme_shutdown() - Shutdown NVM Express device
+ * @udev:	The NVM Express device
+ * Return: 0 if OK, -ve on error
+ */
+int nvme_shutdown(struct udevice *udev);
+
 #endif /* __DRIVER_NVME_H__ */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 7/9] power: domain: apple: Add reset support
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (5 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 6/9] nvme: Add shutdown function Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-01-26 23:54   ` Jaehoon Chung
  2022-02-11  0:36   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller Mark Kettenis
  2022-01-22 19:38 ` [PATCH v2 9/9] configs: apple: Add NVMe boot target Mark Kettenis
  8 siblings, 2 replies; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

The power management controller found on Apple SoCs als provides
a way to reset all devices within a power domain. This is needed
to cleanly shutdown the NVMe controller before we hand over
control to the OS.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/Kconfig                  |  1 +
 drivers/power/domain/apple-pmgr.c | 73 ++++++++++++++++++++++++++++++-
 2 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ecacd6860b..14c83ea19e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -935,6 +935,7 @@ config ARCH_APPLE
 	select DM_GPIO
 	select DM_KEYBOARD
 	select DM_MAILBOX
+	select DM_RESET
 	select DM_SERIAL
 	select DM_USB
 	select DM_VIDEO
diff --git a/drivers/power/domain/apple-pmgr.c b/drivers/power/domain/apple-pmgr.c
index d25f136b9d..4d06e76ff5 100644
--- a/drivers/power/domain/apple-pmgr.c
+++ b/drivers/power/domain/apple-pmgr.c
@@ -6,14 +6,22 @@
 #include <common.h>
 #include <asm/io.h>
 #include <dm.h>
+#include <dm/device-internal.h>
 #include <linux/err.h>
 #include <linux/bitfield.h>
 #include <power-domain-uclass.h>
+#include <reset-uclass.h>
 #include <regmap.h>
 #include <syscon.h>
 
-#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
+#define APPLE_PMGR_RESET	BIT(31)
+#define APPLE_PMGR_DEV_DISABLE	BIT(10)
+#define APPLE_PMGR_WAS_CLKGATED	BIT(9)
+#define APPLE_PMGR_WAS_PWRGATED BIT(8)
 #define APPLE_PMGR_PS_ACTUAL	GENMASK(7, 4)
+#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
+
+#define APPLE_PMGR_FLAGS	(APPLE_PMGR_WAS_CLKGATED | APPLE_PMGR_WAS_PWRGATED)
 
 #define APPLE_PMGR_PS_ACTIVE	0xf
 #define APPLE_PMGR_PS_PWRGATE	0x0
@@ -25,6 +33,65 @@ struct apple_pmgr_priv {
 	u32 offset;		/* offset within regmap for this domain */
 };
 
+static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
+				struct ofnode_phandle_args *args)
+{
+	if (args->args_count != 0)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int apple_reset_request(struct reset_ctl *reset_ctl)
+{
+	return 0;
+}
+
+static int apple_reset_free(struct reset_ctl *reset_ctl)
+{
+	return 0;
+}
+
+static int apple_reset_assert(struct reset_ctl *reset_ctl)
+{
+	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
+
+	regmap_update_bits(priv->regmap, priv->offset,
+			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE,
+			   APPLE_PMGR_DEV_DISABLE);
+	regmap_update_bits(priv->regmap, priv->offset,
+			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET,
+			   APPLE_PMGR_RESET);
+
+	return 0;
+}
+
+static int apple_reset_deassert(struct reset_ctl *reset_ctl)
+{
+	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
+
+	regmap_update_bits(priv->regmap, priv->offset,
+			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET, 0);
+	regmap_update_bits(priv->regmap, priv->offset,
+			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE, 0);
+
+	return 0;
+}
+
+struct reset_ops apple_reset_ops = {
+	.of_xlate = apple_reset_of_xlate,
+	.request = apple_reset_request,
+	.rfree = apple_reset_free,
+	.rst_assert = apple_reset_assert,
+	.rst_deassert = apple_reset_deassert,
+};
+
+static struct driver apple_reset_driver = {
+	.name = "apple_reset",
+	.id = UCLASS_RESET,
+	.ops = &apple_reset_ops,
+};
+
 static int apple_pmgr_request(struct power_domain *power_domain)
 {
 	return 0;
@@ -78,6 +145,7 @@ static const struct udevice_id apple_pmgr_ids[] = {
 static int apple_pmgr_probe(struct udevice *dev)
 {
 	struct apple_pmgr_priv *priv = dev_get_priv(dev);
+	struct udevice *child;
 	int ret;
 
 	ret = dev_power_domain_on(dev);
@@ -92,6 +160,9 @@ static int apple_pmgr_probe(struct udevice *dev)
 	if (ret < 0)
 		return ret;
 
+	device_bind(dev, &apple_reset_driver, "apple_reset", NULL,
+		    dev_ofnode(dev), &child);
+
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (6 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 7/9] power: domain: apple: Add reset support Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:36   ` Tom Rini
  2022-01-22 19:38 ` [PATCH v2 9/9] configs: apple: Add NVMe boot target Mark Kettenis
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

Add a driver for the NVMe storage controller integrated on
Apple SoCs.  This NVMe controller isn't PCI based and deviates
from the NVMe standard in its implementation of the command
submission queue and the integration of an NVMMU that needs
to be managed.  This commit tweaks the core NVMe code to
support the linear command submission queue implemented by
this controller.  But setting up the submission queue and
managing the NVMMU controller is handled by implementing
the driver ops that were added in an earlier commit.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Tested-on: firefly-rk3399
Tested-by: Mark Kettenis <kettenis@openbsd.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
---

ChangeLog:

v2: - Add comments
    - Change include paths to take advantage of SYS_SOC change


 configs/apple_m1_defconfig |   1 +
 drivers/nvme/Kconfig       |  11 ++
 drivers/nvme/Makefile      |   1 +
 drivers/nvme/nvme_apple.c  | 240 +++++++++++++++++++++++++++++++++++++
 4 files changed, 253 insertions(+)
 create mode 100644 drivers/nvme/nvme_apple.c

diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig
index cb235e4e7d..1528217b17 100644
--- a/configs/apple_m1_defconfig
+++ b/configs/apple_m1_defconfig
@@ -11,6 +11,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_NET is not set
 # CONFIG_MMC is not set
 CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_NVME_APPLE=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_KEYBOARD=y
diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig
index 78da444c8b..0cb465160b 100644
--- a/drivers/nvme/Kconfig
+++ b/drivers/nvme/Kconfig
@@ -10,6 +10,17 @@ config NVME
 	  This option enables support for NVM Express devices.
 	  It supports basic functions of NVMe (read/write).
 
+config NVME_APPLE
+	bool "Apple NVMe controller support"
+	select NVME
+	help
+	  This option enables support for the NVMe storage
+	  controller integrated on Apple SoCs.  This controller
+	  isn't PCI-based based and deviates from the NVMe
+	  standard implementation in its implementation of
+	  the command submission queue and the integration
+	  of an NVMMU that needs to be managed.
+
 config NVME_PCI
 	bool "NVM Express PCI device support"
 	depends on PCI
diff --git a/drivers/nvme/Makefile b/drivers/nvme/Makefile
index fad9724e17..fa7b619446 100644
--- a/drivers/nvme/Makefile
+++ b/drivers/nvme/Makefile
@@ -3,4 +3,5 @@
 # Copyright (C) 2017, Bin Meng <bmeng.cn@gmail.com>
 
 obj-y += nvme-uclass.o nvme.o nvme_show.o
+obj-$(CONFIG_NVME_APPLE) += nvme_apple.o
 obj-$(CONFIG_NVME_PCI) += nvme_pci.o
diff --git a/drivers/nvme/nvme_apple.c b/drivers/nvme/nvme_apple.c
new file mode 100644
index 0000000000..6249fceb71
--- /dev/null
+++ b/drivers/nvme/nvme_apple.c
@@ -0,0 +1,240 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2021 Mark Kettenis <kettenis@openbsd.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <mailbox.h>
+#include <mapmem.h>
+#include "nvme.h"
+#include <reset.h>
+
+#include <asm/io.h>
+#include <asm/arch/rtkit.h>
+#include <linux/iopoll.h>
+
+/* ASC registers */
+#define REG_CPU_CTRL		0x0044
+#define  REG_CPU_CTRL_RUN	BIT(4)
+
+/* Apple NVMe registers */
+#define ANS_MAX_PEND_CMDS_CTRL	0x01210
+#define  ANS_MAX_QUEUE_DEPTH	64
+#define ANS_BOOT_STATUS		0x01300
+#define  ANS_BOOT_STATUS_OK	0xde71ce55
+#define ANS_MODESEL		0x01304
+#define ANS_UNKNOWN_CTRL	0x24008
+#define  ANS_PRP_NULL_CHECK	(1 << 11)
+#define ANS_LINEAR_SQ_CTRL	0x24908
+#define  ANS_LINEAR_SQ_CTRL_EN	(1 << 0)
+#define ANS_ASQ_DB		0x2490c
+#define ANS_IOSQ_DB		0x24910
+#define ANS_NVMMU_NUM		0x28100
+#define ANS_NVMMU_BASE_ASQ	0x28108
+#define ANS_NVMMU_BASE_IOSQ	0x28110
+#define ANS_NVMMU_TCB_INVAL	0x28118
+#define ANS_NVMMU_TCB_STAT	0x28120
+
+#define ANS_NVMMU_TCB_SIZE	0x4000
+#define ANS_NVMMU_TCB_PITCH	0x80
+
+/* 
+ * The Apple NVMe controller includes an IOMMU known as NVMMU.  The
+ * NVMMU is programmed through an array of TCBs. These TCBs are paired
+ * with the corresponding slot in the submission queues and need to be
+ * configured with the command details before a command is allowed to
+ * execute. This is necessary even for commands that don't do DMA.
+ */
+struct ans_nvmmu_tcb {
+	u8 opcode;
+	u8 flags;
+	u8 slot;
+	u8 pad0;
+	u32 prpl_len;
+	u8 pad1[16];
+	u64 prp1;
+	u64 prp2;
+};
+
+#define ANS_NVMMU_TCB_WRITE	BIT(0)
+#define ANS_NVMMU_TCB_READ	BIT(1)
+
+struct apple_nvme_priv {
+	struct nvme_dev ndev;
+	void *base;		/* NVMe registers */
+	void *asc;		/* ASC registers */
+	struct reset_ctl_bulk resets; /* ASC reset */
+	struct mbox_chan chan;
+	struct ans_nvmmu_tcb *tcbs[NVME_Q_NUM]; /* Submission queue TCBs */
+	u32 __iomem *q_db[NVME_Q_NUM]; /* Submission queue doorbell */
+};
+
+static int apple_nvme_setup_queue(struct nvme_queue *nvmeq)
+{
+	struct apple_nvme_priv *priv =
+		container_of(nvmeq->dev, struct apple_nvme_priv, ndev);
+	struct nvme_dev *dev = nvmeq->dev;
+
+	switch (nvmeq->qid) {
+	case NVME_ADMIN_Q:
+	case NVME_IO_Q:
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	priv->tcbs[nvmeq->qid] = (void *)memalign(4096, ANS_NVMMU_TCB_SIZE);
+	memset((void *)priv->tcbs[nvmeq->qid], 0, ANS_NVMMU_TCB_SIZE);
+
+	switch (nvmeq->qid) {
+	case NVME_ADMIN_Q:
+		priv->q_db[nvmeq->qid] =
+			((void __iomem *)dev->bar) + ANS_ASQ_DB;
+		nvme_writeq((ulong)priv->tcbs[nvmeq->qid],
+			    ((void __iomem *)dev->bar) + ANS_NVMMU_BASE_ASQ);
+		break;
+	case NVME_IO_Q:
+		priv->q_db[nvmeq->qid] =
+			((void __iomem *)dev->bar) + ANS_IOSQ_DB;
+		nvme_writeq((ulong)priv->tcbs[nvmeq->qid],
+			    ((void __iomem *)dev->bar) + ANS_NVMMU_BASE_IOSQ);
+		break;
+	}
+
+	return 0;
+}
+
+static void apple_nvme_submit_cmd(struct nvme_queue *nvmeq,
+				  struct nvme_command *cmd)
+{
+	struct apple_nvme_priv *priv =
+		container_of(nvmeq->dev, struct apple_nvme_priv, ndev);
+	struct ans_nvmmu_tcb *tcb;
+	u16 tail = nvmeq->sq_tail;
+
+	tcb = ((void *)priv->tcbs[nvmeq->qid]) + tail * ANS_NVMMU_TCB_PITCH;
+	memset(tcb, 0, sizeof(*tcb));
+	tcb->opcode = cmd->common.opcode;
+	tcb->flags = ANS_NVMMU_TCB_WRITE | ANS_NVMMU_TCB_READ;
+	tcb->slot = tail;
+	tcb->prpl_len = cmd->rw.length;
+	tcb->prp1 = cmd->common.prp1;
+	tcb->prp2 = cmd->common.prp2;
+
+	writel(tail, priv->q_db[nvmeq->qid]);
+}
+
+static void apple_nvme_complete_cmd(struct nvme_queue *nvmeq,
+				    struct nvme_command *cmd)
+{
+	struct apple_nvme_priv *priv =
+		container_of(nvmeq->dev, struct apple_nvme_priv, ndev);
+	struct ans_nvmmu_tcb *tcb;
+	u16 tail = nvmeq->sq_tail;
+
+	tcb = ((void *)priv->tcbs[nvmeq->qid]) + tail * ANS_NVMMU_TCB_PITCH;
+	memset(tcb, 0, sizeof(*tcb));
+	writel(tail, ((void __iomem *)nvmeq->dev->bar) + ANS_NVMMU_TCB_INVAL);
+	readl(((void __iomem *)nvmeq->dev->bar) + ANS_NVMMU_TCB_STAT);
+
+	if (++tail == nvmeq->q_depth)
+		tail = 0;
+	nvmeq->sq_tail = tail;
+}
+
+static int apple_nvme_probe(struct udevice *dev)
+{
+	struct apple_nvme_priv *priv = dev_get_priv(dev);
+	fdt_addr_t addr;
+	u32 ctrl, stat;
+	int ret;
+
+	priv->base = dev_read_addr_ptr(dev);
+	if (!priv->base)
+		return -EINVAL;
+
+	addr = dev_read_addr_index(dev, 1);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+	priv->asc = map_sysmem(addr, 0);
+
+	ret = reset_get_bulk(dev, &priv->resets);
+	if (ret < 0)
+		return ret;
+
+	ret = mbox_get_by_index(dev, 0, &priv->chan);
+	if (ret < 0)
+		return ret;
+
+	ctrl = readl(priv->asc + REG_CPU_CTRL);
+	writel(ctrl | REG_CPU_CTRL_RUN, priv->asc + REG_CPU_CTRL);
+
+	ret = apple_rtkit_init(&priv->chan);
+	if (ret < 0)
+		return ret;
+
+	ret = readl_poll_sleep_timeout(priv->base + ANS_BOOT_STATUS, stat,
+				       (stat == ANS_BOOT_STATUS_OK), 100,
+				       500000);
+	if (ret < 0) {
+		printf("%s: NVMe firmware didn't boot\n", __func__);
+		return -ETIMEDOUT;
+	}
+
+	writel(ANS_LINEAR_SQ_CTRL_EN, priv->base + ANS_LINEAR_SQ_CTRL);
+	writel(((ANS_MAX_QUEUE_DEPTH << 16) | ANS_MAX_QUEUE_DEPTH),
+	       priv->base + ANS_MAX_PEND_CMDS_CTRL);
+
+	writel(readl(priv->base + ANS_UNKNOWN_CTRL) & ~ANS_PRP_NULL_CHECK,
+	       priv->base + ANS_UNKNOWN_CTRL);
+
+	strcpy(priv->ndev.vendor, "Apple");
+
+	writel((ANS_NVMMU_TCB_SIZE / ANS_NVMMU_TCB_PITCH) - 1,
+	       priv->base + ANS_NVMMU_NUM);
+	writel(0, priv->base + ANS_MODESEL);
+
+	priv->ndev.bar = priv->base;
+	return nvme_init(dev);
+}
+
+static int apple_nvme_remove(struct udevice *dev)
+{
+	struct apple_nvme_priv *priv = dev_get_priv(dev);
+	u32 ctrl;
+
+	nvme_shutdown(dev);
+
+	apple_rtkit_shutdown(&priv->chan, APPLE_RTKIT_PWR_STATE_SLEEP);
+
+	ctrl = readl(priv->asc + REG_CPU_CTRL);
+	writel(ctrl & ~REG_CPU_CTRL_RUN, priv->asc + REG_CPU_CTRL);
+
+	reset_assert_bulk(&priv->resets);
+	reset_deassert_bulk(&priv->resets);
+
+	return 0;
+}
+
+static const struct nvme_ops apple_nvme_ops = {
+	.setup_queue = apple_nvme_setup_queue,
+	.submit_cmd = apple_nvme_submit_cmd,
+	.complete_cmd = apple_nvme_complete_cmd,
+};
+
+static const struct udevice_id apple_nvme_ids[] = {
+	{ .compatible = "apple,nvme-ans2" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(apple_nvme) = {
+	.name = "apple_nvme",
+	.id = UCLASS_NVME,
+	.of_match = apple_nvme_ids,
+	.priv_auto = sizeof(struct apple_nvme_priv),
+	.probe = apple_nvme_probe,
+	.remove = apple_nvme_remove,
+	.ops = &apple_nvme_ops,
+	.flags = DM_FLAG_OS_PREPARE,
+};
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 9/9] configs: apple: Add NVMe boot target
  2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
                   ` (7 preceding siblings ...)
  2022-01-22 19:38 ` [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller Mark Kettenis
@ 2022-01-22 19:38 ` Mark Kettenis
  2022-02-11  0:36   ` Tom Rini
  8 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-22 19:38 UTC (permalink / raw)
  To: u-boot; +Cc: sjg, jh80.chung, trini, sven, marcan, bmeng.cn, Mark Kettenis

Add a boot target for NVMe such that we can boot from NVMe.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
---
 include/configs/apple.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/configs/apple.h b/include/configs/apple.h
index 3e5fb495f1..47faad8150 100644
--- a/include/configs/apple.h
+++ b/include/configs/apple.h
@@ -13,6 +13,12 @@
 	"fdt_addr_r=0x960100000\0" \
 	"kernel_addr_r=0x960200000\0"
 
+#if CONFIG_IS_ENABLED(CMD_NVME)
+	#define BOOT_TARGET_NVME(func) func(NVME, nvme, 0)
+#else
+	#define BOOT_TARGET_NVME(func)
+#endif
+
 #if CONFIG_IS_ENABLED(CMD_USB)
 	#define BOOT_TARGET_USB(func) func(USB, usb, 0)
 #else
@@ -20,6 +26,7 @@
 #endif
 
 #define BOOT_TARGET_DEVICES(func) \
+	BOOT_TARGET_NVME(func) \
 	BOOT_TARGET_USB(func)
 
 #include <config_distro_bootcmd.h>
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple"
  2022-01-22 19:38 ` [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple" Mark Kettenis
@ 2022-01-22 22:47   ` Simon Glass
  2022-02-11  0:35   ` Tom Rini
  1 sibling, 0 replies; 23+ messages in thread
From: Simon Glass @ 2022-01-22 22:47 UTC (permalink / raw)
  To: Mark Kettenis
  Cc: U-Boot Mailing List, Jaehoon Chung, Tom Rini, sven, marcan, Bin Meng

On Sat, 22 Jan 2022 at 12:38, Mark Kettenis <kettenis@openbsd.org> wrote:
>
> U-Boot is expected to support multiple generations of Apple SoCs
> in a single binary with a single defconfig. Therefore it makes
> more sense to set SYS_SOC to "apple".
>
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> ---
>  arch/arm/include/asm/{arch-m1 => arch-apple}/uart.h | 0
>  arch/arm/mach-apple/Kconfig                         | 2 +-
>  2 files changed, 1 insertion(+), 1 deletion(-)
>  rename arch/arm/include/asm/{arch-m1 => arch-apple}/uart.h (100%)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 7/9] power: domain: apple: Add reset support
  2022-01-22 19:38 ` [PATCH v2 7/9] power: domain: apple: Add reset support Mark Kettenis
@ 2022-01-26 23:54   ` Jaehoon Chung
  2022-01-27 11:48     ` Mark Kettenis
  2022-02-11  0:36   ` Tom Rini
  1 sibling, 1 reply; 23+ messages in thread
From: Jaehoon Chung @ 2022-01-26 23:54 UTC (permalink / raw)
  To: Mark Kettenis, u-boot; +Cc: sjg, trini, sven, marcan, bmeng.cn

Hi,

On 1/23/22 04:38, Mark Kettenis wrote:
> The power management controller found on Apple SoCs als provides
> a way to reset all devices within a power domain. This is needed
> to cleanly shutdown the NVMe controller before we hand over
> control to the OS.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Add minor comment.

> ---
>  arch/arm/Kconfig                  |  1 +
>  drivers/power/domain/apple-pmgr.c | 73 ++++++++++++++++++++++++++++++-
>  2 files changed, 73 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index ecacd6860b..14c83ea19e 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -935,6 +935,7 @@ config ARCH_APPLE
>  	select DM_GPIO
>  	select DM_KEYBOARD
>  	select DM_MAILBOX
> +	select DM_RESET
>  	select DM_SERIAL
>  	select DM_USB
>  	select DM_VIDEO
> diff --git a/drivers/power/domain/apple-pmgr.c b/drivers/power/domain/apple-pmgr.c
> index d25f136b9d..4d06e76ff5 100644
> --- a/drivers/power/domain/apple-pmgr.c
> +++ b/drivers/power/domain/apple-pmgr.c
> @@ -6,14 +6,22 @@
>  #include <common.h>
>  #include <asm/io.h>
>  #include <dm.h>
> +#include <dm/device-internal.h>
>  #include <linux/err.h>
>  #include <linux/bitfield.h>
>  #include <power-domain-uclass.h>
> +#include <reset-uclass.h>
>  #include <regmap.h>
>  #include <syscon.h>
>  
> -#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
> +#define APPLE_PMGR_RESET	BIT(31)
> +#define APPLE_PMGR_DEV_DISABLE	BIT(10)
> +#define APPLE_PMGR_WAS_CLKGATED	BIT(9)
> +#define APPLE_PMGR_WAS_PWRGATED BIT(8)

Bit description is specified "WAS_CLKGATED"?
I think it can be removed "WAS". CLKGATED has already similar meaning.

Best Regards,
Jaehoon Chung

>  #define APPLE_PMGR_PS_ACTUAL	GENMASK(7, 4)
> +#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
> +
> +#define APPLE_PMGR_FLAGS	(APPLE_PMGR_WAS_CLKGATED | APPLE_PMGR_WAS_PWRGATED)
>  
>  #define APPLE_PMGR_PS_ACTIVE	0xf
>  #define APPLE_PMGR_PS_PWRGATE	0x0
> @@ -25,6 +33,65 @@ struct apple_pmgr_priv {
>  	u32 offset;		/* offset within regmap for this domain */
>  };
>  
> +static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
> +				struct ofnode_phandle_args *args)
> +{
> +	if (args->args_count != 0)
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +
> +static int apple_reset_request(struct reset_ctl *reset_ctl)
> +{
> +	return 0;
> +}
> +
> +static int apple_reset_free(struct reset_ctl *reset_ctl)
> +{
> +	return 0;
> +}
> +
> +static int apple_reset_assert(struct reset_ctl *reset_ctl)
> +{
> +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
> +
> +	regmap_update_bits(priv->regmap, priv->offset,
> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE,
> +			   APPLE_PMGR_DEV_DISABLE);
> +	regmap_update_bits(priv->regmap, priv->offset,
> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET,
> +			   APPLE_PMGR_RESET);
> +
> +	return 0;
> +}
> +
> +static int apple_reset_deassert(struct reset_ctl *reset_ctl)
> +{
> +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
> +
> +	regmap_update_bits(priv->regmap, priv->offset,
> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET, 0);
> +	regmap_update_bits(priv->regmap, priv->offset,
> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE, 0);
> +
> +	return 0;
> +}
> +
> +struct reset_ops apple_reset_ops = {
> +	.of_xlate = apple_reset_of_xlate,
> +	.request = apple_reset_request,
> +	.rfree = apple_reset_free,
> +	.rst_assert = apple_reset_assert,
> +	.rst_deassert = apple_reset_deassert,
> +};
> +
> +static struct driver apple_reset_driver = {
> +	.name = "apple_reset",
> +	.id = UCLASS_RESET,
> +	.ops = &apple_reset_ops,
> +};
> +
>  static int apple_pmgr_request(struct power_domain *power_domain)
>  {
>  	return 0;
> @@ -78,6 +145,7 @@ static const struct udevice_id apple_pmgr_ids[] = {
>  static int apple_pmgr_probe(struct udevice *dev)
>  {
>  	struct apple_pmgr_priv *priv = dev_get_priv(dev);
> +	struct udevice *child;
>  	int ret;
>  
>  	ret = dev_power_domain_on(dev);
> @@ -92,6 +160,9 @@ static int apple_pmgr_probe(struct udevice *dev)
>  	if (ret < 0)
>  		return ret;
>  
> +	device_bind(dev, &apple_reset_driver, "apple_reset", NULL,
> +		    dev_ofnode(dev), &child);
> +
>  	return 0;
>  }
>  


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 7/9] power: domain: apple: Add reset support
  2022-01-26 23:54   ` Jaehoon Chung
@ 2022-01-27 11:48     ` Mark Kettenis
  2022-01-27 22:29       ` Jaehoon Chung
  0 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2022-01-27 11:48 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: kettenis, u-boot, sjg, trini, sven, marcan, bmeng.cn

> Date: Thu, 27 Jan 2022 08:54:29 +0900
> From: Jaehoon Chung <jh80.chung@samsung.com>
> 
> Hi,
> 
> On 1/23/22 04:38, Mark Kettenis wrote:
> > The power management controller found on Apple SoCs als provides
> > a way to reset all devices within a power domain. This is needed
> > to cleanly shutdown the NVMe controller before we hand over
> > control to the OS.
> > 
> > Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Tested on: Macbook Air M1
> > Tested-by: Simon Glass <sjg@chromium.org>
> 
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
> 
> Add minor comment.

Hi Jaehoon,

> > ---
> >  arch/arm/Kconfig                  |  1 +
> >  drivers/power/domain/apple-pmgr.c | 73 ++++++++++++++++++++++++++++++-
> >  2 files changed, 73 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index ecacd6860b..14c83ea19e 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -935,6 +935,7 @@ config ARCH_APPLE
> >  	select DM_GPIO
> >  	select DM_KEYBOARD
> >  	select DM_MAILBOX
> > +	select DM_RESET
> >  	select DM_SERIAL
> >  	select DM_USB
> >  	select DM_VIDEO
> > diff --git a/drivers/power/domain/apple-pmgr.c b/drivers/power/domain/apple-pmgr.c
> > index d25f136b9d..4d06e76ff5 100644
> > --- a/drivers/power/domain/apple-pmgr.c
> > +++ b/drivers/power/domain/apple-pmgr.c
> > @@ -6,14 +6,22 @@
> >  #include <common.h>
> >  #include <asm/io.h>
> >  #include <dm.h>
> > +#include <dm/device-internal.h>
> >  #include <linux/err.h>
> >  #include <linux/bitfield.h>
> >  #include <power-domain-uclass.h>
> > +#include <reset-uclass.h>
> >  #include <regmap.h>
> >  #include <syscon.h>
> >  
> > -#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
> > +#define APPLE_PMGR_RESET	BIT(31)
> > +#define APPLE_PMGR_DEV_DISABLE	BIT(10)
> > +#define APPLE_PMGR_WAS_CLKGATED	BIT(9)
> > +#define APPLE_PMGR_WAS_PWRGATED BIT(8)
> 
> Bit description is specified "WAS_CLKGATED"?
> I think it can be removed "WAS". CLKGATED has already similar meaning.

The names are taken from the Linux driver and I would prefer to keep
them the same to make it easier to compare the two drivers since
nobody outside of Apple has access to documentation for this block.

> >  #define APPLE_PMGR_PS_ACTUAL	GENMASK(7, 4)
> > +#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
> > +
> > +#define APPLE_PMGR_FLAGS	(APPLE_PMGR_WAS_CLKGATED | APPLE_PMGR_WAS_PWRGATED)
> >  
> >  #define APPLE_PMGR_PS_ACTIVE	0xf
> >  #define APPLE_PMGR_PS_PWRGATE	0x0
> > @@ -25,6 +33,65 @@ struct apple_pmgr_priv {
> >  	u32 offset;		/* offset within regmap for this domain */
> >  };
> >  
> > +static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
> > +				struct ofnode_phandle_args *args)
> > +{
> > +	if (args->args_count != 0)
> > +		return -EINVAL;
> > +
> > +	return 0;
> > +}
> > +
> > +static int apple_reset_request(struct reset_ctl *reset_ctl)
> > +{
> > +	return 0;
> > +}
> > +
> > +static int apple_reset_free(struct reset_ctl *reset_ctl)
> > +{
> > +	return 0;
> > +}
> > +
> > +static int apple_reset_assert(struct reset_ctl *reset_ctl)
> > +{
> > +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
> > +
> > +	regmap_update_bits(priv->regmap, priv->offset,
> > +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE,
> > +			   APPLE_PMGR_DEV_DISABLE);
> > +	regmap_update_bits(priv->regmap, priv->offset,
> > +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET,
> > +			   APPLE_PMGR_RESET);
> > +
> > +	return 0;
> > +}
> > +
> > +static int apple_reset_deassert(struct reset_ctl *reset_ctl)
> > +{
> > +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
> > +
> > +	regmap_update_bits(priv->regmap, priv->offset,
> > +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET, 0);
> > +	regmap_update_bits(priv->regmap, priv->offset,
> > +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE, 0);
> > +
> > +	return 0;
> > +}
> > +
> > +struct reset_ops apple_reset_ops = {
> > +	.of_xlate = apple_reset_of_xlate,
> > +	.request = apple_reset_request,
> > +	.rfree = apple_reset_free,
> > +	.rst_assert = apple_reset_assert,
> > +	.rst_deassert = apple_reset_deassert,
> > +};
> > +
> > +static struct driver apple_reset_driver = {
> > +	.name = "apple_reset",
> > +	.id = UCLASS_RESET,
> > +	.ops = &apple_reset_ops,
> > +};
> > +
> >  static int apple_pmgr_request(struct power_domain *power_domain)
> >  {
> >  	return 0;
> > @@ -78,6 +145,7 @@ static const struct udevice_id apple_pmgr_ids[] = {
> >  static int apple_pmgr_probe(struct udevice *dev)
> >  {
> >  	struct apple_pmgr_priv *priv = dev_get_priv(dev);
> > +	struct udevice *child;
> >  	int ret;
> >  
> >  	ret = dev_power_domain_on(dev);
> > @@ -92,6 +160,9 @@ static int apple_pmgr_probe(struct udevice *dev)
> >  	if (ret < 0)
> >  		return ret;
> >  
> > +	device_bind(dev, &apple_reset_driver, "apple_reset", NULL,
> > +		    dev_ofnode(dev), &child);
> > +
> >  	return 0;
> >  }
> >  
> 
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 7/9] power: domain: apple: Add reset support
  2022-01-27 11:48     ` Mark Kettenis
@ 2022-01-27 22:29       ` Jaehoon Chung
  0 siblings, 0 replies; 23+ messages in thread
From: Jaehoon Chung @ 2022-01-27 22:29 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: kettenis, u-boot, sjg, trini, sven, marcan, bmeng.cn

On 1/27/22 20:48, Mark Kettenis wrote:
>> Date: Thu, 27 Jan 2022 08:54:29 +0900
>> From: Jaehoon Chung <jh80.chung@samsung.com>
>>
>> Hi,
>>
>> On 1/23/22 04:38, Mark Kettenis wrote:
>>> The power management controller found on Apple SoCs als provides
>>> a way to reset all devices within a power domain. This is needed
>>> to cleanly shutdown the NVMe controller before we hand over
>>> control to the OS.
>>>
>>> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>> Tested on: Macbook Air M1
>>> Tested-by: Simon Glass <sjg@chromium.org>
>>
>> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>>
>> Add minor comment.
> 
> Hi Jaehoon,
> 
>>> ---
>>>  arch/arm/Kconfig                  |  1 +
>>>  drivers/power/domain/apple-pmgr.c | 73 ++++++++++++++++++++++++++++++-
>>>  2 files changed, 73 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>> index ecacd6860b..14c83ea19e 100644
>>> --- a/arch/arm/Kconfig
>>> +++ b/arch/arm/Kconfig
>>> @@ -935,6 +935,7 @@ config ARCH_APPLE
>>>  	select DM_GPIO
>>>  	select DM_KEYBOARD
>>>  	select DM_MAILBOX
>>> +	select DM_RESET
>>>  	select DM_SERIAL
>>>  	select DM_USB
>>>  	select DM_VIDEO
>>> diff --git a/drivers/power/domain/apple-pmgr.c b/drivers/power/domain/apple-pmgr.c
>>> index d25f136b9d..4d06e76ff5 100644
>>> --- a/drivers/power/domain/apple-pmgr.c
>>> +++ b/drivers/power/domain/apple-pmgr.c
>>> @@ -6,14 +6,22 @@
>>>  #include <common.h>
>>>  #include <asm/io.h>
>>>  #include <dm.h>
>>> +#include <dm/device-internal.h>
>>>  #include <linux/err.h>
>>>  #include <linux/bitfield.h>
>>>  #include <power-domain-uclass.h>
>>> +#include <reset-uclass.h>
>>>  #include <regmap.h>
>>>  #include <syscon.h>
>>>  
>>> -#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
>>> +#define APPLE_PMGR_RESET	BIT(31)
>>> +#define APPLE_PMGR_DEV_DISABLE	BIT(10)
>>> +#define APPLE_PMGR_WAS_CLKGATED	BIT(9)
>>> +#define APPLE_PMGR_WAS_PWRGATED BIT(8)
>>
>> Bit description is specified "WAS_CLKGATED"?
>> I think it can be removed "WAS". CLKGATED has already similar meaning.
> 
> The names are taken from the Linux driver and I would prefer to keep
> them the same to make it easier to compare the two drivers since
> nobody outside of Apple has access to documentation for this block.

Thanks for explanation. 

Best Regards,
Jaehoon Chung

> 
>>>  #define APPLE_PMGR_PS_ACTUAL	GENMASK(7, 4)
>>> +#define APPLE_PMGR_PS_TARGET	GENMASK(3, 0)
>>> +
>>> +#define APPLE_PMGR_FLAGS	(APPLE_PMGR_WAS_CLKGATED | APPLE_PMGR_WAS_PWRGATED)
>>>  
>>>  #define APPLE_PMGR_PS_ACTIVE	0xf
>>>  #define APPLE_PMGR_PS_PWRGATE	0x0
>>> @@ -25,6 +33,65 @@ struct apple_pmgr_priv {
>>>  	u32 offset;		/* offset within regmap for this domain */
>>>  };
>>>  
>>> +static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
>>> +				struct ofnode_phandle_args *args)
>>> +{
>>> +	if (args->args_count != 0)
>>> +		return -EINVAL;
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static int apple_reset_request(struct reset_ctl *reset_ctl)
>>> +{
>>> +	return 0;
>>> +}
>>> +
>>> +static int apple_reset_free(struct reset_ctl *reset_ctl)
>>> +{
>>> +	return 0;
>>> +}
>>> +
>>> +static int apple_reset_assert(struct reset_ctl *reset_ctl)
>>> +{
>>> +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
>>> +
>>> +	regmap_update_bits(priv->regmap, priv->offset,
>>> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE,
>>> +			   APPLE_PMGR_DEV_DISABLE);
>>> +	regmap_update_bits(priv->regmap, priv->offset,
>>> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET,
>>> +			   APPLE_PMGR_RESET);
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static int apple_reset_deassert(struct reset_ctl *reset_ctl)
>>> +{
>>> +	struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
>>> +
>>> +	regmap_update_bits(priv->regmap, priv->offset,
>>> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_RESET, 0);
>>> +	regmap_update_bits(priv->regmap, priv->offset,
>>> +			   APPLE_PMGR_FLAGS | APPLE_PMGR_DEV_DISABLE, 0);
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +struct reset_ops apple_reset_ops = {
>>> +	.of_xlate = apple_reset_of_xlate,
>>> +	.request = apple_reset_request,
>>> +	.rfree = apple_reset_free,
>>> +	.rst_assert = apple_reset_assert,
>>> +	.rst_deassert = apple_reset_deassert,
>>> +};
>>> +
>>> +static struct driver apple_reset_driver = {
>>> +	.name = "apple_reset",
>>> +	.id = UCLASS_RESET,
>>> +	.ops = &apple_reset_ops,
>>> +};
>>> +
>>>  static int apple_pmgr_request(struct power_domain *power_domain)
>>>  {
>>>  	return 0;
>>> @@ -78,6 +145,7 @@ static const struct udevice_id apple_pmgr_ids[] = {
>>>  static int apple_pmgr_probe(struct udevice *dev)
>>>  {
>>>  	struct apple_pmgr_priv *priv = dev_get_priv(dev);
>>> +	struct udevice *child;
>>>  	int ret;
>>>  
>>>  	ret = dev_power_domain_on(dev);
>>> @@ -92,6 +160,9 @@ static int apple_pmgr_probe(struct udevice *dev)
>>>  	if (ret < 0)
>>>  		return ret;
>>>  
>>> +	device_bind(dev, &apple_reset_driver, "apple_reset", NULL,
>>> +		    dev_ofnode(dev), &child);
>>> +
>>>  	return 0;
>>>  }
>>>  
>>
>>
> 


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 1/9] nvme: Split out PCI support
  2022-01-22 19:38 ` [PATCH v2 1/9] nvme: Split out PCI support Mark Kettenis
@ 2022-02-11  0:35   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

On Sat, Jan 22, 2022 at 08:38:11PM +0100, Mark Kettenis wrote:

> Apple SoCs have an integrated NVMe controller that isn't connected
> over a PCIe bus. In preparation for adding support for this NVMe
> controller, split out the PCI support into its own file. This file
> is selected through a new CONFIG_NVME_PCI Kconfig option, so do
> a wholesale replacement of CONFIG_NVME with CONFIG_NVME_PCI.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox
  2022-01-22 19:38 ` [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox Mark Kettenis
@ 2022-02-11  0:35   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

On Sat, Jan 22, 2022 at 08:38:12PM +0100, Mark Kettenis wrote:

> This mailbox driver provides a communication channel with the
> Apple IOP controllers found on Apple SoCs.  These IOP controllers
> are used to implement various functions such as the System
> Manegement Controller (SMC) and NVMe storage.  It allows sending
> and receiving a 96-bit message over a single channel.
> 
> The header file with the struct used for mailbox messages is taken
> straight from Linux.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Signed-off-by: Sven Peter <sven@svenpeter.dev>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple"
  2022-01-22 19:38 ` [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple" Mark Kettenis
  2022-01-22 22:47   ` Simon Glass
@ 2022-02-11  0:35   ` Tom Rini
  1 sibling, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

On Sat, Jan 22, 2022 at 08:38:13PM +0100, Mark Kettenis wrote:

> U-Boot is expected to support multiple generations of Apple SoCs
> in a single binary with a single defconfig. Therefore it makes
> more sense to set SYS_SOC to "apple".
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 4/9] arm: apple: Add RTKit support
  2022-01-22 19:38 ` [PATCH v2 4/9] arm: apple: Add RTKit support Mark Kettenis
@ 2022-02-11  0:35   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On Sat, Jan 22, 2022 at 08:38:14PM +0100, Mark Kettenis wrote:

> Most Apple IOPs run a firmware that is based on what Apple calls
> RTKit. RTKit implements a common mailbox protocol.  This code
> provides an implementation of the AP side of this protocol,
> providing a function to initialize RTKit-based firmwares as well
> as a function to do a clean shutdown of this firmware.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 5/9] nvme: Introduce driver ops
  2022-01-22 19:38 ` [PATCH v2 5/9] nvme: Introduce driver ops Mark Kettenis
@ 2022-02-11  0:36   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

On Sat, Jan 22, 2022 at 08:38:15PM +0100, Mark Kettenis wrote:

> The NVMe storage controller integrated on Apple SoCs deviates
> from the NVMe standard in two aspects.  It uses a "linear"
> submission queue and it integrates an NVMMU that needs to be
> programmed for each NVMe command.  Introduce driver ops such
> that we can set up the linear submission queue and program the
> NVMMU in the driver for this strange beast.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 6/9] nvme: Add shutdown function
  2022-01-22 19:38 ` [PATCH v2 6/9] nvme: Add shutdown function Mark Kettenis
@ 2022-02-11  0:36   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

On Sat, Jan 22, 2022 at 08:38:16PM +0100, Mark Kettenis wrote:

> Add a function to disable the NVMe controller. This will be used
> to let the driver for the NVMe storage integrated on Apple SoCs
> shutdown the NVMe controller such we can shutdown the NVMe
> IOP controller in a clean way afterwards before handing control
> to the OS.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 7/9] power: domain: apple: Add reset support
  2022-01-22 19:38 ` [PATCH v2 7/9] power: domain: apple: Add reset support Mark Kettenis
  2022-01-26 23:54   ` Jaehoon Chung
@ 2022-02-11  0:36   ` Tom Rini
  1 sibling, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

On Sat, Jan 22, 2022 at 08:38:17PM +0100, Mark Kettenis wrote:

> The power management controller found on Apple SoCs als provides
> a way to reset all devices within a power domain. This is needed
> to cleanly shutdown the NVMe controller before we hand over
> control to the OS.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller
  2022-01-22 19:38 ` [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller Mark Kettenis
@ 2022-02-11  0:36   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

On Sat, Jan 22, 2022 at 08:38:18PM +0100, Mark Kettenis wrote:

> Add a driver for the NVMe storage controller integrated on
> Apple SoCs.  This NVMe controller isn't PCI based and deviates
> from the NVMe standard in its implementation of the command
> submission queue and the integration of an NVMMU that needs
> to be managed.  This commit tweaks the core NVMe code to
> support the linear command submission queue implemented by
> this controller.  But setting up the submission queue and
> managing the NVMMU controller is handled by implementing
> the driver ops that were added in an earlier commit.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> Tested-on: firefly-rk3399
> Tested-by: Mark Kettenis <kettenis@openbsd.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 9/9] configs: apple: Add NVMe boot target
  2022-01-22 19:38 ` [PATCH v2 9/9] configs: apple: Add NVMe boot target Mark Kettenis
@ 2022-02-11  0:36   ` Tom Rini
  0 siblings, 0 replies; 23+ messages in thread
From: Tom Rini @ 2022-02-11  0:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: u-boot, sjg, jh80.chung, sven, marcan, bmeng.cn

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

On Sat, Jan 22, 2022 at 08:38:19PM +0100, Mark Kettenis wrote:

> Add a boot target for NVMe such that we can boot from NVMe.
> 
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-02-11  0:37 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 19:38 [PATCH v2 0/9] Apple M1 NVMe storage support Mark Kettenis
2022-01-22 19:38 ` [PATCH v2 1/9] nvme: Split out PCI support Mark Kettenis
2022-02-11  0:35   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 2/9] mailbox: apple: Add driver for Apple IOP mailbox Mark Kettenis
2022-02-11  0:35   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 3/9] arm: apple: Change SoC name from "m1" into "apple" Mark Kettenis
2022-01-22 22:47   ` Simon Glass
2022-02-11  0:35   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 4/9] arm: apple: Add RTKit support Mark Kettenis
2022-02-11  0:35   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 5/9] nvme: Introduce driver ops Mark Kettenis
2022-02-11  0:36   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 6/9] nvme: Add shutdown function Mark Kettenis
2022-02-11  0:36   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 7/9] power: domain: apple: Add reset support Mark Kettenis
2022-01-26 23:54   ` Jaehoon Chung
2022-01-27 11:48     ` Mark Kettenis
2022-01-27 22:29       ` Jaehoon Chung
2022-02-11  0:36   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 8/9] nvme: apple: Add driver for Apple NVMe storage controller Mark Kettenis
2022-02-11  0:36   ` Tom Rini
2022-01-22 19:38 ` [PATCH v2 9/9] configs: apple: Add NVMe boot target Mark Kettenis
2022-02-11  0:36   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.