Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72f655e4 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann
Browse files

ieee802154: introduce wpan_phy_supported



This patch introduce the wpan_phy_supported struct for wpan_phy. There
is currently no way to check if a transceiver can handle IEEE 802.15.4
complaint values. With this struct we can check before if the
transceiver supports these values before sending to driver layer.

Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Suggested-by: default avatarPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Acked-by: default avatarVarka Bhadram <varkabhadram@gmail.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 32b23550
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1579,7 +1579,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
	case 3:
	case 3:
		chip = "at86rf231";
		chip = "at86rf231";
		lp->data = &at86rf231_data;
		lp->data = &at86rf231_data;
		lp->hw->phy->channels_supported[0] = 0x7FFF800;
		lp->hw->phy->supported.channels[0] = 0x7FFF800;
		lp->hw->phy->current_channel = 11;
		lp->hw->phy->current_channel = 11;
		lp->hw->phy->symbol_duration = 16;
		lp->hw->phy->symbol_duration = 16;
		break;
		break;
@@ -1587,15 +1587,15 @@ at86rf230_detect_device(struct at86rf230_local *lp)
		chip = "at86rf212";
		chip = "at86rf212";
		lp->data = &at86rf212_data;
		lp->data = &at86rf212_data;
		lp->hw->flags |= IEEE802154_HW_LBT;
		lp->hw->flags |= IEEE802154_HW_LBT;
		lp->hw->phy->channels_supported[0] = 0x00007FF;
		lp->hw->phy->supported.channels[0] = 0x00007FF;
		lp->hw->phy->channels_supported[2] = 0x00007FF;
		lp->hw->phy->supported.channels[2] = 0x00007FF;
		lp->hw->phy->current_channel = 5;
		lp->hw->phy->current_channel = 5;
		lp->hw->phy->symbol_duration = 25;
		lp->hw->phy->symbol_duration = 25;
		break;
		break;
	case 11:
	case 11:
		chip = "at86rf233";
		chip = "at86rf233";
		lp->data = &at86rf233_data;
		lp->data = &at86rf233_data;
		lp->hw->phy->channels_supported[0] = 0x7FFF800;
		lp->hw->phy->supported.channels[0] = 0x7FFF800;
		lp->hw->phy->current_channel = 13;
		lp->hw->phy->current_channel = 13;
		lp->hw->phy->symbol_duration = 16;
		lp->hw->phy->symbol_duration = 16;
		break;
		break;
+1 −1
Original line number Original line Diff line number Diff line
@@ -653,7 +653,7 @@ static int cc2520_register(struct cc2520_private *priv)
	ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);
	ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);


	/* We do support only 2.4 Ghz */
	/* We do support only 2.4 Ghz */
	priv->hw->phy->channels_supported[0] = 0x7FFF800;
	priv->hw->phy->supported.channels[0] = 0x7FFF800;
	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
	priv->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
			  IEEE802154_HW_AFILT;
			  IEEE802154_HW_AFILT;


