From patchwork Tue Feb 14 15:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13140409 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 7272BC05027 for ; Tue, 14 Feb 2023 15:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=TgVkF9pr/HzThzXZ8TSAc9EU4yXX1/FuopcO/VGoEUc=; b=qbaFonJt2YtLPT 2mgGrJMc2BwXS1LTJ80YEhREp0cYuaTxb8CEF9K7Xs7Frg7yllD4P5XGA8a1yzA2U60eLXtzna1kH 27p8RZC0OnNJL75zg93M1yHc9Id85kkBF3bGRSkiEW5zOZzkeN0hHDBgU6P8hkZOJriupKFyZGmhg nAllcF5T9jOA+SYyQKRbFOKwIePff/ieFNo4itGfzTp7BnTHen2RB2rTTttGrh9y8vXEf/gTB0gaw CnGsWsokpRGHi4fTE33y3osScosdXPpMUwvV21Cqao9X1zUUfl/Anwf8Ta1cgfF2U+HRanaOT4S3f Z+NWAiv2ZaNLk6opYjug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRx7d-002Vgf-3D; Tue, 14 Feb 2023 15:21:33 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRx79-002VT6-Ts for linux-arm-kernel@lists.infradead.org; Tue, 14 Feb 2023 15:21:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676388064; x=1707924064; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0CtvDEh2vlSrMf1WczKNd8+6RrD0e9Y436UeDqUellw=; b=DKjuaC3/KhLPChvKMiNs8Pf+iwJkzaJpr/tpxtT55DCw8wEBhGXvHKH3 12k53W6M4NaUBVJgxC42E5ML/wt7TyF9uqrw5WDvie+d/7U8YHhD7BDgJ ITyhqD375pjUTrF9vBwH1mb1lIxLw+A3kn2eiRlS7J1pA8RCMwS6IGUn0 eJO/FkH+M9bKgsKWlOZwNtxdRL2byLpaCRjZv9nfujoibZPSONi/g9Oif bmyHnOcoq/8xBevwiV62SqK02pGxIaXu9LgrcHz4SwILBvVpC3HvpZiQk Me8NDbIEsBAbDz0Icvzilulz42M4DSvKfdXXDCrCJ8+5kT5ETtoeeu8Zj g==; X-IronPort-AV: E=Sophos;i="5.97,296,1669100400"; d="scan'208";a="196877741" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 14 Feb 2023 08:20:53 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 14 Feb 2023 08:20:52 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Tue, 14 Feb 2023 08:20:49 -0700 From: Claudiu Beznea To: , , , CC: , , , Claudiu Beznea Subject: [PATCH 4/7] dmaengine: at_xdmac: restore the content of grws register Date: Tue, 14 Feb 2023 17:18:24 +0200 Message-ID: <20230214151827.1050280-5-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230214151827.1050280-1-claudiu.beznea@microchip.com> References: <20230214151827.1050280-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230214_072104_063152_DF7E7342 X-CRM114-Status: GOOD ( 10.54 ) 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 In case the system suspends to a deep sleep state where power to DMA controller is cut-off we need to restore the content of GRWS register. This is a write only register and writing bit X tells the controller to suspend read and write requests for channel X. Thus set GRWS before restoring the content of GE (Global Enable) regiter. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver") Signed-off-by: Claudiu Beznea --- drivers/dma/at_xdmac.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index fa1e2e0da02f..34c004a4b23c 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -2211,6 +2211,15 @@ static int __maybe_unused atmel_xdmac_resume(struct device *dev) return ret; at_xdmac_device_resume_internal(atchan); } + + /* + * We may resume from a deep sleep state where power + * to DMA controller is cut-off. Thus, restore the + * suspend state of channels set though dmaengine API. + */ + else if (at_xdmac_chan_is_paused(atchan)) + at_xdmac_device_pause_set(atxdmac, atchan); + at_xdmac_chan_write(atchan, AT_XDMAC_CNDA, atchan->save_cnda); at_xdmac_chan_write(atchan, AT_XDMAC_CNDC, atchan->save_cndc); at_xdmac_chan_write(atchan, AT_XDMAC_CIE, atchan->save_cim);