Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3892422rwi; Sun, 16 Oct 2022 20:59:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mvE1Z1OsrZHpmM02l/QvJw7dnI681nP5q00k0IdMql7kPwcYO8+CgF7+TjpcVSizkMiXJ X-Received: by 2002:a17:90b:1d04:b0:20b:cb40:4b3 with SMTP id on4-20020a17090b1d0400b0020bcb4004b3mr11051796pjb.215.1665979162897; Sun, 16 Oct 2022 20:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665979162; cv=none; d=google.com; s=arc-20160816; b=jN8SDMOoJo8zpbpKSlDzD2PWSuOoZ+fvAHuqoCClqCb1Vo+bQCB8LNuLBkwE1lPo4x 1avSzZ/JmsdQiZXsYMv2jVGRf/1q40Hmx1nVwNpPVuiMQTaxNtuxj++qwF+J3nNhYlXP wOjaxDs0UERSu5lEG597w5P1eRBBcVRfP2VLjmdQ60Bsk72cpxo1H+1w2dGCjAe4UqwL 8vh/pPHgcLgkDEy0AeuzsK8EhtQeADgqq/W0BpmsVbpiKsgV/QT5nWTSCPw/dH7P915h r9EcMRoHbT+4J0mGDq8IFQVduEEcHu6Qc4RtenlN4c0md3ZhDKh8yzzS6Ajjj3H+hhmB 0C7Q== 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=YhDlhfzmvmUu/uhEF9hQWwp4cDIAjeW8aJwk5TTNUkE=; b=TYWNK4ev7rQZuCASiu4YyZZcRtBQ9eaavMgOjN4xO4Qv1Af9HlBWfZnB9x3FW0he2X W7loscoOvLut7EygKAr1/omXHds9iW1cgFzXeA5/BF/L1hYF0Ow3GhflRWmZ4XPZGude 7kmAGq4Oza3+f3sSCj6xlvo5o5Gxw7+XasmOwHIgHcoJdxPm1SrvEUwg2ltMhK8qAk8p 4gmqtdpd+eWFT+GhQp9xMrDy+brUEOR46DSUACO0s58f5HxrIwO6dsJj1W3zNfGsZbAp DSuuby7NGNQoQLhcOwUhcGUvHpR5jwwugh2AnTQ6dBh/PZvLwvY4HKEbjb4ePlOCOnG5 ypWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b004624e24b4e9si10261322pgd.543.2022.10.16.20.59.10; Sun, 16 Oct 2022 20:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232570AbiJQDls (ORCPT + 99 others); Sun, 16 Oct 2022 23:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbiJQDlo (ORCPT ); Sun, 16 Oct 2022 23:41:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8290E50051 for ; Sun, 16 Oct 2022 20:41:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40EE5B80D4B for ; Mon, 17 Oct 2022 03:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7CEC433D7; Mon, 17 Oct 2022 03:41:39 +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 1/4] irqchip/loongson-htvec: Add suspend/resume support Date: Mon, 17 Oct 2022 11:39:01 +0800 Message-Id: <20221017033904.2421723-2-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221017033904.2421723-1-chenhuacai@loongson.cn> References: <20221017033904.2421723-1-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add suspend/resume support for HTVEC irqchip, which is needed for upcoming 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 1bb414ec6e78..cd4f1a0a1ea8 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 @@ -29,6 +30,7 @@ struct htvec { void __iomem *base; struct irq_domain *htvec_domain; raw_spinlock_t htvec_lock; + u32 saved_vec_en[HTVEC_MAX_PARENT_IRQ]; }; static struct htvec *htvec_priv; @@ -156,6 +158,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) { @@ -188,6 +213,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.31.1