1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Driver for Adesto Technologies SPI flash
8 #include <commonlib/helpers.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
[] = {
32 .nr_sectors_shift
= 12,
35 /* AT25DF081A Yes, 81A id < 81 */
37 .nr_sectors_shift
= 8,
42 .nr_sectors_shift
= 8,
47 .nr_sectors_shift
= 9,
52 .nr_sectors_shift
= 9,
57 .nr_sectors_shift
= 10,
62 .nr_sectors_shift
= 10,
67 .nr_sectors_shift
= 11,
72 .nr_sectors_shift
= 8,
77 .nr_sectors_shift
= 9,
82 .nr_sectors_shift
= 9,
87 .nr_sectors_shift
= 10,
91 const struct spi_flash_vendor_info spi_flash_adesto_vi
= {
92 .id
= VENDOR_ID_ADESTO
,
94 .sector_size_kib_shift
= 2,
95 .match_id_mask
[0] = 0xffff,
97 .nr_part_ids
= ARRAY_SIZE(flash_table
),
98 .desc
= &spi_flash_pp_0x20_sector_desc
,