Lines Matching +full:bus +full:- +full:err

1 // SPDX-License-Identifier: ISC
14 #include "bus.h"
68 MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
82 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_set_joinpref_default()
84 int err; in brcmf_c_set_joinpref_default() local
96 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, in brcmf_c_set_joinpref_default()
98 if (err) in brcmf_c_set_joinpref_default()
99 bphy_err(drvr, "Set join_pref error (%d)\n", err); in brcmf_c_set_joinpref_default()
106 s32 err; in brcmf_c_download() local
109 dload_buf->flag = cpu_to_le16(flag); in brcmf_c_download()
110 dload_buf->dload_type = cpu_to_le16(DL_TYPE_CLM); in brcmf_c_download()
111 dload_buf->len = cpu_to_le32(len); in brcmf_c_download()
112 dload_buf->crc = cpu_to_le32(0); in brcmf_c_download()
114 err = brcmf_fil_iovar_data_set(ifp, var, dload_buf, in brcmf_c_download()
117 return err; in brcmf_c_download()
124 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_download_blob()
131 s32 err; in brcmf_c_download_blob() local
138 err = -ENOMEM; in brcmf_c_download_blob()
139 return -ENOMEM; in brcmf_c_download_blob()
151 memcpy(chunk_buf->data, data + cumulative_len, chunk_len); in brcmf_c_download_blob()
153 err = brcmf_c_download(ifp, dl_flag, chunk_buf, chunk_len, in brcmf_c_download_blob()
159 datalen -= chunk_len; in brcmf_c_download_blob()
160 } while ((datalen > 0) && (err == 0)); in brcmf_c_download_blob()
162 if (err) { in brcmf_c_download_blob()
164 loadvar, size, err); in brcmf_c_download_blob()
166 err = brcmf_fil_iovar_int_get(ifp, statvar, &status); in brcmf_c_download_blob()
167 if (err) in brcmf_c_download_blob()
168 bphy_err(drvr, "get %s failed (%d)\n", statvar, err); in brcmf_c_download_blob()
171 err = -EIO; in brcmf_c_download_blob()
175 return err; in brcmf_c_download_blob()
180 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_process_clm_blob()
181 struct brcmf_bus *bus = drvr->bus_if; in brcmf_c_process_clm_blob() local
183 s32 err; in brcmf_c_process_clm_blob() local
187 err = brcmf_bus_get_blob(bus, &fw, BRCMF_BLOB_CLM); in brcmf_c_process_clm_blob()
188 if (err || !fw) { in brcmf_c_process_clm_blob()
189 brcmf_info("no clm_blob available (err=%d), device may have limited channels available\n", in brcmf_c_process_clm_blob()
190 err); in brcmf_c_process_clm_blob()
194 err = brcmf_c_download_blob(ifp, fw->data, fw->size, in brcmf_c_process_clm_blob()
198 return err; in brcmf_c_process_clm_blob()
203 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_process_txcap_blob()
204 struct brcmf_bus *bus = drvr->bus_if; in brcmf_c_process_txcap_blob() local
206 s32 err; in brcmf_c_process_txcap_blob() local
210 err = brcmf_bus_get_blob(bus, &fw, BRCMF_BLOB_TXCAP); in brcmf_c_process_txcap_blob()
211 if (err || !fw) { in brcmf_c_process_txcap_blob()
212 brcmf_info("no txcap_blob available (err=%d)\n", err); in brcmf_c_process_txcap_blob()
217 err = brcmf_c_download_blob(ifp, fw->data, fw->size, in brcmf_c_process_txcap_blob()
221 return err; in brcmf_c_process_txcap_blob()
226 s32 err; in brcmf_c_set_cur_etheraddr() local
228 err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", addr, ETH_ALEN); in brcmf_c_set_cur_etheraddr()
229 if (err < 0) in brcmf_c_set_cur_etheraddr()
230 bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err); in brcmf_c_set_cur_etheraddr()
232 return err; in brcmf_c_set_cur_etheraddr()
251 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_process_cal_blob()
252 struct brcmf_mp_device *settings = drvr->settings; in brcmf_c_process_cal_blob()
253 s32 err; in brcmf_c_process_cal_blob() local
257 if (!settings->cal_blob || !settings->cal_size) in brcmf_c_process_cal_blob()
261 err = brcmf_c_download_blob(ifp, settings->cal_blob, settings->cal_size, in brcmf_c_process_cal_blob()
263 return err; in brcmf_c_process_cal_blob()
268 struct brcmf_pub *drvr = ifp->drvr; in brcmf_c_preinit_dcmds()
269 struct brcmf_fweh_info *fweh = drvr->fweh; in brcmf_c_preinit_dcmds()
271 struct brcmf_bus *bus; in brcmf_c_preinit_dcmds() local
276 s32 err; in brcmf_c_preinit_dcmds() local
278 if (is_valid_ether_addr(ifp->mac_addr)) { in brcmf_c_preinit_dcmds()
280 err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); in brcmf_c_preinit_dcmds()
281 if (err < 0) in brcmf_c_preinit_dcmds()
285 err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, in brcmf_c_preinit_dcmds()
286 sizeof(ifp->mac_addr)); in brcmf_c_preinit_dcmds()
287 if (err < 0) { in brcmf_c_preinit_dcmds()
288 bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); in brcmf_c_preinit_dcmds()
292 if (ether_addr_equal_unaligned(ifp->mac_addr, brcmf_default_mac_address)) { in brcmf_c_preinit_dcmds()
294 eth_random_addr(ifp->mac_addr); in brcmf_c_preinit_dcmds()
295 ifp->ndev->addr_assign_type = NET_ADDR_RANDOM; in brcmf_c_preinit_dcmds()
296 err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); in brcmf_c_preinit_dcmds()
297 if (err < 0) in brcmf_c_preinit_dcmds()
302 memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); in brcmf_c_preinit_dcmds()
303 memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); in brcmf_c_preinit_dcmds()
305 bus = ifp->drvr->bus_if; in brcmf_c_preinit_dcmds()
306 ri = &ifp->drvr->revinfo; in brcmf_c_preinit_dcmds()
308 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, in brcmf_c_preinit_dcmds()
310 if (err < 0) { in brcmf_c_preinit_dcmds()
311 bphy_err(drvr, "retrieving revision info failed, %d\n", err); in brcmf_c_preinit_dcmds()
312 strscpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname)); in brcmf_c_preinit_dcmds()
314 ri->vendorid = le32_to_cpu(revinfo.vendorid); in brcmf_c_preinit_dcmds()
315 ri->deviceid = le32_to_cpu(revinfo.deviceid); in brcmf_c_preinit_dcmds()
316 ri->radiorev = le32_to_cpu(revinfo.radiorev); in brcmf_c_preinit_dcmds()
317 ri->corerev = le32_to_cpu(revinfo.corerev); in brcmf_c_preinit_dcmds()
318 ri->boardid = le32_to_cpu(revinfo.boardid); in brcmf_c_preinit_dcmds()
319 ri->boardvendor = le32_to_cpu(revinfo.boardvendor); in brcmf_c_preinit_dcmds()
320 ri->boardrev = le32_to_cpu(revinfo.boardrev); in brcmf_c_preinit_dcmds()
321 ri->driverrev = le32_to_cpu(revinfo.driverrev); in brcmf_c_preinit_dcmds()
322 ri->ucoderev = le32_to_cpu(revinfo.ucoderev); in brcmf_c_preinit_dcmds()
323 ri->bus = le32_to_cpu(revinfo.bus); in brcmf_c_preinit_dcmds()
324 ri->phytype = le32_to_cpu(revinfo.phytype); in brcmf_c_preinit_dcmds()
325 ri->phyrev = le32_to_cpu(revinfo.phyrev); in brcmf_c_preinit_dcmds()
326 ri->anarev = le32_to_cpu(revinfo.anarev); in brcmf_c_preinit_dcmds()
327 ri->chippkg = le32_to_cpu(revinfo.chippkg); in brcmf_c_preinit_dcmds()
328 ri->nvramrev = le32_to_cpu(revinfo.nvramrev); in brcmf_c_preinit_dcmds()
331 if (!bus->chip) { in brcmf_c_preinit_dcmds()
332 bus->chip = le32_to_cpu(revinfo.chipnum); in brcmf_c_preinit_dcmds()
333 bus->chiprev = le32_to_cpu(revinfo.chiprev); in brcmf_c_preinit_dcmds()
336 ri->result = err; in brcmf_c_preinit_dcmds()
338 if (bus->chip) in brcmf_c_preinit_dcmds()
339 brcmf_chip_name(bus->chip, bus->chiprev, in brcmf_c_preinit_dcmds()
340 ri->chipname, sizeof(ri->chipname)); in brcmf_c_preinit_dcmds()
343 err = brcmf_c_process_clm_blob(ifp); in brcmf_c_preinit_dcmds()
344 if (err < 0) { in brcmf_c_preinit_dcmds()
345 bphy_err(drvr, "download CLM blob file failed, %d\n", err); in brcmf_c_preinit_dcmds()
350 err = brcmf_c_process_txcap_blob(ifp); in brcmf_c_preinit_dcmds()
351 if (err < 0) { in brcmf_c_preinit_dcmds()
352 bphy_err(drvr, "download TxCap blob file failed, %d\n", err); in brcmf_c_preinit_dcmds()
357 err = brcmf_c_process_cal_blob(ifp); in brcmf_c_preinit_dcmds()
358 if (err < 0) { in brcmf_c_preinit_dcmds()
359 bphy_err(drvr, "download calibration blob file failed, %d\n", err); in brcmf_c_preinit_dcmds()
365 err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); in brcmf_c_preinit_dcmds()
366 if (err < 0) { in brcmf_c_preinit_dcmds()
368 err); in brcmf_c_preinit_dcmds()
371 buf[sizeof(buf) - 1] = '\0'; in brcmf_c_preinit_dcmds()
376 brcmf_info("Firmware: %s %s\n", ri->chipname, buf); in brcmf_c_preinit_dcmds()
384 strscpy(ifp->drvr->fwver, ptr + 1, sizeof(ifp->drvr->fwver)); in brcmf_c_preinit_dcmds()
388 err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf)); in brcmf_c_preinit_dcmds()
389 if (err) { in brcmf_c_preinit_dcmds()
390 brcmf_dbg(TRACE, "retrieving clmver failed, %d\n", err); in brcmf_c_preinit_dcmds()
392 buf[sizeof(buf) - 1] = '\0'; in brcmf_c_preinit_dcmds()
401 memcpy(ifp->drvr->clmver, clmver, sizeof(ifp->drvr->clmver)); in brcmf_c_preinit_dcmds()
407 err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); in brcmf_c_preinit_dcmds()
408 if (err) { in brcmf_c_preinit_dcmds()
416 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", fweh->event_mask, in brcmf_c_preinit_dcmds()
417 fweh->event_mask_len); in brcmf_c_preinit_dcmds()
418 if (err) { in brcmf_c_preinit_dcmds()
419 bphy_err(drvr, "Get event_msgs error (%d)\n", err); in brcmf_c_preinit_dcmds()
428 setbit(fweh->event_mask, BRCMF_E_IF); in brcmf_c_preinit_dcmds()
429 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", fweh->event_mask, in brcmf_c_preinit_dcmds()
430 fweh->event_mask_len); in brcmf_c_preinit_dcmds()
431 if (err) { in brcmf_c_preinit_dcmds()
432 bphy_err(drvr, "Set event_msgs error (%d)\n", err); in brcmf_c_preinit_dcmds()
437 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, in brcmf_c_preinit_dcmds()
439 if (err) { in brcmf_c_preinit_dcmds()
441 err); in brcmf_c_preinit_dcmds()
446 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, in brcmf_c_preinit_dcmds()
448 if (err) { in brcmf_c_preinit_dcmds()
450 err); in brcmf_c_preinit_dcmds()
457 return err; in brcmf_c_preinit_dcmds()
461 void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...) in __brcmf_err() argument
470 if (bus) in __brcmf_err()
471 dev_err(bus->dev, "%s: %pV", func, &vaf); in __brcmf_err()
504 if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) && in brcmf_mp_attach()
507 brcmfmac_pdata->fw_alternative_path, in brcmf_mp_attach()
521 brcmf_dbg(INFO, "Enter, bus=%d, chip=%d, rev=%d\n", bus_type, chip, in brcmf_get_module_param()
528 settings->p2p_enable = !!brcmf_p2p_enable; in brcmf_get_module_param()
529 settings->feature_disable = brcmf_feature_disable; in brcmf_get_module_param()
530 settings->fcmode = brcmf_fcmode; in brcmf_get_module_param()
531 settings->roamoff = !!brcmf_roamoff; in brcmf_get_module_param()
532 settings->iapp = !!brcmf_iapp_enable; in brcmf_get_module_param()
534 settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; in brcmf_get_module_param()
538 settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz; in brcmf_get_module_param()
543 for (i = 0; i < brcmfmac_pdata->device_count; i++) { in brcmf_get_module_param()
544 device_pd = &brcmfmac_pdata->devices[i]; in brcmf_get_module_param()
545 if ((device_pd->bus_type == bus_type) && in brcmf_get_module_param()
546 (device_pd->id == chip) && in brcmf_get_module_param()
547 ((device_pd->rev == chiprev) || in brcmf_get_module_param()
548 (device_pd->rev == -1))) { in brcmf_get_module_param()
550 settings->country_codes = in brcmf_get_module_param()
551 device_pd->country_codes; in brcmf_get_module_param()
552 if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO) in brcmf_get_module_param()
553 memcpy(&settings->bus.sdio, in brcmf_get_module_param()
554 &device_pd->bus.sdio, in brcmf_get_module_param()
555 sizeof(settings->bus.sdio)); in brcmf_get_module_param()
579 brcmfmac_pdata = dev_get_platdata(&pdev->dev); in brcmf_common_pd_probe()
581 if (brcmfmac_pdata->power_on) in brcmf_common_pd_probe()
582 brcmfmac_pdata->power_on(); in brcmf_common_pd_probe()
591 if (brcmfmac_pdata->power_off) in brcmf_common_pd_remove()
592 brcmfmac_pdata->power_off(); in brcmf_common_pd_remove()
604 int err; in brcmfmac_module_init() local
607 err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe); in brcmfmac_module_init()
608 if (err == -ENODEV) in brcmfmac_module_init()
615 err = brcmf_core_init(); in brcmfmac_module_init()
616 if (err) { in brcmfmac_module_init()
621 return err; in brcmfmac_module_init()