0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __T7XX_PCI_H__
0018 #define __T7XX_PCI_H__
0019
0020 #include <linux/completion.h>
0021 #include <linux/irqreturn.h>
0022 #include <linux/mutex.h>
0023 #include <linux/pci.h>
0024 #include <linux/spinlock.h>
0025 #include <linux/types.h>
0026
0027 #include "t7xx_reg.h"
0028
0029
0030
0031
0032
0033
0034
0035
0036 struct t7xx_addr_base {
0037 void __iomem *pcie_mac_ireg_base;
0038 void __iomem *pcie_ext_reg_base;
0039 u32 pcie_dev_reg_trsl_addr;
0040 void __iomem *infracfg_ao_base;
0041 void __iomem *mhccif_rc_base;
0042 };
0043
0044 typedef irqreturn_t (*t7xx_intr_callback)(int irq, void *param);
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 struct t7xx_pci_dev {
0064 t7xx_intr_callback intr_handler[EXT_INT_NUM];
0065 t7xx_intr_callback intr_thread[EXT_INT_NUM];
0066 void *callback_param[EXT_INT_NUM];
0067 struct pci_dev *pdev;
0068 struct t7xx_addr_base base_addr;
0069 struct t7xx_modem *md;
0070 struct t7xx_ccmni_ctrl *ccmni_ctlb;
0071 bool rgu_pci_irq_en;
0072
0073
0074 struct list_head md_pm_entities;
0075 struct mutex md_pm_entity_mtx;
0076 struct completion pm_sr_ack;
0077 atomic_t md_pm_state;
0078 spinlock_t md_pm_lock;
0079 unsigned int sleep_disable_count;
0080 struct completion sleep_lock_acquire;
0081 };
0082
0083 enum t7xx_pm_id {
0084 PM_ENTITY_ID_CTRL1,
0085 PM_ENTITY_ID_CTRL2,
0086 PM_ENTITY_ID_DATA,
0087 PM_ENTITY_ID_INVALID
0088 };
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102 struct md_pm_entity {
0103 struct list_head entity;
0104 int (*suspend)(struct t7xx_pci_dev *t7xx_dev, void *entity_param);
0105 void (*suspend_late)(struct t7xx_pci_dev *t7xx_dev, void *entity_param);
0106 void (*resume_early)(struct t7xx_pci_dev *t7xx_dev, void *entity_param);
0107 int (*resume)(struct t7xx_pci_dev *t7xx_dev, void *entity_param);
0108 enum t7xx_pm_id id;
0109 void *entity_param;
0110 };
0111
0112 void t7xx_pci_disable_sleep(struct t7xx_pci_dev *t7xx_dev);
0113 void t7xx_pci_enable_sleep(struct t7xx_pci_dev *t7xx_dev);
0114 int t7xx_pci_sleep_disable_complete(struct t7xx_pci_dev *t7xx_dev);
0115 int t7xx_pci_pm_entity_register(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity);
0116 int t7xx_pci_pm_entity_unregister(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity);
0117 void t7xx_pci_pm_init_late(struct t7xx_pci_dev *t7xx_dev);
0118 void t7xx_pci_pm_exp_detected(struct t7xx_pci_dev *t7xx_dev);
0119
0120 #endif