aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-malta/malta-setup.c
diff options
context:
space:
mode:
authorSteven J. Hill <Steven.Hill@imgtec.com>2013-03-25 14:47:29 -0400
committerSteven J. Hill <Steven.Hill@imgtec.com>2013-05-01 17:32:49 -0400
commitb6d92b4a6bdb880b39789c677b952c53a437028d (patch)
treef14d30f02314d75860aa1ed12449410e6659513b /arch/mips/mti-malta/malta-setup.c
parentc34c09c81d659e13e15947580198fa652af3ca1a (diff)
MIPS: Add option to disable software I/O coherency.
Some MIPS controllers have hardware I/O coherency. This patch detects those and turns off software coherency. A new kernel command line option also allows the user to manually turn software coherency on or off. Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Diffstat (limited to 'arch/mips/mti-malta/malta-setup.c')
-rw-r--r--arch/mips/mti-malta/malta-setup.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index 200f64df2c9b..a85557171faa 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -32,6 +32,7 @@
32#include <asm/mips-boards/maltaint.h> 32#include <asm/mips-boards/maltaint.h>
33#include <asm/dma.h> 33#include <asm/dma.h>
34#include <asm/traps.h> 34#include <asm/traps.h>
35#include <asm/gcmpregs.h>
35#ifdef CONFIG_VT 36#ifdef CONFIG_VT
36#include <linux/console.h> 37#include <linux/console.h>
37#endif 38#endif
@@ -105,6 +106,66 @@ static void __init fd_activate(void)
105} 106}
106#endif 107#endif
107 108
109static int __init plat_enable_iocoherency(void)
110{
111 int supported = 0;
112 if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
113 if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
114 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
115 pr_info("Enabled Bonito CPU coherency\n");
116 supported = 1;
117 }
118 if (strstr(fw_getcmdline(), "iobcuncached")) {
119 BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
120 BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
121 ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
122 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
123 pr_info("Disabled Bonito IOBC coherency\n");
124 } else {
125 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
126 BONITO_PCIMEMBASECFG |=
127 (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
128 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
129 pr_info("Enabled Bonito IOBC coherency\n");
130 }
131 } else if (gcmp_niocu() != 0) {
132 /* Nothing special needs to be done to enable coherency */
133 pr_info("CMP IOCU detected\n");
134 if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {
135 pr_crit("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n");
136 return 0;
137 }
138 supported = 1;
139 }
140 hw_coherentio = supported;
141 return supported;
142}
143
144static void __init plat_setup_iocoherency(void)
145{
146#ifdef CONFIG_DMA_NONCOHERENT
147 /*
148 * Kernel has been configured with software coherency
149 * but we might choose to turn it off and use hardware
150 * coherency instead.
151 */
152 if (plat_enable_iocoherency()) {
153 if (coherentio == 0)
154 pr_info("Hardware DMA cache coherency disabled\n");
155 else
156 pr_info("Hardware DMA cache coherency enabled\n");
157 } else {
158 if (coherentio == 1)
159 pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
160 else
161 pr_info("Software DMA cache coherency enabled\n");
162 }
163#else
164 if (!plat_enable_iocoherency())
165 panic("Hardware DMA cache coherency not supported!");
166#endif
167}
168
108#ifdef CONFIG_BLK_DEV_IDE 169#ifdef CONFIG_BLK_DEV_IDE
109static void __init pci_clock_check(void) 170static void __init pci_clock_check(void)
110{ 171{
@@ -207,6 +268,8 @@ void __init plat_mem_setup(void)
207 if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) 268 if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO)
208 bonito_quirks_setup(); 269 bonito_quirks_setup();
209 270
271 plat_setup_iocoherency();
272
210#ifdef CONFIG_BLK_DEV_IDE 273#ifdef CONFIG_BLK_DEV_IDE
211 pci_clock_check(); 274 pci_clock_check();
212#endif 275#endif