Commit d68b603c authored by Abhijeet Kolekar's avatar Abhijeet Kolekar Committed by John W. Linville
Browse files

iwlwifi/iwl3945 : unify apm stop operation



Unify the usage of apm_stop_master and apm_stop
across all hardwares.

Signed-off-by: default avatarAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e932a609
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static struct iwl_lib_ops iwl1000_lib = {
	.apm_ops = {
		.init =	iwl5000_apm_init,
		.reset = iwl5000_apm_reset,
		.stop = iwl5000_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl1000_nic_config,
		.set_pwr_src = iwl_set_pwr_src,
	},
+2 −41
Original line number Diff line number Diff line
@@ -1167,48 +1167,9 @@ void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
	iwl3945_hw_txq_ctx_free(priv);
}

static int iwl3945_apm_stop_master(struct iwl_priv *priv)
{
	int ret = 0;
	unsigned long flags;

	spin_lock_irqsave(&priv->lock, flags);

	/* set stop master bit */
	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);

	iwl_poll_direct_bit(priv, CSR_RESET,
			    CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);

	if (ret < 0)
		goto out;

out:
	spin_unlock_irqrestore(&priv->lock, flags);
	IWL_DEBUG_INFO(priv, "stop master\n");

	return ret;
}

static void iwl3945_apm_stop(struct iwl_priv *priv)
{
	unsigned long flags;

	iwl3945_apm_stop_master(priv);

	spin_lock_irqsave(&priv->lock, flags);

	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);

	udelay(10);
	/* clear "init complete"  move adapter D0A* --> D0U state */
	iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
	spin_unlock_irqrestore(&priv->lock, flags);
}

static int iwl3945_apm_reset(struct iwl_priv *priv)
{
	iwl3945_apm_stop_master(priv);
	iwl_apm_stop_master(priv);


	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2841,7 +2802,7 @@ static struct iwl_lib_ops iwl3945_lib = {
	.apm_ops = {
		.init = iwl3945_apm_init,
		.reset = iwl3945_apm_reset,
		.stop = iwl3945_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl3945_nic_config,
		.set_pwr_src = iwl3945_set_pwr_src,
	},
+2 −36
Original line number Diff line number Diff line
@@ -396,45 +396,11 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
	spin_unlock_irqrestore(&priv->lock, flags);
}

static int iwl4965_apm_stop_master(struct iwl_priv *priv)
{
	unsigned long flags;

	spin_lock_irqsave(&priv->lock, flags);

	/* set stop master bit */
	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);

	iwl_poll_direct_bit(priv, CSR_RESET,
			CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);

	spin_unlock_irqrestore(&priv->lock, flags);
	IWL_DEBUG_INFO(priv, "stop master\n");

	return 0;
}

static void iwl4965_apm_stop(struct iwl_priv *priv)
{
	unsigned long flags;

	iwl4965_apm_stop_master(priv);

	spin_lock_irqsave(&priv->lock, flags);

	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);

	udelay(10);
	/* clear "init complete"  move adapter D0A* --> D0U state */
	iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
	spin_unlock_irqrestore(&priv->lock, flags);
}

static int iwl4965_apm_reset(struct iwl_priv *priv)
{
	int ret = 0;

	iwl4965_apm_stop_master(priv);
	iwl_apm_stop_master(priv);


	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2306,7 +2272,7 @@ static struct iwl_lib_ops iwl4965_lib = {
	.apm_ops = {
		.init = iwl4965_apm_init,
		.reset = iwl4965_apm_reset,
		.stop = iwl4965_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl4965_nic_config,
		.set_pwr_src = iwl_set_pwr_src,
	},
+3 −43
Original line number Diff line number Diff line
@@ -72,26 +72,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = {
	IWL_TX_FIFO_HCCA_2
};

/* FIXME: same implementation as 4965 */
static int iwl5000_apm_stop_master(struct iwl_priv *priv)
{
	unsigned long flags;

	spin_lock_irqsave(&priv->lock, flags);

	/* set stop master bit */
	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);

	iwl_poll_direct_bit(priv, CSR_RESET,
				  CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);

	spin_unlock_irqrestore(&priv->lock, flags);
	IWL_DEBUG_INFO(priv, "stop master\n");

	return 0;
}


int iwl5000_apm_init(struct iwl_priv *priv)
{
	int ret = 0;
@@ -137,31 +117,11 @@ int iwl5000_apm_init(struct iwl_priv *priv)
	return ret;
}

/* FIXME: this is identical to 4965 */
void iwl5000_apm_stop(struct iwl_priv *priv)
{
	unsigned long flags;

	iwl5000_apm_stop_master(priv);

	spin_lock_irqsave(&priv->lock, flags);

	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);

	udelay(10);

	/* clear "init complete"  move adapter D0A* --> D0U state */
	iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);

	spin_unlock_irqrestore(&priv->lock, flags);
}


int iwl5000_apm_reset(struct iwl_priv *priv)
{
	int ret = 0;

	iwl5000_apm_stop_master(priv);
	iwl_apm_stop_master(priv);

	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);

@@ -1561,7 +1521,7 @@ struct iwl_lib_ops iwl5000_lib = {
	.apm_ops = {
		.init =	iwl5000_apm_init,
		.reset = iwl5000_apm_reset,
		.stop = iwl5000_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl5000_nic_config,
		.set_pwr_src = iwl_set_pwr_src,
	},
@@ -1613,7 +1573,7 @@ static struct iwl_lib_ops iwl5150_lib = {
	.apm_ops = {
		.init =	iwl5000_apm_init,
		.reset = iwl5000_apm_reset,
		.stop = iwl5000_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl5000_nic_config,
		.set_pwr_src = iwl_set_pwr_src,
	},
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static struct iwl_lib_ops iwl6000_lib = {
	.apm_ops = {
		.init =	iwl5000_apm_init,
		.reset = iwl5000_apm_reset,
		.stop = iwl5000_apm_stop,
		.stop = iwl_apm_stop,
		.config = iwl6000_nic_config,
		.set_pwr_src = iwl_set_pwr_src,
	},
Loading