Title: [7906] trunk/arch/blackfin: task [#5723], Enable 128/256k/512k uncacheable DMA memory region for small memory system
Revision
7906
Author
bhsong
Date
2009-12-02 04:13:36 -0500 (Wed, 02 Dec 2009)

Log Message

task [#5723], Enable 128/256k/512k uncacheable DMA memory region for small memory system

Modified Paths

Diff

Modified: trunk/arch/blackfin/Kconfig (7905 => 7906)


--- trunk/arch/blackfin/Kconfig	2009-12-02 07:58:12 UTC (rev 7905)
+++ trunk/arch/blackfin/Kconfig	2009-12-02 09:13:36 UTC (rev 7906)
@@ -896,6 +896,12 @@
 	bool "Enable 2M DMA region"
 config DMA_UNCACHED_1M
 	bool "Enable 1M DMA region"
+config DMA_UNCACHED_512K
+	bool "Enable 512K DMA region"
+config DMA_UNCACHED_256K
+	bool "Enable 256K DMA region"
+config DMA_UNCACHED_128K
+	bool "Enable 128K DMA region"
 config DMA_UNCACHED_NONE
 	bool "Disable DMA region"
 endchoice

Modified: trunk/arch/blackfin/include/asm/bfin-global.h (7905 => 7906)


--- trunk/arch/blackfin/include/asm/bfin-global.h	2009-12-02 07:58:12 UTC (rev 7905)
+++ trunk/arch/blackfin/include/asm/bfin-global.h	2009-12-02 09:13:36 UTC (rev 7906)
@@ -20,6 +20,12 @@
 # define DMA_UNCACHED_REGION (2 * 1024 * 1024)
 #elif defined(CONFIG_DMA_UNCACHED_1M)
 # define DMA_UNCACHED_REGION (1024 * 1024)
+#elif defined(CONFIG_DMA_UNCACHED_512K)
+# define DMA_UNCACHED_REGION (512 * 1024)
+#elif defined(CONFIG_DMA_UNCACHED_256K)
+# define DMA_UNCACHED_REGION (256 * 1024)
+#elif defined(CONFIG_DMA_UNCACHED_128K)
+# define DMA_UNCACHED_REGION (128 * 1024)
 #else
 # define DMA_UNCACHED_REGION (0)
 #endif

Modified: trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c (7905 => 7906)


--- trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2009-12-02 07:58:12 UTC (rev 7905)
+++ trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2009-12-02 09:13:36 UTC (rev 7906)
@@ -94,9 +94,19 @@
 	i_d = 0;
 	/* Normal RAM, including MTD FS.  */
 #ifdef CONFIG_MTD_UCLINUX
-	dcplb_bounds[i_d].eaddr = memory_mtd_start + mtd_size;
+	if ((DMA_UNCACHED_REGION >= 1 * 1024 * 1024) || (!DMA_UNCACHED_REGION) ||
+		(_ramend - (memory_mtd_start + mtd_size)) >= 1 * 1024 * 1024)
+		dcplb_bounds[i_d].eaddr = memory_mtd_start + mtd_size;
+	/* if DMA uncache size is less than 1MB, let the whole 1MB from normal_memory_end & 0xfffff uncached */
+	else
+		dcplb_bounds[i_d].eaddr = (memory_mtd_start + mtd_size) & ~(1 * 1024 * 1024);
 #else
-	dcplb_bounds[i_d].eaddr = memory_end;
+	if ((DMA_UNCACHED_REGION >= 1 * 1024 * 1024) || (!DMA_UNCACHED_REGION) ||
+		((_ramend - memory_end) >= 1 * 1024 * 1024))
+		dcplb_bounds[i_d].eaddr = memory_end;
+	/* if DMA uncache size is less than 1MB, let the whole 1MB from normal_memory_end & 0xfffff uncached */
+	else
+		dcplb_bounds[i_d].eaddr = memory_end & ~(1 * 1024 * 1024);
 #endif
 	dcplb_bounds[i_d++].data = ""
 	/* DMA uncached region.  */
@@ -136,10 +146,22 @@
 	i_i = 0;
 	/* Normal RAM, including MTD FS.  */
 #ifdef CONFIG_MTD_UCLINUX
-	icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
+	/*
+	 * While DMA uncache size is 128/256/512KB, we let icplb cover the whole 1MB from normal_memory_end & 0xfffff
+	 * A bad result is the 128/256/512KB becomes be able to fetch instrcutions. But in order to protect the area,
+	 * we have to manage the area by page size
+	 */
+	if (unlikely((memory_mtd_start + mtd_size) & (1 * 1024 * 1024 - 1)))
+		icplb_bounds[i_i].eaddr = ((memory_mtd_start + mtd_size) & ~(1 * 1024 * 1024 - 1)) + 1 * 1024 * 1024;
+	else
+		icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
 #else
-	icplb_bounds[i_i].eaddr = memory_end;
+	if (unlikely(memory_end & (1 * 1024 * 1024 - 1)))
+		icplb_bounds[i_i].eaddr = (memory_end & ~(1 * 1024 * 1024 - 1)) + 1 * 1024 * 1024;
+	else
+		icplb_bounds[i_i].eaddr = memory_end;
 #endif
+
 	icplb_bounds[i_i++].data = ""
 	/* DMA uncached region.  */
 	if (DMA_UNCACHED_REGION) {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to