netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Florian Vaussard <florian.vaussard@epfl.ch>,
	Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/6] can: sja1000: of: add reg-io-width property for 8, 16 and 32-bit register access
Date: Fri, 31 Jan 2014 13:28:42 +0100	[thread overview]
Message-ID: <52EB96FA.7090606@pengutronix.de> (raw)
In-Reply-To: <1391164513-11529-7-git-send-email-florian.vaussard@epfl.ch>

[-- Attachment #1: Type: text/plain, Size: 1728 bytes --]

On 01/31/2014 11:35 AM, Florian Vaussard wrote:
> Add the 'reg-io-width' property for 8, 16 and 32-bit access, like
> what is currently done with IORESOURCE_MEM_{8,16,32}BIT for non-OF
> boot.
> 
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> ---
>  drivers/net/can/sja1000/sja1000_platform.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
> index 96a92a1..62ebc3d 100644
> --- a/drivers/net/can/sja1000/sja1000_platform.c
> +++ b/drivers/net/can/sja1000/sja1000_platform.c
> @@ -103,8 +103,17 @@ static void sp_populate_of(struct sja1000_priv *priv, struct device_node *of)
>  	int err;
>  	u32 prop;
>  
> -	priv->read_reg = sp_read_reg8;
> -	priv->write_reg = sp_write_reg8;
> +	of_property_read_u32(of, "reg-io-width", &prop);

The new property might not be available in the DT, please check the
return value of of_property_read_u32(). Use 8 bit wide as default.

> +	if (prop == 4) {
> +		priv->read_reg = sp_read_reg32;
> +		priv->write_reg = sp_write_reg32;
> +	} else if (prop == 2) {
> +		priv->read_reg = sp_read_reg16;
> +		priv->write_reg = sp_write_reg16;
> +	} else {
> +		priv->read_reg = sp_read_reg8;
> +		priv->write_reg = sp_write_reg8;
> +	}
>  
>  	err = of_property_read_u32(of, "nxp,external-clock-frequency", &prop);
>  	if (!err)
> 

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

  reply	other threads:[~2014-01-31 12:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 10:35 [PATCH v2 0/6] can: sja1000: cleanups and new OF property Florian Vaussard
2014-01-31 10:35 ` [PATCH v2 1/6] can: sja1000: remove unused defines Florian Vaussard
2014-01-31 12:35   ` Marc Kleine-Budde
2014-01-31 10:35 ` [PATCH v2 2/6] can: sja1000: convert printk to use netdev API Florian Vaussard
2014-01-31 12:34   ` Marc Kleine-Budde
2014-01-31 10:35 ` [PATCH v2 3/6] can: sja1000: platform: use devm_* APIs Florian Vaussard
2014-01-31 12:34   ` Marc Kleine-Budde
2014-01-31 10:35 ` [PATCH v2 4/6] can: sja1000: fuse of_platform into platform Florian Vaussard
2014-01-31 12:33   ` Marc Kleine-Budde
2014-01-31 12:45     ` Florian Vaussard
2014-01-31 12:49       ` Marc Kleine-Budde
2014-01-31 12:51         ` Marc Kleine-Budde
2014-01-31 13:00           ` Florian Vaussard
2014-01-31 13:14             ` Marc Kleine-Budde
2014-01-31 10:35 ` [PATCH v2 5/6] Documentation: devicetree: sja1000: add reg-io-width binding Florian Vaussard
2014-01-31 12:29   ` Marc Kleine-Budde
2014-02-03  8:11     ` Florian Vaussard
2014-01-31 10:35 ` [PATCH v2 6/6] can: sja1000: of: add reg-io-width property for 8, 16 and 32-bit register access Florian Vaussard
2014-01-31 12:28   ` Marc Kleine-Budde [this message]
2014-01-31 12:37 ` [PATCH v2 0/6] can: sja1000: cleanups and new OF property Marc Kleine-Budde
2014-01-31 12:41   ` Florian Vaussard

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=52EB96FA.7090606@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=florian.vaussard@epfl.ch \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).