coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
eon.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <commonlib/helpers.h>
4 #include <spi_flash.h>
5 #include <spi-generic.h>
6 
7 #include "spi_flash_internal.h"
8 
9 /* EN25*-specific commands */
10 #define CMD_EN25_WREN 0x06 /* Write Enable */
11 #define CMD_EN25_WRDI 0x04 /* Write Disable */
12 #define CMD_EN25_RDSR 0x05 /* Read Status Register */
13 #define CMD_EN25_WRSR 0x01 /* Write Status Register */
14 #define CMD_EN25_READ 0x03 /* Read Data Bytes */
15 #define CMD_EN25_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
16 #define CMD_EN25_PP 0x02 /* Page Program */
17 #define CMD_EN25_SE 0x20 /* Sector Erase */
18 #define CMD_EN25_BE 0xd8 /* Block Erase */
19 #define CMD_EN25_DP 0xb9 /* Deep Power-down */
20 #define CMD_EN25_RES 0xab /* Release from DP, and Read Signature */
21 
22 #define EON_ID_EN25B80 0x2014
23 #define EON_ID_EN25B16 0x2015
24 #define EON_ID_EN25B32 0x2016
25 #define EON_ID_EN25B64 0x2017
26 #define EON_ID_EN25F80 0x3114
27 #define EON_ID_EN25F16 0x3115
28 #define EON_ID_EN25F32 0x3116
29 #define EON_ID_EN25F64 0x3117
30 #define EON_ID_EN25Q80 0x3014
31 #define EON_ID_EN25Q16 0x3015 /* Same as EN25D16 */
32 #define EON_ID_EN25Q32 0x3016 /* Same as EN25Q32A and EN25Q32B */
33 #define EON_ID_EN25Q64 0x3017
34 #define EON_ID_EN25Q128 0x3018
35 #define EON_ID_EN25QH16 0x7015
36 #define EON_ID_EN25QH32 0x7016
37 #define EON_ID_EN25QH64 0x7017
38 #define EON_ID_EN25QH128 0x7018
39 #define EON_ID_EN25S80 0x3814
40 #define EON_ID_EN25S16 0x3815
41 #define EON_ID_EN25S32 0x3816
42 #define EON_ID_EN25S64 0x3817
43 
44 static const struct spi_flash_part_id flash_table[] = {
45  {
46  /* EN25B80 */
47  .id[0] = EON_ID_EN25B80,
48  .nr_sectors_shift = 8,
49  },
50  {
51  /* EN25B16 */
52  .id[0] = EON_ID_EN25B16,
53  .nr_sectors_shift = 9,
54  },
55  {
56  /* EN25B32 */
57  .id[0] = EON_ID_EN25B32,
58  .nr_sectors_shift = 10,
59  },
60  {
61  /* EN25B64 */
62  .id[0] = EON_ID_EN25B64,
63  .nr_sectors_shift = 11,
64  },
65  {
66  /* EN25F80 */
67  .id[0] = EON_ID_EN25F80,
68  .nr_sectors_shift = 8,
69  },
70  {
71  /* EN25F16 */
72  .id[0] = EON_ID_EN25F16,
73  .nr_sectors_shift = 9,
74  },
75  {
76  /* EN25F32 */
77  .id[0] = EON_ID_EN25F32,
78  .nr_sectors_shift = 10,
79  },
80  {
81  /* EN25F64 */
82  .id[0] = EON_ID_EN25F64,
83  .nr_sectors_shift = 11,
84  },
85  {
86  /* EN25Q80(A) */
87  .id[0] = EON_ID_EN25Q80,
88  .nr_sectors_shift = 8,
89  },
90  {
91  /* EN25Q16(D16) */
92  .id[0] = EON_ID_EN25Q16,
93  .nr_sectors_shift = 9,
94  },
95  {
96  /* EN25Q32(A/B) */
97  .id[0] = EON_ID_EN25Q32,
98  .nr_sectors_shift = 10,
99  },
100  {
101  /* EN25Q64 */
102  .id[0] = EON_ID_EN25Q64,
103  .nr_sectors_shift = 11,
104  },
105  {
106  /* EN25Q128 */
107  .id[0] = EON_ID_EN25Q128,
108  .nr_sectors_shift = 12,
109  },
110  {
111  /* EN25QH16 */
112  .id[0] = EON_ID_EN25QH16,
113  .nr_sectors_shift = 9,
114  },
115  {
116  /* EN25QH32 */
117  .id[0] = EON_ID_EN25QH32,
118  .nr_sectors_shift = 10,
119  },
120  {
121  /* EN25QH64 */
122  .id[0] = EON_ID_EN25QH64,
123  .nr_sectors_shift = 11,
124  },
125  {
126  /* EN25QH128 */
127  .id[0] = EON_ID_EN25QH128,
128  .nr_sectors_shift = 12,
129  },
130  {
131  /* EN25S80 */
132  .id[0] = EON_ID_EN25S80,
133  .nr_sectors_shift = 8,
134  },
135  {
136  /* EN25S16 */
137  .id[0] = EON_ID_EN25S16,
138  .nr_sectors_shift = 9,
139  },
140  {
141  /* EN25S32 */
142  .id[0] = EON_ID_EN25S32,
143  .nr_sectors_shift = 10,
144  },
145  {
146  /* EN25S64 */
147  .id[0] = EON_ID_EN25S64,
148  .nr_sectors_shift = 11,
149  },
150 };
151 
153  .id = VENDOR_ID_EON,
154  .page_size_shift = 8,
155  .sector_size_kib_shift = 2,
156  .match_id_mask[0] = 0xffff,
157  .ids = flash_table,
158  .nr_part_ids = ARRAY_SIZE(flash_table),
160 };
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define EON_ID_EN25B32
Definition: eon.c:24
#define EON_ID_EN25Q128
Definition: eon.c:34
#define EON_ID_EN25Q64
Definition: eon.c:33
#define EON_ID_EN25QH128
Definition: eon.c:38
#define EON_ID_EN25S80
Definition: eon.c:39
#define EON_ID_EN25Q32
Definition: eon.c:32
#define EON_ID_EN25F32
Definition: eon.c:28
#define EON_ID_EN25F16
Definition: eon.c:27
static const struct spi_flash_part_id flash_table[]
Definition: eon.c:44
#define EON_ID_EN25B64
Definition: eon.c:25
#define EON_ID_EN25F80
Definition: eon.c:26
#define EON_ID_EN25QH16
Definition: eon.c:35
#define EON_ID_EN25Q16
Definition: eon.c:31
#define EON_ID_EN25S16
Definition: eon.c:40
#define EON_ID_EN25S64
Definition: eon.c:42
#define EON_ID_EN25QH64
Definition: eon.c:37
#define EON_ID_EN25QH32
Definition: eon.c:36
#define EON_ID_EN25B16
Definition: eon.c:23
#define EON_ID_EN25S32
Definition: eon.c:41
#define EON_ID_EN25Q80
Definition: eon.c:30
#define EON_ID_EN25B80
Definition: eon.c:22
const struct spi_flash_vendor_info spi_flash_eon_vi
Definition: eon.c:152
#define EON_ID_EN25F64
Definition: eon.c:29
#define VENDOR_ID_EON
Definition: spi-generic.h:21
const struct spi_flash_ops_descriptor spi_flash_pp_0x20_sector_desc
Definition: spi_flash.c:793