[PATCH v4 14/16] nvme: Enable PCI bus mastering

Simon Glass sjg at chromium.org
Fri May 5 00:55:07 CEST 2023


U-Boot sets up devices ready for use, but coreboot does not. Enable this
so that NVMe works OK from coreboot.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v4:
- Split out patch to enable bus mastering

 drivers/nvme/nvme_pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/nvme/nvme_pci.c b/drivers/nvme/nvme_pci.c
index 36bf9c5ffb7..5bb43d299fc 100644
--- a/drivers/nvme/nvme_pci.c
+++ b/drivers/nvme/nvme_pci.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <pci.h>
 #include "nvme.h"
 
@@ -30,6 +31,10 @@ static int nvme_probe(struct udevice *udev)
 	ndev->instance = trailing_strtol(udev->name);
 	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, 0, 0,
 				   PCI_REGION_TYPE, PCI_REGION_MEM);
+
+	/* Turn on bus-mastering */
+	dm_pci_clrset_config16(udev, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
+
 	return nvme_init(udev);
 }
 
-- 
2.40.1.521.gf1e218fcd8-goog



More information about the U-Boot mailing list