aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c54
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c5
5 files changed, 79 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index bf0bd4af10c8..646c589b8282 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -642,9 +642,9 @@ void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv)
642 iwl_hw_txq_ctx_free(priv); 642 iwl_hw_txq_ctx_free(priv);
643} 643}
644 644
645int iwl4965_hw_nic_reset(struct iwl_priv *priv) 645static int iwl4965_apm_reset(struct iwl_priv *priv)
646{ 646{
647 int rc = 0; 647 int ret = 0;
648 unsigned long flags; 648 unsigned long flags;
649 649
650 iwl4965_hw_nic_stop_master(priv); 650 iwl4965_hw_nic_stop_master(priv);
@@ -655,33 +655,40 @@ int iwl4965_hw_nic_reset(struct iwl_priv *priv)
655 655
656 udelay(10); 656 udelay(10);
657 657
658 /* FIXME: put here L1A -L0S w/a */
659
658 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 660 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
659 rc = iwl_poll_bit(priv, CSR_RESET, 661 ret = iwl_poll_bit(priv, CSR_RESET,
660 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 662 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
661 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25); 663 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25);
662 664
665 if (ret)
666 goto out;
667
663 udelay(10); 668 udelay(10);
664 669
665 rc = iwl_grab_nic_access(priv); 670 ret = iwl_grab_nic_access(priv);
666 if (!rc) { 671 if (ret)
667 iwl_write_prph(priv, APMG_CLK_EN_REG, 672 goto out;
668 APMG_CLK_VAL_DMA_CLK_RQT | 673 /* Enable DMA and BSM Clock */
669 APMG_CLK_VAL_BSM_CLK_RQT); 674 iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT |
675 APMG_CLK_VAL_BSM_CLK_RQT);
670 676
671 udelay(10); 677 udelay(10);
672 678
673 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, 679 /* disable L1A */
674 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 680 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
681 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
675 682
676 iwl_release_nic_access(priv); 683 iwl_release_nic_access(priv);
677 }
678 684
679 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 685 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
680 wake_up_interruptible(&priv->wait_command_queue); 686 wake_up_interruptible(&priv->wait_command_queue);
681 687
688out:
682 spin_unlock_irqrestore(&priv->lock, flags); 689 spin_unlock_irqrestore(&priv->lock, flags);
683 690
684 return rc; 691 return ret;
685 692
686} 693}
687 694
@@ -3617,6 +3624,7 @@ static struct iwl_lib_ops iwl4965_lib = {
3617 .load_ucode = iwl4965_load_bsm, 3624 .load_ucode = iwl4965_load_bsm,
3618 .apm_ops = { 3625 .apm_ops = {
3619 .init = iwl4965_apm_init, 3626 .init = iwl4965_apm_init,
3627 .reset = iwl4965_apm_reset,
3620 .config = iwl4965_nic_config, 3628 .config = iwl4965_nic_config,
3621 .set_pwr_src = iwl4965_set_pwr_src, 3629 .set_pwr_src = iwl4965_set_pwr_src,
3622 }, 3630 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index b1c50453a7e7..10054bdf3e4c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -100,6 +100,59 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
100 return ret; 100 return ret;
101} 101}
102 102
103static int iwl5000_apm_reset(struct iwl_priv *priv)
104{
105 int ret = 0;
106 unsigned long flags;
107
108 iwl4965_hw_nic_stop_master(priv);
109
110 spin_lock_irqsave(&priv->lock, flags);
111
112 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
113
114 udelay(10);
115
116
117 /* FIXME: put here L1A -L0S w/a */
118
119 iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
120
121 /* set "initialization complete" bit to move adapter
122 * D0U* --> D0A* state */
123 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
124
125 /* wait for clock stabilization */
126 ret = iwl_poll_bit(priv, CSR_GP_CNTRL,
127 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
128 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
129 if (ret < 0) {
130 IWL_DEBUG_INFO("Failed to init the card\n");
131 goto out;
132 }
133
134 ret = iwl_grab_nic_access(priv);
135 if (ret)
136 goto out;
137
138 /* enable DMA */
139 iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT);
140
141 udelay(20);
142
143 /* disable L1-Active */
144 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
145 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
146
147 iwl_release_nic_access(priv);
148
149out:
150 spin_unlock_irqrestore(&priv->lock, flags);
151
152 return ret;
153}
154
155
103static void iwl5000_nic_config(struct iwl_priv *priv) 156static void iwl5000_nic_config(struct iwl_priv *priv)
104{ 157{
105 unsigned long flags; 158 unsigned long flags;
@@ -805,6 +858,7 @@ static struct iwl_lib_ops iwl5000_lib = {
805 .alive_notify = iwl5000_alive_notify, 858 .alive_notify = iwl5000_alive_notify,
806 .apm_ops = { 859 .apm_ops = {
807 .init = iwl5000_apm_init, 860 .init = iwl5000_apm_init,
861 .reset = iwl5000_apm_reset,
808 .config = iwl5000_nic_config, 862 .config = iwl5000_nic_config,
809 .set_pwr_src = iwl4965_set_pwr_src, 863 .set_pwr_src = iwl4965_set_pwr_src,
810 }, 864 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 9392fcf6cac3..d82660c88a38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -124,6 +124,7 @@ struct iwl_lib_ops {
124 /* power management */ 124 /* power management */
125 struct { 125 struct {
126 int (*init)(struct iwl_priv *priv); 126 int (*init)(struct iwl_priv *priv);
127 int (*reset)(struct iwl_priv *priv);
127 void (*config)(struct iwl_priv *priv); 128 void (*config)(struct iwl_priv *priv);
128 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); 129 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
129 } apm_ops; 130 } apm_ops;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index da4d60661572..d193da3a635a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -688,7 +688,6 @@ extern int iwl4965_hw_rxq_stop(struct iwl_priv *priv);
688extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv); 688extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv);
689extern int iwl4965_hw_nic_stop_master(struct iwl_priv *priv); 689extern int iwl4965_hw_nic_stop_master(struct iwl_priv *priv);
690extern void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv); 690extern void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv);
691extern int iwl4965_hw_nic_reset(struct iwl_priv *priv);
692extern int iwl4965_hw_get_temperature(struct iwl_priv *priv); 691extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
693extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 692extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
694 struct iwl_frame *frame, u8 rate); 693 struct iwl_frame *frame, u8 rate);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index ee9fe56552cb..af0ffd3aeb43 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3417,9 +3417,8 @@ static void __iwl4965_down(struct iwl_priv *priv)
3417 3417
3418 udelay(5); 3418 udelay(5);
3419 3419
3420 iwl4965_hw_nic_stop_master(priv); 3420 /* FIXME: apm_ops.suspend(priv) */
3421 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 3421 priv->cfg->ops->lib->apm_ops.reset(priv);
3422 iwl4965_hw_nic_reset(priv);
3423 priv->cfg->ops->lib->free_shared_mem(priv); 3422 priv->cfg->ops->lib->free_shared_mem(priv);
3424 3423
3425 exit: 3424 exit: