Skip to contentSkip to conversation

ata: pci: enable bus mastering

PATCH Superseded Christian Gmeiner 2 participants 3 messages Apr 11, 2023 libata

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ata: pci: enable bus mastering

The non DM code path already would enable pci bus mastering. Do the same for the DM code path.

Fixes AHCI problems I am seeing on an Intel Apollolake device.

v2: Add Bin's R-b and remove the ending '.' from comment.

---
 drivers/ata/ahci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +6 -1
index 6998b82aa5..360ac2c060 100644
@@ -1152,7 +1152,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
 	ulong base;
-	u16 vendor, device;
+	u16 vendor, device, cmd;
+
+	/* Enable bus mastering */
+	dm_pci_read_config16(dev, PCI_COMMAND, &cmd);
+	cmd |= PCI_COMMAND_MASTER;
+	dm_pci_write_config16(dev, PCI_COMMAND, cmd);
 
 	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0,
 				     PCI_REGION_TYPE, PCI_REGION_MEM);
Signature · 1 line
2.40.0
#1 lore raw
Quoted 7 lines · Christian Gmeiner

The non DM code path already would enable pci bus mastering. Do the same for the DM code path.

Fixes AHCI problems I am seeing on an Intel Apollolake device.

v2: Add Bin's R-b and remove the ending '.' from comment.

The changelog should go below --- otherwise it shows up in the commit message :)

Quoted 15 lines
---
 drivers/ata/ahci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +0 -0
index 6998b82aa5..360ac2c060 100644
@@ -1152,7 +1152,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
        ulong base;

drivers/ata/ahci.c int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) · line 1163

Quoted 10 lines
drivers/ata/ahci.c +6 -1
-       u16 vendor, device;
+       u16 vendor, device, cmd;
+
+       /* Enable bus mastering */
+       dm_pci_read_config16(dev, PCI_COMMAND, &cmd);
+       cmd |= PCI_COMMAND_MASTER;
+       dm_pci_write_config16(dev, PCI_COMMAND, cmd);
 
        base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0,
                                     PCI_REGION_TYPE, PCI_REGION_MEM);

Regards,
Bin

#2 lore raw

Am Di., 11. Apr. 2023 um 16:29 Uhr schrieb Bin Meng <[email protected]>:

Quoted 4 lines
Quoted 1 line · Christian Gmeiner
Quoted 9 lines
Quoted 6 lines

The non DM code path already would enable pci bus mastering. Do the same for the DM code path.

Fixes AHCI problems I am seeing on an Intel Apollolake device.

v2: Add Bin's R-b and remove the ending '.' from comment.

The changelog should go below --- otherwise it shows up in the commit message :)

Yeah .. I had that feeling to put it there but .. I will give it another try :)

Quoted 28 lines
Quoted 15 lines
---
 drivers/ata/ahci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +0 -0
index 6998b82aa5..360ac2c060 100644
@@ -1152,7 +1152,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
        ulong base;

drivers/ata/ahci.c int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) · line 1163

Quoted 10 lines
drivers/ata/ahci.c +6 -1
-       u16 vendor, device;
+       u16 vendor, device, cmd;
+
+       /* Enable bus mastering */
+       dm_pci_read_config16(dev, PCI_COMMAND, &cmd);
+       cmd |= PCI_COMMAND_MASTER;
+       dm_pci_write_config16(dev, PCI_COMMAND, cmd);
 
        base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0,
                                     PCI_REGION_TYPE, PCI_REGION_MEM);

Regards,
Bin

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy