2013-07-12 13:52:27

by Andrii Tseglytskyi

[permalink] [raw]
Subject: [PATCH v1 0/2] PM / AVS: interrupt handling fixes

Hi Kevin,

Could you please take a look to the following patch series.
It consists of two patches, which are needed for proper
SmartReflex Interrupt handling.

Based on Linux v3.10. Verified on OMAP4430.

Thank you in advance.

Regards,
Andrii

Nishanth Menon (2):
PM / AVS: SmartReflex: fix interrupt disable sequence
PM / AVS: SmartReflex: disable spamming interrupts

drivers/power/avs/smartreflex.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)

--
1.7.9.5


2013-07-12 13:52:39

by Andrii Tseglytskyi

[permalink] [raw]
Subject: [PATCH v1 1/2] PM / AVS: SmartReflex: fix interrupt disable sequence

From: Nishanth Menon <[email protected]>

With the current interrupt disable sequence, we disable IRQENABLE
followed by clearing of IRQSTATUS. With this sequence, we see, at
times CORE domain does not hit OFF mode during cold boot because
SR modules(Core/IVA/MPU domains) are stuck 'in transition'. This
is due to IP Generic behavior around how swakeup is controlled
towards PRCM.

The right sequence we have is write to IRQSTATUS register
to clear the interrupt, then write to IRQENABLE_CLR register to
disable the interrupt to ensure that no pending interrupts exist
in the system on disable of SmartReflex AVS block.

Reported-by: Honda Kenji <[email protected]>
Reported-by: Maki Tanaka <[email protected]>
Signed-off-by: Nishanth Menon <[email protected]>
Signed-off-by: Andrii Tseglytskyi <[email protected]>
---
drivers/power/avs/smartreflex.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index 6b2238b..5b2b703 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -295,12 +295,12 @@ static void sr_v2_disable(struct omap_sr *sr)
else
sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2,
0x0);
- sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT |
- IRQENABLE_MCUVALIDINT |
- IRQENABLE_MCUBOUNDSINT));
sr_write_reg(sr, IRQSTATUS, (IRQSTATUS_MCUACCUMINT |
IRQSTATUS_MCVALIDINT |
IRQSTATUS_MCBOUNDSINT));
+ sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT |
+ IRQENABLE_MCUVALIDINT |
+ IRQENABLE_MCUBOUNDSINT));

/*
* Wait for SR to be disabled.
@@ -315,8 +315,8 @@ static void sr_v2_disable(struct omap_sr *sr)
__func__);

/* Disable MCUDisableAcknowledge interrupt & clear pending interrupt */
- sr_write_reg(sr, IRQENABLE_CLR, IRQENABLE_MCUDISABLEACKINT);
sr_write_reg(sr, IRQSTATUS, IRQSTATUS_MCUDISABLEACKINT);
+ sr_write_reg(sr, IRQENABLE_CLR, IRQENABLE_MCUDISABLEACKINT);
}

static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row(
--
1.7.9.5

2013-07-12 13:52:45

by Andrii Tseglytskyi

[permalink] [raw]
Subject: [PATCH v1 2/2] PM / AVS: SmartReflex: disable spamming interrupts

From: Nishanth Menon <[email protected]>

At times with bad SR configurations, especially during silicon bring-ups,
we could get continuous spurious interrupts which end up hanging the
platform in the form of an ISR call for status bits that are
automatically enabled by the hardware without any software clearing
option.

If we detect scenarios where ISR was called without the corresponding
notification bit being set, instead of hanging up the system,
we will disable interrupt after noting the event in the system log
to try and keep system sanity and allow developer to debug and fix
the condition.

The same condition applies when a notifier does not exist OR is unable
to handle the interrupt as well.

Signed-off-by: Nishanth Menon <[email protected]>
Signed-off-by: Andrii Tseglytskyi <[email protected]>
---
drivers/power/avs/smartreflex.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index 5b2b703..185098f 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -120,8 +120,27 @@ static irqreturn_t sr_interrupt(int irq, void *data)
return IRQ_NONE;
}

- if (sr_class->notify)
- sr_class->notify(sr_info, status);
+ /* Attempt some resemblance of recovery! */
+ if (!status) {
+ dev_err(&sr_info->pdev->dev,
+ "%s: Spurious interrupt!status = 0x%08x."
+ "Disabling to prevent spamming!!\n",
+ __func__, status);
+ disable_irq_nosync(sr_info->irq);
+ } else {
+ /*
+ * If the notifier does not exist OR reports inability to
+ * handle, disable as well
+ */
+ if (!sr_class->notify ||
+ sr_class->notify(sr_info, status)) {
+ dev_err(&sr_info->pdev->dev,
+ "%s: Callback cant handle int status=0x%08x."
+ "Disabling to prevent spam!!\n",
+ __func__, status);
+ disable_irq_nosync(sr_info->irq);
+ }
+ }

return IRQ_HANDLED;
}
--
1.7.9.5

2013-08-05 16:24:21

by Kevin Hilman

[permalink] [raw]
Subject: Re: [PATCH v1 0/2] PM / AVS: interrupt handling fixes

Andrii Tseglytskyi <[email protected]> writes:

> Hi Kevin,
>
> Could you please take a look to the following patch series.
> It consists of two patches, which are needed for proper
> SmartReflex Interrupt handling.

Thanks.

It doesn't appear that these are regression fixes, so I'm queuing for
v3.12.

Kevin (apologies for the major lag, just returning from some time off...)