coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
adesto.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /*
4  * Driver for Adesto Technologies SPI flash
5  * based on winbond.c
6  */
7 
8 #include <commonlib/helpers.h>
9 #include <spi_flash.h>
10 #include <spi-generic.h>
11 
12 #include "spi_flash_internal.h"
13 
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 */
27 
28 static const struct spi_flash_part_id flash_table[] = {
29  {
30  /* AT25SL128A */
31  .id[0] = 0x4218,
32  .nr_sectors_shift = 12,
33  },
34  {
35  /* AT25DF081A Yes, 81A id < 81 */
36  .id[0] = 0x4501,
37  .nr_sectors_shift = 8,
38  },
39  {
40  /* AT25DF081 */
41  .id[0] = 0x4502,
42  .nr_sectors_shift = 8,
43  },
44  {
45  /* AT25DF161 */
46  .id[0] = 0x4602,
47  .nr_sectors_shift = 9,
48  },
49  {
50  /* AT25DL161 */
51  .id[0] = 0x4603,
52  .nr_sectors_shift = 9,
53  },
54  {
55  /* AT25DF321 */
56  .id[0] = 0x4700,
57  .nr_sectors_shift = 10,
58  },
59  {
60  /* AT25DF321A */
61  .id[0] = 0x4701,
62  .nr_sectors_shift = 10,
63  },
64  {
65  /* AT25DF641 */
66  .id[0] = 0x4800,
67  .nr_sectors_shift = 11,
68  },
69  {
70  /* AT25SF081 */
71  .id[0] = 0x8501,
72  .nr_sectors_shift = 8,
73  },
74  {
75  /* AT25DQ161 */
76  .id[0] = 0x8600,
77  .nr_sectors_shift = 9,
78  },
79  {
80  /* AT25SF161 */
81  .id[0] = 0x8601,
82  .nr_sectors_shift = 9,
83  },
84  {
85  /* AT25DQ321 */
86  .id[0] = 0x8700,
87  .nr_sectors_shift = 10,
88  },
89 };
90 
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),
99 };
const struct spi_flash_vendor_info spi_flash_adesto_vi
Definition: adesto.c:91
static const struct spi_flash_part_id flash_table[]
Definition: adesto.c:28
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define VENDOR_ID_ADESTO
Definition: spi-generic.h:18
const struct spi_flash_ops_descriptor spi_flash_pp_0x20_sector_desc
Definition: spi_flash.c:793