+15 −15
Original line number Original line Diff line number Diff line
@@ -149,35 +149,35 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake)
	priv->hw = hw;
	priv->hw = hw;


	/* 868 MHz BPSK	802.15.4-2003 */
	/* 868 MHz BPSK	802.15.4-2003 */
	hw->phy->channels_supported[0] |= 1;
	hw->phy->supported.channels[0] |= 1;
	/* 915 MHz BPSK	802.15.4-2003 */
	/* 915 MHz BPSK	802.15.4-2003 */
	hw->phy->channels_supported[0] |= 0x7fe;
	hw->phy->supported.channels[0] |= 0x7fe;
	/* 2.4 GHz O-QPSK 802.15.4-2003 */
	/* 2.4 GHz O-QPSK 802.15.4-2003 */
	hw->phy->channels_supported[0] |= 0x7FFF800;
	hw->phy->supported.channels[0] |= 0x7FFF800;
	/* 868 MHz ASK 802.15.4-2006 */
	/* 868 MHz ASK 802.15.4-2006 */
	hw->phy->channels_supported[1] |= 1;
	hw->phy->supported.channels[1] |= 1;
	/* 915 MHz ASK 802.15.4-2006 */
	/* 915 MHz ASK 802.15.4-2006 */
	hw->phy->channels_supported[1] |= 0x7fe;
	hw->phy->supported.channels[1] |= 0x7fe;
	/* 868 MHz O-QPSK 802.15.4-2006 */
	/* 868 MHz O-QPSK 802.15.4-2006 */
	hw->phy->channels_supported[2] |= 1;
	hw->phy->supported.channels[2] |= 1;
	/* 915 MHz O-QPSK 802.15.4-2006 */
	/* 915 MHz O-QPSK 802.15.4-2006 */
	hw->phy->channels_supported[2] |= 0x7fe;
	hw->phy->supported.channels[2] |= 0x7fe;
	/* 2.4 GHz CSS 802.15.4a-2007 */
	/* 2.4 GHz CSS 802.15.4a-2007 */
	hw->phy->channels_supported[3] |= 0x3fff;
	hw->phy->supported.channels[3] |= 0x3fff;
	/* UWB Sub-gigahertz 802.15.4a-2007 */
	/* UWB Sub-gigahertz 802.15.4a-2007 */
	hw->phy->channels_supported[4] |= 1;
	hw->phy->supported.channels[4] |= 1;
	/* UWB Low band 802.15.4a-2007 */
	/* UWB Low band 802.15.4a-2007 */
	hw->phy->channels_supported[4] |= 0x1e;
	hw->phy->supported.channels[4] |= 0x1e;
	/* UWB High band 802.15.4a-2007 */
	/* UWB High band 802.15.4a-2007 */
	hw->phy->channels_supported[4] |= 0xffe0;
	hw->phy->supported.channels[4] |= 0xffe0;
	/* 750 MHz O-QPSK 802.15.4c-2009 */
	/* 750 MHz O-QPSK 802.15.4c-2009 */
	hw->phy->channels_supported[5] |= 0xf;
	hw->phy->supported.channels[5] |= 0xf;
	/* 750 MHz MPSK 802.15.4c-2009 */
	/* 750 MHz MPSK 802.15.4c-2009 */
	hw->phy->channels_supported[5] |= 0xf0;
	hw->phy->supported.channels[5] |= 0xf0;
	/* 950 MHz BPSK 802.15.4d-2009 */
	/* 950 MHz BPSK 802.15.4d-2009 */
	hw->phy->channels_supported[6] |= 0x3ff;
	hw->phy->supported.channels[6] |= 0x3ff;
	/* 950 MHz GFSK 802.15.4d-2009 */
	/* 950 MHz GFSK 802.15.4d-2009 */
	hw->phy->channels_supported[6] |= 0x3ffc00;
	hw->phy->supported.channels[6] |= 0x3ffc00;


	INIT_LIST_HEAD(&priv->list);
	INIT_LIST_HEAD(&priv->list);
	priv->fake = fake;
	priv->fake = fake;
+1 −1
Original line number Original line Diff line number Diff line
@@ -750,7 +750,7 @@ static int mrf24j40_probe(struct spi_device *spi)


	devrec->hw->priv = devrec;
	devrec->hw->priv = devrec;
	devrec->hw->parent = &devrec->spi->dev;
	devrec->hw->parent = &devrec->spi->dev;
	devrec->hw->phy->channels_supported[0] = CHANNEL_MASK;
	devrec->hw->phy->supported.channels[0] = CHANNEL_MASK;
	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
	devrec->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
			    IEEE802154_HW_AFILT;
			    IEEE802154_HW_AFILT;


+5 −1
Original line number Original line Diff line number Diff line
@@ -61,6 +61,10 @@ struct cfg802154_ops {
				struct wpan_dev *wpan_dev, bool mode);
				struct wpan_dev *wpan_dev, bool mode);
};
};


struct wpan_phy_supported {
	u32 channels[IEEE802154_MAX_PAGE + 1];
};

struct wpan_phy_cca {
struct wpan_phy_cca {
	enum nl802154_cca_modes mode;
	enum nl802154_cca_modes mode;
	enum nl802154_cca_opts opt;
	enum nl802154_cca_opts opt;
@@ -84,7 +88,7 @@ struct wpan_phy {
	 */
	 */
	u8 current_channel;
	u8 current_channel;
	u8 current_page;
	u8 current_page;
	u32 channels_supported[IEEE802154_MAX_PAGE + 1];
	struct wpan_phy_supported supported;
	/* current transmit_power in mBm */
	/* current transmit_power in mBm */
	s32 transmit_power;
	s32 transmit_power;
	struct wpan_phy_cca cca;
	struct wpan_phy_cca cca;
Loading