Since the AT86RF2xy chips are mostly compatible, this is only a small change. The at86rf230 driver already supports the RF212 in most places, only three small adjustments are required:
* force the initial state after P_ON to FORCE_TRX_OFF to work around a documented erratum * add a is_rf212 discriminator, used now to check which channel range is supported by the transceiver * channels_supported depends on the frequency of the transceiver, and thus is_rf212 Signed-off-by: Phoebe Buckheister <phoebe.buckheis...@itwm.fraunhofer.de> --- drivers/net/ieee802154/at86rf230.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index ab31544..57f94b6 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -55,6 +55,11 @@ struct at86rf230_local { bool is_tx; }; +static inline int is_rf212(struct at86rf230_local *local) +{ + return local->part == 7; +} + #define RG_TRX_STATUS (0x01) #define SR_TRX_STATUS 0x01, 0x1f, 0 #define SR_RESERVED_01_3 0x01, 0x20, 5 @@ -527,7 +532,9 @@ at86rf230_channel(struct ieee802154_dev *dev, int page, int channel) might_sleep(); - if (page != 0 || channel < 11 || channel > 26) { + if (page != 0 + || (!is_rf212(lp) && (channel < 11 || channel > 26)) + || (is_rf212(lp) && (channel < 0 || channel > 10))) { WARN_ON(1); return -EINVAL; } @@ -753,13 +760,14 @@ static int at86rf230_hw_init(struct at86rf230_local *lp) int rc, irq_pol; u8 status; + rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &status); 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_TRX_OFF); + rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_FORCE_TRX_OFF); if (rc) return rc; msleep(1); @@ -867,8 +875,6 @@ static int at86rf230_probe(struct spi_device *spi) dev->parent = &spi->dev; dev->extra_tx_headroom = 0; - /* We do support only 2.4 Ghz */ - dev->phy->channels_supported[0] = 0x7FFF800; dev->flags = IEEE802154_HW_OMIT_CKSUM; if (pdata->irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { @@ -946,11 +952,21 @@ static int at86rf230_probe(struct spi_device *spi) chip = "at86rf231"; supported = 1; break; + case 7: + chip = "at86rf212"; + supported = 1; + break; default: chip = "UNKNOWN"; break; } + if (is_rf212(lp)) { + dev->phy->channels_supported[0] = 0x00007FF; + } else { + dev->phy->channels_supported[0] = 0x7FFF800; + } + dev_info(&spi->dev, "Detected %s chip version %d\n", chip, lp->vers); if (!supported) { rc = -ENOTSUPP; -- 1.7.9.5 ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel