1 /* 2 * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. 3 * 4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc. 5 * 6 * 7 * Permission to use, copy, modify, and/or distribute this software for 8 * any purpose with or without fee is hereby granted, provided that the 9 * above copyright notice and this permission notice appear in all 10 * copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 19 * PERFORMANCE OF THIS SOFTWARE. 20 */ 21 22 /* 23 * This file was originally distributed by Qualcomm Atheros, Inc. 24 * under proprietary terms before Copyright ownership was assigned 25 * to the Linux Foundation. 26 */ 27 28 #ifndef __IF_SDIO_H__ 29 #define __IF_SDIO_H__ 30 31 #include <linux/version.h> 32 #include <linux/semaphore.h> 33 #include <linux/interrupt.h> 34 #include <osdep.h> 35 #include <ol_if_athvar.h> 36 #include <athdefs.h> 37 #include "a_osapi.h" 38 #include "hif_internal.h" 39 40 41 #define AR6320_HEADERS_DEF 42 43 #define ATH_DBG_DEFAULT 0 44 45 #define RAMDUMP_ADDR 0x8F000000 46 #define RAMDUMP_SIZE 0x700000 47 48 struct hif_sdio_softc { 49 struct hif_softc ol_sc; 50 struct device *dev; 51 struct _NIC_DEV aps_osdev; 52 struct tasklet_struct intr_tq; /* tasklet */ 53 54 int irq; 55 /* 56 * Guard changes to Target HW state and to software 57 * structures that track hardware state. 58 */ 59 spinlock_t target_lock; 60 void *hif_handle; 61 void *ramdump_base; 62 unsigned long ramdump_address; 63 unsigned long ramdump_size; 64 struct targetdef_s *targetdef; 65 struct hostdef_s *hostdef; 66 }; 67 68 #if defined(CONFIG_ATH_PROCFS_DIAG_SUPPORT) 69 int athdiag_procfs_init(void *scn); 70 void athdiag_procfs_remove(void); 71 #else 72 static inline int athdiag_procfs_init(void *scn) 73 { 74 return 0; 75 } 76 77 static inline void athdiag_procfs_remove(void) 78 { 79 } 80 #endif 81 82 #define DMA_MAPPING_ERROR(dev, addr) dma_mapping_error((dev), (addr)) 83 84 int ath_sdio_probe(void *context, void *hif_handle); 85 void ath_sdio_remove(void *context, void *hif_handle); 86 int ath_sdio_suspend(void *context); 87 int ath_sdio_resume(void *context); 88 89 /*These functions are exposed to HDD*/ 90 void hif_init_qdf_ctx(qdf_device_t qdf_dev, void *ol_sc); 91 void hif_deinit_qdf_ctx(void *ol_sc); 92 93 int hif_sdio_device_inserted(struct device *dev, 94 const struct sdio_device_id *id); 95 void hif_sdio_stop(struct hif_softc *hif_ctx); 96 void hif_sdio_shutdown(struct hif_softc *hif_ctx); 97 void hif_sdio_device_removed(struct sdio_func *func); 98 int hif_device_suspend(struct device *dev); 99 int hif_device_resume(struct device *dev); 100 void hif_register_tbl_attach(struct hif_softc *scn, 101 u32 hif_type); 102 void target_register_tbl_attach(struct hif_softc *scn, 103 u32 target_type); 104 void hif_enable_power_gating(void *hif_ctx); 105 void hif_sdio_close(struct hif_softc *hif_sc); 106 QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc, 107 enum qdf_bus_type bus_type); 108 void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device, 109 uint32_t *targregs); 110 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx, 111 struct bmi_target_info *targ_info); 112 QDF_STATUS 113 hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer, 114 uint32_t length); 115 QDF_STATUS 116 hif_bmi_raw_read(struct hif_sdio_dev *device, char *buffer, 117 u32 length, bool want_timeout); 118 119 #endif /* __IF_SDIO_H__ */ 120