Re: [PATCH] can: c_can: use regmap_update_bits() to modify RAMINIT register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 12, 2015 at 02:37:21PM +0200, Roger Quadros wrote:
> On 12/01/15 14:05, Mark Brown wrote:

> > The usual thing to do here is an explicit write clearing the latch,
> > either immediately after setting it or immediately before setting it.
> > If the register is marked as volatile and the hardware doesn't read back
> > the latched state that also does the trick.

> How does this work if driver has access to only 1 bit that can only be
> written with 1 to clear a condition? Writing a 0 is no-op.

The expectation is that for hardware like that writes of zero will be
ignored so you can just do one (generally this is the point of such
things - you write to explicitly clear the bits you want to clear so by
extension other bits are ignored.

> It can read back 0 or 1 depending on the condition.

If the hardware readback has nothing to do with what's read back then
by definition this isn't something you should be updating with
update_bits() - it's doing a read/modify/write cycle so if the read part
doesn't correspond to the write part things will go wrong.

> I didn't understand the volatile trick :P.

If the hardware always reads back zero then if the register isn't cached
(which it sounds like this one shouldn't be) the comparison done by
update_bits() will always show that the latch bit needs writing.

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux