/* SPDX-License-Identifier: GPL-2.0-only * * Copyright (c) 2021, MediaTek Inc. * Copyright (c) 2021-2022, Intel Corporation. * * Authors: * Haijun Liu <[email protected]> * Ricardo Martinez <[email protected]> * Sreehari Kancharla <[email protected]> * * Contributors: * Amir Hanania <[email protected]> * Chiranjeevi Rapolu <[email protected]> * Moises Veleta <[email protected]> */ #ifndef __T7XX_PCI_H__ #define __T7XX_PCI_H__ #include <linux/completion.h> #include <linux/irqreturn.h> #include <linux/mutex.h> #include <linux/pci.h> #include <linux/spinlock.h> #include <linux/types.h> #include "t7xx_reg.h" /* struct t7xx_addr_base - holds base addresses * @pcie_mac_ireg_base: PCIe MAC register base * @pcie_ext_reg_base: used to calculate base addresses for CLDMA, DPMA and MHCCIF registers * @pcie_dev_reg_trsl_addr: used to calculate the register base address * @infracfg_ao_base: base address used in CLDMA reset operations * @mhccif_rc_base: host view of MHCCIF rc base addr */ struct t7xx_addr_base { … }; t7xx_intr_callback; enum t7xx_mode { … }; /* struct t7xx_pci_dev - MTK device context structure * @intr_handler: array of handler function for request_threaded_irq * @intr_thread: array of thread_fn for request_threaded_irq * @callback_param: array of cookie passed back to interrupt functions * @pdev: PCI device * @base_addr: memory base addresses of HW components * @md: modem interface * @ccmni_ctlb: context structure used to control the network data path * @rgu_pci_irq_en: RGU callback ISR registered and active * @md_pm_entities: list of pm entities * @md_pm_entity_mtx: protects md_pm_entities list * @pm_sr_ack: ack from the device when went to sleep or woke up * @md_pm_state: state for resume/suspend * @md_pm_lock: protects PCIe sleep lock * @sleep_disable_count: PCIe L1.2 lock counter * @sleep_lock_acquire: indicates that sleep has been disabled * @mode: indicates the device mode */ struct t7xx_pci_dev { … }; enum t7xx_pm_id { … }; /* struct md_pm_entity - device power management entity * @entity: list of PM Entities * @suspend: callback invoked before sending D3 request to device * @suspend_late: callback invoked after getting D3 ACK from device * @resume_early: callback invoked before sending the resume request to device * @resume: callback invoked after getting resume ACK from device * @id: unique PM entity identifier * @entity_param: parameter passed to the registered callbacks * * This structure is used to indicate PM operations required by internal * HW modules such as CLDMA and DPMA. */ struct md_pm_entity { … }; void t7xx_pci_disable_sleep(struct t7xx_pci_dev *t7xx_dev); void t7xx_pci_enable_sleep(struct t7xx_pci_dev *t7xx_dev); int t7xx_pci_sleep_disable_complete(struct t7xx_pci_dev *t7xx_dev); int t7xx_pci_pm_entity_register(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity); int t7xx_pci_pm_entity_unregister(struct t7xx_pci_dev *t7xx_dev, struct md_pm_entity *pm_entity); void t7xx_pci_pm_init_late(struct t7xx_pci_dev *t7xx_dev); void t7xx_pci_pm_exp_detected(struct t7xx_pci_dev *t7xx_dev); void t7xx_mode_update(struct t7xx_pci_dev *t7xx_dev, enum t7xx_mode mode); int t7xx_pci_reprobe(struct t7xx_pci_dev *t7xx_dev, bool boot); int t7xx_pci_reprobe_early(struct t7xx_pci_dev *t7xx_dev); #endif /* __T7XX_PCI_H__ */