From nobody Mon Jun 8 19:55:33 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 1953333C18E for ; Wed, 27 May 2026 03:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779852551; cv=none; b=MmfKiiFwXRjN8QQPyXsdUrLF8TI/5LCE+SnXpxAFoJWrX7GoYNZraeWP8qagzgvFFkdAXr98Qhn7pNZqP+OOrDjFBh+maoe7RT+301TzSr2lhcGKd2uZZFDf+NHDLsnhrbvobkJmvHiH5+wtJW1oV/Ur5Uqyme6AHfFK5Y+sStU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779852551; c=relaxed/simple; bh=4IEdf3rNGYI4zKhxYjDoocY5ZTYi3QkgPOpewuKtO5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPeSlw65CJHkb+DzEf7hkY9PSsnYIbdEulw3QiNht8c8AIgS5iUSHwuIXBpBIlvnpetgskb40d8wXJ/sP/pDLrUcVf8PJFpC4UQAMQ86Epdl9OC/mC96MCIz+kuYAqYrMalQMvrPe/A5uGRjq3YAfUr6xL0vy1l17736r/WZr8k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=huaqin.corp-partner.google.com; spf=pass smtp.mailfrom=huaqin.corp-partner.google.com; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20251104.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20251104.gappssmtp.com header.b=G5iK9oIg; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=huaqin.corp-partner.google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaqin.corp-partner.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=huaqin-corp-partner-google-com.20251104.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20251104.gappssmtp.com header.b="G5iK9oIg" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-369576666d5so5427248a91.0 for ; Tue, 26 May 2026 20:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20251104.gappssmtp.com; s=20251104; t=1779852549; x=1780457349; 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=EadHXbD47BB2Otw742UEoexqEqx0bBPGGslMs8yT7qA=; b=G5iK9oIgUCVXnVxBxLA4m9ZQrP+InXc5usPiDmM13zjlkCiPYLoaKYdctFBvr+Kb7Y o4KmB6TKb4nesokhk+gNTGnrJbJpNpriDh11F/kavLKEDCsvfwYizNgnVlAId66mGfAK BFHwHxy9KlvdVNwtlgEOW37dpOalMEaJfCCFk9GieFqtV9zZQZH1+N6RUK2tCyZGyomv IqOWxs+0zeFQ2tRsNbv/2Lpi15i/Ve3hCtUWgQUmOvSi9rmYRDJPTYRqEhRa3Nehmoxh 8D6RguOv/HxtG3oGnHTozbpb0sWZXsVDpqednG5uqrqkcXiJO1n4pku+H3A6VQ/rL6WC W2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779852549; x=1780457349; 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=EadHXbD47BB2Otw742UEoexqEqx0bBPGGslMs8yT7qA=; b=lLn/WevYyEvlL0gevJQU1/9/5/2xBCbjkZ+6w8FCvg13kjhkuSTFC5GhqIXLQszdip l27Dvt20rmF7gM5lifD0tXKW4sgo9CzThRrsjk5TPL9wpbFRjO67ViDXDTM1nvXyWrc2 cNf5/6OuGWalZ0xnhknkGFn0VRMO5cvo872x9Qy+izQOnRX7qjg378e4SO0BO8suYAYh 3C1R4uj0EEhTT9ViPJe10jzunE6ZM+RMX0Buk0+7N0asKU6jkkgaVhu/oaOx+YrUapmY xAwD6rtn0onuGV8a/yFsw1w8DrGNMVOvgRHxiHSglTgLy/D/uY0uTvMHhAbeDuF8gBX+ kmMA== X-Gm-Message-State: AOJu0YxnXqasy88Sufm8XRRD2XGG4jVMtTKxjA+3zJh6Ggk9PBdZh/3B eRSgzLn4srh6jEwnynCy8GVo9kG9wKDjnhGcjXFop3wXwa1Kak7daLkbDRJ6drcXMgQ= X-Gm-Gg: Acq92OHtb1q8l630FCkbDsCH8OWPIWhyyexsHDgWo1HXVpmkaMMiAVV6UeGNiJTDm7s OijYmLoCWz3BRUNzKjmzn8rfap1IcpEKV+IOnfkDjuw+ZKehhHAYDKc3icVUzvBHsRoqciyaZ/T LYnUfPx5J/fdIDj5vQq5qrxzgBfvLwdNiPo5gfhaDasHKxW8ByVc8VkxP1muq2lFcEFJnLt9esN KRdM8z2YvzKJ8/uC9fPGBzKycJCg5aXIX0tKfAfELNsEfIDjqRx6p86wquo+c3sB3+SMMjSvsUi +0b5Nk8Y6I8wO+/669ssaH5rFVrnaYnkUC7IdOSuIRzFmvEq3XiwKSd9VOvNmxKOTL/zuu/z3v3 hJUbzQ2TBbIOeHUDFmLMZ+39s1ncczwh0IJEk9Sh6ra0yK6GKRZfKTRlVGU/W4WPF5hzba0pqh6 6cqYpLPx3XefUvY7tkrXrggTFFKqPGeM5n7kgDJzNbxBNOE1+7l+fqF4SJQ6Vuq2mTl6fwqdF0 X-Received: by 2002:a17:90b:5845:b0:366:4a47:f267 with SMTP id 98e67ed59e1d1-36a6765a7b1mr20000860a91.16.1779852549387; Tue, 26 May 2026 20:29:09 -0700 (PDT) Received: from ubuntu2404.huaqin.com ([101.78.151.206]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36a72c4cf56sm13230448a91.12.2026.05.26.20.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 20:29:09 -0700 (PDT) From: Weimin Wu To: wuweimin@huaqin.corp-partner.google.com Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, mwalle@kernel.org, pratyush@kernel.org, takahiro.kuwano@infineon.com, tudor.ambarus@linaro.org Subject: [PATCH] [v4] mtd: spi-nor: gigadevice: Add support for GD25LQ256H Date: Wed, 27 May 2026 11:28:23 +0800 Message-ID: <20260527032823.771616-1-wuweimin@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418084253.792395-1-wuweimin@huaqin.corp-partner.google.com> References: <20260418084253.792395-1-wuweimin@huaqin.corp-partner.google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the GigaDevice GD25LQ256H (JEDEC ID c8 60 19), a 256Mbit (32MB) SPI NOR flash chip which supports SFDP. Without this patch, The WP status cannot be obtained using flashrom: device:/ # flashrom --wp-status ... linux_mtd_wp_read_cfg: ioctl: Operation not supported on transport endpoint Failed to get WP status: failed to read the current WP configuration and with this patch: device:/ # flashrom --wp-status ... Protection range: start=3D0x00000000 length=3D0x00000000 (none) Protection mode: disabled SUCCESS Link: https://download.gigadevice.com/Datasheet/DS-01085-GD25LQ256H-Rev1.3.= pdf Signed-off-by: Weimin Wu --- Changes in v4: - Change title from GD25LQ255E to GD25LQ256H, and change datasheet link. - Delete /* gd25lb256 */ comment. - Link to v3: https://patchwork.ozlabs.org/project/linux-mtd/patch/20260418= 084253.792395-1-wuweimin@huaqin.corp-partner.google.com/ - Link to v2: https://patchwork.ozlabs.org/project/linux-mtd/patch/20260313= 133806.2390946-1-wuweimin@huaqin.corp-partner.google.com/ - Link to v1: https://patchwork.ozlabs.org/project/linux-mtd/patch/20260213= 144133.1778932-1-wuweimin@huaqin.corp-partner.google.com/ Refer to the following documents: https://docs.kernel.org/driver-api/mtd/spi-nor.html#minimum-testing-require= ments 1. Specify the controller that you used to test the flash and specify the f= requency at which the flash was operated: This flash memory has been successfully tested at 100Mhz frequency on a Chr= omebook device running the Intel Patherlake platform, which is currently un= der development. 2. Dump the sysfs entries and print the md5/sha1/sha256 SFDP checksum: root:/ # cat /sys/bus/spi/devices/spi0.0/spi-nor/partname cat: /sys/bus/spi/devices/spi0.0/spi-nor/partname: No such file or directory root:/ # cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id c86019 root:/ # cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer gigadevice root:/ # xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450070102ff00070114300000ffc8000103900000ff84010102c000 00ffffffffffffffffffffffffffffffffffe520fbffffffff0f44eb086b 083b80bbfeffffffffff00ffffff42eb0c200f5210d800ffd4299dfe84d2 14c7ec6316337a757a7507b3d55c190614ff885018010000000000008800 00000000f6f5ffffffffffffffffffffffffffffffffffff002050169ff9 7764fc8bffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffff8e00fe215cdcff root:/ # sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 09f61fe623df200d86b4ab47c48e3a13718fadbb450fcd430b3cdc49a902b1f6 /sys/bus/= spi/devices/spi0.0/spi-nor/sfdp 3. Dump debugfs data: root:/ # cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-1S-1S (fast read) opcode 0x0c mode cycles 0 dummy cycles 8 1S-1S-2S opcode 0x3c mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbc mode cycles 4 dummy cycles 0 1S-1S-4S opcode 0x6c mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 2 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-1S-4S opcode 0x34 root:/ # cat /sys/kernel/debug/spi-nor/spi0.0/params name (null) id c8 60 19 c8 60 19 size 32.0 MiB write size 1 page size 256 address nbytes 4 flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | NO_RE= AD_CR | HAS_SR_TB_BIT6 | HAS_4BIT_BP | SOFT_RESET opcodes read 0x0c dummy cycles 8 erase 0xdc program 0x12 8D extension repeat protocols read 1S-1S-1S write 1S-1S-1S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] 5c (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (32.0 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+---------- 00000000-01ffffff | [ 3] | no 4. Use mtd-utils and verify that erase, read and page program operations wo= rk fine: Because Chromebooks lack the necessary mtd-utils directives, the correspond= ing data cannot be provided. --- --- drivers/mtd/spi-nor/gigadevice.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/spi-nor/gigadevice.c b/drivers/mtd/spi-nor/gigadev= ice.c index ef1edd0add70..63087d3de255 100644 --- a/drivers/mtd/spi-nor/gigadevice.c +++ b/drivers/mtd/spi-nor/gigadevice.c @@ -82,6 +82,9 @@ static const struct flash_info gigadevice_nor_parts[] =3D= { .size =3D SZ_16M, .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id =3D SNOR_ID(0xc8, 0x60, 0x19), + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP | SPI_NOR_HAS_TB | SPI_NOR= _TB_SR_BIT6, }, }; =20 --=20 2.43.0