1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <commonlib/helpers.h>
5 #include <spi-generic.h>
7 #include "spi_flash_internal.h"
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 */
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
44 static const struct spi_flash_part_id flash_table
[] = {
47 .id
[0] = EON_ID_EN25B80
,
48 .nr_sectors_shift
= 8,
52 .id
[0] = EON_ID_EN25B16
,
53 .nr_sectors_shift
= 9,
57 .id
[0] = EON_ID_EN25B32
,
58 .nr_sectors_shift
= 10,
62 .id
[0] = EON_ID_EN25B64
,
63 .nr_sectors_shift
= 11,
67 .id
[0] = EON_ID_EN25F80
,
68 .nr_sectors_shift
= 8,
72 .id
[0] = EON_ID_EN25F16
,
73 .nr_sectors_shift
= 9,
77 .id
[0] = EON_ID_EN25F32
,
78 .nr_sectors_shift
= 10,
82 .id
[0] = EON_ID_EN25F64
,
83 .nr_sectors_shift
= 11,
87 .id
[0] = EON_ID_EN25Q80
,
88 .nr_sectors_shift
= 8,
92 .id
[0] = EON_ID_EN25Q16
,
93 .nr_sectors_shift
= 9,
97 .id
[0] = EON_ID_EN25Q32
,
98 .nr_sectors_shift
= 10,
102 .id
[0] = EON_ID_EN25Q64
,
103 .nr_sectors_shift
= 11,
107 .id
[0] = EON_ID_EN25Q128
,
108 .nr_sectors_shift
= 12,
112 .id
[0] = EON_ID_EN25QH16
,
113 .nr_sectors_shift
= 9,
117 .id
[0] = EON_ID_EN25QH32
,
118 .nr_sectors_shift
= 10,
122 .id
[0] = EON_ID_EN25QH64
,
123 .nr_sectors_shift
= 11,
127 .id
[0] = EON_ID_EN25QH128
,
128 .nr_sectors_shift
= 12,
132 .id
[0] = EON_ID_EN25S80
,
133 .nr_sectors_shift
= 8,
137 .id
[0] = EON_ID_EN25S16
,
138 .nr_sectors_shift
= 9,
142 .id
[0] = EON_ID_EN25S32
,
143 .nr_sectors_shift
= 10,
147 .id
[0] = EON_ID_EN25S64
,
148 .nr_sectors_shift
= 11,
152 const struct spi_flash_vendor_info spi_flash_eon_vi
= {
154 .page_size_shift
= 8,
155 .sector_size_kib_shift
= 2,
156 .match_id_mask
[0] = 0xffff,
158 .nr_part_ids
= ARRAY_SIZE(flash_table
),
159 .desc
= &spi_flash_pp_0x20_sector_desc
,