lib/smbios: Improve Type9
[coreboot2.git] / src / drivers / spi / adesto.c
blob093199d2e2ad8508742aaf58f8304a9bbf864079
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 /*
4 * Driver for Adesto Technologies SPI flash
5 * based on winbond.c
6 */
8 #include <commonlib/helpers.h>
9 #include <spi_flash.h>
10 #include <spi-generic.h>
12 #include "spi_flash_internal.h"
14 /* at25dfxx-specific commands */
15 #define CMD_AT25DF_WREN 0x06 /* Write Enable */
16 #define CMD_AT25DF_WRDI 0x04 /* Write Disable */
17 #define CMD_AT25DF_RDSR 0x05 /* Read Status Register */
18 #define CMD_AT25DF_WRSR 0x01 /* Write Status Register */
19 #define CMD_AT25DF_READ 0x03 /* Read Data Bytes */
20 #define CMD_AT25DF_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
21 #define CMD_AT25DF_PP 0x02 /* Page Program */
22 #define CMD_AT25DF_SE 0x20 /* Sector (4K) Erase */
23 #define CMD_AT25DF_BE 0xd8 /* Block (64K) Erase */
24 #define CMD_AT25DF_CE 0xc7 /* Chip Erase */
25 #define CMD_AT25DF_DP 0xb9 /* Deep Power-down */
26 #define CMD_AT25DF_RES 0xab /* Release from DP, and Read Signature */
28 static const struct spi_flash_part_id flash_table[] = {
30 /* AT25SL128A */
31 .id[0] = 0x4218,
32 .nr_sectors_shift = 12,
35 /* AT25DF081A Yes, 81A id < 81 */
36 .id[0] = 0x4501,
37 .nr_sectors_shift = 8,
40 /* AT25DF081 */
41 .id[0] = 0x4502,
42 .nr_sectors_shift = 8,
45 /* AT25DF161 */
46 .id[0] = 0x4602,
47 .nr_sectors_shift = 9,
50 /* AT25DL161 */
51 .id[0] = 0x4603,
52 .nr_sectors_shift = 9,
55 /* AT25DF321 */
56 .id[0] = 0x4700,
57 .nr_sectors_shift = 10,
60 /* AT25DF321A */
61 .id[0] = 0x4701,
62 .nr_sectors_shift = 10,
65 /* AT25DF641 */
66 .id[0] = 0x4800,
67 .nr_sectors_shift = 11,
70 /* AT25SF081 */
71 .id[0] = 0x8501,
72 .nr_sectors_shift = 8,
75 /* AT25DQ161 */
76 .id[0] = 0x8600,
77 .nr_sectors_shift = 9,
80 /* AT25SF161 */
81 .id[0] = 0x8601,
82 .nr_sectors_shift = 9,
85 /* AT25DQ321 */
86 .id[0] = 0x8700,
87 .nr_sectors_shift = 10,
91 const struct spi_flash_vendor_info spi_flash_adesto_vi = {
92 .id = VENDOR_ID_ADESTO,
93 .page_size_shift = 8,
94 .sector_size_kib_shift = 2,
95 .match_id_mask[0] = 0xffff,
96 .ids = flash_table,
97 .nr_part_ids = ARRAY_SIZE(flash_table),
98 .desc = &spi_flash_pp_0x20_sector_desc,