diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-04-24 14:55:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:22 -0400 |
commit | 694cc56dbb818fe689f721fb53452eb5ad3f8e9a (patch) | |
tree | 24dd95c142fbad86f1b31bc836b667adbfafce86 /drivers/net/wireless/iwlwifi/iwl-4965.c | |
parent | e4d18d817f0ffc830bce57906b2a7dd9e713c388 (diff) |
iwlwifi: wrapping nic configuration in iwl core handler
This patch wraps nic hw configuration in a iwl core handler
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index a98f00f7da42..8aaac16a45fd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -579,22 +579,13 @@ out: | |||
579 | return ret; | 579 | return ret; |
580 | } | 580 | } |
581 | 581 | ||
582 | int iwl4965_hw_nic_init(struct iwl_priv *priv) | 582 | |
583 | static void iwl4965_nic_config(struct iwl_priv *priv) | ||
583 | { | 584 | { |
584 | unsigned long flags; | 585 | unsigned long flags; |
585 | struct iwl4965_rx_queue *rxq = &priv->rxq; | ||
586 | u8 val_link; | ||
587 | u32 val; | 586 | u32 val; |
588 | int ret; | 587 | u16 radio_cfg; |
589 | 588 | u8 val_link; | |
590 | /* nic_init */ | ||
591 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
592 | |||
593 | spin_lock_irqsave(&priv->lock, flags); | ||
594 | iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); | ||
595 | spin_unlock_irqrestore(&priv->lock, flags); | ||
596 | |||
597 | ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); | ||
598 | 589 | ||
599 | spin_lock_irqsave(&priv->lock, flags); | 590 | spin_lock_irqsave(&priv->lock, flags); |
600 | 591 | ||
@@ -605,24 +596,49 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) | |||
605 | val & ~(1 << 11)); | 596 | val & ~(1 << 11)); |
606 | } | 597 | } |
607 | 598 | ||
608 | spin_unlock_irqrestore(&priv->lock, flags); | ||
609 | |||
610 | pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); | 599 | pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); |
611 | 600 | ||
612 | /* disable L1 entry -- workaround for pre-B1 */ | 601 | /* disable L1 entry -- workaround for pre-B1 */ |
613 | pci_write_config_byte(priv->pci_dev, PCI_LINK_CTRL, val_link & ~0x02); | 602 | pci_write_config_byte(priv->pci_dev, PCI_LINK_CTRL, val_link & ~0x02); |
614 | 603 | ||
615 | spin_lock_irqsave(&priv->lock, flags); | 604 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); |
616 | 605 | ||
617 | /* set CSR_HW_CONFIG_REG for uCode use */ | 606 | /* write radio config values to register */ |
607 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) | ||
608 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
609 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | ||
610 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | ||
611 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
618 | 612 | ||
613 | /* set CSR_HW_CONFIG_REG for uCode use */ | ||
619 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 614 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, |
620 | CSR49_HW_IF_CONFIG_REG_BIT_4965_R | | ||
621 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | 615 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | |
622 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | 616 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); |
623 | 617 | ||
618 | priv->calib_info = (struct iwl_eeprom_calib_info *) | ||
619 | iwl_eeprom_query_addr(priv, EEPROM_4965_CALIB_TXPOWER_OFFSET); | ||
620 | |||
621 | spin_unlock_irqrestore(&priv->lock, flags); | ||
622 | } | ||
623 | |||
624 | |||
625 | int iwl4965_hw_nic_init(struct iwl_priv *priv) | ||
626 | { | ||
627 | unsigned long flags; | ||
628 | struct iwl4965_rx_queue *rxq = &priv->rxq; | ||
629 | int ret; | ||
630 | |||
631 | /* nic_init */ | ||
632 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
633 | |||
634 | spin_lock_irqsave(&priv->lock, flags); | ||
635 | iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); | ||
624 | spin_unlock_irqrestore(&priv->lock, flags); | 636 | spin_unlock_irqrestore(&priv->lock, flags); |
625 | 637 | ||
638 | ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); | ||
639 | |||
640 | priv->cfg->ops->lib->apm_ops.config(priv); | ||
641 | |||
626 | iwl4965_hw_card_show_info(priv); | 642 | iwl4965_hw_card_show_info(priv); |
627 | 643 | ||
628 | /* end nic_init */ | 644 | /* end nic_init */ |
@@ -646,10 +662,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) | |||
646 | rxq->need_update = 1; | 662 | rxq->need_update = 1; |
647 | iwl4965_rx_queue_update_write_ptr(priv, rxq); | 663 | iwl4965_rx_queue_update_write_ptr(priv, rxq); |
648 | 664 | ||
649 | /* init the txpower calibration pointer */ | ||
650 | priv->calib_info = (struct iwl_eeprom_calib_info *) | ||
651 | iwl_eeprom_query_addr(priv, EEPROM_4965_CALIB_TXPOWER_OFFSET); | ||
652 | |||
653 | spin_unlock_irqrestore(&priv->lock, flags); | 665 | spin_unlock_irqrestore(&priv->lock, flags); |
654 | 666 | ||
655 | /* Allocate and init all Tx and Command queues */ | 667 | /* Allocate and init all Tx and Command queues */ |
@@ -4112,6 +4124,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
4112 | .load_ucode = iwl4965_load_bsm, | 4124 | .load_ucode = iwl4965_load_bsm, |
4113 | .apm_ops = { | 4125 | .apm_ops = { |
4114 | .init = iwl4965_apm_init, | 4126 | .init = iwl4965_apm_init, |
4127 | .config = iwl4965_nic_config, | ||
4115 | .set_pwr_src = iwl4965_set_pwr_src, | 4128 | .set_pwr_src = iwl4965_set_pwr_src, |
4116 | }, | 4129 | }, |
4117 | .eeprom_ops = { | 4130 | .eeprom_ops = { |