From patchwork Tue Feb 14 15:32:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 9572137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A550160578 for ; Tue, 14 Feb 2017 15:33:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9992B2022B for ; Tue, 14 Feb 2017 15:33:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E7E328408; Tue, 14 Feb 2017 15:33:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BA122022B for ; Tue, 14 Feb 2017 15:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754016AbdBNPdE (ORCPT ); Tue, 14 Feb 2017 10:33:04 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:34614 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbdBNPdE (ORCPT ); Tue, 14 Feb 2017 10:33:04 -0500 Received: by mail-ot0-f196.google.com with SMTP id 73so17476241otj.1 for ; Tue, 14 Feb 2017 07:33:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e83jU1+8DccMEuHd1dyjNosc7ue825jfbQ757dpttCc=; b=eUFjo6z0WyyjFezsxZBJ3U3bWyz1AMDOOXImuc6LtxA1Zoydk7Ju9bAq3YgDml7Zrt 33h6/qIZnRbJMsVw0gPR0231LkAFr7wlwaxzBOqZcAtzzWo09nbbK4sK8PnzCG0vDakE MowIEMkzeHymRD6wUMtd6mciDqrx4+2Sc5XAMxuHm9+HDWkur4GCUalVMFvWuQgwlZMM QxUAWmUUrI+JVqokY9V9WhWyMxArGJ67rGxO2ctm6UUtEaWZxa1p7juN9oGbTR1eui1P gnDtazEDNK2AGVmvKUwI1NHfiWpmDyBi7h/A7yWQtlQoqRpRWVEQnY4KNUbq0kRvoh5W Jtpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e83jU1+8DccMEuHd1dyjNosc7ue825jfbQ757dpttCc=; b=Tjy5JbSWWzht8t/LpusmHaIx8ov94PjUV4GTy/+d7Nw0tb2qTi325/+Jj1C8ccmd51 qxVVq65bIzj9AbpRxwUVJHkuwKwSQ1XF3W8a1uKfazFE2gWG6+TGU0w1wmVOyfRzPY2j PZiLgJ1u4hfQ6QXJOA49ImqRGXhWygYESOwRvniInqUQ1tPPr6Z1PBdam8k4lzJEdAF9 aEqJ+c5TLji9MqUbCihL8/6Hb9jqy3jzL1G6Z+zN5PSf1Kzf20usdMrUD8sHP5bEurFI m4UlPAumLdBFUc0dqWn86Zg800oD4aQ3/7dX8P6pJAyJiZ2CrFOJFiDv97SB6EhZZ5VJ qQ8g== X-Gm-Message-State: AMke39k9mhHgjngBdTkpto4cfZflaOJcDSup2V8MsjuI+aDE8h5cRLKfgLrnx0Fl7TMPlg== X-Received: by 10.98.34.82 with SMTP id i79mr31819716pfi.120.1487086383268; Tue, 14 Feb 2017 07:33:03 -0800 (PST) Received: from mail.broadcom.com ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id a2sm2059794pfc.72.2017.02.14.07.33.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Feb 2017 07:33:02 -0800 (PST) From: Kamal Dasu To: linux-spi@vger.kernel.org, cyrille.pitchen@atmel.com, marex@denx.de, broonie@kernel.org Cc: linux-mtd@lists.infradead.org, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, Kamal Dasu Subject: [PATCH v4 2/2] mtd: m25p80: Added pm ops support Date: Tue, 14 Feb 2017 10:32:48 -0500 Message-Id: <1487086368-4118-3-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487086368-4118-1-git-send-email-kdasu.kdev@gmail.com> References: <1487086368-4118-1-git-send-email-kdasu.kdev@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added power management ops for resume to be able to resan spi-nor device and set it to right transfer modes in its probed state after poweron. Some SoC implementations might power down the spi-nor flash and loose its initial settings on suspend. A resume should retore the part to its probed state. Signed-off-by: Kamal Dasu --- drivers/mtd/devices/m25p80.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index c4df3b1..3ab30b2 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -324,10 +324,21 @@ static int m25p_remove(struct spi_device *spi) }; MODULE_DEVICE_TABLE(of, m25p_of_table); +#ifdef CONFIG_PM_SLEEP +static int m25p_resume(struct device *dev) +{ + struct m25p *flash = dev_get_drvdata(dev); + + return spi_nor_init(&flash->spi_nor); +} +#endif +static SIMPLE_DEV_PM_OPS(m25p_pm_ops, NULL, m25p_resume); + static struct spi_driver m25p80_driver = { .driver = { .name = "m25p80", .of_match_table = m25p_of_table, + .pm = &m25p_pm_ops, }, .id_table = m25p_ids, .probe = m25p_probe,