diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-04-11 05:59:00 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-15 15:04:35 -0400 |
commit | 4ac58469f13028e1eb97f8bc7b0fca5072591d8d (patch) | |
tree | c955e1b753e1f86c570d2d6f5f6095d1182d5c35 /drivers/net/wireless | |
parent | 2d4543fdb487b1301ae48703dea3e66ead2d3c75 (diff) |
ssb: Fix usage of struct device used for DMAing
This fixes DMA on architectures where DMA is nontrivial, like PPC64.
We must use the host-device's (PCI) struct device for any DMA
operation instead of the SSB device. For this we add a new
struct device pointer to the SSB device structure that will always
point to the right device for DMAing.
Without this patch b43 and b44 drivers won't work on complex-DMA
architectures, that for example need dev->archdata for DMA operations.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/b43/dma.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 948eb1fe916b..48e912487b16 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -373,10 +373,10 @@ static inline | |||
373 | dma_addr_t dmaaddr; | 373 | dma_addr_t dmaaddr; |
374 | 374 | ||
375 | if (tx) { | 375 | if (tx) { |
376 | dmaaddr = dma_map_single(ring->dev->dev->dev, | 376 | dmaaddr = dma_map_single(ring->dev->dev->dma_dev, |
377 | buf, len, DMA_TO_DEVICE); | 377 | buf, len, DMA_TO_DEVICE); |
378 | } else { | 378 | } else { |
379 | dmaaddr = dma_map_single(ring->dev->dev->dev, | 379 | dmaaddr = dma_map_single(ring->dev->dev->dma_dev, |
380 | buf, len, DMA_FROM_DEVICE); | 380 | buf, len, DMA_FROM_DEVICE); |
381 | } | 381 | } |
382 | 382 | ||
@@ -388,9 +388,10 @@ static inline | |||
388 | dma_addr_t addr, size_t len, int tx) | 388 | dma_addr_t addr, size_t len, int tx) |
389 | { | 389 | { |
390 | if (tx) { | 390 | if (tx) { |
391 | dma_unmap_single(ring->dev->dev->dev, addr, len, DMA_TO_DEVICE); | 391 | dma_unmap_single(ring->dev->dev->dma_dev, |
392 | addr, len, DMA_TO_DEVICE); | ||
392 | } else { | 393 | } else { |
393 | dma_unmap_single(ring->dev->dev->dev, | 394 | dma_unmap_single(ring->dev->dev->dma_dev, |
394 | addr, len, DMA_FROM_DEVICE); | 395 | addr, len, DMA_FROM_DEVICE); |
395 | } | 396 | } |
396 | } | 397 | } |
@@ -400,7 +401,7 @@ static inline | |||
400 | dma_addr_t addr, size_t len) | 401 | dma_addr_t addr, size_t len) |
401 | { | 402 | { |
402 | B43_WARN_ON(ring->tx); | 403 | B43_WARN_ON(ring->tx); |
403 | dma_sync_single_for_cpu(ring->dev->dev->dev, | 404 | dma_sync_single_for_cpu(ring->dev->dev->dma_dev, |
404 | addr, len, DMA_FROM_DEVICE); | 405 | addr, len, DMA_FROM_DEVICE); |
405 | } | 406 | } |
406 | 407 | ||
@@ -409,7 +410,7 @@ static inline | |||
409 | dma_addr_t addr, size_t len) | 410 | dma_addr_t addr, size_t len) |
410 | { | 411 | { |
411 | B43_WARN_ON(ring->tx); | 412 | B43_WARN_ON(ring->tx); |
412 | dma_sync_single_for_device(ring->dev->dev->dev, | 413 | dma_sync_single_for_device(ring->dev->dev->dma_dev, |
413 | addr, len, DMA_FROM_DEVICE); | 414 | addr, len, DMA_FROM_DEVICE); |
414 | } | 415 | } |
415 | 416 | ||
@@ -425,7 +426,7 @@ static inline | |||
425 | 426 | ||
426 | static int alloc_ringmemory(struct b43_dmaring *ring) | 427 | static int alloc_ringmemory(struct b43_dmaring *ring) |
427 | { | 428 | { |
428 | struct device *dev = ring->dev->dev->dev; | 429 | struct device *dma_dev = ring->dev->dev->dma_dev; |
429 | gfp_t flags = GFP_KERNEL; | 430 | gfp_t flags = GFP_KERNEL; |
430 | 431 | ||
431 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K | 432 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
@@ -439,7 +440,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring) | |||
439 | */ | 440 | */ |
440 | if (ring->type == B43_DMA_64BIT) | 441 | if (ring->type == B43_DMA_64BIT) |
441 | flags |= GFP_DMA; | 442 | flags |= GFP_DMA; |
442 | ring->descbase = dma_alloc_coherent(dev, B43_DMA_RINGMEMSIZE, | 443 | ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE, |
443 | &(ring->dmabase), flags); | 444 | &(ring->dmabase), flags); |
444 | if (!ring->descbase) { | 445 | if (!ring->descbase) { |
445 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | 446 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); |
@@ -452,9 +453,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring) | |||
452 | 453 | ||
453 | static void free_ringmemory(struct b43_dmaring *ring) | 454 | static void free_ringmemory(struct b43_dmaring *ring) |
454 | { | 455 | { |
455 | struct device *dev = ring->dev->dev->dev; | 456 | struct device *dma_dev = ring->dev->dev->dma_dev; |
456 | 457 | ||
457 | dma_free_coherent(dev, B43_DMA_RINGMEMSIZE, | 458 | dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE, |
458 | ring->descbase, ring->dmabase); | 459 | ring->descbase, ring->dmabase); |
459 | } | 460 | } |
460 | 461 | ||
@@ -854,7 +855,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
854 | goto err_kfree_meta; | 855 | goto err_kfree_meta; |
855 | 856 | ||
856 | /* test for ability to dma to txhdr_cache */ | 857 | /* test for ability to dma to txhdr_cache */ |
857 | dma_test = dma_map_single(dev->dev->dev, | 858 | dma_test = dma_map_single(dev->dev->dma_dev, |
858 | ring->txhdr_cache, | 859 | ring->txhdr_cache, |
859 | b43_txhdr_size(dev), | 860 | b43_txhdr_size(dev), |
860 | DMA_TO_DEVICE); | 861 | DMA_TO_DEVICE); |
@@ -869,7 +870,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
869 | if (!ring->txhdr_cache) | 870 | if (!ring->txhdr_cache) |
870 | goto err_kfree_meta; | 871 | goto err_kfree_meta; |
871 | 872 | ||
872 | dma_test = dma_map_single(dev->dev->dev, | 873 | dma_test = dma_map_single(dev->dev->dma_dev, |
873 | ring->txhdr_cache, | 874 | ring->txhdr_cache, |
874 | b43_txhdr_size(dev), | 875 | b43_txhdr_size(dev), |
875 | DMA_TO_DEVICE); | 876 | DMA_TO_DEVICE); |
@@ -883,7 +884,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
883 | } | 884 | } |
884 | } | 885 | } |
885 | 886 | ||
886 | dma_unmap_single(dev->dev->dev, | 887 | dma_unmap_single(dev->dev->dma_dev, |
887 | dma_test, b43_txhdr_size(dev), | 888 | dma_test, b43_txhdr_size(dev), |
888 | DMA_TO_DEVICE); | 889 | DMA_TO_DEVICE); |
889 | } | 890 | } |