Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1345301pxb; Thu, 16 Sep 2021 05:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPbCY7TiereZYGdaeVvMbEE18dfSrCTeWvAtsb6IjRNvoTtIurvN9Bv7N52SFMMWNTqc3/ X-Received: by 2002:a05:6602:2cc5:: with SMTP id j5mr4213912iow.156.1631795947580; Thu, 16 Sep 2021 05:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631795947; cv=none; d=google.com; s=arc-20160816; b=vyCa7s0tJHuNB5SXBYVfvqnD2pwVW9jkYRPe6UV3MkffLKnec4178uwPnkiTEUkwVk U/RA3YzNVSKwiPKeOKrE59vxFlLrV1kMr0RxnAbR38R/2NZPxYj1pj+/HN1vGkMc3ZC5 03c249n+Bg9rTbbAkprWj75oYOv6Kzv6DlXHsTXCxLX52hdYtT1RIJnOZumMPS/1Z8eN bbIxqS5oxNml8B00dTlMTL7oHkLnL2PQ2gVNulml7awd8xjFUrEUv5Fp1rQ8/B8BEJrk UGm0XZ8frVvvD8VdgVnBEicSQ5g7+P40Sata3pxdEJIRhm+Ylo0DY9IPH/U5uOiqd7Xs k62Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5DOEySscEzj3Zqps1XpZElaMPVJfAAKDb+wouF6HNE8=; b=oo0CVaT7uUbZWVucWNdi57Eep9+9qssqFwr3bQXHBH/buGLXm0YpDSWwTWJhnuMkf5 G6N34KDZCWgYIqmojfsts1AJl9n301k1U3SKg8JCaDwkOwxrmQn1yjJBH77wNn9kUaJb uu/zq0ZQVQqg+XMctMSRcnGzV5+kog4aE2RQ+G3WKvKY8GLrb9mr3SsTlP5HwS7wOE7A yOKNoPFKqP/EoXlhLH6Vn1UOiELGX0CpcIlhreZbXS7cMNVDw9QsjfBBjMRig2JQDsEC TOKYF5F9rkOTOtn4gICLadXew/vxtUUTrJmag1bTb7pjm1OjJ1oS8SwN+fVR1OlvqbNm paww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si2367996ilc.181.2021.09.16.05.38.55; Thu, 16 Sep 2021 05:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239473AbhIPMje (ORCPT + 99 others); Thu, 16 Sep 2021 08:39:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235750AbhIPMjd (ORCPT ); Thu, 16 Sep 2021 08:39:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46FAB60F6D; Thu, 16 Sep 2021 12:38:11 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V5 06/10] irqchip/loongson-htvec: Add suspend/resume support Date: Thu, 16 Sep 2021 20:31:34 +0800 Message-Id: <20210916123138.3490474-7-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210916123138.3490474-1-chenhuacai@loongson.cn> References: <20210916123138.3490474-1-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add suspend/resume support for HTVEC irqchip, which is needed for suspend/hibernation. Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-htvec.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c index f54c9ccbd69e..82adb2615013 100644 --- a/drivers/irqchip/irq-loongson-htvec.c +++ b/drivers/irqchip/irq-loongson-htvec.c @@ -16,6 +16,7 @@ #include #include #include +#include /* Registers */ #define HTVEC_EN_OFF 0x20 @@ -30,6 +31,7 @@ struct htvec { struct irq_domain *htvec_domain; raw_spinlock_t htvec_lock; struct fwnode_handle *domain_handle; + u32 saved_vec_en[HTVEC_MAX_PARENT_IRQ]; }; struct htvec *htvec_priv; @@ -157,6 +159,29 @@ static void htvec_reset(struct htvec *priv) } } +static int htvec_suspend(void) +{ + int i; + + for (i = 0; i < htvec_priv->num_parents; i++) + htvec_priv->saved_vec_en[i] = readl(htvec_priv->base + HTVEC_EN_OFF + 4 * i); + + return 0; +} + +static void htvec_resume(void) +{ + int i; + + for (i = 0; i < htvec_priv->num_parents; i++) + writel(htvec_priv->saved_vec_en[i], htvec_priv->base + HTVEC_EN_OFF + 4 * i); +} + +static struct syscore_ops htvec_syscore_ops = { + .suspend = htvec_suspend, + .resume = htvec_resume, +}; + static int htvec_init(phys_addr_t addr, unsigned long size, int num_parents, int parent_irq[], struct fwnode_handle *domain_handle) { @@ -190,6 +215,8 @@ static int htvec_init(phys_addr_t addr, unsigned long size, htvec_priv = priv; + register_syscore_ops(&htvec_syscore_ops); + return 0; iounmap_base: -- 2.27.0