xref: /openbmc/linux/drivers/net/wireless/ath/ath11k/pci.h (revision a05bd851)
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 
12f3c603d4SCarl Huang #define PCIE_SOC_GLOBAL_RESET			0x3008
13f3c603d4SCarl Huang #define PCIE_SOC_GLOBAL_RESET_V			1
14f3c603d4SCarl Huang 
15f3c603d4SCarl Huang #define WLAON_WARM_SW_ENTRY			0x1f80504
16f3c603d4SCarl Huang #define WLAON_SOC_RESET_CAUSE_REG		0x01f8060c
17f3c603d4SCarl Huang 
18f3c603d4SCarl Huang #define PCIE_Q6_COOKIE_ADDR			0x01f80500
19f3c603d4SCarl Huang #define PCIE_Q6_COOKIE_DATA			0xc0000000
20f3c603d4SCarl Huang 
21f3c603d4SCarl Huang /* register to wake the UMAC from power collapse */
22f3c603d4SCarl Huang #define PCIE_SCRATCH_0_SOC_PCIE_REG		0x4040
23f3c603d4SCarl Huang 
24f3c603d4SCarl Huang /* register used for handshake mechanism to validate UMAC is awake */
25f3c603d4SCarl Huang #define PCIE_SOC_WAKE_PCIE_LOCAL_REG		0x3004
26f3c603d4SCarl Huang 
275697a564SGovind Singh struct ath11k_msi_user {
285697a564SGovind Singh 	char *name;
295697a564SGovind Singh 	int num_vectors;
305697a564SGovind Singh 	u32 base_vector;
315697a564SGovind Singh };
325697a564SGovind Singh 
335697a564SGovind Singh struct ath11k_msi_config {
345697a564SGovind Singh 	int total_vectors;
355697a564SGovind Singh 	int total_users;
365697a564SGovind Singh 	struct ath11k_msi_user *users;
375697a564SGovind Singh };
385697a564SGovind Singh 
39a05bd851SCarl Huang enum ath11k_pci_flags {
40a05bd851SCarl Huang 	ATH11K_PCI_FLAG_INIT_DONE,
41a05bd851SCarl Huang };
42a05bd851SCarl Huang 
435762613eSGovind Singh struct ath11k_pci {
445762613eSGovind Singh 	struct pci_dev *pdev;
455762613eSGovind Singh 	struct ath11k_base *ab;
465762613eSGovind Singh 	u16 dev_id;
471399fb87SGovind Singh 	char amss_path[100];
485697a564SGovind Singh 	u32 msi_ep_base_data;
491399fb87SGovind Singh 	struct mhi_controller *mhi_ctrl;
501399fb87SGovind Singh 	unsigned long mhi_state;
51654e959aSGovind Singh 	u32 register_window;
52654e959aSGovind Singh 
53654e959aSGovind Singh 	/* protects register_window above */
54654e959aSGovind Singh 	spinlock_t window_lock;
55a05bd851SCarl Huang 
56a05bd851SCarl Huang 	/* enum ath11k_pci_flags */
57a05bd851SCarl Huang 	unsigned long flags;
585762613eSGovind Singh };
595762613eSGovind Singh 
605762613eSGovind Singh static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
615762613eSGovind Singh {
625762613eSGovind Singh 	return (struct ath11k_pci *)ab->drv_priv;
635762613eSGovind Singh }
641399fb87SGovind Singh 
651399fb87SGovind Singh int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name,
661399fb87SGovind Singh 				       int *num_vectors, u32 *user_base_data,
671399fb87SGovind Singh 				       u32 *base_vector);
681399fb87SGovind Singh int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
69f3c603d4SCarl Huang void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value);
70f3c603d4SCarl Huang u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset);
711399fb87SGovind Singh 
721399fb87SGovind Singh #endif
73