From patchwork Wed Apr 12 07:05:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 97290 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp142652qgf; Wed, 12 Apr 2017 00:06:04 -0700 (PDT) X-Received: by 10.84.238.195 with SMTP id l3mr20343187pln.101.1491980764065; Wed, 12 Apr 2017 00:06:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si19427326pfl.7.2017.04.12.00.06.03 for ; Wed, 12 Apr 2017 00:06:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186AbdDLHGD (ORCPT ); Wed, 12 Apr 2017 03:06:03 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:47266 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752979AbdDLHGC (ORCPT ); Wed, 12 Apr 2017 03:06:02 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 361E6207F4; Wed, 12 Apr 2017 09:06:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from qschulz.lan (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 06363207EC; Wed, 12 Apr 2017 09:05:50 +0200 (CEST) From: Quentin Schulz To: nicolas.ferre@microchip.com, broonie@kernel.org Cc: Quentin Schulz , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, alexandre.belloni@free-electrons.com, thomas.petazzoni@free-electrons.com Subject: [PATCH 2/2] spi: atmel: add PM support to SAMA5D2 Date: Wed, 12 Apr 2017 09:05:20 +0200 Message-Id: <20170412070520.29621-2-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170412070520.29621-1-quentin.schulz@free-electrons.com> References: <20170412070520.29621-1-quentin.schulz@free-electrons.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org This adds PM support to the ATMEL SAMA5D2 Xplained. When suspending, VDDCore is shut down and the SPI registers are lost. Thus, the SPI controller needs to be re-initialized after resuming from a system suspend. Signed-off-by: Quentin Schulz --- drivers/spi/spi-atmel.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 247d920..1eb83c9 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1702,8 +1702,17 @@ static int atmel_spi_suspend(struct device *dev) static int atmel_spi_resume(struct device *dev) { struct spi_master *master = dev_get_drvdata(dev); + struct atmel_spi *as = spi_master_get_devdata(master); int ret; + ret = clk_prepare_enable(as->clk); + if (ret) + return ret; + + atmel_spi_init(as); + + clk_disable_unprepare(as->clk); + if (!pm_runtime_suspended(dev)) { ret = atmel_spi_runtime_resume(dev); if (ret)