Skip to content

Commit

Permalink
ieee802154: ensure that first RF212 state comes from TRX_OFF
Browse files Browse the repository at this point in the history
A documented erratum of the RF212 chip describes that some versions of
RF212 may not be properly reset by the standard reset procedure. The
described workaround seems to not fully work either; my RF212 chips will
not correctly receive any frames unless they are taken from RX mode to
TRX_OFF and back to RX mode, effectively forcing a up-down-up-cycle.
Going to TRX_OFF and to RX without intermediate state changes at least
once fixes this.

The same transition is allowed for RF230, so simply do it all the time.

Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Phoebe Buckheister authored and David S. Miller committed Feb 17, 2014
1 parent 6ca0019 commit 7dcbd22
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions drivers/net/ieee802154/at86rf230.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,18 +926,9 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
if (rc)
return rc;

dev_info(&lp->spi->dev, "Status: %02x\n", status);
if (status == STATE_P_ON) {
rc = at86rf230_write_subreg(lp, SR_TRX_CMD,
STATE_FORCE_TRX_OFF);
if (rc)
return rc;
msleep(1);
rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &status);
if (rc)
return rc;
dev_info(&lp->spi->dev, "Status: %02x\n", status);
}
rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_FORCE_TRX_OFF);
if (rc)
return rc;

/* configure irq polarity, defaults to high active */
if (pdata->irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
Expand Down Expand Up @@ -965,16 +956,6 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
/* Wait the next SLEEP cycle */
msleep(100);

rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_TX_ON);
if (rc)
return rc;
msleep(1);

rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &status);
if (rc)
return rc;
dev_info(&lp->spi->dev, "Status: %02x\n", status);

rc = at86rf230_read_subreg(lp, SR_DVDD_OK, &status);
if (rc)
return rc;
Expand Down

0 comments on commit 7dcbd22

Please sign in to comment.