From patchwork Thu Aug 7 01:17:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 377704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 740AC140095 for ; Thu, 7 Aug 2014 11:22:35 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFCOK-00039B-Ei; Thu, 07 Aug 2014 01:21:16 +0000 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFCO7-0002zZ-GG for linux-mtd@lists.infradead.org; Thu, 07 Aug 2014 01:21:04 +0000 Received: by mail-pd0-f176.google.com with SMTP id y10so4240397pdj.35 for ; Wed, 06 Aug 2014 18:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WcC4VsSZFkEPfTRx6d4rcjo8zwN488qV38sI95vceXk=; b=b7+OCBG5vvm6AnjzU1dK322e6Sp8ervN/5KAWqX2X7WJKT66zpO5hiJPhXykPG3RCp FMjP6cswWWKzxzCWNEgSZUi2yCjmWB8n5aV2XJDxX5zkMK2E50z59DQ3n2DeCChMpHnA Os+TcUXuZHCTb+v2MIfIJnmpd766ybw/8ZfmaZu84hoAgugieX001/ynYfFyIIiHeqkc tbYhpt7BYunGGVwFJaLtwFxorzJs0Gsdw5H+GlNbifRo4m8TZo97ynEO4uPyUMGKQIGn /wGAoUhY369XWGBvYKyf1piX3Zbi40p8NVCPwO7Wx517DXtr2b9Lfea+80W3BJVtYPCv mE/g== X-Received: by 10.66.66.135 with SMTP id f7mr14836648pat.32.1407374443661; Wed, 06 Aug 2014 18:20:43 -0700 (PDT) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id ct1sm3801242pdb.59.2014.08.06.18.20.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Aug 2014 18:20:43 -0700 (PDT) From: Brian Norris To: Subject: [PATCH 6/8] mtd: spi-nor: drop replaceable wait-till-ready function pointer Date: Wed, 6 Aug 2014 18:17:00 -0700 Message-Id: <1407374222-8448-7-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407374222-8448-1-git-send-email-computersforpeace@gmail.com> References: <1407374222-8448-1-git-send-email-computersforpeace@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140806_182103_613153_B9C65DBD X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c02:0:0:0:230 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Cc: Marek Vasut , Huang Shijie , Brian Norris , zajec5@gmail.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We don't need to expose a 'wait-till-ready' interface to drivers. Status register polling should be handled by the core spi-nor.c library, and as of now, I see no need to provide a special driver-specific hook for it. Signed-off-by: Brian Norris Reviewed-by: Marek Vasut --- drivers/mtd/spi-nor/spi-nor.c | 27 ++++++++++----------------- include/linux/mtd/spi-nor.h | 2 -- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 227e2743203e..874e6d9a0b02 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -193,6 +193,10 @@ static int spi_nor_ready(struct spi_nor *nor) return sr && fsr; } +/* + * Service routine to read status register until ready, or timeout occurs. + * Returns non-zero if error. + */ static int spi_nor_wait_till_ready(struct spi_nor *nor) { unsigned long deadline; @@ -214,15 +218,6 @@ static int spi_nor_wait_till_ready(struct spi_nor *nor) } /* - * Service routine to read status register until ready, or timeout occurs. - * Returns non-zero if error. - */ -static int wait_till_ready(struct spi_nor *nor) -{ - return nor->wait_till_ready(nor); -} - -/* * Erase the whole flash memory * * Returns 0 if successful, non-zero otherwise. @@ -712,7 +707,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, /* write one byte. */ nor->write(nor, to, 1, retlen, buf); - ret = wait_till_ready(nor); + ret = spi_nor_wait_till_ready(nor); if (ret) goto time_out; } @@ -724,7 +719,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, /* write two bytes. */ nor->write(nor, to, 2, retlen, buf + actual); - ret = wait_till_ready(nor); + ret = spi_nor_wait_till_ready(nor); if (ret) goto time_out; to += 2; @@ -733,7 +728,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, nor->sst_write_second = false; write_disable(nor); - ret = wait_till_ready(nor); + ret = spi_nor_wait_till_ready(nor); if (ret) goto time_out; @@ -744,7 +739,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, nor->program_opcode = SPINOR_OP_BP; nor->write(nor, to, 1, retlen, buf + actual); - ret = wait_till_ready(nor); + ret = spi_nor_wait_till_ready(nor); if (ret) goto time_out; write_disable(nor); @@ -790,7 +785,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, if (page_size > nor->page_size) page_size = nor->page_size; - ret = wait_till_ready(nor); + ret = spi_nor_wait_till_ready(nor); if (ret) goto write_err; @@ -816,7 +811,7 @@ static int macronix_quad_enable(struct spi_nor *nor) nor->cmd_buf[0] = val | SR_QUAD_EN_MX; nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); - if (wait_till_ready(nor)) + if (spi_nor_wait_till_ready(nor)) return 1; ret = read_sr(nor); @@ -898,8 +893,6 @@ static int spi_nor_check(struct spi_nor *nor) if (!nor->read_id) nor->read_id = spi_nor_read_id; - if (!nor->wait_till_ready) - nor->wait_till_ready = spi_nor_wait_till_ready; return 0; } diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 603ac0306663..d7c12506d7ed 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -146,7 +146,6 @@ enum spi_nor_option_flags { * @write_reg: [DRIVER-SPECIFIC] write data to the register * @read_id: [REPLACEABLE] read out the ID data, and find * the proper spi_device_id - * @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready * @read: [DRIVER-SPECIFIC] read data from the SPI NOR * @write: [DRIVER-SPECIFIC] write data to the SPI NOR * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR @@ -179,7 +178,6 @@ struct spi_nor { int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len, int write_enable); const struct spi_device_id *(*read_id)(struct spi_nor *nor); - int (*wait_till_ready)(struct spi_nor *nor); int (*read)(struct spi_nor *nor, loff_t from, size_t len, size_t *retlen, u_char *read_buf);