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 MT_RING_SIZE 0x10 20 21 #define MT_DMA_CTL_SD_LEN1 GENMASK(13, 0) 22 #define MT_DMA_CTL_LAST_SEC1 BIT(14) 23 #define MT_DMA_CTL_BURST BIT(15) 24 #define MT_DMA_CTL_SD_LEN0 GENMASK(29, 16) 25 #define MT_DMA_CTL_LAST_SEC0 BIT(30) 26 #define MT_DMA_CTL_DMA_DONE BIT(31) 27 28 struct mt76_desc { 29 __le32 buf0; 30 __le32 ctrl; 31 __le32 buf1; 32 __le32 info; 33 } __packed __aligned(4); 34 35 int mt76_dma_attach(struct mt76_dev *dev); 36 void mt76_dma_cleanup(struct mt76_dev *dev); 37 38 #endif 39