• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  * Description: Provides flash DOSILICON Configuration information. \n
16  *
17  * History: \n
18  * 2022-11-15, Create file. \n
19  */
20 #ifndef FLASH_DOSILICON_CONFIG_H
21 #define FLASH_DOSILICON_CONFIG_H
22 
23 /**
24  * @defgroup drivers_driver_flash_dosilicon_config Flash Dosilicon Config
25  * @ingroup  drivers_driver_flash
26  * @{
27  */
28 
29 #include "flash_common_config.h"
30 
31 /* DOSILICON enter qspi mode cmd config. */
32 /* FM25M64/FM25M4AA  DOSILICON flash config. */
33 static flash_cmd_exe_t g_dosilicon_fm25m64_enter_qspi_mode_cmd[] = {
34     /* Write enable for volatile status register. */
35     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD, 1, { 0x50 } },
36     /* Write volatile configuration register, config XIP disable. */
37     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD, 3, { 0x01, 0x00, 0x02 } },
38     /* Wait config done. */
39     { FLASH_CMD_TYPE_PROCESSING, HAL_SPI_FRAME_FORMAT_STANDARD, 3, { FLASH_RDSR1_CMD, 0, 0 } },
40     /* Enable QPI mode. Set the dummy cycle to 4, with the maximum read frequency being 80MHZ. */
41     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD, 1, { 0x38 } },
42     /* The END command, will not be executed and need return. */
43     { FLASH_CMD_TYPE_END, HAL_SPI_FRAME_FORMAT_MAX_NUM,   0, { 0 } }
44 };
45 
46 /* DS25M4AB DOSILICON flash config. */
47 static flash_cmd_exe_t g_dosilicon_ds25m4ab_enter_qspi_mode_cmd[] = {
48     /* Write enable for volatile status register. */
49     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD,  1, { 0x50 } },
50     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD,  3, { 0x01, 0x00, 0x02 } },
51     /* Enable QPI mode. */
52     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_STANDARD,  1, { 0x38 } },
53     /* Set the dummy cycle to 6, with the maximum read frequency being 108MHZ. */
54     { FLASH_CMD_TYPE_CMD, HAL_SPI_FRAME_FORMAT_QUAD, 2, { 0xC0, 0x20 } },
55     /* The END command, will not be executed and need return. */
56     { FLASH_CMD_TYPE_END, HAL_SPI_FRAME_FORMAT_MAX_NUM,    0, { 0 } }
57 };
58 
59 
60 /* DOSILICON enter xip mode config. */
61 /* FM25M64 DOSILICON flash config. */
62 static flash_qspi_xip_config_t g_dosilicon_fm25m64_config = {
63     /* The config that before enter XIP mode. */
64     WAIT_CYCLES_4,
65     HAL_SPI_INST_LEN_8,
66     HAL_SPI_ADDR_LEN_24,
67     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
68     /* The config that after enter XIP mode. */
69     WAIT_CYCLES_4,
70     HAL_SPI_INST_LEN_8,
71     HAL_SPI_ADDR_LEN_24,
72     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
73     /* XIP 32bit addr & wrap config. */
74     false,
75     false,
76 };
77 
78 /* FM25M4AA DOSILICON flash config. */
79 static flash_qspi_xip_config_t g_dosilicon_fm25m4aa_config = {
80     /* The config that before enter XIP mode. */
81     WAIT_CYCLES_4,
82     HAL_SPI_INST_LEN_8,
83     HAL_SPI_ADDR_LEN_24,
84     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
85     /* The config that after enter XIP mode. */
86     WAIT_CYCLES_4,
87     HAL_SPI_INST_LEN_8,
88     HAL_SPI_ADDR_LEN_24,
89     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
90     /* XIP 32bit addr & wrap config. */
91     false,
92     false,
93 };
94 
95 /* DS25M4AB DOSILICON flash config. */
96 static flash_qspi_xip_config_t g_dosilicon_ds25m4ab_config = {
97     /* The config that before enter XIP mode. */
98     WAIT_CYCLES_6,
99     HAL_SPI_INST_LEN_8,
100     HAL_SPI_ADDR_LEN_24,
101     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
102     /* The config that after enter XIP mode. */
103     WAIT_CYCLES_6,
104     HAL_SPI_INST_LEN_8,
105     HAL_SPI_ADDR_LEN_24,
106     HAL_SPI_TRANS_TYPE_INST_Q_ADDR_Q,
107     /* XIP 32bit addr & wrap config. */
108     false,
109     false,
110 };
111 
112 /**
113   * @}
114   */
115 #endif