Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754005AbcKUOQ2 (ORCPT ); Mon, 21 Nov 2016 09:16:28 -0500 Received: from smtpout.microchip.com ([198.175.253.82]:41379 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753706AbcKUOQ1 (ORCPT ); Mon, 21 Nov 2016 09:16:27 -0500 From: Cyrille Pitchen To: , , , , CC: , , Cyrille Pitchen Subject: [PATCH v4 1/8] mtd: spi-nor: improve macronix_quad_enable() Date: Mon, 21 Nov 2016 15:15:40 +0100 Message-ID: <1a9d62bf291ca22516ffb9049d22e6b87830782d.1479736401.git.cyrille.pitchen@atmel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFtrJrMTGxcLF5cOiu4vROMLgx8ypbcwWHVNWMVlcn7eP2eL+tdMsFhva1zJZ3Pu0jdFi2vR3zA5sAQxRrJl5SfkVCawZ+7ctYCm4xV7xpXcxewPjZrYuRk4OIYH1jBIf71WD2GwChhJvHxxl7WLk4hARmMgocXLyF1aQBLNAlkTvmdlADRwcwgIuEnteWYGEWQRUJe6c28IMYvMKxEsse/uZBcSWEJCTuHmuEyzOKWArsWLBSkaIXTYSby4sZISoF5Q4OfMJC8R4CYmDL14wQ9SoSSxsWcEMMSdQYu6Rr2wQtpPEzuVToebbSRyefpEdwnaQWPp7DjtMTfvSN6wQtrbE9lf7oGwdiW0H+6F6bSX2zJjIBGG7Szx4tBzK9pWY9bABqiZK4u28UywTGCVmITl1FpJTFzAyrWKUdvbw0w0O03WNcPYwMNXLTc4o0M1NzMzTS87P3cQIiausHYy9k/ylGhi5OHXigg3s59qfUt4stedt1b0JFYun2eseP5x5d3K+nYfWbGvHu2zLXXZvCrqzSPP9fJ0WVqsr9veEDScF9LG3FMybcPdiYYDmz6D7D+7rvE6Ybr0xM+7YrSNs7xpZ1x+b1tkVscwtZm+kzIrM1m5XC560hUycGZv3FE1VddL/1Pu+QNqa4awSS3FGoqEWc1FxIgB+/rLZTAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 955 Lines: 29 The patch checks whether the Quad Enable bit is already set in the Status Register. If so, the function exits immediately with a successful return code. Otherwise, a message is now printed telling we're setting the non-volatile bit. Signed-off-by: Cyrille Pitchen Reviewed-by: Jagan Teki --- drivers/mtd/spi-nor/spi-nor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index d0fc165d7d66..7ff807211e1e 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1211,6 +1211,11 @@ static int macronix_quad_enable(struct spi_nor *nor) val = read_sr(nor); if (val < 0) return val; + if (val & SR_QUAD_EN_MX) + return 0; + + /* Update the Quad Enable bit. */ + dev_dbg(nor->dev, "setting Macronix Quad Enable (non-volatile) bit\n"); write_enable(nor); write_sr(nor, val | SR_QUAD_EN_MX); -- 2.7.4