From patchwork Fri Mar 19 06:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takahiro Kuwano X-Patchwork-Id: 1455657 X-Patchwork-Delegate: tudor.ambarus@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=p/wqDZJE; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=pmJ18/5n; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F1vlm2fKNz9sWP for ; Fri, 19 Mar 2021 17:55:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iSLjm6TPTrdgL5J8ya9tSgBGfDdlLxHNLp+9WNTWi1s=; b=p/wqDZJE2r1ZcPd+NgFLMlpgg iMihKut0YIerYmTGW/nS7siBMLQlf47kaQLLhvA+BLSbnw6Cy8WeMQhgxPMlxy3PVxQo15FwguR6h HiKl+SD3CTWDgiDNwZItcmidqNiSAzkIgWPT1jCLOXCnW/3Fwr/Tj8K2LLwYQ4Ao7yzSG6FR7yWel 9g1ovzfRzVuIgBtwWRtUkNAPAYq6Aga5VzMn9vgDRfaSTWl3y/8uiijnAci5soF5Erb8WxY3iMCZ1 1w+cFReqeSeg0M6POS/Xg4Oy1r/TfuDKHI6o5BnQrigZfc9nK6UhDwUFlnOpKrTldOJ8LYi6OYrql zVZ0AwCpw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lN91U-006jam-Hv; Fri, 19 Mar 2021 06:54:16 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lN91Q-006jZm-30 for linux-mtd@lists.infradead.org; Fri, 19 Mar 2021 06:54:14 +0000 Received: by mail-pj1-x102e.google.com with SMTP id q6-20020a17090a4306b02900c42a012202so4370942pjg.5 for ; Thu, 18 Mar 2021 23:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4Yg/eGXImxTvnSrwDgFoFqHzX5c9qLEci19XioMhm7I=; b=pmJ18/5noSHZcAPcTuI0R8lA7xeC2qEAQToQTpLKdC3w8SYaQoGW8r5RXnSTbuYp/H BQP9sokM4pBbIb2YmDZLFoiIjqHOSqjNKItiThioisyvvOwpwk0xmjSeZPytUvlFPzBa 1q6Ftd/L3NPgmr99NHcLBs8CBk2aqz2Ub6f8Onu7+TA0qc2lSptJV8PkCC/JkEr4eSG1 7NAtF3K22wSYCfV171BCJ2B5bNOazf5JZi3uVtVlrByWR0PZDL+B3+skQicmQTcKOUxP U0Z7oVpOjRtnwfZctyerLae9nNYrhRdGVIbDNYl3n0XyuNoKoNDlNhnpFboajWFVvOOe TWhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4Yg/eGXImxTvnSrwDgFoFqHzX5c9qLEci19XioMhm7I=; b=OHCg9RjeIOpyfY5RCxaiPjlPj2Sqv5rgR68LKt5ZHzIvLHu29/i2fBoHbXS6NQx3bm UHCNTyjt+gczv6cgFO+8mUIzuRDbPkHzNWXmp3OZ4PS+cr9gmTte8Wn7Uk04yojDPDug 9b9GJanzQUpFfZQT9IsCeTrk5WbTg/FV01HgxwQDywSEdQixUqlIP58hAbw/xX+93nAo qO6AGbHWMp4HmM6itIfC17xLIoiIWYohg+ornd4orrlQlMV4UwXDvhb9+4q3FXkTDZsW zBtUdP52py836MdKoH9d1mzD76IbKM9m2uhbibdK6Zv5G3z+eO3yb06msx5dh3jpVcQA xmXw== X-Gm-Message-State: AOAM531zSjDWFh8wDWngEr4ztaTmas+PSJfEHT1s8y9+Y9OafIhETMR/ i9XomRv7N06SoS1TvTNcjcmQa1i1PsGnDg== X-Google-Smtp-Source: ABdhPJxsXJDWBZCvzvqZ6NOYMsw1vgYUvEWaRP5dCPwskvGR0v5GM72GRwvtJKdoaRVe10GFU2NXTg== X-Received: by 2002:a17:902:eb11:b029:e4:a5c3:4328 with SMTP id l17-20020a170902eb11b02900e4a5c34328mr13427047plb.7.1616136850540; Thu, 18 Mar 2021 23:54:10 -0700 (PDT) Received: from ISCNPF1JZGWX.infineon.com (zz20174137476F6254EB.userreverse.dion.ne.jp. [111.98.84.235]) by smtp.gmail.com with ESMTPSA id m5sm4410901pfd.96.2021.03.18.23.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 23:54:10 -0700 (PDT) From: tkuw584924@gmail.com X-Google-Original-From: Takahiro.Kuwano@infineon.com To: linux-mtd@lists.infradead.org Cc: tudor.ambarus@microchip.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, p.yadav@ti.com, Yaliang.Wang@windriver.com, tkuw584924@gmail.com, Bacem.Daassi@infineon.com, Takahiro Kuwano Subject: [PATCH v4 1/6] mtd: spi-nor: core: Add the ->ready() hook Date: Fri, 19 Mar 2021 15:53:46 +0900 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_065412_301908_7B0465A8 X-CRM114-Status: GOOD ( 16.73 ) X-Spam-Score: 0.1 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Takahiro Kuwano This hook can be used for SPI NOR flashes that do not support default status read method. Signed-off-by: Takahiro Kuwano Reviewed-by: Pratyush Yadav --- Changes in v4: - Reword 'legacy' to 'default' in commit description - Rename spi_nor_read() to spi_nor_default_ready() Content analysis details: (0.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:102e listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [tkuw584924[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [tkuw584924[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Takahiro Kuwano This hook can be used for SPI NOR flashes that do not support default status read method. Signed-off-by: Takahiro Kuwano Reviewed-by: Pratyush Yadav --- Changes in v4: - Reword 'legacy' to 'default' in commit description - Rename spi_nor_read() to spi_nor_default_ready() Changes in v3: - New in v3 The purpose is same as the patch introduced by Yaliang Wang. https://patchwork.ozlabs.org/project/linux-mtd/patch/20210301142844.1089385-1-yaliang.wang@windriver.com/ drivers/mtd/spi-nor/core.c | 8 +++++--- drivers/mtd/spi-nor/core.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 0522304f52fa..5de72322ae32 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -785,12 +785,13 @@ static int spi_nor_fsr_ready(struct spi_nor *nor) } /** - * spi_nor_ready() - Query the flash to see if it is ready for new commands. + * spi_nor_default_ready() - Query the flash to see if it is ready for new + * commands. * @nor: pointer to 'struct spi_nor'. * * Return: 1 if ready, 0 if not ready, -errno on errors. */ -static int spi_nor_ready(struct spi_nor *nor) +static int spi_nor_default_ready(struct spi_nor *nor) { int sr, fsr; @@ -826,7 +827,7 @@ static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, if (time_after_eq(jiffies, deadline)) timeout = 1; - ret = spi_nor_ready(nor); + ret = nor->params->ready(nor); if (ret < 0) return ret; if (ret) @@ -2920,6 +2921,7 @@ static void spi_nor_info_init_params(struct spi_nor *nor) params->quad_enable = spi_nor_sr2_bit1_quad_enable; params->set_4byte_addr_mode = spansion_set_4byte_addr_mode; params->setup = spi_nor_default_setup; + params->ready = spi_nor_default_ready; /* Default to 16-bit Write Status (01h) Command */ nor->flags |= SNOR_F_HAS_16BIT_SR; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 4a3f7f150b5d..4d06c27630fe 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -218,6 +218,7 @@ struct spi_nor_locking_ops { * flashes that have peculiarities to the SPI NOR standard * e.g. different opcodes, specific address calculation, * page size, etc. + * @ready: checks if the SPI NOR flash is ready. * @locking_ops: SPI NOR locking methods. */ struct spi_nor_flash_parameter { @@ -238,6 +239,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; };