From 8eee44dafdaaafaa0623c3ceaf4e507403365311 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 10 Nov 2009 16:44:47 -0600 Subject: [PATCH] Staging: rtl8187se: Remove card_type The vendor-written driver for the RTL8187SE has a private variable for the card type, even though it only occurs in PCI format. Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180.h | 1 - drivers/staging/rtl8187se/r8180_core.c | 9 ---- drivers/staging/rtl8187se/r8180_rtl8225z2.c | 53 +++++---------------- 3 files changed, 13 insertions(+), 50 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 8b33fe00625..ce828885b64 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -328,7 +328,6 @@ typedef struct r8180_priv short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ short enable_gpio0; - enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; short hw_plcp_len; short plcp_preamble_mode; // 0:auto 1:short 2:long diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 585cf683a04..57c62b0a402 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -2911,8 +2911,6 @@ short rtl8180_init(struct net_device *dev) priv->ieee80211->short_slot = 1; // just for sync 85 - priv->card_type = PCI; - DMESG("This is a PCI NIC"); priv->enable_gpio0 = 0; usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET); @@ -3233,7 +3231,6 @@ void rtl8185_set_rate(struct net_device *dev) void rtl8180_adapter_start(struct net_device *dev) { struct r8180_priv *priv = ieee80211_priv(dev); - u8 config3; rtl8180_rtx_disable(dev); rtl8180_reset(dev); @@ -3247,12 +3244,6 @@ void rtl8180_adapter_start(struct net_device *dev) rtl8180_beacon_tx_disable(dev); - if(priv->card_type == CARDBUS ){ - config3=read_nic_byte(dev, CONFIG3); - write_nic_byte(dev,CONFIG3,config3 | CONFIG3_FuncRegEn); - write_nic_word(dev,FEMR, FEMR_INTR | FEMR_WKUP | FEMR_GWAKE | - read_nic_word(dev, FEMR)); - } rtl8180_set_mode(dev, EPROM_CMD_CONFIG); write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c index 830a571be54..afe10f0b75a 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c @@ -23,7 +23,6 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) u16 out, select; u8 bit; u32 bangdata = (data << 4) | (adr & 0xf); - struct r8180_priv *priv = ieee80211_priv(dev); out = read_nic_word(dev, RFPinsOutput) & 0xfff3; @@ -33,7 +32,7 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) select = read_nic_word(dev, RFPinsSelect); write_nic_word(dev, RFPinsSelect, select | 0x7 | - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); + SW_CONTROL_GPIO); force_pci_posting(dev); udelay(10); @@ -71,16 +70,11 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) force_pci_posting(dev); udelay(10); - write_nic_word(dev, RFPinsOutput, out | - ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN)); + write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); - write_nic_word(dev, RFPinsSelect, select | - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); + write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO); - if (priv->card_type == USB) - mdelay(2); - else - rtl8185_rf_pins_enable(dev); + rtl8185_rf_pins_enable(dev); } static const u16 rtl8225bcd_rxgain[] = { @@ -174,15 +168,9 @@ static void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch) u8 cck_power_level = 0xff & priv->chtxpwr[ch]; u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch]; - if (priv->card_type == USB) { - max_cck_power_level = 11; - max_ofdm_power_level = 25; - min_ofdm_power_level = 10; - } else { - max_cck_power_level = 35; - max_ofdm_power_level = 35; - min_ofdm_power_level = 0; - } + max_cck_power_level = 35; + max_ofdm_power_level = 35; + min_ofdm_power_level = 0; if (cck_power_level > max_cck_power_level) cck_power_level = max_cck_power_level; @@ -629,8 +617,7 @@ void rtl8225z2_rf_init(struct net_device *dev) priv->chan = channel; - if (priv->card_type != USB) - rtl8225_host_pci_init(dev); + rtl8225_host_pci_init(dev); write_nic_dword(dev, RF_TIMING, 0x000a8008); @@ -653,7 +640,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x4, 0x8c3); mdelay(1); write_rtl8225(dev, 0x5, 0xc72); mdelay(1); write_rtl8225(dev, 0x6, 0xe6); mdelay(1); - write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1); + write_rtl8225(dev, 0x7, rtl8225_chan[channel]); mdelay(1); write_rtl8225(dev, 0x8, 0x3f); mdelay(1); write_rtl8225(dev, 0x9, 0x335); mdelay(1); write_rtl8225(dev, 0xa, 0x9d4); mdelay(1); @@ -679,13 +666,6 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x2, 0xc4d); - if (priv->card_type == USB) { - mdelay(200); - - write_rtl8225(dev, 0x2, 0x44d); - mdelay(100); - } - /* FIXME!! rtl8187 we have to check if calibrarion * is successful and eventually cal. again (repeat * the two write on reg 2) @@ -705,9 +685,6 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x0, 0x2bf); - if (priv->card_type != USB) - rtl8185_rf_pins_enable(dev); - for (i = 0; i < 128; i++) { data = rtl8225_agc[i]; @@ -724,7 +701,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_phy_ofdm(dev, 0x00, 0x01); mdelay(1); write_phy_ofdm(dev, 0x01, 0x02); mdelay(1); - write_phy_ofdm(dev, 0x02, ((priv->card_type == USB) ? 0x42 : 0x62)); mdelay(1); + write_phy_ofdm(dev, 0x02, 0x62); mdelay(1); write_phy_ofdm(dev, 0x03, 0x00); mdelay(1); write_phy_ofdm(dev, 0x04, 0x00); mdelay(1); write_phy_ofdm(dev, 0x05, 0x00); mdelay(1); @@ -772,7 +749,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_phy_cck(dev, 0x6, 0xfc); mdelay(1); write_phy_cck(dev, 0x7, 0x78); mdelay(1); write_phy_cck(dev, 0x8, 0x2e); mdelay(1); - write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1); + write_phy_cck(dev, 0x10, 0x93); mdelay(1); write_phy_cck(dev, 0x11, 0x88); mdelay(1); write_phy_cck(dev, 0x12, 0x47); mdelay(1); write_phy_cck(dev, 0x13, 0xd0); @@ -806,12 +783,8 @@ void rtl8225z2_rf_init(struct net_device *dev) /* switch to high-speed 3-wire * last digit. 2 for both cck and ofdm */ - if (priv->card_type == USB) - write_nic_dword(dev, 0x94, 0x3dc00002); - else { - write_nic_dword(dev, 0x94, 0x15c00002); - rtl8185_rf_pins_enable(dev); - } + write_nic_dword(dev, 0x94, 0x15c00002); + rtl8185_rf_pins_enable(dev); rtl8225_rf_set_chan(dev, priv->chan); } -- 2.20.1