Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Simon Vincent <simon.vincent@xsilon.com>
Cc: linux-zigbee-devel@lists.sourceforge.net,
	linux-wpan@vger.kernel.org, alan@signal11.us
Subject: Re: [PATCH linux-wpan] Add support for MRF24J40MC
Date: Wed, 6 Aug 2014 13:37:57 +0200	[thread overview]
Message-ID: <20140806113754.GA3995@omega> (raw)
In-Reply-To: <1407320016-2808-1-git-send-email-simon.vincent@xsilon.com>

Hi,

On Wed, Aug 06, 2014 at 11:13:36AM +0100, Simon Vincent wrote:
> The MRF24J40MC module has an external amplifier which should be enabled.
> 
> Signed-off-by: Simon Vincent <simon.vincent@xsilon.com>
> ---
>  drivers/net/ieee802154/mrf24j40.c | 40 +++++++++++++++++++++++++++++++++++++--
>  1 file changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
> index 9e6a124..7950d01 100644
> --- a/drivers/net/ieee802154/mrf24j40.c
> +++ b/drivers/net/ieee802154/mrf24j40.c
> @@ -43,6 +43,8 @@
>  #define REG_TXSTBL   0x2E  /* TX Stabilization */
>  #define REG_INTSTAT  0x31  /* Interrupt Status */
>  #define REG_INTCON   0x32  /* Interrupt Control */
> +#define REG_GPIO     0x33  /* GPIO */
> +#define REG_TRISGPIO 0x34  /* GPIO direction */
>  #define REG_RFCTL    0x36  /* RF Control Mode Register */
>  #define REG_BBREG1   0x39  /* Baseband Registers */
>  #define REG_BBREG2   0x3A  /* */
> @@ -63,6 +65,7 @@
>  #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 */
>  #define REG_RX_FIFO    0x300  /* Receive FIFO */
>  
>  /* Device configuration: Only channels 11-26 on page 0 are supported. */
> @@ -75,6 +78,8 @@
>  #define RX_FIFO_SIZE 144 /* From datasheet */
>  #define SET_CHANNEL_DELAY_US 192 /* From datasheet */
>  
> +enum modules { MRF24J40, MRF24J40MA, MRF24J40MC };
> +
>  /* Device Private Data */
>  struct mrf24j40 {
>  	struct spi_device *spi;
> @@ -690,6 +695,35 @@ static int mrf24j40_hw_init(struct mrf24j40 *devrec)
>  	if (ret)
>  		goto err_ret; 
> 
> +	if (spi_get_device_id(devrec->spi)->driver_data == MRF24J40MC) {
> +		/* Enable external amplifier */
> +		ret = write_long_reg(devrec, REG_TESTMODE, 0xF);
> +		if (ret)
> +			goto err_ret;
> +
> +		ret = read_short_reg(devrec, REG_TRISGPIO, &val);
> +		if (ret)
> +			goto err_ret;
> +
> +		val |= 0x8;
> +		ret = write_short_reg(devrec, REG_TRISGPIO, val);
> +		if (ret)
> +			goto err_ret;
> +
> +		ret = read_short_reg(devrec, REG_GPIO, &val);
> +		if (ret)
> +			goto err_ret;
> +
> +		val |= 0x8;
> +		ret = write_short_reg(devrec, REG_GPIO, val);
> +		if (ret)
> +			goto err_ret;
> +
> +		ret = write_long_reg(devrec, REG_RFCON3, 0x28);
> +		if (ret)
> +			goto err_ret;
> +	}
> +
>  	return 0;
>  
>  err_ret:
> @@ -778,8 +813,9 @@ static int mrf24j40_remove(struct spi_device *spi)
>  }
>  
>  static const struct spi_device_id mrf24j40_ids[] = {
> -	{ "mrf24j40", 0 },
> -	{ "mrf24j40ma", 0 },
> +	{ "mrf24j40", MRF24J40 },
> +	{ "mrf24j40ma", MRF24J40MA },
> +	{ "mrf24j40mc", MRF24J40MC },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(spi, mrf24j40_ids);

this patch looks ok for me, can you please add "ieee802154: mrf24j40:"
at beginning of the first line of this commit msg?

For v2, please add linux-wpan@vger.kernel.org in cc.

Alan is this also okay for you?

- Alex

       reply	other threads:[~2014-08-06 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1407320016-2808-1-git-send-email-simon.vincent@xsilon.com>
2014-08-06 11:37 ` Alexander Aring [this message]
2014-08-06 11:43   ` [PATCH linux-wpan] Add support for MRF24J40MC 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=20140806113754.GA3995@omega \
    --to=alex.aring@gmail.com \
    --cc=alan@signal11.us \
    --cc=linux-wpan@vger.kernel.org \
    --cc=linux-zigbee-devel@lists.sourceforge.net \
    --cc=simon.vincent@xsilon.com \
    /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