From patchwork Fri Feb 10 21:49:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 9567557 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 073EA601EA for ; Fri, 10 Feb 2017 22:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E531D285E5 for ; Fri, 10 Feb 2017 22:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8855285E7; Fri, 10 Feb 2017 22:10:51 +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 8BF0D285E5 for ; Fri, 10 Feb 2017 22:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751243AbdBJWKv (ORCPT ); Fri, 10 Feb 2017 17:10:51 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36561 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbdBJWKu (ORCPT ); Fri, 10 Feb 2017 17:10:50 -0500 Received: by mail-wr0-f195.google.com with SMTP id k90so16406165wrc.3 for ; Fri, 10 Feb 2017 14:10:50 -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=holTK6u5lG14QR3VYIPYP/k5zC8CSM2dnn2X1G3JzRI=; b=Ko7khPgkH8oRj1/pmUUTIDiveNdnbSW8GiyMwM7UpOvxNCetIEhjlET6qxYyzaInl+ EgRqY7zrfKWfLPzqG9Cu/0eTXu5KCAuTfTu1dsS4Cb+gAAJecpZaoIc1IzSt+Gb6mOQt IPeU22ECVOyJL6PXEyAE7Lq76RNotsteN7TGu9F5Wd0ysGE35VMuEZEyJn9o2wviRETN ZM8DLRp08NTA6vE11Po/PRAbIqe364Np3W1tfvt44swdiiMIVn7x1pZGVKnPtsIzoTiG Jw0nI/SR+3P7UYCBh47p+NJQHaitypQWEtgUKqt/wZh5KANqLRVuK8yHFWbXvrEM4Y2D 62vQ== 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=holTK6u5lG14QR3VYIPYP/k5zC8CSM2dnn2X1G3JzRI=; b=l2EexIWzAuT3uLICZhyZDGGxwr0ydxiVwT23GlJueW76zTYHdrqeSd23luXmfPWuFf Lxy3F25uC1aNoxbmYKUIlxQn3ShQUMOnXZtIe63BRsxE9+uAGIHA4yTflcUiQlCRLjFV /vy1ZQ/RhBf8t3DU8Af0XLD98u8dpJuFj4dHf/W0PrvqLEldgi++cblsH44gs5p75Gku mLPAyYZ7Q1ouiTp5kGiZBQ/qMXKhMHkQ/jWFlt8UWUxldqX/tbUP1jcQRm3ku7uz0OkX YEMhiuIQf+nNsB08FHrCg2YJiMlfT5c2zwwyv7CNbzIH/Csad6Ndfa0LmuLhP6/Njgg0 jd8Q== X-Gm-Message-State: AMke39lOvATVQ6sZq2pQXG+3FgxNqw/RHoLpplIa5BSTEtqV1f2VBuBImlKwe+Zalv4Zsw== X-Received: by 10.223.171.65 with SMTP id r1mr9311635wrc.38.1486764649456; Fri, 10 Feb 2017 14:10:49 -0800 (PST) Received: from mail.broadcom.com ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id u184sm1251473wmb.29.2017.02.10.14.10.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Feb 2017 14:10:49 -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 v3 2/2] mtd: m25p80: Added pm ops support Date: Fri, 10 Feb 2017 16:49:29 -0500 Message-Id: <1486763369-31969-3-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486763369-31969-1-git-send-email-kdasu.kdev@gmail.com> References: <1486763369-31969-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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index c4df3b1..be94fba 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -324,10 +324,26 @@ static int m25p_remove(struct spi_device *spi) }; MODULE_DEVICE_TABLE(of, m25p_of_table); +#ifdef CONFIG_PM_SLEEP +static int m25p_suspend(struct device *dev) +{ + return 0; +} + +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, m25p_suspend, 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,