mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Question: regmap_field_write() - why using update?
Date: Thu, 14 Jul 2022 17:15:34 +0200	[thread overview]
Message-ID: <277e0484-60bd-7405-4cd1-acf0a03ef195@linaro.org> (raw)
In-Reply-To: <14b0e150-511c-867a-281a-1d13e7e318e8@linaro.org>

On 14/07/2022 17:13, Krzysztof Kozlowski wrote:
> On 14/07/2022 17:07, Mark Brown wrote:
>> On Thu, Jul 14, 2022 at 05:01:29PM +0200, Krzysztof Kozlowski wrote:
>>
>>> I am converting my driver using MMIO to regmap from readl/writel and to
>>> my surprise I found that regmap_field_write() does not behave the same
>>> as regmap_write(). I would expect that they are the same, except one
>>> operates on fields.
>>
>>> However regmap_field_write() uses an update method [1] which means it
>>> reads and performs update. regmap_write() simply writes without a read.
>>
>>> I find it inconsistent and a bit confusing. Any reasons for such
>>> behavior so I won't send a patch which breaks 100 of devices?
>>
>> How would you propose to write to a field without reading the rest of
>> the bits in the register?  Otherwise you'd be doing a full register
>> write rather than just a write to the specific field.
> 
> Indeed, I forgot about bits in a field... So it has to be like this or I
> need to use regmap_write(). I find the regmap field API very useful for
> devices with different register layouts, but the actual "fields" part is
> not really needed in my case.

... and few registers (like "clear" registers) actually do not allow to
read.

Best regards,
Krzysztof

  reply	other threads:[~2022-07-14 15:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 15:01 Krzysztof Kozlowski
2022-07-14 15:07 ` Mark Brown
2022-07-14 15:13   ` Krzysztof Kozlowski
2022-07-14 15:15     ` Krzysztof Kozlowski [this message]
2022-07-14 18:27       ` Mark Brown
2022-07-19 12:01         ` Krzysztof Kozlowski

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=277e0484-60bd-7405-4cd1-acf0a03ef195@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /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

all inboxes | Powered by JetHome®