Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1633173pxb; Wed, 2 Feb 2022 09:05:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJym/TlyeHdpD7ErFCS8usLcZ3Op0kVcCfdY9GldWeBogEtymZ8N/U279eGDIsvySwRdmKxF X-Received: by 2002:a17:907:7f04:: with SMTP id qf4mr25704611ejc.152.1643821506989; Wed, 02 Feb 2022 09:05:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643821506; cv=none; d=google.com; s=arc-20160816; b=jfI44JGeFzZPDlzNPfajPFB61XjlkYC12IYc90Lb5a3mI2rhYSfzz6Sik2DQFVN4uT ms+8IrKleES/f7lK34Hq9Cxni4790OLvIPIr3bQvCVkgaiMpKxRj5gIW6Yxyn1XTxwg+ fr3l+IEK6Xa6BqZWwcnhGtu72frWQ+A4U4tqIaIiOc0AmmghEM0etVrOaHElxmIn7XB3 Sbn3tfXDKNgol0uiNv8JGe34xfBZU5IpU1bV8fnmhR8SyX60fihUT0sg9LtIj13JyLiT yM57SZeyPoC1iNPkTwNj367BisUngxlkPLOO4XK6N3mqRmBLsBLTkqxhlX1+6N3xIJS7 764g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2iTA2jTJkIDM2vZHO2WWE0aewRctWW+RyrRZGyus5CU=; b=uq91Lekewi5alrahO4fSr7BnkZOkzrI14FPbM0Xpt97R7VNcvbJJesMZmaenNtNgmr IJJyHuPqifceBWz4vwAZR4nB+zwp/fTrszCLMJhMS45eDhc1NTGI6cl627hG/yxmg9sN 5kSEIDAPeNmhq5cfQJ2rbBwX57ctJULVVdIF2Lad0zMQP9eB7aVPPNvXN5O63xN/Yohq qeftKQM/ijwbkY79+OMJOFG/oOgJSLG/ltHeWdoqwt7QnAKlyEiXUESfCmgzLVCkgIHg tqFRVhkuI0XDesCbM/jS/KKHiLSCDEUOYtisTXQXim0kY0Gy+0Tf9NRkzP1fw5Eun0VK MqAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=reHPc19W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr3si11221232ejc.277.2022.02.02.09.04.41; Wed, 02 Feb 2022 09:05:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=reHPc19W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345333AbiBBO7K (ORCPT + 99 others); Wed, 2 Feb 2022 09:59:10 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:34049 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbiBBO7D (ORCPT ); Wed, 2 Feb 2022 09:59:03 -0500 Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id C0243223EF; Wed, 2 Feb 2022 15:59:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1643813942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2iTA2jTJkIDM2vZHO2WWE0aewRctWW+RyrRZGyus5CU=; b=reHPc19WqarNxL1kXBBxXMfO9y88dz2TiXs0rt5DMooj3A2jv9PKBzPYd/Wj9r4kW8/9co yG36ff0nJiEOf0X9P2OXZGVf1yX59XBEasAsdrpQG0jpYPTwwmwCGWyfpTsgajwODG3v8y WZBNZnjzORrHH0e63oWGH6FJDnriQck= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Michael Walle Subject: [PATCH v1 03/14] mtd: spi-nor: allow a flash to define its own ready() function Date: Wed, 2 Feb 2022 15:58:42 +0100 Message-Id: <20220202145853.4187726-4-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220202145853.4187726-1-michael@walle.cc> References: <20220202145853.4187726-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Xilinx and Micron flashes have their own implementation of the spi_nor_ready() function. At the moment, the core will figure out which one to call according to some flags. Lay the foundation to make it possible that a flash can register its own ready() function. Signed-off-by: Michael Walle --- drivers/mtd/spi-nor/core.c | 4 ++++ drivers/mtd/spi-nor/core.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index c8cc906cf771..c181f2680df2 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -794,6 +794,10 @@ static int spi_nor_ready(struct spi_nor *nor) { int sr, fsr; + /* flashes might override our standard routine */ + if (nor->params->ready) + return nor->params->ready(nor); + if (nor->flags & SNOR_F_READY_XSR_RDY) sr = spi_nor_xsr_ready(nor); else diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 10f478547dc2..446218b0e017 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -261,6 +261,9 @@ struct spi_nor_otp { * SPI NOR flashes that have peculiarities to the SPI NOR * standard e.g. different opcodes, specific address * calculation, page size, etc. + * @ready: (optional) flashes might use a different mechanism + * than reading the status register to indicate they + * are ready for a new command * @locking_ops: SPI NOR locking methods. */ struct spi_nor_flash_parameter { @@ -282,6 +285,7 @@ struct spi_nor_flash_parameter { int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable); u32 (*convert_addr)(struct spi_nor *nor, u32 addr); int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps); + int (*ready)(struct spi_nor *nor); const struct spi_nor_locking_ops *locking_ops; }; -- 2.30.2