]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
at86rf230: add recommended csma backoffs settings
authorAlexander Aring <alex.aring@gmail.com>
Tue, 16 Jun 2015 09:07:43 +0000 (11:07 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 16 Jun 2015 16:55:11 +0000 (18:55 +0200)
This patch adds support for a new random csma backoffs settings when
going into sleep state. This is recommended according at86rf2xx
datasheets.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/net/ieee802154/at86rf230.c

index b839bbd4ff696cb6d1eae7d481c9f51e20713e03..7e30a45718c9f2e1a5ebdc86b2d0e025ed919cb3 100644 (file)
@@ -945,10 +945,21 @@ static void
 at86rf230_stop(struct ieee802154_hw *hw)
 {
        struct at86rf230_local *lp = hw->priv;
+       u8 csma_seed[2];
 
        at86rf230_sync_state_change(hw->priv, STATE_FORCE_TRX_OFF);
 
        disable_irq(lp->spi->irq);
+
+       /* It's recommended to set random new csma_seeds before sleep state.
+        * Makes only sense in the stop callback, not doing this inside of
+        * at86rf230_sleep, this is also used when we don't transmit afterwards
+        * when calling start callback again.
+        */
+       get_random_bytes(csma_seed, ARRAY_SIZE(csma_seed));
+       at86rf230_write_subreg(lp, SR_CSMA_SEED_0, csma_seed[0]);
+       at86rf230_write_subreg(lp, SR_CSMA_SEED_1, csma_seed[1]);
+
        at86rf230_sleep(lp);
 }