Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757713AbcJXQe2 (ORCPT ); Mon, 24 Oct 2016 12:34:28 -0400 Received: from smtpout.microchip.com ([198.175.253.82]:44679 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757499AbcJXQe1 (ORCPT ); Mon, 24 Oct 2016 12:34:27 -0400 From: Cyrille Pitchen To: , CC: , , , , , Cyrille Pitchen Subject: [PATCH v3 1/9] mtd: spi-nor: improve macronix_quad_enable() Date: Mon, 24 Oct 2016 18:34:38 +0200 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFtrFrMTGxcLF5cOiK2TBF2Hw6t2xDi6LjimrmCzufdrGaDFt+jtmi/vXTrNYXJ+3j9liQ/taJge2AIYo1sy8pPyKBNaMeZMvMRbcZq9oOT2RvYFxC1sXIxeHkMB6RolnM6czdzFycrAJGEq8fXCUtYuRg0NEwEHi2gR9kBpmgc2MEvvP3mUEqREWcJG48mwzmM0ioCox5+1GMJtXIF5iz7NXYLaEgJzEzXOdYDM5BWwlNk+AqBcSsJFY9+01VL2gxMmZT1hAbGYBCYmDL14wQ9SoSSxsWcEMMSdQ4umU50wQtpPEzuVTWSBsO4nD0y+yQ9gOEkt/z2GHqWlf+oYVwtaW2P5qH5StI7HtYD9Ur63EnhkToWa6Szx4tBzK9pWY9bABqiZK4u28UywTGCVmITl1FpJTFzAyrWKUdvbw0w0O03WNcPYwMNXLTc4o0M1NzMzTS87P3cQIiaysHYy9k/ylGhg3BzndnBadoOO6W3VPRMTCc2EqPkVPTlmfcKn6F5N6lLVWcs9bg4eV55Miz70rOdhfYiq/aN690JNhvYZCCy0brobt2HfWcxmT9qWkDQZPJq1lehFW/eDvTIcfD1dO7nThalpQlbzoTJjKckYD78//e2rKZn01+O58lXnZKZ+KxjlfVieIJPxUYinOSDTUYi4qTgQAXPyx+00CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 956 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..5c87b2d99507 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_info(nor->dev, "setting Macronix Quad Enable (non-volatile) bit\n"); write_enable(nor); write_sr(nor, val | SR_QUAD_EN_MX); -- 2.7.4