mb/google/brya: Create rull variant
[coreboot2.git] / src / drivers / spi / eon.c
blob015b500ca31dfc7c62f529adf80e1e98d3b2b21a
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <commonlib/helpers.h>
4 #include <spi_flash.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[] = {
46 /* EN25B80 */
47 .id[0] = EON_ID_EN25B80,
48 .nr_sectors_shift = 8,
51 /* EN25B16 */
52 .id[0] = EON_ID_EN25B16,
53 .nr_sectors_shift = 9,
56 /* EN25B32 */
57 .id[0] = EON_ID_EN25B32,
58 .nr_sectors_shift = 10,
61 /* EN25B64 */
62 .id[0] = EON_ID_EN25B64,
63 .nr_sectors_shift = 11,
66 /* EN25F80 */
67 .id[0] = EON_ID_EN25F80,
68 .nr_sectors_shift = 8,
71 /* EN25F16 */
72 .id[0] = EON_ID_EN25F16,
73 .nr_sectors_shift = 9,
76 /* EN25F32 */
77 .id[0] = EON_ID_EN25F32,
78 .nr_sectors_shift = 10,
81 /* EN25F64 */
82 .id[0] = EON_ID_EN25F64,
83 .nr_sectors_shift = 11,
86 /* EN25Q80(A) */
87 .id[0] = EON_ID_EN25Q80,
88 .nr_sectors_shift = 8,
91 /* EN25Q16(D16) */
92 .id[0] = EON_ID_EN25Q16,
93 .nr_sectors_shift = 9,
96 /* EN25Q32(A/B) */
97 .id[0] = EON_ID_EN25Q32,
98 .nr_sectors_shift = 10,
101 /* EN25Q64 */
102 .id[0] = EON_ID_EN25Q64,
103 .nr_sectors_shift = 11,
106 /* EN25Q128 */
107 .id[0] = EON_ID_EN25Q128,
108 .nr_sectors_shift = 12,
111 /* EN25QH16 */
112 .id[0] = EON_ID_EN25QH16,
113 .nr_sectors_shift = 9,
116 /* EN25QH32 */
117 .id[0] = EON_ID_EN25QH32,
118 .nr_sectors_shift = 10,
121 /* EN25QH64 */
122 .id[0] = EON_ID_EN25QH64,
123 .nr_sectors_shift = 11,
126 /* EN25QH128 */
127 .id[0] = EON_ID_EN25QH128,
128 .nr_sectors_shift = 12,
131 /* EN25S80 */
132 .id[0] = EON_ID_EN25S80,
133 .nr_sectors_shift = 8,
136 /* EN25S16 */
137 .id[0] = EON_ID_EN25S16,
138 .nr_sectors_shift = 9,
141 /* EN25S32 */
142 .id[0] = EON_ID_EN25S32,
143 .nr_sectors_shift = 10,
146 /* EN25S64 */
147 .id[0] = EON_ID_EN25S64,
148 .nr_sectors_shift = 11,
152 const struct spi_flash_vendor_info spi_flash_eon_vi = {
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),
159 .desc = &spi_flash_pp_0x20_sector_desc,