18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2010-2011 Atheros Communications Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef AR9003_MAC_H
188c2ecf20Sopenharmony_ci#define AR9003_MAC_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define AR_DescId	0xffff0000
218c2ecf20Sopenharmony_ci#define AR_DescId_S	16
228c2ecf20Sopenharmony_ci#define AR_CtrlStat	0x00004000
238c2ecf20Sopenharmony_ci#define AR_CtrlStat_S	14
248c2ecf20Sopenharmony_ci#define AR_TxRxDesc	0x00008000
258c2ecf20Sopenharmony_ci#define AR_TxRxDesc_S	15
268c2ecf20Sopenharmony_ci#define AR_TxQcuNum	0x00000f00
278c2ecf20Sopenharmony_ci#define AR_TxQcuNum_S	8
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define AR_BufLen	0x0fff0000
308c2ecf20Sopenharmony_ci#define AR_BufLen_S	16
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define AR_TxDescId	0xffff0000
338c2ecf20Sopenharmony_ci#define AR_TxDescId_S	16
348c2ecf20Sopenharmony_ci#define AR_TxPtrChkSum	0x0000ffff
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define AR_LowRxChain	0x00004000
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define AR_Not_Sounding	0x20000000
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* ctl 12 */
418c2ecf20Sopenharmony_ci#define AR_PAPRDChainMask	0x00000e00
428c2ecf20Sopenharmony_ci#define AR_PAPRDChainMask_S	9
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define MAP_ISR_S2_CST          6
458c2ecf20Sopenharmony_ci#define MAP_ISR_S2_GTT          6
468c2ecf20Sopenharmony_ci#define MAP_ISR_S2_TIM          3
478c2ecf20Sopenharmony_ci#define MAP_ISR_S2_CABEND       0
488c2ecf20Sopenharmony_ci#define MAP_ISR_S2_DTIMSYNC     7
498c2ecf20Sopenharmony_ci#define MAP_ISR_S2_DTIM         7
508c2ecf20Sopenharmony_ci#define MAP_ISR_S2_TSFOOR       4
518c2ecf20Sopenharmony_ci#define MAP_ISR_S2_BB_WATCHDOG  6
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define AR9003TXC_CONST(_ds) ((const struct ar9003_txc *) _ds)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct ar9003_rxs {
568c2ecf20Sopenharmony_ci	u32 ds_info;
578c2ecf20Sopenharmony_ci	u32 status1;
588c2ecf20Sopenharmony_ci	u32 status2;
598c2ecf20Sopenharmony_ci	u32 status3;
608c2ecf20Sopenharmony_ci	u32 status4;
618c2ecf20Sopenharmony_ci	u32 status5;
628c2ecf20Sopenharmony_ci	u32 status6;
638c2ecf20Sopenharmony_ci	u32 status7;
648c2ecf20Sopenharmony_ci	u32 status8;
658c2ecf20Sopenharmony_ci	u32 status9;
668c2ecf20Sopenharmony_ci	u32 status10;
678c2ecf20Sopenharmony_ci	u32 status11;
688c2ecf20Sopenharmony_ci} __packed __aligned(4);
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* Transmit Control Descriptor */
718c2ecf20Sopenharmony_cistruct ar9003_txc {
728c2ecf20Sopenharmony_ci	u32 info;   /* descriptor information */
738c2ecf20Sopenharmony_ci	u32 link;   /* link pointer */
748c2ecf20Sopenharmony_ci	u32 data0;  /* data pointer to 1st buffer */
758c2ecf20Sopenharmony_ci	u32 ctl3;   /* DMA control 3  */
768c2ecf20Sopenharmony_ci	u32 data1;  /* data pointer to 2nd buffer */
778c2ecf20Sopenharmony_ci	u32 ctl5;   /* DMA control 5  */
788c2ecf20Sopenharmony_ci	u32 data2;  /* data pointer to 3rd buffer */
798c2ecf20Sopenharmony_ci	u32 ctl7;   /* DMA control 7  */
808c2ecf20Sopenharmony_ci	u32 data3;  /* data pointer to 4th buffer */
818c2ecf20Sopenharmony_ci	u32 ctl9;   /* DMA control 9  */
828c2ecf20Sopenharmony_ci	u32 ctl10;  /* DMA control 10 */
838c2ecf20Sopenharmony_ci	u32 ctl11;  /* DMA control 11 */
848c2ecf20Sopenharmony_ci	u32 ctl12;  /* DMA control 12 */
858c2ecf20Sopenharmony_ci	u32 ctl13;  /* DMA control 13 */
868c2ecf20Sopenharmony_ci	u32 ctl14;  /* DMA control 14 */
878c2ecf20Sopenharmony_ci	u32 ctl15;  /* DMA control 15 */
888c2ecf20Sopenharmony_ci	u32 ctl16;  /* DMA control 16 */
898c2ecf20Sopenharmony_ci	u32 ctl17;  /* DMA control 17 */
908c2ecf20Sopenharmony_ci	u32 ctl18;  /* DMA control 18 */
918c2ecf20Sopenharmony_ci	u32 ctl19;  /* DMA control 19 */
928c2ecf20Sopenharmony_ci	u32 ctl20;  /* DMA control 20 */
938c2ecf20Sopenharmony_ci	u32 ctl21;  /* DMA control 21 */
948c2ecf20Sopenharmony_ci	u32 ctl22;  /* DMA control 22 */
958c2ecf20Sopenharmony_ci	u32 ctl23;  /* DMA control 23 */
968c2ecf20Sopenharmony_ci	u32 pad[8]; /* pad to cache line (128 bytes/32 dwords) */
978c2ecf20Sopenharmony_ci} __packed __aligned(4);
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistruct ar9003_txs {
1008c2ecf20Sopenharmony_ci	u32 ds_info;
1018c2ecf20Sopenharmony_ci	u32 status1;
1028c2ecf20Sopenharmony_ci	u32 status2;
1038c2ecf20Sopenharmony_ci	u32 status3;
1048c2ecf20Sopenharmony_ci	u32 status4;
1058c2ecf20Sopenharmony_ci	u32 status5;
1068c2ecf20Sopenharmony_ci	u32 status6;
1078c2ecf20Sopenharmony_ci	u32 status7;
1088c2ecf20Sopenharmony_ci	u32 status8;
1098c2ecf20Sopenharmony_ci} __packed __aligned(4);
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_civoid ar9003_hw_attach_mac_ops(struct ath_hw *hw);
1128c2ecf20Sopenharmony_civoid ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size);
1138c2ecf20Sopenharmony_civoid ath9k_hw_addrxbuf_edma(struct ath_hw *ah, u32 rxdp,
1148c2ecf20Sopenharmony_ci			    enum ath9k_rx_qtype qtype);
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ciint ath9k_hw_process_rxdesc_edma(struct ath_hw *ah,
1178c2ecf20Sopenharmony_ci				 struct ath_rx_status *rxs,
1188c2ecf20Sopenharmony_ci				 void *buf_addr);
1198c2ecf20Sopenharmony_civoid ath9k_hw_reset_txstatus_ring(struct ath_hw *ah);
1208c2ecf20Sopenharmony_civoid ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start,
1218c2ecf20Sopenharmony_ci			       u32 ts_paddr_start,
1228c2ecf20Sopenharmony_ci			       u16 size);
1238c2ecf20Sopenharmony_ci#endif
124