1 /* 2 * Copyright (c) 2016-2020 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 56 /** 57 * hif_pci_reg_read32() - Read register in 32bits 58 * @hif_sc: PCIe control struct 59 * @offset: The register offset 60 * 61 * This function will read register in 32bits 62 * 63 * Return: return value for register with specified offset 64 */ 65 uint32_t hif_pci_reg_read32(struct hif_softc *hif_sc, 66 uint32_t offset); 67 68 /** 69 * hif_pci_reg_write32() - Write register in 32bits 70 * @hif_sc: PCIe control struct 71 * @offset: The register offset 72 * @value: The value need to be written 73 * 74 * This function will write register in 32bits 75 * 76 * Return: None 77 */ 78 void hif_pci_reg_write32(struct hif_softc *hif_sc, 79 uint32_t offset, 80 uint32_t value); 81 82 void hif_pci_display_stats(struct hif_softc *hif_ctx); 83 void hif_pci_clear_stats(struct hif_softc *hif_ctx); 84 int hif_pci_legacy_map_ce_to_irq(struct hif_softc *scn, int ce_id); 85 bool hif_pci_needs_bmi(struct hif_softc *scn); 86 const char *hif_pci_get_irq_name(int irq_no); 87 88 /** hif_pci_config_irq_affinity() - Set the IRQ affinity 89 * @scn: hif context 90 * 91 * Set IRQ affinity hint for WLAN IRQs to gold cores only for 92 * defconfig builds. 93 * 94 * Return: None 95 */ 96 void hif_pci_config_irq_affinity(struct hif_softc *scn); 97 int hif_ce_msi_configure_irq_by_ceid(struct hif_softc *scn, int ce_id); 98 #endif /* _PCI_API_H_ */ 99