Carl-Daniel Hailfinger | d6cbf76 | 2008-05-13 14:58:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2007, 2008 Carl-Daniel Hailfinger |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef __SPI_H__ |
| 21 | #define __SPI_H__ 1 |
| 22 | |
| 23 | /* |
| 24 | * Contains the generic SPI headers |
| 25 | */ |
| 26 | |
| 27 | /* Read Electronic ID */ |
| 28 | #define JEDEC_RDID 0x9f |
| 29 | #define JEDEC_RDID_OUTSIZE 0x01 |
| 30 | #define JEDEC_RDID_INSIZE 0x03 |
| 31 | |
Carl-Daniel Hailfinger | 14e50ac | 2008-11-28 01:25:00 +0000 | [diff] [blame] | 32 | /* Read Electronic Manufacturer Signature */ |
| 33 | #define JEDEC_REMS 0x90 |
| 34 | #define JEDEC_REMS_OUTSIZE 0x04 |
| 35 | #define JEDEC_REMS_INSIZE 0x02 |
| 36 | |
Carl-Daniel Hailfinger | 42c5497 | 2008-05-15 03:19:49 +0000 | [diff] [blame] | 37 | /* Read Electronic Signature */ |
| 38 | #define JEDEC_RES 0xab |
| 39 | #define JEDEC_RES_OUTSIZE 0x04 |
| 40 | #define JEDEC_RES_INSIZE 0x01 |
| 41 | |
Carl-Daniel Hailfinger | d6cbf76 | 2008-05-13 14:58:23 +0000 | [diff] [blame] | 42 | /* Write Enable */ |
| 43 | #define JEDEC_WREN 0x06 |
| 44 | #define JEDEC_WREN_OUTSIZE 0x01 |
| 45 | #define JEDEC_WREN_INSIZE 0x00 |
| 46 | |
| 47 | /* Write Disable */ |
| 48 | #define JEDEC_WRDI 0x04 |
| 49 | #define JEDEC_WRDI_OUTSIZE 0x01 |
| 50 | #define JEDEC_WRDI_INSIZE 0x00 |
| 51 | |
| 52 | /* Chip Erase 0x60 is supported by Macronix/SST chips. */ |
| 53 | #define JEDEC_CE_60 0x60 |
| 54 | #define JEDEC_CE_60_OUTSIZE 0x01 |
| 55 | #define JEDEC_CE_60_INSIZE 0x00 |
| 56 | |
Peter Stuge | f83221b | 2008-07-07 06:38:51 +0000 | [diff] [blame] | 57 | /* Chip Erase 0xc7 is supported by SST/ST/EON/Macronix chips. */ |
Carl-Daniel Hailfinger | d6cbf76 | 2008-05-13 14:58:23 +0000 | [diff] [blame] | 58 | #define JEDEC_CE_C7 0xc7 |
| 59 | #define JEDEC_CE_C7_OUTSIZE 0x01 |
| 60 | #define JEDEC_CE_C7_INSIZE 0x00 |
| 61 | |
Carl-Daniel Hailfinger | d54ef6e | 2008-11-15 13:55:43 +0000 | [diff] [blame] | 62 | /* Block Erase 0x52 is supported by SST and old Atmel chips. */ |
Carl-Daniel Hailfinger | d6cbf76 | 2008-05-13 14:58:23 +0000 | [diff] [blame] | 63 | #define JEDEC_BE_52 0x52 |
| 64 | #define JEDEC_BE_52_OUTSIZE 0x04 |
| 65 | #define JEDEC_BE_52_INSIZE 0x00 |
| 66 | |
| 67 | /* Block Erase 0xd8 is supported by EON/Macronix chips. */ |
| 68 | #define JEDEC_BE_D8 0xd8 |
| 69 | #define JEDEC_BE_D8_OUTSIZE 0x04 |
| 70 | #define JEDEC_BE_D8_INSIZE 0x00 |
| 71 | |
| 72 | /* Sector Erase 0x20 is supported by Macronix/SST chips. */ |
| 73 | #define JEDEC_SE 0x20 |
| 74 | #define JEDEC_SE_OUTSIZE 0x04 |
| 75 | #define JEDEC_SE_INSIZE 0x00 |
| 76 | |
| 77 | /* Read Status Register */ |
| 78 | #define JEDEC_RDSR 0x05 |
| 79 | #define JEDEC_RDSR_OUTSIZE 0x01 |
| 80 | #define JEDEC_RDSR_INSIZE 0x01 |
| 81 | #define JEDEC_RDSR_BIT_WIP (0x01 << 0) |
| 82 | |
| 83 | /* Write Status Register */ |
| 84 | #define JEDEC_WRSR 0x01 |
| 85 | #define JEDEC_WRSR_OUTSIZE 0x02 |
| 86 | #define JEDEC_WRSR_INSIZE 0x00 |
| 87 | |
| 88 | /* Read the memory */ |
| 89 | #define JEDEC_READ 0x03 |
| 90 | #define JEDEC_READ_OUTSIZE 0x04 |
| 91 | /* JEDEC_READ_INSIZE : any length */ |
| 92 | |
| 93 | /* Write memory byte */ |
| 94 | #define JEDEC_BYTE_PROGRAM 0x02 |
| 95 | #define JEDEC_BYTE_PROGRAM_OUTSIZE 0x05 |
| 96 | #define JEDEC_BYTE_PROGRAM_INSIZE 0x00 |
| 97 | |
| 98 | #endif /* !__SPI_H__ */ |