Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of intel 9560 wireless card #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59,506 changes: 59,506 additions & 0 deletions sys/contrib/dev/iwm/iwm-9000-34.fw.uu

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions sys/dev/iwm/if_iwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ iwm_read_firmware(struct iwm_softc *sc)
break;
}

case 48: /* undocumented TLV */
case IWM_UCODE_TLV_SDIO_ADMA_ADDR:
case IWM_UCODE_TLV_FW_GSCAN_CAPA:
/* ignore, not used by current driver */
Expand Down Expand Up @@ -866,8 +865,6 @@ iwm_read_firmware(struct iwm_softc *sc)
device_printf(sc->sc_dev,
"%s: unknown firmware section %d, abort\n",
__func__, tlv_type);
error = EINVAL;
goto parse_out;
}
}

Expand Down Expand Up @@ -1651,7 +1648,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t scd_base_addr)
iwm_nic_unlock(sc);

/* Enable L1-Active */
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
iwm_clear_bits_prph(sc, IWM_APMG_PCIDEV_STT_REG,
IWM_APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
}
Expand Down Expand Up @@ -2069,7 +2066,7 @@ static int
iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw,
const uint16_t *phy_sku)
{
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_SKU);

return le32_to_cpup((const uint32_t *)(phy_sku + IWM_SKU_8000));
Expand All @@ -2078,7 +2075,7 @@ iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw,
static int
iwm_get_nvm_version(const struct iwm_softc *sc, const uint16_t *nvm_sw)
{
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_NVM_VERSION);
else
return le32_to_cpup((const uint32_t *)(nvm_sw +
Expand All @@ -2089,7 +2086,7 @@ static int
iwm_get_radio_cfg(const struct iwm_softc *sc, const uint16_t *nvm_sw,
const uint16_t *phy_sku)
{
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_RADIO_CFG);

return le32_to_cpup((const uint32_t *)(phy_sku + IWM_RADIO_CFG_8000));
Expand All @@ -2100,7 +2097,7 @@ iwm_get_n_hw_addrs(const struct iwm_softc *sc, const uint16_t *nvm_sw)
{
int n_hw_addr;

if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_N_HW_ADDRS);

n_hw_addr = le32_to_cpup((const uint32_t *)(nvm_sw + IWM_N_HW_ADDRS_8000));
Expand All @@ -2112,7 +2109,7 @@ static void
iwm_set_radio_cfg(const struct iwm_softc *sc, struct iwm_nvm_data *data,
uint32_t radio_cfg)
{
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
data->radio_cfg_type = IWM_NVM_RF_CFG_TYPE_MSK(radio_cfg);
data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK(radio_cfg);
data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK(radio_cfg);
Expand All @@ -2138,7 +2135,7 @@ iwm_set_hw_address(struct iwm_softc *sc, struct iwm_nvm_data *data,
iwm_set_hw_address_from_csr(sc, data);
} else
#endif
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
const uint8_t *hw_addr = (const uint8_t *)(nvm_hw + IWM_HW_ADDR);

/* The byte order is little endian 16 bit, meaning 214365 */
Expand Down Expand Up @@ -2170,7 +2167,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
uint32_t sku, radio_cfg;
uint16_t lar_config;

if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
data = malloc(sizeof(*data) +
IWM_NUM_CHANNELS * sizeof(uint16_t),
M_DEVBUF, M_NOWAIT | M_ZERO);
Expand All @@ -2194,7 +2191,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc,

data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw);

if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { /* TODO: use IWL_NVM_EXT */
uint16_t lar_offset = data->nvm_version < 0xE39 ?
IWM_NVM_LAR_OFFSET_8000_OLD :
IWM_NVM_LAR_OFFSET_8000;
Expand Down Expand Up @@ -2241,7 +2238,7 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iwm_nvm_section *sections)
"Can't parse empty OTP/NVM sections\n");
return NULL;
}
} else if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
} else if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) {
/* SW and REGULATORY sections are mandatory */
if (!sections[IWM_NVM_SECTION_TYPE_SW].data ||
!sections[IWM_NVM_SECTION_TYPE_REGULATORY].data) {
Expand Down Expand Up @@ -2602,6 +2599,7 @@ iwm_pcie_load_given_ucode_8000(struct iwm_softc *sc,
IWM_DPRINTF(sc, IWM_DEBUG_RESET, "working with %s CPU\n",
image->is_dual_cpus ? "Dual" : "Single");

iwm_write_prph(sc, IWM_WFPM_GP2, 0x01010101);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's @wjguo just try to port from iwlwifi.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* configure the ucode to be ready to get the secured image */
/* release CPU reset */
if (iwm_nic_lock(sc)) {
Expand Down Expand Up @@ -2677,7 +2675,7 @@ iwm_start_fw(struct iwm_softc *sc, const struct iwm_fw_img *fw)
IWM_WRITE(sc, IWM_CSR_UCODE_DRV_GP1_CLR, IWM_CSR_UCODE_SW_BIT_RFKILL);

/* Load the given image to the HW */
if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000)
ret = iwm_pcie_load_given_ucode_8000(sc, fw);
else
ret = iwm_pcie_load_given_ucode(sc, fw);
Expand Down Expand Up @@ -2828,7 +2826,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc,
IWM_MVM_UCODE_ALIVE_TIMEOUT);
IWM_LOCK(sc);
if (error) {
if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) {
uint32_t a = 0x5a5a5a5a, b = 0x5a5a5a5a;
if (iwm_nic_lock(sc)) {
a = iwm_read_prph(sc, IWM_SB_CPU_1_STATUS);
Expand Down Expand Up @@ -2929,12 +2927,13 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm)
IEEE80211_ADDR_COPY(sc->sc_ic.ic_macaddr, sc->nvm_data->hw_addr);
goto error;
}

ret = iwm_send_bt_init_conf(sc);
if (ret) {
device_printf(sc->sc_dev,
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
ret = iwm_send_bt_init_conf(sc);
if (ret) {
device_printf(sc->sc_dev,
"failed to send bt coex configuration: %d\n", ret);
goto error;
goto error;
}
}

/* Send TX valid antennas before triggering calibrations */
Expand Down Expand Up @@ -4459,7 +4458,7 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc)
* Enable LAR only if it is supported by the FW (TLV) &&
* enabled in the NVM
*/
if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000)
return nvm_lar && tlv_lar;
else
return tlv_lar;
Expand Down Expand Up @@ -5626,6 +5625,7 @@ iwm_intr(void *arg)
#define PCI_PRODUCT_INTEL_WL_8260_1 0x24f3
#define PCI_PRODUCT_INTEL_WL_8260_2 0x24f4
#define PCI_PRODUCT_INTEL_WL_8265_1 0x24fd
#define PCI_PRODUCT_INTEL_WL_9560_1 0x9df0

static const struct iwm_devices {
uint16_t device;
Expand All @@ -5643,6 +5643,7 @@ static const struct iwm_devices {
{ PCI_PRODUCT_INTEL_WL_8260_1, &iwm8260_cfg },
{ PCI_PRODUCT_INTEL_WL_8260_2, &iwm8260_cfg },
{ PCI_PRODUCT_INTEL_WL_8265_1, &iwm8265_cfg },
{ PCI_PRODUCT_INTEL_WL_9560_1, &iwm9560_cfg },
};

static int
Expand Down Expand Up @@ -5809,7 +5810,7 @@ iwm_attach(device_t dev)
* "dash" value). To keep hw_rev backwards compatible - we'll store it
* in the old format.
*/
if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) {
int ret;
uint32_t hw_step;

Expand Down
95 changes: 95 additions & 0 deletions sys/dev/iwm/if_iwm_9000.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*-
* Based on BSD-licensed source modules in the Linux iwlwifi driver,
* which were used as the reference documentation for this implementation.
*
******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* Contact Information:
* Intel Linux Wireless <linuxwifi@intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include "opt_wlan.h"
#include "opt_iwm.h"

#include <sys/param.h>

#include "if_iwm_config.h"

#define IWM9000_FW "iwm9000fw"

#define IWM_NVM_HW_SECTION_NUM_FAMILY_9000 10

#define IWM_DEVICE_9000_COMMON \
.device_family = IWM_DEVICE_FAMILY_9000, \
.eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000, \
.nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_9000

const struct iwm_cfg iwm9560_cfg = {
.name = "Intel(R) Dual Band Wireless AC 9560",
.fw_name = IWM9000_FW,
IWM_DEVICE_9000_COMMON,
.host_interrupt_operation_mode = 0,
};
2 changes: 2 additions & 0 deletions sys/dev/iwm/if_iwm_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ enum iwm_device_family {
IWM_DEVICE_FAMILY_UNDEFINED,
IWM_DEVICE_FAMILY_7000,
IWM_DEVICE_FAMILY_8000,
IWM_DEVICE_FAMILY_9000,
};

#define IWM_DEFAULT_MAX_TX_POWER 22
Expand Down Expand Up @@ -135,5 +136,6 @@ extern const struct iwm_cfg iwm7265_cfg;
extern const struct iwm_cfg iwm7265d_cfg;
extern const struct iwm_cfg iwm8260_cfg;
extern const struct iwm_cfg iwm8265_cfg;
extern const struct iwm_cfg iwm9560_cfg;

#endif /* __IWM_CONFIG_H__ */
4 changes: 2 additions & 2 deletions sys/dev/iwm/if_iwm_pcie_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ iwm_nic_lock(struct iwm_softc *sc)
IWM_SETBITS(sc, IWM_CSR_GP_CNTRL,
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);

if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000)
if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000)
DELAY(2);

