aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-07-02 18:20:43 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 00:29:24 -0400
commit640985ec2ffd2a81f34dc5004f0951d2c6cb3d5e (patch)
tree6dc4ea00259a32766483c436aabe2a581bdee1e7 /net/mac802154
parent1598c36afdd472560c1111cce473f8f88c747f14 (diff)
mac802154: at86rf230: add hw flags and merge ops
This patch adds new mac802154 hw flags for transmit power, csma and listen before transmit (lbt). These flags indicates that the transceiver supports these features. If the flags are set and the driver doesn't implement the necessary functions, then ieee802154_register_device returns -ENOSYS "Function not implemented". This patch merges also all at86rf230 operations into one operations structure and set the right hw flags for the at86rf230 transceivers. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/ieee802154_dev.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c
index c4d4568611ca..9b54370f5e87 100644
--- a/net/mac802154/ieee802154_dev.c
+++ b/net/mac802154/ieee802154_dev.c
@@ -304,29 +304,61 @@ EXPORT_SYMBOL(ieee802154_free_device);
304int ieee802154_register_device(struct ieee802154_dev *dev) 304int ieee802154_register_device(struct ieee802154_dev *dev)
305{ 305{
306 struct mac802154_priv *priv = mac802154_to_priv(dev); 306 struct mac802154_priv *priv = mac802154_to_priv(dev);
307 int rc = -ENOMEM; 307 int rc = -ENOSYS;
308
309 if (dev->flags & IEEE802154_HW_TXPOWER) {
310 if (!priv->ops->set_txpower)
311 goto out;
312
313 priv->phy->set_txpower = mac802154_set_txpower;
314 }
315
316 if (dev->flags & IEEE802154_HW_LBT) {
317 if (!priv->ops->set_lbt)
318 goto out;
319
320 priv->phy->set_lbt = mac802154_set_lbt;
321 }
322
323 if (dev->flags & IEEE802154_HW_CCA_MODE) {
324 if (!priv->ops->set_cca_mode)
325 goto out;
326
327 priv->phy->set_cca_mode = mac802154_set_cca_mode;
328 }
329
330 if (dev->flags & IEEE802154_HW_CCA_ED_LEVEL) {
331 if (!priv->ops->set_cca_ed_level)
332 goto out;
333
334 priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
335 }
336
337 if (dev->flags & IEEE802154_HW_CSMA_PARAMS) {
338 if (!priv->ops->set_csma_params)
339 goto out;
340
341 priv->phy->set_csma_params = mac802154_set_csma_params;
342 }
343
344 if (dev->flags & IEEE802154_HW_FRAME_RETRIES) {
345 if (!priv->ops->set_frame_retries)
346 goto out;
347
348 priv->phy->set_frame_retries = mac802154_set_frame_retries;
349 }
308 350
309 priv->dev_workqueue = 351 priv->dev_workqueue =
310 create_singlethread_workqueue(wpan_phy_name(priv->phy)); 352 create_singlethread_workqueue(wpan_phy_name(priv->phy));
311 if (!priv->dev_workqueue) 353 if (!priv->dev_workqueue) {
354 rc = -ENOMEM;
312 goto out; 355 goto out;
356 }
313 357
314 wpan_phy_set_dev(priv->phy, priv->hw.parent); 358 wpan_phy_set_dev(priv->phy, priv->hw.parent);
315 359
316 priv->phy->add_iface = mac802154_add_iface; 360 priv->phy->add_iface = mac802154_add_iface;
317 priv->phy->del_iface = mac802154_del_iface; 361 priv->phy->del_iface = mac802154_del_iface;
318 if (priv->ops->set_txpower)
319 priv->phy->set_txpower = mac802154_set_txpower;
320 if (priv->ops->set_lbt)
321 priv->phy->set_lbt = mac802154_set_lbt;
322 if (priv->ops->set_cca_mode)
323 priv->phy->set_cca_mode = mac802154_set_cca_mode;
324 if (priv->ops->set_cca_ed_level)
325 priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
326 if (priv->ops->set_csma_params)
327 priv->phy->set_csma_params = mac802154_set_csma_params;
328 if (priv->ops->set_frame_retries)
329 priv->phy->set_frame_retries = mac802154_set_frame_retries;
330 362
331 rc = wpan_phy_register(priv->phy); 363 rc = wpan_phy_register(priv->phy);
332 if (rc < 0) 364 if (rc < 0)