Skip to contentSkip to conversation

ssb: fix DMA translation for some specific boards

PATCH RESEND New Rafał Miłecki 2 participants 4 messages Aug 14, 2011

Subsystems (2)

v1 of 2 New Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 ssb: fix DMA translation for some specific boards

---
 drivers/ssb/main.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
drivers/ssb/main.c +21 -3
index 29c7d4f..d0cbdb0 100644
@@ -1260,16 +1260,34 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags)
 }
 EXPORT_SYMBOL(ssb_device_disable);
 
+/* Some chipsets need routing known for PCIe and 64-bit DMA */
+static bool ssb_dma_translation_special_bit(struct ssb_device *dev)
+{
+	u16 chip_id = dev->bus->chip_id;
+
+	if (dev->id.coreid == SSB_DEV_80211) {
+		return (chip_id == 0x4322 || chip_id == 43221 ||
+			chip_id == 43231 || chip_id == 43222);
+	}
+
+	return 0;
+}
+
 u32 ssb_dma_translation(struct ssb_device *dev)
 {
 	switch (dev->bus->bustype) {
 	case SSB_BUSTYPE_SSB:
 		return 0;
 	case SSB_BUSTYPE_PCI:
-		if (ssb_read32(dev, SSB_TMSHIGH) & SSB_TMSHIGH_DMA64)
+		if (pci_is_pcie(dev->bus->host_pci) &&
+		    ssb_read32(dev, SSB_TMSHIGH) & SSB_TMSHIGH_DMA64) {
 			return SSB_PCIE_DMA_H32;
-		else
-			return SSB_PCI_DMA;
+		} else {
+			if (ssb_dma_translation_special_bit(dev))
+				return SSB_PCIE_DMA_H32;
+			else
+				return SSB_PCI_DMA;
+		}
 	default:
 		__ssb_dma_not_implemented(dev);
 	}
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH v2 2/2 b43: fix DMA on some bugged hardware

Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.

---
V2: use (u64) to fix compilation on 32-bit systems

Larry: could you give it a try?

John: we gave it a change, I failed. Please take it for 3.2, don't want to risk more problems.

---
 drivers/net/wireless/b43/b43.h |    1 +
 drivers/net/wireless/b43/dma.c |  113 +++++++++++++++++++++++++++-------------
 drivers/net/wireless/b43/dma.h |    6 ++
 3 files changed, 84 insertions(+), 36 deletions(-)
drivers/net/wireless/b43/b43.h +1 -0
index c818b0b..3aee322 100644
@@ -594,6 +594,7 @@ struct b43_dma {
 	struct b43_dmaring *rx_ring;
 
 	u32 translation; /* Routing bits */
+	bool translation_in_low; /* Should translation bit go into low addr? */
 	bool parity; /* Check for parity */
 };
 
drivers/net/wireless/b43/dma.c +77 -36

194 lines not on this page · raw message

drivers/net/wireless/b43/dma.h +6 -0
index cdf8709..1a5313d 100644
@@ -212,6 +212,12 @@ enum b43_dmatype {
 	B43_DMA_64BIT	= 64,
 };
 
+enum b43_addrtype {
+	B43_DMA_ADDR_LOW,
+	B43_DMA_ADDR_HIGH,
+	B43_DMA_ADDR_EXT,
+};
+
 struct b43_dmaring {
 	/* Lowlevel DMA ops. */
 	const struct b43_dma_ops *ops;
Signature · 1 line
1.7.3.4
maintainer
#2 lore raw

PATCH v2 2/2 b43: fix DMA on some bugged hardware

Quoted 6 lines · On Sun, 14 Aug 2011 19:39:41 +0200 Rafa? Mi?ecki <[email protected]> wrote:

Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.

---
V2: use (u64) to fix compilation on 32-bit systems

Note that there are the upper_32_bits() and lower_32_bits() macros in kernel.h to address this problem.

Signature · 1 line
Greetings, Michael.
#3 lore raw

PATCH v2 2/2 b43: fix DMA on some bugged hardware

W dniu 14 sierpnia 2011 19:10 u?ytkownik Michael B?sch <[email protected]> napisa?:

Quoted 6 lines
Quoted 3 lines · On Sun, 14 Aug 2011 19:39:41 +0200 Rafa? Mi?ecki <[email protected]> wrote:

Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.

Quoted 6 lines
Quoted 3 lines

---
V2: use (u64) to fix compilation on 32-bit systems

Note that there are the upper_32_bits() and lower_32_bits() macros in kernel.h to address this problem.

I should have guess there is already sth for that.

Worth noting compiler trick in upper_32_bits.
((n) >> 16) >> 16
I didn't think of that :)

Signature · 1 line
Rafa?