From patchwork Thu Oct 26 11:23:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 1855787 X-Patchwork-Delegate: tudor.ambarus@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=RP576GVc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Z8coaOMj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SGNjX5H0pz23jV for ; Thu, 26 Oct 2023 22:24:15 +1100 (AEDT) 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=tblFyyY5Jpdr+7EmarDjUjBx35liqeBT/r5xGWMe9CM=; b=RP576GVcCj6AaS bmO5oCAQfC6HFWQ1MS/lTGQzSNDK3Y3RJA0aWkubCToHWBGf0vUd4i6B3NHxVCB+nJUyDmzkP22w/ v7jKT1TQU0BVadn8pgr9e7pL5GL0SgNKS5NH6oBLLIWGngCK8+jLskehpursWUFfvJ72a/AsMI/wh nn7KOwTfcVTdShySha8HfMJ2HK6dFDsIDo0l5WmidGyai4yWy44UWxxayZJ27b8ECA3xRGXn+9JEO pO7WIXo1+9IoLvgqdZ4uKOkVtsUwL0dOQtP2yVxFmvrpaVuNTgKBU3pLEpJN56O4WhWoU/mpf1ysT Rgsl3hzTbmRjPjgsgOXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvySi-00EMBS-0I; Thu, 26 Oct 2023 11:23:40 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qvySe-00EM9r-0p for linux-mtd@lists.infradead.org; Thu, 26 Oct 2023 11:23:38 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2739c8862d2so156612a91.1 for ; Thu, 26 Oct 2023 04:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698319413; x=1698924213; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iwkuKsYmlW+m0Dyff8DqbSXCchV+IFfsUN6wMmflWq8=; b=Z8coaOMjylFkMHNwoRosgzhpmfTLPRyYI93YpV9eMKDypUM9g/w/6EPYTtPEpbl/JA IWRkS/iHdjLg1nLNCSSH+lo67QE73LHGiwvfkiyGvCIRUpeSacGa2IEaHDxp9NVAzOwM bwdguAY0XWYFGUgJ/gv/Ud64/C/4tyBhbaAEirtD5p85w1ETtac1o5N82ta4Dn9yedHz bLjseB5sRopLNqrM5HEVjoqa7KJAFthbllMqUIl0jQ5KRJsKDLIHXdGwhOp8JpalAHGl doueMDHSgZngZ+JgiqGHiAXHxS9NBRyUtI/Yi+O5y5T5BF4R0ObxmU6KLgO3VBrLgRtT /Z3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698319413; x=1698924213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iwkuKsYmlW+m0Dyff8DqbSXCchV+IFfsUN6wMmflWq8=; b=dNu+p+q51ytmxto2vZeXnlhDWYNHmeM43kWSbCcSKoSp5GMjvGwx4BE2R/J1yHAxnI +XdXRexBcuXdJTgP+JuFEe4/bquUR8dJpcwd9EsNdR2TACpITwBbu0PaawjAYBc7Pvs7 IInz3FEy0iNd2yTWGY8K7bqZfLn4YDWUnpfXuP3er1vA65Xk3JiT2KjFHy7SMWUuQVim lwdkmnDhywgQ331JvPUR4VS3jx0iCALab3GDZUa2ULVw7ukMvMUdopKNa+0hho+Nm2xR A7eI9631+6+Wpfio5IGxGZikdMhU0q8nZs2IZlKnJZgvtmUX1qIPWtba9jlMA3Vf+z3n PdaQ== X-Gm-Message-State: AOJu0YxkhVekJuIszact0HWOrxS7Tg/nQyIk139ygSNCOvSKxLX/0s99 RYYEPEVcRu2LRboHej8zcUN8a7qM90o= X-Google-Smtp-Source: AGHT+IElPaNM4iXbuumEuycISTNEeTqieKZXMu8pa8ZpdpELHLtR0vndEAvFWWfjkLRApFmQEUREyQ== X-Received: by 2002:a17:90b:33c4:b0:274:60c7:e15a with SMTP id lk4-20020a17090b33c400b0027460c7e15amr20449379pjb.4.1698319413203; Thu, 26 Oct 2023 04:23:33 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b61:4887:380:b001:41f4]) by smtp.gmail.com with ESMTPSA id c19-20020a63d513000000b005acd5d7e11bsm2445690pgg.35.2023.10.26.04.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 04:23:32 -0700 (PDT) From: Fabio Estevam To: tudor.ambarus@linaro.org Cc: michael@walle.cc, pratyush@kernel.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org, tkuw584924@gmail.com, Fabio Estevam Subject: [PATCH v3 2/2] mtd: spi-nor: micron-st: Add support for mt25qu01g Date: Thu, 26 Oct 2023 08:23:12 -0300 Message-Id: <20231026112312.3217502-2-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026112312.3217502-1-festevam@gmail.com> References: <20231026112312.3217502-1-festevam@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231026_042336_314608_E8526C2E X-CRM114-Status: GOOD ( 14.53 ) X-Spam-Score: -0.2 (/) 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: From: Fabio Estevam Add support for the MT25QU01G 128MB Micron Serial NOR Flash Memory model. Datasheet: https://www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/mt25q/die-rev-b/mt25q_qlkt_u_01g_bbb_0.pdf Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [festevam[at]gmail.com] -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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:102e listed in] [list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Fabio Estevam Add support for the MT25QU01G 128MB Micron Serial NOR Flash Memory model. Datasheet: https://www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/mt25q/die-rev-b/mt25q_qlkt_u_01g_bbb_0.pdf Tested on a i.MX8MP based board: ~# cat /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/jedec_id 20bb21104400 ~# cat /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/manufacturer st ~# cat /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/partname mt25qu01g ~# xxd -p /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp 53464450060101ff00060110300000ff84000102800000ffffffffffffff ffffffffffffffffffffffffffffffffffffe520fbffffffff3f29eb276b 273b27bbffffffffffff27bbffff29eb0c2010d80f520000244a99008b8e 03e1ac0127387a757a75fbbdd55c4a0f82ff81bd3d36ffffffffffffffff ffffffffffffffffffe7ffff21dcffff ~# md5sum /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp 9d28d1b11de8b15ba9152644219d9a78 /sys/devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp ~# dd if=/dev/urandom of=spi_test bs=1M count=128 128+0 records in 128+0 records out 134217728 bytes (134 MB, 128 MiB) copied, 4.77424 s, 28.1 MB/s ~# mtd_debug write /dev/mtd0 0 134217728 spi_test Copied 134217728 bytes from spi_test to address 0x00000000 in flash ~# mtd_debug read /dev/mtd0 0 134217728 spi_read Copied 134217728 bytes from address 0x00000000 in flash to spi_read ~# sha1sum spi_test spi_read 6778615a7b7db2d3c3fa122721d940082eb67039 spi_test 6778615a7b7db2d3c3fa122721d940082eb67039 spi_read ~# flash_erase /dev/mtd0 0 0 Erasing 131072 Kibyte @ 0 -- 100 % complete ~# hexdump -C /dev/mtd0 00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 08000000 Signed-off-by: Fabio Estevam --- Changes since v2: - Added fixups to report the correct n_dice information. - Removed .flags = NO_CHIP_ERASE (Michael) - Removed .mfr_flags = USE_FSR (Michael) drivers/mtd/spi-nor/micron-st.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index 8920547c12bf..31839d6bc3ac 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -192,6 +192,20 @@ static struct spi_nor_fixups mt25qu512a_fixups = { .post_bfpt = mt25qu512a_post_bfpt_fixup, }; +static int mt25qu01g_post_sfdp_fixup(struct spi_nor *nor) +{ + struct spi_nor_flash_parameter *params = nor->params; + + /* MT25QU01G does not define the SCCR entry, so pass n_dice manually. */ + params->n_dice = 2; + + return 0; +} + +static struct spi_nor_fixups mt25qu01g_fixups = { + .post_sfdp = mt25qu01g_post_sfdp_fixup, +}; + static const struct flash_info st_nor_parts[] = { { .name = "m25p05-nonjedec", @@ -429,6 +443,10 @@ static const struct flash_info st_nor_parts[] = { SPI_NOR_BP3_SR_BIT6, .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, .mfr_flags = USE_FSR, + }, { + .id = SNOR_ID(0x20, 0xbb, 0x21, 0x10, 0x44, 0x00), + .name = "mt25qu01g", + .fixups = &mt25qu01g_fixups, }, { .id = SNOR_ID(0x20, 0xbb, 0x21), .name = "n25q00a",