xref: /openbmc/linux/drivers/net/wireless/ath/ath11k/pci.h (revision 654e959a)
15762613eSGovind Singh /* SPDX-License-Identifier: BSD-3-Clause-Clear */
25762613eSGovind Singh /*
35762613eSGovind Singh  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
45762613eSGovind Singh  */
51399fb87SGovind Singh #ifndef _ATH11K_PCI_H
61399fb87SGovind Singh #define _ATH11K_PCI_H
71399fb87SGovind Singh 
81399fb87SGovind Singh #include <linux/mhi.h>
95762613eSGovind Singh 
105762613eSGovind Singh #include "core.h"
115762613eSGovind Singh 
125697a564SGovind Singh struct ath11k_msi_user {
135697a564SGovind Singh 	char *name;
145697a564SGovind Singh 	int num_vectors;
155697a564SGovind Singh 	u32 base_vector;
165697a564SGovind Singh };
175697a564SGovind Singh 
185697a564SGovind Singh struct ath11k_msi_config {
195697a564SGovind Singh 	int total_vectors;
205697a564SGovind Singh 	int total_users;
215697a564SGovind Singh 	struct ath11k_msi_user *users;
225697a564SGovind Singh };
235697a564SGovind Singh 
245762613eSGovind Singh struct ath11k_pci {
255762613eSGovind Singh 	struct pci_dev *pdev;
265762613eSGovind Singh 	struct ath11k_base *ab;
275762613eSGovind Singh 	u16 dev_id;
281399fb87SGovind Singh 	char amss_path[100];
295697a564SGovind Singh 	u32 msi_ep_base_data;
301399fb87SGovind Singh 	struct mhi_controller *mhi_ctrl;
311399fb87SGovind Singh 	unsigned long mhi_state;
32654e959aSGovind Singh 	u32 register_window;
33654e959aSGovind Singh 
34654e959aSGovind Singh 	/* protects register_window above */
35654e959aSGovind Singh 	spinlock_t window_lock;
365762613eSGovind Singh };
375762613eSGovind Singh 
385762613eSGovind Singh static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
395762613eSGovind Singh {
405762613eSGovind Singh 	return (struct ath11k_pci *)ab->drv_priv;
415762613eSGovind Singh }
421399fb87SGovind Singh 
431399fb87SGovind Singh int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name,
441399fb87SGovind Singh 				       int *num_vectors, u32 *user_base_data,
451399fb87SGovind Singh 				       u32 *base_vector);
461399fb87SGovind Singh int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
471399fb87SGovind Singh 
481399fb87SGovind Singh #endif
49