a27280057799a012e9062ded954ba63bfb614546
[15.05/openwrt.git] / package / kernel / mac80211 / patches / 341-brcmfmac-rename-chip-download-functions.patch
1 From: Arend van Spriel <arend@broadcom.com>
2 Date: Wed, 11 Mar 2015 16:11:29 +0100
3 Subject: [PATCH] brcmfmac: rename chip download functions
4
5 The functions brcmf_chip_[enter/exit]_download() are not exclusively
6 used for firmware download so rename these more appropriate.
7
8 Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
9 Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
10 Signed-off-by: Arend van Spriel <arend@broadcom.com>
11 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
12 ---
13
14 --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
15 +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
16 @@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
17                 err = -EINVAL;
18         if (WARN_ON(!ops->prepare))
19                 err = -EINVAL;
20 -       if (WARN_ON(!ops->exit_dl))
21 +       if (WARN_ON(!ops->activate))
22                 err = -EINVAL;
23         if (err < 0)
24                 return ERR_PTR(-EINVAL);
25 @@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
26  }
27  
28  static void
29 -brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
30 +brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
31  {
32         struct brcmf_core *core;
33  
34 @@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
35         brcmf_chip_resetcore(core, 0, 0, 0);
36  }
37  
38 -static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
39 +static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
40  {
41         struct brcmf_core *core;
42  
43 @@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
44                 return false;
45         }
46  
47 -       chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
48 +       chip->ops->activate(chip->ctx, &chip->pub, 0);
49  
50         core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
51         brcmf_chip_resetcore(core, 0, 0, 0);
52 @@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
53  }
54  
55  static inline void
56 -brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
57 +brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
58  {
59         struct brcmf_core *core;
60  
61 @@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
62                              D11_BCMA_IOCTL_PHYCLOCKEN);
63  }
64  
65 -static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
66 +static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
67  {
68         struct brcmf_core *core;
69  
70 -       chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
71 +       chip->ops->activate(chip->ctx, &chip->pub, rstvec);
72  
73         /* restore ARM */
74         core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
75 @@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
76         return true;
77  }
78  
79 -void brcmf_chip_enter_download(struct brcmf_chip *pub)
80 +void brcmf_chip_set_passive(struct brcmf_chip *pub)
81  {
82         struct brcmf_chip_priv *chip;
83         struct brcmf_core *arm;
84 @@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
85         chip = container_of(pub, struct brcmf_chip_priv, pub);
86         arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
87         if (arm) {
88 -               brcmf_chip_cr4_enterdl(chip);
89 +               brcmf_chip_cr4_set_passive(chip);
90                 return;
91         }
92  
93 -       brcmf_chip_cm3_enterdl(chip);
94 +       brcmf_chip_cm3_set_passive(chip);
95  }
96  
97 -bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
98 +bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
99  {
100         struct brcmf_chip_priv *chip;
101         struct brcmf_core *arm;
102 @@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
103         chip = container_of(pub, struct brcmf_chip_priv, pub);
104         arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
105         if (arm)
106 -               return brcmf_chip_cr4_exitdl(chip, rstvec);
107 +               return brcmf_chip_cr4_set_active(chip, rstvec);
108  
109 -       return brcmf_chip_cm3_exitdl(chip);
110 +       return brcmf_chip_cm3_set_active(chip);
111  }
112  
113  bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
114 --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
115 +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
116 @@ -64,7 +64,7 @@ struct brcmf_core {
117   * @write32: write 32-bit value over bus.
118   * @prepare: prepare bus for core configuration.
119   * @setup: bus-specific core setup.
120 - * @exit_dl: exit download state.
121 + * @active: chip becomes active.
122   *     The callback should use the provided @rstvec when non-zero.
123   */
124  struct brcmf_buscore_ops {
125 @@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
126         void (*write32)(void *ctx, u32 addr, u32 value);
127         int (*prepare)(void *ctx);
128         int (*setup)(void *ctx, struct brcmf_chip *chip);
129 -       void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
130 +       void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
131  };
132  
133  struct brcmf_chip *brcmf_chip_attach(void *ctx,
134 @@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
135  void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
136  void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
137                           u32 postreset);
138 -void brcmf_chip_enter_download(struct brcmf_chip *ci);
139 -bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
140 +void brcmf_chip_set_passive(struct brcmf_chip *ci);
141 +bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
142  bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
143  
144  #endif /* BRCMF_AXIDMP_H */
145 --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
146 +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
147 @@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
148  
149  static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
150  {
151 -       brcmf_chip_enter_download(devinfo->ci);
152 +       brcmf_chip_set_passive(devinfo->ci);
153  
154         if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
155                 brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
156 @@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
157                 brcmf_chip_resetcore(core, 0, 0, 0);
158         }
159  
160 -       return !brcmf_chip_exit_download(devinfo->ci, resetintr);
161 +       return !brcmf_chip_set_active(devinfo->ci, resetintr);
162  }
163  
164  
165 @@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
166  }
167  
168  
169 -static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
170 -                                     u32 rstvec)
171 +static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
172 +                                       u32 rstvec)
173  {
174         struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
175  
176 @@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
177  
178  static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
179         .prepare = brcmf_pcie_buscoreprep,
180 -       .exit_dl = brcmf_pcie_buscore_exitdl,
181 +       .activate = brcmf_pcie_buscore_activate,
182         .read32 = brcmf_pcie_buscore_read32,
183         .write32 = brcmf_pcie_buscore_write32,
184  };
185 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
186 +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
187 @@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
188         brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
189  
190         /* Keep arm in reset */
191 -       brcmf_chip_enter_download(bus->ci);
192 +       brcmf_chip_set_passive(bus->ci);
193  
194         rstvec = get_unaligned_le32(fw->data);
195         brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
196 @@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
197         }
198  
199         /* Take arm out of reset */
200 -       if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
201 +       if (!brcmf_chip_set_active(bus->ci, rstvec)) {
202                 brcmf_err("error getting out of ARM core reset\n");
203                 goto err;
204         }
205 @@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
206         return 0;
207  }
208  
209 -static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
210 -                                     u32 rstvec)
211 +static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
212 +                                       u32 rstvec)
213  {
214         struct brcmf_sdio_dev *sdiodev = ctx;
215         struct brcmf_core *core;
216 @@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
217  
218  static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
219         .prepare = brcmf_sdio_buscoreprep,
220 -       .exit_dl = brcmf_sdio_buscore_exitdl,
221 +       .activate = brcmf_sdio_buscore_activate,
222         .read32 = brcmf_sdio_buscore_read32,
223         .write32 = brcmf_sdio_buscore_write32,
224  };
225 @@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
226                                 sdio_claim_host(bus->sdiodev->func[1]);
227                                 brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
228                                 /* Leave the device in state where it is
229 -                                * 'quiet'. This is done by putting it in
230 -                                * download_state which essentially resets
231 -                                * all necessary cores.
232 +                                * 'passive'. This is done by resetting all
233 +                                * necessary cores.
234                                  */
235                                 msleep(20);
236 -                               brcmf_chip_enter_download(bus->ci);
237 +                               brcmf_chip_set_passive(bus->ci);
238                                 brcmf_sdio_clkctl(bus, CLK_NONE, false);
239                                 sdio_release_host(bus->sdiodev->func[1]);
240                         }