dt-bindings: crypto: fsl-sec4: add snvs clock to pwrkey
Subsystems (5)
PATCH v2 1/6 dt-bindings: crypto: fsl-sec4: add snvs clock to pwrkey
On i.MX7 and i.MX8M, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.
---
v2:
* split documentation and i.MX7 dts update into two patches
* remove stray RTC references from documentation (copy/paste error)
--- .../devicetree/bindings/crypto/fsl-sec4.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Documentation/devicetree/bindings/crypto/fsl-sec4.txt +17 -0
@@ -449,6 +449,19 @@ System ON/OFF key driver Value type: <phandle> Definition: this is phandle to the register map node. + - clocks + Usage: optional, required if SNVS LP requires explicit + enablement of clocks + Value type: <prop_encoded-array> + Definition: a clock specifier describing the clock required for + enabling and disabling SNVS LP. + + - clock-names + Usage: optional, required if SNVS LP requires explicit + enablement of clocks + Value type: <string> + Definition: clock name string should be "snvs-pwrkey". + EXAMPLE: snvs-pwrkey@020cc000 { compatible = "fsl,sec-v4.0-pwrkey";
@@ -456,6 +469,8 @@ EXAMPLE: interrupts = <0 4 0x4> linux,keycode = <116>; /* KEY_POWER */ wakeup-source; + clocks = <&clks IMX7D_SNVS_CLK>; + clock-names = "snvs-pwrkey"; }; =====================================================================
@@ -547,6 +562,8 @@ FULL EXAMPLE interrupts = <0 4 0x4>; linux,keycode = <116>; /* KEY_POWER */ wakeup-source; + clocks = <&clks IMX7D_SNVS_CLK>; + clock-names = "snvs-pwrkey"; }; };
Signature · 1 line
2.23.0.rc1
PATCH v2 2/6 ARM: dts: imx7s: add snvs clock to pwrkey
On i.MX7, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.
---
v2:
* split documentation and i.MX7 dts update into two patches
--- arch/arm/boot/dts/imx7s.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/imx7s.dtsi +2 -0
@@ -611,6 +611,8 @@ compatible = "fsl,sec-v4.0-pwrkey"; regmap = <&snvs>; interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks IMX7D_SNVS_CLK>; + clock-names = "snvs-pwrkey"; linux,keycode = <KEY_POWER>; wakeup-source; status = "disabled";
Signature · 1 line
2.23.0.rc1
Shawn Guo
AppliedRe: [PATCH v2 2/6] ARM: dts: imx7s: add snvs clock to pwrkey
Quoted 11 lines · André Draszik
On i.MX7, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit
ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.Signed-off-by André Draszik <[email protected]>Acked-by Rob Herring <[email protected]>
Applied, thanks.
PATCH v2 3/6 arm64: dts: imx8mm: add snvs clock to pwrkey
In reply to André DraszikOn i.MX8MM, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.
---
v2: new patch
--- arch/arm64/boot/dts/freescale/imx8mm.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/freescale/imx8mm.dtsi +2 -0
@@ -460,6 +460,8 @@ compatible = "fsl,sec-v4.0-pwrkey"; regmap = <&snvs>; interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX8MM_CLK_SNVS_ROOT>; + clock-names = "snvs-pwrkey"; linux,keycode = <KEY_POWER>; wakeup-source; status = "disabled";
Signature · 1 line
2.23.0.rc1
Shawn Guo
AppliedRe: [PATCH v2 3/6] arm64: dts: imx8mm: add snvs clock to pwrkey
Quoted 10 lines · André Draszik
On i.MX8MM, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit
ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.Signed-off-by André Draszik <[email protected]>
Applied, thanks.
PATCH v2 4/6 arm64: dts: imx8mq: add snvs clock to pwrkey
In reply to André DraszikOn i.MX8MM, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.
---
v2: new patch
--- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +2 -0
@@ -501,6 +501,8 @@ compatible = "fsl,sec-v4.0-pwrkey"; regmap = <&snvs>; interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX8MQ_CLK_SNVS_ROOT>; + clock-names = "snvs-pwrkey"; linux,keycode = <KEY_POWER>; wakeup-source; status = "disabled";
Signature · 1 line
2.23.0.rc1
Shawn Guo
AppliedRe: [PATCH v2 4/6] arm64: dts: imx8mq: add snvs clock to pwrkey
Quoted 10 lines · André Draszik
On i.MX8MM, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit
ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.Signed-off-by André Draszik <[email protected]>
Applied, thanks.
PATCH v2 5/6 Input: snvs_pwrkey - enable snvs clock as needed
In reply to André DraszikAt the moment, enabling this driver without the SNVS RTC driver being active will hang the kernel as soon as the power button is pressed.
The reason is that in that case the SNVS isn't enabled, and any attempt to read the SNVS registers will simply hang forever.
Ensure the clock is enabled (during the interrupt handler) to make this driver work.
Also see commit 7f8993995410 ("drivers/rtc/rtc-snvs: add clock support") and commit edb190cb1734
("rtc: snvs: make sure clock is enabled for interrupt handle") for similar updates to the snvs rtc driver.
---
v2:
* drop redundant tests and simplify error handling by using devm_clk_get_optional()
* add clock handling to imx_imx_snvs_check_for_events()
--- drivers/input/keyboard/snvs_pwrkey.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/input/keyboard/snvs_pwrkey.c +27 -1
@@ -16,6 +16,7 @@#include <linux/of_address.h> #include <linux/platform_device.h> #include <linux/pm_wakeirq.h> +#include <linux/clk.h> #include <linux/mfd/syscon.h> #include <linux/regmap.h>
@@ -38,6 +39,7 @@ struct pwrkey_drv_data {int wakeup;struct timer_list check_timer;struct input_dev *input; +struct clk *clk;u8 minor_rev; };
@@ -47,7 +49,10 @@ static void imx_imx_snvs_check_for_events(struct timer_list *t)struct input_dev *input = pdata->input;u32 state; +clk_enable (pdata->clk);regmap_read (pdata->snvs,SNVS_HPSR_REG , &state); +clk_disable (pdata->clk); + state = state &SNVS_HPSR_BTN ?1 :0 ;/* only report new event if status changed */
@@ -74,11 +79,13 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)pm_wakeup_event (input->dev.parent,0 ); +clk_enable (pdata->clk); +regmap_read (pdata->snvs,SNVS_LPSR_REG , &lp_status);if (lp_status &SNVS_LPSR_SPO ) {if (pdata->minor_rev ==0 ) {/* -* The first generation i.MX6 SoCs only sends an +* The first generation i.MX[6|7] SoCs only send an * interrupt on button release. To mimic power-key * usage, we'll prepend a press event. */
@@ -96,6 +103,8 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)/* clear SPO status */ regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); +clk_disable (pdata->clk); +return IRQ_HANDLED ; }
@@ -140,6 +149,23 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)if (pdata->irq <0 )return -EINVAL ; + pdata->clk =devm_clk_get_optional (&pdev->dev,"snvs-pwrkey" ); +if (IS_ERR (pdata->clk)) +return PTR_ERR (pdata->clk); + + error =clk_prepare (pdata->clk); +if (error) { +dev_err (&pdev->dev,"failed to prepare the snvs clock\n" ); +return error; + } + error =devm_add_action_or_reset (&pdev->dev, + (void (*)(void *))clk_unprepare, + pdata->clk); +if (error) { +dev_err (&pdev->dev,"failed to add reset action on 'snvs-pwrkey'" ); +return error; + } +regmap_read (pdata->snvs,SNVS_HPVIDR1_REG , &vid); pdata->minor_rev = vid &0xff ;
Signature · 1 line
2.23.0.rc1
PATCH v2 6/6 Input: snvs_pwrkey - only IRQ_HANDLED for our own events
In reply to André DraszikThe snvs_pwrkey shares the SNVS LPSR status register with the snvs_rtc.
This driver here should only return IRQ_HANDLED if the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.
---
v2:
* no changes
--- drivers/input/keyboard/snvs_pwrkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/input/keyboard/snvs_pwrkey.c +7 -5
@@ -82,7 +82,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)clk_enable (pdata->clk);regmap_read (pdata->snvs,SNVS_LPSR_REG , &lp_status); -if (lp_status &SNVS_LPSR_SPO ) { + lp_status &=SNVS_LPSR_SPO ; + +if (lp_status) {if (pdata->minor_rev ==0 ) {/* * The first generation i.MX[6|7] SoCs only send an
@@ -98,14 +100,14 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)mod_timer (&pdata->check_timer, jiffies +msecs_to_jiffies (DEBOUNCE_TIME )); } - } -/* clear SPO status */ -regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); +/* clear SPO status */ +regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); + }clk_disable (pdata->clk); -return IRQ_HANDLED ; +return lp_status ?IRQ_HANDLED :IRQ_NONE ; }static void imx_snvs_pwrkey_act (void *pdata)
Signature · 1 line
2.23.0.rc1
RE: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Quoted 53 lines · On 2020/02/26 André Draszik <[email protected]> wrote:
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>---
v2:
* no changes--- drivers/input/keyboard/snvs_pwrkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/input/keyboard/snvs_pwrkey.c +3
-1@@ -82,7 +82,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)clk_enable (pdata->clk);regmap_read (pdata->snvs,SNVS_LPSR_REG , &lp_status); -if (lp_status &SNVS_LPSR_SPO ) { + lp_status &=SNVS_LPSR_SPO ; + +if (lp_status) {if (pdata->minor_rev ==0 ) {/* * The first generation i.MX[6|7] SoCs only send an @@ -98,14
+100,14 @@ staticirqreturn_timx_snvs_pwrkey_interrupt(int irq, void *dev_id)
drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) · line 105
Quoted 9 lines
drivers/input/keyboard/snvs_pwrkey.c +2
-3mod_timer (&pdata->check_timer, jiffies +msecs_to_jiffies (DEBOUNCE_TIME )); } - } -/* clear SPO status */ -regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); +/* clear SPO status */ +regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO );
But irq storm will come in once there is other interrupt triggered as unexpected, although I never met it before. Could we drop this patch now? Others are ok for me.
Quoted 11 lines
drivers/input/keyboard/snvs_pwrkey.c +2
-2+ }clk_disable (pdata->clk); -return IRQ_HANDLED ; +return lp_status ?IRQ_HANDLED :IRQ_NONE ; }static void imx_snvs_pwrkey_act (void *pdata) --2.23.0.rc1
Re: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Quoted 59 lines · Robin Gong
Quoted 58 lines · On 2020/02/26 André Draszik <[email protected]> wrote:
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>---
v2:
* no changes--- drivers/input/keyboard/snvs_pwrkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/input/keyboard/snvs_pwrkey.c +3
-1@@ -82,7 +82,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)clk_enable (pdata->clk);regmap_read (pdata->snvs,SNVS_LPSR_REG , &lp_status); -if (lp_status &SNVS_LPSR_SPO ) { + lp_status &=SNVS_LPSR_SPO ; + +if (lp_status) {if (pdata->minor_rev ==0 ) {/* * The first generation i.MX[6|7] SoCs only send an @@ -98,14
+100,14 @@ staticirqreturn_timx_snvs_pwrkey_interrupt(int irq, void *dev_id)drivers/input/keyboard/snvs_pwrkey.c +0
-1mod_timer (&pdata->check_timer, jiffies +msecs_to_jiffies (DEBOUNCE_TIME )); } - }
Quoted 6 lines
drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) · line 105
Quoted 4 lines
drivers/input/keyboard/snvs_pwrkey.c +2
-2-/* clear SPO status */ -regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); +/* clear SPO status */ +regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO );But irq storm will come in once there is other interrupt triggered as unexpected, although I never met it before. Could we drop this patch now? Others are ok for me.
I don't have strong feelings about this patch, but this bit merely changes behaviour to clear SP0 if SP0 was in fact != 0 in the first place, whereas before SP0 was always cleared, even if it was == 0 anyway. Seems more logical in my eyes.
Quoted 7 lines
Reviewed-by Robin Gong <yibin.gong@nxp>drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) · line 110
Quoted 6 lines
drivers/input/keyboard/snvs_pwrkey.c +2
-1+ }clk_disable (pdata->clk); -return IRQ_HANDLED ; +return lp_status ?IRQ_HANDLED :IRQ_NONE ;
If you're talking about this part, the rtc-snvs driver does the same in its interrupt handler. In other words, this driver here could prevent the rtc-snvs driver from seeing its events.
Cheers,
Andre'
Quoted 5 lines
Quoted 5 lines
}
static void
imx_snvs_pwrkey_act(void *pdata)
--
2.23.0.rc1
RE: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Quoted 70 lines · On 2020/02/27 André Draszik <[email protected]> wrote:
Quoted 7 lines · Robin Gong
Quoted 6 lines · On 2020/02/26 André Draszik <[email protected]> wrote:
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even thoughit wasn't at all.
Quoted 38 lines
Quoted 38 lines
Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>---
v2:
* no changes--- drivers/input/keyboard/snvs_pwrkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/input/keyboard/snvs_pwrkey.c +0
-0@@ -82,7 +82,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(intirq, void
*dev_id)
clk_enable(pdata->clk);Quoted 8 lines
drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
Quoted 8 lines
drivers/input/keyboard/snvs_pwrkey.c +3
-1regmap_read (pdata->snvs,SNVS_LPSR_REG , &lp_status); -if (lp_status &SNVS_LPSR_SPO ) { + lp_status &=SNVS_LPSR_SPO ; + +if (lp_status) {if (pdata->minor_rev ==0 ) {/* * The first generation i.MX[6|7] SoCs only send an @@ -98,14
Quoted 8 lines
Quoted 8 lines
+100,14 @@ static
irqreturn_timx_snvs_pwrkey_interrupt(int irq, +void*dev_id)drivers/input/keyboard/snvs_pwrkey.c +0
-1mod_timer (&pdata->check_timer, jiffies +msecs_to_jiffies (DEBOUNCE_TIME )); } - }Quoted 6 lines
drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) · line 105
Quoted 4 lines
drivers/input/keyboard/snvs_pwrkey.c +2
-2-/* clear SPO status */ -regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO ); +/* clear SPO status */ +regmap_write (pdata->snvs,SNVS_LPSR_REG ,SNVS_LPSR_SPO );But irq storm will come in once there is other interrupt triggered as unexpected, although I never met it before. Could we drop this patch now?
Quoted 6 lines
Others are ok for me.
I don't have strong feelings about this patch, but this bit merely changes behaviour to clear SP0 if SP0 was in fact != 0 in the first place, whereas before SP0 was always cleared, even if it was == 0 anyway. Seems more logical in my eyes.
Seems we care something never happen:) I'm okay if you really want to do that.
Quoted 7 lines
Quoted 7 lines
Reviewed-by Robin Gong <yibin.gong@nxp>Quoted 4 lines
drivers/input/keyboard/snvs_pwrkey.c +1
-0+ }clk_disable (pdata->clk);
Quoted 7 lines
Quoted 2 lines
drivers/input/keyboard/snvs_pwrkey.c static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) · line 110
Quoted 2 lines
drivers/input/keyboard/snvs_pwrkey.c +1
-1-return IRQ_HANDLED ; +return lp_status ?IRQ_HANDLED :IRQ_NONE ;If you're talking about this part, the rtc-snvs driver does the same in its interrupt handler.
In other words, this driver here could prevent the rtc-snvs driver from seeing its events
But rtc driver has another interrupt number, and snvs_pwrkey driver just touch SPO bit
as below:regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
So I don't think it could impact rtc-snvs driver. But you remind me rtc-snvs driver may clear SPO status, because lpsr is read from SNVS_LPSR which may SPO has already been set. regmap_write(data->regmap, data->offset + SNVS_LPSR, lpsr);
I'll send a patch for fix that potential issue. Besides, if you really want to follow rtc driver please initialize lp_status with 0.
Quoted 12 lines
Cheers,
Andre'Quoted 5 lines
Quoted 5 lines
}
static void
imx_snvs_pwrkey_act(void *pdata)
--
2.23.0.rc1
Re: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
In reply to André DraszikQuoted 19 lines · André Draszik
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>
Quoted 8 lines
Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>
For patches 2-6:
Also imx8mn.dtsi and imx8mp.dtsi will have to be updated.
Thanks,
Horia
Re: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Quoted 29 lines · Horia Geanta
Quoted 19 lines · André Draszik
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Quoted 8 lines
Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>
Quoted 4 lines
For patches 2-6:
Reviewed-by Horia Geantă <[email protected]>Also
imx8mn.dtsiandimx8mp.dtsiwill have to be updated.
Is there an update coming for the 8mn family? I am seeing it not wake from the power key, and I was hoping to resolve that before i make a push to submit a new 8MN board for review.
thanks
adam
Quoted 8 lines
Thanks,
Horia_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Quoted 30 lines · Adam Ford
Quoted 29 lines · Horia Geanta
Quoted 27 lines · André Draszik
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>
Quoted 9 lines
Quoted 4 lines
For patches 2-6:
Reviewed-by Horia Geantă <[email protected]>Also
imx8mn.dtsiandimx8mp.dtsiwill have to be updated.Is there an update coming for the 8mn family? I am seeing it not wake from the power key, and I was hoping to resolve that before i make a push to submit a new 8MN board for review.
Starting with linux-next next-20200320, there's commit
arm64: dts: imx8mn: Add snvs clock to powerkey
Could you confirm you've tested with a tree including it?
Thanks,
Horia
Re: [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Hi Herbert, Dmitry,
Quoted 36 lines · Horia Geanta
Quoted 35 lines · Adam Ford
Quoted 33 lines · Horia Geanta
Quoted 19 lines · André Draszik
The
snvs_pwrkeyshares the SNVS LPSR status register with thesnvs_rtc.This driver here should only return
IRQ_HANDLEDif the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all.Signed-off-by André Draszik <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Quoted 8 lines
Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>For patches 2-6:
Reviewed-by Horia Geantă <[email protected]>Also
imx8mn.dtsiandimx8mp.dtsiwill have to be updated.
Quoted 9 lines
Quoted 4 lines
Is there an update coming for the 8mn family? I am seeing it not wake from the power key, and I was hoping to resolve that before i make a push to submit a new 8MN board for review.
Starting with linux-next next-20200320, there's commit
arm64: dts: imx8mn: Add snvs clock to powerkeyCould you confirm you've tested with a tree including it?
Seems that from this series:
https://lore.kernel.org/linux-crypto/[email protected]/T/
only DT patches (2,3,4) were applied.
Would it be ok to go via crypto tree with:
[PATCH v2 1/6] dt-bindings: crypto: fsl-sec4: add snvs clock to pwrkey
and via input tree with:
[PATCH v2 5/6] Input: snvs_pwrkey - enable snvs clock as needed [PATCH v2 6/6] Input: snvs_pwrkey - only IRQ_HANDLED for our own events ?
Thanks,
Horia
Quoted 21 lines · André Draszik
On i.MX7 and i.MX8M, the SNVS requires a clock. This is similar to the clock bound to the SNVS RTC node, but if the SNVS RTC driver isn't enabled, then SNVS doesn't work, and as such the pwrkey driver doesn't work (i.e. hangs the kernel, as the clock isn't enabled).
Also see commit
ec2a844ef7c1
("ARM: dts: imx7s: add snvs rtc clock")
for a similar fix.Signed-off-by André Draszik <[email protected]>Acked-by Rob Herring <[email protected]>Cc "Horia Geantă" <[email protected]>Cc Aymen Sghaier <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>
Quoted 8 lines
Cc NXP Linux Team <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Anson Huang <[email protected]>Cc Robin Gong <[email protected]>
Thanks,
Horia