Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5686a1e

Browse files
tpetazzoniJason Cooper
authored andcommitted
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 <[email protected]> Link: https://lkml.kernel.org/r/1397483228-25625-4-git-send-email-thomas.petazzoni@free-electrons.com Signed-off-by: Jason Cooper <[email protected]>
1 parent 501f928 commit 5686a1e

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

arch/arm/mach-kirkwood/board-dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static void __init kirkwood_dt_init(void)
195195
{
196196
kirkwood_disable_mbus_error_propagation();
197197

198-
BUG_ON(mvebu_mbus_dt_init());
198+
BUG_ON(mvebu_mbus_dt_init(false));
199199

200200
#ifdef CONFIG_CACHE_FEROCEON_L2
201201
feroceon_of_init();

arch/arm/mach-mvebu/board-v7.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void __init mvebu_timer_and_clk_init(void)
5858
of_clk_init(NULL);
5959
clocksource_of_init();
6060
coherency_init();
61-
BUG_ON(mvebu_mbus_dt_init());
61+
BUG_ON(mvebu_mbus_dt_init(coherency_available()));
6262
#ifdef CONFIG_CACHE_L2X0
6363
l2x0_of_init(0, ~0UL);
6464
#endif

arch/arm/mach-mvebu/dove.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void __init dove_init(void)
2323
#ifdef CONFIG_CACHE_TAUROS2
2424
tauros2_init(0);
2525
#endif
26-
BUG_ON(mvebu_mbus_dt_init());
26+
BUG_ON(mvebu_mbus_dt_init(false));
2727
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
2828
}
2929

arch/arm/mach-mvebu/kirkwood.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void __init kirkwood_dt_init(void)
169169
{
170170
kirkwood_disable_mbus_error_propagation();
171171

172-
BUG_ON(mvebu_mbus_dt_init());
172+
BUG_ON(mvebu_mbus_dt_init(false));
173173

174174
#ifdef CONFIG_CACHE_FEROCEON_L2
175175
feroceon_of_init();

drivers/bus/mvebu-mbus.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus,
694694
phys_addr_t sdramwins_phys_base,
695695
size_t sdramwins_size)
696696
{
697-
struct device_node *np;
698697
int win;
699698

700699
mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size);
@@ -707,12 +706,6 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus,
707706
return -ENOMEM;
708707
}
709708

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-
716709
for (win = 0; win < mbus->soc->num_wins; win++)
717710
mvebu_mbus_disable_window(mbus, win);
718711

@@ -882,7 +875,7 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
882875
}
883876
}
884877

885-
int __init mvebu_mbus_dt_init(void)
878+
int __init mvebu_mbus_dt_init(bool is_coherent)
886879
{
887880
struct resource mbuswins_res, sdramwins_res;
888881
struct device_node *np, *controller;
@@ -920,6 +913,8 @@ int __init mvebu_mbus_dt_init(void)
920913
return -EINVAL;
921914
}
922915

916+
mbus_state.hw_io_coherency = is_coherent;
917+
923918
/* Get optional pcie-{mem,io}-aperture properties */
924919
mvebu_mbus_get_pcie_resources(np, &mbus_state.pcie_mem_aperture,
925920
&mbus_state.pcie_io_aperture);

include/linux/mbus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ int mvebu_mbus_del_window(phys_addr_t base, size_t size);
7373
int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
7474
size_t mbus_size, phys_addr_t sdram_phys_base,
7575
size_t sdram_size);
76-
int mvebu_mbus_dt_init(void);
76+
int mvebu_mbus_dt_init(bool is_coherent);
7777

7878
#endif /* __LINUX_MBUS_H */

0 commit comments

Comments
 (0)