MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
flash_mx25v8035f.h
Go to the documentation of this file.
1/*
2
3Module: flash_mx25v8035f.h
4
5Function:
6 Definitions for Macronix MX258035F flash chip.
7
8Copyright and License:
9 This file copyright (C) 2021 by
10
11 MCCI Corporation
12 3520 Krums Corners Road
13 Ithaca, NY 14850
14
15 See accompanying LICENSE file for copyright and license information.
16
17Author:
18 ChaeHee Won, MCCI Corporation
19 Terry Moore, MCCI Corporation March 2021
20
21*/
22
23#ifndef _flash_mx25v8035f_h_
24#define _flash_mx25v8035f_h_ /* prevent multiple includes */
25
26#pragma once
27
28#include <stdint.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* MX25V8035F commands */
36#define MX25V8035F_CMD_READ 0x03u /* Read */
37#define MX25V8035F_CMD_FAST_READ 0x0Bu /* Fast read */
38#define MX25V8035F_CMD_PP 0x02u /* Page Program */
39#define MX25V8035F_CMD_SE 0x20u /* Sector Erase */
40#define MX25V8035F_CMD_BE_32K 0x52u /* Block Erase 32KB */
41#define MX25V8035F_CMD_BE 0xD8u /* Block Erase 64KB */
42#define MX25V8035F_CMD_CE 0x60u /* Chip Erase */
43#define MX25V8035F_CMD_RDSFDP 0x5Au /* Read SFDP */
44#define MX25V8035F_CMD_WREN 0x06u /* Write Enable */
45#define MX25V8035F_CMD_WRDI 0x04u /* Write Disable */
46#define MX25V8035F_CMD_RDSR 0x05u /* Read Status Register */
47#define MX25V8035F_CMD_RDCR 0x15u /* Read Configuration Register */
48#define MX25V8035F_CMD_WRSR 0x01u /* Write Status Register */
49#define MX25V8035F_CMD_SUSPEND 0x75u /* PGM/ERS Suspend */
50#define MX25V8035F_CMD_RESUME 0x7Au /* PGM/ERS Resume */
51#define MX25V8035F_CMD_DP 0xB9u /* Deep Power Down */
52#define MX25V8035F_CMD_SBL 0xC0u /* Set Burst Length */
53#define MX25V8035F_CMD_RDID 0x9Fu /* Read Identification */
54#define MX25V8035F_CMD_RES 0xABu /* Read Electronic ID */
55#define MX25V8035F_CMD_REMS 0x90u /* Read Electronic Manu & Dev ID */
56#define MX25V8035F_CMD_ENSO 0xB1u /* Enter Secured OTP */
57#define MX25V8035F_CMD_EXSO 0xC1u /* Exit Secured OTP */
58#define MX25V8035F_CMD_RDSCUR 0x2Bu /* Read Security Register */
59#define MX25V8035F_CMD_WRSCUR 0x2Fu /* Write Security Register */
60#define MX25V8035F_CMD_NOP 0x00u /* No operation */
61#define MX25V8035F_CMD_RSTEN 0x66u /* Reset Enable */
62#define MX25V8035F_CMD_RST 0x99u /* Reset Memory */
63#define MX25V8035F_CMD_RRE 0xFFu /* Release Read Enhanced */
64
65/* MX25V8035F status bits */
66#define MX25V8035F_STS_WIP (1u << 0) /* Write In Progress */
67#define MX25V8035F_STS_WEL (1u << 1) /* Write Enable Latch */
68#define MX25V8035F_STS_BP_MASK (15u << 2) /* the BP bits */
69#define MX25V8035F_STS_QE (1u << 6) /* Quad Enable */
70#define MX25V8035F_STS_SRWD (1u << 7) /* Status Regster Write Protect */
71
72/* MX25V8035F configuration bits */
73#define MX25V8035F_CFG_TB (1u << 3) /* 0=Top, 1=Bottom area protect */
74
75/* MX25V8035F Security bits */
76#define MX25V8035F_SCUR_OTP (1u << 0) /* 1=Factory lock (2nd 4Kb) */
77#define MX25V8035F_SCUR_LDSO (1u << 1) /* 1=Lock-Down (1st 4Kb) */
78#define MX25V8035F_SCUR_PSB (1u << 2) /* Program Suspend */
79#define MX25V8035F_SCUR_ESB (1u << 3) /* Erase Suspend */
80#define MX25V8035F_SCUR_P_FAIL (1u << 5) /* Program Failed */
81#define MX25V8035F_SCUR_E_FAIL (1u << 6) /* Erase Failed */
82
83#define MX25V8035F_MANUFACTURER_ID 0xC2u
84#define MX25V8035F_DEVICE_ID 0x2314u
85
86#define MX25V8035F_PAGE_SIZE UINT32_C(256)
87#define MX25V8035F_SECTOR_SIZE UINT32_C(4096)
88#define MX25V8035F_PAGE_PER_SECTOR (MX25V8035F_SECTOR_SIZE / MX25V8035F_PAGE_SIZE)
89#define MX25V8035F_BLOCK32_SIZE (UINT32_C(32) * 1024)
90#define MX25V8035F_SECTOR_PER_BLOCK32 (MX25V8035F_BLOCK32_SIZE / MX25V8035F_SECTOR_SIZE)
91#define MX25V8035F_PAGE_PER_BLOCK32 (MX25V8035F_BLOCK32_SIZE / MX25V8035F_PAGE_SIZE)
92#define MX25V8035F_BLOCK64_SIZE (UINT32_C(64) * 1024)
93#define MX25V8035F_SECTOR_PER_BLOCK64 (MX25V8035F_BLOCK64_SIZE / MX25V8035F_SECTOR_SIZE)
94#define MX25V8035F_PAGE_PER_BLOCK64 (MX25V8035F_BLOCK64_SIZE / MX25V8035F_PAGE_SIZE)
95
96/* protection level values: MSB is the "TB" value, bits 0..3 are the BP bits */
97#define MCCI_BOOTLOADER_MX25V8035F_PL_NONE 0x00 /* no blocks protected */
98#define MCCI_BOOTLOADER_MX25V8035F_PL_TOP_1 0x01 /* protect 1 block at top */
99#define MCCI_BOOTLOADER_MX25V8035F_PL_TOP_2 0x02 /* protect 2 blocks at top */
100#define MCCI_BOOTLOADER_MX25V8035F_PL_TOP_4 0x03 /* protect 4 blocks at top */
101#define MCCI_BOOTLOADER_MX25V8035F_PL_TOP_8 0x04 /* protect 8 blocks at top */
102#define MCCI_BOOTLOADER_MX25V8035F_PL_BASE_1 0x81 /* protect 1 block at bottom */
103#define MCCI_BOOTLOADER_MX25V8035F_PL_BASE_2 0x82 /* protect 2 blocks at bottom */
104#define MCCI_BOOTLOADER_MX25V8035F_PL_BASE_4 0x83 /* protect 4 blocks at bottom */
105#define MCCI_BOOTLOADER_MX25V8035F_PL_BASE_8 0x84 /* protect 8 blocks at bottom */
106#define MCCI_BOOTLOADER_MX25V8035F_PL_ALL 0x8F /* protect 16 blocks */
107
108#define MCCI_BOOTLOADER_MX25V8035F_PAGE_BASE(a) ((a) & ~(MX25V8035F_PAGE_SIZE - 1))
109#define MCCI_BOOTLOADER_MX25V8035F_SECTOR_BASE(a) ((a) & ~(MX25V8035F_SECTOR_SIZE - 1))
110#define MCCI_BOOTLOADER_MX25V8035F_BLOCK32_BASE(a) ((a) & ~(MX25V8035F_BLOCK32_SIZE - 1))
111#define MCCI_BOOTLOADER_MX25V8035F_BLOCK64_BASE(a) ((a) & ~(MX25V8035F_BLOCK64_SIZE - 1))
112
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* _flash_mx25v8035f_h_ */