Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Teng Wu <gigadevice2025@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Michael Walle <mwalle@kernel.org>
Cc: Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	teng.wu@gigadevice.com
Subject: [PATCH] mtd: spi-nor: Add support for GD25/GD55 series flashes
Date: Tue, 5 May 2026 21:50:05 +0800	[thread overview]
Message-ID: <afn1jToCHwRmNXjK@Fantast-WT.localdomain> (raw)

From 2918d966442e91ff85d493363ff2e7fee92b05de Mon Sep 17 00:00:00 2001
From: Teng Wu <gigadevice2025@gmail.com>
Date: Wed, 22 Apr 2026 16:17:22 +0800
Subject: [PATCH] mtd: spi-nor: Add support for GD25/GD55 series flashes

Add support for following Gigadevice SPI NOR flashes:

- gd25(b/lb)512mf (64MB)
- gd55(b/lb)01gf  (128MB)
- gd55(b/lb)02gf  (256MB)

Link: https://github.com/WT-886/DATASHEET

Signed-off-by: Teng Wu <gigadevice2025@gmail.com>

---
Test logs:

	test1-> gd25b512mf

root@ast2700-default:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/partname
gd25b512mf
root@ast2700-default:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/jedec_id
c8401a
root@ast2700-default:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/manufacturer
gigadevice
root@ast2700-default:~# hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 7f  44 eb 08 6b 08 3b 42 bb  |. ......D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 04 00 08 50 00 01  |zuzu...\)....P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:~# sha256sum /sys/bus/spi/devices/spi0.1/spi-nor/sfdp
2fc728b7dbdb15daf3e685ca7f42c4894fbaa44cbbf7324910578b683744727a  /sys/bus/spi/devices/spi0.1/spi-nor/sfdp
root@ast2700-default:~#
root@ast2700-default:~# cat /sys/kernel/debug/spi-nor/spi0.1/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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34
root@ast2700-default:~#
root@ast2700-default:~# cat /sys/kernel/debug/spi-nor/spi0.1/params
name            gd25b512mf
id              c8 40 1a c8 40 1a
size            64.0 MiB
write size      1
page size       256
address nbytes  4
flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET

opcodes
 read           0x6c
  dummy cycles  8
 erase          0xdc
 program        0x34
 8D extension   none

protocols
 read           1S-1S-4S
 write          1S-1S-4S
 register       1S-1S-1S

erase commands
 21 (4.00 KiB) [1]
 5c (32.0 KiB) [2]
 dc (64.0 KiB) [3]
 c7 (64.0 MiB)

sector map
 region (in hex)   | erase mask | overlaid
 ------------------+------------+----------
 00000000-03ffffff |     [   3] | no

root@ast2700-default:~# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 5.688872 seconds, 360.0KB/s

root@ast2700-default:~# ./mtd_debug erase /dev/mtd6 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@ast2700-default:~# ./mtd_debug read /dev/mtd6 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:~# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:~# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:~# ./mtd_debug write /dev/mtd6 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:~# ./mtd_debug read /dev/mtd6 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:~# sha256sum spi*
3a4031c0260d6d4b5c3491a8c481318cb42f36f5a67ce260c6f7206067eaf8eb  spi_read
3a4031c0260d6d4b5c3491a8c481318cb42f36f5a67ce260c6f7206067eaf8eb  spi_test

