Skip to content

Conversation

dubhater
Copy link

@dubhater dubhater commented Dec 4, 2022

CC: @wandercn

This is necessary to make the firmware start, in Linux too, not just in Windows.

This fixes the slow download and even slower upload speeds.
@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

Hi! This patch broken work driver.

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

The patch breaks the driver? That's weird. I mean, I only tested it for two minutes, but it seemed to work. It improved the speed a lot: 95 megabits/second download, 75 upload.

What happens when you try it?

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

The adapter does not respond, network interface does not up.
Screenshot_20221207_142715
Screenshot_20221207_142815
Screenshot_20221207_142832
Screenshot_20221207_142917

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

I guess your computer is different. On my Intel laptop the wifi interface is called wlp0s20f0u3.

If you want to keep investigating, we'll need more information from the driver. Changing CONFIG_RTW_DEBUG to "y" in the Makefile will make it print more messages.

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

I chose the adapter interface on purpose to show you that it doesn't work. After downloading the firmware and performing a reset, this is what your patch does, the adapter stops responding. Perhaps you had the same thing, and you got speeds on another adapter, because this adapter stopped working and system select other.

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

I also do not exclude the possibility that your reset could affect the loading of the firmware not from the driver, but from its built-in efuse memory, so it works for you, but not on my adapter.

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

Perhaps you had the same thing, and you got speeds on another adapter, because this adapter stopped working and system select other.

That happened to me before 😂 but nowadays I make sure only one adapter is active so the system can't select another.

It works here: 8710bu.txt Something must be different about your computer or your adapter. CONFIG_RTW_DEBUG = y may provide the answer.

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

I always get this error:
_FWFreeToGo: Polling FW ready Fail! (3565, 200ms), REG_MCUFWDL:0x01050182
dmesg.txt

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

Interesting. It says the firmware "download" failed. The firmware checksum calculated by the adapter was wrong, so it's refusing to start. (At least I assume that's what happens, based on bit 2, MCU_FW_DL_CSUM_REPORT, being 0.)

Can you upload the Windows driver stored in the adapter's flash memory? I want to see if the firmware in it is different. (I already checked the Windows driver from my device, it contains the same firmware you have in this repo.)

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

I checked before, the firmware is the same as for Windows.

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

The firmware checksum calculated by the adapter was wrong, so it's refusing to start.

But without your patch, everything works, the firmware is loaded and check pass OK.

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

Indeed. _FWFreeToGo is only called if the checksum was correct.

So then what kind of speeds do you get without my patch?

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

Download 20-50Mbit, upload 3-5Mbit...

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

Yes, that means the firmware is not actually functioning.

Now I notice that your adapter is indeed different:
CHIP_8710B_Normal_Chip_UMC_A_CUT_1T1R_RomVer(2)

Mine is:
CHIP_8710B_Normal_Chip_SMIC_A_CUT_1T1R_RomVer(1)

Something to try:

diff --git a/hal/rtl8710b/rtl8710b_hal_init.c b/hal/rtl8710b/rtl8710b_hal_init.c
index b273f2c..9dcd45e 100644
--- a/hal/rtl8710b/rtl8710b_hal_init.c
+++ b/hal/rtl8710b/rtl8710b_hal_init.c
@@ -229,7 +228,7 @@ static s32 _FWFreeToGo(_adapter *adapter, u32 min_cnt, u32 timeout_ms)
        value32 &= ~WINTINI_RDY;
        rtw_write32(adapter, REG_8051FW_CTRL_V1_8710B, value32);
 
