Commit 5686a1e5aa436c49187a60052d5885fb1f541ce6

Authored by Thomas Petazzoni
Committed by Jason Cooper
1 parent 501f928e00

bus: mvebu: pass the coherency availability information at init time

Until now, the mvebu-mbus was guessing by itself whether hardware I/O
coherency was available or not by poking into the Device Tree to see
if the coherency fabric Device Tree node was present or not.

However, on some upcoming SoCs, the presence or absence of the
coherency fabric DT node isn't sufficient: in CONFIG_SMP, the
coherency can be enabled, but not in !CONFIG_SMP.

In order to clean this up, the mvebu_mbus_dt_init() function is
extended to get a boolean argument telling whether coherency is
enabled or not. Therefore, the logic to decide whether coherency is
available or not now belongs to the core SoC code instead of the
mvebu-mbus driver itself, which is much better.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Link: https://lkml.kernel.org/r/1397483228-25625-4-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>

Showing 6 changed files with 8 additions and 13 deletions Side-by-side Diff

arch/arm/mach-kirkwood/board-dt.c
... ... @@ -195,7 +195,7 @@
195 195 {
196 196 kirkwood_disable_mbus_error_propagation();
197 197  
198   - BUG_ON(mvebu_mbus_dt_init());
  198 + BUG_ON(mvebu_mbus_dt_init(false));
199 199  
200 200 #ifdef CONFIG_CACHE_FEROCEON_L2
201 201 feroceon_of_init();
arch/arm/mach-mvebu/board-v7.c
... ... @@ -58,7 +58,7 @@
58 58 of_clk_init(NULL);
59 59 clocksource_of_init();
60 60 coherency_init();
61   - BUG_ON(mvebu_mbus_dt_init());
  61 + BUG_ON(mvebu_mbus_dt_init(coherency_available()));
62 62 #ifdef CONFIG_CACHE_L2X0
63 63 l2x0_of_init(0, ~0UL);
64 64 #endif
arch/arm/mach-mvebu/dove.c
... ... @@ -23,7 +23,7 @@
23 23 #ifdef CONFIG_CACHE_TAUROS2
24 24 tauros2_init(0);
25 25 #endif
26   - BUG_ON(mvebu_mbus_dt_init());
  26 + BUG_ON(mvebu_mbus_dt_init(false));
27 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
28 28 }
29 29  
arch/arm/mach-mvebu/kirkwood.c
... ... @@ -169,7 +169,7 @@
169 169 {
170 170 kirkwood_disable_mbus_error_propagation();
171 171  
172   - BUG_ON(mvebu_mbus_dt_init());
  172 + BUG_ON(mvebu_mbus_dt_init(false));
173 173  
174 174 #ifdef CONFIG_CACHE_FEROCEON_L2
175 175 feroceon_of_init();
drivers/bus/mvebu-mbus.c
... ... @@ -694,7 +694,6 @@
694 694 phys_addr_t sdramwins_phys_base,
695 695 size_t sdramwins_size)
696 696 {
697   - struct device_node *np;
698 697 int win;
699 698  
700 699 mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size);
... ... @@ -707,12 +706,6 @@
707 706 return -ENOMEM;
708 707 }
709 708  
710   - np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
711   - if (np) {
712   - mbus->hw_io_coherency = 1;
713   - of_node_put(np);
714   - }
715   -
716 709 for (win = 0; win < mbus->soc->num_wins; win++)
717 710 mvebu_mbus_disable_window(mbus, win);
718 711  
... ... @@ -882,7 +875,7 @@
882 875 }
883 876 }
884 877  
885   -int __init mvebu_mbus_dt_init(void)
  878 +int __init mvebu_mbus_dt_init(bool is_coherent)
886 879 {
887 880 struct resource mbuswins_res, sdramwins_res;
888 881 struct device_node *np, *controller;
... ... @@ -919,6 +912,8 @@
919 912 pr_err("cannot get SDRAM register address\n");
920 913 return -EINVAL;
921 914 }
  915 +
  916 + mbus_state.hw_io_coherency = is_coherent;
922 917  
923 918 /* Get optional pcie-{mem,io}-aperture properties */
924 919 mvebu_mbus_get_pcie_resources(np, &mbus_state.pcie_mem_aperture,
include/linux/mbus.h
... ... @@ -73,7 +73,7 @@
73 73 int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
74 74 size_t mbus_size, phys_addr_t sdram_phys_base,
75 75 size_t sdram_size);
76   -int mvebu_mbus_dt_init(void);
  76 +int mvebu_mbus_dt_init(bool is_coherent);
77 77  
78 78 #endif /* __LINUX_MBUS_H */