aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorYair Shapira <yair.shapira@ti.com>2012-07-05 11:11:30 -0400
committerLuciano Coelho <coelho@ti.com>2012-07-18 08:08:21 -0400
commitc68cc0f6ebd471374c0d913717c6a77572e5f9c6 (patch)
treeffb1df45ba143f23d82a55e7d4e069d1ee8506a8 /drivers/net/wireless
parent8e945ff9739dd75adce5d850eec079b4e9af550b (diff)
wl18xx: add support for ht_mode in conf.h
ht_mode added to wl18xx conf struct in order to support different modes from the configuration file, as well as module params, and by default (working without a conf file and/or no module params). the hack regarding conf.phy.low_band_component_type for each board is now explicitly handled after parsing module params. missing default values to wl18xx config added. fix string module params not to have defaults (so if empty, param can be taken from conf file). update conf version to 3. Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Ido Reis <idor@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ti/wl18xx/conf.h21
-rw-r--r--drivers/net/wireless/ti/wl18xx/main.c83
2 files changed, 77 insertions, 27 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/conf.h b/drivers/net/wireless/ti/wl18xx/conf.h
index fac0b7e87e75..4d426cc20274 100644
--- a/drivers/net/wireless/ti/wl18xx/conf.h
+++ b/drivers/net/wireless/ti/wl18xx/conf.h
@@ -23,7 +23,7 @@
23#define __WL18XX_CONF_H__ 23#define __WL18XX_CONF_H__
24 24
25#define WL18XX_CONF_MAGIC 0x10e100ca 25#define WL18XX_CONF_MAGIC 0x10e100ca
26#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0002) 26#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0003)
27#define WL18XX_CONF_MASK 0x0000ffff 27#define WL18XX_CONF_MASK 0x0000ffff
28#define WL18XX_CONF_SIZE (WLCORE_CONF_SIZE + \ 28#define WL18XX_CONF_SIZE (WLCORE_CONF_SIZE + \
29 sizeof(struct wl18xx_priv_conf)) 29 sizeof(struct wl18xx_priv_conf))
@@ -84,7 +84,26 @@ struct wl18xx_mac_and_phy_params {
84 u8 padding[1]; 84 u8 padding[1];
85} __packed; 85} __packed;
86 86
87enum wl18xx_ht_mode {
88 /* Default - use MIMO, fallback to SISO20 */
89 HT_MODE_DEFAULT = 0,
90
91 /* Wide - use SISO40 */
92 HT_MODE_WIDE = 1,
93
94 /* Use SISO20 */
95 HT_MODE_SISO20 = 2,
96};
97
98struct wl18xx_ht_settings {
99 /* DEFAULT / WIDE / SISO20 */
100 u8 mode;
101} __packed;
102
87struct wl18xx_priv_conf { 103struct wl18xx_priv_conf {
104 /* Module params structures */
105 struct wl18xx_ht_settings ht;
106
88 /* this structure is copied wholesale to FW */ 107 /* this structure is copied wholesale to FW */
89 struct wl18xx_mac_and_phy_params phy; 108 struct wl18xx_mac_and_phy_params phy;
90} __packed; 109} __packed;
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index 8bb21b6458b8..fb284dedf725 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -43,8 +43,8 @@
43 43
44#define WL18XX_RX_CHECKSUM_MASK 0x40 44#define WL18XX_RX_CHECKSUM_MASK 0x40
45 45
46static char *ht_mode_param = "default"; 46static char *ht_mode_param = NULL;
47static char *board_type_param = "hdk"; 47static char *board_type_param = NULL;
48static bool checksum_param = false; 48static bool checksum_param = false;
49static bool enable_11a_param = true; 49static bool enable_11a_param = true;
50static int num_rx_desc_param = -1; 50static int num_rx_desc_param = -1;
@@ -494,16 +494,20 @@ static struct wlcore_conf wl18xx_conf = {
494}; 494};
495 495
496static struct wl18xx_priv_conf wl18xx_default_priv_conf = { 496static struct wl18xx_priv_conf wl18xx_default_priv_conf = {
497 .ht = {
498 .mode = HT_MODE_DEFAULT,
499 },
497 .phy = { 500 .phy = {
498 .phy_standalone = 0x00, 501 .phy_standalone = 0x00,
499 .primary_clock_setting_time = 0x05, 502 .primary_clock_setting_time = 0x05,
500 .clock_valid_on_wake_up = 0x00, 503 .clock_valid_on_wake_up = 0x00,
501 .secondary_clock_setting_time = 0x05, 504 .secondary_clock_setting_time = 0x05,
505 .board_type = BOARD_TYPE_HDK_18XX,
502 .rdl = 0x01, 506 .rdl = 0x01,
503 .auto_detect = 0x00, 507 .auto_detect = 0x00,
504 .dedicated_fem = FEM_NONE, 508 .dedicated_fem = FEM_NONE,
505 .low_band_component = COMPONENT_2_WAY_SWITCH, 509 .low_band_component = COMPONENT_2_WAY_SWITCH,
506 .low_band_component_type = 0x05, 510 .low_band_component_type = 0x06,
507 .high_band_component = COMPONENT_2_WAY_SWITCH, 511 .high_band_component = COMPONENT_2_WAY_SWITCH,
508 .high_band_component_type = 0x09, 512 .high_band_component_type = 0x09,
509 .tcxo_ldo_voltage = 0x00, 513 .tcxo_ldo_voltage = 0x00,
@@ -1391,27 +1395,44 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
1391 if (ret < 0) 1395 if (ret < 0)
1392 goto out_free; 1396 goto out_free;
1393 1397
1394 if (!strcmp(board_type_param, "fpga")) { 1398 /* If the module param is set, update it in conf */
1395 priv->conf.phy.board_type = BOARD_TYPE_FPGA_18XX; 1399 if (board_type_param) {
1396 } else if (!strcmp(board_type_param, "hdk")) { 1400 if (!strcmp(board_type_param, "fpga")) {
1397 priv->conf.phy.board_type = BOARD_TYPE_HDK_18XX; 1401 priv->conf.phy.board_type = BOARD_TYPE_FPGA_18XX;
1398 /* HACK! Just for now we hardcode HDK to 0x06 */ 1402 } else if (!strcmp(board_type_param, "hdk")) {
1399 priv->conf.phy.low_band_component_type = 0x06; 1403 priv->conf.phy.board_type = BOARD_TYPE_HDK_18XX;
1400 } else if (!strcmp(board_type_param, "dvp")) { 1404 } else if (!strcmp(board_type_param, "dvp")) {
1401 priv->conf.phy.board_type = BOARD_TYPE_DVP_18XX; 1405 priv->conf.phy.board_type = BOARD_TYPE_DVP_18XX;
1402 } else if (!strcmp(board_type_param, "evb")) { 1406 } else if (!strcmp(board_type_param, "evb")) {
1403 priv->conf.phy.board_type = BOARD_TYPE_EVB_18XX; 1407 priv->conf.phy.board_type = BOARD_TYPE_EVB_18XX;
1404 } else if (!strcmp(board_type_param, "com8")) { 1408 } else if (!strcmp(board_type_param, "com8")) {
1405 priv->conf.phy.board_type = BOARD_TYPE_COM8_18XX; 1409 priv->conf.phy.board_type = BOARD_TYPE_COM8_18XX;
1406 /* HACK! Just for now we hardcode COM8 to 0x06 */ 1410 } else {
1411 wl1271_error("invalid board type '%s'",
1412 board_type_param);
1413 ret = -EINVAL;
1414 goto out_free;
1415 }
1416 }
1417
1418 /* HACK! Just for now we hardcode COM8 and HDK to 0x06 */
1419 switch (priv->conf.phy.board_type) {
1420 case BOARD_TYPE_HDK_18XX:
1421 case BOARD_TYPE_COM8_18XX:
1407 priv->conf.phy.low_band_component_type = 0x06; 1422 priv->conf.phy.low_band_component_type = 0x06;
1408 } else { 1423 break;
1409 wl1271_error("invalid board type '%s'", board_type_param); 1424 case BOARD_TYPE_FPGA_18XX:
1425 case BOARD_TYPE_DVP_18XX:
1426 case BOARD_TYPE_EVB_18XX:
1427 priv->conf.phy.low_band_component_type = 0x05;
1428 break;
1429 default:
1430 wl1271_error("invalid board type '%d'",
1431 priv->conf.phy.board_type);
1410 ret = -EINVAL; 1432 ret = -EINVAL;
1411 goto out_free; 1433 goto out_free;
1412 } 1434 }
1413 1435
1414 /* If the module param is set, update it in conf */
1415 if (low_band_component_param != -1) 1436 if (low_band_component_param != -1)
1416 priv->conf.phy.low_band_component = low_band_component_param; 1437 priv->conf.phy.low_band_component = low_band_component_param;
1417 if (low_band_component_type_param != -1) 1438 if (low_band_component_type_param != -1)
@@ -1432,7 +1453,21 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
1432 if (dc2dc_param != -1) 1453 if (dc2dc_param != -1)
1433 priv->conf.phy.external_pa_dc2dc = dc2dc_param; 1454 priv->conf.phy.external_pa_dc2dc = dc2dc_param;
1434 1455
1435 if (!strcmp(ht_mode_param, "default")) { 1456 if (ht_mode_param) {
1457 if (!strcmp(ht_mode_param, "default"))
1458 priv->conf.ht.mode = HT_MODE_DEFAULT;
1459 else if (!strcmp(ht_mode_param, "wide"))
1460 priv->conf.ht.mode = HT_MODE_WIDE;
1461 else if (!strcmp(ht_mode_param, "siso20"))
1462 priv->conf.ht.mode = HT_MODE_SISO20;
1463 else {
1464 wl1271_error("invalid ht_mode '%s'", ht_mode_param);
1465 ret = -EINVAL;
1466 goto out_free;
1467 }
1468 }
1469
1470 if (priv->conf.ht.mode == HT_MODE_DEFAULT) {
1436 /* 1471 /*
1437 * Only support mimo with multiple antennas. Fall back to 1472 * Only support mimo with multiple antennas. Fall back to
1438 * siso20. 1473 * siso20.
@@ -1447,20 +1482,16 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
1447 /* 5Ghz is always wide */ 1482 /* 5Ghz is always wide */
1448 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, 1483 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
1449 &wl18xx_siso40_ht_cap_5ghz); 1484 &wl18xx_siso40_ht_cap_5ghz);
1450 } else if (!strcmp(ht_mode_param, "wide")) { 1485 } else if (priv->conf.ht.mode == HT_MODE_WIDE) {
1451 wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, 1486 wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
1452 &wl18xx_siso40_ht_cap_2ghz); 1487 &wl18xx_siso40_ht_cap_2ghz);
1453 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, 1488 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
1454 &wl18xx_siso40_ht_cap_5ghz); 1489 &wl18xx_siso40_ht_cap_5ghz);
1455 } else if (!strcmp(ht_mode_param, "siso20")) { 1490 } else if (priv->conf.ht.mode == HT_MODE_SISO20) {
1456 wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, 1491 wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
1457 &wl18xx_siso20_ht_cap); 1492 &wl18xx_siso20_ht_cap);
1458 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, 1493 wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
1459 &wl18xx_siso20_ht_cap); 1494 &wl18xx_siso20_ht_cap);
1460 } else {
1461 wl1271_error("invalid ht_mode '%s'", ht_mode_param);
1462 ret = -EINVAL;
1463 goto out_free;
1464 } 1495 }
1465 1496
1466 if (!checksum_param) { 1497 if (!checksum_param) {