ar71xx: ethernet: cache skb->len in the tx function to avoid accessing it again in...
[openwrt.git] / target / linux / mvebu / patches-3.8 / 031-arm_plat_orion_refactor.patch
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.
5
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.
9
10 The orion_config_wins() function is changed to call
11 orion_disable_cpu_win() in a loop, to preserve an identical behavior.
12
13 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
14 ---
15  arch/arm/plat-orion/addr-map.c |   35 +++++++++++++++++------------------
16  1 file changed, 17 insertions(+), 18 deletions(-)
17
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
21         }
22  }
23  
24 +static void __init orion_disable_cpu_win(const struct orion_addr_map_cfg *cfg,
25 +                                        const int win)
26 +{
27 +       void __iomem *addr = cfg->win_cfg_base(cfg, win);
28 +
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);
34 +       }
35 +}
36 +
37  /*
38   * Configure a number of windows.
39   */
40 @@ -108,36 +121,22 @@ static void __init orion_setup_cpu_wins(
41         }
42  }
43  
44 -static void __init orion_disable_wins(const struct orion_addr_map_cfg * cfg)
45 -{
46 -       void __iomem *addr;
47 -       int i;
48 -
49 -       for (i = 0; i < cfg->num_wins; i++) {
50 -               addr = cfg->win_cfg_base(cfg, i);
51 -
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);
57 -               }
58 -       }
59 -}
60 -
61  /*
62   * Disable, clear and configure windows.
63   */
64  void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
65                               const struct orion_addr_map_info *info)
66  {
67 +       int win;
68 +
69         if (!cfg->cpu_win_can_remap)
70                 cfg->cpu_win_can_remap = orion_cpu_win_can_remap;
71  
72         if (!cfg->win_cfg_base)
73                 cfg->win_cfg_base = orion_win_cfg_base;
74  
75 -       orion_disable_wins(cfg);
76 +       for (win = 0; win < cfg->num_wins; win++)
77 +               orion_disable_cpu_win(cfg, win);
78  
79         if (info)
80                 orion_setup_cpu_wins(cfg, info);