if (iwm_poll_bit(sc, IWM_CSR_GP_CNTRL,
Expand Down Expand Up @@ -454,7 +454,7 @@ iwm_apm_init(struct iwm_softc *sc)
IWM_DPRINTF(sc, IWM_DEBUG_RESET, "iwm apm start\n");

/* Disable L0S exit timer (platform NMI Work/Around) */
if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
IWM_SETBITS(sc, IWM_CSR_GIO_CHICKEN_BITS,
IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
}
Expand Down
1 change: 1 addition & 0 deletions sys/dev/iwm/if_iwmreg.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ enum iwm_secure_boot_status_reg {
#define IWM_WFPM_PS_CTL_CLR 0xa0300c
#define IWM_WFMP_MAC_ADDR_0 0xa03080
#define IWM_WFMP_MAC_ADDR_1 0xa03084
#define IWM_WFPM_GP2 0xa030B4
#define IWM_LMPM_PMG_EN 0xa01cec
#define IWM_RADIO_REG_SYS_MANUAL_DFT_0 0xad4078
#define IWM_RFIC_REG_RD 0xad0470
Expand Down
3 changes: 2 additions & 1 deletion sys/modules/iwm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ KMOD= if_iwm
SRCS= if_iwm.c if_iwm_binding.c if_iwm_util.c if_iwm_phy_db.c
SRCS+= if_iwm_mac_ctxt.c if_iwm_phy_ctxt.c if_iwm_time_event.c
SRCS+= if_iwm_power.c if_iwm_scan.c if_iwm_led.c if_iwm_notif_wait.c
SRCS+= if_iwm_7000.c if_iwm_8000.c if_iwm_fw.c if_iwm_sta.c if_iwm_sf.c
SRCS+= if_iwm_7000.c if_iwm_8000.c if_iwm_9000.c if_iwm_fw.c
SRCS+= if_iwm_sta.c if_iwm_sf.c
# bus layer
SRCS+= if_iwm_pcie_trans.c
SRCS+= device_if.h bus_if.h pci_if.h opt_wlan.h opt_iwm.h
Expand Down
3 changes: 2 additions & 1 deletion sys/modules/iwmfw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SUBDIR= iwm3160fw \
iwm7265fw \
iwm7265Dfw \
iwm8000Cfw \
iwm8265fw
iwm8265fw \
iwm9000fw

.include <bsd.subdir.mk>
6 changes: 6 additions & 0 deletions sys/modules/iwmfw/iwm9000fw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# $FreeBSD$

KMOD= iwm9000fw
IMG= iwm-9000-34

.include <bsd.kmod.mk>