1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _PCI_API_H_ 20 #define _PCI_API_H_ 21 struct hif_exec_context; 22 23 QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx, 24 enum qdf_bus_type bus_type); 25 void hif_pci_close(struct hif_softc *hif_ctx); 26 void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag); 27 void hif_pci_reset_soc(struct hif_softc *ol_sc); 28 int hif_pci_bus_suspend(struct hif_softc *scn); 29 int hif_pci_bus_suspend_noirq(struct hif_softc *scn); 30 int hif_pci_bus_resume(struct hif_softc *scn); 31 int hif_pci_bus_resume_noirq(struct hif_softc *scn); 32 int hif_pci_target_sleep_state_adjust(struct hif_softc *scn, 33 bool sleep_ok, bool wait_for_it); 34 35 void hif_pci_disable_isr(struct hif_softc *scn); 36 void hif_pci_nointrs(struct hif_softc *scn); 37 QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn, 38 struct device *dev, void *bdev, 39 const struct hif_bus_id *bid, 40 enum hif_enable_type type); 41 void hif_pci_disable_bus(struct hif_softc *scn); 42 #ifdef FEATURE_RUNTIME_PM 43 struct hif_runtime_pm_ctx *hif_pci_get_rpm_ctx(struct hif_softc *hif_sc); 44 struct device *hif_pci_get_dev(struct hif_softc *hif_sc); 45 #endif 46 int hif_pci_bus_configure(struct hif_softc *scn); 47 void hif_pci_irq_disable(struct hif_softc *scn, int ce_id); 48 void hif_pci_irq_enable(struct hif_softc *scn, int ce_id); 49 int hif_pci_dump_registers(struct hif_softc *scn); 50 void hif_pci_enable_power_management(struct hif_softc *hif_ctx, 51 bool is_packet_log_enabled); 52 void hif_pci_disable_power_management(struct hif_softc *hif_ctx); 53 int hif_pci_configure_grp_irq(struct hif_softc *scn, 54 struct hif_exec_context *exec); 55 void hif_pci_deconfigure_grp_irq(struct hif_softc *scn); 56 57 /** 58 * hif_pci_reg_read32() - Read register in 32bits 59 * @hif_sc: PCIe control struct 60 * @offset: The register offset 61 * 62 * This function will read register in 32bits 63 * 64 * Return: return value for register with specified offset 65 */ 66 uint32_t hif_pci_reg_read32(struct hif_softc *hif_sc, 67 uint32_t offset); 68 69 /** 70 * hif_pci_reg_write32() - Write register in 32bits 71 * @hif_sc: PCIe control struct 72 * @offset: The register offset 73 * @value: The value need to be written 74 * 75 * This function will write register in 32bits 76 * 77 * Return: None 78 */ 79 void hif_pci_reg_write32(struct hif_softc *hif_sc, 80 uint32_t offset, 81 uint32_t value); 82 83 void hif_pci_display_stats(struct hif_softc *hif_ctx); 84 void hif_pci_clear_stats(struct hif_softc *hif_ctx); 85 int hif_pci_legacy_map_ce_to_irq(struct hif_softc *scn, int ce_id); 86 bool hif_pci_needs_bmi(struct hif_softc *scn); 87 const char *hif_pci_get_irq_name(int irq_no); 88 89 /** hif_pci_config_irq_affinity() - Set the IRQ affinity 90 * @scn: hif context 91 * 92 * Set IRQ affinity hint for WLAN IRQs to gold cores only for 93 * defconfig builds. 94 * 95 * Return: None 96 */ 97 void hif_pci_config_irq_affinity(struct hif_softc *scn); 98 int hif_ce_msi_configure_irq_by_ceid(struct hif_softc *scn, int ce_id); 99 #endif /* _PCI_API_H_ */ 100