Commit 0286cee0 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

iwlagn: move iwl_prepare_card_hw to the transport layer

This function is really related to the transport layer - move it.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 392f8b78
...@@ -3174,7 +3174,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, ...@@ -3174,7 +3174,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
IWL_INFO(priv, "Detected %s, REV=0x%X\n", IWL_INFO(priv, "Detected %s, REV=0x%X\n",
priv->cfg->name, hw_rev); priv->cfg->name, hw_rev);
if (iwl_prepare_card_hw(priv)) { if (trans_prepare_card_hw(priv)) {
err = -EIO; err = -EIO;
IWL_WARN(priv, "Failed, HW not ready\n"); IWL_WARN(priv, "Failed, HW not ready\n");
goto out_free_traffic_mem; goto out_free_traffic_mem;
......
...@@ -122,9 +122,6 @@ static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd) ...@@ -122,9 +122,6 @@ static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd)
hdr->data_valid = 1; hdr->data_valid = 1;
} }
/* TODO: this one should be API of the transport layer */
int iwl_prepare_card_hw(struct iwl_priv *priv);
/* tx queue */ /* tx queue */
void iwl_free_tfds_in_queue(struct iwl_priv *priv, void iwl_free_tfds_in_queue(struct iwl_priv *priv,
int sta_id, int tid, int freed); int sta_id, int tid, int freed);
......
...@@ -1236,6 +1236,8 @@ struct iwl_trans; ...@@ -1236,6 +1236,8 @@ struct iwl_trans;
* struct iwl_trans_ops - transport specific operations * struct iwl_trans_ops - transport specific operations
* @start_device: allocates and inits all the resources for the transport * @start_device: allocates and inits all the resources for the transport
* layer. * layer.
* @prepare_card_hw: claim the ownership on the HW. Will be called during
* probe.
* @tx_start: starts and configures all the Tx fifo - usually done once the fw * @tx_start: starts and configures all the Tx fifo - usually done once the fw
* is alive. * is alive.
* @stop_device:stops the whole device (embedded CPU put to reset) * @stop_device:stops the whole device (embedded CPU put to reset)
...@@ -1259,6 +1261,7 @@ struct iwl_trans; ...@@ -1259,6 +1261,7 @@ struct iwl_trans;
struct iwl_trans_ops { struct iwl_trans_ops {
int (*start_device)(struct iwl_priv *priv); int (*start_device)(struct iwl_priv *priv);
int (*prepare_card_hw)(struct iwl_priv *priv);
void (*stop_device)(struct iwl_priv *priv); void (*stop_device)(struct iwl_priv *priv);
void (*tx_start)(struct iwl_priv *priv); void (*tx_start)(struct iwl_priv *priv);
void (*tx_free)(struct iwl_priv *priv); void (*tx_free)(struct iwl_priv *priv);
......
...@@ -647,11 +647,11 @@ static int iwl_set_hw_ready(struct iwl_priv *priv) ...@@ -647,11 +647,11 @@ static int iwl_set_hw_ready(struct iwl_priv *priv)
} }
/* Note: returns standard 0/-ERROR code */ /* Note: returns standard 0/-ERROR code */
int iwl_prepare_card_hw(struct iwl_priv *priv) static int iwl_trans_prepare_card_hw(struct iwl_priv *priv)
{ {
int ret; int ret;
IWL_DEBUG_INFO(priv, "iwl_prepare_card_hw enter\n"); IWL_DEBUG_INFO(priv, "iwl_trans_prepare_card_hw enter\n");
ret = iwl_set_hw_ready(priv); ret = iwl_set_hw_ready(priv);
if (ret >= 0) if (ret >= 0)
...@@ -682,7 +682,7 @@ static int iwl_trans_start_device(struct iwl_priv *priv) ...@@ -682,7 +682,7 @@ static int iwl_trans_start_device(struct iwl_priv *priv)
priv->ucode_owner = IWL_OWNERSHIP_DRIVER; priv->ucode_owner = IWL_OWNERSHIP_DRIVER;
if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) && if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) &&
iwl_prepare_card_hw(priv)) { iwl_trans_prepare_card_hw(priv)) {
IWL_WARN(priv, "Exit HW not ready\n"); IWL_WARN(priv, "Exit HW not ready\n");
return -EIO; return -EIO;
} }
...@@ -1123,7 +1123,9 @@ static void iwl_trans_free(struct iwl_priv *priv) ...@@ -1123,7 +1123,9 @@ static void iwl_trans_free(struct iwl_priv *priv)
static const struct iwl_trans_ops trans_ops = { static const struct iwl_trans_ops trans_ops = {
.start_device = iwl_trans_start_device, .start_device = iwl_trans_start_device,
.prepare_card_hw = iwl_trans_prepare_card_hw,
.stop_device = iwl_trans_stop_device, .stop_device = iwl_trans_stop_device,
.tx_start = iwl_trans_tx_start, .tx_start = iwl_trans_tx_start,
.rx_free = iwl_trans_rx_free, .rx_free = iwl_trans_rx_free,
......
...@@ -69,6 +69,11 @@ static inline int trans_start_device(struct iwl_priv *priv) ...@@ -69,6 +69,11 @@ static inline int trans_start_device(struct iwl_priv *priv)
return priv->trans.ops->start_device(priv); return priv->trans.ops->start_device(priv);
} }
static inline int trans_prepare_card_hw(struct iwl_priv *priv)
{
return priv->trans.ops->prepare_card_hw(priv);
}
static inline void trans_stop_device(struct iwl_priv *priv) static inline void trans_stop_device(struct iwl_priv *priv)
{ {
priv->trans.ops->stop_device(priv); priv->trans.ops->stop_device(priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment