aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-11-11 01:25:09 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:38:50 -0500
commitd03f387eb321189bc2ba278b6ca82f1a45cf19d6 (patch)
treeb194bd9921c0091e87d71162ec686eb1bb08ab85
parent4c9d2800be5dfabf26acdeb401cbabe9edc1dcf2 (diff)
[POWERPC] Cell fixup DMA offset for new southbridge
This patch makes the Cell DMA code work on both the Spider and the Axon south bridges by turning cell_dma_valid into a variable instead of a constant. This is a temporary patch until we have full iommu support. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/cell/iommu.c14
-rw-r--r--arch/powerpc/platforms/cell/iommu.h8
2 files changed, 16 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 0e6ab8a55ef7..e3ea5311476e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -46,6 +46,8 @@
46 46
47#include "iommu.h" 47#include "iommu.h"
48 48
49static dma_addr_t cell_dma_valid = SPIDER_DMA_VALID;
50
49static inline unsigned long 51static inline unsigned long
50get_iopt_entry(unsigned long real_address, unsigned long ioid, 52get_iopt_entry(unsigned long real_address, unsigned long ioid,
51 unsigned long prot) 53 unsigned long prot)
@@ -423,7 +425,7 @@ static void *cell_alloc_coherent(struct device *hwdev, size_t size,
423 ret = (void *)__get_free_pages(flag, get_order(size)); 425 ret = (void *)__get_free_pages(flag, get_order(size));
424 if (ret != NULL) { 426 if (ret != NULL) {
425 memset(ret, 0, size); 427 memset(ret, 0, size);
426 *dma_handle = virt_to_abs(ret) | CELL_DMA_VALID; 428 *dma_handle = virt_to_abs(ret) | cell_dma_valid;
427 } 429 }
428 return ret; 430 return ret;
429} 431}
@@ -437,7 +439,7 @@ static void cell_free_coherent(struct device *hwdev, size_t size,
437static dma_addr_t cell_map_single(struct device *hwdev, void *ptr, 439static dma_addr_t cell_map_single(struct device *hwdev, void *ptr,
438 size_t size, enum dma_data_direction direction) 440 size_t size, enum dma_data_direction direction)
439{ 441{
440 return virt_to_abs(ptr) | CELL_DMA_VALID; 442 return virt_to_abs(ptr) | cell_dma_valid;
441} 443}
442 444
443static void cell_unmap_single(struct device *hwdev, dma_addr_t dma_addr, 445static void cell_unmap_single(struct device *hwdev, dma_addr_t dma_addr,
@@ -452,7 +454,7 @@ static int cell_map_sg(struct device *hwdev, struct scatterlist *sg,
452 454
453 for (i = 0; i < nents; i++, sg++) { 455 for (i = 0; i < nents; i++, sg++) {
454 sg->dma_address = (page_to_phys(sg->page) + sg->offset) 456 sg->dma_address = (page_to_phys(sg->page) + sg->offset)
455 | CELL_DMA_VALID; 457 | cell_dma_valid;
456 sg->dma_length = sg->length; 458 sg->dma_length = sg->length;
457 } 459 }
458 460
@@ -483,6 +485,12 @@ void cell_init_iommu(void)
483{ 485{
484 int setup_bus = 0; 486 int setup_bus = 0;
485 487
488 /* If we have an Axon bridge, clear the DMA valid mask. This is fairly
489 * hackish but will work well enough until we have proper iommu code.
490 */
491 if (of_find_node_by_name(NULL, "axon"))
492 cell_dma_valid = 0;
493
486 if (of_find_node_by_path("/mambo")) { 494 if (of_find_node_by_path("/mambo")) {
487 pr_info("Not using iommu on systemsim\n"); 495 pr_info("Not using iommu on systemsim\n");
488 } else { 496 } else {
diff --git a/arch/powerpc/platforms/cell/iommu.h b/arch/powerpc/platforms/cell/iommu.h
index 490d77abfe85..2a9ab95604a9 100644
--- a/arch/powerpc/platforms/cell/iommu.h
+++ b/arch/powerpc/platforms/cell/iommu.h
@@ -53,9 +53,11 @@ enum {
53 IOC_ST_ORIGIN = 0x918, 53 IOC_ST_ORIGIN = 0x918,
54 IOC_CONF = 0x930, 54 IOC_CONF = 0x930,
55 55
56 /* The high bit needs to be set on every DMA address, 56 /* The high bit needs to be set on every DMA address when using
57 only 2GB are addressable */ 57 * a spider bridge and only 2GB are addressable with the current
58 CELL_DMA_VALID = 0x80000000, 58 * iommu code.
59 */
60 SPIDER_DMA_VALID = 0x80000000,
59 CELL_DMA_MASK = 0x7fffffff, 61 CELL_DMA_MASK = 0x7fffffff,
60}; 62};
61 63