From patchwork Tue Jul 25 02:23:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1812118 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; 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=) 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=qEIAx7Pn; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=VyP2rB4N; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R917T47QXz1yYC for ; Tue, 25 Jul 2023 12:24:19 +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=8/vvkxRZEijk0SwVU70rwdodIPeqo8+jzNNf2UvnNWM=; b=qEIAx7PnciXtBj UX1ruwtK9Kmjtkxbb5dfIabgMq94pvJEG/B/cFGJHXrEusvTSEs1+ZG52ECgdoIQDaBKGZd/fwJsz Jxywzwbe9QKmCMC4PGoy5TYjd/HNNSMs580VIG1GFhhTPg4JOjfLeveP0DwmhAhy9mS2ut0tfzfEi yJdEJ/OatVzQXcsp1sxZmTF8APpghfYO4nZtvJLxMtQdjE/9UXaHTijEaMs2grfjIBYdWXfZsk91K rXr43oNW8NUWbAvJy3RY6596doELf37ey0K4rmCnwcW4CNY3CXYHBo5JmqnWGL5LXkm7olDoKdkQl 0xusjlpILYM4gXJeXG3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qO7iA-005ts4-1u; Tue, 25 Jul 2023 02:23:42 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qO7i5-005tqq-0f for linux-mtd@lists.infradead.org; Tue, 25 Jul 2023 02:23:38 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1bb81809ca8so22437135ad.3 for ; Mon, 24 Jul 2023 19:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690251816; x=1690856616; 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=zobaIRhTbAwnUiXlFiBM748j6X72wdRlOo58XPnGSgg=; b=VyP2rB4NO801D/78tEEHvp9USQUyVmL3V2itqe3AJJ/KQf2cp+UiHlu172t1+zo3xj TNKlMYi+D69Qs/6dtuJPaEIq5dKYdO1sC91lclNN10TU2uy1G5NfuobKcdb8XOjIShT0 LEDyo2k6Duk/Xw+1/0DbYUc7Tra8G60BKX13922L1EVdFoH8kvAsDXN49TnZKB03J4Y4 FRW2T3ulFAtelrfhmgEcwywfh7g1wMo+eQVZnBDLwfWDK2DUoPqaX9MfnSFtG2SYthHB TGJOsB9z9HdKU30NXAIXZIuyWiipj7e4tKvBTdyPgDzI9nATWFdN+O066PXw/4ALJIHJ G1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690251816; x=1690856616; 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=zobaIRhTbAwnUiXlFiBM748j6X72wdRlOo58XPnGSgg=; b=cK2f/Z+i2Aqx+9jX9s7b7HollJtAsAiuynxRy3FftJnZgQNyoVZy0e/liCW2eVDjB7 32i9+mexxYl0fY+ZsF5uY7jDPqOa+TydeKypKZXZezPdmeZHecyPLW8Ekm1ZPkaM00R9 QhZDLxDkV6IJJn1HXwiaZ1v8owj9gvm4/yqSmeMhANiQxiohb+R1mDXktnkIcGjCIdr1 Todb/XRQkG430mTDHPRTx82YffPDfBrLNfJCj5ZxVFu1cn+2XfrE4MagRh9xqO+zIYmY FdQbpO6ZJ9Krj+a3zOZdeFKwaRMdlo2Vw97+AuwhVGtkw6iJVc8wMlzpF1rJuaPEXTNb Au5Q== X-Gm-Message-State: ABy/qLaqvhpW5YXzXdA7prZQMOrG/Cz2Fdmzv2e6m5QCenhi4f/z/kFw grEIHpeeXxjq85kX0l75aIA= X-Google-Smtp-Source: APBJJlH6XLAmr4RtTSbnqw1O+BIbpzNHTHV3Zu4O8APDGmkEpIMkxnoCpWiEZLJ4Y0zaYnUrYYHrYA== X-Received: by 2002:a17:902:d2c5:b0:1b6:68bb:6ad0 with SMTP id n5-20020a170902d2c500b001b668bb6ad0mr13432045plc.55.1690251815752; Mon, 24 Jul 2023 19:23:35 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id t18-20020a1709028c9200b001b866472e8dsm9620305plo.241.2023.07.24.19.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 19:23:35 -0700 (PDT) Received: from linux-patcher.mp600.macronix.com (linux-patcher [172.17.236.35]) by twhmp6px (Postfix) with ESMTPS id E419C80B31; Tue, 25 Jul 2023 10:22:39 +0800 (CST) From: Jaime Liao To: linux-mtd@lists.infradead.org, tudor.ambarus@linaro.org, pratyush@kernel.org, michael@walle.cc, miquel.raynal@bootlin.com Cc: leoyu@mxic.com.tw, JaimeLiao Subject: [PATCH v1 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash Date: Tue, 25 Jul 2023 10:23:01 +0800 Message-Id: <20230725022302.210275-2-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230725022302.210275-1-jaimeliao.tw@gmail.com> References: <20230725022302.210275-1-jaimeliao.tw@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230724_192337_246040_515E38F4 X-CRM114-Status: GOOD ( 18.23 ) 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: JaimeLiao Enable Octal DTR mode with 20 dummy cycles to allow running at the maximum supported frequency for adding Macronix flash in Octal DTR mode. Signed-off-by: JaimeLiao Co-authored-by: Tudor Ambarus --- drivers/mtd/spi-nor/macronix.c | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) 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 [jaimeliao.tw[at]gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:629 listed in] [list.dnswl.org] -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 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: JaimeLiao Enable Octal DTR mode with 20 dummy cycles to allow running at the maximum supported frequency for adding Macronix flash in Octal DTR mode. Signed-off-by: JaimeLiao Co-authored-by: Tudor Ambarus --- drivers/mtd/spi-nor/macronix.c | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 04888258e891..9010b81e098f 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -8,6 +8,12 @@ #include "core.h" +#define SPINOR_OP_RD_CR2 0x71 /* Read configuration register 2 */ +#define SPINOR_OP_WR_CR2 0x72 /* Write configuration register 2 */ +#define SPINOR_REG_MXIC_CR2_MODE 0x00000000 /* For setting octal DTR mode */ +#define SPINOR_REG_MXIC_OPI_DTR_EN 0x2 /* Enable Octal DTR */ +#define SPINOR_REG_MXIC_SPI_EN 0x0 /* Enable SPI */ + static int mx25l25635_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, @@ -32,6 +38,76 @@ static const struct spi_nor_fixups mx25l25635_fixups = { .post_bfpt = mx25l25635_post_bfpt_fixups, }; +/** + * spi_nor_macronix_octal_dtr_enable() - Enable octal DTR on Macronix flashes. + * @nor: pointer to a 'struct spi_nor' + * @enable: whether to enable Octal DTR or switch back to SPI + * + * Return: 0 on success, -errno otherwise. + */ +static int spi_nor_macronix_octal_dtr_enable(struct spi_nor *nor, bool enable) +{ + struct spi_mem_op op; + u8 *buf = nor->bouncebuf, i; + int ret; + + /* Set/unset the octal and DTR enable bits. */ + ret = spi_nor_write_enable(nor); + if (ret) + return ret; + + if (enable) { + buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN; + } else { + /* + * The register is 1-byte wide, but 1-byte transactions are not + * allowed in 8D-8D-8D mode. Since there is no register at the + * next location, just initialize the value to 0 and let the + * transaction go on. + */ + buf[0] = SPINOR_REG_MXIC_SPI_EN; + buf[1] = 0x0; + } + + op = (struct spi_mem_op) + SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WR_CR2, 1), + SPI_MEM_OP_ADDR(4, SPINOR_REG_MXIC_CR2_MODE, 1), + SPI_MEM_OP_NO_DUMMY, + SPI_MEM_OP_DATA_OUT(enable ? 1 : 2, buf, 1)); + + if (!enable) + spi_nor_spimem_setup_op(nor, &op, SNOR_PROTO_8_8_8_DTR); + + ret = spi_mem_exec_op(nor->spimem, &op); + if (ret) + return ret; + + /* Read flash ID to make sure the switch was successful. */ + op = (struct spi_mem_op) + SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RDID, 1), + SPI_MEM_OP_ADDR(enable ? 4 : 0, 0, 1), + SPI_MEM_OP_DUMMY(enable ? 4 : 0, 1), + SPI_MEM_OP_DATA_IN(SPI_NOR_MAX_ID_LEN, buf, 1)); + + if (enable) + spi_nor_spimem_setup_op(nor, &op, SNOR_PROTO_8_8_8_DTR); + + ret = spi_mem_exec_op(nor->spimem, &op); + if (ret) + return ret; + + if (enable) { + for (i = 0; i < nor->info->id_len; i++) + if (buf[i * 2] != nor->info->id[i]) + return -EINVAL; + } else { + if (memcmp(buf, nor->info->id, nor->info->id_len)) + return -EINVAL; + } + + return 0; +} + static const struct flash_info macronix_nor_parts[] = { /* Macronix */ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1) @@ -108,6 +184,7 @@ static const struct flash_info macronix_nor_parts[] = { static void macronix_nor_default_init(struct spi_nor *nor) { nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable; + nor->params->octal_dtr_enable = spi_nor_macronix_octal_dtr_enable; } static void macronix_nor_late_init(struct spi_nor *nor) From patchwork Tue Jul 25 02:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1812120 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; 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=) 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=vlyUJOjq; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=kqVbzU+U; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R917T4Bhxz1ydq for ; Tue, 25 Jul 2023 12:24:19 +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=P8K3n8F8FOvFhNdCpM6OWiyFr8JNqvp435SlLfWs9fw=; b=vlyUJOjqlHyUXw yobW4QbkUwlkCo7LLdmSk85uOzWZtTcFJZNMhxiQKJ1kZQmZQiVMhMgoa9RvSp9q8oKbGiVnTgpUg +IMJszUOfT3HfUckeFJaJm3wor+KNYn3kwvYKtuOAjf67g7pCRHnHvGlyVS3ctNm4KeWCZoSoA6gp vxXucYGUCwxTyKNN6Z1FawuuTtdGPliweYjA28iLbXxuiw/iinM+HE9lcGghhIN5aFaHm58nCQ8vr ANeyVx1niwx6xMCZkSNBtWxcQQfQgzWWo4Dy6mdP2OqpHrYx4I6YiQPL6LrLdQiia8p3E+Zz520L+ D57rOoUJlzEUroPnotbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qO7iB-005tsB-0I; Tue, 25 Jul 2023 02:23:43 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qO7i5-005tqt-1l for linux-mtd@lists.infradead.org; Tue, 25 Jul 2023 02:23:40 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6b9f47214a3so4719897a34.0 for ; Mon, 24 Jul 2023 19:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690251816; x=1690856616; 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=JH5fCvhDCpjG0CobTB17vbLDsHtpAVwYi60FmbCPgWo=; b=kqVbzU+U2i+YwX+pjrJ49x7+xz/BWnU8/zBH5IjFq2DeTZduOgrRP/e2ht7I2nQ/Pn g+rwCIyn85yrvGv04+xLNjnoBKDYYUm02ZqNvtkLgTzj5s+M+a6v7ueKzXivR9Lt4E0i kz9uhNuSUdUOnckQUSfF3GmuyKVZ4RlfnNUvaS/j/XRb6UOy/YSNndVtHde8UwhwIo5t GsoJGq7mxJdcOQl4cfbtt+77nKhuiA+osW+jB4IUDM1UYlpfM5WboYtbIvKwCA0WN5fM 6U/q3vIwxEOvGj0gImpiQcY6A4aE0Msi8OyQDrgvugp3ftpCkkr45JmUwOsW7Ws2LvAi Q/LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690251816; x=1690856616; 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=JH5fCvhDCpjG0CobTB17vbLDsHtpAVwYi60FmbCPgWo=; b=YXRB1BqO3JSEId3XOlV7LVt0SQZBn6A57+vKluFW53w3irAOgcFTTKnoHtIruNe9Cp b2EzIpMnJsjurx/0ViCY1y7NjwekFS3xKteGe+1pmXHf2S5rJ7eeIZJfZa3eT7MqZyNX ayy44zeyi/QXDyT7n2CZb2prUqczUGwA5Ys0qVzc+d3dPi4ixuWjD//YpDsoOV7IHzx0 X+pOYDQZUcgBp3DV90/ahLQQaakPsFe3wpvdtpAX1kb3vnasARxDrDXevUZM7VEeZW5f Sp1b4Ed4j7Oyb3pE8GJdYTgprtEHIxOhAwpA1m9TLuNdEtqBV0A1X6L2idNBBYRmAs0K s8/A== X-Gm-Message-State: ABy/qLYjdAxt6j3Zyf9MBRZjj06H5bJ6oG+NHE7uRbt4CAYcVYIoRfdc xIa6jZ+2gBbVRZ/8uOH4C4I= X-Google-Smtp-Source: APBJJlGjWqE8+6fLyEjAXBNASKw777DhHaaltg03pweQLXI443lhNcvVprLCOJsSDmAFS1koItJYcA== X-Received: by 2002:a05:6870:5493:b0:1ba:d044:8a4 with SMTP id f19-20020a056870549300b001bad04408a4mr12645615oan.18.1690251816117; Mon, 24 Jul 2023 19:23:36 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id u6-20020a62ed06000000b0067a50223e3bsm8393103pfh.111.2023.07.24.19.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 19:23:35 -0700 (PDT) Received: from linux-patcher.mp600.macronix.com (linux-patcher [172.17.236.35]) by twhmp6px (Postfix) with ESMTPS id 8084A80BB5; Tue, 25 Jul 2023 10:22:40 +0800 (CST) From: Jaime Liao To: linux-mtd@lists.infradead.org, tudor.ambarus@linaro.org, pratyush@kernel.org, michael@walle.cc, miquel.raynal@bootlin.com Cc: leoyu@mxic.com.tw, JaimeLiao Subject: [PATCH v1 2/2] mtd: spi-nor: add support for Macronix Octal flash Date: Tue, 25 Jul 2023 10:23:02 +0800 Message-Id: <20230725022302.210275-3-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230725022302.210275-1-jaimeliao.tw@gmail.com> References: <20230725022302.210275-1-jaimeliao.tw@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230724_192337_582842_7F58C40F X-CRM114-Status: GOOD ( 11.09 ) 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: JaimeLiao Adding Macronix Octal flash for Octal DTR support. The octaflash series can be divided into the following types: 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 [jaimeliao.tw[at]gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:32a listed in] [list.dnswl.org] -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 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: JaimeLiao Adding Macronix Octal flash for Octal DTR support. The octaflash series can be divided into the following types: MX25 series : Serial NOR Flash. MX66 series : Serial NOR Flash with stacked die.(Size larger than 1Gb) LM/UM series : Up to 250MHz clock frequency with both DTR/STR operation. LW/UW series : Support simultaneous Read-while-Write operation in multiple bank architecture. Read-while-write feature which means read data one bank while another bank is programing or erasing. MX25LM : 3.0V Octal I/O -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7841/MX25LM51245G,%203V,%20512Mb,%20v1.1.pdf MX25UM : 1.8V Octal I/O -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7525/MX25UM51245G%20Extreme%20Speed,%201.8V,%20512Mb,%20v1.0.pdf MX66LM : 3.0V Octal I/O with stacked die -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7929/MX66LM1G45G,%203V,%201Gb,%20v1.1.pdf MX66UM : 1.8V Octal I/O with stacked die -https://www.mxic.com.tw/Lists/Datasheet/Attachments/7721/MX66UM1G45G,%201.8V,%201Gb,%20v1.1.pdf MX25LW : 3.0V Octal I/O with Read-while-Write MX25UW : 1.8V Octal I/O with Read-while-Write MX66LW : 3.0V Octal I/O with Read-while-Write and stack die MX66UW : 1.8V Octal I/O with Read-while-Write and stack die MX25UM51245G : 512Mb flash, with Word mode data output format when Octal DTR read MX25UM51345G : 512Mb flash, with Byte mode data output format when Octal DTR read Macronix Octal flash with two types, "byte mode" and "word mode". Because of word mode flash with byte swap issue when Octal DTR read, adding byte mode flash in this patchset only. About LW/UW series, please contact us freely if you have any questions. For adding Octal NOR Flash IDs, we have validated each Flash on plateform zynq-picozed. As below are the SFDP table dump. zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2943c zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx66uw2g345gx0 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx66uw2g345gx0 zynq> hexdump mx66uw2g345gx0 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 7fff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 7987 0001 1284 e200 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 001f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2843c zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx66uw2g345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx66uw2g345g zynq> hexdump mx66uw2g345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 7fff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 7987 0001 1284 e200 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 001f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c2843a zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25uw51345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25uw51345g zynq> hexdump mx25uw51345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 1fff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 798b 0001 128f e200 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 000f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c28339 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25um25345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25um25345g zynq> hexdump mx25um25345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 0fff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 6987 0001 1282 d200 02cc 3867 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0904 0000 0000130 4514 8098 0643 000f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c28439 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25uw25345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25uw25345g zynq> hexdump mx25uw25345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 0fff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 7987 0001 1284 d200 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 000f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c28438 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25uw12345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25uw12345g zynq> hexdump mx25uw12345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 07ff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 798b 0001 128f c900 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 000f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c28437 zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer macronix zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname mx25uw6345g zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/sfdp > mx25uw6345g zynq> hexdump mx25uw6345g 0000000 4653 5044 0108 fd04 0700 1401 0040 ff00 0000010 0187 1c01 0090 ff00 000a 0801 0100 ff00 0000020 0005 0501 0120 ff00 0084 0201 0134 ff00 0000030 0000 0000 0000 0000 ffff ffff ffff ffff 0000040 20e5 ff8a ffff 03ff ff00 ff00 ff00 ff00 0000050 ffee ffff ffff ff00 ffff ff00 200c d810 0000060 ff00 ff00 798b 0001 128f c400 04cc 4667 0000070 b030 b030 bdf4 5cd5 0000 ff00 1010 2000 0000080 0000 0000 0000 237c 0048 0000 0000 8888 0000090 0000 0000 0000 4000 d10f f3ff d10f f3ff 00000a0 0500 9000 0500 b100 2b00 9500 2b00 9600 00000b0 7172 b803 7172 b803 0000 0000 a390 8218 00000c0 c000 9669 0000 0000 0000 0000 7172 9800 00000d0 7172 b800 7172 9900 0000 0000 7172 9800 00000e0 7172 f800 7172 9900 7172 f900 0000 0000 00000f0 0000 0000 1501 d001 7172 d806 0000 5086 0000100 0000 0106 0000 0000 0002 0301 0200 0000 0000110 0000 0106 0000 0000 0000 0672 0200 0000 0000120 ee00 69c0 7272 7171 d800 f6f7 0a00 0000 0000130 4514 8098 0643 000f dc21 ffff ffff ffff 0000140 ffff ffff ffff ffff ffff ffff ffff ffff Signed-off-by: JaimeLiao --- drivers/mtd/spi-nor/macronix.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 9010b81e098f..657f320e414a 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -179,6 +179,33 @@ static const struct flash_info macronix_nor_parts[] = { { "mx66u2g45g", INFO(0xc2253c, 0, 64 * 1024, 4096) NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx66uw2g345g", INFO(0xc2843c, 0, 64 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx66uw2g345gx0", INFO(0xc2943c, 0, 64 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx25uw51345g", INFO(0xc2843a, 0, 16 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx25um25345g", INFO(0xc28339, 0, 8 * 1024, 4096) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx25uw25345g", INFO(0xc28439, 0, 8 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx25uw12345g", INFO(0xc28438, 0, 4 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "mx25uw6345g", INFO(0xc28437, 0, 2 * 1024, 4096) + FLAGS(SPI_NOR_RWW) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) + FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, }; static void macronix_nor_default_init(struct spi_nor *nor)