From patchwork Tue Jan 28 12:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 13952513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88ADDC02193 for ; Tue, 28 Jan 2025 12:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pWl1eEN1iUk9ieX08HFfz+2vM8A6BpuZsHouPY02aXE=; b=J8x7M96N1JICUesKZXb+D7xiVP PE6xrbuG3vTJ5fq+al7YdYMzgs5CKhs+v/RVC7CTLW0aMH2A/7kFHNxEZTWpwSdSSjuex4oK47BBW LGiT2Na8QaZAMIff0YfA/CxGdAcfE5kf4URctIs5eRzhcxZQkv+JxWnVPWAEoW2VEWoK6v44K5NNp nn8ngG8UvzIg0JUWYyPEnhALd/6IMO1QccUn2qYhjJYqxIkbUYvTXVffs9nL62gt6jqxdFcCI/a4A lJfUY4EqF1h17MDV/SjuiCCIUqr7J/Muuw00eZ99jyLvSQdXnR8U26dcrOA909xB0oEg7e8Y2/R5l O11322wQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tckYz-00000004rqU-15sa; Tue, 28 Jan 2025 12:19:29 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tckSS-00000004qcs-3olF for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2025 12:12:46 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50S9U0m5025055; Tue, 28 Jan 2025 13:12:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= pWl1eEN1iUk9ieX08HFfz+2vM8A6BpuZsHouPY02aXE=; b=mlU/4WKCQL6qIvej QuMrAiTViBG7wQ0V4qSgelm+pO/bAF9fhRId5E1S+S/H9+XAwZUx0KFeVoNnS4ym wH47fvW8q13O4JNKzI459UbTiIkuXvRhKpkbzYjILeexF+n7RBuAXAnts/3p6L7R LI5c975SGlknRpC1eHTM9y/Rjhz6LmSvBNgFkn+QsHR8nfcOBNRs61d6X5NbT7iH A4GFM+/pN3ddtmHFeiWoPkvIt01wUcynxtCPioMJzJ1OuXuDJo3kaGOpOBojyGHJ nKtkxSVeHUbwRRIx8Kdk5jQsYbI1F5Q1hE0zjwX6/tYhHxhQ6Unwxs99lC997ioT FOLmAA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 44ebcbktnx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2025 13:12:27 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 23C884004B; Tue, 28 Jan 2025 13:11:06 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id F24B82CE641; Tue, 28 Jan 2025 13:08:11 +0100 (CET) Received: from localhost (10.129.178.212) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 28 Jan 2025 13:08:11 +0100 From: Christian Bruel To: , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v4 02/10] PCI: dwc: Add dw_pcie_wake_irq_handler helper Date: Tue, 28 Jan 2025 13:07:37 +0100 Message-ID: <20250128120745.334377-3-christian.bruel@foss.st.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250128120745.334377-1-christian.bruel@foss.st.com> References: <20250128120745.334377-1-christian.bruel@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.178.212] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-28_04,2025-01-27_01,2024-11-22_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250128_041245_240551_844E103D X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce dw_pcie_wake_irq_handler function to support host wakeup from the WAKE# irq. Signed-off-by: Christian Bruel --- drivers/pci/controller/dwc/pcie-designware-host.c | 15 +++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index ef4799effa03..5a67bee5bf3c 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "../../pci.h" #include "pcie-designware.h" @@ -1054,3 +1055,17 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci) return ret; } EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq); + +irqreturn_t dw_pcie_wake_irq_handler(int irq, void *arg) +{ + struct device *dev = arg; + + dev_dbg(dev, "host wakeup by EP"); + + /* Notify PM core we are wakeup source */ + pm_wakeup_event(dev, 0); + pm_system_wakeup(); + + return IRQ_HANDLED; +} +EXPORT_SYMBOL_GPL(dw_pcie_wake_irq_handler); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f8bf9c89a152..f54cf7b01cbd 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -511,6 +511,8 @@ void dw_pcie_edma_remove(struct dw_pcie *pci); int dw_pcie_suspend_noirq(struct dw_pcie *pci); int dw_pcie_resume_noirq(struct dw_pcie *pci); +irqreturn_t dw_pcie_wake_irq_handler(int irq, void *arg); + static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val) { dw_pcie_write_dbi(pci, reg, 0x4, val);