diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-04-30 11:45:03 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-04-30 12:48:11 -0400 |
commit | d2c8bf51d07729ae6887fa84947b1f825b3729e1 (patch) | |
tree | e59017cd122a4c03e680affb1e434b38bb4fc916 /drivers/net/ieee802154/at86rf230.c | |
parent | 8500920317813ed420311d9cf16c345fc216fb86 (diff) |
at86rf230: add slp_tr support to start tx
This patch adds support for one of the slp_tr gpio use cases which
indicates the TX_START command without doing some spi bus traffic.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net/ieee802154/at86rf230.c')
-rw-r--r-- | drivers/net/ieee802154/at86rf230.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 05ef56d5a710..67d00fbc2e0e 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -85,6 +85,7 @@ struct at86rf230_local { | |||
85 | struct ieee802154_hw *hw; | 85 | struct ieee802154_hw *hw; |
86 | struct at86rf2xx_chip_data *data; | 86 | struct at86rf2xx_chip_data *data; |
87 | struct regmap *regmap; | 87 | struct regmap *regmap; |
88 | int slp_tr; | ||
88 | 89 | ||
89 | struct completion state_complete; | 90 | struct completion state_complete; |
90 | struct at86rf230_state_change state; | 91 | struct at86rf230_state_change state; |
@@ -339,6 +340,14 @@ at86rf230_write_subreg(struct at86rf230_local *lp, | |||
339 | return regmap_update_bits(lp->regmap, addr, mask, data << shift); | 340 | return regmap_update_bits(lp->regmap, addr, mask, data << shift); |
340 | } | 341 | } |
341 | 342 | ||
343 | static inline void | ||
344 | at86rf230_slp_tr_rising_edge(struct at86rf230_local *lp) | ||
345 | { | ||
346 | gpio_set_value(lp->slp_tr, 1); | ||
347 | udelay(1); | ||
348 | gpio_set_value(lp->slp_tr, 0); | ||
349 | } | ||
350 | |||
342 | static bool | 351 | static bool |
343 | at86rf230_reg_writeable(struct device *dev, unsigned int reg) | 352 | at86rf230_reg_writeable(struct device *dev, unsigned int reg) |
344 | { | 353 | { |
@@ -940,13 +949,18 @@ at86rf230_write_frame_complete(void *context) | |||
940 | u8 *buf = ctx->buf; | 949 | u8 *buf = ctx->buf; |
941 | int rc; | 950 | int rc; |
942 | 951 | ||
943 | buf[0] = (RG_TRX_STATE & CMD_REG_MASK) | CMD_REG | CMD_WRITE; | ||
944 | buf[1] = STATE_BUSY_TX; | ||
945 | ctx->trx.len = 2; | 952 | ctx->trx.len = 2; |
946 | ctx->msg.complete = NULL; | 953 | |
947 | rc = spi_async(lp->spi, &ctx->msg); | 954 | if (gpio_is_valid(lp->slp_tr)) { |
948 | if (rc) | 955 | at86rf230_slp_tr_rising_edge(lp); |
949 | at86rf230_async_error(lp, ctx, rc); | 956 | } else { |
957 | buf[0] = (RG_TRX_STATE & CMD_REG_MASK) | CMD_REG | CMD_WRITE; | ||
958 | buf[1] = STATE_BUSY_TX; | ||
959 | ctx->msg.complete = NULL; | ||
960 | rc = spi_async(lp->spi, &ctx->msg); | ||
961 | if (rc) | ||
962 | at86rf230_async_error(lp, ctx, rc); | ||
963 | } | ||
950 | } | 964 | } |
951 | 965 | ||
952 | static void | 966 | static void |
@@ -1680,6 +1694,7 @@ static int at86rf230_probe(struct spi_device *spi) | |||
1680 | lp = hw->priv; | 1694 | lp = hw->priv; |
1681 | lp->hw = hw; | 1695 | lp->hw = hw; |
1682 | lp->spi = spi; | 1696 | lp->spi = spi; |
1697 | lp->slp_tr = slp_tr; | ||
1683 | hw->parent = &spi->dev; | 1698 | hw->parent = &spi->dev; |
1684 | hw->vif_data_size = sizeof(*lp); | 1699 | hw->vif_data_size = sizeof(*lp); |
1685 | ieee802154_random_extended_addr(&hw->phy->perm_extended_addr); | 1700 | ieee802154_random_extended_addr(&hw->phy->perm_extended_addr); |