1 /* This file is part of the coreboot project. */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #include <console/console.h>
5 #include <commonlib/helpers.h>
7 #include <spi-generic.h>
10 #include "spi_flash_internal.h"
12 /* EN25*-specific commands */
13 #define CMD_EN25_WREN 0x06 /* Write Enable */
14 #define CMD_EN25_WRDI 0x04 /* Write Disable */
15 #define CMD_EN25_RDSR 0x05 /* Read Status Register */
16 #define CMD_EN25_WRSR 0x01 /* Write Status Register */
17 #define CMD_EN25_READ 0x03 /* Read Data Bytes */
18 #define CMD_EN25_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
19 #define CMD_EN25_PP 0x02 /* Page Program */
20 #define CMD_EN25_SE 0x20 /* Sector Erase */
21 #define CMD_EN25_BE 0xd8 /* Block Erase */
22 #define CMD_EN25_DP 0xb9 /* Deep Power-down */
23 #define CMD_EN25_RES 0xab /* Release from DP, and Read Signature */
25 #define EON_ID_EN25B80 0x2014
26 #define EON_ID_EN25B16 0x2015
27 #define EON_ID_EN25B32 0x2016
28 #define EON_ID_EN25B64 0x2017
29 #define EON_ID_EN25F80 0x3114
30 #define EON_ID_EN25F16 0x3115
31 #define EON_ID_EN25F32 0x3116
32 #define EON_ID_EN25F64 0x3117
33 #define EON_ID_EN25Q80 0x3014
34 #define EON_ID_EN25Q16 0x3015 /* Same as EN25D16 */
35 #define EON_ID_EN25Q32 0x3016 /* Same as EN25Q32A and EN25Q32B */
36 #define EON_ID_EN25Q64 0x3017
37 #define EON_ID_EN25Q128 0x3018
38 #define EON_ID_EN25QH16 0x7015
39 #define EON_ID_EN25QH32 0x7016
40 #define EON_ID_EN25QH64 0x7017
41 #define EON_ID_EN25QH128 0x7018
42 #define EON_ID_EN25S80 0x3814
43 #define EON_ID_EN25S16 0x3815
44 #define EON_ID_EN25S32 0x3816
45 #define EON_ID_EN25S64 0x3817
47 static const struct spi_flash_part_id flash_table
[] = {
50 .id
[0] = EON_ID_EN25B80
,
51 .nr_sectors_shift
= 8,
55 .id
[0] = EON_ID_EN25B16
,
56 .nr_sectors_shift
= 9,
60 .id
[0] = EON_ID_EN25B32
,
61 .nr_sectors_shift
= 10,
65 .id
[0] = EON_ID_EN25B64
,
66 .nr_sectors_shift
= 11,
70 .id
[0] = EON_ID_EN25F80
,
71 .nr_sectors_shift
= 8,
75 .id
[0] = EON_ID_EN25F16
,
76 .nr_sectors_shift
= 9,
80 .id
[0] = EON_ID_EN25F32
,
81 .nr_sectors_shift
= 10,
85 .id
[0] = EON_ID_EN25F64
,
86 .nr_sectors_shift
= 11,
90 .id
[0] = EON_ID_EN25Q80
,
91 .nr_sectors_shift
= 8,
95 .id
[0] = EON_ID_EN25Q16
,
96 .nr_sectors_shift
= 9,
100 .id
[0] = EON_ID_EN25Q32
,
101 .nr_sectors_shift
= 10,
105 .id
[0] = EON_ID_EN25Q64
,
106 .nr_sectors_shift
= 11,
110 .id
[0] = EON_ID_EN25Q128
,
111 .nr_sectors_shift
= 12,
115 .id
[0] = EON_ID_EN25QH16
,
116 .nr_sectors_shift
= 9,
120 .id
[0] = EON_ID_EN25QH32
,
121 .nr_sectors_shift
= 10,
125 .id
[0] = EON_ID_EN25QH64
,
126 .nr_sectors_shift
= 11,
130 .id
[0] = EON_ID_EN25QH128
,
131 .nr_sectors_shift
= 12,
135 .id
[0] = EON_ID_EN25S80
,
136 .nr_sectors_shift
= 8,
140 .id
[0] = EON_ID_EN25S16
,
141 .nr_sectors_shift
= 9,
145 .id
[0] = EON_ID_EN25S32
,
146 .nr_sectors_shift
= 10,
150 .id
[0] = EON_ID_EN25S64
,
151 .nr_sectors_shift
= 11,
155 const struct spi_flash_vendor_info spi_flash_eon_vi
= {
157 .page_size_shift
= 8,
158 .sector_size_kib_shift
= 2,
159 .match_id_mask
[0] = 0xffff,
161 .nr_part_ids
= ARRAY_SIZE(flash_table
),
162 .desc
= &spi_flash_pp_0x20_sector_desc
,