1 In the address decoding code, the orion_disable_wins() function is
2 used at boot time to disable all address decoding windows, before
3 configuring only the ones that are needed. This allows to make sure
4 that no configuration is left from the bootloader.
6 As a preparation for the introduction of address decoding window
7 allocation/deallocation function, we refactor this function into an
8 orion_disable_cpu_win() which disables a single window.
10 The orion_config_wins() function is changed to call
11 orion_disable_cpu_win() in a loop, to preserve an identical behavior.
13 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15 arch/arm/plat-orion/addr-map.c | 35 +++++++++++++++++------------------
16 1 file changed, 17 insertions(+), 18 deletions(-)
18 --- a/arch/arm/plat-orion/addr-map.c
19 +++ b/arch/arm/plat-orion/addr-map.c
20 @@ -95,6 +95,19 @@ void __init orion_setup_cpu_win(const st
24 +static void __init orion_disable_cpu_win(const struct orion_addr_map_cfg *cfg,
27 + void __iomem *addr = cfg->win_cfg_base(cfg, win);
29 + writel(0, addr + WIN_BASE_OFF);
30 + writel(0, addr + WIN_CTRL_OFF);
31 + if (cfg->cpu_win_can_remap(cfg, win)) {
32 + writel(0, addr + WIN_REMAP_LO_OFF);
33 + writel(0, addr + WIN_REMAP_HI_OFF);
38 * Configure a number of windows.
40 @@ -108,36 +121,22 @@ static void __init orion_setup_cpu_wins(
44 -static void __init orion_disable_wins(const struct orion_addr_map_cfg * cfg)
49 - for (i = 0; i < cfg->num_wins; i++) {
50 - addr = cfg->win_cfg_base(cfg, i);
52 - writel(0, addr + WIN_BASE_OFF);
53 - writel(0, addr + WIN_CTRL_OFF);
54 - if (cfg->cpu_win_can_remap(cfg, i)) {
55 - writel(0, addr + WIN_REMAP_LO_OFF);
56 - writel(0, addr + WIN_REMAP_HI_OFF);
62 * Disable, clear and configure windows.
64 void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
65 const struct orion_addr_map_info *info)
69 if (!cfg->cpu_win_can_remap)
70 cfg->cpu_win_can_remap = orion_cpu_win_can_remap;
72 if (!cfg->win_cfg_base)
73 cfg->win_cfg_base = orion_win_cfg_base;
75 - orion_disable_wins(cfg);
76 + for (win = 0; win < cfg->num_wins; win++)
77 + orion_disable_cpu_win(cfg, win);
80 orion_setup_cpu_wins(cfg, info);