Re: [PATCH V1 01/12] irqchip: tegra: do not disable COP IRQ during suspend

Thierry Reding
2019-05-22T12:12:49Z

[-- Attachment #1: Type: text/plain, Size: 2379 bytes --]

On Tue, May 21, 2019 at 04:31:12PM -0700, Sowjanya Komatineni wrote:
> BPMP-lite still need IRQ function to finish SC7 suspend sequence for
> Tegra210.
>
> This patch has fix for leaving the COP IRQ enabled for Tegra210 during
> interrupt controller suspend operation.
>
> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
> ---
> drivers/irqchip/irq-tegra.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c
> index 0abc0cd1c32e..1882373fa1fd 100644
> --- a/drivers/irqchip/irq-tegra.c
> +++ b/drivers/irqchip/irq-tegra.c
> @@ -53,18 +53,24 @@ static unsigned int num_ictlrs;
>
> struct tegra_ictlr_soc {
> unsigned int num_ictlrs;
> + bool has_bpmpl;

Maybe spell out "has_bpmp_lite" to avoid potential confusion.

> };
>
> +static const struct tegra_ictlr_soc *soc;
> +

Can you make this a field in struct tegra_ictlr_info to avoid having too
many global variables?

> static const struct tegra_ictlr_soc tegra20_ictlr_soc = {
> .num_ictlrs = 4,
> + .has_bpmpl = false,
> };
>
> static const struct tegra_ictlr_soc tegra30_ictlr_soc = {
> .num_ictlrs = 5,
> + .has_bpmpl = false,
> };
>
> static const struct tegra_ictlr_soc tegra210_ictlr_soc = {
> .num_ictlrs = 6,
> + .has_bpmpl = true,
> };
>
> static const struct of_device_id ictlr_matches[] = {
> @@ -157,7 +163,8 @@ static int tegra_ictlr_suspend(void)
> lic->cop_iep[i] = readl_relaxed(ictlr + ICTLR_COP_IEP_CLASS);
>
> /* Disable COP interrupts */
> - writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
> + if (!soc->has_bpmpl)
> + writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);

Maybe adjust the comment to explain. It may not immediately be obvious
to anyone how BPMP-lite is related to COP.

>
> /* Disable CPU interrupts */
> writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR);
> @@ -286,7 +293,6 @@ static int __init tegra_ictlr_init(struct device_node *node,
> {
> struct irq_domain *parent_domain, *domain;
> const struct of_device_id *match;
> - const struct tegra_ictlr_soc *soc;

As mentioned above, perhaps keep this here and assign this to lic->soc
later on so that we have only a single global variable.

Thierry

> unsigned int i;
> int err;
>
> --
> 2.7.4
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]