root@ast2700-default:~# ./mtd_debug info /dev/mtd6
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 67108864 (64M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

	test2-> gd25lb512mf

root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/partname
gd25lb512mf
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/jedec_id
c8601a
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/manufacturer
gigadevice
root@ast2700-default:/tmp# hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 7f  44 eb 08 6b 08 3b 42 bb  |. ......D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 04 00 08 50 00 01  |zuzu...\)....P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:/tmp# sha256sum /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
8fa8a248e0aabc3648138c46c5445826c4a2e7ffdb8808d5e9a86332c2b9662e  /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
root@ast2700-default:/tmp#

root@ast2700-default:/tmp# cat /sys/kernel/debug/spi-nor/spi1.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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34

root@ast2700-default:/tmp# cat /sys/kernel/debug/spi-nor/spi1.0/params
name            gd25lb512mf
id              c8 60 1a c8 60 1a
size            64.0 MiB
write size      1
page size       256
address nbytes  4
flags           4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET

opcodes
 read           0x3c
  dummy cycles  8
 erase          0xdc
 program        0x12
 8D extension   repeat

protocols
 read           1S-1S-2S
 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 (64.0 MiB)

sector map
 region (in hex)   | erase mask | overlaid
 ------------------+------------+----------
 00000000-03ffffff |     [   3] | no

root@ast2700-default:/tmp# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.034673 seconds, 57.7MB/s

root@ast2700-default:/tmp# ./mtd_debug erase /dev/mtd8 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd8 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:/tmp# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:/tmp# ./mtd_debug write /dev/mtd8 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd8 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# sha256sum spi*
fd231c1af2c378eb4f114c4d0cb1988540eb05c6f8fd90c46633441248f037a3  spi_read
fd231c1af2c378eb4f114c4d0cb1988540eb05c6f8fd90c46633441248f037a3  spi_test

root@ast2700-default:/tmp# ./mtd_debug info /dev/mtd8
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 67108864 (64M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

	test3-> gd55b01gf

root@ast2700-default:/tmp# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.034361 seconds, 58.2MB/s
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
gd55b01gf
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c8401b
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
gigadevice
root@ast2700-default:/tmp# hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 3f  44 eb 08 6b 08 3b 42 bb  |. .....?D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 74 00 08 50 00 01  |zuzu...\).t..P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:/tmp# sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
154e574f72e35c9c959f12b2af9db45fdfc6a6c4fa8a18e708f338fab5fd2e43  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
root@ast2700-default:/tmp#
root@ast2700-default:/tmp# 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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34
root@ast2700-default:/tmp# cat /sys/kernel/debug/spi-nor/spi0.0/params
name            gd55b01gf
id              c8 40 1b c8 40 1b
size            128 MiB
write size      1
page size       256
address nbytes  4
flags           4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | SOFT_RESET

opcodes
 read           0x6c
  dummy cycles  8
 erase          0xdc
 program        0x34
 8D extension   none

protocols
 read           1S-1S-4S
 write          1S-1S-4S
 register       1S-1S-1S

erase commands
 21 (4.00 KiB) [1]
 5c (32.0 KiB) [2]
 dc (64.0 KiB) [3]
 c7 (128 MiB)

sector map
 region (in hex)   | erase mask | overlaid
 ------------------+------------+----------
 00000000-07ffffff |     [   3] | no
root@ast2700-default:/tmp# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.035863 seconds, 55.8MB/s

root@ast2700-default:/tmp# ./mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:/tmp# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:/tmp# ./mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# sha256sum spi*
0c10262e00676c994a3e341447a44e12411a3a9e92700b4aa22f0d1e11817486  spi_read
0c10262e00676c994a3e341447a44e12411a3a9e92700b4aa22f0d1e11817486  spi_test

root@ast2700-default:/tmp# ./mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 134217728 (128M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

	test4-> gd55lb01gf

root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/partname
gd55lb01gf
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/jedec_id
c8601b
root@ast2700-default:/tmp# cat /sys/bus/spi/devices/spi1.0/spi-nor/manufacturer
gigadevice
root@ast2700-default:/tmp# hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 7f  44 eb 08 6b 08 3b 42 bb  |. ......D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 04 00 08 50 00 01  |zuzu...\)....P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:/tmp# sha256sum /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
efb1f201a7c3e24390e177446b89c94106201c11cca24fe27472635053f695d9  /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
root@ast2700-default:/tmp#

root@ast2700-default:/tmp# cat /sys/kernel/debug/spi-nor/spi1.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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34
root@ast2700-default:/tmp# cat /sys/kernel/debug/spi-nor/spi1.0/params
name            gd55lb01gf
id              c8 60 1b c8 60 1b
size            128 MiB
write size      1
page size       256
address nbytes  4
flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET

opcodes
 read           0x3c
  dummy cycles  8
 erase          0xdc
 program        0x12
 8D extension   repeat

protocols
 read           1S-1S-2S
 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 (128 MiB)

sector map
 region (in hex)   | erase mask | overlaid
 ------------------+------------+----------
 00000000-07ffffff |     [   3] | no
root@ast2700-default:/tmp#

root@ast2700-default:/tmp# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 0.034935 seconds, 57.2MB/s

root@ast2700-default:/tmp# ./mtd_debug erase /dev/mtd8 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd8 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:/tmp# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:/tmp# ./mtd_debug write /dev/mtd8 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:/tmp# ./mtd_debug read /dev/mtd8 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/tmp# sha256sum spi*
9426559bd5db4978c41d08a81d950b0cdc258dc8890bc63b66e9343da2860650  spi_read
9426559bd5db4978c41d08a81d950b0cdc258dc8890bc63b66e9343da2860650  spi_test

root@ast2700-default:/tmp# ./mtd_debug info /dev/mtd8
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 67108864 (64M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

	 test5-> gd55b02gf

root@ast2700-default:/work# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
gd55b02gf
root@ast2700-default:/work# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c8401c
root@ast2700-default:/work# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
gigadevice
root@ast2700-default:/work# hexdump -Cv /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 7f  44 eb 08 6b 08 3b 42 bb  |. ......D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 04 00 08 50 00 01  |zuzu...\)....P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:/work# sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
450bcdb73ecde4913e7893a0390f052843080c2e5d252258f193dfad840be139  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
root@ast2700-default:/work#
root@ast2700-default:/work# 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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34
root@ast2700-default:/work# cat /sys/kernel/debug/spi-nor/spi0.0/params
name            gd55b02gf
id              c8 40 1c c8 40 1c
size            256 MiB
write size      1
page size       256
address nbytes  4
flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | SOFT_RESET

opcodes
 read           0x6c
  dummy cycles  8
 erase          0xdc
 program        0x34
 8D extension   none

protocols
 read           1S-1S-4S
 write          1S-1S-4S
 register       1S-1S-1S

erase commands
 21 (4.00 KiB) [1]
 5c (32.0 KiB) [2]
 dc (64.0 KiB) [3]
 c7 (256 MiB)

sector map
 region (in hex)   | erase mask | flags
 ------------------+------------+----------
 00000000-0fffffff |     [ 123] |
root@ast2700-default:/work#
root@ast2700-default:/work# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 5.420572 seconds, 377.8KB/s

root@ast2700-default:/work# ./mtd_debug erase /dev/mtd0 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash
root@ast2700-default:/work# ./mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/work# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:/work# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:/work# ./mtd_debug write /dev/mtd0 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:/work# ./mtd_debug read /dev/mtd0 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:/work# sha256sum spi*
9a4bd863407df7dceaa1ad45845fe6c19d862b72edea8ebeb69a7b0d1cf35a6a  spi_read
9a4bd863407df7dceaa1ad45845fe6c19d862b72edea8ebeb69a7b0d1cf35a6a  spi_test

root@ast2700-default:/work# ./mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 268435456 (256M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

	test6-> gd55lb02gf

root@ast2700-default:~# cat /sys/bus/spi/devices/spi1.0/spi-nor/partname
gd55lb02gf
root@ast2700-default:~# cat /sys/bus/spi/devices/spi1.0/spi-nor/jedec_id
c8601c
root@ast2700-default:~# cat /sys/bus/spi/devices/spi1.0/spi-nor/manufacturer
gigadevice
root@ast2700-default:~# hexdump -Cv  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
00000000  53 46 44 50 06 01 02 ff  00 06 01 10 30 00 00 ff  |SFDP........0...|
00000010  c8 00 01 03 90 00 00 ff  84 00 01 02 c0 00 00 ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  e5 20 f3 ff ff ff ff 7f  44 eb 08 6b 08 3b 42 bb  |. ......D..k.;B.|
00000040  fe ff ff ff ff ff 00 ff  ff ff 44 eb 0c 20 0f 52  |..........D.. .R|
00000050  10 d8 00 ff d6 39 a5 fe  82 d6 14 62 ec 62 16 33  |.....9.....b.b.3|
00000060  7a 75 7a 75 04 bd d5 5c  29 06 04 00 08 50 00 01  |zuzu...\)....P..|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  00 36 00 27 9d f9 77 64  8f cb ff ff ff ff ff ff  |.6.'..wd........|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff 0e ff ff 21 5c dc ff                           |....!\..|
000000c8
root@ast2700-default:~# sha256sum /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
8cad1f887c45925f160e70013e605c0467cef85ae2f923627b928b9f79c607b0  /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
root@ast2700-default:~#

root@ast2700-default:~# cat /sys/kernel/debug/spi-nor/spi1.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   2
  dummy cycles  2
 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  4

Supported page program modes by the flash
 1S-1S-1S
  opcode        0x12
 1S-1S-4S
  opcode        0x34
root@ast2700-default:~# cat /sys/kernel/debug/spi-nor/spi1.0/params
name            gd55lb02gf
id              c8 60 1c c8 60 1c
size            256 MiB
write size      1
page size       256
address nbytes  4
flags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | SOFT_RESET

opcodes
 read           0x3c
  dummy cycles  8
 erase          0xdc
 program        0x12
 8D extension   repeat

protocols
 read           1S-1S-2S
 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 (256 MiB)

sector map
 region (in hex)   | erase mask | overlaid
 ------------------+------------+----------
 00000000-0fffffff |     [   3] | no
root@ast2700-default:~#

root@ast2700-default:~# dd if=/dev/urandom of=./spi_test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.0MB) copied, 6.810931 seconds, 300.7KB/s

root@ast2700-default:~# ./mtd_debug erase /dev/mtd7 0 2097152
Erased 2097152 bytes from address 0x00000000 in flash

root@ast2700-default:~# ./mtd_debug read /dev/mtd7 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:~# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0200000

root@ast2700-default:~# sha256sum spi_read
4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5  spi_read

root@ast2700-default:~# ./mtd_debug write /dev/mtd7 0 2097152 spi_test
Copied 2097152 bytes from spi_test to address 0x00000000 in flash

root@ast2700-default:~# ./mtd_debug read /dev/mtd7 0 2097152 spi_read
Copied 2097152 bytes from address 0x00000000 in flash to spi_read

root@ast2700-default:~# sha256sum spi*
b27ca6e0442b035d15659d44bed55389ca3283995c71186c5da3fe8f72597d3d  spi_read
b27ca6e0442b035d15659d44bed55389ca3283995c71186c5da3fe8f72597d3d  spi_test

root@ast2700-default:~# ./mtd_debug info /dev/mtd7
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 268435456 (256M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
---
 drivers/mtd/spi-nor/gigadevice.c | 36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/mtd/spi-nor/gigadevice.c b/drivers/mtd/spi-nor/gigadevice.c
index 317065490e32..47c2306e3fb0 100644
--- a/drivers/mtd/spi-nor/gigadevice.c
+++ b/drivers/mtd/spi-nor/gigadevice.c
@@ -81,6 +81,42 @@ static const struct flash_info gigadevice_nor_parts[] = {
 		.size = SZ_16M,
 		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
 		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x40, 0x1a),
+		.name = "gd25b512mf",
+		.size = SZ_64M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x60, 0x1a),
+		.name = "gd25lb512mf",
+		.size = SZ_64M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x40, 0x1b),
+		.name = "gd55b01gf",
+		.size = SZ_128M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x60, 0x1b),
+		.name = "gd55lb01gf",
+		.size = SZ_128M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x40, 0x1c),
+		.name = "gd55b02gf",
+		.size = SZ_256M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0xc8, 0x60, 0x1c),
+		.name = "gd55lb02gf",
+		.size = SZ_256M,
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
 	},
 };
 
-- 
2.43.0



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

                 reply	other threads:[~2026-05-05 13:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afn1jToCHwRmNXjK@Fantast-WT.localdomain \
    --to=gigadevice2025@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=teng.wu@gigadevice.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox