Commit 24ccb9f4 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 61f2dcba
...@@ -46,10 +46,6 @@ struct at86rf2xx_chip_data { ...@@ -46,10 +46,6 @@ struct at86rf2xx_chip_data {
u16 t_off_to_tx_on; u16 t_off_to_tx_on;
u16 t_frame; u16 t_frame;
u16 t_p_ack; u16 t_p_ack;
/* short interframe spacing time */
u16 t_sifs;
/* long interframe spacing time */
u16 t_lifs;
/* completion timeout for tx in msecs */ /* completion timeout for tx in msecs */
u16 t_tx_timeout; u16 t_tx_timeout;
int rssi_base_val; int rssi_base_val;
...@@ -719,18 +715,9 @@ at86rf230_tx_complete(void *context) ...@@ -719,18 +715,9 @@ at86rf230_tx_complete(void *context)
enable_irq(lp->spi->irq); enable_irq(lp->spi->irq);
if (lp->max_frame_retries <= 0) { if (lp->max_frame_retries <= 0)
/* Interfame spacing time, which is phy depend. ieee802154_xmit_complete(lp->hw, skb, true);
* TODO
* Move this handling in MAC 802.15.4 layer.
* This is currently a workaround to avoid fragmenation issues.
*/
if (skb->len > 18)
udelay(lp->data->t_lifs);
else else
udelay(lp->data->t_sifs);
}
ieee802154_xmit_complete(lp->hw, skb, false); ieee802154_xmit_complete(lp->hw, skb, false);
} }
...@@ -1038,6 +1025,36 @@ at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel) ...@@ -1038,6 +1025,36 @@ at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
if (rc < 0) if (rc < 0)
return rc; return rc;
/* This sets the symbol_duration according frequency on the 212.
* TODO move this handling while set channel and page in cfg802154.
* We can do that, this timings are according 802.15.4 standard.
* If we do that in cfg802154, this is a more generic calculation.
*
* This should also protected from ifs_timer. Means cancel timer and
* init with a new value. For now, this is okay.
*/
if (channel == 0) {
if (page == 0) {
/* SUB:0 and BPSK:0 -> BPSK-20 */
lp->hw->phy->symbol_duration = 50;
} else {
/* SUB:1 and BPSK:0 -> BPSK-40 */
lp->hw->phy->symbol_duration = 25;
}
} else {
if (page == 0)
/* SUB:0 and BPSK:1 -> BPSK-20 */
lp->hw->phy->symbol_duration = 40;
else
/* SUB:1 and BPSK:1 -> BPSK-20 */
lp->hw->phy->symbol_duration = 16;
}
lp->hw->phy->lifs_period = IEEE802154_LIFS_PERIOD *
lp->hw->phy->symbol_duration;
lp->hw->phy->sifs_period = IEEE802154_SIFS_PERIOD *
lp->hw->phy->symbol_duration;
return at86rf230_write_subreg(lp, SR_CHANNEL, channel); return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
} }
...@@ -1245,8 +1262,6 @@ static struct at86rf2xx_chip_data at86rf233_data = { ...@@ -1245,8 +1262,6 @@ static struct at86rf2xx_chip_data at86rf233_data = {
.t_off_to_tx_on = 80, .t_off_to_tx_on = 80,
.t_frame = 4096, .t_frame = 4096,
.t_p_ack = 545, .t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000, .t_tx_timeout = 2000,
.rssi_base_val = -91, .rssi_base_val = -91,
.set_channel = at86rf23x_set_channel, .set_channel = at86rf23x_set_channel,
...@@ -1261,8 +1276,6 @@ static struct at86rf2xx_chip_data at86rf231_data = { ...@@ -1261,8 +1276,6 @@ static struct at86rf2xx_chip_data at86rf231_data = {
.t_off_to_tx_on = 110, .t_off_to_tx_on = 110,
.t_frame = 4096, .t_frame = 4096,
.t_p_ack = 545, .t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000, .t_tx_timeout = 2000,
.rssi_base_val = -91, .rssi_base_val = -91,
.set_channel = at86rf23x_set_channel, .set_channel = at86rf23x_set_channel,
...@@ -1277,8 +1290,6 @@ static struct at86rf2xx_chip_data at86rf212_data = { ...@@ -1277,8 +1290,6 @@ static struct at86rf2xx_chip_data at86rf212_data = {
.t_off_to_tx_on = 200, .t_off_to_tx_on = 200,
.t_frame = 4096, .t_frame = 4096,
.t_p_ack = 545, .t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000, .t_tx_timeout = 2000,
.rssi_base_val = -100, .rssi_base_val = -100,
.set_channel = at86rf212_set_channel, .set_channel = at86rf212_set_channel,
...@@ -1414,6 +1425,7 @@ at86rf230_detect_device(struct at86rf230_local *lp) ...@@ -1414,6 +1425,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->data = &at86rf231_data; lp->data = &at86rf231_data;
lp->hw->phy->channels_supported[0] = 0x7FFF800; lp->hw->phy->channels_supported[0] = 0x7FFF800;
lp->hw->phy->current_channel = 11; lp->hw->phy->current_channel = 11;
lp->hw->phy->symbol_duration = 16;
break; break;
case 7: case 7:
chip = "at86rf212"; chip = "at86rf212";
...@@ -1423,6 +1435,7 @@ at86rf230_detect_device(struct at86rf230_local *lp) ...@@ -1423,6 +1435,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->hw->phy->channels_supported[0] = 0x00007FF; lp->hw->phy->channels_supported[0] = 0x00007FF;
lp->hw->phy->channels_supported[2] = 0x00007FF; lp->hw->phy->channels_supported[2] = 0x00007FF;
lp->hw->phy->current_channel = 5; lp->hw->phy->current_channel = 5;
lp->hw->phy->symbol_duration = 25;
} else { } else {
rc = -ENOTSUPP; rc = -ENOTSUPP;
} }
...@@ -1432,6 +1445,7 @@ at86rf230_detect_device(struct at86rf230_local *lp) ...@@ -1432,6 +1445,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->data = &at86rf233_data; lp->data = &at86rf233_data;
lp->hw->phy->channels_supported[0] = 0x7FFF800; lp->hw->phy->channels_supported[0] = 0x7FFF800;
lp->hw->phy->current_channel = 13; lp->hw->phy->current_channel = 13;
lp->hw->phy->symbol_duration = 16;
break; break;
default: default:
chip = "unkown"; chip = "unkown";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment