aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-12 13:51:57 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-12 22:51:58 -0500
commit24ccb9f4f7a3a5a867bbc880019cdb4b41176b63 (patch)
tree2992d7fa7fefa7e520ac14684bc5e2cd85adfe37 /drivers/net/ieee802154
parent61f2dcba9a03d4fd9342f0d6821af0a46c7098e9 (diff)
at86rf230: remove interframe spacing time workaround
This patch removes the interframe spacing time workaround from at86rf230 driver and use the mac802154 one. The interframe spacing time differs at at86rf212 and channel setting. This patch fix this handling which is also a new workaround and should be moved into mac802154 while channel setting. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r--drivers/net/ieee802154/at86rf230.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 46e50295710a..7278e1838c57 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -46,10 +46,6 @@ struct at86rf2xx_chip_data {
46 u16 t_off_to_tx_on; 46 u16 t_off_to_tx_on;
47 u16 t_frame; 47 u16 t_frame;
48 u16 t_p_ack; 48 u16 t_p_ack;
49 /* short interframe spacing time */
50 u16 t_sifs;
51 /* long interframe spacing time */
52 u16 t_lifs;
53 /* completion timeout for tx in msecs */ 49 /* completion timeout for tx in msecs */
54 u16 t_tx_timeout; 50 u16 t_tx_timeout;
55 int rssi_base_val; 51 int rssi_base_val;
@@ -719,19 +715,10 @@ at86rf230_tx_complete(void *context)
719 715
720 enable_irq(lp->spi->irq); 716 enable_irq(lp->spi->irq);
721 717
722 if (lp->max_frame_retries <= 0) { 718 if (lp->max_frame_retries <= 0)
723 /* Interfame spacing time, which is phy depend. 719 ieee802154_xmit_complete(lp->hw, skb, true);
724 * TODO 720 else
725 * Move this handling in MAC 802.15.4 layer. 721 ieee802154_xmit_complete(lp->hw, skb, false);
726 * This is currently a workaround to avoid fragmenation issues.
727 */
728 if (skb->len > 18)
729 udelay(lp->data->t_lifs);
730 else
731 udelay(lp->data->t_sifs);
732 }
733
734 ieee802154_xmit_complete(lp->hw, skb, false);
735} 722}
736 723
737static void 724static void
@@ -1038,6 +1025,36 @@ at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
1038 if (rc < 0) 1025 if (rc < 0)
1039 return rc; 1026 return rc;
1040 1027
1028 /* This sets the symbol_duration according frequency on the 212.
1029 * TODO move this handling while set channel and page in cfg802154.
1030 * We can do that, this timings are according 802.15.4 standard.
1031 * If we do that in cfg802154, this is a more generic calculation.
1032 *
1033 * This should also protected from ifs_timer. Means cancel timer and
1034 * init with a new value. For now, this is okay.
1035 */
1036 if (channel == 0) {
1037 if (page == 0) {
1038 /* SUB:0 and BPSK:0 -> BPSK-20 */
1039 lp->hw->phy->symbol_duration = 50;
1040 } else {
1041 /* SUB:1 and BPSK:0 -> BPSK-40 */
1042 lp->hw->phy->symbol_duration = 25;
1043 }
1044 } else {
1045 if (page == 0)
1046 /* SUB:0 and BPSK:1 -> BPSK-20 */
1047 lp->hw->phy->symbol_duration = 40;
1048 else
1049 /* SUB:1 and BPSK:1 -> BPSK-20 */
1050 lp->hw->phy->symbol_duration = 16;
1051 }
1052
1053 lp->hw->phy->lifs_period = IEEE802154_LIFS_PERIOD *
1054 lp->hw->phy->symbol_duration;
1055 lp->hw->phy->sifs_period = IEEE802154_SIFS_PERIOD *
1056 lp->hw->phy->symbol_duration;
1057
1041 return at86rf230_write_subreg(lp, SR_CHANNEL, channel); 1058 return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
1042} 1059}
1043 1060
@@ -1245,8 +1262,6 @@ static struct at86rf2xx_chip_data at86rf233_data = {
1245 .t_off_to_tx_on = 80, 1262 .t_off_to_tx_on = 80,
1246 .t_frame = 4096, 1263 .t_frame = 4096,
1247 .t_p_ack = 545, 1264 .t_p_ack = 545,
1248 .t_sifs = 192,
1249 .t_lifs = 640,
1250 .t_tx_timeout = 2000, 1265 .t_tx_timeout = 2000,
1251 .rssi_base_val = -91, 1266 .rssi_base_val = -91,
1252 .set_channel = at86rf23x_set_channel, 1267 .set_channel = at86rf23x_set_channel,
@@ -1261,8 +1276,6 @@ static struct at86rf2xx_chip_data at86rf231_data = {
1261 .t_off_to_tx_on = 110, 1276 .t_off_to_tx_on = 110,
1262 .t_frame = 4096, 1277 .t_frame = 4096,
1263 .t_p_ack = 545, 1278 .t_p_ack = 545,
1264 .t_sifs = 192,
1265 .t_lifs = 640,
1266 .t_tx_timeout = 2000, 1279 .t_tx_timeout = 2000,
1267 .rssi_base_val = -91, 1280 .rssi_base_val = -91,
1268 .set_channel = at86rf23x_set_channel, 1281 .set_channel = at86rf23x_set_channel,
@@ -1277,8 +1290,6 @@ static struct at86rf2xx_chip_data at86rf212_data = {
1277 .t_off_to_tx_on = 200, 1290 .t_off_to_tx_on = 200,
1278 .t_frame = 4096, 1291 .t_frame = 4096,
1279 .t_p_ack = 545, 1292 .t_p_ack = 545,
1280 .t_sifs = 192,
1281 .t_lifs = 640,
1282 .t_tx_timeout = 2000, 1293 .t_tx_timeout = 2000,
1283 .rssi_base_val = -100, 1294 .rssi_base_val = -100,
1284 .set_channel = at86rf212_set_channel, 1295 .set_channel = at86rf212_set_channel,
@@ -1414,6 +1425,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
1414 lp->data = &at86rf231_data; 1425 lp->data = &at86rf231_data;
1415 lp->hw->phy->channels_supported[0] = 0x7FFF800; 1426 lp->hw->phy->channels_supported[0] = 0x7FFF800;
1416 lp->hw->phy->current_channel = 11; 1427 lp->hw->phy->current_channel = 11;
1428 lp->hw->phy->symbol_duration = 16;
1417 break; 1429 break;
1418 case 7: 1430 case 7:
1419 chip = "at86rf212"; 1431 chip = "at86rf212";
@@ -1423,6 +1435,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
1423 lp->hw->phy->channels_supported[0] = 0x00007FF; 1435 lp->hw->phy->channels_supported[0] = 0x00007FF;
1424 lp->hw->phy->channels_supported[2] = 0x00007FF; 1436 lp->hw->phy->channels_supported[2] = 0x00007FF;
1425 lp->hw->phy->current_channel = 5; 1437 lp->hw->phy->current_channel = 5;
1438 lp->hw->phy->symbol_duration = 25;
1426 } else { 1439 } else {
1427 rc = -ENOTSUPP; 1440 rc = -ENOTSUPP;
1428 } 1441 }
@@ -1432,6 +1445,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
1432 lp->data = &at86rf233_data; 1445 lp->data = &at86rf233_data;
1433 lp->hw->phy->channels_supported[0] = 0x7FFF800; 1446 lp->hw->phy->channels_supported[0] = 0x7FFF800;
1434 lp->hw->phy->current_channel = 13; 1447 lp->hw->phy->current_channel = 13;
1448 lp->hw->phy->symbol_duration = 16;
1435 break; 1449 break;
1436 default: 1450 default:
1437 chip = "unkown"; 1451 chip = "unkown";