diff options
author | Mohamed Abbas <mohamed.abbas@intel.com> | 2009-05-22 14:01:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-22 14:06:09 -0400 |
commit | 086ed117c918f07fd40323ab5adc64c52ea7c1b8 (patch) | |
tree | a0335b8ef78733d2456b05e66971297d5f2dc36b /drivers/net/wireless/iwlwifi | |
parent | 0324c14b6f3730eb155dcff864b9c0cf8c893c5f (diff) |
iwlagn: co-exist with AMT
Enable using iwlwifi driver in AMT system.
Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 56 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-csr.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 2 |
3 files changed, 60 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 889574d852b8..0a5507cbeb3f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1792,6 +1792,49 @@ static void iwl_down(struct iwl_priv *priv) | |||
1792 | iwl_cancel_deferred_work(priv); | 1792 | iwl_cancel_deferred_work(priv); |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | #define HW_READY_TIMEOUT (50) | ||
1796 | |||
1797 | static int iwl_set_hw_ready(struct iwl_priv *priv) | ||
1798 | { | ||
1799 | int ret = 0; | ||
1800 | |||
1801 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
1802 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); | ||
1803 | |||
1804 | /* See if we got it */ | ||
1805 | ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
1806 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, | ||
1807 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, | ||
1808 | HW_READY_TIMEOUT); | ||
1809 | if (ret != -ETIMEDOUT) | ||
1810 | priv->hw_ready = true; | ||
1811 | else | ||
1812 | priv->hw_ready = false; | ||
1813 | |||
1814 | IWL_DEBUG_INFO(priv, "hardware %s\n", | ||
1815 | (priv->hw_ready == 1) ? "ready" : "not ready"); | ||
1816 | return ret; | ||
1817 | } | ||
1818 | |||
1819 | static int iwl_prepare_card_hw(struct iwl_priv *priv) | ||
1820 | { | ||
1821 | int ret = 0; | ||
1822 | |||
1823 | IWL_DEBUG_INFO(priv, "iwl_prepare_card_hw enter \n"); | ||
1824 | |||
1825 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
1826 | CSR_HW_IF_CONFIG_REG_PREPARE); | ||
1827 | |||
1828 | ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
1829 | ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, | ||
1830 | CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); | ||
1831 | |||
1832 | if (ret != -ETIMEDOUT) | ||
1833 | iwl_set_hw_ready(priv); | ||
1834 | |||
1835 | return ret; | ||
1836 | } | ||
1837 | |||
1795 | #define MAX_HW_RESTARTS 5 | 1838 | #define MAX_HW_RESTARTS 5 |
1796 | 1839 | ||
1797 | static int __iwl_up(struct iwl_priv *priv) | 1840 | static int __iwl_up(struct iwl_priv *priv) |
@@ -1809,6 +1852,13 @@ static int __iwl_up(struct iwl_priv *priv) | |||
1809 | return -EIO; | 1852 | return -EIO; |
1810 | } | 1853 | } |
1811 | 1854 | ||
1855 | iwl_prepare_card_hw(priv); | ||
1856 | |||
1857 | if (!priv->hw_ready) { | ||
1858 | IWL_WARN(priv, "Exit HW not ready\n"); | ||
1859 | return -EIO; | ||
1860 | } | ||
1861 | |||
1812 | /* If platform's RF_KILL switch is NOT set to KILL */ | 1862 | /* If platform's RF_KILL switch is NOT set to KILL */ |
1813 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 1863 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
1814 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 1864 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
@@ -2896,6 +2946,12 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2896 | * PCI Tx retries from interfering with C3 CPU state */ | 2946 | * PCI Tx retries from interfering with C3 CPU state */ |
2897 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 2947 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
2898 | 2948 | ||
2949 | iwl_prepare_card_hw(priv); | ||
2950 | if (!priv->hw_ready) { | ||
2951 | IWL_WARN(priv, "Failed, HW not ready\n"); | ||
2952 | goto out_iounmap; | ||
2953 | } | ||
2954 | |||
2899 | /* amp init */ | 2955 | /* amp init */ |
2900 | err = priv->cfg->ops->lib->apm_ops.init(priv); | 2956 | err = priv->cfg->ops->lib->apm_ops.init(priv); |
2901 | if (err < 0) { | 2957 | if (err < 0) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index e2fafb828684..f03dae1b2f36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -126,9 +126,9 @@ | |||
126 | 126 | ||
127 | #define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) | 127 | #define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) |
128 | #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) | 128 | #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) |
129 | #define CSR_HW_IF_CONFIG_REG_BIT_PCI_OWN_SEM (0x00400000) | 129 | #define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) |
130 | #define CSR_HW_IF_CONFIG_REG_BIT_ME_OWN (0x02000000) | 130 | #define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) |
131 | #define CSR_HW_IF_CONFIG_REG_BIT_WAKE_ME (0x08000000) | 131 | #define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) |
132 | 132 | ||
133 | #define CSR_INT_PERIODIC_DIS (0x00) | 133 | #define CSR_INT_PERIODIC_DIS (0x00) |
134 | #define CSR_INT_PERIODIC_ENA (0xFF) | 134 | #define CSR_INT_PERIODIC_ENA (0xFF) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index f9a3fd6a023a..2dafc26fb6a8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1113,7 +1113,7 @@ struct iwl_priv { | |||
1113 | u32 disable_tx_power_cal; | 1113 | u32 disable_tx_power_cal; |
1114 | struct work_struct run_time_calib_work; | 1114 | struct work_struct run_time_calib_work; |
1115 | struct timer_list statistics_periodic; | 1115 | struct timer_list statistics_periodic; |
1116 | 1116 | bool hw_ready; | |
1117 | /*For 3945*/ | 1117 | /*For 3945*/ |
1118 | #define IWL_DEFAULT_TX_POWER 0x0F | 1118 | #define IWL_DEFAULT_TX_POWER 0x0F |
1119 | 1119 | ||