ssb: fix DMA translation for some specific boards
RFC PATCH v2 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
@@ -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.1
RFC 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.
---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.
--- 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
@@ -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
@@ -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.1
Michael Büsch
maintainerRFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
Quoted 8 lines · On Wed, 10 Aug 2011 20:35:39 +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.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.
---
Looks good. I didn't test it, though.
Signature · 1 line
Greetings, Michael.
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
In reply to Rafał MiłeckiW dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:
Quoted 7 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Signed-off-by Rafa? Mi?ecki <[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.
14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Signature · 1 line
Rafa?
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
Quoted 5 lines · Rafa? Mi?ecki
W dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:
Quoted 3 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Tested with 14e4:4311 (64-bit) and 14e4:4318 (32-bit). The ssb changes were also tested with b43legacy.
Larry
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
W dniu 11 sierpnia 2011 06:39 u?ytkownik Larry Finger <[email protected]> napisa?:
Quoted 13 lines · Rafa? Mi?ecki
Quoted 12 lines
W dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> ?napisa?:
Quoted 8 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.
Quoted 6 lines
Quoted 3 lines
14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Tested with 14e4:4311 (64-bit) and 14e4:4318 (32-bit). The ssb changes were also tested with b43legacy.
Thanks Larry.
I've additionally tested this on 14e4:4312 (BCM4311), 32-bit DMA. Works OK.
John: please take this patchset.
Signature · 1 line
Rafa?
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
Quoted 19 lines · Rafa? Mi?ecki
W dniu 11 sierpnia 2011 06:39 u?ytkownik Larry Finger <[email protected]> napisa?:
Quoted 17 lines · Rafa? Mi?ecki
Quoted 15 lines
W dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> ?napisa?:
Quoted 8 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Quoted 8 lines
Quoted 2 lines
Tested with 14e4:4311 (64-bit) and 14e4:4318 (32-bit). The ssb changes were also tested with b43legacy.
Thanks Larry.
I've additionally tested this on 14e4:4312 (BCM4311), 32-bit DMA. Works OK.
John: please take this patchset.
Are these fixes intended for 3.1?
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
W dniu 11 sierpnia 2011 18:04 u?ytkownik John W. Linville <[email protected]> napisa?:
Quoted 23 lines · Rafa? Mi?ecki
Quoted 22 lines
W dniu 11 sierpnia 2011 06:39 u?ytkownik Larry Finger <[email protected]> napisa?:
Quoted 19 lines · Rafa? Mi?ecki
Quoted 7 lines
W dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> ?napisa?:
Quoted 4 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Tested with 14e4:4311 (64-bit) and 14e4:4318 (32-bit). The ssb changes were also tested with b43legacy.
Quoted 7 lines
Quoted 5 lines
Thanks Larry.
I've additionally tested this on 14e4:4312 (BCM4311), 32-bit DMA. Works OK.
John: please take this patchset.
Are these fixes intended for 3.1?
The bug in DMA support is in the driver since the first moment we enabled support for N-PHY. It's not any kind of regression. However, it's still a bug fix.
If it's OK to take that for 3.1, then go on. I believe it received required testing. On the other hand, if it's going to make Dave or Linus angry, leave it for 3.2. We have this bug since 2.6.39, we can have it for one more release.
Signature · 1 line
Rafa?
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
W dniu 11 sierpnia 2011 18:21 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:
Quoted 33 lines
W dniu 11 sierpnia 2011 18:04 u?ytkownik John W. Linville <[email protected]> napisa?:
Quoted 23 lines · Rafa? Mi?ecki
Quoted 22 lines
W dniu 11 sierpnia 2011 06:39 u?ytkownik Larry Finger <[email protected]> napisa?:
Quoted 19 lines · Rafa? Mi?ecki
Quoted 7 lines
W dniu 10 sierpnia 2011 20:35 u?ytkownik Rafa? Mi?ecki <[email protected]> ?napisa?:
Quoted 4 lines
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.14e4:4353 (BCM43224), 64-bit DMA, still works :)
The rest will follow tomorrow.
Tested with 14e4:4311 (64-bit) and 14e4:4318 (32-bit). The ssb changes were also tested with b43legacy.
Quoted 7 lines
Quoted 5 lines
Thanks Larry.
I've additionally tested this on 14e4:4312 (BCM4311), 32-bit DMA. Works OK.
John: please take this patchset.
Are these fixes intended for 3.1?
Quoted 8 lines
The bug in DMA support is in the driver since the first moment we enabled support for N-PHY. It's not any kind of regression. However, it's still a bug fix.
If it's OK to take that for 3.1, then go on. I believe it received required testing. On the other hand, if it's going to make Dave or Linus angry, leave it for 3.2. We have this bug since ?2.6.39, we can have it for one more release.
s/Dave/David/, sorry
Signature · 1 line
Rafa?
RFC PATCH v2 2/2 b43: fix DMA on some bugged hardware
In reply to Rafał MiłeckiQuoted 51 lines · Rafa? Mi?ecki
Some hardware with 64-bit DMA uses lower address word for setting routing (translation) bit. Add workaround for such boards.
Signed-off-by Rafa? Mi?ecki<[email protected]>---
This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.--- 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@@ -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 +18
-0@@ -47,6 +47,38 @@* into separate slots. */ #define TX_SLOTS_PER_FRAME 2 +static u32 b43_dma_address (struct b43_dma *dma,dma_addr_t dmaaddr, +enum b43_addrtype addrtype) +{ +u32 uninitialized_var (addr ); + +switch (addrtype) { +case B43_DMA_ADDR_LOW : + addr = dmaaddr&0xFFFFFFFF ; +if (dma->translation_in_low) { + addr&= ~SSB_DMA_TRANSLATION_MASK ; + addr |= dma->translation; + } +break ; +case B43_DMA_ADDR_HIGH : + addr = dmaaddr>>32 ; +if (!dma->translation_in_low) { + addr&= ~SSB_DMA_TRANSLATION_MASK ; + addr |= dma->translation;
drivers/net/wireless/b43/dma.c line 77
Quoted 10 lines
drivers/net/wireless/b43/dma.c +10
-0+ } +break ; +case B43_DMA_ADDR_EXT : +if (dma->translation_in_low) + addr = dmaaddr&0xFFFFFFFF ; +else + addr = dmaaddr>>32 ; + addr&=SSB_DMA_TRANSLATION_MASK ; + addr>>=SSB_DMA_TRANSLATION_SHIFT ; +break ;
Sorry I missed this earlier, but when this code is compiled on a 32-bit system, the compiler spits out
CC [M] drivers/net/wireless/b43/dma.odrivers/net/wireless/b43/dma.c: In function ?b43_dma_address?:drivers/net/wireless/b43/dma.c:64: warning: right shift count >= width of type drivers/net/wireless/b43/dma.c:74: warning: right shift count >= width of type
This is reasonable as dma_addr_t is 32 bits.
Larry