-       _8051Reset8710(adapter);
+       // _8051Reset8710(adapter);
 
        /*  polling for FW ready */
        do {

If that doesn't help:

diff --git a/hal/rtl8710b/rtl8710b_hal_init.c b/hal/rtl8710b/rtl8710b_hal_init.c
index b273f2c..9dcd45e 100644
--- a/hal/rtl8710b/rtl8710b_hal_init.c
+++ b/hal/rtl8710b/rtl8710b_hal_init.c
@@ -54,7 +54,7 @@ static int _BlockWrite(PADAPTER padapter, PVOID buffer, u32 buffSize)
 {
        int ret = _SUCCESS;
 
-       u32                     blockSize_p1 = 4;       /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */
+       u32                     blockSize_p1 = 128;     /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */
        u32                     blockSize_p2 = 8;       /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */
        u32                     blockSize_p3 = 1;       /* Phase #3 : Use 1-byte, the remnant of FW image. */
        u32                     blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0;
@@ -71,14 +71,14 @@ static int _BlockWrite(PADAPTER padapter, PVOID buffer, u32 buffSize)
        remainSize_p1 = buffSize % blockSize_p1;
 
        for (i = 0; i < blockCount_p1; i++) {
-#if 0
-#ifdef CONFIG_USB_HCI
+//#if 0
+//#ifdef CONFIG_USB_HCI
                ret = rtw_writeN(padapter, (FW_8710B_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1));
-#else
-               ret = rtw_write32(padapter, (FW_8710B_START_ADDRESS + i * blockSize_p1), le32_to_cpu(*((u32 *)(bufferPtr + i * blockSize_p1))));
-#endif
-#endif
-               ret = rtw_write32(padapter, (FW_8710B_START_ADDRESS + i * blockSize_p1), le32_to_cpu(*((u32 *)(bufferPtr + i * blockSize_p1))));
+//#else
+//             ret = rtw_write32(padapter, (FW_8710B_START_ADDRESS + i * blockSize_p1), le32_to_cpu(*((u32 *)(bufferPtr + i * blockSize_p1))));
+//#endif
+//#endif
+//             ret = rtw_write32(padapter, (FW_8710B_START_ADDRESS + i * blockSize_p1), le32_to_cpu(*((u32 *)(bufferPtr + i * blockSize_p1))));
                if (ret == _FAIL) {
                        RTW_ERR("====>%s %d i:%d\n", __func__, __LINE__, i);
                        goto exit;
@@ -91,16 +91,16 @@ static int _BlockWrite(PADAPTER padapter, PVOID buffer, u32 buffSize)
 
                blockCount_p2 = remainSize_p1 / blockSize_p2;
                remainSize_p2 = remainSize_p1 % blockSize_p2;
-#if 0
-#ifdef CONFIG_USB_HCI
+//#if 0
+//#ifdef CONFIG_USB_HCI
                for (i = 0; i < blockCount_p2; i++) {
                        ret = rtw_writeN(padapter, (FW_8710B_START_ADDRESS + offset + i * blockSize_p2), blockSize_p2, (bufferPtr + offset + i * blockSize_p2));
 
                        if (ret == _FAIL)
                                goto exit;
                }
-#endif
-#endif
+//#endif
+//#endif
        }
 
        /* 3 Phase #3 */

@McMCCRU
Copy link
Owner

McMCCRU commented Dec 7, 2022

// _8051Reset8710(adapter);

This is the first thing I did after your patch. This resulted in death of system.

@dubhater
Copy link
Author

dubhater commented Dec 7, 2022

Hm. Maybe I should stop trying to help. :)

@dubhater
Copy link
Author

By the way, does your adapter work with the Windows driver?

@iQiexie
Copy link

iQiexie commented Jan 13, 2023

his is the first thing I did after your patch. This resulted in death of system.

Hm. Maybe I should stop trying to help. :)

linux moment

@tom709
Copy link

tom709 commented Feb 25, 2023

Patch does not work on my adapter either, chip version is CHIP_8710B_Normal_Chip_UMC_A_CUT_1T1R_RomVer(2). I also tried the changes proposed above but with no success.

Attaching debug log.
8188-my.txt

One interesting observation is that I get constant printouts in dmesg while the driver is loaded:
[ 2225.438153] RTW: fw read cmd failed...
[ 2225.642152] RTW: fw read cmd failed...
[ 2227.454146] RTW: fw read cmd failed...
[ 2228.004505] RTW: cfg80211_rtw_dump_station(wlx502b73201661)
[ 2228.004509] RTW: Station is not found
[ 2229.470142] RTW: fw read cmd failed...
[ 2231.483966] RTW: fw read cmd failed...
[ 2231.690218] RTW: fw read cmd failed...
[ 2233.502185] RTW: fw read cmd failed...
[ 2234.004118] RTW: cfg80211_rtw_dump_station(wlx502b73201661)
[ 2234.004122] RTW: Station is not found
[ 2235.518178] RTW: fw read cmd failed...
[ 2237.534120] RTW: fw read cmd failed...
[ 2237.738113] RTW: fw read cmd failed...

@tom709
Copy link

tom709 commented Feb 25, 2023

Wow. That works. After applying the umc.txt patch, TX speed is up from 4mbps to 22mbps. RX is around 35mbps.
Here's the dmesg while loading the driver. 8188-umc.txt
Thanks a lot.
:)))

@billyplus
Copy link

Wow. That works. After applying the umc.txt patch, TX speed is up from 4mbps to 22mbps. RX is around 35mbps. Here's the dmesg while loading the driver. 8188-umc.txt Thanks a lot. :)))

where is the "umc.txt" patch???

@a5a5aa555oo
Copy link

https://github.com/McMCCRU/rtl8188gu/files/10831841/umc.txt

I guess this is what you want.

Or you can use rtl8xxxu, it supports 8188GU now and has no slow upload issue.

https://github.com/a5a5aa555oo/rtl8xxxu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants