hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c
old mode 100644new mode 100755
....@@ -71,6 +71,9 @@
7171 uint16 reqid;
7272 uint8 pending;
7373 uint32 lastcmd;
74
+#ifdef BCMDBUS
75
+ uint ctl_completed;
76
+#endif /* BCMDBUS */
7477 uint8 bus_header[BUS_HEADER_LEN];
7578 cdc_ioctl_t msg;
7679 unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
....@@ -86,6 +89,9 @@
8689 static int
8790 dhdcdc_msg(dhd_pub_t *dhd)
8891 {
92
+#ifdef BCMDBUS
93
+ int timeout = 0;
94
+#endif /* BCMDBUS */
8995 int err = 0;
9096 dhd_prot_t *prot = dhd->prot;
9197 int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
....@@ -102,8 +108,46 @@
102108 len = CDC_MAX_MSG_SIZE;
103109
104110 /* Send request */
111
+#ifdef BCMDBUS
112
+ prot->ctl_completed = FALSE;
113
+ err = dbus_send_ctl(dhd->bus, (void *)&prot->msg, len);
114
+ if (err) {
115
+ DHD_ERROR(("dbus_send_ctl error=0x%x\n", err));
116
+ DHD_OS_WAKE_UNLOCK(dhd);
117
+ return err;
118
+ }
119
+#else
105120 err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
121
+#endif /* BCMDBUS */
106122
123
+#ifdef BCMDBUS
124
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
125
+ if ((!timeout) || (!prot->ctl_completed)) {
126
+ DHD_ERROR(("Txctl timeout %d ctl_completed %d\n",
127
+ timeout, prot->ctl_completed));
128
+ DHD_ERROR(("Txctl wait timed out\n"));
129
+ err = -1;
130
+ }
131
+#endif /* BCMDBUS */
132
+#if defined(BCMDBUS) && defined(INTR_EP_ENABLE)
133
+ /* If the ctl write is successfully completed, wait for an acknowledgement
134
+ * that indicates that it is now ok to do ctl read from the dongle
135
+ */
136
+ if (err != -1) {
137
+ prot->ctl_completed = FALSE;
138
+ if (dbus_poll_intr(dhd->dbus)) {
139
+ DHD_ERROR(("dbus_poll_intr not submitted\n"));
140
+ } else {
141
+ /* interrupt polling is sucessfully submitted. Wait for dongle to send
142
+ * interrupt
143
+ */
144
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
145
+ if (!timeout) {
146
+ DHD_ERROR(("intr poll wait timed out\n"));
147
+ }
148
+ }
149
+ }
150
+#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */
107151 DHD_OS_WAKE_UNLOCK(dhd);
108152 return err;
109153 }
....@@ -111,6 +155,9 @@
111155 static int
112156 dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
113157 {
158
+#ifdef BCMDBUS
159
+ int timeout = 0;
160
+#endif /* BCMDBUS */
114161 int ret;
115162 int cdc_len = len + sizeof(cdc_ioctl_t);
116163 dhd_prot_t *prot = dhd->prot;
....@@ -118,7 +165,29 @@
118165 DHD_TRACE(("%s: Enter\n", __FUNCTION__));
119166
120167 do {
168
+#ifdef BCMDBUS
169
+ prot->ctl_completed = FALSE;
170
+ ret = dbus_recv_ctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
171
+ if (ret) {
172
+ DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret));
173
+ goto done;
174
+ }
175
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
176
+ if ((!timeout) || (!prot->ctl_completed)) {
177
+ DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n",
178
+ timeout, prot->ctl_completed));
179
+ ret = -ETIMEDOUT;
180
+ goto done;
181
+ }
182
+
183
+ /* XXX FIX: Must return cdc_len, not len, because after query_ioctl()
184
+ * it subtracts sizeof(cdc_ioctl_t); The other approach is
185
+ * to have dbus_recv_ctl() return actual len.
186
+ */
187
+ ret = cdc_len;
188
+#else
121189 ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
190
+#endif /* BCMDBUS */
122191 if (ret < 0)
123192 break;
124193 } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
....@@ -128,6 +197,9 @@
128197 ret = len;
129198 }
130199
200
+#ifdef BCMDBUS
201
+done:
202
+#endif /* BCMDBUS */
131203 return ret;
132204 }
133205
....@@ -330,6 +402,24 @@
330402 done:
331403 return ret;
332404 }
405
+
406
+#ifdef BCMDBUS
407
+int
408
+dhd_prot_ctl_complete(dhd_pub_t *dhd)
409
+{
410
+ dhd_prot_t *prot;
411
+
412
+ if (dhd == NULL)
413
+ return BCME_ERROR;
414
+
415
+ prot = dhd->prot;
416
+
417
+ ASSERT(prot);
418
+ prot->ctl_completed = TRUE;
419
+ dhd_os_ioctl_resp_wake(dhd);
420
+ return 0;
421
+}
422
+#endif /* BCMDBUS */
333423
334424 /* XXX: due to overlays this should not be called directly; call dhd_wl_ioctl() instead */
335425 int
....@@ -549,17 +639,6 @@
549639 PKTPULL(dhd->osh, pktbuf, (data_offset << 2));
550640 return 0;
551641 }
552
-
553
-#ifdef DHD_LOSSLESS_ROAMING
554
-int dhd_update_sdio_data_prio_map(dhd_pub_t *dhdp)
555
-{
556
- const uint8 prio2tid[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
557
-
558
- bcopy(prio2tid, dhdp->flow_prio_map, sizeof(uint8) * NUMPRIO);
559
-
560
- return BCME_OK;
561
-}
562
-#endif // DHD_LOSSLESS_ROAMING
563642
564643 int
565644 dhd_prot_attach(dhd_pub_t *dhd)