void brcmf_dev_reset(struct device *dev) { struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_pub *drvr = bus_if->drvr; if (drvr == NULL) return; if (drvr->iflist[0]) brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1); }
int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) { s8 eventmask[BRCMF_EVENTING_MASK_LEN]; u8 buf[BRCMF_DCMD_SMLEN]; struct brcmf_rev_info_le revinfo; struct brcmf_rev_info *ri; char *ptr; s32 err; /* retreive mac address */ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, sizeof(ifp->mac_addr)); if (err < 0) { brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); goto done; } memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, &revinfo, sizeof(revinfo)); ri = &ifp->drvr->revinfo; if (err < 0) { brcmf_err("retrieving revision info failed, %d\n", err); } else { ri->vendorid = le32_to_cpu(revinfo.vendorid); ri->deviceid = le32_to_cpu(revinfo.deviceid); ri->radiorev = le32_to_cpu(revinfo.radiorev); ri->chiprev = le32_to_cpu(revinfo.chiprev); ri->corerev = le32_to_cpu(revinfo.corerev); ri->boardid = le32_to_cpu(revinfo.boardid); ri->boardvendor = le32_to_cpu(revinfo.boardvendor); ri->boardrev = le32_to_cpu(revinfo.boardrev); ri->driverrev = le32_to_cpu(revinfo.driverrev); ri->ucoderev = le32_to_cpu(revinfo.ucoderev); ri->bus = le32_to_cpu(revinfo.bus); ri->chipnum = le32_to_cpu(revinfo.chipnum); ri->phytype = le32_to_cpu(revinfo.phytype); ri->phyrev = le32_to_cpu(revinfo.phyrev); ri->anarev = le32_to_cpu(revinfo.anarev); ri->chippkg = le32_to_cpu(revinfo.chippkg); ri->nvramrev = le32_to_cpu(revinfo.nvramrev); } ri->result = err; /* query for 'ver' to get version info from firmware */ memset(buf, 0, sizeof(buf)); strcpy(buf, "ver"); err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); if (err < 0) { brcmf_err("Retreiving version information failed, %d\n", err); goto done; } ptr = (char *)buf; strsep(&ptr, "\n"); /* Print fw version info */ brcmf_err("Firmware version = %s\n", buf); /* locate firmware version number for ethtool */ ptr = strrchr(buf, ' ') + 1; strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver)); /* set mpc */ err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); if (err) { brcmf_err("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", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { brcmf_err("Get event_msgs error (%d)\n", err); goto done; } setbit(eventmask, BRCMF_E_IF); err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { brcmf_err("Set event_msgs error (%d)\n", err); goto done; } /* Setup default scan channel time */ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, BRCMF_DEFAULT_SCAN_CHANNEL_TIME); if (err) { brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", err); goto done; } /* Setup default scan unassoc time */ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, BRCMF_DEFAULT_SCAN_UNASSOC_TIME); if (err) { brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", err); goto done; } /* Enable tx beamforming, errors can be ignored (not supported) */ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1); /* do bus specific preinit here */ err = brcmf_bus_preinit(ifp->drvr->bus_if); done: return err; }
static void _brcmf_set_multicast_list(struct work_struct *work) { struct brcmf_if *ifp; struct net_device *ndev; struct netdev_hw_addr *ha; u32 cmd_value, cnt; __le32 cnt_le; char *buf, *bufp; u32 buflen; s32 err; ifp = container_of(work, struct brcmf_if, multicast_work); brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); ndev = ifp->ndev; /* Determine initial value of allmulti flag */ cmd_value = (ndev->flags & IFF_ALLMULTI) ? true : false; /* Send down the multicast list first. */ cnt = netdev_mc_count(ndev); buflen = sizeof(cnt) + (cnt * ETH_ALEN); buf = kmalloc(buflen, GFP_ATOMIC); if (!buf) return; bufp = buf; cnt_le = cpu_to_le32(cnt); memcpy(bufp, &cnt_le, sizeof(cnt_le)); bufp += sizeof(cnt_le); netdev_for_each_mc_addr(ha, ndev) { if (!cnt) break; memcpy(bufp, ha->addr, ETH_ALEN); bufp += ETH_ALEN; cnt--; } err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); if (err < 0) { brcmf_err("Setting mcast_list failed, %d\n", err); cmd_value = cnt ? true : cmd_value; } kfree(buf); /* * Now send the allmulti setting. This is based on the setting in the * net_device flags, but might be modified above to be turned on if we * were trying to set some addresses and dongle rejected it... */ err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); if (err < 0) brcmf_err("Setting allmulti failed, %d\n", err); /*Finally, pick up the PROMISC flag */ cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); if (err < 0) brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", err); }
int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) { s8 eventmask[BRCMF_EVENTING_MASK_LEN]; u8 buf[BRCMF_DCMD_SMLEN]; struct brcmf_join_pref_params join_pref_params[2]; char *ptr; s32 err; /* retreive mac address */ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, sizeof(ifp->mac_addr)); if (err < 0) { brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); goto done; } memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); /* query for 'ver' to get version info from firmware */ memset(buf, 0, sizeof(buf)); strcpy(buf, "ver"); err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); if (err < 0) { brcmf_err("Retreiving version information failed, %d\n", err); goto done; } ptr = (char *)buf; strsep(&ptr, "\n"); /* Print fw version info */ brcmf_err("Firmware version = %s\n", buf); /* locate firmware version number for ethtool */ ptr = strrchr(buf, ' ') + 1; strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver)); /* set mpc */ err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); if (err) { brcmf_err("failed setting mpc\n"); goto done; } /* * Setup timeout if Beacons are lost and roam is off to report * link down */ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", BRCMF_DEFAULT_BCN_TIMEOUT); if (err) { brcmf_err("bcn_timeout error (%d)\n", err); goto done; } /* Enable/Disable build-in roaming to allowed ext supplicant to take * of romaing */ err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1); if (err) { brcmf_err("roam_off error (%d)\n", err); goto done; } /* Setup join_pref to select target by RSSI(with boost on 5GHz) */ join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA; join_pref_params[0].len = 2; join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST; join_pref_params[0].band = WLC_BAND_5G; join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI; join_pref_params[1].len = 2; join_pref_params[1].rssi_gain = 0; join_pref_params[1].band = 0; err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, sizeof(join_pref_params)); if (err) brcmf_err("Set join_pref error (%d)\n", err); /* Setup event_msgs, enable E_IF */ err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { brcmf_err("Get event_msgs error (%d)\n", err); goto done; } setbit(eventmask, BRCMF_E_IF); err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN); if (err) { brcmf_err("Set event_msgs error (%d)\n", err); goto done; } /* Setup default scan channel time */ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, BRCMF_DEFAULT_SCAN_CHANNEL_TIME); if (err) { brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", err); goto done; } /* Setup default scan unassoc time */ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, BRCMF_DEFAULT_SCAN_UNASSOC_TIME); if (err) { brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", err); goto done; } /* Setup packet filter */ brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, 0, true); /* do bus specific preinit here */ err = brcmf_bus_preinit(ifp->drvr->bus_if); done: return err; }