For QCA6390, host needs to reset some registers before MHI power up to fix PCI link unstable issue if hot reset happened. Also clear all pending interrupts during power up. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Carl Huang <cjhuang@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/1607609124-17250-4-git-send-email-kvalo@codeaurora.org
84 lines
2.0 KiB
C
84 lines
2.0 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
|
|
/*
|
|
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
|
|
*/
|
|
#ifndef _ATH11K_PCI_H
|
|
#define _ATH11K_PCI_H
|
|
|
|
#include <linux/mhi.h>
|
|
|
|
#include "core.h"
|
|
|
|
#define PCIE_SOC_GLOBAL_RESET 0x3008
|
|
#define PCIE_SOC_GLOBAL_RESET_V 1
|
|
|
|
#define WLAON_WARM_SW_ENTRY 0x1f80504
|
|
#define WLAON_SOC_RESET_CAUSE_REG 0x01f8060c
|
|
|
|
#define PCIE_Q6_COOKIE_ADDR 0x01f80500
|
|
#define PCIE_Q6_COOKIE_DATA 0xc0000000
|
|
|
|
/* register to wake the UMAC from power collapse */
|
|
#define PCIE_SCRATCH_0_SOC_PCIE_REG 0x4040
|
|
|
|
/* register used for handshake mechanism to validate UMAC is awake */
|
|
#define PCIE_SOC_WAKE_PCIE_LOCAL_REG 0x3004
|
|
|
|
#define PCIE_PCIE_PARF_LTSSM 0x1e081b0
|
|
#define PARM_LTSSM_VALUE 0x111
|
|
|
|
#define GCC_GCC_PCIE_HOT_RST 0x1e402bc
|
|
#define GCC_GCC_PCIE_HOT_RST_VAL 0x10
|
|
|
|
#define PCIE_PCIE_INT_ALL_CLEAR 0x1e08228
|
|
#define PCIE_SMLH_REQ_RST_LINK_DOWN 0x2
|
|
#define PCIE_INT_CLEAR_ALL 0xffffffff
|
|
|
|
struct ath11k_msi_user {
|
|
char *name;
|
|
int num_vectors;
|
|
u32 base_vector;
|
|
};
|
|
|
|
struct ath11k_msi_config {
|
|
int total_vectors;
|
|
int total_users;
|
|
struct ath11k_msi_user *users;
|
|
};
|
|
|
|
enum ath11k_pci_flags {
|
|
ATH11K_PCI_FLAG_INIT_DONE,
|
|
ATH11K_PCI_FLAG_IS_MSI_64,
|
|
};
|
|
|
|
struct ath11k_pci {
|
|
struct pci_dev *pdev;
|
|
struct ath11k_base *ab;
|
|
u16 dev_id;
|
|
char amss_path[100];
|
|
u32 msi_ep_base_data;
|
|
struct mhi_controller *mhi_ctrl;
|
|
unsigned long mhi_state;
|
|
u32 register_window;
|
|
|
|
/* protects register_window above */
|
|
spinlock_t window_lock;
|
|
|
|
/* enum ath11k_pci_flags */
|
|
unsigned long flags;
|
|
};
|
|
|
|
static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
|
|
{
|
|
return (struct ath11k_pci *)ab->drv_priv;
|
|
}
|
|
|
|
int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name,
|
|
int *num_vectors, u32 *user_base_data,
|
|
u32 *base_vector);
|
|
int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
|
|
void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value);
|
|
u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset);
|
|
|
|
#endif
|