File tree Expand file tree Collapse file tree 6 files changed +16
-40
lines changed Expand file tree Collapse file tree 6 files changed +16
-40
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,7 @@ void __init plat_mem_setup(void)
65
65
/* Clear to obtain best system bus performance */
66
66
clear_c0_config (1 << 19 ); /* Clear Config[OD] */
67
67
68
- coherentio = alchemy_dma_coherent () ?
69
- IO_COHERENCE_ENABLED : IO_COHERENCE_DISABLED ;
68
+ dma_default_coherent = alchemy_dma_coherent ();
70
69
71
70
board_setup (); /* board specific setup */
72
71
Original file line number Diff line number Diff line change 9
9
#ifndef __ASM_DMA_COHERENCE_H
10
10
#define __ASM_DMA_COHERENCE_H
11
11
12
- enum coherent_io_user_state {
13
- IO_COHERENCE_DEFAULT ,
14
- IO_COHERENCE_ENABLED ,
15
- IO_COHERENCE_DISABLED ,
16
- };
17
-
18
- #if defined(CONFIG_DMA_PERDEV_COHERENT )
19
- /* Don't provide (hw_)coherentio to avoid misuse */
20
- #elif defined(CONFIG_DMA_MAYBE_COHERENT )
21
- extern enum coherent_io_user_state coherentio ;
22
- extern int hw_coherentio ;
23
-
12
+ #ifdef CONFIG_DMA_MAYBE_COHERENT
13
+ extern bool dma_default_coherent ;
24
14
static inline bool dev_is_dma_coherent (struct device * dev )
25
15
{
26
- return coherentio == IO_COHERENCE_ENABLED ||
27
- (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio );
16
+ return dma_default_coherent ;
28
17
}
29
18
#else
30
- #ifdef CONFIG_DMA_NONCOHERENT
31
- #define coherentio IO_COHERENCE_DISABLED
32
- #else
33
- #define coherentio IO_COHERENCE_ENABLED
19
+ #define dma_default_coherent (!IS_ENABLED(CONFIG_DMA_NONCOHERENT))
34
20
#endif
35
- #define hw_coherentio 0
36
- #endif /* CONFIG_DMA_MAYBE_COHERENT */
37
21
38
22
#endif
Original file line number Diff line number Diff line change @@ -803,22 +803,20 @@ arch_initcall(debugfs_mips);
803
803
#endif
804
804
805
805
#ifdef CONFIG_DMA_MAYBE_COHERENT
806
- /* User defined DMA coherency from command line. */
807
- enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT ;
808
- EXPORT_SYMBOL_GPL (coherentio );
809
- int hw_coherentio ; /* Actual hardware supported DMA coherency setting. */
806
+ bool dma_default_coherent ;
807
+ EXPORT_SYMBOL_GPL (dma_default_coherent );
810
808
811
809
static int __init setcoherentio (char * str )
812
810
{
813
- coherentio = IO_COHERENCE_ENABLED ;
811
+ dma_default_coherent = true ;
814
812
pr_info ("Hardware DMA cache coherency (command line)\n" );
815
813
return 0 ;
816
814
}
817
815
early_param ("coherentio" , setcoherentio );
818
816
819
817
static int __init setnocoherentio (char * str )
820
818
{
821
- coherentio = IO_COHERENCE_DISABLED ;
819
+ dma_default_coherent = true ;
822
820
pr_info ("Software DMA cache coherency (command line)\n" );
823
821
return 0 ;
824
822
}
Original file line number Diff line number Diff line change @@ -1914,15 +1914,11 @@ void r4k_cache_init(void)
1914
1914
__local_flush_icache_user_range = local_r4k_flush_icache_user_range ;
1915
1915
1916
1916
#ifdef CONFIG_DMA_NONCOHERENT
1917
- #ifdef CONFIG_DMA_MAYBE_COHERENT
1918
- if (coherentio == IO_COHERENCE_ENABLED ||
1919
- (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio )) {
1917
+ if (dma_default_coherent ) {
1920
1918
_dma_cache_wback_inv = (void * )cache_noop ;
1921
1919
_dma_cache_wback = (void * )cache_noop ;
1922
1920
_dma_cache_inv = (void * )cache_noop ;
1923
- } else
1924
- #endif /* CONFIG_DMA_MAYBE_COHERENT */
1925
- {
1921
+ } else {
1926
1922
_dma_cache_wback_inv = r4k_dma_cache_wback_inv ;
1927
1923
_dma_cache_wback = r4k_dma_cache_wback_inv ;
1928
1924
_dma_cache_inv = r4k_dma_cache_inv ;
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ static void __init plat_setup_iocoherency(void)
98
98
if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES ) {
99
99
BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN ;
100
100
pr_info ("Enabled Bonito CPU coherency\n" );
101
- hw_coherentio = 1 ;
101
+ dma_default_coherent = true ;
102
102
}
103
103
if (strstr (fw_getcmdline (), "iobcuncached" )) {
104
104
BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN ;
@@ -118,12 +118,12 @@ static void __init plat_setup_iocoherency(void)
118
118
pr_info ("CMP IOCU detected\n" );
119
119
cfg = __raw_readl ((u32 * )CKSEG1ADDR (ROCIT_CONFIG_GEN0 ));
120
120
if (cfg & ROCIT_CONFIG_GEN0_PCI_IOCU )
121
- hw_coherentio = 1 ;
121
+ dma_default_coherent = true ;
122
122
else
123
123
pr_crit ("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n" );
124
124
}
125
125
126
- if (hw_coherentio )
126
+ if (dma_default_coherent )
127
127
pr_info ("Hardware DMA cache coherency enabled\n" );
128
128
else
129
129
pr_info ("Software DMA cache coherency enabled\n" );
Original file line number Diff line number Diff line change @@ -429,9 +429,8 @@ static int alchemy_pci_probe(struct platform_device *pdev)
429
429
ctx -> alchemy_pci_ctrl .io_map_base = (unsigned long )virt_io ;
430
430
431
431
/* Au1500 revisions older than AD have borked coherent PCI */
432
- if ((alchemy_get_cputype () == ALCHEMY_CPU_AU1500 ) &&
433
- (read_c0_prid () < 0x01030202 ) &&
434
- (coherentio == IO_COHERENCE_DISABLED )) {
432
+ if (alchemy_get_cputype () == ALCHEMY_CPU_AU1500 &&
433
+ read_c0_prid () < 0x01030202 && !dma_default_coherent ) {
435
434
val = __raw_readl (ctx -> regs + PCI_REG_CONFIG );
436
435
val |= PCI_CONFIG_NC ;
437
436
__raw_writel (val , ctx -> regs + PCI_REG_CONFIG );
You can’t perform that action at this time.
0 commit comments