Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-wpan@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCHv3 bluetooth-next 2/2] at86rf230: add support for external xtal trim
Date: Tue, 24 Feb 2015 11:47:57 +0100	[thread overview]
Message-ID: <20150224104757.GC748@omega> (raw)
In-Reply-To: <20150224104236.GB748@omega>

On Tue, Feb 24, 2015 at 11:42:36AM +0100, Alexander Aring wrote:
> On Tue, Feb 24, 2015 at 11:34:17AM +0100, Marc Kleine-Budde wrote:
> > On 02/24/2015 11:28 AM, Alexander Aring wrote:
> > > Hi Marc,
> > > 
> > > On Tue, Feb 24, 2015 at 11:21:43AM +0100, Marc Kleine-Budde wrote:
> > >> On 02/24/2015 11:11 AM, Alexander Aring wrote:
> > >>> This patch adds support for setting the xtal trim register. Some at86rf2xx
> > >>> transceiver boards needs fine tuning the xtal capacitor.
> > >>>
> > >>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > >>> ---
> > >>>  .../devicetree/bindings/net/ieee802154/at86rf230.txt         |  3 +++
> > >>>  drivers/net/ieee802154/at86rf230.c                           | 12 ++++++++++++
> > >>>  include/linux/spi/at86rf230.h                                |  1 +
> > >>>  3 files changed, 16 insertions(+)
> > >>>
> > > ...
> > >>> @@ -1390,6 +1397,10 @@ static int at86rf230_get_pdata(struct spi_device *spi,
> > >>>  
> > >>>  	cfg->rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0);
> > >>>  	cfg->slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0);
> > >>> +	ret = of_property_read_u8(spi->dev.of_node, "xtal-trim",
> > >>> +				  &cfg->xtal_trim);
> > >>> +	if (ret < 0 && ret != -EINVAL)
> > >>> +		return ret;
> > >>>  
> > >>>  	return 0;
> > >>>  }
> > >>> @@ -1545,6 +1556,7 @@ static int at86rf230_probe(struct spi_device *spi)
> > >>>  	lp = hw->priv;
> > >>>  	lp->hw = hw;
> > >>>  	lp->spi = spi;
> > >>> +	lp->cfg = cfg;
> > >>
> > >> This doesn't look correct.
> > > 
> > > You mean the line:
> > > 
> > > "lp->cfg = cfg;" or everything?
> > 
> > Just that line, it's in the wrong patch.
> > 
> 
> yes, but in the other patch it makes no sense. I only use the platform
> data in probe function and can't access the platform data over lp->cfg
> there, because lp isn't allocated. So I can add it in patch 1/2 but then
> I will never access the lp->cfg then.
> 
> devm_request_gpio thing will remember which gpio was requested. I never
> read the platform_data again.
> 
> 
> Now in this patch (2/2) I will access the platform data in hw_init and the lp
> is allocated already in this function and can access xtal_trim over
> lp->cfg->xtal_trim.
> 
> We don't really need after probe the platform data again. Further when
> we will add support for the slp_tr pin we need that. This pin is used
> after probing. This means copying platform data in at86rf230_local is a
> good thing to prepare for future.
> 
> Nevertheless I will move it to 1/2.
> 

Okay, I simple move the ieee802154_alloc_hw call a little bit earlier.
Since we have devm_request_... thing the error handling will not more
complex when doing this step.

- Alex

  reply	other threads:[~2015-02-24 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 10:11 [PATCHv3 bluetooth-next 0/2] at86rf230: add support for xtal trim register Alexander Aring
2015-02-24 10:11 ` [PATCHv3 bluetooth-next 1/2] at86rf230: copy pdata to driver allocated space Alexander Aring
2015-02-24 10:11 ` [PATCHv3 bluetooth-next 2/2] at86rf230: add support for external xtal trim Alexander Aring
2015-02-24 10:21   ` Marc Kleine-Budde
2015-02-24 10:28     ` Alexander Aring
2015-02-24 10:34       ` Marc Kleine-Budde
2015-02-24 10:42         ` Alexander Aring
2015-02-24 10:47           ` Alexander Aring [this message]
2015-02-24 10:55           ` Marc Kleine-Budde

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=20150224104757.GC748@omega \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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