From patchwork Mon Nov 16 16:55:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: play4fun X-Patchwork-Id: 545091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FAC8141460 for ; Tue, 17 Nov 2015 03:56:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=qq.com header.i=@qq.com header.b=NUZ2CP3b; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 7805C28098D; Mon, 16 Nov 2015 17:53:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 8842A28057A for ; Mon, 16 Nov 2015 17:53:42 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 16 Nov 2015 17:53:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201307; t=1447692920; bh=rVisQW3Dgn+83BvZ1iJTy0wUOvatR8/ADCxifxmHseE=; h=From:To:Cc:Subject:Date:Message-Id; b=NUZ2CP3bAgzBcbXyc4yF8qcAds+6jVSTlt5sUD3CijsnkKz1kHe75jDmJO46+mjHw KEcKRDi8LaXN9QztRJp/bbBVAvZX0yKN8+BmY9pn6hUPzmcyBlPVg7v6Hjv3pwn/pQ e90FP5e9thC3cxZlaeHqBjz0nfoXxWedvY1YSBGE= X-QQ-mid: esmtp20t1447692919t424t07397 Received: from ubuntu-desktop.lan (unknown [112.95.186.12]) by esmtp4.qq.com (ESMTP) with id ; Tue, 17 Nov 2015 00:55:14 +0800 (CST) X-QQ-SSF: B1010000000000F0F6501F00000000P X-QQ-FEAT: QX/rXDl9P1ue0B5dg8qyH1FUAGFpdyhwt2lCOBRx/Pjo4n1FaOHEqv/sEmfOB a9jng9ICBYoWA4UuldYzAUbUAclegz87x6a8SYXaGVthW/z51JpfBW8tdn+fIhGrY5jAz+d fMo3AXAMrVnKRKsrO3/ETOCDDQ2lH9qQ6A2zVE7QsYhrxQX+s8lq3GtVlstR6Yfy2LifNgh XdcFyRaU9SgaeZpdlIGMoto3D278fLAxozPQtdynmTUJ5/uTyVVGS X-QQ-GoodBg: 0 From: Shonn Lu To: openwrt-devel@lists.openwrt.org Date: Tue, 17 Nov 2015 00:55:10 +0800 Message-Id: <1447692910-27855-1-git-send-email-countrysideboy@qq.com> X-Mailer: git-send-email 1.9.1 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [OpenWrt-Devel] [PATCH] ramips: reset m25p80 when shutdown X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: Shonn Lu --- .../0064-reset-m25p80-when-shutdown.patch | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch diff --git a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch new file mode 100644 index 0000000..aca758d --- /dev/null +++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch @@ -0,0 +1,27 @@ +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -322,6 +322,16 @@ + { + struct m25p *flash = spi_get_drvdata(spi); + ++ if ((&flash->spi_nor)->addr_width > 3) { ++ printk(KERN_INFO "m25p80: exit 4-byte address mode\n"); ++ flash->command[0] = SPINOR_OP_EX4B; // exit 4-byte address mode: 0xe9 ++ spi_write(flash->spi, flash->command, 1); ++ flash->command[0] = 0x66; // enable reset ++ spi_write(flash->spi, flash->command, 1); ++ flash->command[0] = 0x99; // reset ++ spi_write(flash->spi, flash->command, 1); ++ } ++ + /* Clean up MTD stuff. */ + return mtd_device_unregister(&flash->mtd); + } +@@ -385,6 +395,7 @@ + .id_table = m25p_ids, + .probe = m25p_probe, + .remove = m25p_remove, ++ .shutdown = m25p_remove, // add shutdown method to reset spi flash + + /* REVISIT: many of these chips have deep power-down modes, which + * should clearly be entered on suspend() to minimize power use.