staging: vt6655: card.c change BBvCalculateParameter to vnt_get_phy_field
authorMalcolm Priestley <tvboxspy@gmail.com>
Wed, 20 Aug 2014 21:30:30 +0000 (22:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Aug 2014 20:48:19 +0000 (13:48 -0700)
Using vnt_get_phy_field means the values are not in the
correct write order the lower word and the upper word need
to be swapped over for an u32 write out.

Rather create another data variable to manipulate this structure.
Create a new union vnt_phy_field_swap with struct vnt_phy_field,
the u16 word swap and the u32 write out.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6655/card.c
drivers/staging/vt6655/desc.h

index 9807374b33f4d56255c54a33779b8c610deac307..c4ed8d55fc29036260972a9aaad8a54d80270390 100644 (file)
@@ -225,57 +225,51 @@ void
 s_vSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
             void *pvSupportRateIEs, void *pvExtSupportRateIEs)
 {
-       unsigned char byServ = 0, bySignal = 0; // For CCK
-       unsigned short wLen = 0;
+       union vnt_phy_field_swap phy;
        unsigned char byTxRate = 0, byRsvTime = 0;    // For OFDM
 
        //Set to Page1
        MACvSelectPage1(pDevice->PortOffset);
 
-       //RSPINF_b_1
-       BBvCalculateParameter(pDevice,
-                             14,
-                             VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       /* RSPINF_b_1 */
+       vnt_get_phy_field(pDevice,
+                         14,
+                         VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
+                         PK_TYPE_11B,
+                         &phy.field_read);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       ///RSPINF_b_2
-       BBvCalculateParameter(pDevice,
-                             14,
-                             VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+        /* swap over to get correct write order */
+       swap(phy.swap[0], phy.swap[1]);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       //RSPINF_b_5
-       BBvCalculateParameter(pDevice,
-                             14,
-                             VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       //RSPINF_b_11
-       BBvCalculateParameter(pDevice,
-                             14,
-                             VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       /* RSPINF_b_2 */
+       vnt_get_phy_field(pDevice, 14,
+                         VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write);
+
+       /* RSPINF_b_5 */
+       vnt_get_phy_field(pDevice, 14,
+                         VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write);
+
+       /* RSPINF_b_11 */
+       vnt_get_phy_field(pDevice, 14,
+                         VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
        //RSPINF_a_6
        s_vCalculateOFDMRParameter(RATE_6M,
                                   ePHYType,
@@ -1592,57 +1586,49 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice,
  */
 void CARDvSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType)
 {
-       unsigned char byServ = 0x00, bySignal = 0x00; //For CCK
-       unsigned short wLen = 0x0000;
+       union vnt_phy_field_swap phy;
        unsigned char byTxRate, byRsvTime;             //For OFDM
 
        //Set to Page1
        MACvSelectPage1(pDevice->PortOffset);
 
-       //RSPINF_b_1
-       BBvCalculateParameter(pDevice,
-                             14,
-                             CARDwGetCCKControlRate((void *)pDevice, RATE_1M),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       /* RSPINF_b_1 */
+       vnt_get_phy_field(pDevice, 14,
+                         CARDwGetCCKControlRate(pDevice, RATE_1M),
+                         PK_TYPE_11B, &phy.field_read);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       ///RSPINF_b_2
-       BBvCalculateParameter(pDevice,
-                             14,
-                             CARDwGetCCKControlRate((void *)pDevice, RATE_2M),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+        /* swap over to get correct write order */
+       swap(phy.swap[0], phy.swap[1]);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       //RSPINF_b_5
-       BBvCalculateParameter(pDevice,
-                             14,
-                             CARDwGetCCKControlRate((void *)pDevice, RATE_5M),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
-       //RSPINF_b_11
-       BBvCalculateParameter(pDevice,
-                             14,
-                             CARDwGetCCKControlRate((void *)pDevice, RATE_11M),
-                             PK_TYPE_11B,
-                             &wLen,
-                             &byServ,
-                             &bySignal
-);
+       /* RSPINF_b_2 */
+       vnt_get_phy_field(pDevice, 14,
+                         CARDwGetCCKControlRate(pDevice, RATE_2M),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write);
+
+       /* RSPINF_b_5 */
+       vnt_get_phy_field(pDevice, 14,
+                         CARDwGetCCKControlRate(pDevice, RATE_5M),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write);
+
+       /* RSPINF_b_11 */
+       vnt_get_phy_field(pDevice, 14,
+                         CARDwGetCCKControlRate(pDevice, RATE_11M),
+                         PK_TYPE_11B, &phy.field_read);
+
+       swap(phy.swap[0], phy.swap[1]);
+
+       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write);
 
-       VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
        //RSPINF_a_6
        s_vCalculateOFDMRParameter(RATE_6M,
                                   ePHYType,
index 1dd38f730a6c78bdae8074ca33049a7ce2c512f4..18427238efcf3b5c947d921a8fff02c16859987a 100644 (file)
@@ -384,6 +384,12 @@ struct vnt_phy_field {
        __le16 len;
 } __packed;
 
+union vnt_phy_field_swap {
+       struct vnt_phy_field field_read;
+       u16 swap[2];
+       u32 field_write;
+};
+
 typedef struct tagSRTS_g {
        struct vnt_phy_field b;
        struct vnt_phy_field a;