Lines Matching refs:wl
661 static int wl18xx_identify_chip(struct wl1271 *wl) in wl18xx_identify_chip() argument
665 switch (wl->chip.id) { in wl18xx_identify_chip()
668 wl->chip.id); in wl18xx_identify_chip()
669 wl->sr_fw_name = WL18XX_FW_NAME; in wl18xx_identify_chip()
671 wl->plt_fw_name = WL18XX_FW_NAME; in wl18xx_identify_chip()
672 wl->quirks |= WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | in wl18xx_identify_chip()
679 wlcore_set_min_fw_ver(wl, WL18XX_CHIP_VER, in wl18xx_identify_chip()
687 wl->chip.id); in wl18xx_identify_chip()
692 wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); in wl18xx_identify_chip()
697 wl->fw_mem_block_size = 272; in wl18xx_identify_chip()
698 wl->fwlog_end = 0x40000000; in wl18xx_identify_chip()
700 wl->scan_templ_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4; in wl18xx_identify_chip()
701 wl->scan_templ_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; in wl18xx_identify_chip()
702 wl->sched_scan_templ_id_2_4 = CMD_TEMPL_PROBE_REQ_2_4_PERIODIC; in wl18xx_identify_chip()
703 wl->sched_scan_templ_id_5 = CMD_TEMPL_PROBE_REQ_5_PERIODIC; in wl18xx_identify_chip()
704 wl->max_channels_5 = WL18XX_MAX_CHANNELS_5GHZ; in wl18xx_identify_chip()
705 wl->ba_rx_session_count_max = WL18XX_RX_BA_MAX_SESSIONS; in wl18xx_identify_chip()
710 static int wl18xx_set_clk(struct wl1271 *wl) in wl18xx_set_clk() argument
715 ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); in wl18xx_set_clk()
721 ret = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT, &clk_freq); in wl18xx_set_clk()
731 ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_N, in wl18xx_set_clk()
736 ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_M, in wl18xx_set_clk()
742 ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_SWALLOW_EN, in wl18xx_set_clk()
747 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, in wl18xx_set_clk()
752 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, in wl18xx_set_clk()
759 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1, in wl18xx_set_clk()
766 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2, in wl18xx_set_clk()
773 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1, in wl18xx_set_clk()
780 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2, in wl18xx_set_clk()
786 ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, in wl18xx_set_clk()
793 ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_SEL, in wl18xx_set_clk()
799 ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_EN, PLLSH_WL_PLL_EN_VAL1); in wl18xx_set_clk()
806 ret = wl18xx_top_reg_write(wl, PLLSH_WL_PLL_EN, PLLSH_WL_PLL_EN_VAL2); in wl18xx_set_clk()
811 ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_SWALLOW_EN, in wl18xx_set_clk()
818 static int wl18xx_boot_soft_reset(struct wl1271 *wl) in wl18xx_boot_soft_reset() argument
823 ret = wlcore_write32(wl, WL18XX_ENABLE, 0x0); in wl18xx_boot_soft_reset()
828 ret = wlcore_write32(wl, WL18XX_SPARE_A2, 0xffff); in wl18xx_boot_soft_reset()
834 static int wl18xx_pre_boot(struct wl1271 *wl) in wl18xx_pre_boot() argument
838 ret = wl18xx_set_clk(wl); in wl18xx_pre_boot()
843 ret = wlcore_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); in wl18xx_pre_boot()
849 ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); in wl18xx_pre_boot()
854 ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); in wl18xx_pre_boot()
858 ret = wl18xx_boot_soft_reset(wl); in wl18xx_pre_boot()
864 static int wl18xx_pre_upload(struct wl1271 *wl) in wl18xx_pre_upload() argument
873 ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); in wl18xx_pre_upload()
878 ret = wlcore_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND); in wl18xx_pre_upload()
882 ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); in wl18xx_pre_upload()
888 ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); in wl18xx_pre_upload()
899 ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); in wl18xx_pre_upload()
904 ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, in wl18xx_pre_upload()
910 ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, in wl18xx_pre_upload()
916 ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, in wl18xx_pre_upload()
921 ret = irq_get_trigger_type(wl->irq); in wl18xx_pre_upload()
924 ret = wlcore_set_partition(wl, in wl18xx_pre_upload()
925 &wl->ptable[PART_TOP_PRCM_ELP_SOC]); in wl18xx_pre_upload()
929 ret = wl18xx_top_reg_read(wl, TOP_FN0_CCCR_REG_32, &irq_invert); in wl18xx_pre_upload()
934 ret = wl18xx_top_reg_write(wl, TOP_FN0_CCCR_REG_32, irq_invert); in wl18xx_pre_upload()
938 ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); in wl18xx_pre_upload()
945 static int wl18xx_set_mac_and_phy(struct wl1271 *wl) in wl18xx_set_mac_and_phy() argument
947 struct wl18xx_priv *priv = wl->priv; in wl18xx_set_mac_and_phy()
957 ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); in wl18xx_set_mac_and_phy()
961 ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, params, in wl18xx_set_mac_and_phy()
969 static int wl18xx_enable_interrupts(struct wl1271 *wl) in wl18xx_enable_interrupts() argument
977 ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask); in wl18xx_enable_interrupts()
981 wlcore_enable_interrupts(wl); in wl18xx_enable_interrupts()
983 ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, in wl18xx_enable_interrupts()
991 wlcore_disable_interrupts(wl); in wl18xx_enable_interrupts()
997 static int wl18xx_boot(struct wl1271 *wl) in wl18xx_boot() argument
1001 ret = wl18xx_pre_boot(wl); in wl18xx_boot()
1005 ret = wl18xx_pre_upload(wl); in wl18xx_boot()
1009 ret = wlcore_boot_upload_firmware(wl); in wl18xx_boot()
1013 ret = wl18xx_set_mac_and_phy(wl); in wl18xx_boot()
1017 wl->event_mask = BSS_LOSS_EVENT_ID | in wl18xx_boot()
1036 wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; in wl18xx_boot()
1038 ret = wlcore_boot_run_firmware(wl); in wl18xx_boot()
1042 ret = wl18xx_enable_interrupts(wl); in wl18xx_boot()
1048 static int wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, in wl18xx_trigger_cmd() argument
1051 struct wl18xx_priv *priv = wl->priv; in wl18xx_trigger_cmd()
1056 return wlcore_write(wl, cmd_box_addr, priv->cmd_buf, in wl18xx_trigger_cmd()
1060 static int wl18xx_ack_event(struct wl1271 *wl) in wl18xx_ack_event() argument
1062 return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, in wl18xx_ack_event()
1066 static u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) in wl18xx_calc_tx_blocks() argument
1073 wl18xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, in wl18xx_set_tx_desc_blocks() argument
1080 wl18xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, in wl18xx_set_tx_desc_data_len() argument
1086 if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) in wl18xx_set_tx_desc_data_len()
1099 wl18xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) in wl18xx_get_rx_buf_align() argument
1107 static u32 wl18xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, in wl18xx_get_rx_packet_len() argument
1119 static void wl18xx_tx_immediate_completion(struct wl1271 *wl) in wl18xx_tx_immediate_completion() argument
1121 wl18xx_tx_immediate_complete(wl); in wl18xx_tx_immediate_completion()
1124 static int wl18xx_set_host_cfg_bitmap(struct wl1271 *wl, u32 extra_mem_blk) in wl18xx_set_host_cfg_bitmap() argument
1132 if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) { in wl18xx_set_host_cfg_bitmap()
1138 if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) { in wl18xx_set_host_cfg_bitmap()
1143 ret = wl18xx_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap, in wl18xx_set_host_cfg_bitmap()
1152 static int wl18xx_hw_init(struct wl1271 *wl) in wl18xx_hw_init() argument
1155 struct wl18xx_priv *priv = wl->priv; in wl18xx_hw_init()
1162 ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE); in wl18xx_hw_init()
1167 ret = wl18xx_acx_dynamic_fw_traces(wl); in wl18xx_hw_init()
1172 ret = wl18xx_acx_set_checksum_state(wl); in wl18xx_hw_init()
1180 static void wl18xx_convert_fw_status(struct wl1271 *wl, void *raw_fw_status, in wl18xx_convert_fw_status() argument
1217 static void wl18xx_set_tx_desc_csum(struct wl1271 *wl, in wl18xx_set_tx_desc_csum() argument
1247 static void wl18xx_set_rx_csum(struct wl1271 *wl, in wl18xx_set_rx_csum() argument
1255 static bool wl18xx_is_mimo_supported(struct wl1271 *wl) in wl18xx_is_mimo_supported() argument
1257 struct wl18xx_priv *priv = wl->priv; in wl18xx_is_mimo_supported()
1271 static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl, in wl18xx_sta_get_ap_rate_mask() argument
1283 } else if (wl18xx_is_mimo_supported(wl)) { in wl18xx_sta_get_ap_rate_mask()
1291 static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl, in wl18xx_ap_get_mimo_wide_rate_mask() argument
1303 } else if (wl18xx_is_mimo_supported(wl) && in wl18xx_ap_get_mimo_wide_rate_mask()
1342 static int wl18xx_get_pg_ver(struct wl1271 *wl, s8 *ver) in wl18xx_get_pg_ver() argument
1348 ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); in wl18xx_get_pg_ver()
1352 ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_2_3, &fuse); in wl18xx_get_pg_ver()
1358 ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_1_3, &fuse); in wl18xx_get_pg_ver()
1372 ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_2_3, &fuse); in wl18xx_get_pg_ver()
1384 ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); in wl18xx_get_pg_ver()
1438 static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) in wl18xx_conf_init() argument
1440 struct platform_device *pdev = wl->pdev; in wl18xx_conf_init()
1442 struct wl18xx_priv *priv = wl->priv; in wl18xx_conf_init()
1444 if (wl18xx_load_conf_file(dev, &wl->conf, &priv->conf, in wl18xx_conf_init()
1449 memcpy(&wl->conf, &wl18xx_conf, sizeof(wl->conf)); in wl18xx_conf_init()
1458 static int wl18xx_plt_init(struct wl1271 *wl) in wl18xx_plt_init() argument
1463 if (wl->plt_mode == PLT_FEM_DETECT) { in wl18xx_plt_init()
1468 ret = wlcore_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT); in wl18xx_plt_init()
1472 return wl->ops->boot(wl); in wl18xx_plt_init()
1475 static int wl18xx_get_mac(struct wl1271 *wl) in wl18xx_get_mac() argument
1480 ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); in wl18xx_get_mac()
1484 ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1, &mac1); in wl18xx_get_mac()
1488 ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2, &mac2); in wl18xx_get_mac()
1493 wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + in wl18xx_get_mac()
1495 wl->fuse_nic_addr = (mac1 & 0xffffff); in wl18xx_get_mac()
1497 if (!wl->fuse_oui_addr && !wl->fuse_nic_addr) { in wl18xx_get_mac()
1502 wl->fuse_oui_addr = (mac[0] << 16) + (mac[1] << 8) + mac[2]; in wl18xx_get_mac()
1503 wl->fuse_nic_addr = (mac[3] << 16) + (mac[4] << 8) + mac[5]; in wl18xx_get_mac()
1507 ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); in wl18xx_get_mac()
1513 static int wl18xx_handle_static_data(struct wl1271 *wl, in wl18xx_handle_static_data() argument
1519 strncpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, in wl18xx_handle_static_data()
1520 sizeof(wl->chip.phy_fw_ver_str)); in wl18xx_handle_static_data()
1523 wl->chip.phy_fw_ver_str[sizeof(wl->chip.phy_fw_ver_str) - 1] = '\0'; in wl18xx_handle_static_data()
1530 static int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) in wl18xx_get_spare_blocks() argument
1532 struct wl18xx_priv *priv = wl->priv; in wl18xx_get_spare_blocks()
1541 static int wl18xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, in wl18xx_set_key() argument
1546 struct wl18xx_priv *priv = wl->priv; in wl18xx_set_key()
1556 ret = wlcore_set_key(wl, cmd, vif, sta, key_conf); in wl18xx_set_key()
1584 ret = wl18xx_set_host_cfg_bitmap(wl, in wl18xx_set_key()
1587 ret = wl18xx_set_host_cfg_bitmap(wl, in wl18xx_set_key()
1594 static u32 wl18xx_pre_pkt_send(struct wl1271 *wl, in wl18xx_pre_pkt_send() argument
1597 if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) { in wl18xx_pre_pkt_send()
1601 last_desc = (struct wl1271_tx_hw_descr *)(wl->aggr_buf + in wl18xx_pre_pkt_send()
1613 static void wl18xx_sta_rc_update(struct wl1271 *wl, in wl18xx_sta_rc_update() argument
1634 wl18xx_acx_peer_ht_operation_mode(wl, wlvif->sta.hlid, wide); in wl18xx_sta_rc_update()
1639 static int wl18xx_set_peer_cap(struct wl1271 *wl, in wl18xx_set_peer_cap() argument
1644 return wl18xx_acx_set_peer_cap(wl, ht_cap, allow_ht_operation, in wl18xx_set_peer_cap()
1648 static bool wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, in wl18xx_lnk_high_prio() argument
1653 (struct wl18xx_fw_status_priv *)wl->fw_status->priv; in wl18xx_lnk_high_prio()
1666 if (test_bit(hlid, &wl->fw_fast_lnk_map) && in wl18xx_lnk_high_prio()
1667 !test_bit(hlid, &wl->ap_fw_ps_map)) in wl18xx_lnk_high_prio()
1675 static bool wl18xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, in wl18xx_lnk_low_prio() argument
1680 (struct wl18xx_fw_status_priv *)wl->fw_status->priv; in wl18xx_lnk_low_prio()
1690 else if (test_bit(hlid, &wl->fw_fast_lnk_map) && in wl18xx_lnk_low_prio()
1691 !test_bit(hlid, &wl->ap_fw_ps_map)) in wl18xx_lnk_low_prio()
1699 static u32 wl18xx_convert_hwaddr(struct wl1271 *wl, u32 hwaddr) in wl18xx_convert_hwaddr() argument
1704 static int wl18xx_setup(struct wl1271 *wl);
1870 static int wl18xx_setup(struct wl1271 *wl) in wl18xx_setup() argument
1872 struct wl18xx_priv *priv = wl->priv; in wl18xx_setup()
1879 wl->rtable = wl18xx_rtable; in wl18xx_setup()
1880 wl->num_tx_desc = WL18XX_NUM_TX_DESCRIPTORS; in wl18xx_setup()
1881 wl->num_rx_desc = WL18XX_NUM_RX_DESCRIPTORS; in wl18xx_setup()
1882 wl->num_links = WL18XX_MAX_LINKS; in wl18xx_setup()
1883 wl->max_ap_stations = WL18XX_MAX_AP_STATIONS; in wl18xx_setup()
1884 wl->iface_combinations = wl18xx_iface_combinations; in wl18xx_setup()
1885 wl->n_iface_combinations = ARRAY_SIZE(wl18xx_iface_combinations); in wl18xx_setup()
1886 wl->num_mac_addr = WL18XX_NUM_MAC_ADDRESSES; in wl18xx_setup()
1887 wl->band_rate_to_idx = wl18xx_band_rate_to_idx; in wl18xx_setup()
1888 wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; in wl18xx_setup()
1889 wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; in wl18xx_setup()
1890 wl->fw_status_len = sizeof(struct wl18xx_fw_status); in wl18xx_setup()
1891 wl->fw_status_priv_len = sizeof(struct wl18xx_fw_status_priv); in wl18xx_setup()
1892 wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics); in wl18xx_setup()
1893 wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv); in wl18xx_setup()
1896 wl->num_rx_desc = num_rx_desc_param; in wl18xx_setup()
1898 ret = wl18xx_conf_init(wl, wl->dev); in wl18xx_setup()
1965 if (wl18xx_is_mimo_supported(wl)) in wl18xx_setup()
1966 wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, in wl18xx_setup()
1969 wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, in wl18xx_setup()
1973 wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, in wl18xx_setup()
1976 wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, in wl18xx_setup()
1978 wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, in wl18xx_setup()
1981 wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, in wl18xx_setup()
1983 wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, in wl18xx_setup()
1993 wl->enable_11a = (priv->conf.phy.number_of_assembled_ant5 != 0); in wl18xx_setup()
2000 struct wl1271 *wl; in wl18xx_probe() local
2013 wl = hw->priv; in wl18xx_probe()
2014 wl->ops = &wl18xx_ops; in wl18xx_probe()
2015 wl->ptable = wl18xx_ptable; in wl18xx_probe()
2016 ret = wlcore_probe(wl, pdev); in wl18xx_probe()
2023 wlcore_free_hw(wl); in wl18xx_probe()