aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ieee802154/atusb.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2022-02-01 19:06:27 +0100
committerStefan Schmidt <stefan@datenfreihafen.org>2022-02-10 15:41:58 +0100
commit731cddce6dd110fb2cdee34eddb48599e7251517 (patch)
tree54ba2afeedaa1a2a7a96fdc9201acb79aace6037 /drivers/net/ieee802154/atusb.c
parentnet: ieee802154: ca8210: Fix lifs/sifs periods (diff)
downloadlinux-dev-731cddce6dd110fb2cdee34eddb48599e7251517.tar.xz
linux-dev-731cddce6dd110fb2cdee34eddb48599e7251517.zip
net: mac802154: Convert the symbol duration into nanoseconds
Tdsym is often given in the spec as pretty small numbers in microseconds and hence was reflected in the code as symbol_duration and was stored as a u8. Actually, for UWB PHYs, the symbol duration is given in nanoseconds and are as precise as picoseconds. In order to handle better these PHYs, change the type of symbol_duration to u32 and store this value in nanoseconds. All the users of this variable are updated in a mechanical way. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20220201180629.93410-3-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'drivers/net/ieee802154/atusb.c')
-rw-r--r--drivers/net/ieee802154/atusb.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 07bafbf94680..abe27d1c51ca 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -625,24 +625,24 @@ static int hulusb_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
if (channel == 0) {
if (page == 0) {
/* SUB:0 and BPSK:0 -> BPSK-20 */
- lp->hw->phy->symbol_duration = 50;
+ lp->hw->phy->symbol_duration = 50 * NSEC_PER_USEC;
} else {
/* SUB:1 and BPSK:0 -> BPSK-40 */
- lp->hw->phy->symbol_duration = 25;
+ lp->hw->phy->symbol_duration = 25 * NSEC_PER_USEC;
}
} else {
if (page == 0)
/* SUB:0 and BPSK:1 -> OQPSK-100/200/400 */
- lp->hw->phy->symbol_duration = 40;
+ lp->hw->phy->symbol_duration = 40 * NSEC_PER_USEC;
else
/* SUB:1 and BPSK:1 -> OQPSK-250/500/1000 */
- lp->hw->phy->symbol_duration = 16;
+ lp->hw->phy->symbol_duration = 16 * NSEC_PER_USEC;
}
- 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;
+ lp->hw->phy->lifs_period =
+ (IEEE802154_LIFS_PERIOD * lp->hw->phy->symbol_duration) / 1000;
+ lp->hw->phy->sifs_period =
+ (IEEE802154_SIFS_PERIOD * lp->hw->phy->symbol_duration) / 1000;
return atusb_write_subreg(lp, SR_CHANNEL, channel);
}
@@ -869,7 +869,7 @@ static int atusb_get_and_conf_chip(struct atusb *atusb)
chip = "AT86RF230";
atusb->hw->phy->supported.channels[0] = 0x7FFF800;
atusb->hw->phy->current_channel = 11; /* reset default */
- atusb->hw->phy->symbol_duration = 16;
+ atusb->hw->phy->symbol_duration = 16 * NSEC_PER_USEC;
atusb->hw->phy->supported.tx_powers = atusb_powers;
atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers);
hw->phy->supported.cca_ed_levels = atusb_ed_levels;
@@ -879,7 +879,7 @@ static int atusb_get_and_conf_chip(struct atusb *atusb)
chip = "AT86RF231";
atusb->hw->phy->supported.channels[0] = 0x7FFF800;
atusb->hw->phy->current_channel = 11; /* reset default */
- atusb->hw->phy->symbol_duration = 16;
+ atusb->hw->phy->symbol_duration = 16 * NSEC_PER_USEC;
atusb->hw->phy->supported.tx_powers = atusb_powers;
atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers);
hw->phy->supported.cca_ed_levels = atusb_ed_levels;
@@ -891,7 +891,7 @@ static int atusb_get_and_conf_chip(struct atusb *atusb)
atusb->hw->phy->supported.channels[0] = 0x00007FF;
atusb->hw->phy->supported.channels[2] = 0x00007FF;
atusb->hw->phy->current_channel = 5;
- atusb->hw->phy->symbol_duration = 25;
+ atusb->hw->phy->symbol_duration = 25 * NSEC_PER_USEC;
atusb->hw->phy->supported.lbt = NL802154_SUPPORTED_BOOL_BOTH;
atusb->hw->phy->supported.tx_powers = at86rf212_powers;
atusb->hw->phy->supported.tx_powers_size = ARRAY_SIZE(at86rf212_powers);