| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef __T7XX_PCI_H__ |
| 18 |
#define __T7XX_PCI_H__ |
| 19 |
|
| 20 |
#include <linux/completion.h> |
| 21 |
#include <linux/irqreturn.h> |
| 22 |
#include <linux/mutex.h> |
| 23 |
#include <linux/pci.h> |
| 24 |
#include <linux/spinlock.h> |
| 25 |
#include <linux/types.h> |
| 26 |
|
| 27 |
#include "t7xx_reg.h" |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
struct t7xx_addr_base { |
| 37 |
void __iomem *pcie_mac_ireg_base; |
| 38 |
void __iomem *pcie_ext_reg_base; |
| 39 |
u32 pcie_dev_reg_trsl_addr; |
| 40 |
void __iomem *infracfg_ao_base; |
| 41 |
void __iomem *mhccif_rc_base; |
| 42 |
}; |
| 43 |
|
| 44 |
typedef irqreturn_t (*t7xx_intr_callback)(int irq, void *param); |
| 45 |
|
| 46 |
enum t7xx_mode { |
| 47 |
T7XX_UNKNOWN, |
| 48 |
T7XX_READY, |
| 49 |
T7XX_RESET, |
| 50 |
T7XX_FASTBOOT_SWITCHING, |
| 51 |
T7XX_FASTBOOT_DOWNLOAD, |
| 52 |
T7XX_FASTBOOT_DUMP, |
| 53 |
T7XX_MODE_LAST, |
| 54 |
}; |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
struct t7xx_pci_dev { |
| 75 |
t7xx_intr_callback intr_handler[EXT_INT_NUM]; |
| 76 |
t7xx_intr_callback intr_thread[EXT_INT_NUM]; |
| 77 |
void *callback_param[EXT_INT_NUM]; |
| 78 |
struct pci_dev *pdev; |
| 79 |
struct t7xx_addr_base base_addr; |
| 80 |
struct t7xx_modem *md; |
| 81 |
struct t7xx_ccmni_ctrl *ccmni_ctlb; |
| 82 |
bool rgu_pci_irq_en; |
| 83 |
struct completion init_done; |
| 84 |
|
| 85 |
|
| 86 |
struct list_head md_pm_entities; |
| 87 |
struct mutex md_pm_entity_mtx; |
| 88 |
struct completion pm_sr_ack; |
| 89 |
atomic_t md_pm_state; |
| 90 |
spinlock_t md_pm_lock; |
| 91 |
unsigned int sleep_disable_count; |
| 92 |
struct completion sleep_lock_acquire; |
| 93 |
#ifdef CONFIG_WWAN_DEBUGFS |
| 94 |
struct dentry *debugfs_dir; |
| 95 |
#endif |
| 96 |
u32 mode; |
| 97 |
bool debug_ports_show; |
| 98 |
}; |
| 99 |
|
| 100 |
enum t7xx_pm_id { |
| 101 |
PM_ENTITY_ID_CTRL1, |
| 102 |
PM_ENTITY_ID_CTRL2, |
| 103 |
PM_ENTITY_ID_DATA, |
| 104 |
PM_ENTITY_ID_INVALID |
| 105 |
}; |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
struct md_pm_entity { |
| 120 |
struct list_head entity; |
| 121 |
int (*suspend)(struct t7xx_pci_dev *t7xx_dev, void *entity_param); |
| 122 |
void (*suspend_late)(struct t7xx_pci_dev *t7xx_dev, void *entity_param); |
| 123 |
void (*resume_early)(struct t7xx_pci_dev *t7xx_dev, void *entity_param); |
| 124 |
int (*resume)(struct t7xx_pci_dev *t7xx_dev, void *entity_param); |
| 125 |
enum t7xx_pm_id id; |
| 126 |
void *entity_param; |
| 127 |
}; |
| 128 |
|
| 129 |
void t7xx_pci_disable_sleep(struct t7xx_pci_dev *t7xx_dev); |
| 130 |
void t7xx_pci_enable_sleep(struct t7xx_pci_dev *t7xx_dev); |
| 131 |
int t7xx_pci_sleep_disable_complete(struct t7xx_pci_dev *t7xx_dev); |
| 132 |
int t7xx_pci_pm_entity_register(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity); |
| 133 |
int t7xx_pci_pm_entity_unregister(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity); |
| 134 |
void t7xx_pci_pm_init_late(struct t7xx_pci_dev *t7xx_dev); |
| 135 |
void t7xx_pci_pm_exp_detected(struct t7xx_pci_dev *t7xx_dev); |
| 136 |
void t7xx_mode_update(struct t7xx_pci_dev *t7xx_dev, enum t7xx_mode mode); |
| 137 |
int t7xx_pci_reprobe(struct t7xx_pci_dev *t7xx_dev, bool boot); |
| 138 |
int t7xx_pci_reprobe_early(struct t7xx_pci_dev *t7xx_dev); |
| 139 |
|
| 140 |
#endif |