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, 41*e8e55d89SAnilkumar Kolli ATH11K_PCI_FLAG_IS_MSI_64, 42a05bd851SCarl Huang }; 43a05bd851SCarl Huang 445762613eSGovind Singh struct ath11k_pci { 455762613eSGovind Singh struct pci_dev *pdev; 465762613eSGovind Singh struct ath11k_base *ab; 475762613eSGovind Singh u16 dev_id; 481399fb87SGovind Singh char amss_path[100]; 495697a564SGovind Singh u32 msi_ep_base_data; 501399fb87SGovind Singh struct mhi_controller *mhi_ctrl; 511399fb87SGovind Singh unsigned long mhi_state; 52654e959aSGovind Singh u32 register_window; 53654e959aSGovind Singh 54654e959aSGovind Singh /* protects register_window above */ 55654e959aSGovind Singh spinlock_t window_lock; 56a05bd851SCarl Huang 57a05bd851SCarl Huang /* enum ath11k_pci_flags */ 58a05bd851SCarl Huang unsigned long flags; 595762613eSGovind Singh }; 605762613eSGovind Singh 615762613eSGovind Singh static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab) 625762613eSGovind Singh { 635762613eSGovind Singh return (struct ath11k_pci *)ab->drv_priv; 645762613eSGovind Singh } 651399fb87SGovind Singh 661399fb87SGovind Singh int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name, 671399fb87SGovind Singh int *num_vectors, u32 *user_base_data, 681399fb87SGovind Singh u32 *base_vector); 691399fb87SGovind Singh int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector); 70f3c603d4SCarl Huang void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value); 71f3c603d4SCarl Huang u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset); 721399fb87SGovind Singh 731399fb87SGovind Singh #endif 74