Skip to content

Commit 04e4783

Browse files
Christoph Hellwigtsbogend
authored andcommitted
MIPS/malta: simplify plat_setup_iocoherency
Given that plat_mem_setup runs before earlyparams are handled and malta selects CONFIG_DMA_MAYBE_COHERENT, coherentio can only be set to IO_COHERENCE_DEFAULT at this point. So remove the checking for other options and merge plat_enable_iocoherency into plat_setup_iocoherency to simplify the code a bit. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 7c86ff9 commit 04e4783

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

arch/mips/mti-malta/malta-setup.c

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,15 @@ static void __init fd_activate(void)
9090
}
9191
#endif
9292

93-
static int __init plat_enable_iocoherency(void)
93+
static void __init plat_setup_iocoherency(void)
9494
{
95-
int supported = 0;
9695
u32 cfg;
9796

9897
if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
9998
if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
10099
BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
101100
pr_info("Enabled Bonito CPU coherency\n");
102-
supported = 1;
101+
hw_coherentio = 1;
103102
}
104103
if (strstr(fw_getcmdline(), "iobcuncached")) {
105104
BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
@@ -118,29 +117,16 @@ static int __init plat_enable_iocoherency(void)
118117
/* Nothing special needs to be done to enable coherency */
119118
pr_info("CMP IOCU detected\n");
120119
cfg = __raw_readl((u32 *)CKSEG1ADDR(ROCIT_CONFIG_GEN0));
121-
if (!(cfg & ROCIT_CONFIG_GEN0_PCI_IOCU)) {
120+
if (cfg & ROCIT_CONFIG_GEN0_PCI_IOCU)
121+
hw_coherentio = 1;
122+
else
122123
pr_crit("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n");
123-
return 0;
124-
}
125-
supported = 1;
126124
}
127-
hw_coherentio = supported;
128-
return supported;
129-
}
130125

131-
static void __init plat_setup_iocoherency(void)
132-
{
133-
if (plat_enable_iocoherency()) {
134-
if (coherentio == IO_COHERENCE_DISABLED)
135-
pr_info("Hardware DMA cache coherency disabled\n");
136-
else
137-
pr_info("Hardware DMA cache coherency enabled\n");
138-
} else {
139-
if (coherentio == IO_COHERENCE_ENABLED)
140-
pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
141-
else
142-
pr_info("Software DMA cache coherency enabled\n");
143-
}
126+
if (hw_coherentio)
127+
pr_info("Hardware DMA cache coherency enabled\n");
128+
else
129+
pr_info("Software DMA cache coherency enabled\n");
144130
}
145131

146132
static void __init pci_clock_check(void)

0 commit comments

Comments
 (0)