From patchwork Tue Jul 27 04:51:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510279 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=PhRtOOVI; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=0kp2l65Y; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYkwY4yg0z9sWl for ; Tue, 27 Jul 2021 14:54:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=S4py8lFh+WnpTz8kJYjlT750Cq/fqdpS2/Uwkt5SAfs=; b=PhRtOOVIP3Poi3 EGxL/t3rq/cUTOzNsUe0eFyUYRKrbdCOP0/+ZfRIT8ScYteX0GKA+ielD86oeubeFtSgqChJC5zG/ hMkV+yD902YmLUmy/YygnyJ0GaVMLv4rTyUFf18hMWQydiUIIWs8Ff0BGfhElX3wvv/kqckdz+ePr VUpxnao0UvUg/K52Kd7ew833ojvpJoNBYtEXILh2aCCdfVgSKDpTXuNGkOgstw9Yp3xJK8C/ccYe1 Vlcy+IvAJppAB/OmxIBDXFqNYWB0s6MAceI8QWi/gTWy3cy0KKce9aHCyD8xqqjRHzevjXvEWH1wC UMu0zYNR6jOlSmzhH6Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F63-00DHdv-C6; Tue, 27 Jul 2021 04:53:39 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F52-00DHNg-Jz; Tue, 27 Jul 2021 04:52:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361556; x=1658897556; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KwrvnfvQjSCqvGkjRSxIvckxcUAqvwi0R3Sjw3cBkmA=; b=0kp2l65Y0boveiRhiZoUPpjQxBwHpsVWrXLkr7GoC10X0b9gScrh9jm6 frBDV0MeOiqj4irL2GBW+AL5NLFpUIhJMeFKLJnlB6hE2uCYHZPdOd+6o 7GFdSO2r9CGZ59p7LEAp4vjeTZs4+nduBmFjyaUAMOJOW4F57UxV+eDPV 7pvFVvxJU78nQ2CnhT9cTECWA79CLtT9hfu2mvtU1DwDNusvX562NPDrZ x3nowW13Q32tKMrjZ7kxb/RZ7/vvk9POywRrpnjuIdhAjb3ZOJVJr8ll/ XehhnKRVGyCQRr3jPqRCvnY25ZdFlbn8z57Hwvbf3KgjVdDDtfagqWInl w==; IronPort-SDR: Z7MS2DBj/xIkjNIyZTrpX3VUbANjjKTb9NtmnAh0LlOiIN0ipBI/oxkYeIi7hT+vlV7yHK/1tv mt2Now9S812k3RfwwaSo5F1/tpaa5cXFCb3SzRqXio+umaak2uJCI5muBeR0HSGRdbEy1IQG+Q rcSMItm9bHlXEpN6Bg0XsAhEDDen716txL9/kPKqX16oNwZjI1z6EP6liHqbqtpbXGoIzxixcr IgyGjIWi0D1sACGoe0i8K9wTuTGJuFhU0+e3XMW90dlUaFzonuuSPRMgkcLF66LcSc9IKCfKjk 7hsTga5YkW/zsiPb5iu/JiZT X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="130482096" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:52:35 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:52:35 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:30 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 01/35] mtd: spi-nor: core: Introduce SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:51:48 +0300 Message-ID: <20210727045222.905056-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215236_750272_2D5B6FFA X-CRM114-Status: GOOD ( 15.37 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: SPI NOR flashes that statically declare one of the SPI_NOR_{DUAL, QUAD, OCTAL, OCTAL_DTR}_READ flags and do not support the RDSFDP command are gratuiously receiving the RDSFDP command in the attempt o [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 SPI NOR flashes that statically declare one of the SPI_NOR_{DUAL, QUAD, OCTAL, OCTAL_DTR}_READ flags and do not support the RDSFDP command are gratuiously receiving the RDSFDP command in the attempt of parsing the SFDP tables. It is not desirable to issue commands that are not supported, so introduce a flag to help on this situation. New flash additions that support the SFDP standard should be declared using SPI_NOR_PARSE_SFDP. Support that can be discovered when parsing SFDP should not be duplicated by explicit flags at flash declaration. All the flash parameters will be discovered when parsing SFDP. Sometimes manufacturers wrongly define some fields in the SFDP tables. If that's the case, SFDP data can be amended with the fixups() hooks. It is not common, but if the SFDP tables are entirely wrong, and it does not worth the hassle to tweak the SFDP parameters by using the fixups hooks, or if the flash does not define the SFDP tables at all, then statically init the flash with the SPI_NOR_SKIP_SFDP flag and specify the rest of flash capabilities with the flash info flags. With time, we want to convert all flashes to SPI_NOR_PARSE_SFDP and stop triggering the SFDP parsing with the SPI_NOR_{DUAL, QUAD, OCTAL*}_READ flags. Getting rid of the SPI_NOR_{OCTAL, OCTAL_DTR}_READ trigger is easily achievable, the rest are a long term goal. Signed-off-by: Tudor Ambarus Reviewed-by: Heiko Thiery Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/core.c | 3 ++- drivers/mtd/spi-nor/core.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index cc08bd707378..3d9f3698fb7b 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2726,7 +2726,8 @@ static int spi_nor_init_params(struct spi_nor *nor) spi_nor_manufacturer_init_params(nor); - if ((nor->info->flags & (SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + if ((nor->info->flags & (SPI_NOR_PARSE_SFDP | + SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ)) && !(nor->info->flags & SPI_NOR_SKIP_SFDP)) spi_nor_sfdp_init_params(nor); diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 3348e1dd1445..55fceb0ec894 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -382,6 +382,10 @@ struct flash_info { * protection bits. Usually these will * power-up in a write-protected state. */ +#define SPI_NOR_PARSE_SFDP BIT(23) /* + * Flash initialized based on the SFDP + * tables. + */ const struct spi_nor_otp_organization otp_org; From patchwork Tue Jul 27 04:51:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510280 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=MymL5OjU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=Vc+gSu8R; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYkyR7181z9sWl for ; Tue, 27 Jul 2021 14:55:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=C2fvnBDAx4r5cD/GGhmyByHPofaTB6xdOKT9bN7TmaQ=; b=MymL5OjUYMPl5m zWg2D7TA8JvlrJFjCF08E9lMB82lV9hrGMQ8UtaSd7PYdrSYuGTYMHpkz05B2Y8lPtEubvuXk3iqU E+8inUqHODVAB3x1k0Lf6Nj8AGs2thBzORH7j6GhFQ6mDCoBlMWL//Fi35q1mYUx1sHc44TZl/z4z HwEPj2RORAM2/sbjD3VQfimBL1zGQFbrxOlALhkpEdsZnYYGsVcKi67Sv7/TEKCi+bHR9L+XsrBht AXE29e5ZJCbEieMFKL+mOqH0H4a4vhvk6PM8B17VgjALrIiN2md28XX0xilvDUe4vjiow94h0k/+f 55r26wBFed0JJKJq632g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7f-00DI6w-5D; Tue, 27 Jul 2021 04:55:19 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F58-00DHPH-En; Tue, 27 Jul 2021 04:52:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361562; x=1658897562; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6roB3jv3+3BTf7v5TlRyzhlr+56Le9mHFNgqovKmH/c=; b=Vc+gSu8Rf9M14orQOlCq8X87PfjZ4ja4dBOVVhWXi67VjHMLnzVTt17A 4mUVgqoE5n6Iu1dIWyomVIiE0h6/6boMGADYEatXjWY4gBDe9nBa90A2o KUW7OI0yrUsTxx29pLuWEjT0kCCZ/x8uQiuc2K+rhC8xn86AUOIHwuiSS 8uaLEH/MSIO1faEae3viBUClURn4yE3tqn3hqwZ2hFVK1zXbeRjkxdeFH qX74b52Ef5L5FIby+WODwC5jxhERWM6AQJhXsh1zP+LfLovGUYvyRkIsT ylBmNCbCR4W2m/EAZolZRdHAUMG9/jMxnF6x3uGulYqg0psmpod1ibNg6 A==; IronPort-SDR: BkXF85cxN9O0jv/0vaHEiJW78HkHjyfvEcTt0rHF55X7eZWykQ6bd3tNa+RVY63lozh0L3XkcB IsX07uekgCQzYuNYofZwXWK+d/9NezoGwaf4b1vgpxwkcVyDRX4ZABNz7S/R0Gb0QRfT//v3gm mI+w2wdWh1npBDANJHYehSa+83JanmR7AYUc1TQ9thj6CGbYLhqAetu7hOD9D8XLFOXIHY3cjw Ksxt/Qy+jAZViTodbqHp1SL4UWlhvxfN2ydhREW1oZHvxEd4AnTgBlz0B/qMJ5CFZ0RgAU2j+F BRgA1lheJMznzb7lO0pQjepq X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935408" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:52:41 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:52:40 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:35 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 02/35] mtd: spi-nor: core: Report correct name in case of ID collisions Date: Tue, 27 Jul 2021 07:51:49 +0300 Message-ID: <20210727045222.905056-3-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215242_582423_2A0076B9 X-CRM114-Status: GOOD ( 14.32 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Provide a way to report the correct flash name in case of ID collisions. There will be a single flash_info entry when flash IDs collide, and the differentiation between the flash types will be made at [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Provide a way to report the correct flash name in case of ID collisions. There will be a single flash_info entry when flash IDs collide, and the differentiation between the flash types will be made at runtime if possible. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 7 +++++-- drivers/mtd/spi-nor/sysfs.c | 2 +- include/linux/mtd/spi-nor.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 3d9f3698fb7b..1a278d33b02d 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3027,7 +3027,7 @@ static void spi_nor_debugfs_init(struct spi_nor *nor, { struct mtd_info *mtd = &nor->mtd; - mtd->dbg.partname = info->name; + mtd->dbg.partname = nor->name; mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, "spi-nor:%*phN", info->id_len, info->id); } @@ -3208,7 +3208,10 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, /* Configure OTP parameters and ops */ spi_nor_otp_init(nor); - dev_info(dev, "%s (%lld Kbytes)\n", info->name, + if (!nor->name) + nor->name = info->name; + + dev_info(dev, "%s (%lld Kbytes)\n", nor->name, (long long)mtd->size >> 10); dev_dbg(dev, diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c index 9aec9d8a98ad..017119768f32 100644 --- a/drivers/mtd/spi-nor/sysfs.c +++ b/drivers/mtd/spi-nor/sysfs.c @@ -25,7 +25,7 @@ static ssize_t partname_show(struct device *dev, struct spi_mem *spimem = spi_get_drvdata(spi); struct spi_nor *nor = spi_mem_get_drvdata(spimem); - return sysfs_emit(buf, "%s\n", nor->info->name); + return sysfs_emit(buf, "%s\n", nor->name); } static DEVICE_ATTR_RO(partname); diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index f67457748ed8..bd92acdd1899 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -369,6 +369,7 @@ struct spi_nor_flash_parameter; * @bouncebuf: bounce buffer used when the buffer passed by the MTD * layer is not DMA-able * @bouncebuf_size: size of the bounce buffer + * @name: used to point to correct name in case of ID collisions. * @info: SPI NOR part JEDEC MFR ID and other info * @manufacturer: SPI NOR manufacturer * @page_size: the page size of the SPI NOR @@ -399,6 +400,7 @@ struct spi_nor { struct spi_mem *spimem; u8 *bouncebuf; size_t bouncebuf_size; + const char *name; const struct flash_info *info; const struct spi_nor_manufacturer *manufacturer; u32 page_size; From patchwork Tue Jul 27 04:51:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510281 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=0jLZBoOU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=QZD7tVSw; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYl0L6KfMz9sWl for ; Tue, 27 Jul 2021 14:57:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=mKyYMNI9IY/dk3yydJ25HcfM1En44/dFkajbNd7pfck=; b=0jLZBoOUn+V4Sb OgCfF3Od0qrAjSvncP0NUsD9BF4QH2JxYKWNCrvfVajlbDbv7qysnsDuXArKy/7sFAlf787sse0Nu zNxiWIVhLdIlMRuiVEOcDMw0aS+Zim/+yZu7VMt+DbDDS/cl1qu7S8cB21nbvCDGJX8XzC7Bd5qHU MuXShUXkulWV6W43KrLewTVMJRB8JPPk51eM05LSY8+A55Q4nwbWrufymUkDtY3aoZz6cWyaxubHk q8T1NxU1tkAual04hMip+/CWyrRlIsZ5f4PWo6DSkF5AQ9w4pLp69prap6rZnT9N7T8Y+3yn8O1Ws I1DOmSHoqck/Hx5bQFlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F9F-00DIX0-Ek; Tue, 27 Jul 2021 04:56:57 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5C-00DHPH-Tu; Tue, 27 Jul 2021 04:52:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361567; x=1658897567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QP7fz944bHICjJ92Ef9vR4tInkb8gSiyADZFnhZEnBI=; b=QZD7tVSwrW/ZgfKHwYMQFNXTNvtqN7B2pS7YjCmI7+7hronAQxYlVjst ib8hDOs8veRep3YnQBhV7iMaJPvr1HSWkG8xfJaqBTB4t3jME7Ia8oz31 r1auUvqYAGMXgnkStd3pWoBYL4ZEPFaa4LrtzfEMHqVweDS1xSHp83t5Y qddM0vWSlaIFfkAAyw+SOOa9IvFxvWUv0kjtd/OVRooY4/jukX8jazYLl S4T+nZWR6N7SC83YoSXBoHSwQ3ThScri5JusqQeHdtJRz3dzF1COghRGg eunuAqjCs3xQ3Zd4Osh6k4TmGi6m91N+gHSLaBVgF9baU4X1oZ9tceVwg g==; IronPort-SDR: +fAk7TGFAXG8h6cEZ/q1qocn/wrZ9mpqGZ9GzbcSrNnMGVwStxBcIdKVQnbDHArFkAcE70K/KI 4uPdHfve/YoJ3OGFe5Ya4vcDRmIJ7UJtq1GE2zd9epXwI+iMJRD4Xk1xEfCEZ5cWG7Rd6kNLPa puJA4vyD+7ynbFsgrtH8OMtCy3ymIbLNzeLVQhVmG4R8bt+9vBgvj7/+n1x8rnaT4vCsaN+9m/ DH5Qv9BlbaBN7RIV1ftpAdU+z0bynCrbH1rixLrIZvFbOwE9yVYMcOoyIe91kK0eJfFs1667VY jQCJUSy7xdS0zwXr1E1dnkmd X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935427" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:52:46 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:52:45 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:40 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 03/35] mtd: spi-nor: macronix: Handle ID collision b/w MX25L3233F and MX25L3205D Date: Tue, 27 Jul 2021 07:51:50 +0300 Message-ID: <20210727045222.905056-4-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215247_029285_EBE3B05A X-CRM114-Status: GOOD ( 13.88 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Macronix has a bad habbit of reusing flash IDs. While MX25L3233F supports RDSFDP opcode, MX25L3205D does not support it and does not recommend issuing opcodes that are not supported ("It is not recomm [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Macronix has a bad habbit of reusing flash IDs. While MX25L3233F supports RDSFDP opcode, MX25L3205D does not support it and does not recommend issuing opcodes that are not supported ("It is not recommended to adopt any other code not in the command definition table, which will potentially enter the hidden mode."). We tested the RDSFDP on the MX25L3205D and the conclusion is that the flash didn't reply anything. Given that it is unlikely that RDSFDP will cause any problems for the old MX25L3205D, differentiate between the two flashes by parsing SFDP. Tested MX25L3233F. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb, for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02. Signed-off-by: Tudor Ambarus Acked-by: Pratyush Yadav --- root@sama5d2-xplained:~# find / -iname spi-nor /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 14:51 . drwxr-xr-x 6 root root 0 Mar 9 14:50 .. -r--r--r-- 1 root root 4096 Mar 9 14:51 jedec_id -r--r--r-- 1 root root 4096 Mar 9 14:51 manufacturer -r--r--r-- 1 root root 4096 Mar 9 14:51 partname -r--r--r-- 1 root root 0 Mar 9 14:51 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id c22016 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer macronix root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname mx25l3233f root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > mx25l3233f-sfdp root@sama5d2-xplained:~# hexdump mx25l3233f-sfdp 0000000 4653 5044 0100 ff01 0000 0901 0030 ff00 0000010 00c2 0401 0060 ff00 ffff ffff ffff ffff 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20e5 fff1 ffff 01ff eb44 6b08 3b08 bb04 0000040 ffee ffff ffff ff00 ffff ff00 200c 520f 0000050 d810 ff00 ffff ffff ffff ffff ffff ffff 0000060 3600 2650 f99c 6477 cffe ffff ffff ffff 0000070 drivers/mtd/spi-nor/macronix.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 27498ed0cc0d..68f6ac060bc6 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -8,6 +8,24 @@ #include "core.h" +static int mx25l3233f_post_bfpt_fixups(struct spi_nor *nor, + const struct sfdp_parameter_header *bfpt_header, + const struct sfdp_bfpt *bfpt) +{ + /* + * Macronix has a bad habit of reusing flash IDs: MX25L3233F collides + * with MX25L3205D. MX25L3233F defines SFDP tables, while the older + * variant does not. + */ + nor->name = "mx25l3233f"; + + return 0; +} + +static struct spi_nor_fixups mx25l3233f_fixups = { + .post_bfpt = mx25l3233f_post_bfpt_fixups, +}; + static int mx25l25635_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, @@ -39,7 +57,10 @@ static const struct flash_info macronix_parts[] = { { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) }, - { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, + { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SPI_NOR_PARSE_SFDP | + SECT_4K) + /* ID collision with mx25l3233f. */ + .fixups = &mx25l3233f_fixups }, { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, { "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4, SECT_4K) }, From patchwork Tue Jul 27 04:51:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510282 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=eOFq07W9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=XYwbrY05; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYl1x47SXz9sWl for ; Tue, 27 Jul 2021 14:59:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=1x0YuOiS8kkxiBoGVg5ZagEM/XyZ3JtPiN2zF2IDWug=; b=eOFq07W9CEvWvK +NFlCM5s1481GOcv03Y3HivycOtzRsVU1V0TbnPU4x6nKndx4pTOzJLJHz0J2YxzvM5fIS4OEXnvu G+94SbkELholX71BBaMopKw7ZlHU9aqdpWQrfU1NCkY0uOFUnRFdMFnic+2be+i/J8+2AuDuhe7Ix 3ZqT7kdNlxmftYmCfsDt/Frum5vM5OAo4Lz/FKR3VIP9+l/6NmW4cZ8Td7eGBiMUXVw2wFk+HnNsd +vA+dfvjHDmQskiLaEUUGLuSzNm78Z7dMv57+Dc4kOFCJkvyzuwZENmOCETSm/6xp1FRk8/q43N7X lmrd+1zgMhM33PoQavSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FAZ-00DJ5D-Nw; Tue, 27 Jul 2021 04:58:19 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5J-00DHRs-Bm; Tue, 27 Jul 2021 04:52:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361573; x=1658897573; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0Z23cobJ8rYXhcA546i8ItWOTGlv3l049QBpJBZN1Hk=; b=XYwbrY05kVtpB1zqI3lUMiX6oTGS5AoFbsmtQx5O/PhbG6GqWLgB1oit 7dUdGH1PPKv9FxE2bo2EDTV2xFpuNNsHnuSbGRID4wRZujqkbqUR+RFLS DrLdIP4EUN3EiJ7aMc14QdyvAus3y838lN3rDCJoWMis5BKVnJJHK/NAq +/4m/YyixPG47dWvE+5Jk8yJIfPt1tjmSve0Djm6bLNXbt9O9fCbN/MrE 1usj97SdYd9fAETA5bd748TJnu2TvN0a0nrn8O0o7xV6qiO0Py3hlhHDD C8AX68Crf4uSyYfI0oN2fwh/6FI2Yayjd/Pl0r184WMyDS926pGWXGhwa w==; IronPort-SDR: a7vVkp7YHgCVq4BwWtzLfsJGCo3OIEYminI3RdwGkGX0GeO+pjG/U0fe41wRODVXMus1Wqmv/i N8TU1YjZTTTsH5QDTxsEg/xoQZ7JUtNTxNQLBLjCK8RGJhmE3rL+I2Kq886WedbarKRyka7hlS BiYFHcC22Zina7AGwmLu0MLzCpvSHDxIMEey6Ssx5Ojl2xyk3hkPnf5k1MF+3m8Us19tXmr3Du O3Qee+Im8J2zi2dareRG0mrdDWeQvsIrAo8kImjf2tEMk+tdKwkffyeKGddz/TNtWTaESzI2bd yUKwQqYCsijwF3kvrgW/9rjK X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="63689432" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:52:50 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:52:50 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:45 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 04/35] mtd: spi-nor: macronix: Handle ID collision b/w MX25L12805D and MX25L12835F Date: Tue, 27 Jul 2021 07:51:51 +0300 Message-ID: <20210727045222.905056-5-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215253_560241_88D1E936 X-CRM114-Status: GOOD ( 12.18 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: MX25L12835F define SFDP, while MX25L12805D does not. Signed-off-by: Tudor Ambarus Testd-by: Heiko Thiery Acked-by: Pratyush Yadav --- Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 MX25L12835F define SFDP, while MX25L12805D does not. Signed-off-by: Tudor Ambarus Testd-by: Heiko Thiery Acked-by: Pratyush Yadav --- # cat /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0 .0/spi-nor/sfdp | xxd -p 53464450000101ff00000109300000ffc2000104600000ffffffffffffff ffffffffffffffffffffffffffffffffffffe520f1ffffffff0744eb086b 083b04bbfeffffffffff00ffffff44eb0c200f5210d800ffffffffffffff ffffffffffff003600279df9c06485cbffffffffffff drivers/mtd/spi-nor/macronix.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 68f6ac060bc6..fba85efafb47 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -8,6 +8,24 @@ #include "core.h" +static int mx25l12835f_post_bfpt_fixups(struct spi_nor *nor, + const struct sfdp_parameter_header *bfpt_header, + const struct sfdp_bfpt *bfpt) +{ + /* + * Macronix has a bad habit of reusing flash IDs: MX25L12835F collides + * with MX25L12805D. MX25L12835F defines SFDP tables, while the older + * variant does not. + */ + nor->name = "mx25l12835f"; + + return 0; +} + +static struct spi_nor_fixups mx25l12835f_fixups = { + .post_bfpt = mx25l12835f_post_bfpt_fixups, +}; + static int mx25l3233f_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt) @@ -70,8 +88,10 @@ static const struct flash_info macronix_parts[] = { { "mx25u4035", INFO(0xc22533, 0, 64 * 1024, 8, SECT_4K) }, { "mx25u8035", INFO(0xc22534, 0, 64 * 1024, 16, SECT_4K) }, { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, SECT_4K | - SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) }, + { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, SPI_NOR_PARSE_SFDP | + SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) + /* ID collision with mx25l12835f. */ + .fixups = &mx25l12835f_fixups }, { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, { "mx25r1635f", INFO(0xc22815, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | From patchwork Tue Jul 27 04:51:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510283 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=D6IqSSDq; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=yEvAbTrp; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYl4M07nvz9sX2 for ; Tue, 27 Jul 2021 15:01:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=hgVNxDQKQYPq7Ys/w9/dlT3fGzFxOiALsfZx8U4WhRs=; b=D6IqSSDqa0TEl3 qqryz6l6gWKnjoW88/vFWmhgGgxziPnDN1iQZtPAkoulqL3Tj9AUwnozey9JHPlQ5W4ui4vGT6uxQ +AL5ylcXJ4VZ8eek0W8/yVuJQZyscoTsHXZzSnrZevUcSlISnVz2ZbwPI8pf1HlU2/UQ98cYQY7gV KnIIi2NzCQinZih1MwSmOmwj761f48ItfhS/lMBq7wB82trnUQWD3nS1ltIysl2cCQurYPwC7MeXl 6/ns4oGV14XxWHK2uX89Z7Ya6Fnv/HVoszTOAIUidp1DyFizLX+sX41+kiRmb3Hz4pXQztCUy5qaw fZsS6qwXqvddBrS+jMOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FCT-00DJsu-SH; Tue, 27 Jul 2021 05:00:18 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5O-00DHTL-Uq; Tue, 27 Jul 2021 04:53:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361579; x=1658897579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6QTTN/6Jydl0xQPcXkV159/XnVcFV2lCZN44ktflG2U=; b=yEvAbTrpuV0Ab7OJR7NwjaT5B2r3DkBEWYzXEGfmdI4QqfsNVQIb35No pRQJdHLdHK9ZUMxAPgybvQTxbmpAAnliTDf8WQ4LHe88GX8EQ79ntA82K m3tM/oi0wFj+mQdLm/1kRf4dt9WWcGJr+yhxOYi6QB01T9SlCFaVSNz2m k4ZgoKyMclD/vdlvclaBa1KhfqS9f2szkadGYOBY7WeaTxzsV7kjO7DJk hNWNi797XnYFd62Ro2mzz4FyD+6J0VMelEhSapofhxL2Cpok83MJ1MQbH JGp5XAvS9aFwgh3qYhOwpvrZ61IzCZ3qqGaS4otd460BuTmzLH17gIYN5 g==; IronPort-SDR: xNs4oVHSNsLSfLRy7sboayzgHESIxpLZywrjEk0pbPLPW8djJtOT8w8Uzvpr/IpzMw6oc7cPUY LlG06+erT5Q/pQxAx9Xs4C+kU14OPiA2O7JztKG1tCrcieLNSW95Su5T7zn7aN4l3OZed9K2iQ OatYLH9Fiuukk4uKIewGLhcmLMQYk3+wKFI2Qf7lRlbuzmDoDxhka8aMvL5eeCJ5gaI9wAd16n 2VZmtLFmVAh3r4gKK+gj9XfOs6AparjwN2xvC/5gmO+juOYvlPAxWHVSOQH4D0+SewTNz4qctr W/cC9du9tWPzihVaFVA+KPpW X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126054953" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:52:56 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:52:55 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:50 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 05/35] mtd: spi-nor: Introduce Manufacturer ID collisions driver Date: Tue, 27 Jul 2021 07:51:52 +0300 Message-ID: <20210727045222.905056-6-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215259_131336_5A6D863C X-CRM114-Status: GOOD ( 18.51 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Some manufacturers completely ignore the manufacturer's identification code standard (JEP106) and do not define the manufacturer ID continuation scheme. This will result in manufacturer ID collisions. Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Some manufacturers completely ignore the manufacturer's identification code standard (JEP106) and do not define the manufacturer ID continuation scheme. This will result in manufacturer ID collisions. An an example, JEP106BA requires Boya that it's manufacturer ID to be preceded by 8 continuation codes. Boya's identification code must be: 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x68. But Boya ignores the continuation scheme and its ID collides with the manufacturer defined in bank one: Convex Computer. Introduce the manuf-id-collisions driver in order to address ID collisions between manufacturers. flash_info entries will be added in a first come, first served manner. Differentiation between flashes will be done at runtime if possible. Where runtime differentiation is not possible, new compatibles will be introduced, but this will be done as a last resort. Every new flash addition that define the SFDP tables, should dump its SFDP tables in the patch's comment section below the --- line, so that we can reference it in case of collisions. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav --- drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/core.c | 1 + drivers/mtd/spi-nor/core.h | 1 + drivers/mtd/spi-nor/manuf-id-collisions.c | 22 ++++++++++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 drivers/mtd/spi-nor/manuf-id-collisions.c diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile index 6b904e439372..48763d10daad 100644 --- a/drivers/mtd/spi-nor/Makefile +++ b/drivers/mtd/spi-nor/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 spi-nor-objs := core.o sfdp.o swp.o otp.o sysfs.o +spi-nor-objs += manuf-id-collisions.o spi-nor-objs += atmel.o spi-nor-objs += catalyst.o spi-nor-objs += eon.o diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 1a278d33b02d..d30c8f350dc1 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -1829,6 +1829,7 @@ int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor) } static const struct spi_nor_manufacturer *manufacturers[] = { + &spi_nor_manuf_id_collisions, &spi_nor_atmel, &spi_nor_catalyst, &spi_nor_eon, diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 55fceb0ec894..e9896cd60695 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -476,6 +476,7 @@ struct sfdp { }; /* Manufacturer drivers. */ +extern const struct spi_nor_manufacturer spi_nor_manuf_id_collisions; extern const struct spi_nor_manufacturer spi_nor_atmel; extern const struct spi_nor_manufacturer spi_nor_catalyst; extern const struct spi_nor_manufacturer spi_nor_eon; diff --git a/drivers/mtd/spi-nor/manuf-id-collisions.c b/drivers/mtd/spi-nor/manuf-id-collisions.c new file mode 100644 index 000000000000..bf7dba34f018 --- /dev/null +++ b/drivers/mtd/spi-nor/manuf-id-collisions.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Used to handle collisions between manufacturers, where manufacturers are + * ignorant enough to not implement the ID continuation scheme described in the + * JEP106 JEDEC standard. + */ + +#include +#include "core.h" + +static const struct flash_info id_collision_parts[] = { + /* Boya */ + { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256, SPI_NOR_SKIP_SFDP | + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, +}; + +const struct spi_nor_manufacturer spi_nor_manuf_id_collisions = { + .name = "manufacturer ID collisions", + .parts = id_collision_parts, + .nparts = ARRAY_SIZE(id_collision_parts), +}; From patchwork Tue Jul 27 04:51:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510284 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=48tOMf47; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=0wxs4W12; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYl6j0HkGz9sWl for ; Tue, 27 Jul 2021 15:03:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=BSm/jRlgh58MHFSkOfGIldYoth9RVk/3OJabcxuPqVg=; b=48tOMf47GzWalZ LT5OwlgnvJZLOGfu+nkGG97fCTIYXPrbtfhW7o/sdDY1Ewiiw37Y0WtrD9ugQ1ZS/vQh4hFsUzT/k S/95NR/VsPMeqYuKAdjVpFXiBy2hUduduuZR7Fc/JROWkkLFhtEjxcxHHVClDVdNy9/Vh74IBGOg+ D+G9Ttk8vF3KIiezqGgSOJ6Ohsaf/mhTmgyOtcX4ewWmppaMPSFivoGAtGt6Rj+W1GRo/jAVjx3yj FhymQTidgVPQJq0extHGVLUY2fBTYYSp9reeQY/jH4d8/Lg+OCim7EcfiGX2NKglNmNUzUz7SeQgH UB6GP1u/vSaJdEENmrrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FEa-00DKjA-Fy; Tue, 27 Jul 2021 05:02:28 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5R-00DHUR-UR; Tue, 27 Jul 2021 04:53:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361581; x=1658897581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6/0tDN1r+uFRVwM41QCwY7mVuqDSpx5qYOvBSq9SpFQ=; b=0wxs4W12Yh6sj7KvhwosuuxwpwFlFjRIU0cUZTbXnYJHrW67nlsS50uo 4QRNn3JcQMoti0lfQ3sAd85Sy7Wk2ukmsCkn3Z40saJAmGu9h/QRN1sgt z+OZKtYJUi3oYLhNyntdDdgaxNx0C+BccKBMiTXqsfGGTF/fL+SWCJRKO RbeHbyCWh7H4di4XBXLbHHXTv41D9ljIMu3MZ6hoPxsPDxXRPeZrWBRd7 iZfihWuKaAwooPk4tjrq/3dZTHqUdgLa2l3SS3CY5QjQ4qcsmQCfLX09i OpJbBr0wX3OHXy4KirJ2fhNJ1rulBHto2ZmcOstXKFlqj1csaHIKCRnpy A==; IronPort-SDR: 2h9VgTU8l0fVWA19nEgNjQJ60QLJ1JjvbEcctfqODSgeXAqOAjKR0gHMG3wfsxt3Plyo8z99kb jaJ5zYuqdcosjES/cYwnXydYv5x5bZ7OYS/8aQmmd+aZcGVc0OD5fQCCXaNVdrC0vnaB1V13xa g7eLjqAmqgYamPW33LofWdxFwDTWx9Cz1p+KVHHfOaBfy9A7qlMIlsgHqm+cwzD9bSN5BrMQUe P5jYipC+rbdEJ8dxEnnzi+57r1E4P6MOuyrKib86SwZmyUqG+zI2oPyMNtRYWc9Kc9vZXLAsNG fzQVdhEunHyUlRca//8euPGO X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137653912" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:00 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:00 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:52:55 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 06/35] mtd: spi-nor: manuf-id-collisions: Add support for xt25f128b Date: Tue, 27 Jul 2021 07:51:53 +0300 Message-ID: <20210727045222.905056-7-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215302_063670_8F3DB650 X-CRM114-Status: UNSURE ( 9.06 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Flash does not support continuation codes and may collide with a flash of other manufacturer, Intersil being an example . Signed-off-by: Tudor Ambarus --- 0000000 4653 5044 0100 ff01 0000 0901 0030 ff00 0000010 000b 0301 0060 ff00 ffff ffff ffff ffff 0000020 ffff ffff ffff ffff ffff ffff fff [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Flash does not support continuation codes and may collide with a flash of other manufacturer, Intersil being an example . Signed-off-by: Tudor Ambarus --- 0000000 4653 5044 0100 ff01 0000 0901 0030 ff00 0000010 000b 0301 0060 ff00 ffff ffff ffff ffff 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20e5 fff1 ffff 07ff eb44 6b08 3b08 bb42 0000040 ffee ffff ffff ff00 ffff ff00 200c 520f 0000050 d810 ff00 ffff ffff ffff ffff ffff ffff 0000060 3600 2700 f99f 6477 e8d9 ffff drivers/mtd/spi-nor/manuf-id-collisions.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/manuf-id-collisions.c b/drivers/mtd/spi-nor/manuf-id-collisions.c index bf7dba34f018..db31470ebf6a 100644 --- a/drivers/mtd/spi-nor/manuf-id-collisions.c +++ b/drivers/mtd/spi-nor/manuf-id-collisions.c @@ -13,6 +13,10 @@ static const struct flash_info id_collision_parts[] = { { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256, SPI_NOR_SKIP_SFDP | SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, + + /* XTX (XTX Technology Limited) */ + { "xt25f128b", INFO(0x0b4018, 0, 64 * 1024, 256, SPI_NOR_PARSE_SFDP | + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, }; const struct spi_nor_manufacturer spi_nor_manuf_id_collisions = { From patchwork Tue Jul 27 04:51:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510285 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=CFOWFIn4; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=wmDfMyA8; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYl9j10Rhz9sWl for ; Tue, 27 Jul 2021 15:05:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=ks4dIpSk7A37rWPYE6CceSdob/wSUY79KFjj8Zg8TXA=; b=CFOWFIn4PDDr4a 47PVzeM+UXMtGK9+ZfG7dXOX/hjmaWdSD9CMQ2bQQf2Gys0M1TYVIALvBNp2uNGOQ16eUsILE9TYS qvi5Cjqj/E14Ne8B1LonbkRKUsWfUKSMUTDcEbWMFQqUfe+8dLg8LLc/5dkgnZMDU6pUXS/DCY4vp GYrQHpH24phnl4k2DLheGIN5//tfW+7LDY9AlPORuDNR4uKgUo67RVrUW22s5OlevaHoucY9Civnr q3/zSY0x9Qa4WYhyPvtzKgbNg5wcwJe38/jVbssBhpwg74uskw3MrDaKtzdCoGxSHvXvnc6m6qg+c bDO1A4RPgLUzQW0MzwUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FH7-00DLSu-DH; Tue, 27 Jul 2021 05:05:05 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5X-00DHVh-9v; Tue, 27 Jul 2021 04:53:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361587; x=1658897587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FnW9fxzApB6BxAtUcw3xQI1N0ia6iSLV+WDV+VjMt9o=; b=wmDfMyA8WYM4bqHl9gOMhygMw20X+BLq1WWYAj1ZGxPzlB9b5Zhh6n5X Lba4uTFYSBoxtG9lIkcwZ1CfthHRCflF6u9G5Oz9S+wIR5NbkQhrf27+d Wq7i1MHeeRzhVAz7xRQN7UcmwmMiLPjzUAvDbEJooCHaRA7qIfxtOo8aY eW6QaLvGYm7DGnA1FFYmy5fxjaeIOEN/Dw8pSOlGUuBy5QyvqrVxazp5Z snkBko9rcv6bUI5yH6kzeMII8nqYBklrEpq+bu/k4kB/RMXbJsDzQ+kbL oBOpmM6q8cbtSfsw4EGCL0XNLEYOZoPQjDEhX8H26EID5u39LVGOT3ZAg w==; IronPort-SDR: dndfBDwKSBX5Dp6qJbekKs8oANBVVxVtZR9UicEtlf09Dq3ZrdaHCgoXCWwcAuXPPOL2dG/6Zy 9zJSAUBi5oSVhed1LMjng5SthYzu+PBsk78Mu7iTrwaltE2KpOI/YnUB1TpUo5eJmkuibGmE4J Se98teMqTnVChSXAtxqGRtGUNvEqx9c8yk1pq+XFb2pa62DJmIt4B9UtZvQ7mGYWQHVbPQ5FkP +hiHNFZxPwq5gV1AfcQFHdl7Ow1vc69NnDUrumghHrshlWMguuMh8QD38by+wuh1LLni8RS1qe YJUrmSh90+WjQ7aMXXTTEt2L X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126054976" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:06 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:05 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:00 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 07/35] mtd: spi-nor: manuf-id-collisions: Add support for xm25qh64c Date: Tue, 27 Jul 2021 07:51:54 +0300 Message-ID: <20210727045222.905056-8-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215307_459512_D9DA939B X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Flash ignores the manufacturer continuation codes and is likely to collide with other manufacturers flashes. Signed-off-by: Tudor Ambarus --- Do not apply without the SFDP tables hexdump. Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Flash ignores the manufacturer continuation codes and is likely to collide with other manufacturers flashes. Signed-off-by: Tudor Ambarus --- Do not apply without the SFDP tables hexdump. drivers/mtd/spi-nor/manuf-id-collisions.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/spi-nor/manuf-id-collisions.c b/drivers/mtd/spi-nor/manuf-id-collisions.c index db31470ebf6a..f3ba00d17c68 100644 --- a/drivers/mtd/spi-nor/manuf-id-collisions.c +++ b/drivers/mtd/spi-nor/manuf-id-collisions.c @@ -14,6 +14,9 @@ static const struct flash_info id_collision_parts[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, + /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */ + { "xm25qh64c", INFO(0x204017, 0, 64 * 1024, 128, SPI_NOR_PARSE_SFDP) }, + /* XTX (XTX Technology Limited) */ { "xt25f128b", INFO(0x0b4018, 0, 64 * 1024, 256, SPI_NOR_PARSE_SFDP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, From patchwork Tue Jul 27 04:51:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510286 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=XLp40+Kv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=fFXmBeHa; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlFb1VYlz9sWl for ; Tue, 27 Jul 2021 15:09:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=u8K+rCzxgRvIHW4WBoG3d03GxLyAoKF0KVZDrMERJKM=; b=XLp40+KvvDyA9q I4gcKmxdx6fv4BRe4+VoZoWHkyXsWeuKaPhs0dOP4ATTsOiWrDmdN+i5W7NyOzirCkomAH2/FpqEI X4gaRIXSnzSMYsaEgG//v9PieXvlHlS5oKxOqMl2uzvBTgIhFPyfgVdDInYe6IusgIaBzZh9BkYdQ kEdsR/WS4GdRvEqhgKoShTxy3n4bqjo/3hZ0zlNL4hBHUks//MEG7vsQ8hk057dbnCWAJRg2Dy2TT pZtyjN6Kjjnr13SiFnGz5L3HY5OjlaxtgSx0E/IVJFgHj+/0WbIH9tGPZFlubxqFel8hF9SgG+xrT 3Qy2C/rKOuHsvyJO81yQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FKI-00DMQq-Ma; Tue, 27 Jul 2021 05:08:23 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5c-00DHX1-3g; Tue, 27 Jul 2021 04:53:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361591; x=1658897591; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W6PtSFtp9YKqjBcoAfppno8q9Rqg4UE5THfHt9mw6j4=; b=fFXmBeHaZQLbLUGr6DLs0aBleNIxTVofdp4WlCHa+0Crv14n2/OeHba3 VMV2377iV2Pj5BHCTUkAunAClZRu/bmwdcC9Zr5qSg87E2fWYjczutv11 UZuh89+OIwYOZNDe4yuJkSjs8zuNOBewvLGCGO5CQoQsv69Ztlc35gzg1 bjr0ZI3lho/o++RBdOfFugfixJjX1bL/W2bIKBsSHmcWmDg2qznqoq5SJ Vb5F04Dab9MXd4WfIgUNBc9RnF36PImZzGcFWQPckd5BgTDT4QYfffwdh x8hu4yJRC5l8xn1hEDkw5XFR2r3e2X2utS31AgAHX8TcCDxJ0CLSKlIyV g==; IronPort-SDR: gZF7Qu8Y7QzSbm/fPqfTG1EMuOqzd/aGljBooSMpqDUrwGzO0coA606m6kG7b474tnst7+iDzL hzm1zMJEtTSzv2wXUXl9vzyjicpEyrLEkVCnZ6/siaBEN8TIpo0cD+N7WyC+/JIJStdF+6V45n EcVswKhV9afaIYu4VoZGbG4fZvT9bRrBQmYbMtFwwDwBSOILVB4fSO1I3KMqESutc6lLzjpGcF fkmggytgHWyfBQ28cW/csADprfKMaYGjH+O67VcxoOgeTgiq05b1LSr6Sw80wWRjXFvQj/VAnZ bBCMQkdMe3HvGviTM3EuRDP8 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="130482114" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:10 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:10 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:05 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 08/35] mtd: spi-nor: core: Introduce the ate_init() hook Date: Tue, 27 Jul 2021 07:51:55 +0300 Message-ID: <20210727045222.905056-9-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215312_247553_C0D32E95 X-CRM114-Status: GOOD ( 16.55 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: The goal is to get rid of the spaghetti way of initializing the flash parameters and settings. late_init() hook will be used to tweak various parameters that are not defined by the SFDP standard. Can [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 The goal is to get rid of the spaghetti way of initializing the flash parameters and settings. late_init() hook will be used to tweak various parameters that are not defined by the SFDP standard. Can be used by non SFDP compliant flashes in order to tweak flash parameters that are not/shouldn't be handled by the flash_info flags. Will replace the default_init() hook. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 15 +++++++++++---- drivers/mtd/spi-nor/core.h | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index d30c8f350dc1..15ccc9994215 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2667,11 +2667,18 @@ static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) * spi_nor_late_init_params() - Late initialization of default flash parameters. * @nor: pointer to a 'struct spi_nor' * - * Used to set default flash parameters and settings when the ->default_init() - * hook or the SFDP parser let voids. + * Used to tweak various flash parameters that are not defined by the SFDP + * standard. Can be used by non SFDP compliant flashes in order to tweek flash + * parameters that are not handled by the flash_info flags. */ static void spi_nor_late_init_params(struct spi_nor *nor) { + if (nor->manufacturer && nor->manufacturer->late_init) + nor->manufacturer->late_init(nor); + + if (nor->info->late_init) + nor->info->late_init(nor); + /* * NOR protection support. When locking_ops are not provided, we pick * the default ones. @@ -2713,8 +2720,8 @@ static void spi_nor_late_init_params(struct spi_nor *nor) * wrong). * spi_nor_post_sfdp_fixups() * - * 5/ Late default flash parameters initialization, used when the - * ->default_init() hook or the SFDP parser do not set specific params. + * 5/ Late flash parameters initialization, used to initialize flash + * parameters that are not declared in the JESD216 SFDP standard. * spi_nor_late_init_params() */ static int spi_nor_init_params(struct spi_nor *nor) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index e9896cd60695..13d5c5edfd27 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -391,6 +391,11 @@ struct flash_info { /* Part specific fixup hooks. */ const struct spi_nor_fixups *fixups; + /* + * Init flash parameters that are not declared in the JESD216 SFDP + * standard. + */ + void (* const late_init)(struct spi_nor *nor); }; /* Used when the "_ext_id" is two bytes at most */ @@ -457,12 +462,15 @@ struct flash_info { * @parts: array of parts supported by this manufacturer * @nparts: number of entries in the parts array * @fixups: hooks called at various points in time during spi_nor_scan() + * @late_init: used to init flash parameters that are not declared in the + * JESD216 SFDP standard. */ struct spi_nor_manufacturer { const char *name; const struct flash_info *parts; unsigned int nparts; const struct spi_nor_fixups *fixups; + void (* const late_init)(struct spi_nor *nor); }; /** From patchwork Tue Jul 27 04:51:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510287 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=pdAWo7Ib; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=zs0/IamD; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlKN3DSgz9sWl for ; Tue, 27 Jul 2021 15:12:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=3m65mBN22Ms5vb7hgZH26RXym+aejq56v1OHUzpDV/U=; b=pdAWo7IbmOrJ6v kqm196wdyfE+9r2Yo9U/hlIVuFORZ/k50QLGhGeJ85Zp/O+AQMMoSzUIHTnkoVAqsQTdgJap6MCIW NtzGcbML9yV/fJnzNwdx/PmXzutut0XVn7zs0KcbjZukK0gl63ea22DKbyOgUrRgaI7q6BHH1n93Z 5g/2pWrMbnJ8Ug9EMh6/0jzzLW9L0NrWUvk2c4UhH41/iffQ/RDGyNbKM/yQRh1og4phUG2wltNFf aLereBOz0P+JurpeyfkIvhMXGmGUWGUmfr8nY1/D0YqNd+7nl3QrL4bnHSp/C2Fy4aoHa0noB25nX StyocroBoELeOfDZebfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FNX-00DNJO-RK; Tue, 27 Jul 2021 05:11:43 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5h-00DHYa-Dk; Tue, 27 Jul 2021 04:53:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361597; x=1658897597; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PxTTUSqP4zNCXhtrcOx5menYSWiRlPcQ4R03mryo9WM=; b=zs0/IamD8qOYWdTO9icrYpcnvSWh9soG0UtVXiuJuM8eZzJC0Rsk0xcH p06QhkUACdLBBLDruttRG0UMzOua4qGNez248KgxCCyjpoyJQBqJ8iQPt E22KRgUigmOpFoBd4b1TQs6PF+pJ3CQUc6f/VyK86KRhr48iupPCTlyef Y33LTrJlDBV8nsahzWQh8vmLBDtVIOnZiSMN/GhxgTlRIPgDulcp4DVXd G267JyoUY9CdKAc9JU/w7NbJZDm8aK1VsriNINhPio8Sdq8h2mDXhIlb5 GlnZHEKo6QgbPcJQ8z8gYCkNteZSGV+N3JoMd3dbzBFcoFjiD5GJXYBs6 w==; IronPort-SDR: 4o4O3ixXKpK6pf70C5bAyN2dddo6HeIl2JHDb3zXN4v9WQEdTewstlfOGljLBVUxAvstSRTqQB Vv2u4cWyN9tsyv3gCY08yORC6EHd8rDUjN3pR+Z1KSbMph1nT3sTHw0xEgC/py7eHEpMiC/+/V cqiNM06bqzXI87XPrOXEjvyVKUCR/nEJT1cdL0URZnxkIlbOz8pZkT8T9Wm/1OSHQbhA5HNvFf HUUzT0Hbh6Mbdf55wnw3YGNky99TBgNnKdyxHEqNjaR7YuCiVz37pZ2Rpk9WyOQpDKumzX03LK TpK0514isQYjLxfrLu+29cRq X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137653937" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:15 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:10 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 09/35] mtd: spi-nor: atmel: Use flash late_init() for locking Date: Tue, 27 Jul 2021 07:51:56 +0300 Message-ID: <20210727045222.905056-10-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215317_561131_538FB3C4 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Locking is not described in JESD216 SFDP standard, place the locking init in late_init(). Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/atmel.c | 30 +++++++++++ 1 file changed, 11 insertions(+), 19 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Locking is not described in JESD216 SFDP standard, place the locking init in late_init(). Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/atmel.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c index 1fea5cab492c..b937ef734e55 100644 --- a/drivers/mtd/spi-nor/atmel.c +++ b/drivers/mtd/spi-nor/atmel.c @@ -48,15 +48,11 @@ static const struct spi_nor_locking_ops atmel_at25fs_locking_ops = { .is_locked = atmel_at25fs_is_locked, }; -static void atmel_at25fs_default_init(struct spi_nor *nor) +static void atmel_at25fs_late_init(struct spi_nor *nor) { nor->params->locking_ops = &atmel_at25fs_locking_ops; } -static const struct spi_nor_fixups atmel_at25fs_fixups = { - .default_init = atmel_at25fs_default_init, -}; - /** * atmel_set_global_protection - Do a Global Protect or Unprotect command * @nor: pointer to 'struct spi_nor' @@ -146,34 +142,30 @@ static const struct spi_nor_locking_ops atmel_global_protection_ops = { .is_locked = atmel_is_global_protected, }; -static void atmel_global_protection_default_init(struct spi_nor *nor) +static void atmel_global_protection_late_init(struct spi_nor *nor) { nor->params->locking_ops = &atmel_global_protection_ops; } -static const struct spi_nor_fixups atmel_global_protection_fixups = { - .default_init = atmel_global_protection_default_init, -}; - static const struct flash_info atmel_parts[] = { /* Atmel -- some are (confusingly) marketed as "DataFlash" */ { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K | SPI_NOR_HAS_LOCK) - .fixups = &atmel_at25fs_fixups }, + .late_init = atmel_at25fs_late_init }, { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) - .fixups = &atmel_at25fs_fixups }, + .late_init = atmel_at25fs_late_init }, { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at25sl321", INFO(0x1f4216, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, @@ -181,13 +173,13 @@ static const struct flash_info atmel_parts[] = { { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) }, { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &atmel_global_protection_fixups }, + .late_init = atmel_global_protection_late_init }, { "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16, SECT_4K) }, }; From patchwork Tue Jul 27 04:51:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510288 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=rPivLiUK; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=1+5KMk07; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlPd42V8z9sWl for ; Tue, 27 Jul 2021 15:16:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=UIM/yRS6jqTGZ2QSM7Dn5wKmpY/Qc8ew9lDDmbWfTOs=; b=rPivLiUKFcH2hv /FF4o11jgArv8nikkHd3R+T+Y+iwU/s6r2EUPdcXwE/A+qhG5AsQ7xCzeJbo7mn8o29dUihoGzLNU jdsprTvOAKQjxpF7tNDK/E2rhO+pqcEsosWrGLgPJTqlw16m0F6ajjeqT14v1T84ZaOnGYleN3vim WfUNzEvyWYqlcYURBa6mTzH7plG5PS9c84PqvmG5e+IZq3O3lcTEifau7eJT710ukmQ3HTXpyb5Sd LMPpujRsDKwq1jGI7nDV6dJ3byaEkGLoKZgaBN/a2UDs+ed0QN4wswSTozUGhCWyi6J9d95oP/K80 cUKfnuW4qEzL0OJ+3W7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FR8-00DO7B-MT; Tue, 27 Jul 2021 05:15:26 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5m-00DHYa-Dp; Tue, 27 Jul 2021 04:53:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361602; x=1658897602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4h/b2thfFZv8AmUSRxRfy4fl3H7wKOL2R1o8uNHRrVA=; b=1+5KMk07bikmHKsO1TK/Aeh4M/puJh4BkGNbezvA5zb9niWvCXggrnOT K1VLGkpbm+6pVgXiphgU/N2OlCkj0Tg7R8ZekwmW6uXrVbKndFiYkl5wu 3g4pOiwUPBWvmnQICxRCh3l7h1VQSLtUpWmyw9ZBQTlQbT7mW1gfvf7gQ K8yjOA3Rx2F5oQfVc8mSfk+jnwckMBlU0lE6aX/SGC9bNowNjQw8Ugo7D hnV/+hmx1Gut1R0SXhm2rBIr3WnKPLyKnRjSRjBLKjP4GtLc1LOW+l8K8 bOdVROiBDurNPlgZWoyluVViarM3fmgPmJ2BSSlECxy40TENyw8EFOvv7 g==; IronPort-SDR: xPJVDUWZ/g9XKMwVoFSB0T4dwRpUA0uMLVFcfbNvF7Ebq8dd3iirJuk3g0sHOapHuWHSIoFDkz UveztIpldeTPHFofuMZIAMzyIcAEse89xRzp5Q+Tg3Z8CtMGcqMJ9lxN7br/XwhpvTGUEbtHK+ pQOO2cctj8CE/bF/AX1d9dv3YuYucSzl6UMoMTUW0PKkHzLO0d98Y6DO5YJeAPpBnSKPm6ic3Y 7vqbz0XEvplMPwUqiwo0W0k0jBW7DwCCgFwY3yGPkABVsdy2rDrifWO/fuKl3quPTAyjdAO2nR FOshww2Nj+IBWICk5Sg9bayF X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137653949" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:21 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:20 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:16 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 10/35] mtd: spi-nor: sst: Use flash late_init() for locking Date: Tue, 27 Jul 2021 07:51:57 +0300 Message-ID: <20210727045222.905056-11-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215322_514401_6F9A8D53 X-CRM114-Status: GOOD ( 10.87 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Locking ops are not discoverable via SFDP, use late_init() call. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/sst.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Locking ops are not discoverable via SFDP, use late_init() call. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/sst.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c index 980f4c09c91d..29d100febdbf 100644 --- a/drivers/mtd/spi-nor/sst.c +++ b/drivers/mtd/spi-nor/sst.c @@ -46,15 +46,11 @@ static const struct spi_nor_locking_ops sst26vf_locking_ops = { .is_locked = sst26vf_is_locked, }; -static void sst26vf_default_init(struct spi_nor *nor) +static void sst26vf_late_init(struct spi_nor *nor) { nor->params->locking_ops = &sst26vf_locking_ops; } -static const struct spi_nor_fixups sst26vf_fixups = { - .default_init = sst26vf_default_init, -}; - static const struct flash_info sst_parts[] = { /* SST -- large erase sizes are "overlays", "sectors" are 4K */ { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, @@ -88,7 +84,7 @@ static const struct flash_info sst_parts[] = { { "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) - .fixups = &sst26vf_fixups }, + .late_init = sst26vf_late_init}, }; static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, From patchwork Tue Jul 27 04:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510291 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=0Wu+WVZX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=CPynRznt; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlTl4Fvpz9sX2 for ; Tue, 27 Jul 2021 15:19:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=h7FSy8RDWq465AWDa1iOPAkJaupteGfWfozThGW79mc=; b=0Wu+WVZXocu1Ul jmOw4+4Se+MU8cAq5Y+FWiMF2mR0RmgL81ET9zeU1m5P4/H07fPwYtsgL1F9PqpAKafPvYWc45lG8 lg7fncV6Dnmh64gw5iqDno4iqQgfvPABM/3foQ8PTTg0y8L39ngEv7pyG9PYoYVyg+paN9BALY/tk p+26F7ANtHPecQFVHznpXlVW2+yh9jHgJr+ZLZTsKQIpFJEmbO8kv2wfb/tSoYShuNatO5O1ujLco +ooup1/PmieLt1nabnxZG334c5g51HPq5uV7VAhxa8oG36Uo+QRnSPG7JG7LPUWJrL3akjWFbVGPO Fsb6sw4djG1hUad+gJxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FUX-00DOpu-4A; Tue, 27 Jul 2021 05:18:57 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5r-00DHYa-Cu; Tue, 27 Jul 2021 04:53:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361607; x=1658897607; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sFFvbSCxDwFI/4WJvZ1kPyfQ0F55eHoZjShgBNhGvdw=; b=CPynRzntlrMBegiOmM8BYo9Dj2EDB6J8iYDbwZIoluAxdrr7pnp8LI57 xomMo1IuKW22C3sj7EFfyuUbgZoAloLc/Du2ld/JBM++FgxjtDdumOmEa bDfDb7OVhjY2y+hCX+EDHEmvHKmDpO6DqSQA8jhMlr3Pzrnx5XXS8sZda oZLVoEX5pn4S2JaxOhS3RC8ip+xdntgvcMI0AUy8CYI/2eKC8y0Iyj9IJ 2aRSrk4wSNfkXrO5PsWNWaKJLacXraAUDNI77M72mNHIO+yClK2gNFgCT 26MjkYXQvSUwAHStdQhso9cC4jPzwepj40t4xU95r2w3zolGi1SbhAb03 A==; IronPort-SDR: U3da8gcLfM9MG9doUZBcWS2As/NVaWIK0tIzYu/TNK+Q5nbXN3rD3XototM/adk8K1RYpGM0bJ 6P4N5XRWyBzlS9IZqHmcs2sBUfLCVVArSiaHYh4omQereAcnYEf8+IT4NgXSnI0sYJkNGU/fKd SYAkNa0xEF+WSvsMy/EzkBvmkqfnjisbrxmaPUvhPPfnGGDOB4fjI8Udz9pLWMzTc4TSfzqMrQ tJg1iQpMsmzcc9B21mZ2W+TrE8Ao8ACEJQwtzWHY3rqeH9+dBF5z8ks0oDEM5IpoWhGsNWAeK2 eAI6HotkyfLRiNzvpWfByK6M X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137653964" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:26 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:25 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:21 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 11/35] mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops Date: Tue, 27 Jul 2021 07:51:58 +0300 Message-ID: <20210727045222.905056-12-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215327_522222_B90FC720 X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: OTP info is not yet discoverable via SFDP, use late_init() to init the OTP ops. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/winbond.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 OTP info is not yet discoverable via SFDP, use late_init() to init the OTP ops. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/winbond.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 96573f61caf5..6be45d2291c6 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -147,17 +147,22 @@ static const struct spi_nor_otp_ops winbond_otp_ops = { static void winbond_default_init(struct spi_nor *nor) { nor->params->set_4byte_addr_mode = winbond_set_4byte_addr_mode; - if (nor->params->otp.org->n_regions) - nor->params->otp.ops = &winbond_otp_ops; } static const struct spi_nor_fixups winbond_fixups = { .default_init = winbond_default_init, }; +static void winbond_late_init(struct spi_nor *nor) +{ + if (nor->params->otp.org->n_regions) + nor->params->otp.ops = &winbond_otp_ops; +} + const struct spi_nor_manufacturer spi_nor_winbond = { .name = "winbond", .parts = winbond_parts, .nparts = ARRAY_SIZE(winbond_parts), .fixups = &winbond_fixups, + .late_init = winbond_late_init, }; From patchwork Tue Jul 27 04:51:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510292 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=W45yHUZ9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=jxiyHxrd; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlZP0blRz9sWl for ; Tue, 27 Jul 2021 15:23:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=1IwkUwh829KZTgcbRE7uJq5ZngtN+36DY9hr1LRC+w0=; b=W45yHUZ9UWBkE+ ZfbAdskJ6FTp/ehQ3thIsi/CwReo9HXu80TYIlg57oStzypJJ0jKEojD4weuarb2OSY+HXhohCzF5 wrFHu0ipQX/wJKkRoqHQ++IuWD+FnThQtn3oE+Pr/mgiPJM6CfHxFHNLoli/g+Po1QC/PPK5tlQv0 gwgLyo+jyvkf/uiqIM+BgUskpcUUzz9hZdawpqzXv9hYvcV5PkRjV8ASnGUe92qqjhlOJdGJjqlQ/ Fnp8Txa7/CrmyEFTVYsohNlTlTIFzTg5ThNiO/v2JW8d3B7L3x5uT0Wv4903sZwhWBT+ktLYrFaHC VcyZMn5ifszcMCkw4iRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FYR-00DPWD-Va; Tue, 27 Jul 2021 05:23:00 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F5x-00DHcL-2z; Tue, 27 Jul 2021 04:53:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361613; x=1658897613; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YlTavZcPTLHLDyRR/4iV9l7Py9LfBh5YVJy1QKVoG7o=; b=jxiyHxrdIblb4iy2V4ab5C5U70bAgYQ+KlUUUM90hrQ17v8A4bNQvgW8 9iPGkeu6tak3oBrxdkTY58HTg/BFDhtQw0KmsQlHcJz3dSSEf5W80v9Lw 7BpMaYRae54Arl0fP+vitCjiciKbUaxk+KHYSKrHivdYciFLnX3TaCKfH oVGa2xNMc1YT9tr2JHPUHBMkToePZ7mVScCgRkzCw2XbNX6bhMnGoPGKn imhqaui9WzeyFgkUWXLfLrPgw/XzY0b6dLc19JXX5znbUyM6z4gbDxKUe QncG9pUX8WRmZ5lRSDNbXOah5DEeh+A5eCFxTfx49VMK9VlFoIdLlCh0z A==; IronPort-SDR: /VYiasdu+SLELpP72wQJyygMl2TZSycTJsXIse9gyAoOc6TdRogbFOh+4QX2WzQLcp9l2wt+/u CFIGum3pg+djY0WrqxLaSU85qw8Gd54eccFooNnGjWiqmikc5k3LFVjmSGUKEvXCoLWlQfsUT/ v91/biL+FCDmCDQ6rsk9ZLTYefsSgCOx0er1yqQVDQMLe0P9/VAdOOuaLJ0TiUOTW1rqIrL27O DOqerhPtVuF0J0gBWkNIH3wvDR951teDuyJZbudQt8BONeoTlrgD4Tzu6VRGonuHOeoECIwx/K 9N6T1iHqKGwBntvIzgN1fhIg X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126055047" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:32 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:30 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:26 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 12/35] mtd: spi-nor: xilinx: Use manufacturer late_init() to set setup method Date: Tue, 27 Jul 2021 07:51:59 +0300 Message-ID: <20210727045222.905056-13-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215333_253738_0BBBD7AF X-CRM114-Status: GOOD ( 10.17 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: post_sfdp was misleading in this case, as SFDP is not supported by xilinx. Plus, there's no fixup here, just setting the correct setup method, as required by xilinx parts. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/xilinx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 post_sfdp was misleading in this case, as SFDP is not supported by xilinx. Plus, there's no fixup here, just setting the correct setup method, as required by xilinx parts. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/xilinx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/xilinx.c b/drivers/mtd/spi-nor/xilinx.c index 1138bdbf4199..a573c3cde414 100644 --- a/drivers/mtd/spi-nor/xilinx.c +++ b/drivers/mtd/spi-nor/xilinx.c @@ -77,18 +77,14 @@ static int xilinx_nor_setup(struct spi_nor *nor, return 0; } -static void xilinx_post_sfdp_fixups(struct spi_nor *nor) +static void xilinx_late_init(struct spi_nor *nor) { nor->params->setup = xilinx_nor_setup; } -static const struct spi_nor_fixups xilinx_fixups = { - .post_sfdp = xilinx_post_sfdp_fixups, -}; - const struct spi_nor_manufacturer spi_nor_xilinx = { .name = "xilinx", .parts = xilinx_parts, .nparts = ARRAY_SIZE(xilinx_parts), - .fixups = &xilinx_fixups, + .late_init = xilinx_late_init, }; From patchwork Tue Jul 27 04:52:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510301 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=AungE6jb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=a+oAGr4w; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlgZ17qlz9sWl for ; Tue, 27 Jul 2021 15:28:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=Q7M18Jz0G6qe2/qQDUjQXGzXdATULGfa9u9kmflv3xw=; b=AungE6jbVBhhXj GcrONhckIPdLf55ugv7XN012TkwbsP8Noi4EBLI8K+Spf9wCf87tw09zyH+oZ374bDI7glq56VfeX c5ulb0MHNO9HF3LnHGQP1TIMc/u3VquAZR/DDu0Gz8FAgXsCDBu4Sg4Y5Zuin2SdADiyfEbQAYzzO DNpIN4tVjn/PdCEnvDGX41FHH2bxTSrztEfjHliMKdger0rF0nJBX+5YkIhQbj4hqGeTRpFdPlp7h CGDGS+lRsvmIo8CxpBBS5mJ1dKgsOmSOhKD2y41tpA5wCpK88SEpWBTnvxgST7nS+NFz6CAKXSeKv mwk163mNTOmYxHxnrAmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8FcW-00DQEf-BO; Tue, 27 Jul 2021 05:27:12 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F61-00DHdT-5U; Tue, 27 Jul 2021 04:53:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361617; x=1658897617; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iSuRmV8kupJ1GFmuO0CIaIgArMhoyaX7b2kfMAny4uw=; b=a+oAGr4wBuZ4h5OGmu6YbBwtdL43CxZrg0Hsh8KRIQcGdTKAl8fakYR+ cwnNxZD/ABf2ztmLHtwz9a4U3TxwPh9+ctBKua8vP9VPo/vXchY/wJXvy hyz6O2JHx36ItQWHbPfTlO0T52YgYf66wSXARRyuKoRbdKj76OgdydfIJ hYFXEDbu/nnTGFsIwHf5w0GZCYkQEJdye/gF7riwdLc4SMAebtQqa0nZC rKcfCm1qqmhsKkpA1CjGnGhkslQwbphXdteCaNWqjcIAmROkNRaWdh9aZ aKOg49AI7UKmyUHEn3BWlm5qjbIz2RN7pNAZyoNFiIv+KJU3QkopJeVM2 A==; IronPort-SDR: 3yEOlbzqoXx0spaVogL6EFIyMtXIlGqU9SRlDjBQlNbbuAnh7ZlKJDa6Z/7dzMHy3jSKNtXmNz Pif+h3qJ+hhRLQ1Mnw/KYKvlMWvvFqO4TKk/ZeKRA7uzoZuU64YW1Fw+bf58hVpx9WWaKgI/X7 athk7mIQh1r+D+q8TfD9M+4dzp1OloZvgi5uEEupe6u/9VQMj0lqju1M2gaQQumH6vgIUI7ah/ JVny5HW7DInCC+HGLaqQcdYD8KyxFvHpX0/F5lMU6nRIOu3B0RLA2maEYI0TisFzpjQmeegvfw Sy4Q+8XQUcvzRp28ZuOFYEeH X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137653981" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:36 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:35 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:31 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 13/35] mtd: spi-nor: sst: Use manufacturer late_init() to set _write() Date: Tue, 27 Jul 2021 07:52:00 +0300 Message-ID: <20210727045222.905056-14-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215337_277872_E3C292E2 X-CRM114-Status: GOOD ( 11.46 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Setting the correct nor->mtd._write in a fixup hook was misleading, since this is not a fixup, just a specific setting for SST, that differs from the SPI NOR core default init. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/sst.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Setting the correct nor->mtd._write in a fixup hook was misleading, since this is not a fixup, just a specific setting for SST, that differs from the SPI NOR core default init. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/sst.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c index 29d100febdbf..eeb10766b70e 100644 --- a/drivers/mtd/spi-nor/sst.c +++ b/drivers/mtd/spi-nor/sst.c @@ -173,19 +173,15 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, return ret; } -static void sst_post_sfdp_fixups(struct spi_nor *nor) +static void sst_late_init(struct spi_nor *nor) { if (nor->info->flags & SST_WRITE) nor->mtd._write = sst_write; } -static const struct spi_nor_fixups sst_fixups = { - .post_sfdp = sst_post_sfdp_fixups, -}; - const struct spi_nor_manufacturer spi_nor_sst = { .name = "sst", .parts = sst_parts, .nparts = ARRAY_SIZE(sst_parts), - .fixups = &sst_fixups, + .late_init = sst_late_init, }; From patchwork Tue Jul 27 04:52:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510302 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=Zlu6xAVL; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=fSRGhuwM; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlmX5sjWz9sX2 for ; Tue, 27 Jul 2021 15:32:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=oWz6ATL7vrrcRGzLSSN0jr4iYlXNBnmnjFLFqGhO9+g=; b=Zlu6xAVL3gnw4o 5zbH0314thWCBsfdM/SDi/nNsYxRl1jGb733bg2qP+JJNlvooJ4IJJTWI6iOxD8kjz6+edSlwb7S6 Alhj2w8pw1OCzhc32smmY3dLyQUOfZwfkKWGDRXuYjcI90O28BZiLzGDm5bRJ9srsvDpY8O78ZPeG hznwK3rhXDdE3hAdwEdGog/XuQKQ2RpYOQvR4dQ5EFdK/eTxPz9kGGdkVc73vMo6EO+CPGjN4bMFX 7xShRz/09iKPk2oHA4d09OCcitu2U2PRMyOw/ZUtO3p9PCp3o43DpwIDligQebT8VC7ddcL3Zckc+ rCb25D3AdCygi+Jus+7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Fgu-00DQym-Q4; Tue, 27 Jul 2021 05:31:45 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F66-00DHez-Mt; Tue, 27 Jul 2021 04:53:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361622; x=1658897622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iN51XLl+urMrTqqdcj0HnYMBux/5PYfkWnkj91upvkI=; b=fSRGhuwMsyKGZAGwQat5X+78HMcoiZDxnUeo9+VkaBwyav7o/MFejV7Y wNhZiKwo0PaeUOP4JN5ehVz/rDXlHvDrZpDDqk3rsN+o7xFeiirLVGisa schh7pVKWRX13vBfksZR1fexQPTWmOGmtgS47wytjOQtnfwPyO9QtwFo4 5SfgXjdW1e02ep/YguPWT2Yz8hidbzkdle/QY3weYjoVmbEunx0bksoM5 WFVlid0uFTNLRefsETgknPZdJNQhjecVVT8kjHuIqliCxgglnlwm7B8Gw 7EFVtjWhHGqXtohCwdbySsH11AriDXhqHgMFO0K0J3Pb+96tpWms4Sfcj w==; IronPort-SDR: veBFMWgJqK4cB5BD0+IdcJC7q0ls8tTMZ8buF7SGCbDwVQO+/GkjIhuGg6RjrgvS+K2xDF9MNM sqnW7l99dK4pFaqjgKPwvFRX/we9QoGnSpt+2TS8pIhvln3CBZ3uA4BR6GFhkQaEldgbePh1QK XoHdqGPbJ27RKavyEA5rYsC5eOUewDRVLbn2sbnNgtbBXoRRXvKFrPrmn1x2MYlpzHfwakGdT7 rp25unXikGU+9cIEFs9S1NnnBliPKtSM/EmPzICherqm88WJKxMwr9he/eb4xtZb6ybOAFvS3a +ZgpEXhzkYA1EupEW9D/uqHg X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="63689471" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:41 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:40 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:36 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 14/35] mtd: spi-nor: spansion: Use manufacturer late_init() Date: Tue, 27 Jul 2021 07:52:01 +0300 Message-ID: <20210727045222.905056-15-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215342_916353_EE71244E X-CRM114-Status: GOOD ( 11.47 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: spansion_post_sfdp_fixups() was called regardless if the flash defined SFDP tables or not. A better place for this kind of parameters init is in manufacturer's late_init() hook. post_sfdp() should be [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 spansion_post_sfdp_fixups() was called regardless if the flash defined SFDP tables or not. A better place for this kind of parameters init is in manufacturer's late_init() hook. post_sfdp() should be called only when SFDP is defined. No functional change in this patch. Instead of doing the 4b opcodes settings at manufacturer level, thus also for every flash that will be introduced, this should be done just where it is needed, per flash. I'll let this for other patch. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/spansion.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index ee82dcd75310..aad7170768b4 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -276,7 +276,7 @@ static const struct flash_info spansion_parts[] = { }, }; -static void spansion_post_sfdp_fixups(struct spi_nor *nor) +static void spansion_late_init(struct spi_nor *nor) { if (nor->params->size <= SZ_16M) return; @@ -287,13 +287,9 @@ static void spansion_post_sfdp_fixups(struct spi_nor *nor) nor->mtd.erasesize = nor->info->sector_size; } -static const struct spi_nor_fixups spansion_fixups = { - .post_sfdp = spansion_post_sfdp_fixups, -}; - const struct spi_nor_manufacturer spi_nor_spansion = { .name = "spansion", .parts = spansion_parts, .nparts = ARRAY_SIZE(spansion_parts), - .fixups = &spansion_fixups, + .late_init = spansion_late_init, }; From patchwork Tue Jul 27 04:52:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510303 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=AEmKynCG; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=tMKwhmX/; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYltD3dDxz9s1l for ; Tue, 27 Jul 2021 15:37:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=0vI97lk7MvugtbCuM0JmpcvknIvpeVAqA3xLz3nfLuE=; b=AEmKynCG7bnWg7 S8A1EgxRkxTGIiI7YnYZP0oQW6aF7lhg+kQaYraNNwOLPuYmWRmuPfRksuKXpnB3ph8ijMAx50z/f qvCimg2k1h+WCoiHGqH8BLeb7XEYbg/gTrALH0vJNJ3NIpe1c7SnpowvWBlyFQyk86FF0+jwvXAXd eknuKbg3Qwjr6G7FN4jlNNm5G8yTgpeqEYuYaaLi45fCLGrMfzwJo8MaWcwK+/IZEPgug4Ve5DH4/ CLHofrhXXLX+fYhPj5Oz5gz4lEiFRNMM3tgFuAbYhtjDixc5ADs4D2yzSMQ9EUmb6wHu6IHq7TDF3 2Il1DA7xpvYNUbyJxvoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Flb-00DRmE-LS; Tue, 27 Jul 2021 05:36:36 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6B-00DHg2-UN; Tue, 27 Jul 2021 04:53:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361627; x=1658897627; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s+IGlN+uye5uhaNJhXu4Hwk6b/4NW9Rf6HIzmXPOgcI=; b=tMKwhmX/nlGwn6KPCWa60wy/FJRPVx56u38Fsb3oOwjOfpU+gU0lfmUW HnEHwQxGWKbKPoYaKaJR0x22SZWmRoDOtkP3yiDtIVwkO/a5O/EKUtviH GQqjDWN0M0rqcGxOIKe7B1LvIJqixqqD1LIXJiXErjkJB+fmL4cMgOzSt gL9nM/Lqb941sJGrK3VkGHEsPICRyBtKC4mYKrQXTZcsKWkN0ZuhbpsgH ap3eSQEV/IVyT+Xc6Oknayv+zgcy8oQ9ufZbpOTdDPHg9yIgLF13DiRDj WKJspI3w0YsHJlVhWICHz0vOOcqEVl5BdfJBK6jgYcqDUF/rf7YReQ66H g==; IronPort-SDR: jEKDt/h7q1F3Ek5F0YU/hmBdvZ1lhyeX1eRtbeaPWVxvb+KWqMCVAZJcD+ZE+DH/CQUqWv8Zoq dEV3teZS8wR7TpWoJujgbSg1sASEBaiw6/nnUGmzufjLj8aWQw8ejW3iij2IyGaoFHebPhmZtC 8FbNL/0QB08rS6Cq3vwejwvZ/zG+TWgJmYehlmz+8HnRwN/ZSOrL/Eeosqiqk1HXR9Td/4GP9T dvvwZA55Hq1Cz+hZUaMuKcNf48Q5EC2wsJjTY8jPMrCjtaO6CxFkcHPOSDe2a3ZNEDmJKDlX/X COjuz0J7h8CJTCdV0vqGpdgq X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="130482146" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:46 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:45 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:41 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 15/35] mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is defined Date: Tue, 27 Jul 2021 07:52:02 +0300 Message-ID: <20210727045222.905056-16-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215348_086424_5FDE7E07 X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: spi_nor_post_sfdp_fixups() was called even when there were no SFDP tables defined and the function name was misleading. We introduced the late_init() hook which is used to tweak various parameters that could not be extracted by other means, i.e. when parameters are not defined in the JESD216 SFDP standard, or when the [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 spi_nor_post_sfdp_fixups() was called even when there were no SFDP tables defined and the function name was misleading. We introduced the late_init() hook which is used to tweak various parameters that could not be extracted by other means, i.e. when parameters are not defined in the JESD216 SFDP standard, or when the flash_info flags are incomplete. Use spi_nor_post_sfdp_fixups() just to fix SFDP data. post_sfdp() hook is as of now used just by s28hs512t, mt35xu512aba, and both support SFDP, there's no functional change with this patch. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 66 +++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 15ccc9994215..1f38fa8ab2fa 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2509,6 +2509,25 @@ static void spi_nor_manufacturer_init_params(struct spi_nor *nor) nor->info->fixups->default_init(nor); } +/** + * spi_nor_post_sfdp_fixups() - Updates the flash's parameters and settings + * after SFDP has been parsed. + * @nor: pointer to a 'struct spi_nor' + * + * Typically used to tweak various parameters that could not be extracted by + * other means (i.e. when information provided by the SFDP tables are + * incomplete or wrong). + */ +static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) +{ + if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->post_sfdp) + nor->manufacturer->fixups->post_sfdp(nor); + + if (nor->info->fixups && nor->info->fixups->post_sfdp) + nor->info->fixups->post_sfdp(nor); +} + /** * spi_nor_sfdp_init_params() - Initialize the flash's parameters and settings * based on JESD216 SFDP standard. @@ -2523,11 +2542,12 @@ static void spi_nor_sfdp_init_params(struct spi_nor *nor) memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); - if (spi_nor_parse_sfdp(nor)) { - memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); - nor->addr_width = 0; - nor->flags &= ~SNOR_F_4B_OPCODES; - } + if (!spi_nor_parse_sfdp(nor)) + return spi_nor_post_sfdp_fixups(nor); + + memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); + nor->addr_width = 0; + nor->flags &= ~SNOR_F_4B_OPCODES; } /** @@ -2643,26 +2663,6 @@ static void spi_nor_info_init_params(struct spi_nor *nor) spi_nor_init_uniform_erase_map(map, erase_mask, params->size); } -/** - * spi_nor_post_sfdp_fixups() - Updates the flash's parameters and settings - * after SFDP has been parsed (is also called for SPI NORs that do not - * support RDSFDP). - * @nor: pointer to a 'struct spi_nor' - * - * Typically used to tweak various parameters that could not be extracted by - * other means (i.e. when information provided by the SFDP/flash_info tables - * are incomplete or wrong). - */ -static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) -{ - if (nor->manufacturer && nor->manufacturer->fixups && - nor->manufacturer->fixups->post_sfdp) - nor->manufacturer->fixups->post_sfdp(nor); - - if (nor->info->fixups && nor->info->fixups->post_sfdp) - nor->info->fixups->post_sfdp(nor); -} - /** * spi_nor_late_init_params() - Late initialization of default flash parameters. * @nor: pointer to a 'struct spi_nor' @@ -2709,18 +2709,12 @@ static void spi_nor_late_init_params(struct spi_nor *nor) * should be more accurate that the above. * spi_nor_sfdp_init_params() * - * Please note that there is a ->post_bfpt() fixup hook that can overwrite - * the flash parameters and settings immediately after parsing the Basic - * Flash Parameter Table. + * Please note that there are ->post_{bfpt, sfdp}() fixup hooks that can + * overwrite the flash parameters and settings immediately after table + * parsing. * * which can be overwritten by: - * 4/ Post SFDP flash parameters initialization. Used to tweak various - * parameters that could not be extracted by other means (i.e. when - * information provided by the SFDP/flash_info tables are incomplete or - * wrong). - * spi_nor_post_sfdp_fixups() - * - * 5/ Late flash parameters initialization, used to initialize flash + * 4/ Late flash parameters initialization, used to initialize flash * parameters that are not declared in the JESD216 SFDP standard. * spi_nor_late_init_params() */ @@ -2740,8 +2734,6 @@ static int spi_nor_init_params(struct spi_nor *nor) !(nor->info->flags & SPI_NOR_SKIP_SFDP)) spi_nor_sfdp_init_params(nor); - spi_nor_post_sfdp_fixups(nor); - spi_nor_late_init_params(nor); return 0; From patchwork Tue Jul 27 04:52:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510304 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=hv45wUVD; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=I2WBwJeA; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYlzC1bldz9s24 for ; Tue, 27 Jul 2021 15:41:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=KYK0WIwAuwoveOyTsLjYjZYzbOPK2gwoQumZEAC+Nv8=; b=hv45wUVD/XpVTU DJN7v1nczk2m8dEzRy44PVA/WkpxP4YYXfc4hay4Qlnldyzqji1Zaz5tj33A6iCqSq2lUTlVwXnWz Hye66pnjW2R5Cq86aZYDakdWxTtp95dISDHlFe/SBwWI5fGxT1htaQlOrvAYe+tdWVAjaa0YovgkH 1xdRqfRsjthSe696JpT5FXOYJ6GeI48VeMmZ9P/T4cpF7cd7uX7/PhttEMX4ePinoQJjr5EJedlh3 w0BYPhJF/b0DGkg3kdpHiQyiNmZf8efJhMNrGewXOH1UntmjPgwWxfPtPBoX0eayxaM0EVhC/OjSY OT4ANa8RcjEH1KpOfxIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Fpt-00DSUq-Oc; Tue, 27 Jul 2021 05:41:02 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6G-00DHg2-74; Tue, 27 Jul 2021 04:53:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361632; x=1658897632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7sygOHV1tKihRyLHBcbxw32cAQ3a9MX29yYfuJ8nECM=; b=I2WBwJeAJYBUVjXclOK2msyk58eIjKEH5jZuPLz9xFrlA5lW0JVrHFvU fst+oyWUGjyUpu+k15zIdxlVreQXrF1jEEQbxqaLKJrjJtFoqJmYZaX21 DcUM98pY/bsHRxY3zVvh7sOtu9yz2G6SPM31imbiBKza7l5LVN9/uE+8e sOam0+3KOmKvs4H1yGTnrM2VwwgIw9oG5Arer1lllZKNRyd2EVj5m0o0w +scqfbW+hSYC0zPHrZ60B7JKWK7IDTkm3VoRwMrKVVDsQ101Fnl/nF7CE qx+Cxva5CGXlpdpGCjONs6nXk4kyd55Wfsn76WXMWIgtvBuQwIHkn6FlI w==; IronPort-SDR: Csg0uB6gYqXwrFNR6VWLSHFCHgqftdB9gRINnxVtO+DB+dCAdqobHhLKvOZUblmsc1RNY/ZAm/ EjR/dmWTgbc/g1g6Vtpuz71u0VkCV4ErDueP7LjjxIeNFpMcf6XgbfpyhTw9USH11/+qna+PLB CpDTnd+gFBr/6xSwGyJKJiEDmjUxPZJeSaT3Vc8Z9QcekrJifRJOBoA0ranpJjF7fG8mJXZ9Hd ThSwGtHIYrCyrpuo0R5gcXYHxBi8xsrPaXPW8gyW0jyvqVLVf2ryDIO63t+RlKnl5PKn80B3j1 VfkCgkdmhRkW3bzKhAk281I8 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="130482159" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:51 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:50 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:46 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 16/35] mtd: spi-nor: core: Mark default_init() as deprecated Date: Tue, 27 Jul 2021 07:52:03 +0300 Message-ID: <20210727045222.905056-17-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215352_872252_666F667F X-CRM114-Status: GOOD ( 10.81 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: The goal is to remove the spagetti init of params. The flash should be initialized by the SFDP data, and when SFDP tables are not defined, by the flash_info flags. SFDP data can be corrected by the po [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 The goal is to remove the spagetti init of params. The flash should be initialized by the SFDP data, and when SFDP tables are not defined, by the flash_info flags. SFDP data can be corrected by the post_{bfpt, sfdp} when wrong, and in case of flash_info flags init, we'll use the late_init() hook, where checking for the SPI_NOR_SKIP_SFDP flag. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 13d5c5edfd27..625f4eed75f1 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -289,9 +289,8 @@ struct spi_nor_flash_parameter { /** * struct spi_nor_fixups - SPI NOR fixup hooks - * @default_init: called after default flash parameters init. Used to tweak - * flash parameters when information provided by the flash_info - * table is incomplete or wrong. + * @default_init: Deprecated. Use the post_{bfpt, sfdp}, or the late_init() + * hooks instead. * @post_bfpt: called after the BFPT table has been parsed * @post_sfdp: called after SFDP has been parsed (is also called for SPI NORs * that do not support RDSFDP). Typically used to tweak various From patchwork Tue Jul 27 04:52:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510306 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=p2BwJGyB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=VZS/8e+2; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYm4H22kNz9s24 for ; Tue, 27 Jul 2021 15:46:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=aOGlBiGwTxqtwUPSUXB3FAqF5+txueNSkvJrUUZ+3RI=; b=p2BwJGyBquzwdr X45vHgtY+OZCmoU+amQjNKi+N5dkUAg1DjMGoDy/gl166H3hBb/L9cJ0eZvIh412Y+tqrfTQIO2t9 R0VHZec6ZQW/RTrN01uHHZ8aDD0oZm3VMPB3tH1IBMv3Hmkak/MYj0fjY+vokl3erEsUgS76rmaEQ J2fjEM88RYoa4fveSnldPkl9MfNV60pZG7ouYL31fLC/VpkloVzOEg3dG4f1XGdpsjYOZwdzzK7Rr 1LjPms3NgVLTCNvr42W5Gc1ylP7xtXsJXDJOeSoZMWrl52OIyGsZi1wf3rkynFvxDe1MJFsbdHRTk gNCFPkXpfp28psAX0wXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Fu7-00DTBm-UC; Tue, 27 Jul 2021 05:45:24 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6L-00DHik-Cp; Tue, 27 Jul 2021 04:53:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361637; x=1658897637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iMd5MF3VKOKvR/sNxHGUhRLlcKGvQ0L1ZdjRzhncJT8=; b=VZS/8e+2aFgnIDsC6RnRBr+jmx1zll2z952ScNV65D/vuEFWDCNcP1AK 9yEz1H5FWARF9ApCzTanZdJBPvnp+ycmyywwu92ylAlArBDBUB714+KQm k2krCxgpnrdBv9g6/39c641VR8bI/tF9NIdrEQHph4dlQByAGPe02xHyT AwM3TDvblJqvBnj22NPWZjhMTfUl5+fEETOfJw/qem+ahc6/j9BSz32NL mlJCcerstirvT20uDvGODq+v/jMBAVSJ4OKinYTgsvhrPfYZyEfu6qRsG UZ7RZUQDFE/s6H+WGnUae0+ExBJU9T0+h3jKwJcfWz9OgONSnbh007+KG Q==; IronPort-SDR: 43bZDfU9h4Z1yTrDDpACfmFA7P4FPFmgMt5wmojZ7NcVLiPRTjYFN0oU9rDrO1mS7uqC0KUFdM iZ6u+XiHdY7B6dlfguQ5KKpAFNiTSeJgzTPTRv0nMDIhogFi7Nus4jITDe3wpJktcBmdRt6+t0 25qgJtPVsTM9fAog9r+ltDzX0HPqju+GeoSalNWK9Y1YXlZfg/iU7QsUl+omaLY9aLhBL0XfBm cazEA4DepdOUJs7GHqrWrFebUe80Bvks3N9c3XENF7CH33y8i8mBJBSPWdPM/GJ0L3CZGeYNSC avr80q7BIC+xODeQbj9I41Fr X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137654021" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:53:56 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:53:56 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:51 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 17/35] mtd: spi-nor: Introduce spi_nor_nonsfdp_flags_init() Date: Tue, 27 Jul 2021 07:52:04 +0300 Message-ID: <20210727045222.905056-18-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215357_524632_84C687CF X-CRM114-Status: GOOD ( 14.63 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Used to initialize the NOR flags for settings that are not defined in the JESD216 SFDP standard, thus can not be retrieved when parsing SFDP. No functional change. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 88 ++++++++++++++++++++++ 1 file changed, 52 insertions(+), 36 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Used to initialize the NOR flags for settings that are not defined in the JESD216 SFDP standard, thus can not be retrieved when parsing SFDP. No functional change. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 88 ++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 1f38fa8ab2fa..6a8617346764 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2687,6 +2687,56 @@ static void spi_nor_late_init_params(struct spi_nor *nor) spi_nor_init_default_locking_ops(nor); } +/** + * spi_nor_nonsfdp_flags_init() - Initialize NOR flags for settings that are not + * defined in the JESD216 SFDP standard, thus can not be retrieved when parsing + * SFDP. + * @nor: pointer to a 'struct spi_nor' + */ +static void spi_nor_nonsfdp_flags_init(struct spi_nor *nor) +{ + const struct flash_info *info = nor->info; + struct device_node *np = spi_nor_get_flash_node(nor); + + if (of_property_read_bool(np, "broken-flash-reset")) + nor->flags |= SNOR_F_BROKEN_RESET; + + if (info->flags & SPI_NOR_SWP_IS_VOLATILE) + nor->flags |= SNOR_F_SWP_IS_VOLATILE; + + if (info->flags & SPI_NOR_HAS_LOCK) + nor->flags |= SNOR_F_HAS_LOCK; + + if (info->flags & SPI_NOR_HAS_TB) { + nor->flags |= SNOR_F_HAS_SR_TB; + if (info->flags & SPI_NOR_TB_SR_BIT6) + nor->flags |= SNOR_F_HAS_SR_TB_BIT6; + } + + if (info->flags & SPI_NOR_4BIT_BP) { + nor->flags |= SNOR_F_HAS_4BIT_BP; + if (info->flags & SPI_NOR_BP3_SR_BIT6) + nor->flags |= SNOR_F_HAS_SR_BP3_BIT6; + } + + if (info->flags & NO_CHIP_ERASE) + nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; + + if (info->flags & USE_FSR) + nor->flags |= SNOR_F_USE_FSR; + + if (info->flags & USE_CLSR) + nor->flags |= SNOR_F_USE_CLSR; + + /* + * Make sure the XSR_RDY flag is set before calling + * spi_nor_wait_till_ready(). Xilinx S3AN share MFR + * with Atmel SPI NOR. + */ + if (info->flags & SPI_NOR_XSR_RDY) + nor->flags |= SNOR_F_READY_XSR_RDY; +} + /** * spi_nor_init_params() - Initialize the flash's parameters and settings. * @nor: pointer to a 'struct spi_nor'. @@ -2736,6 +2786,8 @@ static int spi_nor_init_params(struct spi_nor *nor) spi_nor_late_init_params(nor); + spi_nor_nonsfdp_flags_init(nor); + return 0; } @@ -3078,7 +3130,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, const struct flash_info *info; struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; - struct device_node *np = spi_nor_get_flash_node(nor); int ret; int i; @@ -3115,17 +3166,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, mutex_init(&nor->lock); - /* - * Make sure the XSR_RDY flag is set before calling - * spi_nor_wait_till_ready(). Xilinx S3AN share MFR - * with Atmel SPI NOR. - */ - if (info->flags & SPI_NOR_XSR_RDY) - nor->flags |= SNOR_F_READY_XSR_RDY; - - if (info->flags & SPI_NOR_HAS_LOCK) - nor->flags |= SNOR_F_HAS_LOCK; - mtd->_write = spi_nor_write; /* Init flash parameters based on flash_info struct and SFDP */ @@ -3147,27 +3187,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, mtd->_get_device = spi_nor_get_device; mtd->_put_device = spi_nor_put_device; - if (info->flags & USE_FSR) - nor->flags |= SNOR_F_USE_FSR; - if (info->flags & SPI_NOR_HAS_TB) { - nor->flags |= SNOR_F_HAS_SR_TB; - if (info->flags & SPI_NOR_TB_SR_BIT6) - nor->flags |= SNOR_F_HAS_SR_TB_BIT6; - } - - if (info->flags & NO_CHIP_ERASE) - nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; - if (info->flags & USE_CLSR) - nor->flags |= SNOR_F_USE_CLSR; - if (info->flags & SPI_NOR_SWP_IS_VOLATILE) - nor->flags |= SNOR_F_SWP_IS_VOLATILE; - - if (info->flags & SPI_NOR_4BIT_BP) { - nor->flags |= SNOR_F_HAS_4BIT_BP; - if (info->flags & SPI_NOR_BP3_SR_BIT6) - nor->flags |= SNOR_F_HAS_SR_BP3_BIT6; - } - if (info->flags & SPI_NOR_NO_ERASE) mtd->flags |= MTD_NO_ERASE; @@ -3175,9 +3194,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, nor->page_size = nor->params->page_size; mtd->writebufsize = nor->page_size; - if (of_property_read_bool(np, "broken-flash-reset")) - nor->flags |= SNOR_F_BROKEN_RESET; - /* * Configure the SPI memory: * - select op codes for (Fast) Read, Page Program and Sector Erase. From patchwork Tue Jul 27 04:52:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510311 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=a0QoG1pW; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=I3wSj6Ph; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmB40RDtz9s24 for ; Tue, 27 Jul 2021 15:51:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=qA+AdkNKLiXH8+8liujxHEA2GG9E6lNpLkpStnlSt2I=; b=a0QoG1pWoDEwxB Olnqh8pj6RrNtchcD1VJVv5fQO6Ok3rA3bNX7051EgHI4GVbmHynPTfXRndXBBVOZXiFAGf0LmLY8 FxjlcyT6dgvKgJvQ+RihS2V2CG7rFOKUJ6aqMOGI37KrUgHT3dxXN4o8znB0h7IvKxB2sPS6hLYEP GdIEIOt09RxM8MCX/zQ/Lrpki4G35dBu0kK0gK5VUx/xG7jSqXj5V2DzGa1alKPpY1KrNf3jUuOnt PvRxEmt2y+UCxuZFMWcTT4kyvuIGYUy2hXwN8gk2GXsBT8l4cY9N77+V6ejtAqlrEenxXHGmlBMMJ MIMXbOBXfTkit6B3s/gA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Fyx-00DTyM-9A; Tue, 27 Jul 2021 05:50:23 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6R-00DHkY-5b; Tue, 27 Jul 2021 04:54:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361642; x=1658897642; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cVj0kbSGBe7lT3ccoMoy4blkRxb3Ft64D/me5Ns8TJs=; b=I3wSj6Ph9SbshfYMTY0xerX+a9x4BuX9weaM/LXxXE1Dj1+Km+72G4GF FUPDgBKy2xNbIhF4Nd9z1YD3GLR+OOiLHOFYwvjjfLju/dt/4q2k33uZO FLCByExqsh0ce0JaA7+uTeUG5SGu7REp5bPmdoC7K9ZErnaSVpfYz5E+L jIwTa5fELAQzGzBgsbO1S+IRojPAJa8czMAjIsjA+oNIiPs3KaTjUPU8w mbHIcARzrzyjaFs2Do/al5ICcQ1L4Qwb1a4bJTraiUvRZmV5nTwD4JIW/ 4bvCTSMNEnRUEu5JxY5ulcH0plz6e+G6MiSTHi+JC9030O4B3eb/i6Y+x Q==; IronPort-SDR: K0f3wXzNnHPXR4wWqY6Q2ah0aPRX0/h7qNAmRsk+pnpZWQ978fn85MdxsKtBAaOM4ntcMwxhhx ZYU7l+OZLM0IA3+pQ+S8uE4Lu7iQwJy2Q4GAHRljuYO9Bt3rbpps9EziCXtj9G1BTC1yuwR1gr 8jQhUFGnufaFqOxapV/XCfI6o1+8iH4di4uU+4sNT96vGznVcb44VUfiJ4zGgQO6xZ8aTX8hcX Asoti22bz9mR+K76YbHKyFTvPAbb6JXrCWiDIzgaQodtrGJDfBUNin182QOMZDJFbd+BECIXk4 sSAKlHtjRGFILkcuF9Fy0jBF X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="123560018" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:01 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:01 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:53:56 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 18/35] mtd: spi-nor: Get rid of SPI_NOR_4B_OPCODES flag Date: Tue, 27 Jul 2021 07:52:05 +0300 Message-ID: <20210727045222.905056-19-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215403_387913_C4A17042 X-CRM114-Status: GOOD ( 18.06 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of flash_info flags that indicate settings which can be discovered when parsing SFDP. It will be clearer who sets what, and we'll restrict the flash settings that a developer can choose to onl [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of flash_info flags that indicate settings which can be discovered when parsing SFDP. It will be clearer who sets what, and we'll restrict the flash settings that a developer can choose to only settings that are not SFDP discoverable. Whether a flash supports 4byte opcodes or not, is discoverable when parsing the optional 4-byte address instruction table. Flashes that do not support the 4bait SFDP table should set the SNOR_F_4B_OPCODES flag in the late_init() call. Flashes that define the 4bait SFDP table but gets it wrong, should set the flag in a post_sfdp fixup hook. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 3 --- drivers/mtd/spi-nor/core.h | 32 ++++++++++++++++---------------- drivers/mtd/spi-nor/gigadevice.c | 7 ++++--- drivers/mtd/spi-nor/issi.c | 12 ++++++------ drivers/mtd/spi-nor/macronix.c | 18 ++++++++++-------- drivers/mtd/spi-nor/micron-st.c | 22 +++++++++++++--------- drivers/mtd/spi-nor/spansion.c | 12 ++++++------ 7 files changed, 55 insertions(+), 51 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 6a8617346764..240d5c31af88 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3204,9 +3204,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (ret) return ret; - if (info->flags & SPI_NOR_4B_OPCODES) - nor->flags |= SNOR_F_4B_OPCODES; - if (info->flags & SPI_NOR_IO_MODE_EN_VOLATILE) nor->flags |= SNOR_F_IO_MODE_EN_VOLATILE; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 625f4eed75f1..dfdc51a26cad 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -348,40 +348,36 @@ struct flash_info { * S3AN flashes have specific opcode to * read the status register. */ -#define SPI_NOR_4B_OPCODES BIT(11) /* - * Use dedicated 4byte address op codes - * to support memory size above 128Mib. - */ -#define NO_CHIP_ERASE BIT(12) /* Chip does not support chip erase */ -#define SPI_NOR_SKIP_SFDP BIT(13) /* Skip parsing of SFDP tables */ -#define USE_CLSR BIT(14) /* use CLSR command */ -#define SPI_NOR_OCTAL_READ BIT(15) /* Flash supports Octal Read */ -#define SPI_NOR_TB_SR_BIT6 BIT(16) /* +#define NO_CHIP_ERASE BIT(11) /* Chip does not support chip erase */ +#define SPI_NOR_SKIP_SFDP BIT(12) /* Skip parsing of SFDP tables */ +#define USE_CLSR BIT(13) /* use CLSR command */ +#define SPI_NOR_OCTAL_READ BIT(14) /* Flash supports Octal Read */ +#define SPI_NOR_TB_SR_BIT6 BIT(15) /* * Top/Bottom (TB) is bit 6 of * status register. Must be used with * SPI_NOR_HAS_TB. */ -#define SPI_NOR_4BIT_BP BIT(17) /* +#define SPI_NOR_4BIT_BP BIT(16) /* * Flash SR has 4 bit fields (BP0-3) * for block protection. */ -#define SPI_NOR_BP3_SR_BIT6 BIT(18) /* +#define SPI_NOR_BP3_SR_BIT6 BIT(17) /* * BP3 is bit 6 of status register. * Must be used with SPI_NOR_4BIT_BP. */ -#define SPI_NOR_OCTAL_DTR_READ BIT(19) /* Flash supports octal DTR Read. */ -#define SPI_NOR_OCTAL_DTR_PP BIT(20) /* Flash supports Octal DTR Page Program */ -#define SPI_NOR_IO_MODE_EN_VOLATILE BIT(21) /* +#define SPI_NOR_OCTAL_DTR_READ BIT(18) /* Flash supports octal DTR Read. */ +#define SPI_NOR_OCTAL_DTR_PP BIT(19) /* Flash supports Octal DTR Page Program */ +#define SPI_NOR_IO_MODE_EN_VOLATILE BIT(20) /* * Flash enables the best * available I/O mode via a * volatile bit. */ -#define SPI_NOR_SWP_IS_VOLATILE BIT(22) /* +#define SPI_NOR_SWP_IS_VOLATILE BIT(21) /* * Flash has volatile software write * protection bits. Usually these will * power-up in a write-protected state. */ -#define SPI_NOR_PARSE_SFDP BIT(23) /* +#define SPI_NOR_PARSE_SFDP BIT(22) /* * Flash initialized based on the SFDP * tables. */ @@ -569,4 +565,8 @@ static struct spi_nor __maybe_unused *mtd_to_spi_nor(struct mtd_info *mtd) return mtd->priv; } +static inline void snor_f_4b_opcodes(struct spi_nor *nor) +{ + nor->flags |= SNOR_F_4B_OPCODES; +} #endif /* __LINUX_MTD_SPI_NOR_INTERNAL_H */ diff --git a/drivers/mtd/spi-nor/gigadevice.c b/drivers/mtd/spi-nor/gigadevice.c index 447d84bb2128..ff523fe734ef 100644 --- a/drivers/mtd/spi-nor/gigadevice.c +++ b/drivers/mtd/spi-nor/gigadevice.c @@ -47,9 +47,10 @@ static const struct flash_info gigadevice_parts[] = { SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, { "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | - SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6) - .fixups = &gd25q256_fixups }, + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | + SPI_NOR_TB_SR_BIT6) + .fixups = &gd25q256_fixups, + .late_init = snor_f_4b_opcodes, }, }; const struct spi_nor_manufacturer spi_nor_gigadevice = { diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c index 1e5bb5408b68..aeff8f60cbae 100644 --- a/drivers/mtd/spi-nor/issi.c +++ b/drivers/mtd/spi-nor/issi.c @@ -45,9 +45,9 @@ static const struct flash_info issi_parts[] = { { "is25lp128", INFO(0x9d6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ) }, { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) - .fixups = &is25lp256_fixups }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .fixups = &is25lp256_fixups, + .late_init = snor_f_4b_opcodes, }, { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128, @@ -55,9 +55,9 @@ static const struct flash_info issi_parts[] = { { "is25wp128", INFO(0x9d7018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "is25wp256", INFO(0x9d7019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) - .fixups = &is25lp256_fixups }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .fixups = &is25lp256_fixups, + .late_init = snor_f_4b_opcodes, }, /* PMC */ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index fba85efafb47..9709eb68b613 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -105,29 +105,31 @@ static const struct flash_info macronix_parts[] = { { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) .fixups = &mx25l25635_fixups }, - { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_4B_OPCODES) }, + { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) + .late_init = snor_f_4b_opcodes, }, { "mx25u51245g", INFO(0xc2253a, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "mx25v8035f", INFO(0xc22314, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, { "mx66l51235f", INFO(0xc2201a, 0, 64 * 1024, 1024, - SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) }, + SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "mx66u51235f", INFO(0xc2253a, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "mx66l1g45g", INFO(0xc2201b, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, { "mx66u2g45g", INFO(0xc2253c, 0, 64 * 1024, 4096, - SECT_4K | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, }; static void macronix_default_init(struct spi_nor *nor) diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index c224e59820a1..72cc4673bf88 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -121,13 +121,13 @@ static struct spi_nor_fixups mt35xu512aba_fixups = { static const struct flash_info micron_parts[] = { { "mt35xu512aba", INFO(0x2c5b1a, 0, 128 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ | - SPI_NOR_4B_OPCODES | SPI_NOR_OCTAL_DTR_READ | - SPI_NOR_OCTAL_DTR_PP | + SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP | SPI_NOR_IO_MODE_EN_VOLATILE) - .fixups = &mt35xu512aba_fixups}, + .fixups = &mt35xu512aba_fixups, + .late_init = snor_f_4b_opcodes, }, { "mt35xu02g", INFO(0x2c5b1c, 0, 128 * 1024, 2048, - SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ | - SPI_NOR_4B_OPCODES) }, + SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ) + .late_init = snor_f_4b_opcodes, }, }; static const struct flash_info st_parts[] = { @@ -149,25 +149,29 @@ static const struct flash_info st_parts[] = { SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, { "mt25ql256a", INFO6(0x20ba19, 0x104400, 64 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mt25qu256a", INFO6(0x20bb19, 0x104400, 64 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, { "mt25ql512a", INFO6(0x20ba20, 0x104400, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | SPI_NOR_BP3_SR_BIT6) }, { "mt25qu512a", INFO6(0x20bb20, 0x104400, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index aad7170768b4..af10833f56d8 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -259,14 +259,14 @@ static const struct flash_info spansion_parts[] = { { "s25fl208k", INFO(0x014014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ) }, { "s25fl064l", INFO(0x016017, 0, 64 * 1024, 128, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "s25fl128l", INFO(0x016018, 0, 64 * 1024, 256, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "s25fl256l", INFO(0x016019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) }, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + .late_init = snor_f_4b_opcodes, }, { "cy15x104q", INFO6(0x042cc2, 0x7f7f7f, 512 * 1024, 1, SPI_NOR_NO_ERASE) }, { "s28hs512t", INFO(0x345b1a, 0, 256 * 1024, 256, From patchwork Tue Jul 27 04:52:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510313 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=pPVbVLyh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=KPMKjhyB; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmHx2gwYz9sXM for ; Tue, 27 Jul 2021 15:56:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=sVErBaoI8J4do/6ODGdtCWkb8uXJ9ug0B8yEbsRmKgo=; b=pPVbVLyhiLNjtQ 1X24u5DpNcolQ6xEugyBo8guI62Gq8lJaM2Wv/1bOY6VKrwAY9FsdpY8zSL0FkicNtBXgi/6NsRR3 ui2nMwk5gLiTuvyWNysM3QxMCqxjgnVlnjIdt9RHXBqyfg20+Ku9ZVzlhXm4dMHHHQmTyRx+1b7p1 MineF7RrQ65TckcHT9N9cU8rKh8uYnN3TIrdPqX7DiKFjvEwVOqTfZxtqDjsyO4Cv9JV4Hmrp6ofH 2IVPG7JO4bIBwsbLyRrE2cNe8KsXIfUN+2KWHi5K7l4iaKt+gTCchQFigzjbvP0Jt6eN/3Yy7nv7O /KQvtC7hmdsNjiwt9U0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8G3m-00DUmh-8o; Tue, 27 Jul 2021 05:55:22 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6V-00DHkY-EX; Tue, 27 Jul 2021 04:54:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361647; x=1658897647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jS6nbw3I4zv0fIPeQBXIY5jxxOe47HQkmbUGrc480eQ=; b=KPMKjhyBiBvrmERKULRvRyW1eoek++VCu4Hj/VetNv5EtOReGCnEaA0T fR67t4A6jDCQtfU8HVIe+ervXR8zBGt4ijEIE7YID3sY2J9EBzeHzX3oB q1VKuVcQHtnKPt6HG4hc02Y+y3JscGG1FI5RRRkXRg+m6JJ/D8Gy6+YFn eBHHk6Fwj64a2YJLixuUWbKdBilhu+jo3aGnQPiDITpNkdhVZO9E2GcGZ gklS8X/m5yuvKYqcOqGvwgiX97S0FRQC1UrPe+v0ip7UfP9nd40s9NYbL pLzKZ2soXf17NM3XxK01v6dnwpZtiATTldAcHdhFEdG5Xj9xrxeauJQsl w==; IronPort-SDR: EbLnsmlB66hSQJ1YjCE/c1GNhGfiipcd1EfNwGPHWZ29bgrj8OhYM5oju0bjJOOJ0B6nvBHv3J Fcv1QFZntOYX5gSoRN8ZO4pY9MR259PGm23Rihe+Ev5D54sgMYnnrZXDB5PmxhXSBTQq3oDeUC cnD4Wka3j+JY4AWuZhaeh7ZCxvcvdtxxT1ceuuWrjO6alEx3DKk0GGC6JObvR3WN+bOmprz2Uh lxxyt6M1FelqQ3IZLexaEMAv2XkdMi4OSuLJzl0Y3oWlYan7oGzLa2Mx2xy2nQkyer0mGEzWip i/5+8oZIy2a/5hZ3I2aThKyK X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="123560027" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:06 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:06 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:01 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 19/35] mtd: spi-nor: Get rid of SPI_NOR_IO_MODE_EN_VOLATILE flag Date: Tue, 27 Jul 2021 07:52:06 +0300 Message-ID: <20210727045222.905056-20-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215407_630116_36807BC4 X-CRM114-Status: GOOD ( 13.58 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of flash_info flags that indicate settings which can be discovered when parsing SFDP. It will be clearer who sets what, and we'll restrict the flash settings that a developer can choose to onl [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of flash_info flags that indicate settings which can be discovered when parsing SFDP. It will be clearer who sets what, and we'll restrict the flash settings that a developer can choose to only settings that are not SFDP discoverable. SNOR_F_IO_MODE_EN_VOLATILE is discoverable when parsing the optional SCCR Map SFDP table. Flashes that do not define this table should set the flag in the late_init() call. Flashes that define the SFDP optional table but get the value wrong, should fix it in a post_sfdp fixup hook. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 3 --- drivers/mtd/spi-nor/core.h | 9 ++------- drivers/mtd/spi-nor/micron-st.c | 11 ++++++++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 240d5c31af88..9885d434ea83 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3204,9 +3204,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (ret) return ret; - if (info->flags & SPI_NOR_IO_MODE_EN_VOLATILE) - nor->flags |= SNOR_F_IO_MODE_EN_VOLATILE; - ret = spi_nor_set_addr_width(nor); if (ret) return ret; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index dfdc51a26cad..987797a789c8 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -367,17 +367,12 @@ struct flash_info { */ #define SPI_NOR_OCTAL_DTR_READ BIT(18) /* Flash supports octal DTR Read. */ #define SPI_NOR_OCTAL_DTR_PP BIT(19) /* Flash supports Octal DTR Page Program */ -#define SPI_NOR_IO_MODE_EN_VOLATILE BIT(20) /* - * Flash enables the best - * available I/O mode via a - * volatile bit. - */ -#define SPI_NOR_SWP_IS_VOLATILE BIT(21) /* +#define SPI_NOR_SWP_IS_VOLATILE BIT(20) /* * Flash has volatile software write * protection bits. Usually these will * power-up in a write-protected state. */ -#define SPI_NOR_PARSE_SFDP BIT(22) /* +#define SPI_NOR_PARSE_SFDP BIT(21) /* * Flash initialized based on the SFDP * tables. */ diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index 72cc4673bf88..31ebd4c9b431 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -118,13 +118,18 @@ static struct spi_nor_fixups mt35xu512aba_fixups = { .post_sfdp = mt35xu512aba_post_sfdp_fixup, }; +static void mt35xu512aba_late_init(struct spi_nor *nor) +{ + nor->flags |= SNOR_F_4B_OPCODES; + nor->flags |= SNOR_F_IO_MODE_EN_VOLATILE; +} + static const struct flash_info micron_parts[] = { { "mt35xu512aba", INFO(0x2c5b1a, 0, 128 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ | - SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP | - SPI_NOR_IO_MODE_EN_VOLATILE) + SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) .fixups = &mt35xu512aba_fixups, - .late_init = snor_f_4b_opcodes, }, + .late_init = mt35xu512aba_late_init, }, { "mt35xu02g", INFO(0x2c5b1c, 0, 128 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ) .late_init = snor_f_4b_opcodes, }, From patchwork Tue Jul 27 04:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510316 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=kIBF3tAd; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=W3pzG8zi; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmQ912LFz9sRK for ; Tue, 27 Jul 2021 16:01:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=6AgytYuBT4Yg4HShlWDVx5kM41pp5bLWQYFilRPGVZk=; b=kIBF3tAdY4YC8F LecZ+3l6YTvHtjb9HXuVPx9jnzVCLti4Ps09K9BHfkN3iahiBlE2bDYI03pYNfTKLyqU5QNlfMjlx 4OxIJpqDHxp3ZClh9JxF667mqIiegiQd3acsyOMaG9OuH9exJbBzmrrjt4NjcvJdZ+LthqQQ2zrlC lGBe+pDgQefOB6EiIOie6loBSYVazEaGC/XC8dgNxN3Eq+BRNeuUOZtrAtxp1hyncIB72ws2oZzvl tXAsQvDB1lIFmqLULiDYj1OiTWHg8IkoSk5a11UtjvTmN5nXk7xBKxigcY8SE5im53pTgVaNtD1gS Imub1foC3tZrY93fdu8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8G8z-00DWMC-EF; Tue, 27 Jul 2021 06:00:46 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6a-00DHkY-Q4; Tue, 27 Jul 2021 04:54:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361652; x=1658897652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z1KEnQMB1TWuUPku8a8nzjp3TzBTGce4VMYNdWlm5es=; b=W3pzG8zi46TnKPaNBgXet+8Fr5ybs/MBEraYtW8LHKwQhpZYIMuZJd6x CWMTBc14gDbH0b5XXgO2lGHjz5D1KvammiqwiTzF8TgWMvR5RFd5LFrDB CkFmlEaKf3hzCqkoRYChXA7Czj7nqZCuFrTszvmuJ8LQws1oPoWie5wf9 Lbos0DV58hAZ9ZETDbyUu4TDt68Xqjr34UlyF6NFxvjCB1rRBuBWPIj4D Lr753LUtWTaGf0AuTYbrb6Ou8Nbn8aswmqnLb0NepHbJoDVjrjmm31Tf1 h82zckIRM0sNsNzD8n50lJv/cJjN/6qyvcA/xjhXbnOn++CiMMNQOqacU Q==; IronPort-SDR: 6gGHgYUmm0stu3M/VthlRHnK2qnoedZA1MNhdL3cUMkyUS18TBkpmVP+WOKU68SstMKZMEg2RK w3hSm/KAvp8dVMCzEvf3Wz++/5T7CtL57nrh5rufM+2RN8mShq7j62Id0HJrysrkePxsXfPRFI eFwlnjVCieXP0/R9T0iEaCxGz9c7Yh78/scqOcE2CaJI/cDrvUK4OcyFTSxWT2DV1uN7X8OvKz 1Mf1fdgwQLoJt6shtzXlLFUHA7xOqIbddszoDTYJtaNKRc3+QjnbCHRI4+VRBs4o/WoEfAxfl6 x39iuF3vivFQMdXe9DDmt781 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="123560030" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:11 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:11 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:06 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 20/35] mtd: spi-nor: core: Use container_of to get the pointer to struct spi_nor Date: Tue, 27 Jul 2021 07:52:07 +0300 Message-ID: <20210727045222.905056-21-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215412_951199_591546AD X-CRM114-Status: GOOD ( 10.62 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get the pointer to the containing struct spi_nor by using container_of. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 1 - drivers/mtd/spi-nor/core.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get the pointer to the containing struct spi_nor by using container_of. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 1 - drivers/mtd/spi-nor/core.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 9885d434ea83..5c8cffb5e6f2 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3175,7 +3175,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (!mtd->name) mtd->name = dev_name(dev); - mtd->priv = nor; mtd->type = MTD_NORFLASH; mtd->writesize = nor->params->writesize; mtd->flags = MTD_CAP_NORFLASH; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 987797a789c8..8fddc685d2d3 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -557,7 +557,7 @@ void spi_nor_otp_init(struct spi_nor *nor); static struct spi_nor __maybe_unused *mtd_to_spi_nor(struct mtd_info *mtd) { - return mtd->priv; + return container_of(mtd, struct spi_nor, mtd); } static inline void snor_f_4b_opcodes(struct spi_nor *nor) From patchwork Tue Jul 27 04:52:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510320 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=bAV2r2qZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=uKJiNXUb; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmW10BrPz9sRK for ; Tue, 27 Jul 2021 16:05:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=p9LlfiXKBkzq3Vv2s1l/Cmup/wBtz9OsC6/VkitK2mY=; b=bAV2r2qZ5HsEhO unJhv3O8W4I0CM5GZ0EABjjt6lqUy7eqD/xByxVt3s9t2xomuxykOME+Pi9XXU9Zfyco/rqzuU5Fm CObjEFPLgAWUOb9AR2CU2N1vBBOeqNc0tRaoMjXjfs6X1ZEPKspbaH4Fiswotb3/uP8uPPvzYyUOE n/6kdP6ZxnoNTe+66BkQNQxIhDz84YT20oxG3YySW7uFXtjuN6IKtQkwLV/7xDHDz04NSn3hIB8qK qxtiG1i4AqdEh5hIYn8n79Pg7kbGPrucVT2EnX6tNP/aEr9Omct3QCklWByoelXSBtjm20wbsDGfy PyBe783WAlnJJXoTbBeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GD3-00DXT9-MW; Tue, 27 Jul 2021 06:04:58 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6g-00DHp7-4I; Tue, 27 Jul 2021 04:54:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361658; x=1658897658; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OQeQ2rKKd/hcEVSPOXJJh3XAVaCs3IGWXsqePC50tlk=; b=uKJiNXUbMtrhsJiyxH0XhdRplKlynwijxeRy6OkXAFJBx1LRjdW+GV36 4ZOA3TTMW3W3D6nBOaMn1EHh7ThNGiBqUzr+bLkc0s9nZ0xPcrdyZU38v aKoU4ZOLaWCwkCvG2KRoSmWjJ/S0PAzmal6/cp+XwmfeLZfTHpe3X1H4d pONfePD1p+NUNPytZV0RAq4E0uoTiyx2RSU8yKthERajcJCOk/u9VsTe+ i+SM2DM0O+Akk9Ayx9Do/M1x5IFwcK4v30ezDCK+aEx8W9qFpOfK3IByc e3Y5S5t8NohVnBZSjSUCelBDu2CMoOcowuKjK+pDKqDaU0i6XdGHh4I0z g==; IronPort-SDR: 8gTCAuo7Ngm4K7EpFK72yAc/ythNoSqLFsqUTBHe6nIj2TqcE3CoXFHC2cNW+XI+bNpd7Ve/u7 LvUGzUCmjuRxF1e3lgcT64QNEt22B+x/Yskai0X/9D/vqtfyFSX+zey9db+rDM/bBWtgICuJUm vt3nDNT5JpUb4dSOXE6GXRFpn3HYs6nsJ4IVN4y0MuHX4ntgAZ5fSJGD80leRkC2y+ZPE3pLiH tuXpH8LbOy4HWka5WnjvigcnLOPLAF+9tknQ3lM4FhWV9tdPB4fGkeoJ1C2mjUDPmWFdVbqBSD Wb0F8ZL0PndsJdhINt/M3Hny X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935478" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:16 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:11 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 21/35] mtd: spi-nor: Introduce spi_nor_set_mtd_info() Date: Tue, 27 Jul 2021 07:52:08 +0300 Message-ID: <20210727045222.905056-22-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215418_273876_5618DB9A X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Used to init all the mtd_info fields. Move the mtd_info init the last thing in the spi_nor_scan(), so that we avoid superfluous initialization of the mtd_info fields in case of errors. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 55 +++++++++++++++++++++ 1 file changed, 31 insertions(+), 24 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Used to init all the mtd_info fields. Move the mtd_info init the last thing in the spi_nor_scan(), so that we avoid superfluous initialization of the mtd_info fields in case of errors. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav --- drivers/mtd/spi-nor/core.c | 55 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 5c8cffb5e6f2..26acfc9901db 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3124,6 +3124,36 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, return info; } +static void spi_nor_set_mtd_info(struct spi_nor *nor) +{ + struct mtd_info *mtd = &nor->mtd; + struct device *dev = nor->dev; + + spi_nor_register_locking_ops(nor); + + /* Configure OTP parameters and ops */ + spi_nor_otp_init(nor); + + mtd->dev.parent = dev; + if (!mtd->name) + mtd->name = dev_name(dev); + mtd->priv = nor; + mtd->type = MTD_NORFLASH; + mtd->flags = MTD_CAP_NORFLASH; + if (nor->info->flags & SPI_NOR_NO_ERASE) + mtd->flags |= MTD_NO_ERASE; + mtd->writesize = nor->params->writesize; + mtd->writebufsize = nor->page_size; + mtd->size = nor->params->size; + mtd->_erase = spi_nor_erase; + mtd->_read = spi_nor_read; + mtd->_write = spi_nor_write; + mtd->_suspend = spi_nor_suspend; + mtd->_resume = spi_nor_resume; + mtd->_get_device = spi_nor_get_device; + mtd->_put_device = spi_nor_put_device; +} + int spi_nor_scan(struct spi_nor *nor, const char *name, const struct spi_nor_hwcaps *hwcaps) { @@ -3166,32 +3196,12 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, mutex_init(&nor->lock); - mtd->_write = spi_nor_write; - /* Init flash parameters based on flash_info struct and SFDP */ ret = spi_nor_init_params(nor); if (ret) return ret; - if (!mtd->name) - mtd->name = dev_name(dev); - mtd->type = MTD_NORFLASH; - mtd->writesize = nor->params->writesize; - mtd->flags = MTD_CAP_NORFLASH; - mtd->size = nor->params->size; - mtd->_erase = spi_nor_erase; - mtd->_read = spi_nor_read; - mtd->_suspend = spi_nor_suspend; - mtd->_resume = spi_nor_resume; - mtd->_get_device = spi_nor_get_device; - mtd->_put_device = spi_nor_put_device; - - if (info->flags & SPI_NOR_NO_ERASE) - mtd->flags |= MTD_NO_ERASE; - - mtd->dev.parent = dev; nor->page_size = nor->params->page_size; - mtd->writebufsize = nor->page_size; /* * Configure the SPI memory: @@ -3207,15 +3217,12 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (ret) return ret; - spi_nor_register_locking_ops(nor); - /* Send all the required SPI flash commands to initialize device */ ret = spi_nor_init(nor); if (ret) return ret; - /* Configure OTP parameters and ops */ - spi_nor_otp_init(nor); + spi_nor_set_mtd_info(nor); if (!nor->name) nor->name = info->name; From patchwork Tue Jul 27 04:52:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510323 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=TKJhiGmS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=rrIkFASh; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmZZ2pM7z9sRK for ; Tue, 27 Jul 2021 16:08:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=Fa/oYpVj+3dFGW5hIVhD2FdfsmnPLmO7ilBnvECu7A0=; b=TKJhiGmSDYl2dp zQx77hW9cQPqkiOcajcV47RMxVo2Y5GTzSC//zgQK27upHUEd9ciML6vCB29IXF5nijjKfqSO61Sh csjKu/YYsjIAaQBaEFpRrExtb3Qdg3N5Myo74HpCflhtoi8yykum1bbySZ9zBFXtwIMKLweQGhaiO 9A3JjPRp0FKo9E/uuyvcYqbMe4ZEzgaZ/bbAu6D2xLuej04WN7CJI4SIXRz1i9+rqVB7IVVpvqKv9 Q/S6zb2m5Pg2yz8dJ5J0z2qMIM2oxV75yTZn5zYejV4o2UVJHexCYS8l9fG721PdnIzcGhoDR14JX YnUnsRhm6HCWmFcDuQzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GGF-00DYDn-2a; Tue, 27 Jul 2021 06:08:15 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6k-00DHp7-Q8; Tue, 27 Jul 2021 04:54:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361663; x=1658897663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=veVf62Z8aiUAdiv6mgEpUSiaV4PssLJCIenAVWy7Py0=; b=rrIkFAShoEaNzrMgzszEGPfSElZj55FuCr1psahJf7YmUzFFA9/WYui3 ZYz21jw6GfR7jp1oOXnO96VopzkcE6cFxqKqOoHNptr9JIg0OqOxJWWKm RKnh5NXomSIpBdNHtCEl/AGJO8XJXrMuYd+Ce/svuhRSjkkzMacS0IE9d ieJNRqSTFr0Il3i27CS3l1EbLRiJ6jU5Pe7LvMGygB98Q7u0jy8fO2K6q dFv46FAgYq3/4haN8qe7TrKG+ISzEJssiVk7cLWJoB31DV1P8pv3a/PqT JEKXYELDixZN/ojIdqR9GUp3J4VdABmG3dY082K0/lM7musEw+VtZIHEP w==; IronPort-SDR: n0hEuQ63hg1LhGthVeuVM3rqpKGMoCBlku2ZZPhsAXPjwIdc6MKCATpeyEFMDZgF2JkyXrvFWk URM52TQzqrb40jo67OraXMz0NOxFqnKtdvDLg9j5uShktB2+3hW9vILlRbn85jG8e2dJ09rsPa 4kbGDcIBPOPe4YjK+mO25uBdMluch5e7bH6WHx9kWBO+JqFv2Yy/ubULuSfJAJrDYnMwEk5EII joN60GyU6c2aGq+8YYXWmG6pyjr4XlI+iUSSRkUlFGtD1WPdh7p/LwtDL1H4FELld+E9p5Mgop E7i/xFIBiYAANdOigRkod72S X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935490" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:22 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:21 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:16 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 22/35] mtd: spi-nor: core: Use common naming scheme for setting mtd_info fields Date: Tue, 27 Jul 2021 07:52:09 +0300 Message-ID: <20210727045222.905056-23-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215422_921136_2D574E46 X-CRM114-Status: GOOD ( 12.82 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: The functions names are self explanatory, get rid of the comment for the OTP function. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 6 ++---- drivers/mtd/spi-nor/core.h | 4 ++-- drivers/mtd/spi-nor/otp.c | 2 +- drivers/mtd/spi-nor/swp.c | 2 [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 The functions names are self explanatory, get rid of the comment for the OTP function. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav --- drivers/mtd/spi-nor/core.c | 6 ++---- drivers/mtd/spi-nor/core.h | 4 ++-- drivers/mtd/spi-nor/otp.c | 2 +- drivers/mtd/spi-nor/swp.c | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 26acfc9901db..72dfe6274041 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3129,10 +3129,8 @@ static void spi_nor_set_mtd_info(struct spi_nor *nor) struct mtd_info *mtd = &nor->mtd; struct device *dev = nor->dev; - spi_nor_register_locking_ops(nor); - - /* Configure OTP parameters and ops */ - spi_nor_otp_init(nor); + spi_nor_set_mtd_locking_ops(nor); + spi_nor_set_mtd_otp_ops(nor); mtd->dev.parent = dev; if (!mtd->name) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 8fddc685d2d3..7fb0cfabe85a 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -552,8 +552,8 @@ int spi_nor_post_bfpt_fixups(struct spi_nor *nor, void spi_nor_init_default_locking_ops(struct spi_nor *nor); void spi_nor_try_unlock_all(struct spi_nor *nor); -void spi_nor_register_locking_ops(struct spi_nor *nor); -void spi_nor_otp_init(struct spi_nor *nor); +void spi_nor_set_mtd_locking_ops(struct spi_nor *nor); +void spi_nor_set_mtd_otp_ops(struct spi_nor *nor); static struct spi_nor __maybe_unused *mtd_to_spi_nor(struct mtd_info *mtd) { diff --git a/drivers/mtd/spi-nor/otp.c b/drivers/mtd/spi-nor/otp.c index 983e40b19134..fa63d8571218 100644 --- a/drivers/mtd/spi-nor/otp.c +++ b/drivers/mtd/spi-nor/otp.c @@ -480,7 +480,7 @@ static int spi_nor_mtd_otp_lock(struct mtd_info *mtd, loff_t from, size_t len) return ret; } -void spi_nor_otp_init(struct spi_nor *nor) +void spi_nor_set_mtd_otp_ops(struct spi_nor *nor) { struct mtd_info *mtd = &nor->mtd; diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c index 8594bcbb7dbe..1f178313ba8f 100644 --- a/drivers/mtd/spi-nor/swp.c +++ b/drivers/mtd/spi-nor/swp.c @@ -414,7 +414,7 @@ void spi_nor_try_unlock_all(struct spi_nor *nor) dev_dbg(nor->dev, "Failed to unlock the entire flash memory array\n"); } -void spi_nor_register_locking_ops(struct spi_nor *nor) +void spi_nor_set_mtd_locking_ops(struct spi_nor *nor) { struct mtd_info *mtd = &nor->mtd; From patchwork Tue Jul 27 04:52:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510327 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=zL6m2n+s; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=EBkgR2oY; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmhg0W0hz9sT6 for ; Tue, 27 Jul 2021 16:14:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=nvXDmPamNERyZwlBLy1miyuOpP/o5dQ2bz8GXGgB2Rg=; b=zL6m2n+smW9qBU mnwrPeczgvkt6puB/H7TlULXd4zPzmrdhWHXxpVbLGzBMuyXOdBUFcnj0sKscvBrpoL53FEyFmxjo hYo/Sk7qGh2878atAKLcyQx+vJ2JkrT5oyIRJQacu/51and0O9QabW3ESi8UIzhziHLiW2kpLa13b jT9mjTAsm3IahzyyhbWx1BkIRulO+OQBkUzjsG/wg5MT/o3AKceQGjM2Dy93qMQKu6xBpOVmRUUKC blojFoTHKGMwWwPtkCN7mlat/Ha0wg5x+r+JBBaKy4Tqs489GKs58kKKXht+JehXB1ULp5GjlpzFB emUJP+8nT7GE6m30UoJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GLF-00DZNM-JQ; Tue, 27 Jul 2021 06:13:26 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6q-00DHsJ-Ov; Tue, 27 Jul 2021 04:54:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361668; x=1658897668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=quEXac8Me5KRinPjcg+W1EvjGTJmVyCb4e5T50NVy70=; b=EBkgR2oYJDeDyHPwzV74gkzk1cjkdN1wUEdMhaRn3pDkOxXVauuq+bFA MadO9fui8pJzlTR7rKQeacp6vdMgsOCgLdVH937c730NSbKDb9mwJT7Oc aoyDkCyGtQ0Bs9SMdss5LtmGyBMZBSoSt3AC0vjTXSaXVEsXuImF9MrLW zXETSDa9fG1QPGfVKoQL2fpOOS2gYd7LjCYoNTg6eKA5TPofAfI3TZFtQ RrT5pta97WpWeI2jwAtfR6YamPVGDJeytWE1guS0kR/C0vuGyNcqgFErc PRSAu5lZBWKppVq/6wpGBQ0SEKGfbWSupEEEQzI3FZuHOkUFjj3UMdRfg g==; IronPort-SDR: Wezu3nB2+f1EC/1QJvJ7heDEb/c5WndzjUoPoEnvGobbJwiyEGrm5QipYPWcDkXmF5QcEeCTft tZPGKsWtm5Adys0SFFlsV5qtD1Y84c7lMEfGzF8sQKe9rYwQ8iZ8oiamo2po2obrZLB4MEmHlP WoWCgZXLqyjhF5ab0z7lpIsu0IQPlbu6J/hqZl1mrwJnMVbFV+9/aPMcjS5Cv29eFzkqry7pfM ao/UoobQmHKMUV/8I/n231Zve4moELhSptiHJqr62cxu4M8iZYlbv5C/XVLgv8FySjVmnVvvmF sSssLQveoFBCiogou9gEf5ks X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126055079" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:27 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:26 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:21 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 23/35] mtd: spi-nor: Get rid of nor->page_size Date: Tue, 27 Jul 2021 07:52:10 +0300 Message-ID: <20210727045222.905056-24-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215428_912365_D94DF945 X-CRM114-Status: GOOD ( 19.78 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: nor->page_size duplicated what nor->params->page_size indicates for no good reason. page_size is a flash parameter of fixed value and it is better suited to be found in nor->params->page_size. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 20 +++++++++ drivers/mtd/spi-nor/xilinx.c | 17 ++++++++++------- include/linux/mtd/spi-nor.h | 2 [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 nor->page_size duplicated what nor->params->page_size indicates for no good reason. page_size is a flash parameter of fixed value and it is better suited to be found in nor->params->page_size. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/core.c | 20 +++++++++----------- drivers/mtd/spi-nor/xilinx.c | 17 ++++++++++------- include/linux/mtd/spi-nor.h | 2 -- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 72dfe6274041..83f27405a000 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -1953,6 +1953,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, struct spi_nor *nor = mtd_to_spi_nor(mtd); size_t page_offset, page_remain, i; ssize_t ret; + u32 page_size = nor->params->page_size; dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); @@ -1969,16 +1970,15 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, * calculated with an AND operation. On the other cases we * need to do a modulus operation (more expensive). */ - if (is_power_of_2(nor->page_size)) { - page_offset = addr & (nor->page_size - 1); + if (is_power_of_2(page_size)) { + page_offset = addr & (page_size - 1); } else { uint64_t aux = addr; - page_offset = do_div(aux, nor->page_size); + page_offset = do_div(aux, page_size); } /* the size of data remaining on the first page */ - page_remain = min_t(size_t, - nor->page_size - page_offset, len - i); + page_remain = min_t(size_t, page_size - page_offset, len - i); addr = spi_nor_convert_addr(nor, addr); @@ -3141,7 +3141,7 @@ static void spi_nor_set_mtd_info(struct spi_nor *nor) if (nor->info->flags & SPI_NOR_NO_ERASE) mtd->flags |= MTD_NO_ERASE; mtd->writesize = nor->params->writesize; - mtd->writebufsize = nor->page_size; + mtd->writebufsize = nor->params->page_size; mtd->size = nor->params->size; mtd->_erase = spi_nor_erase; mtd->_read = spi_nor_read; @@ -3174,7 +3174,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, * We need the bounce buffer early to read/write registers when going * through the spi-mem layer (buffers have to be DMA-able). * For spi-mem drivers, we'll reallocate a new buffer if - * nor->page_size turns out to be greater than PAGE_SIZE (which + * nor->params->page_size turns out to be greater than PAGE_SIZE (which * shouldn't happen before long since NOR pages are usually less * than 1KB) after spi_nor_scan() returns. */ @@ -3199,8 +3199,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (ret) return ret; - nor->page_size = nor->params->page_size; - /* * Configure the SPI memory: * - select op codes for (Fast) Read, Page Program and Sector Erase. @@ -3359,8 +3357,8 @@ static int spi_nor_probe(struct spi_mem *spimem) * and add this logic so that if anyone ever adds support for such * a NOR we don't end up with buffer overflows. */ - if (nor->page_size > PAGE_SIZE) { - nor->bouncebuf_size = nor->page_size; + if (nor->params->page_size > PAGE_SIZE) { + nor->bouncebuf_size = nor->params->page_size; devm_kfree(nor->dev, nor->bouncebuf); nor->bouncebuf = devm_kmalloc(nor->dev, nor->bouncebuf_size, diff --git a/drivers/mtd/spi-nor/xilinx.c b/drivers/mtd/spi-nor/xilinx.c index a573c3cde414..a5feb86b0a7e 100644 --- a/drivers/mtd/spi-nor/xilinx.c +++ b/drivers/mtd/spi-nor/xilinx.c @@ -28,11 +28,12 @@ static const struct flash_info xilinx_parts[] = { */ static u32 s3an_convert_addr(struct spi_nor *nor, u32 addr) { + u32 page_size = nor->params->page_size; u32 offset, page; - offset = addr % nor->page_size; - page = addr / nor->page_size; - page <<= (nor->page_size > 512) ? 10 : 9; + offset = addr % page_size; + page = addr / page_size; + page <<= (page_size > 512) ? 10 : 9; return page | offset; } @@ -40,6 +41,7 @@ static u32 s3an_convert_addr(struct spi_nor *nor, u32 addr) static int xilinx_nor_setup(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps) { + u32 page_size; int ret; ret = spi_nor_xread_sr(nor, nor->bouncebuf); @@ -64,10 +66,11 @@ static int xilinx_nor_setup(struct spi_nor *nor, */ if (nor->bouncebuf[0] & XSR_PAGESIZE) { /* Flash in Power of 2 mode */ - nor->page_size = (nor->page_size == 264) ? 256 : 512; - nor->mtd.writebufsize = nor->page_size; - nor->mtd.size = 8 * nor->page_size * nor->info->n_sectors; - nor->mtd.erasesize = 8 * nor->page_size; + page_size = (nor->params->page_size == 264) ? 256 : 512; + nor->params->page_size = page_size; + nor->mtd.writebufsize = page_size; + nor->mtd.size = 8 * page_size * nor->info->n_sectors; + nor->mtd.erasesize = 8 * page_size; } else { /* Flash in Default addressing mode */ nor->params->convert_addr = s3an_convert_addr; diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index bd92acdd1899..be7ebaf092fe 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -372,7 +372,6 @@ struct spi_nor_flash_parameter; * @name: used to point to correct name in case of ID collisions. * @info: SPI NOR part JEDEC MFR ID and other info * @manufacturer: SPI NOR manufacturer - * @page_size: the page size of the SPI NOR * @addr_width: number of address bytes * @erase_opcode: the opcode for erasing a sector * @read_opcode: the read opcode @@ -403,7 +402,6 @@ struct spi_nor { const char *name; const struct flash_info *info; const struct spi_nor_manufacturer *manufacturer; - u32 page_size; u8 addr_width; u8 erase_opcode; u8 read_opcode; From patchwork Tue Jul 27 04:52:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510333 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=0Jmjubpt; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=NKtLOMew; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmq64FzTz9sT6 for ; Tue, 27 Jul 2021 16:19:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=z/LitzKXsgDIry9hqY4lCwAbL5j0WQj+cvDGWBnonCo=; b=0JmjubptcmCy+z MJ+md+xS84N+soYVvTmGRObZm+lD40vXQ4K6ULETTjiUOxpHXpmvC6o1JbUeNoN+6vMaCsVCX3Fd1 S+mbeIEfV1YdtgudNuANG3E/y5uFArSVaafdSF+s4PqP1O/xdjkBpewYyXCKB3scUrt1wN1s76AqR Xag8shhh6F97Vvk/xdJmNXmgTOSK0HjPmHrQ/btYY99wW21EcXf8BXdbRwa5DhWfVk9vawFavSFfu 7dyQmhGzZJ9U0T0WQEZOiJ9JVfKG5IuDb3tPqW+4zLFCKv4EBVXyZ0Aw/ij/5+E9KdE1+m+PyGjCs HcGl4mx7CjUeRjc6VGGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GQh-00Daz2-4o; Tue, 27 Jul 2021 06:19:03 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F6v-00DHth-QK; Tue, 27 Jul 2021 04:54:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361674; x=1658897674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L804f2SQT/kD0Qvc6v7SllFOYiMRzMP0mOA6jLCywcU=; b=NKtLOMewCeMm0xzuxJuKgU97huHiB1A5ASHXT6vOAm8z+hoQRDqxsETk g+oztjn+jaCZRL2tD3bssTxIkMZab3kO0RXricvUH6HAnUqM1FM71B5VB vrxx6Q25Vflv/jCPvsj103vYUZOczIeGwZLVxKqp7mL71njMY0URM7TUY coTrrp9YxME1QgefyWKJWiBr9osIAES8HGCaGrFG4pu7PzkyX4MOQPO6g M4SgeV/4SboXVixfRJLtLhf/Q/l9s+rCZEiwszYHocs9eOQiq2alBR5BA +179PdU1GKXGFjA3uBZYVwoi6ZEgxyxZ/B+ChQqi0GKtEe0nPNjhJFw94 w==; IronPort-SDR: BPCUfJkl4AbaN1aBkWL1mZent3s79Ri/lrhqherdkcQEHCWmXrevf6S5RUHZqDxbIKds0EG/ZH VnzkINf4hnaPoDMka33S7H8qkjOmUZn9DirvE9SRDgMHjhLfTgZrhRq0Q6wQPLSv697B35bqqm aGnnyX2U/9N459IGWIMzwbo5P+IDUdXNlb0dCFLIrxhWaYTr/HsbNd+RkImk/1ER8jZY0KK6YD 7nMX/9tMJ7vWTBJ5wvbrwCXcuQKcuD0N9CzoLDEBrW44o+f5lSm2Jm0jxQoRTSEHLAnigikAWc mm1ZB50W24zAwSR6j44m3nic X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935509" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:32 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:31 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:26 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 24/35] mtd: spi-nor: core: Fix spi_nor_flash_parameter otp description Date: Tue, 27 Jul 2021 07:52:11 +0300 Message-ID: <20210727045222.905056-25-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215433_927014_D2775BC6 X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Update the description of the otp member of the struct spi_nor_flash_parameter. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Update the description of the otp member of the struct spi_nor_flash_parameter. Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav Reviewed-by: Michael Walle --- drivers/mtd/spi-nor/core.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 7fb0cfabe85a..501d9212ba9b 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -250,7 +250,7 @@ struct spi_nor_otp { * higher index in the array, the higher priority. * @erase_map: the erase map parsed from the SFDP Sector Map Parameter * Table. - * @otp_info: describes the OTP regions. + * @otp: SPI NOR OTP info. * @octal_dtr_enable: enables SPI NOR octal DTR mode. * @quad_enable: enables SPI NOR quad mode. * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode. @@ -262,7 +262,6 @@ struct spi_nor_otp { * e.g. different opcodes, specific address calculation, * page size, etc. * @locking_ops: SPI NOR locking methods. - * @otp: SPI NOR OTP methods. */ struct spi_nor_flash_parameter { u64 size; From patchwork Tue Jul 27 04:52:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510337 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=t1CLtkKF; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=GuRqImU0; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYmwP33l3z9sT6 for ; Tue, 27 Jul 2021 16:24:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=gE2sU0TpLHslmH0b7xLiHeUdG67wgU1ChY+Gg3iMf04=; b=t1CLtkKFXpjlLq OWyIBl4zjx9igWYfZCuHwYbLtwPbuY6wZxJ2lz2pkuZoxlK4NRVOnloEhVax4UYrN8nGayp7nwjhI ligUR+ZVTfv6dgIrC/psSKhD2CCSPYi9Hz1pU0dPUI9gvpB+1HYaCZ1glcie6vThd5HdiG9kdLpn8 aApYK95iBogKwmWgCtMG2bMcbuInQa0Zh0Ze6DurTKXuoM62sndA5/HaRxGKEvTQi4rfd4i0ELN+N ARmywK4qAovBGlezi+3BA+xxSpmCzQe8+iVP68pCrlGJts4eayedrgvUPlFDrZjvCWFfPPxrCkdw+ iun+jPTFCKSFmErtiUhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GUs-00DblM-Ij; Tue, 27 Jul 2021 06:23:22 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F70-00DHth-Nw; Tue, 27 Jul 2021 04:54:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361679; x=1658897679; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NCA36JpXoX0x5HsFEPVjKjK/pmqngl0RcmS5nzg0+2Y=; b=GuRqImU01z0umyo2lXLmrCKwLegQshOAZVbrt57LCeMzUCpi7W4M1BXm 3QRFNuzok6xRA3/UEwMBzertX+67ItZ5wH/kxMdxdU01TP8zvRlHslARR H0p1r1KYw4q5b5G9nWo4xI8Gjq/y9nLafOOSrwYOwIx0BNpRHLnUtoILY rJ3mAoLIq63WhIe/UxBJJPkJ4Llmw/jiyzitLyXa9+Ib4v7mM5crChGgd x6WsnNSo8xj791ppUTWBBU8C/np8Jeos3vXqV37+9AKuIF8i29fYOBM4n 88p76MOmEUqB4bp7pKLb1KhAbo2rSgxxAcga5liLUUfGluouiRef9qLQM w==; IronPort-SDR: wIzkb/toWchSIboommgzShVObYoeeXhHluVjCX3rs7bAJXUfSi6AVo1MamfFbkJpyPcCJnMdv1 zztBC66ZMvOuPSW78j0t+fL14VjO78gAaQe+f4l8zMU9WXMKtdYvfxCgQf6e2lIh56pRndIxM8 3Gny3ZlCidf7MNn0le0cghV1ybBzwUFeY/CTyHK/b97Og3VRyvfPklgbNeY4xw+WYkNv1iquCL SCtPEp5pt2G6twLZZDt+vIWVdpxAQgavPM+d6szScK8OlPfd9W/T18DyFCb8ezGV7IVD6H0LaZ tLZB9KPB7es13JiIeaEzxLkp X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935525" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:38 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:36 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:31 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 25/35] mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup() Date: Tue, 27 Jul 2021 07:52:12 +0300 Message-ID: <20210727045222.905056-26-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215438_838218_A783899A X-CRM114-Status: GOOD ( 18.50 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: spi_nor_setup() configures the SPI NOR memory. Setting the addr width is too a configuration, hence we can move the spi_nor_set_addr_width() in spi_nor_setup(). Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 101 +++++++++++++++++++ 1 file changed, 52 insertions(+), 49 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 spi_nor_setup() configures the SPI NOR memory. Setting the addr width is too a configuration, hence we can move the spi_nor_set_addr_width() in spi_nor_setup(). Signed-off-by: Tudor Ambarus Reviewed-by: Pratyush Yadav --- drivers/mtd/spi-nor/core.c | 101 +++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 83f27405a000..b3a01d7d6f0b 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2485,13 +2485,62 @@ static int spi_nor_default_setup(struct spi_nor *nor, return 0; } +static int spi_nor_set_addr_width(struct spi_nor *nor) +{ + if (nor->addr_width) { + /* already configured from SFDP */ + } else if (nor->read_proto == SNOR_PROTO_8_8_8_DTR) { + /* + * In 8D-8D-8D mode, one byte takes half a cycle to transfer. So + * in this protocol an odd address width cannot be used because + * then the address phase would only span a cycle and a half. + * Half a cycle would be left over. We would then have to start + * the dummy phase in the middle of a cycle and so too the data + * phase, and we will end the transaction with half a cycle left + * over. + * + * Force all 8D-8D-8D flashes to use an address width of 4 to + * avoid this situation. + */ + nor->addr_width = 4; + } else if (nor->info->addr_width) { + nor->addr_width = nor->info->addr_width; + } else { + nor->addr_width = 3; + } + + if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) { + /* enable 4-byte addressing if the device exceeds 16MiB */ + nor->addr_width = 4; + } + + if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { + dev_dbg(nor->dev, "address width is too large: %u\n", + nor->addr_width); + return -EINVAL; + } + + /* Set 4byte opcodes when possible. */ + if (nor->addr_width == 4 && nor->flags & SNOR_F_4B_OPCODES && + !(nor->flags & SNOR_F_HAS_4BAIT)) + spi_nor_set_4byte_opcodes(nor); + + return 0; +} + static int spi_nor_setup(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps) { + int ret; + if (!nor->params->setup) - return 0; + return spi_nor_set_addr_width(nor); - return nor->params->setup(nor, hwcaps); + ret = nor->params->setup(nor, hwcaps); + if (ret) + return ret; + + return spi_nor_set_addr_width(nor); } /** @@ -3031,49 +3080,6 @@ static const struct flash_info *spi_nor_match_id(struct spi_nor *nor, return NULL; } -static int spi_nor_set_addr_width(struct spi_nor *nor) -{ - if (nor->addr_width) { - /* already configured from SFDP */ - } else if (nor->read_proto == SNOR_PROTO_8_8_8_DTR) { - /* - * In 8D-8D-8D mode, one byte takes half a cycle to transfer. So - * in this protocol an odd address width cannot be used because - * then the address phase would only span a cycle and a half. - * Half a cycle would be left over. We would then have to start - * the dummy phase in the middle of a cycle and so too the data - * phase, and we will end the transaction with half a cycle left - * over. - * - * Force all 8D-8D-8D flashes to use an address width of 4 to - * avoid this situation. - */ - nor->addr_width = 4; - } else if (nor->info->addr_width) { - nor->addr_width = nor->info->addr_width; - } else { - nor->addr_width = 3; - } - - if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) { - /* enable 4-byte addressing if the device exceeds 16MiB */ - nor->addr_width = 4; - } - - if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { - dev_dbg(nor->dev, "address width is too large: %u\n", - nor->addr_width); - return -EINVAL; - } - - /* Set 4byte opcodes when possible. */ - if (nor->addr_width == 4 && nor->flags & SNOR_F_4B_OPCODES && - !(nor->flags & SNOR_F_HAS_4BAIT)) - spi_nor_set_4byte_opcodes(nor); - - return 0; -} - static void spi_nor_debugfs_init(struct spi_nor *nor, const struct flash_info *info) { @@ -3204,15 +3210,12 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, * - select op codes for (Fast) Read, Page Program and Sector Erase. * - set the number of dummy cycles (mode cycles + wait states). * - set the SPI protocols for register and memory accesses. + * - set the address width. */ ret = spi_nor_setup(nor, hwcaps); if (ret) return ret; - ret = spi_nor_set_addr_width(nor); - if (ret) - return ret; - /* Send all the required SPI flash commands to initialize device */ ret = spi_nor_init(nor); if (ret) From patchwork Tue Jul 27 04:52:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510339 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=Fm/EBkVS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=vkmUFd6b; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYn0b0CqHz9sT6 for ; Tue, 27 Jul 2021 16:27:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=BfEXnfMWnHDHTnE1Ydty+n2fCidTbqEmx43CCX36ca4=; b=Fm/EBkVSkJWUVt n8XRGk/gsCG4raQo+HdX46ct9rMZ1x45NRA/+GMLV66T5M3mnoQNHhMm720x/vii42MRLn2IHQthB KFF4tj/p5J2b1/AmkcuaS40jgjw8M+NCjph5XK5HtVZvpMgluV6tpP4EPZYMn1By6xijRm3ppVc9b w9qAl7ulTz3vKbljOSjzqrNN19vuKYtadR2jUMRVCF5oPHJKpabIGsInAQcUjm81JyBQWIyZqy1PS PCy4uCtlJQEHEJpTqZUmR/vBIx3CxRQZvjgqIQ66Qg6lH2nowTHF7e6mJ/jAJk96qNXb9RZnXEUxd kX8jY0hQW1l6MxlTHB3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GYc-00DcXF-4R; Tue, 27 Jul 2021 06:27:14 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F75-00DHwD-6r; Tue, 27 Jul 2021 04:54:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361683; x=1658897683; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OxxpDnFl3yWu3prwePBKq7v9bIv3vcU9pe64UwmCXqY=; b=vkmUFd6bh3mSabvJsU9nBfEB5DP89LDGTFmHDkDoBzdJEKxoKh+jzK/Q eM1ar5ygGjOqOSVY+flVTE1toMZ67CifDCatat/9Drf2zVbldPYoGmSiR MEm2PojS8MEAYnzDMsFDosLt05uVUTkxd5u70pW4efR8AmIOT7pDUis9I BA+K/mrhjlooT/BXJdLGGAuACyYkqbKs/EdDex8abl9VD0HfDKLCgUXrF P2/wzUZGBU/3elP9Bs0SSUA6eWy4ft5nH060FJARZFqN0ep2uekSZ5pOb cdpWeqfwoBJBZKQSW5m0to0dPf7/eZr5RtQp/lxsex09TsXFwfOsx8Mxb Q==; IronPort-SDR: 8EjOtTq65UKyJ36ANh7Mac3HYr0vIIC3VzKNDKUxL8ZIfAQgGJVq/bCcJQwFA8C9SUgLoM9dUk aP06lmjD3A/ssEZnJPsPpweqAY9iJJmaxuYgMAIo0Ju807bN524h6M/zB5M3nm6T6IlKJZG66q 82e3cxGiC5Lae6QkzA315J4UHwCgi0xxVC5dTNF6VkoQRCpQFGqa4QwZoOv1tOPOZOAtN4MPdG MjZb5ytXkr9Ce+sit6SVV55VL0iVYNF5hFs6MbaLOyCKT8o8pXWOPdOJEdktPW9Zw/aruX2dM/ LNY0y3JZoEvgL3PNOi8cXRtl X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126055092" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:42 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:41 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:36 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 26/35] mtd: spi-nor: core: Introduce spi_nor_init_default_params() Date: Tue, 27 Jul 2021 07:52:13 +0300 Message-ID: <20210727045222.905056-27-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215443_397778_74C7C345 X-CRM114-Status: GOOD ( 13.16 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Called for all flashes, regardless if they define SFDP tables or not. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 92 +++++++++++++++++++++ 1 file changed, 52 insertions(+), 40 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Called for all flashes, regardless if they define SFDP tables or not. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 92 +++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index b3a01d7d6f0b..9193317f897d 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2543,6 +2543,56 @@ static int spi_nor_setup(struct spi_nor *nor, return spi_nor_set_addr_width(nor); } +/** + * spi_nor_init_default_params() - Default initialization of flash parameters + * and settings. Done for all flashes, regardless is they define SFDP tables + * or not. + * @nor: pointer to a 'struct spi_nor'. + */ +static void spi_nor_init_default_params(struct spi_nor *nor) +{ + struct spi_nor_flash_parameter *params = nor->params; + const struct flash_info *info = nor->info; + struct device_node *np = spi_nor_get_flash_node(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->otp.org = &info->otp_org; + + /* Default to 16-bit Write Status (01h) Command */ + nor->flags |= SNOR_F_HAS_16BIT_SR; + + /* Set SPI NOR sizes. */ + params->writesize = 1; + params->size = (u64)info->sector_size * info->n_sectors; + params->page_size = info->page_size; + + if (!(info->flags & SPI_NOR_NO_FR)) { + /* Default to Fast Read for DT and non-DT platform devices. */ + params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; + + /* Mask out Fast Read if not requested at DT instantiation. */ + if (np && !of_property_read_bool(np, "m25p,fast-read")) + params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; + } + + /* (Fast) Read settings. */ + params->hwcaps.mask |= SNOR_HWCAPS_READ; + spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ], + 0, 0, SPINOR_OP_READ, + SNOR_PROTO_1_1_1); + + if (params->hwcaps.mask & SNOR_HWCAPS_READ_FAST) + spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_FAST], + 0, 8, SPINOR_OP_READ_FAST, + SNOR_PROTO_1_1_1); + /* Page Program settings. */ + params->hwcaps.mask |= SNOR_HWCAPS_PP; + spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP], + SPINOR_OP_PP, SNOR_PROTO_1_1_1); +} + /** * spi_nor_manufacturer_init_params() - Initialize the flash's parameters and * settings based on MFR register and ->default_init() hook. @@ -2609,43 +2659,8 @@ static void spi_nor_info_init_params(struct spi_nor *nor) struct spi_nor_flash_parameter *params = nor->params; struct spi_nor_erase_map *map = ¶ms->erase_map; const struct flash_info *info = nor->info; - struct device_node *np = spi_nor_get_flash_node(nor); u8 i, erase_mask; - /* Initialize default flash parameters and settings. */ - 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->otp.org = &info->otp_org; - - /* Default to 16-bit Write Status (01h) Command */ - nor->flags |= SNOR_F_HAS_16BIT_SR; - - /* Set SPI NOR sizes. */ - params->writesize = 1; - params->size = (u64)info->sector_size * info->n_sectors; - params->page_size = info->page_size; - - if (!(info->flags & SPI_NOR_NO_FR)) { - /* Default to Fast Read for DT and non-DT platform devices. */ - params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; - - /* Mask out Fast Read if not requested at DT instantiation. */ - if (np && !of_property_read_bool(np, "m25p,fast-read")) - params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; - } - - /* (Fast) Read settings. */ - params->hwcaps.mask |= SNOR_HWCAPS_READ; - spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ], - 0, 0, SPINOR_OP_READ, - SNOR_PROTO_1_1_1); - - if (params->hwcaps.mask & SNOR_HWCAPS_READ_FAST) - spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_FAST], - 0, 8, SPINOR_OP_READ_FAST, - SNOR_PROTO_1_1_1); - if (info->flags & SPI_NOR_DUAL_READ) { params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_1_1_2], @@ -2674,11 +2689,6 @@ static void spi_nor_info_init_params(struct spi_nor *nor) SNOR_PROTO_8_8_8_DTR); } - /* Page Program settings. */ - params->hwcaps.mask |= SNOR_HWCAPS_PP; - spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP], - SPINOR_OP_PP, SNOR_PROTO_1_1_1); - if (info->flags & SPI_NOR_OCTAL_DTR_PP) { params->hwcaps.mask |= SNOR_HWCAPS_PP_8_8_8_DTR; /* @@ -2823,6 +2833,8 @@ static int spi_nor_init_params(struct spi_nor *nor) if (!nor->params) return -ENOMEM; + spi_nor_init_default_params(nor); + spi_nor_info_init_params(nor); spi_nor_manufacturer_init_params(nor); From patchwork Tue Jul 27 04:52:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510340 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=ZKjqiuwR; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=hoIn0Ieu; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYn681W4Rz9sWS for ; Tue, 27 Jul 2021 16:32:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=FGtj4gjaOZVrS6u5gvF2cp8JuOFTxT1VB9GcOZ6Ej+o=; b=ZKjqiuwRgonbVQ BN0Rc00QRVOUgt+IOWZ4Fa4UnMslf2ZmWBZwKEqcjR7cO7M9BfACQGfmMqSiNmxnrIBDznodEul98 tQyGjU+x+FzIBUha9atX/7Z/uolrJAObdnCD8tF22of88HbAwzvIaBFqsr1ZB1ymoyjf7WYTBSI5r 5/0/UOUa4rSNvsaa5dzr0S169sTCNTZpmE4hA+mW3YTbeiolFokc5g+Rtdx4qGpUdxjOvf797PIqj oEaOjHBIrGG5mq2mClz8M9BovI4ir644TQEkSmWf21BQCIkT/vCba7PEURobEpl4NdWuh5nbEKqMO 7Ov7PYyje52/utKOQAtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GdI-00DdLA-QA; Tue, 27 Jul 2021 06:32:05 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F79-00DHxc-T1; Tue, 27 Jul 2021 04:54:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361688; x=1658897688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=slTmtpnqab5rT6lwyPep+HqlYjo+D1OO6WRDMlDoHTA=; b=hoIn0IeuDnIwScoZhGPm4my1o+tmlEjK2MsRxixRypvTK2tJSw15roUP Cqgs4jmEMMdShQSzFs3uahBPUfAe/D4r+nVf79CXS2ENe6HWtS73jrzQh bhQ+qmZzUBRkCJkwuf/ak3aJQS3naUJsDGzPks/Vazpo4vLkLldFJhU0I G7E+sfRlVUzpmqx7MiHUem7NeoYPkARUpsWzMpFwwzJZnIWnLsnpscWW8 6gP1e4bhEVcbLORZvxYoGISyYinbVIRVx23qpsd9s4GImO4YEEF8l7P5O L+OIcXjUNL1AubSHi+WkPFXHRJk+zaFhl7VNwZHYH8Y2MPQni7xoCZzSA Q==; IronPort-SDR: KxHsrL+kTCLqTU1/PiRmM+xHi6hOQ0bdtOo6pkcWEj8ZSA4L+QxKg4BQMKWW/BlA3loWBa2/Bk jh1QNJCMaYhXAW/sSmeLEyVXukYEB0kjG7q0SoxWXOxJuhlWm+Mg865nZHv0yArs4CxgjAyyrC ZuQOCOqB41AMNDy1NF6Vwi/43YPYN9cYYpADAbr7qZV6d4IuObCofJjkqK15x7v+1348QacanS m6gJis4aa+19iH3L4cHFVTz06/JEQ1u80UVuhkAFn97dB/kQXlhxH6R4T7GYbv0CEmMBl9K1VJ yfnjQy30zy6JZbJpYVWvCFdB X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935540" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:47 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:46 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:41 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 27/35] mtd: spi-nor: core: Init flash params based on SFDP first for new flash additions Date: Tue, 27 Jul 2021 07:52:14 +0300 Message-ID: <20210727045222.905056-28-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215448_024160_9CB406B5 X-CRM114-Status: GOOD ( 18.90 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Remove the spagetti way of initializing flash parameters and settings, at least for the new flash additions (for now). All flash entries should be converted to either use SPI_NOR_PARSE_SFDP or SPI_NOR [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Remove the spagetti way of initializing flash parameters and settings, at least for the new flash additions (for now). All flash entries should be converted to either use SPI_NOR_PARSE_SFDP or SPI_NOR_SKIP_SFDP. SPI_NOR_SKIP_SFDP should be set either when the SFDP tables are completely wrong and we can't parse relevant data, or when the SFDP tables are not defined at all, or when RDSFDP command is not supported by the flash. After all the flash entries will be converted to use these flags and after the default_init() hook will be removed, the spi_nor_init_params_deprecated() will be replaced by spi_nor_info_init_params(). The flash parameters and settings will be initialized either by parsing SFDP, or via the flash info flags. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/core.c | 103 +++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 9193317f897d..ef06a8d6abb8 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2627,28 +2627,6 @@ static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) nor->info->fixups->post_sfdp(nor); } -/** - * spi_nor_sfdp_init_params() - Initialize the flash's parameters and settings - * based on JESD216 SFDP standard. - * @nor: pointer to a 'struct spi_nor'. - * - * The method has a roll-back mechanism: in case the SFDP parsing fails, the - * legacy flash parameters and settings will be restored. - */ -static void spi_nor_sfdp_init_params(struct spi_nor *nor) -{ - struct spi_nor_flash_parameter sfdp_params; - - memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); - - if (!spi_nor_parse_sfdp(nor)) - return spi_nor_post_sfdp_fixups(nor); - - memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); - nor->addr_width = 0; - nor->flags &= ~SNOR_F_4B_OPCODES; -} - /** * spi_nor_info_init_params() - Initialize the flash's parameters and settings * based on nor->info data. @@ -2722,6 +2700,39 @@ static void spi_nor_info_init_params(struct spi_nor *nor) spi_nor_init_uniform_erase_map(map, erase_mask, params->size); } +/** + * spi_nor_sfdp_init_params() - Initialize the flash's parameters and settings + * based on JESD216 SFDP standard. + * @nor: pointer to a 'struct spi_nor'. + * + * The method has a roll-back mechanism: in case the SFDP parsing fails, the + * legacy flash parameters and settings will be restored. + */ +static void spi_nor_sfdp_init_params(struct spi_nor *nor, + bool treat_id_collisions) +{ + struct spi_nor_flash_parameter sfdp_params; + + memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); + + if (!spi_nor_parse_sfdp(nor)) + return spi_nor_post_sfdp_fixups(nor); + + memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); + nor->addr_width = 0; + nor->flags &= ~SNOR_F_4B_OPCODES; + + if (!treat_id_collisions) + return; + /* + * Fallback to flash info params init in case the SFDP parsing fails. + * Used to handle ID collisions between flashes that define the SFDP + * tables and flashes that don't. + */ + spi_nor_info_init_params(nor); + spi_nor_manufacturer_init_params(nor); +} + /** * spi_nor_late_init_params() - Late initialization of default flash parameters. * @nor: pointer to a 'struct spi_nor' @@ -2797,7 +2808,9 @@ static void spi_nor_nonsfdp_flags_init(struct spi_nor *nor) } /** - * spi_nor_init_params() - Initialize the flash's parameters and settings. + * spi_nor_init_params_deprecated() - Initialize the flash's parameters and + * settings. The function is deprecated, it will be removed and replaced with + * spi_nor_info_init_params(). * @nor: pointer to a 'struct spi_nor'. * * The flash parameters and settings are initialized based on a sequence of @@ -2821,11 +2834,40 @@ static void spi_nor_nonsfdp_flags_init(struct spi_nor *nor) * Please note that there are ->post_{bfpt, sfdp}() fixup hooks that can * overwrite the flash parameters and settings immediately after table * parsing. + */ +static void spi_nor_init_params_deprecated(struct spi_nor *nor) +{ + spi_nor_info_init_params(nor); + spi_nor_manufacturer_init_params(nor); + + if ((nor->info->flags & (SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ)) && + !(nor->info->flags & SPI_NOR_SKIP_SFDP)) + spi_nor_sfdp_init_params(nor, false); +} + +/** + * spi_nor_init_params() - Initialize the flash's parameters and settings. + * @nor: pointer to a 'struct spi_nor'. + * + * The flash parameters and settings are initialized based on a sequence of + * calls that are ordered by priority: + * + * 1/ Default flash parameters initialization. The initializations are done + * for all the flashes, regardless if the support SFDP or not. + * spi_nor_init_default_params() + * which can be overwritten by: * + * 2/ SFDP based or the deprecated way of initializing flash parameters. + * Ideally at this step the flash parameters init will be done either by + * parsing SFDP, where supported, or statically via flash_info flags. + * spi_nor_sfdp_init_params() or spi_nor_init_params_deprecated() * which can be overwritten by: - * 4/ Late flash parameters initialization, used to initialize flash + * + * 3/ Late flash parameters initialization, used to initialize flash * parameters that are not declared in the JESD216 SFDP standard. * spi_nor_late_init_params() + * */ static int spi_nor_init_params(struct spi_nor *nor) { @@ -2835,15 +2877,10 @@ static int spi_nor_init_params(struct spi_nor *nor) spi_nor_init_default_params(nor); - spi_nor_info_init_params(nor); - - spi_nor_manufacturer_init_params(nor); - - if ((nor->info->flags & (SPI_NOR_PARSE_SFDP | - SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ)) && - !(nor->info->flags & SPI_NOR_SKIP_SFDP)) - spi_nor_sfdp_init_params(nor); + if (nor->info->flags & SPI_NOR_PARSE_SFDP) + spi_nor_sfdp_init_params(nor, true); + else + spi_nor_init_params_deprecated(nor); spi_nor_late_init_params(nor); From patchwork Tue Jul 27 04:52:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510341 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=btaHScnS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=WprYdK4m; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnCy0vsqz9sV8 for ; Tue, 27 Jul 2021 16:37:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=xNdmrggPs5+rfyRpAoWcF7QkEcCHkh4bEtiXb4+r+HI=; b=btaHScnSU8P2M9 jTdGe7PT/AHY+ij6TSCL4pFbJYWlcVlVjZue9LnkDmeaHjWes1KnwYq6PkZ8sP8jBaHSAPFgSiyrv WfaKIAUhsY3IOnptAtaX1jCP8bzCuVzG5btOeVGSFuTQUYW+bha8JvuIKM3Pva56KN8zwHtW6ENa5 bpLOyMvjvijEckG2KiA41rgrb65SvoT6jZ+6vJdbgwweNeA7hhXh34qnFOrzfTMSJ5xZX0aPgNI2I slg4adWEjsYqeiTFc9qqmkJnfnS53PoXGq9v9BwjjVA7FkxlqUJoSQ9z5Iq1mVWiLPIui+gtnB/2f /K/E9TMkjCUDZfvsp43w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Gi5-00DeB5-JK; Tue, 27 Jul 2021 06:37:02 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7J-00DI07-2C; Tue, 27 Jul 2021 04:54:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361697; x=1658897697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SNa9I8ZyXHR+DV0mECnoEPrhIlp8JDOTWsPWdriZ+C0=; b=WprYdK4mZTFgZXiS6Ejh0YfkunKKdbbyDfVYsoXMh1IgWZE7xQMUh4EN uLLpK8tcbPY8+1hWNzEouYpbhlQ1IvfEb69zQImRrY4MYHNghU32dgxXh EcFv/5G1VHDjoK1vSCo8b+RjPUpnT/y1VVRCXjn83HZb2bGNTCpsC/jQ1 JRm7333V8ThARzi+abxp77MaR/LX1aIM6eHSLnwHog61OFnI2xcZZzsH1 /QGZGTtonf6teEz/mybGSLNletOzcyQbdUZ8+Rwf5B+TqNgN2peVXdY5x yPuMiUZYmg7A36S2h6rZhM4Ry8zSrGF0hCSV/7YuyDFEnR6PO5NmVjB14 Q==; IronPort-SDR: WTb/T6w3ECs1nHZWKa6dV8ur3EToSdsf2iJzaTyhKGwstOmIo28gp9qyaT5YDPgREtGzHrL86D 0qTTE8HIv0UecCcgtsBSnLQpBrNzxkTZ232LCRT6dmJRhaegnG093X5D246MeTf+dyyizIiP12 i3fCjHZYgxidWW9Gi38dy+4vRorZiO6qjse0N1Db2GNPk9Ii5bNnbghhWyHseHAab8CYtTibAy kbCVcKMGlQ6xNg1XBzUW4CiQnhq+DaWU4OUSGax/bNcmDVkKlEkHFsJBZWecaUbSGmg8z7TIAH 7h94DZwSgIGubRsZM9QkuLjt X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935555" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:56 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:51 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:46 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 28/35] mtd: spi-nor: sst: sst26vf064b: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:15 +0300 Message-ID: <20210727045222.905056-29-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215457_185125_CE8B2341 X-CRM114-Status: GOOD ( 10.90 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb, for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# find / -iname spi-nor /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 14:45 . drwxr-xr-x 6 root root 0 Mar 9 14:34 .. -r--r--r-- 1 root root 4096 Mar 9 14:45 jedec_id -r--r--r-- 1 root root 4096 Mar 9 14:45 manufacturer -r--r--r-- 1 root root 4096 Mar 9 14:45 partname -r--r--r-- 1 root root 0 Mar 9 14:45 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id bf2643 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer sst root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname sst26vf064b root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > sst26vf064b-sfdp root@sama5d2-xplained:~# hexdump sst26vf064b-sfdp 0000000 4653 5044 0106 ff02 0600 1001 0030 ff00 0000010 0081 0601 0100 ff00 00bf 1801 0200 0100 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20fd fff1 ffff 03ff eb44 6b08 3b08 bb80 0000040 fffe ffff ffff ff00 ffff 0b44 200c d80d 0000050 d80f d810 9120 2448 6f80 811d 0fed 3877 0000060 b030 b030 fff7 ffff c229 ff5c 30f0 80c0 0000070 ffff ffff ffff ffff ffff ffff ffff ffff * 0000100 00ff ff04 7ff3 0000 7ff5 0000 fff9 007d 0000110 7ff5 0000 7ff3 0000 ffff ffff ffff ffff 0000120 ffff ffff ffff ffff ffff ffff ffff ffff * 0000200 26bf ff43 5fb9 fffd f230 f360 ff32 120a 0000210 4623 0fff 3219 190f ff19 ffff ffff ffff 0000220 6600 3899 05ff 3501 0406 3202 30b0 4272 0000230 e88d 8898 85a5 9fc0 5aaf ffff ec06 0c06 0000240 0300 0b08 ffff ffff 07ff ffff 0202 06ff 0000250 0003 fdfd 0704 fc00 0003 fefe 0202 0e07 0000260 drivers/mtd/spi-nor/sst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c index eeb10766b70e..c3bdaa6af2ec 100644 --- a/drivers/mtd/spi-nor/sst.c +++ b/drivers/mtd/spi-nor/sst.c @@ -81,8 +81,7 @@ static const struct flash_info sst_parts[] = { SPI_NOR_QUAD_READ) }, { "sst26vf016b", INFO(0xbf2641, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ) }, - { "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + { "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128, SPI_NOR_PARSE_SFDP | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) .late_init = sst26vf_late_init}, }; From patchwork Tue Jul 27 04:52:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510342 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=x2k+vVX8; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=OwvU36bQ; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnHM5zbGz9sWS for ; Tue, 27 Jul 2021 16:40:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=CEwIaR4h66YqfOTcgBjKZ3Mc7PYzxlyC4uORrirN2S0=; b=x2k+vVX8G5Kv5c M5hTj0wX2ZMvSCdGEg45qcAOur7wceRnItyzOOqdCPKCbrlQ9Vgu0e/7/HZToIzE8Eje6HMBIaJ1R yN1hskt+ZWisxA32E75AsQp3xOdN1EVR1vlzDS/xBgo/BMyJiWEShbJRKp6zoToFyHlGh7eCiSuPa 2tMJ9DuNXPGcYSQ13TxsnOa6X7PJaoHZaM1rCEgFd6SiKKu+vqprZIR75Ywuz5ekIIqtzpcVQV4e6 NM/bWA1/QEGjPzc/UnkOqtQa9UAqJymwNWL7wo0Y0ms60iio1mTShREeN96nsF/9E82+U54wJHG/d mJjAMn8+I+imdHFrMjIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Gkx-00Dedt-Pu; Tue, 27 Jul 2021 06:40:00 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7K-00DI0Z-8a; Tue, 27 Jul 2021 04:54:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361698; x=1658897698; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VMsCu8WSS1vN1wUh9GVosLaMJS+kLC64LCe6S8YxOQE=; b=OwvU36bQuYDRzS2UfwEZOE4ILStH6DsUO55tjgQLD3DnjUpSjgwpTEoG 3q7XOquCILRRVJE+IFQOxw62SN385nuQFwoasFkN7sUlimmFjEA1lb3fI Jg9YD7QAEpFf1QQVoU1m8hlJbLBthsjeKSqTHJU7oYPCz9tXt7Zf6G/73 lxdeeBdRA8PkRB6ziNy8VEXwsKyohzqJBmz+re4Uyz668CWyWwggOb+VV 4izRQ+3IrX459WNHMS0XgtjC4nc2hE0a/ZpFBJDQEAe/WlMjbpEofHSLH qwGjnQhzkAvWT3nKjaRbqqmbb3wiPU+ys+1oVTm9MzmZ8NHDpWeywKsWB A==; IronPort-SDR: bchJ2rVmEuQfYqV8D48OrWy7V58pOq1SptACrgfxtgfqPNmyYdtSlB9AdnMpoWiFoWGSx5gw87 arhpLKLm4LmQUzvtO5oO5GvD5EGsFnUvVM+ODwwUhiO7zS5+UZsE8Y1oW1lC0tFHkdv8oriKZs YBi2jU4MgAR1HzcCuQ6yxe3SO9VOwMRmERJzaO7U5LN2SiL464xdqHyh0PbS9uFZkGcss5QLaD LD9EDWgz6V4VfkzJ5YWGhfpxZTDcdSJ396mTHenvUSWJ1k3Wqv1yXRi+InBOeqqBhKMWVZ0TwJ xVx+GvVHQW2gtIe9lLe2H5Wq X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935559" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:54:57 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:54:56 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:52 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 29/35] mtd: spi-nor: winbond: w25q256jvm: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:16 +0300 Message-ID: <20210727045222.905056-30-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215458_369215_A608F121 X-CRM114-Status: GOOD ( 12.09 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb, for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# find / -iname spi-nor find: '/proc/383': No such file or directory /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 14:16 . drwxr-xr-x 6 root root 0 Mar 9 14:15 .. -r--r--r-- 1 root root 4096 Mar 9 14:17 jedec_id -r--r--r-- 1 root root 4096 Mar 9 14:17 manufacturer -r--r--r-- 1 root root 4096 Mar 9 14:17 partname -r--r--r-- 1 root root 0 Mar 9 14:17 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id ef7019 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer winbond root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname w25q256jvm root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > sfdp-w25q256jvm root@sama5d2-xplained:~# hexdump sfdp-w25q256jvm 0000000 4653 5044 0105 ff00 0500 1001 0080 ff00 0000010 ffff ffff ffff ffff ffff ffff ffff ffff * 0000080 20e5 fffb ffff 0fff eb44 6b08 3b08 bb42 0000090 fffe ffff ffff 0000 ffff eb40 200c 520f 00000a0 d810 0000 0236 00a6 ea82 d314 63e9 3376 00000b0 757a 757a a2f7 5cd5 f719 ff4d 70e9 a5f9 00000c0 drivers/mtd/spi-nor/winbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 6be45d2291c6..cbfc41b261d7 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -95,7 +95,7 @@ static const struct flash_info winbond_parts[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) .fixups = &w25q256_fixups }, { "w25q256jvm", INFO(0xef7019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + SPI_NOR_PARSE_SFDP) }, { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024, From patchwork Tue Jul 27 04:52:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510343 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=Fr7851OL; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=dkCQp1cK; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnQL0nf3z9sWX for ; Tue, 27 Jul 2021 16:46:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=PKQJtdAXampgeNKe4Ij29D4r6rxFBtz+CCFwVAVgICw=; b=Fr7851OL0+ysWY AeGo+4CIxD9Rb675E/KtSBOKNXMnh+uRTuwk5zyIPdgOxywI2ASKJgJFKx7HYfrZcTc8XYdbPefdX WnRYUc55Ta/6WUXgvmWYbV0wHHiTBK0ozMcbr6JSH2qGfF1DM2laf1MDNWE/C9fEiYIuJfylWxmuG pipNN/XN5mSf6fZROjIB5w74yHgxmAdlxGR5OU92r1Jr8SeFYqR08f2SuuojUw9i8OnyIUm0PC7wl uSge5QTCtxjNOw03SSkmeKQpjHP3lm4rEUe/xgqjqRgamGjt2buBSeTdMTx5KCRcarPVKMzyZv24Y 2dc/3OQ4EwpZT6/Z/b1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Gqs-00DfZo-Qo; Tue, 27 Jul 2021 06:46:07 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7P-00DI2K-HZ; Tue, 27 Jul 2021 04:55:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361703; x=1658897703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YFDXqOqiOz32GuoZm4etjvBxgxuwZuogj1CClYqVE5o=; b=dkCQp1cKitu15gSz8P8J9lIfOcq3gTxBvI/prMC34F47j3KYfe/RqSUK 1yPhCtSAcd3s1gm51r0YcjfzTlHooy8wj1S9+D32Y+qH2Ww7bosaJEpoL tTQDPVXgaFrhlcLUwOR/UuqqlaHrEmVpCRG/BMDC7M4Pi0YMkvWwqLoH6 ARj9lS6VETfCKvif4t1ICiKT//Z3OWBufmhabPODYPHnF5nhsY3LMMLj8 12RNuwyUd+wxTbZ2agucUezTI6xvdU8i5w+6XYZ66fqZU0MMmIgdszeiY jNinJIEkCHZj3/pbzuC7IEkeCal9fmVMDUc6XM8JmJdXitN5/RcJoFtbS w==; IronPort-SDR: JVvyxwtejNbZoD/1CJ87+R8FUe3lgSUduA9OGZilUS/nrvWQwwt4Zciio4V2F/7u8+Cio3tF8Z DzwUWNO8U9FP7TcC5BeXH0IrrMDIzP73IXv3T3PpyEZBsxvGW5cP5YgwgxbqtSGCUdgPFTCpeN znKN19A+zGpy/xK5yn+lE5BJ4UUjhpEVVOs5AZegGXnWr/mzMDT/cHW7T1vC39NCCV2i/ma5uE cSM0An1Srg3NuyVedhx8v3VYvzmQZCq1lugD7gfbVjrGsyBLz8Ru946PeHMwTvBUuHGPmt303f /I4Vl6ux4EZkojfNFiEylkXF X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="130482199" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:02 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:01 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:54:57 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 30/35] mtd: spi-nor: issi: is25lp256: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:17 +0300 Message-ID: <20210727045222.905056-31-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215503_689370_2D3B4ACE X-CRM114-Status: GOOD ( 10.51 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4_4B 0xec, for erases SPINOR_OP_BE_4K_4B 0x21, and for writes SPINOR_OP_PP_4B 0x12. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id 9d6019 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer issi root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname is25lp256 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > sfdp-issi root@sama5d2-xplained:~# hexdump sfdp-issi 0000000 4653 5044 0106 ff01 0600 1001 0030 ff00 0000010 059d 0301 0080 0200 ffff ffff ffff ffff 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20e5 fff9 ffff 0fff eb44 6b08 3b08 bb80 0000040 fffe ffff ffff ff00 ffff eb44 200c 520f 0000050 d810 ff00 4a23 00c9 d882 ce11 cdcc 4668 0000060 757a 757a aef7 5cd5 424a ff2c 30f0 a9f2 0000070 ffff ffff ffff ffff ffff ffff ffff ffff 0000080 3600 2300 f99e 64c0 ef8f ffff 000008c drivers/mtd/spi-nor/issi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c index aeff8f60cbae..4f778f5d6adb 100644 --- a/drivers/mtd/spi-nor/issi.c +++ b/drivers/mtd/spi-nor/issi.c @@ -45,7 +45,7 @@ static const struct flash_info issi_parts[] = { { "is25lp128", INFO(0x9d6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ) }, { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + SPI_NOR_PARSE_SFDP) .fixups = &is25lp256_fixups, .late_init = snor_f_4b_opcodes, }, { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64, From patchwork Tue Jul 27 04:52:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510344 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=1lfd1UHw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=l0NboEwO; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnWR2BKfz9sWS for ; Tue, 27 Jul 2021 16:51:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=xpYIgeJhWMdGrEB5sam92ymBEm4Rh5cmUHv/T4tWVFs=; b=1lfd1UHwQU8LfZ X8FIErjozB2Jk1y22hVNRMRbYFqvBryqHHoaifDjKSsBigPHF93NSZ6n5jzsZ52GVQYpDRaYwpryK 4TLlKLjZKL5546RYxJs3DxVW94Pppjd80LTJ6GTJmAq8Uk5rXTaSJ8pS9SLfIUGEzQ/AUZje4QmLL KWz1fn06FokrGvZXfyYHCCGAgZUt6/15+MCyDU+77l2hpAqbNTiF4NxSdKdiGSjW1FYoFkCAoM5aj /C3Sq6B0h3CbSxQd08yECzTgVAyZba8iakC4HWNvw2gGUKuP1MEU7vQCmuNuHQ0hNWbyLLRpMqeR7 W+6w3nF4XBRAXGhtnTWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GvC-00DgOC-Ao; Tue, 27 Jul 2021 06:50:34 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7U-00DI3f-26; Tue, 27 Jul 2021 04:55:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361708; x=1658897708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rw9pd7hKHwkij51FXnWhKe3/qlJzsbPMaydEM1Cbtx8=; b=l0NboEwOJ3uGKWyZX8gawOvLvkgOTogKzxZM1ZJFCw6DEv4biCuFgqw0 3oC8IpcmX+7eKD/7Cx/7UTAfCwDdzBSWTKnj22r2qQRtceMnuXhAqt5zq l0vD1fp4OV+UB2REYkLwDI12Zb5/qbrDsykDSmg29Fb4iD1XakoietmSl fKiHibG7nv1p9HMH4m5zCYIDrE2VHVv9awd7V6LUos5CUiDNUnnEQs8sd 6bkjEz/zK0Teas2t4fFyTUsz3Nms+bwz/d679GeFhiM1QIKUaMQtTyQLB sPFnO1zyBYHB5fQT90lq1JT7yPYJCwy7NP1z9Lhol+3GHo9fyVRAMqP+9 Q==; IronPort-SDR: F/80afb0lpIHx9NkkB7/G26fdSGJseecdeGY+1w9IQEWgCtl9NFKOrqcLLkNgRVMC1lJo40f3S a6q0Bws1xo0yGtuhBsy0nwr3oNOTNSOggLFNpl8GzQGXr2hVVHA0ifpOgHmXp8MLrU9yP/QYP8 TETUy1jT8i8DDQAj3wHczdKJ42EKcP7kqsS7QAp226K4dCohPJ97HXF8eNdV8aAnW4kMqYC2pj 71K0FMlkvV5k55uC//fxd+3qmAcWEvrQ/3eySRSymvuB87UOhto1e8ZUTY6j5SvMHg9EoVB2f2 yd9Bm5RGZnVQgDHPK/3F9vz2 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137654067" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:07 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:06 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:55:02 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 31/35] mtd: spi-nor: spansion: s25fl256s0: Skip SFDP parsing Date: Tue, 27 Jul 2021 07:52:18 +0300 Message-ID: <20210727045222.905056-32-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215508_173008_C2DCE45C X-CRM114-Status: GOOD ( 10.77 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: s25fl256s0 does not define the SFDP tables nor implements the RDSFDP 0x5a command. Skip the SFDP parsing in order to avoid issuing an unsupported command to the flash. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/spansion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 s25fl256s0 does not define the SFDP tables nor implements the RDSFDP 0x5a command. Skip the SFDP parsing in order to avoid issuing an unsupported command to the flash. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi-nor/spansion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index af10833f56d8..7fe4e31f8c3e 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -209,8 +209,8 @@ static const struct flash_info spansion_parts[] = { SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, { "s25fl256s0", INFO6(0x010219, 0x4d0080, 256 * 1024, 128, - SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - USE_CLSR) }, + SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | + SPI_NOR_QUAD_READ | USE_CLSR) }, { "s25fl256s1", INFO6(0x010219, 0x4d0180, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, From patchwork Tue Jul 27 04:52:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510345 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=zxP/bnLP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=N7yrMvvG; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYncm0CCfz9sX2 for ; Tue, 27 Jul 2021 16:55:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=0NkHRBjHEA4h8gr7auUhNQ8rJlY201ttYpBbCfxBgx4=; b=zxP/bnLPkTu/5i h8axSs7C17ylol7H2EJp+0PIm9BUp9WFbsqtTMySu5FnbxJoEyMduoSsIASCnZ4Tjfi1kaKkl0iR1 +Zmd/TmFyHrLHqbkZW75lgCwpPtSFv+d7a/hk3X01nAogprO2lSFvfZdaYAOpkFSM46ZIsbI6I/+v rC3dsGDHtPqD2YtR3bGPcMEijtXWdXklwVj47GlhEvtfEYdgM2b3r8g3XiENEHeSXKbX5tB/5m5AV KpOY8tYaS5hjGZRlWgSgnPc/uHwGydOaS9c2RTQoabdQEjHupMqjR1fI/i3uPL3REOVQC6aNI+oWy OsP7dARtwpqhLRd9VQdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GzZ-00Dh9O-U4; Tue, 27 Jul 2021 06:55:06 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7a-00DI5N-8J; Tue, 27 Jul 2021 04:55:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361714; x=1658897714; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hS0mPNifufnhkL17r+uLX0qeIBwXPGRyRWvEieR6Zkk=; b=N7yrMvvGMRkLzQzOvA9ob0mPmz6UiCKkCDhoyK14/v2065u7TKjZcVz5 //79q4lR+YPbO8Pv5ryDliku79f2tNPqDuNMWbT+K4cMG9MZRjjReVZ8Q 4UiNIfxG94dw+R0it636uF8aIXMP+ninhIyHGpF2QB647ngLlRVDwdjw9 MqQ7SGyAAFwUwte1GkaYwNUmwt0ua1rVNL+nkDoaO5dQVodBszOEnm61v GWoGuVv+2QYEUBeW6ZNjY6l85jZpHGCYTbOCT0NPSYuuu+JIKpdJkqyvt vmL2y3KbizlYqkz9Kgh5VbgwWYo5Y1LtHOnoY6hEp1RMfyoXcJQAMxND4 w==; IronPort-SDR: aLBOaYRRYEX0ZV32fbSS2a1+x3HvExsKy1CcghO2b5JWEif6yfYRUnSNssM8v53H2aDdEG0XsV GIrKO5i38ewPDEh/uilW5x0vft+59o7llO4pWDo6LOCHucylBtdQdDli2IoHzwjM+cmcMduQLt 7Mszqmh2hGEvBul9JrsytF7Tnwhbd3lbQzHl7FTfb8/ysukIq25CFh+p4IPCXTmkOTFS/3phuf ZkV2/IHt7rDibnujW9JQ4nIdYaeS/dpdJEQbQ1/lVHof2ZPyN1Idi8TD5Oqs1kDEOUE57RGl42 DfQ6lXh/ZAzHBXhm27C0IgMz X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="126055132" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:11 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:55:07 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 32/35] mtd: spi-nor: gigadevice: gd25q256: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:19 +0300 Message-ID: <20210727045222.905056-33-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215514_476797_D4F05226 X-CRM114-Status: GOOD ( 10.55 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4_4B 0xec, for erases SPINOR_OP_BE_4K_4B 0x21, and for writes SPINOR_OP_PP_1_1_4_4B 0x34. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# find / -iname spi-nor /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-norroot@sama5d2-xplained:~# /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor^C root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 15:57 . drwxr-xr-x 6 root root 0 Mar 9 15:10 .. -r--r--r-- 1 root root 4096 Mar 9 15:57 jedec_id -r--r--r-- 1 root root 4096 Mar 9 15:57 manufacturer -r--r--r-- 1 root root 4096 Mar 9 15:57 partname -r--r--r-- 1 root root 0 Mar 9 15:57 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id c84019 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer gigadevice root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname gd25q256 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > gd25q256-sfdp root@sama5d2-xplained:~# hexdump gd25q256-sfdp 0000000 4653 5044 0106 ff02 0600 1001 0030 ff00 0000010 00c8 0301 0090 ff00 0084 0201 00c0 ff00 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20e5 fff3 ffff 0fff eb44 6b08 3b08 bb42 0000040 ffee ffff ffff ff00 ffff ff00 200c 520f 0000050 d810 ff00 6242 fec9 e982 5814 60ec 3306 0000060 757a 757a bd04 5cd5 0600 0044 5008 0100 0000070 ffff ffff ffff ffff ffff ffff ffff ffff * 0000090 3600 2700 f99e 6477 cbfc ffff ffff ffff 00000a0 ffff ffff ffff ffff ffff ffff ffff ffff * 00000c0 0eff fff0 5c21 ffdc 00000c8 drivers/mtd/spi-nor/gigadevice.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/gigadevice.c b/drivers/mtd/spi-nor/gigadevice.c index ff523fe734ef..f4cdd87893a7 100644 --- a/drivers/mtd/spi-nor/gigadevice.c +++ b/drivers/mtd/spi-nor/gigadevice.c @@ -46,9 +46,8 @@ static const struct flash_info gigadevice_parts[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, { "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | - SPI_NOR_TB_SR_BIT6) + SPI_NOR_PARSE_SFDP | SPI_NOR_HAS_LOCK | + SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6) .fixups = &gd25q256_fixups, .late_init = snor_f_4b_opcodes, }, }; From patchwork Tue Jul 27 04:52:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510349 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=htpSW5Qv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=gVgIGzim; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnkH0Jhyz9sWS for ; Tue, 27 Jul 2021 17:00:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=riGwicPZXzX+aYZ5rEFTJ+7MoYcwV2fsIuCG1l/EtYY=; b=htpSW5QvbJ/BrB h7MnX7+YATEfFuMIQHEe1vhQbNIorrNayLYt3G+yleM15kzdeMm2WXSIwPbZlXL4OOYrXapaYU05k 1nalZKesJYFG1COiqwfmtjyDxmqToCdkCMPNaizYMZmbqTb6rrwd3myXB1spTnjXMrwjNP6m2WZb+ rzlPJu6O/iT58O20EGsVGMFuhodqJ/Ma4hv7D9gbMabdT3iXEERn2iN4rAPCq5mK5Z1Ie57LQ+2Xk VsetMftaSkmW3f9EHJNMhLk+riauRfyNSdkfjNPNV7V2ZNAyEPni/WNZoZ56kTMvEfYopCKoDXac2 xI+SfGDwDgPuCKLcQPaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8H3z-00Di1r-Tn; Tue, 27 Jul 2021 06:59:40 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7e-00DI6m-JM; Tue, 27 Jul 2021 04:55:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361718; x=1658897718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rz4/CFcmWeFTUWNky+5xp12x4PAxGGUNRLbxni7Jfno=; b=gVgIGzims56M4sKilYuZ2iDAgWoLImyw37nEi8xWFJkbJQx4215KoAtk 1Ry5I4fele6wuHTXHuqVXI66zmbGOKyu6jHlVKfV+cAnLtKf+telClqB/ 2ymf2kogJWZrFmtrIClxpT6j6CblWoqjwf9rfJyQZgTS0VIkG1deBFBSr DiucgmBR9d7fUzUy9Kw1CGFlUO6ZJgEyCT0rxJ1GbC3xomAmbK3cVAJiA gZHVP9niqQIXUGSTqovx7VixUNi7WLs7aSzwYGRngCnxruc9xj3qMR4oF /RIbSxxxN/H+GcdcmwnMD5gNGGgAs9ZGtGv8nfM+O/ZI1xY5agyH3HxxK A==; IronPort-SDR: Wvx7nzcvRdplnheYJYEAtKiRY1GCTq4k5K/Irf4omM2Rc1AyFyucrUv2+RRV0gdwULu6vyWd/y OYX6kMlNsLOsiszRDpg4tGEnrZk3YLDSdkP2xXfdhaM5L15I1YQYDYSO1pCGUgVb1iLYz/T4vO 6iYyDOkp1pv1R3otJwRqjcNkjuVpVZy8n/hg0xG6pWe2ZBTgs4SWXy3spPej6KOHsaPfzhibkV 7kczvSmbSKmtJElgie1ovHqwgyyFFiluPHVnFYn6uE5AqXGZn2umhrsZtWeyRLAxQWgKfhZFwt z/XfOqy0m1KyC6SIjA3Hmta+ X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="129935595" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:17 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:55:12 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 33/35] mtd: spi-nor: micron-st: n25q256a: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:20 +0300 Message-ID: <20210727045222.905056-34-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215518_731686_A64EB938 X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb, for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# find / -iname spi-nor /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor ^C root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 16:14 . drwxr-xr-x 6 root root 0 Mar 9 16:13 .. -r--r--r-- 1 root root 4096 Mar 9 16:14 jedec_id -r--r--r-- 1 root root 4096 Mar 9 16:14 manufacturer -r--r--r-- 1 root root 4096 Mar 9 16:14 partname -r--r--r-- 1 root root 0 Mar 9 16:14 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id 20ba19 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer st root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partnme cat: '/sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partnme': No such file or directory root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname n25q256a root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > n25q256a-sfdp root@sama5d2-xplained:~# hexdump n25q256a-sfdp 0000000 4653 5044 0100 ff00 0000 0901 0030 ff00 0000010 ffff ffff ffff ffff ffff ffff ffff ffff * 0000030 20e5 fffb ffff 0fff eb29 6b27 3b08 bb27 0000040 ffff ffff ffff bb27 ffff eb29 200c d810 0000050 0000 0000 0000054 drivers/mtd/spi-nor/micron-st.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index 31ebd4c9b431..c685dc6c5aff 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -156,9 +156,8 @@ static const struct flash_info st_parts[] = { SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) .late_init = snor_f_4b_opcodes, }, - { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | - USE_FSR | SPI_NOR_DUAL_READ | - SPI_NOR_QUAD_READ) }, + { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, + SPI_NOR_PARSE_SFDP | USE_FSR) }, { "mt25qu256a", INFO6(0x20bb19, 0x104400, 64 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) From patchwork Tue Jul 27 04:52:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510350 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=W7cdTYKc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=kcpR898L; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnq43BpFz9sWS for ; Tue, 27 Jul 2021 17:04:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=XImLFRIykSOojVLDpULeoN6ZTxctQlqA26/8E1rEpZQ=; b=W7cdTYKcaBwYGA 6M8/8fn2P4uVuuXSrqfZYgSNRAOwqScdMjG73FJbkOeRarfEM5YAKBIZS04/9vkGzSrDQhsjlh+MK gccwIjJzw63xq0K1e1O2mws81UbqO3iXmJCPDRhJhoQq5AVVQCyO/EX65l/GGY0BcSRa2R8yrsDxt r5LvrQzxYKSLOcjLcQMT8YwtB9hf6jbwW5ogpTXfZMcalIrKmJKUVmVVSTVOBXttSxLHu3184l7wT HWFNA15XvUCL81pOT0wmI4uldGJT73um62P/gY2DvS1sqOlABuyNCAOHsxkUcgGEaRF929RAIIPsY 8BwU/A/mgK3fgvwaEPXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8H8A-00DjN2-Ai; Tue, 27 Jul 2021 07:03:58 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7j-00DI8M-8m; Tue, 27 Jul 2021 04:55:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361723; x=1658897723; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IO52f8kF9wUaT16TlrBacs61p5rHu3R/YcDLO6eRPbE=; b=kcpR898Lh85bpfOWNk69KNKm6kkLLYhOd+LT35fq9PbXooxeHeeT0XxE CVWg3E5EHJUrJIYCdJK4ivkGnD3MwkTS0oHXftToK/9Jwj/Q6qEeyaxoZ 9yf5BfogzUCUww8Dpm4JeMwaQ40koxaF1bFs+gsYKbOFP66MYtGuz1Tfb OIN5x18tdqeDt6UDZtStO9BVdnSiStoS6cYVBPQgxcheAH3yLT74gI0Js vGRGQYSRKOpWfU+v8CNH9/A8YQsX0yaCijxuJ/qH3O55llCxi4lKzpygu F07sHRX0ZAlgqIJdSpjA/3c4cl9crCfy+oCreoo+PJ+XM4TxQQ7EIz//g w==; IronPort-SDR: QwPDHxRxJ0+iBUU+KPk44DezCULg+WgEA0au4LrKAh3UfNWnEVz71qf9G8/6Wh91fFmqwmN6GM lCTXdFohmNtHOCDoODKSWsWUgMGtiLzJ8ip9YQZOlHG0rxCb6cSPtWJkSTKkfRZChp5tL+vtpd IjcyeOC8Fx4EGgU3nXHKVLNFzSb9oSdf4iZAIvKT/YTlaYycbIqXnW5r5g1WJVXHKFmmWHvAn7 uG1zmJ8a1OjtVBIn0e8Ss3DDrwTDg3e+y+4ei9DTM50s3h2S8viqiRXCXMx2Iwd1ll/B4EGmbZ 4Gg3fgu+bpS5gNEwwVA3R+CA X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="137654091" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:22 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:21 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:55:17 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 34/35] mtd: spi-nor: macronix: mx25l25635e: Use SPI_NOR_PARSE_SFDP Date: Tue, 27 Jul 2021 07:52:21 +0300 Message-ID: <20210727045222.905056-35-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215523_393684_F2CD6611 X-CRM114-Status: GOOD ( 12.10 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Get rid of the static initialization of the flash parameters and init them when parsing SFDP. Generated a 256 Kbyte random data and did an erase, write, read back and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4_4B 0xec, for erases SPINOR_OP_BE_4K_4B 0x21, and for writes SPINOR_OP_PP_1_4_4_4B 0x3e. Signed-off-by: Tudor Ambarus --- root@sama5d2-xplained:~# find / -iname spi-nor find: '/proc/381': No such file or directory /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor /sys/devices/platform/ahb/ahb:apb/f8000000.spi/spi_master/spi0/spi0.0/spi-nor /sys/bus/spi/drivers/spi-nor root@sama5d2-xplained:~# ls -al /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor total 0 drwxr-xr-x 2 root root 0 Mar 9 16:27 . drwxr-xr-x 6 root root 0 Mar 9 16:26 .. -r--r--r-- 1 root root 4096 Mar 9 16:27 jedec_id -r--r--r-- 1 root root 4096 Mar 9 16:27 manufacturer -r--r--r-- 1 root root 4096 Mar 9 16:27 partname -r--r--r-- 1 root root 0 Mar 9 16:27 sfdp root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id c22019 root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer macronix root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname mx25l25635e root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > mx25l25635e-sfdp root@sama5d2-xplained:~# hexdump mx25l25635e-sfdp 0000000 4653 5044 0106 ff02 0600 1001 0030 ff00 0000010 00c2 0401 0110 ff00 0084 0201 00c0 ff00 0000020 ffff ffff ffff ffff ffff ffff ffff ffff 0000030 20e5 fffb ffff 0fff eb44 6b08 3b08 bb04 0000040 fffe ffff ffff ff00 ffff eb44 200c 520f 0000050 d810 ff00 59d6 00dd 9f82 db03 0344 3867 0000060 b030 b030 bdf7 5cd5 9e4a ff29 50f0 85f9 0000070 ffff ffff ffff ffff ffff ffff ffff ffff * 00000c0 8f7f ffff 5c21 ffdc ffff ffff ffff ffff 00000d0 ffff ffff ffff ffff ffff ffff ffff ffff * 0000110 3600 2700 f99d 64c0 cb85 ffff ffff ffff 0000120 drivers/mtd/spi-nor/macronix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 9709eb68b613..b4eaf22ee388 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -103,7 +103,7 @@ static const struct flash_info macronix_parts[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, - SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) + SPI_NOR_PARSE_SFDP) .fixups = &mx25l25635_fixups }, { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K) .late_init = snor_f_4b_opcodes, }, From patchwork Tue Jul 27 04:52:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 1510351 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=2607:7c80:54:e::133; helo=bombadil.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=bombadil.20210309 header.b=y/8oO2Jm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=rlKWhOZF; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4GYnwZ3HQNz9sWS for ; Tue, 27 Jul 2021 17:09:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=r5cEA7Q8kqEJGHyvX+GLH8JsBaOFNGtB7HIk6f4k4cs=; b=y/8oO2Jm5iDUhu lVZ6K7PExtnCf5nVPj/Sre+Rrsq5ffARTXgqVll3JivePUtMpOpOGn0uUvOTnjWUxbIT1LkJqxtxD efKZr+415ov9Ov02UGsa1SsZ+koU8IUvgTPKi3n+P3wslrYBR9x0KulDRBQs0RorOOmW/8656sgj6 XwW+qbydCrSM48h8w5m5Pwin4kmWiIcCKANZ7LYfNauKekXfukbix7vwTFwH2KatLnx9Dl7agtvB9 O8jYia5odhpgcqgedmAMe5PdXnfxetnQHUpSS0sPOqrIx7k/mIs4h80S8V8eoS8rHnkArM6hvSskE slmh0vZXOU5cYph27YSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8HCq-00Dkef-FY; Tue, 27 Jul 2021 07:08:48 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8F7p-00DIA3-4T; Tue, 27 Jul 2021 04:55:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1627361728; x=1658897728; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SzwolEeGEyf9oVitKoVWHbwOtUaC9B7RoDUDxRyncSM=; b=rlKWhOZFnwdk2liwM/fwltwflE3Tos+Lfo9dDFjtS6y2z+Y352FatF53 im6Y2UTKiRH0HK/0a32RljRFeOh8EVSs5WIkgQBIfkqqgLMfg/3iDQVva iudxhwimM0uoc30ppx/o6NvmwIIEPtVl2jX66be+hJ1x5KoIVKYf2lKSd pEpNhtxITaZqT9gaP8Mde749JHzPEhCau+pz6uVekF8tyzyXuBpOPMq3v Puy37oD1PtHng+wCa+796bXSUjDs6P/Sw4tOjgoBYrduaNtLvAqQGKD3b VRQzI4kDirDulGzopb6r0Q+59loFXb32IVRxlLj3nYsQmfxz/RrBv4+Tf g==; IronPort-SDR: 9XNm7nmNa6fpHsh9VcPRvZQ4yZM2IpARhmTgovzXaLol2YVXizopAqpcep/oIfGSOkYq1QpWXB OWFtvjkqDY+95OtH6lAz1HrOuOvXYt8004GcmzhIn6jTgSUnI4WJ/gdh6cJS9PbD/VCIMnuZZe OcHXZ74pnFCxMpOdKPFRWWVK4WFA02xtu/Ppgch3eOyi5/gXGwBcfrhBeTIeAdlVbIg+VyS+Gr OjFAq/rn6sJAVhtMe/bNkyUJe4mexn86Aewqr4bazgaujHFtxuClx/Mz2ZocuKoDQaP+m+EmUk 7VDAdOzx+xdpwVroAN5FNTlB X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="123560057" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jul 2021 21:55:27 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 26 Jul 2021 21:55:27 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 26 Jul 2021 21:55:22 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , , , , , , , , "Tudor Ambarus" Subject: [PATCH v2 35/35] docs: mtd: spi-nor: Add details about how to propose a new flash addition Date: Tue, 27 Jul 2021 07:52:22 +0300 Message-ID: <20210727045222.905056-36-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727045222.905056-1-tudor.ambarus@microchip.com> References: <20210727045222.905056-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_215529_322250_EE34DE22 X-CRM114-Status: GOOD ( 27.02 ) X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.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: Add some guideliness on how to propose a new flash addition. Signed-off-by: Tudor Ambarus --- Documentation/driver-api/mtd/spi-nor.rst | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Add some guideliness on how to propose a new flash addition. Signed-off-by: Tudor Ambarus --- Documentation/driver-api/mtd/spi-nor.rst | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/Documentation/driver-api/mtd/spi-nor.rst b/Documentation/driver-api/mtd/spi-nor.rst index 4a3adca417fd..ffb8d97a2766 100644 --- a/Documentation/driver-api/mtd/spi-nor.rst +++ b/Documentation/driver-api/mtd/spi-nor.rst @@ -66,3 +66,68 @@ when you want to write a new driver for a SPI NOR controller. Another API is spi_nor_restore(), this is used to restore the status of SPI flash chip such as addressing mode. Call it whenever detach the driver from device or reboot the system. + +Part IV - How to propose a new flash addition? +---------------------------------------------- + +First we have to clarify where the new flash_info entry will reside. Typically +each manufacturer have their own driver and the new flash will be placed in that +specific manufacturer driver. There are cases however, where special care has to +be taken. In case of flash ID collisions between different manufacturers, the +place to add the new flash is in the manuf-id-collisions.c driver. ID collisions +between flashes of the same manufacturer should be handled in their own +manufacturer driver, macronix being an example. There will be a single +flash_info entry for all the ID collisions of the same ID. + +manuf-id-collisions.c is the place to add new flash additions where the +manufacturer is ignorant enough to not implement the ID continuation scheme +that is described in the JEP106 JEDEC Standard. One has to dump its flash ID and +compare it with the flash's manufacturer identification code that is defined in +the JEP106 JEDEC Standard. If the manufacturer ID is defined in bank two or +higher and the manufacturer does not implement the ID continuation scheme, then +it is likely that the flash ID will collide with a manufacturer from bank one or +with other manufacturer from other bank that does not implement the ID +continuation scheme as well. + +flash_info entries will be added in a first come, first served manner. If there +are ID collisions, differentiation between flashes will be done at runtime if +possible. Where runtime differentiation is not possible, new compatibles will be +introduced, but this will be done as a last resort. + +New flash additions that support the SFDP standard should be declared using +SPI_NOR_PARSE_SFDP. Support that can be discovered when parsing SFDP should not +be duplicated by explicit flags at flash declaration. All the SFDP flash +parameters and settings will be discovered when parsing SFDP. There are +flash_info flags that indicate support that is not SFDP discoverable. These +flags initialize non SFDP support in the spi_nor_nonsfdp_flags_init() method. +SPI_NOR_PARSE_SFDP is usually followed by other flash_info flags from the +aforementioned function. Sometimes manufacturers wrongly define some fields in +the SFDP tables. If that's the case, SFDP data can be amended with the fixups() +hooks. It is not common, but if the SFDP tables are entirely wrong, and it does +not worth the hassle to tweak the SFDP parameters by using the fixups hooks, or +if the flash does not define the SFDP tables at all, then one can statically +init the flash with the SPI_NOR_SKIP_SFDP flag and specify the rest of the flash +capabilities with the flash info flags. + +With time we want to convert all flashes to either use SPI_NOR_PARSE_SFDP or +SPI_NOR_SKIP_SFDP and stop triggering the SFDP parsing with the +SPI_NOR_{DUAL, QUAD, OCTAL*}_READ flags. There are flashes that support QUAD +mode but do not support the RDSFDP command, we should avoid issuing unsupported +commands to flashes where possible. It is unlikely that RDSFDP will cause any +problems, but still, it's better to avoid it. There are cases however of flash +ID collisions between flashes that define the SFDP tables and flashes that don't +(again, macronix). We usually differentiate between the two by issuing the +RDSFDP command. In such a case one has to declare the SPI_NOR_PARSE_SFDP +together with all the relevant flags from spi_nor_nonsfdp_flags_init() for the +SFDP compatible flash, but should also declare the relevant flags that are used +in the spi_nor_info_init_params() method in order to init support that can't be +discovered via SFDP for the non-SFDP compatible flash. + +Every new flash addition that define the SFDP tables, should hexdump its SFDP +tables in the patch's comment section below the --- line, so that we can +reference it in case of ID collisions. + +Every flash_info flag declared should be tested. Typically one uses the +mtd-utils and does an erase, verify erase, write, read back and compare test. +Locking and other flags that are declared in the flash_info entry and used in +the spi_nor_nonsfdp_flags_init() should be tested as well.