iwlwifi: deliver hw version in both string and u32 format
Add function to get hw version in both strind and u32 format Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
This commit is contained in:
parent
7428994d79
commit
62e731695d
4 changed files with 23 additions and 7 deletions
|
@ -122,7 +122,8 @@ struct iwl_bus;
|
||||||
* struct iwl_bus_ops - bus specific operations
|
* struct iwl_bus_ops - bus specific operations
|
||||||
* @get_pm_support: must returns true if the bus can go to sleep
|
* @get_pm_support: must returns true if the bus can go to sleep
|
||||||
* @apm_config: will be called during the config of the APM
|
* @apm_config: will be called during the config of the APM
|
||||||
* @get_hw_id: prints the hw_id in the provided buffer
|
* @get_hw_id_string: prints the hw_id in the provided buffer
|
||||||
|
* @get_hw_id: get hw_id in u32
|
||||||
* @write8: write a byte to register at offset ofs
|
* @write8: write a byte to register at offset ofs
|
||||||
* @write32: write a dword to register at offset ofs
|
* @write32: write a dword to register at offset ofs
|
||||||
* @wread32: read a dword at register at offset ofs
|
* @wread32: read a dword at register at offset ofs
|
||||||
|
@ -130,7 +131,8 @@ struct iwl_bus;
|
||||||
struct iwl_bus_ops {
|
struct iwl_bus_ops {
|
||||||
bool (*get_pm_support)(struct iwl_bus *bus);
|
bool (*get_pm_support)(struct iwl_bus *bus);
|
||||||
void (*apm_config)(struct iwl_bus *bus);
|
void (*apm_config)(struct iwl_bus *bus);
|
||||||
void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
|
void (*get_hw_id_string)(struct iwl_bus *bus, char buf[], int buf_len);
|
||||||
|
u32 (*get_hw_id)(struct iwl_bus *bus);
|
||||||
void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
|
void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
|
||||||
void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
|
void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
|
||||||
u32 (*read32)(struct iwl_bus *bus, u32 ofs);
|
u32 (*read32)(struct iwl_bus *bus, u32 ofs);
|
||||||
|
@ -172,9 +174,15 @@ static inline void bus_apm_config(struct iwl_bus *bus)
|
||||||
bus->ops->apm_config(bus);
|
bus->ops->apm_config(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bus_get_hw_id(struct iwl_bus *bus, char buf[], int buf_len)
|
static inline void bus_get_hw_id_string(struct iwl_bus *bus, char buf[],
|
||||||
|
int buf_len)
|
||||||
{
|
{
|
||||||
bus->ops->get_hw_id(bus, buf, buf_len);
|
bus->ops->get_hw_id_string(bus, buf, buf_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 bus_get_hw_id(struct iwl_bus *bus)
|
||||||
|
{
|
||||||
|
return bus->ops->get_hw_id(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bus_write8(struct iwl_bus *bus, u32 ofs, u8 val)
|
static inline void bus_write8(struct iwl_bus *bus, u32 ofs, u8 val)
|
||||||
|
|
|
@ -204,7 +204,7 @@ int iwl_init_geos(struct iwl_priv *priv)
|
||||||
if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
|
if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
|
||||||
cfg(priv)->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
|
cfg(priv)->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
bus_get_hw_id(bus(priv), buf, sizeof(buf));
|
bus_get_hw_id_string(bus(priv), buf, sizeof(buf));
|
||||||
IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
|
IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
|
||||||
"Please send your %s to maintainer.\n", buf);
|
"Please send your %s to maintainer.\n", buf);
|
||||||
cfg(priv)->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
|
cfg(priv)->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
|
||||||
|
|
|
@ -135,7 +135,7 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
|
static void iwl_pci_get_hw_id_string(struct iwl_bus *bus, char buf[],
|
||||||
int buf_len)
|
int buf_len)
|
||||||
{
|
{
|
||||||
struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
|
struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
|
||||||
|
@ -144,6 +144,13 @@ static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
|
||||||
pci_dev->subsystem_device);
|
pci_dev->subsystem_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)
|
||||||
|
{
|
||||||
|
struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
|
||||||
|
|
||||||
|
return (pci_dev->device << 16) + pci_dev->subsystem_device;
|
||||||
|
}
|
||||||
|
|
||||||
static void iwl_pci_write8(struct iwl_bus *bus, u32 ofs, u8 val)
|
static void iwl_pci_write8(struct iwl_bus *bus, u32 ofs, u8 val)
|
||||||
{
|
{
|
||||||
iowrite8(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs);
|
iowrite8(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs);
|
||||||
|
@ -163,6 +170,7 @@ static u32 iwl_pci_read32(struct iwl_bus *bus, u32 ofs)
|
||||||
static const struct iwl_bus_ops bus_ops_pci = {
|
static const struct iwl_bus_ops bus_ops_pci = {
|
||||||
.get_pm_support = iwl_pci_is_pm_supported,
|
.get_pm_support = iwl_pci_is_pm_supported,
|
||||||
.apm_config = iwl_pci_apm_config,
|
.apm_config = iwl_pci_apm_config,
|
||||||
|
.get_hw_id_string = iwl_pci_get_hw_id_string,
|
||||||
.get_hw_id = iwl_pci_get_hw_id,
|
.get_hw_id = iwl_pci_get_hw_id,
|
||||||
.write8 = iwl_pci_write8,
|
.write8 = iwl_pci_write8,
|
||||||
.write32 = iwl_pci_write32,
|
.write32 = iwl_pci_write32,
|
||||||
|
|
|
@ -534,7 +534,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
|
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
|
||||||
bus_get_hw_id(bus(priv), buf, sizeof(buf));
|
bus_get_hw_id_string(bus(priv), buf, sizeof(buf));
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
strsep(&ptr, ":");
|
strsep(&ptr, ":");
|
||||||
sscanf(strsep(&ptr, ":"), "%x", &num);
|
sscanf(strsep(&ptr, ":"), "%x", &num);
|
||||||
|
|
Loading…
Add table
Reference in a new issue