old mode 100644new mode 100755.. | .. |
---|
83 | 83 | #endif /* !defined(OOB_INTR_ONLY) */ |
---|
84 | 84 | static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr); |
---|
85 | 85 | #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) |
---|
90 | 87 | 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 |
---|
98 | 88 | #else |
---|
99 | 89 | extern int sdio_reset_comm(struct mmc_card *card); |
---|
100 | 90 | #endif |
---|
.. | .. |
---|
112 | 102 | #ifndef CUSTOM_SDIO_F1_BLKSIZE |
---|
113 | 103 | #define CUSTOM_SDIO_F1_BLKSIZE DEFAULT_SDIO_F1_BLKSIZE |
---|
114 | 104 | #endif |
---|
115 | | - |
---|
116 | | -#define COPY_BUF_SIZE (SDPCM_MAXGLOM_SIZE * 1600) |
---|
117 | 105 | |
---|
118 | 106 | #define MAX_IO_RW_EXTENDED_BLK 511 |
---|
119 | 107 | |
---|
.. | .. |
---|
194 | 182 | err_ret = sdio_enable_func(sd->func[1]); |
---|
195 | 183 | sdio_release_host(sd->func[1]); |
---|
196 | 184 | 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)); |
---|
198 | 186 | } |
---|
199 | 187 | |
---|
200 | 188 | return FALSE; |
---|
.. | .. |
---|
221 | 209 | return NULL; |
---|
222 | 210 | } |
---|
223 | 211 | 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 |
---|
232 | 212 | sd->osh = osh; |
---|
233 | 213 | sd->fake_func0.num = 0; |
---|
234 | 214 | sd->fake_func0.card = func->card; |
---|
.. | .. |
---|
293 | 273 | return sd; |
---|
294 | 274 | |
---|
295 | 275 | fail: |
---|
296 | | -#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF) |
---|
297 | | - MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE); |
---|
298 | | -#endif |
---|
299 | 276 | MFREE(sd->osh, sd, sizeof(sdioh_info_t)); |
---|
300 | 277 | return NULL; |
---|
301 | 278 | } |
---|
.. | .. |
---|
324 | 301 | sd->func[1] = NULL; |
---|
325 | 302 | sd->func[2] = NULL; |
---|
326 | 303 | |
---|
327 | | -#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF) |
---|
328 | | - MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE); |
---|
329 | | -#endif |
---|
330 | 304 | MFREE(sd->osh, sd, sizeof(sdioh_info_t)); |
---|
331 | 305 | } |
---|
332 | 306 | return SDIOH_API_RC_SUCCESS; |
---|
.. | .. |
---|
1232 | 1206 | if (err_ret) |
---|
1233 | 1207 | #endif /* MMC_SDIO_ABORT */ |
---|
1234 | 1208 | { |
---|
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", |
---|
1236 | 1210 | rw ? "Write" : "Read", func, addr, *word, err_ret)); |
---|
1237 | 1211 | } |
---|
1238 | 1212 | } |
---|
.. | .. |
---|
1382 | 1356 | return SDIOH_API_RC_FAIL; |
---|
1383 | 1357 | } |
---|
1384 | 1358 | } |
---|
1385 | | - } |
---|
1386 | | - else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) { |
---|
| 1359 | + } else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) { |
---|
1387 | 1360 | for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) { |
---|
1388 | 1361 | ttl_len += PKTLEN(sd->osh, pnext); |
---|
1389 | 1362 | } |
---|
.. | .. |
---|
1392 | 1365 | for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) { |
---|
1393 | 1366 | uint8 *buf = (uint8*)PKTDATA(sd->osh, pnext); |
---|
1394 | 1367 | pkt_len = PKTLEN(sd->osh, pnext); |
---|
| 1368 | + |
---|
1395 | 1369 | if (!localbuf) { |
---|
1396 | | -#ifdef BCMSDIOH_STATIC_COPY_BUF |
---|
1397 | | - if (ttl_len <= COPY_BUF_SIZE) |
---|
1398 | | - localbuf = sd->copy_buf; |
---|
1399 | | -#else |
---|
1400 | 1370 | localbuf = (uint8 *)MALLOC(sd->osh, ttl_len); |
---|
1401 | | -#endif |
---|
1402 | 1371 | 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")); |
---|
1406 | 1374 | goto txglomfail; |
---|
1407 | 1375 | } |
---|
1408 | 1376 | } |
---|
| 1377 | + |
---|
1409 | 1378 | bcopy(buf, (localbuf + local_plen), pkt_len); |
---|
1410 | 1379 | local_plen += pkt_len; |
---|
1411 | 1380 | if (PKTNEXT(sd->osh, pnext)) |
---|
.. | .. |
---|
1450 | 1419 | return SDIOH_API_RC_FAIL; |
---|
1451 | 1420 | } |
---|
1452 | 1421 | |
---|
1453 | | -#ifndef BCMSDIOH_STATIC_COPY_BUF |
---|
1454 | 1422 | if (localbuf) |
---|
1455 | 1423 | MFREE(sd->osh, localbuf, ttl_len); |
---|
1456 | | -#endif |
---|
1457 | 1424 | |
---|
1458 | 1425 | #ifndef PKT_STATICS |
---|
1459 | 1426 | if (sd_msglevel & SDH_COST_VAL) |
---|
.. | .. |
---|
1782 | 1749 | #if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE) |
---|
1783 | 1750 | static int sdio_sw_reset(sdioh_info_t *sd) |
---|
1784 | 1751 | { |
---|
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 |
---|
1786 | 1755 | int err = 0; |
---|
1787 | 1756 | |
---|
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__); |
---|
1791 | 1759 | 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); |
---|
1812 | 1761 | sdio_release_host(sd->func[0]); |
---|
1813 | 1762 | #else |
---|
1814 | | - /* sdio_reset_comm */ |
---|
1815 | | - err = sdio_reset_comm(card); |
---|
| 1763 | + err = sdio_reset_comm(sd->func[0]->card); |
---|
1816 | 1764 | #endif |
---|
1817 | 1765 | |
---|
1818 | 1766 | if (err) |
---|