1. 08 7月, 2014 10 次提交
    • A
      09e536cd
    • A
      at86rf230: rework state change and start/stop · 2e0571c0
      Alexander Aring 提交于
      This patch removes the current synchron state change function and add a
      new function for a state assert. Change the start and stop callbacks to
      use this new synchron state change behaviour. It's a wrapper around the
      async state change function.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2e0571c0
    • A
      at86rf230: rework irq_pol setting · 1db0558e
      Alexander Aring 提交于
      This patch rework the irq_pol register setting for rising and falling
      interrupt settings only. The default behaviour should be rising flag.
      
      Also use IRQ_TYPE_* defines instead of IRQF_* defines. There is no
      functionality change but irq_get_trigger_type returns IRQ_TYPE_* defines.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1db0558e
    • A
      at86rf230: move RX_SAFE_MODE setting to hw_init · 6bd2b132
      Alexander Aring 提交于
      There is no need to set this bit in start callback which could be
      called more than once.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6bd2b132
    • A
      at86rf230: rework transmit and receive handling · 1d15d6b5
      Alexander Aring 提交于
      This patch is a complete reimplementation of transmit and receive
      handling for the at86rf230 driver.
      
      It solves also six bugs:
      
      First:
      
      The RX_SAFE_MODE is enabled and the transceiver doesn't leave the
      receive state while the framebuffer isn't read by a CMD_FB command.
      This is useful to read out the frame and don't get into another receive
      or transmit state, otherwise the frame would be overwritten.
      The current driver do twice CMD_FB calls, the first one leaves this
      protection.
      
      Second:
      
      Sometimes the CRC calculation is correct and the length field is greater
      127. The current mac802154 layer and filter of a at86rf2xx doesn't check
      on this and the kernel crashes. In this case the frame is corrupted, we
      send the whole receive buffer to the next layer which can be useful for
      sniffing.
      
      Thrid:
      There is a undocumented race condition. When we are go into the
      RX_AACK_ON state the transceiver could be changed into RX_AACK_BUSY
      state. This is a normal behaviour. In this case the transceiver received
      a SHR while assert wasn't finished.
      
      Fourth:
      It also handle some more "correct" state changes. In aret mode the
      transceiver need to go to TX_ON before the transceiver go into
      RX_AACK_ON.
      
      Fifth:
      The programming model [0] describes also a error handling in ARET mode
      if the trac status is different than zero. This is patch adds support
      for handling this.
      
      Sixth:
      In receive handling the transceiver should also get the trac status
      according [0]. The driver could use the trac status as error statistic
      handling, but the driver doesn't use this currently. There is maybe some
      timing behaviour or the read of this register change some transceiver
      states.
      
      In addition the irqworker is removed. Instead we do async spi calls and
      no scheduling is involved anymore. The transmit function is also
      asynchron but with a wait_for_completion handling. The mac802154 layer
      doesn't support asynchron transmit handling right now.
      
      The state change behaviour is now changes, before it was:
      
      1. assert while(!STATE_TRANSITION_IN_PROGRESS)
      2. state change
      3. assert while(!STATE_TRANSITION_IN_PROGRESS)
      4. assert once(wanted state != current state)
      
      Sometimes a unexcepted state change occurs when 4. assert was violated.
      The new state change behaviour is:
      
      1. assert while(!STATE_TRANSITION_IN_PROGRESS)
      2. state change
      3. wait state change timing according datasheet
      4. assert once(wanted state != current state)
      
      This behaviour is described in the at86rf231 software programming model [0].
      The state change documentation in this programming guide should also valid for
      at86rf212 and at86rf233 chips.
      
      The transceiver don't do a FORCE_TX_ON while we want to transmit a PDU.
      The new behaviour is a TX_ON and wait a receiving time (tFrame + tPAck).
      If we are still in RX_AACK_BUSY then we transmit a FORCE_TX_ON as timeout
      handling. The different is that FORCE_TX_ON aborts receiving and TX_ON
      waits if RX_AACK_BUSY is finished. This should decrease the drop rate of
      packets.
      
      [0] http://www.atmel.com/Images/AVR2022_swpm231-2.0.zipSigned-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1d15d6b5
    • A
      at86rf230: add support for at86rf23x desense · a7d7eda9
      Alexander Aring 提交于
      To set the CCA_ED_THRES register the calculation for at86rf23x is
      different than for at86rf212. This patch adds a new callback for this
      calculation in chip data struct.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a7d7eda9
    • A
      at86rf230: remove is212 and add driver data · a53d1f7c
      Alexander Aring 提交于
      This patch adds a new at86rf2xx_chip_data structure which holds device
      specific attributes. Instead of runtime decisions "if (is212())" we set
      callbacks/attributes while device detection.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a53d1f7c
    • A
      at86rf230: rework detect device handling · c8ee0f56
      Alexander Aring 提交于
      This patch drops the current lowlevel spi calls for the detect device
      function instead we handle this via regmap. Also put the detection of
      in a seperate function and set all device specific attributes while detection.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8ee0f56
    • A
      at86rf230: add regmap support · f76014f7
      Alexander Aring 提交于
      This patch adds regmap support for the at86rf230 driver and drop the
      lowlevel spi access functions and use the regmap access functions.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f76014f7
    • A
      mac802154: at86rf230: add hw flags and merge ops · 640985ec
      Alexander Aring 提交于
      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: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      640985ec
  2. 23 6月, 2014 1 次提交
  3. 27 4月, 2014 13 次提交
  4. 15 4月, 2014 2 次提交
  5. 08 4月, 2014 1 次提交
  6. 01 4月, 2014 1 次提交
    • A
      at86rf230: mask irq's before deregister device · 17e84a92
      Alexander Aring 提交于
      While transmit over a at86rf231 device and unloading the module I got:
      
      [   29.643073] WARNING: CPU: 0 PID: 3 at kernel/workqueue.c:1335 __queue_work+0xb4/0x224()
      [   29.651457] Modules linked in: at86rf230(-) autofs4
      [   29.656612] CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G        W    3.14.0-rc6-01602-g902659e-dirty #294
      [   29.666490] [<c00124f0>] (unwind_backtrace) from [<c0010ad0>] (show_stack+0x10/0x14)
      [   29.674628] [<c0010ad0>] (show_stack) from [<c0032c80>] (warn_slowpath_common+0x60/0x80)
      [   29.683116] [<c0032c80>] (warn_slowpath_common) from [<c0032d30>] (warn_slowpath_null+0x18/0x20)
      [   29.692329] [<c0032d30>] (warn_slowpath_null) from [<c0045b08>] (__queue_work+0xb4/0x224)
      [   29.700906] [<c0045b08>] (__queue_work) from [<c0045cc8>] (queue_work_on+0x50/0x78)
      [   29.708944] [<c0045cc8>] (queue_work_on) from [<c05669cc>] (mac802154_tx+0x1e4/0x240)
      [   29.717164] [<c05669cc>] (mac802154_tx) from [<c0471814>] (dev_hard_start_xmit+0x2f0/0x43c)
      [   29.725926] [<c0471814>] (dev_hard_start_xmit) from [<c04878d0>] (sch_direct_xmit+0x64/0x2a0)
      [   29.734867] [<c04878d0>] (sch_direct_xmit) from [<c0487c38>] (__qdisc_run+0x12c/0x18c)
      [   29.743169] [<c0487c38>] (__qdisc_run) from [<c046e1b0>] (net_tx_action+0xe0/0x178)
      [   29.751205] [<c046e1b0>] (net_tx_action) from [<c0036690>] (__do_softirq+0x100/0x264)
      [   29.759420] [<c0036690>] (__do_softirq) from [<c0036818>] (run_ksoftirqd+0x24/0x4c)
      [   29.767453] [<c0036818>] (run_ksoftirqd) from [<c005232c>] (smpboot_thread_fn+0x128/0x13c)
      [   29.776121] [<c005232c>] (smpboot_thread_fn) from [<c004c3fc>] (kthread+0xd0/0xe4)
      [   29.784061] [<c004c3fc>] (kthread) from [<c000da88>] (ret_from_fork+0x14/0x2c)
      [   29.791628] ---[ end trace 3406ff24bd973834 ]---
      
      The problem is there are still interrupts after deregister ieee802154
      device. This patch mask all interrupts in the at86rf2xx chips before
      deregister the device.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      17e84a92
  7. 18 3月, 2014 5 次提交
    • A
      at86rf230: add support for devicetree · fa2d3e94
      Alexander Aring 提交于
      This patch adds devicetree support for the at86rf230 driver.
      
      Possible gpios to configure are "reset-gpio" and "sleep-gpio".
      Also add support to configure the "irq-type" for the irq polarity
      register.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa2d3e94
    • A
      at86rf230: make reset pin optionally · 3fa27571
      Alexander Aring 提交于
      This patch make the reset pin optionally. Some devices like the atben
      from qi-hardware don't have a reset pin externally. The usually way is
      to turn power off/on for the atben device to initiate a device reset.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3fa27571
    • A
      at86rf230: change reset timings · 56f023fb
      Alexander Aring 提交于
      While checkpatch another patch I got a:
      
      "WARNING: msleep < 20ms can sleep for up to 20ms"
      
      The datasheet of at86rf231 and at86rf212 says a minimum delay for reset
      pulse width and spi access latency after reset is 625 nanoseconds.
      
      This patch removes the 1 milliseconds sleep and replace it with a 1
      microseconds udelay which should be also okay for the reset pulse width.
      
      To change the state from RESET -> TRX_OFF the at86rf230 device needs 120
      microseconds, this is a worst case of all at86rf* chips.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56f023fb
    • A
      at86rf230: move locking state in xmit · 7e814618
      Alexander Aring 提交于
      There is no need to lock the clearing of IRQ_TRX_END in status.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e814618
    • A
      at86rf230: fix unexpected state change · 7332fcb8
      Alexander Aring 提交于
      This patch fix a unexpected state change for the at86rf231 chip.
      We can't change into STATE_FORCE_TX_ON while the chip is in one of
      SLEEP, P_ON, RESET, TRX_OFF, and all *_NOCLK states.
      
      In this case we are in the TRX_OFF state. See datasheet [1] page 71 for
      more information.
      
      Without this patch you will get the following message on a at86rf231 device:
      
      [   20.065218] unexpected state change: 8, asked for 4
      [   20.070527] ------------[ cut here ]------------
      [   20.075414] WARNING: CPU: 0 PID: 160 at net/mac802154/ieee802154_dev.c:43 mac802154_slave_open+0x70/0xb8()
      [   20.085594] Modules linked in: autofs4
      [   20.089667] CPU: 0 PID: 160 Comm: ifconfig Not tainted 3.14.0-20140108-1-00993-g905c192 #162
      [   20.098612] [<c00127b8>] (unwind_backtrace) from [<c0010b1c>] (show_stack+0x10/0x14)
      [   20.106819] [<c0010b1c>] (show_stack) from [<c0033838>] (warn_slowpath_common+0x60/0x80)
      [   20.115311] [<c0033838>] (warn_slowpath_common) from [<c00338e8>] (warn_slowpath_null+0x18/0x20)
      [   20.124590] [<c00338e8>] (warn_slowpath_null) from [<c057b7e8>] (mac802154_slave_open+0x70/0xb8)
      [   20.133880] [<c057b7e8>] (mac802154_slave_open) from [<c0488a58>] (__dev_open+0xa8/0x108)
      [   20.142553] [<c0488a58>] (__dev_open) from [<c0488cb0>] (__dev_change_flags+0x8c/0x148)
      [   20.151051] [<c0488cb0>] (__dev_change_flags) from [<c0488d84>] (dev_change_flags+0x18/0x48)
      [   20.159968] [<c0488d84>] (dev_change_flags) from [<c04e2e9c>] (devinet_ioctl+0x2b0/0x63c)
      [   20.168623] [<c04e2e9c>] (devinet_ioctl) from [<c04712e4>] (sock_ioctl+0x23c/0x29c)
      [   20.176727] [<c04712e4>] (sock_ioctl) from [<c00e3cb8>] (do_vfs_ioctl+0x4a8/0x578)
      [   20.184671] [<c00e3cb8>] (do_vfs_ioctl) from [<c00e3dd4>] (SyS_ioctl+0x4c/0x78)
      [   20.192402] [<c00e3dd4>] (SyS_ioctl) from [<c000da00>] (ret_fast_syscall+0x0/0x48)
      [   20.200392] ---[ end trace 9a34542f4ea08e47 ]---
      
      This patch was tested on at86rf231 and at86rf212.
      
      [1] http://www.atmel.com/images/doc8111.pdfSigned-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7332fcb8
  8. 15 3月, 2014 1 次提交
  9. 14 3月, 2014 1 次提交
    • A
      at86rf230: fix lockdep splats · 6e07a1e0
      Alexander Aring 提交于
      This patch fix a lockdep in the at86rf230 driver, otherwise we get:
      
      [   30.206517] =================================
      [   30.211078] [ INFO: inconsistent lock state ]
      [   30.215647] 3.14.0-20140108-1-00994-g32e9426 #163 Not tainted
      [   30.221660] ---------------------------------
      [   30.226222] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
      [   30.232514] systemd-udevd/157 [HC1[1]:SC0[0]:HE0:SE1] takes:
      [   30.238439]  (&(&lp->lock)->rlock){?.+...}, at: [<c03600f8>] at86rf230_isr+0x18/0x44
      [   30.246621] {HARDIRQ-ON-W} state was registered at:
      [   30.251728]   [<c0061ce4>] __lock_acquire+0x7a4/0x18d8
      [   30.257135]   [<c0063500>] lock_acquire+0x68/0x7c
      [   30.262071]   [<c0588820>] _raw_spin_lock+0x28/0x38
      [   30.267203]   [<c0361240>] at86rf230_xmit+0x1c/0x144
      [   30.272412]   [<c057ba6c>] mac802154_xmit_worker+0x88/0x148
      [   30.278271]   [<c0047844>] process_one_work+0x274/0x404
      [   30.283761]   [<c00484c0>] worker_thread+0x228/0x374
      [   30.288971]   [<c004cfb8>] kthread+0xd0/0xe4
      [   30.293455]   [<c000dac8>] ret_from_fork+0x14/0x2c
      [   30.298493] irq event stamp: 8948
      [   30.301963] hardirqs last  enabled at (8947): [<c00cb290>] __kmalloc+0xb4/0x110
      [   30.309636] hardirqs last disabled at (8948): [<c00115d4>] __irq_svc+0x34/0x5c
      [   30.317215] softirqs last  enabled at (8452): [<c0037324>] __do_softirq+0x1dc/0x264
      [   30.325243] softirqs last disabled at (8439): [<c0037638>] irq_exit+0x80/0xf4
      
      We use the lp->lock inside the isr of at86rf230, that's why we need the
      irqsave spinlock calls.
      Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6e07a1e0
  10. 12 3月, 2014 1 次提交
  11. 04 3月, 2014 1 次提交
    • J
      ieee802154: fix at86rf212_set_txpower() exit path · 677676cd
      Jean Sacren 提交于
      The commit 9b2777d6 ("ieee802154: add TX power control to
      wpan_phy") introduced the new function at86rf212_set_txpower() with
      the questionable check of the return of __at86rf230_write() in the
      exit path:
      
      1) Both at86rf212_set_txpower() and __at86rf230_write() have the
         same return type.
      
      2) Whatever __at86rf230_write() returns becomes the return value of
         at86rf212_set_txpower().
      
      Thus, fix the exit path by getting rid of that check entirely.
      Signed-off-by: NJean Sacren <sakiwit@gmail.com>
      Cc: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      677676cd
  12. 27 2月, 2014 1 次提交
    • J
      ieee802154: fix new function declaration · 44a6bd86
      Jean Sacren 提交于
      The commit 8fad346f ("eee802154: add basic support for RF212 to
      at86rf230 driver") introduced the new function is_rf212() with some
      minor issues in declaration:
      
      1) Fix the function type by changing it to bool as the function
         definition returns a boolean value. Additionally both callers of
         is_rf212() are expected to return a boolean value.
      
      2) Fix the function specifier by deleting the inline keyword as the
         compiler takes care of that.
      Signed-off-by: NJean Sacren <sakiwit@gmail.com>
      Cc: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      44a6bd86
  13. 18 2月, 2014 2 次提交