diff options
-rw-r--r-- | arch/blackfin/include/asm/dma.h | 1 | ||||
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 19 | ||||
-rw-r--r-- | arch/blackfin/mach-common/pm.c | 17 |
3 files changed, 27 insertions, 10 deletions
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h index 2c09b1d50ec9..eedf3ca65ba2 100644 --- a/arch/blackfin/include/asm/dma.h +++ b/arch/blackfin/include/asm/dma.h | |||
@@ -276,6 +276,7 @@ static inline void clear_dma_irqstat(unsigned int channel) | |||
276 | } | 276 | } |
277 | 277 | ||
278 | void *dma_memcpy(void *dest, const void *src, size_t count); | 278 | void *dma_memcpy(void *dest, const void *src, size_t count); |
279 | void *dma_memcpy_nocache(void *dest, const void *src, size_t count); | ||
279 | void *safe_dma_memcpy(void *dest, const void *src, size_t count); | 280 | void *safe_dma_memcpy(void *dest, const void *src, size_t count); |
280 | void blackfin_dma_early_init(void); | 281 | void blackfin_dma_early_init(void); |
281 | void early_dma_memcpy(void *dest, const void *src, size_t count); | 282 | void early_dma_memcpy(void *dest, const void *src, size_t count); |
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 26403d1c9e65..1e485dfdc9f2 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -450,7 +450,6 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) | |||
450 | { | 450 | { |
451 | unsigned long dst = (unsigned long)pdst; | 451 | unsigned long dst = (unsigned long)pdst; |
452 | unsigned long src = (unsigned long)psrc; | 452 | unsigned long src = (unsigned long)psrc; |
453 | size_t bulk, rest; | ||
454 | 453 | ||
455 | if (bfin_addr_dcacheable(src)) | 454 | if (bfin_addr_dcacheable(src)) |
456 | blackfin_dcache_flush_range(src, src + size); | 455 | blackfin_dcache_flush_range(src, src + size); |
@@ -458,6 +457,22 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) | |||
458 | if (bfin_addr_dcacheable(dst)) | 457 | if (bfin_addr_dcacheable(dst)) |
459 | blackfin_dcache_invalidate_range(dst, dst + size); | 458 | blackfin_dcache_invalidate_range(dst, dst + size); |
460 | 459 | ||
460 | return dma_memcpy_nocache(pdst, psrc, size); | ||
461 | } | ||
462 | EXPORT_SYMBOL(dma_memcpy); | ||
463 | |||
464 | /** | ||
465 | * dma_memcpy_nocache - DMA memcpy under mutex lock | ||
466 | * - No cache flush/invalidate | ||
467 | * | ||
468 | * Do not check arguments before starting the DMA memcpy. Break the transfer | ||
469 | * up into two pieces. The first transfer is in multiples of 64k and the | ||
470 | * second transfer is the piece smaller than 64k. | ||
471 | */ | ||
472 | void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size) | ||
473 | { | ||
474 | size_t bulk, rest; | ||
475 | |||
461 | bulk = size & ~0xffff; | 476 | bulk = size & ~0xffff; |
462 | rest = size - bulk; | 477 | rest = size - bulk; |
463 | if (bulk) | 478 | if (bulk) |
@@ -465,7 +480,7 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) | |||
465 | _dma_memcpy(pdst + bulk, psrc + bulk, rest); | 480 | _dma_memcpy(pdst + bulk, psrc + bulk, rest); |
466 | return pdst; | 481 | return pdst; |
467 | } | 482 | } |
468 | EXPORT_SYMBOL(dma_memcpy); | 483 | EXPORT_SYMBOL(dma_memcpy_nocache); |
469 | 484 | ||
470 | /** | 485 | /** |
471 | * safe_dma_memcpy - DMA memcpy w/argument checking | 486 | * safe_dma_memcpy - DMA memcpy w/argument checking |
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index ea7f95f6bb4c..09c1fb410748 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
@@ -61,10 +61,11 @@ void bfin_pm_suspend_standby_enter(void) | |||
61 | 61 | ||
62 | int bf53x_suspend_l1_mem(unsigned char *memptr) | 62 | int bf53x_suspend_l1_mem(unsigned char *memptr) |
63 | { | 63 | { |
64 | dma_memcpy(memptr, (const void *) L1_CODE_START, L1_CODE_LENGTH); | 64 | dma_memcpy_nocache(memptr, (const void *) L1_CODE_START, |
65 | dma_memcpy(memptr + L1_CODE_LENGTH, (const void *) L1_DATA_A_START, | 65 | L1_CODE_LENGTH); |
66 | L1_DATA_A_LENGTH); | 66 | dma_memcpy_nocache(memptr + L1_CODE_LENGTH, |
67 | dma_memcpy(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH, | 67 | (const void *) L1_DATA_A_START, L1_DATA_A_LENGTH); |
68 | dma_memcpy_nocache(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH, | ||
68 | (const void *) L1_DATA_B_START, L1_DATA_B_LENGTH); | 69 | (const void *) L1_DATA_B_START, L1_DATA_B_LENGTH); |
69 | memcpy(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH + | 70 | memcpy(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH + |
70 | L1_DATA_B_LENGTH, (const void *) L1_SCRATCH_START, | 71 | L1_DATA_B_LENGTH, (const void *) L1_SCRATCH_START, |
@@ -75,10 +76,10 @@ int bf53x_suspend_l1_mem(unsigned char *memptr) | |||
75 | 76 | ||
76 | int bf53x_resume_l1_mem(unsigned char *memptr) | 77 | int bf53x_resume_l1_mem(unsigned char *memptr) |
77 | { | 78 | { |
78 | dma_memcpy((void *) L1_CODE_START, memptr, L1_CODE_LENGTH); | 79 | dma_memcpy_nocache((void *) L1_CODE_START, memptr, L1_CODE_LENGTH); |
79 | dma_memcpy((void *) L1_DATA_A_START, memptr + L1_CODE_LENGTH, | 80 | dma_memcpy_nocache((void *) L1_DATA_A_START, memptr + L1_CODE_LENGTH, |
80 | L1_DATA_A_LENGTH); | 81 | L1_DATA_A_LENGTH); |
81 | dma_memcpy((void *) L1_DATA_B_START, memptr + L1_CODE_LENGTH + | 82 | dma_memcpy_nocache((void *) L1_DATA_B_START, memptr + L1_CODE_LENGTH + |
82 | L1_DATA_A_LENGTH, L1_DATA_B_LENGTH); | 83 | L1_DATA_A_LENGTH, L1_DATA_B_LENGTH); |
83 | memcpy((void *) L1_SCRATCH_START, memptr + L1_CODE_LENGTH + | 84 | memcpy((void *) L1_SCRATCH_START, memptr + L1_CODE_LENGTH + |
84 | L1_DATA_A_LENGTH + L1_DATA_B_LENGTH, L1_SCRATCH_LENGTH); | 85 | L1_DATA_A_LENGTH + L1_DATA_B_LENGTH, L1_SCRATCH_LENGTH); |
@@ -167,7 +168,7 @@ int bfin_pm_suspend_mem_enter(void) | |||
167 | _disable_icplb(); | 168 | _disable_icplb(); |
168 | bf53x_suspend_l1_mem(memptr); | 169 | bf53x_suspend_l1_mem(memptr); |
169 | 170 | ||
170 | do_hibernate(wakeup | vr_wakeup); /* Goodbye */ | 171 | do_hibernate(wakeup | vr_wakeup); /* See you later! */ |
171 | 172 | ||
172 | bf53x_resume_l1_mem(memptr); | 173 | bf53x_resume_l1_mem(memptr); |
173 | 174 | ||