Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Malta: Cleanup DMA coherence #ifdefs

DMA coherence is not user-selectable in Kconfig, and Malta selects
CONFIG_DMA_MAYBE_COHERENT which in turn selects CONFIG_DMA_NONCOHERENT.
Remove #ifdefs whose conditions can therefore never be true for Malta.

This removes a significant amount of code from bonito_quirks_setup(),
but the code is duplicated in plat_enable_iocoherency() anyway so we
lose nothing but duplication.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/14188/

-38
-38
arch/mips/mti-malta/malta-setup.c
··· 145 145 146 146 static void __init plat_setup_iocoherency(void) 147 147 { 148 - #ifdef CONFIG_DMA_NONCOHERENT 149 - /* 150 - * Kernel has been configured with software coherency 151 - * but we might choose to turn it off and use hardware 152 - * coherency instead. 153 - */ 154 148 if (plat_enable_iocoherency()) { 155 149 if (coherentio == IO_COHERENCE_DISABLED) 156 150 pr_info("Hardware DMA cache coherency disabled\n"); ··· 156 162 else 157 163 pr_info("Software DMA cache coherency enabled\n"); 158 164 } 159 - #else 160 - if (!plat_enable_iocoherency()) 161 - panic("Hardware DMA cache coherency not supported!"); 162 - #endif 163 165 } 164 166 165 167 static void __init pci_clock_check(void) ··· 217 227 pr_info("Enabled Bonito debug mode\n"); 218 228 } else 219 229 BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE; 220 - 221 - #ifndef CONFIG_DMA_NONCOHERENT 222 - if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) { 223 - BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN; 224 - pr_info("Enabled Bonito CPU coherency\n"); 225 - 226 - argptr = fw_getcmdline(); 227 - if (strstr(argptr, "iobcuncached")) { 228 - BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN; 229 - BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG & 230 - ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED | 231 - BONITO_PCIMEMBASECFG_MEMBASE1_CACHED); 232 - pr_info("Disabled Bonito IOBC coherency\n"); 233 - } else { 234 - BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN; 235 - BONITO_PCIMEMBASECFG |= 236 - (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED | 237 - BONITO_PCIMEMBASECFG_MEMBASE1_CACHED); 238 - pr_info("Enabled Bonito IOBC coherency\n"); 239 - } 240 - } else 241 - panic("Hardware DMA cache coherency not supported"); 242 - #endif 243 230 } 244 231 245 232 void __init *plat_get_fdt(void) ··· 246 279 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge. 247 280 */ 248 281 enable_dma(4); 249 - 250 - #ifndef CONFIG_DMA_NONCOHERENT 251 - if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO) 252 - panic("Hardware DMA cache coherency not supported"); 253 - #endif 254 282 255 283 if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) 256 284 bonito_quirks_setup();