From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 07:24:11 +0000
Subject: [PATCH] add stmac read mac form eeprom
---
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c | 82 +++++++---------------------------------
1 files changed, 15 insertions(+), 67 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c
old mode 100644
new mode 100755
index ba31570..2ac448c
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c
@@ -83,18 +83,8 @@
#endif /* !defined(OOB_INTR_ONLY) */
static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr);
#if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
-#if defined(MMC_SW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
-extern int mmc_sw_reset(struct mmc_card *card);
-#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
extern int mmc_sw_reset(struct mmc_host *host);
-#endif
-#elif defined(MMC_HW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
-extern int mmc_hw_reset(struct mmc_card *card);
-#else
-extern int mmc_hw_reset(struct mmc_host *host);
-#endif
#else
extern int sdio_reset_comm(struct mmc_card *card);
#endif
@@ -112,8 +102,6 @@
#ifndef CUSTOM_SDIO_F1_BLKSIZE
#define CUSTOM_SDIO_F1_BLKSIZE DEFAULT_SDIO_F1_BLKSIZE
#endif
-
-#define COPY_BUF_SIZE (SDPCM_MAXGLOM_SIZE * 1600)
#define MAX_IO_RW_EXTENDED_BLK 511
@@ -194,7 +182,7 @@
err_ret = sdio_enable_func(sd->func[1]);
sdio_release_host(sd->func[1]);
if (err_ret) {
- sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: %d\n", err_ret));
+ sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x\n", err_ret));
}
return FALSE;
@@ -221,14 +209,6 @@
return NULL;
}
bzero((char *)sd, sizeof(sdioh_info_t));
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
- sd->copy_buf = MALLOC(osh, COPY_BUF_SIZE);
- if (sd->copy_buf == NULL) {
- sd_err(("%s: MALLOC of %d-byte copy_buf failed\n",
- __FUNCTION__, COPY_BUF_SIZE));
- goto fail;
- }
-#endif
sd->osh = osh;
sd->fake_func0.num = 0;
sd->fake_func0.card = func->card;
@@ -293,9 +273,6 @@
return sd;
fail:
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
- MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE);
-#endif
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
return NULL;
}
@@ -324,9 +301,6 @@
sd->func[1] = NULL;
sd->func[2] = NULL;
-#if defined(BCMSDIOH_TXGLOM) && defined(BCMSDIOH_STATIC_COPY_BUF)
- MFREE(sd->osh, sd->copy_buf, COPY_BUF_SIZE);
-#endif
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
}
return SDIOH_API_RC_SUCCESS;
@@ -1232,7 +1206,7 @@
if (err_ret)
#endif /* MMC_SDIO_ABORT */
{
- sd_err(("bcmsdh_sdmmc: Failed to %s word F%d:@0x%05x=%02x, Err: %d\n",
+ sd_err(("bcmsdh_sdmmc: Failed to %s word F%d:@0x%05x=%02x, Err: 0x%08x\n",
rw ? "Write" : "Read", func, addr, *word, err_ret));
}
}
@@ -1382,8 +1356,7 @@
return SDIOH_API_RC_FAIL;
}
}
- }
- else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) {
+ } else if(sd->txglom_mode == SDPCM_TXGLOM_CPY) {
for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
ttl_len += PKTLEN(sd->osh, pnext);
}
@@ -1392,20 +1365,16 @@
for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
uint8 *buf = (uint8*)PKTDATA(sd->osh, pnext);
pkt_len = PKTLEN(sd->osh, pnext);
+
if (!localbuf) {
-#ifdef BCMSDIOH_STATIC_COPY_BUF
- if (ttl_len <= COPY_BUF_SIZE)
- localbuf = sd->copy_buf;
-#else
localbuf = (uint8 *)MALLOC(sd->osh, ttl_len);
-#endif
if (localbuf == NULL) {
- sd_err(("%s: %s localbuf malloc FAILED ttl_len=%d\n",
- __FUNCTION__, (write) ? "TX" : "RX", ttl_len));
- ttl_len -= pkt_len;
+ sd_err(("%s: %s TXGLOM: localbuf malloc FAILED\n",
+ __FUNCTION__, (write) ? "TX" : "RX"));
goto txglomfail;
}
}
+
bcopy(buf, (localbuf + local_plen), pkt_len);
local_plen += pkt_len;
if (PKTNEXT(sd->osh, pnext))
@@ -1450,10 +1419,8 @@
return SDIOH_API_RC_FAIL;
}
-#ifndef BCMSDIOH_STATIC_COPY_BUF
if (localbuf)
MFREE(sd->osh, localbuf, ttl_len);
-#endif
#ifndef PKT_STATICS
if (sd_msglevel & SDH_COST_VAL)
@@ -1782,37 +1749,18 @@
#if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
static int sdio_sw_reset(sdioh_info_t *sd)
{
- struct mmc_card *card = sd->func[0]->card;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
+ struct mmc_host *host = sd->func[0]->card->host;
+#endif
int err = 0;
-#if defined(MMC_SW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
- /* MMC_SW_RESET */
- printf("%s: call mmc_sw_reset\n", __FUNCTION__);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) && defined(MMC_SW_RESET)
+ printf("%s: Enter\n", __FUNCTION__);
sdio_claim_host(sd->func[0]);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
- err = mmc_sw_reset(card);
-#else
- err = mmc_sw_reset(card->host);
-#endif
- sdio_release_host(sd->func[0]);
-#elif defined(MMC_HW_RESET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
- /* MMC_HW_RESET */
- printf("%s: call mmc_hw_reset\n", __FUNCTION__);
- sdio_claim_host(sd->func[0]);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
- while (atomic_read(&card->sdio_funcs_probed) > 1) {
- atomic_dec(&card->sdio_funcs_probed);
- }
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
- err = mmc_hw_reset(card);
-#else
- err = mmc_hw_reset(card->host);
-#endif
+ err = mmc_sw_reset(host);
sdio_release_host(sd->func[0]);
#else
- /* sdio_reset_comm */
- err = sdio_reset_comm(card);
+ err = sdio_reset_comm(sd->func[0]->card);
#endif
if (err)
--
Gitblit v1.6.2