xref: /openbmc/linux/drivers/mtd/devices/serial_flash_cmds.h (revision 92d3af9ac369faf3bd2c409cf5218510500af214)
15549fbd5SLee Jones /*
25549fbd5SLee Jones  * Generic/SFDP Flash Commands and Device Capabilities
35549fbd5SLee Jones  *
45549fbd5SLee Jones  * Copyright (C) 2013 Lee Jones <lee.jones@lianro.org>
55549fbd5SLee Jones  *
65549fbd5SLee Jones  * This code is free software; you can redistribute it and/or modify
75549fbd5SLee Jones  * it under the terms of the GNU General Public License version 2 as
85549fbd5SLee Jones  * published by the Free Software Foundation.
95549fbd5SLee Jones  *
105549fbd5SLee Jones  */
115549fbd5SLee Jones 
125549fbd5SLee Jones #ifndef _MTD_SERIAL_FLASH_CMDS_H
135549fbd5SLee Jones #define _MTD_SERIAL_FLASH_CMDS_H
145549fbd5SLee Jones 
155549fbd5SLee Jones /* Generic Flash Commands/OPCODEs */
16*92d3af9aSBrian Norris #define SPINOR_OP_WREN		0x06
17*92d3af9aSBrian Norris #define SPINOR_OP_WRDI		0x04
18*92d3af9aSBrian Norris #define SPINOR_OP_RDID		0x9f
19*92d3af9aSBrian Norris #define SPINOR_OP_RDSR		0x05
20*92d3af9aSBrian Norris #define SPINOR_OP_RDSR2		0x35
21*92d3af9aSBrian Norris #define SPINOR_OP_WRSR		0x01
22*92d3af9aSBrian Norris #define SPINOR_OP_SE_4K		0x20
23*92d3af9aSBrian Norris #define SPINOR_OP_SE_32K	0x52
24*92d3af9aSBrian Norris #define SPINOR_OP_SE		0xd8
25*92d3af9aSBrian Norris #define SPINOR_OP_CHIPERASE	0xc7
26*92d3af9aSBrian Norris #define SPINOR_OP_WRVCR		0x81
27*92d3af9aSBrian Norris #define SPINOR_OP_RDVCR		0x85
285549fbd5SLee Jones 
295549fbd5SLee Jones /* JEDEC Standard - Serial Flash Discoverable Parmeters (SFDP) Commands */
30*92d3af9aSBrian Norris #define SPINOR_OP_READ		0x03	/* READ */
31*92d3af9aSBrian Norris #define SPINOR_OP_READ_FAST	0x0b	/* FAST READ */
32*92d3af9aSBrian Norris #define SPINOR_OP_READ_1_1_2	0x3b	/* DUAL OUTPUT READ */
33*92d3af9aSBrian Norris #define SPINOR_OP_READ_1_2_2	0xbb	/* DUAL I/O READ */
34*92d3af9aSBrian Norris #define SPINOR_OP_READ_1_1_4	0x6b	/* QUAD OUTPUT READ */
35*92d3af9aSBrian Norris #define SPINOR_OP_READ_1_4_4	0xeb	/* QUAD I/O READ */
365549fbd5SLee Jones 
37*92d3af9aSBrian Norris #define SPINOR_OP_WRITE		0x02	/* PAGE PROGRAM */
38*92d3af9aSBrian Norris #define SPINOR_OP_WRITE_1_1_2	0xa2	/* DUAL INPUT PROGRAM */
39*92d3af9aSBrian Norris #define SPINOR_OP_WRITE_1_2_2	0xd2	/* DUAL INPUT EXT PROGRAM */
40*92d3af9aSBrian Norris #define SPINOR_OP_WRITE_1_1_4	0x32	/* QUAD INPUT PROGRAM */
41*92d3af9aSBrian Norris #define SPINOR_OP_WRITE_1_4_4	0x12	/* QUAD INPUT EXT PROGRAM */
425549fbd5SLee Jones 
43*92d3af9aSBrian Norris #define SPINOR_OP_EN4B_ADDR	0xb7	/* Enter 4-byte address mode */
44*92d3af9aSBrian Norris #define SPINOR_OP_EX4B_ADDR	0xe9	/* Exit 4-byte address mode */
455549fbd5SLee Jones 
465549fbd5SLee Jones /* READ commands with 32-bit addressing */
47*92d3af9aSBrian Norris #define SPINOR_OP_READ4		0x13
48*92d3af9aSBrian Norris #define SPINOR_OP_READ4_FAST	0x0c
49*92d3af9aSBrian Norris #define SPINOR_OP_READ4_1_1_2	0x3c
50*92d3af9aSBrian Norris #define SPINOR_OP_READ4_1_2_2	0xbc
51*92d3af9aSBrian Norris #define SPINOR_OP_READ4_1_1_4	0x6c
52*92d3af9aSBrian Norris #define SPINOR_OP_READ4_1_4_4	0xec
535549fbd5SLee Jones 
545549fbd5SLee Jones /* Configuration flags */
555549fbd5SLee Jones #define FLASH_FLAG_SINGLE	0x000000ff
565549fbd5SLee Jones #define FLASH_FLAG_READ_WRITE	0x00000001
575549fbd5SLee Jones #define FLASH_FLAG_READ_FAST	0x00000002
585549fbd5SLee Jones #define FLASH_FLAG_SE_4K	0x00000004
595549fbd5SLee Jones #define FLASH_FLAG_SE_32K	0x00000008
605549fbd5SLee Jones #define FLASH_FLAG_CE		0x00000010
615549fbd5SLee Jones #define FLASH_FLAG_32BIT_ADDR	0x00000020
625549fbd5SLee Jones #define FLASH_FLAG_RESET	0x00000040
635549fbd5SLee Jones #define FLASH_FLAG_DYB_LOCKING	0x00000080
645549fbd5SLee Jones 
655549fbd5SLee Jones #define FLASH_FLAG_DUAL		0x0000ff00
665549fbd5SLee Jones #define FLASH_FLAG_READ_1_1_2	0x00000100
675549fbd5SLee Jones #define FLASH_FLAG_READ_1_2_2	0x00000200
685549fbd5SLee Jones #define FLASH_FLAG_READ_2_2_2	0x00000400
695549fbd5SLee Jones #define FLASH_FLAG_WRITE_1_1_2	0x00001000
705549fbd5SLee Jones #define FLASH_FLAG_WRITE_1_2_2	0x00002000
715549fbd5SLee Jones #define FLASH_FLAG_WRITE_2_2_2	0x00004000
725549fbd5SLee Jones 
735549fbd5SLee Jones #define FLASH_FLAG_QUAD		0x00ff0000
745549fbd5SLee Jones #define FLASH_FLAG_READ_1_1_4	0x00010000
755549fbd5SLee Jones #define FLASH_FLAG_READ_1_4_4	0x00020000
765549fbd5SLee Jones #define FLASH_FLAG_READ_4_4_4	0x00040000
775549fbd5SLee Jones #define FLASH_FLAG_WRITE_1_1_4	0x00100000
785549fbd5SLee Jones #define FLASH_FLAG_WRITE_1_4_4	0x00200000
795549fbd5SLee Jones #define FLASH_FLAG_WRITE_4_4_4	0x00400000
805549fbd5SLee Jones 
815549fbd5SLee Jones #endif /* _MTD_SERIAL_FLASH_CMDS_H */
82