GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / rtlwifi / halmac / halmac_sdio_reg.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2016  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 #ifndef __HALMAC_SDIO_REG_H__
26 #define __HALMAC_SDIO_REG_H__
27
28 /* SDIO CMD address mapping */
29
30 #define HALMAC_SDIO_4BYTE_LEN_MASK 0x1FFF
31 #define HALMAC_SDIO_LOCAL_MSK 0x0FFF
32 #define HALMAC_WLAN_MAC_REG_MSK 0xFFFF
33 #define HALMAC_WLAN_IOREG_MSK 0xFFFF
34
35 /* Sdio address for SDIO Local Reg, TRX FIFO, MAC Reg */
36 enum halmac_sdio_cmd_addr {
37         HALMAC_SDIO_CMD_ADDR_SDIO_REG = 0,
38         HALMAC_SDIO_CMD_ADDR_MAC_REG = 8,
39         HALMAC_SDIO_CMD_ADDR_TXFF_HIGH = 4,
40         HALMAC_SDIO_CMD_ADDR_TXFF_LOW = 6,
41         HALMAC_SDIO_CMD_ADDR_TXFF_NORMAL = 5,
42         HALMAC_SDIO_CMD_ADDR_TXFF_EXTRA = 7,
43         HALMAC_SDIO_CMD_ADDR_RXFF = 7,
44 };
45
46 /* IO Bus domain address mapping */
47 #define SDIO_LOCAL_OFFSET 0x10250000
48 #define WLAN_IOREG_OFFSET 0x10260000
49 #define FW_FIFO_OFFSET 0x10270000
50 #define TX_HIQ_OFFSET 0x10310000
51 #define TX_MIQ_OFFSET 0x10320000
52 #define TX_LOQ_OFFSET 0x10330000
53 #define TX_EXQ_OFFSET 0x10350000
54 #define RX_RXOFF_OFFSET 0x10340000
55
56 /* Get TX WLAN FIFO information in CMD53 addr  */
57 #define GET_WLAN_TXFF_DEVICE_ID(__cmd53_addr)                                  \
58         LE_BITS_TO_4BYTE((u32 *)__cmd53_addr, 13, 4)
59 #define GET_WLAN_TXFF_PKT_SIZE(__cmd53_addr)                                   \
60         (LE_BITS_TO_4BYTE((u32 *)__cmd53_addr, 0, 13) << 2)
61
62 #endif /* __HALMAC_SDIO_REG_H__ */