From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DEDF301486 for ; Fri, 5 Jun 2026 00:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621217; cv=none; b=Jv4+rSrOqGIahPyo1dehxihxJIHRAQTuXKQ4dnWyAnXfK7iDz0VXHBqloMROj5cz3HSoP0s9wgdd8jOURvi1aafAUOKLA3yeYdutPhUPpG/12yGPqji2TZ23IpRiPvOGY5C6PX6viXXf4ijG3xttZQNzdqjFExceTIARswaWVbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780621217; c=relaxed/simple; bh=+6iapMLF5LFq4Ew0zzmvV8Q/ztg8fcHwMPpnfeSSo/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CgVYDVhz3fkesGSC9M1gDLH//G9md25oVgiyi+eXNR31ywXvO4hcgt8z1jnE2l0h8ior2fBQxUocOnpen7KyAL+pCCuXJw++9Uv4WfZauTBPV55FP385EAmCX7u6wh206VtwBoDDOJ5fnBRywIBNGU01RcbJsXACU0i884g7xBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XlqXcJT/; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XlqXcJT/" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c85893bce34so541283a12.1 for ; Thu, 04 Jun 2026 17:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780621198; x=1781225998; darn=vger.kernel.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=dTPPV6JZiYYlwbArmH1Q/4ShfP+Wrc5dPQHhlSVN1ec=; b=XlqXcJT/OzSioVPFqeACrGsL/g+1w4t9NuuIMq6Puin52/FvbQRjh/UFdi5wn3tnAR Onnbc/3Q0KdMeO25WPdQ5yxydwz4ts9PhXyCKtdlIttJaXUXxhOqDgiAp6I2V3lkQi6d DyYDvPFU2em4lJf+8nxRLbVLqwImIz18ljJ5DJSGQlybsdDSKZ0ERBG8eGyA7G3O1aKJ EVDlOfvYVEOhfsvX8stuAOPU+rBKMnHagSUxogOqEiTKxyf9VU67xGtpypD4mzrAAd3/ DPIJYg8PU2sqUghkaYihujSJZ8eTbopG+9d+uuvicrTZVeciyIiW6pSYom7zR7g0YFvt FxiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780621198; x=1781225998; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dTPPV6JZiYYlwbArmH1Q/4ShfP+Wrc5dPQHhlSVN1ec=; b=UfvWJoCTcqz8Po0JWbjzd8/kud2ugqykB9pggHMrESfKiMuG7g4r05nuqyyNM7ck5u y9N7D3TMc5gNIrX1YQ+VjSpbQNAlUSOBgY+eEhVetoeaoq+PNPc8Q78Wm/J35V/q48zJ V23VbjboCSCZPXYZ5kiMWSpaMHx/yAWEWbPxWrxJX6RkgCeyYcir2bVda4eA4aL48Uxb D8BKjS491mbOTzdo1kgHr/8wRKJhii/TJlbkBMIF3ogtdqeZxqXXnEXr5HvlEfvZ4H/s lxW69jyzMHsnv2doONMnJovvucZZppgVpEw1nXtKcVqQxqe9z1H2wre9GOjCP2TUWU2E QE3Q== X-Forwarded-Encrypted: i=1; AFNElJ+VOMmrtaXVNDgqmbUC3pJOQVFusCtcmeGDbdBDSbU7/aXGYHSVUHKCBvzpXvhVxT6ZSsae5EAObqpXIyM=@vger.kernel.org X-Gm-Message-State: AOJu0YwHBJFaVS9bS5ET2v3EB8G614EK9yWVCPHxfMObpwwt185oLwyv lsDiu1JpMSLD9TVvRn79rSqWfYOmu5jIBGkov54FHKoQd/ScsfYGnqLu2sgBwA== X-Gm-Gg: Acq92OEuoliTr8xLV+r8sIs42JcRXKoHomwRl3l23gZcNSVqsGLLdZPnejKzSp1t2qj AU6IpBDNo8SGYnEtEz2iY6bN7ST1s4Z7d1n2dYryY5okgLJTH2FdkxjDFLy4o6SQR8AwrxU9Kqe ETdhRDbvlVz3KqZUS8dNaSi5XCS3Fw7obC627KYXfueQMevlrcwUMNv0tPN+0lWR85xoS2kTdyK APDVPmnABWqiU8uramJJDUCyqvuwSorv4qh0FKs0pzJ3BGs6DiacNEW64NXvr+f8ZR26I6P/UV2 H5bUlnU7a/MnVWsf+y/vZGgnFAgqS+AX2zpeU2eshUT96TSQ4719dHmwgr5NGKzS02Rj3fP8iKz mVbPmWJa2W7066vFdR0E3UMIGW9oirL2INAqAw8/cD+f8Odvj5o2XCKnyyQbl6L48FqM4mn3Xej RbqzP9AxOpb617yvzxyMHvznbGD5pT9FRvdkKPTFuL0EwUueH22aarp76c X-Received: by 2002:a05:6a20:be86:b0:3b3:fc6:6226 with SMTP id adf61e73a8af0-3b4ccf7f128mr1382064637.24.1780621198351; Thu, 04 Jun 2026 17:59:58 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85df0bdbe4sm6528618a12.32.2026.06.04.17.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 17:59:57 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (unknown [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id 7333E4163B71; Fri, 5 Jun 2026 08:59:55 +0800 (CST) From: Cheng Ming Lin To: Pratyush Yadav , Michael Walle , Takahiro Kuwano , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, alvinzhou@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v2 1/2] mtd: spi-nor: Add support for MX25L12833F and MX25L12845G Date: Fri, 5 Jun 2026 08:57:19 +0800 Message-Id: <20260605005720.1857413-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260605005720.1857413-1-linchengming884@gmail.com> References: <20260605005720.1857413-1-linchengming884@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Cheng Ming Lin Add support for Macronix MX25L12833F and MX25L12845G SPI NOR flashes. These parts share the same JEDEC ID (0xc2, 0x20, 0x18) as the legacy MX25L12805D. The newer flashes support SFDP and 1-4-4 Page Program in 3-byte address mode, but this 4PP capability is not defined in their SFDP tables. Conversely, the legacy MX25L12805D lacks SFDP support entirely and does not support 4PP. To safely enable 4PP for the newer flashes without breaking the legacy part, introduce a post_bfpt fixup. Since the legacy MX25L12805D does not support SFDP, it falls back to static parameters and will never execute the post_bfpt hook. The newer flashes will successfully parse the BFPT, trigger the hook, and safely append the SNOR_HWCAPS_PP_1_4_4 capability. Signed-off-by: Cheng Ming Lin --- drivers/mtd/spi-nor/macronix.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index e97f5cbd9..febcef6a1 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -83,6 +83,25 @@ mx25l3255e_late_init_fixups(struct spi_nor *nor) return 0; } +static int +mx25l12805d_4pp3b_post_bfpt_fixups(struct spi_nor *nor) +{ + struct spi_nor_flash_parameter *params = nor->params; + + /* + * JEDEC ID 0xc22018 is shared by MX25L12805D (no SFDP, no 4PP) and + * MX25L12833F/MX25L12845G (support SFDP and 4PP in 3-byte mode). + * The legacy 05D lacks SFDP and will not execute this hook. For + * the newer flashes, 3-byte 1-4-4 PP is not defined in SFDP, so + * we safely enable it here. + */ + params->hwcaps.mask |= SNOR_HWCAPS_PP_1_4_4; + spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP_1_4_4], + SPINOR_OP_PP_1_4_4, SNOR_PROTO_1_4_4); + + return 0; +} + static const struct spi_nor_fixups mx25l25635_fixups = { .post_bfpt = mx25l25635_post_bfpt_fixups, .post_sfdp = macronix_qpp4b_post_sfdp_fixups, @@ -96,6 +115,10 @@ static const struct spi_nor_fixups mx25l3255e_fixups = { .late_init = mx25l3255e_late_init_fixups, }; +static const struct spi_nor_fixups mx25l12805d_4pp3b_fixups = { + .post_bfpt = mx25l12805d_4pp3b_post_bfpt_fixups, +}; + static const struct flash_info macronix_nor_parts[] = { { .id = SNOR_ID(0xc2, 0x20, 0x10), @@ -130,9 +153,10 @@ static const struct flash_info macronix_nor_parts[] = { .size = SZ_8M, .no_sfdp_flags = SECT_4K, }, { - /* MX25L12805D */ + /* MX25L12805D, MX25L12833F, MX25L12845G */ .id = SNOR_ID(0xc2, 0x20, 0x18), .flags = SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, + .fixups = &mx25l12805d_4pp3b_fixups, }, { /* MX25L25635E, MX25L25645G */ .id = SNOR_ID(0xc2, 0x20, 0x19), -- 2.25.1