1 /* 2 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 #ifndef __MT76_DMA_H 17 #define __MT76_DMA_H 18 19 #define DMA_DUMMY_DATA ((void *)~0) 20 21 #define MT_RING_SIZE 0x10 22 23 #define MT_DMA_CTL_SD_LEN1 GENMASK(13, 0) 24 #define MT_DMA_CTL_LAST_SEC1 BIT(14) 25 #define MT_DMA_CTL_BURST BIT(15) 26 #define MT_DMA_CTL_SD_LEN0 GENMASK(29, 16) 27 #define MT_DMA_CTL_LAST_SEC0 BIT(30) 28 #define MT_DMA_CTL_DMA_DONE BIT(31) 29 30 #define MT_DMA_HDR_LEN 4 31 #define MT_RX_INFO_LEN 4 32 #define MT_FCE_INFO_LEN 4 33 #define MT_RX_RXWI_LEN 32 34 35 struct mt76_desc { 36 __le32 buf0; 37 __le32 ctrl; 38 __le32 buf1; 39 __le32 info; 40 } __packed __aligned(4); 41 42 enum mt76_qsel { 43 MT_QSEL_MGMT, 44 MT_QSEL_HCCA, 45 MT_QSEL_EDCA, 46 MT_QSEL_EDCA_2, 47 }; 48 49 enum mt76_mcu_evt_type { 50 EVT_CMD_DONE, 51 EVT_CMD_ERROR, 52 EVT_CMD_RETRY, 53 EVT_EVENT_PWR_RSP, 54 EVT_EVENT_WOW_RSP, 55 EVT_EVENT_CARRIER_DETECT_RSP, 56 EVT_EVENT_DFS_DETECT_RSP, 57 }; 58 59 void mt76_dma_attach(struct mt76_dev *dev); 60 void mt76_dma_cleanup(struct mt76_dev *dev); 61 62 #endif 63