Search Linux Wireless

Re: Debugging RTL8192CU firmware loading on 3.12 powerpc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dienstag, 6. September 2016 09:40:41 CEST Sven Eckelmann wrote:
> On Freitag, 2. September 2016 12:53:28 CEST Larry Finger wrote:
> [...]
> 
> > The patch I included in my previous E-mail, and attached here,  does get
> > the firmware loaded correctly. There is still a problem that prevents
> > authentication. I'm still looking for that issue.
> 
> Thanks for the fast update. I am currently testing your patch. It looks like
> the initial error is now gone. The hostapd also starts but beaconing
> doesn't seem to work at all (no error from the kernel/hostapd but the
> device is not sending anything). I am currently checking how beaconing is
> supposed to work in your driver. Maybe I will spot something useful.

Yes, found something similar in the checksumming algorithm. See the attached 
patch for details.

Kind regards,
	Sven
From: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
Date: Mon, 5 Sep 2016 11:03:44 +0200
Subject: [PATCH] rtl8192c: Fix byteorder of loaded firmware

The firmware is read in as an array of bytes, thus it is effectively in
little-endian order. When it is written back to the device in routine
_rtl92c_fw_block_write(), the data output uses 32-bit writes. Of course,
all data supplied in all 2- and 4-byte writes is assumed to be in CPU
order. As the device needs the data to be little-endian, it will be byte
swapped on BE machines. As a result, the firmware is written out in the
wrong byte order
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
index 43fcb25..7c5fc85 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
@@ -74,16 +74,18 @@ static void _rtl92c_fw_block_write(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	u32 blocksize = sizeof(u32);
 	u8 *bufferptr = (u8 *)buffer;
-	u32 *pu4byteptr = (u32 *)buffer;
+	__le32 *pu4byteptr = (__le32 *)buffer;
 	u32 i, offset, blockcount, remainsize;
+	u32 data;
 
 	blockcount = size / blocksize;
 	remainsize = size % blocksize;
 
 	for (i = 0; i < blockcount; i++) {
 		offset = i * blocksize;
+		data = le32_to_cpu(*(pu4byteptr + i));
 		rtl_write_dword(rtlpriv, (FW_8192C_START_ADDRESS + offset),
-				*(pu4byteptr + i));
+				data);
 	}
 
 	if (remainsize) {
From: Sven Eckelmann <sven@xxxxxxxxxxxxx>
Date: Tue, 6 Sep 2016 15:00:27 +0200
Subject: [PATCH] Fix TX checksum on big endian systems
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
index 95880fe..6cb46ba 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
@@ -481,14 +481,14 @@ static void _rtl_fill_usb_tx_desc(u8 *txdesc)
  */
 static void _rtl_tx_desc_checksum(u8 *txdesc)
 {
-	u16 *ptr = (u16 *)txdesc;
+	__le16 *ptr = (__le16 *)txdesc;
 	u16	checksum = 0;
 	u32 index;
 
 	/* Clear first */
 	SET_TX_DESC_TX_DESC_CHECKSUM(txdesc, 0);
 	for (index = 0; index < 16; index++)
-		checksum = checksum ^ (*(ptr + index));
+		checksum = checksum ^ le16_to_cpu(*(ptr + index));
 	SET_TX_DESC_TX_DESC_CHECKSUM(txdesc, checksum);
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux