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/dhd_cdc.c | 101 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 90 insertions(+), 11 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c
old mode 100644
new mode 100755
index a81d49f..0152c18
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c
@@ -71,6 +71,9 @@
uint16 reqid;
uint8 pending;
uint32 lastcmd;
+#ifdef BCMDBUS
+ uint ctl_completed;
+#endif /* BCMDBUS */
uint8 bus_header[BUS_HEADER_LEN];
cdc_ioctl_t msg;
unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN];
@@ -86,6 +89,9 @@
static int
dhdcdc_msg(dhd_pub_t *dhd)
{
+#ifdef BCMDBUS
+ int timeout = 0;
+#endif /* BCMDBUS */
int err = 0;
dhd_prot_t *prot = dhd->prot;
int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
@@ -102,8 +108,46 @@
len = CDC_MAX_MSG_SIZE;
/* Send request */
+#ifdef BCMDBUS
+ prot->ctl_completed = FALSE;
+ err = dbus_send_ctl(dhd->bus, (void *)&prot->msg, len);
+ if (err) {
+ DHD_ERROR(("dbus_send_ctl error=0x%x\n", err));
+ DHD_OS_WAKE_UNLOCK(dhd);
+ return err;
+ }
+#else
err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len);
+#endif /* BCMDBUS */
+#ifdef BCMDBUS
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
+ if ((!timeout) || (!prot->ctl_completed)) {
+ DHD_ERROR(("Txctl timeout %d ctl_completed %d\n",
+ timeout, prot->ctl_completed));
+ DHD_ERROR(("Txctl wait timed out\n"));
+ err = -1;
+ }
+#endif /* BCMDBUS */
+#if defined(BCMDBUS) && defined(INTR_EP_ENABLE)
+ /* If the ctl write is successfully completed, wait for an acknowledgement
+ * that indicates that it is now ok to do ctl read from the dongle
+ */
+ if (err != -1) {
+ prot->ctl_completed = FALSE;
+ if (dbus_poll_intr(dhd->dbus)) {
+ DHD_ERROR(("dbus_poll_intr not submitted\n"));
+ } else {
+ /* interrupt polling is sucessfully submitted. Wait for dongle to send
+ * interrupt
+ */
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
+ if (!timeout) {
+ DHD_ERROR(("intr poll wait timed out\n"));
+ }
+ }
+ }
+#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */
DHD_OS_WAKE_UNLOCK(dhd);
return err;
}
@@ -111,6 +155,9 @@
static int
dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
{
+#ifdef BCMDBUS
+ int timeout = 0;
+#endif /* BCMDBUS */
int ret;
int cdc_len = len + sizeof(cdc_ioctl_t);
dhd_prot_t *prot = dhd->prot;
@@ -118,7 +165,29 @@
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
do {
+#ifdef BCMDBUS
+ prot->ctl_completed = FALSE;
+ ret = dbus_recv_ctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
+ if (ret) {
+ DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret));
+ goto done;
+ }
+ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
+ if ((!timeout) || (!prot->ctl_completed)) {
+ DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n",
+ timeout, prot->ctl_completed));
+ ret = -ETIMEDOUT;
+ goto done;
+ }
+
+ /* XXX FIX: Must return cdc_len, not len, because after query_ioctl()
+ * it subtracts sizeof(cdc_ioctl_t); The other approach is
+ * to have dbus_recv_ctl() return actual len.
+ */
+ ret = cdc_len;
+#else
ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len);
+#endif /* BCMDBUS */
if (ret < 0)
break;
} while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
@@ -128,6 +197,9 @@
ret = len;
}
+#ifdef BCMDBUS
+done:
+#endif /* BCMDBUS */
return ret;
}
@@ -330,6 +402,24 @@
done:
return ret;
}
+
+#ifdef BCMDBUS
+int
+dhd_prot_ctl_complete(dhd_pub_t *dhd)
+{
+ dhd_prot_t *prot;
+
+ if (dhd == NULL)
+ return BCME_ERROR;
+
+ prot = dhd->prot;
+
+ ASSERT(prot);
+ prot->ctl_completed = TRUE;
+ dhd_os_ioctl_resp_wake(dhd);
+ return 0;
+}
+#endif /* BCMDBUS */
/* XXX: due to overlays this should not be called directly; call dhd_wl_ioctl() instead */
int
@@ -549,17 +639,6 @@
PKTPULL(dhd->osh, pktbuf, (data_offset << 2));
return 0;
}
-
-#ifdef DHD_LOSSLESS_ROAMING
-int dhd_update_sdio_data_prio_map(dhd_pub_t *dhdp)
-{
- const uint8 prio2tid[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
-
- bcopy(prio2tid, dhdp->flow_prio_map, sizeof(uint8) * NUMPRIO);
-
- return BCME_OK;
-}
-#endif // DHD_LOSSLESS_ROAMING
int
dhd_prot_attach(dhd_pub_t *dhd)
--
Gitblit v1.6.2