forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/ath/ath10k/sdio.h
....@@ -1,33 +1,14 @@
1
+/* SPDX-License-Identifier: ISC */
12 /*
23 * Copyright (c) 2004-2011 Atheros Communications Inc.
34 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
45 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
5
- *
6
- * Permission to use, copy, modify, and/or distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
176 */
187
198 #ifndef _SDIO_H_
209 #define _SDIO_H_
2110
2211 #define ATH10K_HIF_MBOX_BLOCK_SIZE 256
23
-
24
-#define QCA_MANUFACTURER_ID_BASE GENMASK(11, 8)
25
-#define QCA_MANUFACTURER_ID_AR6005_BASE 0x5
26
-#define QCA_MANUFACTURER_ID_QCA9377_BASE 0x7
27
-#define QCA_SDIO_ID_AR6005_BASE 0x500
28
-#define QCA_SDIO_ID_QCA9377_BASE 0x700
29
-#define QCA_MANUFACTURER_ID_REV_MASK 0x00FF
30
-#define QCA_MANUFACTURER_CODE 0x271 /* Qualcomm/Atheros */
3112
3213 #define ATH10K_SDIO_MAX_BUFFER_SIZE 4096 /*Unsure of this constant*/
3314
....@@ -48,7 +29,7 @@
4829 (ATH10K_SDIO_MAX_BUFFER_SIZE - sizeof(struct ath10k_htc_hdr))
4930
5031 #define ATH10K_HIF_MBOX_NUM_MAX 4
51
-#define ATH10K_SDIO_BUS_REQUEST_MAX_NUM 64
32
+#define ATH10K_SDIO_BUS_REQUEST_MAX_NUM 1024
5233
5334 #define ATH10K_SDIO_HIF_COMMUNICATION_TIMEOUT_HZ (100 * HZ)
5435
....@@ -100,15 +81,30 @@
10081 * to the maximum value (HTC_HOST_MAX_MSG_PER_RX_BUNDLE).
10182 *
10283 * in this case the driver must allocate
103
- * (HTC_HOST_MAX_MSG_PER_RX_BUNDLE * HTC_HOST_MAX_MSG_PER_RX_BUNDLE) skb's.
84
+ * (HTC_HOST_MAX_MSG_PER_RX_BUNDLE * 2) skb's.
10485 */
10586 #define ATH10K_SDIO_MAX_RX_MSGS \
106
- (HTC_HOST_MAX_MSG_PER_RX_BUNDLE * HTC_HOST_MAX_MSG_PER_RX_BUNDLE)
87
+ (HTC_HOST_MAX_MSG_PER_RX_BUNDLE * 2)
10788
10889 #define ATH10K_FIFO_TIMEOUT_AND_CHIP_CONTROL 0x00000868u
10990 #define ATH10K_FIFO_TIMEOUT_AND_CHIP_CONTROL_DISABLE_SLEEP_OFF 0xFFFEFFFF
11091 #define ATH10K_FIFO_TIMEOUT_AND_CHIP_CONTROL_DISABLE_SLEEP_ON 0x10000
11192
93
+enum sdio_mbox_state {
94
+ SDIO_MBOX_UNKNOWN_STATE = 0,
95
+ SDIO_MBOX_REQUEST_TO_SLEEP_STATE = 1,
96
+ SDIO_MBOX_SLEEP_STATE = 2,
97
+ SDIO_MBOX_AWAKE_STATE = 3,
98
+};
99
+
100
+#define ATH10K_CIS_READ_WAIT_4_RTC_CYCLE_IN_US 125
101
+#define ATH10K_CIS_RTC_STATE_ADDR 0x1138
102
+#define ATH10K_CIS_RTC_STATE_ON 0x01
103
+#define ATH10K_CIS_XTAL_SETTLE_DURATION_IN_US 1500
104
+#define ATH10K_CIS_READ_RETRY 10
105
+#define ATH10K_MIN_SLEEP_INACTIVITY_TIME_MS 50
106
+
107
+/* TODO: remove this and use skb->cb instead, much cleaner approach */
112108 struct ath10k_sdio_bus_request {
113109 struct list_head list;
114110
....@@ -137,7 +133,6 @@
137133 bool part_of_bundle;
138134 bool last_in_bundle;
139135 bool trailer_only;
140
- int status;
141136 };
142137
143138 struct ath10k_sdio_irq_proc_regs {
....@@ -149,8 +144,8 @@
149144 u8 rx_lookahead_valid;
150145 u8 host_int_status2;
151146 u8 gmbox_rx_avail;
152
- __le32 rx_lookahead[2];
153
- __le32 rx_gmbox_lookahead_alias[2];
147
+ __le32 rx_lookahead[2 * ATH10K_HIF_MBOX_NUM_MAX];
148
+ __le32 int_status_enable;
154149 };
155150
156151 struct ath10k_sdio_irq_enable_regs {
....@@ -198,6 +193,9 @@
198193 struct ath10k_sdio_bus_request bus_req[ATH10K_SDIO_BUS_REQUEST_MAX_NUM];
199194 /* free list of bus requests */
200195 struct list_head bus_req_freeq;
196
+
197
+ struct sk_buff_head rx_head;
198
+
201199 /* protects access to bus_req_freeq */
202200 spinlock_t lock;
203201
....@@ -206,6 +204,13 @@
206204
207205 struct ath10k *ar;
208206 struct ath10k_sdio_irq_data irq_data;
207
+
208
+ /* temporary buffer for sdio read.
209
+ * It is allocated when probe, and used for receive bundled packets,
210
+ * the read for bundled packets is not parallel, so it does not need
211
+ * protected.
212
+ */
213
+ u8 *vsg_buffer;
209214
210215 /* temporary buffer for BMI requests */
211216 u8 *bmi_buf;
....@@ -217,6 +222,10 @@
217222 struct list_head wr_asyncq;
218223 /* protects access to wr_asyncq */
219224 spinlock_t wr_async_lock;
225
+
226
+ struct work_struct async_work_rx;
227
+ struct timer_list sleep_timer;
228
+ enum sdio_mbox_state mbox_state;
220229 };
221230
222231 static inline struct ath10k_sdio *ath10k_sdio_priv(struct ath10k *ar)