diff options
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/main.c | 71 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/reg.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 26 |
3 files changed, 65 insertions, 33 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 717c4f5a02c2..49aca2cf7605 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ip.h> | 24 | #include <linux/ip.h> |
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
27 | #include <linux/irq.h> | ||
27 | 28 | ||
28 | #include "../wlcore/wlcore.h" | 29 | #include "../wlcore/wlcore.h" |
29 | #include "../wlcore/debug.h" | 30 | #include "../wlcore/debug.h" |
@@ -578,7 +579,7 @@ static struct wl18xx_priv_conf wl18xx_default_priv_conf = { | |||
578 | 579 | ||
579 | static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = { | 580 | static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = { |
580 | [PART_TOP_PRCM_ELP_SOC] = { | 581 | [PART_TOP_PRCM_ELP_SOC] = { |
581 | .mem = { .start = 0x00A02000, .size = 0x00010000 }, | 582 | .mem = { .start = 0x00A00000, .size = 0x00012000 }, |
582 | .reg = { .start = 0x00807000, .size = 0x00005000 }, | 583 | .reg = { .start = 0x00807000, .size = 0x00005000 }, |
583 | .mem2 = { .start = 0x00800000, .size = 0x0000B000 }, | 584 | .mem2 = { .start = 0x00800000, .size = 0x0000B000 }, |
584 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, | 585 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, |
@@ -862,6 +863,7 @@ static int wl18xx_pre_upload(struct wl1271 *wl) | |||
862 | { | 863 | { |
863 | u32 tmp; | 864 | u32 tmp; |
864 | int ret; | 865 | int ret; |
866 | u16 irq_invert; | ||
865 | 867 | ||
866 | BUILD_BUG_ON(sizeof(struct wl18xx_mac_and_phy_params) > | 868 | BUILD_BUG_ON(sizeof(struct wl18xx_mac_and_phy_params) > |
867 | WL18XX_PHY_INIT_MEM_SIZE); | 869 | WL18XX_PHY_INIT_MEM_SIZE); |
@@ -911,6 +913,28 @@ static int wl18xx_pre_upload(struct wl1271 *wl) | |||
911 | /* re-enable FDSP clock */ | 913 | /* re-enable FDSP clock */ |
912 | ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, | 914 | ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, |
913 | MEM_FDSP_CLK_120_ENABLE); | 915 | MEM_FDSP_CLK_120_ENABLE); |
916 | if (ret < 0) | ||
917 | goto out; | ||
918 | |||
919 | ret = irq_get_trigger_type(wl->irq); | ||
920 | if ((ret == IRQ_TYPE_LEVEL_LOW) || (ret == IRQ_TYPE_EDGE_FALLING)) { | ||
921 | wl1271_info("using inverted interrupt logic: %d", ret); | ||
922 | ret = wlcore_set_partition(wl, | ||
923 | &wl->ptable[PART_TOP_PRCM_ELP_SOC]); | ||
924 | if (ret < 0) | ||
925 | goto out; | ||
926 | |||
927 | ret = wl18xx_top_reg_read(wl, TOP_FN0_CCCR_REG_32, &irq_invert); | ||
928 | if (ret < 0) | ||
929 | goto out; | ||
930 | |||
931 | irq_invert |= BIT(1); | ||
932 | ret = wl18xx_top_reg_write(wl, TOP_FN0_CCCR_REG_32, irq_invert); | ||
933 | if (ret < 0) | ||
934 | goto out; | ||
935 | |||
936 | ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); | ||
937 | } | ||
914 | 938 | ||
915 | out: | 939 | out: |
916 | return ret; | 940 | return ret; |
@@ -1351,9 +1375,10 @@ out: | |||
1351 | } | 1375 | } |
1352 | 1376 | ||
1353 | #define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin" | 1377 | #define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin" |
1354 | static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) | 1378 | |
1379 | static int wl18xx_load_conf_file(struct device *dev, struct wlcore_conf *conf, | ||
1380 | struct wl18xx_priv_conf *priv_conf) | ||
1355 | { | 1381 | { |
1356 | struct wl18xx_priv *priv = wl->priv; | ||
1357 | struct wlcore_conf_file *conf_file; | 1382 | struct wlcore_conf_file *conf_file; |
1358 | const struct firmware *fw; | 1383 | const struct firmware *fw; |
1359 | int ret; | 1384 | int ret; |
@@ -1362,14 +1387,14 @@ static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) | |||
1362 | if (ret < 0) { | 1387 | if (ret < 0) { |
1363 | wl1271_error("could not get configuration binary %s: %d", | 1388 | wl1271_error("could not get configuration binary %s: %d", |
1364 | WL18XX_CONF_FILE_NAME, ret); | 1389 | WL18XX_CONF_FILE_NAME, ret); |
1365 | goto out_fallback; | 1390 | return ret; |
1366 | } | 1391 | } |
1367 | 1392 | ||
1368 | if (fw->size != WL18XX_CONF_SIZE) { | 1393 | if (fw->size != WL18XX_CONF_SIZE) { |
1369 | wl1271_error("configuration binary file size is wrong, expected %zu got %zu", | 1394 | wl1271_error("configuration binary file size is wrong, expected %zu got %zu", |
1370 | WL18XX_CONF_SIZE, fw->size); | 1395 | WL18XX_CONF_SIZE, fw->size); |
1371 | ret = -EINVAL; | 1396 | ret = -EINVAL; |
1372 | goto out; | 1397 | goto out_release; |
1373 | } | 1398 | } |
1374 | 1399 | ||
1375 | conf_file = (struct wlcore_conf_file *) fw->data; | 1400 | conf_file = (struct wlcore_conf_file *) fw->data; |
@@ -1379,7 +1404,7 @@ static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) | |||
1379 | "expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC, | 1404 | "expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC, |
1380 | conf_file->header.magic); | 1405 | conf_file->header.magic); |
1381 | ret = -EINVAL; | 1406 | ret = -EINVAL; |
1382 | goto out; | 1407 | goto out_release; |
1383 | } | 1408 | } |
1384 | 1409 | ||
1385 | if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) { | 1410 | if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) { |
@@ -1387,28 +1412,32 @@ static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) | |||
1387 | "expected 0x%08x got 0x%08x", | 1412 | "expected 0x%08x got 0x%08x", |
1388 | WL18XX_CONF_VERSION, conf_file->header.version); | 1413 | WL18XX_CONF_VERSION, conf_file->header.version); |
1389 | ret = -EINVAL; | 1414 | ret = -EINVAL; |
1390 | goto out; | 1415 | goto out_release; |
1391 | } | 1416 | } |
1392 | 1417 | ||
1393 | memcpy(&wl->conf, &conf_file->core, sizeof(wl18xx_conf)); | 1418 | memcpy(conf, &conf_file->core, sizeof(*conf)); |
1394 | memcpy(&priv->conf, &conf_file->priv, sizeof(priv->conf)); | 1419 | memcpy(priv_conf, &conf_file->priv, sizeof(*priv_conf)); |
1420 | |||
1421 | out_release: | ||
1422 | release_firmware(fw); | ||
1423 | return ret; | ||
1424 | } | ||
1395 | 1425 | ||
1396 | goto out; | 1426 | static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) |
1427 | { | ||
1428 | struct wl18xx_priv *priv = wl->priv; | ||
1397 | 1429 | ||
1398 | out_fallback: | 1430 | if (wl18xx_load_conf_file(dev, &wl->conf, &priv->conf) < 0) { |
1399 | wl1271_warning("falling back to default config"); | 1431 | wl1271_warning("falling back to default config"); |
1400 | 1432 | ||
1401 | /* apply driver default configuration */ | 1433 | /* apply driver default configuration */ |
1402 | memcpy(&wl->conf, &wl18xx_conf, sizeof(wl18xx_conf)); | 1434 | memcpy(&wl->conf, &wl18xx_conf, sizeof(wl->conf)); |
1403 | /* apply default private configuration */ | 1435 | /* apply default private configuration */ |
1404 | memcpy(&priv->conf, &wl18xx_default_priv_conf, sizeof(priv->conf)); | 1436 | memcpy(&priv->conf, &wl18xx_default_priv_conf, |
1437 | sizeof(priv->conf)); | ||
1438 | } | ||
1405 | 1439 | ||
1406 | /* For now we just fallback */ | ||
1407 | return 0; | 1440 | return 0; |
1408 | |||
1409 | out: | ||
1410 | release_firmware(fw); | ||
1411 | return ret; | ||
1412 | } | 1441 | } |
1413 | 1442 | ||
1414 | static int wl18xx_plt_init(struct wl1271 *wl) | 1443 | static int wl18xx_plt_init(struct wl1271 *wl) |
diff --git a/drivers/net/wireless/ti/wl18xx/reg.h b/drivers/net/wireless/ti/wl18xx/reg.h index a433a75f3cd7..bac2364c8e72 100644 --- a/drivers/net/wireless/ti/wl18xx/reg.h +++ b/drivers/net/wireless/ti/wl18xx/reg.h | |||
@@ -109,6 +109,7 @@ | |||
109 | 109 | ||
110 | #define WL18XX_WELP_ARM_COMMAND (WL18XX_REGISTERS_BASE + 0x7100) | 110 | #define WL18XX_WELP_ARM_COMMAND (WL18XX_REGISTERS_BASE + 0x7100) |
111 | #define WL18XX_ENABLE (WL18XX_REGISTERS_BASE + 0x01543C) | 111 | #define WL18XX_ENABLE (WL18XX_REGISTERS_BASE + 0x01543C) |
112 | #define TOP_FN0_CCCR_REG_32 (WL18XX_TOP_OCP_BASE + 0x64) | ||
112 | 113 | ||
113 | /* PRCM registers */ | 114 | /* PRCM registers */ |
114 | #define PLATFORM_DETECTION 0xA0E3E0 | 115 | #define PLATFORM_DETECTION 0xA0E3E0 |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 7fe50f8182f3..ef3fe0fff588 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5965,10 +5965,6 @@ static int wl12xx_get_hw_info(struct wl1271 *wl) | |||
5965 | { | 5965 | { |
5966 | int ret; | 5966 | int ret; |
5967 | 5967 | ||
5968 | ret = wl12xx_set_power_on(wl); | ||
5969 | if (ret < 0) | ||
5970 | return ret; | ||
5971 | |||
5972 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &wl->chip.id); | 5968 | ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &wl->chip.id); |
5973 | if (ret < 0) | 5969 | if (ret < 0) |
5974 | goto out; | 5970 | goto out; |
@@ -5984,7 +5980,6 @@ static int wl12xx_get_hw_info(struct wl1271 *wl) | |||
5984 | ret = wl->ops->get_mac(wl); | 5980 | ret = wl->ops->get_mac(wl); |
5985 | 5981 | ||
5986 | out: | 5982 | out: |
5987 | wl1271_power_off(wl); | ||
5988 | return ret; | 5983 | return ret; |
5989 | } | 5984 | } |
5990 | 5985 | ||
@@ -6432,10 +6427,22 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context) | |||
6432 | else | 6427 | else |
6433 | wl->irq_flags |= IRQF_ONESHOT; | 6428 | wl->irq_flags |= IRQF_ONESHOT; |
6434 | 6429 | ||
6430 | ret = wl12xx_set_power_on(wl); | ||
6431 | if (ret < 0) | ||
6432 | goto out_free_nvs; | ||
6433 | |||
6434 | ret = wl12xx_get_hw_info(wl); | ||
6435 | if (ret < 0) { | ||
6436 | wl1271_error("couldn't get hw info"); | ||
6437 | wl1271_power_off(wl); | ||
6438 | goto out_free_nvs; | ||
6439 | } | ||
6440 | |||
6435 | ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq, | 6441 | ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq, |
6436 | wl->irq_flags, pdev->name, wl); | 6442 | wl->irq_flags, pdev->name, wl); |
6437 | if (ret < 0) { | 6443 | if (ret < 0) { |
6438 | wl1271_error("request_irq() failed: %d", ret); | 6444 | wl1271_error("interrupt configuration failed"); |
6445 | wl1271_power_off(wl); | ||
6439 | goto out_free_nvs; | 6446 | goto out_free_nvs; |
6440 | } | 6447 | } |
6441 | 6448 | ||
@@ -6449,12 +6456,7 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context) | |||
6449 | } | 6456 | } |
6450 | #endif | 6457 | #endif |
6451 | disable_irq(wl->irq); | 6458 | disable_irq(wl->irq); |
6452 | 6459 | wl1271_power_off(wl); | |
6453 | ret = wl12xx_get_hw_info(wl); | ||
6454 | if (ret < 0) { | ||
6455 | wl1271_error("couldn't get hw info"); | ||
6456 | goto out_irq; | ||
6457 | } | ||
6458 | 6460 | ||
6459 | ret = wl->ops->identify_chip(wl); | 6461 | ret = wl->ops->identify_chip(wl); |
6460 | if (ret < 0) | 6462 | if (ret < 0) |