* [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback @ 2016-04-19 14:28 Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 2/4] ieee802154: atusb: implement .set_cca_ed_level " Stefan Schmidt ` (3 more replies) 0 siblings, 4 replies; 8+ messages in thread From: Stefan Schmidt @ 2016-04-19 14:28 UTC (permalink / raw) To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt Catching up with the stack here and implement CSMA parameter setting. Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> --- drivers/net/ieee802154/atusb.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index b1cd865..2d8de9f 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -473,6 +473,23 @@ atusb_set_txpower(struct ieee802154_hw *hw, s32 mbm) } static int +atusb_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, u8 retries) +{ + struct atusb *atusb = hw->priv; + int ret; + + ret = atusb_write_subreg(atusb, SR_MIN_BE, min_be); + if (ret) + return ret; + + ret = atusb_write_subreg(atusb, SR_MAX_BE, max_be); + if (ret) + return ret; + + return atusb_write_subreg(atusb, SR_MAX_CSMA_RETRIES, retries); +} + +static int atusb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on) { struct atusb *atusb = hw->priv; @@ -508,6 +525,7 @@ static struct ieee802154_ops atusb_ops = { .stop = atusb_stop, .set_hw_addr_filt = atusb_set_hw_addr_filt, .set_txpower = atusb_set_txpower, + .set_csma_params = atusb_set_csma_params, .set_promiscuous_mode = atusb_set_promiscuous_mode, }; @@ -636,7 +654,7 @@ static int atusb_probe(struct usb_interface *interface, hw->parent = &usb_dev->dev; hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT | - IEEE802154_HW_PROMISCUOUS; + IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS; hw->phy->flags = WPAN_PHY_FLAG_TXPOWER; -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH bluetooth-next 2/4] ieee802154: atusb: implement .set_cca_ed_level ops callback 2016-04-19 14:28 [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Stefan Schmidt @ 2016-04-19 14:28 ` Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 3/4] ieee802154: atusb: implement .set_cca_mode " Stefan Schmidt ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Stefan Schmidt @ 2016-04-19 14:28 UTC (permalink / raw) To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt Catching up with the stack here and implement CCA ED level setting. Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> --- drivers/net/ieee802154/atusb.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index 2d8de9f..94f8457 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -472,6 +472,26 @@ atusb_set_txpower(struct ieee802154_hw *hw, s32 mbm) return -EINVAL; } +#define ATUSB_MAX_ED_LEVELS 0xF +static const s32 atusb_ed_levels[ATUSB_MAX_ED_LEVELS + 1] = { + -9100, -8900, -8700, -8500, -8300, -8100, -7900, -7700, -7500, -7300, + -7100, -6900, -6700, -6500, -6300, -6100, +}; + +static int +atusb_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm) +{ + struct atusb *atusb = hw->priv; + u32 i; + + for (i = 0; i < hw->phy->supported.cca_ed_levels_size; i++) { + if (hw->phy->supported.cca_ed_levels[i] == mbm) + return atusb_write_subreg(atusb, SR_CCA_ED_THRES, i); + } + + return -EINVAL; +} + static int atusb_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, u8 retries) { @@ -525,6 +545,7 @@ static struct ieee802154_ops atusb_ops = { .stop = atusb_stop, .set_hw_addr_filt = atusb_set_hw_addr_filt, .set_txpower = atusb_set_txpower, + .set_cca_ed_level = atusb_set_cca_ed_level, .set_csma_params = atusb_set_csma_params, .set_promiscuous_mode = atusb_set_promiscuous_mode, }; @@ -656,7 +677,10 @@ static int atusb_probe(struct usb_interface *interface, hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS; - hw->phy->flags = WPAN_PHY_FLAG_TXPOWER; + hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL; + + hw->phy->supported.cca_ed_levels = atusb_ed_levels; + hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(atusb_ed_levels); hw->phy->current_page = 0; hw->phy->current_channel = 11; /* reset default */ @@ -665,6 +689,7 @@ static int atusb_probe(struct usb_interface *interface, hw->phy->supported.tx_powers_size = ARRAY_SIZE(atusb_powers); hw->phy->transmit_power = hw->phy->supported.tx_powers[0]; ieee802154_random_extended_addr(&hw->phy->perm_extended_addr); + hw->phy->cca_ed_level = hw->phy->supported.cca_ed_levels[7]; atusb_command(atusb, ATUSB_RF_RESET, 0); atusb_get_and_show_chip(atusb); -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH bluetooth-next 3/4] ieee802154: atusb: implement .set_cca_mode ops callback 2016-04-19 14:28 [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 2/4] ieee802154: atusb: implement .set_cca_ed_level " Stefan Schmidt @ 2016-04-19 14:28 ` Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 4/4] ieee802154: atusb: update my copyright years for this driver Stefan Schmidt 2016-04-20 18:55 ` [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Alexander Aring 3 siblings, 0 replies; 8+ messages in thread From: Stefan Schmidt @ 2016-04-19 14:28 UTC (permalink / raw) To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt Catching up with the stack here and implement CCA mode setting. Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> --- drivers/net/ieee802154/atusb.c | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index 94f8457..72128b3 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -479,6 +479,39 @@ static const s32 atusb_ed_levels[ATUSB_MAX_ED_LEVELS + 1] = { }; static int +atusb_set_cca_mode(struct ieee802154_hw *hw, const struct wpan_phy_cca *cca) +{ + struct atusb *atusb = hw->priv; + u8 val; + + /* mapping 802.15.4 to driver spec */ + switch (cca->mode) { + case NL802154_CCA_ENERGY: + val = 1; + break; + case NL802154_CCA_CARRIER: + val = 2; + break; + case NL802154_CCA_ENERGY_CARRIER: + switch (cca->opt) { + case NL802154_CCA_OPT_ENERGY_CARRIER_AND: + val = 3; + break; + case NL802154_CCA_OPT_ENERGY_CARRIER_OR: + val = 0; + break; + default: + return -EINVAL; + } + break; + default: + return -EINVAL; + } + + return atusb_write_subreg(atusb, SR_CCA_MODE, val); +} + +static int atusb_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm) { struct atusb *atusb = hw->priv; @@ -545,6 +578,7 @@ static struct ieee802154_ops atusb_ops = { .stop = atusb_stop, .set_hw_addr_filt = atusb_set_hw_addr_filt, .set_txpower = atusb_set_txpower, + .set_cca_mode = atusb_set_cca_mode, .set_cca_ed_level = atusb_set_cca_ed_level, .set_csma_params = atusb_set_csma_params, .set_promiscuous_mode = atusb_set_promiscuous_mode, @@ -677,11 +711,19 @@ static int atusb_probe(struct usb_interface *interface, hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS; - hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL; + hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL | + WPAN_PHY_FLAG_CCA_MODE; + + hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) | + BIT(NL802154_CCA_CARRIER) | BIT(NL802154_CCA_ENERGY_CARRIER); + hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND) | + BIT(NL802154_CCA_OPT_ENERGY_CARRIER_OR); hw->phy->supported.cca_ed_levels = atusb_ed_levels; hw->phy->supported.cca_ed_levels_size = ARRAY_SIZE(atusb_ed_levels); + hw->phy->cca.mode = NL802154_CCA_ENERGY; + hw->phy->current_page = 0; hw->phy->current_channel = 11; /* reset default */ hw->phy->supported.channels[0] = 0x7FFF800; -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH bluetooth-next 4/4] ieee802154: atusb: update my copyright years for this driver 2016-04-19 14:28 [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 2/4] ieee802154: atusb: implement .set_cca_ed_level " Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 3/4] ieee802154: atusb: implement .set_cca_mode " Stefan Schmidt @ 2016-04-19 14:28 ` Stefan Schmidt 2016-04-20 18:55 ` [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Alexander Aring 3 siblings, 0 replies; 8+ messages in thread From: Stefan Schmidt @ 2016-04-19 14:28 UTC (permalink / raw) To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> --- drivers/net/ieee802154/atusb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index 72128b3..52c9051 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -3,6 +3,8 @@ * * Written 2013 by Werner Almesberger <werner@almesberger.net> * + * Copyright (c) 2015 - 2016 Stefan Schmidt <stefan@datenfreihafen.org> + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2 -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback 2016-04-19 14:28 [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Stefan Schmidt ` (2 preceding siblings ...) 2016-04-19 14:28 ` [PATCH bluetooth-next 4/4] ieee802154: atusb: update my copyright years for this driver Stefan Schmidt @ 2016-04-20 18:55 ` Alexander Aring 2016-04-20 22:22 ` Marcel Holtmann 2016-04-21 10:00 ` Stefan Schmidt 3 siblings, 2 replies; 8+ messages in thread From: Alexander Aring @ 2016-04-20 18:55 UTC (permalink / raw) To: Stefan Schmidt, linux-wpan Hi, On 04/19/2016 04:28 PM, Stefan Schmidt wrote: > Catching up with the stack here and implement CSMA parameter setting. > > Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> all patches are fine. I want to remember this settings have no effects until atusb has TX_ARET support and drops basic operation mode. But I am sure you already known that and this will part of next firmware version. Also please care of ed-levels if they are the same on at86rf230, don't known yet. There is some calculation with rssi_base_val parameter which is on 2.4 Ghz always -91. - Alex ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback 2016-04-20 18:55 ` [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Alexander Aring @ 2016-04-20 22:22 ` Marcel Holtmann 2016-04-21 10:00 ` Stefan Schmidt 1 sibling, 0 replies; 8+ messages in thread From: Marcel Holtmann @ 2016-04-20 22:22 UTC (permalink / raw) To: Alexander Aring; +Cc: Stefan Schmidt, linux-wpan Hi Alex, >> Catching up with the stack here and implement CSMA parameter setting. >> >> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> > > all patches are fine. I want to remember this settings have no effects > until atusb has TX_ARET support and drops basic operation mode. I have applied all 4 patches to bluetooth-next tree. Regards Marcel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback 2016-04-20 18:55 ` [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Alexander Aring 2016-04-20 22:22 ` Marcel Holtmann @ 2016-04-21 10:00 ` Stefan Schmidt 2016-04-21 18:49 ` Stefan Schmidt 1 sibling, 1 reply; 8+ messages in thread From: Stefan Schmidt @ 2016-04-21 10:00 UTC (permalink / raw) To: Alexander Aring, linux-wpan Hello. On 20/04/16 20:55, Alexander Aring wrote: > Hi, > > On 04/19/2016 04:28 PM, Stefan Schmidt wrote: >> Catching up with the stack here and implement CSMA parameter setting. >> >> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> > all patches are fine. I want to remember this settings have no effects > until atusb has TX_ARET support and drops basic operation mode. > > But I am sure you already known that and this will part of next firmware > version. Yes, thats what I'm working on right now. > Also please care of ed-levels if they are the same on at86rf230, don't > known yet. There is some calculation with rssi_base_val parameter which > is on 2.4 Ghz always -91. I will have a look at the 230 ed level table and see if anything special is needed for it when running atusb with the rzusb dongle. regards Stefan Schmidt ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback 2016-04-21 10:00 ` Stefan Schmidt @ 2016-04-21 18:49 ` Stefan Schmidt 0 siblings, 0 replies; 8+ messages in thread From: Stefan Schmidt @ 2016-04-21 18:49 UTC (permalink / raw) To: Alexander Aring, linux-wpan Hello. On 21/04/16 12:00, Stefan Schmidt wrote: > Hello. > > On 20/04/16 20:55, Alexander Aring wrote: >> Hi, >> >> On 04/19/2016 04:28 PM, Stefan Schmidt wrote: >>> Catching up with the stack here and implement CSMA parameter setting. >>> >>> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> >> all patches are fine. I want to remember this settings have no effects >> until atusb has TX_ARET support and drops basic operation mode. >> >> But I am sure you already known that and this will part of next firmware >> version. > > Yes, thats what I'm working on right now. > >> Also please care of ed-levels if they are the same on at86rf230, don't >> known yet. There is some calculation with rssi_base_val parameter which >> is on 2.4 Ghz always -91. > > I will have a look at the 230 ed level table and see if anything > special is needed for it when running atusb with the rzusb dongle. I looked it up in the datasheets (231 on page 91ff and for 230 page 50ff). Both have 85 ED levels in 1dB steps and the range is 0 - 84 on both as well. Nothing I can see where 230 and 231 have any difference how we would need to handle them. regards Stefan Schmidt ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-21 18:50 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-04-19 14:28 [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 2/4] ieee802154: atusb: implement .set_cca_ed_level " Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 3/4] ieee802154: atusb: implement .set_cca_mode " Stefan Schmidt 2016-04-19 14:28 ` [PATCH bluetooth-next 4/4] ieee802154: atusb: update my copyright years for this driver Stefan Schmidt 2016-04-20 18:55 ` [PATCH bluetooth-next 1/4] ieee802154: atusb: implement .set_csma_params ops callback Alexander Aring 2016-04-20 22:22 ` Marcel Holtmann 2016-04-21 10:00 ` Stefan Schmidt 2016-04-21 18:49 ` Stefan Schmidt
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.