Merge branch 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rtl8187se / r8185b_init.c
index 1dfa78e137c0a26d454b49312da7e05d5c997440..978dc5f4f929f197aa680a407251b6bfa5a6c3d2 100644 (file)
@@ -120,19 +120,19 @@ static u8 PlatformIORead1Byte(struct net_device *dev, u32 offset)
        return read_nic_byte(dev, offset);
 }
 
-void PlatformIOWrite1Byte(struct net_device *dev, u32 offset, u8 data)
+static void PlatformIOWrite1Byte(struct net_device *dev, u32 offset, u8 data)
 {
        write_nic_byte(dev, offset, data);
        read_nic_byte(dev, offset); /* To make sure write operation is completed, 2005.11.09, by rcnjko. */
 }
 
-void PlatformIOWrite2Byte(struct net_device *dev, u32 offset, u16 data)
+static void PlatformIOWrite2Byte(struct net_device *dev, u32 offset, u16 data)
 {
        write_nic_word(dev, offset, data);
        read_nic_word(dev, offset); /* To make sure write operation is completed, 2005.11.09, by rcnjko. */
 }
 
-void PlatformIOWrite4Byte(struct net_device *dev, u32 offset, u32 data)
+static void PlatformIOWrite4Byte(struct net_device *dev, u32 offset, u32 data)
 {
        if (offset == PhyAddr) {
        /* For Base Band configuration. */
@@ -175,27 +175,7 @@ void PlatformIOWrite4Byte(struct net_device *dev, u32 offset, u32 data)
        }
 }
 
-u16 PlatformIORead2Byte(struct net_device *dev, u32 offset)
-{
-       u16     data = 0;
-
-       data = read_nic_word(dev, offset);
-
-
-       return data;
-}
-
-u32 PlatformIORead4Byte(struct net_device *dev, u32 offset)
-{
-       u32     data = 0;
-
-       data = read_nic_dword(dev, offset);
-
-
-       return data;
-}
-
-void SetOutputEnableOfRfPins(struct net_device *dev)
+static void SetOutputEnableOfRfPins(struct net_device *dev)
 {
        write_nic_word(dev, RFPinsEnable, 0x1bff);
 }
@@ -304,62 +284,38 @@ bool SetAntennaConfig87SE(struct net_device *dev,
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        bool   bAntennaSwitched = true;
+       u8      ant_diversity_offset = 0x00; /* 0x00 = disabled, 0x80 = enabled */
 
        /* printk("SetAntennaConfig87SE(): DefaultAnt(%d), bAntDiversity(%d)\n", DefaultAnt, bAntDiversity); */
 
        /* Threshold for antenna diversity. */
        write_phy_cck(dev, 0x0c, 0x09); /* Reg0c : 09 */
 
-       if (bAntDiversity) {    /*      Enable Antenna Diversity. */
-               if (DefaultAnt == 1) {  /* aux antenna */
-
-                       /* Mac register, aux antenna */
-                       write_nic_byte(dev, ANTSEL, 0x00);
-
-                       /* Config CCK RX antenna. */
-                       write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */
-                       write_phy_cck(dev, 0x01, 0xc7); /* Reg01 : c7 */
-
-                       /* Config OFDM RX antenna. */
-                       write_phy_ofdm(dev, 0x0D, 0x54);        /* Reg0d : 54 */
-                       write_phy_ofdm(dev, 0x18, 0xb2);        /* Reg18 : b2 */
-               } else { /*  use main antenna */
-                       /* Mac register, main antenna */
-                       write_nic_byte(dev, ANTSEL, 0x03);
-                       /* base band */
-                       /*  Config CCK RX antenna. */
-                       write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */
-                       write_phy_cck(dev, 0x01, 0xc7); /* Reg01 : c7 */
-
-                       /* Config OFDM RX antenna. */
-                       write_phy_ofdm(dev, 0x0d, 0x5c);  /* Reg0d : 5c */
-                       write_phy_ofdm(dev, 0x18, 0xb2);  /* Reg18 : b2 */
-               }
-       } else {
-               /* Disable Antenna Diversity. */
-               if (DefaultAnt == 1) { /* aux Antenna */
-                       /* Mac register, aux antenna */
-                       write_nic_byte(dev, ANTSEL, 0x00);
-
-                       /* Config CCK RX antenna. */
-                       write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */
-                       write_phy_cck(dev, 0x01, 0x47); /* Reg01 : 47 */
-
-                       /* Config OFDM RX antenna. */
-                       write_phy_ofdm(dev, 0x0D, 0x54);        /* Reg0d : 54 */
-                       write_phy_ofdm(dev, 0x18, 0x32);        /* Reg18 : 32 */
-               } else { /* main Antenna */
-                       /* Mac register, main antenna */
-                       write_nic_byte(dev, ANTSEL, 0x03);
-
-                       /* Config CCK RX antenna.       */
-                       write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */
-                       write_phy_cck(dev, 0x01, 0x47); /* Reg01 : 47 */
-
-                       /* Config OFDM RX antenna. */
-                       write_phy_ofdm(dev, 0x0D, 0x5c); /* Reg0d : 5c */
-                       write_phy_ofdm(dev, 0x18, 0x32); /*Reg18 : 32 */
-               }
+       if (bAntDiversity)      /*      Enable Antenna Diversity. */
+               ant_diversity_offset = 0x80;
+
+       if (DefaultAnt == 1) { /* aux Antenna */
+               /* Mac register, aux antenna */
+               write_nic_byte(dev, ANTSEL, 0x00);
+
+               /* Config CCK RX antenna. */
+               write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */
+               write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); /* Reg01 : 47 | ant_diversity_offset */
+
+               /* Config OFDM RX antenna. */
+               write_phy_ofdm(dev, 0x0D, 0x54);        /* Reg0d : 54 */
+               write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset);   /* Reg18 : 32 */
+       } else { /* main Antenna */
+               /* Mac register, main antenna */
+               write_nic_byte(dev, ANTSEL, 0x03);
+
+               /* Config CCK RX antenna.       */
+               write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */
+               write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); /* Reg01 : 47 */
+
+               /* Config OFDM RX antenna. */
+               write_phy_ofdm(dev, 0x0D, 0x5c); /* Reg0d : 5c */
+               write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset); /*Reg18 : 32 */
        }
        priv->CurrAntennaIndex = DefaultAnt; /* Update default settings. */
        return  bAntennaSwitched;
