linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: mkl@pengutronix.de, linux-can@vger.kernel.org, wsa@the-dreams.de,
	kernel@pengutronix.de, linux-omap@vger.kernel.org,
	broonie@kernel.org
Subject: Re: [PATCH] can: c_can: use regmap_update_bits() to modify RAMINIT register
Date: Mon, 12 Jan 2015 12:02:21 +0200	[thread overview]
Message-ID: <54B39BAD.4070604@ti.com> (raw)
In-Reply-To: <54B39A8E.4090006@ti.com>

+Mark with correct id.

On 12/01/15 11:57, Roger Quadros wrote:
> +Mark,
> 
> On 09/01/15 15:50, Tomi Valkeinen wrote:
>> 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?
>>
> 
> Initial condition is START=0, DONE=1.
> 
> Now setting and clearing START bit initiates the start process and will cause the
> DONE bit to be set after a while.
> So unfortunately this doesn't work for us.
> 
> Mark,
> 
> The problem here is we can't use regmap_update_bits() because we need to write a 1 to the DONE bit to clear it and _regmap_update_bits() doesn't allow us to do that because of commit
> d91e8db2c3bb regmap: Suppress noop writes in regmap_update_bits()
> 
> Is reverting it going to cause other issues? If yes then can we have a flag to specify forced update?
> 
> cheers,
> -roger
> [1] - http://lxr.free-electrons.com/source/drivers/base/regmap/regmap.c#L2332
> 
> 


  reply	other threads:[~2015-01-12 10:02 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
2015-01-12  9:57   ` Roger Quadros
2015-01-12 10:02     ` Roger Quadros [this message]
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=54B39BAD.4070604@ti.com \
    --to=rogerq@ti.com \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=tomi.valkeinen@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).