20 #ifndef __CARD_SDIO_H__
21 #define __CARD_SDIO_H__
31 #ifndef CSR_WIFI_HIP_TA_DISABLE
52 #define RESUME_XMIT_THRESHOLD 4
67 #define TO_HOST_FLUSH_THRESHOLD (500 * 5)
71 #define SDIO_CCCR_SDIO_REVISION (0x00)
72 #define SDIO_SD_SPEC_REVISION (0x01)
73 #define SDIO_IO_ENABLE (0x02)
74 #define SDIO_IO_READY (0x03)
75 #define SDIO_INT_ENABLE (0x04)
76 #define SDIO_INT_PENDING (0x05)
77 #define SDIO_IO_ABORT (0x06)
78 #define SDIO_BUS_IFACE_CONTROL (0x07)
79 #define SDIO_CARD_CAPABILOTY (0x08)
80 #define SDIO_COMMON_CIS_POINTER (0x09)
81 #define SDIO_BUS_SUSPEND (0x0C)
82 #define SDIO_FUNCTION_SELECT (0x0D)
83 #define SDIO_EXEC_FLAGS (0x0E)
84 #define SDIO_READY_FLAGS (0x0F)
85 #define SDIO_FN0_BLOCK_SIZE (0x10)
86 #define SDIO_POWER_CONTROL (0x12)
87 #define SDIO_VENDOR_START (0xF0)
89 #define SDIO_CSR_HOST_WAKEUP (0xf0)
90 #define SDIO_CSR_HOST_INT_CLEAR (0xf1)
91 #define SDIO_CSR_FROM_HOST_SCRATCH0 (0xf2)
92 #define SDIO_CSR_FROM_HOST_SCRATCH1 (0xf3)
93 #define SDIO_CSR_TO_HOST_SCRATCH0 (0xf4)
94 #define SDIO_CSR_TO_HOST_SCRATCH1 (0xf5)
95 #define SDIO_CSR_FUNC_EN (0xf6)
96 #define SDIO_CSR_CSPI_MODE (0xf7)
97 #define SDIO_CSR_CSPI_STATUS (0xf8)
98 #define SDIO_CSR_CSPI_PADDING (0xf9)
101 #define UNIFI_SD_INT_ENABLE_IENM 0x0001
103 #ifdef CSR_PRE_ALLOC_NET_DATA
104 #define BULK_DATA_PRE_ALLOC_NUM 16
193 #define SDIO_CONFIG_DATA_SIZE 30
196 #define SDIO_INIT_FLAG_OFFSET 0x12
197 #define SDIO_TO_HOST_SIG_PADDING_OFFSET 0x1C
211 #define SDIO_CMD_SIGNAL 0x00
212 #define SDIO_CMD_TO_HOST_TRANSFER 0x01
213 #define SDIO_CMD_TO_HOST_TRANSFER_ACK 0x02
214 #define SDIO_CMD_FROM_HOST_TRANSFER 0x03
215 #define SDIO_CMD_FROM_HOST_TRANSFER_ACK 0x04
216 #define SDIO_CMD_CLEAR_SLOT 0x05
217 #define SDIO_CMD_OVERLAY_TRANSFER 0x06
218 #define SDIO_CMD_OVERLAY_TRANSFER_ACK 0x07
219 #define SDIO_CMD_FROM_HOST_AND_CLEAR 0x08
220 #define SDIO_CMD_PADDING 0x0f
222 #define SLOT_DIR_TO_HOST 0x8000
229 #define UNIFI_INIT_BULK_DATA(bulk_data_slot) \
231 (bulk_data_slot)->os_data_ptr = NULL; \
232 (bulk_data_slot)->data_length = 0; \
233 (bulk_data_slot)->os_net_buf_ptr = NULL; \
234 (bulk_data_slot)->net_buf_length = 0; \
261 #define UNIFI_QUEUE_NAME_MAX_LENGTH 16
276 #define UNIFI_RESERVED_COMMAND_SLOTS 2
279 #define UNIFI_PACKETS_INTERVAL 1000
316 #define CSR_WIFI_HIP_Q_SLOTS_USED(q) \
317 (((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \
318 ((q)->q_wr_ptr - (q)->q_rd_ptr + (q)->q_length) : ((q)->q_wr_ptr - (q)->q_rd_ptr))
326 #define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \
327 ((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1)
336 #define CSR_WIFI_HIP_Q_SLOT_DATA(q, slot) \
345 #define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \
354 #define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \
364 #define CSR_WIFI_HIP_Q_WRAP(q, x) \
365 ((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x)))
371 #define CSR_WIFI_HIP_Q_INC_R(q) \
372 ((q)->q_rd_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_rd_ptr + 1))
378 #define CSR_WIFI_HIP_Q_INC_W(q) \
379 ((q)->q_wr_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_wr_ptr + 1))
410 u32 *fh_slot_host_tag_record;
415 char build_id_string[128];
442 #define card_is_tx_q_paused(card, q) (card->tx_q_paused_flag[q])
443 #define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0)
444 #define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1)
455 u8 request_max_clock;
458 u32 sdio_clock_speed;
480 q_t fh_command_queue;
493 s32 from_host_signals_w;
494 s32 from_host_signals_r;
495 s32 to_host_signals_r;
496 s32 to_host_signals_w;
505 #define UNIFI_FH_BUF_SIZE 1024
521 u32 unifi_interrupt_seq;
522 u8 generate_interrupt;
535 s16 from_host_data_head;
561 u32 sdio_bytes_written;
563 u8 memory_resources_allocated;
566 u16 sdio_io_block_size;
569 u8 sdio_io_block_pad;
574 #ifndef CSR_WIFI_HIP_TA_DISABLE
580 s16 request_coredump_on_reset;
585 #ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
597 u32 cmd52_f0_r_count;
598 u32 cmd52_f0_w_count;
599 u32 cmd52_r8or16_count;
600 u32 cmd52_w8or16_count;
606 u32 sdio_cmd_clear_slot;
607 u32 sdio_cmd_to_host;
608 u32 sdio_cmd_from_host;
609 u32 sdio_cmd_from_host_and_clear;
611 struct cmd_profile cmd_prof;
622 u32 panic_data_phy_addr;
623 u32 panic_data_mac_addr;
624 u16 last_phy_panic_code;
625 u16 last_phy_panic_arg;
626 u16 last_mac_panic_code;
627 u16 last_mac_panic_arg;
628 #ifdef CSR_PRE_ALLOC_NET_DATA
630 u16 prealloc_netdata_r;
631 u16 prealloc_netdata_w;
671 #define UNIFI_SDIO_READ 0
672 #define UNIFI_SDIO_WRITE 1
690 #ifdef CSR_PRE_ALLOC_NET_DATA