linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Roger Quadros <rogerq@ti.com>
Cc: mkl@pengutronix.de, linux-can@vger.kernel.org, wsa@the-dreams.de,
	kernel@pengutronix.de, linux-omap@vger.kernel.org
Subject: Re: [PATCH] can: c_can: use regmap_update_bits() to modify RAMINIT register
Date: Fri, 9 Jan 2015 15:50:40 +0200	[thread overview]
Message-ID: <54AFDCB0.5060908@ti.com> (raw)
In-Reply-To: <1420641162-8634-1-git-send-email-rogerq@ti.com>

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

On 07/01/15 16:32, Roger Quadros wrote:
> use of regmap_read() and regmap_write() in c_can_hw_raminit_syscon()
> is not safe as the RAMINIT register can be shared between different drivers
> at least for TI SoCs.
> 
> To make the modification atomic we switch to using regmap_update_bits().
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/net/can/c_can/c_can_platform.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> index f363972..364209a 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -110,6 +110,10 @@ static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable)
>  	 */
>  	ctrl &= ~(1 << raminit->bits.start);
>  	ctrl |= 1 << raminit->bits.done;
> +
> +	/* we can't use regmap_update_bits here as it will bypass the write
> +	 * if START is already 0 and DONE is already 1.
> +	 */
>  	regmap_write(raminit->syscon, raminit->reg, ctrl);

Can you first use update_bits to change either bit, so that this update
will be done?

 Tomi



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

  reply	other threads:[~2015-01-09 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 14:32 [PATCH] can: c_can: use regmap_update_bits() to modify RAMINIT register Roger Quadros
2015-01-09 13:50 ` Tomi Valkeinen [this message]
2015-01-12  9:57   ` Roger Quadros
2015-01-12 10:02     ` Roger Quadros
2015-01-12 12:05       ` Mark Brown
2015-01-12 12:37         ` Roger Quadros
2015-01-12 12:43           ` Mark Brown
2015-01-13 14:23 ` [PATCH v2] " Roger Quadros
2015-01-15 14:37   ` 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=54AFDCB0.5060908@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=rogerq@ti.com \
    --cc=wsa@the-dreams.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;
as well as URLs for NNTP newsgroup(s).