From: stsp Date: Mon, 20 Dec 2021 15:08:10 +0000 (+0000) Subject: Make iwm(4) attach to PCI devices with product ID 0x31dc. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7a10236ffdbbe6def10b389307a12c500b4573b3;p=openbsd Make iwm(4) attach to PCI devices with product ID 0x31dc. This device is part of the 9560 chip family. With a small device-specific quirk we can make iwm(4) attach and provide a working wifi interface. Problem reported and fix tested by Joao Victor. --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index ae02ad71669..ab482a8a7da 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.384 2021/12/03 12:43:17 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.385 2021/12/20 15:08:10 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -4287,7 +4287,8 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *sc) struct iwm_phy_cfg_cmd phy_cfg_cmd; enum iwm_ucode_type ucode_type = sc->sc_uc_current; - phy_cfg_cmd.phy_cfg = htole32(sc->sc_fw_phy_config); + phy_cfg_cmd.phy_cfg = htole32(sc->sc_fw_phy_config | + sc->sc_extra_phy_config); phy_cfg_cmd.calib_control.event_trigger = sc->sc_default_calib[ucode_type].event_trigger; phy_cfg_cmd.calib_control.flow_trigger = @@ -11177,6 +11178,7 @@ static const struct pci_matchid iwm_devices[] = { { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9260_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9560_1 }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9560_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9560_3 }, }; int @@ -11405,6 +11407,7 @@ iwm_attach(struct device *parent, struct device *self, void *aux) break; case PCI_PRODUCT_INTEL_WL_9560_1: case PCI_PRODUCT_INTEL_WL_9560_2: + case PCI_PRODUCT_INTEL_WL_9560_3: sc->sc_fwname = "iwm-9000-46"; sc->host_interrupt_operation_mode = 0; sc->sc_device_family = IWM_DEVICE_FAMILY_9000; @@ -11412,7 +11415,11 @@ iwm_attach(struct device *parent, struct device *self, void *aux) sc->sc_nvm_max_section_size = 32768; sc->sc_mqrx_supported = 1; sc->sc_integrated = 1; - sc->sc_xtal_latency = 650; + if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_WL_9560_3) { + sc->sc_xtal_latency = 670; + sc->sc_extra_phy_config = IWM_FW_PHY_CFG_SHARED_CLK; + } else + sc->sc_xtal_latency = 650; break; default: printf("%s: unknown adapter type\n", DEVNAME(sc)); diff --git a/sys/dev/pci/if_iwmreg.h b/sys/dev/pci/if_iwmreg.h index 59ae267a763..3188bc07ea3 100644 --- a/sys/dev/pci/if_iwmreg.h +++ b/sys/dev/pci/if_iwmreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmreg.h,v 1.65 2021/10/11 09:03:22 stsp Exp $ */ +/* $OpenBSD: if_iwmreg.h,v 1.66 2021/12/20 15:08:10 stsp Exp $ */ /****************************************************************************** * @@ -982,6 +982,7 @@ struct iwm_tlv_calib_ctrl { #define IWM_FW_PHY_CFG_TX_CHAIN (0xf << IWM_FW_PHY_CFG_TX_CHAIN_POS) #define IWM_FW_PHY_CFG_RX_CHAIN_POS 20 #define IWM_FW_PHY_CFG_RX_CHAIN (0xf << IWM_FW_PHY_CFG_RX_CHAIN_POS) +#define IWM_FW_PHY_CFG_SHARED_CLK (1U << 31) #define IWM_UCODE_MAX_CS 1 diff --git a/sys/dev/pci/if_iwmvar.h b/sys/dev/pci/if_iwmvar.h index 69b7d287148..78540603637 100644 --- a/sys/dev/pci/if_iwmvar.h +++ b/sys/dev/pci/if_iwmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmvar.h,v 1.73 2021/12/03 12:43:17 stsp Exp $ */ +/* $OpenBSD: if_iwmvar.h,v 1.74 2021/12/20 15:08:10 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh @@ -580,7 +580,8 @@ struct iwm_softc { bus_size_t sc_fwdmasegsz; size_t sc_nvm_max_section_size; struct iwm_fw_info sc_fw; - int sc_fw_phy_config; + uint32_t sc_fw_phy_config; + uint32_t sc_extra_phy_config; struct iwm_tlv_calib_ctrl sc_default_calib[IWM_UCODE_TYPE_MAX]; struct iwm_nvm_data sc_nvm;