* [PATCH 0/2] imx: Fix power-up on RTC alarm @ 2017-02-07 12:54 Guy Shapiro [not found] ` <1486472054-4367-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Guy Shapiro @ 2017-02-07 12:54 UTC (permalink / raw) To: Rob Herring, Mark Rutland, Sebastian Reichel, Fabio Estevam Cc: Guy Shapiro, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-pm-u79uwXL29TY76Z2rM5mHXA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni Currently, the syscon-poweroff driver cleans the alarm enable bit during power off. This behaviour makes it impossible to wake up the device using the RTC. The first patch adds a mask option to the syscon-poweroff driver. It uses the method suggested by Sebastian Reichel [0] to maintain compatibility with the old binding. The second patch update the device trees for the snvs component users. Although I believe this should work on all the modified devices, I had only imx6ul to test with. Making the wake-up alarm work may require applying another patch [1], already accepted to the rtc-snvs driver. Thanks, Guy. [0] http://www.spinics.net/lists/devicetree/msg161527.html [1] https://patchwork.ozlabs.org/patch/721155/ Guy Shapiro (2): power: reset: syscon-poweroff: add a mask property ARM: dts: imx: update snvs-poweroff mask .../bindings/power/reset/syscon-poweroff.txt | 11 +++++++++-- arch/arm/boot/dts/imx6qdl.dtsi | 1 + arch/arm/boot/dts/imx6sl.dtsi | 1 + arch/arm/boot/dts/imx6sx.dtsi | 1 + arch/arm/boot/dts/imx6ul.dtsi | 1 + arch/arm/boot/dts/imx7s.dtsi | 1 + drivers/power/reset/syscon-poweroff.c | 19 ++++++++++++++++--- 7 files changed, 30 insertions(+), 5 deletions(-) -- 2.1.4 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <1486472054-4367-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org>]
* [PATCH 1/2] power: reset: syscon-poweroff: add a mask property [not found] ` <1486472054-4367-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> @ 2017-02-07 15:56 ` Guy Shapiro [not found] ` <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Guy Shapiro @ 2017-02-07 15:56 UTC (permalink / raw) To: Rob Herring, Mark Rutland, Sebastian Reichel, Fabio Estevam Cc: Guy Shapiro, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-pm-u79uwXL29TY76Z2rM5mHXA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni Make the syscon-poweroff driver accept value and mask instead of just value. Prior to this patch, the property name for the value was 'mask'. If only the mask property is defined on a node, maintain compatibility by using it as the value. Signed-off-by: Guy Shapiro <guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> --- .../bindings/power/reset/syscon-poweroff.txt | 11 +++++++++-- drivers/power/reset/syscon-poweroff.c | 19 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt index 1e2546f..022ed1f 100644 --- a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt +++ b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt @@ -3,13 +3,20 @@ Generic SYSCON mapped register poweroff driver This is a generic poweroff driver using syscon to map the poweroff register. The poweroff is generally performed with a write to the poweroff register defined by the register map pointed by syscon reference plus the offset -with the mask defined in the poweroff node. +with the value and mask defined in the poweroff node. Required properties: - compatible: should contain "syscon-poweroff" - regmap: this is phandle to the register map node - offset: offset in the register map for the poweroff register (in bytes) -- mask: the poweroff value written to the poweroff register (32 bit access) +- value: the poweroff value written to the poweroff register (32 bit access) + +Optional properties: +- mask: update only the register bits defined by the mask (32 bit) + +Legacy usage: +If a node doesn't contain a value property but contains a mask property, the +mask property is used as the value. Default will be little endian mode, 32 bit access only. diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index b683383..f9f1cb5 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -28,12 +28,13 @@ static struct regmap *map; static u32 offset; +static u32 value; static u32 mask; static void syscon_poweroff(void) { /* Issue the poweroff */ - regmap_write(map, offset, mask); + regmap_update_bits(map, offset, mask, value); mdelay(1000); @@ -43,6 +44,7 @@ static void syscon_poweroff(void) static int syscon_poweroff_probe(struct platform_device *pdev) { char symname[KSYM_NAME_LEN]; + int mask_err, value_err; map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); if (IS_ERR(map)) { @@ -55,11 +57,22 @@ static int syscon_poweroff_probe(struct platform_device *pdev) return -EINVAL; } - if (of_property_read_u32(pdev->dev.of_node, "mask", &mask)) { - dev_err(&pdev->dev, "unable to read 'mask'"); + value_err = of_property_read_u32(pdev->dev.of_node, "value", &value); + mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &mask); + if (value_err && mask_err) { + dev_err(&pdev->dev, "unable to read 'value' and 'mask'"); return -EINVAL; } + if (value_err) { + /* support old binding */ + value = mask; + mask = 0xFFFFFFFF; + } else if (mask_err) { + /* support value without mask*/ + mask = 0xFFFFFFFF; + } + if (pm_power_off) { lookup_symbol_name((ulong)pm_power_off, symname); dev_err(&pdev->dev, -- 2.1.4 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org>]
* [PATCH 2/2] ARM: dts: imx: update snvs-poweroff mask [not found] ` <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> @ 2017-02-07 15:56 ` Guy Shapiro 2017-02-15 22:00 ` [PATCH 1/2] power: reset: syscon-poweroff: add a mask property Rob Herring 2017-03-15 20:45 ` Sebastian Reichel 2 siblings, 0 replies; 5+ messages in thread From: Guy Shapiro @ 2017-02-07 15:56 UTC (permalink / raw) To: Rob Herring, Mark Rutland, Sebastian Reichel, Fabio Estevam Cc: Guy Shapiro, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-pm-u79uwXL29TY76Z2rM5mHXA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni Make the syscon-poweroff driver change only the shutdown bits on the SNVS_LP control register. This change fixes an issue with the RTC wakeup alarm, that was previously disabled during power off. Signed-off-by: Guy Shapiro <guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> --- arch/arm/boot/dts/imx6qdl.dtsi | 1 + arch/arm/boot/dts/imx6sl.dtsi | 1 + arch/arm/boot/dts/imx6sx.dtsi | 1 + arch/arm/boot/dts/imx6ul.dtsi | 1 + arch/arm/boot/dts/imx7s.dtsi | 1 + 5 files changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 89b834f..06984b1 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -757,6 +757,7 @@ compatible = "syscon-poweroff"; regmap = <&snvs>; offset = <0x38>; + value = <0x60>; mask = <0x60>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 19cbd87..58717d3 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -644,6 +644,7 @@ compatible = "syscon-poweroff"; regmap = <&snvs>; offset = <0x38>; + value = <0x60>; mask = <0x60>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index 10f3330..be142ed5 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -698,6 +698,7 @@ compatible = "syscon-poweroff"; regmap = <&snvs>; offset = <0x38>; + value = <0x60>; mask = <0x60>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 39845a7..505d24e 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -606,6 +606,7 @@ compatible = "syscon-poweroff"; regmap = <&snvs>; offset = <0x38>; + value = <0x60>; mask = <0x60>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi index 8ff2cbdd..aadb1134 100644 --- a/arch/arm/boot/dts/imx7s.dtsi +++ b/arch/arm/boot/dts/imx7s.dtsi @@ -529,6 +529,7 @@ compatible = "syscon-poweroff"; regmap = <&snvs>; offset = <0x38>; + value = <0x60>; mask = <0x60>; }; -- 2.1.4 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] power: reset: syscon-poweroff: add a mask property [not found] ` <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 2017-02-07 15:56 ` [PATCH 2/2] ARM: dts: imx: update snvs-poweroff mask Guy Shapiro @ 2017-02-15 22:00 ` Rob Herring 2017-03-15 20:45 ` Sebastian Reichel 2 siblings, 0 replies; 5+ messages in thread From: Rob Herring @ 2017-02-15 22:00 UTC (permalink / raw) To: Guy Shapiro Cc: Mark Rutland, Sebastian Reichel, Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-pm-u79uwXL29TY76Z2rM5mHXA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni On Tue, Feb 07, 2017 at 05:56:05PM +0200, Guy Shapiro wrote: > Make the syscon-poweroff driver accept value and mask instead of > just value. > > Prior to this patch, the property name for the value was 'mask'. If > only the mask property is defined on a node, maintain compatibility > by using it as the value. > > Signed-off-by: Guy Shapiro <guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> > --- > .../bindings/power/reset/syscon-poweroff.txt | 11 +++++++++-- > drivers/power/reset/syscon-poweroff.c | 19 ++++++++++++++++--- > 2 files changed, 25 insertions(+), 5 deletions(-) Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] power: reset: syscon-poweroff: add a mask property [not found] ` <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 2017-02-07 15:56 ` [PATCH 2/2] ARM: dts: imx: update snvs-poweroff mask Guy Shapiro 2017-02-15 22:00 ` [PATCH 1/2] power: reset: syscon-poweroff: add a mask property Rob Herring @ 2017-03-15 20:45 ` Sebastian Reichel 2 siblings, 0 replies; 5+ messages in thread From: Sebastian Reichel @ 2017-03-15 20:45 UTC (permalink / raw) To: Guy Shapiro Cc: Rob Herring, Mark Rutland, Fabio Estevam, devicetree-u79uwXL29TY76Z2rM5mHXA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, linux-pm-u79uwXL29TY76Z2rM5mHXA, Alexandre Belloni, Sascha Hauer, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r [-- Attachment #1: Type: text/plain, Size: 1002 bytes --] Hi, On Tue, Feb 07, 2017 at 05:56:05PM +0200, Guy Shapiro wrote: > Make the syscon-poweroff driver accept value and mask instead of > just value. > > Prior to this patch, the property name for the value was 'mask'. If > only the mask property is defined on a node, maintain compatibility > by using it as the value. > > Signed-off-by: Guy Shapiro <guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> Thanks, queued with Rob's Acked-By. -- Sebastian -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-15 20:45 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-02-07 12:54 [PATCH 0/2] imx: Fix power-up on RTC alarm Guy Shapiro [not found] ` <1486472054-4367-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 2017-02-07 15:56 ` [PATCH 1/2] power: reset: syscon-poweroff: add a mask property Guy Shapiro [not found] ` <1486482966-4497-1-git-send-email-guy.shapiro-2HKgp+mgmS5l57MIdRCFDg@public.gmane.org> 2017-02-07 15:56 ` [PATCH 2/2] ARM: dts: imx: update snvs-poweroff mask Guy Shapiro 2017-02-15 22:00 ` [PATCH 1/2] power: reset: syscon-poweroff: add a mask property Rob Herring 2017-03-15 20:45 ` Sebastian Reichel
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).