hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c
old mode 100644new mode 100755
....@@ -83,18 +83,8 @@
8383 #endif /* !defined(OOB_INTR_ONLY) */
8484 static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr);
8585 #if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
86
-#if defined(MMC_SW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
87
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
88
-extern int mmc_sw_reset(struct mmc_card *card);
89
-#else
86
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
9087 extern int mmc_sw_reset(struct mmc_host *host);
91
-#endif
92
-#elif defined(MMC_HW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
93
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
94
-extern int mmc_hw_reset(struct mmc_card *card);
95
-#else
96
-extern int mmc_hw_reset(struct mmc_host *host);
97
-#endif
9888 #else
9989 extern int sdio_reset_comm(struct mmc_card *card);
10090 #endif
....@@ -112,8 +102,6 @@
112102 #ifndef CUSTOM_SDIO_F1_BLKSIZE
113103 #define CUSTOM_SDIO_F1_BLKSIZE DEFAULT_SDIO_F1_BLKSIZE
114104 #endif
115
-
116
-#define COPY_BUF_SIZE (SDPCM_MAXGLOM_SIZE * 1600)
117105
118106 #define MAX_IO_RW_EXTENDED_BLK 511
119107
....@@ -194,7 +182,7 @@
194182 err_ret = sdio_enable_func(sd->func[1]);
195183 sdio_release_host(sd->func[1]);
196184 if (err_ret) {
197
- sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: %d\n", err_ret));
185
+ sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x\n", err_ret));
198186 }
199187
200188 return FALSE;
....@@ -221,14 +209,6 @@
221209 return NULL;
222210 }
223211 bzero((char *)sd, sizeof(sdioh_info_t));
224
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
225
- sd->copy_buf = MALLOC(osh, COPY_BUF_SIZE);
226
- if (sd->copy_buf == NULL) {
227
- sd_err(("%s: MALLOC of %d-byte copy_buf failed\n",
228
- __FUNCTION__, COPY_BUF_SIZE));
229
- goto fail;
230
- }
231
-#endif
232212 sd->osh = osh;
233213 sd->fake_func0.num = 0;
234214 sd->fake_func0.card = func->card;
....@@ -293,9 +273,6 @@
293273 return sd;
294274
295275 fail:
296
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
297
- MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE);
298
-#endif
299276 MFREE(sd->osh, sd, sizeof(sdioh_info_t));
300277 return NULL;
301278 }
....@@ -324,9 +301,6 @@
324301 sd->func[1] = NULL;
325302 sd->func[2] = NULL;
326303
327
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
328
- MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE);
329
-#endif
330304 MFREE(sd->osh, sd, sizeof(sdioh_info_t));
331305 }
332306 return SDIOH_API_RC_SUCCESS;
....@@ -1232,7 +1206,7 @@
12321206 if (err_ret)
12331207 #endif /* MMC_SDIO_ABORT */
12341208 {
1235
- sd_err(("bcmsdh_sdmmc: Failed to %s word F%d:@0x%05x=%02x, Err: %d\n",
1209
+ sd_err(("bcmsdh_sdmmc: Failed to %s word F%d:@0x%05x=%02x, Err: 0x%08x\n",
12361210 rw ? "Write" : "Read", func, addr, *word, err_ret));
12371211 }
12381212 }
....@@ -1382,8 +1356,7 @@
13821356 return SDIOH_API_RC_FAIL;
13831357 }
13841358 }
1385
- }
1386
- else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) {
1359
+ } else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) {
13871360 for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
13881361 ttl_len += PKTLEN(sd->osh, pnext);
13891362 }
....@@ -1392,20 +1365,16 @@
13921365 for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
13931366 uint8 *buf = (uint8*)PKTDATA(sd->osh, pnext);
13941367 pkt_len = PKTLEN(sd->osh, pnext);
1368
+
13951369 if (!localbuf) {
1396
-#ifdef BCMSDIOH_STATIC_COPY_BUF
1397
- if (ttl_len <= COPY_BUF_SIZE)
1398
- localbuf = sd->copy_buf;
1399
-#else
14001370 localbuf = (uint8 *)MALLOC(sd->osh, ttl_len);
1401
-#endif
14021371 if (localbuf == NULL) {
1403
- sd_err(("%s: %s localbuf malloc FAILED ttl_len=%d\n",
1404
- __FUNCTION__, (write) ? "TX" : "RX", ttl_len));
1405
- ttl_len -= pkt_len;
1372
+ sd_err(("%s: %s TXGLOM: localbuf malloc FAILED\n",
1373
+ __FUNCTION__, (write) ? "TX" : "RX"));
14061374 goto txglomfail;
14071375 }
14081376 }
1377
+
14091378 bcopy(buf, (localbuf + local_plen), pkt_len);
14101379 local_plen += pkt_len;
14111380 if (PKTNEXT(sd->osh, pnext))
....@@ -1450,10 +1419,8 @@
14501419 return SDIOH_API_RC_FAIL;
14511420 }
14521421
1453
-#ifndef BCMSDIOH_STATIC_COPY_BUF
14541422 if (localbuf)
14551423 MFREE(sd->osh, localbuf, ttl_len);
1456
-#endif
14571424
14581425 #ifndef PKT_STATICS
14591426 if (sd_msglevel & SDH_COST_VAL)
....@@ -1782,37 +1749,18 @@
17821749 #if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
17831750 static int sdio_sw_reset(sdioh_info_t *sd)
17841751 {
1785
- struct mmc_card *card = sd->func[0]->card;
1752
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
1753
+ struct mmc_host *host = sd->func[0]->card->host;
1754
+#endif
17861755 int err = 0;
17871756
1788
-#if defined(MMC_SW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
1789
- /* MMC_SW_RESET */
1790
- printf("%s: call mmc_sw_reset\n", __FUNCTION__);
1757
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
1758
+ printf("%s: Enter\n", __FUNCTION__);
17911759 sdio_claim_host(sd->func[0]);
1792
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
1793
- err = mmc_sw_reset(card);
1794
-#else
1795
- err = mmc_sw_reset(card->host);
1796
-#endif
1797
- sdio_release_host(sd->func[0]);
1798
-#elif defined(MMC_HW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
1799
- /* MMC_HW_RESET */
1800
- printf("%s: call mmc_hw_reset\n", __FUNCTION__);
1801
- sdio_claim_host(sd->func[0]);
1802
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
1803
- while (atomic_read(&card->sdio_funcs_probed) > 1) {
1804
- atomic_dec(&card->sdio_funcs_probed);
1805
- }
1806
-#endif
1807
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
1808
- err = mmc_hw_reset(card);
1809
-#else
1810
- err = mmc_hw_reset(card->host);
1811
-#endif
1760
+ err = mmc_sw_reset(host);
18121761 sdio_release_host(sd->func[0]);
18131762 #else
1814
- /* sdio_reset_comm */
1815
- err = sdio_reset_comm(card);
1763
+ err = sdio_reset_comm(sd->func[0]->card);
18161764 #endif
18171765
18181766 if (err)