aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorBarry Song <barry.song@analog.com>2009-12-02 04:13:36 -0500
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:15:48 -0500
commitc45c06596e0d45125d25beb0fe24a68aef1f1046 (patch)
treea556caee3f3f14ae9fd0eb5bb9e7053ecd8c63e8 /arch/blackfin
parent5df326aca48b8631c9e3c90c76d7e9f0b466a721 (diff)
Blackfin: support smaller uncached DMA chunks for memory constrained systems
When working with 8 meg systems, forcing a 1 meg DMA chunk heavily cuts into the available resources. So support smaller chunks to better cover needs for these systems. Signed-off-by: Barry Song <barry.song@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/Kconfig6
-rw-r--r--arch/blackfin/include/asm/bfin-global.h6
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c20
3 files changed, 25 insertions, 7 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index d703247caf20..8141b1e82927 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -896,6 +896,12 @@ config DMA_UNCACHED_2M
896 bool "Enable 2M DMA region" 896 bool "Enable 2M DMA region"
897config DMA_UNCACHED_1M 897config DMA_UNCACHED_1M
898 bool "Enable 1M DMA region" 898 bool "Enable 1M DMA region"
899config DMA_UNCACHED_512K
900 bool "Enable 512K DMA region"
901config DMA_UNCACHED_256K
902 bool "Enable 256K DMA region"
903config DMA_UNCACHED_128K
904 bool "Enable 128K DMA region"
899config DMA_UNCACHED_NONE 905config DMA_UNCACHED_NONE
900 bool "Disable DMA region" 906 bool "Disable DMA region"
901endchoice 907endchoice
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 741c02112c06..e6485c305ea6 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -20,6 +20,12 @@
20# define DMA_UNCACHED_REGION (2 * 1024 * 1024) 20# define DMA_UNCACHED_REGION (2 * 1024 * 1024)
21#elif defined(CONFIG_DMA_UNCACHED_1M) 21#elif defined(CONFIG_DMA_UNCACHED_1M)
22# define DMA_UNCACHED_REGION (1024 * 1024) 22# define DMA_UNCACHED_REGION (1024 * 1024)
23#elif defined(CONFIG_DMA_UNCACHED_512K)
24# define DMA_UNCACHED_REGION (512 * 1024)
25#elif defined(CONFIG_DMA_UNCACHED_256K)
26# define DMA_UNCACHED_REGION (256 * 1024)
27#elif defined(CONFIG_DMA_UNCACHED_128K)
28# define DMA_UNCACHED_REGION (128 * 1024)
23#else 29#else
24# define DMA_UNCACHED_REGION (0) 30# define DMA_UNCACHED_REGION (0)
25#endif 31#endif
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index fd9a2f31e686..c9b0a4d53dc1 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -89,15 +89,25 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
89 89
90void __init generate_cplb_tables_all(void) 90void __init generate_cplb_tables_all(void)
91{ 91{
92 unsigned long uncached_end;
92 int i_d, i_i; 93 int i_d, i_i;
93 94
94 i_d = 0; 95 i_d = 0;
95 /* Normal RAM, including MTD FS. */ 96 /* Normal RAM, including MTD FS. */
96#ifdef CONFIG_MTD_UCLINUX 97#ifdef CONFIG_MTD_UCLINUX
97 dcplb_bounds[i_d].eaddr = memory_mtd_start + mtd_size; 98 uncached_end = memory_mtd_start + mtd_size;
98#else 99#else
99 dcplb_bounds[i_d].eaddr = memory_end; 100 uncached_end = memory_end;
100#endif 101#endif
102 /*
103 * if DMA uncached is less than 1MB, mark the 1MB chunk as uncached
104 * so that we don't have to use 4kB pages and cause CPLB thrashing
105 */
106 if ((DMA_UNCACHED_REGION >= 1 * 1024 * 1024) || !DMA_UNCACHED_REGION ||
107 ((_ramend - uncached_end) >= 1 * 1024 * 1024))
108 dcplb_bounds[i_d].eaddr = uncached_end;
109 else
110 dcplb_bounds[i_d].eaddr = uncached_end & ~(1 * 1024 * 1024);
101 dcplb_bounds[i_d++].data = SDRAM_DGENERIC; 111 dcplb_bounds[i_d++].data = SDRAM_DGENERIC;
102 /* DMA uncached region. */ 112 /* DMA uncached region. */
103 if (DMA_UNCACHED_REGION) { 113 if (DMA_UNCACHED_REGION) {
@@ -135,11 +145,7 @@ void __init generate_cplb_tables_all(void)
135 145
136 i_i = 0; 146 i_i = 0;
137 /* Normal RAM, including MTD FS. */ 147 /* Normal RAM, including MTD FS. */
138#ifdef CONFIG_MTD_UCLINUX 148 icplb_bounds[i_i].eaddr = uncached_end;
139 icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
140#else
141 icplb_bounds[i_i].eaddr = memory_end;
142#endif
143 icplb_bounds[i_i++].data = SDRAM_IGENERIC; 149 icplb_bounds[i_i++].data = SDRAM_IGENERIC;
144 /* DMA uncached region. */ 150 /* DMA uncached region. */
145 if (DMA_UNCACHED_REGION) { 151 if (DMA_UNCACHED_REGION) {