Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* syscon-poweroff: add a mask property
@ 2017-01-29 12:04 Guy Shapiro
  2017-01-29 18:50 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Guy Shapiro @ 2017-01-29 12:04 UTC (permalink / raw)
  To: linux-arm-kernel


The syscon-poweroff driver powers off the machine by writing a value to
a register. Both the register and the value are configured via the
device tree.

I encountered a situation where I need to mask the written value - some
values of the register must remain unchanged during the power-down.
(This is required to turn on the i.mx6ul using the RTC. See [1] for more
details.)

Unfortunately, the property of the register value is currently named
mask, so we can't just add a "mask" property.

The solutions I could think of:
1) Add a new mask property and name it "mask_mask" or something like
that.
2) Create a new "syscon-masked-poweroff" driver that will have value and
mask properties.

What do you think?


[1] https://www.spinics.net/lists/arm-kernel/msg555580.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* syscon-poweroff: add a mask property
  2017-01-29 12:04 syscon-poweroff: add a mask property Guy Shapiro
@ 2017-01-29 18:50 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-01-29 18:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Sun, Jan 29, 2017 at 02:04:00PM +0200, Guy Shapiro wrote:
> The syscon-poweroff driver powers off the machine by writing a value to
> a register. Both the register and the value are configured via the
> device tree.
> 
> I encountered a situation where I need to mask the written value - some
> values of the register must remain unchanged during the power-down.
> (This is required to turn on the i.mx6ul using the RTC. See [1] for more
> details.)
> 
> Unfortunately, the property of the register value is currently named
> mask, so we can't just add a "mask" property.
> 
> The solutions I could think of:
> 1) Add a new mask property and name it "mask_mask" or something like
> that.
> 2) Create a new "syscon-masked-poweroff" driver that will have value and
> mask properties.
> 
> What do you think?

I suggest the we add a value property to the binding [0]
and use the following logic in the driver to keep
compatibility with the old binding:

if (!value) {
    /* support for old binding */
    val = mask;
    mask = 0xFFFFFFFF;
} else if (!mask) {
    /* support for just providing value */
    mask = 0xFFFFFFFF;
    val = value;
}

regmap_update_bits(map, offset, mask, val);

[0] Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170129/5f0dd3f4/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-29 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-29 12:04 syscon-poweroff: add a mask property Guy Shapiro
2017-01-29 18:50 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox