staticint brcmf_roamoff;
module_param_named(roamoff, brcmf_roamoff, int, 0400);
MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine");
staticint brcmf_iapp_enable;
module_param_named(iapp, brcmf_iapp_enable, int, 0);
MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
/* On some boards there is no eeprom to hold the nvram, in this case instead * a board specific nvram is loaded from /lib/firmware. On most boards the * macaddr setting in the /lib/firmware nvram file is ignored because the * wifibt chip has a unique MAC programmed into the chip itself. * But in some cases the actual MAC from the /lib/firmware nvram file gets * used, leading to MAC conflicts. * The MAC addresses in the troublesome nvram files seem to all come from * the same nvram file template, so we only need to check for 1 known * address to detect this.
*/ staticconst u8 brcmf_default_mac_address[ETH_ALEN] = {
0x00, 0x90, 0x4c, 0xc5, 0x12, 0x38
};
if (is_valid_ether_addr(ifp->mac_addr)) { /* set mac address */
err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); if (err < 0) goto done;
} else { /* retrieve mac address */
err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, sizeof(ifp->mac_addr)); if (err < 0) {
bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); goto done;
}
if (ether_addr_equal_unaligned(ifp->mac_addr, brcmf_default_mac_address)) {
bphy_err(drvr, "Default MAC is used, replacing with random MAC to avoid conflicts\n");
eth_random_addr(ifp->mac_addr);
ifp->ndev->addr_assign_type = NET_ADDR_RANDOM;
err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); if (err < 0) goto done;
}
}
/* use revinfo if not known yet */ if (!bus->chip) {
bus->chip = le32_to_cpu(revinfo.chipnum);
bus->chiprev = le32_to_cpu(revinfo.chiprev);
}
}
ri->result = err;
if (bus->chip)
brcmf_chip_name(bus->chip, bus->chiprev,
ri->chipname, sizeof(ri->chipname));
/* Do any CLM downloading */
err = brcmf_c_process_clm_blob(ifp); if (err < 0) {
bphy_err(drvr, "download CLM blob file failed, %d\n", err); goto done;
}
/* Do TxCap downloading, if needed */
err = brcmf_c_process_txcap_blob(ifp); if (err < 0) {
bphy_err(drvr, "download TxCap blob file failed, %d\n", err); goto done;
}
/* Download external calibration blob, if available */
err = brcmf_c_process_cal_blob(ifp); if (err < 0) {
bphy_err(drvr, "download calibration blob file failed, %d\n", err); goto done;
}
/* query for 'ver' to get version info from firmware */
memset(buf, 0, sizeof(buf));
err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); if (err < 0) {
bphy_err(drvr, "Retrieving version information failed, %d\n",
err); goto done;
}
buf[sizeof(buf) - 1] = '\0';
ptr = (char *)buf;
strsep(&ptr, "\n");
/* Print fw version info */
brcmf_info("Firmware: %s %s\n", ri->chipname, buf);
/* locate firmware version number for ethtool */
ptr = strrchr(buf, ' '); if (!ptr) {
bphy_err(drvr, "Retrieving version number failed"); goto done;
}
strscpy(ifp->drvr->fwver, ptr + 1, sizeof(ifp->drvr->fwver));
/* Query for 'clmver' to get CLM version info from firmware */
memset(buf, 0, sizeof(buf));
err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf)); if (err) {
brcmf_dbg(TRACE, "retrieving clmver failed, %d\n", err);
} else {
buf[sizeof(buf) - 1] = '\0';
clmver = (char *)buf;
/* Replace all newline/linefeed characters with space * character
*/
strreplace(clmver, '\n', ' ');
/* store CLM version for adding it to revinfo debugfs file */
memcpy(ifp->drvr->clmver, clmver, sizeof(ifp->drvr->clmver));
brcmf_dbg(INFO, "CLM version = %s\n", clmver);
}
/* set mpc */
err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); if (err) {
bphy_err(drvr, "failed setting mpc\n"); goto done;
}
brcmf_c_set_joinpref_default(ifp);
/* Setup event_msgs, enable E_IF */
err = brcmf_fil_iovar_data_get(ifp, "event_msgs", fweh->event_mask,
fweh->event_mask_len); if (err) {
bphy_err(drvr, "Get event_msgs error (%d)\n", err); goto done;
} /* * BRCMF_E_IF can safely be used to set the appropriate bit * in the event_mask as the firmware event code is guaranteed * to match the value of BRCMF_E_IF because it is old cruft * that all vendors have.
*/
setbit(fweh->event_mask, BRCMF_E_IF);
err = brcmf_fil_iovar_data_set(ifp, "event_msgs", fweh->event_mask,
fweh->event_mask_len); if (err) {
bphy_err(drvr, "Set event_msgs error (%d)\n", err); goto done;
}
staticvoid brcmf_mp_attach(void)
{ /* If module param firmware path is set then this will always be used, * if not set then if available use the platform data version. To make * sure it gets initialized at all, always copy the module param version
*/
strscpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
BRCMF_FW_ALTPATH_LEN); if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
(brcmf_mp_global.firmware_path[0] == '\0')) {
strscpy(brcmf_mp_global.firmware_path,
brcmfmac_pdata->fw_alternative_path,
BRCMF_FW_ALTPATH_LEN);
}
}
/* start by using the module parameters */
settings->p2p_enable = !!brcmf_p2p_enable;
settings->feature_disable = brcmf_feature_disable;
settings->fcmode = brcmf_fcmode;
settings->roamoff = !!brcmf_roamoff;
settings->iapp = !!brcmf_iapp_enable; #ifdef DEBUG
settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; #endif
if (bus_type == BRCMF_BUSTYPE_SDIO)
settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz;
/* See if there is any device specific platform data configured */
found = false; if (brcmfmac_pdata) { for (i = 0; i < brcmfmac_pdata->device_count; i++) {
device_pd = &brcmfmac_pdata->devices[i]; if ((device_pd->bus_type == bus_type) &&
(device_pd->id == chip) &&
((device_pd->rev == chiprev) ||
(device_pd->rev == -1))) {
brcmf_dbg(INFO, "Platform data for device found\n");
settings->country_codes =
device_pd->country_codes; if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
memcpy(&settings->bus.sdio,
&device_pd->bus.sdio, sizeof(settings->bus.sdio));
found = true; break;
}
}
} if (!found) { /* No platform data for this device, try OF and DMI data */
brcmf_dmi_probe(settings, chip, chiprev); if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER) {
kfree(settings); return ERR_PTR(-EPROBE_DEFER);
}
brcmf_acpi_probe(dev, bus_type, settings);
} return settings;
}
staticint __init brcmfmac_module_init(void)
{ int err;
/* Get the platform data (if available) for our devices */
err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe); if (err == -ENODEV)
brcmf_dbg(INFO, "No platform data available.\n");
/* Initialize global module parameters */
brcmf_mp_attach();
/* Continue the initialization by registering the different busses */
err = brcmf_core_init(); if (err) { if (brcmfmac_pdata)
platform_driver_unregister(&brcmf_pd);
}
return err;
}
staticvoid __exit brcmfmac_module_exit(void)
{
brcmf_core_exit(); if (brcmfmac_pdata)
platform_driver_unregister(&brcmf_pd);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.