diff options
author | Andrea Merello <andrea.merello@gmail.com> | 2014-03-15 13:29:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-03-17 13:44:15 -0400 |
commit | 516a0930195e996512495fbdedf6cc298eb96c66 (patch) | |
tree | 64c81013bb56d8d45a5e5150f762f9345a448a7c /drivers/net/wireless | |
parent | bf888184f8857b03f53bba84acb12f29f1068ea9 (diff) |
rtl8180: support for BSS_CHANGED_BASIC_RATES
Basic rates setting is done with hardcoded register write with
fixed settings.
This patch introduces a new function that makes it possible to
configure basic rates and it add a check for mac80211
BSS_CHANGED_BASIC_RATES flag in order to eventually invoke that
function when needed.
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180/dev.c | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 3c2b784fd783..ede8fee13332 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -371,6 +371,36 @@ void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam) | |||
371 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | 371 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); |
372 | } | 372 | } |
373 | 373 | ||
374 | static void rtl8180_conf_basic_rates(struct ieee80211_hw *dev, | ||
375 | u32 rates_mask) | ||
376 | { | ||
377 | struct rtl8180_priv *priv = dev->priv; | ||
378 | |||
379 | u8 max, min; | ||
380 | u16 reg; | ||
381 | |||
382 | max = fls(rates_mask) - 1; | ||
383 | min = ffs(rates_mask) - 1; | ||
384 | |||
385 | switch (priv->chip_family) { | ||
386 | |||
387 | case RTL818X_CHIP_FAMILY_RTL8180: | ||
388 | /* in 8180 this is NOT a BITMAP */ | ||
389 | reg = rtl818x_ioread16(priv, &priv->map->BRSR); | ||
390 | reg &= ~3; | ||
391 | reg |= max; | ||
392 | rtl818x_iowrite16(priv, &priv->map->BRSR, reg); | ||
393 | |||
394 | break; | ||
395 | |||
396 | case RTL818X_CHIP_FAMILY_RTL8185: | ||
397 | /* in 8185 this is a BITMAP */ | ||
398 | rtl818x_iowrite16(priv, &priv->map->BRSR, rates_mask); | ||
399 | rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (max << 4) | min); | ||
400 | break; | ||
401 | } | ||
402 | } | ||
403 | |||
374 | static int rtl8180_init_hw(struct ieee80211_hw *dev) | 404 | static int rtl8180_init_hw(struct ieee80211_hw *dev) |
375 | { | 405 | { |
376 | struct rtl8180_priv *priv = dev->priv; | 406 | struct rtl8180_priv *priv = dev->priv; |
@@ -441,9 +471,6 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
441 | if (priv->chip_family != RTL818X_CHIP_FAMILY_RTL8180) { | 471 | if (priv->chip_family != RTL818X_CHIP_FAMILY_RTL8180) { |
442 | rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); | 472 | rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); |
443 | rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81); | 473 | rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81); |
444 | rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0); | ||
445 | |||
446 | rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); | ||
447 | 474 | ||
448 | /* TODO: set ClkRun enable? necessary? */ | 475 | /* TODO: set ClkRun enable? necessary? */ |
449 | reg = rtl818x_ioread8(priv, &priv->map->GP_ENABLE); | 476 | reg = rtl818x_ioread8(priv, &priv->map->GP_ENABLE); |
@@ -453,7 +480,6 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
453 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | (1 << 2)); | 480 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | (1 << 2)); |
454 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | 481 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); |
455 | } else { | 482 | } else { |
456 | rtl818x_iowrite16(priv, &priv->map->BRSR, 0x1); | ||
457 | rtl818x_iowrite8(priv, &priv->map->SECURITY, 0); | 483 | rtl818x_iowrite8(priv, &priv->map->SECURITY, 0); |
458 | 484 | ||
459 | rtl818x_iowrite8(priv, &priv->map->PHY_DELAY, 0x6); | 485 | rtl818x_iowrite8(priv, &priv->map->PHY_DELAY, 0x6); |
@@ -461,8 +487,18 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
461 | } | 487 | } |
462 | 488 | ||
463 | priv->rf->init(dev); | 489 | priv->rf->init(dev); |
464 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8185) | 490 | |
465 | rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); | 491 | /* default basic rates are 1,2 Mbps for rtl8180. 1,2,6,9,12,18,24 Mbps |
492 | * otherwise. bitmask 0x3 and 0x01f3 respectively. | ||
493 | * NOTE: currenty rtl8225 RF code changes basic rates, so we need to do | ||
494 | * this after rf init. | ||
495 | * TODO: try to find out whether RF code really needs to do this.. | ||
496 | */ | ||
497 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) | ||
498 | rtl8180_conf_basic_rates(dev, 0x3); | ||
499 | else | ||
500 | rtl8180_conf_basic_rates(dev, 0x1f3); | ||
501 | |||
466 | return 0; | 502 | return 0; |
467 | } | 503 | } |
468 | 504 | ||
@@ -857,6 +893,9 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev, | |||
857 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); | 893 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); |
858 | } | 894 | } |
859 | 895 | ||
896 | if (changed & BSS_CHANGED_BASIC_RATES) | ||
897 | rtl8180_conf_basic_rates(dev, info->basic_rates); | ||
898 | |||
860 | if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) | 899 | if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) |
861 | priv->rf->conf_erp(dev, info); | 900 | priv->rf->conf_erp(dev, info); |
862 | 901 | ||