From patchwork Wed Feb 8 16:53:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 9562829 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 3E2F0601E5 for ; Wed, 8 Feb 2017 17:04:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 170B2284EF for ; Wed, 8 Feb 2017 17:04:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A2DB28505; Wed, 8 Feb 2017 17:04:16 +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 B3926284EF for ; Wed, 8 Feb 2017 17:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbdBHREJ (ORCPT ); Wed, 8 Feb 2017 12:04:09 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36863 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbdBHRDg (ORCPT ); Wed, 8 Feb 2017 12:03:36 -0500 Received: by mail-pf0-f193.google.com with SMTP id 19so12037322pfo.3 for ; Wed, 08 Feb 2017 09:03:36 -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=VcGLdLdqCEcZIj/g1QhD6qUsfILiqbEkJEmu1tMPMUE=; b=QpGu81uTZVg2kmYY1AMyDcHPaOI6heN7VB4FHH7nExp2AlzCLePvUT9uUpvX/2wzQY UHsYb/ljQ1FQ1cm5BBbsiZ9AX4s8SJOKKaNj9CcPCqAVxXykYtY7wbpUnQIC550IxtAp 6wt18IfSnd1veazdCDd1rm+yqJqcMh2TmVf+fEUr1MjF7V2bPNXZmRmtuPi6ekyb0VRb YAh1RB2CyKjaP+yzOSOS72RM2uJQFzUX++WTFoEJs+UvpLrFKVRYtAVoBKa4Xl0VUFq2 XBmXke8fQCqVeHEQ5J5bJ1OrwWDZLhoeBqHzEhupRUh7iLNAlG8QNZf2z07/e8hioQvJ U5Vw== 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=VcGLdLdqCEcZIj/g1QhD6qUsfILiqbEkJEmu1tMPMUE=; b=B7TXRpF0FzrUJ0deifxlLGI6OXF5y7mlVWTQ/6fjNMouvbC+YqJSOkU1ajDXO7tBME XBZ0SSUzd2dOLc9Dk1QRces4/bT8xhkXb7UUS6qy5IxkCHrA0qXpeVPGm4Bl/Vm4H/OO zwdtMcJxJG98P0K6rHwfRcY5O98eoT3JRFc5vfOQgNIBlwFAy4NlBqXyUOk97aTxJmyo p/MUtoa2PsGpo/YtW/1JX1odHQn73q2d46JtY0wsE7E73ktEwrnoUvXXdJyymfI9/qEk a1Z3KE7n1qHj+XEWC9BU+XFR+xvoAj0lgRmcYd/h52YaubZbB6/Q6TImXccavWvoPQ29 ZaJQ== X-Gm-Message-State: AIkVDXJ735xkQLfYT/UOxciV+gzzHy4uYRZ9+Wqcqmiz/6jjEIdeKt0PtIrCakWdSUnzrw== X-Received: by 10.99.64.4 with SMTP id n4mr28052280pga.71.1486572974812; Wed, 08 Feb 2017 08:56:14 -0800 (PST) Received: from mail.broadcom.com ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id q22sm21714703pfj.77.2017.02.08.08.56.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 08:56:14 -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 v2 2/2] mtd: m25p80: Added pm ops support Date: Wed, 8 Feb 2017 11:53:01 -0500 Message-Id: <1486572781-28808-3-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486572781-28808-1-git-send-email-kdasu.kdev@gmail.com> References: <1486572781-28808-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 9cf7fcd..69d309b 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -319,10 +319,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_reset(&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,