linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, alan@signal11.us, jonatan@myeden.se,
	stefan@osg.samsung.com
Subject: Re: [RFC bluetooth-next 17/21] mrf24j40: add cca mode support
Date: Thu, 27 Aug 2015 19:49:15 +0200	[thread overview]
Message-ID: <20150827174912.GC686@omega> (raw)
In-Reply-To: <1439468568-22288-18-git-send-email-alex.aring@gmail.com>

On Thu, Aug 13, 2015 at 02:22:44PM +0200, Alexander Aring wrote:
> This patch supports cca mode handling for mrf24j40.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
>  drivers/net/ieee802154/mrf24j40.c | 40 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
> index fdb0b84..0fc7628 100644
> --- a/drivers/net/ieee802154/mrf24j40.c
> +++ b/drivers/net/ieee802154/mrf24j40.c
> @@ -789,6 +789,37 @@ mrf24j40_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be,
>  	return regmap_update_bits(devrec->regmap_short, REG_TXMCR, 0x1f, val);
>  }
>  
> +static int mrf24j40_set_cca_mode(struct ieee802154_hw *hw,
> +				 const struct wpan_phy_cca *cca)
> +{
> +	struct mrf24j40 *devrec = hw->priv;
> +	u8 val;
> +
> +	/* mapping 802.15.4 to driver spec */
> +	switch (cca->mode) {
> +	case NL802154_CCA_ENERGY:
> +		val = 2;
> +		break;
> +	case NL802154_CCA_CARRIER:
> +		val = 1;
> +		break;
> +	case NL802154_CCA_ENERGY_CARRIER:
> +		switch (cca->opt) {
> +		case NL802154_CCA_OPT_ENERGY_CARRIER_OR:

changed NL802154_CCA_OPT_ENERGY_CARRIER_OR to
NL802154_CCA_OPT_ENERGY_CARRIER_AND.

Reason see below.

> +			val = 3;
> +			break;
> +		default:
> +			return -EINVAL;
> +		}
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return regmap_update_bits(devrec->regmap_short, REG_BBREG2, 0xc0,
> +				  val << 6);
> +}
> +
>  static const struct ieee802154_ops mrf24j40_ops = {
>  	.owner = THIS_MODULE,
>  	.xmit_async = mrf24j40_tx,
> @@ -798,6 +829,7 @@ static const struct ieee802154_ops mrf24j40_ops = {
>  	.set_channel = mrf24j40_set_channel,
>  	.set_hw_addr_filt = mrf24j40_filter,
>  	.set_csma_params = mrf24j40_csma_params,
> +	.set_cca_mode = mrf24j40_set_cca_mode,
>  };
>  
>  static void mrf24j40_intstat_complete(void *context)
> @@ -999,6 +1031,12 @@ static void  mrf24j40_phy_setup(struct mrf24j40 *devrec)
>  	/* We assume max_be is 802.15.4 default */
>  	devrec->hw->phy->supported.min_maxbe = 5;
>  	devrec->hw->phy->supported.max_maxbe = 5;
> +
> +	devrec->hw->phy->cca.mode = NL802154_CCA_CARRIER;;
> +	devrec->hw->phy->supported.cca_modes = BIT(NL802154_CCA_ENERGY) |
> +					       BIT(NL802154_CCA_CARRIER) |
> +					       BIT(NL802154_CCA_ENERGY_CARRIER);
> +	devrec->hw->phy->supported.cca_opts = BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND);

We set "NL802154_CCA_OPT_ENERGY_CARRIER_AND" here, I was not sure about
that and had "NL802154_CCA_OPT_ENERGY_CARRIER_OR" before.

I think it's "and" because there is a "and" in the explanation and no
"or".

"CCA Mode 3: Carrier sense with energy above threshold. CCA shall report
a busy medium only upon the detection of a signal with the modulation and
spreading characteristics of IEEE 802.15.4 with energy above the energy
Detection (ED) threshold."

I mean "...modulation and spreading...", otherwise I don't know if it's
or XOR and, but it must one of them.

- Alex

  parent reply	other threads:[~2015-08-27 17:49 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 12:22 [RFC bluetooth-next 00/21] mrf24j40: async rx/tx handling and new features Alexander Aring
2015-08-13 12:22 ` [RFC bluetooth-next 01/21] mrf24j40: cleanup define identation Alexander Aring
2015-08-27 12:59   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 02/21] mrf24j40: use ieee802154_alloc_hw for private data Alexander Aring
2015-08-27 13:03   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 03/21] mrf24j40: calling ieee802154_register_hw at last Alexander Aring
2015-08-27 13:06   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 04/21] mrf24j40: remove spi settings overwrite Alexander Aring
2015-08-27 13:14   ` Stefan Schmidt
2015-08-28  7:50     ` Alexander Aring
2015-08-28  7:58       ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 05/21] mrf24j40: add device-tree support Alexander Aring
2015-08-27 13:16   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 06/21] mrf24j40: add default channel setting Alexander Aring
2015-08-27 13:24   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 07/21] mrf24j40: add random extended addr generation Alexander Aring
2015-08-27 13:25   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 08/21] mrf24j40: add more register defines Alexander Aring
2015-08-27 13:28   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 09/21] mrf24j40: add regmap support Alexander Aring
2015-08-27 17:45   ` Alexander Aring
2015-08-28  8:37   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 10/21] mrf24j40: use regmap for register access Alexander Aring
2015-08-28  8:43   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 11/21] mrf24j40: change to frame delivery with crc Alexander Aring
2015-08-27 13:30   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 12/21] ieee802154: add helpers for frame control checks Alexander Aring
2015-08-13 12:22 ` [RFC bluetooth-next 13/21] mrf24j40: rework tx handling to async tx handling Alexander Aring
2015-08-28  8:50   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 14/21] mrf24j40: rework rx handling to async rx handling Alexander Aring
2015-08-28  8:55   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 15/21] mrf24j40: async interrupt handling Alexander Aring
2015-08-28  8:57   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 16/21] mrf24j40: add csma params support Alexander Aring
2015-08-27 13:46   ` Stefan Schmidt
2015-08-28  7:53     ` Alexander Aring
2015-08-13 12:22 ` [RFC bluetooth-next 17/21] mrf24j40: add cca mode support Alexander Aring
2015-08-27 13:50   ` Stefan Schmidt
2015-08-27 17:49   ` Alexander Aring [this message]
2015-08-13 12:22 ` [RFC bluetooth-next 18/21] mrf24j40: add cca ed level support Alexander Aring
2015-08-27 13:52   ` Stefan Schmidt
2015-08-27 17:44   ` Alexander Aring
2015-08-13 12:22 ` [RFC bluetooth-next 19/21] mrf24j40: add tx power support Alexander Aring
2015-08-27 13:59   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 20/21] mrf24j40: add promiscuous mode support Alexander Aring
2015-08-27 14:00   ` Stefan Schmidt
2015-08-13 12:22 ` [RFC bluetooth-next 21/21] mrf24j40: change irq trigger type behaviour Alexander Aring
2015-08-28  8:28   ` Stefan Schmidt
2015-08-18 13:54 ` [RFC bluetooth-next 00/21] mrf24j40: async rx/tx handling and new features Alan Ott
2015-08-27 12:29 ` Stefan Schmidt
2015-08-27 12:33   ` Alan Ott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150827174912.GC686@omega \
    --to=alex.aring@gmail.com \
    --cc=alan@signal11.us \
    --cc=jonatan@myeden.se \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).