@@ -371,7 +327,7 @@ bool SetAntennaConfig87SE(struct net_device *dev,
  *--------------------------------------------------------------
  */
 
-void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev)
+static void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev)
 {
 
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -672,7 +628,7 @@ void UpdateInitialGain(struct net_device *dev)
  *             Tx Power tracking mechanism routine on 87SE.
  *     Created by Roger, 2007.12.11.
  */
-void InitTxPwrTracking87SE(struct net_device *dev)
+static void InitTxPwrTracking87SE(struct net_device *dev)
 {
        u32     u4bRfReg;
 
@@ -682,7 +638,7 @@ void InitTxPwrTracking87SE(struct net_device *dev)
        RF_WriteReg(dev, 0x02, u4bRfReg|PWR_METER_EN);                  mdelay(1);
 }
 
-void PhyConfig8185(struct net_device *dev)
+static void PhyConfig8185(struct net_device *dev)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
                write_nic_dword(dev, RCR, priv->ReceiveConfig);
@@ -709,7 +665,7 @@ void PhyConfig8185(struct net_device *dev)
        return;
 }
 
-void HwConfigureRTL8185(struct net_device *dev)
+static void HwConfigureRTL8185(struct net_device *dev)
 {
        /* RTL8185_TODO: Determine Retrylimit, TxAGC, AutoRateFallback control. */
        u8 bUNIVERSAL_CONTROL_RL = 0;
@@ -834,12 +790,12 @@ static void MacConfig_85BASIC(struct net_device *dev)
        write_nic_byte(dev, 0x24E, 0x01);
 }
 
-u8 GetSupportedWirelessMode8185(struct net_device *dev)
+static u8 GetSupportedWirelessMode8185(struct net_device *dev)
 {
        return WIRELESS_MODE_B | WIRELESS_MODE_G;
 }
 
-void ActUpdateChannelAccessSetting(struct net_device *dev,
+static void ActUpdateChannelAccessSetting(struct net_device *dev,
                                   WIRELESS_MODE WirelessMode,
                                   PCHANNEL_ACCESS_SETTING ChnlAccessSetting)
 {
@@ -874,7 +830,7 @@ void ActUpdateChannelAccessSetting(struct net_device *dev,
        }
 }
 
-void ActSetWirelessMode8185(struct net_device *dev, u8 btWirelessMode)
+static void ActSetWirelessMode8185(struct net_device *dev, u8 btWirelessMode)
 {
        struct  r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        struct  ieee80211_device *ieee = priv->ieee80211;
@@ -931,7 +887,7 @@ void rtl8185b_irq_enable(struct net_device *dev)
        write_nic_dword(dev, IMR, priv->IntrMask);
 }
 
-void MgntDisconnectIBSS(struct net_device *dev)
+static void MgntDisconnectIBSS(struct net_device *dev)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        u8 i;
@@ -957,7 +913,7 @@ void MgntDisconnectIBSS(struct net_device *dev)
        notify_wx_assoc_event(priv->ieee80211);
 }
 
-void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn)
+static void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        u8 i;
@@ -974,7 +930,7 @@ void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn)
        }
 }
 
-void MgntDisconnectAP(struct net_device *dev, u8 asRsn)
+static void MgntDisconnectAP(struct net_device *dev, u8 asRsn)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
@@ -992,7 +948,7 @@ void MgntDisconnectAP(struct net_device *dev, u8 asRsn)
        priv->ieee80211->state = IEEE80211_NOLINK;
 }
 
-bool MgntDisconnect(struct net_device *dev, u8 asRsn)
+static bool MgntDisconnect(struct net_device *dev, u8 asRsn)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        /*
@@ -1028,7 +984,7 @@ bool MgntDisconnect(struct net_device *dev, u8 asRsn)
  *     Assumption:
  *             PASSIVE LEVEL.
  */
-bool SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState)
+static bool SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState)
 {
        struct  r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        bool    bResult = false;
@@ -1132,7 +1088,7 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u
        return bActionAllowed;
 }
 
-void InactivePowerSave(struct net_device *dev)
+static void InactivePowerSave(struct net_device *dev)
 {
        struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
        /*