diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/pci.h')
| -rw-r--r-- | drivers/net/wireless/ath/ath10k/pci.h | 101 | 
1 files changed, 31 insertions, 70 deletions
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index 871bb339d56..dfdebb4157a 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h @@ -43,22 +43,6 @@ struct bmi_xfer {  	u32 resp_len;  }; -struct ath10k_pci_compl { -	struct list_head list; -	int send_or_recv; -	struct ce_state *ce_state; -	struct hif_ce_pipe_info *pipe_info; -	void *transfer_context; -	unsigned int nbytes; -	unsigned int transfer_id; -	unsigned int flags; -}; - -/* compl_state.send_or_recv */ -#define HIF_CE_COMPLETE_FREE 0 -#define HIF_CE_COMPLETE_SEND 1 -#define HIF_CE_COMPLETE_RECV 2 -  /*   * PCI-specific Target state   * @@ -152,17 +136,16 @@ struct service_to_pipe {  enum ath10k_pci_features {  	ATH10K_PCI_FEATURE_MSI_X		= 0, -	ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND	= 1, -	ATH10K_PCI_FEATURE_SOC_POWER_SAVE	= 2, +	ATH10K_PCI_FEATURE_SOC_POWER_SAVE	= 1,  	/* keep last */  	ATH10K_PCI_FEATURE_COUNT  };  /* Per-pipe state. */ -struct hif_ce_pipe_info { +struct ath10k_pci_pipe {  	/* Handle of underlying Copy Engine */ -	struct ce_state *ce_hdl; +	struct ath10k_ce_pipe *ce_hdl;  	/* Our pipe number; facilitiates use of pipe_info ptrs. */  	u8 pipe_num; @@ -175,12 +158,6 @@ struct hif_ce_pipe_info {  	/* protects compl_free and num_send_allowed */  	spinlock_t pipe_lock; -	/* List of free CE completion slots */ -	struct list_head compl_free; - -	/* Limit the number of outstanding send requests. */ -	int num_sends_allowed; -  	struct ath10k_pci *ar_pci;  	struct tasklet_struct intr;  }; @@ -190,7 +167,6 @@ struct ath10k_pci {  	struct device *dev;  	struct ath10k *ar;  	void __iomem *mem; -	int cacheline_sz;  	DECLARE_BITMAP(features, ATH10K_PCI_FEATURE_COUNT); @@ -202,41 +178,25 @@ struct ath10k_pci {  	struct tasklet_struct intr_tq;  	struct tasklet_struct msi_fw_err; - -	/* Number of Copy Engines supported */ -	unsigned int ce_count; +	struct tasklet_struct early_irq_tasklet;  	int started;  	atomic_t keep_awake_count;  	bool verified_awake; -	/* List of CE completions to be processed */ -	struct list_head compl_process; - -	/* protects compl_processing and compl_process */ -	spinlock_t compl_lock; - -	bool compl_processing; - -	struct hif_ce_pipe_info pipe_info[CE_COUNT_MAX]; +	struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];  	struct ath10k_hif_cb msg_callbacks_current; -	/* Target address used to signal a pending firmware event */ -	u32 fw_indicator_address; -  	/* Copy Engine used for Diagnostic Accesses */ -	struct ce_state *ce_diag; +	struct ath10k_ce_pipe *ce_diag;  	/* FIXME: document what this really protects */  	spinlock_t ce_lock;  	/* Map CE id to ce_state */ -	struct ce_state *ce_id_to_state[CE_COUNT_MAX]; - -	/* makes sure that dummy reads are atomic */ -	spinlock_t hw_v1_workaround_lock; +	struct ath10k_ce_pipe ce_states[CE_COUNT_MAX];  };  static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar) @@ -244,14 +204,18 @@ static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)  	return ar->hif.priv;  } -static inline u32 ath10k_pci_reg_read32(void __iomem *mem, u32 addr) +static inline u32 ath10k_pci_reg_read32(struct ath10k *ar, u32 addr)  { -	return ioread32(mem + PCIE_LOCAL_BASE_ADDRESS + addr); +	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); + +	return ioread32(ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS + addr);  } -static inline void ath10k_pci_reg_write32(void __iomem *mem, u32 addr, u32 val) +static inline void ath10k_pci_reg_write32(struct ath10k *ar, u32 addr, u32 val)  { -	iowrite32(val, mem + PCIE_LOCAL_BASE_ADDRESS + addr); +	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); + +	iowrite32(val, ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS + addr);  }  #define ATH_PCI_RESET_WAIT_MAX 10 /* ms */ @@ -310,23 +274,8 @@ static inline void ath10k_pci_write32(struct ath10k *ar, u32 offset,  				      u32 value)  {  	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); -	void __iomem *addr = ar_pci->mem; - -	if (test_bit(ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND, ar_pci->features)) { -		unsigned long irq_flags; -		spin_lock_irqsave(&ar_pci->hw_v1_workaround_lock, irq_flags); - -		ioread32(addr+offset+4); /* 3rd read prior to write */ -		ioread32(addr+offset+4); /* 2nd read prior to write */ -		ioread32(addr+offset+4); /* 1st read prior to write */ -		iowrite32(value, addr+offset); - -		spin_unlock_irqrestore(&ar_pci->hw_v1_workaround_lock, -				       irq_flags); -	} else { -		iowrite32(value, addr+offset); -	} +	iowrite32(value, ar_pci->mem + offset);  }  static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset) @@ -336,15 +285,27 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)  	return ioread32(ar_pci->mem + offset);  } -void ath10k_do_pci_wake(struct ath10k *ar); +static inline u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr) +{ +	return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr); +} + +static inline void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val) +{ +	ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + addr, val); +} + +int ath10k_do_pci_wake(struct ath10k *ar);  void ath10k_do_pci_sleep(struct ath10k *ar); -static inline void ath10k_pci_wake(struct ath10k *ar) +static inline int ath10k_pci_wake(struct ath10k *ar)  {  	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);  	if (test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features)) -		ath10k_do_pci_wake(ar); +		return ath10k_do_pci_wake(ar); + +	return 0;  }  static inline void ath10k_pci_sleep(struct ath10k *ar)  | 
