Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Walter Mack <wmack@componentsw.com>
To: linux-wpan@vger.kernel.org, wmack@componentsw.com
Cc: alan@signal11.us
Subject: [PATCH wpan-next] ieee802154: mrf24j40: support for external rx/tx
Date: Sun, 14 Sep 2014 22:35:38 -0700	[thread overview]
Message-ID: <1410759338-21663-1-git-send-email-wmack@componentsw.com> (raw)

The MRF24j40 device supports the use of external receivers/transmitters.
Microchip literature refers to them as LNA and PA respectively.
However, if external receivers/transmitters are present, register
"TESTMODE" has to be programmed with value 0f.
This patch adds a boolean module parameter ext_rx_tx. Setting it to true
configures the driver to adjust the mrf24j40 operation to work
with external receivers/transmitters.

Microchip's MRF24J40MB module is one instance that has external PA/LNA.
Without this new module parameter, transmission between two of these
modules was limited to less than 5 feet. With the module parameter set,
the range increased to well above 100 feet.

Signed-off-by: Walter Mack <wmack@componentsw.com>
---
 drivers/net/ieee802154/mrf24j40.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 9e6a124..e9cb5c6 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -26,6 +26,10 @@
 #include <net/mac802154.h>
 #include <net/ieee802154.h>
 
+static bool ext_rx_tx;
+module_param(ext_rx_tx, bool, 0444);
+MODULE_PARM_DESC(ext_rx_tx, "turn on statemachine to manage external tx/rx");
+
 /* MRF24J40 Short Address Registers */
 #define REG_RXMCR    0x00  /* Receive MAC control */
 #define REG_PANIDL   0x01  /* PAN ID (low) */
@@ -63,6 +67,8 @@
 #define REG_SLPCON1    0x220
 #define REG_WAKETIMEL  0x222  /* Wake-up Time Match Value Low */
 #define REG_WAKETIMEH  0x223  /* Wake-up Time Match Value High */
+#define REG_TESTMODE   0x22f  /* test mode and state machine control register */
+
 #define REG_RX_FIFO    0x300  /* Receive FIFO */
 
 /* Device configuration: Only channels 11-26 on page 0 are supported. */
@@ -679,6 +685,12 @@ static int mrf24j40_hw_init(struct mrf24j40 *devrec)
 
 	udelay(192);
 
+	if (ext_rx_tx) {
+		ret = write_long_reg(devrec, REG_TESTMODE, 0x0f);
+		if (ret)
+			goto err_ret;
+	}
+
 	/* Set RX Mode. RXMCR<1:0>: 0x0 normal, 0x1 promisc, 0x2 error */
 	ret = read_short_reg(devrec, REG_RXMCR, &val);
 	if (ret)
-- 
1.9.1


             reply	other threads:[~2014-09-15  5:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15  5:35 Walter Mack [this message]
2014-09-16  7:01 ` [PATCH wpan-next] ieee802154: mrf24j40: support for external rx/tx Alexander Aring
2014-09-16 20:13   ` Walter Mack
2014-09-16 20:20     ` Alexander Aring
2014-09-23  3:51       ` Alan Ott
2014-09-23  7:19         ` Alexander Aring
2014-09-23  7:58           ` Simon Vincent
2014-09-23  8:06             ` Alexander Aring
2014-09-24  6:11         ` Walter Mack
2014-09-24  6:35           ` Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410759338-21663-1-git-send-email-wmack@componentsw.com \
    --to=wmack@componentsw.com \
    --cc=alan@signal11.us \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox